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>
|
<%def name="title()">Report : Inventory Worksheet</%def>
|
||||||
|
|
||||||
<p>Please provide the following criteria to generate your report:</p>
|
<%def name="page_content()">
|
||||||
<br />
|
% if use_buefy:
|
||||||
|
|
||||||
${h.form(request.current_route_url())}
|
<p class="block">
|
||||||
${h.csrf_token(request)}
|
Please provide the following criteria to generate your report:
|
||||||
|
</p>
|
||||||
|
|
||||||
<div class="field-wrapper">
|
${h.form(request.current_route_url())}
|
||||||
<label for="department">Department</label>
|
${h.csrf_token(request)}
|
||||||
<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">
|
<b-field label="Department">
|
||||||
${h.checkbox('weighted-only', label="Only include items which are sold by weight.")}
|
<b-select name="department">
|
||||||
</div>
|
<option v-for="dept in departments"
|
||||||
|
:key="dept.uuid"
|
||||||
|
:value="dept.uuid">
|
||||||
|
{{ dept.name }}
|
||||||
|
</option>
|
||||||
|
</b-select>
|
||||||
|
</b-field>
|
||||||
|
|
||||||
<div class="field-wrapper">
|
<b-field>
|
||||||
${h.checkbox('exclude-not-for-sale', label="Exclude items marked \"not for sale\".", checked=True)}
|
<b-checkbox name="weighted-only">
|
||||||
</div>
|
Only include items which are sold by weight.
|
||||||
|
</b-checkbox>
|
||||||
|
</b-field>
|
||||||
|
|
||||||
<div class="buttons">
|
<b-field>
|
||||||
${h.submit('submit', "Generate Report")}
|
<b-checkbox name="exclude-not-for-sale" :value="true">
|
||||||
</div>
|
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.order_by(model.Department.name)
|
||||||
departments = departments.all()
|
departments = departments.all()
|
||||||
return{'departments': departments}
|
return{'departments': departments,
|
||||||
|
'use_buefy': self.get_use_buefy()}
|
||||||
|
|
||||||
def write_report(self, department):
|
def write_report(self, department):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue