function getURLParameter(n,t){return decodeURIComponent((new RegExp("[?|&]"+n+"=([^&;]+?)(&|#|;|$)").exec(t||location.search)||[,""])[1].replace(/\+/g,"%20"))||null}function addAddressAjax(n,t,i=false,r=null){var f=$(t).serialize(),u=window.location.href.toLowerCase();$.ajax({cache:!1,type:"POST",data:f,url:n,success:function(n){if(n.Status===1)if($.fancybox.close(),!n.NoChange&&u.includes("/customer/addressedit")||!n.NoChange&&u.includes("/customer/addressadd"))showAddressVerificationModal(n.Data.NewAddressId,!0,!1,!1,!1,r);else if(n.NoChange&&u.includes("/customer/addressedit")||n.NoChange&&u.includes("/customer/addressadd")){var t=getURLParameter("returnurl",u);location.href=t!==null?t:"/customer/addresses"}else!n.NoChange&&u.includes("/checkout/billingaddress")?($("#selectedBillingAddressId")&&$("#selectedBillingAddressId").val()==="0"&&$("#selectedBillingAddressId").val(n.Data.NewAddressId),$("#selectedShippingAddressId")&&$("#selectedShippingAddressId").val()==="0"&&$("#selectedShippingAddressId").val(n.Data.NewAddressId),showAddressVerificationModal(n.Data.NewAddressId,!1,!1,!1,i,r)):n.NoChange&&u.includes("/checkout/billingaddress")?($("#selectedBillingAddressId")&&$("#selectedBillingAddressId").val()==="0"&&$("#selectedBillingAddressId").val(n.Data.NewAddressId),$("#selectedShippingAddressId")&&$("#selectedShippingAddressId").val()==="0"&&$("#selectedShippingAddressId").val(n.Data.NewAddressId),addressAddEditDelete.getAddressList(".address-list-wrapper",".address-add-wrapper",".checkout-address-list"),$(".address-list-wrapper").css("display","block")):!n.NoChange&&u.includes("/customer/recurringordersedit")?showAddressVerificationModal(n.Data.NewAddressId):n.NoChange&&u.includes("/customer/recurringordersedit")?(addressAddEditDelete.getAddressList(".address-list-wrapper",".address-add-wrapper",".address-list-wrapper"),$(".address-list-wrapper").css("display","block")):!n.NoChange&&u.includes("/pendingedit")?showAddressVerificationModal(n.Data.NewAddressId,!1,n.Data.IsShipping,n.Data.MergeAddresses):u.includes("/pendingedit/")&&($("#orderUpdateWindow").remove(),$("#orderUpdateWindowResult").show(),n.Messages[0]!==""?$("#orderUpdateWindowResult").html("<i><\/i> <br />"+n.Messages[0]+"<br/><button class='btn btn-primary order-detail-return' onclick='goBackToOrderDetails();'>Sipariş Detayına Git<\/button>"):$("#orderUpdateWindowResult").html("<i><\/i> <br />İşleminiz başarılı bir şekilde tamamlandı. <br /><button class='btn btn-primary order-detail-return' onclick='goBackToOrderDetails();'>Sipariş Detayına Git<\/button>"),$(".pending-address-box").slideUp(),$(".address-edit-buttons, .toggle-box").slideDown());else generalAlert(n.Messages[0],"Hata")},error:function(n){generalAlert(n.Messages[0],"Hata")}})}function showAddressVerificationModal(n,t=false,i=false,r=false,u=false,f=null){var e=window.location.href.toLowerCase(),h=e.includes("/pendingedit"),s=!1,o=function(){$(".fancybox-wrap").height($(".sms-confirmation-wrapper").outerHeight(!0));$(".fancybox-inner").height($(".sms-confirmation-wrapper").outerHeight(!0))},c;t&&$.ajax({cache:!1,type:"POST",url:"/customer/ResendValidateAddressCode",data:{addressId:n}});$.fancybox({width:"305",height:"350",scrolling:"no",fitToView:!1,autoSize:!1,closeClick:!1,openEffect:"none",closeEffect:"none",afterShow:function(){f!=null&&$(f).removeAttr("disabled")},helpers:{overlay:{closeClick:!1}},padding:0,wrapCSS:"dikey-popup sms-confirmation-popup dikey-form no-padding",content:`<div class="sms-confirmation-wrapper ${window._storeId===3?"fitmoda-sms-wrapper":""}"> <div class="sc-title">Email Onay Kodu</div> <div>Sistemde kayıtlı olan e-posta adresinize gönderdiğimiz doğrulama kodunu girin.<br /><br />"444 1 348" Müşteri hizmetlerimizi arayarak destek alabilirsiniz.</div> <div class="dikey-group" style="margin: 30px 0;"> <label>Doğrulama Kodu</label> <div class="dikey-input-tick"> <input type="number" name="emailConfirmation" class="dikey-control" id="emailConfirmation" maxlength="6" /> <span class="counter">120 sn</span> </div> <span class="error-message"></span> </div> <a href="javascript:;" class="btn btn-primary btn-lg btn-block customize-bootstrap-primary-btn active">ONAYLA</a> <a href="javascript:;" class="btn btn-success btn-lg btn-block customize-bootstrap-success-btn active hidden">GÖNDER</a></div>`,afterClose:function(){e.includes("/checkout/billingaddress")?(s||(console.log("Girdi"),addressAddEditDelete.getAddressList(".address-list-wrapper",".address-add-wrapper",".checkout-address-list","",!0,u)),$(".address-list-wrapper").css("display","block")):e.includes("/customer/recurringordersedit")&&(addressAddEditDelete.getAddressList(".address-list-wrapper",".address-add-wrapper",".address-list-wrapper"),$(".address-list-wrapper").css("display","block"));s=!1}});c=setInterval(function(){var n=$(".sms-confirmation-popup .counter"),t=Number(n.text().replace("sn",""));t>0?n.text(t-1+" sn"):(clearInterval(c),$.fancybox.close())},1e3);$(".sms-confirmation-wrapper #emailConfirmation").on("keyup",function(){$(".sms-confirmation-wrapper .error-message").text("");o()});$(".sms-confirmation-wrapper a.btn-primary:not(.busy)").on("click",function(){var t=$(this),f=$(".sms-confirmation-wrapper #emailConfirmation").val();if(t.addClass("busy"),f.length===0){$(".sms-confirmation-wrapper .error-message").text("Lütfen doğrulama kodu giriniz.");o();t.removeClass("busy");return}$.ajax({cache:!1,type:"POST",url:h?"/customer/ValidateOrderAddressCode":"/customer/ValidateAddressCode",data:h?{addressId:n,validationCode:f,isShipping:i,mergeOrderAddresses:r,orderCode:$("#PendingOrderShippingAddressEdit > #OrderCode").val()}:{addressId:n,validationCode:f},success:function(n){t.removeClass("busy");n.Status===-1?($(".sms-confirmation-wrapper .error-message").text(n.Messages[0]),(n.Data==16||n.Data==17)&&(t.addClass("hidden"),$(".sms-confirmation-wrapper a.btn-success").removeClass("hidden")),o()):e.includes("/customer/addressedit")||e.includes("/customer/addressadd")?(location.href="/customer/addresses",$.fancybox.close()):e.includes("/checkout/billingaddress")?(s=!0,addressAddEditDelete.getAddressList(".address-list-wrapper",".address-add-wrapper",".checkout-address-list","",!0,u),$(".address-list-wrapper").css("display","block"),$.fancybox.close()):e.includes("/customer/recurringordersedit")?(addressAddEditDelete.getAddressList(".address-list-wrapper",".address-add-wrapper",".address-list-wrapper"),$(".address-list-wrapper").css("display","block"),$.fancybox.close()):e.includes("/pendingedit")&&($("#orderUpdateWindow").remove(),$("#orderUpdateWindowResult").show(),$("#orderUpdateWindowResult").html("<i><\/i> <br />İşleminiz başarılı bir şekilde tamamlandı. <br /><button class='btn btn-primary order-detail-return' onclick='goBackToOrderDetails();'>Sipariş Detayına Git<\/button>"),$(".pending-address-box").slideUp(),$(".address-edit-buttons, .toggle-box").slideDown(),$.fancybox.close())}})});$(".sms-confirmation-wrapper a.btn-success:not(.busy)").on("click",function(){var t=$(this);t.addClass("busy");$.ajax({cache:!1,type:"POST",url:"/customer/ResendValidateAddressCode",data:{addressId:n},success:function(n){n.Status===-1?($(".sms-confirmation-wrapper .error-message").text(n.Messages[0]),o(),t.removeClass("busy"),$(".sms-confirmation-popup .counter").text("120 sn")):($(".sms-confirmation-wrapper .error-message").text(""),o(),t.removeClass("busy"),t.addClass("hidden"),$(".sms-confirmation-wrapper a.btn-primary").removeClass("hidden"),$(".sms-confirmation-popup .counter").text("120 sn"))}})})}function showCheckoutAddressVerificationModal(n,t=false,i=false,r=false){var u;u=i?$(".selected-shipping").attr("data-value"):$(".selected-billing").attr("data-value");$.ajax({cache:!1,type:"POST",url:"/checkout/ValidateDistrictControl",data:{addressId:u},success:function(n){n.status===!1?i?reAssingAddressBillingAndShippingEdit(!0,"Teslimat Adresini Düzenle"):reAssingAddressBillingAndShippingEdit(!1,"Fatura Adresini Düzenle"):showAddressVerificationModal(u,t,i,r)},error:function(){generalAlert("İşlem esnasında bir hata oluştu.","Hata")}})}function goBackToOrderDetails(){window.location.pathname=window.location.pathname.replace("pendingedit","orderdetails")}function districtShowHide(n){var i=$(n+" #CityId :selected").text().toLowerCase(),t=$(n+" #CountyId :selected").val();t||(t=0);i.endsWith("stanbul")&&t>0?$(n+" #disrictrow").show():hideDistricts(n)}function getDistricts(n){var r=$(n+" #CityId :selected").text().toLowerCase(),t=$(n+" #CountyId :selected").val(),i=$(n+" #DistrictId");r.endsWith("stanbul")&&t>0?($(n+" #disrictrow").show(),$.ajax({cache:!1,type:"POST",url:addressUrls.GetCityCountyDistrictsByCityCountyId,data:{cityCountyId:t,addEmptyCityCountyDistrictIfRequired:"true"},success:function(t){i.html("");$(n+" #DistrictId").attr("general-required","required");$(n+" #DistrictId").append("<option value='0' selected='selected'>Semt / Mahalle<\/option>");for(var r=0;r<t.length;r++)i.append("<option value='"+t[r].id+"'>"+t[r].name+"<\/option>");addValidationDistrictOnPendingOrder(n)}})):hideDistricts(n)}function hideDistricts(n){$(n+" #disrictrow").hide();$(n+" #DistrictId").find("option").remove().end().append('<option value="0">--Seçiniz--<\/option>').val("0");$("#DistrictId").removeAttr("general-required")}function getCounties(n){var t=$(n+" #CityId").val();$.ajax({cache:!1,type:"POST",url:addressUrls.GetCityCountiesByCityId,data:{cityId:t,addEmptyCityCountyIfRequired:!0},success:function(t){var r=$(n+" #CountyId"),i;for(r.html(""),r.append("<option value='0' selected='selected'>İlçe (*)<\/option>"),i=0;i<t.length;i++)r.append("<option value='"+t[i].id+"'>"+t[i].name+"<\/option>")}})}function assignEditFormEvents(n){$(n).data().posturl!==""&&(districtShowHide(n),$(n+" #CityId").change(function(){$(n+" #CountyId").val("0");$(n+" #DistrictId").find("option").remove().end().append('<option value="0">--Seçiniz--<\/option>').val("0");setTimeout(function(){districtShowHide(n);getCounties(n)},200)}),$(n+" #CountyId").change(function(){getDistricts(n)}),formValidation.validateAjaxFormPostForPendingEdit(n,".form-control",n+" #EditAddressButton"),stylishForm(".form-control",".control-group",".animated-label"),phoneNumberMask($(".phoneMask")))}function assingAddFrom(n){$("#AddAddressGeneric .country-id-select").val("77");formValidation.getCity("#AddAddressGeneric .select-city");$(n+" .form-control").each(function(){$(this).attr("data-inputtype")!=="Title"&&$(this).attr("data-inputtype")!=="Name"&&$(this).attr("data-inputtype")!=="Surname"&&$(this).attr("data-inputtype")!=="MobilePhoneNumber"&&$(this).attr("data-inputtype")!=="Email"&&$(this).val("")});$.fancybox({closeClick:!1,content:$(".address-add-wrapper"),width:"700",height:"500",padding:0,margin:0,helpers:{overlay:{closeClick:!1}},afterClose:function(){$(".address-add-wrapper").attr("data-popup","false")}});$(".address-add-wrapper").attr("data-popup","true");$(".popup-text").text("Yeni Adres Ekle");$("#AddAddressGeneric #PersonalAddressType").trigger("click");setTimeout(function(){districtShowHide("#AddAddressGeneric")},200)}function reAssingAddressAdd(n){$("#AddAddressGeneric select[data-inputtype*='CountyId']").html("");$("#AddAddressGeneric select[data-inputtype*='CountyId']").append("<option value='0' selected='selected'>İlçe (*)<\/option>");$(n+" .form-control").each(function(){$(this).attr("data-inputtype")!=="Name"&&$(this).attr("data-inputtype")!=="Surname"&&$(this).attr("data-inputtype")!=="MobilePhoneNumber"&&$(this).attr("data-inputtype")!=="Email"&&(addAddressFirstRun?$(this).attr("data-inputtype")!=="Title"&&$(this).val(""):$(this).val(""))});$.ajax({type:"POST",cache:!1,url:"/Checkout/GetNextAddressTitle/",success:function(n){n&&n.Data&&$(".address-add-wrapper #Title").val(n.Data)}});addAddressFirstRun=!1;var t=window.location.href.toLowerCase();$.fancybox({closeClick:!1,content:$(".address-add-wrapper"),width:"700",height:"500",padding:0,margin:0,helpers:{overlay:{closeClick:!1}},afterClose:function(){$("#AddAddressAlertBox").hide();$(".address-add-wrapper").attr("data-popup","false");t.includes("/customer/recurringordersedit")||showHideAgtAreaByDataSet()}});resetValidationOnAdd();$(".address-add-wrapper").attr("data-popup","true");$(".popup-text").text("Yeni Adres Ekle");$("#AddAddressGeneric #PersonalAddressType").trigger("click");setTimeout(function(){districtShowHide("#AddAddressGeneric")},200)}function reAssingAddressBillingAndShippingEdit(n,t){var r=window.location.href.toLowerCase(),i;i=n?$(".selected-shipping").attr("data-value"):$(".selected-billing").attr("data-value");$.ajax({type:"POST",cache:!1,url:"/checkout/addressedit?id="+i,success:function(i){var u,f;$("#EditAddressGeneric #Id").val(i.id);$("#EditAddressGeneric #Title").val(i.Title);resetValidationOnEdit();u=77;$.ajax({cache:!1,type:"POST",url:"/Country/GetCitiesByCountryId",data:{countryId:u,addEmptyCityIfRequired:"true"},success:function(n){$("#EditAddressGeneric select[data-inputtype*='CityId']").html("");$("#EditAddressGeneric select[data-inputtype*='CityId']").append("<option value='0'>İl (*)<\/option>");for(var t=0;t<n.length;t++)n[t].id===i.CityId?$("#EditAddressGeneric select[data-inputtype*='CityId']").append("<option value='"+n[t].id+"' selected='selected'>"+n[t].name+"<\/option>"):$("#EditAddressGeneric select[data-inputtype*='CityId']").append("<option value='"+n[t].id+"'>"+n[t].name+"<\/option>")}});formValidation.getCityCountiesOnLoadEditForm(i.CityId,$("#EditAddressGeneric select[data-inputtype*='CountyId']"),i.CountyId);$("input.form-control, textarea.form-control,select.form-control").each(function(){var n=$(this).attr("data-inputtype"),t=$(this);$.each(i,function(i,r){n===i&&t.val(r)});stylishForm(".form-control",".control-group",".animated-label")});formValidation.getCityCountiesDistincsOnLoadEditForm(i.CountyId,$("#EditAddressGeneric select[data-inputtype*='DistrictId']"),i.DistrictId);$("input.form-control, textarea.form-control,select.form-control").each(function(){var n=$(this).attr("data-inputtype"),t=$(this);$.each(i,function(i,r){n===i&&t.val(r)});stylishForm(".form-control",".control-group",".animated-label")});phoneNumberMask($(".phoneMask"));$.fancybox({closeClick:!1,content:$(".address-edit-wrapper"),width:"700",height:"500",padding:0,margin:0,helpers:{overlay:{closeClick:!1}},afterClose:function(){$("#EditAddressAlertBox").hide();$(".address-edit-wrapper").attr("data-popup","false");r.includes("/customer/recurringordersedit")||showHideAgtAreaByDataSet()}});f=$("#EditAddressGeneric #TaxNumber").val();f>0?$("#EditAddressGeneric #corporateAddressLink").trigger("click"):($("#EditAddressGeneric #PersonalAddressType").trigger("click"),$("#EditAddressGeneric #TaxNumber").val(""));$(".address-edit-wrapper").attr("data-popup","true");$(".popup-text").text(t);$("#RecurringOrderAddressIsShipping").val(n);setTimeout(function(){districtShowHide("#EditAddressGeneric")},500)}})}function showHideAgtArea(){setTimeout(function(){var n=$("#selectedShippingAddressId"),t,i;n!=null&&n.val()>0&&(t=41,i="/checkout/addressedit",$.ajax({type:"POST",cache:!1,url:i+"?id="+n.val(),success:function(n){if(n.CityId!==t){$(".sameday-delivery-list .selected").length&&$(".sameday-delivery-list .selected").removeClass("selected");$("#shippingoption > li.selected").length||$("#shippingoption > li:first").addClass("selected");var i=$("#shippingoption > li.selected").data("value");typeof i!="undefined"&&i!=null&&$("#selectedShippingOption").val(i);$(".sameday-delivery:first").parent().hide()}else $("#shippingoption > li.selected").length&&$("#shippingoption > li.selected").removeClass("selected"),$(".sameday-delivery-list .selected").length&&$(".sameday-delivery-list .selected").removeClass("selected"),$("#selectedShippingOption").val(""),$("#selectedAgtSlotOptionId").val(0),$(".sameday-delivery:first").parent().show()}}))},1200)}function showHideAgtAreaByDataSet(){var t=$("#shipAddressSelectControl .selected").data("showagt"),n;t==undefined?setTimeout(function(){showHideAgtAreaByDataSet()},50):($(".shipping-column.active").removeClass("active"),t==="True"?($("#shippingoption > li.selected").length&&$("#shippingoption > li.selected").removeClass("selected"),$(".sameday-delivery-list .selected").length&&$(".sameday-delivery-list .selected").removeClass("selected"),$("#selectedShippingOption").val(""),$("#selectedAgtSlotOptionId").val(0),$(".sameday-delivery").length>0&&$(".sameday-delivery:first").parent().show(),$(".shipping-column.standard-cargo").addClass("active"),setTimeout(function(){$(".shipping-column .standard-cargo-list > li:first").click()},10)):($(".sameday-delivery-list .selected").length&&$(".sameday-delivery-list .selected").removeClass("selected"),$("#shippingoption > li.selected").length||$("#shippingoption > li:first").addClass("selected"),n=$("#shippingoption > li.selected").data("value"),typeof n!="undefined"&&n!=null&&$("#selectedShippingOption").val(n),$(".sameday-delivery:first").parent().hide(),$(".shipping-column.standard-cargo").addClass("active")),prepareCargoTabs&&prepareCargoTabs())}function addValidationOnDistrict(){var n=$("#EditAddressGeneric #DistrictId option:selected").val(),t=$("#EditAddressGeneric #DistrictId option:selected").text();n==0&&t=="Diğer"?$("#EditAddressGeneric #DistrictId").removeAttr("general-required"):($("#EditAddressGeneric #DistrictId").attr("general-required","required"),$("#EditAddressGeneric #DistrictId").attr("data-error-message","Lütfen zorunlu alanları doldurunuz."))}function addValidationDistrictOnPendingOrder(n){var t=$(n+" #DistrictId option:selected").val(),i=$(n+" #DistrictId option:selected").text();t==0&&i=="Diğer"?$(n+" #DistrictId").removeAttr("general-required"):($(n+" #DistrictId").attr("general-required","required"),$(n+" #DistrictId").attr("data-error-message","Lütfen zorunlu alanları doldurunuz."))}function addValidationOnDistrictOnAdd(){var n=$("#AddAddressGeneric #DistrictId option:selected").val(),t=$("#AddAddressGeneric #DistrictId option:selected").text();n==0&&t=="Diğer"?$("#AddAddressGeneric #DistrictId").removeAttr("general-required"):($("#AddAddressGeneric #DistrictId").attr("general-required","required"),$("#AddAddressGeneric #DistrictId").attr("data-error-message","Lütfen zorunlu alanları doldurunuz."))}function resetValidationOnEdit(){$("#EditAddressGeneric div").removeClass("has-error");$("p").remove("#EditAddressGeneric .error-message")}function resetValidationOnAdd(){$("#AddAddressGeneric div").removeClass("has-error");$("p").remove("#AddAddressGeneric .error-message")}function ValidateLuhn(n){var t=parseInt(n.substring(n.length-1,n.length)),i=n.substring(0,n.length-1);return CalculateLuhn(i)==parseInt(t)?!0:!1}function CalculateLuhn(n){var r=0,u,f,e,t;for(i=0;i<n.length;i++)r+=parseInt(n.substring(i,i+1));for(u=[0,1,2,3,4,-4,-3,-2,-1,0],i=n.length-1;i>=0;i-=2)f=parseInt(n.substring(i,i+1)),e=u[f],r+=e;return t=r%10,t=10-t,t==10&&(t=0),t}function recCardAdd(){var t=$("#recCardNumber"),i=$("#cardHolderName"),r=$("#cardCvv"),u=$("#expireMonth"),f=$("#expireYear"),n="";if(t.val().length<15&&(n="Lütfen zorunlu alanları doldurunuz.",t.parent().addClass("has-error")),(u.val()===""||f.val()==="")&&(n="Lütfen zorunlu alanları doldurunuz.",u.parent().addClass("has-error"),f.parent().addClass("has-error")),r.val().length<3&&(n="Lütfen zorunlu alanları doldurunuz.",r.parent().addClass("has-error")),i.val().length<=0&&(n="Lütfen zorunlu alanları doldurunuz.",i.parent().addClass("has-error")),!(n.length>0)&&validLuhn!==!1){$(".order-overlay").show();var e=window.orderId(),o=$("#frmNewCreditCard").serialize(),s=o+"&recurringOrderId="+e;$.ajax({url:"/order/RecurringOrderAddCreditCard",type:"post",data:s,cache:!1,success:function(n){$(".order-overlay").hide();n.Status==="Error"?generalAlert(n.Messages[0],"BİLGİLENDİRME"):(generalAlert(n.Messages[0],"BİLGİLENDİRME"),httpService.getMethod(window.recurringOrderGetCards))}})}}var httpService=function(){var n={getMethod:function(n){$(".order-overlay").show();var t=window.orderId(),i={recurringOrderId:t};$.ajax({url:n,type:"get",cache:!1,data:i,success:function(n){window.recurringWizardObj.html(n);$(".order-overlay").hide()}})},getInstallmentTable:function(n,t){$(".order-overlay").show();var i=window.orderId(),r={recurringOrderId:i,customerCardId:t};$.ajax({url:n,type:"POST",cache:!1,data:r,success:function(n){$("#recurringInstallmentContainer").html(n);$("#installmentCount").val("");$(".order-overlay").hide()}})},getInstallmentTableOnLoad:function(n,t,i){$(".order-overlay").show();var r=i,u=window.orderId(),f={recurringOrderId:u,customerCardId:t};$.ajax({url:n,type:"POST",cache:!1,data:f,success:function(n){$("#recurringInstallmentContainer").html(n);$(".installment-item").each(function(){var n=$(this).attr("data-installmentCount");n===r&&$(this).addClass("selected")});$(".order-overlay").hide()}})},approvePost:function(t,i){$(".order-overlay").show();var r=i.orderId(),u={recurringOrderId:r};$.ajax({url:t,type:"post",cache:!1,data:u,success:function(t){$(".order-overlay").hide();t.Status==="Success"?n.callBack(i.recurringOrderGetCards,t,i):generalAlert(t.Messages[0],"BİLGİLENDİRME")}})},postMethod:function(t,i,r,u){$(".order-overlay").show();var f=i.orderId(),e=r+"&recurringOrderId="+f;$.ajax({url:t,type:"POST",cache:!1,data:e,success:function(t){n.callBack(u,t,i)}})},getOrderSummaryMethod:function(n,t){var i=t.orderId(),r={recurringOrderId:i};$.ajax({url:n,type:"POST",cache:!1,data:r,success:function(n){t.recurringWizardSummaryObj.html(n)}})},getRecurringAddressStepMethod:function(n,t){var i={recurringOrderId:window.orderId};$.ajax({url:n,type:"POST",cache:!1,data:i,success:function(n){t.html(n);addressAddEditDelete.addressSelectToggle(".selected-address-item",".address-list");addressAddEditDelete.selectAddressOnLoad(".selected-address-item",".address-item","#selectedBillingAddressId","#selectedShippingAddressId",".address-edit-button");addressAddEditDelete.selectAddressOnClick(".address-item",".address-wrapper",".selected-address-item","#selectedBillingAddressId","#selectedShippingAddressId",".address-edit-button",".address-select");addressAddEditDelete.selectShippingMethod(".selected-shipping-method",".shipping-method-list",".shipping-method","#selectedShippingOption",".shipping-name");formValidation.selectAddressType(".address-type",".tax",".institutional")}})},callBack:function(n,t,i){$(".order-overlay").hide();i.recurringOrderGetAddress===n&&t.Status==="Success"?(i.wizardCycleStepStatus=!0,httpService.getMethod(n,i)):i.recurringOrderGetProducts===n&&t.Status==="Success"?(i.wizardAddressStepStatus=!0,httpService.getMethod(n,i)):i.recurringOrderGetCards===n&&t.Status==="Success"?(i.wizardProductStepStatus=!0,httpService.getMethod(n,i)):i.recurringOrderGetSuccessPage===n&&t.Status==="Success"?(i.wizardPaymentStepStatus=!0,httpService.getMethod(n,i)):t.Status==="Error"&&generalAlert(t.Messages[0],"BİLGİLENDİRME")}};return n}(),wizardService=function(){return{getRecurringCycle:function(n){httpService.getMethod(n.recurringOrderGetCycleInfo,n)},getRecurringOrderSummary:function(n){httpService.getOrderSummaryMethod(n.recurringOrderGetSummary,n)},setRecurringCycle:function(n,t){httpService.postMethod(n.recurringOrderSetCycle,n,t,n.recurringOrderGetAddress)},setCreditCard:function(n,t){httpService.postMethod(n.recurringOrderSetPayment,n,t,n.recurringOrderGetSuccessPage)},setBillingAndShippingAddress:function(n,t){httpService.postMethod(n.recurringSetBillingAndShippingAddress,n,t,n.recurringOrderGetProducts)},recDeleteProduct:function(n,t){httpService.postMethod(n.recurringOrderRemoveProductVariant,n,t,n.recurringOrderGetProducts)},getCreditCardSettings:function(n){httpService.approvePost(n.recurringOrderApproveProducts,n)},getCreditCardSettingsOnClick:function(n){httpService.getMethod(n.recurringOrderGetCards,n)},getRcurringProducts:function(n){httpService.getMethod(n.recurringOrderGetProducts,n)},getAddressListOnClick:function(n){httpService.getMethod(n.recurringOrderGetAddress,n)}}}(),wizardController=function(){var n=this;n.wizardCycleStepStatus=!1;n.wizardAddressStepStatus=!1;n.wizardProductStepStatus=!1;n.wizardPaymentStepStatus=!1;n.recurringOrderGetCycleInfo="/order/RecurringOrderGetCycleInfo";n.recurringOrderGetAddress="/order/RecurringOrderGetAddress";n.recurringOrderSetCycle="/order/RecurringOrderSetCycle";n.recurringSetBillingAndShippingAddress="/order/RecurringOrderSetAddress";n.recurringOrderGetProducts="/order/RecurringOrderGetProducts";n.recurringOrderGetSummary="/order/RecurringOrderGetSummary";n.recurringOrderAddressList="/order/RecurringOrderAddressList";n.recurringWizardObj=$("#recurringWizardContent");n.recurringWizardSummaryObj=$("#orderSummaryWizard");n.recurringOrderRemoveProductVariant="/order/RecurringOrderRemoveProductVariant";n.recurringOrderGetCards="/order/RecurringOrderGetCards";n.recurringOrderSetPayment="/order/RecurringOrderSetPayment";n.recurringOrderGetSuccessPage="/order/recurringordercompleted";n.recurringOrderApproveProducts="/order/RecurringOrderApproveProducts ";n.recurringOrderGetInstallments="/order/RecurringOrderGetInstallments";n.dateTimePicker=function(n){$.datepicker.setDefaults($.datepicker.regional.tr);$(n).datepicker({minDate:"1",maxDate:"1 +3M"})};n.orderId=function(){return $("#recurringOrderIdInput").val()};n.setCycle=function(t){wizardService.setRecurringCycle(n,t)};n.getRecurringCycleHtml=function(){wizardService.getRecurringCycle(n)};n.setBillingAndShippingAddress=function(t){if($("#selectedBillingAddressId").val()==="0"||$("#selectedShippingAddressId").val()==="0")return generalAlert("Lütfen adres seçiniz.","BİLGİLENDİRME"),!1;wizardService.setBillingAndShippingAddress(n,t)};n.getRecurringOrderSummary=function(){wizardService.getRecurringOrderSummary(n)};n.setStepStatus=function(n){$(".wizard-step-item").each(function(){$(this).removeClass("active")});n.closest(".wizard-step-item").addClass("active")};n.setStepForWizardScreen=function(n){n.prevAll().removeClass("active").addClass("visited");n.nextAll().removeClass("active");n.nextAll().removeClass("visited");n.addClass("active")};n.getRecurringCycleHtmlOnClick=function(t){wizardService.getRecurringCycle(n);window.setStepStatus(t)};n.getCreditCardSettingsOnClick=function(t){wizardService.getCreditCardSettingsOnClick(n);window.setStepStatus(t)};n.getAddressListOnClick=function(t){wizardService.getAddressListOnClick(n);window.setStepStatus(t)};n.getRecurringCycleHtmlOnClickWizard=function(t){wizardService.getRecurringCycle(n);window.setStepStatus(t)};n.getAddressListOnClickWizard=function(t){window.wizardCycleStepStatus&&(wizardService.getAddressListOnClick(n),window.setStepStatus(t))};n.getRcurringProductsOnClickWizard=function(t){window.wizardAddressStepStatus&&(wizardService.getRcurringProducts(n),window.setStepStatus(t))};n.getCreditCardSettingsOnClickWizard=function(t){window.wizardProductStepStatus&&(wizardService.getCreditCardSettingsOnClick(n),window.setStepStatus(t))};n.getCreditCardSettings=function(){wizardService.getCreditCardSettings(n)};n.getRcurringProducts=function(t){wizardService.getRcurringProducts(n);window.setStepStatus(t)};n.setCreditCard=function(t){if($("#selectedCardId").val()==="0"||$("#recInstallmentCount").val()==="")return generalAlert("Devam edebilmeniz için lütfen kredi kartı ekleyiniz.","BİLGİLENDİRME"),!1;wizardService.setCreditCard(n,t)};n.recDeleteProduct=function(t){var r=$(t).attr("data-pid"),u="recurringOrderProductVariantId="+r+"",i="",f=t.attr("class"),e=$("."+f).length;i=e===1?"Ürünü silmeniz durumunda bu ürünün tekrarlı siparişi iptal olacaktır.  <br/>Bu ürünü silmek istediğinize emin misiniz?":"Bu ürünü silmek istediğinize emin misiniz?";confirmModal(i,"deleteRecProduct","Ürünü Sil","BİLGİLENDİRME");$("#deleteRecProduct").on("click",function(){$.fancybox.close();wizardService.recDeleteProduct(n,u)})};n.toggleRecSavedCards=function(n){n.closest(".recurring-card-list").find(".rec-card-list-wrapper").slideToggle();var t=n.attr("data-value");window.setSelectedCard(t)};n.setSelectedCard=function(n){var t=$(".rec-card-item");$.each(t,function(){var t=$(this).attr("data-value");t===n&&$(this).addClass("selected")})};n.selectRecCard=function(n,t){var u=n.html(),i=n.closest(".recurring-card-list").find(".rec-selected-card"),r=n.attr("data-value");i.html(u);i.attr("data-value",r);$("#selectedCardId").attr("value",r);$(".rec-card-item").each(function(){$(this).removeClass("selected")});n.addClass("selected");n.closest(".rec-card-list-wrapper").slideUp();httpService.getInstallmentTable(window.recurringOrderGetInstallments,t)}}(),addressAddEditDelete=function(){return{addressSelectToggle:function(n,t){$(n).on("click",function(){if($(this).parent().find(".address-item").length>1){var n=$(this).parent().find(t);n.slideToggle()}})},selectAddressOnLoad:function(n,t,i,r,u){$(n).addClass("has-bg");var f,e,o,s=0;$(n).each(function(){$(this).hasClass("selected-shipping")?o=$(this).data("value"):$(this).hasClass("selected-billing")&&(e=$(this).data("value"))});$(t).each(function(){s++;f=$(this).data("value");adressType=$(this).data("type");f===e&&adressType=="billing"&&$(this).addClass("selected");f===o&&adressType=="shipping"&&$(this).addClass("selected")});$(u).each(function(){$(this).attr("data-addressedit",$(this).parents(".address-select").find(n).attr("data-value"))})},selectAddressOnClick:function(n,t,i,r,u,f,e,o=false,s=false){var h=window.location.href.toLowerCase();$(n).on("click",function(){var s=$(this).closest(t).find(i),l=$(this).closest(e).find(f),a=$(this).html(),c=$(this).attr("data-value"),v=$(this).attr("data-valid");s.html(a);s.attr("data-value",c);s.attr("data-valid",v);$(this).parent().find(n).removeClass("selected");$(this).addClass("selected");o||$(this).parent().slideToggle();l.attr("data-addressedit",c);s.hasClass("selected-shipping")===!0?$(u).val(c):$(r).val(c);h.includes("/customer/recurringordersedit")||showHideAgtAreaByDataSet();$.post("CheckoutSelectBillingAndShippingAddressAjax",$("#ShippingOptionAndAddressSelectForm").serialize())});o&&s&&$(`.shipping-address-wrapper .address-item[data-value="${$(".selected-billing").attr("data-value")}"]`).trigger("click")},selectShippingMethod:function(n,t,i,r,u){var f=$(n).attr("data-value");$(r).val(f);$(n).parent().mouseenter(function(){$(this).parent().find(t).stop(!0,!1).slideDown()});$(n).parent().mouseleave(function(){$(this).parent().find(t).stop(!0,!1).slideUp()});$(i).on("click",function(){var n=$(this).attr("data-value"),t=$(this).attr("data-cargo"),i=$(this).text();$(r).val(n);$(u).text(i);$(this).parent().slideUp();t==="Aras Kargo"?($(".aras-kargo").show(),$(".yk-kargo").hide()):($(".yk-kargo").show(),$(".aras-kargo").hide())})},getAddressList:function(n,t,i,r,u,f=false){var e=window.location.href.toLowerCase(),o="/checkout/addresslist",s=!1;u&&(s=!0);r!==""&&r!==undefined&&(o=r);$.ajax({cache:!1,type:"POST",url:o,success:function(r){$(t).slideUp();$(n).html(r);$(i).slideDown();e.includes("/checkout/billingaddress")&&($("#selectedShippingAddressId").val($(".selected-address-item.selected-shipping").attr("data-value")),$("#selectedBillingAddressId").val($(".selected-address-item.selected-billing").attr("data-value")));addressAddEditDelete.addressSelectToggle(".selected-address-item",".address-list");addressAddEditDelete.selectAddressOnLoad(".selected-address-item",".address-item","#selectedBillingAddressId","#selectedShippingAddressId",".address-edit-button");addressAddEditDelete.selectAddressOnClick(".address-item",".address-wrapper",".selected-address-item","#selectedBillingAddressId","#selectedShippingAddressId",".address-edit-button",".address-select",s,f);$("#AddressEditButtonShipping").on("click",function(){reAssingAddressBillingAndShippingEdit(!0,"Teslimat Adresini Düzenle")});$("#AddressEditButtonBilling").on("click",function(){reAssingAddressBillingAndShippingEdit(!1,"Fatura Adresini Düzenle")});e.includes("/customer/recurringordersedit")||showHideAgtAreaByDataSet()}})},formPost:function(n,t){var i=$(t).serialize();$.ajax({cache:!1,type:"POST",data:i,url:n,success:function(){addressAddEditDelete.getAddressList(".address-list-wrapper",".address-add-wrapper",".checkout-address-list");addressAddEditDelete.selectAddressOnLoad(".selected-address-item",".address-item","#selectedBillingAddressId","#selectedShippingAddressId",".address-edit-button");addressAddEditDelete.selectAddressOnClick(".address-item",".address-wrapper",".selected-address-item","#selectedBillingAddressId","#selectedShippingAddressId",".address-edit-button",".address-select");$(".create-or-update").find(".form-control").each(function(){$(this).attr("data-inputType")!=="Email"&&$(this).val("")});stylishForm(".form-control",".control-group",".animated-label")}})},formAjaxPost:function(n,t,i,r){var u=$(t).serialize();$.ajax({cache:!1,type:"POST",data:u,url:n,success:function(n){n.Status==="Success"?(i&&i==1?(addressAddEditDelete.getAddressList(".address-list-wrapper",".address-add-wrapper",".checkout-address-list",r),generalAlert("Adresiniz başarılı bir şekilde eklenmiştir.","BİLGİLENDİRME")):addressAddEditDelete.getAddressList(".address-list-wrapper",".address-add-wrapper",".checkout-address-list"),addressAddEditDelete.selectAddressOnLoad(".selected-address-item",".address-item","#selectedBillingAddressId","#selectedShippingAddressId",".address-edit-button"),addressAddEditDelete.selectAddressOnClick(".address-item",".address-wrapper",".selected-address-item","#selectedBillingAddressId","#selectedShippingAddressId",".address-edit-button",".address-select"),$(".create-or-update").find(".form-control").each(function(){$(this).attr("data-inputType")!=="Email"&&$(this).val("")}),stylishForm(".form-control",".control-group",".animated-label")):generalAlert(n.Messages[0],"BİLGİLENDİRME")}})},formAjaxPostRecurringOrder:function(n,t){var i=$(t).serialize();$.ajax({cache:!1,type:"POST",data:i,url:n,success:function(n){n.Status==="Success"?(addressAddEditDelete.getAddressList(".address-list-wrapper",".address-add-wrapper",".checkout-address-list"),addressAddEditDelete.selectAddressOnLoad(".selected-address-item",".address-item","#selectedBillingAddressId","#selectedShippingAddressId",".address-edit-button"),addressAddEditDelete.selectAddressOnClick(".address-item",".address-wrapper",".selected-address-item","#selectedBillingAddressId","#selectedShippingAddressId",".address-edit-button",".address-select"),$(".create-or-update").find(".form-control").each(function(){$(this).attr("data-inputType")!=="Email"&&$(this).val("")}),stylishForm(".form-control",".control-group",".animated-label")):generalAlert(n.Messages[0],"BİLGİLENDİRME")}})},formAjaxPostForCustomerPages:function(n,t){var i=$(t).serialize();$.ajax({cache:!1,type:"POST",data:i,url:n,success:function(n){n.Status==="Success"?(generalAlert(n.Messages[0],"BİLGİLENDİRME"),location.href="/customer/addresses"):generalAlert(n.Messages[0],"BİLGİLENDİRME")}})},addressFormOpenPopup:function(n,t,i,r){$(n).on("click",function(){var n=$(".control-group").each(function(){var n=$(".error-message");if(n.length>0)return!0});n&&$(".error-message").each(function(){$(this).remove()});$.fancybox({closeClick:!1,content:$(t),width:"660",padding:0,margin:0,helpers:{overlay:{closeClick:!1}},afterClose:function(){$(t).attr("data-popup","false")}});$(t).attr("data-popup","true");$(i).text(r)})},addressEdit:function(n){$(n).on("click",function(){var t=$(this).attr("data-addressedit"),i=t;$(".address-id").val(t);addressAddEditDelete.addressFormOpenPopup($(n),".address-add-wrapper",".popup-text","Adres Düzenle");$(".form-control").each(function(){$(this).attr("data-inputType")!=="Email"&&$(this).val("")});$.ajax({type:"POST",cache:!1,url:"/checkout/addressedit?id="+i,success:function(n){formValidation.getCityCountiesOnLoadEditForm(n.CityId,$("select[data-inputtype*='CountyId']"),n.CountyId);$("input.form-control, textarea.form-control,select.form-control").each(function(){var t=$(this).attr("data-inputtype"),i=$(this);$.each(n,function(n,r){t===n&&i.val(r)});stylishForm(".form-control",".control-group",".animated-label")});formValidation.getCityCountiesDistincsOnLoadEditForm(n.CountyId,$("select[data-inputtype*='DistrictId']"),n.DistrictId);$("input.form-control, textarea.form-control,select.form-control").each(function(){var t=$(this).attr("data-inputtype"),i=$(this);$.each(n,function(n,r){t===n&&i.val(r)});stylishForm(".form-control",".control-group",".animated-label")});phoneNumberMask($(".phoneMask"));n.IsCorporate&&$("#corporateAddressLink").click()}})})}}}(),addressUrls,formValidation,addressData,addAddressFirstRun,selectedMethodOnLoad,validLuhn,creditCardLuhnCheck;$(function(){addressAddEditDelete.addressSelectToggle(".selected-address-item",".address-list");addressAddEditDelete.selectAddressOnLoad(".selected-address-item",".address-item","#selectedBillingAddressId","#selectedShippingAddressId",".address-edit-button");addressAddEditDelete.selectAddressOnClick(".address-item",".address-wrapper",".selected-address-item","#selectedBillingAddressId","#selectedShippingAddressId",".address-edit-button",".address-select");addressAddEditDelete.selectShippingMethod(".selected-shipping-method",".shipping-method-list",".shipping-method","#selectedShippingOption",".shipping-name")}),function(){"use strict";var r;if(typeof window!="undefined"&&window.addEventListener){var n=Object.create(null),u,f,t=function(){clearTimeout(f);f=setTimeout(u,100)},i=function(){return},o=function(){var n;window.addEventListener("resize",t,!1);window.addEventListener("orientationchange",t,!1);window.MutationObserver?(n=new MutationObserver(t),n.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),i=function(){try{n.disconnect();window.removeEventListener("resize",t,!1);window.removeEventListener("orientationchange",t,!1)}catch(i){}}):(document.documentElement.addEventListener("DOMSubtreeModified",t,!1),i=function(){document.documentElement.removeEventListener("DOMSubtreeModified",t,!1);window.removeEventListener("resize",t,!1);window.removeEventListener("orientationchange",t,!1)})},s=function(n){function r(n){var t;return n.protocol!==undefined?t=n:(t=document.createElement("a"),t.href=n),t.protocol.replace(/:/g,"")+t.host}var t,u,i;return window.XMLHttpRequest&&(t=new XMLHttpRequest,u=r(location),i=r(n),t=t.withCredentials===undefined&&i!==""&&i!==u?XDomainRequest||undefined:XMLHttpRequest),t},e="http://www.w3.org/1999/xlink";u=function(){function w(){a-=1;a===0&&(i(),o())}function k(t){return function(){n[t.base]!==!0&&(t.useEl.setAttributeNS(e,"xlink:href","#"+t.hash),t.useEl.hasAttribute("href")&&t.useEl.setAttribute("href","#"+t.hash))}}function g(n){return function(){var i=document.body,r=document.createElement("x"),t;n.onload=null;r.innerHTML=n.responseText;t=r.getElementsByTagName("svg")[0];t&&(t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.width=0,t.style.height=0,t.style.overflow="hidden",i.insertBefore(t,i.firstChild));w()}}function d(n){return function(){n.onerror=null;n.ontimeout=null;w()}}var t,h,b="",c,l,u,a=0,v,y,p,f,r;for(i(),f=document.getElementsByTagName("use"),u=0;u<f.length;u+=1){try{h=f[u].getBoundingClientRect()}catch(nt){h=!1}l=f[u].getAttribute("href")||f[u].getAttributeNS(e,"href")||f[u].getAttribute("xlink:href");p=l&&l.split?l.split("#"):["",""];t=p[0];c=p[1];v=h&&h.left===0&&h.right===0&&h.top===0&&h.bottom===0;h&&h.width===0&&h.height===0&&!v?(b&&!t.length&&c&&!document.getElementById(c)&&(t=b),f[u].hasAttribute("href")&&f[u].setAttributeNS(e,"xlink:href",l),t.length&&(r=n[t],r!==!0&&setTimeout(k({useEl:f[u],base:t,hash:c}),0),r===undefined&&(y=s(t),y!==undefined&&(r=new y,n[t]=r,r.onload=g(r),r.onerror=d(r),r.ontimeout=d(r),r.open("GET",t),r.send(),a+=1)))):v?t.length&&n[t]&&setTimeout(k({useEl:f[u],base:t,hash:c}),0):n[t]===undefined?n[t]=!0:n[t].onload&&(n[t].abort(),delete n[t].onload,n[t]=!0)}f="";a+=1;w()};r=function(){window.removeEventListener("load",r,!1);f=setTimeout(u,0)};document.readyState!=="complete"?window.addEventListener("load",r,!1):r()}}();addressUrls={GetCityCountiesByCityId:"/Country/GetCityCountiesByCityId",GetCityCountyDistrictsByCityCountyId:"/Country/GetAgtCityCountyDistrictsByCityCountyId"};formValidation=function(){return{selectAddressType:function(n,t,i){$(n).on("click",function(){var r=$(this).attr("data-institutional"),u;$(n).removeClass("selected");$(this).addClass("selected");r==="institutional"?($(t).each(function(){$(this).hasClass("tax-office")&&$(this).attr("general-required","required").attr("data-error-message","Lütfen bağlı olduğunuz vergi dairesini giriniz.");$(this).hasClass("tax-number")&&$(this).attr("general-required","required").attr("data-error-message","Lütfen vergi numaranızı giriniz.");var n=$("#IsCorporate").val(!0)}),$(i).slideDown()):($(t).each(function(){$(this).removeAttr("general-required").removeAttr("data-error-message");$(i).slideUp()}),$(".tax-number").val(""),u=$("#IsCorporate").val(!1))})},getCity:function(n){$.ajax({cache:!1,type:"POST",url:"/Country/GetCitiesByCountryId",data:{countryId:77,addEmptyCityIfRequired:"true"},success:function(t){$(n).html("");$(n).append("<option value='0' selected='selected'>İl (*)<\/option>");for(var i=0;i<t.length;i++)$(n).append("<option value='"+t[i].id+"'>"+t[i].name+"<\/option>");formValidation.getCityCountiesOnChangeCountry(n,".select-counties")}})},getCityCountiesOnChangeCountry:function(n,t){var i;$(n).on("change",function(){i=$(this).val();$.ajax({cache:!1,type:"POST",url:addressUrls.GetCityCountiesByCityId,data:{cityId:i,addEmptyCityCountyIfRequired:!0},success:function(n){$(t).html("");$(t).append("<option value='0' selected='selected'>İlçe (*)<\/option>");for(var i=0;i<n.length;i++)$(t).append("<option value='"+n[i].id+"'>"+n[i].name+"<\/option>")}})})},getCityCountiesOnLoadEditForm:function(n,t,i){$.ajax({cache:!1,type:"POST",url:addressUrls.GetCityCountiesByCityId,data:{cityId:n,addEmptyCityCountyIfRequired:!0},success:function(n){$(t).html("");$(t).append("<option value='0' selected='selected'>İlçe<\/option>");for(var r=0;r<n.length;r++)$(t).append("<option value='"+n[r].id+"'>"+n[r].name+"<\/option>");t.val(i)}})},getCityCountiesDistincsOnLoadEditForm:function(n,t,i){$.ajax({cache:!1,type:"POST",url:addressUrls.GetCityCountyDistrictsByCityCountyId,data:{cityCountyId:n,addEmptyCityCountyDistrictIfRequired:"true"},success:function(n){$(t).html("");$(t).append("<option value='0' selected='selected'>Semt / Mahalle<\/option>");for(var r=0;r<n.length;r++)$(t).append("<option value='"+n[r].id+"'>"+n[r].name+"<\/option>");t.val(i);addValidationOnDistrict()}})},validateOnSubmit:function(n,t){$(n).submit(function(){var f=$(n).parent().attr("data-popup"),u=$(this).find(t),r="",i;if(r=$(n).attr("data-posturl")!=="string"?$(n).attr("data-posturl"):$(n).attr("action"),f==="true"){if(u.each(function(){var i=$(this).attr("general-required"),n=$(this).val(),t;i==="required"&&n<=0?(t=$(this).attr("data-error-message"),$(this).parent().find(".error-message").length<=0&&($(this).parent().append("<p class='error-message'>"+t+"<\/p>"),$(this).parent().addClass("has-error"))):n<=0&&$(this).parent().find(".error-message").length>0&&($(this).parent().find("error-message").remove(),$(this).parent().removeClass("has-error"))}),$(".error-message").length>0)return!1;generalAlertInfo("Adresiniz ekleniyor. Lütfen bekleyiniz...","BİLGİLENDİRME");addressAddEditDelete.formPost(r,n)}else{if(i="",u.each(function(){var t=$(this).attr("general-required"),r=$(this).val(),n;t==="required"&&r<=0&&(n=$(this).attr("data-error-message"),$(this).parent().addClass("has-error"),i=n+"<br/>")}),i.length>0)return generalAlert(i,"BİLGİLENDİRME"),!1;generalAlertInfo("Adresiniz ekleniyor. Lütfen bekleyiniz...","BİLGİLENDİRME");addressAddEditDelete.formPost(r,n)}});$(t).on("change",function(){var n=$(this).val();n.length>0&&($(this).parent().find(".error-message").remove(),$(this).parent().removeClass("has-error"))})},validateAjaxFormPost:function(n,t,i,r,u){$(i).on("click",function(){var o=$(n).parent().attr("data-popup"),e=$(n).find(t),f="",i;if(f=typeof $(n).attr("data-posturl")!="undefined"?$(n).attr("data-posturl"):$(n).attr("action"),o==="true"){if(e.each(function(){var i=$(this).attr("general-required"),n=$(this).val(),t;i==="required"&&n<=0?(t=$(this).attr("data-error-message"),$(this).parent().find(".error-message").length<=0&&($(this).parent().append("<p class='error-message'>"+t+"<\/p>"),$(this).parent().addClass("has-error"))):n<=0&&$(this).parent().find(".error-message").length>0&&($(this).parent().find("error-message").remove(),$(this).parent().removeClass("has-error"))}),$(".error-message").length>0)return!1;generalAlertInfo("Adresiniz ekleniyor. Lütfen bekleyiniz...","BİLGİLENDİRME");addressAddEditDelete.formAjaxPost(f,n,r,u)}else{if(i="",e.each(function(){var t=$(this).attr("general-required"),r=$(this).val(),n;t==="required"&&r<=0&&(n=$(this).attr("data-error-message"),i=n+"<br/>",$(this).parent().addClass("has-error"))}),i.length>0)return generalAlert(i,"BİLGİLENDİRME"),!1;generalAlertInfo("Adresiniz ekleniyor. Lütfen bekleyiniz...","BİLGİLENDİRME");addressAddEditDelete.formAjaxPost(f,n)}});$(t).on("change",function(){var n=$(this).val();n.length>0&&($(this).parent().find(".error-message").remove(),$(this).parent().removeClass("has-error"))})},validateAjaxFormPostForCustomerPage:function(n,t,i){$(i).on("click",function(){var u=!1,r;$(this).attr("id")==="AddAddressButton"&&(u=!0,$(i).attr("disabled","disabled"));var o=$(n).attr("data-popup"),e=$(n).find(t),f="";if(f=$(n).attr("data-posturl")!=="string"?$(n).attr("data-posturl"):$(n).attr("action"),o==="true"){if(e.each(function(){var r=$(this).attr("general-required"),n=$(this).val(),t,i;r==="required"&&n<=0?(t=$(this).attr("data-error-message"),$(this).parent().find(".error-message").length<=0&&($(this).parent().append("<p class='error-message'>"+t+"<\/p>"),$(this).parent().addClass("has-error"))):$(this).attr("name")==="Email"?(i=new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/),i.test($(this).val())||($(this).parent().find(".error-message").remove(),$(this).parent().removeClass("has-error"),$(this).parent().append("<p class='error-message'>Lütfen email adresinizi doğru formatta giriniz.<\/p>"),$(this).parent().addClass("has-error"))):n<=0&&$(this).parent().find(".error-message").length>0&&($(this).parent().find("error-message").remove(),$(this).parent().removeClass("has-error"))}),$(".error-message").length>0)return $(i).removeAttr("disabled"),!1;generalAlertInfo("Adresiniz ekleniyor. Lütfen bekleyiniz...","BİLGİLENDİRME");addAddressAjax(f,n,u,i)}else{if(r="",e.each(function(){var i=$(this).attr("general-required"),u=$(this).val(),t,n;i==="required"&&u<=0&&(n=$(this).attr("data-error-message"),r=n+"<br/>",$(this).parent().addClass("has-error"));$(this).attr("name")==="Email"&&(t=new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/),t.test($(this).val())||(n="E-mail adresinizi doğru formatta giriniz.",r=n+"<br/>",$(this).parent().addClass("has-error")))}),r.length>0)return generalAlert(r,"BİLGİLENDİRME"),$(i).removeAttr("disabled"),!1;generalAlertInfo("Adresiniz ekleniyor. Lütfen bekleyiniz...","BİLGİLENDİRME");addAddressAjax(f,n,u,i)}});$(t).on("change",function(){var n=$(this).val();n.length>0&&($(this).parent().find(".error-message").remove(),$(this).parent().removeClass("has-error"))})},validateAjaxFormPostForPendingEdit:function(n,t,i){$(i).on("click",function(){var u=$(n).find(t),r="",i;if(r=$(n).attr("data-posturl")!=="string"?$(n).attr("data-posturl"):$(n).attr("action"),i="",u.each(function(){var t=$(this).attr("general-required"),r=$(this).val(),n;t==="required"&&r<=0&&(n=$(this).attr("data-error-message"),i=n+"<br/>",$(this).parent().addClass("has-error"))}),i.length>0)return generalAlert(i,"BİLGİLENDİRME"),!1;generalAlertInfo("Adresiniz düzenleniyor. Lütfen bekleyiniz...","BİLGİLENDİRME");addAddressAjax(r,n)});$(t).on("change",function(){var n=$(this).val();n.length>0&&($(this).parent().find(".error-message").remove(),$(this).parent().removeClass("has-error"))})}}}();$(function(){$(".country-id-select").val("77");formValidation.selectAddressType(".address-type",".tax",".institutional");formValidation.getCityCountiesOnChangeCountry($(".select-city"),".select-counties")});addressData={id:0,addressType:0,addressTitle:"",name:"",surname:"",mobilePhoneNumber:"",emailAddress:"",addressLine1:"",cityId:0,cityCountyId:0,cityCountyDistrictId:0,taxOffice:"",taxNumber:""};addAddressFirstRun=!0;String.prototype.endsWith||(String.prototype.endsWith=function(n,t){var i=this.toString(),r;return(typeof t!="number"||!isFinite(t)||Math.floor(t)!==t||t>i.length)&&(t=i.length),t-=n.length,r=i.lastIndexOf(n,t),r!==-1&&r===t});String.prototype.includes||(String.prototype.includes=function(n,t){return typeof t!="number"&&(t=0),t+n.length>this.length?!1:this.indexOf(n,t)!==-1});$("#EditAddressGeneric #DistrictId").change(function(){var n=$("#EditAddressGeneric #DistrictId option:selected").val(),t=$("#EditAddressGeneric #DistrictId option:selected").text();n==0&&t=="Diğer"?$("#EditAddressGeneric #DistrictId").removeAttr("general-required"):($("#EditAddressGeneric #DistrictId").attr("general-required","required"),$("#EditAddressGeneric #DistrictId").attr("data-error-message","Lütfen zorunlu alanları doldurunuz."))});$(document).on("change","#PendingOrderBillingAddressEdit #DistrictId",function(){var n=$("#PendingOrderBillingAddressEdit #DistrictId option:selected").val(),t=$("#PendingOrderBillingAddressEdit #DistrictId option:selected").text();n==0&&t=="Diğer"?$("#PendingOrderBillingAddressEdit #DistrictId").removeAttr("general-required"):($("#PendingOrderBillingAddressEdit #DistrictId").attr("general-required","required"),$("#PendingOrderBillingAddressEdit #DistrictId").attr("data-error-message","Lütfen zorunlu alanları doldurunuz."))});$(document).on("change","#PendingOrderShippingAddressEdit #DistrictId",function(){var n=$("#PendingOrderShippingAddressEdit #DistrictId option:selected").val(),t=$("#PendingOrderShippingAddressEdit #DistrictId option:selected").text();n==0&&t=="Diğer"?$("#PendingOrderShippingAddressEdit #DistrictId").removeAttr("general-required"):($("#PendingOrderShippingAddressEdit #DistrictId").attr("general-required","required"),$("#PendingOrderShippingAddressEdit #DistrictId").attr("data-error-message","Lütfen zorunlu alanları doldurunuz."))});$("#AddAddressGeneric #DistrictId").change(function(){var n=$("#AddAddressGeneric #DistrictId option:selected").val(),t=$("#AddAddressGeneric #DistrictId option:selected").text();n==0&&t=="Diğer"?$("#AddAddressGeneric #DistrictId").removeAttr("general-required"):($("#AddAddressGeneric #DistrictId").attr("general-required","required"),$("#AddAddressGeneric #DistrictId").attr("data-error-message","Lütfen zorunlu alanları doldurunuz."))});selectedMethodOnLoad=$("#payment-method-type").val();validLuhn=!1;creditCardLuhnCheck=function(n){if(n&&n.val().length>15){var t=n.val().replace(/ /g,"");validLuhn=!1;t.length===15&&(t.substring(0,2)==="37"||t.substring(0,2)==="34")&&(validLuhn=ValidateLuhn(t));t.length===16&&t.substring(0,1)==="4"&&(validLuhn=ValidateLuhn(t));t.length===16&&t.substring(0,1)==="5"&&(validLuhn=ValidateLuhn(t));validLuhn||n.val().length===16&&generalAlert("Kart numaranız hatalı lütfen düzelterek tekrar deneyin.","BİLGİLENDİRME")}return};var inputOnChangeRemoveError=function(n){n.val()&&n.val().length>0&&n.parent().removeClass("has-error")},recAddNewCreditCardOpenPopupOnClick=function(){$.fancybox({closeClick:!1,content:$(".add-new-card"),width:"660",padding:0,margin:0,helpers:{overlay:{closeClick:!1}}})},selectInstallmentRec=function(n,t){n.find("input").prop("checked",!0);$("#recInstallmentCount").val(t);var i=n.find(".payment_taksit_monthly").text(),r=n.find(".payment_taksit_total").text(),u=n.find(".payment_taksit_title").text();$(".selected-installment").text(u);$(".selected-monthly-price").text(i);$(".selected-total-price").text(r);n.parent().find(".installment-item").each(function(){$(this).removeClass("selected")});n.addClass("selected");$(".installment-list").slideToggle()},toggleInstallmentList=function(){$(".installment-list").slideToggle()}