Refactor the Inventory Worksheet generator, per Buefy
This commit is contained in:
parent
a3723e4879
commit
a1d88a5e6b
|
@ -3,13 +3,58 @@
|
|||
|
||||
<%def name="title()">Report : Inventory Worksheet</%def>
|
||||
|
||||
<p>Please provide the following criteria to generate your report:</p>
|
||||
<br />
|
||||
<%def name="page_content()">
|
||||
% if use_buefy:
|
||||
|
||||
${h.form(request.current_route_url())}
|
||||
${h.csrf_token(request)}
|
||||
<p class="block">
|
||||
Please provide the following criteria to generate your report:
|
||||
</p>
|
||||
|
||||
<div class="field-wrapper">
|
||||
${h.form(request.current_route_url())}
|
||||
${h.csrf_token(request)}
|
||||
|
||||
<b-field label="Department">
|
||||
<b-select name="department">
|
||||
<option v-for="dept in departments"
|
||||
:key="dept.uuid"
|
||||
:value="dept.uuid">
|
||||
{{ dept.name }}
|
||||
</option>
|
||||
</b-select>
|
||||
</b-field>
|
||||
|
||||
<b-field>
|
||||
<b-checkbox name="weighted-only">
|
||||
Only include items which are sold by weight.
|
||||
</b-checkbox>
|
||||
</b-field>
|
||||
|
||||
<b-field>
|
||||
<b-checkbox name="exclude-not-for-sale" :value="true">
|
||||
Exclude items marked "not for sale".
|
||||
</b-checkbox>
|
||||
</b-field>
|
||||
|
||||
<div class="buttons">
|
||||
<b-button type="is-primary"
|
||||
native-type="submit"
|
||||
icon-pack="fas"
|
||||
icon-left="arrow-circle-right">
|
||||
Generate Report
|
||||
</b-button>
|
||||
</div>
|
||||
|
||||
${h.end_form()}
|
||||
|
||||
% else:
|
||||
|
||||
<p>Please provide the following criteria to generate your report:</p>
|
||||
<br />
|
||||
|
||||
${h.form(request.current_route_url())}
|
||||
${h.csrf_token(request)}
|
||||
|
||||
<div class="field-wrapper">
|
||||
<label for="department">Department</label>
|
||||
<div class="field">
|
||||
<select name="department">
|
||||
|
@ -18,18 +63,33 @@ ${h.csrf_token(request)}
|
|||
% endfor
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-wrapper">
|
||||
<div class="field-wrapper">
|
||||
${h.checkbox('weighted-only', label="Only include items which are sold by weight.")}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-wrapper">
|
||||
<div class="field-wrapper">
|
||||
${h.checkbox('exclude-not-for-sale', label="Exclude items marked \"not for sale\".", checked=True)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="buttons">
|
||||
<div class="buttons">
|
||||
${h.submit('submit', "Generate Report")}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
${h.end_form()}
|
||||
${h.end_form()}
|
||||
|
||||
% endif
|
||||
</%def>
|
||||
|
||||
<%def name="modify_this_page_vars()">
|
||||
${parent.modify_this_page_vars()}
|
||||
<script type="text/javascript">
|
||||
|
||||
ThisPageData.departments = ${json.dumps([{'uuid': d.uuid, 'name': d.name} for d in departments])|n}
|
||||
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
|
||||
${parent.body()}
|
||||
|
|
|
@ -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):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue