Various tweaks to support mobile inventory batches

still not fully there I think, but pretty close..
This commit is contained in:
Lance Edgar 2017-07-11 20:57:31 -05:00
parent 452cb99349
commit 32d256932e
10 changed files with 341 additions and 39 deletions

View file

@ -0,0 +1,6 @@
## -*- coding: utf-8; -*-
<%inherit file="/mobile/master/create.mako" />
<%def name="title()">${h.link_to("Inventory", url('mobile.batch.inventory'))} &raquo; New Batch</%def>
${parent.body()}

View file

@ -0,0 +1,10 @@
## -*- coding: utf-8; -*-
<%inherit file="/mobile/master/index.mako" />
<%def name="title()">Inventory</%def>
% if request.has_perm('batch.inventory.create'):
${h.link_to("New Inventory Batch", url('mobile.batch.inventory.create'), class_='ui-btn ui-corner-all')}
% endif
${parent.body()}

View file

@ -1,6 +1,16 @@
## -*- coding: utf-8; -*-
<%inherit file="/mobile/newbatch/view.mako" />
<%def name="title()">${h.link_to("Inventory", url('mobile.batch.inventory'))} &raquo; ${instance.id_str}</%def>
<%def name="title()">${h.link_to("Inventory", url('mobile.batch.inventory'))} &raquo; ${batch.id_str}</%def>
${parent.body()}
${form.render()|n}
% if not batch.executed and not batch.complete:
<br />
${h.text('upc-search', class_='inventory-upc-search', placeholder="Enter UPC", autocomplete='off', **{'data-type': 'search', 'data-url': url('mobile.batch.inventory.row_from_upc', uuid=batch.uuid)})}
% endif
% if master.has_rows:
<br />
${grid.render_complete()|n}
% endif

View file

@ -1,7 +1,64 @@
## -*- coding: utf-8; -*-
<%inherit file="/mobile/newbatch/view_row.mako" />
<%namespace file="/mobile/keypad.mako" import="keypad" />
## TODO: this is broken for actual page (header) title
<%def name="title()">${h.link_to("Inventory", url('mobile.batch.inventory'))} &raquo; ${h.link_to(instance.batch.id_str, url('mobile.batch.inventory.view', uuid=instance.batch_uuid))} &raquo; row ${row.sequence}</%def>
<%def name="title()">${h.link_to("Inventory", url('mobile.batch.inventory'))} &raquo; ${h.link_to(instance.batch.id_str, url('mobile.batch.inventory.view', uuid=instance.batch_uuid))} &raquo; ${row.upc.pretty()}</%def>
${parent.body()}
<%
unit_uom = 'LB' if row.product and row.product.weighed else 'EA'
if row.cases:
uom = 'CS'
elif row.units:
uom = 'EA'
elif row.case_quantity:
uom = 'CS'
else:
uom = 'EA'
%>
<div class="ui-grid-a">
<div class="ui-block-a">
% if instance.product:
<h3>${row.brand_name or ""}</h3>
<h3>${row.description} ${row.size}</h3>
<h3>${h.pretty_quantity(row.case_quantity)} ${unit_uom} per CS</h3>
% else:
<h3>${row.description}</h3>
% endif
</div>
<div class="ui-block-b">
${h.image(product_image_url, "product image")}
</div>
</div>
<p>
currently:&nbsp;
% if uom == 'CS':
${h.pretty_quantity(row.cases or 0)}
% else:
${h.pretty_quantity(row.units or 0)}
% endif
${uom}
</p>
% if not row.batch.executed and not row.batch.complete:
${h.form(request.current_route_url())}
${h.csrf_token(request)}
${h.hidden('row', value=row.uuid)}
${h.hidden('cases')}
${h.hidden('units')}
${keypad(unit_uom, uom, quantity=row.cases or row.units or 1)}
<fieldset data-role="controlgroup" data-type="horizontal" class="inventory-actions">
<button type="button" class="ui-btn-inline ui-corner-all save">Save</button>
<button type="button" class="ui-btn-inline ui-corner-all delete" disabled="disabled">Delete</button>
${h.link_to("Cancel", url('mobile.batch.inventory.view', uuid=row.batch.uuid), class_='ui-btn ui-btn-inline ui-corner-all')}
</fieldset>
${h.end_form()}
% endif

View file

@ -0,0 +1,39 @@
## -*- coding: utf-8; -*-
<%def name="keypad(unit_uom, selected_uom, quantity=1)">
<div class="quantity-keypad-thingy" data-changed="false">
<table>
<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>
<fieldset data-role="controlgroup" data-type="horizontal">
<button type="button" class="ui-btn-active keypad-quantity">${h.pretty_quantity(quantity or 1)}</button>
<button type="button" disabled="disabled">&nbsp;</button>
${h.radio('keypad-uom', value='CS', checked=selected_uom == 'CS', label="CS")}
${h.radio('keypad-uom', value=unit_uom, checked=selected_uom == unit_uom, label=unit_uom)}
</fieldset>
</div>
</%def>

View file

@ -0,0 +1,8 @@
## -*- coding: utf-8; -*-
<%inherit file="/mobile/base.mako" />
<%def name="title()">New ${model_title}</%def>
<div class="form-wrapper">
${form.render()|n}
</div><!-- form-wrapper -->