first shot
This commit is contained in:
39
app/templates/createRegularCostForm.html
Normal file
39
app/templates/createRegularCostForm.html
Normal file
@@ -0,0 +1,39 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% block body %}
|
||||
<div class="col-md-2" ></div>
|
||||
<div class="col-md-8">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<h3>New Regular Cost for '{{ vehicle.name }}'</h3>
|
||||
<form class='form-horizontal' method="POST">
|
||||
{{ form.hidden_tag() }}
|
||||
|
||||
{{ render_field_with_errors(form.start_at) }}
|
||||
<span id="{{form.start_at.id}}_help" class="help-block">
|
||||
{{messages['start_at']}}
|
||||
</span>
|
||||
|
||||
{{ render_field_with_errors(form.ends_at) }}
|
||||
<span id="{{form.ends_at.id}}_help" class="help-block">
|
||||
{{messages['ends_at']}}
|
||||
</span>
|
||||
|
||||
{{ render_field_with_errors(form.days) }}
|
||||
<span>Format as 'Month-Day' (e.g. 05-25) and separate with ','.</span>
|
||||
<span id="{{form.days.id}}_help" class="help-block">
|
||||
{{messages['days']}}
|
||||
</span>
|
||||
|
||||
{{ render_field_with_errors(form.costs) }}
|
||||
<span id="{{form.costs.id}}_help" class="help-block">
|
||||
{{messages['costs']}}
|
||||
</span>
|
||||
{{ render_field_with_errors(form.description) }}
|
||||
{{ render_field_with_errors(form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2" ></div>
|
||||
{% endblock %}
|
||||
46
app/templates/deleteRegularCostForm.html
Normal file
46
app/templates/deleteRegularCostForm.html
Normal file
@@ -0,0 +1,46 @@
|
||||
{% extends 'layout.html' %}
|
||||
|
||||
{% block body %}
|
||||
<div class='col-md-2' ></div>
|
||||
<div class='col-md-8'>
|
||||
<div class='panel panel-default'>
|
||||
<div class='panel-body'>
|
||||
<h3>Delete Regular Cost?</h3>
|
||||
<table style='width: 100%' class="table table-striped table-bordered table-condensed">
|
||||
<tr>
|
||||
<th style='text-align:right'>Description of regular cost</th>
|
||||
<td style='text-align: left'>{{ regular_cost.description }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style='text-align:right'>Costs (per instance)</th>
|
||||
<td style='text-align: left'>
|
||||
{% if regular_cost.costs %}
|
||||
{{ regular_cost.costs }}
|
||||
{% else %}
|
||||
--
|
||||
{% endif %}
|
||||
€
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style='text-align:right'>Days for regular costs</th>
|
||||
<td style='text-align: left'>{{ regular_cost.days }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style='text-align:right'>regular costs starting from</th>
|
||||
<td style='text-align: left'>{{ regular_cost.start_at }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style='text-align:right'>regular costs ending at</th>
|
||||
<td style='text-align: left'>{{ regular_cost.ends_at }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<form class='form-horizontal' method='POST'>
|
||||
{{ form.hidden_tag() }}
|
||||
{{ render_field_with_errors(form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-md-2' ></div>
|
||||
{% endblock %}
|
||||
@@ -8,7 +8,7 @@
|
||||
<h3>Delete vehicle '{{vehicle.name}}'?</h3>
|
||||
<form class='form-horizontal' method="POST">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ render_field_with_errors(form.submit) }}
|
||||
{{ render_field_with_errors(form.submit, include_cancel=True) }}
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
39
app/templates/editRegularCostForm.html
Normal file
39
app/templates/editRegularCostForm.html
Normal file
@@ -0,0 +1,39 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% block body %}
|
||||
<div class="col-md-2" ></div>
|
||||
<div class="col-md-8">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<h3>Edit Regular Cost for '{{ vehicle.name }}'</h3>
|
||||
<form class='form-horizontal' method="POST">
|
||||
{{ form.hidden_tag() }}
|
||||
|
||||
{{ render_field_with_errors(form.start_at) }}
|
||||
<span id="{{form.start_at.id}}_help" class="help-block">
|
||||
{{messages['start_at']}}
|
||||
</span>
|
||||
|
||||
{{ render_field_with_errors(form.ends_at) }}
|
||||
<span id="{{form.ends_at.id}}_help" class="help-block">
|
||||
{{messages['ends_at']}}
|
||||
</span>
|
||||
|
||||
{{ render_field_with_errors(form.days) }}
|
||||
<span>Format as 'Month-Day' (e.g. 05-25) and separate with ','.</span>
|
||||
<span id="{{form.days.id}}_help" class="help-block">
|
||||
{{messages['days']}}
|
||||
</span>
|
||||
|
||||
{{ render_field_with_errors(form.costs) }}
|
||||
<span id="{{form.costs.id}}_help" class="help-block">
|
||||
{{messages['costs']}}
|
||||
</span>
|
||||
{{ render_field_with_errors(form.description) }}
|
||||
|
||||
{{ render_field_with_errors(form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
16
app/templates/endRegularCostForm.html
Normal file
16
app/templates/endRegularCostForm.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% block body %}
|
||||
<div class="col-md-2" ></div>
|
||||
<div class="col-md-8">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<h3>Edit Regular Cost for '{{ vehicle.name }}'</h3>
|
||||
<form class='form-horizontal' method="POST">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ render_field_with_errors(form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -3,6 +3,7 @@
|
||||
<li><a id='plan_pitstop_link' href='{{ url_for('select_vehicle_for_plan_pitstop') }}'>Plan Pitstop</a></li>
|
||||
<li><a id='new_pitstop_link' href='{{ url_for('select_vehicle_for_new_pitstop') }}'>Create Pitstop</a></li>
|
||||
<li><a id='new_service_link' href='{{ url_for('select_vehicle_for_new_service') }}'>Create Service</a></li>
|
||||
<li><a id='new_service_link' href='{{ url_for('select_vehicle_for_new_regular_cost') }}'>Create Regular Cost</a></li>
|
||||
<li><a id='statistics_limk' href='{{ url_for('get_statistics') }}'>Statistics</a></li>
|
||||
<li><a id='account_link' href='{{ url_for('get_account_page') }}'>Account</a></li>
|
||||
{% if current_user.has_role('admin') %}
|
||||
@@ -15,20 +16,17 @@
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro render_field_with_errors(field) %}
|
||||
{% macro render_field_with_errors(field, include_cancel=True) %}
|
||||
<div class="form-group">
|
||||
{% if field.type == 'SubmitField' %}
|
||||
<div class="col-md-4" ></div>
|
||||
|
||||
<div class="col-sm-4" style="align:center">
|
||||
<div class="col-md-3" ></div>
|
||||
<div class="col-sm-6" style="align:center">
|
||||
{% if include_cancel %}
|
||||
<input id="{{ field.id }}_cancel" name="{{ field.id }}_cancel" class="btn btn-default" type="submit" value="Cancel" onclick="window.history.go(-1)">
|
||||
{% endif %}
|
||||
<input id="{{ field.id }}" name="{{ field.id }}" class="btn btn-default" type="submit" value="{{ field.label.text }}">
|
||||
</div>
|
||||
<!--
|
||||
<div class="col-sm-3" style="align:center">
|
||||
<a class="btn btn-default" href="{{ g.data['back'] }}" role="button">Cancel</a>
|
||||
</div>
|
||||
-->
|
||||
<div class="col-md-4" ></div>
|
||||
<div class="col-md-3" ></div>
|
||||
{% else %}
|
||||
<label class="col-sm-6 control-label">
|
||||
{{ field.label }}
|
||||
|
||||
@@ -1,5 +1,92 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% macro regular(field, vindex, loop) -%}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<div style="text-align: left; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-repeat" aria-hidden="true" style="border: 1px solid black; padding: 5px 5px 3px; border-radius: 5px;" />
|
||||
</div>
|
||||
<table class="table table-striped table-bordered table-condensed">
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<td id="vehicle_{{vindex}}_pitstop_{{loop.index}}_date">{{field.description}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Costs</th>
|
||||
<td id="vehicle_{{vindex}}_pitstop_{{loop.index}}_cost">
|
||||
{% if field.costs %}
|
||||
{{field.costs}} €
|
||||
{% else %}
|
||||
-- €
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>From</th>
|
||||
<td id="vehicle_{{vindex}}_pitstop_{{loop.index}}_date">{{field.start_at}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>To</th>
|
||||
<td id="vehicle_{{vindex}}_pitstop_{{loop.index}}_date">{{field.ends_at}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Days</th>
|
||||
<td id="vehicle_{{vindex}}_pitstop_{{loop.index}}_date">{{field.days}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% if loop.first %}
|
||||
{% endif %}
|
||||
<a id="vehicle_{{vindex}}_edit_regular_{{loop.index}}" href="{{ url_for('edit_regular_form', pid=field.id) }}" class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> edit
|
||||
</a>
|
||||
<a id="vehicle_{{vindex}}_delete_regular_{{loop.index}}" href="{{ url_for('delete_regular_form', pid=field.id) }}" class="btn btn-primary btn-warning ">
|
||||
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro regular_instance(field, vindex, loop) -%}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<div style="text-align: left; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon-repeat" aria-hidden="true" style="border: 1px solid black; padding: 5px 5px 3px; border-radius: 5px;"></span>
|
||||
</div>
|
||||
<table class="table table-striped table-bordered table-condensed">
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<td id="vehicle_{{vindex}}_pitstop_{{loop.index}}_date">{{field.date}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<td id="vehicle_{{vindex}}_pitstop_{{loop.index}}_date">{{field.name}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Costs</th>
|
||||
<td id="vehicle_{{vindex}}_pitstop_{{loop.index}}_cost">
|
||||
{% if field.costs %}
|
||||
{{field.costs}} €
|
||||
{% else %}
|
||||
-- €
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% if loop.first %}
|
||||
{% endif %}
|
||||
<a id="vehicle_{{vindex}}_edit_regular_{{loop.index}}" href="{{ url_for('edit_regular_form', pid=field.id) }}" class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> edit
|
||||
</a>
|
||||
<a id="vehicle_{{vindex}}_end_regular_{{loop.index}}" href="{{ url_for('end_regular_form', pid=field.id) }}" class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-remove-sign" aria-hidden="true"></span> end series
|
||||
</a>
|
||||
<a id="vehicle_{{vindex}}_delete_regular_{{loop.index}}" href="{{ url_for('delete_regular_form', pid=field.id) }}" class="btn btn-primary btn-warning ">
|
||||
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro pitstop(field, vindex, loop) -%}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
@@ -110,12 +197,22 @@
|
||||
{% if 'Service' in data.__class__.__name__ %}
|
||||
{{ service(data, vehicleloop.index, loop) }}
|
||||
{% endif %}
|
||||
{% if 'Regular' in data.__class__.__name__ %}
|
||||
{{ regular_instance(data, vehicleloop.index, loop) }}
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
{% 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>?
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if vehicle.regulars %}
|
||||
<h4>Regular Costs</h4>
|
||||
{% for data in vehicle.regulars %}
|
||||
{{ regular(data, vehicleloop.index, loop) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@@ -25,7 +25,14 @@
|
||||
|
||||
{% macro nav_tab(id, text, active) %}
|
||||
{#
|
||||
Create a UI element to select the shown pane of a tabbed view
|
||||
|
||||
id:
|
||||
id of the pane to select
|
||||
text:
|
||||
the text in the UI element
|
||||
active:
|
||||
boolean stating if the tab is active or not
|
||||
#}
|
||||
<li class="{% if active %}active{% endif %}">
|
||||
<a href="#ref_{{id}}" id="id_{{id}}" data-toggle="tab" >
|
||||
@@ -87,7 +94,15 @@
|
||||
<th>Logged Costs:</th>
|
||||
<td>{{ vehicle.overall_costs | round(2) }} €</td>
|
||||
</tr>
|
||||
</table>
|
||||
<tr>
|
||||
<th>Logged Costs per km:</th>
|
||||
{% if vehicle.costs_per_distance != 'N/A' %}
|
||||
<td>{{ vehicle.costs_per_distance | round(2) }} €/100km</td>
|
||||
{% else %}
|
||||
<td>{{ vehicle.costs_per_distance }}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
@@ -115,6 +130,7 @@
|
||||
{{ print_vehicle_table(vehicle) }}
|
||||
<ul id="vehicle_{{vehicle.id}}_tabs" class="nav nav-tabs" data-tabs="tabs">
|
||||
{{ nav_tab(vehicle.id|string + '_odometer', 'Odometer', true) }}
|
||||
{{ nav_tab(vehicle.id|string + '_costs', 'Costs', false) }}
|
||||
{% for consumable in vehicle.consumables %}
|
||||
{{ nav_tab(vehicle.id|string + '_' + consumable.id|string, consumable.name, false) }}
|
||||
{% endfor %}
|
||||
@@ -131,6 +147,17 @@
|
||||
true
|
||||
)
|
||||
}}
|
||||
{{ tab_pane(
|
||||
vehicle.id|string + '_costs',
|
||||
chart(
|
||||
vehicle.costs,
|
||||
'ref_' + vehicle.id|string + '_costs',
|
||||
'€',
|
||||
url_for('select_consumable_for_new_pitstop', vid=vehicle.id)
|
||||
),
|
||||
false
|
||||
)
|
||||
}}
|
||||
{% for consumable in vehicle.consumables %}
|
||||
<div class="tab-pane" id="ref_{{vehicle.id}}_{{consumable.id}}">
|
||||
{{ print_consumable_table(consumable) }}
|
||||
|
||||
Reference in New Issue
Block a user