This commit is contained in:
Priec
2026-05-16 12:45:38 +02:00
parent 164dacb678
commit 6c87a9d58f
5 changed files with 152 additions and 129 deletions

View File

@@ -5,36 +5,42 @@
{% block content %}
<div class="mb-4 flex items-center justify-between">
<h1 class="text-2xl font-bold">{{ t(key="manage-courts", lang=lang) }}</h1>
<a href="/admin" class="text-sm text-blue-600 hover:underline">&larr; {{ t(key="back-to-calendar", lang=lang) }}</a>
<a href="/admin" class="btn btn-ghost btn-sm">« {{ t(key="back-to-calendar", lang=lang) }}</a>
</div>
{% if name_error %}
<div class="mb-3 rounded bg-red-100 px-3 py-2 text-sm text-red-700">{{ t(key="court-delete-error", lang=lang) }}</div>
<div class="alert alert-error mb-4">
<span>{{ t(key="court-delete-error", lang=lang) }}</span>
</div>
{% endif %}
<div class="mb-6 overflow-auto rounded-lg border bg-white">
<table class="w-full text-sm">
<div class="mb-6 overflow-x-auto rounded-lg border border-gray-200 bg-white shadow-sm">
<table class="table">
<thead>
<tr class="bg-gray-100 text-left">
<th class="p-2">{{ t(key="court-name", lang=lang) }}</th>
<th class="p-2">{{ t(key="court-surface", lang=lang) }}</th>
<th class="p-2">{{ t(key="court-indoor", lang=lang) }}</th>
<th class="p-2">{{ t(key="court-remove", lang=lang) }}</th>
<tr>
<th>{{ t(key="court-name", lang=lang) }}</th>
<th>{{ t(key="court-surface", lang=lang) }}</th>
<th>{{ t(key="court-indoor", lang=lang) }}</th>
<th class="text-right">{{ t(key="court-remove", lang=lang) }}</th>
</tr>
</thead>
<tbody>
{% for c in courts %}
<tr class="border-t">
<td class="p-2">{{ c.name }}</td>
<td class="p-2">{{ c.surface }}</td>
<td class="p-2">{{ c.indoor }}</td>
<td class="p-2">
<form method="post" action="/admin/courts/{{ c.id }}/delete"
<tr>
<td class="font-medium">{{ c.name }}</td>
<td>{{ c.surface }}</td>
<td>
{% if c.indoor %}
<span class="badge badge-success badge-sm"></span>
{% else %}
<span class="badge badge-ghost badge-sm"></span>
{% endif %}
</td>
<td class="text-right">
<form method="post" action="/admin/courts/{{ c.id }}/delete" class="inline"
data-court-name="{{ c.name }}" onsubmit="return promptCourtDelete(this);">
<input type="hidden" name="confirm_name">
<button class="rounded bg-red-600 px-3 py-1 text-sm text-white hover:bg-red-700">
{{ t(key="delete", lang=lang) }}
</button>
<button class="btn btn-error btn-sm">{{ t(key="delete", lang=lang) }}</button>
</form>
</td>
</tr>
@@ -43,24 +49,27 @@
</table>
</div>
<div class="max-w-md rounded-lg border bg-white p-4">
<h2 class="mb-3 font-semibold">{{ t(key="add-court", lang=lang) }}</h2>
<form method="post" action="/admin/courts" class="space-y-3">
<div>
<label class="block text-sm text-gray-600">{{ t(key="court-name", lang=lang) }}</label>
<input name="name" required class="w-full rounded border-gray-300 text-sm">
</div>
<div>
<label class="block text-sm text-gray-600">{{ t(key="court-surface", lang=lang) }}</label>
<input name="surface" class="w-full rounded border-gray-300 text-sm">
</div>
<label class="flex items-center gap-2 text-sm">
<input type="checkbox" name="indoor" value="1"> {{ t(key="court-indoor", lang=lang) }}
</label>
<button class="rounded bg-gray-900 px-4 py-2 text-sm text-white hover:bg-gray-700">
{{ t(key="add-court", lang=lang) }}
</button>
</form>
<div class="card max-w-md border border-gray-200 bg-white shadow-sm">
<div class="card-body">
<h2 class="card-title text-base">{{ t(key="add-court", lang=lang) }}</h2>
<form method="post" action="/admin/courts" class="space-y-2">
<div class="form-control">
<label class="label"><span class="label-text">{{ t(key="court-name", lang=lang) }}</span></label>
<input name="name" required class="input input-bordered w-full">
</div>
<div class="form-control">
<label class="label"><span class="label-text">{{ t(key="court-surface", lang=lang) }}</span></label>
<input name="surface" class="input input-bordered w-full">
</div>
<div class="form-control">
<label class="label cursor-pointer justify-start gap-3">
<input type="checkbox" name="indoor" value="1" class="checkbox checkbox-sm">
<span class="label-text">{{ t(key="court-indoor", lang=lang) }}</span>
</label>
</div>
<button class="btn btn-neutral mt-1">{{ t(key="add-court", lang=lang) }}</button>
</form>
</div>
</div>
{% endblock content %}