import{S as n,P as M,M as r,T as o,X as d,W as a,V as l,K as E,Z as L,r as b,l as v,B as N,L as k,b as g,U as m}from"./vendor-bSWkQivH.js";import{e as P,h as x,aj as F,c3 as R,i as j}from"./index-Dqv5IkpS.js";const q={};function H(i,y){const p=n("VcButton"),_=n("VcModal");return r(),M(_,{variant:"success",title:i.$t("shared.account.checkout_default_success_modal.title"),icon:"apply"},{actions:o(({close:h})=>[l(p,{class:"mx-auto",onClick:h},{default:o(()=>[d(a(i.$t("shared.account.checkout_default_success_modal.ok_button")),1)]),_:2},1032,["onClick"])]),default:o(()=>[d(" "+a(i.$t("shared.account.checkout_default_success_modal.message")),1)]),_:1},8,["title"])}const K=P(q,[["render",H]]),X={key:1,class:"flex flex-col lg:w-1/2"},Z={class:"font-bold"},A={class:"mt-3 flex flex-col space-y-5 md:mt-1 md:flex-row md:space-x-7 md:space-y-0"},G={class:"flex items-center gap-3 p-3 text-sm"},J={class:"flex items-center gap-3 p-3 text-sm"},O={class:"flex items-center gap-3 p-3 text-sm"},Q={class:"flex items-center gap-3 p-3 text-sm"},te=E({__name:"checkout-defaults",setup(i){const{t:y}=L(),{openModal:p}=x(),{loading:_,availableShippingMethods:h,availablePaymentMethods:C,forceFetch:U}=F(),{getUserCheckoutDefaults:B,setUserCheckoutDefaults:z}=R();j({title:y("pages.account.checkout_defaults.meta.title")});const f=b(B()),s=b(v.clone(f.value)),D=N(()=>!v.isEqual(f.value,s.value));function w(){z(s.value),f.value=v.clone(s.value),p({component:K})}return U(),(t,c)=>{const S=n("VcTypography"),T=n("VcLoaderWithText"),V=n("VcRadioButton"),u=n("VcImage"),$=n("VcSelect"),I=n("VcButton"),W=n("VcWidget");return r(),k("div",null,[l(S,{tag:"h1"},{default:o(()=>[d(a(t.$t("pages.account.checkout_defaults.title")),1)]),_:1}),l(W,{size:"lg"},{default:o(()=>[g(_)?(r(),M(T,{key:0})):(r(),k("div",X,[m("div",Z,a(t.$t("pages.account.checkout_defaults.select_delivery_method_label")),1),m("div",A,[l(V,{modelValue:s.value.deliveryMethod,"onUpdate:modelValue":c[0]||(c[0]=e=>s.value.deliveryMethod=e),value:"shipping",label:t.$t("pages.account.checkout_defaults.shipping_radio_label")},null,8,["modelValue","label"]),l(V,{modelValue:s.value.deliveryMethod,"onUpdate:modelValue":c[1]||(c[1]=e=>s.value.deliveryMethod=e),value:"pickup",label:t.$t("pages.account.checkout_defaults.pickup_radio_label")},null,8,["modelValue","label"])]),l($,{modelValue:s.value.paymentMethodCode,"onUpdate:modelValue":c[2]||(c[2]=e=>s.value.paymentMethodCode=e),items:g(C),label:t.$t("pages.account.checkout_defaults.payment_method_label"),"value-field":"code",class:"mt-8 w-full",size:"auto"},{placeholder:o(()=>[m("div",G,[l(u,{alt:t.$t("common.placeholders.select_payment_method"),class:"size-12 rounded-sm bg-neutral-100",src:"select-payment.svg"},null,8,["alt"]),d(" "+a(t.$t("common.placeholders.select_payment_method")),1)])]),selected:o(({item:e})=>[m("div",J,[l(u,{alt:t.$t(`common.methods.payment_by_code.${e.code}`),class:"size-12 rounded-sm",src:e.logoUrl},null,8,["alt","src"]),d(" "+a(t.$t(`common.methods.payment_by_code.${e.code}`)),1)])]),item:o(({item:e})=>[l(u,{alt:t.$t(`common.methods.payment_by_code.${e.code}`),class:"size-12 rounded-sm",src:e.logoUrl},null,8,["alt","src"]),d(" "+a(t.$t(`common.methods.payment_by_code.${e.code}`)),1)]),_:1},8,["modelValue","items","label"]),l($,{modelValue:s.value.shippingMethodId,"onUpdate:modelValue":c[3]||(c[3]=e=>s.value.shippingMethodId=e),items:g(h),label:t.$t("pages.account.checkout_defaults.shipping_method_label"),"value-field":"id",class:"mt-8 w-full",size:"auto"},{placeholder:o(()=>[m("div",O,[l(u,{alt:t.$t("common.placeholders.select_delivery_method"),class:"size-12 rounded-sm bg-neutral-100",src:"select-shipping.svg"},null,8,["alt"]),d(" "+a(t.$t("common.placeholders.select_delivery_method")),1)])]),selected:o(({item:e})=>[m("div",Q,[l(u,{alt:t.$t(`common.methods.delivery_by_id.${e.id}`),class:"size-12 rounded-sm",src:e.logoUrl},null,8,["alt","src"]),d(" "+a(t.$t(`common.methods.delivery_by_id.${e.id}`)),1)])]),item:o(({item:e})=>[l(u,{alt:t.$t(`common.methods.delivery_by_id.${e.id}`),class:"size-12 rounded-sm",src:e.logoUrl},null,8,["alt","src"]),d(" "+a(t.$t(`common.methods.delivery_by_id.${e.id}`)),1)]),_:1},8,["modelValue","items","label"]),l(I,{disabled:!D.value,class:"mt-8 self-center lg:self-start","min-width":"12rem",onClick:c[4]||(c[4]=e=>w())},{default:o(()=>[d(a(t.$t("pages.account.checkout_defaults.update_button")),1)]),_:1},8,["disabled"])]))]),_:1})])}}});export{te as default};
//# sourceMappingURL=checkout-defaults-I29edef0.js.map
