284 lines
6.8 KiB
HTML
284 lines
6.8 KiB
HTML
<div>
|
|
|
|
<!-- HEADER -->
|
|
|
|
<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>
|
|
|
|
<div class="font-bold text-xl">
|
|
{{ r.room }}
|
|
</div>
|
|
|
|
<div class="text-sm text-gray-400">
|
|
{{ r.type }}
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% if r.tracks_bathroom %}
|
|
<span class="bg-blue-700 px-2 py-1 rounded text-sm">
|
|
Bathroom Tracking
|
|
</span>
|
|
{% endif %}
|
|
|
|
</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"
|
|
>
|
|
|
|
<!-- 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>
|
|
|
|
<label class="block text-sm mb-1">
|
|
Max Occupancy
|
|
</label>
|
|
|
|
<input
|
|
type="number"
|
|
name="max"
|
|
value="{{ r.max }}"
|
|
class="bg-gray-800 p-2 rounded w-full"
|
|
>
|
|
|
|
</div>
|
|
|
|
<!-- BATHROOM DROPDOWN -->
|
|
|
|
<div>
|
|
|
|
<label class="block text-sm mb-1">
|
|
Bathroom Room
|
|
</label>
|
|
|
|
<select
|
|
name="bathroom_id"
|
|
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 -->
|
|
|
|
<div class="flex items-center gap-2">
|
|
|
|
<input
|
|
type="checkbox"
|
|
name="tracks_bathroom"
|
|
{% if r.bathroom %}
|
|
checked
|
|
{% endif %}
|
|
class="w-5 h-5"
|
|
>
|
|
|
|
<label>
|
|
Track Bathroom Usage
|
|
</label>
|
|
|
|
</div>
|
|
|
|
<!-- SAVE -->
|
|
|
|
<button
|
|
class="bg-blue-700 hover:bg-blue-600 px-4 py-2 rounded w-full"
|
|
>
|
|
Save Room
|
|
</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</div> |