Add products and quantities pages
This commit is contained in:
parent
b809edd49d
commit
82f37f4b25
25
templates/ui/products.html
Normal file
25
templates/ui/products.html
Normal 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>
|
19
templates/ui/quantities.html
Normal file
19
templates/ui/quantities.html
Normal 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
33
webui.py
Normal 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)
|
Loading…
Reference in New Issue
Block a user