import{r as f,b as x,j as s,n as a,aT as k}from"./index-7c7a558c.js";import{B as y}from"./Breadcrumb-f4cb0f42.js";function N(){const[r,d]=f.useState(""),[t,o]=f.useState(""),{mutate:p,isLoading:n}=x(k,{onSuccess:()=>{a.success("Successfully Saved"),d(""),o("")},onError:e=>{var l,i,u,m,c,g,b,h;(i=(l=e==null?void 0:e.response)==null?void 0:l.data)!=null&&i.error?a.error((m=(u=e==null?void 0:e.response)==null?void 0:u.data)==null?void 0:m.error):(g=(c=e==null?void 0:e.response)==null?void 0:c.data)!=null&&g.message?a.error((h=(b=e==null?void 0:e.response)==null?void 0:b.data)==null?void 0:h.message):a.error("something went wrong!")}}),w=e=>{if(e.preventDefault(),r==""){a.error("Password field is required");return}if(t==""){a.error("Confirm Password field is required");return}if(r!=t){a.error("Password not matched!");return}n||p({formdata:{password:r,password_confirmation:t}})};return s.jsxs(s.Fragment,{children:[s.jsx(y,{title:"Change Password"}),s.jsx("div",{className:"my-12 h-screen",children:s.jsx("div",{className:"relative overflow-x-auto shadow-md sm:rounded-lg section-bg p-2",children:s.jsxs("form",{className:"p-5",onSubmit:w,children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("label",{htmlFor:"password",className:"block mb-2 text-sm font-medium text-gray-900 dark:text-white",children:"Your password"}),s.jsx("input",{type:"password",id:"password",className:"shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light",required:!0,onChange:e=>d(e.target.value)})]}),s.jsxs("div",{className:"mb-6",children:[s.jsx("label",{htmlFor:"repeat-password",className:"block mb-2 text-sm font-medium text-gray-900 dark:text-white",children:"Repeat password"}),s.jsx("input",{type:"password",id:"repeat-password",className:"shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light",required:!0,onChange:e=>o(e.target.value)})]}),s.jsx("button",{type:"submit",className:"text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800",children:n?"Changing Password...":"Change Password"})]})})})]})}export{N as default};
