autoilux/main/templates/main/fuelpurchase_list.html

74 lines
3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends "base.html" %}
{% block title %}Fuel Purchases - {{ current_month }}.{{ current_year }}{% endblock %}
{% block content %}
<div class="uk-flex uk-flex-between uk-flex-middle uk-margin-bottom">
<h2 class="uk-heading-line">
<span>Fuel Purchases {{ current_month }}.{{ current_year }}</span>
</h2>
<a href="{% url 'fuelpurchase_add' %}" class="uk-button uk-button-primary">Add Purchase</a>
</div>
<!-- Navigointi ja alasvetovalikko -->
<div class="uk-flex uk-flex-between uk-flex-middle uk-margin-small-bottom">
<a href="{% url 'fuelpurchase_list' prev_year prev_month %}" class="uk-button uk-button-default">&larr; Previous</a>
<form method="get" action="" class="uk-form-horizontal">
<select class="uk-select" onchange="if(this.value) window.location.href=this.value;">
{% for month_date in available_months %}
<option value="{% url 'fuelpurchase_list' month_date.year month_date.month %}"
{% if month_date.year == current_year and month_date.month == current_month %}selected{% endif %}>
{{ month_date|date:"Y F" }}
</option>
{% endfor %}
</select>
</form>
<a href="{% url 'fuelpurchase_list' next_year next_month %}" class="uk-button uk-button-default">Next &rarr;</a>
</div>
<!-- Yhteenveto -->
<div class="uk-card uk-card-default uk-card-body uk-margin-bottom">
<h4 class="uk-card-title">Summary</h4>
<ul class="uk-list uk-list-divider">
<li><strong>Total Cost:</strong> {{ summary.total_cost_sum|floatformat:2|default:"0.00" }} €</li>
<li><strong>Total Litres:</strong> {{ summary.total_litres_sum|floatformat:2|default:"0.00" }} L</li>
<li><strong>Average Litre Price:</strong> {{ summary.avg_price|floatformat:3|default:"0.000" }} €</li>
<li><strong>Min Litre Price:</strong> {{ summary.min_price|floatformat:3|default:"0.000" }} €</li>
<li><strong>Max Litre Price:</strong> {{ summary.max_price|floatformat:3|default:"0.000" }} €</li>
</ul>
</div>
<!-- Taulukko -->
{% if purchases %}
<table class="uk-table uk-table-divider uk-table-striped uk-table-hover">
<thead>
<tr>
<th>Date</th>
<th>Total Cost (€)</th>
<th>Litre Price (€)</th>
<th>Amount (litres)</th>
<th>Octane</th>
<th>Gas Station</th>
<th>Car</th>
</tr>
</thead>
<tbody>
{% for purchase in purchases %}
<tr>
<td>{{ purchase.purchase_date|date:"d.m.Y" }}</td>
<td>{{ purchase.total_cost }}</td>
<td>{{ purchase.price_per_litre }}</td>
<td>{{ purchase.amount_litres }}</td>
<td>{{ purchase.octane }}</td>
<td>{{ purchase.get_gas_station_display }}</td>
<td>{{ purchase.get_car_display }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="uk-text-meta">No purchases recorded for this month.</p>
{% endif %}
{% endblock %}