Skip to content

Commit

Permalink
Merge branch 'ExtWebpages'
Browse files Browse the repository at this point in the history
  • Loading branch information
DynastyKids committed Jan 22, 2024
2 parents cb80e2a + b4b61af commit 786babc
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 66 deletions.
66 changes: 54 additions & 12 deletions public/labelgenerator.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Label Generator - Warehouse Electron</title>
<link href="/library/bootstrap.min.css" rel="stylesheet" />
<link href="/library/bootstrap.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="/library/tabler/tabler-icons.min.css">
</head>
<body>
<div class="container-fluid">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="/">Stock-take Electron</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
Expand All @@ -27,10 +28,14 @@
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="labelgenerator.html">Generate Labels</a></li>
<li><a class="dropdown-item" href="#">Check prefill labels (Unavailable)</a></li>
<li><hr class="dropdown-divider"></li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="stocks/stocks.html">Stock Management</a></li>
<li><a class="dropdown-item" href="#">Add Stock (Unavailable)</a></li>
<li><hr class="dropdown-divider"></li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="#">Scan QR Code(Unavailable)</a></li>
</ul>
</li>
Expand All @@ -56,17 +61,23 @@ <h1>Label Generator</h1>
<button type="button" class="btn-close me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<div id="loadingAnimation" style="display: flex">
<div class="loader"></div>
<p>Fetching Products List, Please Wait</p>
</div>
<div class="container-fluid">
<table class="table">
<thead><tr>
<thead>
<tr>
<th class="rowid d-none d-sm-table-cell">No.</th>
<th class="d-inline-block d-sm-table-cell">Product Name</th>
<th class="d-inline-block d-sm-table-cell">Quantity</th>
<th class="d-inline-block d-sm-table-cell">Unit</th>
<th class="d-inline-block d-sm-table-cell">Expire date</th>
<th class="d-inline-block d-sm-table-cell">Copies</th>
<th class="d-inline-block d-sm-table-cell"></th>
</tr></thead>
</tr>
</thead>
<tbody>
</tbody>
</table>
Expand All @@ -91,16 +102,16 @@ <h1>Label Generator</h1>
<hr>
<h5>Optional</h5>
<div class="row mb-3">
<!-- <div class="col-sm-3 col-6">-->
<!-- <label for="fileinput_packaging">Manifest File</label>-->
<!-- <input type="file" id="fileinput_manifest" class="form-control">-->
<!-- </div>-->
<!-- <div class="col-sm-3 col-6">-->
<!-- <label for="fileinput_packaging">Manifest File</label>-->
<!-- <input type="file" id="fileinput_manifest" class="form-control">-->
<!-- </div>-->
<div class="col-sm-4 col-12">
<label>Purchase Order No.</label>
<input type="text" class="form-control" placeholder="" id="input_purchaseorder">
</div>
</div>
<!-- <button class="btn btn-secondary" id="file_load">Load File</button>-->
<!-- <button class="btn btn-secondary" id="file_load">Load File</button>-->
</div>
</div>
<datalist id="productSuggestions"></datalist>
Expand All @@ -127,14 +138,45 @@ <h5>Optional</h5>
<script src="labelgenerator.js"></script>

<style>
@media (max-width: 576px) { /* For small devices */
@media (max-width: 576px) {
/* For small devices */
.table thead th.d-block,
.table tbody td.d-block {
display: block;
width: 100%;
box-sizing: border-box;
}
}

/* Loading Animation*/
.loader {
width: 40px;
aspect-ratio: 1;
--c: no-repeat radial-gradient(farthest-side, #514b82 92%, #0000);
background: var(--c) 50% 0,
var(--c) 50% 100%,
var(--c) 100% 50%,
var(--c) 0 50%;
background-size: 7px 7px;
animation: l18 1s infinite;
position: relative;
}

.loader::before {
content: "";
position: absolute;
inset: 0;
margin: 3px;
background: repeating-conic-gradient(#0000 0 35deg, #514b82 0 90deg);
-webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 3px), #000 0);
border-radius: 50%;
}

@keyframes l18 {
100% {
transform: rotate(.5turn)
}
}
</style>
</body>
</html>
1 change: 1 addition & 0 deletions public/labelgenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ document.addEventListener("DOMContentLoaded", function (ev) {
(new bootstrap.Toast(toast)).show();
}
}
document.querySelector("#loadingAnimation").style = "display: none"
})

function resetTimer() {
Expand Down
48 changes: 0 additions & 48 deletions public/layout.html

This file was deleted.

28 changes: 25 additions & 3 deletions public/stocks/stocks.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,14 @@ <h6>Product Information:</h6>
</form>
<p></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="editModal_btnSubmit" disabled>Submit</button>
<div class="modal-footer justify-content-between d-flex">
<div>
<button type="button" class="btn btn-danger" id="editModal_btnDelete" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#deleteModal" data-bs-labelId="">Delete</button>
</div>
<div>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="editModal_btnSubmit" disabled>Submit</button>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -196,6 +201,23 @@ <h5 class="modal-title" id="removeModalLabel">Remove Item</h5>
</div>
</div>
</div>
<div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true">
<div class="modal-dialog model-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="deleteModalLabel">Delete Item</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p class="mb-2">It is not safe to use delete method from here, please use desktop's stock manage page to delete this stock.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-info" id="deleteModal_btnReturn" data-bs-target="#editModal" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-itemId="">Back to Edit</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Dismiss</button>
</div>
</div>
</div>
</div>
<script src="../library/jquery-3.7.1.min.js"></script>
<script src="../library/bootstrap.bundle.min.js"></script>
<script src="../library/datatables/datatables.js"></script>
Expand Down
12 changes: 9 additions & 3 deletions public/stocks/stocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ let editModal = document.querySelector("#editModal")
editModal.addEventListener("show.bs.modal", async function (ev) {
let requestLabelId = ev.relatedTarget.getAttribute("data-bs-labelId")
editModal.querySelector("#editModal_labelId").value = requestLabelId
editModal.querySelector("#editModal_btnSubmit").disabled = true
editModal.querySelector("#editModal_btnSubmit").textContent = "Submit"
editModal.querySelector("#editModal .modal-title").textContent = `Loading Product Information`

editModal.querySelector(".modal-title").textContent = `Loading Product Information`
editModal.querySelector("#editModal_btnDelete").setAttribute("data-bs-labelId",requestLabelId)
let stockInfo = await fetchStockByLabelid(requestLabelId)
if (Array.isArray(stockInfo) && stockInfo.length > 0) {
currentEditModalItem = stockInfo[0]
writeModalEdit(stockInfo[0])
editModal.querySelector("#editModal_btnSubmit").disabled = false
}
})
editModal.querySelector("#editModal_btnSubmit").addEventListener("click", async (ev) => {
Expand Down Expand Up @@ -276,6 +276,12 @@ document.querySelector("#removeModalYes").addEventListener("click", async functi
}
})

let deleteModal = document.querySelector("#deleteModal")
deleteModal.addEventListener("show.bs.modal", (ev)=>{
var itemId = ev.relatedTarget.getAttribute("data-bs-itemId")
deleteModal.querySelector("#deleteModal_btnReturn").setAttribute("data-bs-itemId", itemId)
})

function createAlert(status, alertText){
let alertElement = document.createElement("div")
alertElement.setAttribute("role","alert")
Expand Down

0 comments on commit 786babc

Please sign in to comment.