import{d as w,C as b,E as V,A as h,a as m,o as l,e as o,b as a,u as s,h as E,y as g,k as u,w as d,i,t as p,g as k,F as C}from"./app-D_cNhTOt.js";import{_ as S}from"./AppLayout.vue_vue_type_script_setup_true_lang-kdLGGf-_.js";import{_}from"./AppLogoIcon.vue_vue_type_script_setup_true_lang-BbjSNLws.js";import{_ as f}from"./Label.vue_vue_type_script_setup_true_lang-CsAMCf-a.js";import{_ as c}from"./Input.vue_vue_type_script_setup_true_lang-C7QVdt1n.js";import{a as $,E as U}from"./eye-B7FUyUiq.js";import"./useForwardExpose-4P0NPntM.js";import"./VisuallyHidden-V0BOAZdg.js";import"./RovingFocusGroup-Ciyu9vLm.js";import"./useArrowNavigation-C6Y-ieo6.js";import"./index-Z7dItZLR.js";import"./createLucideIcon-1FJ9MNCd.js";const B={class:"p-6"},F={class:"space-y-4"},N={class:"space-y-1"},P={key:0,class:"text-red-500 text-sm"},q={class:"space-y-1 relative"},j={key:0,class:"text-red-500 text-sm"},A={class:"space-y-4"},T={class:"space-y-1"},D={key:0,class:"text-red-500 text-sm"},M={class:"col-span-2 flex justify-end mt-4 space-x-2"},ee=w({layout:S,__name:"User-create",setup(O){const t=b({name:"",email:"",password:""}),y=V(),n=h(!1),v=()=>{t.post("/user-management/user-create",{onSuccess:()=>{y.success("Stakeholder created successfully!"),t.reset()},onError:()=>{y.error("Failed to create stakeholder. Please check the form.")}})},x=()=>{t.reset()};return(R,e)=>(l(),m(C,null,[o(s(E),{title:"Create User"}),a("div",B,[e[10]||(e[10]=a("div",{class:"flex justify-between items-center mb-6"},[a("h1",{class:"text-2xl font-bold"},"Add Stakeholder")],-1)),e[11]||(e[11]=a("p",{class:"mb-6"},"Please fill-up the form to create new stakeholder",-1)),a("form",{onSubmit:g(v,["prevent"]),class:"grid grid-cols-2 gap-6"},[a("div",F,[a("div",N,[o(s(f),null,{default:d(()=>[...e[5]||(e[5]=[i("Stakeholder",-1)])]),_:1}),o(s(c),{modelValue:s(t).name,"onUpdate:modelValue":e[0]||(e[0]=r=>s(t).name=r),type:"text",placeholder:"Enter stakeholder name",required:""},null,8,["modelValue"]),s(t).name?(l(),m("div",P,p(s(t).errors.name),1)):u("",!0)]),a("div",q,[o(s(f),null,{default:d(()=>[...e[6]||(e[6]=[i("Password",-1)])]),_:1}),o(s(c),{modelValue:s(t).password,"onUpdate:modelValue":e[1]||(e[1]=r=>s(t).password=r),type:n.value?"text":"password",placeholder:"Enter stakeholder password",required:""},null,8,["modelValue","type"]),a("button",{type:"button",class:"absolute inset-y-9 right-0 flex items-center pr-3 text-neutral-400 dark:text-neutral-500",onClick:e[2]||(e[2]=r=>n.value=!n.value)},[n.value?(l(),k(s(U),{key:1,class:"w-5 h-5"})):(l(),k(s($),{key:0,class:"w-5 h-5"}))]),s(t).password?(l(),m("div",j,p(s(t).errors.password),1)):u("",!0)])]),a("div",A,[a("div",T,[o(s(f),null,{default:d(()=>[...e[7]||(e[7]=[i("Email",-1)])]),_:1}),o(s(c),{modelValue:s(t).email,"onUpdate:modelValue":e[3]||(e[3]=r=>s(t).email=r),type:"email",placeholder:"Enter stakeholder email",required:""},null,8,["modelValue"]),s(t).email?(l(),m("div",D,p(s(t).errors.email),1)):u("",!0)])]),a("div",M,[o(s(_),{type:"button",variant:"outline",onClick:e[4]||(e[4]=r=>x())},{default:d(()=>[...e[8]||(e[8]=[i(" Reset ",-1)])]),_:1}),o(s(_),{type:"submit",variant:"default",disabled:s(t).processing},{default:d(()=>[...e[9]||(e[9]=[i(" Create Stakeholder ",-1)])]),_:1},8,["disabled"])])],32)])],64))}});export{ee as default};
