import{q as P,r as p,S,j as s}from"./app-Bup04Qnx.js";import{I as t}from"./Input-Bs1ncZB7.js";import"./format-CisCU4Rs.js";import"./BaseForm-wkPKZ5Eg.js";function k({className:d=""}){const{has_password:o}=P().props.auth,i=p.useRef(),l=p.useRef(),{data:u,setData:m,errors:f,post:w,reset:r,processing:c,recentlySuccessful:x}=S({current_password:"",password:"",password_confirmation:""}),h=n=>{n.preventDefault(),w("/app/profile?update-password=true",{preserveScroll:!0,onSuccess:()=>r(),onError:a=>{a.password&&(r("password","password_confirmation"),i.current.focus()),a.current_password&&(r("current_password"),l.current.focus())}})};function j(n){const{name:a,value:g}=n.target;let b=g;m(N=>({...N,[a]:b}))}const e={handleChange:j,data:u,errors:f};return s.jsxs("section",{className:d,children:[s.jsx("header",{children:s.jsxs("h2",{className:"text-lg font-medium text-gray-900 ",children:[o?"Ganti":"Tambahkan"," Password"]})}),s.jsxs("form",{onSubmit:h,className:"space-y-6",children:[s.jsxs("div",{className:"grid gap-2",children:[o?s.jsx(t,{type:"password",name:"current_password",label:"Password Sekarang",...e}):null,s.jsx(t,{type:"password",name:"password",label:"Password Baru",...e}),s.jsx(t,{type:"password",name:"password_confirmation",label:"Konfirmasi Password Baru",...e})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("button",{disabled:c,className:"btn btn-primary btn-sm",children:[c&&s.jsx("span",{className:"loading"}),s.jsx("span",{children:"Simpan"})]}),x?s.jsxs("div",{className:"badge badge-success gap-2 badge-lg",children:[s.jsx("i",{className:"fas fa-check"}),s.jsx("span",{children:"Berhasil Disimpan"})]}):null]})]})]})}export{k as default};
