Files
Kurt_kalendar/ht_booking/assets/views/calendar/week.html
Priec 6c87a9d58f ui
2026-05-16 12:45:38 +02:00

85 lines
3.6 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ t(key="calendar-title", lang=lang) }}{% endblock title %}
{% block content %}
<div class="mb-4 flex flex-wrap items-center justify-between gap-3">
<h1 class="text-2xl font-bold">
{% if is_admin %}{{ t(key="admin-title", lang=lang) }}{% else %}{{ t(key="calendar-title", lang=lang) }}{% endif %}
</h1>
{% if has_courts %}
<form method="get" action="{{ base_path }}" class="flex items-center gap-2">
<label class="text-sm font-medium text-gray-600">{{ t(key="court-label", lang=lang) }}</label>
<input type="hidden" name="week" value="{{ week }}">
<select name="court" onchange="this.form.submit()" class="select select-bordered select-sm">
{% for c in courts %}
<option value="{{ c.id }}" {% if c.selected %}selected{% endif %}>{{ c.name }}</option>
{% endfor %}
</select>
</form>
{% endif %}
</div>
{% if has_courts %}
<div class="mb-3 flex flex-wrap items-center justify-between gap-2">
<div class="join">
<a href="{{ base_path }}?court={{ court_id }}&week={{ prev_week }}"
class="btn btn-sm join-item">« {{ t(key="prev-week", lang=lang) }}</a>
<a href="{{ base_path }}?court={{ court_id }}&week={{ this_week }}"
class="btn btn-sm join-item">{{ t(key="this-week", lang=lang) }}</a>
<a href="{{ base_path }}?court={{ court_id }}&week={{ next_week }}"
class="btn btn-sm join-item">{{ t(key="next-week", lang=lang) }} »</a>
</div>
<div class="text-sm font-medium text-gray-500">{{ court_name }} · {{ week_label }}</div>
</div>
<div class="overflow-x-auto rounded-lg border border-gray-200 bg-white shadow-sm">
<table class="w-full border-collapse text-sm">
<thead>
<tr class="bg-gray-100">
<th class="w-16 border border-gray-200 p-2"></th>
{% for d in days %}
<th class="border border-gray-200 p-2 text-center">
<div class="font-semibold">{{ t(key=d.key, lang=lang) }}</div>
<div class="text-xs font-normal text-gray-400">{{ d.num }}</div>
</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
<td class="border border-gray-200 bg-gray-50 p-2 text-center font-medium text-gray-500">{{ row.hour_label }}</td>
{% for cell in row.cells %}
<td class="h-14 border border-gray-200 p-1 align-top">
{% if cell.booked %}
{% if is_admin %}
<a href="/admin/booking/{{ cell.booking_id }}"
class="block h-full rounded px-1 py-1 text-xs font-medium text-white shadow-sm transition hover:opacity-90"
style="background-color: {{ cell.color }}">{{ cell.name }}</a>
{% else %}
<div class="h-full rounded px-1 py-1 text-xs font-medium text-white shadow-sm"
style="background-color: {{ cell.color }}" title="{{ cell.name }}">{{ t(key="booked", lang=lang) }}</div>
{% endif %}
{% else %}
{% if is_admin %}
<a href="/admin/booking?court={{ court_id }}&date={{ cell.date }}&hour={{ cell.hour }}"
class="flex h-full items-center justify-center rounded text-lg text-gray-300 transition hover:bg-gray-100 hover:text-gray-500">+</a>
{% else %}
<div class="px-1 py-1 text-xs text-gray-300">{{ t(key="free", lang=lang) }}</div>
{% endif %}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="card border border-gray-200 bg-white shadow-sm">
<div class="card-body items-center text-center text-gray-500">{{ t(key="no-courts", lang=lang) }}</div>
</div>
{% endif %}
{% endblock content %}