Adjust travel page to show flights grouped by booking with booking reference and price
Closes: #152
This commit is contained in:
parent
19732a3ef1
commit
6d6e416df3
4 changed files with 65 additions and 15 deletions
|
|
@ -90,6 +90,49 @@
|
|||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro flight_booking_row(booking) %}
|
||||
<div class="grid-item">{{ booking.booking_reference or "reference missing" }}</div>
|
||||
<div class="grid-item text-end">
|
||||
{% if g.user.is_authenticated and booking.price and booking.currency %}
|
||||
<span class="badge bg-info text-nowrap">{{ "{:,f}".format(booking.price) }} {{ booking.currency }}</span>
|
||||
{% if booking.currency != "GBP" %}
|
||||
<span class="badge bg-info text-nowrap">{{ "{:,.2f}".format(booking.price / fx_rate[booking.currency]) }} GBP</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% for i in range(8) %}
|
||||
<div class="grid-item"></div>
|
||||
{% endfor %}
|
||||
|
||||
{% for item in booking.flights %}
|
||||
{% set full_flight_number = item.airline + item.flight_number %}
|
||||
{% set radarbox_url = "https://www.radarbox.com/data/flights/" + full_flight_number %}
|
||||
<div class="grid-item"></div>
|
||||
<div class="grid-item"></div>
|
||||
<div class="grid-item text-end">{{ item.depart.strftime("%a, %d %b %Y") }}</div>
|
||||
<div class="grid-item">{{ item.from }} → {{ 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">{{ full_flight_number }}</div>
|
||||
<div class="grid-item">
|
||||
<a href="https://www.flightradar24.com/data/flights/{{ full_flight_number | lower }}">flightradar24</a>
|
||||
| <a href="https://uk.flightaware.com/live/flight/{{ full_flight_number | replace("U2", "EZY") }}">FlightAware</a>
|
||||
| <a href="{{ radarbox_url }}">radarbox</a>
|
||||
</div>
|
||||
<div class="grid-item text-end">
|
||||
{% if item.distance %}
|
||||
{{ "{:,.0f} km / {:,.0f} miles".format(item.distance, item.distance / 1.60934) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro flight_row(item) %}
|
||||
{% set full_flight_number = item.airline + item.flight_number %}
|
||||
{% set radarbox_url = "https://www.radarbox.com/data/flights/" + full_flight_number %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue