PageSourceSearch

https://digitalbehandling.se/assets/OrgTrainingStatusPage-BjUsj6m_.js

js digitalbehandling.se collected 2026-09-30 08:27:34 UTC 5,065 bytes, 1 lines download raw bytes

1import{l as k,r as l,g as b,j as e,B as p,A as S,d1 as T,aD as g,ac as y,aE as j,aF as f,C,c as E,d as w,aO as A,a5 as L,a as K,b5 as D,I as B,ae as h,aS as R,aT as H,aU as v,aV as r,aW as O,aX as n,k as _}from"./index-CobRY8C4.js";const P={linked:"Kopplad till verksamheten",answered_not_linked:"Ej kopplad — deltagaren har svarat",awaiting_answer:"Väntar på deltagarens svar"},I={registered:"Anmäld",in_progress:"Pågår",paused:"Pausad",completed:"Klar — diplom utfärdat"};async function V(){const{data:s,error:t}=await k("admin_org_training_status");if(t)throw new Error(t.message);return s??[]}function $(){const[s,t]=l.useState([]),[m,d]=l.useState(!0),[x,i]=l.useState(null),o=l.useCallback(async()=>{d(!0);try{t(await V()),i(null)}catch(c){i(c instanceof Error?c.message:"Kunde inte hämta utbildningsstatusen."),t([])}finally{d(!1)}},[]);return l.useEffect(()=>{o()},[o]),{rows:s,loading:m,error:x,refresh:o}}function q(s){return s?new Date(s).toLocaleDateString("sv-SE"):"—"}function z(s){return s.progress_state==="completed"?"default":s.progress_state==="in_progress"?"secondary":"outline"}function U(){const s=b(),{rows:t,loading:m,error:d,refresh:x}=$(),[i,o]=l.useState(""),c=l.useMemo(()=>{const a=i.trim().toLowerCase();return a?t.filter(u=>[u.participant_name,u.participant_email,u.course_title,u.certificate_number].filter(Boolean).some(N=>N.toLowerCase().includes(a))):t},[t,i]);return e.jsxs("div",{className:"mx-auto max-w-[1200px] space-y-6 p-4 md:p-6",children:[e.jsxs(p,{variant:"ghost",size:"sm",onClick:()=>s(-1),className:"gap-2",children:[e.jsx(S,{className:"h-4 w-4"}),"Tillbaka"]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-semibold",children:[e.jsx(T,{className:"h-6 w-6 text-primary"}),"Anställdas utbildningsstatus"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Här ser du vilka i verksamheten som är anmälda till utbildning, hur långt de kommit och vilket diplomnummer de fått."})]}),e.jsxs(g,{children:[e.jsx(y,{className:"h-4 w-4"}),e.jsx(j,{children:"Vad du inte ser"}),e.jsx(f,{children:"Prov, inlämnade svar, poäng och bedömarkommentarer visas aldrig här — de tillhör deltagaren. Kopplingen till verksamheten avgörs enbart av deltagarens eget svar. Har någon svarat nej visas bara att ett svar lämnats, aldrig vad hen svarade."})]}),e.jsxs(C,{children:[e.jsxs(E,{className:"flex flex-row items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(w,{children:"Deltagare"}),e.jsx(A,{children:m?"Hämtar…":`${c.length} av ${t.length} rader`})]}),e.jsxs(p,{variant:"outline",size:"sm",onClick:()=>void x(),className:"gap-2",children:[e.jsx(L,{className:"h-4 w-4"}),"Uppdatera"]})]}),e.jsxs(K,{className:"space-y-4",children:[e.jsxs("div",{className:"relative max-w-sm",children:[e.jsx(D,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(B,{value:i,onChange:a=>o(a.target.value),placeholder:"Sök namn, e-post, kurs eller diplomnummer",className:"pl-9"})]}),d&&e.jsxs(g,{variant:"destructive",children:[e.jsx(j,{children:"Kunde inte hämta listan"}),e.jsx(f,{children:d})]}),m?e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:"h-10 w-full"}),e.jsx(h,{className:"h-10 w-full"}),e.jsx(h,{className:"h-10 w-full"})]}):c.length===0?e.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"Inga anmälda deltagare att visa ännu."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(R,{children:[e.jsx(H,{children:e.jsxs(v,{children:[e.jsx(r,{children:"Namn"}),e.jsx(r,{children:"E-post"}),e.jsx(r,{children:"Kurstillfälle"}),e.jsx(r,{children:"Kursstart"}),e.jsx(r,{children:"Status"}),e.jsx(r,{children:"Koppling"}),e.jsx(r,{children:"Diplomnummer"})]})}),e.jsx(O,{children:c.map(a=>e.jsxs(v,{children:[e.jsxs(n,{className:"font-medium",children:[a.participant_name??"Namn saknas",a.participant_role&&e.jsx("span",{className:"block text-xs text-muted-foreground",children:a.participant_role}),a.is_test_data&&e.jsx(_,{variant:"outline",className:"mt-1",children:"TEST"})]}),e.jsx(n,{children:a.participant_email?e.jsx("a",{href:`mailto:${a.participant_email}`,className:"text-sm text-primary underline-offset-2 hover:underline",children:a.participant_email}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"E-post saknas"})}),e.jsx(n,{children:a.course_title??"—"}),e.jsx(n,{children:q(a.course_start)}),e.jsxs(n,{children:[e.jsx(_,{variant:z(a),children:I[a.progress_state]}),a.blocks_completed>0&&a.progress_state!=="completed"&&e.jsxs("span",{className:"block text-xs text-muted-foreground",children:[a.blocks_completed," av 3 block klara"]})]}),e.jsx(n,{className:"text-sm text-muted-foreground",children:P[a.link_state]}),e.jsx(n,{children:a.certificate_number?e.jsx("span",{className:"font-mono text-sm",children:a.certificate_number}):e.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})})]},a.signup_id))})]})})]})]})]})}export{U 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.