import{N as n,K as C,E as r,O as l,S as d,R as a,Q as o,C as N,V as W,r as b,l as v,q as P,D as k,u as g,P as m}from"./vendor-BGtMsOoo.js";import{e as R,h as q,ae as x,i as F}from"./index-CRze-aDK.js";import{u as L}from"./useUserCheckoutDefaults-BlmbrerI.js";const H={};function K(i,y){const p=n("VcButton"),_=n("VcModal");return r(),C(_,{variant:"success",title:i.$t("shared.account.checkout_default_success_modal.title"),icon:"apply"},{actions:l(({close:h})=>[o(p,{class:"mx-auto",onClick:h},{default:l(()=>[d(a(i.$t("shared.account.checkout_default_success_modal.ok_button")),1)]),_:2},1032,["onClick"])]),default:l(()=>[d(" "+a(i.$t("shared.account.checkout_default_success_modal.message")),1)]),_:1},8,["title"])}const O=R(H,[["render",K]]),Q={key:1,class:"flex flex-col lg:w-1/2"},j={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"},X={class:"flex items-center gap-3 p-3 text-sm"},Y={class:"flex items-center gap-3 p-3 text-sm"},oe=N({__name:"checkout-defaults",setup(i){const{t:y}=W(),{openModal:p}=q(),{loading:_,availableShippingMethods:h,availablePaymentMethods:M,forceFetch:U}=x(),{getUserCheckoutDefaults:B,setUserCheckoutDefaults:D}=L();F({title:y("pages.account.checkout_defaults.meta.title")});const f=b(B()),s=b(v.clone(f.value)),z=P(()=>!v.isEqual(f.value,s.value));function w(){D(s.value),f.value=v.clone(s.value),p({component:O})}return U(),(t,c)=>{const S=n("VcTypography"),I=n("VcLoaderWithText"),V=n("VcRadioButton"),u=n("VcImage"),$=n("VcSelect"),T=n("VcButton"),E=n("VcWidget");return r(),k("div",null,[o(S,{tag:"h1"},{default:l(()=>[d(a(t.$t("pages.account.checkout_defaults.title")),1)]),_:1}),o(E,{size:"lg"},{default:l(()=>[g(_)?(r(),C(I,{key:0})):(r(),k("div",Q,[m("div",j,a(t.$t("pages.account.checkout_defaults.select_delivery_method_label")),1),m("div",A,[o(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"]),o(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"])]),o($,{modelValue:s.value.paymentMethodCode,"onUpdate:modelValue":c[2]||(c[2]=e=>s.value.paymentMethodCode=e),items:g(M),label:t.$t("pages.account.checkout_defaults.payment_method_label"),"value-field":"code",class:"mt-8 w-full",size:"auto"},{placeholder:l(()=>[m("div",G,[o(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:l(({item:e})=>[m("div",J,[o(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:l(({item:e})=>[o(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"]),o($,{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:l(()=>[m("div",X,[o(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:l(({item:e})=>[m("div",Y,[o(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:l(({item:e})=>[o(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"]),o(T,{disabled:!z.value,class:"mt-8 self-center lg:self-start","min-width":"12rem",onClick:c[4]||(c[4]=e=>w())},{default:l(()=>[d(a(t.$t("pages.account.checkout_defaults.update_button")),1)]),_:1},8,["disabled"])]))]),_:1})])}}});export{oe as default};
//# sourceMappingURL=checkout-defaults-C9RkYguL.js.map
