Compare commits
No commits in common. "abc792d5b7c213e9b5ebfaba91ac90d5a8fbb4e8" and "b5779c3ecf0da563b5a10fc96ecde344ae2786af" have entirely different histories.
abc792d5b7
...
b5779c3ecf
|
|
@ -31,11 +31,7 @@ class CreateExcelDocumentAction
|
||||||
private function allSheet(Collection $participants): TableDocumentData
|
private function allSheet(Collection $participants): TableDocumentData
|
||||||
{
|
{
|
||||||
$document = TableDocumentData::from(['title' => 'Anmeldungen für ' . $this->form->name, 'sheets' => []]);
|
$document = TableDocumentData::from(['title' => 'Anmeldungen für ' . $this->form->name, 'sheets' => []]);
|
||||||
$headers = [
|
$headers = $this->form->getFields()->map(fn ($field) => $field->name)->push('Abgemeldet am')->prepend('ID')->toArray();
|
||||||
'ID',
|
|
||||||
...$this->form->getFields()->names(),
|
|
||||||
'Abgemeldet am',
|
|
||||||
];
|
|
||||||
[$activeParticipants, $cancelledParticipants] = $participants->partition(fn ($participant) => $participant->cancelled_at === null);
|
[$activeParticipants, $cancelledParticipants] = $participants->partition(fn ($participant) => $participant->cancelled_at === null);
|
||||||
|
|
||||||
$document->addSheet(SheetData::from([
|
$document->addSheet(SheetData::from([
|
||||||
|
|
@ -72,11 +68,10 @@ class CreateExcelDocumentAction
|
||||||
|
|
||||||
/** @return array<string, mixed> */
|
/** @return array<string, mixed> */
|
||||||
public function rowFor(Participant $participant): array {
|
public function rowFor(Participant $participant): array {
|
||||||
return [
|
return $this->form->getFields()->map(fn ($field) => $participant->getFields()->find($field)->presentRaw())
|
||||||
'ID' => $participant->id,
|
->put('Abgemeldet am', $participant->cancelled_at?->format('d.m.Y H:i:s') ?: '')
|
||||||
...$this->form->getFields()->map(fn ($field) => $participant->getFields()->find($field)->presentRaw()),
|
->prepend('ID', $participant->id)
|
||||||
'Abgemeldet am' => $participant->cancelled_at?->format('d.m.Y H:i:s') ?: '',
|
->toArray();
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function tempPath(): string
|
private function tempPath(): string
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace Illuminate\Testing;
|
||||||
|
|
||||||
namespace Spatie\LaravelSettings;
|
namespace Spatie\LaravelSettings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue