Add initial support for mobile receiving views

This commit is contained in:
Lance Edgar 2017-05-24 00:04:56 -05:00
parent d68bf6b012
commit 5eca2347d5
11 changed files with 712 additions and 14 deletions

View file

@ -0,0 +1,4 @@
## -*- coding: utf-8; -*-
<%inherit file="/mobile/master/view.mako" />
${parent.body()}

View file

@ -0,0 +1,48 @@
## -*- coding: utf-8; -*-
<%inherit file="/mobile/base.mako" />
<%def name="title()">${h.link_to("Receiving", url('mobile.receiving'))} &raquo; New Batch</%def>
${h.form(request.current_route_url(), class_='ui-filterable', name='new-purchasing-batch')}
${h.csrf_token(request)}
% if vendor is Undefined:
<div class="field-wrapper vendor">
<div class="field autocomplete" data-url="${url('vendors.autocomplete')}">
${h.hidden('vendor')}
${h.text('new-purchasing-batch-vendor-text', placeholder="Vendor name", autocomplete='off', **{'data-type': 'search'})}
<ul data-role="listview" data-inset="true" data-filter="true" data-input="#new-purchasing-batch-vendor-text"></ul>
<button type="button" style="display: none;">Change Vendor</button>
</div>
</div>
<br />
${h.submit('submit', "Find purchase orders")}
## <button type="button">New receiving from scratch</button>
% else: ## vendor is known
<div class="field-wrapper vendor">
<div class="field">
${h.hidden('vendor', value=vendor.uuid)}
${vendor}
</div>
</div>
% if purchases:
${h.hidden('purchase')}
<ul data-role="listview" data-inset="true">
% for uuid, purchase in purchases:
<li data-uuid="${uuid}">${h.link_to(purchase, '#')}</li>
% endfor
</ul>
% else:
<p>(no eligible purchases found)</p>
% endif
## ${h.link_to("Receive from scratch for {}".format(vendor), '#', class_='ui-btn ui-corner-all')}
% endif
${h.end_form()}

View file

@ -0,0 +1,18 @@
## -*- coding: utf-8; -*-
<%inherit file="/mobile/master/index.mako" />
<%def name="title()">Receiving</%def>
% if request.has_perm('receiving.create'):
${h.link_to("New Receiving Batch", url('mobile.receiving.create'), class_='ui-btn ui-corner-all')}
% endif
<fieldset data-role="controlgroup" data-type="horizontal">
${h.radio('receiving-filter', value='pending', label="Pending", checked=True)}
${h.radio('receiving-filter', value='complete', label="Complete", disabled='disabled')}
${h.radio('receiving-filter', value='executed', label="Executed", disabled='disabled')}
${h.radio('receiving-filter', value='all', label="All", disabled='disabled')}
</fieldset>
<br /><br />
${parent.body()}

View file

@ -0,0 +1,25 @@
## -*- coding: utf-8; -*-
<%inherit file="/mobile/master/view.mako" />
<%def name="title()">${h.link_to("Receiving", url('mobile.receiving'))} &raquo; ${instance.id_str}</%def>
${form.render()|n}
<br />
${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 />
<fieldset data-role="controlgroup" data-type="horizontal">
## ${h.radio('receiving-row-filter', value='missing', label="Missing", disabled='disabled')}
${h.radio('receiving-row-filter', value='incomplete', label="Incomplete", disabled='disabled')}
${h.radio('receiving-row-filter', value='damaged', label="Damaged", disabled='disabled')}
${h.radio('receiving-row-filter', value='expired', label="Expired", disabled='disabled')}
${h.radio('receiving-row-filter', value='all', label="All", checked=True)}
</fieldset>
<br /><br />
<ul data-role="listview">
% for obj in grid.iter_rows():
<li>${grid.listitem.render_readonly()}</li>
% endfor
</ul>

View file

@ -0,0 +1,107 @@
## -*- coding: utf-8; -*-
<%inherit file="/mobile/master/view_row.mako" />
## TODO: this is broken for actual page (header) title
<%def name="title()">${h.link_to("Receiving", url('mobile.receiving'))} &raquo; ${h.link_to(instance.batch.id_str, url('mobile.receiving.view', uuid=instance.batch_uuid))} &raquo; ${row.upc.pretty()}</%def>
<% unit_uom = 'LB' if row.product.weighed else 'EA' %>
<div class="ui-grid-a">
<div class="ui-block-a">
<h3>${instance.brand_name}</h3>
<h3>${instance.description} ${instance.size}</h3>
<h3>${h.pretty_quantity(row.case_quantity)} ${unit_uom} per CS</h3>
</div>
<div class="ui-block-b">
${h.image(product_image_url, "product image")}
</div>
</div>
<table>
<tbody>
<tr>
<td>ordered</td>
<td>${h.pretty_quantity(row.cases_ordered or 0)} / ${h.pretty_quantity(row.units_ordered or 0)}</td>
</tr>
<tr>
<td>received</td>
<td>${h.pretty_quantity(row.cases_received or 0)} / ${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>
</tr>
</tbody>
</table>
<table id="receiving-quantity-keypad-thingy">
<tbody>
<tr>
<td>${h.link_to("7", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<td>${h.link_to("8", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<td>${h.link_to("9", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
</tr>
<tr>
<td>${h.link_to("4", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<td>${h.link_to("5", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<td>${h.link_to("6", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
</tr>
<tr>
<td>${h.link_to("1", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<td>${h.link_to("2", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<td>${h.link_to("3", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
</tr>
<tr>
<td>${h.link_to("0", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<td>${h.link_to(".", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
<td>${h.link_to("Del", '#', class_='keypad-button ui-btn ui-btn-inline ui-corner-all')}</td>
</tr>
</tbody>
</table>
${h.form(request.current_route_url(), class_='receiving-update')}
${h.csrf_token(request)}
${h.hidden('row', value=row.uuid)}
${h.hidden('cases')}
${h.hidden('units')}
<%
uom = 'CS'
if row.units_ordered and not row.cases_ordered:
uom = 'EA'
%>
<fieldset data-role="controlgroup" data-type="horizontal">
<button type="button" class="ui-btn-active receiving-quantity">1</button>
<button type="button" disabled="disabled">&nbsp;</button>
${h.radio('receiving-uom', value='CS', checked=uom == 'CS', label="CS")}
${h.radio('receiving-uom', value=unit_uom, checked=uom == unit_uom, label=unit_uom)}
</fieldset>
<table>
<tbody>
<tr>
<td>
<fieldset data-role="controlgroup" data-type="horizontal">
${h.radio('mode', value='received', label="received", checked=True)}
${h.radio('mode', value='damaged', label="damaged")}
${h.radio('mode', value='expired', label="expired")}
</fieldset>
</td>
</tr>
<tr>
<td>
<fieldset data-role="controlgroup" data-type="horizontal" class="receiving-actions">
<button type="button" data-action="add" class="ui-btn-inline ui-corner-all">Add</button>
<button type="button" data-action="subtract" class="ui-btn-inline ui-corner-all">Subtract</button>
<button type="button" data-action="clear" class="ui-btn-inline ui-corner-all ui-state-disabled">Clear</button>
</fieldset>
</td>
</tr>
</tbody>
</table>
${h.end_form()}