import{b as _,u as F,d as V,e as n,f as b,g,m as r,p as y,h as x,i as o,D as B,I as h}from"./app-94c6def1.js";import{F as C}from"./Form-88ba26a4.js";/*! 2FAuth version 5.1.0 - Copyright (c) 2023 Bubka - https://github.com/Bubka/2FAuth */const E=["onSubmit"],k={__name:"Create",setup(N){const m=_(),l=F(),e=V(new C({name:"",email:"",password:"",password_confirmation:"",is_admin:!1}));async function i(d){e.password_confirmation=e.password,e.post("/api/v1/users").then(s=>{const t=s.data;m.success({text:h("admin.user_created")}),l.push({name:"admin.manageUser",params:{userId:t.info.id}})})}return(d,s)=>{const t=n("FormField"),u=n("FormPasswordField"),p=n("FormCheckbox"),f=n("FormButtons"),c=n("FormWrapper"),w=n("VueFooter");return b(),g("div",null,[r(c,{title:"admin.new_user"},{default:y(()=>[x("form",{onSubmit:B(i,["prevent"]),onKeydown:s[4]||(s[4]=a=>o(e).onKeydown(a))},[r(t,{modelValue:o(e).name,"onUpdate:modelValue":s[0]||(s[0]=a=>o(e).name=a),fieldName:"name",fieldError:o(e).errors.get("name"),inputType:"text",label:"auth.forms.name",maxLength:255,autofocus:""},null,8,["modelValue","fieldError"]),r(t,{modelValue:o(e).email,"onUpdate:modelValue":s[1]||(s[1]=a=>o(e).email=a),fieldName:"email",fieldError:o(e).errors.get("email"),inputType:"email",label:"auth.forms.email",maxLength:255},null,8,["modelValue","fieldError"]),r(u,{modelValue:o(e).password,"onUpdate:modelValue":s[2]||(s[2]=a=>o(e).password=a),fieldName:"password",fieldError:o(e).errors.get("password"),showRules:!0,label:"auth.forms.password",autocomplete:"new-password"},null,8,["modelValue","fieldError"]),r(p,{modelValue:o(e).is_admin,"onUpdate:modelValue":s[3]||(s[3]=a=>o(e).is_admin=a),fieldName:"is_admin",label:"admin.forms.is_admin.label",help:"admin.forms.is_admin.help"},null,8,["modelValue"]),r(f,{isBusy:o(e).isBusy,isDisabled:o(e).isDisabled,showCancelButton:!0,cancelLandingView:"admin.users",caption:"commons.create",submitId:"btnCreateUser"},null,8,["isBusy","isDisabled","cancelLandingView"])],40,E)]),_:1}),r(w)])}}};export{k as default};