- add: add beverages

This commit is contained in:
Ulrich Knechtelsdorfer
2016-02-13 22:05:49 +01:00
parent c84212e151
commit 79bcf2e8ca
13 changed files with 148 additions and 28 deletions

View File

@@ -7,8 +7,24 @@
</ul>
<h1> Konsumatverwaltung </h1>
{% for product in products %}
<div><p> {{ product.id }}, {{product.name}}, {{product.price}} €</p></div>
{% endfor %}
<a href=/manage_beverages/add>Getränk Hinzufügen</a></li>
{% endblock %}
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Preis</th>
<th>Wird angezeigt</th>
<th></th>
</tr>
{% for product in products %}
<tr>
<td>{{product.id}}</td>
<td>{{product.name}}</td>
<td>{{product.price}}</td>
<td>{% if product.isshown %} &#9745; {% else %} &#9744; {% endif %} </td>
<td> <a href="/manage_beverages/edit/{{product.name}}">bearbeiten</a></td>
</tr>
{% endfor %}
</table>
<br />
<a href=/manage_beverages/add>Getränk Hinzufügen</a></li>
{% endblock %}

View File

@@ -0,0 +1,18 @@
{% extends "base.html"%}
{% set title = "Produkt hinzufügen" %}
{% block content %}
<h1> Produkt hinzufügen</h1>
{% if error %}
<p>Fehler: {{ error }}</p>
{% endif %}
{% if success %}
<p>{{ success }}</p>
{% endif %}
<p> TODO: many </p>
<form name="user" method="post" action="/manage_beverages/add">
Produktname:<input type="text" name="name" required><br>
Preis:<input type="number" name="price" step="any" required value="0.0" /><br>
Angezeigt: <input type="checkbox" name="isshown" checked /><br>
<input type="submit" value="Hinzufügen">
</form>
{% endblock %}

View File

@@ -0,0 +1,19 @@
{% extends "base.html"%}
{% set title = "Konsumat bearbeiten" %}
{% block content %}
<h1> {{product_to_edit.name}} bearbeiten</h1>
{% if error %}
<p>Fehler: {{ error }}</p>
{% else %}
{% if success %}
<p>{{ success }}</p>
{% endif %}
<form name="product" method="post" action="/manage_beverages/edit">
Userid: <input type="text" name="id" required value="{{product_to_edit.id}}" readonly="readonly" /> <br>
Username:<input type="text" name="name" required value="{{product_to_edit.name}}" /> <br>
Preis:<input type="number" name="price" step="any" required value="{{product_to_edit.price}}" /><br>
Angezeigt: <input type="checkbox" name="isshown" {% if product_to_edit.isshown %} checked {% endif %} /><br>
<input type="submit" value="Übernehmen" />
</form>
{% endif %}
{% endblock %}

View File

@@ -1,16 +0,0 @@
{% extends "base.html"%}
{% set title = "Produkt hinzufügen" %}
{% block content %}
<h1> Produkt hinzufügen</h1>
{% if error %}
<p>Fehler: {{ error }}</p>
{% endif %}
{% if success %}
<p>{{ success }}</p>
{% endif %}
<p> TODO: many </p>
<form name="user" method="post" action="/manage_users/add">
Produktname:<input type="text" name=username required placeholder="Username"><br>
Preis:<input type="password" name=password1 required placeholder="Password"><br>
</form>
{% endblock %}