1ACC.accountcancelreturn = { 2 3 _autoload: [ 4 ["cancelReturnSetup", $("#submitcancelreturnform .cancel-return-list[data-new-process-enabled='true'] .item__list--item").length > 0] 5 ], 6 7 cancelReturnSetup: function() { 8 const $selectAllCheckbox = $('#select-all-checkbox'); 9 const $productCheckboxes = $('.select-product-checkbox'); 10 const checkboxesTotalNumber = $productCheckboxes.length; 11 const $submitButton = $('#openmodaltosubmitcancelreturnformbutton'); 12 13 $selectAllCheckbox.change(function () { 14 const isChecked = $(this).is(':checked'); 15 $.each($productCheckboxes, (key, productCheckbox) => { 16 $(productCheckbox).prop('checked', !!isChecked).change(); 17 }); 18 }); 19 20 $productCheckboxes.change(function () { 21 const selectedNumber = $productCheckboxes.filter(':checked').length; 22 $selectAllCheckbox.prop('checked', selectedNumber === checkboxesTotalNumber); 23 24 if (selectedNumber > 0) { 25 $submitButton.removeAttr('disabled'); 26 } else { 27 $submitButton.prop('disabled', true); 28 } 29 }); 30 31 $submitButton.on('click', function (event) { 32 event.preventDefault(); 33 const { title, question, yesText, noText } = getPopupTexts($productCheckboxes.filter(':checked').length === checkboxesTotalNumber); 34 const questionRow = `<p>${question}</p>`; 35 const buttonsRow = getButtonsElement(noText, yesText); 36 37 ACC.colorbox.open(title, { 38 html: `${questionRow}<div>${buttonsRow}</div>`, 39 width: "640px" 40 }); 41 }); 42 43 function getPopupTexts(allSelected) { 44 const getValue = (id) => $(`#${id}`)[0]?.value; 45 46 return { 47 title: getValue('popupTitle'), 48 question: getValue(allSelected ? 'allSelectedQuestion' : 'someSelectedQuestion'), 49 yesText: getValue('yesButtonText'), 50 noText: getValue('noButtonText'), 51 } 52 } 53 54 function getButtonsElement(noText, yesText) { 55 const noButton = `<button class="btn btn-primary" onClick="ACC.colorbox.close()">${noText}</button>`; 56 const yesButton = `<button class="btn btn-primary" onClick="ACC.accountcancelreturn.handleClickOnSubmit()">${yesText}</button>`; 57 return `<div class="row button-row return-cancel-confirmation-actions">${noButton}${yesButton}</div>`; 58 } 59 }, 60 61 handleClickOnSubmit: function () { 62 const $submitCancelReturnForm = $('#submitcancelreturnform'); 63 const orderNumber = $submitCancelReturnForm.data('gaordercode'); 64 const returnNumber = $submitCancelReturnForm.data('gareturncode'); 65 66 GA.ReturnRequests.sendReturnRequestCancel(orderNumber, returnNumber); 67 $submitCancelReturnForm.submit(); 68 } 69};
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.