Add search box for location to quantities page
This commit is contained in:
parent
82f37f4b25
commit
df6e64afc3
@ -1,6 +1,11 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<form action="./quantities">
|
||||
<input type="text" placeholder="Location" name="location" />
|
||||
<input type="submit" />
|
||||
</form>
|
||||
<a href="./quantities">Clear Search</a>
|
||||
<table border=1>
|
||||
<tr>
|
||||
<th>UPC</th>
|
||||
|
17
webui.py
17
webui.py
@ -6,7 +6,7 @@ Web User Interface for InvMan
|
||||
"""
|
||||
|
||||
# Imports
|
||||
from flask import Flask, render_template
|
||||
from flask import Flask, render_template, request
|
||||
|
||||
from libdb import Session, Product, ProductQuantity
|
||||
|
||||
@ -28,6 +28,15 @@ def products_list_page():
|
||||
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)
|
||||
query = session.query(ProductQuantity.product_upc,
|
||||
ProductQuantity.quantity, ProductQuantity.location)
|
||||
if "location" in request.args:
|
||||
searchloc = request.args['location']
|
||||
if len(request.args['location']) > 0:
|
||||
data = query.filter(ProductQuantity.location == request.args['location']).all()
|
||||
else:
|
||||
data = query.all()
|
||||
else:
|
||||
searchloc = ""
|
||||
data = query.all()
|
||||
return render_template("ui/quantities.html", data=data, searchloc=searchloc)
|
||||
|
Loading…
Reference in New Issue
Block a user