1(function ($) { 2 // $(document).on('submit','.quform-form-4',function(e){ 3 4 // e.preventDefault(); 5 // }); 6 7 $('.quform-element-1_11').click(function () { 8 window.location.href = window.location.href.split('?')[0]; 9 }); 10 11 $('.quform-form-4').ready(function () { 12 $('#result-text').text(''); 13 $('#sar-result-table tr').remove(); 14 $('#sar-note').hide(); 15 }); 16 17 $('.quform-form-4').submit(function (e) { 18 e.preventDefault(); 19 $('#loading-image img').css("display", "block"); 20 var valid = false; 21 var searchType = $('.quform-field-4_3').val() 22 var searchText = ''; 23 if (searchType == 'postCode') { 24 if ($.isNumeric($('.quform-field-4_4').val())) { 25 searchText = $('.quform-field-4_4').val() 26 valid = true; 27 } 28 } else if (searchType == 'locationName') { 29 searchText = $('.quform-field-4_5').val() 30 valid = true; 31 } 32 if (valid) { 33 $.ajax({
34 type: "post", 35 dataType: "json", 36 url: INTEGRATION.ajax_url, 37 data: { 38 action: 'call_sar', 39 type: searchType, 40 param: searchText 41 }, 42 success: function (data) { 43 var response = jQuery.parseJSON(data); 44 $('#loading-image img').css("display", "none"); 45 $('#sar-result-table tr').remove(); 46 $('#result-text').text(response.r.length + ' results found for "' + searchText + '"'); 47 $('#sar-result-table thead').append(`<tr> 48 <th align="left">Location</th> 49 <th style="text-align: center;" align="left">Postcode</th> 50 <th style="text-align: center;" align="left">State</th> 51 <th style="text-align: center;" align="left">Service Station</th> 52 <th style="text-align: center;" align="left">Monday</th> 53 <th style="text-align: center;" align="left">Tuesday</th> 54 <th style="text-align: center;" align="left">Wednesday</th> 55 <th style="text-align: center;" align="left">Thursday</th> 56 <th style="text-align: center;" align="left">Friday</th> 57 <th style="text-align: center;" align="left">Saturday</th> 58 <th style="text-align: center;" align="left">Sunday</th> 59 </tr>`); 60 if (response.s == "success") { 61 $('#sar-note').show(); 62 for (let i = 0; i < response.r.length; i++) { 63 $('#sar-result-table tbody').append(`<tr> 64 <td align="left">`+ response.r[i].location + `</td> 65 <td style="text-align: center;" align="left">`+ response.r[i].postcode + `</td> 66 <td style="text-align: center;" align="left">`+ response.r[i].state + `</td> 67 <td style="text-align: center;" align="left">`+ response.r[i].serviceStation + `</td> 68 <td style="text-align: center;" align="left">`+ (response.r[i].monday ? "X" : "") + `</td> 69 <td style="text-align: center;" align="left">`+ (response.r[i].tuesday ? "X" : "") + `</td> 70 <td style="text-align: center;" align="left">`+ (response.r[i].wednesday ? "X" : "") + `</td> 71 <td style="text-align: center;" align="left">`+ (response.r[i].thursday ? "X" : "") + `</td> 72 <td style="text-align: center;" align="left">`+ (response.r[i].friday ? "X" : "") + `</td> 73 <td style="text-align: center;" align="left">`+ (response.r[i].saturday ? "X" : "") + `</td> 74 <td style="text-align: center;" align="left">`+ (response.r[i].sunday ? "X" : "") + `</td> 75 </tr>>`); 76 } 77 } else { 78 alert(response.e); 79 $('#sar-result-table tbody').append(`<tr> 80 <td colspan="11" style="text-align: center;" align="left">No Record Found</td> 81 </tr>>`); 82 } 83 } 84 }); 85 } 86 }); 87 88 $('.quform-form-12').ready(function () { 89 $('#sar-note').hide(); 90 $('#result-text').text(''); 91 $('#sar-result-table tr').remove(); 92 }); 93 94 $('.quform-form-12').submit(function (e) { 95 e.preventDefault(); 96 $('#loading-image img').css("display", "block"); 97 var valid = false; 98 var searchType = $('.quform-field-12_3').val() 99 var searchText = ''; 100 if (searchType == 'postCode') { 101 if ($.isNumeric($('.quform-field-12_4').val())) { 102 searchText = $('.quform-field-12_4').val() 103 valid = true; 104 } 105 } else if (searchType == 'locationName') { 106 searchText = $('.quform-field-12_5').val() 107 valid = true; 108 } 109 if (valid) { 110 $.ajax({
111 type: "post", 112 dataType: "json", 113 url: INTEGRATION.ajax_url, 114 data: { 115 action: 'call_sar_cool', 116 type: searchType, 117 param: searchText 118 }, 119 success: function (data) { 120 $('#loading-image img').css("display", "none"); 121 var response = jQuery.parseJSON(data); 122 $('#sar-result-table tr').remove(); 123 $('#result-text').text(response.r.length + ' results found for "' + searchText + '"'); 124 $('#sar-result-table thead').append(`<tr> 125 <th align="left">Location</th> 126 <th style="text-align: center;" align="left">Postcode</th> 127 <th style="text-align: center;" align="left">State</th> 128 <th style="text-align: center;" align="left">Service Station</th> 129 <th style="text-align: center;" align="left">Monday</th> 130 <th style="text-align: center;" align="left">Tuesday</th> 131 <th style="text-align: center;" align="left">Wednesday</th> 132 <th style="text-align: center;" align="left">Thursday</th> 133 <th style="text-align: center;" align="left">Friday</th> 134 <th style="text-align: center;" align="left">Saturday</th> 135 <th style="text-align: center;" align="left">Sunday</th> 136 </tr>`); 137 if (response.s == "success") { 138 $('#sar-note').show(); 139 for (let i = 0; i < response.r.length; i++) { 140 $('#sar-result-table tbody').append(`<tr> 141 <td align="left">`+ response.r[i].location + `</td> 142 <td style="text-align: center;" align="left">`+ response.r[i].postcode + `</td> 143 <td style="text-align: center;" align="left">`+ response.r[i].state + `</td> 144 <td style="text-align: center;" align="left">`+ response.r[i].serviceStation + `</td> 145 <td style="text-align: center;" align="left">`+ (response.r[i].monday ? "X" : "") + `</td> 146 <td style="text-align: center;" align="left">`+ (response.r[i].tuesday ? "X" : "") + `</td> 147 <td style="text-align: center;" align="left">`+ (response.r[i].wednesday ? "X" : "") + `</td> 148 <td style="text-align: center;" align="left">`+ (response.r[i].thursday ? "X" : "") + `</td> 149 <td style="text-align: center;" align="left">`+ (response.r[i].friday ? "X" : "") + `</td> 150 <td style="text-align: center;" align="left">`+ (response.r[i].saturday ? "X" : "") + `</td> 151 <td style="text-align: center;" align="left">`+ (response.r[i].sunday ? "X" : "") + `</td> 152 </tr>>`); 153 } 154 } else { 155 $('#sar-result-table tbody').append(`<tr> 156 <td colspan="11" style="text-align: center;" align="left">No Record Found</td> 157 </tr>>`); 158 } 159 } 160 }); 161 } 162 }); 163 164 var getFromLocation = function () { 165 var postCode = $('.quform-field-6_25').val(); 166 $('.quform-field-6_31').empty(); 167 if (postCode) { 168 if (postCode.length >= 5) { 169 if ($.isNumeric(postCode) && postCode.length == 5) { 170 $.ajax({
171 type: "post", 172 dataType: "json", 173 url: INTEGRATION.ajax_url, 174 data: { 175 action: 'call_location', 176 postcode: postCode, 177 }, 178 success: function (data) { 179 var response = jQuery.parseJSON(data); 180 if (response.s == "success") { 181 for (let i = 0; i < response.r.length; i++) { 182 $('.quform-field-6_31').append(new Option(response.r[i].location, response.r[i].locationId)); 183 } 184 // for (let i = 0; i < response.r.DistrictList.length; i++) { 185 // if (response.r.DistrictList[i].LocationList.length){ 186 // for (let j = 0; j < response.r.DistrictList[i].LocationList.length; j++) { 187 // $('.quform-field-6_31').append(new Option(response.r.DistrictList[i].LocationList[j].Location, response.r.DistrictList[i].LocationList[j].LocationId)); 188 // } 189 // } 190 // } 191 } else { 192 alert(response.e); 193 } 194 } 195 }); 196 } else {
197 alert("Invalid Postcode!"); 198 } 199 } 200 } 201 } 202 var getToLocation = function () { 203 var postCode = $('.quform-field-6_26').val(); 204 $('.quform-field-6_32').empty(); 205 if (postCode) { 206 if (postCode.length >= 5) { 207 if ($.isNumeric(postCode) && postCode.length == 5) { 208 $.ajax({ 209 type: "post", 210 dataType: "json", 211 url: INTEGRATION.ajax_url, 212 data: { 213 action: 'call_location', 214 postcode: postCode, 215 }, 216 success: function (data) { 217 var response = jQuery.parseJSON(data); 218 if (response.s == "success") { 219 for (let i = 0; i < response.r.length; i++) { 220 $('.quform-field-6_32').append(new Option(response.r[i].location, response.r[i].locationId)); 221 } 222 // for (let i = 0; i < response.r.DistrictList.length; i++) { 223 // if (response.r.DistrictList[i].LocationList.length){ 224 // for (let j = 0; j < response.r.DistrictList[i].LocationList.length; j++) { 225 // $('.quform-field-6_32').append(new Option(response.r.DistrictList[i].LocationList[j].Location, response.r.DistrictList[i].LocationList[j].LocationId)); 226 // } 227 // } 228 // } 229 } else { 230 alert(response.e); 231 } 232 } 233 }); 234 } else {
235 alert("Invalid Postcode!"); 236 } 237 } 238 } 239 } 240 $('.quform-form-6').ready(function () { 241 getFromLocation(); 242 getToLocation(); 243 $('#rate-estimate-table tr').remove(); 244 $('#quotation h2').text(''); 245 $('#tax-fee').text(''); 246 }); 247 248 var getFromLocation2 = function () { 249 var postCode = $('.quform-field-11_12').val(); 250 $('.quform-field-11_22').empty(); 251 if (postCode) { 252 if (postCode.length >= 5) { 253 if ($.isNumeric(postCode) && postCode.length == 5) { 254 $.ajax({ 255 type: "post", 256 dataType: "json", 257 url: INTEGRATION.ajax_url, 258 data: { 259 action: 'call_location', 260 postcode: postCode, 261 }, 262 success: function (data) { 263 var response = jQuery.parseJSON(data); 264 if (response.s == "success") { 265 for (let i = 0; i < response.r.length; i++) { 266 $('.quform-field-11_22').append(new Option(response.r[i].location, response.r[i].locationId)); 267 } 268 } else { 269 alert(response.e); 270 } 271 } 272 }); 273 } else {
274 alert("Invalid Postcode!"); 275 } 276 } 277 } 278 } 279 280 var getToLocation2 = function () { 281 var postCode = $('.quform-field-11_26').val(); 282 var countryISO3 = $('.quform-field-11_8 :selected').val() 283 $('.quform-field-11_23').empty(); 284 285 if (countryISO3 == 'MYS') { 286 $('.quform-element-11_14').hide() 287 $('.quform-element-11_26').show() 288 $('.quform-element-11_23').show() 289 290 } else { 291 $('.quform-element-11_14').show() 292 $('.quform-element-11_26').hide() 293 $('.quform-element-11_23').hide() 294 } 295 296 if (postCode) { 297 if (postCode.length >= 5) { 298 if ($.isNumeric(postCode) && postCode.length == 5) { 299 $.ajax({ 300 type: "post", 301 dataType: "json", 302 url: INTEGRATION.ajax_url, 303 data: { 304 action: 'call_location', 305 postcode: postCode, 306 }, 307 success: function (data) { 308 var response = jQuery.parseJSON(data); 309 if (response.s == "success") { 310 for (let i = 0; i < response.r.length; i++) { 311 $('.quform-field-11_23').append(new Option(response.r[i].location, response.r[i].locationId)); 312 } 313 } else { 314 alert(response.e); 315 } 316 } 317 }); 318 } else {
319 alert("Invalid Postcode!"); 320 } 321 } 322 } 323 } 324 325 $('.quform-field-11_12').on('keyup', getFromLocation2); 326 $('.quform-field-11_26').on('keyup', getToLocation2); 327 $('.quform-field-6_25').on('keyup', getFromLocation); 328 $('.quform-field-6_26').on('keyup', getToLocation); 329 330 $('.quform-form-11').submit(function (e) { 331 e.preventDefault(); 332 $('#quotation h2').text(''); 333 $('#rate-estimate-detail').empty(); 334 $('#tax-fee').text(''); 335 var countryISO3 = $('.quform-field-11_8 :selected').val() 336 var fromPostcode = $('.quform-field-11_12').val(); 337 var toPostcode = $('.quform-field-11_26').val(); 338 var toCountryPostcode = $('.quform-field-11_14').val(); 339 var fromLocationId = $('.quform-field-11_22').val(); 340 var toLocationId = $('.quform-field-11_23').val(); 341 var shipmentTypeCode = $('.quform-field-11_24').val(); 342 var weightInKg = $('.quform-field-11_18').val(); 343 var weightInGram = weightInKg * 1000; 344 var shipmentProductCode = $('.quform-field-11_25:checked').val();//if internation can direct use 345 if (countryISO3 == 'MYS') { 346 if (shipmentProductCode == 'T0') { 347 shipmentProductCode = 'CS01L'; 348 } else if (shipmentProductCode == 'RP') { 349 shipmentProductCode = 'CS01P'; 350 } 351 if (fromPostcode.length && toPostcode.length && fromLocationId.length && toLocationId.length && shipmentTypeCode.length && $.isNumeric(weightInKg) && shipmentProductCode.length) { 352 $.ajax({
353 type: "post", 354 dataType: "json", 355 url: INTEGRATION.ajax_url, 356 data: { 357 action: 'call_price_estimate', 358 FromPostalCode: fromPostcode, 359 ToPostalCode: toPostcode, 360 FromLocationId: fromLocationId, 361 ToLocationId: toLocationId, 362 ShipmentTypeCode: shipmentTypeCode, 363 WeightInGram: weightInGram, 364 ShipmentProductCode: shipmentProductCode, 365 toCountry: countryISO3, 366 }, 367 success: function (data) { 368 $('.result-div').show(); 369 $('.international-fuel-surcharge').hide(); 370 var response = jQuery.parseJSON(data); 371 if (response.s == "success") { 372 $('#quotation h2').text('Your Quotation: RM' + response.r.Total.toFixed(2)); 373 $('#rate-estimate-detail').empty(); 374 $('#rate-estimate-detail').append(`<p>Consignment type: ` + $('.quform-field-11_24 :selected').text() + '</p>'); 375 $('#rate-estimate-detail').append(`<p>Weight: ` + $('.quform-field-11_18').val() + `KG</p>`); 376 $('#rate-estimate-detail').append(`<p>From: ` + $('.quform-field-11_12').val() + ' ' + $('.quform-field-11_22 :selected').text() + `</p>`); 377 $('#rate-estimate-detail').append(`<p>To: ` + $('.quform-field-11_26').val() + ' ' + $('.quform-field-11_23 :selected').text() + `</p>`); 378 379 $('#tax-fee').text('15% Security & Fuel Surcharge, 20% Handling Charge included and 6% Service Tax included.'); 380 381 } else { 382 alert(response.e); 383 } 384 } 385 }); 386 } 387 } else { 388 if (shipmentTypeCode.length && $.isNumeric(weightInKg) && shipmentProductCode.length) { 389 $.ajax({
390 type: "post", 391 dataType: "json", 392 url: INTEGRATION.ajax_url, 393 data: { 394 action: 'call_price_estimate', 395 FromPostalCode: 123, 396 ToPostalCode: toCountryPostcode, 397 FromLocationId: 123, 398 ToLocationId: 123, 399 ShipmentTypeCode: shipmentTypeCode, 400 WeightInGram: weightInGram, 401 ShipmentProductCode: shipmentProductCode, 402 toCountry: countryISO3 403 }, 404 success: function (data) { 405 $('.result-div').show(); 406 $('.international-fuel-surcharge').show(); 407 var response = jQuery.parseJSON(data); 408 if (response.s == "success") { 409 $('#quotation h2').text('Your Quotation: RM' + response.r.Total.toFixed(2)); 410 $('#rate-estimate-detail').empty(); 411 $('#rate-estimate-detail').append(`<p>Consignment type: ` + $('.quform-field-11_24 :selected').text() + '</p>'); 412 $('#rate-estimate-detail').append(`<p>Weight: ` + $('.quform-field-11_18').val() + `kg</p>`); 413 $('#rate-estimate-detail').append(`<p>From: ` + $('.quform-field-11_12').val() + ' ' + $('.quform-field-11_22 :selected').text() + `</p>`); 414 $('#rate-estimate-detail').append(`<p>To: ` + $('.quform-field-11_14').val() + ' ' + $('.quform-field-11_8 :selected').text() + `</p>`); 415 416 if (response.r.ODACharge > 0) { 417 $('#tax-fee').text('ODA Charges RM' + response.r.ODACharge + ', ' + (response.r.FuelSurchargePercentage * 100).toFixed(2) + '% Security & Fuel Surcharge and ' + response.r.HandlingSurchargePercentage * 100 + '% Handling Charge included.'); 418 } else { 419 $('#tax-fee').text((+response.r.FuelSurchargePercentage * 100).toFixed(2) + '% Security & Fuel Surcharge and ' + response.r.HandlingSurchargePercentage * 100 + '% Handling Charge included.'); 420 } 421 } else if (response.r) { 422 alert(response.r); 423 } else { 424 alert(response.e); 425 } 426 } 427 }); 428 } 429 } 430 431 }); 432 433 $('.quform-form-6').submit(function (e) { 434 e.preventDefault(); 435 var fromPostcode = $('.quform-field-6_25').val(); 436 var toPostcode = $('.quform-field-6_26').val(); 437 var fromLocationId = $('.quform-field-6_31').val(); 438 var toLocationId = $('.quform-field-6_32').val(); 439 var shipmentTypeCode = $('.quform-field-6_7').val(); 440 var weightInKg = $('.quform-field-6_8').val(); 441 var weightInGram = weightInKg * 1000; 442 var shipmentProductCode = $('.quform-field-6_20:checked').val(); 443 if (fromPostcode.length && toPostcode.length && fromLocationId.length && toLocationId.length && shipmentTypeCode.length && $.isNumeric(weightInGram) && shipmentProductCode.length) { 444 $.ajax({
445 type: "post", 446 dataType: "json", 447 url: INTEGRATION.ajax_url, 448 data: { 449 action: 'call_price_estimate', 450 FromPostalCode: fromPostcode, 451 ToPostalCode: toPostcode, 452 FromLocationId: fromLocationId, 453 ToLocationId: toLocationId, 454 ShipmentTypeCode: shipmentTypeCode, 455 WeightInGram: weightInGram, 456 ShipmentProductCode: shipmentProductCode, 457 toCountry: 'Malaysia' 458 }, 459 success: function (data) { 460 var response = jQuery.parseJSON(data); 461 if (response.s == "success") { 462 $('#rate-estimate-table tr').remove(); 463 $('#quotation h2').text('Your Quotation: RM' + response.r.Total.toFixed(2)); 464 $('#rate-estimate-table tbody').append(`<tr> 465 <td align="left">Consignment Type</td> 466 <td align="left">`+ $('.quform-field-6_7 :selected').text() + `</td> 467 </tr>>`); 468 $('#rate-estimate-table tbody').append(`<tr> 469 <td align="left">Weight</td> 470 <td align="left">`+ $('.quform-field-6_8').val() + `KG</td> 471 </tr>>`); 472 $('#rate-estimate-table tbody').append(`<tr> 473 <td align="left">From</td> 474 <td align="left">`+ $('.quform-field-6_25').val() + ' ' + $('.quform-field-6_31 :selected').text() + `</td> 475 </tr>>`); 476 $('#rate-estimate-table tbody').append(`<tr> 477 <td align="left">To</td> 478 <td align="left">`+ $('.quform-field-6_26').val() + ' ' + $('.quform-field-6_32 :selected').text() + `</td> 479 </tr>>`); 480 $('#tax-fee').text('15% Security & Fuel Surcharge, 20% Handling Charge included and 6% Service Tax included.'); 481 482 } else if (response.r) { 483 alert(response.r); 484 } else { 485 alert(response.e); 486 } 487 } 488 }); 489 } 490 }); 491 492 $('.quform-form-5').submit(function (e) { 493 e.preventDefault(); 494 var shipmentTypeCode = $('.quform-field-5_7').val(); 495 var weightInKg = $('.quform-field-5_8').val(); 496 var weightInGram = weightInKg * 1000; 497 var shipmentProductCode = $('.quform-field-5_20:checked').val(); 498 var toCountry = $('.quform-field-5_6 :selected').text(); 499 var postCode = $('.quform-field-5_33').val(); 500 501 if (shipmentTypeCode.length && $.isNumeric(weightInGram) && shipmentProductCode.length) { 502 $.ajax({
503 type: "post", 504 dataType: "json", 505 url: INTEGRATION.ajax_url, 506 data: { 507 action: 'call_price_estimate', 508 FromPostalCode: 123, 509 ToPostalCode: postCode, 510 FromLocationId: 123, 511 ToLocationId: 123, 512 ShipmentTypeCode: shipmentTypeCode, 513 WeightInGram: weightInGram, 514 ShipmentProductCode: shipmentProductCode, 515 toCountry: toCountry 516 }, 517 success: function (data) { 518 var response = jQuery.parseJSON(data); 519 if (response.s == "success") { 520 $('#rate-estimate-table tr').remove(); 521 $('#quotation h2').text('Your Quotation: RM' + response.r.Total.toFixed(2)); 522 $('#rate-estimate-table tbody').append(`<tr> 523 <td align="left">Consignment Type</td> 524 <td align="left">`+ $('.quform-field-5_7 :selected').text() + `</td> 525 </tr>>`); 526 $('#rate-estimate-table tbody').append(`<tr> 527 <td align="left">Weight</td> 528 <td align="left">`+ $('.quform-field-5_8').val() + `KG</td> 529 </tr>>`); 530 $('#rate-estimate-table tbody').append(`<tr> 531 <td align="left">From</td> 532 <td align="left">Malaysia</td> 533 </tr>>`); 534 $('#rate-estimate-table tbody').append(`<tr> 535 <td align="left">To</td> 536 <td align="left">`+ $('.quform-field-5_6 :selected').text() + `</td> 537 </tr>>`); 538 if (response.r.ODACharge > 0) { 539 $('#tax-fee').text('ODA Charges RM' + response.r.ODACharge + ', ' + (response.r.FuelSurchargePercentage * 100).toFixed(2) + '% Security & Fuel Surcharge and ' + response.r.HandlingSurchargePercentage * 100 + '% Handling Charge included.'); 540 } else { 541 $('#tax-fee').text((+response.r.FuelSurchargePercentage * 100).toFixed(2) + '% Security & Fuel Surcharge and ' + response.r.HandlingSurchargePercentage * 100 + '% Handling Charge included.'); 542 } 543 544 } else if (response.r) { 545 alert(response.r); 546 } else { 547 alert(response.e); 548 } 549 } 550 }) 551 } 552 }); 553 554 var getCommodity = function () { 555 $('.quform-field-10_5').empty(); 556 $('.quform-field-10_5').prepend("<option value=''>Please select</option>").val(''); 557 558 var countryISO3 = $('.quform-field-10_4 :selected').val(); 559 $.ajax({
560 type: "post", 561 dataType: "json", 562 url: INTEGRATION.ajax_url, 563 data: { 564 action: 'call_commodity_guideline1', 565 countryISO3: countryISO3, 566 }, 567 success: function (data) { 568 var response = jQuery.parseJSON(data); 569 if (response.length > 0) { 570 for (let i = 0; i < response.length; i++) { 571 $('.quform-field-10_5').append(new Option(response[i].commodity_name, response[i].id)); 572 } 573 $('.quform-field-10_5').trigger('change'); 574 } else { 575 alert("No commodities found for selected country"); 576 } 577 } 578 }); 579 $('.quform-field-10_5').trigger('change'); 580 } 581 582 var getItem = function () { 583 $('.quform-field-10_6').empty(); 584 $('.quform-field-10_6').prepend("<option value=''>Please select</option>").val(''); 585 586 var commodityId = $('.quform-field-10_5 :selected').val(); 587 $.ajax({
588 type: "post", 589 dataType: "json", 590 url: INTEGRATION.ajax_url, 591 data: { 592 action: 'call_commodity_guideline2', 593 commodityId: commodityId, 594 }, 595 success: function (response) { 596 for (let i = 0; i < response.length; i++) { 597 $('.quform-field-10_6').append(new Option(response[i], response[i])); 598 } 599 $('.quform-field-10_6').trigger('change'); 600 } 601 }); 602 $('.quform-field-10_6').trigger('change'); 603 } 604 // $('.quform-field-10_4').on('change', getCommodity); 605 $('.quform-field-10_5').on('change', getItem); 606 607 $('.quform-form-10').ready(function () { 608 if ($(".quform-form-10").length > 0) { 609 $('#commodity-guideline-table tr').remove(); 610 $('.quform-field-10_4').empty() 611 $('.quform-field-10_4').append($("<option>", { value: '', text: "Please select" })); 612 $.ajax({ 613 type: "get", 614 dataType: "json", 615 url: INTEGRATION.ajax_url, 616 data: { 617 action: 'call_get_country', 618 }, 619 success: function (data) { 620 var response = jQuery.parseJSON(data); 621 if (response.s == "success") { 622 for (let i = 0; i < response.r.length; i++) { 623 $('.quform-field-10_4').append(new Option(response.r[i].country_name, response.r[i].iso_code_3)); 624 } 625 $('.quform-field-10_4').on('change keyup', getCommodity); 626 } else { 627 alert(response.e) 628 } 629 } 630 }); 631 } 632 }); 633 634 $('.quform-form-10').submit(function (e) { 635 e.preventDefault(); 636 var countryISO3 = $('.quform-field-10_4 :selected').val(); 637 var commodityId = $('.quform-field-10_5 :selected').val(); 638 var itemName = $('.quform-field-10_6 :selected').text(); 639 640 $.ajax({
641 type: "post", 642 dataType: "json", 643 url: INTEGRATION.ajax_url, 644 data: { 645 action: 'call_commodity_guideline3', 646 countryISO3: countryISO3, 647 commodityId: commodityId, 648 itemName: itemName, 649 }, 650 success: function (response) { 651 $('#commodity-guideline-table tr').remove(); 652 $('#commodity-guideline-table thead').append(`<tr> 653 <th align="left">Country</th> 654 <th align="left">Commodity</th> 655 <th align="left">Item</th> 656 <th align="left">Results</th> 657 <th align="left">Remarks</th> 658 </tr>`); 659 var result = ''; 660 if (response.condition == 'Acceptable') { 661 result = '<strong><span style="color: #99cc00;">' + response.condition + '</span></strong>'; 662 } else if (response.condition == 'Prohibited') { 663 result = '<strong><span style="color: #ff0000;">' + response.condition + '</span></strong>'; 664 } else { 665 result = '<strong><span style="color: #0099cc;">' + response.condition + '</span></strong>'; 666 } 667 $('#commodity-guideline-table tbody').append(`<tr> 668 <td align="left">`+ response.countryName + `</td> 669 <td align="left">`+ response.commodityName + `</td> 670 <td align="left">`+ itemName + `</td> 671 <td align="left">`+ result + `</td> 672 <td align="left">`+ response.remarks + `</td> 673 </tr>>`); 674 } 675 }); 676 677 }); 678 // PERMISSION TO COPY FROM CLIPBOARD 679 680 // function catchPaste(evt, elem, callback) { 681 // if (navigator.clipboard && navigator.clipboard.readText) { 682 // // modern approach with Clipboard API 683 // navigator.clipboard.readText().then(callback); 684 // } else if (evt.originalEvent && evt.originalEvent.clipboardData) { 685 // // OriginalEvent is a property from jQuery, normalizing the event object 686 // callback(evt.originalEvent.clipboardData.getData('text')); 687 // } else if (evt.clipboardData) { 688 // // used in some browsers for clipboardData 689 // callback(evt.clipboardData.getData('text/plain')); 690 // } else if (window.clipboardData) {
691 // // Older clipboardData version for Internet Explorer only 692 // callback(window.clipboardData.getData('Text')); 693 // } else { 694 // // Last resort fallback, using a timer 695 // setTimeout(function () { 696 // callback(elem.value) 697 // }, 100); 698 // } 699 // } 700 701 // $('.quform-field-1_3').on('paste', function (e) { 702 // e.preventDefault(); 703 // catchPaste(e, this, function (clipData) { 704 // e.preventDefault(); 705 // var appendClipData = $(".quform-field-1_3").val() + clipData.split('\n').join(', '); 706 // $(".quform-field-1_3").val(appendClipData); 707 // }); 708 // }); 709 710 // PERMISSION TO COPY FROM CLIPBOARD 711 712 $(document).ready(function () { 713 var appendBottomLinkRetry = 0; 714 var appendBottomLink = setInterval(function () { 715 console.log('loop'); 716 if (++appendBottomLinkRetry === 10) { 717 clearInterval(appendBottomLink); 718 return; 719 } 720 721 // if ($("#asl-categories").length) { 722 // $('#asl-categories').on('change', function(e){ 723 // const arr=$('#asl-categories').val(); 724 // arr.forEach(function(element,index){ 725 // if(arr[index]=="20"){ 726 // arr[index]=" Collect a Parcel"; 727 // } 728 // else if(arr[index]=="19"){ 729 // arr[index]=" Drop-Off a Parcel"; 730 // } 731 // else if(arr[index]=="21"){ 732 // arr[index]=" Fulfillment Related Service"; 733 // } 734 // else if(arr[index]=="18"){ 735 // arr[index]=" Send a Parcel"; 736 // } 737 // }); 738 // $('#you-selected').text("You selected"+arr); 739 740 // const spaced = $('#asl-categories option:selected').toArray().map(item => item.text).join().replaceAll(',', ', '); 741 // $('#you-selected').text(spaced); 742 // }); 743 // clearInterval(appendBottomLink); 744 // } 745 $(".onoffswitch-checkbox").click(function () { 746 if ($(".onoffswitch-inner").hasClass("all")) { 747 $(".onoffswitch-inner").removeClass("all") 748 } 749 else { 750 $(".onoffswitch-inner").addClass("all"); 751 } 752 753 }) 754 }, 500); 755 756 }); 757 758 $(".quform-form-11").ready(function () { 759 if ($(".quform-form-11").length > 0) { 760 $('.result-div').hide(); 761 $('.international-fuel-surcharge').hide(); 762 $('#quotation h2').text(''); 763 $('#rate-estimate-detail').empty(); 764 $('#tax-fee').text(''); 765 // $('.quform-field-11_8').empty() 766 // $('.quform-field-11_8').append($("<option>", { value: '', text: "Please select" })); 767 $('.quform-element-11_14').hide() 768 $.ajax({
769 type: "get", 770 dataType: "json", 771 url: INTEGRATION.ajax_url, 772 data: { 773 action: 'call_get_country', 774 }, 775 success: function (data) { 776 var response = jQuery.parseJSON(data); 777 if (response.s == "success") { 778 $('.quform-field-11_8').empty() 779 for (let i = 0; i < response.r.length; i++) { 780 $('.quform-field-11_8').append(new Option(response.r[i].country_name, response.r[i].iso_code_3)); 781 } 782 $('.quform-field-11_8').val("MYS"); 783 $('.quform-field-11_8').on('change keyup', getToLocation2); 784 } else { 785 alert(response.e); 786 } 787 } 788 }); 789 } 790 }); 791 792 // $('.quform-form-21').submit(function (e) { 793 // e.preventDefault(); 794 795 // var name = $('.quform-field-21_30').val(); 796 // var contact_no = $('.quform-field-21_37').val(); 797 // var email = $('.quform-field-21_45').val(); 798 // var comp_name = $('.quform-field-21_49').val(); 799 // var msg = $('.quform-field-21_51').val(); 800 801 // if (name.length && contact_no.length && email.length && comp_name.length) { 802 // $.ajax({
803 // type: "post", 804 // dataType: "json", 805 // url: INTEGRATION.ajax_url, 806 // data: { 807 // action: 'call_add_organization', 808 // name: comp_name, 809 // }, 810 // success: function (data_1) { 811 // var response_1 = jQuery.parseJSON(data_1); 812 813 // if (response_1.success == true) { 814 815 // console.log(response_1); 816 // console.log(name); 817 // console.log(response_1.data.id); 818 // console.log(contact_no); 819 // console.log(email); 820 821 // $.ajax({ 822 // type: "post", 823 // dataType: "json", 824 // url: INTEGRATION.ajax_url, 825 // data: { 826 // action: 'call_add_person', 827 // name: name, 828 // org_id: response_1.data.id, 829 // phone: contact_no, 830 // email: email, 831 // }, 832 // success: function (data_2) { 833 // var response_2 = jQuery.parseJSON(data_2); 834 835 // if (response_2.success == true) { 836 837 // console.log(response_2); 838 // console.log(comp_name); 839 // console.log(response_2.data.id); 840 // console.log(response_1.data.id); 841 // console.log(msg); 842 843 // $.ajax({
844 // type: "post", 845 // dataType: "json", 846 // url: INTEGRATION.ajax_url, 847 // data: { 848 // action: 'call_add_deal', 849 // title: comp_name + " lead", 850 // person_id: response_2.data.id, 851 // org_id: response_1.data.id, 852 // msg: msg, 853 // }, 854 // success: function (data_3) { 855 // var response_3 = jQuery.parseJSON(data_3); 856 // if (response_3.success == true) { 857 858 // console.log(response_3); 859 860 // } else { 861 // alert(response.e); 862 // } 863 // } 864 // }); 865 // } else { 866 // alert(response.e); 867 // } 868 // } 869 // }); 870 // } else { 871 // alert(response.e); 872 // } 873 // } 874 // }); 875 // } 876 // }); 877 878 $('.quform-form-21').submit(function (e) { 879 e.preventDefault(); 880 881 var name = $('.quform-field-21_30').val(); 882 var contact_no = $('.quform-field-21_37').val(); 883 var email = $('.quform-field-21_45').val(); 884 var comp_name = $('.quform-field-21_49').val(); 885 var msg = $('.quform-field-21_51').val(); 886 887 if (name.length && contact_no.length && email.length && comp_name.length) { 888 $.ajax({
889 type: "post", 890 dataType: "json", 891 url: INTEGRATION.ajax_url, 892 data: { 893 action: 'call_add_lark_record', 894 name: name, 895 phone: contact_no, 896 email: email, 897 company_name: comp_name, 898 msg: msg, 899 }, 900 success: function (response) { 901 if (response.s == "success") { 902 console.log('Lark record created:', response.r); 903 } else { 904 alert(response.e || 'Something went wrong. Please try again later.'); 905 } 906 }, 907 error: function () { 908 alert('Something went wrong. Please try again later.'); 909 } 910 }); 911 } 912 }); 913 914 $('#track-order-form').submit(function (e) { 915 e.preventDefault(); 916 var errormsg = document.getElementById("errormsg"); 917 918 var track_no = $('#quform_1_3').val(); 919 var type = $('input[name=quform_1_16]:checked', '#track-order-form').val() 920 921 if (track_no.length && type.length) { 922 $(".quform-loading-type-spinner-6").addClass("quform-loading-triggered") 923 $.ajax({
924 type: "post", 925 dataType: "json", 926 url: INTEGRATION.ajax_url, 927 data: { 928 action: 'call_track_result', 929 track_no: track_no, 930 type: type, 931 }, 932 success: function (response) { 933 errormsg.style.display = 'none'; 934 window.location.href = response; 935 } 936 }); 937 } else { 938 errormsg.style.display = 'block'; 939 } 940 }); 941})(jQuery);
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.