1/* 2 * 3 */ 4ACC.cancelorderaction = { 5 6 _autoload: [ 7 ["bindToCancelCompleteOrderButton", $(".js-cancel-complete-order-link").length != 0], 8 "bindToCancelEntryQuantityInput", 9 "bindToCancelEntryQuantityFocusOut" 10 ], 11 12 bindToCancelCompleteOrderButton : function() { 13 $(document).on('click', '.js-cancel-complete-order-link', function(event) { 14 event.preventDefault(); 15 $.each( $('[id^="item_quantity_"]'), function(i) { 16 $('[name^="cancelEntryQuantityMap[' + i + ']"]').val($('#item_quantity_' + i).val()) 17 }); 18 ACC.cancelorderaction.disableEnableCancelSubmit(); 19 }); 20 }, 21 22 bindToCancelEntryQuantityInput : function() { 23 $('input[id^="cancelEntryQuantityMap"]').keypress(function(e) { 24 if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) { 25 return false; 26 } 27 }); 28 }, 29 30 bindToCancelEntryQuantityFocusOut : function() { 31 $('[name^="cancelEntryQuantityMap"]').focusout(function(field) { 32 var index = this.id.replace("cancelEntryQuantityMap", ""); 33 if (parseInt($('#item_quantity_' + index).val()) < parseInt(this.value)) { 34 this.value = $('#item_quantity_' + index).val(); 35 } 36 $('[name^="cancelEntryQuantityMap[' + index + ']"]').val(this.value) 37 38 ACC.cancelorderaction.disableEnableCancelSubmit(); 39 }); 40 }, 41 42 //Enable submit button in case some value is more than zero. 43 disableEnableCancelSubmit: function() { 44 var submitDisabled = true; 45 $.each( $('[id^="item_quantity_"]'), function(i) { 46 if (parseInt($('[name^="cancelEntryQuantityMap[' + i + ']"]').val()) > 0 ) { 47 submitDisabled = false; 48 } 49 }); 50 $("#cancelOrderButtonConfirmation").prop("disabled", submitDisabled); 51 } 52 53}
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.