This commit is contained in:
Harry Esses
2026-05-18 12:24:19 -04:00
parent c29f85752b
commit 3d07c59287
3 changed files with 225 additions and 22 deletions

View File

@@ -1,19 +1,101 @@
<div>
<div class="flex justify-between items-center mb-4">
<!-- HEADER -->
<h2 class="text-2xl font-bold">
<div class="flex justify-between items-center mb-6">
<h2 class="text-3xl font-bold">
Rooms
</h2>
</div>
<!-- NEW ROOM -->
<div class="bg-gray-900 p-6 rounded-xl border border-gray-800 mb-6">
<h3 class="text-xl font-bold mb-4">
Add New Room
</h3>
<form
hx-post="/admin/room/create"
hx-target="#content"
class="grid grid-cols-4 gap-4"
>
<!-- ROOM NAME -->
<input
type="text"
name="room"
placeholder="Room Name"
required
class="bg-gray-800 p-2 rounded"
>
<!-- ROOM TYPE -->
<select
name="room_type"
class="bg-gray-800 p-2 rounded"
>
<option value="classroom">
Classroom
</option>
<option value="bathroom">
Bathroom
</option>
<option value="office">
Office
</option>
<option value="hallway">
Hallway
</option>
<option value="gym">
Gym
</option>
<option value="cafeteria">
Cafeteria
</option>
</select>
<!-- MAX -->
<input
type="number"
name="max"
value="30"
class="bg-gray-800 p-2 rounded"
>
<button
class="bg-green-700 hover:bg-green-600 rounded px-4"
>
Create Room
</button>
</form>
</div>
<!-- EXISTING ROOMS -->
<div class="grid grid-cols-3 gap-4">
{% for r in rooms %}
<div class="bg-gray-900 p-4 rounded-xl border border-gray-800">
<!-- TITLE -->
<div class="flex justify-between items-center">
<div>
@@ -22,14 +104,13 @@
{{ r.room }}
</div>
<div class="text-gray-400 text-sm">
Current Occupancy:
{{ r.count }}
<div class="text-sm text-gray-400">
{{ r.type }}
</div>
</div>
{% if r.bathroom %}
{% if r.tracks_bathroom %}
<span class="bg-blue-700 px-2 py-1 rounded text-sm">
Bathroom Tracking
</span>
@@ -37,13 +118,84 @@
</div>
<!-- OCCUPANCY -->
<div class="mt-4 text-sm space-y-1">
<div>
Occupancy:
<b>{{ r.count }}</b>
</div>
<div>
Max:
<b>{{ r.max }}</b>
</div>
</div>
<!-- UPDATE FORM -->
<form
hx-post="/admin/room/update/{{ r.id }}"
hx-target="#content"
class="mt-4 space-y-3"
>
<!-- MAX OCCUPANCY -->
<!-- ROOM TYPE -->
<div>
<label class="block text-sm mb-1">
Room Type
</label>
<select
name="room_type"
class="bg-gray-800 p-2 rounded w-full"
>
<option
value="classroom"
{% if r.type == "classroom" %}
selected
{% endif %}
>
Classroom
</option>
<option
value="bathroom"
{% if r.type == "bathroom" %}
selected
{% endif %}
>
Bathroom
</option>
<option
value="office"
{% if r.type == "office" %}
selected
{% endif %}
>
Office
</option>
<option
value="hallway"
{% if r.type == "hallway" %}
selected
{% endif %}
>
Hallway
</option>
</select>
</div>
<!-- MAX -->
<div>
@@ -60,31 +212,47 @@
</div>
<!-- BATHROOM GROUP -->
<!-- BATHROOM DROPDOWN -->
<div>
<label class="block text-sm mb-1">
Bathroom Group ID
Bathroom Room
</label>
<input
type="text"
<select
name="bathroom_id"
value="{{ r.bathroom_id }}"
placeholder="example: floor2_west"
class="bg-gray-800 p-2 rounded w-full"
>
<option value="">
None
</option>
{% for b in bathrooms %}
<option
value="{{ b.room }}"
{% if r.bathroom_id == b.room %}
selected
{% endif %}
>
{{ b.room }}
</option>
{% endfor %}
</select>
</div>
<!-- TRACK BATHROOM -->
<!-- TRACK -->
<div class="flex items-center gap-2">
<input
type="checkbox"
name="bathroom"
name="tracks_bathroom"
{% if r.bathroom %}
checked
{% endif %}
@@ -97,6 +265,8 @@
</div>
<!-- SAVE -->
<button
class="bg-blue-700 hover:bg-blue-600 px-4 py-2 rounded w-full"
>