agenda/templates/accommodation.html

62 lines
1.7 KiB
HTML
Raw Permalink Normal View History

2024-01-01 21:26:39 +00:00
{% extends "base.html" %}
{% from "macros.html" import trip_link, accommodation_row with context %}
{% block title %}Accommodation - Edward Betts{% endblock %}
2024-01-01 21:26:39 +00:00
{% block style %}
{% set column_count = 9 %}
2024-01-01 21:26:39 +00:00
<style>
.grid-container {
display: grid;
grid-template-columns: repeat({{ column_count }}, auto);
2024-01-01 21:26:39 +00:00
gap: 10px;
justify-content: start;
}
.grid-item {
/* Additional styling for grid items can go here */
}
.heading {
grid-column: 1 / {{ column_count + 1 }}; /* Spans from the 1st line to the 7th line */
2024-01-01 21:26:39 +00:00
}
</style>
{% endblock %}
{% macro section(heading, item_list, badge) %}
{% if item_list %}
<div class="heading"><h2>{{heading}}</h2></div>
{% for item in item_list %}
{{ accommodation_row(item, badge) }}
<div class="grid-item">{% if item.linked_trip %} trip: {{ trip_link(item.linked_trip) }} {% endif %}</div>
{% endfor %}
2024-01-01 21:26:39 +00:00
{% endif %}
{% endmacro %}
{% block content %}
<div class="container-fluid mt-2">
<h1>Accommodation</h1>
<h3>Statistics</h3>
2024-01-01 21:26:39 +00:00
<ul>
{% for year, stats in year_stats %}
{% set days_in_year = 366 if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0) else 365 %}
{% set total_percentage = (stats.total_nights / days_in_year) * 100 %}
{% set abroad_percentage = (stats.nights_abroad / days_in_year) * 100 %}
<li>
<strong>{{ year }}:</strong>
Total nights away: {{ stats.total_nights }} ({{ "%.1f"|format(total_percentage) }}%),
Total nights abroad: {{ stats.nights_abroad }} ({{ "%.1f"|format(abroad_percentage) }}%)
</li>
{% endfor %}
2024-01-01 21:26:39 +00:00
</ul>
<div class="grid-container">
{{ section("Current", current) }}
{{ section("Future", future) }}
2024-08-04 11:45:13 +08:00
{{ section("Past", past) }}
2024-01-01 21:26:39 +00:00
</div>
</div>
{% endblock %}