2023-07-30 14:13:49 +02:00
|
|
|
{% import "includes/macros" as macros %}
|
|
|
|
{% import "includes/forms/log" as log %}
|
|
|
|
{% extends "base" %}
|
|
|
|
{% block content %}
|
2024-03-04 13:28:42 +01:00
|
|
|
<div class="max-w-screen-lg w-full">
|
2024-03-05 09:19:15 +01:00
|
|
|
<h1 class="h1">
|
|
|
|
Logbuch
|
2024-03-05 09:46:53 +01:00
|
|
|
{% if loggedin_user and "admin" in loggedin_user.roles %}
|
2024-03-05 09:19:15 +01:00
|
|
|
<select id="yearSelect"
|
|
|
|
onchange="changeYear()"
|
|
|
|
style="background: transparent;
|
|
|
|
background-image: none;
|
|
|
|
text-decoration: underline"></select>
|
|
|
|
{% endif %}
|
|
|
|
</h1>
|
2024-03-04 13:28:42 +01:00
|
|
|
<div class="mt-3">
|
|
|
|
<div class="search-wrapper">
|
|
|
|
<label for="name" class="sr-only">Suche</label>
|
|
|
|
<input type="search"
|
|
|
|
name="name"
|
|
|
|
id="filter-js"
|
|
|
|
class="search-bar"
|
|
|
|
placeholder="Suchen nach Bootsname oder Ruderer...">
|
|
|
|
</div>
|
|
|
|
<div id="filter-result-js" class="search-result"></div>
|
2024-07-23 14:57:09 +02:00
|
|
|
{% for log in logs %}
|
|
|
|
{% set_global allowed_to_edit = false %}
|
|
|
|
{% if loggedin_user %}
|
|
|
|
{% if "Vorstand" in loggedin_user.roles %}
|
|
|
|
{% set_global allowed_to_edit = true %}
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{{ log::show_old(log=log, state="completed", only_ones=false, index=loop.index, allowed_to_edit=allowed_to_edit) }}
|
|
|
|
{% endfor %}
|
2024-03-04 13:28:42 +01:00
|
|
|
</div>
|
2023-09-27 15:36:07 +02:00
|
|
|
</div>
|
2024-03-05 09:19:15 +01:00
|
|
|
<script>
|
|
|
|
function getYearFromURL() {
|
|
|
|
var queryParams = new URLSearchParams(window.location.search);
|
|
|
|
return queryParams.get('year');
|
|
|
|
}
|
|
|
|
|
|
|
|
function populateYears() {
|
|
|
|
var select = document.getElementById('yearSelect');
|
|
|
|
var currentYear = new Date().getFullYear();
|
|
|
|
var selectedYear = getYearFromURL() || currentYear;
|
|
|
|
for (var year = 2019; year <= currentYear; year++) {
|
|
|
|
var option = document.createElement('option');
|
|
|
|
option.value = option.textContent = year;
|
|
|
|
if (year == selectedYear) {
|
|
|
|
option.selected = true;
|
|
|
|
}
|
|
|
|
select.appendChild(option);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function changeYear() {
|
|
|
|
var selectedYear = document.getElementById('yearSelect').value;
|
|
|
|
window.location.href = '?year=' + selectedYear;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Call this function when the page loads
|
|
|
|
populateYears();
|
|
|
|
</script>
|
2024-03-04 13:28:42 +01:00
|
|
|
{% endblock content %}
|