From 312aa4cb05bbedb3aa9540feb5e6d8cfe1abc0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20D=C4=9Bdi=C4=8D?= Date: Fri, 29 Sep 2023 18:01:25 +0200 Subject: [PATCH] Split participant export between participants and instructors --- .../CampModule/presenters/ParticipantPresenter.php | 9 +++++++-- .../Components/Participants/ParticipantList.php | 2 ++ .../Participants/templates/ParticipantList.latte | 4 ++-- .../EducationModule/presenters/ParticipantPresenter.php | 8 +++++--- .../EventModule/presenters/ParticipantPresenter.php | 9 +++++++-- .../Factories/Participants/IParticipantListFactory.php | 1 + app/model/DTO/Participant/ParticipatingPerson.php | 3 +++ app/model/Export/ExportService.php | 8 ++++++-- app/model/Export/templates/participantEducation.latte | 4 ++-- 9 files changed, 35 insertions(+), 13 deletions(-) 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…