Feuilles de poste : ajouter le référent en en-tête
Nom + téléphone du référent du poste (Position.lead_account_id), juste sous le sous-titre (jour/lieu) — « Référent : à désigner » si aucun. Même source que le référent affiché à l'écran bénévole (volunteers.py:get_volunteer_planning). Vérifié : pytest (287 passés, dont les nouveaux tests avec/sans référent), ruff, alembic check — tous verts (pas de changement frontend, la feuille reste un simple téléchargement de PDF). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
2a2a0c23ca
commit
f1d88302a4
@@ -64,6 +64,10 @@ class PositionDaySheet:
|
||||
position_location: str | None
|
||||
date: dt.date
|
||||
shifts: tuple[SheetShift, ...]
|
||||
# None si le poste n'a pas (encore) de référent désigné
|
||||
# (`Position.lead_account_id`).
|
||||
referent_name: str | None = None
|
||||
referent_phone: str | None = None
|
||||
|
||||
|
||||
def _styles() -> dict[str, ParagraphStyle]:
|
||||
@@ -74,7 +78,11 @@ def _styles() -> dict[str, ParagraphStyle]:
|
||||
),
|
||||
"subtitle": ParagraphStyle(
|
||||
"SheetSubtitle", parent=base["Normal"],
|
||||
fontSize=12, textColor=colors.grey, spaceAfter=16,
|
||||
fontSize=12, textColor=colors.grey, spaceAfter=4,
|
||||
),
|
||||
"referent": ParagraphStyle(
|
||||
"SheetReferent", parent=base["Normal"],
|
||||
fontSize=11.5, fontName="Helvetica-Bold", spaceAfter=16,
|
||||
),
|
||||
"shiftHeader": ParagraphStyle(
|
||||
"ShiftHeader", parent=base["Heading3"], fontSize=13, spaceBefore=12, spaceAfter=4
|
||||
@@ -125,6 +133,14 @@ def generate_position_sheets_pdf(sheets: list[PositionDaySheet]) -> bytes:
|
||||
subtitle += f" — {sheet.position_location}"
|
||||
story.append(Paragraph(subtitle, styles["subtitle"]))
|
||||
|
||||
if sheet.referent_name:
|
||||
referent_line = f"Référent : {sheet.referent_name}"
|
||||
if sheet.referent_phone:
|
||||
referent_line += f" — {sheet.referent_phone}"
|
||||
story.append(Paragraph(referent_line, styles["referent"]))
|
||||
else:
|
||||
story.append(Paragraph("Référent : à désigner", styles["referent"]))
|
||||
|
||||
if not sheet.shifts:
|
||||
story.append(Paragraph("Aucun créneau ce jour-là.", styles["normal"]))
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user