rollerverbrauch/app/templates/pitstops.html

80 lines
4.3 KiB
HTML
Raw Normal View History

2016-05-24 06:49:39 +02:00
{% extends "layout.html" %}
2015-03-06 21:58:53 +01:00
{% block body %}
2016-07-04 20:19:59 +02:00
<div class="col-md-2" ></div>
<div class="col-md-8">
<ul id="tabs" class="nav nav-tabs" data-tabs="tabs">
{% for vehicle in current_user.vehicles %}
<li {% if loop.first %}class="active" {%endif %}>
<a href="#v{{vehicle.id}}" id="i{{vehicle.id}}" data-toggle="tab">
{{ vehicle.name }}
</a>
</li>
{% endfor %}
</ul>
<div id="my-tab-content" class="tab-content">
{% for vehicle in current_user.vehicles %}
2016-08-07 13:18:04 +02:00
{% set vehicleloop = loop %}
<div class="tab-pane {% if loop.first %}active{% endif %}" id="v{{vehicle.id}}">
<h3>{{vehicle.name}}</h3>
2016-05-24 06:49:39 +02:00
{% if vehicle.pitstops %}
2016-07-04 20:19:59 +02:00
{% for pitstop in vehicle.pitstops|reverse %}
<div class="panel panel-default">
<div class="panel-body">
<table class="table table-striped table-bordered table-condensed">
<tr>
<th>Date</th>
2016-08-07 13:18:04 +02:00
<td id="vehicle_{{vehicleloop.index}}_pitstop_{{loop.index}}_date">{{pitstop.date}}</td>
2016-05-24 06:49:39 +02:00
</tr>
2016-07-04 20:19:59 +02:00
<tr>
<th>Odometer</th>
2016-08-07 13:18:04 +02:00
<td id="vehicle_{{vehicleloop.index}}_pitstop_{{loop.index}}_odo">{{pitstop.odometer}} km</td>
2016-05-24 06:49:39 +02:00
</tr>
2016-07-04 20:19:59 +02:00
<tr>
<th>{{ pitstop.consumable.name }}</th>
2016-08-07 13:18:04 +02:00
<td id="vehicle_{{vehicleloop.index}}_pitstop_{{loop.index}}_anmount">{{pitstop.amount}} {{ pitstop.consumable.unit }}</td>
2016-07-04 20:19:59 +02:00
</tr>
<tr>
<th>Costs</th>
2016-08-07 13:18:04 +02:00
<td id="vehicle_{{vehicleloop.index}}_pitstop_{{loop.index}}_cost">
2016-07-16 12:07:01 +02:00
{% if pitstop.costs %}
{{pitstop.costs}} €
{% else %}
-- €
{% endif %}
</td>
2016-07-04 20:19:59 +02:00
</tr>
</table>
{% if loop.first %}
2016-08-07 13:18:04 +02:00
<a id="vehicle_{{vehicleloop.index}}_edit_pitstop_{{loop.index}}" href="{{ url_for('edit_pit_stop_form', pid=pitstop.id) }}" class="btn btn-primary">
2016-07-04 20:19:59 +02:00
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> edit
</a>
2016-08-07 13:18:04 +02:00
<a id="vehicle_{{vehicleloop.index}}_delete_pitstop_{{loop.index}}" href="{{ url_for('delete_pit_stop_form', pid=pitstop.id) }}" class="btn btn-primary btn-warning ">
2016-07-04 20:19:59 +02:00
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> delete
</a>
2016-05-24 06:49:39 +02:00
{% endif %}
2016-07-04 20:19:59 +02:00
</div>
</div>
{% endfor %}
2016-05-24 06:49:39 +02:00
{% else %}
<div class="alert alert-warning" role="alert">
not enough data: <a href="{{ url_for('select_consumable_for_new_pitstop', vid=vehicle.id) }}">log a pitstop</a>?
2016-05-24 06:49:39 +02:00
</div>
{% endif %}
</div>
{% endfor %}
</div>
</div>
2016-07-04 20:19:59 +02:00
<div class="col-md-2" ></div>
<script type="text/javascript">
jQuery(document).ready(function ($) {
$('#tabs').tab();
if(window.location.hash != "") {
$('a[href="' + window.location.hash + '"]').click()
}
});
2015-03-16 22:06:59 +01:00
</script>
2016-04-24 14:09:41 +02:00
{% endblock %}