8 lines
5.7 KiB
JavaScript
8 lines
5.7 KiB
JavaScript
import{u as I}from"./C_U-NUAd.js";import{F as b}from"./BteKZQ9T.js";import{e as $,r as _,g as w,h as E,c as a,a as l,t as c,F as k,i as S,b as x,u as g,j as M,o as r,d as L}from"#entry";import{E as z}from"./Cx4UcKGu.js";/**
|
||
* @license lucide-vue-next v0.344.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const A=$("DownloadIcon",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]),N={class:"min-h-full py-16 bg-gray-50"},V={class:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"},G={class:"text-center mb-12"},H={class:"text-xl text-gray-600 max-w-3xl mx-auto"},T={key:0,class:"space-y-4 max-w-4xl mx-auto"},B={class:"flex items-center justify-between"},P={class:"flex items-center space-x-4"},X={class:"w-12 h-12 bg-primary-100 rounded-lg flex items-center justify-center"},C={class:"text-lg font-semibold text-gray-900"},K={class:"text-sm text-gray-500"},O=["href"],q={key:1,class:"text-center py-16 bg-white rounded-xl shadow-lg max-w-4xl mx-auto"},Q={class:"text-gray-600"},Y={class:"mt-12 max-w-4xl mx-auto"},J={key:0,class:"space-y-3"},R={class:"flex items-center justify-between"},U={class:"font-semibold text-gray-900"},W={class:"text-sm text-gray-500"},Z=["href"],oe={__name:"spielplaene",setup(ee){const u=_([]),p=_([]),d=w(()=>{const n=new Date,t=n.getMonth()+1,s=n.getFullYear();return t>=7?{start:s,ende:s+1}:{start:s-1,ende:s}}),m=w(()=>`${d.value.start}/${d.value.ende}`),D=n=>{console.log("extractSaison für:",n);let t=n.match(/(\d{4})[^0-9](\d{4})/);if(t){const s=parseInt(t[1]),e=parseInt(t[2]);return console.log(" Gefunden (4-stellig):",s,e),{start:s,ende:e,label:`${s}/${e}`}}if(t=n.match(/(\d{2})[^0-9](\d{2})/),t){let s=parseInt(t[1]),e=parseInt(t[2]);return s<100&&(s=2e3+s,e=2e3+e),console.log(" Gefunden (2-stellig):",s,e),{start:s,ende:e,label:`${s}/${e}`}}return console.log(" Keine Saison gefunden"),null},v=n=>n?n.start===d.value.start&&n.ende===d.value.ende:!1,F=async()=>{try{console.log("=== SPIELPLÄNE LADEN ==="),console.log("Aktuelle Saison:",d.value),console.log("Saison Label:",m.value);const n=await fetch("/api/spielplaene");if(!n.ok){console.error("Fehler beim Laden der Spielpläne:",n.status);return}const t=await n.json();console.log("Geladene Dateien:",t);const s=t.map(e=>{console.log("Verarbeite Datei:",e);const o=D(e);if(console.log(" Extrahierte Saison:",o),console.log(" Ist aktuelle Saison?",o?v(o):!1),!o||!v(o))return null;const i=e.replace(/\.(pdf|PDF|xlsx|XLSX|xls|XLS)$/,"").replace(/[-_]/g," ").replace(/\d{2,4}[-_\/⁄]\d{2,4}/,"").trim();return{filename:e,titel:i||e,saison:o.label,url:`/spielplaene/${e}`}}).filter(e=>e!==null);u.value=s,console.log("Aktuelle Saison:",m.value),console.log("Gefundene Spielpläne:",u.value)}catch(n){console.error("Fehler beim Laden der Spielpläne:",n)}},j=async()=>{try{const n=await fetch("/data/mannschaften.csv");if(!n.ok)return;const s=(await n.text()).split(`
|
||
`).filter(e=>e.trim()!=="");if(s.length<2)return;p.value=s.slice(1).map(e=>{const o=[];let i="",h=!1;for(let f=0;f<e.length;f++){const y=e[f];y==='"'?h=!h:y===","&&!h?(o.push(i.trim()),i=""):i+=y}return o.push(i.trim()),o.length<10?null:{mannschaft:o[0].trim(),liga:o[1].trim(),weitere_informationen_link:o[8].trim()}}).filter(e=>e!==null&&e.weitere_informationen_link!==""),console.log("Mannschaften mit Links:",p.value)}catch(n){console.error("Fehler beim Laden der Mannschaften:",n)}};return E(()=>{F(),j()}),I({title:"Spielpläne - Harheimer TC"}),(n,t)=>(r(),a("div",N,[l("div",V,[l("div",G,[t[0]||(t[0]=l("h1",{class:"text-4xl sm:text-5xl font-display font-bold text-gray-900 mb-4"}," Spielpläne ",-1)),t[1]||(t[1]=l("div",{class:"w-24 h-1 bg-primary-600 mx-auto mb-6"},null,-1)),l("p",H," Aktuelle Spielpläne der Saison "+c(m.value),1)]),u.value.length>0?(r(),a("div",T,[(r(!0),a(k,null,S(u.value,(s,e)=>(r(),a("div",{key:e,class:"bg-white rounded-xl shadow-lg border border-gray-100 p-6 hover:shadow-xl transition-shadow"},[l("div",B,[l("div",P,[l("div",X,[x(g(b),{size:24,class:"text-primary-600"})]),l("div",null,[l("h3",C,c(s.titel),1),l("p",K,"Saison "+c(s.saison),1)])]),l("a",{href:s.url,download:"",class:"inline-flex items-center px-4 py-2 bg-primary-600 hover:bg-primary-700 text-white font-medium rounded-lg transition-colors"},[x(g(A),{size:18,class:"mr-2"}),t[2]||(t[2]=L(" Download ",-1))],8,O)])]))),128))])):(r(),a("div",q,[x(g(b),{size:48,class:"text-gray-400 mx-auto mb-4"}),t[3]||(t[3]=l("h3",{class:"text-xl font-semibold text-gray-900 mb-2"},"Keine Spielpläne verfügbar",-1)),l("p",Q," Für die aktuelle Saison "+c(m.value)+" sind noch keine Spielpläne verfügbar. ",1)])),l("div",Y,[t[5]||(t[5]=l("h2",{class:"text-2xl font-display font-bold text-gray-900 mb-6 text-center"}," Online Spielpläne & Tabellen ",-1)),p.value.length>0?(r(),a("div",J,[(r(!0),a(k,null,S(p.value,(s,e)=>(r(),a("div",{key:e,class:"bg-white rounded-lg shadow border border-gray-100 p-4 hover:shadow-md transition-shadow"},[l("div",R,[l("div",null,[l("h3",U,c(s.mannschaft),1),l("p",W,c(s.liga),1)]),l("a",{href:s.weitere_informationen_link,target:"_blank",class:"inline-flex items-center px-4 py-2 bg-gray-100 hover:bg-gray-200 text-gray-700 rounded-lg transition-colors text-sm"},[x(g(z),{size:16,class:"mr-2"}),t[4]||(t[4]=L(" Online ansehen ",-1))],8,Z)])]))),128))])):M("",!0)]),t[6]||(t[6]=l("div",{class:"mt-12 max-w-4xl mx-auto bg-primary-50 border border-primary-100 rounded-xl p-6"},[l("h3",{class:"text-lg font-semibold text-primary-900 mb-2"}," Hinweis "),l("p",{class:"text-primary-800"}," Die Spielpläne werden automatisch für die aktuelle Saison angezeigt. Ältere Spielpläne können auf Anfrage bereitgestellt werden. ")],-1))])]))}};export{oe as default};
|