Files
intotheeast-com-content/plugins/admin2/app/_app/immutable/nodes/37.A1dRE-K7.js
T

2 lines
6.5 KiB
JavaScript

import"../chunks/DsnmJJEf.js";import{p as Le,i as l,m as je,u as ze,t as G,g as e,a as A,b as Oe,k as Be,o as Fe,s,d as r,j as i,c as D,f as He,h as q,$ as Ke,r as a,n as Ge}from"../chunks/krC2xWPP.js";import{d as qe,e as Ve,s as d,a as Je}from"../chunks/CddAxf8c.js";import{i as pe}from"../chunks/DjsWWzyL.js";import{h as Qe,s as V}from"../chunks/j_DJpx8B.js";import{d as Ye,s as Ze,B as et,t as _e,r as w}from"../chunks/Lvd_r9sp.js";import{b as k}from"../chunks/ciapVzar.js";import{i as o}from"../chunks/Cu5ilWky.js";import{g as be}from"../chunks/BVTiZ3e2.js";import{b as ge}from"../chunks/BSopV7IU.js";import{c as tt}from"../chunks/SVx5UhLg.js";import{P as rt}from"../chunks/DHzx-VDt.js";import{S as at}from"../chunks/K87jKp17.js";import{p as J,P as st,e as ot}from"../chunks/DI46g3k0.js";import{D as it}from"../chunks/nlum2O0L.js";import{L as dt}from"../chunks/C_E2vM9U.js";import{S as nt}from"../chunks/CV_JZMCk.js";import{U as lt}from"../chunks/Caj_ccK9.js";var ut=D('<div class="flex h-9 w-9 items-center justify-center rounded-full bg-primary/10 text-primary"><!></div>'),ct=D("<!> ",1),vt=D('<div><div><div class="flex items-center gap-3"><button type="button" class="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"><!></button> <!> <h1> </h1></div> <!></div></div>'),mt=D('<div class="flex h-full flex-col"><!> <div class="flex-1 overflow-y-auto"><div class="space-y-6 px-6 py-6"><div class="rounded-xl border border-border bg-card p-5"><h2 class="text-sm font-semibold text-foreground"> </h2> <div class="mt-4 space-y-4"><div><label for="username" class="block text-xs font-medium text-muted-foreground"> <span class="text-destructive">*</span></label> <input id="username" type="text" class="mt-1 h-9 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"/></div> <div class="grid gap-4 sm:grid-cols-2"><div><label for="fullname" class="block text-xs font-medium text-muted-foreground"> </label> <input id="fullname" type="text" class="mt-1 h-9 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-ring"/></div> <div><label for="title-field" class="block text-xs font-medium text-muted-foreground">Title</label> <input id="title-field" type="text" class="mt-1 h-9 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-ring"/></div></div> <div><label for="email" class="block text-xs font-medium text-muted-foreground">Email <span class="text-destructive">*</span></label> <input id="email" type="email" class="mt-1 h-9 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-ring"/></div> <!> <div><label for="state" class="block text-xs font-medium text-muted-foreground"> </label> <select id="state" class="mt-1 h-9 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-ring"><option> </option><option> </option></select></div></div></div> <div class="rounded-xl border border-border bg-card p-5"><h2 class="text-sm font-semibold text-foreground"> </h2> <div class="mt-4"><!></div></div></div></div></div>');function It(xe,Ee){Le(Ee,!0);let v=l(""),h=l(""),R=l(""),T=l(""),N=l(""),$=l("enabled"),S=l(je({})),m=l(!1);ze(()=>{J.load().catch(()=>{})});const he=q(()=>ot(e(N),J.current)),Q=q(()=>e(v).length>=3&&e(h).length>0&&e(he).allRulesMet);async function Y(){i(m,!0);try{await tt({username:e(v),password:e(N),email:e(h),fullname:e(R)||void 0,title:e(T)||void 0,state:e($),access:Object.keys(e(S)).length>0?e(S):void 0}),_e.success(o.t("ADMIN_NEXT.TOASTS.USER_CREATED",{username:e(v)})),be(`${ge}/users/${e(v)}`)}catch(t){const u=t&&typeof t=="object"&&"message"in t?t.message:"Failed to create user";_e.error(u)}finally{i(m,!1)}}function Ne(t){i(S,t,!0)}function Se(t){(t.metaKey||t.ctrlKey)&&t.key==="s"&&(t.preventDefault(),e(Q)&&!e(m)&&Y())}var I=mt();Qe("pvbw0q",t=>{Be(u=>{Ke.title=u??""},[()=>o.t("ADMIN_NEXT.USERS.NEW.NEW_USER_GRAV_ADMIN")])}),Ve("keydown",Fe,Se);var Z=r(I);at(Z,{children:(u,H)=>{let f=()=>H?.().scrolled;var p=vt(),g=r(p),x=r(g),_=r(x),Ie=r(_);it(Ie,{name:"arrow-back",size:16}),a(_);var ce=s(_,2);{var Me=c=>{var E=ut(),ve=r(E);lt(ve,{size:16}),a(E),A(c,E)};pe(ce,c=>{f()||c(Me)})}var K=s(ce,2),Ue=r(K,!0);a(K),a(x);var Xe=s(x,2);{let c=q(()=>!e(Q)||e(m));et(Xe,{size:"sm",onclick:Y,get disabled(){return e(c)},children:(E,ve)=>{var me=ct(),fe=He(me);{var Pe=n=>{dt(n,{size:14,class:"me-1.5 animate-spin"})},We=n=>{nt(n,{size:14,class:"me-1.5"})};pe(fe,n=>{e(m)?n(Pe):n(We,-1)})}var Ce=s(fe);G(n=>d(Ce,` ${n??""}`),[()=>o.t("ADMIN_NEXT.USERS.NEW.CREATE")]),A(E,me)},$$slots:{default:!0}})}a(g),a(p),G(c=>{V(p,1,`px-6 transition-[padding] duration-200 ${f()?"py-2":"pt-6 pb-3"}`),V(g,1,`flex items-center justify-between gap-4 ${f()?"min-h-6":"min-h-8"}`),V(K,1,`font-semibold text-foreground transition-[font-size] duration-200 ${f()?"text-sm":"text-lg"}`),d(Ue,c)},[()=>o.t("ADMIN_NEXT.USERS.NEW.NEW_USER")]),Je("click",_,()=>be(`${ge}/users`)),A(u,p)},$$slots:{default:!0}});var ee=s(Z,2),te=r(ee),M=r(te),U=r(M),ye=r(U,!0);a(U);var re=s(U,2),X=r(re),P=r(X),Ae=r(P);Ge(),a(P);var W=s(P,2);w(W),a(X);var C=s(X,2),L=r(C),j=r(L),we=r(j,!0);a(j);var ae=s(j,2);w(ae),a(L);var se=s(L,2),oe=s(r(se),2);w(oe),a(se),a(C);var z=s(C,2),ie=s(r(z),2);w(ie),a(z);var de=s(z,2);st(de,{id:"password",label:"Password *",get policy(){return J.current},get disabled(){return e(m)},get value(){return e(N)},set value(t){i(N,t,!0)}});var ne=s(de,2),O=r(ne),ke=r(O,!0);a(O);var B=s(O,2),b=r(B),De=r(b,!0);a(b),b.value=b.__value="enabled";var y=s(b),Re=r(y,!0);a(y),y.value=y.__value="disabled",a(B),a(ne),a(re),a(M);var le=s(M,2),F=r(le),Te=r(F,!0);a(F);var ue=s(F,2),$e=r(ue);rt($e,{get value(){return e(S)},onchange:Ne}),a(ue),a(le),a(te),a(ee),a(I),G((t,u,H,f,p,g,x,_)=>{d(ye,t),d(Ae,`${u??""} `),Ze(W,"placeholder",H),d(we,f),d(ke,p),d(De,g),d(Re,x),d(Te,_)},[()=>o.t("ADMIN_NEXT.USERS.NEW.ACCOUNT"),()=>o.t("ADMIN_NEXT.USERNAME"),()=>o.t("ADMIN_NEXT.USERS.NEW.LOWERCASE_3_64_CHARS"),()=>o.t("ADMIN_NEXT.USERS.NEW.FULL_NAME"),()=>o.t("ADMIN_NEXT.PAGES.HEADER_STATUS"),()=>o.t("ADMIN_NEXT.ENABLED"),()=>o.t("ADMIN_NEXT.DISABLED"),()=>o.t("ADMIN_NEXT.USERS.NEW.PERMISSIONS")]),k(W,()=>e(v),t=>i(v,t)),k(ae,()=>e(R),t=>i(R,t)),k(oe,()=>e(T),t=>i(T,t)),k(ie,()=>e(h),t=>i(h,t)),Ye(B,()=>e($),t=>i($,t)),A(xe,I),Oe()}qe(["click"]);export{It as component};