"use strict";var KTWizard2=function(){var _wizardEl;var _formEl;var _wizardObj;var _validations=[];var _initWizard=function(){_wizardObj=new KTWizard(_wizardEl,{startStep:1,clickableSteps:false});_wizardObj.on('change',function(wizard){if(wizard.getStep()>wizard.getNewStep()){return;}
var validator=_validations[wizard.getStep()-1];if(validator){validator.validate().then(function(status){if(status=='Valid'){wizard.goTo(wizard.getNewStep());KTUtil.scrollTop();}else{Swal.fire({text:"Sorry, looks like there are some errors detected, please try again.",icon:"error",buttonsStyling:false,confirmButtonText:"Ok, got it!",customClass:{confirmButton:"btn font-weight-bold btn-light"}}).then(function(){KTUtil.scrollTop();});}});}
return false;});_wizardObj.on('changed',function(wizard){KTUtil.scrollTop();});_wizardObj.on('submit',function(wizard){Swal.fire({text:"All is good! Please confirm the form submission.",icon:"success",showCancelButton:true,buttonsStyling:false,confirmButtonText:"Yes, submit!",cancelButtonText:"No, cancel",customClass:{confirmButton:"btn font-weight-bold btn-primary",cancelButton:"btn font-weight-bold btn-default"}}).then(function(result){if(result.value){_formEl.submit();}else if(result.dismiss==='cancel'){Swal.fire({text:"Your form has not been submitted!.",icon:"error",buttonsStyling:false,confirmButtonText:"Ok, got it!",customClass:{confirmButton:"btn font-weight-bold btn-primary",}});}});});}
var _initValidation=function(){_validations.push(FormValidation.formValidation(_formEl,{fields:{fname:{validators:{notEmpty:{message:'First name is required'}}},lname:{validators:{notEmpty:{message:'Last Name is required'}}},phone:{validators:{notEmpty:{message:'Phone is required'}}},email:{validators:{notEmpty:{message:'Email is required'},emailAddress:{message:'The value is not a valid email address'}}}},plugins:{trigger:new FormValidation.plugins.Trigger(),bootstrap:new FormValidation.plugins.Bootstrap({eleValidClass:'',})}}));_validations.push(FormValidation.formValidation(_formEl,{fields:{address1:{validators:{notEmpty:{message:'Address is required'}}},postcode:{validators:{notEmpty:{message:'Postcode is required'}}},city:{validators:{notEmpty:{message:'City is required'}}},state:{validators:{notEmpty:{message:'State is required'}}},country:{validators:{notEmpty:{message:'Country is required'}}}},plugins:{trigger:new FormValidation.plugins.Trigger(),bootstrap:new FormValidation.plugins.Bootstrap({eleValidClass:'',})}}));_validations.push(FormValidation.formValidation(_formEl,{fields:{delivery:{validators:{notEmpty:{message:'Delivery type is required'}}},packaging:{validators:{notEmpty:{message:'Packaging type is required'}}},preferreddelivery:{validators:{notEmpty:{message:'Preferred delivery window is required'}}}},plugins:{trigger:new FormValidation.plugins.Trigger(),bootstrap:new FormValidation.plugins.Bootstrap({eleValidClass:'',})}}));_validations.push(FormValidation.formValidation(_formEl,{fields:{locaddress1:{validators:{notEmpty:{message:'Address is required'}}},locpostcode:{validators:{notEmpty:{message:'Postcode is required'}}},loccity:{validators:{notEmpty:{message:'City is required'}}},locstate:{validators:{notEmpty:{message:'State is required'}}},loccountry:{validators:{notEmpty:{message:'Country is required'}}}},plugins:{trigger:new FormValidation.plugins.Trigger(),bootstrap:new FormValidation.plugins.Bootstrap({eleValidClass:'',})}}));_validations.push(FormValidation.formValidation(_formEl,{fields:{ccname:{validators:{notEmpty:{message:'Credit card name is required'}}},ccnumber:{validators:{notEmpty:{message:'Credit card number is required'},creditCard:{message:'The credit card number is not valid'}}},ccmonth:{validators:{notEmpty:{message:'Credit card month is required'}}},ccyear:{validators:{notEmpty:{message:'Credit card year is required'}}},cccvv:{validators:{notEmpty:{message:'Credit card CVV is required'},digits:{message:'The CVV value is not valid. Only numbers is allowed'}}}},plugins:{trigger:new FormValidation.plugins.Trigger(),bootstrap:new FormValidation.plugins.Bootstrap({eleValidClass:'',})}}));}
return{init:function(){_wizardEl=KTUtil.getById('kt_wizard');_formEl=KTUtil.getById('kt_form');_initWizard();_initValidation();}};}();jQuery(document).ready(function(){KTWizard2.init();});