1import{u as Ze,f as es,r as m,j as e}from"./vendor-react-GnwsTJfO.js";import{f as g,U as N,ag as R,N as ie,F as de,B as j,Y as ss,x as k,a$ as oe,C as b,g as v,M as ts,a8 as ns,a9 as as,aa as ls,ab as rs,ac as is,ad as ds,E as U,G as q,T as ce,o as me,p as D,q as p,r as xe,t as i,n as he,i as os,j as cs,k as ms,l as xs,m as ue,a2 as hs,V as us}from"./index-Bj2Y77AF.js";import{e as pe,g as ge,E as ps}from"./AdminNavigation-DYLQ05kD.js";import{C as E}from"./checkbox-BAFwp2Vs.js";import{T as gs,a as js,b as z,c as I}from"./tabs-V3f5EPci.js";import{S as fs}from"./switch-DraYssLT.js";import{A as je,a as fe,b as Ne,c as be,d as ve,e as _e,f as ye,g as we}from"./alert-dialog-BHHcOqiA.js";import{U as Ns}from"./upload-D3gF-COp.js";import{U as ke}from"./users-CHiFHZvy.js";import{C as bs}from"./circle-check-big-Za92oeq3.js";import{T as P}from"./trash-2-D673yTlG.js";import"./vendor-cjs-BcELrC9x.js";import"./vendor-supabase-BWPZKnGU.js";import"./vendor-ui-C1xCQL2z.js";import"./vendor-utils-B2rm_Apj.js";import"./vendor-query-Dp4tHR6-.js";import"./MasonicCross-CB_Vslf8.js";import"./image-l440pP5V.js";function Gs(){const J=Ze(),{id:w}=es(),[x,Ce]=m.useState(null),[c,C]=m.useState([]),[S,Se]=m.useState([]),[$e,De]=m.useState([]),[Me,Te]=m.useState([]),[Le,Ae]=m.useState(!0),[H,Fe]=m.useState(!0),[M,L]=m.useState(null),[Re,K]=m.useState(""),[V,Ee]=m.useState([]),[Pe,Y]=m.useState(!1),[He,G]=m.useState(!1),[O,Q]=m.useState(!1),[d,$]=m.useState(null),[A,W]=m.useState(!1);m.useEffect(()=>{w&&X()},[w]);const X=async()=>{try{const{data:s,error:a}=await g.from("info_meetings").select("id, title, event_date, event_time, status, meeting_type").eq("id",w).single();if(a)throw a;Ce(s);const{data:t,error:n}=await g.from("info_meeting_registrations").select("*").eq("meeting_id",w).order("created_at",{ascending:!0});if(n)throw n;const r=(t||[]).filter(h=>h.registration_type==="member").map(h=>h.id);let l={};if(r.length>0){const{data:h}=await g.from("info_meeting_guests").select("*").in("registration_id",r);l=(h||[]).reduce((_,y)=>(_[y.registration_id]||(_[y.registration_id]=[]),_[y.registration_id].push(y),_),{})}const u=(t||[]).map(h=>({...h,guests:l[h.id]||[]}));C(u);const o=Array.from(new Set(u.map(h=>h.member_lodge_id).filter(Boolean)));if(o.length>0){const{data:h}=await g.from("lodges").select("id, name, lodge_number, category_id").in("id",o),_=h||[];Se(_);const y=_.map(Xe=>Xe.lodge_number),{data:We}=await g.from("contact_persons").select("id, lodge_number, title, email").in("lodge_number",y).in("title",["Ordførende Mester","Sekretær"]);De(We||[])}const{data:f}=await g.from("info_meeting_lodge_reports").select("id, lodge_id, sent_at, recipient_emails, attendee_count, guest_count").eq("meeting_id",w).order("sent_at",{ascending:!1});Te(f||[])}catch(s){console.error(s),N.error("Kunne ikke laste data")}finally{Ae(!1)}},Z=async(s,a)=>{try{const{error:t}=await g.from("info_meeting_registrations").update({attended:a}).eq("id",s);if(t)throw t;C(n=>n.map(r=>r.id===s?{...r,attended:a}:r))}catch(t){console.error(t),N.error("Kunne ikke oppdatere oppmøte")}},ee=async(s,a)=>{try{const{error:t}=await g.from("info_meeting_guests").update({attended:a}).eq("id",s);if(t)throw t;C(n=>n.map(r=>{var l;return{...r,guests:(l=r.guests)==null?void 0:l.map(u=>u.id===s?{...u,attended:a}:u)}}))}catch(t){console.error(t),N.error("Kunne ikke oppdatere oppmøte")}},Ge=async(s,a)=>{try{const{error:t}=await g.from("info_meeting_registrations").update({registration_type:a}).eq("id",s);if(t)throw t;C(n=>n.map(r=>r.id===s?{...r,registration_type:a}:r)),N.success("Type oppdatert")}catch(t){console.error(t),N.error((t==null?void 0:t.message)||"Kunne ikke oppdatere type")}},Oe=async()=>{if(d){W(!0);try{if(d.type==="registration"){const{error:s}=await g.from("info_meeting_registrations").delete().eq("id",d.id);if(s)throw s;C(a=>a.filter(t=>t.id!==d.id)),N.success("Påmeldingen ble slettet")}else{const{error:s}=await g.from("info_meeting_guests").delete().eq("id",d.id);if(s)throw s;C(a=>a.map(t=>{var n;return{...t,guests:(n=t.guests)==null?void 0:n.filter(r=>r.id!==d.id)}})),N.success("Gjesten ble slettet")}$(null)}catch(s){console.error(s),N.error((s==null?void 0:s.message)||"Kunne ikke slette")}finally{W(!1)}}},Be=()=>{const s=c.filter(n=>!n.on_waitlist),a=c.filter(n=>n.on_waitlist);let t=`Navn;E-post;Telefon;Fødselsår;Type;Venteliste;Påmeldt;Møtte opp 2`;
2[...s,...a].forEach(n=>{var r;t+=`${n.name};${n.email};${n.phone};${n.birth_year||""};${n.registration_type==="member"?"Bror":"à pen"};${n.on_waitlist?"Ja":"Nei"};${k(new Date(n.created_at),"dd.MM.yyyy HH:mm")};${n.attended===!0?"Ja":n.attended===!1?"Nei":""} 3`,(r=n.guests)==null||r.forEach(l=>{t+=`${l.name} (gjest);${l.email};${l.phone};${l.birth_year};Gjest;${n.on_waitlist?"Ja":"Nei"};;${l.attended===!0?"Ja":l.attended===!1?"Nei":""} 4`})}),se(t,`pameldte-${(x==null?void 0:x.title)||"infomote"}-${k(new Date,"yyyy-MM-dd")}.csv`)},Ue=()=>{var r;let s=`Loge;Logenr;Navn;Type;Gjest av;Fødselsår;E-post;Telefon;Oppmøte;Møtedato 5`;const a=x?k(new Date(x.event_date),"dd.MM.yyyy"):"",t=R(S);for(const l of t){const u=c.filter(o=>o.member_lodge_id===l.id);for(const o of u)s+=`${l.name};${l.lodge_number};${o.name};Bror;;${o.birth_year||""};${o.email};${o.phone};${o.attended===!0?"Ja":o.attended===!1?"Nei":""};${a} 6`,(r=o.guests)==null||r.forEach(f=>{s+=`${l.name};${l.lodge_number};${f.name};Gjest;${o.name};${f.birth_year};${f.email};${f.phone};${f.attended===!0?"Ja":f.attended===!1?"Nei":""};${a} 7`})}const n=c.filter(l=>!l.member_lodge_id);for(const l of n)s+=`Uten loge;;${l.name};${l.registration_type==="member"?"Bror":"à pen"};;${l.birth_year||""};${l.email};${l.phone};${l.attended===!0?"Ja":l.attended===!1?"Nei":""};${a} 8`;se(s,`pameldte-per-loge-${(x==null?void 0:x.title)||"infomote"}-${k(new Date,"yyyy-MM-dd")}.csv`)},se=(s,a)=>{const t=new Blob(["\uFEFF"+s],{type:"text/csv;charset=utf-8;"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=a,r.click(),URL.revokeObjectURL(n)},te=m.useMemo(()=>{const s=new Map;for(const t of c){if(!t.member_lodge_id)continue;const n=s.get(t.member_lodge_id)||[];n.push(t),s.set(t.member_lodge_id,n)}return R(S).filter(t=>s.has(t.id)).map(t=>({lodge:t,regs:s.get(t.id)||[]}))},[c,S]),ne=m.useMemo(()=>c.filter(s=>!s.member_lodge_id),[c]),F=s=>{const a=$e.filter(r=>r.lodge_number===s.lodge_number),t=a.find(r=>r.title==="Ordførende Mester"),n=a.find(r=>r.title==="Sekretær");return{list:[t==null?void 0:t.email,n==null?void 0:n.email].filter(r=>!!r),om:(t==null?void 0:t.email)||null,sekr:(n==null?void 0:n.email)||null}},qe=s=>Me.find(a=>a.lodge_id===s)||null,ze=async s=>{L(s),Y(!0),K("");try{const{data:a,error:t}=await g.functions.invoke("send-lodge-attendance-report",{body:{meeting_id:w,lodge_ids:[s],include_unmarked:H,preview:!0}});if(t)throw t;const n=((a==null?void 0:a.results)||[])[0];K((n==null?void 0:n.html)||""),Ee((n==null?void 0:n.recipients)||[])}catch(a){console.error(a),N.error("Kunne ikke generere forhåndsvisning")}finally{Y(!1)}},B=async s=>{Q(!0);try{const{data:a,error:t}=await g.functions.invoke("send-lodge-attendance-report",{body:{meeting_id:w,lodge_ids:s,include_unmarked:H,preview:!1}});if(t)throw t;const n=(a==null?void 0:a.results)||[],r=n.filter(o=>o.status==="sent").length,l=n.filter(o=>o.status==="skipped").length,u=n.filter(o=>o.status==="failed").length;N.success(`Sendt: ${r}. Hoppet over: ${l}. Feilet: ${u}.`),L(null),G(!1),await X()}catch(a){console.error(a),N.error("Kunne ikke sende rapport")}finally{Q(!1)}},Ie=c.filter(s=>!s.on_waitlist).length,Je=c.filter(s=>s.on_waitlist).length,ae=c.filter(s=>s.attended===!0).length,le=c.reduce((s,a)=>{var t;return s+(((t=a.guests)==null?void 0:t.length)||0)},0),Ke=c.reduce((s,a)=>{var t;return s+(((t=a.guests)==null?void 0:t.filter(n=>n.attended===!0).length)||0)},0),Ve=(x==null?void 0:x.meeting_type)==="closed";if(Le)return e.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[e.jsx(ie,{}),e.jsx(pe,{}),e.jsx("main",{className:"flex-grow flex items-center justify-center",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}),e.jsx(de,{})]});const re=()=>e.jsxs(b,{children:[e.jsx(U,{children:e.jsx(q,{children:"Påmeldte deltakere"})}),e.jsx(v,{children:c.length===0?e.jsx("p",{className:"text-muted-foreground text-center py-8",children:"Ingen påmeldte ennå"}):e.jsxs(ce,{children:[e.jsx(me,{children:e.jsxs(D,{children:[e.jsx(p,{children:"Møtte opp"}),e.jsx(p,{children:"Navn"}),e.jsx(p,{className:"hidden md:table-cell",children:"E-post"}),e.jsx(p,{className:"hidden md:table-cell",children:"Telefon"}),e.jsx(p,{className:"hidden lg:table-cell",children:"Fødselsår"}),e.jsx(p,{children:"Type"}),e.jsx(p,{className:"hidden lg:table-cell",children:"Påmeldt"}),e.jsx(p,{className:"w-12"})]})}),e.jsx(xe,{children:c.map(s=>{var a;return e.jsxs(e.Fragment,{children:[e.jsxs(D,{className:s.on_waitlist?"opacity-60":"",children:[e.jsx(i,{children:e.jsx(E,{checked:s.attended===!0,onCheckedChange:t=>Z(s.id,t)})}),e.jsxs(i,{className:"font-medium",children:[s.name,s.on_waitlist&&e.jsx(he,{variant:"outline",className:"ml-2",children:"Venteliste"}),e.jsxs("span",{className:"block md:hidden text-xs font-normal text-muted-foreground break-all",children:[s.email,s.phone?` · ${s.phone}`:""]})]}),e.jsx(i,{className:"hidden md:table-cell",children:s.email}),e.jsx(i,{className:"hidden md:table-cell",children:s.phone}),e.jsx(i,{className:"hidden lg:table-cell",children:s.birth_year||"-"}),e.jsx(i,{children:e.jsxs(os,{value:s.registration_type,onValueChange:t=>Ge(s.id,t),children:[e.jsx(cs,{className:"h-8 w-[110px]",children:e.jsx(ms,{})}),e.jsxs(xs,{children:[e.jsx(ue,{value:"member",children:"Broder"}),e.jsx(ue,{value:"public",children:"Gjest"})]})]})}),e.jsx(i,{className:"hidden lg:table-cell",children:k(new Date(s.created_at),"dd.MM.yyyy HH:mm")}
8),e.jsx(i,{children:e.jsx(j,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>{var t;return $({type:"registration",id:s.id,name:s.name,guestCount:((t=s.guests)==null?void 0:t.length)||0})},"aria-label":"Slett påmelding",children:e.jsx(P,{className:"w-4 h-4"})})})]},s.id),(a=s.guests)==null?void 0:a.map(t=>e.jsxs(D,{className:"bg-muted/30",children:[e.jsx(i,{children:e.jsx(E,{checked:t.attended===!0,onCheckedChange:n=>ee(t.id,n)})}),e.jsxs(i,{className:"font-medium pl-8",children:["Ⳡ",t.name,e.jsxs("span",{className:"block md:hidden text-xs font-normal text-muted-foreground break-all",children:[t.email,t.phone?` · ${t.phone}`:""]})]}),e.jsx(i,{className:"hidden md:table-cell",children:t.email}),e.jsx(i,{className:"hidden md:table-cell",children:t.phone}),e.jsx(i,{className:"hidden lg:table-cell",children:t.birth_year}),e.jsx(i,{children:e.jsx(he,{variant:"outline",children:"Gjest"})}),e.jsx(i,{className:"hidden lg:table-cell",children:"-"}),e.jsx(i,{children:e.jsx(j,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>$({type:"guest",id:t.id,name:t.name,registrationName:s.name}),"aria-label":"Slett gjest",children:e.jsx(P,{className:"w-4 h-4"})})})]},t.id))]})})})]})})]}),Ye=()=>e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:te.length}),e.jsx("p",{className:"text-muted-foreground",children:"Deltakende loger"})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-2xl font-bold",children:[ae," / ",c.filter(s=>s.registration_type==="member").length]}),e.jsx("p",{className:"text-muted-foreground",children:"Brødre (til stede / påmeldt)"})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-2xl font-bold",children:[Ke," / ",le]}),e.jsx("p",{className:"text-muted-foreground",children:"Gjester (til stede / påmeldt)"})]}),e.jsx("div",{className:"flex items-end",children:e.jsxs(j,{variant:"outline",size:"sm",onClick:Ue,children:[e.jsx(oe,{className:"w-4 h-4 mr-2"}),"Eksporter per loge"]})})]})})}),te.map(({lodge:s,regs:a})=>{const t=a.reduce((n,r)=>{var l;return n+(((l=r.guests)==null?void 0:l.length)||0)},0);return e.jsxs(b,{children:[e.jsx(U,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[e.jsxs(q,{className:"text-base",children:[s.name," ",e.jsxs("span",{className:"text-muted-foreground",children:["(",s.lodge_number,")"]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[a.length," brødre · ",t," gjester"]})]})}),e.jsx(v,{children:e.jsx("div",{className:"space-y-2",children:a.map(n=>{var r;return e.jsxs("div",{className:"border-b last:border-0 pb-2 last:pb-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(E,{checked:n.attended===!0,onCheckedChange:l=>Z(n.id,l)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"font-medium text-sm",children:[n.name,n.birth_year&&e.jsxs("span",{className:"text-muted-foreground font-normal",children:[" (f. ",n.birth_year,")"]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:[n.email," · ",n.phone]})]}),e.jsx(j,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive shrink-0",onClick:()=>{var l;return $({type:"registration",id:n.id,name:n.name,guestCount:((l=n.guests)==null?void 0:l.length)||0})},"aria-label":"Slett påmelding",children:e.jsx(P,{className:"w-3.5 h-3.5"})})]}),(r=n.guests)==null?void 0:r.map(l=>e.jsxs("div",{className:"flex items-center gap-3 pl-8 mt-1",children:[e.jsx(E,{checked:l.attended===!0,onCheckedChange:u=>ee(l.id,u)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-sm",children:["Ⳡ",l.name,l.birth_year&&e.jsxs("span",{className:"text-muted-foreground",children:[" (f. ",l.birth_year,")"]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:[l.email," · ",l.phone]}
8)]}),e.jsx(j,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive shrink-0",onClick:()=>$({type:"guest",id:l.id,name:l.name,registrationName:n.name}),"aria-label":"Slett gjest",children:e.jsx(P,{className:"w-3.5 h-3.5"})})]},l.id))]},n.id)})})})]},s.id)}),ne.length>0&&e.jsxs(b,{children:[e.jsx(U,{className:"pb-2",children:e.jsx(q,{className:"text-base text-muted-foreground",children:"Uten loge-tilknytning"})}),e.jsx(v,{children:e.jsx("div",{className:"space-y-1 text-sm",children:ne.map(s=>e.jsxs("div",{children:[s.name,s.birth_year&&e.jsxs("span",{className:"text-muted-foreground",children:[" (f. ",s.birth_year,")"]})]},s.id))})})]})]}),Qe=()=>{const s=R(S).filter(t=>c.some(n=>n.member_lodge_id===t.id)),a=s.filter(t=>F(t).list.length>0).length;return e.jsxs("div",{className:"space-y-4",children:[e.jsx(b,{children:e.jsxs(v,{className:"pt-6 flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(fs,{id:"include-unmarked",checked:H,onCheckedChange:Fe}),e.jsx("label",{htmlFor:"include-unmarked",className:"text-sm",children:"Inkluder ogsÃ¥ pÃ¥meldte som ikke er markert til stede"})]}),e.jsxs(j,{onClick:()=>G(!0),disabled:a===0||O,children:[e.jsx(ge,{className:"w-4 h-4 mr-2"}),"Send til alle loger (",a,")"]})]})}),e.jsx(b,{children:e.jsx(v,{className:"pt-6",children:e.jsxs(ce,{children:[e.jsx(me,{children:e.jsxs(D,{children:[e.jsx(p,{children:"Loge"}),e.jsx(p,{children:"Brødre"}),e.jsx(p,{children:"Gjester"}),e.jsx(p,{children:"Mottakere"}),e.jsx(p,{children:"Sist sendt"}),e.jsx(p,{className:"text-right",children:"Handlinger"})]})}),e.jsxs(xe,{children:[s.map(t=>{const n=c.filter(h=>h.member_lodge_id===t.id),r=n.reduce((h,_)=>{var y;return h+(((y=_.guests)==null?void 0:y.length)||0)},0),{list:l,om:u,sekr:o}=F(t),f=qe(t.id);return e.jsxs(D,{children:[e.jsxs(i,{className:"font-medium",children:[t.name," ",e.jsxs("span",{className:"text-muted-foreground",children:["(",t.lodge_number,")"]})]}),e.jsx(i,{children:n.length}),e.jsx(i,{children:r}),e.jsx(i,{className:"text-xs",children:l.length===0?e.jsx("span",{className:"text-destructive",children:"Ingen mottakere"}):e.jsxs("div",{className:"space-y-0.5",children:[u?e.jsxs("div",{children:["OM: ",u]}):e.jsx("div",{className:"text-muted-foreground",children:"Mangler OM"}),o?e.jsxs("div",{children:["Sekr: ",o]}):e.jsx("div",{className:"text-muted-foreground",children:"Mangler sekretær"})]})}),e.jsx(i,{className:"text-xs",children:f?k(new Date(f.sent_at),"dd.MM.yyyy HH:mm"):"â"}),e.jsx(i,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(j,{variant:"outline",size:"sm",onClick:()=>ze(t.id),children:[e.jsx(ps,{className:"w-3.5 h-3.5 mr-1"}),"ForhÃ¥ndsvis"]}),e.jsxs(j,{size:"sm",disabled:l.length===0||O,onClick:()=>B([t.id]),children:[e.jsx(hs,{className:"w-3.5 h-3.5 mr-1"}),f?"Send pÃ¥ nytt":"Send"]})]})})]},t.id)}),s.length===0&&e.jsx(D,{children:e.jsx(i,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"Ingen loger med pÃ¥meldte brødre."})})]})]})})})]})},T=M?S.find(s=>s.id===M):null;return e.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[e.jsx(ie,{}),e.jsx(pe,{}),e.jsxs("main",{className:"flex-grow container mx-auto px-4 py-8",children:[e.jsx("div",{className:"flex items-center gap-4 mb-6",children:e.jsxs(j,{variant:"ghost",onClick:()=>J("/admin/info-meetings"),children:[e.jsx(ss,{className:"w-4 h-4 mr-2"}),"Tilbake"]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-start mb-8 gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-serif text-foreground",children:x==null?void 0:x.title}),x&&e.jsxs("p",{className:"text-muted-foreground mt-2",children:[k(new Date(x.event_date),"PPP",{locale:us})," kl."," ",x.event_time.substring(0,5)]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:flex gap-2",children:[e.jsxs(j,{variant:"outline",size:"sm",className:"sm:h-10 sm:px-4",onClick:()=>J(`/admin/info-meetings/${w}/import`),children:[e.jsx(Ns,{className:"w-4 h-4 mr-2"}),"Importer"]}),e.jsxs(j,{size:"sm",className:"sm:h-10 sm:px-4",onClick:Be,children:[e.jsx(oe,{className:"w-4 h-4 mr-2"}),"Eksporter"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 sm:gap-4 mb-8",children:[e.jsx(b,{children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"w-5 h-5 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:Ie}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"PÃ¥meldte"})]})]})})}),e.jsx(b,{children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"w-5 h-5 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:le}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Gjester"})]})]})})}),e.jsx(b,{children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ts,{className:"w-5 h-5 text-amber-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:Je}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Venteliste"})]})]})})}),e.jsx(b,{children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(bs,{className:"w-5 h-5 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:ae}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Møtte opp"})]})]})})})]}),Ve?e.jsxs(gs,{defaultValue:"all",className:"w-full",children:[e.jsxs(js,{className:"grid w-full grid-cols-3 h-auto sm:inline-flex sm:w-auto",children:[e.jsx(z,{value:"all",className:"text-xs sm:text-sm px-2 py-2",children:"Alle pÃ¥meldte"}),e.jsx(z,{value:"per-lodge",className:"text-xs sm:text-sm px-2 py-2",children:"Per loge"}),e.jsx(z,{value:"reports",className:"text-xs sm:text-sm px-2 py-2",children:"Rapporter"})]}),e.jsx(I,{value:"all",className:"mt-4",children:re()}),e.jsx(I,{value:"per-lodge",className:"mt-4",children:Ye()}),e.jsx(I,{value:"reports",className:"mt-4",children:Qe()})]}
8):re(),e.jsx(ns,{open:!!M,onOpenChange:s=>!s&&L(null),children:e.jsxs(as,{className:"max-w-3xl",children:[e.jsxs(ls,{children:[e.jsx(rs,{children:"ForhÃ¥ndsvisning av e-post"}),e.jsx(is,{children:T?e.jsxs(e.Fragment,{children:["Til ",T.name," (",T.lodge_number,")",V.length>0&&e.jsxs("span",{className:"block mt-1 text-xs",children:["Mottakere: ",V.join(", ")]})]}):null})]}),e.jsx("div",{className:"border rounded-md bg-card max-h-[60vh] overflow-auto",children:Pe?e.jsx("div",{className:"p-8 text-center text-muted-foreground",children:"Genererer â¦"}):e.jsx("iframe",{title:"E-post forhÃ¥ndsvisning",srcDoc:Re,className:"w-full min-h-[400px]"})}),e.jsxs(ds,{children:[e.jsx(j,{variant:"outline",onClick:()=>L(null),children:"Lukk"}),e.jsxs(j,{onClick:()=>M&&B([M]),disabled:O||!T||F(T).list.length===0,children:[e.jsx(ge,{className:"w-4 h-4 mr-2"}),"Send nÃ¥"]})]})]})}),e.jsx(je,{open:He,onOpenChange:G,children:e.jsxs(fe,{children:[e.jsxs(Ne,{children:[e.jsx(be,{children:"Send rapport til alle loger?"}),e.jsx(ve,{children:"Rapporten sendes til Ordførende Mester og Sekretær i alle loger med registrerte mottakere. Loger uten registrert OM eller sekretær blir hoppet over."})]}),e.jsxs(_e,{children:[e.jsx(ye,{children:"Avbryt"}),e.jsx(we,{onClick:()=>{const s=R(S).filter(a=>F(a).list.length>0).filter(a=>c.some(t=>t.member_lodge_id===a.id)).map(a=>a.id);B(s)},children:"Send nÃ¥"})]})]})}),e.jsx(je,{open:!!d,onOpenChange:s=>!s&&!A&&$(null),children:e.jsxs(fe,{children:[e.jsxs(Ne,{children:[e.jsx(be,{children:(d==null?void 0:d.type)==="registration"?"Slette pÃ¥melding?":"Slette gjest?"}),e.jsx(ve,{children:(d==null?void 0:d.type)==="registration"?e.jsxs(e.Fragment,{children:["Du er i ferd med Ã¥ slette pÃ¥meldingen til"," ",e.jsx("strong",{children:d.name}),".",d.guestCount>0&&e.jsxs(e.Fragment,{children:[" ","Dette vil ogsÃ¥ slette"," ",e.jsxs("strong",{children:[d.guestCount," tilknyttede"," ",d.guestCount===1?"gjest":"gjester"]}),"."]})," ","Handlingen kan ikke angres, og det blir ikke sendt noen avbestillingsbekreftelse til deltakeren."]}):(d==null?void 0:d.type)==="guest"?e.jsxs(e.Fragment,{children:["Du er i ferd med Ã¥ slette gjesten"," ",e.jsx("strong",{children:d.name})," (invitert av"," ",d.registrationName,"). Handlingen kan ikke angres."]}):null})]}),e.jsxs(_e,{children:[e.jsx(ye,{disabled:A,children:"Avbryt"}),e.jsx(we,{onClick:s=>{s.preventDefault(),Oe()},disabled:A,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:A?"Sletter â¦":"Slett"})]})]})})]}),e.jsx(de,{})]})}export{Gs 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.