").addClass("shipping-title").append($("").addClass("shipping-price-title").text("Shipping:")).append($("").addClass("shipping-loading"));$("#open-estimate-shipping-popup-2260").html(n)}},success:function(){var t=n.getActiveShippingOption();n.selectShippingOption(t);u=!0;n.settings.handlers.success=undefined},error:function(){n.selectShippingOption()},selectedOption:function(t){var i,u,r;t&&t.provider&&t.price&&n.validateAddress(t.address)?(i=$("#open-estimate-shipping-popup-2260"),u=$("
").addClass("shipping-title").append($("").addClass("shipping-price-title").text("Shipping:")).append($("").addClass("shipping-price").text(t.price)),i.html(u),r=$("").addClass("estimated-delivery").append($("").addClass("shipping-address").append($("").text("to "+t.address.countryName+", "+(t.address.stateProvinceName?t.address.stateProvinceName+", ":"")+(n.settings.useCity?t.address.city:globalTownName)+" via "+t.provider)).append($("").addClass("arrow-down"))),t.deliveryDate&&t.deliveryDate!=="-"&&r.append($("").addClass("shipping-date").text("Estimated Delivery on "+t.deliveryDate)),i.append(r)):$("#open-estimate-shipping-popup-2260").html($("").text("Please select the address you want to ship to")).append($("").addClass("arrow-down"))}}},i,r;n=createEstimateShippingPopUp(f);n.init();i=function(){var t=n.getShippingAddress();n.validateAddress(t)?n.getShippingOptions(t):n.selectShippingOption()};i();r=function(r){var o=r.changedData.productId,f,e;o===2260&&(n.params.selectedShippingOption?(f=n.params.selectedShippingOption.address,e=n.getShippingAddress(),n.addressesAreEqual(f,e)||(t=!0),n.getShippingOptions(f)):u?t=!0:i())};setTimeout(function(){$(document).on("product_attributes_changed",r)},500);$(document).on("product_quantity_changed",r);$("#TownId").change(function(){var t={id:$("#TownId").val()};console.log("x=>",t);$.ajax({cache:!1,url:"/Country/GetTownByTownId?id="+t.id,success:function(t){console.log("response = > ",t);let r=t.Code,u=t.Id;globalTownName=t.Name;$("#zippostalcode").val(r);let i=n.getShippingAddress();i.zipPostalCode=r;i.townId=u;n.validateAddress(i)?(globalTownId=i.townId,globalZipCode=i.zipPostalCode,n.getShippingOptions(i)):n.selectShippingOption()}})})})