Improve support for "receive from scratch" workflow, esp. for mobile

also try harder to make certain aspects easier to enable/disable via handler,
e.g. whether cases should be allowed as quantity input, or expired credits
should be a thing etc.
This commit is contained in:
Lance Edgar 2018-07-17 19:55:15 -05:00
parent a34a42d2b2
commit d8b45db331
13 changed files with 330 additions and 149 deletions

View file

@ -16,3 +16,10 @@
## ${form.render(buttons=capture(self.buttons))|n}
${form.render()|n}
</div><!-- form-wrapper -->
% if master.mobile_rows_deletable and request.has_perm('{}.delete_row'.format(permission_prefix)):
${h.form(url('mobile.{}.delete_row'.format(route_prefix), uuid=parent_instance.uuid, row_uuid=row.uuid))}
${h.csrf_token(request)}
${h.submit('submit', "Delete this Row")}
${h.end_form()}
% endif

View file

@ -34,7 +34,7 @@ ${form.render()|n}
<button type="button" style="display: none;">Change</button>
</div>
% else:
${h.text('quick_row_entry', placeholder=placeholder, autocomplete='off', **{'data-type': 'search', 'data-url': url('mobile.{}.quick_row'.format(route_prefix), uuid=instance.uuid), 'data-wedge': quick_row_keyboard_wedge})}
${h.text('quick_row_entry', placeholder=placeholder, autocomplete='off', **{'data-type': 'search', 'data-url': url('mobile.{}.quick_row'.format(route_prefix), uuid=instance.uuid), 'data-wedge': 'true' if quick_row_keyboard_wedge else 'false'})}
% endif
${h.end_form()}
% endif

View file

@ -10,3 +10,10 @@ ${form.render()|n}
% if master.mobile_rows_editable and instance_editable and request.has_perm('{}.edit_row'.format(permission_prefix)):
${h.link_to("Edit", url('mobile.{}.edit_row'.format(route_prefix), uuid=instance.batch_uuid, row_uuid=instance.uuid), class_='ui-btn')}
% endif
% if master.mobile_rows_deletable and request.has_perm('{}.delete_row'.format(permission_prefix)):
${h.form(url('mobile.{}.delete_row'.format(route_prefix), uuid=parent_instance.uuid, row_uuid=row.uuid))}
${h.csrf_token(request)}
${h.submit('submit', "Delete this Row")}
${h.end_form()}
% endif

View file

@ -31,7 +31,7 @@ ${h.csrf_token(request)}
% endif
% if master.allow_from_scratch:
<button type="button">Receive from Scratch</button>
<button type="button" id="receive-from-scratch">Receive from Scratch</button>
% endif
% if master.allow_truck_dump:

View file

@ -11,37 +11,63 @@
<div class="ui-block-a">
% if instance.product:
<h3>${instance.brand_name or ""}</h3>
<h3>${instance.description} ${instance.size}</h3>
<h3>1 CS = ${h.pretty_quantity(row.case_quantity)} ${unit_uom}</h3>
<h3>${instance.description} ${instance.size or ''}</h3>
% if allow_cases:
<h3>1 CS = ${h.pretty_quantity(row.case_quantity or 1)} ${unit_uom}</h3>
% endif
% else:
<h3>${instance.description}</h3>
% endif
</div>
<div class="ui-block-b">
${h.image(product_image_url, "product image")}
% if product_image_url:
${h.image(product_image_url, "product image")}
% endif
</div>
</div>
<table>
<tbody>
% if not batch.truck_dump:
% if populated_from_purchase:
<tr>
<td>ordered</td>
<td>${h.pretty_quantity(row.cases_ordered or 0)} / ${h.pretty_quantity(row.units_ordered or 0)}</td>
<td>
% if allow_cases:
${h.pretty_quantity(row.cases_ordered or 0)} /
% endif
${h.pretty_quantity(row.units_ordered or 0)}
</td>
</tr>
% endif
<tr>
<td>received</td>
<td>${h.pretty_quantity(row.cases_received or 0)} / ${h.pretty_quantity(row.units_received or 0)}</td>
<td>
% if allow_cases:
${h.pretty_quantity(row.cases_received or 0)} /
% endif
${h.pretty_quantity(row.units_received or 0)}
</td>
</tr>
<tr>
<td>damaged</td>
<td>${h.pretty_quantity(row.cases_damaged or 0)} / ${h.pretty_quantity(row.units_damaged or 0)}</td>
</tr>
<tr>
<td>expired</td>
<td>${h.pretty_quantity(row.cases_expired or 0)} / ${h.pretty_quantity(row.units_expired or 0)}</td>
<td>
% if allow_cases:
${h.pretty_quantity(row.cases_damaged or 0)} /
% endif
${h.pretty_quantity(row.units_damaged or 0)}
</td>
</tr>
% if allow_expired:
<tr>
<td>expired</td>
<td>
% if allow_cases:
${h.pretty_quantity(row.cases_expired or 0)} /
% endif
${h.pretty_quantity(row.units_expired or 0)}
</td>
</tr>
% endif
</tbody>
</table>
@ -59,9 +85,13 @@
${h.hidden('cases')}
${h.hidden('units')}
<button type="button" class="receive-one-case">Receive 1 CS</button>
% if allow_cases:
<button type="button" class="quick-receive" data-uom="CS">Receive 1 CS</button>
% else:
<button type="button" class="quick-receive" data-uom="${unit_uom}">Receive 1 ${unit_uom}</button>
% endif
${keypad(unit_uom, uom)}
${keypad(unit_uom, uom, allow_cases=allow_cases)}
<table>
<tbody>
@ -70,7 +100,9 @@
<fieldset data-role="controlgroup" data-type="horizontal" class="receiving-mode">
${h.radio('mode', value='received', label="received", checked=True)}
${h.radio('mode', value='damaged', label="damaged")}
${h.radio('mode', value='expired', label="expired")}
% if allow_expired:
${h.radio('mode', value='expired', label="expired")}
% endif
</fieldset>
</td>
</tr>
@ -95,11 +127,13 @@
</table>
${h.hidden('quick_receive', value='false')}
${h.end_form()}
${h.hidden('delete_row', value='false')}
% if request.has_perm('{}.delete_row'.format(permission_prefix)):
<button type="button" id="delete-receiving-row">Delete this Row</button>
% if master.mobile_rows_deletable and request.has_perm('{}.delete_row'.format(permission_prefix)):
${h.form(url('mobile.{}.delete_row'.format(route_prefix), uuid=batch.uuid, row_uuid=row.uuid), class_='receiving-update')}
${h.csrf_token(request)}
${h.submit('submit', "Delete this Row")}
${h.end_form()}
% endif
${h.end_form()}
% endif