1import{_ as J}from"./IJ0OkbxE.js";import{u as Q,d as W,aw as X,o as Y,az as r,aA as l,aB as e,ax as _,aV as M,a$ as y,aI as d,j as a,aC as $,aG as U,b0 as ee,b7 as te,al as se,aD as oe,f as p,k as w,aH as x,bC as b,cz as ne}from"./fZsE0FXM.js";import{C as re}from"./BXLgYm53.js";import{C as le}from"./BtYswUdJ.js";import{_ as ae}from"./C00ef3QB.js";import"./BOOeS0PC.js";const ie=()=>{const{$auth:C}=Q(),k=async()=>{if(C?.currentUser)try{const n=await C.currentUser.getIdToken();if(n)return{authorization:`Bearer ${n}`}}catch(n){console.error("Error getting auth token:",n)}return{}},j=async()=>{const n=await k();return await $fetch("/api/admin/fom-applications",{headers:n})},g=async(n,c)=>{const h=await k();return await $fetch(`/api/admin/fom-applications/${n}`,{method:"PATCH",headers:h,body:c})};return{fetchApplications:j,updateApplication:g,updateStatus:(n,c)=>g(n,{status:c}),updateNote:(n,c)=>g(n,{note:c}),softDelete:n=>g(n,{deleted:!0,deletedAt:new Date().toISOString()}),restore:n=>g(n,{deleted:!1,deletedAt:null})}},de={class:"mb-4"},ce={class:"mb-6 flex items-center justify-between"},ue={class:"flex items-center gap-6"},ye={class:"text-sm text-gray-500"},xe={class:"font-semibold text-gray-900"},ge={class:"font-semibold text-gray-900"},me={class:"flex cursor-pointer items-center gap-2 text-sm text-gray-700"},be={key:0},fe={key:1,class:"overflow-hidden rounded-lg border border-gray-200"},he={class:"w-full text-left text-sm"},ve={class:"divide-y divide-gray-100"},pe=["onClick"],ke={class:"px-4 py-3 text-gray-600"},_e={class:"px-4 py-3 text-gray-600"},we={class:"px-4 py-3 text-gray-600"},Ce={class:"px-4 py-3 text-gray-600"},je={class:"px-4 py-3 text-center"},ze={key:0,class:"mx-auto h-5 w-5 text-green-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ne={key:1,class:"text-gray-300"},Se={class:"px-4 py-3"},Ae={key:0,class:"inline-block rounded-full bg-gray-200 px-2.5 py-0.5 text-xs font-semibold text-gray-600"},De={key:2,class:"text-gray-300"},Me={class:"px-4 py-3 text-right"},$e={key:0},Be={colspan:"9",class:"bg-gray-50 px-6 py-6"},Le={class:"mb-6 flex gap-3"},Ve=["disabled","onClick"],Ue=["disabled","onClick"],Ee=["disabled","onClick"],Ie={class:"mb-6"},Pe={class:"mb-1.5 flex items-center justify-between"},Fe=["value","disabled","onInput"],Te={class:"space-y-5"},He={class:"text-sm text-gray-700"},Oe={class:"whitespace-pre-line text-sm text-gray-700"},Re={class:"whitespace-pre-line text-sm text-gray-700"},Ze=["href"],Ke={class:"mt-8 border-t border-gray-200 pt-5"},Ge=["onClick"],qe=["onClick"],tt=W({__name:"index",setup(C){X({title:"Prihlášky â Letná Å¡kola PMÃ"});const{fetchApplications:k,updateStatus:j,updateNote:g,softDelete:B,restore:L}=ie(),f=p([]),z=p(!0),n=p(!1),c=p(null),h=p(!1),u=ne({}),N={},S=w(()=>h.value?f.value:f.value.filter(s=>!s.deleted)),E=w(()=>f.value.filter(s=>!s.deleted).length),V=w(()=>f.value.filter(s=>s.deleted).length),I=w(()=>S.value.filter(s=>s.essay).length),P={bc:"Bc.","ing-mgr":"Ing./Mgr.",phd:"PhD.",other:"Iné"};function F(s,t){return s==="other"&&t?`Iné: ${t}`:P[s]||s}function T(s){return s?new Date(s).toLocaleDateString("sk-SK",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}):"â"}function H(s){return{accepted:"Prijatý",rejected:"Neprijatý",maybe:"UvidÃme"}[s]||s}function O(s){return{accepted:"bg-green-100 text-green-800",rejected:"bg-red-100 text-red-800",maybe:"bg-blue-100 text-blue-800"}[s]||"bg-gray-100 text-gray-800"}function R(s){c.value=c.value===s?null:s}async function A(s,t){try{await j(s.id,t),s.status=t}catch(m){console.error("Failed to update status:",m)}}function Z(s,t){s.note=t,u[s.id]="saving",N[s.id]&&clearTimeout(N[s.id]),N[s.id]=setTimeout(async()=>{try{await g(s.id,t),u[s.id]="saved",setTimeout(()=>{u[s.id]==="saved"&&(u[s.id]=null)},2e3)}catch(m){console.error("Failed to save note:",m),u[s.id]=null}},700)}async function K(s){if(confirm(`Naozaj chceÅ¡ vymazaÅ¥ prihlášku od "${s.fullName}"? 2 3Prihláška sa len skryje â obnoviÅ¥ ju môžeÅ¡ kedykoľvek cez prepÃnaÄ "ZobraziÅ¥ zmazané".`))try{await B(s.id),s.deleted=!0,s.deletedAt=new Date().toISOString()}catch(t){console.error("Failed to delete application:",t)}}async function G(s){try{await L(s.id),s.deleted=!1,s.deletedAt=null}catch(t){console.error("Failed to restore application:",t)}}function q(){n.value=!0;try{const t=`\uFEFFPoradové ÄÃslo,Esej 4`+S.value.map((i,D)=>({essay:i.essay,index:D+1})).filter(i=>i.essay).map(i=>{const D=i.essay.replace(/"/g,'""');return`${i.index},"${D}"`}).join(` 5`),m=new Blob([t],{type:"text/csv;charset=utf-8;"}),o=URL.createObjectURL(m),v=document.createElement("a");v.href=o,v.download="fom-eseje.csv",v.click(),URL.revokeObjectURL(o)}finally{n.value=!1}}return Y(async()=>{try{f.value=await k()}catch(s){console.error("Failed to fetch applications:",s)}finally{z.value=!1}}),(s,t)=>{const m=J;return r(),l("div",null,[e("div",de,[_(m,{to:"/admin",class:"text-blue-600 hover:underline"},{default:M(()=>[...t[3]||(t[3]=[y(" â Back to Admin Dashboard ",-1)])]),_:1})]),_(le,null,{default:M(()=>[...t[4]||(t[4]=[y("Prihlášky â Letná Å¡kola PMÃ",-1)])]),_:1}),e("div",ce,[e("div",ue,[e("div",ye,[t[6]||(t[6]=y(" AktÃvne: ",-1)),e("span",xe,d(a(E)),1),a(V)>0?(r(),l($,{key:0},[t[5]||(t[5]=y("  · Zmazané: ",-1)),e("span",ge,d(a(V)),1)],64)):U("",!0)]),e("label",me,[ee(e("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>
5se(h)?h.value=o:null),type:"checkbox",class:"h-4 w-4 rounded border-gray-300"},null,512),[[te,a(h)]]),t[7]||(t[7]=y(" ZobraziÅ¥ zmazané ",-1))])]),_(re,{variant:"primary",disabled:a(I)===0||a(n),onClick:q},{default:M(()=>[y(d(a(n)?"Exportujem...":"Export esejà (CSV)"),1)]),_:1},8,["disabled"])]),a(z)?(r(),l("div",be,[_(ae)])):(r(),l("div",fe,[e("table",he,[t[18]||(t[18]=e("thead",{class:"border-b border-gray-200 bg-gray-50"},[e("tr",null,[e("th",{class:"px-4 py-3 font-semibold text-gray-600"},"#"),e("th",{class:"px-4 py-3 font-semibold text-gray-600"},"Meno a Priezvisko"),e("th",{class:"px-4 py-3 font-semibold text-gray-600"},"Email"),e("th",{class:"px-4 py-3 font-semibold text-gray-600"},"Dátum prihlásenia"),e("th",{class:"px-4 py-3 font-semibold text-gray-600"},"Å túdium"),e("th",{class:"px-4 py-3 font-semibold text-gray-600"},"Å tádium"),e("th",{class:"px-4 py-3 text-center font-semibold text-gray-600"},"Esej"),e("th",{class:"px-4 py-3 font-semibold text-gray-600"},"Status"),e("th",{class:"px-4 py-3"})])],-1)),e("tbody",ve,[(r(!0),l($,null,oe(a(S),(o,v)=>(r(),l($,{key:o.id},[e("tr",{class:x(["cursor-pointer transition-colors hover:bg-gray-50",{"bg-red-50/40 text-gray-400":o.deleted}]),onClick:i=>R(o.id)},[e("td",{class:x(["px-4 py-3",(o.deleted,"text-gray-400")])},d(v+1),3),e("td",{class:x(["px-4 py-3 font-medium",o.deleted?"text-gray-400 line-through":"text-gray-900"])},d(o.fullName),3),e("td",ke,d(o.email),1),e("td",_e,d(T(o.createdAt)),1),e("td",we,d(o.study),1),e("td",Ce,d(F(o.studyStage,o.studyStageOther)),1),e("td",je,[o.essay?(r(),l("svg",ze,[...t[8]||(t[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)])])):(r(),l("span",Ne,"â"))]),e("td",Se,[o.deleted?(r(),l("span",Ae," Zmazané ")):o.status?(r(),l("span",{key:1,class:x(["inline-block rounded-full px-2.5 py-0.5 text-xs font-semibold",O(o.status)])},d(H(o.status)),3)):(r(),l("span",De,"â"))]),e("td",Me,[(r(),l("svg",{class:x(["h-5 w-5 text-gray-400 transition-transform",{"rotate-90":a(c)===o.id}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...t[9]||(t[9]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2))])],10,pe),a(c)===o.id?(r(),l("tr",$e,[e("td",Be,[e("div",Le,[e("button",{class:x(["rounded-lg px-4 py-2 text-sm font-semibold transition-all disabled:cursor-not-allowed disabled:opacity-40",o.status==="accepted"?"bg-green-600 text-white":"bg-green-100 text-green-700 hover:bg-green-200"]),disabled:o.deleted,onClick:b(i=>A(o,"accepted"),["stop"])}," Prijatý ",10,Ve),e("button",{class:x(["rounded-lg px-4 py-2 text-sm font-semibold transition-all disabled:cursor-not-allowed disabled:opacity-40",o.status==="rejected"?"bg-red-600 text-white":"bg-red-100 text-red-700 hover:bg-red-200"]),disabled:o.deleted,onClick:b(i=>A(o,"rejected"),["stop"])}," Neprijatý ",10,Ue),e("button",{class:x(["rounded-lg px-4 py-2 text-sm font-semibold transition-all disabled:cursor-not-allowed disabled:opacity-40",o.status==="maybe"?"bg-blue-600 text-white":"bg-blue-100 text-blue-700 hover:bg-blue-200"]),disabled:o.deleted,onClick:b(i=>A(o,"maybe"),["stop"])}," UvidÃme ",10,Ee)]),e("div",Ie,[e("label",Pe,[t[10]||(t[10]=e("span",{class:"text-xs font-semibold uppercase tracking-wider text-gray-400"}," Miesto pre poznámky k prihláške ",-1)),e("span",{class:x(["text-[11px] font-medium",a(u)[o.id]==="saving"?"text-gray-400":a(u)[o.id]==="saved"?"text-green-600":"text-transparent"])},d(a(u)[o.id]==="saving"?"Ukladám...":a(u)[o.id]==="saved"?"Uložené â":"â"),3)]),e("textarea",{value:o.note,rows:"3",class:"w-full rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm text-gray-700 outline-none focus:border-gray-400 focus:ring-2 focus:ring-gray-200 disabled:bg-gray-100",disabled:o.deleted,placeholder:"NapÃÅ¡ si sem pracovné poznámky, ktoré uvidÃÅ¡ iba Ty...",onClick:t[1]||(t[1]=b(()=>{},["stop"])),onInput:i=>Z(o,i.target.value)},null,40,Fe)]),e("div",Te,[e("div",null,[t[11]||(t[11]=e("h4",{class:"mb-1 text-xs font-semibold uppercase tracking-wider text-gray-400"}," SkúsenosÅ¥ s reguláciou / hospodárskou súťažou ",-1)),e("p",He,d(o.experience||"Nevyplnené"),1)]),e("div",null,[t[12]||(t[12]=e("h4",{class:"mb-1 text-xs font-semibold uppercase tracking-wider text-gray-400"}," MotivaÄný list ",-1)),e("p",Oe,d(o.motivation),1)]),e("div",null,[t[13]||(t[13]=e("h4",{class:"mb-1 text-xs font-semibold uppercase tracking-wider text-gray-400"}," Krátka esej ",-1)),e("p",Re,d(o.essay||"Nevyplnené"),1)]),e("div",null,[t[15]||(t[15]=e("h4",{class:"mb-1 text-xs font-semibold uppercase tracking-wider text-gray-400"}," Životopis (CV) ",-1)),e("a",{href:o.cvUrl,target:"_blank",class:"inline-flex items-center gap-1.5 text-sm font-medium text-blue-600 hover:underline",onClick:t[2]||(t[2]=b(()=>{},["stop"]))},[...t[14]||(t[14]=[e("svg",{class:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1),y(" OtvoriÅ¥ CV ",-1)])],8,Ze)])]),e("div",Ke,[o.deleted?(r(),l("button",{key:1,class:"inline-flex items-center gap-1.5 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50",onClick:b(i=>G(o),["stop"])},[...t[17]||(t[17]=[e("svg",{class:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"})],-1),y(" ObnoviÅ¥ prihlášku ",-1)])],8,qe)):(r(),l("button",{key:0,class:"inline-flex items-center gap-1.5 rounded-lg border border-red-200 bg-white px-4 py-2 text-sm font-medium text-red-600 hover:bg-red-50",onClick:b(i=>K(o),["stop"])},[...t[16]||(t[16]=[e("svg",{class:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6M1 7h22M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3"})],-1),y(" VymazaÅ¥ prihlášku ",-1)])],8,Ge))])])])):U("",!0)],64))),128))])])]))])}}});
5export{tt as default}; 6//# sourceMappingURL=BUDE0Vge.js.map
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.