Skip to content

Commit

Permalink
Merge branch 'Modernize_template'
Browse files Browse the repository at this point in the history
  • Loading branch information
DynastyKids committed Jan 9, 2024
2 parents 1cb7bd6 + 2e88656 commit ad0956a
Show file tree
Hide file tree
Showing 15 changed files with 1,290 additions and 461 deletions.
4 changes: 2 additions & 2 deletions Modernize/pages/products/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ document.querySelector("#deleteRowModal").addEventListener('show.bs.modal', (ev)
document.querySelector("#deleteModalConfirmBtn").textContent = "Updating"
result = (itemStatus === "true" ? await updateRecordById(itemId, {"active": false}) : await updateRecordById(itemId, {"active": true}))
if (result.acknowledged || result.ok === 1) {
location.reload()
await fetchTablesData()
} else {
document.querySelector("#deleteRowModal .modal-body p").innerText = "Error happened while on updates."
}
Expand Down Expand Up @@ -340,7 +340,7 @@ document.querySelector("#editRowModal").addEventListener('show.bs.modal', async
// 当最后确认提交成功则dismiss并回弹成功信息
if (updateResult.ok === 1 || updateResult.acknowledged) {
bootstrap.Modal.getInstance(document.querySelector("#editRowModal")).hide()
window.location.reload()
await fetchTablesData()
} else {
document.querySelector("#deleteRowModal .modal-body p").innerText = "Error happened while on updates."
}
Expand Down
152 changes: 93 additions & 59 deletions Modernize/pages/sessions/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>List Sessions - Warehouse Electron (N)</title>
<title>List Snapshots - Warehouse Electron (N)</title>
<link rel="shortcut icon" type="image/png" href="../../assets/images/logos/favicon.png"/>
<link rel="stylesheet" href="../../assets/css/styles.min.css"/>
</head>
Expand Down Expand Up @@ -40,26 +39,32 @@
<div class="card-body px-4 py-3">
<div class="row align-items-center">
<div class="col-12">
<h4 class="fw-semibold mb-8">Sessions</h4>
<h4 class="fw-semibold mb-8">Snapshots</h4>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a class="text-muted text-decoration-none" href="../home/index.html">Home</a>
</li>
<li class="breadcrumb-item" aria-current="page">Sessions</li>
<li class="breadcrumb-item" aria-current="page">Snapshots</li>
</ol>
</nav>
</div>
</div>
</div>
</div>
<div id="alertAnchor"></div>
<div class="card">
<div class="card-body">
<h5 class="card-title fw-semibold mb-4">Actions</h5>
<p>Session has been renamed to Snapshots. It can create a snapshot of current stocks for stock-take actions, provide a frozen record of
stocks.</p>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="check_hiddenSessions">
<label class="form-check-label" for="check_hiddenSessions">Show Hidden Snapshots</label>
</div>
<div class="list-group-item-action">
<a class="mb-0 ms-2" href="#" id="act_listchange" data-value="all">List All Sessions</a>
<a class="mb-0 ms-2" href="#" id="act_reloadTable">Refresh Session List</a>
<a class="mb-0 ms-2" href="#" id="act_addSession" data-bs-toggle="modal" data-bs-target="#addSessionModal">Add session</a>
<a class="mb-0 ms-2" href="#" id="act_reloadTable">Refresh Snapshot List</a>
<a class="mb-0 ms-2" href="#" id="act_addSession" data-bs-toggle="modal" data-bs-target="#addSessionModal">Add a snapshot</a>
<div id="loadingStatus">
<span class="spinner-border" role="status" id="loadingSpinners"></span>
<span class="" id="loadingTableText">Loading data...</span>
Expand All @@ -69,72 +74,101 @@ <h5 class="card-title fw-semibold mb-4">Actions</h5>
<hr>
<div class="card-body">
<h5 class="card-title fw-semibold mb-4">List of Sessions</h5>
<p class="mb-0"><table class="table" id="table">
<thead class="thead-light">
<tr>
<th scope="col">Session ID</th>
<th scope="col">Start Time</th>
<th scope="col">End Time</th>
<th scope="col">Setup Time</th>
<th scope="col">Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th scope="col">Session ID</th>
<th scope="col">Start Time</th>
<th scope="col">End Time</th>
<th scope="col">Setup Time</th>
<th scope="col">Action</th>
</tr>
</tfoot>
<tbody id="activeTBody">
</tbody>
</table>
<p class="mb-0">
<table class="table" id="table">
<thead class="thead-light">
<tr>
<th scope="col">Session ID</th>
<th scope="col">Snapshot Time</th>
<th scope="col">Stock Quantity / Value</th>
<th scope="col">Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th scope="col">Session ID</th>
<th scope="col">Snapshot Time</th>
<th scope="col">Stock Quantity / Value</th>
<th scope="col">Action</th>
</tr>
</tfoot>
<tbody id="activeTBody">
</tbody>
</table>
</div>
</div>
</div>
</div>

<div class="modal fade" id="addSessionModal" tabindex="-1" aria-labelledby="addSessionModalLabel" aria-hidden="true">
<div class="modal-dialog model-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addSessionModalLabel">Create Session</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p class="mb-2">Please record down the Session code and prepare for use in client page.</p>
<form>
<div class="col-12">
<label for="addModal_sessioncode" class="form-label">Session Code:</label>
<input type="text" class="form-control col-6" id="addModal_sessioncode" disabled value="">
</div>
<div class="col-12">
<label for="addModal_sessioncode" class="form-label">Session Start:</label>
<input type="datetime-local" class="form-control col-6" id="addModal_sessionStart" value="">
</div>
<div class="col-12">
<label for="addModal_sessioncode" class="form-label">Session End:</label>
<input type="datetime-local" class="form-control col-6" id="addModal_sessionEnd" value="">
</div>
</form>
</div>
<div class="modal fade" id="addSessionModal" tabindex="-1" aria-labelledby="addSessionModalLabel" aria-hidden="true">
<div class="modal-dialog model-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addSessionModalLabel">Create Session</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p class="mb-2">Please record down the Session code and prepare for use in client page.</p>
<form>
<div class="col-12">
<label for="addModal_sessioncode" class="form-label">Session Code:</label>
<input type="text" class="form-control col-6" id="addModal_sessioncode" disabled value="">
</div>
<div class="col-12">
<label for="addModal_snapshotTime" class="form-label">Snapshot Time:</label>
<input type="datetime-local" class="form-control col-6" id="addModal_snapshotTime" value="">
</div>
</form>
<div class="mt-2 mb-2 col-12">
<label class="form-label">Status:</label>
<span id="addModal_statusText">Ready</span>
</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="addSessionModal_btnsubmit" disabled>Confirm</button>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" id="addSessionModal_btnCancel" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="addSessionModal_btnSubmit" disabled>Confirm</button>
</div>
</div>
</div>
</div>

<div class="modal fade" id="removeModal" tabindex="-1" aria-labelledby="removeModalLabel" aria-hidden="true">
<div class="modal-dialog model-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="removeModalLabel">Remove Snapshot Records</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p class="mb-2" id="removeModal_mainText">?</p>
<form>
<input type="text" class="form-control" id="removeModal_operation" hidden value="">
<input type="text" class="form-control" id="removeModal_dataId" hidden value="">
<input type="text" class="form-control" id="removeModal_sessionCode" hidden value="">
</form>
</div>
<div class="modal-footer">
<div class="mt-2 mb-2 col-12">
<label class="form-label">Status:</label>
<span id="removeModal_statusText">Awaiting User Response</span>
</div>
<button type="button" class="btn btn-secondary" id="removeModal_btnCancel" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" id="removeModal_btnConfirm">Confirm</button>
</div>
</div>
</div>
</div>
<script> window.$ = window.jQuery = require('jquery');</script>
<script src="../../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="../../assets/js/sidebarmenu.js"></script>
<script src="../../assets/js/app.min.js"></script>
<script src="../../../node_modules/simplebar/dist/simplebar.min.js"></script>
<script src="../../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="../../assets/js/app.min.js"></script>

<script src="./index.js"></script>
</body>

<style>
.actions{
margin-right: 5px;
}
</style>
</html>
Loading

0 comments on commit ad0956a

Please sign in to comment.