From a1d88a5e6bca998c444e033df413f61abad6bb0d Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 30 Jan 2023 11:56:09 -0600 Subject: [PATCH] Refactor the Inventory Worksheet generator, per Buefy --- tailbone/templates/reports/inventory.mako | 108 +++++++++++++++++----- tailbone/views/reports.py | 3 +- 2 files changed, 86 insertions(+), 25 deletions(-) diff --git a/tailbone/templates/reports/inventory.mako b/tailbone/templates/reports/inventory.mako index 41c74cda..e3033c4c 100644 --- a/tailbone/templates/reports/inventory.mako +++ b/tailbone/templates/reports/inventory.mako @@ -3,33 +3,93 @@ <%def name="title()">Report : Inventory Worksheet -

Please provide the following criteria to generate your report:

-
+<%def name="page_content()"> + % if use_buefy: -${h.form(request.current_route_url())} -${h.csrf_token(request)} +

+ Please provide the following criteria to generate your report: +

-
- -
- -
-
+ ${h.form(request.current_route_url())} + ${h.csrf_token(request)} -
- ${h.checkbox('weighted-only', label="Only include items which are sold by weight.")} -
+ + + + + -
- ${h.checkbox('exclude-not-for-sale', label="Exclude items marked \"not for sale\".", checked=True)} -
+ + + Only include items which are sold by weight. + + -
- ${h.submit('submit', "Generate Report")} -
+ + + Exclude items marked "not for sale". + + -${h.end_form()} +
+ + Generate Report + +
+ + ${h.end_form()} + + % else: + +

Please provide the following criteria to generate your report:

+
+ + ${h.form(request.current_route_url())} + ${h.csrf_token(request)} + +
+ +
+ +
+
+ +
+ ${h.checkbox('weighted-only', label="Only include items which are sold by weight.")} +
+ +
+ ${h.checkbox('exclude-not-for-sale', label="Exclude items marked \"not for sale\".", checked=True)} +
+ +
+ ${h.submit('submit', "Generate Report")} +
+ + ${h.end_form()} + + % endif + + +<%def name="modify_this_page_vars()"> + ${parent.modify_this_page_vars()} + + + + +${parent.body()} diff --git a/tailbone/views/reports.py b/tailbone/views/reports.py index 7bcc05da..0054569d 100644 --- a/tailbone/views/reports.py +++ b/tailbone/views/reports.py @@ -174,7 +174,8 @@ class InventoryWorksheet(View): departments = departments.order_by(model.Department.name) departments = departments.all() - return{'departments': departments} + return{'departments': departments, + 'use_buefy': self.get_use_buefy()} def write_report(self, department): """