Add car journeys to trips

This commit is contained in:
Edward Betts 2026-07-08 09:09:48 +01:00
parent bc7a2e89d0
commit c6cb06b71e
9 changed files with 430 additions and 10 deletions

View file

@ -409,7 +409,7 @@ https://www.flightradar24.com/data/flights/{{ flight.airline_detail.iata | lower
{% if item.operator and item.operator != item.name %}<span class="text-muted small">{{ item.operator }}</span>{% endif %}
</div>
{% elif e.element_type != "conference" %}
{# Transport: flight, train, ferry, coach, bus #}
{# Transport: flight, train, ferry, coach, bus, car #}
{% set has_arrive = item.arrive is defined and item.arrive %}
{# item.depart may be a date (no .date() method) or a datetime (has .date()) #}
{% set has_time = item.depart is defined and item.depart and item.depart.hour is defined %}

View file

@ -367,20 +367,25 @@
</div>
</div>
{% elif e.element_type in ("coach", "bus") %}
{% elif e.element_type in ("coach", "bus", "car") %}
{% set item = e.detail %}
<div class="trip-transport-card my-1">
<div class="card-body">
<h5 class="card-title">
🚌 {{ item.from }} → {{ item.to }}
{% if e.element_type == "car" %}🚗{% else %}🚌{% endif %}
{{ item.from }} → {{ item.to }}
{% if item.operator %}<small class="text-muted fw-normal">{{ item.operator }}</small>{% endif %}
</h5>
<p class="card-text">
{{ item.depart.strftime("%H:%M") }} → {{ item.arrive.strftime("%H:%M") }}
{% if item.depart.hour is defined and item.arrive.hour is defined %}
{{ item.depart.strftime("%H:%M") }} → {{ item.arrive.strftime("%H:%M") }}
{% endif %}
{% if item.class %}
<span class="badge bg-info text-nowrap">{{ item.class }}</span>
{% endif %}
<span class="text-muted">🕒{{ trip_duration(item.depart, item.arrive) }}</span>
{% if item.depart.hour is defined and item.arrive.hour is defined %}
<span class="text-muted">🕒{{ trip_duration(item.depart, item.arrive) }}</span>
{% endif %}
{% if item.distance %}
<span class="text-muted">🛤️ {{ "{:,.0f} km".format(item.distance) }}</span>
{% endif %}