Add initial support for expiration date for mobile receiving
This commit is contained in:
parent
4aa91414a5
commit
a03083efdd
3 changed files with 34 additions and 4 deletions
|
@ -149,19 +149,39 @@ $(document).on('click', '#receiving-quantity-keypad-thingy .keypad-button', func
|
|||
$(document).on('click', '.receiving-actions button', function() {
|
||||
var action = $(this).data('action');
|
||||
var form = $('form.receiving-update');
|
||||
var uom = form.find('[name="receiving-uom"]').val();
|
||||
var uom = form.find('[name="receiving-uom"]:selected').val();
|
||||
var mode = form.find('[name="mode"]:checked').val();
|
||||
var qty = form.find('.receiving-quantity').text();
|
||||
if (action == 'add' || action == 'subtract') {
|
||||
if (qty != '0') {
|
||||
if (action == 'subtract') {
|
||||
qty = '-' + qty;
|
||||
}
|
||||
|
||||
if (uom == 'CS') {
|
||||
form.find('[name="cases"]').val(qty);
|
||||
} else { // units
|
||||
form.find('[name="units"]').val(qty);
|
||||
}
|
||||
form.submit();
|
||||
|
||||
if (action == 'add' && mode == 'expired') {
|
||||
$('#popup-receiving-expiration').popup('open');
|
||||
} else {
|
||||
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();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue