1 2$(function () { // start of document ready: 3 4 if ($('.shipping-methods-container')[0]) { 5 6 let currentShippingMethod = Cookies.get('shipping_method'); 7 if(currentShippingMethod == undefined || currentShippingMethod == ''){ 8 let shippingMethodCode = $('.shipping-methods-container').children().first().data('shipping-method-id'); 9 Cookies.set('shipping_method',shippingMethodCode, { expires: 7 } ); 10 }else{ 11 $('.shipping-methods-container').children().each(function () { 12 let currentChildMC = $(this).data('shipping-method-id'); 13 if(currentShippingMethod == currentChildMC){ 14 $('.shipping-method-item-wrapper').removeClass('smiw-active'); 15 $(this).addClass('smiw-active'); 16 } 17 }); 18 } 19 20 $('.shipping-method-item-wrapper').click(function(){ 21 $('.shipping-method-item-wrapper').removeClass('smiw-active'); 22 $(this).addClass('smiw-active'); 23 let shippingMethodCode = $(this).data('shipping-method-id'); 24 Cookies.set('shipping_method',shippingMethodCode, { expires: 7 } ); 25 }); 26 27 } 28 29 $('#change-address-btn').click(function() { 30 31 let dialog_id = "#change-address-dialog"; 32 let box = $(dialog_id+" .majorisbox-wrapper"); 33 let contentBox = $(dialog_id+" .majorisbox-final-content"); 34 let closeBtn = $(dialog_id+" .majorisbox-close"); 35 let loadingOverlay = $(dialog_id).find('.majorisbox-loading'); 36 loadingOverlay.show(); 37 38 closeBtn.click(function () { 39 $(dialog_id).fadeOut('fast'); 40 $('body').css('overflow', 'auto'); 41 }); 42 43 //outside click cause dissmiss: 44 $(dialog_id).click(function () { 45 $(dialog_id).fadeOut('fast'); 46 $('body').css('overflow', 'auto'); 47 }); 48 box.click(function (e) {e.stopPropagation();}); 49 50 $(dialog_id).fadeIn('fast'); 51 52 let iframeHtml = '<iframe id="change-address-dialog-iframe" style="width:100%;height:100%" src="'+webAddress+'/dialog/change-address" title="description"></iframe>'; 53 contentBox.html(iframeHtml); 54 contentBox.show(); 55 loadingOverlay.hide(); 56 $('body').css('overflow', 'hidden'); 57 58 let iframe = $('#change-address-dialog-iframe'); 59 iframe.on('load', function(){ 60 iframe.contents().find('#end-of-save-address-proccess').click(function(){ 61 62 setTimeout(function() { 63 //remove current selected shipping method because when user change address shipping ways may change! 64 Cookies.set('shipping_method','', { expires: 7 } ); 65 location.reload(); 66 }, 800); 67 }); 68 }); 69 70 }); 71 72 $('#cart-main-goto-checkout').click(function(){ 73 74 let currentShippingMethod = Cookies.get('shipping_method'); 75 if( currentShippingMethod == undefined || currentShippingMethod == ''){ 76 notyf.error(apptext['please_select_shipping_method']); 77 return; 78 } 79 let addressExist = $('#cart-main-goto-checkout').data('is-address-exist'); 80 if(addressExist == "0"){ 81 notyf.error(apptext['enter_address_first']); 82 return; 83 } 84 85 window.location.href = webAddress + "/checkout"; 86 87 }); 88 89 $('#select-province').click(function () { 90 91 let dialog_id = "#majoris-select-dialog"; 92 let box = $(dialog_id+" .majorisbox-wrapper"); 93 let contentBox = $(dialog_id+" .majorisbox-final-content"); 94 let loadingOverlay = $(dialog_id).find('.majorisbox-loading'); 95 loadingOverlay.show(); 96 97 //outside click cuase dissmiss: 98 $(dialog_id).click(function () { 99 $(dialog_id).fadeOut('fast'); 100 $('body').css('overflow', 'auto'); 101 }); 102 box.click(function (e) {e.stopPropagation();}); 103 104 $(dialog_id).fadeIn('fast'); 105 106 let iframeHtml = '<iframe id="province-select-iframe" style="width:100%;height:100%" src="'+webAddress+'/dialog/provinces-list" title="description"></iframe>'; 107 contentBox.html(iframeHtml); 108 contentBox.show(); 109 loadingOverlay.hide(); 110 $('body').css('overflow', 'hidden'); 111 112 let iframe = $('#province-select-iframe'); 113 iframe.on('load', function(){ 114 iframe.contents().find('.majorisbox-close').click(function(){ 115 $(dialog_id).fadeOut('fast'); 116 $('body').css('overflow', 'auto'); 117 }); 118 iframe.contents().find('.msd-item').click(function(){ 119 $(dialog_id).fadeOut('fast'); 120 $('body').css('overflow', 'auto'); 121 let pName = $(this).text(); 122 let pId = $(this).attr('data-id'); 123 //notyf.success("pName:" + pName + " | pId" + pId); 124 $('#select-province').find('.majoris-select-data').html(pName); 125 $('#select-province').find('.majoris-select-data').attr('data-province-text',pName); 126 $('#select-province').removeClass('empty-select'); 127 $('#select-city').attr('data-province-id',pId); 128 $('#select-city').find('.majoris-select-data').html('Ø§ÙØªØ®Ø§Ø¨ Ú©ÙÛØ¯'); 129 $('#select-city').find('.majoris-select-data').attr('data-city-text',''); 130 $('#select-city').addClass('empty-select'); 131 }); 132 }); 133 134 }); 135 136 $('#select-city').click(function () { 137 138 let provinceId = $('#select-city').attr('data-province-id'); 139
140 if(provinceId == "0"){ 141 notyf.error(apptext['please_select_province_first']); 142 return; 143 } 144 145 let dialog_id = "#majoris-select-dialog"; 146 let box = $(dialog_id+" .majorisbox-wrapper"); 147 let contentBox = $(dialog_id+" .majorisbox-final-content"); 148 let loadingOverlay = $(dialog_id).find('.majorisbox-loading'); 149 loadingOverlay.show(); 150 151 //outside click cuase dissmiss: 152 $(dialog_id).click(function () { 153 $(dialog_id).fadeOut('fast'); 154 $('body').css('overflow', 'auto'); 155 }); 156 box.click(function (e) {e.stopPropagation();}); 157 158 $(dialog_id).fadeIn('fast'); 159 160 let iframeHtml = '<iframe id="city-select-iframe" style="width:100%;height:100%" src="'+webAddress+'/dialog/city-list/'+provinceId+'" title="description"></iframe>'; 161 contentBox.html(iframeHtml); 162 contentBox.show(); 163 loadingOverlay.hide(); 164 $('body').css('overflow', 'hidden'); 165 166 let iframe = $('#city-select-iframe'); 167 iframe.on('load', function(){ 168 iframe.contents().find('.majorisbox-close').click(function(){ 169 $(dialog_id).fadeOut('fast'); 170 $('body').css('overflow', 'auto'); 171 }); 172 iframe.contents().find('.msd-item').click(function(){ 173 $(dialog_id).fadeOut('fast'); 174 $('body').css('overflow', 'auto'); 175 let cName = $(this).text(); 176 let cId = $(this).attr('data-id'); 177 //notyf.success("City Name:" + cName); 178 $('#select-city').find('.majoris-select-data').html(cName); 179 $('#select-city').find('.majoris-select-data').attr('data-city-text',cName); 180 $('#select-city').removeClass('empty-select'); 181 }); 182 }); 183 184 }); 185 186 187 188 $('#save-address-btn').click(function() { 189 let btn = $(this); 190 191 let name = $('input#name').val(); 192 let phone = $('input#phone').val(); 193 let province = $('#select-province').find('.majoris-select-data').attr('data-province-text'); 194 let city = $('#select-city').find('.majoris-select-data').attr('data-city-text'); 195 let address = $('textarea#address').val(); 196 let postal_code = $('input#postal_code').val(); 197 //other data: 198 let melli_code = $('#other-user-data').data('melli-code'); 199 let credit_card_number = $('#other-user-data').data('credit-card-number'); 200 201 if(name=='' || phone=='' || 202 province =='' || city=='' || 203 address=='' || postal_code==''){ 204 notyf.error(apptext['please_fill_the_required_inputs']); 205 return; 206 } 207 208 btn.prop('disabled', true); 209 btn.find('.majoris-button-text').hide(); 210 btn.find('.majoris-loading').show(); 211 212 param = { 213 name : name, 214 shipping_phone : phone, 215 province : province, 216 city : city, 217 address : address, 218 postal_code : postal_code, 219 melli_code : melli_code, 220 credit_card_number: credit_card_number, 221 }; 222 223 $.ajax({ 224 type: "POST", 225 url: webAddress + "/request/User/user_info_update", 226 data: JSON.stringify(param), 227 timeout: 25000, 228 processData: false, 229 cache: false, 230 contentType: 'application/json', 231 success: function (data) { 232 notyf.success(data['fa']); 233 btn.prop('disabled', false); 234 btn.find('.majoris-button-text').show(); 235 btn.find('.majoris-loading').hide(); 236 //trigger a hidden btn: 237 $('#end-of-save-address-proccess').trigger('click'); 238 }, 239 error: function (xhr, status, error) { 240 btn.prop('disabled', false); 241 btn.find('.majoris-button-text').show(); 242 btn.find('.majoris-loading').hide(); 243 ajaxErrorToaster(xhr, status, error); 244 } 245 246 }); 247 248 }); 249 250 251}); //end of jqury doc ready
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.