60 lines
1.8 KiB
HTML
60 lines
1.8 KiB
HTML
{% macro consumption_graph_svg(values) -%}
|
|
{% set stroke_width = 8 %}
|
|
{% set width = 300 %}
|
|
{% set height = 100 %}
|
|
{% set padding = 4 %}
|
|
{% set dx = (width - 2 * padding) / ((values | length) + 1) %}
|
|
{% set dy = (height - 2 * padding) / ((values + [1]) | max) %}
|
|
<svg viewBox="0 0 {{ width }} {{ height }}" role="img" class="consumption-graph">
|
|
<polyline
|
|
points="
|
|
{% for value in values %}
|
|
{{ padding + loop.index * dx }}, {{ height - padding - value * dy }}
|
|
{% endfor %}
|
|
"
|
|
stroke="green"
|
|
stroke-width="{{ stroke_width }}"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
fill="none"
|
|
>
|
|
</svg>
|
|
{% endmacro -%}
|
|
|
|
{% extends "base.html" %}
|
|
|
|
{% block content %}
|
|
<table>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Graph</th>
|
|
<th>Barcode</th>
|
|
<th>Name</th>
|
|
<th>Preis (Netto)</th>
|
|
<th>Kaufdatum</th>
|
|
<th>Gruppe</th>
|
|
<th>Eingekauft</th>
|
|
<th title="Korrekturen">Korr.</th>
|
|
<th>Inventar</th>
|
|
<th title="Anzahl aktiver Snackeinträge">#AS</th>
|
|
<th>Raum</th>
|
|
</tr>
|
|
{% for item in items %}
|
|
<tr>
|
|
<td><a href="/inventory/item/{{ item.item_id }}">{{ item.item_id }}</a></td>
|
|
<td>{{ consumption_graph_svg(item.last_n_days_sales) }}</td>
|
|
<td><code>{{ item.item_barcode }}</code></td>
|
|
<td>{{ item.name }}</td>
|
|
<td class="--align-right">{{ format_currency(item.unit_price) }}</td>
|
|
<td>{{ format_date(item.bought) }}</td>
|
|
<td>{{ item.group_name }} ({{ item.item_group }})</td>
|
|
<td class="--align-right">{{ item.sales_units }}</td>
|
|
<td class="--align-right">{% if item.correction_delta > 0 %}+{% endif %}{{ item.correction_delta }}</td>
|
|
<td class="--align-right">{{ item.units_left }}</td>
|
|
<td class="--align-right">{{ item.active_mappings }}</td>
|
|
<td>{{ item.location_name }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</table>
|
|
{% endblock %}
|