Move Python code into repo root

This commit is contained in:
2023-08-11 14:37:51 +02:00
parent b729e91aaa
commit fd02d162aa
32 changed files with 1 additions and 5 deletions
+107
View File
@@ -0,0 +1,107 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jon</title>
<style>
html {
font-family: Helvetica, sans-serif;
}
h1 {
margin: 0;
}
nav > ul {
padding-left: 0;
}
nav > ul > li {
display: inline-block;
list-style: none;
}
nav > ul > li + li:before {
content: ' · ';
}
.current-page > a {
position: relative;
}
.current-page > a:after {
content: '↓';
font-size: 0.8em;
box-sizing: border-box;
position: absolute;
display: block;
right: 50%;
top: -1em;
width: 1em;
text-align: center;
margin-right: -0.5em;
animation: wiggle 0.8s ease-in-out 0s infinite;
/* animation-direction: alternate; */
}
.--align-left {
text-align: left;
}
.--align-right {
text-align: right;
}
.--centered {
text-align: center;
}
@keyframes wiggle {
0%, 100% { margin-top: 0; }
50% { margin-top: -0.5em; }
/* 100% { transform: rotate(1turn); } */
}
table {
border-spacing: .5em 0;
}
th {
font-size: .8em;
}
@media print {
body {
font-size: 8px;
}
}
.form-input > label {
font-size: .8em;
}
.form-input > input:not([type=radio]),
.form-input > select {
display: block;
}
</style>
</head>
<body>
<header>
<h1>jon</h1>
<nav>
<ul>
<li {{ "class=current-page" if request.path == "/" else "" }}><a href="/">Home</a></li>
<li {{ "class=current-page" if request.path.startswith("/inventory") else "" }}><a href="/inventory">Inventar</a></li>
<li {{ "class=current-page" if request.path.startswith("/entry") else "" }}><a href="/entry">Eintragen</a></li>
<li {{ "class=current-page" if request.path.startswith("/location") else "" }}>
<a href="/location">
{% if "location" not in session %}
Raum wählen
{% else %}
Raum: {{ session.location.location_name }}
{% endif %}
</a>
</li>
</ul>
</nav>
{% if config.DEBUG %}
<details>
<summary><code>config</code></summary>
<pre>{% for key, value in config.items() %}{{ key }} = {{ value }}
{% endfor %}</pre>
</details>
{% endif %}
</header>
<main>
{% block content %}{% endblock %}
</main>
</body>
</html>
+56
View File
@@ -0,0 +1,56 @@
{% extends "base.html" %}
{% block content %}
<pre>{{ entry }}</pre>
<fieldset>
<legend>Neuer Inventareintrag</legend>
<form method="POST" action="/entry/edit-item-data">
<div class="form-input">
<label for="item_bought">Kaufdatum</label>
<input name="item_bought" id="item_bought" type="date" value="{{ (entry.item_bought or now()).strftime('%Y-%m-%d') }}">
</div>
<div class="form-input">
<label for="item_barcode">Barcode</label>
<input name="item_barcode" id="item_barcode" type="text" value="{{ entry.item_barcode }}" placeholder="Barcode">
</div>
<div class="form-input">
<label for="item_name">Artikel</label>
<input name="item_name" id="item_name" type="text" value="{{ entry.item_name }}" placeholder="Artikel">
</div>
<div class="form-input">
<label for="item_group">Gruppe</label>
<select name="item_group" id="item_group">
{% for group in groups %}
<option value="{{ group.group_id }}"{% if entry.item_group_id == group.group_id %} selected{% endif %}>{{ group.group_name }} ({{ group.group_id }})</option>
{% endfor %}
</select>
</div>
<div class="form-input">
<label for="item_net_unit_price">Stückpreis (Netto) in €</label>
<input name="item_net_unit_price" id="item_net_unit_price" type="number" step="0.01" value="{{ entry.item_net_unit_price }}" placeholder="Stückpreis (Netto) in €">
</div>
<div class="form-input">
<input name="item_tax_group" id="item_tax_group_1" type="radio" value="1"{% if entry.item_tax_group_id == 1 %} selected{% endif %}>
<label for="item_tax_group_1">Volle Umsatzsteuer (19%)</label>
<input name="item_tax_group" id="item_tax_group_2" type="radio" value="2"{% if entry.item_tax_group_id == 2 %} selected{% endif %}>
<label for="item_tax_group_2">Ermäßigte Umsatzsteuer (7%)</label>
</div>
<div class="form-input">
<label for="item_amount">Anzahl</label>
<input name="item_amount" id="item_amount" type="number" value="{{ entry.item_amount }}" placeholder="Anzahl">
</div>
<div class="form-input">
<label for="item_group">Raum</label>
<select name="item_location" id="item_location">
{% for location in locations %}
<option value="{{ location.location_id }}"{% if entry.item_location_id == location.location_id or ("item_location" not in entry and (session.location.location_id == location.location_id)) %} selected{% endif %}>{{ location.location_name }} ({{ location.location_id }})</option>
{% endfor %}
</select>
</div>
<button>Weiter zu den Snackeinträgen</button>
</form>
</fieldset>
{% endblock %}
+5
View File
@@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block content %}
<a href="/entry/edit-item-data">Neuer Eintrag</a>
{% endblock %}
@@ -0,0 +1,83 @@
{% extends "base.html" %}
{% block content %}
<pre>{{ entry }}</pre>
<fieldset>
<legend>Neuer Inventareintrag</legend>
<table>
<tr>
<th class="--align-left">ID</th>
<td>{{ entry.item_id }}</td>
</tr>
<tr>
<th class="--align-left">Barcode</th>
<td><code>{{ entry.item_barcode }}</code></td>
</tr>
<tr>
<th class="--align-left">Name</th>
<td>{{ entry.item_name }}</td>
</tr>
<tr>
<th class="--align-left">Einkaufspreis (Netto)</th>
<td>{{ format_currency(entry.item_net_unit_price) }}</td>
</tr>
<tr>
<th class="--align-left">Empfohlener Garfield-Verkaufspreis</th>
<td>{{ format_currency(get_garfield_price(entry.item_net_unit_price, entry.item_tax_group_id)) }}</td>
</tr>
<tr>
<th class="--align-left">Kaufdatum</th>
<td>{{ format_date(entry.item_bought) }}</td>
</tr>
<tr>
<th class="--align-left">Gruppe</th>
<td>{{ entry.item_group_name }} ({{ entry.item_group_id }})</td>
</tr>
<tr>
<th class="--align-left">Anzahl</th>
<td>{{ entry.item_amount }}</td>
</tr>
<tr>
<th class="--align-left">Raum</th>
<td>{{ entry.item_location_name }} ({{ entry.item_location_id }})</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>Snackeinträge mit Barcode <code>{{ entry.item_barcode }}</code></legend>
<table>
<tr>
<th>ID</th>
<th>Barcode</th>
<th>Name</th>
<th>Verkaufspreis (Brutto)</th>
<th>Eintragedatum</th>
<th>Steuersatz</th>
<th>Raum</th>
<th>Aktiv?</th>
<th>Aktionen</th>
</tr>
{% for snack in snacks %}
<tr>
<td>{{ snack.snack_id }}</td>
<td><code>{{ snack.snack_barcode }}</code></td>
<td>{{ snack.snack_name }}</td>
<td class="--align-right">{{ format_currency(snack.snack_price) }}</td>
<td>{{ format_date(snack.snack_timestamp) }}</td>
<td>{{ snack.description }} ({{ snack.tax_group_id }})</td>
<td>{{ snack.location_name }} ({{ snack.location_id }})</td>
<td>{{ format_bool(snack.snack_available) }}</td>
<td>
<form method="POST" action="/entry/select-snack-entry">
<input type="hidden" name="snack_id" value="{{ snack.snack_id }}">
<button>Snackeintrag übernehmen</button>
</form>
</td>
</tr>
{% endfor %}
</table>
</fieldset>
{% endblock %}
+5
View File
@@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block content %}
<h2>It works!</h2>
{% endblock %}
+34
View File
@@ -0,0 +1,34 @@
{% extends "base.html" %}
{% block content %}
<table>
<tr>
<th>ID</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><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 %}
+154
View File
@@ -0,0 +1,154 @@
{% extends "base.html" %}
{% block content %}
<h2>Inventareintrag {{ item.item_id }}</h2>
<fieldset>
<legend>Inventareintrag {{ item.item_id }}</legend>
<table>
<tr>
<th class="--align-left">ID</th>
<td>{{ item.item_id }}</td>
</tr>
<tr>
<th class="--align-left">Barcode</th>
<td><code>{{ item.item_barcode }}</code></td>
</tr>
<tr>
<th class="--align-left">Name</th>
<td>{{ item.name }}</td>
</tr>
<tr>
<th class="--align-left">Einkaufspreis (Netto)</th>
<td>{{ format_currency(item.unit_price) }}</td>
</tr>
<tr> <th class="--align-left">Kaufdatum</th>
<td>{{ format_date(item.bought) }}</td>
</tr>
<tr>
<th class="--align-left">Gruppe</th>
<td>{{ item.group_name }} ({{ item.item_group }})</td>
</tr>
<tr>
<th class="--align-left">Inventar</th>
<td>{{ item.units_left }}</td>
</tr>
<tr>
<th class="--align-left">Korrekturen</th>
<td>{{ item.correction_delta }}</td>
</tr>
<tr>
<th class="--align-left">Eingekauft</th>
<td>{{ item.sales_units }}</td>
</tr>
<tr>
<th class="--align-left">Raum</th>
<td>{{ item.location_name }} ({{ item.location }})</td>
</tr>
<tr>
<th class="--align-left">Aktiv?</th>
<td>{{ format_bool(item.available) }}</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>Aktionen</legend>
<form method="POST" action="/inventory/correction">
<input name="item_id" type="hidden" value="{{ item.item_id }}">
<input name="correction_comment" type="hidden" value="Verlust">
<input name="correction_delta" type="hidden" value="{{ -item.units_left }}">
<button{% if item.units_left == 0 %} disabled{% endif %}>Inventar zu 0 korrigieren</button>
</form>
<form method="POST" action="/inventory/correction">
<input name="item_id" type="hidden" value="{{ item.item_id }}">
<input name="correction_comment" type="text" value="" placeholder="Kommentar">
<input name="correction_delta" type="number" value="" placeholder="Delta">
<button>Inventar korrigieren</button>
</form>
<form method="POST" action="/inventory/item/{{ item.item_id }}/deactivate">
<button{% if item.units_left != 0 %} disabled{% endif %}>Inventar- und Snackeintrag deaktivieren</button>
</form>
</fieldset>
<fieldset>
<legend>Snackeinträge für {{ item.item_id }}</legend>
<table>
<tr>
<th>ID</th>
<th>Barcode</th>
<th>Name</th>
<th>Verkaufspreis (Brutto)</th>
<th>Eintragedatum</th>
<th>Steuersatz</th>
<th>Raum</th>
<th>Aktiv?</th>
</tr>
{% for snack in snacks %}
<tr>
<td>{{ snack.snack_id }}</td>
<td><code>{{ snack.snack_barcode }}</code></td>
<td>{{ snack.snack_name }}</td>
<td class="--align-right">{{ format_currency(snack.snack_price) }}</td>
<td>{{ format_date(snack.snack_timestamp) }}</td>
<td>{{ snack.description }} ({{ snack.tax_group_id }})</td>
<td>{{ snack.location_name }} ({{ snack.location_id }})</td>
<td>{{ format_bool(snack.snack_available) }}</td>
</tr>
{% endfor %}
</table>
</fieldset>
<fieldset>
<legend>Inventareinträge mit Barcode <code>{{ item.item_barcode }}</code> in {{ item.location_name }}</legend>
<table>
<tr>
<th>ID</th>
<th>Barcode</th>
<th>Name</th>
<th>Einkaufspreis (Netto)</th>
<th>Kaufdatum</th>
<th>Gruppe</th>
<th>Eingekauft</th>
<th>Korrekturen</th>
<th>Inventar</th>
<th title="Aktive Snackeinträge">AS</th>
<th>Aktiv?</th>
</tr>
{% for other_item in same_barcode_items %}
<tr>
<td><a href="/inventory/item/{{ other_item.item_id }}">{{ other_item.item_id }}</a></td>
<td><code>{{ other_item.item_barcode }}</code></td>
<td>{{ other_item.name }}</td>
<td class="--align-right">{{ format_currency(other_item.unit_price) }}</td>
<td>{{ format_date(other_item.bought) }}</td>
<td>{{ other_item.group_name }} ({{ other_item.item_group }})</td>
<td class="--align-right">{{ other_item.sales_units }}</td>
<td class="--align-right">{% if other_item.correction_delta > 0 %}+{% endif %}{{ other_item.correction_delta }}</td>
<td class="--align-right">{{ other_item.units_left }}</td>
<td class="--centered">
{% if other_item.active_mappings != 0 %}
{{ other_item.active_mappings_array | join(", ") }}
{% else %}
-
{% endif %}
</td>
<td class="--centered">{{ format_bool(other_item.available) }}</td>
<td>
<form method="POST" action="/inventory/transfer">
<input type="hidden" name="from_item_id" value="{{ item.item_id }}">
<input type="hidden" name="to_item_id" value="{{ other_item.item_id }}">
<input type="hidden" name="amount" value="{{ item.units_left }}">
<button{% if not other_item.available or other_item.item_id == item.item_id %} disabled{% endif %}>{{ item.units_left }} Artikel umbuchen</button>
</form>
</td>
</tr>
{% endfor %}
</table>
</fieldset>
{% endblock %}
+28
View File
@@ -0,0 +1,28 @@
{% extends "base.html" %}
{% block content %}
<table>
<tr>
<th>ID</th>
<th>Barcode</th>
<th>Name</th>
<th>Inventar</th>
<th>Raum</th>
<th>Verbrauch [1/d]</th>
<th>ETUE [d]</th>
<th>Für 2m</th>
</tr>
{% for item in items %}
<tr>
<td><a href="/inventory/item/{{ item.item_id }}">{{ item.item_id }}</a></td>
<td><code>{{ item.item_barcode }}</code></td>
<td>{{ item.name }}</td>
<td class="--align-right">{{ item.units_left }}</td>
<td>{{ item.location_name }}</td>
<td class="--align-right">{{ item.per_day|round(2) }}</td>
<td class="--align-right">{% if item.days_left != None %}{{ item.days_left|round(1) }}{% endif %}</td>
<td class="--align-right">{% if item.for_two_months %}{{ item.for_two_months|round(1) }}{% endif %}</td>
</tr>
{% endfor %}
</table>
{% endblock %}
+14
View File
@@ -0,0 +1,14 @@
{% extends "base.html" %}
{% block content %}
<form method="POST" action=".">
<select name="location_id">
<option value="" {{ "selected" if "location" not in session else ""}}>-</option>
{% for location in locations %}
<option value="{{ location.location_id }}" {{ "selected" if "location" in session and session.location.location_id == location.location_id else "" }}>{{ location.location_name }}</option>
{% endfor %}
</select>
<button type="submit">Raum wählen</button>
</form>
{% endblock %}