1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[698],{11710:(e,s,t)=>{"use strict";t.d(s,{default:()=>m});var a=t(95155),r=t(90272),l=t(32450),n=t(12115),i=t(14282),c=t(52619),o=t.n(c),d=t(20063);function m(e){let{children:s,requiredRole:t}=e,c=(0,r.IT)(l.F.users.currentLoggedInUser),m=(0,r.n_)(l.F.users.ensureUserRole),[x,h]=(0,n.useState)(!0),[g,u]=(0,n.useState)(!1),p=(0,n.useRef)(!1),b=(0,d.useRouter)();return(console.log("ProtectedPageWrapper Debug:",{currentUser:c,isValidating:x,isAssigningRole:g,requiredRole:t}),(0,n.useEffect)(()=>{if(void 0===c)return void h(!0);if(null===c){console.log("No authenticated user found"),h(!1);return}if(!c.role&&!g&&!p.current){console.log("User has no role, assigning..."),p.current=!0,u(!0),m({}).then(e=>{console.log("Role assignment result:",e),u(!1)}).catch(e=>{console.error("Error assigning role:",e),u(!1),h(!1)});return}if(!g){if(!c.role)return(console.log("User still has no role after assignment, defaulting to teacher access"),"teacher"===t)?void h(!1):"admin"===t?void b.push("/portal"):void h(!1);if(t){if(c.role===t){console.log("User with role ".concat(c.role," accessing ").concat(t," page - allowed")),h(!1);return}console.log("Access denied: user role ".concat(c.role," does not match required role ").concat(t)),"admin"===c.role?b.push("/admin"):b.push("/portal");return}h(!1)}},[c,t,b,g,m]),x||g)?(0,a.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-blue-900 via-blue-800 to-green-600",children:[(0,a.jsx)("header",{className:"container mx-auto px-4 py-8",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("div",{className:"flex items-center space-x-4",children:(0,a.jsx)("div",{children:(0,a.jsx)("img",{src:"https://assets.macaly-user-data.dev/cdn-cgi/image/fit=scale-down,width=2000,height=2000,format=webp,quality=90/u5t1cvpuvx8ywjzer2rlho4n/mebxwfmgqryj2mml3icgwnzi/lOH9JiSyQNeLezQVHFT-w/logo-vscht-green.png",alt:"VÅ CHT Praha - Vysok\xe1 Å¡kola chemicko-technologick\xe1 v Praze",className:"h-12 w-auto"})})}),(0,a.jsx)("nav",{className:"flex items-center space-x-6",children:(0,a.jsx)(o(),{href:"/",className:"text-green-300 hover:text-green-200 transition-colors",children:"Domů"})})]})}),(0,a.jsx)("div",{className:"flex items-center justify-center py-24",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-green-400 mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-green-200",children:g?"Nastavuji \xfaÄet...":"OvÄÅuji pÅ\xedstup..."})]})})]}):c?(0,a.jsx)(a.Fragment,{children:s}):(0,a.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-blue-900 via-blue-800 to-green-600",children:[(0,a.jsx)("header",{className:"container mx-auto px-4 py-8",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("div",{className:"flex items-center space-x-4",children:(0,a.jsx)("div",{children:(0,a.jsx)("img",{src:"https://assets.macaly-user-data.dev/cdn-cgi/image/fit=scale-down,width=2000,height=2000,format=webp,quality=90/u5t1cvpuvx8ywjzer2rlho4n/mebxwfmgqryj2mml3icgwnzi/lOH9JiSyQNeLezQVHFT-w/logo-vscht-green.png",alt:"VÅ CHT Praha - Vysok\xe1 Å¡kola chemicko-technologick\xe1 v Praze",className:"h-12 w-auto"})})}),(0,a.jsx)("nav",{className:"flex items-center space-x-6",children:(0,a.jsx)(o(),{href:"/",className:"text-green-300 hover:text-green-200 transition-colors",children:"Domů"})})]})}),(0,a.jsx)("div",{className:"flex items-center justify-center py-16 px-4",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("h1",{className:"text-4xl font-bold text-white mb-8",children:"ChemMasters"}),(0,a.jsx)("p",{className:"text-green-300 mb-8",children:"Pro pÅ\xedstup na tuto str\xe1nku se pros\xedm pÅihlaste"}),(0,a.jsx)(i.A,{children:(0,a.jsx)("div",{className:"bg-green-500 hover:bg-green-600 text-white px-6 py-3 rounded-lg cursor-pointer inline-block",children:"PÅihl\xe1sit se"})})]})})]})}},47507:(e,s,t)=>{"use strict";t.d(s,{bq:()=>x,eb:()=>p,gC:()=>u,l6:()=>d,yv:()=>m});var a=t(95155),r=t(12115),l=t(55644),n=t(24033),i=t(12108),c=t(5917),o=t(25016);let d=l.bL;l.YJ;let m=l.WT,x=r.forwardRef((e,s)=>{let{className:t,children:r,...i}=e;return(0,a.jsxs)(l.l9,{ref:s,className:(0,o.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...i,children:[r,(0,a.jsx)(l.In,{asChild:!0,children:(0,a.jsx)(n.A,{className:"h-4 w-4 opacity-50"})})]})});x.displayName=l.l9.displayName;let h=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.PP,{ref:s,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...r,children:(0,a.jsx)(i.A,{className:"h-4 w-4"})})});h.displayName=l.PP.displayName;let g=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.wn,{ref:s,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...r,children:(0,a.jsx)(n.A,{className:"h-4 w-4"})})});g.displayName=l.wn.displayName;let u=r.forwardRef((e,s)=>{let{className:t,children:r,position:n="popper",...i}=e;return(0,a.jsx)(l.ZL,{children:(0,a.jsxs)(l.UC,{ref:s,className:(0,o.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...i,children:[(0,a.jsx)(h,{}),(0,a.jsx)(l.LM,{className:(0,o.cn)("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),(0,a.jsx)(g,{})]})})});u.displayName=l.UC.displayName,r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.JU,{ref:s,className:(0,o.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...r})}).displayName=l.JU.displayName;let p=r.forwardRef((e,s)=>{let{className:t,children:r,...n}=e;return(0,a.jsxs)(l.q7,{ref:s,className:(0,o.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(l.VF,{children:(0,a.jsx)(c.A,{className:"h-4 w-4"})})}),(0,a.jsx)(l.p4,{children:r})]})});p.displayName=l.q7.displayName,r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.wv,{ref:s,className:(0,o.cn)("-mx-1 my-1 h-px bg-muted",t),...r})}).displayName=l.wv.displayName},48228:(e,s,t)=>{"use strict";t.d(s,{default:()=>ey});var a=t(95155),r=t(12115),l=t(90272),n=t(25743),i=t(32450),c=t(18720),o=t(55172),d=t(36941);async function m(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2160,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.4;return new Promise((a,r)=>{let l=document.createElement("canvas"),n=l.getContext("2d"),i=new Image;if(!n)return void r(Error("Canvas context not available"));i.onload=()=>{let{width:c,height:o}=i;c>o?c>s&&(o=o*s/c,c=s):o>s&&(c=c*s/o,o=s),l.width=c,l.height=o,n.drawImage(i,0,0,c,o),l.toBlob(s=>{if(!s)return void r(Error("Failed to compress image"));let t=new File([s],e.name,{type:"image/jpeg",lastModified:Date.now()}),l=e.size,n=t.size;a({file:t,originalSize:l,compressedSize:n,compressionRatio:(l-n)/l*100})},"image/jpeg",t)},i.onerror=()=>{r(Error("Failed to load image"))},i.src=URL.createObjectURL(e)})}function x(e){return["image/jpeg","image/jpg","image/png","image/webp"].includes(e.type)}async function h(e){try{let s=await fetch("/fonts/NotoSans-Regular.ttf");if(!s.ok)return console.warn("Failed to fetch NotoSans-Regular.ttf"),!1;let t=await s.arrayBuffer(),a=btoa(new Uint8Array(t).reduce((e,s)=>e+String.fromCharCode(s),"")),r=await fetch("/fonts/NotoSans-Bold.ttf");if(!r.ok)return console.warn("Failed to fetch NotoSans-Bold.ttf"),!1;let l=await r.arrayBuffer(),n=btoa(new Uint8Array(l).reduce((e,s)=>e+String.fromCharCode(s),""));return e.addFileToVFS("NotoSans-Regular.ttf",a),e.addFont("NotoSans-Regular.ttf","NotoSans","normal"),e.addFileToVFS("NotoSans-Bold.ttf",n),e.addFont("NotoSans-Bold.ttf","NotoSans","bold"),console.log("NotoSans fonts loaded successfully"),!0}catch(e){return console.error("Error loading PDF fonts:",e),!1}}var g=t(97003),u=t(83209),p=t(67812),b=t(33789),j=t(90235),v=t(90923),N=t(54679),f=t(35646),y=t(25016);let w=f.bL,k=f.l9,C=f.ZL,S=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(f.hJ,{className:(0,y.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r,ref:s})});S.displayName=f.hJ.displayName;let T=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsxs)(C,{children:[(0,a.jsx)(S,{}),(0,a.jsx)(f.UC,{ref:s,className:(0,y.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
1nded-lg",t),...r})]})});T.displayName=f.UC.displayName;let z=e=>{let{className:s,...t}=e;return(0,a.jsx)("div",{className:(0,y.cn)("flex flex-col space-y-2 text-center sm:text-left",s),...t})};z.displayName="AlertDialogHeader";let A=e=>{let{className:s,...t}=e;return(0,a.jsx)("div",{className:(0,y.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t})};A.displayName="AlertDialogFooter";let F=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(f.hE,{ref:s,className:(0,y.cn)("text-lg font-semibold",t),...r})});F.displayName=f.hE.displayName;let E=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(f.VY,{ref:s,className:(0,y.cn)("text-sm text-muted-foreground",t),...r})});E.displayName=f.VY.displayName;let P=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(f.rc,{ref:s,className:(0,y.cn)((0,g.r)(),t),...r})});P.displayName=f.rc.displayName;let R=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(f.ZD,{ref:s,className:(0,y.cn)((0,g.r)({variant:"outline"}),"mt-2 sm:mt-0",t),...r})});R.displayName=f.ZD.displayName;var _=t(27599);let D=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(_.bL,{className:(0,y.cn)("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...r,ref:s,children:(0,a.jsx)(_.zi,{className:(0,y.cn)("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})})});D.displayName=_.bL.displayName;var O=t(47507),$=t(84916),Z=t(6132),J=t(42529),U=t(78874),V=t(23664),L=t(6613);t(93341),t(20562),t(8803);var I=t(70532),M=t(57828),H=t(84926),B=t(65229),q=t(15870),G=t(71360),K=t(61194),W=t(12108),X=t(24033),Y=t(95664),Q=t(89715),ee=t(11010),es=t(90368),et=t(27937),ea=t(21786),er=t(39867),el=t(5917),en=t(6191),ei=t(16485),ec=t(52056),eo=t(91169);let ed=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("textarea",{className:(0,y.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:s,...r})});ed.displayName="Textarea";var em=t(26983),ex=t(34172),eh=t(54485),eg=t(18085),eu=t(86651),ep=t(89559),eb=t(75426);let ej={pending:{label:"Äek\xe1",color:"bg-yellow-100 text-yellow-800 border-yellow-200",icon:em.A},sent:{label:"Odesl\xe1no",color:"bg-green-100 text-green-800 border-green-200",icon:J.A},failed:{label:"Chyba",color:"bg-red-100 text-red-800 border-red-200",icon:U.A}},ev={registration_confirmation:{label:"Potvrzen\xed registrace",description:"Odes\xedl\xe1 se automaticky po registraci t\xfdmu"},day_before_reminder:{label:"Instrukce den pÅed akc\xed",description:"Odes\xedl\xe1 se den pÅed term\xednem"},teacher_confirmation:{label:"Potvrzen\xed uÄitelk\xe1m",description:"Manu\xe1ln\xed odesl\xe1n\xed potvrzen\xed uÄitelk\xe1m"},cancellation_notice:{label:"Ozn\xe1men\xed o zruÅ¡en\xed",description:"Odes\xedl\xe1 se pÅi zruÅ¡en\xed term\xednu"}};function eN(){let[e,s]=(0,r.useState)("config"),[t,n]=(0,r.useState)(!1),[o,d]=(0,r.useState)(!1),[m,x]=(0,r.useState)(!1),[h,f]=(0,r.useState)(null),[y,C]=(0,r.useState)(null),[S,_]=(0,r.useState)("all"),[D,$]=(0,r.useState)(""),[Z,J]=(0,r.useState)(""),[U,L]=(0,r.useState)({smtpHost:"",smtpPort:587,smtpUser:"[email protected]",smtpPassword:"",fromName:"Anna z ChemMasters",fromEmail:"[email protected]",replyToEmail:"[email protected]"}),[I,H]=(0,r.useState)({name:"",type:"registration_confirmation",subject:"",content:"",sendTrigger:"on_registration",scheduleDaysBefore:1}),B=(0,l.IT)(i.F.emails.getEmailConfig),K=(0,l.IT)(i.F.emails.getAllEmailTemplates),W=(0,l.IT)(i.F.emails.getEmailLogs,{limit:100}),X=(0,l.n_)(i.F.emails.saveEmailConfig),Y=(0,l.n_)(i.F.emails.saveEmailTemplate),es=(0,l.n_)(i.F.emails.deleteEmailTemplate),et=(0,l.n_)(i.F.emails.sendTestEmail);(0,r.useEffect)(()=>{B&&(L({smtpHost:B.smtpHost,smtpPort:B.smtpPort,smtpUser:B.smtpUser,smtpPassword:"",fromName:B.fromName,fromEmail:B.fromEmail,replyToEmail:B.replyToEmail}),J(B.replyToEmail||B.fromEmail||""))},[B]);let ea=async()=>{try{await X({smtpHost:U.smtpHost,smtpPort:U.smtpPort,smtpUser:U.smtpUser,smtpPassword:U.smtpPassword,fromName:U.fromName,fromEmail:U.fromEmail,replyToEmail:U.replyToEmail}),c.oR.success("Email konfigurace byla uložena"),n(!1)}catch(e){console.error("Error saving email config:",e),c.oR.error("Chyba pÅi ukl\xe1d\xe1n\xed konfigurace")}},er=async()=>{if(!I.name||!I.subject||!I.content)return void c.oR.error("VyplÅte vÅ¡echna povinn\xe1 pole");try{await Y({templateId:null==h?void 0:h._id,...I}),c.oR.success(h?"Å ablona byla aktualizov\xe1na":"Å ablona byla vytvoÅena"),d(!1),f(null),em()}catch(e){console.error("Error saving template:",e),c.oR.error("Chyba pÅi ukl\xe1d\xe1n\xed Å¡ablony")}},el=async e=>{if(!Z.trim())return void c.oR.error("Zadejte test email adresu");if(e)try{await et({templateId:e._id,testEmail:Z,testName:"Test uživatel"}),c.oR.success("Test email odesl\xe1n na ".concat(Z))}catch(e){console.error("Error sending test email:",e),c.oR.error("Chyba pÅi odes\xedl\xe1n\xed test emailu")}else{if(!I.subject||!I.content)return void c.oR.error("VyplÅte pÅedmÄt a obsah emailu");c.oR.info("Test email z formul\xe1Åe nen\xed zat\xedm implementov\xe1n")}},ei=async e=>{try{await es({templateId:e}),c.oR.success("Å ablona byla \xfaspÄÅ¡nÄ smaz\xe1na")}catch(e){console.error("Error deleting template:",e),c.oR.error("Chyba pÅi maz\xe1n\xed Å¡ablony")}},ec=async e=>{try{c.oR.info("Opakov\xe1n\xed emailu nen\xed zat\xedm implementov\xe1no")}catch(e){console.error("Error retrying email:",e),c.oR.error("Chyba pÅi opakov\xe1n\xed emailu")}},eo=async()=>{try{c.oR.info("Inicializace v\xfdchoz\xedch Å¡ablon nen\xed zat\xedm implementov\xe1na")}catch(e){console.error("Error initializing templates:",e),c.oR.error("Chyba pÅi inicializaci Å¡ablon")}},em=()=>{H({name:"",type:"registration_confirmation",subject:"",content:"",sendTrigger:"on_registration",scheduleDaysBefore:1,isActive:!0})},eN=e=>{navigator.clipboard.writeText(e),c.oR.success("Zkop\xedrov\xe1no do schr\xe1nky")},ef=(null==W?void 0:W.filter(e=>{let s="all"===S||e.status===S,t=!D||e.recipientEmail.toLowerCase().includes(D.toLowerCase())||e.recipientName.toLowerCase().includes(D.toLowerCase())||e.subject.toLowerCase().includes(D.toLowerCase());return s&&t}))||[];return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Email Management"}),(0,a.jsx)("p",{className:"text-gray-600",children:"Konfigurace SMTP, Å¡ablony emailů a log odeslan\xfdch zpr\xe1v"})]}),(0,a.jsxs)(g.$,{onClick:eo,variant:"outline",children:[(0,a.jsx)(Q.A,{className:"h-4 w-4 mr-2"}),"VytvoÅit v\xfdchoz\xed Å¡ablony"]})]}),(0,a.jsxs)(v.tU,{value:e,onValueChange:s,className:"space-y-6",children:[(0,a.jsxs)(v.j7,{className:"grid w-full grid-cols-3",children:[(0,a.jsxs)(v.Xi,{value:"config",className:"flex items-center gap-2",children:[(0,a.jsx)(ex.A,{className:"h-4 w-4"}),"SMTP Konfigurace"]}),(0,a.jsxs)(v.Xi,{value:"templates",className:"flex items-center gap-2",children:[(0,a.jsx)(Q.A,{className:"h-4 w-4"}),"Email Å ablony"]}),(0,a.jsxs)(v.Xi,{value:"logs",className:"flex items-center gap-2",children:[(0,a.jsx)(eh.A,{className:"h-4 w-4"}),"Log Emailů"]})]}),(0,a.jsx)(v.av,{value:"config",className:"space-y-6",children:(0,a.jsxs)(u.Zp,{children:[(0,a.jsxs)(u.aR,{children:[(0,a.jsxs)(u.ZB,{className:"flex items-center gap-2",children:[(0,a.jsx)(q.A,{className:"h-5 w-5"}),"SMTP Nastaven\xed"]}),(0,a.jsx)(u.BT,{children:"Konfigurace SMTP serveru pro odes\xedl\xe1n\xed emailů"})]}),(0,a.jsxs)(u.Wu,{className:"space-y-4",children:[B?(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{className:"text-sm font-medium",children:"SMTP Server"}),(0,a.jsxs)("p",{className:"text-sm text-gray-600",children:[B.smtpHost,":",B.smtpPort]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{className:"text-sm font-medium",children:"Uživatel"}),(0,a.jsx)("p",{className:"text-sm text-gray-600",children:B.smtpUser})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{className:"text-sm font-medium",children:"Odes\xedlatel"}),(0,a.jsxs)("p",{className:"text-sm text-gray-600",children:[B.fromName," <",B.fromEmail,">"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{className:"text-sm font-medium",children:"Reply-To"}),(0,a.jsx)("p",{className:"text-sm text-gray-600",children:B.replyToEmail})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(p.E,{variant:B.isActive?"default":"secondary",children:B.isActive?"Aktivn\xed":"Neaktivn\xed"}),(0,a.jsxs)("span",{className:"text-sm text-gray-500",children:["Naposledy aktualizov\xe1no: ",new Date(B.updatedAt).toLocaleStr
1ing("cs-CZ")]})]})]}):(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)(V.A,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600 mb-4",children:"SMTP konfigurace nen\xed nastavena"})]}),(0,a.jsxs)(N.lG,{open:t,onOpenChange:n,children:[(0,a.jsx)(N.zM,{asChild:!0,children:(0,a.jsxs)(g.$,{children:[(0,a.jsx)(q.A,{className:"h-4 w-4 mr-2"}),B?"Upravit konfiguraci":"Nastavit SMTP"]})}),(0,a.jsxs)(N.Cf,{className:"max-w-2xl",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsx)(N.L3,{children:"SMTP Konfigurace"}),(0,a.jsx)(N.rr,{children:"Nastavte SMTP server pro odes\xedl\xe1n\xed emailů"})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"smtpHost",children:"SMTP Server *"}),(0,a.jsx)(b.p,{id:"smtpHost",value:U.smtpHost,onChange:e=>L(s=>({...s,smtpHost:e.target.value})),placeholder:"smtp.gmail.com"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"smtpPort",children:"Port *"}),(0,a.jsx)(b.p,{id:"smtpPort",type:"number",value:U.smtpPort,onChange:e=>L(s=>({...s,smtpPort:parseInt(e.target.value)}))})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"smtpUser",children:"Uživatelsk\xe9 jm\xe9no *"}),(0,a.jsx)(b.p,{id:"smtpUser",value:U.smtpUser,onChange:e=>L(s=>({...s,smtpUser:e.target.value}))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"smtpPassword",children:"Heslo"}),(0,a.jsx)(b.p,{id:"smtpPassword",type:"password",value:U.smtpPassword,onChange:e=>L(s=>({...s,smtpPassword:e.target.value})),placeholder:B?"Ponechat st\xe1vaj\xedc\xed":"Zadejte heslo"})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"fromName",children:"Jm\xe9no odes\xedlatele *"}),(0,a.jsx)(b.p,{id:"fromName",value:U.fromName,onChange:e=>L(s=>({...s,fromName:e.target.value}))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"fromEmail",children:"Email odes\xedlatele *"}),(0,a.jsx)(b.p,{id:"fromEmail",type:"email",value:U.fromEmail,onChange:e=>L(s=>({...s,fromEmail:e.target.value}))})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"replyToEmail",children:"Reply-To Email *"}),(0,a.jsx)(b.p,{id:"replyToEmail",type:"email",value:U.replyToEmail,onChange:e=>L(s=>({...s,replyToEmail:e.target.value}))})]})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(g.$,{variant:"outline",onClick:()=>n(!1),children:"ZruÅ¡it"}),(0,a.jsx)(g.$,{onClick:ea,children:"Uložit konfiguraci"})]})]})]})]})]})}),(0,a.jsxs)(v.av,{value:"templates",className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Email Å ablony"}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(j.J,{htmlFor:"testRecipient",className:"text-sm text-gray-600",children:"Test adresa"}),(0,a.jsx)(b.p,{id:"testRecipient",type:"email",placeholder:"[email protected]",value:Z,onChange:e=>J(e.target.value),className:"w-56"})]}),(0,a.jsxs)(N.lG,{open:o,onOpenChange:d,children:[(0,a.jsx)(N.zM,{asChild:!0,children:(0,a.jsxs)(g.$,{onClick:()=>{f(null),em()},children:[(0,a.jsx)(en.A,{className:"h-4 w-4 mr-2"}),"Nov\xe1 Å¡ablona"]})}),(0,a.jsxs)(N.Cf,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsx)(N.L3,{children:h?"Upravit Å¡ablonu":"Nov\xe1 email Å¡ablona"}),(0,a.jsx)(N.rr,{children:"VytvoÅte nebo upravte Å¡ablonu pro automatick\xe9 odes\xedl\xe1n\xed emailů"})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"templateName",children:"N\xe1zev Å¡ablony *"}),(0,a.jsx)(b.p,{id:"templateName",value:I.name,onChange:e=>H(s=>({...s,name:e.target.value})),placeholder:"Potvrzen\xed registrace"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"templateType",children:"Typ Å¡ablony *"}
1),(0,a.jsxs)(O.l6,{value:I.type,onValueChange:e=>H(s=>({...s,type:e})),children:[(0,a.jsx)(O.bq,{children:(0,a.jsx)(O.yv,{})}),(0,a.jsx)(O.gC,{children:Object.entries(ev).map(e=>{let[s,t]=e;return(0,a.jsx)(O.eb,{value:s,children:t.label},s)})})]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"templateSubject",children:"PÅedmÄt emailu *"}),(0,a.jsx)(b.p,{id:"templateSubject",value:I.subject,onChange:e=>H(s=>({...s,subject:e.target.value})),placeholder:"Potvrzen\xed ChemMasters [datum term\xednu] [n\xe1zev Å¡koly]"}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Použijte chytr\xe1 pole: [n\xe1zev t\xfdmu], [n\xe1zev Å¡koly], [datum term\xednu], [Äas slotu], [Ä\xe1st dne]"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"templateContent",children:"Obsah emailu *"}),(0,a.jsx)(ed,{id:"templateContent",value:I.content,onChange:e=>H(s=>({...s,content:e.target.value})),rows:12,placeholder:"Dobr\xfd den, s VaÅ¡\xedm t\xfdmem [n\xe1zev t\xfdmu] poÄ\xedt\xe1 na \xfanikovce [datum term\xednu] [Äas slotu]..."}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Dostupn\xe1 chytr\xe1 pole: [n\xe1zev t\xfdmu], [n\xe1zev Å¡koly], [jm\xe9no uÄitele], [email uÄitele], [telefon uÄitele], [datum term\xednu], [Äas slotu], [Ä\xe1st dne], [Älenov\xe9 t\xfdmu], [heslo]"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"sendTrigger",children:"Způsob odesl\xe1n\xed"}),(0,a.jsxs)(O.l6,{value:I.sendTrigger,onValueChange:e=>H(s=>({...s,sendTrigger:e})),children:[(0,a.jsx)(O.bq,{children:(0,a.jsx)(O.yv,{})}),(0,a.jsxs)(O.gC,{children:[(0,a.jsx)(O.eb,{value:"on_registration",children:"Automaticky pÅi registraci"}),(0,a.jsx)(O.eb,{value:"manual",children:"Manu\xe1lnÄ z admin rozhran\xed"}),(0,a.jsx)(O.eb,{value:"scheduled",children:"Napl\xe1novan\xe9 odesl\xe1n\xed"})]})]})]}),"scheduled"===I.sendTrigger&&(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"scheduleDays",children:"Dn\xed pÅed term\xednem"}),(0,a.jsx)(b.p,{id:"scheduleDays",type:"number",min:"1",value:I.scheduleDaysBefore,onChange:e=>H(s=>({...s,scheduleDaysBefore:parseInt(e.target.value)}))})]})]})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(g.$,{variant:"outline",onClick:()=>d(!1),children:"ZruÅ¡it"}),(0,a.jsxs)(g.$,{onClick:er,children:[h?"Aktualizovat":"VytvoÅit"," Å¡ablonu"]})]})]})]})]})]}),(0,a.jsx)("div",{className:"space-y-4",children:void 0===K?(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto"}),(0,a.jsx)("p",{className:"text-gray-500 mt-2",children:"NaÄ\xedt\xe1m Å¡ablony..."})]}):0===K.length?(0,a.jsx)(u.Zp,{children:(0,a.jsxs)(u.Wu,{className:"text-center py-8",children:[(0,a.jsx)(Q.A,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600",children:"Ž\xe1dn\xe9 email Å¡ablony nebyly zat\xedm vytvoÅeny"}),(0,a.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:'KliknÄte na "Nov\xe1 Å¡ablona" pro vytvoÅen\xed prvn\xed Å¡ablony'})]})}):(0,a.jsx)("div",{className:"grid gap-4",children:K.map(e=>{var s;return(0,a.jsx)(u.Zp,{className:"hover:shadow-md transition-shadow",children:(0,a.jsx)(u.Wu,{className:"p-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,a.jsx)("h4",{className:"font-semibold text-lg",children:e.name}),(0,a.jsx)(p.E,{variant:e.isActive?"default":"secondary",children:e.isActive?"Aktivn\xed":"Neaktivn\xed"}),(0,a.jsx)(p.E,{variant:"outline",children:(null==(s=ev[e.type])?void 0:s.label)||e.type})]}),(0,a.jsxs)("p",{className:"text-sm text-gray-600 mb-2",children:[(0,a.jsx)("strong",{children:"PÅedmÄt:"})," ",e.subject]}),(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:["VytvoÅeno: ",new Date(e.createdAt).toLocaleString("cs-CZ")," ⢠Aktualizov\xe1no: ",new Date(e.updatedAt).toLocaleStr
1ing("cs-CZ")]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(g.$,{variant:"outline",size:"sm",onClick:()=>el(e),children:[(0,a.jsx)(eg.A,{className:"h-4 w-4 mr-1"}),"Test"]}),(0,a.jsx)(g.$,{variant:"outline",size:"sm",onClick:()=>{f(e),H({name:e.name,type:e.type,subject:e.subject,content:e.content,sendTrigger:e.sendTrigger,scheduleDaysBefore:e.scheduleDaysBefore||1,isActive:e.isActive}),d(!0)},children:(0,a.jsx)(ee.A,{className:"h-4 w-4"})}),(0,a.jsxs)(w,{children:[(0,a.jsx)(k,{asChild:!0,children:(0,a.jsx)(g.$,{variant:"outline",size:"sm",children:(0,a.jsx)(G.A,{className:"h-4 w-4 text-red-600"})})}),(0,a.jsxs)(T,{children:[(0,a.jsxs)(z,{children:[(0,a.jsx)(F,{children:"Smazat Å¡ablonu"}),(0,a.jsxs)(E,{children:['Opravdu chcete smazat Å¡ablonu "',e.name,'"? Tato akce je nevratn\xe1.']})]}),(0,a.jsxs)(A,{children:[(0,a.jsx)(R,{children:"ZruÅ¡it"}),(0,a.jsx)(P,{onClick:()=>ei(e._id),className:"bg-red-600 hover:bg-red-700",children:"Smazat"})]})]})]})]})]})})},e._id)})})})]}),(0,a.jsxs)(v.av,{value:"logs",className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Log odeslan\xfdch emailů"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(eu.A,{className:"h-4 w-4 absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"}),(0,a.jsx)(b.p,{placeholder:"Hledat podle emailu, jm\xe9na...",value:D,onChange:e=>$(e.target.value),className:"pl-10 w-64"})]}),(0,a.jsxs)(O.l6,{value:S,onValueChange:e=>_(e),children:[(0,a.jsx)(O.bq,{className:"w-32",children:(0,a.jsx)(O.yv,{})}),(0,a.jsxs)(O.gC,{children:[(0,a.jsx)(O.eb,{value:"all",children:"VÅ¡e"}),(0,a.jsx)(O.eb,{value:"pending",children:"Äek\xe1"}),(0,a.jsx)(O.eb,{value:"sent",children:"Odesl\xe1no"}),(0,a.jsx)(O.eb,{value:"failed",children:"Chyba"})]})]})]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[ef.map(e=>{let s=ej[e.status].icon;return(0,a.jsx)(u.Zp,{children:(0,a.jsx)(u.Wu,{className:"p-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,a.jsxs)(p.E,{className:ej[e.status].color,children:[(0,a.jsx)(s,{className:"h-3 w-3 mr-1"}),ej[e.status].label]}),(0,a.jsx)("span",{className:"font-medium",children:e.recipientName}),(0,a.jsx)("span",{className:"text-gray-500",children:e.recipientEmail}),e.retryCount>0&&(0,a.jsxs)(p.E,{variant:"outline",children:[e.retryCount," opakov\xe1n\xed"]})]}),(0,a.jsxs)("div",{className:"text-sm text-gray-600 mb-1",children:[(0,a.jsx)("strong",{children:"PÅedmÄt:"})," ",e.subject]}),(0,a.jsxs)("div",{className:"text-xs text-gray-500",children:["VytvoÅeno: ",new Date(e.createdAt).toLocaleString("cs-CZ"),e.sentAt&&(0,a.jsxs)(a.Fragment,{children:[" ⢠Odesl\xe1no: ",new Date(e.sentAt).toLocaleString("cs-CZ")]})]}),e.errorMessage&&(0,a.jsxs)("div",{className:"text-xs text-red-600 mt-1",children:[(0,a.jsx)("strong",{children:"Chyba:"})," ",e.errorMessage]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(g.$,{variant:"outline",size:"sm",onClick:()=>{C(e),x(!0)},children:(0,a.jsx)(M.A,{className:"h-4 w-4"})}),"failed"===e.status&&(0,a.jsx)(g.$,{variant:"outline",size:"sm",onClick:()=>ec(e._id),children:(0,a.jsx)(ep.A,{className:"h-4 w-4"})})]})]})})},e._id)}),0===ef.length&&(0,a.jsx)(u.Zp,{children:(0,a.jsxs)(u.Wu,{className:"text-center py-8",children:[(0,a.jsx)(eh.A,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600",children:D||"all"!==S?"Ž\xe1dn\xe9 emaily neodpov\xeddaj\xed filtru":"Ž\xe1dn\xe9 emaily nebyly zat\xedm odesl\xe1ny"})]})})]})]})]}),(0,a.jsx)(N.lG,{open:m,onOpenChange:x,children:(0,a.jsxs)(N.Cf,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsx)(N.L3,{children:"Detail emailu"}),(0,a.jsx)(N.rr,{children:"Kompletn\xed informace o odeslan\xe9m emailu"})]}),y&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{className:"text-sm font-medium",children:"PÅ\xedjemce"}),(0,a.jsxs)("p",{className:"text-sm",children:[y.recipientName," <",y.recipientEmail,">"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{className:"text-sm font-medium",children:"Stav"}),(0,a.jsx)(p.E,{className:ej[y.status].color,children:ej[y.status].label})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{className:"text-sm font-medium",children:"VytvoÅeno"}),(0,a.jsx)("p",{className:"text-sm",children:new Date(y.createdAt).toLocaleStr
1ing("cs-CZ")})]}),y.sentAt&&(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{className:"text-sm font-medium",children:"Odesl\xe1no"}),(0,a.jsx)("p",{className:"text-sm",children:new Date(y.sentAt).toLocaleString("cs-CZ")})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)(j.J,{className:"text-sm font-medium",children:"PÅedmÄt"}),(0,a.jsx)(g.$,{variant:"outline",size:"sm",onClick:()=>eN(y.subject),children:(0,a.jsx)(eb.A,{className:"h-4 w-4"})})]}),(0,a.jsx)("p",{className:"text-sm bg-gray-50 p-3 rounded border",children:y.subject})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)(j.J,{className:"text-sm font-medium",children:"Obsah emailu"}),(0,a.jsx)(g.$,{variant:"outline",size:"sm",onClick:()=>eN(y.content),children:(0,a.jsx)(eb.A,{className:"h-4 w-4"})})]}),(0,a.jsx)("div",{className:"text-sm bg-gray-50 p-3 rounded border whitespace-pre-wrap max-h-64 overflow-y-auto",children:y.content})]}),y.errorMessage&&(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{className:"text-sm font-medium text-red-600",children:"Chybov\xe1 zpr\xe1va"}),(0,a.jsx)("p",{className:"text-sm text-red-600 bg-red-50 p-3 rounded border border-red-200",children:y.errorMessage})]}),y.retryCount>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{className:"text-sm font-medium",children:"PoÄet opakov\xe1n\xed"}),(0,a.jsx)("p",{className:"text-sm",children:y.retryCount}),y.lastRetryAt&&(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:["Posledn\xed opakov\xe1n\xed: ",new Date(y.lastRetryAt).toLocaleString("cs-CZ")]})]})]})]})})]})}let ef={unconfirmed:{label:"Nepotvrzen\xe1",color:"bg-yellow-100 text-yellow-800",icon:Z.A},confirmed:{label:"Potvrzeno",color:"bg-green-100 text-green-800",icon:J.A},cancelled:{label:"ZruÅ¡eno",color:"bg-red-100 text-red-800",icon:U.A},changes_needed:{label:"ZmÄny potÅebn\xe9",color:"bg-orange-100 text-orange-800",icon:Z.A},reminder_sent:{label:"Instrukce odesl\xe1ny",color:"bg-blue-100 text-blue-800",icon:V.A},published:{label:"Publikov\xe1no",color:"bg-purple-100 text-purple-800",icon:L.A}};function ey(){var e,s;let[t,f]=(0,r.useState)(null),[y,k]=(0,r.useState)(!1),[C,S]=(0,r.useState)(""),[_,Z]=(0,r.useState)(null),[J,ed]=(0,r.useState)("0"),[em,ex]=(0,r.useState)("0"),[eh,eg]=(0,r.useState)("0"),[eu,ep]=(0,r.useState)(!1),[eb,ej]=(0,r.useState)(null),[ev,ey]=(0,r.useState)(new Date),[ew,ek]=(0,r.useState)(null),[eC,eS]=(0,r.useState)(!1),[eT,ez]=(0,r.useState)(!1),[eA,eF]=(0,r.useState)(null),[eE,eP]=(0,r.useState)(!1),[eR,e_]=(0,r.useState)(null),[eD,eO]=(0,r.useState)(!0),[e$,eZ]=(0,r.useState)(!1),[eJ,eU]=(0,r.useState)(null),[eV,eL]=(0,r.useState)(!1),[eI,eM]=(0,r.useState)([]),[eH,eB]=(0,r.useState)(new Set),[eq,eG]=(0,r.useState)(!1),[eK,eW]=(0,r.useState)(""),[eX,eY]=(0,r.useState)(!1),[eQ,e0]=(0,r.useState)(!1),[e4,e1]=(0,r.useState)([]),[e2,e3]=(0,r.useState)(""),[e5,e6]=(0,r.useState)(!1),[e9,e8]=(0,r.useState)(new Set),[e7,se]=(0,r.useState)(!1),[ss,st]=(0,r.useState)(!1),[sa,sr]=(0,r.useState)("confirmed"),[sl,sn]=(0,r.useState)(null),[si,sc]=(0,r.useState)("asc"),[so,sd]=(0,r.useState)("teacher_confirmation"),[sm,sx]=(0,r.useState)(!1),[sh,sg]=(0,r.useState)(null),[su,sp]=(0,r.useState)(!1),[sb,sj]=(0,r.useState)(!1),[sv,sN]=(0,r.useState)(null),[sf,sy]=(0,r.useState)(!1),[sw,sk]=(0,r.useState)(""),[sC,sS]=(0,r.useState)(!1),[sT,sz]=(0,r.useState)(null),[sA,sF]=(0,r.useState)({timeType:"morning",startTime:"09:00",endTime:"13:00",capacity:8}),[sE,sP]=(0,r.useState)(new Set),[sR,s_]=(0,r.useState)(!1),[sD,sO]=(0,r.useState)(null),[s$,sZ]=(0,r.useState)([]),[sJ,sU]=(0,r.useState)(!1),{signOut:sV}=(0,n.BG)(),sL=(0,l.IT)(i.F.users.currentLoggedInUser),sI=(0,l.IT)(i.F.registrations.getAllForAdmin),sM=(0,l.IT)(i.F.timeSlots.getAllForAdmin),sH=(0,l.IT)(i.F.photos.getAllPhotosForAdmin),sB=(0,l.IT)(i.F.users.getHallOfFameVisibility),sq=(0,l.n_)(i.F.registrations.updateRegistrationStatus),sG=(0,l.n_)(i.F.leaderboard.addCompletionTimeAndPublish),sK=(0,l.n_)(i.F.leaderboard.updateCompletionTime),sW=(0,l.n_)(i.F.users.toggleHallOfFameVisibility),sX=(0,l.n_)(i.F.timeSlots.createTimeSlot),sY=(0,l.n_)(i.F.timeSlots.updateTimeSlot),sQ=(0,l.n_)(i.F.timeSlots.deleteTimeSlotWithNotifications),s0=(0,l.n_)(i.F.photos.generateUploadUrl),s4=(0,l.n_)(i.F.photos.savePhotoMetadata),s1=(0,l.n_)(i.F.photos.togglePhotoVisibility),s2=(0,l.n_)(i.F.photos.deletePhoto);(0,l.n_)(i.F.photos.bulkAssignKeywords),(0,l.n_)(i.F.photos.bulkDeletePhotos);let s3=(0,l.n_)(i.F.registrations.bulkUpdateRegistrationStatus),s5=(0,l.n_)(i.F.registrations.bulkDeleteRegistrations),s6=(0,l.n_)(i.F.registrations.changeTimeSlot),s9=(0,l.n_)(i.F.emails.sendManualConfirmationEmail),s8=(0,l.n_)(i.F.emails.sendBulkConfirmationEmails);(0,l.IT)(i.F.leaderboard.getPublicLeaderboard),console.log("AdminDashboard Debug:",{currentUser:sL,isAdminAuthenticated:_}),(0,r.useEffect)(()=>{void 0===sL?Z(null):null===sL?(console.log("No user found"),Z(!1)):"admin"===sL.role?(console.log("Admin user authenticated:",sL),Z(!0)):(console.log("Non-admin user, access denied:",sL),Z(!1))},[sL]);let s7=(null==sI?void 0:sI.ok)?sI.registrations:[],te=(null==sM?void 0:sM.ok)?sM.timeSlots:[],ts=s
1H||[],tt=te.filter(e=>{let s=new Date(e.date+"T00:00:00"),t=new Date;return t.setHours(0,0,0,0),s>=t}),ta=[...te].sort((e,s)=>{let t=new Date;t.setHours(0,0,0,0);let a=new Date(e.date+"T00:00:00"),r=new Date(s.date+"T00:00:00"),l=a<t,n=r<t;return l&&!n?1:!l&&n?-1:l||n?r.getTime()-a.getTime():a.getTime()-r.getTime()}),tr=async()=>{try{console.log("Toggling Hall of Fame visibility...");let e=await sW({});console.log("Toggle result:",e);let s=e.hallOfFameVisible?"Hall of Fame je nyn\xed viditeln\xfd na hlavn\xed str\xe1nce":"Hall of Fame je nyn\xed skryt\xfd na hlavn\xed str\xe1nce";c.oR.success(s)}catch(e){console.error("Error toggling hall of fame visibility:",e),c.oR.error("Chyba pÅi zmÄnÄ viditelnosti Hall of Fame: "+e.message)}},tl=async()=>{try{await sV(),c.oR.success("Byli jste \xfaspÄÅ¡nÄ odhl\xe1Å¡eni"),setTimeout(()=>{window.location.href="/"},500)}catch(e){console.error("Error logging out:",e),c.oR.error("Chyba pÅi odhlaÅ¡ov\xe1n\xed")}},tn=async e=>{let s=parseInt(J)||0,t=3600*s+60*(parseInt(em)||0)+(parseInt(eh)||0);if(t<=0)return void c.oR.error("Zadejte platn\xfd Äas dokonÄen\xed");try{await sG({registrationId:e,completionTime:t}),c.oR.success("V\xfdsledek byl publikov\xe1n do Hall of Fame"),ed("0"),ex("0"),eg("0"),k(!1)}catch(e){console.error("Error publishing result:",e),c.oR.error("Chyba pÅi publikov\xe1n\xed v\xfdsledku")}},ti=async()=>{if(!eb)return;let e=parseInt(J)||0,s=3600*e+60*(parseInt(em)||0)+(parseInt(eh)||0);if(s<=0)return void c.oR.error("Zadejte platn\xfd Äas dokonÄen\xed");try{await sK({registrationId:eb._id,completionTime:s}),c.oR.success("Äas byl aktualizov\xe1n"),ed("0"),ex("0"),eg("0"),ep(!1),ej(null)}catch(e){console.error("Error updating completion time:",e),c.oR.error("Chyba pÅi aktualizaci Äasu")}},tc=async()=>{if(sT)try{await sq({registrationId:sT._id,status:"cancelled"}),c.oR.success("PÅihl\xe1Å¡ka byla zruÅ¡ena"),sS(!1),sz(null),sj(!1),sN(null)}catch(e){console.error("Error cancelling registration:",e),c.oR.error("Chyba pÅi ruÅ¡en\xed pÅihl\xe1Å¡ky")}},to=e=>new Date(e).toLocaleDateString("cs-CZ",{weekday:"short",month:"short",day:"numeric"});(()=>{let e={};return s7.forEach(s=>{let t=s.timeSlot?"".concat(s.timeSlot.date,"-").concat(s.timeSlot.timeType):"no-slot";e[t]||(e[t]=[]),e[t].push(s)})})(),sl&&[...s7].sort((e,s)=>{let t=0;switch(sl){case"createdAt":t=e._creationTime-s._creationTime;break;case"teamNickname":t=e.teamNickname.localeCompare(s.teamNickname,"cs");break;case"schoolName":t=e.schoolName.localeCompare(s.schoolName,"cs");break;case"timeSlot":t=(e.timeSlot?new Date(e.timeSlot.date+"T"+e.timeSlot.startTime).getTime():0)-(s.timeSlot?new Date(s.timeSlot.date+"T"+s.timeSlot.startTime).getTime():0);break;case"status":t=e.status.localeCompare(s.status,"cs")}return"asc"===si?t:-t});let td=e=>{let s=e.getFullYear(),t=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return"".concat(s,"-").concat(t,"-").concat(a)},tm=e=>s7.filter(s=>s.timeSlotId===e),tx=async e=>{c.oR.info("Generuji PDF...",{duration:2e3});try{let s=tm(e._id).filter(e=>"cancelled"!==e.status&&"changes_needed"!==e.status),t=new o.Ay("p","mm","a4"),a=10,r=!1;try{(r=await h(t))&&t.setFont("NotoSans","normal")}catch(e){console.warn("Font loading failed, using helvetica:",e),r=!1}r||t.setFont("helvetica","normal"),t.setFontSize(14),t.setFont(r?"NotoSans":"helvetica","bold");let l="ChemMasters ".concat(to(e.date)," - ").concat(e.startTime," - ").concat(e.endTime);t.text(l,105,a,{align:"center"}),a+=15,t.setFontSize(11),t.setFont(r?"NotoSans":"helvetica","normal"),t.text("PÅihl\xe1Å¡en\xe9 t\xfdmy:",15,a),a+=15,t.setFontSize(9);let n={};for(let e of s){a>217&&(t.addPage(),a=10),t.setFont(r?"NotoSans":"helvetica","bold"),t.setFontSize(11);let s="".concat(e.teamNickname," - ").concat(e.schoolName,":");t.text(s,15,a),a+=10;let l=[],i="".concat(e.teacherPhone,"\n").concat(e.teacherEmail);l.push([(e.teacherName||"Doprovod")+" (doprovod)","",i,"",e.note||""]),n[""]||(n[""]={count:0,notes:[]}),n[""].count++,e.note&&n[""].notes.push(e.note),e.teamMembers.forEach((e,s)=>{l.push([e,"","","",""]),n[""]||(n[""]={count:0,notes:[]}),n[""].count++}),(0,d.Ay)(t,{startY:a,tableWidth:"170mm",head:[["Jm\xe9no \xfaÄastn\xedka","Catering","Kontakt","J\xedzdn\xe9","Podpis"]],body:l,theme:"striped",styles:{font:r?"NotoSans":"helvetica",fontSize:11,cellPadding:1,textColor:[0,0,0]},headStyles:{font:r?"NotoSans":"helvetica",fontStyle:"bold",fillColor:[254,254,254],textColor:[0,0,0]},margin:{top:10,left:10,right:10,bottom:10}}),a=t.lastAutoTable.finalY+15}let i=t.getNumberOfPages();for(let e=1;e<=i;e++)t.setPage(e),t.setFont(r?"NotoSans":"helvetica","normal"),t.setFontSize(9),t.text("".concat(e,"/").concat(i),195,282,{align:"center"});let m=t.output("blob"),x=URL.createObjectURL(m);window.open(x,"_blank");let g=new o.Ay("p","mm","a4"),u=!1;try{(u=await h(g))&&g.setFont("NotoSans","normal")}catch(e){console.warn("Summary font loading failed, using helvetica:",e),u=!1}u||g.setFont("helvetica","normal");let p=10;g.setFontSize(14),g.setFont(u?"NotoSans":"helvetica","bold");let b="ChemMasters ".concat(to(e.date)," - ").concat(e.startTime," - ").concat(e.endTime);g.text(b,105,p,{align:"center"}
1),p+=15,g.setFontSize(11),g.setFont(u?"NotoSans":"helvetica","normal"),g.text("Souhrn cateringu:",10,p),p+=15;let j=Object.entries(n).map(e=>{let[s,t]=e;return[s,t.count,t.notes.join(", ")]});(0,d.Ay)(g,{startY:p,tableWidth:"170mm",head:[["Catering","PoÄet","Podpis"]],body:j,theme:"striped",styles:{font:u?"NotoSans":"helvetica",fontSize:11,cellPadding:3,textColor:[0,0,0]},headStyles:{font:u?"NotoSans":"helvetica",fontStyle:"bold",fillColor:[254,254,254],textColor:[0,0,0]},margin:{top:10,left:10,right:10,bottom:10}});let v=g.getNumberOfPages();for(let e=1;e<=v;e++)g.setPage(e),g.setFont(u?"NotoSans":"helvetica","normal"),g.setFontSize(9),g.text("".concat(e,"/").concat(v),195,282,{align:"center"});let N=g.output("blob"),f=URL.createObjectURL(N);window.open(f,"_blank"),c.oR.success("PDF dokumenty byly uspesne vygenerovany")}catch(e){console.error("Error generating PDF:",e),c.oR.error("Chyba pri generovani PDF: "+e.message)}},th=(e,s)=>{e.stopPropagation(),eF(s),sF({timeType:s.timeType,startTime:s.startTime,endTime:s.endTime,capacity:s.capacity}),ez(!0)},tg=async()=>{if(sv&&sw)try{await s6({registrationId:sv._id,newTimeSlotId:sw}),c.oR.success("Term\xedn byl \xfaspÄÅ¡hÄ zmÄnÄn"),sy(!1),sk(""),sj(!1)}catch(e){console.error("Error changing time slot:",e),c.oR.error("Chyba pÅi zmÄnÄ term\xednu: "+e.message)}},tu=async()=>{if(ew)try{await sX({date:ew,timeType:sA.timeType,startTime:sA.startTime,endTime:sA.endTime,capacity:sA.capacity}),c.oR.success("Term\xedn byl vytvoÅen"),eS(!1),ek(null)}catch(e){console.error("Error creating time slot:",e),c.oR.error("Chyba pÅi vytv\xe1Åen\xed term\xednu")}},tp=async()=>{if(eA)try{await sY({timeSlotId:eA._id,startTime:sA.startTime,endTime:sA.endTime,capacity:sA.capacity,isActive:eA.isActive}),c.oR.success("Term\xedn byl aktualizov\xe1n"),ez(!1)}catch(e){console.error("Error updating time slot:",e),c.oR.error("Chyba pÅi aktualizaci term\xednu")}},tb=async()=>{if(eR)try{let e=await sQ({timeSlotId:eR._id,sendEmails:eD}),s=eD?"Term\xedn byl zruÅ¡en a ".concat(e.emailsScheduled," emailů bylo odesl\xe1no t\xfdmům."):"Term\xedn byl zruÅ¡en bez odesl\xe1n\xed emailů. OvlivnÄno ".concat(e.affectedRegistrations," registrac\xed.");c.oR.success(s),eP(!1),ez(!1),e_(null)}catch(e){console.error("Error deleting time slot:",e),c.oR.error("Chyba pÅi ruÅ¡en\xed term\xednu")}},tj=e=>{ey(s=>{let t=new Date(s);return"prev"===e?t.setMonth(s.getMonth()-1):t.setMonth(s.getMonth()+1),t})},tv=e=>{let s=e?"morning":"afternoon",t=e?{startTime:"09:00",endTime:"13:00"}:{startTime:"13:30",endTime:"17:00"};sF(e=>({...e,timeType:s,...t}))},tN=async()=>{if(!sD||0===s$.length)return;sU(!0);let e=0;try{for(let s of s$)try{let t=(await m(s)).file,a=await s0({}),r=await fetch(a,{method:"POST",headers:{"Content-Type":t.type},body:t});if(!r.ok)throw Error("Upload failed: ".concat(r.statusText));let{storageId:l}=await r.json();await s4({storageId:l,teamName:"Term\xedn ".concat(to(sD.date)),gameDate:sD.date,timeType:sD.timeType,originalFilename:s.name,contentType:t.type,size:t.size,keywords:["term\xedn","".concat("morning"===sD.timeType?"dopoledne":"odpoledne"),to(sD.date)]}),e++}catch(e){console.error("Error uploading ".concat(s.name,":"),e),c.oR.error("Chyba pÅi nahr\xe1v\xe1n\xed ".concat(s.name))}e>0&&c.oR.success("\xdaspÄÅ¡nÄ nahr\xe1no ".concat(e," z ").concat(s$.length," fotek")),sZ([]),s_(!1),sO(null)}catch(e){console.error("Error in event photo upload:",e),c.oR.error("Chyba pÅi nahr\xe1v\xe1n\xed fotek")}finally{sU(!1)}},tf=async()=>{if(!eJ||0===eI.length)return;eL(!0);let e=0;try{for(let a of eI)try{var s,t;let r=(await m(a)).file,l=await s0({}),n=await fetch(l,{method:"POST",headers:{"Content-Type":r.type},body:r});if(!n.ok)throw Error("Upload failed: ".concat(n.statusText));let{storageId:i}=await n.json();await s4({storageId:i,teamName:eJ.teamNickname,gameDate:(null==(s=eJ.timeSlot)?void 0:s.date)||new Date().toISOString().split("T")[0],timeType:(null==(t=eJ.timeSlot)?void 0:t.timeType)||"morning",originalFilename:a.name,contentType:r.type,size:r.size,keywords:["".concat(eJ.teamNickname),"".concat(eJ.schoolName)]}),e++}catch(e){console.error("Error uploading ".concat(a.name,":"),e),
1c.oR.error("Chyba pÅi nahr\xe1v\xe1n\xed ".concat(a.name))}e>0&&c.oR.success("\xdaspÄÅ¡nÄ nahr\xe1no ".concat(e," z ").concat(eI.length," fotek")),eM([]),eZ(!1),eU(null)}catch(e){console.error("Error in photo upload:",e),c.oR.error("Chyba pÅi nahr\xe1v\xe1n\xed fotek")}finally{eL(!1)}},ty=async()=>{if(0===e4.length)return;e6(!0);let e=0;try{for(let s of e4)try{let t=(await m(s)).file,a=await s0({}),r=await fetch(a,{method:"POST",headers:{"Content-Type":t.type},body:t});if(!r.ok)throw Error("Upload failed: ".concat(r.statusText));let{storageId:l}=await r.json();await s4({storageId:l,teamName:"Obecn\xe9",gameDate:new Date().toISOString().split("T")[0],timeType:"morning",originalFilename:s.name,contentType:t.type,size:t.size,keywords:[e2||"obecn\xe9"]}),e++}catch(e){console.error("Error uploading ".concat(s.name,":"),e),c.oR.error("Chyba pÅi nahr\xe1v\xe1n\xed ".concat(s.name))}e>0&&c.oR.success("\xdaspÄÅ¡nÄ nahr\xe1no ".concat(e," z ").concat(e4.length," fotek")),e1([]),e3(""),e0(!1)}catch(e){console.error("Error in general photo upload:",e),c.oR.error("Chyba pÅi nahr\xe1v\xe1n\xed fotek")}finally{e6(!1)}},tw=async()=>{if(0!==e9.size)try{await s3({registrationIds:Array.from(e9),status:sa}),c.oR.success("Stav ".concat(e9.size," registrac\xed byl aktualizov\xe1n")),e8(new Set),st(!1),se(!1)}catch(e){console.error("Error updating bulk status:",e),c.oR.error("Chyba pÅi hromadn\xe9 aktualizaci stavu")}},tk=async()=>{if(0!==e9.size)try{await s5({registrationIds:Array.from(e9)}),c.oR.success("".concat(e9.size," registrac\xed bylo smaz\xe1no")),e8(new Set),se(!1)}catch(e){console.error("Error deleting registrations:",e),c.oR.error("Chyba pÅi maz\xe1n\xed registrac\xed")}},tC=async(e,s)=>{try{await s9({registrationId:e,templateType:s});let t="teacher_confirmation"===s?"potvrzen\xedm":"day_before_reminder"===s?"pÅipomenut\xedm":"potvrzen\xedm registrace";c.oR.success("Email s ".concat(t," byl odesl\xe1n"))}catch(e){console.error("Error sending email:",e),c.oR.error("Chyba pÅi odes\xedl\xe1n\xed emailu: "+e.message)}},tS=async e=>{if(0!==e9.size)try{let s=await s8({registrationIds:Array.from(e9),templateType:e});c.oR.success("Emaily byly napl\xe1novan\xe9: ".concat(s.scheduled," \xfaspÄÅ¡n\xfdch, ").concat(s.failed," ne\xfaspÄÅ¡n\xfdch")),e8(new Set),se(!1)}catch(e){console.error("Error sending bulk emails:",e),c.oR.error("Chyba pÅi odes\xedl\xe1n\xed emailů")}},tT=e=>{sg(e),sd("teacher_confirmation"),sx(!0)},tz=async()=>{sh&&(await tC(sh,so),sx(!1),sg(null))},tA=async()=>{await tS(so),sp(!1)};return null===_?(0,a.jsx)("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600",children:"OvÄÅuji pÅ\xedstup..."})]})}):_?void 0===sI||void 0===sM?(0,a.jsx)("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600",children:"NaÄ\xedt\xe1m admin dashboard..."})]})}):(0,a.jsxs)("div",{className:"min-h-screen relative",style:{backgroundImage:"url(/admin-bg.webp)",backgroundSize:"cover",backgroundPosition:"center",backgroundAttachment:"fixed"},children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/80 via-blue-800/80 to-green-600/80 pointer-events-none"}),(0,a.jsxs)("div",{className:"relative z-10",children:[(0,a.jsx)("header",{className:"container mx-auto px-4 py-8",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("div",{className:"flex items-center space-x-4",children:(0,a.jsx)("div",{children:(0,a.jsx)("img",{src:"https://assets.macaly-user-data.dev/cdn-cgi/image/fit=scale-down,width=2000,height=2000,format=webp,quality=90/u5t1cvpuvx8ywjzer2rlho4n/mebxwfmgqryj2mml3icgwnzi/lOH9JiSyQNeLezQVHFT-w/logo-vscht-green.png",alt:"
1VÅ CHT Praha - Vysok\xe1 Å¡kola chemicko-technologick\xe1 v Praze",className:"h-12 w-auto"})})}),(0,a.jsxs)("nav",{className:"flex items-center space-x-6",children:[(0,a.jsx)("a",{href:"/",className:"flex items-center space-x-2 text-green-300 hover:text-green-200 transition-colors",children:(0,a.jsx)("span",{className:"text-sm font-medium",children:"Domů"})}),(0,a.jsxs)(g.$,{onClick:tr,variant:"outline",className:"flex items-center gap-2 bg-black/20 backdrop-blur-sm border-green-400/30 text-green-300 hover:text-green-200 hover:bg-green-400/10",children:[sB?(0,a.jsx)(I.A,{className:"w-4 h-4"}):(0,a.jsx)(M.A,{className:"w-4 h-4"}),sB?"Skr\xfdt Hall of Fame":"OtevÅ\xedt Hall of Fame"]}),(0,a.jsxs)(g.$,{onClick:tl,variant:"outline",className:"flex items-center gap-2 bg-black/20 backdrop-blur-sm border-red-400/30 text-red-300 hover:text-red-200 hover:bg-red-400/10",children:[(0,a.jsx)(H.A,{className:"w-4 h-4"}),"Odhl\xe1sit"]})]})]})}),(0,a.jsx)("section",{className:"container mx-auto px-4 py-8 text-center",children:(0,a.jsxs)("div",{className:"max-w-4xl mx-auto",children:[(0,a.jsx)("h1",{className:"text-4xl md:text-6xl font-bold text-transparent bg-clip-text bg-gradient-to-r from-green-400 to-green-200 mb-4",children:"Admin Dashboard"}),(0,a.jsx)("p",{className:"text-xl md:text-2xl text-green-300 mb-8 font-light",children:"Spr\xe1va registrac\xed ChemMasters"})]})}),(0,a.jsx)("div",{className:"container mx-auto px-4 pb-8",children:(0,a.jsxs)(v.tU,{defaultValue:"kanban",className:"space-y-6",children:[(0,a.jsx)("div",{className:"flex justify-center",children:(0,a.jsxs)(v.j7,{className:"bg-black/20 backdrop-blur-sm border border-green-400/30",children:[(0,a.jsx)(v.Xi,{value:"kanban",className:"text-green-300 data-[state=active]:bg-green-500 data-[state=active]:text-white",children:"Kanban Board"}),(0,a.jsx)(v.Xi,{value:"slots",className:"text-green-300 data-[state=active]:bg-green-500 data-[state=active]:text-white",children:"Spr\xe1va term\xednů"}),(0,a.jsx)(v.Xi,{value:"calendar",className:"text-green-300 data-[state=active]:bg-green-500 data-[state=active]:text-white",children:"Kalend\xe1Å"}),(0,a.jsx)(v.Xi,{value:"photos",className:"text-green-300 data-[state=active]:bg-green-500 data-[state=active]:text-white",children:"Fotogalerie"}),(0,a.jsx)(v.Xi,{value:"halloffame",className:"text-green-300 data-[state=active]:bg-green-500 data-[state=active]:text-white",children:"Hall of Fame"}),(0,a.jsx)(v.Xi,{value:"emails",className:"text-green-300 data-[state=active]:bg-green-500 data-[state=active]:text-white",children:"Email Management"})]})}),(0,a.jsxs)(v.av,{value:"kanban",className:"space-y-6",children:[e7&&(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 bg-black/20 backdrop-blur-sm border border-green-400/30 rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)($.S,{checked:e9.size===s7.length&&s7.length>0,onCheckedChange:e=>{e?e8(new Set(s7.map(e=>e._id))):e8(new Set)}}),(0,a.jsx)("span",{className:"text-sm font-medium text-green-300",children:0===e9.size?"Vybrat vÅ¡e":"Vybr\xe1no ".concat(e9.size," z ").concat(s7.length)})]}),e9.size>0&&(0,a.jsx)(g.$,{variant:"ghost",size:"sm",onClick:()=>{e8(new Set)},className:"text-green-300 hover:text-green-200 hover:bg-green-400/10",children:(0,a.jsx)(B.A,{className:"w-4 h-4"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(g.$,{variant:"outline",size:"sm",onClick:()=>st(!0),disabled:0===e9.size,className:"bg-black/20 backdrop-blur-sm border-green-400/30 text-green-300 hover:text-green-200 hover:bg-green-400/10",children:[(0,a.jsx)(q.A,{className:"w-4 h-4 mr-1"}),"ZmÄnit stav"]}),(0,a.jsxs)(g.$,{variant:"outline",size:"sm",onClick:()=>{sd("teacher_confirmation"),sp(!0)},disabled:0===e9.size,className:"bg-black/20 backdrop-blur-sm border-blue-400/30 text-blue-300 hover:text-blue-200 hover:bg-blue-400/10",children:[(0,a.jsx)(V.A,{className:"w-4 h-4 mr-1"}),"Odeslat emaily"]}),(0,a.jsxs)(g.$,{variant:"outline",size:"sm",onClick:tk,disabled:0===e9.size,className:"bg-black/20 backdrop-blur-sm border-red-400/30 text-red-300 hover:text-red-200 hover:bg-red-400/10",children:[(0,a.jsx)(G.A,{className:"w-4 h-4 mr-1"}),"Smazat"]}),(0,a.jsx)(g.$,{variant:"ghost",size:"sm",onClick:()=>se(!1),className:"text-green-300 hover:text-green-200 hover:bg-green-400/10",children:(0,a.jsx)(B.A,{className:"w-4 h-4"})})]})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 ga
1p-4",children:Object.entries(ef).map(e=>{let[s,t]=e,r=s7.filter(e=>e.status===s),l=t.icon;return(0,a.jsx)("div",{className:"bg-black/20 backdrop-blur-sm border border-green-400/30 rounded-lg p-4",children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(l,{className:"w-4 h-4 text-green-400"}),(0,a.jsx)("h3",{className:"font-medium text-white text-sm",children:t.label})]}),(0,a.jsx)(p.E,{variant:"outline",className:"border-green-400/30 text-green-300",children:r.length})]}),(0,a.jsx)("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:r.map(e=>(0,a.jsx)(u.Zp,{className:"bg-black/40 border-green-400/20 hover:border-green-400/40 transition-colors cursor-pointer",onClick:()=>{e7||(sN(e),sj(!0))},children:(0,a.jsxs)(u.Wu,{className:"p-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[e7&&(0,a.jsx)($.S,{checked:e9.has(e._id),onCheckedChange:s=>{let t=new Set(e9);s?t.add(e._id):t.delete(e._id),e8(t)},className:"mr-2"}),(0,a.jsx)("h4",{className:"font-medium text-white text-sm truncate flex-1",children:e.teamNickname})]}),(0,a.jsx)("p",{className:"text-xs text-green-300 mb-1",children:e.schoolName}),(0,a.jsxs)("p",{className:"text-xs text-green-300 mb-1",children:[e.teacherName," (",e.teacherEmail,")"]}),e.timeSlot&&(0,a.jsxs)("p",{className:"text-xs text-green-300",children:[to(e.timeSlot.date)," - ",e.timeSlot.startTime]}),(0,a.jsx)("div",{className:"flex items-center justify-end mt-2",children:(0,a.jsxs)("div",{className:"flex gap-1",children:[(0,a.jsx)(g.$,{variant:"ghost",size:"sm",onClick:s=>{s.stopPropagation(),tT(e._id)},className:"h-6 w-6 p-0 text-blue-400 hover:text-blue-200 hover:bg-blue-400/10",children:(0,a.jsx)(V.A,{className:"w-3 h-3"})}),(0,a.jsx)(g.$,{variant:"ghost",size:"sm",onClick:s=>{s.stopPropagation(),f(e),k(!0)},className:"h-6 w-6 p-0 text-green-400 hover:text-green-200 hover:bg-green-400/10",children:(0,a.jsx)(L.A,{className:"w-3 h-3"})})]})})]})},e._id))})]})},s)})}),(0,a.jsx)("div",{className:"flex justify-center gap-4",children:(0,a.jsx)(g.$,{onClick:()=>se(!e7),variant:"outline",className:"bg-black/20 backdrop-blur-sm border-green-400/30 text-green-300 hover:text-green-200 hover:bg-green-400/10",children:e7?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(B.A,{className:"w-4 h-4 mr-2"}),"ZruÅ¡it v\xfdbÄr"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K.A,{className:"w-4 h-4 mr-2"}),"Vybrat v\xedce"]})})})]}),(0,a.jsx)(v.av,{value:"slots",className:"space-y-6",children:(0,a.jsxs)("div",{className:"bg-black/20 backdrop-blur-sm border border-green-400/30 rounded-lg p-6",children:[(0,a.jsx)("h3",{className:"text-xl font-semibold text-white mb-4",children:"Spr\xe1va term\xednů"}),(0,a.jsx)("div",{className:"grid gap-4",children:ta.map(e=>{let s=tm(e._id).filter(e=>"cancelled"!==e.status&&"changes_needed"!==e.status),t=sE.has(e._id),r=new Date(e.date+"T00:00:00"),l=new Date;l.setHours(0,0,0,0);let n=r<l;return(0,a.jsx)(u.Zp,{className:"border-green-400/20 ".concat(n?"bg-black/60 opacity-70":"bg-black/40"),children:(0,a.jsxs)(u.Wu,{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>{var s;return s=e._id,void sP(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"p-2 rounded-lg ".concat(n?"bg-gray-500/20":"bg-green-500/20"),children:t?(0,a.jsx)(W.A,{className:"w-5 h-5 ".concat(n?"text-gray-400":"text-green-400")}):(0,a.jsx)(X.A,{className:"w-5 h-5 ".concat(n?"text-gray-400":"text-green-400")})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("h4",{className:"font-medium text-white flex items-center gap-2",children:[to(e.date)," - ","morning"===e.timeType?"Dopoledne":"Odpoledne",n&&(0,a.jsx)(p.E,{variant:"outline",className:"text-xs bg-gray-500/20 text-gray-300 border-gray-400/30",children:"ProbÄhlo"})]}),(0,a.jsxs)("p",{className:"text-sm ".concat(n?"text-gray-400":"text-green-300"),children:[e.startTime," - ",e.endTime," | Kapacita: ",e.capacity]}),(0,a.jsxs)("p",{className:"text-sm ".concat(n?"text-gray-400":"text-green-400"),children:["PÅihl\xe1Å¡eno: ",s.length," t\xfdmů"]})]})]}),(0,a.jsxs)("div",{className:"flex gap-2",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)(g.$,{variant:"outline",size:"sm",onClick:()=>{sO(e),s_(!0)},className:"bg-black/20 backdrop-blur-sm border-blue-400/30 text-blue-300 hover:text-blue-200 hover:bg-blue-400/10",title:"Nahr\xe1t fotky z akce",children:[(0,a.jsx)(Y.A,{className:"w-4 h-4 mr-1"}),"Fotky"]}),(0,a.jsxs)(g.$,{variant:"outline",size:"sm",onClick:()=>tx(e),className:"bg-black/20 backdrop-blur-sm border-green-400/30 text-green-200 hover:text-green-200 hover:bg-green-400/10",children:[(0,a.jsx)(Q.A,{className:"w-4 h-4 mr-1"}),"PDF"]}),(0,a.jsxs)(g.$,{variant:"outline",size:"sm",onClick:s=>th(s,e),className:"bg-black/20 backdrop-blur-sm border-green-400/30 text-green-300 hover:text-green-200 hover:bg-green-400/10",children:[(0,a.jsx)(ee.A,{className:"w-4 h-4 mr-1"}),"Upravit"]})]})]}),t&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-green-400/20",children:[(0,a.jsx)("h5",{className:"text-sm font-medium text-green-300 mb
1-3",children:"PÅihl\xe1Å¡en\xe9 t\xfdmy:"}),0===s.length?(0,a.jsx)("p",{className:"text-gray-400 text-sm",children:"Ž\xe1dn\xe9 t\xfdmy nejsou pÅihl\xe1Å¡eny na tento term\xedn."}):(0,a.jsx)("div",{className:"space-y-2",children:s.map(e=>{var s,t;return(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 bg-black/30 rounded-lg border border-green-400/10 hover:border-green-400/30 transition-colors",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h6",{className:"font-medium text-white",children:e.teamNickname}),(0,a.jsx)(p.E,{variant:"outline",className:"text-xs ".concat((null==(s=ef[e.status])?void 0:s.color)||"border-gray-400/30 text-gray-300"),children:(null==(t=ef[e.status])?void 0:t.label)||e.status})]}),(0,a.jsx)("p",{className:"text-sm text-green-300",children:e.schoolName}),(0,a.jsxs)("p",{className:"text-xs text-green-400",children:[e.teacherName," ⢠",e.teamMembers.length+1," \xfaÄastn\xedků"]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(g.$,{variant:"ghost",size:"sm",onClick:()=>{sN(e),sj(!0)},className:"text-green-300 hover:text-green-200 hover:bg-green-400/10",title:"Zobrazit detail registrace",children:(0,a.jsx)(M.A,{className:"w-4 h-4"})}),(0,a.jsx)(g.$,{variant:"ghost",size:"sm",onClick:()=>tT(e._id),className:"text-blue-300 hover:text-blue-200 hover:bg-blue-400/10",title:"Odeslat email",children:(0,a.jsx)(V.A,{className:"w-4 h-4"})}),(0,a.jsx)(g.$,{variant:"ghost",size:"sm",onClick:()=>{eU(e),eZ(!0)},className:"text-purple-300 hover:text-purple-200 hover:bg-purple-400/10",title:"Nahr\xe1t fotky t\xfdmu",children:(0,a.jsx)(Y.A,{className:"w-4 h-4"})}),(0,a.jsx)(g.$,{variant:"ghost",size:"sm",onClick:()=>{f(e),ed("0"),ex("0"),eg("0"),k(!0)},className:"text-yellow-300 hover:text-yellow-200 hover:bg-yellow-400/10",title:"Publikovat v\xfdsledek",children:(0,a.jsx)(L.A,{className:"w-4 h-4"})})]})]},e._id)})})]})]})},e._id)})})]})}),(0,a.jsx)(v.av,{value:"calendar",className:"space-y-6",children:(0,a.jsxs)("div",{className:"bg-black/20 backdrop-blur-sm border border-green-400/30 rounded-lg p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsx)("h3",{className:"text-xl font-semibold text-white",children:ev.toLocaleDateString("cs-CZ",{month:"long",year:"numeric"})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(g.$,{variant:"outline",size:"sm",onClick:()=>tj("prev"),className:"bg-black/20 backdrop-blur-sm border-green-400/30 text-green-300 hover:text-green-200 hover:bg-green-400/10",children:(0,a.jsx)(es.A,{className:"w-4 h-4"})}),(0,a.jsx)(g.$,{variant:"outline",size:"sm",onClick:()=>tj("next"),className:"bg-black/20 backdrop-blur-sm border-green-400/30 text-green-300 hover:text-green-200 hover:bg-green-400/10",children:(0,a.jsx)(et.A,{className:"w-4 h-4"})})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-7 gap-1 mb-4",children:[["Po","\xdat","St","Ät","P\xe1","So","Ne"].map(e=>(0,a.jsx)("div",{className:"p-2 text-center text-green-300 font-medium text-sm",children:e},e)),(e=>{let s=e.getFullYear(),t=e.getMonth(),a=new Date(s,t,1),r=new Date(s,t+1,0).getDate(),l=(a.getDay()+6)%7,n=[];for(let e=0;e<l;e++)n.push(null);for(let e=1;e<=r;e++)n.push(new Date(s,t,e));return n})(ev).map((e,s)=>{if(!e)return(0,a.jsx)("div",{className:"p-2 h-24"},s);let t=(e=>{let s=td(e);return tt.filter(e=>e.date===s)})(e),r=e.toDateString()===new Date().toDateString();return(0,a.jsxs)("div",{className:"p-2 h-24 border border-green-400/20 rounded cursor-pointer hover:bg-green-400/10 transition-colors ".concat(r?"bg-green-400/20":"bg-black/20"),onClick:()=>{ek(td(e)),sF({timeType:"morning",startTime:"09:00",endTime:"13:00",capacity:8}),eS(!0)},children:[(0,a.jsx)("div",{className:"text-white text-sm font-medium mb-1",children:e.getDate()}),(0,a.jsx)("div",{className:"space-y-1",children:t.map(e=>{let s=tm(e._id).filter(e=>"cancelled"!==e.status&&"changes_needed"!==e.status).length;return(0,a.jsxs)("div",{className:"text-xs p-1 bg-green-500/20 text-green-300 rounded cursor-pointer hover:bg-green-500/30",onClick:s=>th(s,e),children:["morning"===e.timeType?"D":"O",": ",s,"/",e.capacity]},e._id)})})]},e.toISOString())})]})]})}),(0,a.jsx)(v.av,{value:"photos",className:"space-y-6",children:(0,a.jsxs)("div",{className:"bg-black/20 backdrop-blur-sm border border-green-400/30 rounded-lg p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsx)("h3",{className:"text-xl font-semibold text-white",children:"Fotogalerie"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)(g.$,{onClick:()=>e0(!0),className:"bg-green-600 hover:bg-green-700 text-white",children:[(0,a.jsx)(ea.A,{className:"w-4 h-4 mr-2"}),"Nahr\xe1t obecn\xe9 fotky"]}),(0,a.jsx)(g.$,{onClick:()=>eY(!eX),variant:"outline",className:"bg-black/20 backdrop-blur-sm border-green-400/30 text-green-300 hover:text-green-200 hover:bg-green-400/10",children:eX?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(B.A,{className:"w-4 h-4 mr-2"}),"ZruÅ¡it v\xfdbÄr"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K.A,{className:"w-4 h-4 mr-2"}),"Vybrat v\xedce"]})})]})]}),(0,a.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 ga
1p-4",children:ts.map(e=>(0,a.jsxs)("div",{className:"relative group",children:[(0,a.jsxs)("div",{className:"aspect-square bg-black/40 rounded-lg overflow-hidden border border-green-400/20",children:[e.url&&(0,a.jsx)("img",{src:e.url,alt:e.filename,className:"w-full h-full object-cover"}),eX&&(0,a.jsx)("div",{className:"absolute top-2 left-2",children:(0,a.jsx)($.S,{checked:eH.has(e._id),onCheckedChange:s=>{let t=new Set(eH);s?t.add(e._id):t.delete(e._id),eB(t)},className:"bg-black/50 border-white"})}),(0,a.jsx)("div",{className:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(g.$,{variant:"ghost",size:"sm",onClick:()=>s1({photoId:e._id}),className:"text-white hover:bg-white/20",children:e.isVisible?(0,a.jsx)(M.A,{className:"w-4 h-4"}):(0,a.jsx)(I.A,{className:"w-4 h-4"})}),(0,a.jsx)(g.$,{variant:"ghost",size:"sm",onClick:()=>s2({photoId:e._id}),className:"text-red-400 hover:bg-red-400/20",children:(0,a.jsx)(G.A,{className:"w-4 h-4"})})]})})]}),(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsx)("p",{className:"text-xs text-green-300 truncate",children:e.teamName||"Obecn\xe9"}),(0,a.jsx)("p",{className:"text-xs text-green-400 truncate",children:e.filename})]})]},e._id))})]})}),(0,a.jsx)(v.av,{value:"emails",className:"space-y-6",children:(0,a.jsx)(eN,{})}),(0,a.jsx)(v.av,{value:"halloffame",className:"space-y-6",children:(0,a.jsxs)("div",{className:"bg-black/20 backdrop-blur-sm border border-green-400/30 rounded-lg p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-wrap gap-3",children:[(0,a.jsx)("h3",{className:"text-xl font-semibold text-white",children:"Hall of Fame - VÅ¡echny v\xfdsledky"}),(0,a.jsxs)(g.$,{onClick:()=>{let e=new Map;s7.filter(e=>"cancelled"!==e.status).forEach(s=>{var t,a;let r=(null==(t=s.schoolName)?void 0:t.trim())||"Nezn\xe1m\xe1 Å¡kola";e.has(r)||e.set(r,{dates:new Set,teams:[],teacherEmails:new Set});let l=e.get(r);l.teams.push(s.teamNickname),s.teacherEmail&&l.teacherEmails.add(s.teacherEmail),(null==(a=s.timeSlot)?void 0:a.date)&&l.dates.add(s.timeSlot.date)});let s=new Blob(["\uFEFF"+[["Å kola","PoÄet t\xfdmů","T\xfdmy","Datum n\xe1vÅ¡tÄvy","Email uÄitele"],...Array.from(e.entries()).sort((e,s)=>e[0].localeCompare(s[0],"cs")).map(e=>{let[s,t]=e,a=Array.from(t.dates).sort();return[s,t.teams.length.toString(),t.teams.join(", "),a.join(", "),Array.from(t.teacherEmails).join(", ")]})].map(e=>e.map(e=>'"'.concat(e.replace(/"/g,'""'),'"')).join(";")).join("\n")],{type:"text/csv;charset=utf-8;"}),t=URL.createObjectURL(s),a=document.createElement("a");a.href=t,a.download="chemmasters-skoly-".concat(new Date().toISOString().slice(0,10),".csv"),a.click(),URL.revokeObjectURL(t),c.oR.success("Stažen seznam ".concat(e.size," Å¡kol"))},variant:"outline",size:"sm",className:"border-green-400/50 text-green-300 hover:bg-green-400/10 flex items-center gap-2",children:[(0,a.jsx)(er.A,{className:"w-4 h-4"}),"St\xe1hnout seznam Å¡kol (CSV)"]})]}),(()=>{let e=s7.filter(e=>e.completionTime&&e.completionTime>0).sort((e,s)=>(e.completionTime||0)-(s.completionTime||0));return 0===e.length?(0,a.jsx)("div",{className:"text-center py-8 text-green-300",children:"Zat\xedm nejsou zaznamen\xe1ny ž\xe1dn\xe9 v\xfdsledky."}):(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-green-400/30",children:[(0,a.jsx)("th",{className:"text-left py-3 text-green-300 font-medium",children:"PoÅad\xed"}),(0,a.jsx)("th",{className:"text-left py-3 text-green-300 font-medium",children:"T\xfdm"}),(0,a.jsx)("th",{className:"text-left py-3 text-green-300 font-medium",children:"Å kola"}),(0,a.jsx)("th",{className:"text-left py-3 text-green-300 font-medium",children:"Datum"}),(0,a.jsx)("th",{className:"text-left py-3 text-green-300 font-medium",children:"Äas"}),(0,a.jsx)("th",{className:"text-left py-3 text-green-300 font-medium",children:"Stav"}),(0,a.jsx)("th",{className:"text-left py-3 text-green-300 font-medium",children:"Akce"})]})}),(0,a.jsx)("tbody",{children:e.map((e,s)=>{let t=(null==eb?void 0:eb._id)===e._id,r=Math.floor((e.completionTime||0)/3600),l=Math.floor((e.completionTime||0)%3600/60),n=(e.completionTime||0)%60,i="published"===e.status;return(0,a.jsxs)("tr",{className:"border-b border-green-400/10 hover:bg-green-400/5",children:[(0,a.jsxs)("td",{className:"py-3 text-white font-bold text-lg",children:[s+1,"."]}),(0,a.jsx)("td",{className:"py-3 text-white font-medium",children:e.teamNickname}),(0,a.jsx)("td",{className:"py-3 text-green-300",children:e.schoolName}),(0,a.jsx)("td",{className:"py-3 text-green-300",children:e.timeSlot?(0,a.jsxs)(a.Fragment,{children:[new Date(e.timeSlot.date+"T00:00:00").toLocaleDateString("cs-CZ",{day:"numeric",month:"numeric"}),(0,a.jsx)("span",{className:"ml-1 font-bold",children:"morning"===e.timeSlot.timeType?"D":"O"})]}):"-"}),(0,a.jsx)("td",{className:"py-3",children:t?(0,a.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,a.jsx)(b.p,{type:"number",min:"0",value:J,onChange:e=>ed(e.target.value),placeholder:"H",className:"w-16 bg-black/20 border-green-400/30 text-white"}),(0,a.jsx)("span",{className:"text-green-300",children:":"}),(0,a.jsx)(b.p,{type:"number",min:"0",max:"59",value:em,onChange:e=>ex(e.target.value),placeholder:"M",className:"w-16 bg-black/20 border-green-400/30 text-white"}),(0,a.jsx)("span",{className:"text-green-300",children:":"}),(0,a.jsx)(b.p,{type:"number",min:"0",max:"59",value:eh,onChange:e=>eg(e.target.value),placeholder:"S",className:"w-16 bg-black/20 border-green-400/30 text-white"})]}):(0,a.jsxs)("span",{className:"text-white font-mono text-lg",children:[r>0?"".concat(r,"h "):"",l,"m ",n,"s"]})}),(0,a.jsx)("td",{className:"py-3",children:(0,a.jsx)(p.E,{className:i?"bg-purple-500/20 text-purple-300 border-purple-400/30":"bg-gray-500/20 text-gray-300 border-gray-400/30",children:i?"Publikov\xe1no":"Nepublikov\xe1no"})}),(0,a.jsx)("td",{className:"py-3",children:t?(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(g.$,{size:"sm",onClick:async()=>{try{let s=3600*parseInt(J||"0")+60*parseInt(em||"0")+parseInt(eh||"0");if(s<=0)return void c.oR.error("Äas mus\xed b\xfdt vÄtÅ¡\xed než 0");
1await sK({registrationId:e._id,completionTime:s}),c.oR.success("Äas byl aktualizov\xe1n"),ej(null),ep(!1)}catch(e){console.error("Error updating time:",e),c.oR.error("Chyba pÅi aktualizaci Äasu")}},className:"bg-green-600 hover:bg-green-700",children:(0,a.jsx)(el.A,{className:"w-4 h-4"})}),(0,a.jsx)(g.$,{size:"sm",variant:"outline",onClick:()=>{ej(null),ep(!1)},className:"border-red-400/30 text-red-300 hover:bg-red-400/10",children:(0,a.jsx)(B.A,{className:"w-4 h-4"})})]}):(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)(g.$,{size:"sm",variant:"outline",onClick:()=>{ej(e),ed(r.toString()),ex(l.toString()),eg(n.toString()),ep(!0)},className:"border-green-400/30 text-green-300 hover:bg-green-400/10",children:[(0,a.jsx)(ee.A,{className:"w-4 h-4 mr-1"}),"Upravit"]}),(()=>{let s=ts.some(s=>s.teamName===e.teamNickname);return(0,a.jsx)(g.$,{size:"sm",variant:"outline",onClick:()=>{eU(e),eZ(!0)},className:s?"border-green-400/30 text-green-300 hover:bg-green-400/10":"border-blue-400/30 text-blue-300 hover:bg-blue-400/10",title:s?"Fotka nahr\xe1na - klikni pro \xfapravu":"Nahr\xe1t fotky t\xfdmu",children:s?(0,a.jsx)(el.A,{className:"w-4 h-4"}):(0,a.jsx)(Y.A,{className:"w-4 h-4"})})})(),!i&&(0,a.jsxs)(g.$,{size:"sm",variant:"outline",onClick:async()=>{try{await sq({registrationId:e._id,status:"published"}),c.oR.success("V\xfdsledek byl publikov\xe1n")}catch(e){console.error("Error publishing:",e),c.oR.error("Chyba pÅi publikov\xe1n\xed")}},className:"border-purple-400/30 text-purple-300 hover:bg-purple-400/10",children:[(0,a.jsx)(L.A,{className:"w-4 h-4 mr-1"}),"Publikovat"]})]})})]},e._id)})})]})})})()]})})]})}),(0,a.jsx)(N.lG,{open:y,onOpenChange:k,children:(0,a.jsxs)(N.Cf,{className:"bg-black/90 backdrop-blur-sm border-green-400/30 text-white",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsxs)(N.L3,{className:"flex items-center gap-2 text-white",children:[(0,a.jsx)(L.A,{className:"w-5 h-5 text-yellow-400"}),"Publikovat v\xfdsledek do Hall of Fame"]}),(0,a.jsx)(N.rr,{className:"text-green-300",children:t&&(0,a.jsxs)(a.Fragment,{children:["T\xfdm ",(0,a.jsx)("strong",{children:t.teamNickname})," ze Å¡koly"," ",(0,a.jsx)("strong",{children:t.schoolName})]})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{className:"text-green-300 mb-2 block",children:"Äas dokonÄen\xed"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"hours",className:"text-green-300 text-xs",children:"Hodiny"}),(0,a.jsx)(b.p,{id:"hours",type:"number",min:"0",value:J,onChange:e=>ed(e.target.value),placeholder:"0",className:"bg-black/20 border-green-400/30 text-white"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"minutes",className:"text-green-300 text-xs",children:"Minuty"}),(0,a.jsx)(b.p,{id:"minutes",type:"number",min:"0",max:"59",value:em,onChange:e=>ex(e.target.value),placeholder:"0",className:"bg-black/20 border-green-400/30 text-white"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"seconds",className:"text-green-300 text-xs",children:"VteÅiny"}),(0,a.jsx)(b.p,{id:"seconds",type:"number",min:"0",max:"59",value:eh,onChange:e=>eg(e.target.value),placeholder:"0",className:"bg-black/20 border-green-400/30 text-white"})]})]})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-4",children:[(0,a.jsx)(g.$,{variant:"outline",onClick:()=>k(!1),className:"flex-1",children:"ZruÅ¡it"}),(0,a.jsxs)(g.$,{onClick:()=>t&&tn(t._id),className:"flex-1",children:[(0,a.jsx)(L.A,{className:"w-4 h-4 mr-2"}),"Publikovat"]})]})]})]})}),(0,a.jsx)(N.lG,{open:eC,onOpenChange:eS,children:(0,a.jsxs)(N.Cf,{className:"bg-black/90 backdrop-blur-sm border-green-400/30 text-white",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsxs)(N.L3,{className:"flex items-center gap-2 text-white",children:[(0,a.jsx)(en.A,{className:"w-5 h-5"}),"PÅidat nov\xfd term\xedn"]}),(0,a.jsx)(N.rr,{className:"text-green-300",children:ew&&"Datum: ".concat(new Date(ew+"T00:00:00").toLocaleDateString("cs-CZ"))})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)($.S,{id:"morning",checked:"morning"===sA.timeType,onCheckedChange:()=>tv(!0)}),(0,a.jsx)(j.J,{htmlFor:"morning",className:"text-green-300",children:"Dopoledne"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)($.S,{id:"afternoon",checked:"afternoon"===sA.timeType,onCheckedChange:()=>tv(!1)}),(0,a.jsx)(j.J,{htmlFor:"afternoon",className:"text-green-300",children:"Od
1poledne"})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"startTime",className:"text-green-300",children:"ZaÄ\xe1tek"}),(0,a.jsx)(b.p,{id:"startTime",type:"time",value:sA.startTime,onChange:e=>sF(s=>({...s,startTime:e.target.value})),className:"bg-black/20 border-green-400/30 text-white"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"endTime",className:"text-green-300",children:"Konec"}),(0,a.jsx)(b.p,{id:"endTime",type:"time",value:sA.endTime,onChange:e=>sF(s=>({...s,endTime:e.target.value})),className:"bg-black/20 border-green-400/30 text-white"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"capacity",className:"text-green-300",children:"Kapacita (poÄet t\xfdmů)"}),(0,a.jsx)(b.p,{id:"capacity",type:"number",value:sA.capacity,onChange:e=>sF(s=>({...s,capacity:parseInt(e.target.value)||8})),className:"bg-black/20 border-green-400/30 text-white"})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-4",children:[(0,a.jsx)(g.$,{variant:"outline",onClick:()=>eS(!1),className:"flex-1",children:"ZruÅ¡it"}),(0,a.jsxs)(g.$,{onClick:tu,className:"flex-1",children:[(0,a.jsx)(en.A,{className:"w-4 h-4 mr-2"}),"VytvoÅit term\xedn"]})]})]})]})}),(0,a.jsx)(N.lG,{open:eT,onOpenChange:ez,children:(0,a.jsxs)(N.Cf,{className:"max-w-4xl bg-black/90 backdrop-blur-sm border-green-400/30 text-white",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsxs)(N.L3,{className:"flex items-center gap-2 text-white",children:[(0,a.jsx)(ei.A,{className:"w-5 h-5"}),"Detail term\xednu"]}),(0,a.jsx)(N.rr,{className:"text-green-300",children:eA&&(0,a.jsxs)(a.Fragment,{children:[new Date(eA.date+"T00:00:00").toLocaleDateString("cs-CZ")," -"," ","morning"===eA.timeType?"Dopoledne":"Odpoledne"]})})]}),eA&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"editStartTime",className:"text-green-300",children:"ZaÄ\xe1tek"}),(0,a.jsx)(b.p,{id:"editStartTime",type:"time",value:sA.startTime,onChange:e=>sF(s=>({...s,startTime:e.target.value})),className:"bg-black/20 border-green-400/30 text-white"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"editEndTime",className:"text-green-300",children:"Konec"}),(0,a.jsx)(b.p,{id:"editEndTime",type:"time",value:sA.endTime,onChange:e=>sF(s=>({...s,endTime:e.target.value})),className:"bg-black/20 border-green-400/30 text-white"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"editCapacity",className:"text-green-300",children:"Kapacita"}),(0,a.jsx)(b.p,{id:"editCapacity",type:"number",value:sA.capacity,onChange:e=>sF(s=>({...s,capacity:parseInt(e.target.value)||8})),className:"bg-black/20 border-green-400/30 text-white"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-lg font-medium text-white mb-3",children:"PÅihl\xe1Å¡en\xe9 t\xfdmy"}),(0,a.jsx)("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:tm(eA._id).filter(e=>"cancelled"!==e.status&&"changes_needed"!==e.status).map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 bg-black/40 border border-green-400/20 rounded",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h5",{className:"font-medium text-white",children:e.teamNickname}),(0,a.jsx)("p",{className:"text-sm text-green-300",children:e.schoolName}),(0,a.jsxs)("p",{className:"text-xs text-green-400",children:[e.teamMembers.length+1," \xfaÄastn\xedků"]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(g.$,{variant:"ghost",size:"sm",onClick:()=>{eU(e),eZ(!0)},className:"text-green-400 hover:text-green-300 hover:bg-green-400/10",children:(0,a.jsx)(Y.A,{className:"w-4 h-4"})}),(0,a.jsx)(g.$,{variant:"ghost",size:"sm",onClick:()=>{f(e),k(!0)},className:"text-yellow-400 hover:text-yellow-300 hover:bg-yellow-400/10",children:(0,a.jsx)(L.A,{className:"w-4 h-4"})})]})]},e._id))})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-4",children:[(0,a.jsx)(g.$,{variant:"outline",onClick:()=>ez(!1),className:"flex-1",children:"ZavÅ\xedt"}),(0,a.jsxs)(g.$,{variant:"outline",onClick:()=>tx(eA),className:"bg-black/20 backdrop-blur-sm border-green-400/30 text-green-300 hover:text-green-200 hover:bg-green-400/10",children:[(0,a.jsx)(Q.A,{className:"w-4 h-4 mr-2"}),"Generovat PDF"]}),(0,a.jsxs)(g.$,{onClick:tp,className:"bg-green-600 hover:bg-green-700",children:[(0,a.jsx)(ee.A,{className:"w-4 h-4 mr-2"}),"Uložit zmÄny"]}),(0,a.jsxs)(g.$,{variant:"destructive",onClick:()=>{e_(eA),eP(!0)},className:"bg-red-600 hover:bg-red-700",children:[(0,a.jsx)(G.A,{className:"w-4 h-4 mr-2"}),"ZruÅ¡it term\xedn"]})]})]})]})}),(0,a.jsx)(w,{open:eE,onOpenChange:eP,children:(0,a.jsxs)(T,{className:"bg-black/90 backdrop-blur-sm border-green-400/30 text-white",children:[(0,a.jsxs)(z,{children:[(0,a.jsxs)(F,{className:"flex items-center gap-2 text-white",children:[(0,a.jsx)(ec.A,{className:"w-5 h-5 text-red-400"}),"Potvrdit zruÅ¡en\xed term\xednu"]}),(0,a.jsx)(E,{className:"text-green-300",children:eR&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("p",{children:["Opravdu chcete zruÅ¡it term\xedn ",(0,a.jsx)("strong",{children:new Date(eR.date+"T00:00:00").toLocaleDateString("cs-CZ")})," ",(0,a.jsx)("strong",{children:"morning"===eR.timeType?"dopoledne":"odpoledne"})," ","(",eR.startTime," - ",eR.endTime,")?"]}),tm(eR._id).length>0&&(0,a.jsxs)("div",{className:"p-3 bg-orange-500/10 border border-orange-400/30 rounded-lg",children:[(0,a.jsxs)("p",{className:"font-medium text-orange-300",children:["â ï¸ Na tento term\xedn je pÅihl\xe1Å¡eno ",tm(eR._id).length," t\xfdmů"]}),(0,a.jsx)("p",{className:"text-sm text-orange-400 mt-1",children:'VÅ¡echny registrace budou zruÅ¡eny a oznaÄeny jako "cancelled".'})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 border border-green-400/30 rounded-lg bg-black/20 backdrop-blur-sm",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(V.A,{className:"w-4 h-4 text-green-400"}),(0,a.jsx)("span",{className:"text-sm font-medium text-green-300",children:"Odeslat emailov\xe9 notifikace t\xfdmům"})]}),(0,a.jsx)(D,{checked:eD,onCheckedChange:eO})]}),eD&&tm(eR._id).length>0&&(0,a.jsxs)("p",{className:"text-xs text-green-400",children:["Bude odesl\xe1no ",tm(eR._id).length," emailů s informac\xed o zruÅ¡en\xed term\xednu."]})]})})]}),(0,a.jsxs)(A,{children:[(0,a.jsx)(R,{className:"bg-black/20 backdrop-blur-sm border-green-400/30 text-green-300 hover:text-green-200 hover:bg-green-400/10",children:"ZruÅ¡it"}),(0,a.jsxs)(P,{onClick:tb,className:"bg-red-600 hover:bg-red-700 text-white",children:[(0,a.jsx)(G.A,{className:"w-4 h-4 mr-2"}),"ZruÅ¡it term\xedn"]})]})]})}),(0,a.jsx)(N.lG,{open:e$,onOpenChange:eZ,children:(0,a.jsxs)(N.Cf,{className:"max-w-md bg-black/90 backdrop-blur-sm border-green-400/30 text-white",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsxs)(N.L3,{className:"flex items-center gap-2 text-white",children:[(0,a.jsx)(Y.A,{className:"w-5 h-5"}),"Nahr\xe1t fotky pro t\xfdm ",eJ&&eJ.teamNickname]}),(0,a.jsx)(N.rr,{className:"text-green-300",children:eJ&&(0,a.jsxs)(a.Fragment,{children:["Nahr\xe1v\xe1n\xed fotek pro t\xfdm ",(0,a.jsx)("strong",{children:eJ.teamNickname})," ",(0,a.jsx)("strong",{children:eJ.timeSlot&&("morning"===eJ.timeSlot.timeType?"Dopoledne":"Odpoledne")})," ","(",eJ.timeSlot&&eJ.timeSlot.startTime," - ",eJ.timeSlot&&eJ.timeSlot.endTime,")"]})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"photoUpload",className:"text-green-300",children:"Vyberte soubory"}),(0,a.jsx)(b.p,{id:"photoUpload",type:"file",multiple:!0,accept:"image/*",onChange:e=>{eM(Array.from(e.target.files||[]).filter(e=>x(e)?!(e.size>0x3200000)||(c.oR.error("Soubor ".concat(e.name," je pÅ\xedliÅ¡ velk\xfd (max 50MB)")),!1):(c.oR.error("Soubor ".concat(e.name," nen\xed podporovan\xfd form\xe1t obr\xe1zku")),!1)))},className:"bg-black/20 border-green-400/30 text-white file:bg-green-500 file:text-white file:border-0 file:rounded file:px-3 file:py-1 file:mr-3"}),eI.length>0&&(0,a.jsxs)("p",{className:"text-xs text-green-400 mt-1",children:["Vybr\xe1no ",eI.length," souborů"]})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-4",children:[(0,a.jsx)(g.$,{variant:"outline",onClick:()=>{eZ(!1),eU(null),eM([])},className:"flex-1",children:"ZruÅ¡it"}),(0,a.jsxs)(g.$,{onClick:tf,className:"flex-1",disabled:!eJ||0===eI.length||eV,children:[(0,a.jsx)(ea.A,{className:"w-4 h-4 mr-2"}),eV?"Nahr\xe1v\xe1m...":"Nahr\xe1t fotky"]})]})]})]})}),(0,a.jsx)(N.lG,{open:eQ,onOpenChange:e0,children:(0,a.jsxs)(N.Cf,{className:"max-w-md bg-black/90 backdrop-blur-sm border-green-400/30 text-white",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsxs)(N.L3,{className:"flex items-center gap-2 text-white",children:[(0,a.jsx)(Y.A,{className:"w-5 h-5"}),"Nahr\xe1t obecn\xe9 fotky"]}),(0,a.jsx)(N.rr,{className:"text-green-300",children:"Nahr\xe1n\xed fotek bez pÅiÅazen\xed ke konkr\xe9tn\xedmu t\xfdmu s možnost\xed pÅid\xe1n\xed tagu"})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"generalPhotoUpload",className:"text-green-300",children:"Vyberte soubory"}),(0,a.jsx)(b.p,{id:"generalPhotoUpload",type:"file",multiple:!0,accept:"image/*",onChange:e=>{e1(Array.from(e.target.files||[]).filter(e=>x(e)?!(e.size>0x3200000)||(c.oR.error("Soubor ".concat(e.name," je pÅ\xedliÅ¡ velk\xfd (max 50MB)")),!1):(c.oR.error("Soubor ".concat(e.name," nen\xed podporovan\xfd form\xe1t obr\xe1zku")),!1)))},className:"bg-black/20 border-green-400/30 text-white file:bg-green-500 file:text-white file:border-0 file:rounded file:px-3 file:py-1 file:mr-3"}),e4.length>0&&(0,a.jsxs)("p",{className:"text-xs text-green-400 mt-1",children:["Vybr\xe1no ",e4.length," souborů"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"photoTag",className:"text-green-300",children:"Tag/Kl\xedÄov\xe9 slovo (voliteln\xe9)"}),(0,a.jsx)(b.p,{id:"photoTag",value:e2,onChange:e=>e3(e.target.value),placeholder:"napÅ. ceremoni\xe1l, prezentace...",className:"bg-black/20 border-green-400/30 text-white"})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-4",children:[(0,a.jsx)(g.$,{variant:"outline",onClick:()=>{e0(!1),e1([]),e3("")},className:"flex-1",children:"ZruÅ¡it"}),(0,a.jsxs)(g.$,{onClick:ty,className:"flex-1",disabled:0===e4.length||e5,children:[(0,a.jsx)(ea.A,{className:"w-4 h-4 mr-2"}),e5?"Nahr\xe1v\xe1m...":"Nahr\xe1t fotky"]})]})]})]})}),(0,a.jsx)(N.lG,{open:sR,onOpenChange:s_,children:(0,a.jsxs)(N.Cf,{className:"max-w-md bg-black/90 backdrop-blur-sm border-green-400/30 text-white",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsxs)(N.L3,{className:"flex items-center gap-2 text-white",children:[(0,a.jsx)(Y.A,{className:"w-5 h-5"}),"Nahr\xe1t fotky z akce"]}),(0,a.jsx)(N.rr,{className:"text-green-300",children:sD&&(0,a.jsxs)(a.Fragment,{children:["Nahr\xe1n\xed fotek pro term\xedn ",(0,a.jsx)("strong",{children:to(sD.date)})," ",(0,a.jsx)("strong",{children:"morning"===sD.timeType?"Dopoledne":"Odpoledne"})," ","(",sD.startTime," - ",sD.endTime,")"]})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"eventPhotoUpload",className:"text-green-300",children:"Vyberte soubory"}),(0,a.jsx)(b.p,{id:"eventPhotoUpload",type:"file",multiple:!0,accept:"image/*",onChange:e=>{sZ(Array.from(e.target.files||[]).filter(e=>x(e)?!(e.size>0x3200000)||(c.oR.error("Soubor ".concat(e.name," je pÅ\xedliÅ¡ velk\xfd (max 50MB)")),!1):(c.oR.error("Soubor ".concat(e.name," nen\xed podporovan\xfd form\xe1t obr\xe1zku")),!1)))},className:"bg-black/20 border-green-400/30 text-white file:bg-green-500 file:text-white file:border-0 file:rounded file:px-3 file:py-1 file:mr-3"}),s$.length>0&&(0,a.jsxs)("p",{className:"text-xs text-green-400 mt-1",children:["Vybr\xe1no ",s$.length," souborů"]})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-4",children:[(0,a.jsx)(g.$,{variant:"outline",onClick:()=>{s_(!1),sO(null),sZ([])},className:"flex-1",children:"ZruÅ¡it"}),(0,a.jsxs)(g.$,{onClick:tN,className:"flex-1",disabled:!sD||0===s$.length||sJ,children:[(0,a.jsx)(ea.A,{className:"w-4 h-4 mr-2"}),sJ?"Nahr\xe1v\xe1m...":"Nahr\xe1t fotky"]})]})]})]})}),(0,a.jsx)(N.lG,{open:ss,onOpenChange:st,children:(0,a.jsxs)(N.Cf,{className:"bg-black/90 backdrop-blur-sm border-green-400/30 text-white",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsxs)(N.L3,{className:"flex items-center gap-2 text-white",children:[(0,a.jsx)(q.A,{className:"w-5 h-5"}),"Hromadd\xe1 zmÄna stavu"]}),(0,a.jsxs)(N.rr,{className:"text-green-300",children:["ZmÄnit stav pro ",e9.size," vybran\xfdch registrac\xed"]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"bulkStatus",className:"text-green-300",children:"Nov\xfd stav"}),(0,a.jsxs)(O.l6,{value:sa,onValueChange:e=>sr(e),children:[(0,a.jsx)(O.bq,{className:"bg-black/20 border-green-400/30 text-white",children:(0,a.jsx)(O.yv,{})}),(0,a.jsx)(O.gC,{className:"bg-black/90 border-green-400/30",children:Object.entries(ef).map(e=>{let[s,t]=e;return(0,a.jsx)(O.eb,{value:s,className:"text-green-300 focus:bg-green-400/20",children:t.label},s)})})]})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-4",children:[(0,a.jsx)(g.$,{variant:"outline",onClick:()=>st(!1),className:"flex-1",children:"ZruÅ¡it"}),(0,a.jsxs)(g.$,{onClick:tw,className:"flex-1",children:[(0,a.jsx)(q.A,{className:"w-4 h-4 mr-2"}),"ZmÄnit stav"]})]})]})]})}),(0,a.jsx)(N.lG,{open:sb,onOpenChange:sj,children:(0,a.jsxs)(N.Cf,{className:"max-w-4xl bg-black/90 backdrop-blur-sm border-green-400/30 text-white flex flex-col max-h-[90vh]",children:[(0,a.jsxs)(N.c7,{className:"flex-shrink-0",children:[(0,a.jsxs)(N.L3,{className:"flex items-center gap-2 text-white",children:[(0,a.jsx)(eo.A,{className:"w-5 h-5 text-green-400"}),"Detail registrace"]}),(0,a.jsx)(N.rr,{className:"text-green-300",children:"Kompletn\xed informace o registraci t\xfdmu"})]}),(0,a.jsx)("div",{className:"overflow-y-auto flex-1 min-h-0 pr-1",children:sv&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-green-400",children:"Informace o t\xfdmu"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-green-300",children:"N\xe1zev t\xfdmu:"}),(0,a.jsx)("p",{className:"text-white",children:sv.teamNickname})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-green-300",children:"Å kola:"}),(0,a.jsx)("p",{className:"text-white",children:sv.schoolName})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-green-300",children:"Stav registrace:"}),(0,a.jsx)(p.E,{variant:"outline",className:"ml-2 ".concat((null==(e=ef[sv.status])?void 0:e.color)||"border-gray-400/30 text-gray-300"),children:(null==(s=ef[sv.status])?void 0:s.label)||sv.status})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-green-300",children:"PoÄet Älenů:"}),(0,a.jsxs)("p",{className:"text-white",children:[sv.teamMembers.length+1," osob"]})]})]})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-green-400",children:"Term\xedn"}),(0,a.jsx)("div",{className:"space-y-2",children:sv.timeSlot?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-green-300",children:"Datum:"}),(0,a.jsx)("p",{className:"text-white",children:to(sv.timeSlot.date)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-green-300",children:"Äas:"}),(0,a.jsxs)("p",{className:"text-white",children:[sv.timeSlot.startTime," - ",sv.timeSlot.endTime]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-green-300",children:"Typ:"}),(0,a.jsx)("p",{className:"text-white",children:"morning"===sv.timeSlot.timeType?"Dopoledn\xed":"Odpoledn\xed"})]}),sf?(0,a.jsxs)("div",{className:"space-y-2 mt-2",children:[(0,a.jsx)(j.J,{htmlFor:"newTimeSlot",className:"text-green-300",children:"Vyberte nov\xfd term\xedn:"}),(0,a.jsxs)(O.l6,{value:sw,onValueChange:
1sk,children:[(0,a.jsx)(O.bq,{className:"bg-black/20 border-green-400/30 text-white",children:(0,a.jsx)(O.yv,{placeholder:"Vyberte term\xedn"})}),(0,a.jsx)(O.gC,{className:"bg-black/90 border-green-400/30",children:tt.map(e=>(0,a.jsxs)(O.eb,{value:e._id,className:"text-green-300 focus:bg-green-400/20",children:[to(e.date)," - ","morning"===e.timeType?"Dopoledne":"Odpoledne"," (",e.startTime," - ",e.endTime,") - ",e.availableSpots,"/",e.capacity," voln\xfdch"]},e._id))})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(g.$,{variant:"outline",size:"sm",onClick:()=>{sy(!1),sk("")},className:"flex-1 bg-black/20 backdrop-blur-sm border-green-400/30 text-green-300 hover:text-green-200 hover:bg-green-400/10",children:"ZruÅ¡it"}),(0,a.jsx)(g.$,{size:"sm",onClick:tg,disabled:!sw,className:"flex-1 bg-green-600 hover:bg-green-700",children:"Uložit zmÄnu"})]})]}):(0,a.jsxs)(g.$,{variant:"outline",size:"sm",onClick:()=>sy(!0),className:"mt-2 bg-black/20 backdrop-blur-sm border-green-400/30 text-green-300 hover:text-green-200 hover:bg-green-400/10",children:[(0,a.jsx)(ee.A,{className:"w-4 h-4 mr-2"}),"ZmÄnit term\xedn"]})]}):(0,a.jsx)("p",{className:"text-yellow-300",children:"Term\xedn nebyl pÅiÅazen"})})]})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-green-400",children:"Vedouc\xed t\xfdmu (UÄitel)"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-green-300",children:"Jm\xe9no:"}),(0,a.jsx)("p",{className:"text-white",children:sv.teacherName})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-green-300",children:"Email:"}),(0,a.jsx)("p",{className:"text-white",children:sv.teacherEmail})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-green-300",children:"Telefon:"}),(0,a.jsx)("p",{className:"text-white",children:sv.teacherPhone})]})]})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-green-400",children:"Älenov\xe9 t\xfdmu"}),sv.teamMembers.length>0?(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:sv.teamMembers.map((e,s)=>{var t;return(0,a.jsx)("div",{className:"p-3 bg-black/40 rounded-lg border border-green-400/20",children:(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-xs font-medium text-green-300",children:"Jm\xe9no:"}),(0,a.jsx)("p",{className:"text-white text-sm",children:e})]}),(null==(t=sv.teamMemberIntolerances)?void 0:t.find(e=>e.memberIndex===s))&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-xs font-medium text-green-300",children:"Intolerance:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(()=>{var e;let t=null==(e=sv.teamMemberIntolerances)?void 0:e.find(e=>e.memberIndex===s),r=[];return(null==t?void 0:t.glutenFree)&&r.push((0,a.jsx)(p.E,{variant:"outline",className:"text-xs border-yellow-400/30 text-yellow-300",children:"Bezlepkov\xe1"},"gluten")),(null==t?void 0:t.lactoseFree)&&r.push((0,a.jsx)(p.E,{variant:"outline",className:"text-xs border-blue-400/30 text-blue-300",children:"Bezlakt\xf3zov\xe1"},"lactose")),(null==t?void 0:t.vegetarian)&&r.push((0,a.jsx)(p.E,{variant:"outline",className:"text-xs border-green-400/30 text-green-300",children:"Vegetari\xe1n"},"vegetarian")),(null==t?void 0:t.vegan)&&r.push((0,a.jsx)(p.E,{variant:"outline",className:"text-xs border-purple-400/30 text-purple-300",children:"Vegan"},"vegan")),r.length>0?r:(0,a.jsx)("span",{className:"text-xs text-gray-400",children:"Ž\xe1dn\xe9"})})()})]})]})},s)})}):(0,a.jsx)("p",{className:"text-gray-400",children:"Ž\xe1dn\xed Älenov\xe9 t\xfdmu"})]}),sv.note&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-green-400",children:"Pozn\xe1mky"}),(0,a.jsx)("div",{className:"p-3 bg-black/40 rounded-lg border border-green-400/20",children:(0,a.jsx)("p",{className:"text-white",children:sv.note})})]}),sv.completionTime&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-green-400",children:"V\xfdsledky"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-green-300",children:"Äas dokonÄen\xed:"}),(0,a.jsxs)("p",{className:"text-white",children:[Math.floor(sv.completionTime/3600),":",Math.floor(sv.completionTime%3600/60).toString().padStart(2,"0"),":",(sv.completionTime%60).toString().padStart(2,"0")]}),(0,a.jsxs)(g.$,{variant:"outline",size:"sm",onClick:()=>(e=>{if(e.completionTime){let s=e.completionTime,t=Math.floor(s/3600),a=Math.floor(s%3600/60);ed(t.toString()),ex(a.toString()),eg((s%60).toString())}else ed("0"),ex("0"),eg("0");ej(e),ep(!0)})(sv),className:"mt-2 bg-black/20 backdrop-blur-sm border-green-400/30 text-green-300 hover:text-green-200 hover:bg-green-400/10",children:[(0,a.jsx)(ee.A,{className:"w-4 h-4 mr-2"}),"Upravit Äas"]})]})]})]})}),(0,a.jsxs)("div",{className:"flex justify-between pt-4 flex-shrink-0",children:[sv&&"cancelled"!==sv.status&&(0,a.jsxs)(g.$,{variant:"destructive",onClick:()=>{sz(sv),sS(!0)},className:"bg-red-600 hover:bg-red-700",children:[(0,a.jsx)(U.A,{className:"w-4 h-4 mr-2"}),"ZruÅ¡it pÅihl\xe1Å¡ku"]}),(0,a.jsx)(g.$,{variant:"outline",onClick:()=>sj(!1),className:"bg-black/20 backdrop-blur-sm border-green-400/30 text-green-300 hover:text-green-200 hover:bg-green-400/10 ml-auto",children:"ZavÅ\xedt"})]})]})}),(0,a.jsx)(w,{open:sC,onOpenChange:sS,children:(0,a.jsxs)(T,{className:"bg-black/90 backdrop-blur-sm border-red-400/30 text-white",children:[(0,a.jsxs)(z,{children:[(0,a.jsxs)(F,{className:"flex items-center gap-2 text-white",children:[(0,a.jsx)(ec.A,{className:"w-5 h-5 text-red-400"}),"ZruÅ¡it pÅihl\xe1Å¡ku"]}),(0,a.jsx)(E,{className:"text-gray-300",children:sT&&(0,a.jsxs)(a.Fragment,{children:["Opravdu chcete zruÅ¡it pÅihl\xe1Å¡ku t\xfdmu ",(0,a.jsx)("strong",{className:"text-white",children:sT.teamNickname})," ze Å¡koly"," ",(0,a.jsx)("strong",{className:"text-white",children:sT.sc
1hoolName}),"?",(0,a.jsx)("br",{}),(0,a.jsx)("br",{}),"T\xfdm bude odhl\xe1Å¡en z term\xednu a m\xedsto se uvoln\xed pro ostatn\xed."]})})]}),(0,a.jsxs)(A,{children:[(0,a.jsx)(R,{className:"bg-black/20 backdrop-blur-sm border-green-400/30 text-green-300 hover:text-green-200 hover:bg-green-400/10",children:"ZpÄt"}),(0,a.jsx)(P,{onClick:tc,className:"bg-red-600 hover:bg-red-700 text-white",children:"Ano, zruÅ¡it pÅihl\xe1Å¡ku"})]})]})}),(0,a.jsx)(N.lG,{open:eu,onOpenChange:ep,children:(0,a.jsxs)(N.Cf,{className:"bg-black/90 backdrop-blur-sm border-green-400/30 text-white",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsxs)(N.L3,{className:"flex items-center gap-2 text-white",children:[(0,a.jsx)(ee.A,{className:"w-5 h-5 text-green-400"}),"Upravit Äas dokonÄen\xed"]}),(0,a.jsx)(N.rr,{className:"text-green-300",children:eb&&(0,a.jsxs)(a.Fragment,{children:["T\xfdm ",(0,a.jsx)("strong",{children:eb.teamNickname})," ze Å¡koly"," ",(0,a.jsx)("strong",{children:eb.schoolName})]})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{className:"text-green-300 mb-2 block",children:"Äas dokonÄen\xed"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"edit-hours",className:"text-green-300 text-xs",children:"Hodiny"}),(0,a.jsx)(b.p,{id:"edit-hours",type:"number",min:"0",value:J,onChange:e=>ed(e.target.value),placeholder:"0",className:"bg-black/20 border-green-400/30 text-white"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"edit-minutes",className:"text-green-300 text-xs",children:"Minuty"}),(0,a.jsx)(b.p,{id:"edit-minutes",type:"number",min:"0",max:"59",value:em,onChange:e=>ex(e.target.value),placeholder:"0",className:"bg-black/20 border-green-400/30 text-white"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(j.J,{htmlFor:"edit-seconds",className:"text-green-300 text-xs",children:"VteÅiny"}),(0,a.jsx)(b.p,{id:"edit-seconds",type:"number",min:"0",max:"59",value:eh,onChange:e=>eg(e.target.value),placeholder:"0",className:"bg-black/20 border-green-400/30 text-white"})]})]})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-4",children:[(0,a.jsx)(g.$,{variant:"outline",onClick:()=>{ep(!1),ej(null)},className:"flex-1",children:"ZruÅ¡it"}),(0,a.jsxs)(g.$,{onClick:ti,className:"flex-1 bg-green-600 hover:bg-green-700",children:[(0,a.jsx)(ee.A,{className:"w-4 h-4 mr-2"}),"Uložit Äas"]})]})]})]})}),(0,a.jsx)(N.lG,{open:sm,onOpenChange:sx,children:(0,a.jsxs)(N.Cf,{className:"bg-black/90 backdrop-blur-sm border-green-400/30 text-white",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsxs)(N.L3,{className:"flex items-center gap-2 text-white",children:[(0,a.jsx)(V.A,{className:"w-5 h-5 text-blue-400"}),"Vyberte typ emailu"]}),(0,a.jsx)(N.rr,{className:"text-green-300",children:"Jak\xfd email chcete odeslat?"})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(j.J,{className:"text-green-300",children:"Typ emailu"}),(0,a.jsxs)(O.l6,{value:so,onValueChange:e=>sd(e),children:[(0,a.jsx)(O.bq,{className:"bg-black/20 border-green-400/30 text-white",children:(0,a.jsx)(O.yv,{})}),(0,a.jsxs)(O.gC,{className:"bg-black/90 border-green-400/30",children:[(0,a.jsx)(O.eb,{value:"registration_confirmation",className:"text-green-300 focus:bg-green-400/20",children:"Potvrzen\xed registrace"}),(0,a.jsx)(O.eb,{value:"teacher_confirmation",className:"text-green-300 focus:bg-green-400/20",children:"Potvrzen\xed registrace administr\xe1torem"}),(0,a.jsx)(O.eb,{value:"day_before_reminder",className:"text-green-300 focus:bg-green-400/20",children:"Email den pÅed akc\xed"})]})]})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-4",children:[(0,a.jsx)(g.$,{variant:"outline",onClick:()=>sx(!1),className:"flex-1 border-green-400/30 text-green-300 hover:bg-green-400/10",children:"ZruÅ¡it"}),(0,a.jsxs)(g.$,{onClick:tz,className:"flex-1 bg-blue-600 hover:bg-blue-700",children:[(0,a.jsx)(V.A,{className:"w-4 h-4 mr-2"}),"Odeslat email"]})]})]})]})}),(0,a.jsx)(N.lG,{open:su,onOpenChange:sp,children:(0,a.jsxs)(N.Cf,{className:"bg-black/90 backdrop-blur-sm border-green-400/30 text-white",children:[(0,a.jsxs)(N.c7,{children:[(0,a.jsxs)(N.L3,{className:"flex items-center gap-2 text-white",children:[(0,a.jsx)(V.A,{className:"w-5 h-5 text-blue-400"}),"Hromadn\xe9 odes\xedl\xe1n\xed emailů"]}),(0,a.jsxs)(N.rr,{className:"text-green-300",children:["Odeslat email ",e9.size," registrac\xedm"]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)(j.J,{className:"text-green-300",children:"Typ emailu"}),(0,a.jsxs)(O.l6,{value:so,onValueChange:e=>sd(e),children:[(0,a.jsx)(O.bq,{className:"bg-black/20 border-green-400/30 text-white",children:(0,a.jsx)(O.yv,{})}),(0,a.jsxs)(O.gC,{className:"bg-black/90 border-green-400/30",children:[(0,a.jsx)(O.eb,{value:"registration_confirmation",className:"text-green-300 focus:bg-green-400/20",children:"Potvrzen\xed registrace"}),(0,a.jsx)(O.eb,{value:"teacher_confirmation",className:"text-green-300 focus:bg-green-400/20",children:"Potvrzen\xed registrace administr\xe1torem"}),(0,a.jsx)(O.eb,{value:"day_before_reminder",className:"text-green-300 focus:bg-green-400/20",children:"Email den pÅed akc\xed"})]})]})]}),(0,a.jsxs)("div",{className:"flex gap-2 pt-4",children:[(0,a.jsx)(g.$,{variant:"outline",onClick:()=>sp(!1),className:"flex-1 border-green-400/30 text-green-300 hover:bg-green-400/10",children:"ZruÅ¡it"}),(0,a.jsxs)(g.$,{onClick:tA,className:"flex-1 bg-blue-600 hover:bg-blue-700",children:[(0,a.jsx)(V.A,{className:"w-4 h-4 mr-2"}),"Odeslat emaily (",e9.size,")"]})]})]})]})})]})]}):(0,a.jsx)("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-6xl mb-4",children:"\uD83D\uDD12"}),(0,a.jsx)("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"PÅ\xedstup odepÅen"}),(0,a.jsx)("p",{className:"text-gray-600 mb-4",children:"Nem\xe1te opr\xe1vnÄn\xed k pÅ\xedstupu do admin sekce."}),(0,a.jsx)(g.$,{onClick:()=>window.location.href="/",variant:"outline",children:"ZpÄt na hlavn\xed str\xe1nku"})]})})}},55299:(e,s,t)=>{Promise.resolve().then(t.bind(t,48228)),Promise.resolve().then(t.bind(t,11710))},90923:(e,s,t)=>{"use strict";t.d(s,{Xi:()=>o,av:()=>d,j7:()=>c,tU:()=>i});var a=t(95155),r=t(12115),l=t(60574),n=t(25016);let i=l.bL,c=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.B8,{ref:s,className:(0,n.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...r})});c.displayName=l.B8.displayName;let o=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.l9,{ref:s,className:(0,n.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...r})});o.displayName=l.l9.displayName;let d=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.UC,{ref:s,className:(0,n.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...r})});d.displayName=l.UC.displayName}},e=>{e.O(0,[33,930,272,158,363,270,649,598,419,88,441,255,358],()=>e(e.s=55299)),_N_E=e.O()}]);
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.