Refactor mobile receiving to use "quick row" feature

plus some other random things thrown in there, for good measure..
This commit is contained in:
Lance Edgar 2018-07-16 20:40:29 -05:00
parent 3cc8adba86
commit a34a42d2b2
9 changed files with 177 additions and 156 deletions

View file

@ -18,21 +18,23 @@ ${form.render()|n}
% if master.mobile_rows_creatable and master.rows_creatable_for(instance):
## TODO: this seems like a poor choice of names? what are we really testing for here?
% if master.mobile_rows_creatable_via_browse:
${h.link_to(add_item_title, url('mobile.{}.create_row'.format(route_prefix), uuid=instance.uuid), class_='ui-btn ui-corner-all')}
<% add_title = "Add Record" if add_item_title is Undefined else add_item_title %>
${h.link_to(add_title, url('mobile.{}.create_row'.format(route_prefix), uuid=instance.uuid), class_='ui-btn ui-corner-all')}
% endif
% endif
% if master.mobile_rows_quickable and master.rows_quickable_for(instance):
<% placeholder = '' if quick_row_entry_placeholder is Undefined else quick_row_entry_placeholder %>
${h.form(url('mobile.{}.quick_row'.format(route_prefix), uuid=instance.uuid))}
${h.csrf_token(request)}
% if quick_row_autocomplete:
<div class="field autocomplete quick-row" data-url="${quick_row_autocomplete_url}">
${h.hidden('quick_row_entry')}
${h.text('quick_row_autocomplete_text', placeholder=quick_row_entry_placeholder, autocomplete='off', data_type='search')}
${h.text('quick_row_autocomplete_text', placeholder=placeholder, autocomplete='off', data_type='search')}
<ul data-role="listview" data-inset="true" data-filter="true" data-input="#quick_row_autocomplete_text"></ul>
<button type="button" style="display: none;">Change</button>
</div>
% else:
${h.text('quick_row_entry', placeholder=quick_row_entry_placeholder, autocomplete='off', **{'data-type': 'search', 'data-url': url('mobile.{}.quick_row'.format(route_prefix), uuid=instance.uuid)})}
${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})}
% endif
${h.end_form()}
% endif

View file

@ -1,24 +0,0 @@
## -*- coding: utf-8; -*-
<%inherit file="/mobile/master/view.mako" />
<%def name="title()">Receiving &raquo; ${instance.id_str}</%def>
<%def name="page_title()">${h.link_to("Receiving", url('mobile.receiving'))} &raquo; ${instance.id_str}</%def>
${form.render()|n}
<br />
% if not instance.executed and not instance.complete:
${h.text('upc-search', class_='receiving-upc-search', placeholder="Enter UPC", autocomplete='off', **{'data-type': 'search', 'data-url': url('mobile.receiving.lookup', uuid=batch.uuid)})}
<br />
% endif
${grid.render_complete()|n}
% if not instance.executed and not instance.complete:
<br /><br />
${h.form(request.route_url('mobile.receiving.mark_complete', uuid=instance.uuid))}
${h.csrf_token(request)}
${h.hidden('mark-complete', value='true')}
<button type="submit">Mark Batch as Complete</button>
% endif

View file

@ -2,9 +2,9 @@
<%inherit file="/mobile/master/view_row.mako" />
<%namespace file="/mobile/keypad.mako" import="keypad" />
<%def name="title()">Receiving &raquo; ${batch.id_str} &raquo; ${row.upc.pretty()}</%def>
<%def name="title()">Receiving &raquo; ${batch.id_str} &raquo; ${master.render_product_key_value(row)}</%def>
<%def name="page_title()">${h.link_to("Receiving", url('mobile.receiving'))} &raquo; ${h.link_to(batch.id_str, url('mobile.receiving.view', uuid=batch.uuid))} &raquo; ${row.upc.pretty()}</%def>
<%def name="page_title()">${h.link_to("Receiving", url('mobile.receiving'))} &raquo; ${h.link_to(batch.id_str, url('mobile.receiving.view', uuid=batch.uuid))} &raquo; ${master.render_product_key_value(row)}</%def>
<div class="ui-grid-a">