1import{a as o,s as U,e as k,q as x,u as A,t as q,n as B,f as $,m as D}from"./index-mGgJqOFQ.js";import{d as F,y as G,S as z,bo as E,br as L,bn as M,E as N,J as l,i as p,o as T,c as J,b as n,w as u,a1 as R,a0 as j,q as H,t as K,z as O,aa as Q,u as d,bk as W,bl as _}from"./core-Cu1dlvv4.js";const ee=F({__name:"UserCreate",async setup(X){let i,m;const{t:e}=G(),f=z();[i,m]=E(()=>_.fetchAll([{uri:"users",cachePath:"users"},{uri:"domains",cachePath:"domains"}])),await i,m();const{usernames:h}=L(),{domainsAsChoices:w,mainDomain:b}=M(),a=N({username:"",fullname:"",domain:b.value,password:"",confirmation:""}),c={username:l({component:"InputItem",label:e("user_username"),rules:p(()=>({required:o,alphalownumdot_:k,notInUsers:x(h)})),cProps:{id:"username",placeholder:e("placeholder.username"),autocapitalize:"off",spellcheck:"false"}}),fullname:{component:"InputItem",hr:!0,label:e("user_fullname"),rules:{required:o,name:B},cProps:{id:"fullname",placeholder:e("placeholder.fullname"),spellcheck:"false"}},domain:l({component:"SelectItem",hr:!0,id:"mail",label:e("user_email"),description:e("tip_about_user_email"),descriptionVariant:"info",rules:{required:o},cProps:{choices:w}}),password:{component:"InputItem",label:e("password"),description:e("good_practices_about_user_password"),descriptionVariant:"warning",rules:{required:o,passwordLenght:D(8)},cProps:{id:"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",type:"password"}},confirmation:l({component:"InputItem",label:e("password_confirmation"),rules:p(()=>({required:o,passwordMatch:U(a.value.password)})),cProps:{id:"confirmation",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",type:"password"}})},{v:I,onSubmit:v}=A(a,c),V=v(async t=>{const s=await W(a);_.post({uri:"users",cachePath:"users",data:s}).then(()=>{f.push({name:"user-list"})}).catch(t)});return(t,s)=>{const g=j,P=q,y=R,C=$;return T(),J("div",null,[n(C,{modelValue:a.value,"onUpdate:modelValue":s[1]||(s[1]=r=>a.value=r),icon:"user-plus",fields:c,title:t.$t("users_add"),validations:d(I),onSubmit:Q(d(V),["prevent"])},{"component:domain":u(r=>[n(y,null,{default:u(()=>[n(g,{id:"local-part",tag:"label",class:"border-right-0"},{default:u(()=>[H(K(a.value.username)+"@ ",1)]),_:1}),n(P,O(r,{modelValue:a.value.domain,"onUpdate:modelValue":s[0]||(s[0]=S=>a.value.domain=S)}),null,16,["modelValue"])]),_:2},1024)]),_:1},8,["modelValue","title","validations","onSubmit"])])}}});export{ee as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.