feat(pdf-generator): add response deadline text to member competitions
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 55s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 55s
This commit is contained in:
@@ -562,12 +562,24 @@ class PDFGenerator {
|
||||
});
|
||||
}
|
||||
|
||||
addMemberCompetitions(tournamentTitle, memberName, recommendedRows = [], otherRows = [], venues = []) {
|
||||
addMemberCompetitions(tournamentTitle, memberName, recommendedRows = [], otherRows = [], venues = [], responseDeadlineText = '') {
|
||||
let y = this.margin;
|
||||
this.pdf.setFont('helvetica', 'bold');
|
||||
this.pdf.setFontSize(14);
|
||||
this.pdf.text(tournamentTitle || this.t('pdfGenerator.officialTournament'), this.margin, y);
|
||||
y += 9;
|
||||
if (responseDeadlineText) {
|
||||
const maxWidth = 210 - this.margin * 2 - 6;
|
||||
const lines = this.pdf.splitTextToSize(responseDeadlineText, maxWidth);
|
||||
const boxHeight = Math.max(10, lines.length * 5 + 5);
|
||||
this.pdf.setDrawColor(30, 84, 116);
|
||||
this.pdf.setFillColor(238, 246, 252);
|
||||
this.pdf.roundedRect(this.margin, y - 5, 210 - this.margin * 2, boxHeight, 1.5, 1.5, 'FD');
|
||||
this.pdf.setFont('helvetica', 'bold');
|
||||
this.pdf.setFontSize(11);
|
||||
this.pdf.text(lines, this.margin + 3, y + 1);
|
||||
y += boxHeight + 4;
|
||||
}
|
||||
this.pdf.setFont('helvetica', 'bold');
|
||||
this.pdf.setFontSize(12);
|
||||
this.pdf.text(`${this.t('pdfGenerator.member')} ${memberName}`, this.margin, y);
|
||||
|
||||
@@ -1963,7 +1963,7 @@ export default {
|
||||
const venues = (this.parsed && this.parsed.parsedData && Array.isArray(this.parsed.parsedData.austragungsorte))
|
||||
? this.parsed.parsedData.austragungsorte
|
||||
: [];
|
||||
pdf.addMemberCompetitions(title, `${m.firstName} ${m.lastName}`, recRows, otherRows, venues);
|
||||
pdf.addMemberCompetitions(title, `${m.firstName} ${m.lastName}`, recRows, otherRows, venues, this.memberResponseDeadlineText());
|
||||
}
|
||||
pdf.save('turnier_mitglieder.pdf');
|
||||
},
|
||||
@@ -1971,6 +1971,14 @@ export default {
|
||||
await this.generateMembersPdf();
|
||||
this.closeMemberDialog();
|
||||
},
|
||||
memberResponseDeadlineText() {
|
||||
if (!this.registrationDeadlineAt) return '';
|
||||
const responseDeadline = new Date(this.registrationDeadlineAt);
|
||||
responseDeadline.setDate(responseDeadline.getDate() - 1);
|
||||
const date = `${String(responseDeadline.getDate()).padStart(2, '0')}.${String(responseDeadline.getMonth() + 1).padStart(2, '0')}.${responseDeadline.getFullYear()}`;
|
||||
const time = `${String(responseDeadline.getHours()).padStart(2, '0')}:${String(responseDeadline.getMinutes()).padStart(2, '0')}`;
|
||||
return `Rückmeldung über Teilnahme bis spätestens ${date} ${time} Uhr`;
|
||||
},
|
||||
// Eligibility: Datum parsen (dd.mm.yyyy | yyyy-mm-dd | ISO)
|
||||
parseDateFlexible(s) {
|
||||
if (!s || typeof s !== 'string') return null;
|
||||
|
||||
Reference in New Issue
Block a user