diff --git a/frontend/src/components/PDFGenerator.js b/frontend/src/components/PDFGenerator.js index 1793bf4..999ae3a 100644 --- a/frontend/src/components/PDFGenerator.js +++ b/frontend/src/components/PDFGenerator.js @@ -241,7 +241,7 @@ class PDFGenerator { } } - addTable(tableId, highlightName = '') { + addTable(tableId, highlightName = '', excludeColumns = []) { this.pdf.setFontSize(11); autoTable(this.pdf, { html: `#${tableId}`, @@ -251,6 +251,12 @@ class PDFGenerator { headStyles: { fillColor: [220, 220, 220], textColor: 0, halign: 'left' }, theme: 'grid', didParseCell: (data) => { + // Spalten ausschließen + if (excludeColumns.includes(data.column.index)) { + data.cell.styles.display = 'none'; + return; + } + const cellText = Array.isArray(data.cell.text) ? data.cell.text.join(' ') : String(data.cell.text); @@ -260,6 +266,12 @@ class PDFGenerator { }, didDrawPage: (data) => { this.cursorY = data.cursor.y + 10; + }, + // Spalten aus dem Header entfernen + willDrawCell: (data) => { + if (excludeColumns.includes(data.column.index)) { + return false; + } } }); } diff --git a/frontend/src/views/ScheduleView.vue b/frontend/src/views/ScheduleView.vue index 3d0196f..d428b8b 100644 --- a/frontend/src/views/ScheduleView.vue +++ b/frontend/src/views/ScheduleView.vue @@ -630,7 +630,20 @@ export default { if (element) { const pdfGen = new PDFGenerator(); pdfGen.addTitle(`Spiele für ${highlightName} in ${this.selectedLeague}`); - pdfGen.addTable('schedule-table', highlightName); + + // Bestimme die auszuschließenden Spalten + // Spaltenstruktur: Datum, Uhrzeit, Heimmannschaft, Gastmannschaft, Ergebnis, [Altersklasse], Code, Heim-PIN, Gast-PIN + const hasAgeClass = this.selectedLeague === 'Gesamtspielplan' || this.selectedLeague === 'Spielplan Erwachsene'; + let excludeColumns; + if (hasAgeClass) { + // Mit Altersklasse: Ergebnis=4, Code=6, Heim-PIN=7, Gast-PIN=8 + excludeColumns = [4, 6, 7, 8]; + } else { + // Ohne Altersklasse: Ergebnis=4, Code=5, Heim-PIN=6, Gast-PIN=7 + excludeColumns = [4, 5, 6, 7]; + } + + pdfGen.addTable('schedule-table', highlightName, excludeColumns); pdfGen.addNewPage(); const uniqueLocations = this.getUniqueLocations(); uniqueLocations.forEach((addressLines, clubName) => {