<table style="width:100%;">
    <tr>
        <td style="width:33%;" title="{{ trip.departureAirport.name }}">
            {% if trip.departureAirport.iataCode %}
                <span style="font-size:200%;">{{ trip.departureAirport.iataCode }}
            {% else %}
                <span style="font-size:120%;">{{ trip.departureAirport.name }}
            {% endif %}
            {% with trip.departureAirport as location %}{% include "org.kde.messageviewer/itinerary/location.html" %}{% endwith %}</span>
        </td>
        <td style="font-size:200%; width:33%; text-align:center;">
        {% if elem.reservations.0.reservation.reservationStatus == 1 %}
            {% icon "dialog-cancel" sizemedium _("Reservation canceled.") %}
        {% else %}
            &#9992;
        {% endif %}
        </td>
        <td style="width:33%;" title="{{ trip.arrivalAirport.name }}">
            {% if trip.arrivalAirport.iataCode %}
                <span style="font-size:200%;">{{ trip.arrivalAirport.iataCode }}
            {% else %}
                <span style="font-size:120%;">{{ trip.arrivalAirport.name }}
            {% endif %}
            {% with trip.arrivalAirport as location %}{% include "org.kde.messageviewer/itinerary/location.html" %}{% endwith %}</span>
        </td>
    </tr>
    <tr>
        <td>
            {% if trip.departureTime %}
                {{ trip.departureTime|formatDateTime }}
            {% else %}
                {{ trip.departureDay|formatDate }}
            {% endif %}
        </td>
        <td style="white-space: nowrap; text-align:center;" title="{{ trip.airline.name }}">{{ trip.airline.iataCode }} {{ trip.flightNumber }}</td>
        <td>{{ trip.arrivalTime|formatDateTime }}</td>
    </tr>
    <tr><td colspan="3">
        <div style="float:left">
        {% if elem.reservations.0.ticketToken or elem.reservations.size > 1 %}
            <a href="x-kmail:/bodypart/0//semanticExpand?{{ elem.groupId }}">
            {% if elem.state.expanded %}
                <img src="{{ style.collapseIcon }}" style="margin-right: 4px;"/>
            {% else %}
                <img src="{{ style.expandIcon }}" style="margin-right: 4px;"/>
            {% endif %}
            </a>
        {% endif %}
        {% if trip.departureGate %}
            {% i18n "Gate: %1" trip.departureGate %}
        {% endif %}

        {% if trip.boardingTime %}
            {% i18n "Boarding: %1" trip.boardingTime|formatTime %}
        {% endif %}

        {% if res.boardingGroup and elem.reservations.size == 1 and not elem.state.expanded %}
            {% i18n "Group: %1" res.boardingGroup %}
        {% endif %}

        {% if res.airplaneSeat and elem.reservations.size == 1 and not elem.state.expanded %}
            {% i18n "Seat: %1" res.airplaneSeat %}
        {% endif %}
        </div>
        {% if elem.reservations.size == 1 %}
            {% include "org.kde.messageviewer/itinerary/actions.html" %}
        {% endif %}
    </td></tr>
</table>

{% if elem.state.expanded %}
    {% for d in elem.reservations %}
        {% with d.reservation as res %}
        {% if res.underName.name %}
            <div>{{ res.underName.name }}</div>
        {% endif %}
        <div>
        {% if res.boardingGroup %} {% i18n "Group: %1" res.boardingGroup %} {% endif %}
        {% if res.airplaneSeat %} {% i18n "Seat: %1" res.airplaneSeat %} {% endif %}
        </div>
        {% if d.ticketToken %}
            <div style="text-align:center;">
                <div style="background-color: #ffffff; display: inline-block; padding: 4px;">
                <img src="{{ d.ticketToken }}"/>
                </div>
            </div>
        {% endif %}
        {% if elem.reservations.size > 1 %}
            {% include "org.kde.messageviewer/itinerary/actions.html" %}
        {% endif %}
        {% endwith %}
    {% endfor %}
{% endif %}
