import{_ as j,g as I,x as O,y as R,s as Y,d as q,o,c as v,a as t,h as w,j as d,ay as F,w as G,i as H,t as l,an as J,C as K,O as h,az as _,B as f,e as i,aA as b,aB as x,p as y,a8 as L,r as u}from"./app-B-4i4xU3.js";const Q={class:"bg-white dark:bg-slate-800 px-3 text-slate-600 dark:text-slate-300 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:""},tt={class:"form-label"},et={class:"relative"},st=["type","placeholder"],at={key:0,class:"text-red-500 text-sm"},ot={class:"mt-4"},rt={class:"form-label"},lt={class:"relative"},nt=["type","placeholder"],dt={key:0,class:"text-red-500 text-sm"},it={class:"mt-4"},ut={class:"form-label"},pt={class:"relative"},ct=["type","placeholder"],mt={key:0,class:"text-red-500 text-sm"},vt={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"},wt={__name:"ChangePassword",setup(ht){const g=I(),z=O(),k=R(),A=Y(),p=u(!1),c=u(!1),m=u(!1),n=u({current_password:"",password:"",password_confirmation:""}),e=u({}),E={component:L,props:{title:"Password Updated",message:"Your password updated successfully"}},M=()=>{axios.post("/change-password",n.value,{headers:{Authorization:z.token}}).then(()=>{n.value={},k(E,{type:"default",hideProgressBar:!0,icon:!1,position:g.langDirection==="rtl"?"bottom-right":"bottom-left",toastClassName:"vue-toastification-alert",timeout:2e3}),e.value=null,A.push({name:"profile"})}).catch(s=>{e.value=s.response.data.errors,s.response.data.errors||k.error(s.response.data.message,{position:g.langDirection==="rtl"?"bottom-right":"bottom-left"})})};return(s,a)=>{var C,$,P,N,B,V,D,S,U;const T=q("router-link");return o(),v("div",null,[t("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(s.$t("Profile")),1)]),_:1}),t("span",null,"/ "+l(s.$t("Change Password")),1)]),w(J,{title:s.$t("Change Password")},null,8,["title"]),t("div",W,[t("div",X,[t("form",{onSubmit:a[6]||(a[6]=K(r=>M(),["prevent"])),class:"bg-white dark:bg-slate-800 dark:text-slate-300 rounded-lg md:rounded-xl p-4 md:p-6"},[t("div",Z,[t("label",tt,l(s.$t("Change Password")),1),t("div",et,[h(t("input",{type:p.value?"text":"password","onUpdate:modelValue":a[0]||(a[0]=r=>n.value.current_password=r),placeholder:s.$t("Enter Current Password"),class:f(["form-input",e.value&&((C=e.value)!=null&&C.current_password)?"border-red-500":"border-slate-200"])},null,10,st),[[_,n.value.current_password]]),t("button",{type:"button",onClick:a[1]||(a[1]=r=>p.value=!p.value)},[p.value?(o(),i(d(b),{key:0,class:"w-6 h-6 text-slate-700 dark:text-slate-400 absolute right-4 top-1/2 -translate-y-1/2"})):(o(),i(d(x),{key:1,class:"w-6 h-6 text-slate-700 dark:text-slate-400 absolute right-4 top-1/2 -translate-y-1/2"}))])]),e.value&&(($=e.value)!=null&&$.current_password)?(o(),v("span",at,l((P=e.value)==null?void 0:P.current_password[0]),1)):y("",!0)]),t("div",ot,[t("label",rt,l(s.$t("Create New Password")),1),t("div",lt,[h(t("input",{type:c.value?"text":"password","onUpdate:modelValue":a[2]||(a[2]=r=>n.value.password=r),placeholder:s.$t("Enter Create New Password"),class:f(["form-input",e.value&&((N=e.value)!=null&&N.password)?"border-red-500":"border-slate-200"])},null,10,nt),[[_,n.value.password]]),t("button",{type:"button",onClick:a[3]||(a[3]=r=>c.value=!c.value)},[c.value?(o(),i(d(b),{key:0,class:"w-6 h-6 text-slate-700 dark:text-slate-400 absolute right-4 top-1/2 -translate-y-1/2"})):(o(),i(d(x),{key:1,class:"w-6 h-6 text-slate-700 dark:text-slate-400 absolute right-4 top-1/2 -translate-y-1/2"}))])]),e.value&&((B=e.value)!=null&&B.password)?(o(),v("span",dt,l((V=e.value)==null?void 0:V.password[0]),1)):y("",!0)]),t("div",it,[t("label",ut,l(s.$t("Confirm New Password")),1),t("div",pt,[h(t("input",{type:m.value?"text":"password","onUpdate:modelValue":a[4]||(a[4]=r=>n.value.password_confirmation=r),placeholder:s.$t("Confirm New Password"),class:f(["form-input",e.value&&((D=e.value)!=null&&D.password_confirmation)?"border-red-500":"border-slate-200"])},null,10,ct),[[_,n.value.password_confirmation]]),t("button",{type:"button",onClick:a[5]||(a[5]=r=>m.value=!m.value)},[m.value?(o(),i(d(b),{key:0,class:"w-6 h-6 text-slate-700 dark:text-slate-400 absolute right-4 top-1/2 -translate-y-1/2"})):(o(),i(d(x),{key:1,class:"w-6 h-6 text-slate-700 dark:text-slate-400 absolute right-4 top-1/2 -translate-y-1/2"}))])]),e.value&&((S=e.value)!=null&&S.password_confirmation)?(o(),v("span",mt,l((U=e.value)==null?void 0:U.password_confirmation[0]),1)):y("",!0)]),t("button",vt,l(s.$t("Update Password")),1)],32)])])])}}},ft=j(wt,[["__scopeId","data-v-22d6d58d"]]);export{ft as default};
