import{_ as q,u as I,p as K,q as R,l as Y,r as u,b as j,c as v,o,a as e,f as w,e as d,ag as F,w as G,h as H,t as l,a8 as J,C as L,k as h,K as _,ah as f,n as b,d as i}from"./app-q0jdcHwC.js";import{_ as O}from"./ToastSuccessMessage-DTQABN-g.js";import{r as y,a as g}from"./EyeIcon-BbgVg4KN.js";const Q={class:"bg-white px-3 text-slate-600 flex items-center gap-1 pt-2 leading-normal"},W={class:"p-3 md:p-4 xl:p-6"},X={class:"max-w-5xl mx-auto"},Z={class:""},ee={class:"form-label"},se={class:"relative"},te=["type","placeholder"],ae={key:0,class:"text-red-500 text-sm"},oe={class:"mt-4"},re={class:"form-label"},le={class:"relative"},ne=["type","placeholder"],de={key:0,class:"text-red-500 text-sm"},ie={class:"mt-4"},ue={class:"form-label"},pe={class:"relative"},ce=["type","placeholder"],me={key:0,class:"text-red-500 text-sm"},ve={type:"submit",class:"px-4 py-3 md:px-6 md:py-4 bg-primary text-white text-sm md:text-base rounded-[10px] mt-6"},we={__name:"ChangePassword",setup(he){const x=I(),E=K(),C=R(),M=Y(),p=u(!1),c=u(!1),m=u(!1),n=u({current_password:"",password:"",password_confirmation:""}),s=u({}),z={component:O,props:{title:"Password Updated",message:"Your password updated successfully"}},A=()=>{axios.post("/change-password",n.value,{headers:{Authorization:E.token}}).then(()=>{n.value={},C(z,{type:"default",hideProgressBar:!0,icon:!1,position:x.langDirection==="rtl"?"bottom-right":"bottom-left",toastClassName:"vue-toastification-alert",timeout:2e3}),s.value=null,M.push({name:"profile"})}).catch(a=>{s.value=a.response.data.errors,a.response.data.errors||C.error(a.response.data.message,{position:x.langDirection==="rtl"?"bottom-right":"bottom-left"})})};return(a,t)=>{var k,P,$,N,V,D,B,S,U;const T=j("router-link");return o(),v("div",null,[e("div",Q,[w(d(F),{class:"w-5 h-5 md:w-6 md:h-6"}),w(T,{to:"/profile",class:"hover:text-primary"},{default:G(()=>[H(l(a.$t("Profile")),1)]),_:1}),e("span",null,"/ "+l(a.$t("Change Password")),1)]),w(J,{title:"Change Password"}),e("div",W,[e("div",X,[e("form",{onSubmit:t[6]||(t[6]=L(r=>A(),["prevent"])),class:"bg-white rounded-lg md:rounded-xl p-4 md:p-6"},[e("div",Z,[e("label",ee,l(a.$t("Change Password")),1),e("div",se,[_(e("input",{type:p.value?"text":"password","onUpdate:modelValue":t[0]||(t[0]=r=>n.value.current_password=r),placeholder:a.$t("Enter Current Password"),class:b(["form-input",s.value&&((k=s.value)!=null&&k.current_password)?"border-red-500":"border-slate-200"])},null,10,te),[[f,n.value.current_password]]),e("button",{type:"button",onClick:t[1]||(t[1]=r=>p.value=!p.value)},[p.value?(o(),i(d(y),{key:0,class:"w-6 h-6 text-slate-700 absolute right-4 top-1/2 -translate-y-1/2"})):(o(),i(d(g),{key:1,class:"w-6 h-6 text-slate-700 absolute right-4 top-1/2 -translate-y-1/2"}))])]),s.value&&((P=s.value)!=null&&P.current_password)?(o(),v("span",ae,l(($=s.value)==null?void 0:$.current_password[0]),1)):h("",!0)]),e("div",oe,[e("label",re,l(a.$t("Create New Password")),1),e("div",le,[_(e("input",{type:c.value?"text":"password","onUpdate:modelValue":t[2]||(t[2]=r=>n.value.password=r),placeholder:a.$t("Enter Create New Password"),class:b(["form-input",s.value&&((N=s.value)!=null&&N.password)?"border-red-500":"border-slate-200"])},null,10,ne),[[f,n.value.password]]),e("button",{type:"button",onClick:t[3]||(t[3]=r=>c.value=!c.value)},[c.value?(o(),i(d(y),{key:0,class:"w-6 h-6 text-slate-700 absolute right-4 top-1/2 -translate-y-1/2"})):(o(),i(d(g),{key:1,class:"w-6 h-6 text-slate-700 absolute right-4 top-1/2 -translate-y-1/2"}))])]),s.value&&((V=s.value)!=null&&V.password)?(o(),v("span",de,l((D=s.value)==null?void 0:D.password[0]),1)):h("",!0)]),e("div",ie,[e("label",ue,l(a.$t("Confirm New Password")),1),e("div",pe,[_(e("input",{type:m.value?"text":"password","onUpdate:modelValue":t[4]||(t[4]=r=>n.value.password_confirmation=r),placeholder:a.$t("Confirm New Password"),class:b(["form-input",s.value&&((B=s.value)!=null&&B.password_confirmation)?"border-red-500":"border-slate-200"])},null,10,ce),[[f,n.value.password_confirmation]]),e("button",{type:"button",onClick:t[5]||(t[5]=r=>m.value=!m.value)},[m.value?(o(),i(d(y),{key:0,class:"w-6 h-6 text-slate-700 absolute right-4 top-1/2 -translate-y-1/2"})):(o(),i(d(g),{key:1,class:"w-6 h-6 text-slate-700 absolute right-4 top-1/2 -translate-y-1/2"}))])]),s.value&&((S=s.value)!=null&&S.password_confirmation)?(o(),v("span",me,l((U=s.value)==null?void 0:U.password_confirmation[0]),1)):h("",!0)]),e("button",ve,l(a.$t("Update Password")),1)],32)])])])}}},ye=q(we,[["__scopeId","data-v-816f4f71"]]);export{ye as default};
