Skip to content

Commit db4f965

Browse files
committed
27 Jan 2024
1) Library updates - Bootstrap, JWT, WebAuthn, webpush. 2) A couple of general UI updates. 3) QRcode scanner for movement and check pages are now merged into PAGE-qrscan.js.
1 parent 3ec4d6b commit db4f965

File tree

127 files changed

+1069
-801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+1069
-801
lines changed

CB-worker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ self.addEventListener("install", evt => {
1515
"assets/PAGE-import.js",
1616
"assets/PAGE-items-check.js",
1717
"assets/PAGE-items.js",
18+
"assets/PAGE-login.css",
1819
"assets/PAGE-login.js",
1920
"assets/PAGE-move.js",
2021
"assets/PAGE-nfc.js",
@@ -31,6 +32,7 @@ self.addEventListener("install", evt => {
3132
"assets/html5-qrcode.min.js",
3233
"assets/qrcode.min.js",
3334
"assets/PAGE-qrscan.css",
35+
"assets/PAGE-qrscan.js",
3436
"assets/bootstrap.min.css",
3537
"assets/bootstrap.min.css.map",
3638
"assets/favicon.png",

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Storage Boxx is an open-source PHP Inventory Management System. With a built-in
77
2) Create item NFC tags, built-in NFC scanner.
88
3) Passwordless login - NFC and Web Authentication (Biometric, PIN, Face Recognition)
99
4) Stock level monitoring, push notifications on low stock.
10-
5) Installable progressive web app.
10+
5) Batch and expiration tracking.
11+
6) Installable progressive web app.
1112
<br><br>
1213

1314
## :camera: SCREENSHOTS
@@ -27,21 +28,27 @@ Storage Boxx is an open-source PHP Inventory Management System. With a built-in
2728
3) PHP MYSQL PDO Extension
2829
4) PHP OPENSSL Extension
2930
5) At least PHP 8.0
30-
6) Take note, Weccam, NFC and Passwordless (Web Authentication) support depends on the user's device and browser.
31+
6) Take note - Webcam, NFC and Passwordless (Web Authentication) support depends on the user's device and browser.
3132
<br><br>
3233

3334
## :floppy_disk: INSTALLATION
34-
1) Just copy/unzip into your `http` folder.
35+
1) Copy & unzip into your `http` folder.
3536
2) Access `http://your-site.com/` in your browser and walk through the installer.
3637
3) If you want, add the [optional AI Assistant](https://github.com/code-boxx/Storage-Boxx-AI) after the installation.
3738
<br><br>
3839

40+
## :star: SUPPORT
41+
1) Just give this project a star. That will indirectly drive more traffic a little bit. :wink:
42+
2) [Sponsor this project](https://github.com/sponsors/code-boxx). Even a small one time amount helps.
43+
<br><br>
44+
3945
## :bulb: DOCUMENTATION
4046
1) [How To Use](https://code-boxx.com/storage-boxx-php-inventory-system/#sec-use)
4147
2) [FAQ](https://code-boxx.com/core-boxx-php-framework/#sec-faq)
4248
3) [For The Developers](https://code-boxx.com/storage-boxx-php-inventory-system/#sec-dev)
49+
<br><br>
4350

44-
## :electric_plug: FRAMEWORKS
51+
## :electric_plug: CREDITS AND FRAMEWORKS USED
4552
1) PHP Packages
4653
- [Core Boxx](https://code-boxx.com/core-boxx-php-framework/)
4754
- [PHP Web Push](https://github.com/web-push-libs/web-push-php)
@@ -55,10 +62,6 @@ Storage Boxx is an open-source PHP Inventory Management System. With a built-in
5562
- [csv.js](https://github.com/okfn/csv.js/)
5663
<br><br>
5764

58-
## :star: SUPPORT
59-
Like this project? Just give it a star. That will indirectly help grow my blog a little bit. :wink:
60-
<br><br>
61-
6265
## :newspaper: LICENSE
6366
Copyright by Code Boxx
6467

assets/PAGE-check.js

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ var check = {
44
hSKU : null, hBatch : null, // html sku & batch fields
55
hnBtn : null, hnStat : null, // html nfc button & status
66
sku : null, batch: null, // current item & batch
7-
qrscan : null, // qr scanner
87
pg : 1, // current page
98

109
// (B) INIT
@@ -65,47 +64,13 @@ var check = {
6564

6665
// (C) "SWITCH ON" QR SCANNER
6766
qron : () => {
68-
// (C1) INITIALIZE SCANNER
69-
if (check.qrscan==null) {
70-
check.qrscan = new Html5QrcodeScanner("qr-cam", { fps: 10, qrbox: 250 });
71-
check.qrscan.render((txt, res) => {
72-
check.qroff();
73-
try {
74-
let item = JSON.parse(txt);
75-
check.hSKU.value = item.S;
76-
check.hBatch.value = item.B;
77-
check.pre();
78-
} catch (e) {
79-
console.error(e);
80-
cb.modal("Invalid QR Code", "Failed to parse scanned QR code.");
81-
}
82-
});
67+
if (qrscan.scanner==null) {
68+
qrscan.init(check.hSKU, check.hBatch, check.pre);
8369
}
84-
85-
// (C2) SHOW SCANNER
86-
cb.transit(() => {
87-
document.getElementById("qr-wrapA").classList.remove("d-none");
88-
window.scrollTo(0, 0);
89-
});
90-
},
91-
92-
// (D) "SWITCH OFF" QR SCANNER
93-
qroff : () => {
94-
// (D1) SEEMINGLY NO SMART WAY TO "STOP SCANNING"
95-
let stop = document.getElementById("html5-qrcode-button-camera-stop"),
96-
wrap = document.getElementById("qr-wrapA");
97-
if (stop != null) {
98-
if (stop.style.display!="none") { stop.click(); }
99-
}
100-
101-
// (D2) HIDE SCANNER
102-
cb.transit(() => {
103-
wrap.classList.add("d-none");
104-
window.scrollTo(0, 0);
105-
});
70+
qrscan.show();
10671
},
10772

108-
// (E) CHECK VALID SKU BEFORE LOADING HISTORY LIST
73+
// (D) CHECK VALID SKU BEFORE LOADING HISTORY LIST
10974
pre : () => {
11075
cb.api({
11176
mod : "items", act : "check",
@@ -124,7 +89,7 @@ var check = {
12489
return false;
12590
},
12691

127-
// (F) LOAD MOVEMENT HISTORY "MAIN PAGE"
92+
// (E) LOAD MOVEMENT HISTORY "MAIN PAGE"
12893
go : () => cb.load({
12994
page : "check-main", target : "cb-page-2",
13095
data : {
@@ -137,7 +102,7 @@ var check = {
137102
}
138103
}),
139104

140-
// (G) SHOW ITEM MOVEMENT HISTORY
105+
// (F) SHOW ITEM MOVEMENT HISTORY
141106
list : () => cb.load({
142107
page : "check/list", target : "check-list",
143108
data : {
@@ -147,7 +112,7 @@ var check = {
147112
}
148113
}),
149114

150-
// (H) GO TO PAGE
115+
// (G) GO TO PAGE
151116
// pg : int, page number
152117
goToPage : pg => { if (pg!=check.pg) {
153118
check.pg = pg;

assets/PAGE-login.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
:root {
2+
--bs-light-rgb: 150,150,150;
3+
}
4+
#cb-body {
5+
align-items: center;
6+
}
7+
#login-r {
8+
background-size: contain !important;
9+
min-height: 380px;
10+
}

assets/PAGE-move.js

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ var move = {
55
hSKU : null, hBatch : null, // sku, batch
66
hnBtn : null, hnStat : null, // nfc
77
hlQty : null, hlDir : null, hlSKU : null, hlNote : null, // last entry
8-
qrscan : null, // qr scanner
98

109
// (B) INIT
1110
init : () => {
@@ -73,48 +72,16 @@ var move = {
7372

7473
// (C) "SWITCH ON" QR SCANNER
7574
qron : () => {
76-
// (C1) INITIALIZE SCANNER
77-
if (move.qrscan==null) {
78-
move.qrscan = new Html5QrcodeScanner("qr-cam", { fps: 10, qrbox: 250 });
79-
move.qrscan.render((txt, res) => {
80-
move.qroff();
81-
try {
82-
let item = JSON.parse(txt);
83-
move.hSKU.value = item.S;
84-
move.hBatch.value = item.B;
85-
if (move.hForm.checkValidity()) { move.save(); }
86-
else { move.hForm.reportValidity(); }
87-
} catch (e) {
88-
console.error(e);
89-
cb.modal("Invalid QR Code", "Failed to parse scanned QR code.");
90-
}
75+
if (qrscan.scanner==null) {
76+
qrscan.init(move.hSKU, move.hBatch, () => {
77+
if (move.hForm.checkValidity()) { move.save(); }
78+
else { move.hForm.reportValidity(); }
9179
});
9280
}
93-
94-
// (C2) SHOW SCANNER
95-
cb.transit(() => {
96-
document.getElementById("qr-wrapA").classList.remove("d-none");
97-
window.scrollTo(0, 0);
98-
});
99-
},
100-
101-
// (D) "SWITCH OFF" QR SCANNER
102-
qroff : () => {
103-
// (D1) SEEMINGLY NO SMART WAY TO "STOP SCANNING"
104-
let stop = document.getElementById("html5-qrcode-button-camera-stop"),
105-
wrap = document.getElementById("qr-wrapA");
106-
if (stop != null) {
107-
if (stop.style.display!="none") { stop.click(); }
108-
}
109-
110-
// (D2) HIDE SCANNER
111-
cb.transit(() => {
112-
wrap.classList.add("d-none");
113-
window.scrollTo(0, 0);
114-
});
81+
qrscan.show();
11582
},
11683

117-
// (E) SAVE MOVEMENT
84+
// (D) SAVE MOVEMENT
11885
save : () => {
11986
cb.api({
12087
mod : "move", act : "saveM",

assets/PAGE-qrscan.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
var qrscan = {
2+
// (A) PROPERTIES
3+
scanner : null, // scanner object
4+
5+
// (B) INITIALIZE
6+
init : (hSKU, hBatch, after) => {
7+
// (B1) ATTACH HTML
8+
let hScan = document.createElement("div");
9+
hScan.id = "qr-wrapA";
10+
hScan.className = "d-none tran-zoom bg-dark";
11+
hScan.innerHTML = `<div id="qr-wrapB">
12+
<h3 class="mb-3 text-white">SCAN QR CODE</h3>
13+
<div id="qr-cam" class="bg-light"></div>
14+
<button type="button" class="mt-4 btn btn-danger d-flex-inline" onclick="qrscan.hide()">
15+
<i class="ico-sm icon-cross"></i> Cancel
16+
</button>
17+
</div>`;
18+
document.body.appendChild(hScan);
19+
20+
// (B2) CREATE QR SCANNER OBJECT
21+
qrscan.scanner = new Html5QrcodeScanner("qr-cam", { fps: 10, qrbox: 250 });
22+
qrscan.scanner.render((txt, res) => {
23+
qrscan.hide();
24+
try {
25+
let item = JSON.parse(txt);
26+
hSKU.value = item.S;
27+
hBatch.value = item.B;
28+
after();
29+
} catch (e) {
30+
console.error(e);
31+
cb.modal("Invalid QR Code", "Failed to parse scanned QR code.");
32+
}
33+
});
34+
},
35+
36+
// (C) SHOW SCANNER
37+
show : () => cb.transit(() => {
38+
document.getElementById("qr-wrapA").classList.remove("d-none");
39+
document.body.classList.add("overflow-hidden");
40+
}),
41+
42+
// (D) HIDE QR SCANNER
43+
hide : () => {
44+
// (D1) SEEMINGLY NO SMART WAY TO "STOP SCANNING"
45+
let stop = document.getElementById("html5-qrcode-button-camera-stop"),
46+
wrap = document.getElementById("qr-wrapA");
47+
if (stop != null) {
48+
if (stop.style.display!="none") { stop.click(); }
49+
}
50+
51+
// (D2) HIDE SCANNER
52+
cb.transit(() => {
53+
wrap.classList.add("d-none");
54+
document.body.classList.remove("overflow-hidden");
55+
});
56+
}
57+
};

assets/bootstrap.bundle.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/bootstrap.bundle.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/bootstrap.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/bootstrap.min.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)