{% extends "layout.html" %} {% macro pitstop(field, vindex, loop) -%}
Date {{field.date}}
Odometer {{field.odometer}} km
{{ field.consumable.name }} {{field.amount}} {{ field.consumable.unit }}
Costs {% if field.costs %} {{field.costs}} € {% else %} -- € {% endif %}
{% if loop.first %} {% endif %} edit delete
{%- endmacro %} {% macro service(field, vindex, loop) -%}
Date {{field.date}}
Odometer {{field.odometer}} km
Description {{field.description | markdown | safe}}
Costs {% if field.costs %} {{field.costs}} € {% else %} -- € {% endif %}
{% if loop.first %} edit {% endif %} delete
{%- endmacro %} {% block body %}
{% for vehicle in user.vehicles %} {% set vehicleloop = loop %}

{{vehicle.name}}

{% if vehicle.data %} {% for data in vehicle.data|reverse %} {% if 'Pitstop' in data.__class__.__name__ %} {{ pitstop(data, vehicleloop.index, loop) }} {% endif %} {% if 'Service' in data.__class__.__name__ %} {{ service(data, vehicleloop.index, loop) }} {% endif %} {% endfor %} {% else %} {% endif %}
{% endfor %}
{% endblock %}