Refactor keypad widget for mobile receiving
logic for this is now held in common
This commit is contained in:
parent
32d256932e
commit
8a5dbc33a7
|
@ -192,10 +192,10 @@ $(document).on('change', 'fieldset.receiving-mode input[name="mode"]', function(
|
|||
// handle receiving action buttons
|
||||
$(document).on('click', '.receiving-actions button', function() {
|
||||
var action = $(this).data('action');
|
||||
var form = $('form.receiving-update');
|
||||
var uom = form.find('[name="receiving-uom"]:checked').val();
|
||||
var form = $(this).parents('form:first');
|
||||
var uom = form.find('[name="keypad-uom"]:checked').val();
|
||||
var mode = form.find('[name="mode"]:checked').val();
|
||||
var qty = form.find('.receiving-quantity').text();
|
||||
var qty = form.find('.keypad-quantity').text();
|
||||
if (action == 'add' || action == 'subtract') {
|
||||
if (qty != '0') {
|
||||
if (action == 'subtract') {
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
<%inherit file="/mobile/master/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("Receiving", url('mobile.receiving'))} » ${h.link_to(instance.batch.id_str, url('mobile.receiving.view', uuid=instance.batch_uuid))} » ${row.upc.pretty()}</%def>
|
||||
|
||||
<% unit_uom = 'LB' if row.product and row.product.weighed else 'EA' %>
|
||||
<%
|
||||
unit_uom = 'LB' if row.product and row.product.weighed else 'EA'
|
||||
|
||||
uom = 'CS'
|
||||
if row.units_ordered and not row.cases_ordered:
|
||||
uom = 'EA'
|
||||
%>
|
||||
|
||||
|
||||
<div class="ui-grid-a">
|
||||
<div class="ui-block-a">
|
||||
|
@ -49,30 +57,6 @@
|
|||
% endif
|
||||
|
||||
% if not instance.batch.executed and not instance.batch.complete:
|
||||
<table id="receiving-quantity-keypad-thingy" data-changed="false">
|
||||
<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)}
|
||||
|
@ -80,17 +64,7 @@
|
|||
${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"> </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>
|
||||
${keypad(unit_uom, uom)}
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
|
|
Loading…
Reference in a new issue