edit
60
client/public/add-category.html
Normal file
@@ -0,0 +1,60 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Add Room Category</title>
|
||||
</head>
|
||||
<body style="font-family: sans-serif; max-width: 720px; margin: 40px auto;">
|
||||
<h2>Add Room Category (Admin)</h2>
|
||||
<p>Make sure you are logged in to /admin/login first.</p>
|
||||
|
||||
<label>Name</label><br />
|
||||
<input id="name" style="width:100%;padding:8px" value="Deluxe" /><br /><br />
|
||||
|
||||
<label>Slug (lowercase, no spaces)</label><br />
|
||||
<input id="slug" style="width:100%;padding:8px" value="deluxe" /><br /><br />
|
||||
|
||||
<label>Description</label><br />
|
||||
<textarea id="description" style="width:100%;padding:8px" rows="4">Deluxe rooms</textarea><br /><br />
|
||||
|
||||
<button id="btn" style="padding:10px 16px">Create Category</button>
|
||||
|
||||
<pre id="out" style="background:#111;color:#0f0;padding:12px;margin-top:16px;white-space:pre-wrap"></pre>
|
||||
|
||||
<script>
|
||||
document.getElementById("btn").onclick = async () => {
|
||||
const token = localStorage.getItem("adminToken");
|
||||
if (!token) {
|
||||
document.getElementById("out").textContent = "❌ No adminToken found. Please login at /admin/login first.";
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = {
|
||||
name: document.getElementById("name").value.trim(),
|
||||
slug: document.getElementById("slug").value.trim(),
|
||||
description: document.getElementById("description").value.trim(),
|
||||
images: [],
|
||||
features: [],
|
||||
isActive: true,
|
||||
displayOrder: 1
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await fetch("http://localhost:5080/api/room-categories", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer " + token
|
||||
},
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
document.getElementById("out").textContent = "Status: " + res.status + "\n" + JSON.stringify(data, null, 2);
|
||||
} catch (e) {
|
||||
document.getElementById("out").textContent = "❌ Error: " + e.message;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
client/public/uploads/1-1768295870059-239826802.jpg
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
client/public/uploads/2-1768295870063-802829438.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
client/public/uploads/3-1768295870064-579147982.webp
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
client/public/uploads/4-1768295870068-442995448.jpg
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
client/public/uploads/5-1768295870072-844168095.png
Normal file
|
After Width: | Height: | Size: 230 KiB |
BIN
client/public/uploads/888-1768295870105-385689950.jpg
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
client/public/uploads/ai-accounting-1768295870109-673067819.jpg
Normal file
|
After Width: | Height: | Size: 95 KiB |
BIN
client/public/uploads/optimized-3-1768295870064-579147982.webp
Normal file
|
After Width: | Height: | Size: 52 KiB |