diff --git a/frontend/src/components/PDFGenerator.js b/frontend/src/components/PDFGenerator.js index 725657e..195eeec 100644 --- a/frontend/src/components/PDFGenerator.js +++ b/frontend/src/components/PDFGenerator.js @@ -264,30 +264,116 @@ class PDFGenerator { }); } - addMemberCompetitions(tournamentTitle, memberName, rows) { + addMemberCompetitions(tournamentTitle, memberName, recommendedRows = [], otherRows = []) { let y = this.margin; this.pdf.setFont('helvetica', 'bold'); this.pdf.setFontSize(14); this.pdf.text(tournamentTitle || 'Offizielles Turnier', this.margin, y); y += 9; - this.pdf.setFont('helvetica', 'normal'); + this.pdf.setFont('helvetica', 'bold'); this.pdf.setFontSize(12); this.pdf.text(`Mitglied: ${memberName}`, this.margin, y); y += 8; - this.pdf.setFont('helvetica', 'bold'); - this.pdf.text('Wettbewerb', this.margin, y); - this.pdf.text('Datum', this.margin + 110, y); - this.pdf.text('Startzeit', this.margin + 150, y); - y += 7; - this.pdf.setFont('helvetica', 'normal'); - for (const r of rows) { - this.pdf.text(r.name || '', this.margin, y); - this.pdf.text(r.date || '–', this.margin + 110, y); - this.pdf.text(r.time || '–', this.margin + 150, y); + // Empfehlungen (fett) + if (recommendedRows && recommendedRows.length) { + this.pdf.setFont('helvetica', 'bold'); + this.pdf.setFontSize(13); + this.pdf.text('Empfehlungen', this.margin, y); y += 7; + this.pdf.setFont('helvetica', 'bold'); + this.pdf.setFontSize(12); + this.pdf.text('Wettbewerb', this.margin, y); + this.pdf.text('Datum', this.margin + 110, y); + this.pdf.text('Startzeit', this.margin + 150, y); + y += 7; + for (const r of recommendedRows) { + this.pdf.text(r.name || '', this.margin, y); + this.pdf.text(r.date || '–', this.margin + 110, y); + this.pdf.text(r.time || '–', this.margin + 150, y); + y += 7; + if (y > this.pageHeight) { + this.addNewPage(); + y = this.margin; + } + } + } + + // Weitere spielbare Wettbewerbe (normal) + if (otherRows && otherRows.length) { + y += 5; + if (y > this.pageHeight) { this.addNewPage(); y = this.margin; } + this.pdf.setFont('helvetica', 'bold'); + this.pdf.setFontSize(13); + this.pdf.text('Ebenfalls spielbar', this.margin, y); + y += 7; + this.pdf.setFont('helvetica', 'normal'); + this.pdf.setFontSize(12); + for (const r of otherRows) { + this.pdf.text(r.name || '', this.margin, y); + this.pdf.text(r.date || '–', this.margin + 110, y); + this.pdf.text(r.time || '–', this.margin + 150, y); + y += 7; + if (y > this.pageHeight) { + this.addNewPage(); + y = this.margin; + } + } + } + // Hinweise-Sektion + const remainingForHints = 60; // Platz für Überschrift + Liste abschätzen + if (y + remainingForHints > this.pageHeight) { + this.addNewPage(); + y = this.margin; + } else { + y += 6; + } + this.pdf.setFont('helvetica', 'bold'); + this.pdf.setFontSize(13); + this.pdf.text('Hinweise:', this.margin, y); + y += 7; + this.pdf.setFont('helvetica', 'bold'); + this.pdf.setFontSize(12); + const maxWidth = 210 - this.margin * 2; + const bullets = [ + 'Eine Stunde vor Beginn der Konkurrenz in der Halle sein', + 'Kein weißes Trikot', + 'Sportshorts (oder Sportröckchen), am besten auch nicht weiß', + 'Hallenschuhe (dürfen auf Boden nicht abfärben)', + 'Eine Flasche Wasser dabei haben', + 'Da der Verein die Meldung übernehmen möchte, die Trainer mind. eine Woche vor dem Turnier über die Teilnahme informieren', + ]; + for (const b of bullets) { + const lines = this.pdf.splitTextToSize(`- ${b}`, maxWidth); + for (const line of lines) { + this.pdf.text(line, this.margin, y); + y += 6; + if (y > this.pageHeight) { + this.addNewPage(); + y = this.margin; + this.pdf.setFont('helvetica', 'bold'); + this.pdf.setFontSize(12); + } + } + } + // Leerzeile vor dem Abschlusssatz + if (y + 6 > this.pageHeight) { + this.addNewPage(); + y = this.margin; + } else { + y += 6; + } + const finalLine = 'Die Trainer probieren bei allen Turnieren anwesend zu sein.'; + this.pdf.setFont('helvetica', 'bold'); + this.pdf.setFontSize(12); + const finalLines = this.pdf.splitTextToSize(finalLine, maxWidth); + for (const line of finalLines) { + this.pdf.text(line, this.margin, y); + y += 6; if (y > this.pageHeight) { this.addNewPage(); y = this.margin; + this.pdf.setFont('helvetica', 'bold'); + this.pdf.setFontSize(12); } } this.cursorY = y + 10; diff --git a/frontend/src/views/OfficialTournaments.vue b/frontend/src/views/OfficialTournaments.vue index ea2bd42..4969dec 100644 --- a/frontend/src/views/OfficialTournaments.vue +++ b/frontend/src/views/OfficialTournaments.vue @@ -42,12 +42,12 @@ -