Add trips page

Creating a new entity called a trip. This will group together any travel
accommodation and conferences that happen together on one trip.

A trip is assumed to start when leaving home and finish when returning
home.

The start date of a trip in is the trip ID. The date is written in ISO
format.

This assumes there cannot be multiple trips one one day. This assumption
might be wrong, for example a morning day trip by rail, then another
trip starts in the afternoon. I can change my choice of using dates as
trip IDs if that happens.

Sometimes during the planning of a trip the start date is unknown. For
now we make up a start date, we can always change it later. If we use
the start date in URLs then the URLs will change. Might need to keep a
file of redirects, or could think of a different style of identifier.

Trip ID have been added to accommodation, conferences, trains and
flights.

Later there will be a trips.yaml with notes about each trip.
This commit is contained in:
Edward Betts 2024-01-04 22:55:19 +00:00
parent 5786e3d575
commit ce9faa654f
10 changed files with 234 additions and 120 deletions

View file

@ -1,10 +1,5 @@
{% extends "base.html" %}
{% block travel %}
{% endblock %}
{% macro display_datetime(dt) %}{{ dt.strftime("%a, %d, %b %Y %H:%M %z") }}{% endmacro %}
{% macro display_time(dt) %}{{ dt.strftime("%H:%M %z") }}{% endmacro %}
{% from "macros.html" import flight_row, train_row with context %}
{% block style %}
<style>
@ -17,7 +12,7 @@
.train-grid-container {
display: grid;
grid-template-columns: repeat(6, auto); /* 7 columns for each piece of information */
grid-template-columns: repeat(7, auto); /* 7 columns for each piece of information */
gap: 10px;
justify-content: start;
}
@ -45,19 +40,8 @@
<div class="grid-item">flight</div>
<div class="grid-item">reference</div>
{% for item in flights | sort(attribute="depart") if item.arrive %}
<div class="grid-item text-end">{{ item.depart.strftime("%a, %d %b %Y") }}</div>
<div class="grid-item">{{ item.from }} &rarr; {{ item.to }}</div>
<div class="grid-item">{{ item.depart.strftime("%H:%M") }}</div>
<div class="grid-item">
{% if item.arrive %}
{{ item.arrive.strftime("%H:%M") }}
{% if item.arrive.date() != item.depart.date() %}+1 day{% endif %}
{% endif %}
</div>
<div class="grid-item">{{ item.duration }}</div>
<div class="grid-item">{{ item.airline }}{{ item.flight_number }}</div>
<div class="grid-item">{{ item.booking_reference }}</div>
{% for item in flights | sort(attribute="depart") %}
{{ flight_row(item) }}
{% endfor %}
</div>
@ -68,21 +52,12 @@
<div class="grid-item">route</div>
<div class="grid-item">depart</div>
<div class="grid-item">arrive</div>
<div class="grid-item">duration</div>
<div class="grid-item">operator</div>
<div class="grid-item">reference</div>
{% for item in trains | sort(attribute="depart") if item.arrive %}
<div class="grid-item text-end">{{ item.depart.strftime("%a, %d %b %Y") }}</div>
<div class="grid-item">{{ item.from }} &rarr; {{ item.to }}</div>
<div class="grid-item">{{ item.depart.strftime("%H:%M") }}</div>
<div class="grid-item">
{% if item.arrive %}
{{ item.arrive.strftime("%H:%M") }}
{% if item.arrive.date() != item.depart.date() %}+1 day{% endif %}
{% endif %}
</div>
<div class="grid-item">{{ item.operator }}</div>
<div class="grid-item">{{ item.booking_reference }}</div>
{% for item in trains | sort(attribute="depart") %}
{{ train_row(item) }}
{% endfor %}
</div>