Add ID to participant excel document

This commit is contained in:
philipp lang 2025-11-11 01:24:11 +01:00
parent 1e4361c709
commit 4abdac75f6
1 changed files with 2 additions and 1 deletions

View File

@ -31,7 +31,7 @@ class CreateExcelDocumentAction
private function allSheet(Collection $participants): TableDocumentData
{
$document = TableDocumentData::from(['title' => 'Anmeldungen für ' . $this->form->name, 'sheets' => []]);
$headers = $this->form->getFields()->map(fn ($field) => $field->name)->push('Abgemeldet am')->toArray();
$headers = $this->form->getFields()->map(fn ($field) => $field->name)->push('Abgemeldet am')->prepend('ID')->toArray();
[$activeParticipants, $cancelledParticipants] = $participants->partition(fn ($participant) => $participant->cancelled_at === null);
$document->addSheet(SheetData::from([
@ -70,6 +70,7 @@ class CreateExcelDocumentAction
public function rowFor(Participant $participant): array {
return $this->form->getFields()->map(fn ($field) => $participant->getFields()->find($field)->presentRaw())
->put('Abgemeldet am', $participant->cancelled_at?->format('d.m.Y H:i:s') ?: '')
->prepend('ID', $participant->id)
->toArray();
}