Stop using popup for expiration date, for mobile receiving
that was causing event headaches..this way is simpler
This commit is contained in:
parent
dda79a491f
commit
bf3d7b9143
|
@ -151,6 +151,17 @@ $(document).on('click', '#receiving-quantity-keypad-thingy .keypad-button', func
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// show/hide expiration date per receiving mode selection
|
||||||
|
$(document).on('change', 'fieldset.receiving-mode input[name="mode"]', function() {
|
||||||
|
var mode = $(this).val();
|
||||||
|
if (mode == 'expired') {
|
||||||
|
$('#expiration-row').show();
|
||||||
|
} else {
|
||||||
|
$('#expiration-row').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// handle receiving action buttons
|
// handle receiving action buttons
|
||||||
$(document).on('click', '.receiving-actions button', function() {
|
$(document).on('click', '.receiving-actions button', function() {
|
||||||
var action = $(this).data('action');
|
var action = $(this).data('action');
|
||||||
|
@ -171,23 +182,15 @@ $(document).on('click', '.receiving-actions button', function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == 'add' && mode == 'expired') {
|
if (action == 'add' && mode == 'expired') {
|
||||||
$('#popup-receiving-expiration').popup('open');
|
var expiry = form.find('input[name="expiration_date"]');
|
||||||
} else {
|
if (! /^\d{4}-\d{2}-\d{2}$/.test(expiry.val())) {
|
||||||
|
alert("Please enter a valid expiration date.");
|
||||||
|
expiry.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
form.submit();
|
form.submit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: something's wrong.. we can't close the popup or else the form will
|
|
||||||
// be "posted" via GET. but then we still have to click the button twice??
|
|
||||||
|
|
||||||
// handle Submit button from receiving expiration date popup
|
|
||||||
$(document).on('click', '#popup-receiving-expiration button', function() {
|
|
||||||
var popup = $('#popup-receiving-expiration');
|
|
||||||
var date = popup.find('input').val();
|
|
||||||
var form = $('form.receiving-update');
|
|
||||||
form.find('[name="expiration_date"]').val(date);
|
|
||||||
form.submit();
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -79,7 +79,6 @@
|
||||||
${h.hidden('row', value=row.uuid)}
|
${h.hidden('row', value=row.uuid)}
|
||||||
${h.hidden('cases')}
|
${h.hidden('cases')}
|
||||||
${h.hidden('units')}
|
${h.hidden('units')}
|
||||||
${h.hidden('expiration_date')}
|
|
||||||
|
|
||||||
<%
|
<%
|
||||||
uom = 'CS'
|
uom = 'CS'
|
||||||
|
@ -97,13 +96,21 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<fieldset data-role="controlgroup" data-type="horizontal">
|
<fieldset data-role="controlgroup" data-type="horizontal" class="receiving-mode">
|
||||||
${h.radio('mode', value='received', label="received", checked=True)}
|
${h.radio('mode', value='received', label="received", checked=True)}
|
||||||
${h.radio('mode', value='damaged', label="damaged")}
|
${h.radio('mode', value='damaged', label="damaged")}
|
||||||
${h.radio('mode', value='expired', label="expired")}
|
${h.radio('mode', value='expired', label="expired")}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr id="expiration-row" style="display: none;">
|
||||||
|
<td>
|
||||||
|
<div style="padding:10px 20px;">
|
||||||
|
<label for="expiration_date">Expiration Date</label>
|
||||||
|
<input name="expiration_date" type="date" value="" placeholder="YYYY-MM-DD" />
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<fieldset data-role="controlgroup" data-type="horizontal" class="receiving-actions">
|
<fieldset data-role="controlgroup" data-type="horizontal" class="receiving-actions">
|
||||||
|
@ -116,14 +123,5 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div data-role="popup" id="popup-receiving-expiration" data-dismissible="false" data-overlay-theme="b" class="ui-corner-all">
|
|
||||||
<div style="padding:10px 20px;">
|
|
||||||
<h3>Please provide expiration date</h3>
|
|
||||||
<input name="expiration-date" type="date" value="" placeholder="Expiration Date" />
|
|
||||||
<a href="#" class="ui-btn ui-btn-inline ui-corner-all" data-rel="back">Cancel</a>
|
|
||||||
<button type="button" class="ui-btn ui-btn-inline ui-corner-all">Submit</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
${h.end_form()}
|
${h.end_form()}
|
||||||
% endif
|
% endif
|
||||||
|
|
Loading…
Reference in a new issue