1ACC.cancelorderaction = { 2 3 _autoload: [ 4 ["bindToCancelCompleteOrderButton", $(".js-cancel-complete-order-link").length != 0], 5 "bindToCancelEntryQuantityInput", 6 "bindToCancelEntryQuantityFocusOut" 7 ], 8 9 bindToCancelCompleteOrderButton : function() { 10 $(document).on('click', '.js-cancel-complete-order-link', function(event) { 11 event.preventDefault(); 12 $.each( $('[id^="item_quantity_"]'), function() { 13 var entryNumber = $(this).attr('id').split("item_quantity_")[1]; 14 $('[name^="cancelEntryQuantityMap[' + entryNumber + ']"]').val($('#item_quantity_' + entryNumber).val()); 15 }); 16 ACC.cancelorderaction.disableEnableCancelSubmit(); 17 }); 18 }, 19 20 bindToCancelEntryQuantityInput : function() { 21 $('input[id^="cancelEntryQuantityMap"]').keypress(function(e) { 22 if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) { 23 return false; 24 } 25 }); 26 }, 27 28 bindToCancelEntryQuantityFocusOut : function() { 29 $('[name^="cancelEntryQuantityMap"]').focusout(function(field) { 30 var quantity = this.value.match("[0-9]+"); 31 if (quantity == null) { 32 this.value = 0; 33 } else { 34 this.value = parseInt(quantity); 35 } 36 var index = this.id.replace("cancelEntryQuantityMap", ""); 37 if (parseInt($('#item_quantity_' + index).val()) < parseInt(this.value)) { 38 this.value = $('#item_quantity_' + index).val(); 39 } 40 $('[name^="cancelEntryQuantityMap[' + index + ']"]').val(this.value) 41 42 ACC.cancelorderaction.disableEnableCancelSubmit(); 43 }); 44 }, 45 46 //Enable submit button in case some value is more than zero. 47 disableEnableCancelSubmit: function() { 48 var submitDisabled = true; 49 $.each( $('[id^="item_quantity_"]'), function() { 50 var entryNumber = $(this).attr('id').split("item_quantity_")[1]; 51 52 if (parseInt($('[name^="cancelEntryQuantityMap[' + entryNumber + ']"]').val()) > 0 ) { 53 submitDisabled = false; 54 } 55 }); 56 $("#cancelOrderButtonConfirmation").prop("disabled", submitDisabled); 57 } 58 59}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.