diff --git a/app/AccountancyModule/CampModule/presenters/ParticipantPresenter.php b/app/AccountancyModule/CampModule/presenters/ParticipantPresenter.php index 32481eb997..8602dc5a52 100644 --- a/app/AccountancyModule/CampModule/presenters/ParticipantPresenter.php +++ b/app/AccountancyModule/CampModule/presenters/ParticipantPresenter.php @@ -17,6 +17,7 @@ use Model\Cashbook\ReadModel\Queries\CampParticipantListQuery; use Model\DTO\Participant\NonMemberParticipant; use Model\DTO\Participant\Participant; +use Model\DTO\Participant\ParticipatingPerson; use Model\DTO\Participant\UpdateParticipant; use Model\Event\Commands\Camp\ActivateAutocomputedParticipants; use Model\Event\SkautisCampId; @@ -100,8 +101,10 @@ public function handleActivateAutocomputedParticipants(int $aid): void $this->redirect('this'); } - public function actionExportExcel(int $aid): void + public function actionExportExcel(int $aid, string $exportType): void { + assert($exportType === ParticipatingPerson::PARTICIPANT); + try { $participantsDTO = $this->campParticipants(); $spreadsheet = $this->excelService->getCampParticipants($participantsDTO); @@ -164,8 +167,10 @@ protected function createComponentParticipantList(): ParticipantList return $control; } - public function actionExport(int $aid): void + public function actionExport(int $aid, string $exportType): void { + assert($exportType === ParticipatingPerson::PARTICIPANT); + try { $template = $this->exportService->getParticipants($aid, EventType::CAMP); $this->pdf->render($template, 'seznam-ucastniku.pdf', true); diff --git a/app/AccountancyModule/Components/Participants/ParticipantList.php b/app/AccountancyModule/Components/Participants/ParticipantList.php index 8d19add63d..f28ca13b36 100644 --- a/app/AccountancyModule/Components/Participants/ParticipantList.php +++ b/app/AccountancyModule/Components/Participants/ParticipantList.php @@ -62,6 +62,7 @@ public function __construct( protected bool $isAllowParticipantDelete, protected bool $isAllowShowUnits, protected string $title, + protected string $exportType, ) { } @@ -95,6 +96,7 @@ public function render(): void 'isAllowParticipantUpdate' => $this->isAllowParticipantUpdate, 'isAllowParticipantDelete' => $this->isAllowParticipantDelete, 'isAllowAnyAction' => $this->isAllowParticipantUpdate || $this->isAllowParticipantDelete, + 'exportType' => $this->exportType, ]); $this->template->render(); diff --git a/app/AccountancyModule/Components/Participants/templates/ParticipantList.latte b/app/AccountancyModule/Components/Participants/templates/ParticipantList.latte index fc5558de98..6c913e783e 100644 --- a/app/AccountancyModule/Components/Participants/templates/ParticipantList.latte +++ b/app/AccountancyModule/Components/Participants/templates/ParticipantList.latte @@ -71,10 +71,10 @@ $showUnits bool - zobrazovat číslo jednotky Exportovat…