import{_ as a}from"./B8Kx3ZW0.js";import{a as s,b as o,l,_ as e}from"./u7I9BgvO.js";import{_ as r}from"./BEvgBzOB.js";import{c as d,a as t,b as i}from"./Cp31FEs4.js";import{c as n,A as p,L as c,M as u,$ as m,a2 as w,H as b,P as f,u as h,V as P,Z as v,W as F,a5 as _}from"./BCDZ6bul.js";import"./XQnr5WFw.js";import"./CFRUpBN3.js";import"./t_btr7io.js";const g={class:"bg-[#F6F7FC] p-4 lg:p-6 h-fit"},S={class:"font-bold text-xl mb-14"},R={class:"grid grid-cols-1 [&_label]:!bg-[#F6F7FC] [&_input]:!bg-[#FFFFFF03] [&_button[aria-haspopup=listbox]]:!bg-[#FFFFFF03] gap-8"},y={class:"flex items-center gap-6 mt-10"},$=["loading"],T={__name:"change-password",setup(T){const j=s().$axios,E=n(!1),{t:L}=o(),U=n(d().shape({oldPassword:t().required(L("ERRORS.old_password")),password:t().required(L("ERRORS.password")),confirmPassword:t().required(L("ERRORS.confirmPassword")).oneOf([i("password"),null],L("ERRORS.confirmPasswordDosnotMuch"))})),x=n({}),O=n(!1),A=async a=>{O.value=!0,j.post("update-password",{old_password:a.oldPassword,password:a.password,password_confirmation:a.confirmPassword,_method:"PATCH"}).then((a=>{E.value=!0})).catch((a=>{l.error(a.response.data.message)})).finally((()=>{O.value=!1}))};return(s,o)=>{const l=a,d=e,t=p("VeeForm"),i=r;return c(),u("div",g,[m("h3",S,w(s.$t("TITLES.change_password")),1),b(t,{"validation-schema":h(U),onSubmit:A,initialValues:h(x)},{default:f((()=>[m("div",R,[m("div",null,[b(l,{name:"oldPassword",label:s.$t("LABELS.old_password"),placeholder:s.$t("INPUTS.old_password"),type:"password",value:h(x).oldPassword,"onUpdate:value":o[0]||(o[0]=a=>h(x).oldPassword=a)},null,8,["label","placeholder","value"])]),m("div",null,[b(l,{name:"password",label:s.$t("LABELS.password"),placeholder:s.$t("INPUTS.password"),type:"password",value:h(x).password,"onUpdate:value":o[1]||(o[1]=a=>h(x).password=a)},null,8,["label","placeholder","value"])]),m("div",null,[b(l,{name:"confirmPassword",label:s.$t("LABELS.confirmPassword"),placeholder:s.$t("INPUTS.confirmPassword"),type:"password",value:h(x).confirmPassword,"onUpdate:value":o[2]||(o[2]=a=>h(x).confirmPassword=a)},null,8,["label","placeholder","value"])]),m("div",y,[m("button",{loading:h(O),type:"submit",class:"base-btn capitalize disabled:!bg-[#909090] w-full mb-2"},w(s.$t("BUTTONS.confirm")),9,$),b(d,{to:s.localePath("/profile"),class:"base-btn capitalize !text-primary !bg-transparent border border-primary disabled:!bg-[#909090] w-full mb-2"},{default:f((()=>[_(w(s.$t("BUTTONS.cancel")),1)])),_:1},8,["to"])])])])),_:1},8,["validation-schema","initialValues"]),h(E)?(c(),P(v,{key:0,custom:"",to:"body"},[b(i,{class:"[&_h2]:!font-Montserrat [&_h2]:!not-italic [&_h2]:!font-semibold",onClose:o[3]||(o[3]=a=>E.value=!1),title:"Password changed",desc:"Change Password Successfully"})])):F("",!0)])}}};export{T as default};
