summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/main.py7
-rw-r--r--frontend/admin/admin-style.css11
-rw-r--r--frontend/admin/admin.js16
-rw-r--r--frontend/admin/index.html13
-rw-r--r--frontend/admin/panel.html31
-rw-r--r--frontend/main.js2
-rw-r--r--frontend/style.css8
7 files changed, 87 insertions, 1 deletions
diff --git a/backend/main.py b/backend/main.py
index db2519d..f027e9f 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -126,6 +126,7 @@ class FinishRequestData(BaseModel):
class OverrideMachineData(BaseModel):
block: int
machine_id: int
+ status: int # according to class Status
class Status(Enum):
@@ -472,6 +473,12 @@ def notif_subscribe(data: notif.PushSubscriptionData, response: fastapi.Response
# #### ADMIN PANEL API END POINTS ####
+# --- admin login
+@app.post("admin_login", response_class=PlainTextResponse)
+def admin_login(password: str, response: fastapi.Response):
+ pass
+
+
# --- override each machine status
@app.post("/override_status", response_class=PlainTextResponse)
def override_status(data: OverrideMachineData, response: fastapi.Response, admin_auth: Annotated[str | None, fastapi.Cookie()] = None):
diff --git a/frontend/admin/admin-style.css b/frontend/admin/admin-style.css
new file mode 100644
index 0000000..86be9f5
--- /dev/null
+++ b/frontend/admin/admin-style.css
@@ -0,0 +1,11 @@
+#unauthorised {
+
+}
+
+#authorised {
+
+}
+
+.admin-machine-container {
+
+}
diff --git a/frontend/admin/admin.js b/frontend/admin/admin.js
new file mode 100644
index 0000000..5a194c9
--- /dev/null
+++ b/frontend/admin/admin.js
@@ -0,0 +1,16 @@
+const API_URL = "https://backend.laundryweb.altafcreator.com"
+
+async function login() {
+ const field = document.getElementById("pwfield");
+
+ const response = await fetch(`${API_URL}/admin_login`, {
+ method: "POST",
+ credentials: "include",
+ headers: {
+ "Content-Type": "text/plain"
+ },
+ body: field.value,
+ });
+
+ alert("loggin' in");
+}
diff --git a/frontend/admin/index.html b/frontend/admin/index.html
new file mode 100644
index 0000000..8d415a1
--- /dev/null
+++ b/frontend/admin/index.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Victoria Hall LaundryWeb Admin Panel</title>
+ <link rel="stylesheet" href="./admin-style.css">
+</head>
+<body>
+ <h1>LaundryWeb Admin Panel Log In</h1>
+ <input type="password" id="pwfield"> <button onclick="login()">Log In</button>
+ <script src="./admin.js"></script>
+</body>
+</html>
diff --git a/frontend/admin/panel.html b/frontend/admin/panel.html
new file mode 100644
index 0000000..b912553
--- /dev/null
+++ b/frontend/admin/panel.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Victoria Hall LaundryWeb Admin Panel</title>
+ <link rel="stylesheet" href="./admin-style.css">
+</head>
+<body>
+ <h1>LaundryWeb Admin Panel</h1>
+ <p id="unauthorised">You are unauthorised.</p>
+ <!-- even if you make this div visible, you won't be able to do anything if you are unauthorised -->
+ <div id="authorised">
+ <div class="admin-machine-container">
+ <div>
+ <img src="" alt="">
+ <select id="h1w1" name="">
+ <option value="normal">Normal</option>
+ <option value="down">Out of Service</option>
+ </select>
+ </div>
+ <div>
+ <img src="" alt="">
+ <select id="h1d1" name="">
+ <option value="normal">Normal</option>
+ <option value="down">Out of Service</option>
+ </select>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/frontend/main.js b/frontend/main.js
index ee61db1..cfacc86 100644
--- a/frontend/main.js
+++ b/frontend/main.js
@@ -212,7 +212,7 @@ async function updateMachines() {
const end = Date.parse(status[2][i]);
const minsLeft = Math.ceil((end - now) / 60000).toString();
machineTxts[i].innerHTML = minsLeft + " min(s) left";
- if (machineDetailImgs[0]) machineDetailTitles[i].innerHTML = minsLeft + " minutes left"
+ if (machineDetailImgs[0]) machineDetailTitles[i].innerHTML = minsLeft + " minute(s) left"
} else if (status[0][i] == "OUTOFSERVICE") {
if ((i + 1) % 2 == 0) {
machineImgs[i].src = "/assets/img/washer_down.png";
diff --git a/frontend/style.css b/frontend/style.css
index c241045..e3c8f68 100644
--- a/frontend/style.css
+++ b/frontend/style.css
@@ -369,4 +369,12 @@ hr {
.txtcol-washer > img {
padding: 8px;
}
+
+ .txtcol-dryer > span {
+ font-size: .8rem;
+ }
+
+ .txtcol-dryer > img {
+ padding: 8px;
+ }
}