admin functionality

This commit is contained in:
Priec
2026-05-16 17:21:14 +02:00
parent 7220ec87bc
commit 70920ede87
5 changed files with 48 additions and 2 deletions

View File

@@ -73,8 +73,12 @@
<div class="mb-3 flex flex-wrap items-center justify-between gap-2">
<div class="flex flex-wrap items-center gap-2">
<div class="join">
{% if can_prev %}
<a href="{{ base_path }}?court={{ court_id }}&week={{ prev_week }}"
class="btn btn-sm join-item">« {{ t(key="prev-week", lang=lang) }}</a>
{% else %}
<span class="btn btn-sm join-item btn-disabled" aria-disabled="true">« {{ t(key="prev-week", lang=lang) }}</span>
{% endif %}
<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 }}"
@@ -90,6 +94,21 @@
</svg>
{{ t(key="view-details", lang=lang) }}
</button>
<form method="get" action="{{ base_path }}" class="relative inline-flex">
<input type="hidden" name="court" value="{{ court_id }}">
<button type="button" id="cal-jump-btn" class="btn btn-sm gap-1"
title="{{ t(key='pick-week', lang=lang) }}">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="h-4 w-4">
<path stroke-linecap="round" stroke-linejoin="round"
d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5" />
</svg>
{{ t(key="pick-week", lang=lang) }}
</button>
<input type="date" name="week" id="cal-jump" value="{{ week }}"
onchange="this.form.submit()" tabindex="-1" aria-hidden="true"
class="pointer-events-none absolute inset-0 -z-10 opacity-0">
</form>
{% endif %}
</div>
<div class="text-sm font-medium opacity-60">{{ court_name }} · {{ week_label }}</div>
@@ -190,5 +209,22 @@
});
})();
</script>
<script>
// "Go to week" — open the native date picker; picking any day loads the
// week it belongs to. Admin only.
(function () {
var btn = document.getElementById('cal-jump-btn');
var input = document.getElementById('cal-jump');
if (!btn || !input) return;
btn.addEventListener('click', function () {
if (typeof input.showPicker === 'function') {
input.showPicker();
} else {
input.focus();
input.click();
}
});
})();
</script>
{% endif %}
{% endblock js %}