import{D as m}from"./default_avatar-25741ce7.js";import{_ as u,A as p}from"./_plugin-vue_export-helper-8019582c.js";import{o as w,c as f,b as s,t as r,g as i,v as c}from"./index-454c8244.js";const _={name:"ProfilePage",setup(){},components:{},props:{},data(){return{user:localStorage.getItem("user")?JSON.parse(localStorage.getItem("user")):{},form:{currentPassword:"",newPassword:""}}},mounted(){},methods:{DefaultAvatar(){return m},async handlePasswordReset(l){l.preventDefault();const e=await p.post("updatePassword/"+this.user.id,this.form);if(e.data&&e.data.status){const d=document.getElementById("passwordResetModal"),n=document.getElementsByClassName("modal-backdrop");d.classList.remove("show"),n[0].classList.remove("show"),localStorage.clear(),this.$router.push({path:"/login"})}}}},b={class:"alert-classic section-b-space pt-0",style:{"margin-top":"90px"}},h={class:"d-flex flex-column gap-3 justify-content-center align-items-center"},P=["src"],g=s("button",{type:"button",class:"btn btn-primary","data-bs-toggle":"modal","data-bs-target":"#passwordResetModal"},"Reset Password ",-1),v={class:"modal fade",id:"passwordResetModal",tabindex:"-1","aria-labelledby":"passwordResetModal","aria-hidden":"true"},y={class:"modal-dialog"},x={class:"modal-content"},R=s("div",{class:"modal-header"},[s("h5",{class:"modal-title",id:"passwordResetModal"},"Reset Password"),s("button",{type:"button",class:"btn-close","data-bs-dismiss":"modal","aria-label":"Close"})],-1),D={class:"modal-body"},B={class:"form-group mb-3"},M=s("label",{for:"currentPassword",class:"form-label"},"Current Password",-1),S={class:"form-group mb-3"},A=s("label",{for:"newPassword",class:"form-label"},"New Password",-1),k=s("button",{type:"submit",class:"btn btn-primary"},"Reset Password",-1);function I(l,e,d,n,t,a){return w(),f("section",b,[s("div",h,[s("img",{src:a.DefaultAvatar(),alt:"avatar",style:{"max-width":"100px",border:"1px solid #868686","border-radius":"10px",padding:"5px"}},null,8,P),s("h1",null,r(t.user.name),1),s("h2",null,r(t.user.user_role.role),1),s("h2",null,r(t.user.phone),1),g,s("div",v,[s("div",y,[s("div",x,[R,s("div",D,[s("form",{onSubmit:e[2]||(e[2]=(...o)=>a.handlePasswordReset&&a.handlePasswordReset(...o))},[s("div",B,[M,i(s("input",{type:"text","onUpdate:modelValue":e[0]||(e[0]=o=>t.form.currentPassword=o),name:"currentPassword",id:"currentPassword",class:"form-control"},null,512),[[c,t.form.currentPassword]])]),s("div",S,[A,i(s("input",{type:"text","onUpdate:modelValue":e[1]||(e[1]=o=>t.form.newPassword=o),name:"newPassword",id:"newPassword",class:"form-control"},null,512),[[c,t.form.newPassword]])]),k],32)])])])])])])}const V=u(_,[["render",I]]);export{V as default};
