Add (restore?) basic support for mobile receiving from PO

This commit is contained in:
Lance Edgar 2018-07-18 16:25:54 -05:00
parent 87ba8026e5
commit 34bdd2ac84
5 changed files with 122 additions and 67 deletions

View file

@ -57,7 +57,7 @@ function setfocus() {
var queries = [
'#username',
'#new-purchasing-batch-vendor-text',
// '.receiving-upc-search',
'#new-receiving-batch-vendor-text',
];
$.each(queries, function(i, query) {
el = $(query);
@ -92,16 +92,6 @@ $(document).on('click', 'form[name="new-purchasing-batch"] input[type="submit"]'
}
});
// submit new purchasing batch form on Purchase click
$(document).on('click', 'form[name="new-purchasing-batch"] [data-role="listview"] a', function() {
var $form = $(this).parents('form');
var $field = $form.find('[name="purchase"]');
var uuid = $(this).parents('li').data('uuid');
$field.val(uuid);
$form.submit();
return false;
});
// disable datasync restart button when clicked
$(document).on('click', '#datasync-restart', function() {

View file

@ -8,29 +8,31 @@
************************************************************/
// TODO: this is really just for receiving; should change form name?
$(document).on('autocompleteitemselected', 'form[name="new-purchasing-batch"] .vendor', function(event, uuid) {
// toggle visibility of "Receive" type buttons based on whether vendor is set
$(document).on('autocompleteitemselected', 'form[name="new-receiving-batch"] .vendor', function(event, uuid) {
$('#new-receiving-types').show();
});
// TODO: this is really just for receiving; should change form name?
$(document).on('autocompleteitemcleared', 'form[name="new-purchasing-batch"] .vendor', function(event) {
$(document).on('autocompleteitemcleared', 'form[name="new-receiving-batch"] .vendor', function(event) {
$('#new-receiving-types').hide();
});
$(document).on('click', 'form[name="new-purchasing-batch"] #receive-truck-dump', function() {
// submit new receiving batch form when user clicks "Receive" type button
$(document).on('click', 'form[name="new-receiving-batch"] .start-receiving', function() {
var form = $(this).parents('form');
form.find('input[name="workflow"]').val('truck_dump');
form.find('input[name="workflow"]').val($(this).data('workflow'));
form.submit();
});
$(document).on('click', 'form[name="new-purchasing-batch"] #receive-from-scratch', function() {
// submit new receiving batch form when user clicks Purchase Order option
$(document).on('click', 'form[name="new-receiving-batch"] [data-role="listview"] a', function() {
var form = $(this).parents('form');
form.find('input[name="workflow"]').val('from_scratch');
var key = $(this).parents('li').data('key');
form.find('[name="workflow"]').val('from_po');
form.find('.purchase-order-field').val(key);
form.submit();
return false;
});