Roasted Bean Deploy commited on
Commit Β·
2e73730
1
Parent(s): cdcf596
π½οΈ Table ordering system: QR codes, /order page, admin orders panel, midnight cleanup
Browse files- data/menu.json +3 -1
- package-lock.json +306 -0
- package.json +2 -1
- public/admin.html +31 -0
- public/css/admin.css +161 -0
- public/css/order.css +579 -0
- public/index.html +1 -0
- public/js/admin.js +141 -0
- public/js/order.js +261 -0
- public/order.html +62 -0
- server.js +138 -0
data/menu.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
| 1 |
{
|
|
|
|
|
|
|
| 2 |
"items": [
|
| 3 |
{
|
| 4 |
"id": "a1b2c3d4-0001",
|
|
@@ -189,4 +191,4 @@
|
|
| 189 |
],
|
| 190 |
"email": "hello@theroastedbean.com"
|
| 191 |
}
|
| 192 |
-
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"tables": 8,
|
| 3 |
+
"orders": [],
|
| 4 |
"items": [
|
| 5 |
{
|
| 6 |
"id": "a1b2c3d4-0001",
|
|
|
|
| 191 |
],
|
| 192 |
"email": "hello@theroastedbean.com"
|
| 193 |
}
|
| 194 |
+
}
|
package-lock.json
CHANGED
|
@@ -11,6 +11,7 @@
|
|
| 11 |
"bcryptjs": "^2.4.3",
|
| 12 |
"express": "^4.18.2",
|
| 13 |
"express-session": "^1.17.3",
|
|
|
|
| 14 |
"uuid": "^9.0.0"
|
| 15 |
}
|
| 16 |
},
|
|
@@ -27,6 +28,30 @@
|
|
| 27 |
"node": ">= 0.6"
|
| 28 |
}
|
| 29 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
"node_modules/array-flatten": {
|
| 31 |
"version": "1.1.1",
|
| 32 |
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
|
@@ -101,6 +126,44 @@
|
|
| 101 |
"url": "https://github.com/sponsors/ljharb"
|
| 102 |
}
|
| 103 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
"node_modules/content-disposition": {
|
| 105 |
"version": "0.5.4",
|
| 106 |
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
|
@@ -146,6 +209,15 @@
|
|
| 146 |
"ms": "2.0.0"
|
| 147 |
}
|
| 148 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
"node_modules/depd": {
|
| 150 |
"version": "2.0.0",
|
| 151 |
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
|
@@ -165,6 +237,12 @@
|
|
| 165 |
"npm": "1.2.8000 || >= 1.4.16"
|
| 166 |
}
|
| 167 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
"node_modules/dunder-proto": {
|
| 169 |
"version": "1.0.1",
|
| 170 |
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
|
@@ -185,6 +263,12 @@
|
|
| 185 |
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
|
| 186 |
"license": "MIT"
|
| 187 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
"node_modules/encodeurl": {
|
| 189 |
"version": "2.0.0",
|
| 190 |
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
|
@@ -326,6 +410,19 @@
|
|
| 326 |
"node": ">= 0.8"
|
| 327 |
}
|
| 328 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
"node_modules/forwarded": {
|
| 330 |
"version": "0.2.0",
|
| 331 |
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
|
@@ -353,6 +450,15 @@
|
|
| 353 |
"url": "https://github.com/sponsors/ljharb"
|
| 354 |
}
|
| 355 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 356 |
"node_modules/get-intrinsic": {
|
| 357 |
"version": "1.3.0",
|
| 358 |
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
|
@@ -473,6 +579,27 @@
|
|
| 473 |
"node": ">= 0.10"
|
| 474 |
}
|
| 475 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 476 |
"node_modules/math-intrinsics": {
|
| 477 |
"version": "1.1.0",
|
| 478 |
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
|
@@ -590,6 +717,42 @@
|
|
| 590 |
"node": ">= 0.8"
|
| 591 |
}
|
| 592 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 593 |
"node_modules/parseurl": {
|
| 594 |
"version": "1.3.3",
|
| 595 |
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
|
@@ -599,12 +762,30 @@
|
|
| 599 |
"node": ">= 0.8"
|
| 600 |
}
|
| 601 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 602 |
"node_modules/path-to-regexp": {
|
| 603 |
"version": "0.1.13",
|
| 604 |
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
|
| 605 |
"integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",
|
| 606 |
"license": "MIT"
|
| 607 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 608 |
"node_modules/proxy-addr": {
|
| 609 |
"version": "2.0.7",
|
| 610 |
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
|
@@ -618,6 +799,23 @@
|
|
| 618 |
"node": ">= 0.10"
|
| 619 |
}
|
| 620 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 621 |
"node_modules/qs": {
|
| 622 |
"version": "6.15.3",
|
| 623 |
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz",
|
|
@@ -667,6 +865,21 @@
|
|
| 667 |
"node": ">= 0.8"
|
| 668 |
}
|
| 669 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 670 |
"node_modules/safe-buffer": {
|
| 671 |
"version": "5.2.1",
|
| 672 |
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
|
@@ -738,6 +951,12 @@
|
|
| 738 |
"node": ">= 0.8.0"
|
| 739 |
}
|
| 740 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 741 |
"node_modules/setprototypeof": {
|
| 742 |
"version": "1.2.0",
|
| 743 |
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
|
@@ -825,6 +1044,32 @@
|
|
| 825 |
"node": ">= 0.8"
|
| 826 |
}
|
| 827 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 828 |
"node_modules/toidentifier": {
|
| 829 |
"version": "1.0.1",
|
| 830 |
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
|
@@ -899,6 +1144,67 @@
|
|
| 899 |
"engines": {
|
| 900 |
"node": ">= 0.8"
|
| 901 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 902 |
}
|
| 903 |
}
|
| 904 |
}
|
|
|
|
| 11 |
"bcryptjs": "^2.4.3",
|
| 12 |
"express": "^4.18.2",
|
| 13 |
"express-session": "^1.17.3",
|
| 14 |
+
"qrcode": "^1.5.4",
|
| 15 |
"uuid": "^9.0.0"
|
| 16 |
}
|
| 17 |
},
|
|
|
|
| 28 |
"node": ">= 0.6"
|
| 29 |
}
|
| 30 |
},
|
| 31 |
+
"node_modules/ansi-regex": {
|
| 32 |
+
"version": "5.0.1",
|
| 33 |
+
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
| 34 |
+
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
| 35 |
+
"license": "MIT",
|
| 36 |
+
"engines": {
|
| 37 |
+
"node": ">=8"
|
| 38 |
+
}
|
| 39 |
+
},
|
| 40 |
+
"node_modules/ansi-styles": {
|
| 41 |
+
"version": "4.3.0",
|
| 42 |
+
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
| 43 |
+
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
| 44 |
+
"license": "MIT",
|
| 45 |
+
"dependencies": {
|
| 46 |
+
"color-convert": "^2.0.1"
|
| 47 |
+
},
|
| 48 |
+
"engines": {
|
| 49 |
+
"node": ">=8"
|
| 50 |
+
},
|
| 51 |
+
"funding": {
|
| 52 |
+
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
| 53 |
+
}
|
| 54 |
+
},
|
| 55 |
"node_modules/array-flatten": {
|
| 56 |
"version": "1.1.1",
|
| 57 |
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
|
|
|
| 126 |
"url": "https://github.com/sponsors/ljharb"
|
| 127 |
}
|
| 128 |
},
|
| 129 |
+
"node_modules/camelcase": {
|
| 130 |
+
"version": "5.3.1",
|
| 131 |
+
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
| 132 |
+
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
| 133 |
+
"license": "MIT",
|
| 134 |
+
"engines": {
|
| 135 |
+
"node": ">=6"
|
| 136 |
+
}
|
| 137 |
+
},
|
| 138 |
+
"node_modules/cliui": {
|
| 139 |
+
"version": "6.0.0",
|
| 140 |
+
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
|
| 141 |
+
"integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
|
| 142 |
+
"license": "ISC",
|
| 143 |
+
"dependencies": {
|
| 144 |
+
"string-width": "^4.2.0",
|
| 145 |
+
"strip-ansi": "^6.0.0",
|
| 146 |
+
"wrap-ansi": "^6.2.0"
|
| 147 |
+
}
|
| 148 |
+
},
|
| 149 |
+
"node_modules/color-convert": {
|
| 150 |
+
"version": "2.0.1",
|
| 151 |
+
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
| 152 |
+
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
| 153 |
+
"license": "MIT",
|
| 154 |
+
"dependencies": {
|
| 155 |
+
"color-name": "~1.1.4"
|
| 156 |
+
},
|
| 157 |
+
"engines": {
|
| 158 |
+
"node": ">=7.0.0"
|
| 159 |
+
}
|
| 160 |
+
},
|
| 161 |
+
"node_modules/color-name": {
|
| 162 |
+
"version": "1.1.4",
|
| 163 |
+
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
| 164 |
+
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
| 165 |
+
"license": "MIT"
|
| 166 |
+
},
|
| 167 |
"node_modules/content-disposition": {
|
| 168 |
"version": "0.5.4",
|
| 169 |
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
|
|
|
| 209 |
"ms": "2.0.0"
|
| 210 |
}
|
| 211 |
},
|
| 212 |
+
"node_modules/decamelize": {
|
| 213 |
+
"version": "1.2.0",
|
| 214 |
+
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
| 215 |
+
"integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
|
| 216 |
+
"license": "MIT",
|
| 217 |
+
"engines": {
|
| 218 |
+
"node": ">=0.10.0"
|
| 219 |
+
}
|
| 220 |
+
},
|
| 221 |
"node_modules/depd": {
|
| 222 |
"version": "2.0.0",
|
| 223 |
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
|
|
|
| 237 |
"npm": "1.2.8000 || >= 1.4.16"
|
| 238 |
}
|
| 239 |
},
|
| 240 |
+
"node_modules/dijkstrajs": {
|
| 241 |
+
"version": "1.0.3",
|
| 242 |
+
"resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz",
|
| 243 |
+
"integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==",
|
| 244 |
+
"license": "MIT"
|
| 245 |
+
},
|
| 246 |
"node_modules/dunder-proto": {
|
| 247 |
"version": "1.0.1",
|
| 248 |
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
|
|
|
| 263 |
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
|
| 264 |
"license": "MIT"
|
| 265 |
},
|
| 266 |
+
"node_modules/emoji-regex": {
|
| 267 |
+
"version": "8.0.0",
|
| 268 |
+
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
| 269 |
+
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
| 270 |
+
"license": "MIT"
|
| 271 |
+
},
|
| 272 |
"node_modules/encodeurl": {
|
| 273 |
"version": "2.0.0",
|
| 274 |
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
|
|
|
| 410 |
"node": ">= 0.8"
|
| 411 |
}
|
| 412 |
},
|
| 413 |
+
"node_modules/find-up": {
|
| 414 |
+
"version": "4.1.0",
|
| 415 |
+
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
| 416 |
+
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
|
| 417 |
+
"license": "MIT",
|
| 418 |
+
"dependencies": {
|
| 419 |
+
"locate-path": "^5.0.0",
|
| 420 |
+
"path-exists": "^4.0.0"
|
| 421 |
+
},
|
| 422 |
+
"engines": {
|
| 423 |
+
"node": ">=8"
|
| 424 |
+
}
|
| 425 |
+
},
|
| 426 |
"node_modules/forwarded": {
|
| 427 |
"version": "0.2.0",
|
| 428 |
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
|
|
|
| 450 |
"url": "https://github.com/sponsors/ljharb"
|
| 451 |
}
|
| 452 |
},
|
| 453 |
+
"node_modules/get-caller-file": {
|
| 454 |
+
"version": "2.0.5",
|
| 455 |
+
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
| 456 |
+
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
| 457 |
+
"license": "ISC",
|
| 458 |
+
"engines": {
|
| 459 |
+
"node": "6.* || 8.* || >= 10.*"
|
| 460 |
+
}
|
| 461 |
+
},
|
| 462 |
"node_modules/get-intrinsic": {
|
| 463 |
"version": "1.3.0",
|
| 464 |
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
|
|
|
| 579 |
"node": ">= 0.10"
|
| 580 |
}
|
| 581 |
},
|
| 582 |
+
"node_modules/is-fullwidth-code-point": {
|
| 583 |
+
"version": "3.0.0",
|
| 584 |
+
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
| 585 |
+
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
| 586 |
+
"license": "MIT",
|
| 587 |
+
"engines": {
|
| 588 |
+
"node": ">=8"
|
| 589 |
+
}
|
| 590 |
+
},
|
| 591 |
+
"node_modules/locate-path": {
|
| 592 |
+
"version": "5.0.0",
|
| 593 |
+
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
| 594 |
+
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
|
| 595 |
+
"license": "MIT",
|
| 596 |
+
"dependencies": {
|
| 597 |
+
"p-locate": "^4.1.0"
|
| 598 |
+
},
|
| 599 |
+
"engines": {
|
| 600 |
+
"node": ">=8"
|
| 601 |
+
}
|
| 602 |
+
},
|
| 603 |
"node_modules/math-intrinsics": {
|
| 604 |
"version": "1.1.0",
|
| 605 |
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
|
|
|
| 717 |
"node": ">= 0.8"
|
| 718 |
}
|
| 719 |
},
|
| 720 |
+
"node_modules/p-limit": {
|
| 721 |
+
"version": "2.3.0",
|
| 722 |
+
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
| 723 |
+
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
| 724 |
+
"license": "MIT",
|
| 725 |
+
"dependencies": {
|
| 726 |
+
"p-try": "^2.0.0"
|
| 727 |
+
},
|
| 728 |
+
"engines": {
|
| 729 |
+
"node": ">=6"
|
| 730 |
+
},
|
| 731 |
+
"funding": {
|
| 732 |
+
"url": "https://github.com/sponsors/sindresorhus"
|
| 733 |
+
}
|
| 734 |
+
},
|
| 735 |
+
"node_modules/p-locate": {
|
| 736 |
+
"version": "4.1.0",
|
| 737 |
+
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
|
| 738 |
+
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
|
| 739 |
+
"license": "MIT",
|
| 740 |
+
"dependencies": {
|
| 741 |
+
"p-limit": "^2.2.0"
|
| 742 |
+
},
|
| 743 |
+
"engines": {
|
| 744 |
+
"node": ">=8"
|
| 745 |
+
}
|
| 746 |
+
},
|
| 747 |
+
"node_modules/p-try": {
|
| 748 |
+
"version": "2.2.0",
|
| 749 |
+
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
| 750 |
+
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
|
| 751 |
+
"license": "MIT",
|
| 752 |
+
"engines": {
|
| 753 |
+
"node": ">=6"
|
| 754 |
+
}
|
| 755 |
+
},
|
| 756 |
"node_modules/parseurl": {
|
| 757 |
"version": "1.3.3",
|
| 758 |
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
|
|
|
| 762 |
"node": ">= 0.8"
|
| 763 |
}
|
| 764 |
},
|
| 765 |
+
"node_modules/path-exists": {
|
| 766 |
+
"version": "4.0.0",
|
| 767 |
+
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
| 768 |
+
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
| 769 |
+
"license": "MIT",
|
| 770 |
+
"engines": {
|
| 771 |
+
"node": ">=8"
|
| 772 |
+
}
|
| 773 |
+
},
|
| 774 |
"node_modules/path-to-regexp": {
|
| 775 |
"version": "0.1.13",
|
| 776 |
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
|
| 777 |
"integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",
|
| 778 |
"license": "MIT"
|
| 779 |
},
|
| 780 |
+
"node_modules/pngjs": {
|
| 781 |
+
"version": "5.0.0",
|
| 782 |
+
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
|
| 783 |
+
"integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==",
|
| 784 |
+
"license": "MIT",
|
| 785 |
+
"engines": {
|
| 786 |
+
"node": ">=10.13.0"
|
| 787 |
+
}
|
| 788 |
+
},
|
| 789 |
"node_modules/proxy-addr": {
|
| 790 |
"version": "2.0.7",
|
| 791 |
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
|
|
|
| 799 |
"node": ">= 0.10"
|
| 800 |
}
|
| 801 |
},
|
| 802 |
+
"node_modules/qrcode": {
|
| 803 |
+
"version": "1.5.4",
|
| 804 |
+
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",
|
| 805 |
+
"integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==",
|
| 806 |
+
"license": "MIT",
|
| 807 |
+
"dependencies": {
|
| 808 |
+
"dijkstrajs": "^1.0.1",
|
| 809 |
+
"pngjs": "^5.0.0",
|
| 810 |
+
"yargs": "^15.3.1"
|
| 811 |
+
},
|
| 812 |
+
"bin": {
|
| 813 |
+
"qrcode": "bin/qrcode"
|
| 814 |
+
},
|
| 815 |
+
"engines": {
|
| 816 |
+
"node": ">=10.13.0"
|
| 817 |
+
}
|
| 818 |
+
},
|
| 819 |
"node_modules/qs": {
|
| 820 |
"version": "6.15.3",
|
| 821 |
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz",
|
|
|
|
| 865 |
"node": ">= 0.8"
|
| 866 |
}
|
| 867 |
},
|
| 868 |
+
"node_modules/require-directory": {
|
| 869 |
+
"version": "2.1.1",
|
| 870 |
+
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
| 871 |
+
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
|
| 872 |
+
"license": "MIT",
|
| 873 |
+
"engines": {
|
| 874 |
+
"node": ">=0.10.0"
|
| 875 |
+
}
|
| 876 |
+
},
|
| 877 |
+
"node_modules/require-main-filename": {
|
| 878 |
+
"version": "2.0.0",
|
| 879 |
+
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
|
| 880 |
+
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
|
| 881 |
+
"license": "ISC"
|
| 882 |
+
},
|
| 883 |
"node_modules/safe-buffer": {
|
| 884 |
"version": "5.2.1",
|
| 885 |
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
|
|
|
| 951 |
"node": ">= 0.8.0"
|
| 952 |
}
|
| 953 |
},
|
| 954 |
+
"node_modules/set-blocking": {
|
| 955 |
+
"version": "2.0.0",
|
| 956 |
+
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
| 957 |
+
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
|
| 958 |
+
"license": "ISC"
|
| 959 |
+
},
|
| 960 |
"node_modules/setprototypeof": {
|
| 961 |
"version": "1.2.0",
|
| 962 |
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
|
|
|
| 1044 |
"node": ">= 0.8"
|
| 1045 |
}
|
| 1046 |
},
|
| 1047 |
+
"node_modules/string-width": {
|
| 1048 |
+
"version": "4.2.3",
|
| 1049 |
+
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
| 1050 |
+
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
| 1051 |
+
"license": "MIT",
|
| 1052 |
+
"dependencies": {
|
| 1053 |
+
"emoji-regex": "^8.0.0",
|
| 1054 |
+
"is-fullwidth-code-point": "^3.0.0",
|
| 1055 |
+
"strip-ansi": "^6.0.1"
|
| 1056 |
+
},
|
| 1057 |
+
"engines": {
|
| 1058 |
+
"node": ">=8"
|
| 1059 |
+
}
|
| 1060 |
+
},
|
| 1061 |
+
"node_modules/strip-ansi": {
|
| 1062 |
+
"version": "6.0.1",
|
| 1063 |
+
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
| 1064 |
+
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
| 1065 |
+
"license": "MIT",
|
| 1066 |
+
"dependencies": {
|
| 1067 |
+
"ansi-regex": "^5.0.1"
|
| 1068 |
+
},
|
| 1069 |
+
"engines": {
|
| 1070 |
+
"node": ">=8"
|
| 1071 |
+
}
|
| 1072 |
+
},
|
| 1073 |
"node_modules/toidentifier": {
|
| 1074 |
"version": "1.0.1",
|
| 1075 |
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
|
|
|
| 1144 |
"engines": {
|
| 1145 |
"node": ">= 0.8"
|
| 1146 |
}
|
| 1147 |
+
},
|
| 1148 |
+
"node_modules/which-module": {
|
| 1149 |
+
"version": "2.0.1",
|
| 1150 |
+
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",
|
| 1151 |
+
"integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==",
|
| 1152 |
+
"license": "ISC"
|
| 1153 |
+
},
|
| 1154 |
+
"node_modules/wrap-ansi": {
|
| 1155 |
+
"version": "6.2.0",
|
| 1156 |
+
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
|
| 1157 |
+
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
|
| 1158 |
+
"license": "MIT",
|
| 1159 |
+
"dependencies": {
|
| 1160 |
+
"ansi-styles": "^4.0.0",
|
| 1161 |
+
"string-width": "^4.1.0",
|
| 1162 |
+
"strip-ansi": "^6.0.0"
|
| 1163 |
+
},
|
| 1164 |
+
"engines": {
|
| 1165 |
+
"node": ">=8"
|
| 1166 |
+
}
|
| 1167 |
+
},
|
| 1168 |
+
"node_modules/y18n": {
|
| 1169 |
+
"version": "4.0.3",
|
| 1170 |
+
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
|
| 1171 |
+
"integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
|
| 1172 |
+
"license": "ISC"
|
| 1173 |
+
},
|
| 1174 |
+
"node_modules/yargs": {
|
| 1175 |
+
"version": "15.4.1",
|
| 1176 |
+
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
|
| 1177 |
+
"integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
|
| 1178 |
+
"license": "MIT",
|
| 1179 |
+
"dependencies": {
|
| 1180 |
+
"cliui": "^6.0.0",
|
| 1181 |
+
"decamelize": "^1.2.0",
|
| 1182 |
+
"find-up": "^4.1.0",
|
| 1183 |
+
"get-caller-file": "^2.0.1",
|
| 1184 |
+
"require-directory": "^2.1.1",
|
| 1185 |
+
"require-main-filename": "^2.0.0",
|
| 1186 |
+
"set-blocking": "^2.0.0",
|
| 1187 |
+
"string-width": "^4.2.0",
|
| 1188 |
+
"which-module": "^2.0.0",
|
| 1189 |
+
"y18n": "^4.0.0",
|
| 1190 |
+
"yargs-parser": "^18.1.2"
|
| 1191 |
+
},
|
| 1192 |
+
"engines": {
|
| 1193 |
+
"node": ">=8"
|
| 1194 |
+
}
|
| 1195 |
+
},
|
| 1196 |
+
"node_modules/yargs-parser": {
|
| 1197 |
+
"version": "18.1.3",
|
| 1198 |
+
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
|
| 1199 |
+
"integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
|
| 1200 |
+
"license": "ISC",
|
| 1201 |
+
"dependencies": {
|
| 1202 |
+
"camelcase": "^5.0.0",
|
| 1203 |
+
"decamelize": "^1.2.0"
|
| 1204 |
+
},
|
| 1205 |
+
"engines": {
|
| 1206 |
+
"node": ">=6"
|
| 1207 |
+
}
|
| 1208 |
}
|
| 1209 |
}
|
| 1210 |
}
|
package.json
CHANGED
|
@@ -8,9 +8,10 @@
|
|
| 8 |
"dev": "node server.js"
|
| 9 |
},
|
| 10 |
"dependencies": {
|
|
|
|
| 11 |
"express": "^4.18.2",
|
| 12 |
"express-session": "^1.17.3",
|
| 13 |
-
"
|
| 14 |
"uuid": "^9.0.0"
|
| 15 |
}
|
| 16 |
}
|
|
|
|
| 8 |
"dev": "node server.js"
|
| 9 |
},
|
| 10 |
"dependencies": {
|
| 11 |
+
"bcryptjs": "^2.4.3",
|
| 12 |
"express": "^4.18.2",
|
| 13 |
"express-session": "^1.17.3",
|
| 14 |
+
"qrcode": "^1.5.4",
|
| 15 |
"uuid": "^9.0.0"
|
| 16 |
}
|
| 17 |
}
|
public/admin.html
CHANGED
|
@@ -37,6 +37,7 @@
|
|
| 37 |
<button class="tb-nav-item active" data-section="menu">Menu</button>
|
| 38 |
<button class="tb-nav-item" data-section="categories">Categories</button>
|
| 39 |
<button class="tb-nav-item" data-section="info">Cafe Info</button>
|
|
|
|
| 40 |
<button class="tb-nav-item" data-section="settings">Settings</button>
|
| 41 |
</nav>
|
| 42 |
<div class="topbar-actions">
|
|
@@ -126,6 +127,36 @@
|
|
| 126 |
</form>
|
| 127 |
</section>
|
| 128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
<!-- Settings Section -->
|
| 130 |
<section id="settingsSection" class="panel" style="display: none;">
|
| 131 |
<div class="panel-head">
|
|
|
|
| 37 |
<button class="tb-nav-item active" data-section="menu">Menu</button>
|
| 38 |
<button class="tb-nav-item" data-section="categories">Categories</button>
|
| 39 |
<button class="tb-nav-item" data-section="info">Cafe Info</button>
|
| 40 |
+
<button class="tb-nav-item" data-section="tables">Tables & Orders</button>
|
| 41 |
<button class="tb-nav-item" data-section="settings">Settings</button>
|
| 42 |
</nav>
|
| 43 |
<div class="topbar-actions">
|
|
|
|
| 127 |
</form>
|
| 128 |
</section>
|
| 129 |
|
| 130 |
+
<!-- Tables & Orders Section -->
|
| 131 |
+
<section id="tablesSection" class="panel" style="display: none;">
|
| 132 |
+
<!-- Table count -->
|
| 133 |
+
<div class="panel-head">
|
| 134 |
+
<h2>Tables & QR Codes</h2>
|
| 135 |
+
</div>
|
| 136 |
+
<div class="form-block" style="margin-bottom: 28px;">
|
| 137 |
+
<div class="field" style="max-width: 200px;">
|
| 138 |
+
<label for="tableCount">Number of tables</label>
|
| 139 |
+
<input type="number" id="tableCount" min="0" max="100" placeholder="8">
|
| 140 |
+
</div>
|
| 141 |
+
<button type="button" id="saveTablesBtn" class="btn">Save</button>
|
| 142 |
+
<button type="button" id="loadQrBtn" class="btn btn-ghost" style="margin-left:8px;">Generate QR codes</button>
|
| 143 |
+
</div>
|
| 144 |
+
|
| 145 |
+
<!-- QR Code Grid -->
|
| 146 |
+
<div class="qr-grid" id="qrGrid">
|
| 147 |
+
<p style="color:var(--parchment);font-size:0.82rem;padding:32px;">Set the number of tables above, then click "Generate QR codes" to generate printable QR codes for each table.</p>
|
| 148 |
+
</div>
|
| 149 |
+
|
| 150 |
+
<!-- Orders -->
|
| 151 |
+
<div class="panel-head" style="margin-top: 44px;">
|
| 152 |
+
<h2>Active orders</h2>
|
| 153 |
+
<button id="refreshOrdersBtn" class="btn btn-ghost" style="font-size:0.75rem;">Refresh</button>
|
| 154 |
+
</div>
|
| 155 |
+
<div id="ordersContainer">
|
| 156 |
+
<p style="color:var(--parchment);font-size:0.82rem;">No orders yet.</p>
|
| 157 |
+
</div>
|
| 158 |
+
</section>
|
| 159 |
+
|
| 160 |
<!-- Settings Section -->
|
| 161 |
<section id="settingsSection" class="panel" style="display: none;">
|
| 162 |
<div class="panel-head">
|
public/css/admin.css
CHANGED
|
@@ -650,6 +650,167 @@ body {
|
|
| 650 |
border-top: 1px solid var(--rule);
|
| 651 |
}
|
| 652 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 653 |
/* ββ Toast βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 654 |
.toast {
|
| 655 |
position: fixed;
|
|
|
|
| 650 |
border-top: 1px solid var(--rule);
|
| 651 |
}
|
| 652 |
|
| 653 |
+
/* ββ QR Grid ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 654 |
+
.qr-grid {
|
| 655 |
+
display: flex;
|
| 656 |
+
flex-wrap: wrap;
|
| 657 |
+
gap: 20px;
|
| 658 |
+
background: var(--white);
|
| 659 |
+
border: 1px solid var(--rule);
|
| 660 |
+
padding: 28px;
|
| 661 |
+
}
|
| 662 |
+
|
| 663 |
+
.qr-card {
|
| 664 |
+
display: flex;
|
| 665 |
+
flex-direction: column;
|
| 666 |
+
align-items: center;
|
| 667 |
+
gap: 8px;
|
| 668 |
+
padding: 16px;
|
| 669 |
+
border: 1px solid var(--rule-light);
|
| 670 |
+
background: var(--paper);
|
| 671 |
+
}
|
| 672 |
+
|
| 673 |
+
.qr-card img {
|
| 674 |
+
display: block;
|
| 675 |
+
border: 1px solid var(--rule-light);
|
| 676 |
+
}
|
| 677 |
+
|
| 678 |
+
.qr-label {
|
| 679 |
+
font-family: var(--font-display);
|
| 680 |
+
font-size: 1rem;
|
| 681 |
+
font-weight: 700;
|
| 682 |
+
color: var(--roast);
|
| 683 |
+
}
|
| 684 |
+
|
| 685 |
+
.qr-url {
|
| 686 |
+
font-size: 0.6rem;
|
| 687 |
+
color: var(--parchment);
|
| 688 |
+
word-break: break-all;
|
| 689 |
+
max-width: 150px;
|
| 690 |
+
text-align: center;
|
| 691 |
+
line-height: 1.3;
|
| 692 |
+
}
|
| 693 |
+
|
| 694 |
+
/* ββ Order Cards βββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 695 |
+
.order-card {
|
| 696 |
+
background: var(--white);
|
| 697 |
+
border: 1px solid var(--rule);
|
| 698 |
+
margin-bottom: 12px;
|
| 699 |
+
}
|
| 700 |
+
|
| 701 |
+
.order-card.order-cancelled {
|
| 702 |
+
opacity: 0.5;
|
| 703 |
+
background: var(--paper);
|
| 704 |
+
}
|
| 705 |
+
|
| 706 |
+
.order-card-head {
|
| 707 |
+
display: flex;
|
| 708 |
+
justify-content: space-between;
|
| 709 |
+
align-items: center;
|
| 710 |
+
padding: 14px 20px;
|
| 711 |
+
border-bottom: 1px solid var(--rule-light);
|
| 712 |
+
}
|
| 713 |
+
|
| 714 |
+
.order-tbl {
|
| 715 |
+
font-family: var(--font-display);
|
| 716 |
+
font-size: 1.05rem;
|
| 717 |
+
font-weight: 700;
|
| 718 |
+
color: var(--roast);
|
| 719 |
+
margin-right: 12px;
|
| 720 |
+
}
|
| 721 |
+
|
| 722 |
+
.order-time {
|
| 723 |
+
font-size: 0.72rem;
|
| 724 |
+
color: var(--parchment);
|
| 725 |
+
}
|
| 726 |
+
|
| 727 |
+
.order-card-body {
|
| 728 |
+
padding: 16px 20px;
|
| 729 |
+
}
|
| 730 |
+
|
| 731 |
+
.order-items {
|
| 732 |
+
list-style: none;
|
| 733 |
+
display: flex;
|
| 734 |
+
flex-direction: column;
|
| 735 |
+
gap: 6px;
|
| 736 |
+
}
|
| 737 |
+
|
| 738 |
+
.order-items li {
|
| 739 |
+
display: flex;
|
| 740 |
+
justify-content: space-between;
|
| 741 |
+
font-size: 0.84rem;
|
| 742 |
+
color: var(--roast);
|
| 743 |
+
padding: 4px 0;
|
| 744 |
+
}
|
| 745 |
+
|
| 746 |
+
.order-items li span {
|
| 747 |
+
font-weight: 600;
|
| 748 |
+
color: var(--roast-med);
|
| 749 |
+
}
|
| 750 |
+
|
| 751 |
+
.order-item-custom {
|
| 752 |
+
font-style: italic;
|
| 753 |
+
color: var(--parchment) !important;
|
| 754 |
+
}
|
| 755 |
+
|
| 756 |
+
.order-note {
|
| 757 |
+
margin-top: 8px;
|
| 758 |
+
font-size: 0.78rem;
|
| 759 |
+
color: var(--parchment);
|
| 760 |
+
font-style: italic;
|
| 761 |
+
padding-top: 8px;
|
| 762 |
+
border-top: 1px solid var(--rule-light);
|
| 763 |
+
}
|
| 764 |
+
|
| 765 |
+
.order-total {
|
| 766 |
+
margin-top: 10px;
|
| 767 |
+
padding-top: 10px;
|
| 768 |
+
border-top: 1px solid var(--rule);
|
| 769 |
+
font-weight: 700;
|
| 770 |
+
font-size: 0.88rem;
|
| 771 |
+
color: var(--green);
|
| 772 |
+
text-align: right;
|
| 773 |
+
}
|
| 774 |
+
|
| 775 |
+
.order-card-actions {
|
| 776 |
+
display: flex;
|
| 777 |
+
gap: 8px;
|
| 778 |
+
padding: 12px 20px;
|
| 779 |
+
border-top: 1px solid var(--rule-light);
|
| 780 |
+
}
|
| 781 |
+
|
| 782 |
+
.order-card-actions .btn {
|
| 783 |
+
font-size: 0.75rem;
|
| 784 |
+
padding: 8px 16px;
|
| 785 |
+
}
|
| 786 |
+
|
| 787 |
+
.order-card-actions .btn.serve {
|
| 788 |
+
background: var(--green);
|
| 789 |
+
color: var(--white);
|
| 790 |
+
}
|
| 791 |
+
|
| 792 |
+
.order-card-actions .btn.serve:hover { background: var(--green-light); }
|
| 793 |
+
|
| 794 |
+
.order-card-actions .btn.paid {
|
| 795 |
+
background: var(--roast);
|
| 796 |
+
color: var(--paper);
|
| 797 |
+
}
|
| 798 |
+
|
| 799 |
+
.order-card-actions .btn.cancel {
|
| 800 |
+
border-color: var(--cherry);
|
| 801 |
+
color: var(--cherry);
|
| 802 |
+
}
|
| 803 |
+
|
| 804 |
+
.order-card-actions .btn.cancel:hover {
|
| 805 |
+
background: var(--cherry-bg);
|
| 806 |
+
border-color: var(--cherry);
|
| 807 |
+
}
|
| 808 |
+
|
| 809 |
+
.badge-order-new { color: var(--green); }
|
| 810 |
+
.badge-order-served { color: var(--roast-med); }
|
| 811 |
+
.badge-order-paid { color: var(--parchment); }
|
| 812 |
+
.badge-order-cancelled { color: var(--cherry); }
|
| 813 |
+
|
| 814 |
/* ββ Toast βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 815 |
.toast {
|
| 816 |
position: fixed;
|
public/css/order.css
ADDED
|
@@ -0,0 +1,579 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* ββ Order Page β The Roasted Bean βββββββββββββββββββββββββββββββββββββ */
|
| 2 |
+
/* Mobile-first: scanned from table QR codes */
|
| 3 |
+
|
| 4 |
+
:root {
|
| 5 |
+
--paper: #F4F2EC;
|
| 6 |
+
--roast: #1B1512;
|
| 7 |
+
--roast-med: #4A4038;
|
| 8 |
+
--parchment: #968878;
|
| 9 |
+
--green: #3C6E55;
|
| 10 |
+
--green-light: #4E8A6B;
|
| 11 |
+
--cherry: #C44D34;
|
| 12 |
+
--cherry-bg: rgba(196, 77, 52, 0.06);
|
| 13 |
+
--crema: #EAE5DD;
|
| 14 |
+
--white: #FFFFFF;
|
| 15 |
+
--rule: #D9D2C7;
|
| 16 |
+
--rule-light: #EBE7E0;
|
| 17 |
+
--font-display: 'Newsreader', Georgia, serif;
|
| 18 |
+
--font-body: 'Figtree', sans-serif;
|
| 19 |
+
--ease: cubic-bezier(0.22, 0.61, 0.36, 1);
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
| 23 |
+
|
| 24 |
+
html {
|
| 25 |
+
background: var(--paper);
|
| 26 |
+
color: var(--roast);
|
| 27 |
+
font-family: var(--font-body);
|
| 28 |
+
font-size: 15px;
|
| 29 |
+
line-height: 1.55;
|
| 30 |
+
-webkit-font-smoothing: antialiased;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
body {
|
| 34 |
+
min-height: 100vh;
|
| 35 |
+
max-width: 800px;
|
| 36 |
+
margin: 0 auto;
|
| 37 |
+
display: flex;
|
| 38 |
+
flex-direction: column;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
::selection { background: rgba(60, 110, 85, 0.12); }
|
| 42 |
+
|
| 43 |
+
/* ββ Header βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 44 |
+
.ord-header {
|
| 45 |
+
position: sticky;
|
| 46 |
+
top: 0;
|
| 47 |
+
z-index: 50;
|
| 48 |
+
background: rgba(244, 242, 236, 0.94);
|
| 49 |
+
backdrop-filter: blur(12px);
|
| 50 |
+
-webkit-backdrop-filter: blur(12px);
|
| 51 |
+
border-bottom: 1px solid var(--rule);
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.ord-header-inner {
|
| 55 |
+
display: flex;
|
| 56 |
+
align-items: center;
|
| 57 |
+
justify-content: space-between;
|
| 58 |
+
padding: 0 20px;
|
| 59 |
+
height: 52px;
|
| 60 |
+
gap: 12px;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
.ord-logo {
|
| 64 |
+
font-family: var(--font-display);
|
| 65 |
+
font-size: 0.9rem;
|
| 66 |
+
font-weight: 600;
|
| 67 |
+
color: var(--green);
|
| 68 |
+
text-decoration: none;
|
| 69 |
+
letter-spacing: -0.01em;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
.ord-table {
|
| 73 |
+
display: flex;
|
| 74 |
+
align-items: baseline;
|
| 75 |
+
gap: 6px;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
.ord-table-label {
|
| 79 |
+
font-size: 0.68rem;
|
| 80 |
+
font-weight: 700;
|
| 81 |
+
letter-spacing: 0.1em;
|
| 82 |
+
text-transform: uppercase;
|
| 83 |
+
color: var(--parchment);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.ord-table-num {
|
| 87 |
+
font-family: var(--font-display);
|
| 88 |
+
font-size: 1.2rem;
|
| 89 |
+
font-weight: 700;
|
| 90 |
+
color: var(--roast);
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
.ord-cart-badge {
|
| 94 |
+
display: flex;
|
| 95 |
+
align-items: center;
|
| 96 |
+
gap: 5px;
|
| 97 |
+
background: var(--roast);
|
| 98 |
+
color: var(--paper);
|
| 99 |
+
padding: 5px 12px;
|
| 100 |
+
border-radius: 20px;
|
| 101 |
+
font-size: 0.78rem;
|
| 102 |
+
font-weight: 600;
|
| 103 |
+
cursor: pointer;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
.ord-cart-badge svg { color: var(--paper); }
|
| 107 |
+
|
| 108 |
+
/* ββ Main Layout ββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 109 |
+
.ord-main {
|
| 110 |
+
flex: 1;
|
| 111 |
+
display: flex;
|
| 112 |
+
flex-direction: column;
|
| 113 |
+
padding: 20px 16px 100px;
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
/* ββ Section Title ββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 117 |
+
.ord-section-title {
|
| 118 |
+
font-family: var(--font-display);
|
| 119 |
+
font-size: 1.1rem;
|
| 120 |
+
font-weight: 600;
|
| 121 |
+
color: var(--roast);
|
| 122 |
+
margin-bottom: 16px;
|
| 123 |
+
letter-spacing: -0.01em;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
/* ββ Filters ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 127 |
+
.ord-filter {
|
| 128 |
+
display: flex;
|
| 129 |
+
gap: 6px;
|
| 130 |
+
flex-wrap: wrap;
|
| 131 |
+
margin-bottom: 18px;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
.ord-filter-btn {
|
| 135 |
+
padding: 6px 14px;
|
| 136 |
+
border: 1px solid var(--rule);
|
| 137 |
+
background: var(--white);
|
| 138 |
+
font-family: var(--font-body);
|
| 139 |
+
font-size: 0.75rem;
|
| 140 |
+
font-weight: 500;
|
| 141 |
+
color: var(--roast-med);
|
| 142 |
+
cursor: pointer;
|
| 143 |
+
transition: all 0.15s var(--ease);
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
.ord-filter-btn:hover { border-color: var(--roast-med); color: var(--roast); }
|
| 147 |
+
.ord-filter-btn.active {
|
| 148 |
+
background: var(--roast);
|
| 149 |
+
color: var(--paper);
|
| 150 |
+
border-color: var(--roast);
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
/* ββ Menu Items βββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 154 |
+
.ord-items {
|
| 155 |
+
display: flex;
|
| 156 |
+
flex-direction: column;
|
| 157 |
+
gap: 1px;
|
| 158 |
+
background: var(--rule);
|
| 159 |
+
border: 1px solid var(--rule);
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
.ord-item {
|
| 163 |
+
display: flex;
|
| 164 |
+
align-items: center;
|
| 165 |
+
gap: 12px;
|
| 166 |
+
padding: 12px 14px;
|
| 167 |
+
background: var(--white);
|
| 168 |
+
cursor: pointer;
|
| 169 |
+
transition: background 0.12s;
|
| 170 |
+
user-select: none;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
.ord-item:active { background: var(--paper); }
|
| 174 |
+
.ord-item.sold-out { opacity: 0.45; cursor: default; }
|
| 175 |
+
|
| 176 |
+
.ord-item-img {
|
| 177 |
+
width: 48px;
|
| 178 |
+
height: 48px;
|
| 179 |
+
border-radius: 6px;
|
| 180 |
+
overflow: hidden;
|
| 181 |
+
flex-shrink: 0;
|
| 182 |
+
background: var(--crema);
|
| 183 |
+
position: relative;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
.ord-item-img img {
|
| 187 |
+
width: 100%;
|
| 188 |
+
height: 100%;
|
| 189 |
+
object-fit: cover;
|
| 190 |
+
position: absolute;
|
| 191 |
+
inset: 0;
|
| 192 |
+
z-index: 1;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
.ord-item-img svg {
|
| 196 |
+
width: 22px;
|
| 197 |
+
height: 22px;
|
| 198 |
+
color: var(--parchment);
|
| 199 |
+
position: absolute;
|
| 200 |
+
inset: 0;
|
| 201 |
+
margin: auto;
|
| 202 |
+
z-index: 0;
|
| 203 |
+
opacity: 0.6;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
.ord-item-info {
|
| 207 |
+
flex: 1;
|
| 208 |
+
min-width: 0;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
.ord-item-name {
|
| 212 |
+
font-weight: 600;
|
| 213 |
+
font-size: 0.88rem;
|
| 214 |
+
color: var(--roast);
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
.ord-item-desc {
|
| 218 |
+
font-size: 0.72rem;
|
| 219 |
+
color: var(--parchment);
|
| 220 |
+
margin-top: 2px;
|
| 221 |
+
white-space: nowrap;
|
| 222 |
+
overflow: hidden;
|
| 223 |
+
text-overflow: ellipsis;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
.ord-item-price {
|
| 227 |
+
font-weight: 600;
|
| 228 |
+
font-size: 0.85rem;
|
| 229 |
+
color: var(--roast-med);
|
| 230 |
+
flex-shrink: 0;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
.ord-item-add {
|
| 234 |
+
width: 32px;
|
| 235 |
+
height: 32px;
|
| 236 |
+
border-radius: 50%;
|
| 237 |
+
border: 1.5px solid var(--green);
|
| 238 |
+
background: transparent;
|
| 239 |
+
color: var(--green);
|
| 240 |
+
font-size: 1.1rem;
|
| 241 |
+
display: flex;
|
| 242 |
+
align-items: center;
|
| 243 |
+
justify-content: center;
|
| 244 |
+
cursor: pointer;
|
| 245 |
+
flex-shrink: 0;
|
| 246 |
+
transition: all 0.15s;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
.ord-item-add:active { background: var(--green); color: var(--white); }
|
| 250 |
+
.ord-item.sold-out .ord-item-add { border-color: var(--rule); color: var(--rule); cursor: default; }
|
| 251 |
+
|
| 252 |
+
/* ββ Cart βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 253 |
+
.ord-cart {
|
| 254 |
+
position: fixed;
|
| 255 |
+
bottom: 0;
|
| 256 |
+
left: 0;
|
| 257 |
+
right: 0;
|
| 258 |
+
max-width: 800px;
|
| 259 |
+
margin: 0 auto;
|
| 260 |
+
background: var(--white);
|
| 261 |
+
border-top: 1px solid var(--rule);
|
| 262 |
+
z-index: 40;
|
| 263 |
+
max-height: 50vh;
|
| 264 |
+
overflow-y: auto;
|
| 265 |
+
box-shadow: 0 -4px 24px rgba(27, 21, 18, 0.08);
|
| 266 |
+
transition: max-height 0.25s var(--ease);
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
.ord-cart.collapsed {
|
| 270 |
+
max-height: 56px;
|
| 271 |
+
overflow: hidden;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
.ord-cart-head {
|
| 275 |
+
display: flex;
|
| 276 |
+
justify-content: space-between;
|
| 277 |
+
align-items: center;
|
| 278 |
+
padding: 14px 18px 10px;
|
| 279 |
+
cursor: pointer;
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
.ord-cart-head h2 {
|
| 283 |
+
font-family: var(--font-display);
|
| 284 |
+
font-size: 1rem;
|
| 285 |
+
font-weight: 600;
|
| 286 |
+
color: var(--roast);
|
| 287 |
+
letter-spacing: -0.01em;
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
.ord-cart-total {
|
| 291 |
+
font-family: var(--font-display);
|
| 292 |
+
font-size: 1.05rem;
|
| 293 |
+
font-weight: 700;
|
| 294 |
+
color: var(--green);
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
.ord-cart-items {
|
| 298 |
+
padding: 0 18px 8px;
|
| 299 |
+
max-height: 200px;
|
| 300 |
+
overflow-y: auto;
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
.ord-cart-empty {
|
| 304 |
+
font-size: 0.78rem;
|
| 305 |
+
color: var(--parchment);
|
| 306 |
+
padding: 8px 0;
|
| 307 |
+
text-align: center;
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
.cart-item {
|
| 311 |
+
display: flex;
|
| 312 |
+
align-items: center;
|
| 313 |
+
justify-content: space-between;
|
| 314 |
+
padding: 8px 0;
|
| 315 |
+
border-bottom: 1px solid var(--rule-light);
|
| 316 |
+
gap: 8px;
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
.cart-item:last-child { border-bottom: none; }
|
| 320 |
+
|
| 321 |
+
.cart-item-info {
|
| 322 |
+
flex: 1;
|
| 323 |
+
min-width: 0;
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
.cart-item-name {
|
| 327 |
+
font-weight: 600;
|
| 328 |
+
font-size: 0.82rem;
|
| 329 |
+
color: var(--roast);
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
.cart-item-meta {
|
| 333 |
+
font-size: 0.68rem;
|
| 334 |
+
color: var(--parchment);
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
.cart-item-qty {
|
| 338 |
+
display: flex;
|
| 339 |
+
align-items: center;
|
| 340 |
+
gap: 4px;
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
.cart-qty-btn {
|
| 344 |
+
width: 26px;
|
| 345 |
+
height: 26px;
|
| 346 |
+
border-radius: 50%;
|
| 347 |
+
border: 1px solid var(--rule);
|
| 348 |
+
background: var(--white);
|
| 349 |
+
font-size: 0.85rem;
|
| 350 |
+
color: var(--roast-med);
|
| 351 |
+
cursor: pointer;
|
| 352 |
+
display: flex;
|
| 353 |
+
align-items: center;
|
| 354 |
+
justify-content: center;
|
| 355 |
+
line-height: 1;
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
.cart-qty-btn:active { background: var(--paper); }
|
| 359 |
+
|
| 360 |
+
.cart-qty-num {
|
| 361 |
+
width: 26px;
|
| 362 |
+
text-align: center;
|
| 363 |
+
font-size: 0.82rem;
|
| 364 |
+
font-weight: 600;
|
| 365 |
+
color: var(--roast);
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
.cart-item-price {
|
| 369 |
+
font-weight: 600;
|
| 370 |
+
font-size: 0.82rem;
|
| 371 |
+
color: var(--roast-med);
|
| 372 |
+
min-width: 48px;
|
| 373 |
+
text-align: right;
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
.cart-item-remove {
|
| 377 |
+
width: 24px;
|
| 378 |
+
height: 24px;
|
| 379 |
+
border: none;
|
| 380 |
+
background: none;
|
| 381 |
+
color: var(--cherry);
|
| 382 |
+
cursor: pointer;
|
| 383 |
+
font-size: 0.9rem;
|
| 384 |
+
display: flex;
|
| 385 |
+
align-items: center;
|
| 386 |
+
justify-content: center;
|
| 387 |
+
opacity: 0.5;
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
.cart-item-remove:hover { opacity: 1; }
|
| 391 |
+
|
| 392 |
+
.cart-item-custom {
|
| 393 |
+
font-style: italic;
|
| 394 |
+
color: var(--roast-med);
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
/* ββ Cart Note ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 398 |
+
.ord-cart-note {
|
| 399 |
+
padding: 0 18px 10px;
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
.ord-cart-note label {
|
| 403 |
+
display: block;
|
| 404 |
+
font-size: 0.65rem;
|
| 405 |
+
font-weight: 700;
|
| 406 |
+
letter-spacing: 0.08em;
|
| 407 |
+
text-transform: uppercase;
|
| 408 |
+
color: var(--parchment);
|
| 409 |
+
margin-bottom: 4px;
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
.ord-cart-note textarea {
|
| 413 |
+
width: 100%;
|
| 414 |
+
padding: 8px 10px;
|
| 415 |
+
border: 1px solid var(--rule);
|
| 416 |
+
font-family: var(--font-body);
|
| 417 |
+
font-size: 0.8rem;
|
| 418 |
+
color: var(--roast);
|
| 419 |
+
background: var(--paper);
|
| 420 |
+
resize: none;
|
| 421 |
+
transition: border-color 0.2s;
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
.ord-cart-note textarea:focus {
|
| 425 |
+
outline: none;
|
| 426 |
+
border-color: var(--green);
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
/* ββ Table Select (when no table param) βββββββββββββββββββββββββββββββ */
|
| 430 |
+
.ord-cart-table-row {
|
| 431 |
+
padding: 0 18px 10px;
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
.ord-cart-table-row label {
|
| 435 |
+
display: block;
|
| 436 |
+
font-size: 0.65rem;
|
| 437 |
+
font-weight: 700;
|
| 438 |
+
letter-spacing: 0.08em;
|
| 439 |
+
text-transform: uppercase;
|
| 440 |
+
color: var(--parchment);
|
| 441 |
+
margin-bottom: 4px;
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
.ord-cart-table-row select {
|
| 445 |
+
width: 100%;
|
| 446 |
+
padding: 8px 10px;
|
| 447 |
+
border: 1px solid var(--rule);
|
| 448 |
+
font-family: var(--font-body);
|
| 449 |
+
font-size: 0.82rem;
|
| 450 |
+
color: var(--roast);
|
| 451 |
+
background: var(--paper);
|
| 452 |
+
transition: border-color 0.2s;
|
| 453 |
+
appearance: none;
|
| 454 |
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23968878' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
|
| 455 |
+
background-repeat: no-repeat;
|
| 456 |
+
background-position: right 10px center;
|
| 457 |
+
padding-right: 30px;
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
.ord-cart-table-row select:focus {
|
| 461 |
+
outline: none;
|
| 462 |
+
border-color: var(--green);
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
/* ββ Submit Button ββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 466 |
+
.ord-submit {
|
| 467 |
+
display: block;
|
| 468 |
+
width: calc(100% - 36px);
|
| 469 |
+
margin: 8px 18px 18px;
|
| 470 |
+
padding: 14px;
|
| 471 |
+
background: var(--roast);
|
| 472 |
+
color: var(--paper);
|
| 473 |
+
border: none;
|
| 474 |
+
border-radius: 6px;
|
| 475 |
+
font-family: var(--font-body);
|
| 476 |
+
font-size: 0.88rem;
|
| 477 |
+
font-weight: 700;
|
| 478 |
+
cursor: pointer;
|
| 479 |
+
transition: background 0.2s, transform 0.1s;
|
| 480 |
+
letter-spacing: 0.02em;
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
.ord-submit:hover { background: var(--green); }
|
| 484 |
+
.ord-submit:active { transform: scale(0.98); }
|
| 485 |
+
.ord-submit:disabled {
|
| 486 |
+
background: var(--rule);
|
| 487 |
+
color: var(--parchment);
|
| 488 |
+
cursor: not-allowed;
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
+
/* ββ Toast ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 492 |
+
.ord-toast {
|
| 493 |
+
position: fixed;
|
| 494 |
+
top: 60px;
|
| 495 |
+
left: 50%;
|
| 496 |
+
transform: translateX(-50%);
|
| 497 |
+
z-index: 100;
|
| 498 |
+
pointer-events: none;
|
| 499 |
+
opacity: 0;
|
| 500 |
+
transition: opacity 0.3s var(--ease);
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
.ord-toast.show {
|
| 504 |
+
opacity: 1;
|
| 505 |
+
pointer-events: auto;
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
.ord-toast-inner {
|
| 509 |
+
background: var(--roast);
|
| 510 |
+
color: var(--paper);
|
| 511 |
+
padding: 12px 24px;
|
| 512 |
+
border-radius: 8px;
|
| 513 |
+
font-size: 0.85rem;
|
| 514 |
+
font-weight: 500;
|
| 515 |
+
text-align: center;
|
| 516 |
+
box-shadow: 0 4px 16px rgba(27, 21, 18, 0.15);
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
/* ββ Success State ββββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 520 |
+
.ord-success {
|
| 521 |
+
text-align: center;
|
| 522 |
+
padding: 60px 20px;
|
| 523 |
+
}
|
| 524 |
+
|
| 525 |
+
.ord-success-icon {
|
| 526 |
+
width: 64px;
|
| 527 |
+
height: 64px;
|
| 528 |
+
margin: 0 auto 20px;
|
| 529 |
+
background: var(--green);
|
| 530 |
+
border-radius: 50%;
|
| 531 |
+
display: flex;
|
| 532 |
+
align-items: center;
|
| 533 |
+
justify-content: center;
|
| 534 |
+
color: var(--white);
|
| 535 |
+
}
|
| 536 |
+
|
| 537 |
+
.ord-success h2 {
|
| 538 |
+
font-family: var(--font-display);
|
| 539 |
+
font-size: 1.4rem;
|
| 540 |
+
color: var(--roast);
|
| 541 |
+
margin-bottom: 8px;
|
| 542 |
+
}
|
| 543 |
+
|
| 544 |
+
.ord-success p {
|
| 545 |
+
color: var(--roast-med);
|
| 546 |
+
font-size: 0.88rem;
|
| 547 |
+
margin-bottom: 24px;
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
+
/* ββ Reduced Motion βββββββββββββββββββββββββββββββββββββββββββββββββββ */
|
| 551 |
+
@media (prefers-reduced-motion: reduce) {
|
| 552 |
+
*, *::before, *::after {
|
| 553 |
+
animation-duration: 0.01ms !important;
|
| 554 |
+
transition-duration: 0.01ms !important;
|
| 555 |
+
}
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
/* ββ Desktop (wider than 500px) βββββββββββββββββββββββββββββββββββββββ */
|
| 559 |
+
@media (min-width: 500px) {
|
| 560 |
+
.ord-main {
|
| 561 |
+
flex-direction: row;
|
| 562 |
+
gap: 24px;
|
| 563 |
+
padding: 24px 20px 120px;
|
| 564 |
+
}
|
| 565 |
+
|
| 566 |
+
.ord-menu { flex: 1; }
|
| 567 |
+
.ord-cart {
|
| 568 |
+
position: sticky;
|
| 569 |
+
bottom: auto;
|
| 570 |
+
top: 72px;
|
| 571 |
+
width: 300px;
|
| 572 |
+
flex-shrink: 0;
|
| 573 |
+
border: 1px solid var(--rule);
|
| 574 |
+
border-top: 1px solid var(--rule);
|
| 575 |
+
box-shadow: none;
|
| 576 |
+
align-self: flex-start;
|
| 577 |
+
max-height: calc(100vh - 100px);
|
| 578 |
+
}
|
| 579 |
+
}
|
public/index.html
CHANGED
|
@@ -17,6 +17,7 @@
|
|
| 17 |
<a href="#" class="nav-logo">The Roasted Bean</a>
|
| 18 |
<div class="nav-links">
|
| 19 |
<a href="#menu">Menu</a>
|
|
|
|
| 20 |
<a href="#about">About</a>
|
| 21 |
<a href="#visit">Visit</a>
|
| 22 |
</div>
|
|
|
|
| 17 |
<a href="#" class="nav-logo">The Roasted Bean</a>
|
| 18 |
<div class="nav-links">
|
| 19 |
<a href="#menu">Menu</a>
|
| 20 |
+
<a href="/order">Order</a>
|
| 21 |
<a href="#about">About</a>
|
| 22 |
<a href="#visit">Visit</a>
|
| 23 |
</div>
|
public/js/admin.js
CHANGED
|
@@ -89,6 +89,10 @@ function showSection(section) {
|
|
| 89 |
document.getElementById('infoSection').style.display = '';
|
| 90 |
renderInfo();
|
| 91 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
case 'settings':
|
| 93 |
document.getElementById('settingsSection').style.display = '';
|
| 94 |
break;
|
|
@@ -408,6 +412,143 @@ function setupForms() {
|
|
| 408 |
});
|
| 409 |
}
|
| 410 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 411 |
// ββ Toast βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 412 |
function showToast(msg, type = 'success') {
|
| 413 |
const container = document.getElementById('toastContainer');
|
|
|
|
| 89 |
document.getElementById('infoSection').style.display = '';
|
| 90 |
renderInfo();
|
| 91 |
break;
|
| 92 |
+
case 'tables':
|
| 93 |
+
document.getElementById('tablesSection').style.display = '';
|
| 94 |
+
setupTablesSection();
|
| 95 |
+
break;
|
| 96 |
case 'settings':
|
| 97 |
document.getElementById('settingsSection').style.display = '';
|
| 98 |
break;
|
|
|
|
| 412 |
});
|
| 413 |
}
|
| 414 |
|
| 415 |
+
// ββ Tables & Orders ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 416 |
+
let tablesSetup = false;
|
| 417 |
+
|
| 418 |
+
function setupTablesSection() {
|
| 419 |
+
if (tablesSetup) { renderOrders(); return; }
|
| 420 |
+
tablesSetup = true;
|
| 421 |
+
|
| 422 |
+
document.getElementById('saveTablesBtn').addEventListener('click', saveTableCount);
|
| 423 |
+
document.getElementById('loadQrBtn').addEventListener('click', loadQrCodes);
|
| 424 |
+
document.getElementById('refreshOrdersBtn').addEventListener('click', () => { renderOrders(); });
|
| 425 |
+
|
| 426 |
+
// Set current table count
|
| 427 |
+
document.getElementById('tableCount').value = menuData.tables || 0;
|
| 428 |
+
renderOrders();
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
async function saveTableCount() {
|
| 432 |
+
const count = parseInt(document.getElementById('tableCount').value);
|
| 433 |
+
if (isNaN(count) || count < 0 || count > 100) {
|
| 434 |
+
return showToast('Enter 0β100', 'error');
|
| 435 |
+
}
|
| 436 |
+
try {
|
| 437 |
+
const res = await fetch('/api/tables', {
|
| 438 |
+
method: 'PUT',
|
| 439 |
+
headers: { 'Content-Type': 'application/json' },
|
| 440 |
+
body: JSON.stringify({ count })
|
| 441 |
+
});
|
| 442 |
+
if (!res.ok) throw new Error('Failed');
|
| 443 |
+
menuData.tables = count;
|
| 444 |
+
showToast(`Saved: ${count} tables`, 'success');
|
| 445 |
+
} catch { showToast('Error saving', 'error'); }
|
| 446 |
+
}
|
| 447 |
+
|
| 448 |
+
async function loadQrCodes() {
|
| 449 |
+
const grid = document.getElementById('qrGrid');
|
| 450 |
+
grid.innerHTML = '<p style="color:var(--parchment);font-size:0.82rem;padding:20px;">Generating QR codesβ¦</p>';
|
| 451 |
+
try {
|
| 452 |
+
const res = await fetch('/api/qr');
|
| 453 |
+
if (!res.ok) throw new Error('Failed');
|
| 454 |
+
const qrs = await res.json();
|
| 455 |
+
|
| 456 |
+
if (qrs.length === 0) {
|
| 457 |
+
grid.innerHTML = '<p style="color:var(--parchment);font-size:0.82rem;padding:32px;">No tables configured. Set the number above first.</p>';
|
| 458 |
+
return;
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
grid.innerHTML = qrs.map(q => `
|
| 462 |
+
<div class="qr-card">
|
| 463 |
+
<img src="${q.dataUrl}" alt="QR for Table ${q.table}" width="150" height="150">
|
| 464 |
+
<div class="qr-label">Table ${q.table}</div>
|
| 465 |
+
<div class="qr-url">${esc(q.url)}</div>
|
| 466 |
+
</div>
|
| 467 |
+
`).join('');
|
| 468 |
+
|
| 469 |
+
showToast(`${qrs.length} QR codes ready for print`, 'success');
|
| 470 |
+
} catch (err) {
|
| 471 |
+
console.error(err);
|
| 472 |
+
grid.innerHTML = '<p style="color:var(--cherry);font-size:0.82rem;padding:32px;">Failed to generate QR codes.</p>';
|
| 473 |
+
}
|
| 474 |
+
}
|
| 475 |
+
|
| 476 |
+
async function renderOrders() {
|
| 477 |
+
const container = document.getElementById('ordersContainer');
|
| 478 |
+
try {
|
| 479 |
+
const res = await fetch('/api/orders');
|
| 480 |
+
if (!res.ok) throw new Error('Failed');
|
| 481 |
+
const orders = await res.json();
|
| 482 |
+
|
| 483 |
+
if (orders.length === 0) {
|
| 484 |
+
container.innerHTML = '<p style="color:var(--parchment);font-size:0.82rem;padding:16px 0;">No active orders.</p>';
|
| 485 |
+
return;
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
const statusLabel = { pending: 'New', served: 'Served', paid: 'Paid', cancelled: 'Cancelled' };
|
| 489 |
+
const statusClass = { pending: 'badge-order-new', served: 'badge-order-served', paid: 'badge-order-paid', cancelled: 'badge-order-cancelled' };
|
| 490 |
+
|
| 491 |
+
container.innerHTML = orders.map(o => `
|
| 492 |
+
<div class="order-card ${o.status === 'cancelled' ? 'order-cancelled' : ''}">
|
| 493 |
+
<div class="order-card-head">
|
| 494 |
+
<div>
|
| 495 |
+
<span class="order-tbl">Table ${o.table}</span>
|
| 496 |
+
<span class="order-time">${timeAgo(o.createdAt)}</span>
|
| 497 |
+
</div>
|
| 498 |
+
<span class="badge ${statusClass[o.status] || ''}">${statusLabel[o.status] || o.status}</span>
|
| 499 |
+
</div>
|
| 500 |
+
<div class="order-card-body">
|
| 501 |
+
<ul class="order-items">
|
| 502 |
+
${o.items.map(i => i.mid
|
| 503 |
+
? `<li>${i.qty}Γ ${esc(i.name)} <span>$${(i.price * i.qty).toFixed(2)}</span></li>`
|
| 504 |
+
: `<li class="order-item-custom">"${esc(i.text)}"</li>`
|
| 505 |
+
).join('')}
|
| 506 |
+
</ul>
|
| 507 |
+
${o.note ? `<p class="order-note">π ${esc(o.note)}</p>` : ''}
|
| 508 |
+
<p class="order-total">Total: $${o.total.toFixed(2)}</p>
|
| 509 |
+
</div>
|
| 510 |
+
${o.status !== 'cancelled' ? `
|
| 511 |
+
<div class="order-card-actions">
|
| 512 |
+
${o.status === 'pending' ? `<button class="btn act-order serve" data-id="${o.id}" data-status="served">β Served</button>` : ''}
|
| 513 |
+
${o.status === 'served' ? `<button class="btn act-order paid" data-id="${o.id}" data-status="paid">$ Paid</button>` : ''}
|
| 514 |
+
${o.status !== 'paid' ? `<button class="btn btn-ghost act-order cancel" data-id="${o.id}" data-status="cancelled">β Cancel</button>` : ''}
|
| 515 |
+
</div>
|
| 516 |
+
` : ''}
|
| 517 |
+
</div>
|
| 518 |
+
`).join('');
|
| 519 |
+
|
| 520 |
+
// Wire up action buttons
|
| 521 |
+
container.querySelectorAll('.act-order').forEach(btn => {
|
| 522 |
+
btn.addEventListener('click', async () => {
|
| 523 |
+
const id = btn.dataset.id;
|
| 524 |
+
const status = btn.dataset.status;
|
| 525 |
+
try {
|
| 526 |
+
const res = await fetch(`/api/orders/${id}`, {
|
| 527 |
+
method: 'PUT',
|
| 528 |
+
headers: { 'Content-Type': 'application/json' },
|
| 529 |
+
body: JSON.stringify({ status })
|
| 530 |
+
});
|
| 531 |
+
if (!res.ok) throw new Error('Failed');
|
| 532 |
+
showToast(`Order ${status}`, 'success');
|
| 533 |
+
renderOrders();
|
| 534 |
+
} catch { showToast('Error updating', 'error'); }
|
| 535 |
+
});
|
| 536 |
+
});
|
| 537 |
+
} catch (err) {
|
| 538 |
+
console.error(err);
|
| 539 |
+
container.innerHTML = '<p style="color:var(--cherry);">Failed to load orders.</p>';
|
| 540 |
+
}
|
| 541 |
+
}
|
| 542 |
+
|
| 543 |
+
function timeAgo(iso) {
|
| 544 |
+
const diff = Math.floor((Date.now() - new Date(iso).getTime()) / 1000);
|
| 545 |
+
if (diff < 60) return 'just now';
|
| 546 |
+
if (diff < 3600) return `${Math.floor(diff / 60)}m ago`;
|
| 547 |
+
if (diff < 86400) return `${Math.floor(diff / 3600)}h ago`;
|
| 548 |
+
const d = new Date(iso);
|
| 549 |
+
return d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' });
|
| 550 |
+
}
|
| 551 |
+
|
| 552 |
// ββ Toast βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 553 |
function showToast(msg, type = 'success') {
|
| 554 |
const container = document.getElementById('toastContainer');
|
public/js/order.js
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// ββ Order Page β The Roasted Bean βββββββββββββββββββββββββββββββββββββ
|
| 2 |
+
|
| 3 |
+
let menuData = null;
|
| 4 |
+
let cart = [];
|
| 5 |
+
let tableNumber = null;
|
| 6 |
+
let tablesCount = 0;
|
| 7 |
+
|
| 8 |
+
document.addEventListener('DOMContentLoaded', init);
|
| 9 |
+
|
| 10 |
+
async function init() {
|
| 11 |
+
// Get table from URL
|
| 12 |
+
const params = new URLSearchParams(window.location.search);
|
| 13 |
+
const tableParam = params.get('table');
|
| 14 |
+
if (tableParam) {
|
| 15 |
+
tableNumber = parseInt(tableParam);
|
| 16 |
+
document.getElementById('tableNumber').textContent = `#${tableNumber}`;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
// Load data
|
| 20 |
+
const [menuRes, tablesRes] = await Promise.all([
|
| 21 |
+
fetch('/api/menu'),
|
| 22 |
+
fetch('/api/tables')
|
| 23 |
+
]);
|
| 24 |
+
menuData = await menuRes.json();
|
| 25 |
+
const tablesData = await tablesRes.json();
|
| 26 |
+
tablesCount = tablesData.tables || 0;
|
| 27 |
+
|
| 28 |
+
// No table from URL β show table selector
|
| 29 |
+
if (!tableNumber) {
|
| 30 |
+
document.getElementById('tableDisplay').style.display = 'none';
|
| 31 |
+
const sel = document.getElementById('cartTableSelect');
|
| 32 |
+
sel.innerHTML = '<option value="">Select your table</option>' +
|
| 33 |
+
Array.from({ length: tablesCount }, (_, i) =>
|
| 34 |
+
`<option value="${i + 1}">Table ${i + 1}</option>`
|
| 35 |
+
).join('');
|
| 36 |
+
sel.addEventListener('change', () => {
|
| 37 |
+
tableNumber = parseInt(sel.value) || null;
|
| 38 |
+
updateSubmit();
|
| 39 |
+
});
|
| 40 |
+
document.getElementById('cartTableRow').style.display = '';
|
| 41 |
+
} else {
|
| 42 |
+
document.getElementById('cartTableRow').style.display = 'none';
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
renderFilters();
|
| 46 |
+
renderItems();
|
| 47 |
+
updateSubmit();
|
| 48 |
+
setupCartToggle();
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
// ββ Filters ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 52 |
+
function renderFilters() {
|
| 53 |
+
const cats = menuData.categories || [];
|
| 54 |
+
const container = document.getElementById('ordFilters');
|
| 55 |
+
container.innerHTML = cats.map(c => `
|
| 56 |
+
<button class="ord-filter-btn${c.id === 'all' ? ' active' : ''}" data-cat="${c.id}">
|
| 57 |
+
${c.name}
|
| 58 |
+
</button>
|
| 59 |
+
`).join('');
|
| 60 |
+
|
| 61 |
+
container.addEventListener('click', (e) => {
|
| 62 |
+
const btn = e.target.closest('.ord-filter-btn');
|
| 63 |
+
if (!btn) return;
|
| 64 |
+
container.querySelectorAll('.ord-filter-btn').forEach(b => b.classList.remove('active'));
|
| 65 |
+
btn.classList.add('active');
|
| 66 |
+
renderItems(btn.dataset.cat);
|
| 67 |
+
});
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
// ββ Items ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 71 |
+
function renderItems(catId = 'all') {
|
| 72 |
+
const container = document.getElementById('ordItems');
|
| 73 |
+
let items = menuData.items || [];
|
| 74 |
+
if (catId !== 'all') items = items.filter(i => i.category === catId);
|
| 75 |
+
|
| 76 |
+
container.innerHTML = items.map(item => {
|
| 77 |
+
const hasImg = item.image && item.image.startsWith('http');
|
| 78 |
+
const thumbSvg = svgPlaceholder(item.category);
|
| 79 |
+
const inCart = cart.find(c => c.mid === item.id);
|
| 80 |
+
const qty = inCart ? inCart.qty : 0;
|
| 81 |
+
|
| 82 |
+
return `
|
| 83 |
+
<div class="ord-item${!item.available ? ' sold-out' : ''}" data-id="${item.id}">
|
| 84 |
+
<div class="ord-item-img">
|
| 85 |
+
${thumbSvg}
|
| 86 |
+
${hasImg ? `<img src="${esc(item.image)}" alt="" loading="lazy" onerror="this.style.display='none'">` : ''}
|
| 87 |
+
</div>
|
| 88 |
+
<div class="ord-item-info">
|
| 89 |
+
<div class="ord-item-name">${esc(item.name)}</div>
|
| 90 |
+
<div class="ord-item-desc">${esc(item.description || '')}</div>
|
| 91 |
+
</div>
|
| 92 |
+
<div class="ord-item-price">$${item.price.toFixed(2)}</div>
|
| 93 |
+
<button class="ord-item-add" ${!item.available ? 'disabled' : ''}>${qty > 0 ? qty : '+'}</button>
|
| 94 |
+
</div>
|
| 95 |
+
`;
|
| 96 |
+
}).join('');
|
| 97 |
+
|
| 98 |
+
// Click handler
|
| 99 |
+
container.querySelectorAll('.ord-item:not(.sold-out)').forEach(el => {
|
| 100 |
+
el.addEventListener('click', () => {
|
| 101 |
+
const id = el.dataset.id;
|
| 102 |
+
const item = menuData.items.find(i => i.id === id);
|
| 103 |
+
if (!item) return;
|
| 104 |
+
addToCart(item);
|
| 105 |
+
});
|
| 106 |
+
});
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
// ββ Cart ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 110 |
+
function addToCart(item) {
|
| 111 |
+
const existing = cart.find(c => c.mid === item.id);
|
| 112 |
+
if (existing) {
|
| 113 |
+
existing.qty++;
|
| 114 |
+
} else {
|
| 115 |
+
cart.push({ mid: item.id, name: item.name, price: item.price, qty: 1 });
|
| 116 |
+
}
|
| 117 |
+
renderCart();
|
| 118 |
+
renderItems(document.querySelector('.ord-filter-btn.active')?.dataset?.cat || 'all');
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
function removeFromCart(mid) {
|
| 122 |
+
cart = cart.filter(c => c.mid !== mid);
|
| 123 |
+
renderCart();
|
| 124 |
+
renderItems(document.querySelector('.ord-filter-btn.active')?.dataset?.cat || 'all');
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
function changeQty(mid, delta) {
|
| 128 |
+
const item = cart.find(c => c.mid === mid);
|
| 129 |
+
if (!item) return;
|
| 130 |
+
item.qty += delta;
|
| 131 |
+
if (item.qty <= 0) {
|
| 132 |
+
removeFromCart(mid);
|
| 133 |
+
return;
|
| 134 |
+
}
|
| 135 |
+
renderCart();
|
| 136 |
+
renderItems(document.querySelector('.ord-filter-btn.active')?.dataset?.cat || 'all');
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
function renderCart() {
|
| 140 |
+
const container = document.getElementById('cartItems');
|
| 141 |
+
const total = cart.reduce((sum, c) => sum + c.price * c.qty, 0);
|
| 142 |
+
|
| 143 |
+
if (cart.length === 0) {
|
| 144 |
+
container.innerHTML = '<p class="ord-cart-empty">Tap items from the menu to add them here.</p>';
|
| 145 |
+
} else {
|
| 146 |
+
container.innerHTML = cart.map(c => `
|
| 147 |
+
<div class="cart-item">
|
| 148 |
+
<div class="cart-item-info">
|
| 149 |
+
<div class="cart-item-name">${esc(c.name)}</div>
|
| 150 |
+
<div class="cart-item-meta">$${c.price.toFixed(2)} each</div>
|
| 151 |
+
</div>
|
| 152 |
+
<div class="cart-item-qty">
|
| 153 |
+
<button class="cart-qty-btn" data-action="minus" data-mid="${c.mid}">β</button>
|
| 154 |
+
<span class="cart-qty-num">${c.qty}</span>
|
| 155 |
+
<button class="cart-qty-btn" data-action="plus" data-mid="${c.mid}">+</button>
|
| 156 |
+
</div>
|
| 157 |
+
<div class="cart-item-price">$${(c.price * c.qty).toFixed(2)}</div>
|
| 158 |
+
<button class="cart-item-remove" data-action="remove" data-mid="${c.mid}">β</button>
|
| 159 |
+
</div>
|
| 160 |
+
`).join('');
|
| 161 |
+
|
| 162 |
+
container.querySelectorAll('.cart-qty-btn, .cart-item-remove').forEach(btn => {
|
| 163 |
+
btn.addEventListener('click', (e) => {
|
| 164 |
+
e.stopPropagation();
|
| 165 |
+
const action = btn.dataset.action;
|
| 166 |
+
const mid = btn.dataset.mid;
|
| 167 |
+
if (action === 'plus') changeQty(mid, 1);
|
| 168 |
+
else if (action === 'minus') changeQty(mid, -1);
|
| 169 |
+
else if (action === 'remove') removeFromCart(mid);
|
| 170 |
+
});
|
| 171 |
+
});
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
document.getElementById('cartTotal').textContent = `$${total.toFixed(2)}`;
|
| 175 |
+
document.getElementById('cartCount').textContent = cart.reduce((s, c) => s + c.qty, 0);
|
| 176 |
+
document.getElementById('cartBadge').style.display = cart.length > 0 ? '' : 'none';
|
| 177 |
+
|
| 178 |
+
updateSubmit();
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
// ββ Submit ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 182 |
+
function updateSubmit() {
|
| 183 |
+
const btn = document.getElementById('submitBtn');
|
| 184 |
+
const valid = cart.length > 0 && !!tableNumber;
|
| 185 |
+
btn.disabled = !valid;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
document.getElementById('submitBtn').addEventListener('click', async () => {
|
| 189 |
+
if (!tableNumber || cart.length === 0) return;
|
| 190 |
+
|
| 191 |
+
const note = document.getElementById('orderNote').value.trim();
|
| 192 |
+
const btn = document.getElementById('submitBtn');
|
| 193 |
+
btn.disabled = true;
|
| 194 |
+
btn.textContent = 'Placing orderβ¦';
|
| 195 |
+
|
| 196 |
+
try {
|
| 197 |
+
const res = await fetch('/api/orders', {
|
| 198 |
+
method: 'POST',
|
| 199 |
+
headers: { 'Content-Type': 'application/json' },
|
| 200 |
+
body: JSON.stringify({ table: tableNumber, items: cart, note })
|
| 201 |
+
});
|
| 202 |
+
if (!res.ok) throw new Error((await res.json()).error || 'Failed');
|
| 203 |
+
|
| 204 |
+
// Success state
|
| 205 |
+
document.getElementById('ordMenu').innerHTML = `
|
| 206 |
+
<div class="ord-success">
|
| 207 |
+
<div class="ord-success-icon">
|
| 208 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>
|
| 209 |
+
</div>
|
| 210 |
+
<h2>Order placed!</h2>
|
| 211 |
+
<p>Table #${tableNumber} β your order is being prepared.</p>
|
| 212 |
+
<p style="font-size:0.78rem;color:var(--parchment);">Total: $${cart.reduce((s,c)=>s+c.price*c.qty,0).toFixed(2)}</p>
|
| 213 |
+
${note ? `<p style="font-size:0.75rem;color:var(--parchment);margin-top:4px;">Note: ${esc(note)}</p>` : ''}
|
| 214 |
+
</div>
|
| 215 |
+
`;
|
| 216 |
+
document.getElementById('ordCart').style.display = 'none';
|
| 217 |
+
|
| 218 |
+
// Show toast then redirect
|
| 219 |
+
showToast('β Sent to the kitchen!');
|
| 220 |
+
setTimeout(() => { window.location.href = '/'; }, 6000);
|
| 221 |
+
} catch (err) {
|
| 222 |
+
btn.disabled = false;
|
| 223 |
+
btn.textContent = 'Place order';
|
| 224 |
+
showToast('Something went wrong. Try again.');
|
| 225 |
+
console.error(err);
|
| 226 |
+
}
|
| 227 |
+
});
|
| 228 |
+
|
| 229 |
+
// ββ Cart Toggle (mobile) ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 230 |
+
function setupCartToggle() {
|
| 231 |
+
const cart = document.getElementById('ordCart');
|
| 232 |
+
const head = cart.querySelector('.ord-cart-head');
|
| 233 |
+
head.addEventListener('click', () => {
|
| 234 |
+
cart.classList.toggle('collapsed');
|
| 235 |
+
});
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
// ββ Toast ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 239 |
+
function showToast(msg) {
|
| 240 |
+
const container = document.getElementById('ordToast');
|
| 241 |
+
container.innerHTML = `<div class="ord-toast-inner">${msg}</div>`;
|
| 242 |
+
container.classList.add('show');
|
| 243 |
+
setTimeout(() => container.classList.remove('show'), 2500);
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
// ββ Utils βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 247 |
+
function esc(str) {
|
| 248 |
+
const div = document.createElement('div');
|
| 249 |
+
div.textContent = str || '';
|
| 250 |
+
return div.innerHTML;
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
function svgPlaceholder(category) {
|
| 254 |
+
const svgs = {
|
| 255 |
+
'coffee': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4h14v12a2 2 0 01-2 2H6a2 2 0 01-2-2V4z"/><path d="M18 9h2a2 2 0 012 2v1a2 2 0 01-2 2h-2"/><ellipse cx="8" cy="14" rx="2" ry="1.5"/><path d="M8 1v2" opacity="0.4"/><path d="M6 0v2" opacity="0.3"/><path d="M10 0v2" opacity="0.3"/></svg>',
|
| 256 |
+
'tea': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M5 8h10a3 3 0 013 3v3a3 3 0 01-3 3H5a3 3 0 01-3-3v-3a3 3 0 013-3z"/><path d="M2 11l-2 3h2l1-3"/><path d="M7 8V6a1 1 0 011-1h2a1 1 0 011 1v2"/><circle cx="10" cy="3.5" r="1.2"/><path d="M8 1v2" opacity="0.4"/><path d="M10 0v2" opacity="0.3"/><path d="M12 1v2" opacity="0.3"/></svg>',
|
| 257 |
+
'pastries': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M4 16C4 16 6 10 12 8s10 0 10 0c-4 2-6 8-6 8"/><path d="M5 14c1-3 4-6 7-7"/><path d="M19 14c-1-3-4-6-7-7"/><path d="M8 10h8" opacity="0.3"/></svg>',
|
| 258 |
+
'food': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="12" cy="18" rx="10" ry="3"/><rect x="8" y="8" width="8" height="7" rx="1"/><line x1="10" y1="9.5" x2="14" y2="9.5" opacity="0.4"/><line x1="10" y1="11.5" x2="14" y2="11.5" opacity="0.3"/><ellipse cx="12" cy="16" rx="3" ry="2" fill="currentColor" opacity="0.15"/></svg>'
|
| 259 |
+
};
|
| 260 |
+
return svgs[category] || svgs['coffee'];
|
| 261 |
+
}
|
public/order.html
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Order β The Roasted Bean</title>
|
| 7 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 8 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 9 |
+
<link href="https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;0,6..72,700&family=Figtree:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 10 |
+
<link rel="stylesheet" href="/css/order.css">
|
| 11 |
+
</head>
|
| 12 |
+
<body>
|
| 13 |
+
|
| 14 |
+
<header class="ord-header">
|
| 15 |
+
<div class="ord-header-inner">
|
| 16 |
+
<a href="/" class="ord-logo">β Back</a>
|
| 17 |
+
<div class="ord-table" id="tableDisplay">
|
| 18 |
+
<span class="ord-table-label">Table</span>
|
| 19 |
+
<span class="ord-table-num" id="tableNumber">β</span>
|
| 20 |
+
</div>
|
| 21 |
+
<div class="ord-cart-badge" id="cartBadge" style="display:none">
|
| 22 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="9" cy="21" r="1"/><circle cx="20" cy="21" r="1"/><path d="M1 1h4l2.68 13.39a2 2 0 002 1.61h9.72a2 2 0 002-1.61L23 6H6"/></svg>
|
| 23 |
+
<span id="cartCount">0</span>
|
| 24 |
+
</div>
|
| 25 |
+
</div>
|
| 26 |
+
</header>
|
| 27 |
+
|
| 28 |
+
<main class="ord-main">
|
| 29 |
+
<!-- Menu items list -->
|
| 30 |
+
<section class="ord-menu" id="ordMenu">
|
| 31 |
+
<h2 class="ord-section-title">Menu</h2>
|
| 32 |
+
<div class="ord-filter" id="ordFilters"></div>
|
| 33 |
+
<div class="ord-items" id="ordItems"></div>
|
| 34 |
+
</section>
|
| 35 |
+
|
| 36 |
+
<!-- Cart panel -->
|
| 37 |
+
<aside class="ord-cart" id="ordCart">
|
| 38 |
+
<div class="ord-cart-head">
|
| 39 |
+
<h2>Your order</h2>
|
| 40 |
+
<span class="ord-cart-total" id="cartTotal">$0.00</span>
|
| 41 |
+
</div>
|
| 42 |
+
<div class="ord-cart-items" id="cartItems">
|
| 43 |
+
<p class="ord-cart-empty">Tap items from the menu to add them here.</p>
|
| 44 |
+
</div>
|
| 45 |
+
<div class="ord-cart-note">
|
| 46 |
+
<label for="orderNote">Special requests</label>
|
| 47 |
+
<textarea id="orderNote" rows="2" placeholder="e.g. Extra hot, oat milk instead"></textarea>
|
| 48 |
+
</div>
|
| 49 |
+
<div class="ord-cart-table-row" id="cartTableRow">
|
| 50 |
+
<label for="cartTableSelect">Table</label>
|
| 51 |
+
<select id="cartTableSelect"></select>
|
| 52 |
+
</div>
|
| 53 |
+
<button class="ord-submit" id="submitBtn" disabled>Place order</button>
|
| 54 |
+
</aside>
|
| 55 |
+
</main>
|
| 56 |
+
|
| 57 |
+
<!-- Confirmation toast -->
|
| 58 |
+
<div class="ord-toast" id="ordToast"></div>
|
| 59 |
+
|
| 60 |
+
<script src="/js/order.js"></script>
|
| 61 |
+
</body>
|
| 62 |
+
</html>
|
server.js
CHANGED
|
@@ -2,6 +2,7 @@ const express = require('express');
|
|
| 2 |
const session = require('express-session');
|
| 3 |
const bcrypt = require('bcryptjs');
|
| 4 |
const { v4: uuidv4 } = require('uuid');
|
|
|
|
| 5 |
const fs = require('fs');
|
| 6 |
const path = require('path');
|
| 7 |
|
|
@@ -181,6 +182,116 @@ app.put('/api/info', requireAuth, (req, res) => {
|
|
| 181 |
res.json(data.info);
|
| 182 |
});
|
| 183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
// ββ Health ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 185 |
app.get('/health', (req, res) => res.json({ status: 'ok' }));
|
| 186 |
|
|
@@ -189,12 +300,39 @@ app.get('/admin', (req, res) => {
|
|
| 189 |
res.sendFile(path.join(__dirname, 'public', 'admin.html'));
|
| 190 |
});
|
| 191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
// SPA fallback
|
| 193 |
app.get('*', (req, res) => {
|
| 194 |
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
| 195 |
});
|
| 196 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
// ββ Start βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 198 |
app.listen(PORT, '0.0.0.0', () => {
|
| 199 |
console.log(`β The Roasted Bean serving on 0.0.0.0:${PORT}`);
|
| 200 |
});
|
|
|
|
|
|
| 2 |
const session = require('express-session');
|
| 3 |
const bcrypt = require('bcryptjs');
|
| 4 |
const { v4: uuidv4 } = require('uuid');
|
| 5 |
+
const QRCode = require('qrcode');
|
| 6 |
const fs = require('fs');
|
| 7 |
const path = require('path');
|
| 8 |
|
|
|
|
| 182 |
res.json(data.info);
|
| 183 |
});
|
| 184 |
|
| 185 |
+
// ββ Tables API ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 186 |
+
app.get('/api/tables', (req, res) => {
|
| 187 |
+
const data = readMenu();
|
| 188 |
+
res.json({ tables: data.tables || 0 });
|
| 189 |
+
});
|
| 190 |
+
|
| 191 |
+
app.put('/api/tables', requireAuth, (req, res) => {
|
| 192 |
+
const { count } = req.body;
|
| 193 |
+
if (typeof count !== 'number' || count < 0 || count > 100) {
|
| 194 |
+
return res.status(400).json({ error: 'Count must be 0β100' });
|
| 195 |
+
}
|
| 196 |
+
const data = readMenu();
|
| 197 |
+
data.tables = count;
|
| 198 |
+
writeMenu(data);
|
| 199 |
+
res.json({ tables: count });
|
| 200 |
+
});
|
| 201 |
+
|
| 202 |
+
// ββ Orders API ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 203 |
+
// Create order (public)
|
| 204 |
+
app.post('/api/orders', (req, res) => {
|
| 205 |
+
const { table, items, note } = req.body;
|
| 206 |
+
if (!table || !items || !Array.isArray(items) || items.length === 0) {
|
| 207 |
+
return res.status(400).json({ error: 'table and items are required' });
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
const data = readMenu();
|
| 211 |
+
const orderItems = [];
|
| 212 |
+
let total = 0;
|
| 213 |
+
|
| 214 |
+
for (const it of items) {
|
| 215 |
+
if (it.mid) {
|
| 216 |
+
const menuItem = data.items.find(m => m.id === it.mid);
|
| 217 |
+
if (!menuItem || !menuItem.available) continue;
|
| 218 |
+
const qty = Math.max(1, it.qty || 1);
|
| 219 |
+
orderItems.push({ mid: menuItem.id, name: menuItem.name, price: menuItem.price, qty });
|
| 220 |
+
total += menuItem.price * qty;
|
| 221 |
+
} else if (it.text) {
|
| 222 |
+
orderItems.push({ text: it.text, price: 0 });
|
| 223 |
+
}
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
if (orderItems.length === 0) {
|
| 227 |
+
return res.status(400).json({ error: 'No valid items in order' });
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
const order = {
|
| 231 |
+
id: uuidv4(),
|
| 232 |
+
table: parseInt(table),
|
| 233 |
+
items: orderItems,
|
| 234 |
+
note: note || '',
|
| 235 |
+
status: 'pending',
|
| 236 |
+
total: Math.round(total * 100) / 100,
|
| 237 |
+
createdAt: new Date().toISOString()
|
| 238 |
+
};
|
| 239 |
+
|
| 240 |
+
data.orders = data.orders || [];
|
| 241 |
+
data.orders.push(order);
|
| 242 |
+
writeMenu(data);
|
| 243 |
+
res.status(201).json(order);
|
| 244 |
+
});
|
| 245 |
+
|
| 246 |
+
// Get all orders (admin)
|
| 247 |
+
app.get('/api/orders', requireAuth, (req, res) => {
|
| 248 |
+
const data = readMenu();
|
| 249 |
+
const orders = data.orders || [];
|
| 250 |
+
orders.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));
|
| 251 |
+
res.json(orders);
|
| 252 |
+
});
|
| 253 |
+
|
| 254 |
+
// Update order status (admin)
|
| 255 |
+
app.put('/api/orders/:id', requireAuth, (req, res) => {
|
| 256 |
+
const data = readMenu();
|
| 257 |
+
const idx = (data.orders || []).findIndex(o => o.id === req.params.id);
|
| 258 |
+
if (idx === -1) return res.status(404).json({ error: 'Order not found' });
|
| 259 |
+
|
| 260 |
+
const { status } = req.body;
|
| 261 |
+
if (!['pending', 'served', 'paid', 'cancelled'].includes(status)) {
|
| 262 |
+
return res.status(400).json({ error: 'Invalid status' });
|
| 263 |
+
}
|
| 264 |
+
data.orders[idx].status = status;
|
| 265 |
+
writeMenu(data);
|
| 266 |
+
res.json(data.orders[idx]);
|
| 267 |
+
});
|
| 268 |
+
|
| 269 |
+
// ββ QR Codes (admin) ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 270 |
+
app.get('/api/qr', requireAuth, async (req, res) => {
|
| 271 |
+
try {
|
| 272 |
+
const data = readMenu();
|
| 273 |
+
const count = data.tables || 0;
|
| 274 |
+
const host = req.get('host');
|
| 275 |
+
const baseUrl = (host && (host.includes('localhost') || host.includes('127.0.0.1')))
|
| 276 |
+
? 'https://qr-code-cafe.hf.space'
|
| 277 |
+
: `https://${host}`;
|
| 278 |
+
|
| 279 |
+
const qrs = [];
|
| 280 |
+
for (let i = 1; i <= count; i++) {
|
| 281 |
+
const url = `${baseUrl}/order?table=${i}`;
|
| 282 |
+
const dataUrl = await QRCode.toDataURL(url, {
|
| 283 |
+
width: 200, margin: 2,
|
| 284 |
+
color: { dark: '#1B1512', light: '#FFFFFF' }
|
| 285 |
+
});
|
| 286 |
+
qrs.push({ table: i, url, dataUrl });
|
| 287 |
+
}
|
| 288 |
+
res.json(qrs);
|
| 289 |
+
} catch (err) {
|
| 290 |
+
console.error('QR generation error:', err);
|
| 291 |
+
res.status(500).json({ error: 'QR generation failed' });
|
| 292 |
+
}
|
| 293 |
+
});
|
| 294 |
+
|
| 295 |
// ββ Health ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 296 |
app.get('/health', (req, res) => res.json({ status: 'ok' }));
|
| 297 |
|
|
|
|
| 300 |
res.sendFile(path.join(__dirname, 'public', 'admin.html'));
|
| 301 |
});
|
| 302 |
|
| 303 |
+
app.get('/order', (req, res) => {
|
| 304 |
+
res.sendFile(path.join(__dirname, 'public', 'order.html'));
|
| 305 |
+
});
|
| 306 |
+
|
| 307 |
// SPA fallback
|
| 308 |
app.get('*', (req, res) => {
|
| 309 |
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
| 310 |
});
|
| 311 |
|
| 312 |
+
// ββ Midnight cleanup ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 313 |
+
function scheduleMidnightCleanup() {
|
| 314 |
+
const now = new Date();
|
| 315 |
+
const midnight = new Date(now);
|
| 316 |
+
midnight.setHours(24, 0, 0, 0);
|
| 317 |
+
const msUntilMidnight = midnight - now;
|
| 318 |
+
|
| 319 |
+
setTimeout(() => {
|
| 320 |
+
try {
|
| 321 |
+
const data = readMenu();
|
| 322 |
+
if (data.orders && data.orders.length > 0) {
|
| 323 |
+
data.orders = [];
|
| 324 |
+
writeMenu(data);
|
| 325 |
+
console.log('ποΈ Midnight: cleared all orders');
|
| 326 |
+
}
|
| 327 |
+
} catch (err) {
|
| 328 |
+
console.error('Midnight cleanup error:', err);
|
| 329 |
+
}
|
| 330 |
+
scheduleMidnightCleanup();
|
| 331 |
+
}, msUntilMidnight);
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
// ββ Start βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 335 |
app.listen(PORT, '0.0.0.0', () => {
|
| 336 |
console.log(`β The Roasted Bean serving on 0.0.0.0:${PORT}`);
|
| 337 |
});
|
| 338 |
+
scheduleMidnightCleanup();
|