Fixed project structure for pycharm
This commit is contained in:
66
app/templates/account.html
Normal file
66
app/templates/account.html
Normal file
@@ -0,0 +1,66 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% block body %}
|
||||
<h3>Account management for {{current_user.email}}</h3>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Password</div>
|
||||
<div class="panel-body">
|
||||
<a href='{{ url_for('security.change_password') }}' class="btn btn-primary " role="button">
|
||||
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Change
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Vehicles</div>
|
||||
<div class="panel-body">
|
||||
<a href="{{ url_for('create_vehicle') }}" class="btn btn-primary " role="button">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> create
|
||||
</a>
|
||||
</div>
|
||||
<table class="table table-striped table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
Vehicle
|
||||
</th>
|
||||
<th>
|
||||
Info
|
||||
</th>
|
||||
<th>
|
||||
Actions
|
||||
</th>
|
||||
</tr>
|
||||
{% for vehicle in current_user.vehicles %}
|
||||
<tr>
|
||||
<td>
|
||||
{{ vehicle.name }}
|
||||
</td>
|
||||
<td>
|
||||
{{ vehicle.pitstops | length }} pitstops
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ url_for('edit_vehicle', vid=vehicle.id) }}" class="btn btn-primary " role="button">
|
||||
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> edit
|
||||
</a>
|
||||
{% if current_user.vehicles | length > 1 %}
|
||||
<a href="{{ url_for('delete_vehicle', vid=vehicle.id) }}" class="btn btn-primary btn-warning " role="button">
|
||||
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> delete
|
||||
</a>
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Account</div>
|
||||
<div class="panel-body">
|
||||
<a href='{{ url_for('delete_account') }}' class="btn btn-primary " role="button">
|
||||
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
18
app/templates/admin.html
Normal file
18
app/templates/admin.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{% 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>Admin</h3>
|
||||
We have {{ data.users|length }} users so far:
|
||||
<ul>
|
||||
{% for user in data.users %}
|
||||
<li>{{user.email}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
18
app/templates/createVehicleForm.html
Normal file
18
app/templates/createVehicleForm.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{% 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>Create vehicle</h3>
|
||||
<form class='form-horizontal' method="POST">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ render_field_with_errors(form.name) }}
|
||||
{{ render_field_with_errors(form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2" ></div>
|
||||
{% endblock %}
|
||||
18
app/templates/deleteAccountForm.html
Normal file
18
app/templates/deleteAccountForm.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{% 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 account for '{{current_user.email}}'?</h3>
|
||||
This cannot be undone!
|
||||
<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 %}
|
||||
35
app/templates/deletePitstopForm.html
Normal file
35
app/templates/deletePitstopForm.html
Normal file
@@ -0,0 +1,35 @@
|
||||
{% 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 pitstop?</h3>
|
||||
<table style='width: 100%'>
|
||||
<tr>
|
||||
<th style='text-align:right'>Date of Pitstop</th>
|
||||
<td style='text-align: left'>{{ pitstop.date }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style='text-align:right'>Odometer</th>
|
||||
<td style='text-align: left'>{{ pitstop.odometer }} km</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style='text-align:right'>Litres</th>
|
||||
<td style='text-align: left'>{{ pitstop.litres }} l</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style='text-align:right'>Costs (overall)</th>
|
||||
<td style='text-align: left'>{{ pitstop.costs }} €</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 %}
|
||||
18
app/templates/deleteVehicleForm.html
Normal file
18
app/templates/deleteVehicleForm.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{% 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 vehicle '{{vehicle.name}}'?</h3>
|
||||
<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 %}
|
||||
29
app/templates/editPitStopForm.html
Normal file
29
app/templates/editPitStopForm.html
Normal file
@@ -0,0 +1,29 @@
|
||||
{% 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 Pitstop for '{{ vehicle.name }}'</h3>
|
||||
<form class='form-horizontal' method="POST">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ render_field_with_errors(form.date) }}
|
||||
<span id="{{form.date.id}}_help" class="help-block">
|
||||
{{messages['date']}}
|
||||
</span>
|
||||
{{ render_field_with_errors(form.odometer) }}
|
||||
<span id="{{form.odometer.id}}_help" class="help-block">
|
||||
{{messages['odometer']}}
|
||||
</span>
|
||||
{{ render_field_with_errors(form.litres) }}
|
||||
{{ render_field_with_errors(form.costs) }}
|
||||
<span id="{{form.costs.id}}_help" class="help-block">
|
||||
{{messages['costs']}}
|
||||
</span>
|
||||
{{ render_field_with_errors(form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
18
app/templates/editVehicleForm.html
Normal file
18
app/templates/editVehicleForm.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{% 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 vehicle</h3>
|
||||
<form class='form-horizontal' method="POST">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ render_field_with_errors(form.name) }}
|
||||
{{ render_field_with_errors(form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
28
app/templates/index.html
Normal file
28
app/templates/index.html
Normal file
@@ -0,0 +1,28 @@
|
||||
{% extends "layout.html" %}
|
||||
{% from "security/_macros.html" import render_field_with_errors, render_field %}
|
||||
|
||||
{% block body %}
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{{ render_login_form() }}
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body" >
|
||||
<h1>Join the pitstop community!</h1>
|
||||
|
||||
<p>There are already {{ data.users}} members with {{ data.vehicles }} vehicles who have logged {{ data.pitstops }} pitstops fuelling {{ data.litres }}l for {{ data.kilometers }}km.</p>
|
||||
|
||||
<p>With pitstop community you can:</p>
|
||||
<ul>
|
||||
<li>manage multiple vehicles</li>
|
||||
<li>track each pitstop</li>
|
||||
<li>get statistics about the fuel consumption</li>
|
||||
</ul>
|
||||
|
||||
<p><a href='{{ url_for('security.register') }}'>Register your account now</a> or <a href='{{ url_for('security.login') }}'>log into your account</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
189
app/templates/layout.html
Normal file
189
app/templates/layout.html
Normal file
@@ -0,0 +1,189 @@
|
||||
{% macro navigation() -%}
|
||||
{% if current_user.email %}
|
||||
<li><a href='{{ url_for('select_vehicle_for_new_pitstop') }}'>Create Pitstop</a></li>
|
||||
<li><a href='{{ url_for('get_statistics') }}'>Statistics</a></li>
|
||||
<li><a href='{{ url_for('get_account_page') }}'>Account</a></li>
|
||||
{% if current_user.has_role('admin') %}
|
||||
<li><a href='{{ url_for('get_admin_page') }}'>Admin</a></li>
|
||||
{% endif %}
|
||||
<li><a href='{{ url_for('security.logout') }}'>Logout</a></li>
|
||||
{% else %}
|
||||
<li><a href='{{ url_for('security.login') }}'>Login</a></li>
|
||||
<li><a href='{{ url_for('security.register') }}'>Register</a></li>
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro render_field_with_errors(field) %}
|
||||
<div class="form-group">
|
||||
{% if field.type == 'SubmitField' %}
|
||||
<div class="col-md-4" ></div>
|
||||
|
||||
<div class="col-sm-4" style="align:center">
|
||||
<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>
|
||||
{% else %}
|
||||
<label class="col-sm-6 control-label">
|
||||
{{ field.label }}
|
||||
</label>
|
||||
<div class="col-sm-6">
|
||||
{% if field.type == 'SelectField' %}
|
||||
<select id="{{ field.id }}" name="{{ field.id }}" class="form-control">
|
||||
{% for choice in field.choices %}
|
||||
<option value="{{ choice[0] }}">{{ choice[1] }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% elif field.type == 'BooleanField' %}
|
||||
<input class="form-control" type="checkbox" id="{{ field.id }}" name="{{ field.id }}" value="{{ field.default|none_filter }}" aria-describedby="{{ field.id }}_help" />
|
||||
{% elif field.type == 'StringField' %}
|
||||
<input class="form-control" type="text" id="{{ field.id }}" name="{{ field.id }}" value="{{ field.default|none_filter }}" aria-describedby="{{ field.id }}_help" />
|
||||
{% elif field.type == 'PasswordField' %}
|
||||
<input class="form-control" type="password" id="{{ field.id }}" name="{{ field.id }}" value="{{ field.default|none_filter }}" aria-describedby="{{ field.id }}_help" />
|
||||
{% elif field.type == 'DateField' %}
|
||||
<input class="form-control" type="date" id="{{ field.id }}" name="{{ field.id }}" value="{{ field.default|none_filter }}" aria-describedby="{{ field.id }}_help" />
|
||||
{% elif field.type == 'IntegerField' %}
|
||||
<input class="form-control" type="number" id="{{ field.id }}" name="{{ field.id }}" value="{{ field.default|none_filter }}" step="1" aria-describedby="{{ field.id }}_help" />
|
||||
{% elif field.type == 'DecimalField' %}
|
||||
<input class="form-control" type="number" id="{{ field.id }}" name="{{ field.id }}" value="{{ field.default|none_filter }}" step="{{ 1 / 10 ** field.places}}" aria-describedby="{{ field.id }}_help" />
|
||||
{% else %}
|
||||
{{ field(**kwargs)|safe }}
|
||||
{% endif %}
|
||||
{% if field.errors %}
|
||||
<p class='error'>
|
||||
{% for error in field.errors %}
|
||||
{{ error }}
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_login_form() %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<h3>Login</h3>
|
||||
<form class='form-horizontal' action="{{ url_for_security('login') }}" method="POST" name="login_user_form">
|
||||
{{ login_user_form.hidden_tag() }}
|
||||
{{ render_field_with_errors(login_user_form.email) }}
|
||||
{{ render_field_with_errors(login_user_form.password) }}
|
||||
{{ render_field_with_errors(login_user_form.remember) }}
|
||||
{{ render_field(login_user_form.next) }}
|
||||
{{ render_field_with_errors(login_user_form.submit) }}
|
||||
{% if security.recoverable %}
|
||||
<a href="{{ url_for_security('forgot_password') }}">Forgot password</a>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro chartScript(divId, data, unit)%}
|
||||
{% set hash = divId | md5 %}
|
||||
|
||||
data_{{ hash }} = [{% for stop in data %}{
|
||||
"date": "{{stop.date}}",
|
||||
"value": {{stop.value}}
|
||||
}{% if not loop.last %},{%endif%}
|
||||
{% endfor%}
|
||||
]
|
||||
var chart_{{ hash }} = createChart('{{divId}}', data_{{ hash }}, '{{unit}}');
|
||||
|
||||
function zoom_chart_{{ hash }}() {
|
||||
chart_{{ hash }}.zoomToIndexes(
|
||||
chart_{{ hash }}.dataProvider.length - 40,
|
||||
chart_{{ hash }}.dataProvider.length - 1
|
||||
);
|
||||
}
|
||||
|
||||
chart_{{ hash }}.addListener("rendered", zoom_chart_{{ hash }});
|
||||
|
||||
zoom_chart_{{ hash }}()
|
||||
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
<!doctype html>
|
||||
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
|
||||
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9" lang=""> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang=""> <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>refuel journal</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="apple-touch-icon" href="{{ url_for('static', filename='apple-touch-icon-57.png') }}">
|
||||
<link rel="apple-touch-icon" href="{{ url_for('static', filename='apple-touch-icon-60.png') }}">
|
||||
<link rel="apple-touch-icon" href="{{ url_for('static', filename='apple-touch-icon-72.png') }}">
|
||||
<link rel="apple-touch-icon" href="{{ url_for('static', filename='apple-touch-icon-76.png') }}">
|
||||
<link rel="apple-touch-icon" href="{{ url_for('static', filename='apple-touch-icon-114.png') }}">
|
||||
<link rel="apple-touch-icon" href="{{ url_for('static', filename='apple-touch-icon-120.png') }}">
|
||||
<link rel="apple-touch-icon" href="{{ url_for('static', filename='apple-touch-icon-144.png') }}">
|
||||
<link rel="apple-touch-icon" href="{{ url_for('static', filename='apple-touch-icon-152.png') }}">
|
||||
<link rel="apple-touch-icon" href="{{ url_for('static', filename='apple-touch-icon-180.png') }}">
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="{{ url_for('static', filename='android-icon-192x192.png') }}">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ url_for('static', filename='favicon-32x32.png') }}">
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="{{ url_for('static', filename='favicon-96x96.png') }}">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ url_for('static', filename='favicon-16x16.png') }}">
|
||||
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
|
||||
|
||||
<!-- Optional theme -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
|
||||
<!-- Latest compiled and minified JavaScript -->
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='main.css') }}">
|
||||
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
|
||||
<script src="https://www.amcharts.com/lib/3/serial.js"></script>
|
||||
<script src="https://www.amcharts.com/lib/3/themes/patterns.js"></script>
|
||||
<script src="{{ url_for('static', filename='main.js') }}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="{{ url_for('index') }}">refuel journal</a>
|
||||
</div>
|
||||
<div id="navbar" class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
{{ navigation() }}
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
<div class="starter-template">
|
||||
{% block body %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
{#
|
||||
<nav class="navbar navbar-inverse navbar-fixed-bottom">
|
||||
<div class="container">
|
||||
<div class="navbar-footer">
|
||||
<a class="navbar-brand" href="">Imprint</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
#}
|
||||
</body>
|
||||
</html>
|
||||
31
app/templates/manual.html
Normal file
31
app/templates/manual.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% macro line(header, cell) -%}
|
||||
<tr>
|
||||
<th>
|
||||
{{ header }}
|
||||
</th>
|
||||
<td>
|
||||
{{ cell }}
|
||||
</td>
|
||||
</tr>
|
||||
{%- endmacro %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered table-condensed">
|
||||
{{ line('Reifenluftdruck (vorne)', '1,75 - 2,0 Bar') }}
|
||||
{{ line('Reifenluftdruck (hinten)', '2,0 - 2,25 Bar') }}
|
||||
{{ line('Scheinwerfer', '12V 35/35W HS1-Halogen-Glühlampe') }}
|
||||
{{ line('Standlicht', '12V 5W Glassockel 9mm') }}
|
||||
{{ line('Blinker vorne', '12V 10W Stecksockel 15mm') }}
|
||||
{{ line('Rück-/Bremslicht', '12V/21/5W Stecksockel 15mm') }}
|
||||
{{ line('Blinker hinten', '12V 10W Stecksockel 15mm') }}
|
||||
{{ line('Tankinhalt', 'ca. 6,0 L') }}
|
||||
{{ line('Motoröl', 'SAE 15W40') }}
|
||||
{{ line('Getriebeöl', 'SAE 80/90 (0,12/0,09)') }}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
29
app/templates/newPitStopForm.html
Normal file
29
app/templates/newPitStopForm.html
Normal file
@@ -0,0 +1,29 @@
|
||||
{% 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 Pitstop for '{{ vehicle.name }}'</h3>
|
||||
<form class='form-horizontal' method="POST">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ render_field_with_errors(form.date) }}
|
||||
<span id="{{form.date.id}}_help" class="help-block">
|
||||
{{messages['date']}}
|
||||
</span>
|
||||
{{ render_field_with_errors(form.odometer) }}
|
||||
<span id="{{form.odometer.id}}_help" class="help-block">
|
||||
{{messages['odometer']}}
|
||||
</span>
|
||||
{{ render_field_with_errors(form.litres) }}
|
||||
{{ render_field_with_errors(form.costs) }}
|
||||
<span id="{{form.costs.id}}_help" class="help-block">
|
||||
{{messages['costs']}}
|
||||
</span>
|
||||
{{ render_field_with_errors(form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
116
app/templates/pitstops.html
Normal file
116
app/templates/pitstops.html
Normal file
@@ -0,0 +1,116 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<div id="content">
|
||||
<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 %}
|
||||
<div class="tab-pane {% if loop.first %}active{% endif %}" id="v{{vehicle.id}}">
|
||||
<h3>{{vehicle.name}}</h3>
|
||||
{% if vehicle.pitstops %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered table-condensed">
|
||||
<tr>
|
||||
<th>
|
||||
Date<br/>
|
||||
Days
|
||||
</th>
|
||||
<th>
|
||||
Odometer<br/>
|
||||
Distance
|
||||
</th>
|
||||
<th>
|
||||
Litres<br/>
|
||||
Average
|
||||
</th>
|
||||
<th>
|
||||
Costs<br />
|
||||
Costs per Litre
|
||||
</th>
|
||||
</tr>
|
||||
{% for pitstop in vehicle.pitstops|reverse %}
|
||||
{% if not loop.last %}
|
||||
{% set days = (pitstop.date - vehicle.pitstops[vehicle.pitstops|length - loop.index - 1].date).days %}
|
||||
{% set distance = pitstop.odometer - vehicle.pitstops[vehicle.pitstops|length - loop.index - 1].odometer %}
|
||||
{% set average = (pitstop.litres / distance) * 100 %}
|
||||
<tr class='pitstop'>
|
||||
<td>
|
||||
{{pitstop.date}}<br/>
|
||||
{{ days }} days
|
||||
</td>
|
||||
<td>
|
||||
{{pitstop.odometer}} km<br/>
|
||||
{{distance}} km
|
||||
</td>
|
||||
<td>
|
||||
{{pitstop.litres}} l<br/>
|
||||
{{average | round(2)}} l/100km
|
||||
</td>
|
||||
<td>
|
||||
{{pitstop.costs}} €<br />
|
||||
{{ (pitstop.costs / pitstop.litres) | round(2) }} €/l
|
||||
</td>
|
||||
</tr>
|
||||
{% if loop.first %}
|
||||
<tr class='pitstop'>
|
||||
<td colspan='4'>
|
||||
<a href="{{ url_for('edit_pit_stop_form', pid=pitstop.id) }}" class="btn btn-primary">
|
||||
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> edit
|
||||
</a>
|
||||
<a href="{{ url_for('delete_pit_stop_form', pid=pitstop.id) }}" class="btn btn-primary btn-warning ">
|
||||
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> delete
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<tr class='pitstop'>
|
||||
<td>
|
||||
{{pitstop.date}}<br/>
|
||||
-- days
|
||||
</td>
|
||||
<td>
|
||||
{{pitstop.odometer}} km<br/>
|
||||
-- km
|
||||
</td>
|
||||
<td>
|
||||
{{pitstop.litres}} l<br/>
|
||||
-- l/100km
|
||||
</td>
|
||||
<td>
|
||||
{{pitstop.costs}} €<br />
|
||||
{{ (pitstop.costs / pitstop.litres) | round(2) }} €/l
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
not enough data: <a href="{{ url_for('create_pit_stop_form', vid=vehicle.id) }}">log a pitstop</a>?
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function ($) {
|
||||
$('#tabs').tab();
|
||||
if(window.location.hash != "") {
|
||||
$('a[href="' + window.location.hash + '"]').click()
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
20
app/templates/security/change_password.html
Normal file
20
app/templates/security/change_password.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{% extends "layout.html" %}
|
||||
{% from "security/_macros.html" import render_field_with_errors, render_field %}
|
||||
|
||||
{% block body %}
|
||||
<div class="col-md-2" ></div>
|
||||
<div class="col-md-8">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<h3>Change password</h3>
|
||||
<form class='form-horizontal' action="{{ url_for_security('change_password') }}" method="POST" name="change_password_form">
|
||||
{{ change_password_form.hidden_tag() }}
|
||||
{{ render_field_with_errors(change_password_form.password) }}
|
||||
{{ render_field_with_errors(change_password_form.new_password) }}
|
||||
{{ render_field_with_errors(change_password_form.new_password_confirm) }}
|
||||
{{ render_field_with_errors(change_password_form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
19
app/templates/security/forgot_password.html
Normal file
19
app/templates/security/forgot_password.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{% extends "layout.html" %}
|
||||
{% from "security/_macros.html" import render_field_with_errors, render_field %}
|
||||
|
||||
{% block body %}
|
||||
<div class="col-md-2" ></div>
|
||||
<div class="col-md-8">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<h3>Reset password</h3>
|
||||
<form class='form-horizontal' action="{{ url_for_security('forgot_password') }}" method="POST" name="forgot_password_form">
|
||||
{{ forgot_password_form.hidden_tag() }}
|
||||
{{ render_field_with_errors(forgot_password_form.email) }}
|
||||
{{ render_field_with_errors(forgot_password_form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2" ></div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
13
app/templates/security/login_user.html
Normal file
13
app/templates/security/login_user.html
Normal file
@@ -0,0 +1,13 @@
|
||||
{% extends "layout.html" %}
|
||||
{% from "security/_macros.html" import render_field_with_errors, render_field %}
|
||||
|
||||
{% block body %}
|
||||
<div class="row">
|
||||
<div class="col-md-2" ></div>
|
||||
<div class="col-md-8">
|
||||
{{ render_login_form() }}
|
||||
</div>
|
||||
<div class="col-md-2" ></div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
23
app/templates/security/register_user.html
Normal file
23
app/templates/security/register_user.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends "layout.html" %}
|
||||
{% from "security/_macros.html" import render_field_with_errors, render_field %}
|
||||
|
||||
{% block body %}
|
||||
<div class="col-md-2" ></div>
|
||||
<div class="col-md-8">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<h3>Register</h3>
|
||||
<form class='form-horizontal' action="{{ url_for_security('register') }}" method="POST" name="register_user_form">
|
||||
{{ register_user_form.hidden_tag() }}
|
||||
{{ render_field_with_errors(register_user_form.email) }}
|
||||
{{ render_field_with_errors(register_user_form.password) }}
|
||||
{% if register_user_form.password_confirm %}
|
||||
{{ render_field_with_errors(register_user_form.password_confirm) }}
|
||||
{% endif %}
|
||||
{{ render_field_with_errors(register_user_form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2" ></div>
|
||||
{% endblock %}
|
||||
12
app/templates/security/reset_password.html
Normal file
12
app/templates/security/reset_password.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% extends "layout.html" %}
|
||||
{% from "security/_macros.html" import render_field_with_errors, render_field %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Reset password</h1>
|
||||
<form class='form-horizontal' action="{{ url_for_security('reset_password', token=reset_password_token) }}" method="POST" name="reset_password_form">
|
||||
{{ reset_password_form.hidden_tag() }}
|
||||
{{ render_field_with_errors(reset_password_form.password) }}
|
||||
{{ render_field_with_errors(reset_password_form.password_confirm) }}
|
||||
{{ render_field(reset_password_form.submit) }}
|
||||
</form>
|
||||
{% endblock %}
|
||||
19
app/templates/selectVehice.html
Normal file
19
app/templates/selectVehice.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{% 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>Select Vehicle</h3>
|
||||
<form class='form-horizontal' method="POST">
|
||||
{{ form.hidden_tag() }}
|
||||
{{ render_field_with_errors(form.vehicle) }}
|
||||
{{ render_field_with_errors(form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2" ></div>
|
||||
{% endblock %}
|
||||
|
||||
161
app/templates/statistics.html
Normal file
161
app/templates/statistics.html
Normal file
@@ -0,0 +1,161 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% block body %}
|
||||
<div id="content">
|
||||
<ul id="vehicle_tabs" class="nav nav-tabs" data-tabs="tabs">
|
||||
{% for vehicle in data %}
|
||||
<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="vehicle_content" class="tab-content ">
|
||||
{% for vehicle in data %}
|
||||
<div class="tab-pane {% if loop.first %}active{% endif %}" id="v{{vehicle.id}}">
|
||||
<h3>{{vehicle.name}}</h3>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered table-condensed">
|
||||
<tr>
|
||||
<th>Number of Pitstops:</th>
|
||||
<td>{{ vehicle.pitstop_count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Logged Distance:</th>
|
||||
<td>{{ vehicle.overall_distance | round(2) }} km</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Average Distance:</th>
|
||||
<td>{{ vehicle.average_distance | round(2) }} km</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Litres fuelled:</th>
|
||||
<td>{{ vehicle.overall_litres | round(2) }} l</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Average Litres fuelled:</th>
|
||||
<td>{{ vehicle.average_litres_fuelled | round(2) }} l</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Average Litres used:</th>
|
||||
<td>{{ vehicle.average_litres_used | round(2) }} l/100km</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Logged Costs:</th>
|
||||
<td>{{ vehicle.overall_costs | round(2) }} €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Average Costs per Litre:</th>
|
||||
<td>{{ vehicle.average_costs_per_litre | round(2) }} €/l</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<ul id="charts_tabs" class="nav nav-tabs" data-tabs="tabs">
|
||||
<li class="active">
|
||||
<a href="#v{{vehicle.id}}_c3" id="i{{vehicle.id}}_c3" data-toggle="tab">
|
||||
Consumption
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#v{{vehicle.id}}_c1" id="i{{vehicle.id}}_c1" data-toggle="tab">
|
||||
Fuelled litres
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#v{{vehicle.id}}_c2" id="i{{vehicle.id}}_c2" data-toggle="tab">
|
||||
Odometer
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#v{{vehicle.id}}_c4" id="i{{vehicle.id}}_c4" data-toggle="tab">
|
||||
Costs per litre
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#v{{vehicle.id}}_c5" id="i{{vehicle.id}}_c5" data-toggle="tab">
|
||||
Costs
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="charts_tabs-content" class="tab-content">
|
||||
<div class="tab-pane active" id="v{{vehicle.id}}_c3">
|
||||
{% if vehicle.pitstop_count > 1 %}
|
||||
<div id="averageUsageDiv{{vehicle.id}}" style="width:100%; height:500px;"></div>
|
||||
<script type="text/javascript">
|
||||
{{ chartScript('averageUsageDiv'+vehicle.id|str, vehicle.average_litres, 'l/100 km') }}
|
||||
</script>
|
||||
{% else %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
not enough data: <a href="{{ url_for('create_pit_stop_form', vid=vehicle.id) }}">log a pitstop</a>?
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="tab-pane " id="v{{vehicle.id}}_c1">
|
||||
{% if vehicle.pitstop_count > 0 %}
|
||||
<div id="fuelledChartDiv{{vehicle.id}}" style="width:100%; height:500px;"></div>
|
||||
<script type="text/javascript">
|
||||
{{ chartScript('fuelledChartDiv'+vehicle.id|str, vehicle.litres, 'l') }}
|
||||
</script>
|
||||
{% else %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
not enough data: <a href="{{ url_for('create_pit_stop_form', vid=vehicle.id) }}">log a pitstop</a>?
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="tab-pane " id="v{{vehicle.id}}_c2">
|
||||
{% if vehicle.pitstop_count > 0 %}
|
||||
<div id="odometerChartDiv{{vehicle.id}}" style="width:100%; height:500px;"></div>
|
||||
<script type="text/javascript">
|
||||
{{ chartScript('odometerChartDiv'+vehicle.id|str, vehicle.odometers, 'km') }}
|
||||
</script>
|
||||
{% else %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
not enough data: <a href="{{ url_for('create_pit_stop_form', vid=vehicle.id) }}">log a pitstop</a>?
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="tab-pane " id="v{{vehicle.id}}_c4">
|
||||
{% if vehicle.pitstop_count > 0 %}
|
||||
<div id="costsPerLitre{{vehicle.id}}" style="width:100%; height:500px;"></div>
|
||||
<script type="text/javascript">
|
||||
{{ chartScript('costsPerLitre'+vehicle.id|str, vehicle.costsPerLitre, '€/l') }}
|
||||
</script>
|
||||
{% else %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
not enough data: <a href="{{ url_for('create_pit_stop_form', vid=vehicle.id) }}">log a pitstop</a>?
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="tab-pane " id="v{{vehicle.id}}_c5">
|
||||
{% if vehicle.pitstop_count > 0 %}
|
||||
<div id="costs{{vehicle.id}}" style="width:100%; height:500px;"></div>
|
||||
<script type="text/javascript">
|
||||
{{ chartScript('costs'+vehicle.id|str, vehicle.costs, '€') }}
|
||||
</script>
|
||||
{% else %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
not enough data: <a href="{{ url_for('create_pit_stop_form', vid=vehicle.id) }}">log a pitstop</a>?
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function ($) {
|
||||
$('#vehicle_tabs').tab();
|
||||
if(window.location.hash != "") {
|
||||
$('a[href="' + window.location.hash + '"]').click()
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user