2 lines
4.5 KiB
JavaScript
2 lines
4.5 KiB
JavaScript
import"../chunks/DsnmJJEf.js";import{p as fe,t as x,g as t,a as b,b as ve,i as N,k as _e,o as ge,s,j as v,c as h,f as q,d as r,h as w,$ as xe,r as a}from"../chunks/krC2xWPP.js";import{e as be,s as d}from"../chunks/CddAxf8c.js";import{i as Ne}from"../chunks/DjsWWzyL.js";import{h as he,s as J}from"../chunks/j_DJpx8B.js";import{s as Ee,B as Q,t as ee,r as k}from"../chunks/Lvd_r9sp.js";import{b as X}from"../chunks/ciapVzar.js";import{i as o}from"../chunks/Cu5ilWky.js";import{g as te}from"../chunks/BVTiZ3e2.js";import{b as re}from"../chunks/BSopV7IU.js";import{c as Ae}from"../chunks/DRw0n_lJ.js";import{S as Pe}from"../chunks/K87jKp17.js";import{D as Re}from"../chunks/nlum2O0L.js";import{U as Oe}from"../chunks/DwS2ehmU.js";import{L as $e}from"../chunks/C_E2vM9U.js";import{S as Ge}from"../chunks/CV_JZMCk.js";var Ue=h("<!> ",1),De=h("<!> ",1),Se=h('<div><div class="flex items-center gap-2"><!> <h1> </h1></div> <div class="flex items-center gap-2"><!> <!></div></div>'),ye=h('<div class="flex h-full flex-col"><!> <div class="flex-1 overflow-y-auto"><div class="mx-auto max-w-2xl px-6 py-6 space-y-4"><div><label for="groupname-input" class="mb-1 block text-sm font-medium text-foreground"> </label> <input id="groupname-input" type="text" class="h-10 w-full rounded-md border border-input bg-transparent px-3 text-sm shadow-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"/> <p class="mt-1 text-xs text-muted-foreground"> </p></div> <div><label for="readableName-input" class="mb-1 block text-sm font-medium text-foreground"> </label> <input id="readableName-input" type="text" class="h-10 w-full rounded-md border border-input bg-transparent px-3 text-sm shadow-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"/></div> <div><label for="description-input" class="mb-1 block text-sm font-medium text-foreground"> </label> <input id="description-input" type="text" class="h-10 w-full rounded-md border border-input bg-transparent px-3 text-sm shadow-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"/></div></div></div></div>');function Ye(ae,se){fe(se,!0);let u=N(""),E=N(""),A=N(""),p=N(!1);const P=w(()=>/^[a-zA-Z0-9_-]{1,200}$/.test(t(u)));async function z(){if(t(P)){v(p,!0);try{await Ae({groupname:t(u),readableName:t(E),description:t(A)}),ee.success(o.t("ADMIN_NEXT.GROUPS.GROUP_CREATED",{name:t(u)})),te(`${re}/users/groups/${t(u)}`)}catch(e){const n=e&&typeof e=="object"&&"message"in e?e.message:o.t("ADMIN_NEXT.GROUPS.FAILED_TO_CREATE_GROUP");ee.error(n)}finally{v(p,!1)}}}function oe(e){(e.metaKey||e.ctrlKey)&&e.key==="s"&&(e.preventDefault(),t(P)&&!t(p)&&z())}var R=ye();he("fa2np5",e=>{_e(n=>{xe.title=n??""},[()=>o.t("ADMIN_NEXT.GROUPS.NEW_GROUP_GRAV_ADMIN")])}),be("keydown",ge,oe);var C=r(R);Pe(C,{children:(n,S)=>{let c=()=>S?.().scrolled;var m=Se(),y=r(m),F=r(y);{let l=w(()=>c()?16:20);Oe(F,{get size(){return t(l)},class:"text-muted-foreground"})}var I=s(F,2),ue=r(I,!0);a(I),a(y);var V=s(y,2),Y=r(V);Q(Y,{variant:"outline",size:"sm",onclick:()=>te(`${re}/users/groups`),children:(l,Z)=>{var T=Ue(),f=q(T);Re(f,{name:"chevron-back",size:14});var g=s(f);x(M=>d(g,` ${M??""}`),[()=>o.t("ADMIN_NEXT.GROUPS.BACK_TO_GROUPS")]),b(l,T)},$$slots:{default:!0}});var me=s(Y,2);{let l=w(()=>!t(P)||t(p));Q(me,{size:"sm",get disabled(){return t(l)},onclick:z,children:(Z,T)=>{var f=De(),g=q(f);{var M=i=>{$e(i,{size:14,class:"animate-spin"})},pe=i=>{Ge(i,{size:14})};Ne(g,i=>{t(p)?i(M):i(pe,-1)})}var ce=s(g);x(i=>d(ce,` ${i??""}`),[()=>o.t("ADMIN_NEXT.GROUPS.CREATE")]),b(Z,f)},$$slots:{default:!0}})}a(V),a(m),x(l=>{J(m,1,`flex items-center justify-between px-6 transition-[padding] duration-200 ${c()?"py-2":"pt-6 pb-3"}`),J(I,1,`font-semibold tracking-tight text-foreground transition-[font-size] duration-200 ${c()?"text-sm":"text-xl"}`),d(ue,l)},[()=>o.t("ADMIN_NEXT.GROUPS.NEW_GROUP")]),b(n,m)},$$slots:{default:!0}});var L=s(C,2),K=r(L),O=r(K),$=r(O),ie=r($,!0);a($);var _=s($,2);k(_);var j=s(_,2),ne=r(j,!0);a(j),a(O);var G=s(O,2),U=r(G),le=r(U,!0);a(U);var B=s(U,2);k(B),a(G);var H=s(G,2),D=r(H),de=r(D,!0);a(D);var W=s(D,2);k(W),a(H),a(K),a(L),a(R),x((e,n,S,c,m)=>{d(ie,e),Ee(_,"placeholder",n),d(ne,S),d(le,c),d(de,m)},[()=>o.t("ADMIN_NEXT.GROUPS.GROUP_NAME"),()=>o.t("ADMIN_NEXT.GROUPS.GROUP_NAME_PLACEHOLDER"),()=>o.t("ADMIN_NEXT.GROUPS.GROUP_NAME_HELP"),()=>o.t("ADMIN_NEXT.GROUPS.DISPLAY_NAME"),()=>o.t("ADMIN_NEXT.GROUPS.DESCRIPTION")]),X(_,()=>t(u),e=>v(u,e)),X(B,()=>t(E),e=>v(E,e)),X(W,()=>t(A),e=>v(A,e)),b(ae,R),ve()}export{Ye as component};
|