1function returnOrderViewHandler(config) { 2 var $returnOrderViewHandler = this; 3 4 if (typeof config.design1500 === "undefined") config.design1500 = false; 5 if (typeof config.convertClickedIndex === "undefined") config.convertClickedIndex = true; 6 7 $returnOrderViewHandler.check = function ($this,errorRemoveDisable) { 8 if (typeof errorRemoveDisable === "undefined") errorRemoveDisable = 0; 9 $($this).prop("checked",true); 10 11 if (config.design1500) { 12 $($this).closest("."+config.design1500Config.checkBoxClass).removeClass(config.design1500Config.checkBoxUnCheckedClass); 13 $($this).closest("."+config.design1500Config.checkBoxClass).addClass(config.design1500Config.checkBoxCheckedClass); 14 $($this).closest("."+config.design1500Config.checkBoxClass).attr("rel_checked",1); 15 16 if (config.typeInput) { 17 $($this).closest(config.rowItem).find(config.inputItem).prop("readonly",false); 18 } else { 19 $($this).closest(config.rowItem).find(config.design1500Config.selectWrapper).removeClass("disabled"); 20 $($this).closest(config.rowItem).find(config.design1500Config.selectWrapper).find(config.inputItem).prop("disabled",false); 21 $($this).closest(config.rowItem).find(config.design1500Config.selectWrapper).closest(".select").find(config.inputItem).removeAttr("disabled","disabled"); 22 } 23 24 $($this).closest(config.rowItem).addClass("checked"); 25 } else { 26 $($this).closest(config.rowItem).find((config.typeInput!==1) ? "select"+config.inputItem : config.inputItem).prop((config.typeInput!==1) ? "disabled" : "readonly",false); 27 $($this).closest(config.rowItem).addClass("checked"); 28 } 29 30 if (!errorRemoveDisable) $returnOrderViewHandler.removeError($this); 31 }; 32 33 $returnOrderViewHandler.unCheck = function ($this) { 34 $($this).prop("checked",false); 35 36 if (config.design1500) { 37 $($this).closest("."+config.design1500Config.checkBoxClass).removeClass(config.design1500Config.checkBoxCheckedClass); 38 $($this).closest("."+config.design1500Config.checkBoxClass).addClass(config.design1500Config.checkBoxUnCheckedClass); 39 $($this).closest("."+config.design1500Config.checkBoxClass).attr("rel_checked",0); 40 41 if (config.typeInput) { 42 $($this).closest(config.rowItem).find(config.inputItem).prop("readonly",true); 43 } else { 44 $($this).closest(config.rowItem).find(config.design1500Config.selectWrapper).addClass("disabled"); 45 $($this).closest(config.rowItem).find(config.design1500Config.selectWrapper).find(config.inputItem).prop("disabled",true); 46 $($this).closest(config.rowItem).find(config.design1500Config.selectWrapper).closest(".select").find(config.inputItem).attr("disabled","disabled"); 47 } 48 49 $($this).closest(config.rowItem).removeClass("checked"); 50 } else { 51 $($this).closest(config.rowItem).find((config.typeInput!==1) ? "select"+config.inputItem : config.inputItem).prop((config.typeInput!==1) ? "disabled" : "readonly",true); 52 $($this).closest(config.rowItem).removeClass("checked"); 53 } 54 55 $returnOrderViewHandler.removeError($this); 56 }; 57 58 $returnOrderViewHandler.pairItemWithDiscount = function (checkBoxItems,sku,checked,clickedIndex) { 59 if (config.convertClickedIndex) clickedIndex = clickedIndex - 2; 60 61 $(checkBoxItems).each(function (currentIndex) { 62 var $this=$(this); 63 if (currentIndex!==(clickedIndex)) { 64 if (sku===$($this).attr("data-sku")) { 65 (checked) 66 ? $returnOrderViewHandler.check($this,config.typeInput) 67 : $returnOrderViewHandler.unCheck($this,config.typeInput); 68 } 69 } 70 }); 71 }; 72 73 $returnOrderViewHandler.removeError = function ($this) { 74 if ($($this).closest(config.rowItem).hasClass(config.errorClass)) 75 $($this).closest(config.rowItem).removeClass(config.errorClass); 76 }; 77 78 $returnOrderViewHandler.isAnyChecked = function (onload) { 79 if (onload===1) { 80 var returnItem = (config.design1500) 81 ? $(config.returnItem).find("input[type='checkbox']:checked") 82 : config.returnItem+":checked"; 83 84 $(returnItem).each(function() { 85 var $this=$(this); 86 $returnOrderViewHandler.check($this,1); 87 }); 88 } 89 90 $(config.returnSendButton).prop("disabled",$(config.rowItem+".checked").length<1) 91 }; 92 93 $returnOrderViewHandler.filterMods = function (selectedPaymentType) { 94 var itemCount = $(config.customerParamRowClass).length; 95 96 $(config.customerParamRowClass).each(function() { 97 var $this=$(this); 98 var actualPaymentType = $($this).attr(config.paymentTypeAttr); 99 100 if (actualPaymentType===selectedPaymentType || actualPaymentType==="always") { 101 $($this).show().addClass(config.visibleClass).removeClass(config.notVisibleClass); 102 } else { 103 $($this).hide().addClass(config.notVisibleClass).removeClass(config.visibleClass); 104 } 105 }); 106 107 var countOfNotVisibleItems = $(config.customerParamRowClass+"."+config.notVisibleClass).length; 108 (countOfNotVisibleItems===itemCount) ? $(config.customerParamWrapper).hide() : $(config.customerParamWrapper).show(); 109 }; 110 111 $returnOrderViewHandler.returnItemClick = function () { 112 $(config.returnItem).on("click",function () { 113 var $this = $(this); 114 var sku = (config.design1500) 115 ? $($this).find(config.design1500Config.returnItem).attr("data-sku") 116 : $($this).attr("data-sku"); 117 118 $returnOrderViewHandler.removeError($this); 119 120 if (config.design1500) { 121 (! $($this).hasClass(config.design1500Config.checkBoxCheckedClass.replace(".",""))) 122 ? $($this).closest(config.rowItem).addClass("checked") 123 : $($this).closest(config.rowItem).removeClass("checked"); 124 } else { 125 ($($this).prop("checked")) 126 ? $($this).closest(config.rowItem).addClass("checked") 127 : $($this).closest(config.rowItem).removeClass("checked"); 128 } 129 130 let clickedIndex = $($this).closest(config.rowItem).index(); 131 let dataIndex = $($this).data("index"); 132 133 if (typeof dataIndex !== "undefined") { 134 clickedIndex = dataIndex - 1; 135 } 136 137 let checkboxItems = (config.design1500) 138 ? config.design1500Config.returnItem 139 : config.returnItem; 140 141 let isChecked = (config.design1500) 142 ? !$($this).hasClass(config.design1500Config.checkBoxCheckedClass.replace(".", "")) 143 : $($this).prop("checked") 144 145 $returnOrderViewHandler.pairItemWithDiscount(checkboxItems, sku, isChecked, clickedIndex); 146 }); 147 148 $(config.returnItem).click(function () { 149 var $this=$(this); 150 151 $($this).closest(config.rowItem) 152 .find((config.typeInput!==1) ? "select"+config.inputItem : config.inputItem) 153 .prop( 154 (config.typeInput!==1) 155 ? "disabled" 156 : "readonly", 157 (config.design1500) 158 ? $($this).hasClass(config.design1500Config.checkBoxCheckedClass.replace(".","")) 159 : !$($this).prop("checked") 160 ); 161 162 if (config.design1500 && config.typeInput!==1) { 163 ($($this).hasClass(config.design1500Config.checkBoxCheckedClass.replace(".",""))) 164 ? $($this).closest(config.rowItem).find(config.design1500Config.selectWrapper).addClass("disabled") 165 : $($this).closest(config.rowItem).find(config.design1500Config.selectWrapper).removeClass("disabled"); 166 } 167 168 $returnOrderViewHandler.isAnyChecked(0); 169 }); 170 }; 171 172 $returnOrderViewHandler.paymentRadioClick = function () { 173 $(config.paymentRadioClass).click(function(){ 174 var $this=$(this); 175 $returnOrderViewHandler.filterMods( 176 (config.design1500) ? $($this).find("input[type='radio']").attr("data-type") : $($this).attr("data-type"), 177 config.customerParamRowClass, 178 config.paymentTypeAttr, 179 config.visibleClass, 180 config.notVisibleClass, 181 config.customerParamWrapper 182 ); 183 }); 184 }; 185 186 $returnOrderViewHandler.customerParameterRadioClick = function() { 187 $(function () { $(config.customerParameterRadio+":checked").click(); }); 188 189 $(config.customerParameterRadio).on("click", function() { 190 var id = (config.design1500) 191 ? $(this).find(config.design1500Config.customerParameterRadioInput).attr("id") 192 : $(this).attr("id"); 193 194 var split = id.split("_"); 195 var value = (config.design1500) 196 ? $(this).find(config.design1500Config.customerParameterRadioInput).val() 197 : $(this).val(); 198 199 $("#cust_param_hidden_"+split[3]).val(value); 200 }); 201 }; 202}
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.