Refactor the Inventory Worksheet generator, per Buefy
This commit is contained in:
parent
a3723e4879
commit
a1d88a5e6b
|
@ -3,33 +3,93 @@
|
|||
|
||||
<%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">
|
||||
<label for="department">Department</label>
|
||||
<div class="field">
|
||||
<select name="department">
|
||||
% for department in departments:
|
||||
<option value="${department.uuid}">${department.name}</option>
|
||||
% endfor
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
${h.form(request.current_route_url())}
|
||||
${h.csrf_token(request)}
|
||||
|
||||
<div class="field-wrapper">
|
||||
${h.checkbox('weighted-only', label="Only include items which are sold by weight.")}
|
||||
</div>
|
||||
<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>
|
||||
|
||||
<div class="field-wrapper">
|
||||
${h.checkbox('exclude-not-for-sale', label="Exclude items marked \"not for sale\".", checked=True)}
|
||||
</div>
|
||||
<b-field>
|
||||
<b-checkbox name="weighted-only">
|
||||
Only include items which are sold by weight.
|
||||
</b-checkbox>
|
||||
</b-field>
|
||||
|
||||
<div class="buttons">
|
||||
${h.submit('submit', "Generate Report")}
|
||||
</div>
|
||||
<b-field>
|
||||
<b-checkbox name="exclude-not-for-sale" :value="true">
|
||||
Exclude items marked "not for sale".
|
||||
</b-checkbox>
|
||||
</b-field>
|
||||
|
||||
${h.end_form()}
|
||||
<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">
|
||||
% for department in departments:
|
||||
<option value="${department.uuid}">${department.name}</option>
|
||||
% endfor
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-wrapper">
|
||||
${h.checkbox('weighted-only', label="Only include items which are sold by weight.")}
|
||||
</div>
|
||||
|
||||
<div class="field-wrapper">
|
||||
${h.checkbox('exclude-not-for-sale', label="Exclude items marked \"not for sale\".", checked=True)}
|
||||
</div>
|
||||
|
||||
<div class="buttons">
|
||||
${h.submit('submit', "Generate Report")}
|
||||
</div>
|
||||
|
||||
${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