PageSourceSearch

https://itganzheitlich.de/assets/admin.benutzer-DtqJqktK.js

js itganzheitlich.de collected 2026-10-09 22:04:24 UTC 4,494 bytes, 1 lines download raw bytes

1import{E as x,F as h,H as u,a2 as w,a as R,r as _,j as e,B as o}from"./index-rJe3K42J.js";import{u as c}from"./useServerFn-CHaTzvCt.js";import{u as j}from"./useMutation-DTEJXkwz.js";import{B as y}from"./badge-BuoMQ3A_.js";import{S as T}from"./skeleton-CL3h64Sm.js";import{T as C,a as z,b as d,c as t,d as E,e as r}from"./table-UIaU4CIJ.js";import{S as M,a as q,b as F,c as B,d as m}from"./select-CR_Uyusw.js";import{t as l}from"./index-CgME4r_n.js";import{S as H}from"./shield-check-DP1PcVhV.js";import{S as A}from"./shield-D7is8ut5.js";import{X as L}from"./x-CcBTHzOg.js";import{f as v}from"./format-BS8Ay9AX.js";import{c as K}from"./createLucideIcon-CsrVDcwM.js";import"./index-CO83ps-Q.js";import"./index-Ti1s0iFR.js";import"./index-DSPw5FvC.js";import"./index-tYDn-WvL.js";import"./index-D9A0Z0Od.js";import"./index-Id9UFQbS.js";import"./index-AaRhqpaN.js";import"./index-DDAl_oPg.js";import"./chevron-down-BXpv-Rg9.js";import"./check-BE_LYMyQ.js";const P=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Q=K("user-plus",P),O=x({method:"GET"}).middleware([h]).handler(u("d8e3329caf7de737f1fa11a140a2e28debca87c101360f889139202ea2583ee1")),D=x({method:"POST"}).middleware([h]).handler(u("fd12dad15c26b8954b68f55029529c2d2ed6973176a230e65371fe4dbe27618d")),G=x({method:"POST"}).middleware([h]).handler(u("6ff702596c3041f8b40be604cd13787a15ac7b3a33ea3000d3cfec68e5e919f0"));function ue(){const p=w(),g=c(O),N=c(D),S=c(G),f=R({queryKey:["adm-users"],queryFn:()=>g()}),[n,i]=_.useState(null),b=j({mutationFn:s=>N({data:s}),onSuccess:()=>{p.invalidateQueries({queryKey:["adm-users"]}),l.success("Rolle vergeben"),i(null)},onError:s=>l.error(s instanceof Error?s.message:"Fehler")}),k=j({mutationFn:s=>S({data:s}),onSuccess:()=>{p.invalidateQueries({queryKey:["adm-users"]}),l.success("Rolle entzogen")},onError:s=>l.error(s instanceof Error?s.message:"Fehler")});return e.jsxs("div",{className:"mx-auto max-w-6xl px-5 lg:px-8 py-8",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"font-display text-2xl text-primary",children:"Benutzer & Rollen"}),e.jsx("p",{className:"text-sm text-ink-soft",children:"Rollen verwalten. Super-Admin ist geschützt."})]}),e.jsx("div",{className:"rounded-xl border border-hairline overflow-hidden",children:e.jsxs(C,{children:[e.jsx(z,{children:e.jsxs(d,{children:[e.jsx(t,{children:"E-Mail"}),e.jsx(t,{children:"Rollen"}),e.jsx(t,{children:"Letzter Login"}),e.jsx(t,{children:"Registriert"}),e.jsx(t,{className:"text-right",children:"Aktionen"})]})}),e.jsx(E,{children:f.isLoading?e.jsx(d,{children:e.jsx(r,{colSpan:5,children:e.jsx(T,{className:"h-8 w-full"})})}):f.data?.map(s=>e.jsxs(d,{children:[e.jsxs(r,{children:[e.jsx("div",{className:"font-medium",children:s.email}),s.is_super_admin&&e.jsxs(y,{variant:"default",className:"mt-1",children:[e.jsx(H,{className:"h-3 w-3 mr-1"}),"Super-Admin"]})]}),e.jsx(r,{children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[s.roles.length===0&&e.jsx("span",{className:"text-xs text-ink-soft",children:"—"}),s.roles.map(a=>e.jsxs(y,{variant:"outline",className:"gap-1",children:[e.jsx(A,{className:"h-3 w-3"})," ",a,!(a==="admin"&&s.is_super_admin)&&e.jsx("button",{onClick:()=>{confirm(`Rolle '${a}' entziehen?`)&&k.mutate({user_id:s.id,role:a})},className:"ml-1 hover:text-destructive",children:e.jsx(L,{className:"h-3 w-3"})})]},a))]})}),e.jsx(r,{className:"text-xs text-ink-soft",children:s.last_sign_in_at?v(new Date(s.last_sign_in_at),"dd.MM.yyyy HH:mm"):"—"}),e.jsx(r,{className:"text-xs text-ink-soft",children:v(new Date(s.created_at),"dd.MM.yyyy")}),e.jsx(r,{className:"text-right",children:n?.id===s.id?e.jsxs("div",{className:"inline-flex items-center gap-1",children:[e.jsxs(M,{value:n.role,onValueChange:a=>i({id:s.id,role:a}),children:[e.jsx(q,{className:"h-8 w-32",children:e.jsx(F,{})}),e.jsxs(B,{children:[e.jsx(m,{value:"admin",children:"admin"}),e.jsx(m,{value:"editor",children:"editor"}),e.jsx(m,{value:"author",children:"author"})]})]}),e.jsx(o,{size:"sm",onClick:()=>b.mutate({user_id:s.id,role:n.role}),children:"OK"}),e.jsx(o,{size:"sm",variant:"ghost",onClick:()=>i(null),children:"×"})]}):e.jsxs(o,{size:"sm",variant:"outline",onClick:()=>i({id:s.id,role:"author"}),children:[e.jsx(Q,{className:"h-4 w-4 mr-1.5"}),"Rolle"]})})]},s.id))})]})})]})}export{ue as component};

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.