From f4d2f64e75ea782441d2512717d9ad26c8c21ecc Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Fri, 23 Jan 2026 22:02:56 +0800 Subject: admin machine status --- frontend/.DS_Store | Bin 6148 -> 6148 bytes frontend/admin/admin.js | 33 +++++++++++++++++++++++++++++++++ frontend/admin/panel.html | 6 +++++- 3 files changed, 38 insertions(+), 1 deletion(-) (limited to 'frontend') diff --git a/frontend/.DS_Store b/frontend/.DS_Store index 6e268de..ac6b678 100644 Binary files a/frontend/.DS_Store and b/frontend/.DS_Store differ diff --git a/frontend/admin/admin.js b/frontend/admin/admin.js index 6f1ebce..b78b1b3 100644 --- a/frontend/admin/admin.js +++ b/frontend/admin/admin.js @@ -38,9 +38,42 @@ async function panelLoginCheck() { if (await checkLoginStatus()) { msg.style.display = "none"; authDiv.style.display = "inherit"; + return true; } else { msg.style.display = "inherit"; authDiv.style.display = "none"; + return false; + } +} + +async function syncMachineStatus() { + const response = await fetch(`${API_URL}/admin_machine_status`, { + method: "POST", + credentials: "include", + }); + const data = await response.json(); + + for (let b = 1; b <= data.length; b++) { + for (let m = 1; m <= data[b].length; m++) { + const img = document.getElementById("h"+b.toString()+"m"+m.toString()+"img"); + const dropdown = document.getElementById("h"+b.toString()+"m"+m.toString()); + + if (data[b][m] != "OUTOFSERVICE") { + if (m % 2 == 0) { + img.src = "/assets/img/washer_down.png"; + } else { + img.src = "/assets/img/dryer_down.png"; + } + dropdown.selectedIndex = 1; + } else { + if (m % 2 == 0) { + img.src = "/assets/img/washer_off.png"; + } else { + img.src = "/assets/img/dryer_off.png"; + } + dropdown.selectedIndex = 0; + } + } } } diff --git a/frontend/admin/panel.html b/frontend/admin/panel.html index 1169c30..1b0f2cf 100644 --- a/frontend/admin/panel.html +++ b/frontend/admin/panel.html @@ -77,7 +77,11 @@ -- cgit v1.2.3