Add products and quantities pages

This commit is contained in:
BBaoVanC 2020-10-05 20:10:43 -05:00
parent b809edd49d
commit 82f37f4b25
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
3 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML>
<html>
<body>
<table border=1>
<tr>
<th>UPC</th>
<td>Brand</td>
<td>Name</td>
<td>Size</td>
<td>Size Unit</td>
<td>Description</td>
</tr>
{% for upc, brand, name, size, sizeunit, description in data %}
<tr>
<th> {{ upc }} </th>
<td> {{ brand }} </td>
<td> {{ name }} </td>
<td> {{ size }} </td>
<td> {{ sizeunit }} </td>
<td> {{ description }} </td>
</tr>
{% endfor %}
</table>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!DOCTYPE HTML>
<html>
<body>
<table border=1>
<tr>
<th>UPC</th>
<td>Quantity</td>
<td>Location</td>
</tr>
{% for upc, quantity, location in data %}
<tr>
<th> {{ upc }} </th>
<td> {{ quantity }} </td>
<td> {{ location }} </td>
</tr>
{% endfor %}
</table>
</body>
</html>

33
webui.py Normal file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env python3
"""
InvMan Web UI
Web User Interface for InvMan
"""
# Imports
from flask import Flask, render_template
from libdb import Session, Product, ProductQuantity
app = Flask(__name__) # app is the Flask app
@app.route("/ui/products")
def products_list_page():
"""Route for the products page"""
session = Session()
data = session.query(
Product.upc, Product.brand, Product.name,
Product.size, Product.sizeunit, Product.description).all()
return render_template("ui/products.html", data=data)
@app.route("/ui/quantities")
def products_quantities_page():
"""Route for the quantities page"""
session = Session()
data = session.query(ProductQuantity.product_upc,
ProductQuantity.quantity, ProductQuantity.location).all()
return render_template("ui/quantities.html", data=data)