stats #836
@ -72,42 +72,5 @@
|
|||||||
<span class="pl-3 w-20 text-right"><b>{{ guest_km.amount_trips + club_trips }}</b></span>
|
<span class="pl-3 w-20 text-right"><b>{{ guest_km.amount_trips + club_trips }}</b></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="container" class="w-full"></div>
|
|
||||||
</div>
|
</div>
|
||||||
<script>
|
|
||||||
{% if personal %}
|
|
||||||
const data = [
|
|
||||||
{%- for p in personal %}{ date: '{{p.date}}', km: {{p.km}} },{%- endfor %}
|
|
||||||
]
|
|
||||||
sessionStorage.setItem('userStats', JSON.stringify(data));
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
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 = 1977; 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>
|
|
||||||
<script src="/public/logbook.js"></script>
|
|
||||||
{% endblock content %}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user