PageSourceSearch

https://www.nkc.nu/portal/assets/GroupManager-CG9XYYA9.js

js nkc.nu collected 2026-10-04 01:53:17 UTC 8,113 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-tiptap-CRdka2py.js";import{u as w,b as o}from"./vendor-i18n-Do9jGewF.js";import{H as y,C as M}from"./HelpButton-Dht5BAjR.js";import{M as C,C as S}from"./MediaPicker-D0nI0pq3.js";import{R as E}from"./RichTextEditor-BxRaERzG.js";import{s as G}from"./RichTextContent-CjBbBA82.js";import"./index-Dm1QE6j5.js";import"./vendor-firebase-B7FTlnjY.js";import"./purify.es-5AjVNlXF.js";const j=["#10b981","#3b82f6","#f43f5e","#06b6d4","#ec4899","#6366f1","#71717a","#18181b","#0ea5e9"],R=({group:s,allMembers:g,onSave:p,onClose:u})=>{const{t:a}=w(),[n,h]=o.useState(s?.name||""),[i,m]=o.useState(s?.description||""),[d,l]=o.useState(s?.color||j[0]),[c,f]=o.useState(s?.members||[]),[b,k]=o.useState(s?.ogImage),z=!s,t=r=>{f(x=>x.includes(r)?x.filter(N=>N!==r):[...x,r])},v=r=>{if(r.preventDefault(),!n.trim()){alert(a("groupManager.nameRequired"));return}p({name:n,description:i,color:d,members:c,ogImage:b})};return e.jsx("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50 p-4",children:e.jsx("div",{className:"bg-white dark:bg-dark-surface rounded-2xl shadow-xl w-full max-w-lg max-h-[90vh] flex flex-col border border-zinc-200 dark:border-zinc-800",children:e.jsxs("form",{onSubmit:v,className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"p-6 overflow-y-auto flex-grow custom-scrollbar",children:[e.jsx("h3",{className:"text-2xl font-black mb-4 text-zinc-900 dark:text-white",children:a(z?"groupManager.createGroup":"groupManager.editGroup")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-bold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider mb-1",children:a("groupManager.name")}),e.jsx("input",{id:"name",name:"name",value:n,onChange:r=>h(r.target.value),placeholder:a("groupManager.namePlaceholder"),className:"mt-1 w-full p-3 rounded-xl bg-zinc-100 dark:bg-zinc-900 border border-zinc-300 dark:border-zinc-700 text-zinc-900 dark:text-white focus:ring-primary focus:border-primary",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-bold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider mb-2",children:a("groupManager.colorCoding")}),e.jsx("div",{className:"flex flex-wrap gap-3",children:j.map(r=>e.jsx("button",{type:"button",onClick:()=>l(r),className:`w-8 h-8 rounded-full transition-transform ${d===r?"ring-2 ring-offset-2 ring-primary scale-110":"hover:scale-110"}`,style:{backgroundColor:r}},r))})]}),e.jsx("div",{className:"p-4 bg-zinc-50 dark:bg-zinc-900 rounded-2xl border-2 border-primary/20",children:e.jsx(C,{value:b||"",onChange:r=>k(r||void 0),compressOptions:S.og,label:a("groupManager.sharingImage"),previewSize:"md",tags:["group","og"],hint:a("groupManager.sharingImageHint")})}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-bold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider mb-1",children:a("groupManager.description")}),e.jsx(E,{content:i,onChange:m,placeholder:a("groupManager.descriptionPlaceholder"),minHeight:"120px",toolbarVariant:"compact"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-bold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider mb-2",children:[a("groupManager.members")," (",c.length,")"]}),e.jsx("div",{className:"max-h-40 overflow-y-auto border border-zinc-300 dark:border-zinc-700 rounded-xl bg-zinc-50 dark:bg-zinc-900 p-2 custom-scrollbar",children:g.sort((r,x)=>r.firstName.localeCompare(x.firstName)).map(r=>e.jsxs("label",{className:"flex items-center gap-3 p-2 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded-lg cursor-pointer transition-colors",children:[e.jsx("input",{type:"checkbox",checked:c.includes(r.id),onChange:()=>t(r.id),className:"h-4 w-4 rounded border-zinc-300 text-primary focus:ring-primary"}),e.jsxs("span",{className:"text-sm text-zinc-700 dark:text-zinc-300 font-medium",children:[r.firstName," ",r.lastName]})]},r.id))})]})]})]}),e.jsxs("div",{className:"bg-zinc-50 dark:bg-zinc-900/50 px-6 py-4 flex justify-end gap-3 rounded-b-2xl border-t border-zinc-200 dark:border-zinc-800",children:[e.jsx("button",{type:"button",onClick:u,className:"bg-zinc-200 hover:bg-zinc-300 dark:bg-zinc-800 dark:hover:bg-zinc-700 text-zinc-800 dark:text-white font-bold py-2 px-4 roun
1ded-xl transition-colors text-sm uppercase tracking-wide",children:a("common.cancel")}),e.jsx("button",{type:"submit",className:"bg-primary hover:bg-primary-hover text-white font-bold py-2 px-4 rounded-xl transition-colors text-sm uppercase tracking-wide shadow-lg shadow-red-900/20",children:a("common.save")})]})]})})})},B=({groups:s,allMembers:g,addGroup:p,updateGroup:u,deleteGroup:a})=>{const{t:n}=w(),[h,i]=o.useState(!1),[m,d]=o.useState(null),[l,c]=o.useState(null),f=async t=>{m?await u({...m,...t}):await p(t),i(!1),d(null)},b=t=>{d(t),i(!0)},k=t=>{c(t)},z=async()=>{l&&(await a(l.id),c(null))};return e.jsxs("div",{className:"bg-white dark:bg-dark-surface p-6 rounded-2xl shadow-sm border border-zinc-200 dark:border-zinc-800",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-center border-b border-zinc-200 dark:border-zinc-800 pb-4 mb-6 gap-4",children:[e.jsxs("h3",{className:"text-2xl md:text-4xl font-black text-zinc-900 dark:text-white uppercase tracking-tight flex items-center gap-3",children:[n("groupManager.title")," ",e.jsx(y,{section:"training_groups"})]}),e.jsx("button",{onClick:()=>{d(null),i(!0)},className:"bg-green-600 hover:bg-green-700 text-white font-bold py-2 px-4 rounded-xl transition-colors w-full sm:w-auto uppercase tracking-wide text-sm",children:n("groupManager.newGroup")})]}),e.jsx("div",{className:"max-h-[70vh] overflow-y-auto pr-2 custom-scrollbar",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:s.length>0?s.map(t=>e.jsxs("div",{className:"p-6 rounded-[2.2rem] border border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-900/50 flex flex-col h-full transition-all hover:border-primary/30 group",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl flex-shrink-0 shadow-sm overflow-hidden flex items-center justify-center bg-white dark:bg-zinc-800 border border-zinc-100 dark:border-zinc-700",children:t.ogImage?e.jsx("img",{src:t.ogImage,className:"w-full h-full object-cover",alt:""}):e.jsx("div",{className:"w-6 h-6 rounded-full",style:{backgroundColor:t.color||"#ccc"}})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h4",{className:"font-bold text-lg text-zinc-900 dark:text-white truncate group-hover:text-primary transition-colors",children:t.name}),e.jsx("span",{className:"text-xs font-bold text-zinc-400",children:n("groupManager.membersCount",{count:t.members.length})})]})]}),e.jsx("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 flex-grow mb-6 line-clamp-3",children:G(t.description)}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-auto pt-4 border-t border-zinc-100 dark:border-zinc-800/50",children:[e.jsx("button",{onClick:()=>b(t),className:"bg-zinc-900 dark:bg-white text-white dark:text-black font-black py-2.5 rounded-xl text-[9px] uppercase tracking-widest transition-all hover:scale-105 active:scale-95 shadow-sm",children:n("common.edit")}),e.jsx("button",{onClick:()=>k(t),className:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 font-black py-2.5 rounded-xl text-[9px] uppercase tracking-widest border border-red-100 dark:border-red-900/50 transition-all active:scale-95",children:n("common.delete")})]})]},t.id)):e.jsx("p",{className:"col-span-full text-center text-zinc-500 dark:text-zinc-400 py-12 italic border-2 border-dashed border-zinc-200 dark:border-zinc-800 rounded-xl",children:n("groupManager.noGroupsYet")})})}),h&&e.jsx(R,{group:m,allMembers:g,onSave:f,onClose:()=>i(!1)}),l&&e.jsx(M,{isOpen:!!l,onClose:()=>c(null),onConfirm:z,title:n("groupManager.deleteTitle"),message:n("groupManager.deleteMessage",{name:l.name}),confirmText:n("common.delete")})]})};export{B as GroupManager};

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.