From f3769866eb950c817b3d254c9b081b3726f527dc Mon Sep 17 00:00:00 2001 From: paaton Date: Tue, 28 Nov 2023 13:44:40 +0100 Subject: [PATCH] added printed handbook check --- sql/init-postgresql.sql | 1 + sql/init.sql | 1 + ...1127201235_add_printed_handbook_switch.php | 22 ++++++++++++ src/Event/AbstractContentArbiter.php | 3 +- src/Event/EventType/Obrok/EventTypeObrok.php | 2 ++ src/Export/ExportService.php | 36 ++++++++++--------- src/Participant/Participant.php | 1 + src/Participant/ParticipantService.php | 1 + src/Templates/cs.yaml | 2 ++ src/Templates/en.yaml | 2 ++ .../translatable/widgets/changeDetails.twig | 14 +++++++- .../translatable/widgets/details.twig | 2 ++ 12 files changed, 68 insertions(+), 19 deletions(-) create mode 100644 src/Application/migrations/20231127201235_add_printed_handbook_switch.php diff --git a/sql/init-postgresql.sql b/sql/init-postgresql.sql index 657d0855..89b5c377 100755 --- a/sql/init-postgresql.sql +++ b/sql/init-postgresql.sql @@ -106,6 +106,7 @@ create table "participant" patrol_leader_id int, patrol_name TEXT, drivers_license TEXT, + printed_handbook TEXT, languages TEXT, skills TEXT, preferred_position TEXT, diff --git a/sql/init.sql b/sql/init.sql index 6a20afcb..5bef3a30 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -110,6 +110,7 @@ create table participant patrol_leader_id int, patrol_name TEXT, drivers_license TEXT, + printed_handbook TEXT, languages TEXT, skills TEXT, preferred_position TEXT, diff --git a/src/Application/migrations/20231127201235_add_printed_handbook_switch.php b/src/Application/migrations/20231127201235_add_printed_handbook_switch.php new file mode 100644 index 00000000..d347552e --- /dev/null +++ b/src/Application/migrations/20231127201235_add_printed_handbook_switch.php @@ -0,0 +1,22 @@ +table('participant'); + $tableUser->addColumn('printed_handbook', 'string', ['null' => true]); + $tableUser->save(); + } + + public function down(): void + { + $tableUser = $this->table('participant'); + $tableUser->removeColumn('printed_handbook'); + $tableUser->save(); + } +} diff --git a/src/Event/AbstractContentArbiter.php b/src/Event/AbstractContentArbiter.php index 9f04408a..ae1f553e 100755 --- a/src/Event/AbstractContentArbiter.php +++ b/src/Event/AbstractContentArbiter.php @@ -20,7 +20,7 @@ abstract class AbstractContentArbiter public bool $birthPlace = false; public bool $health = true; public bool $medicaments = false; - public bool $psychicalHealth = false; + public bool $psychicalHealth = true; public bool $food = false; public bool $idNumber = false; public bool $scarf = false; @@ -32,5 +32,6 @@ abstract class AbstractContentArbiter public bool $skills = false; public bool $preferredPosition = false; public bool $driver = false; + public bool $printedHandbook = false; public bool $notes = true; } diff --git a/src/Event/EventType/Obrok/EventTypeObrok.php b/src/Event/EventType/Obrok/EventTypeObrok.php index 6efa79f3..0af59f7c 100644 --- a/src/Event/EventType/Obrok/EventTypeObrok.php +++ b/src/Event/EventType/Obrok/EventTypeObrok.php @@ -40,6 +40,7 @@ public function getContentArbiterTroopLeader(): ContentArbiterTroopLeader $ca->unit = true; $ca->medicaments = true; $ca->psychicalHealth = true; + $ca->printedHandbook = true; return $ca; } @@ -53,6 +54,7 @@ public function getContentArbiterTroopParticipant(): ContentArbiterTroopParticip $ca->unit = true; $ca->medicaments = true; $ca->psychicalHealth = true; + $ca->printedHandbook = true; return $ca; } diff --git a/src/Export/ExportService.php b/src/Export/ExportService.php index 4df6bd8d..a0bd054b 100755 --- a/src/Export/ExportService.php +++ b/src/Export/ExportService.php @@ -57,7 +57,7 @@ public function healthDataToCSV(Event $event, User $adminUser): array 'health informations', 'medicaments', 'psychical health', - 'swimming', + 'swimming', // 10 'note', ]; @@ -73,7 +73,7 @@ public function healthDataToCSV(Event $event, User $adminUser): array $participant->healthProblems ?? '', $participant->medicaments ?? '', $participant->psychicalHealthProblems ?? '', - $participant->swimming ?? '', + $participant->swimming ?? '', // 10 $participant->notes ?? '', ]; } @@ -181,26 +181,27 @@ public function allRegistrationDataToCSV(Event $event, User $adminUser): array 'birthPlace', 'healthProblems', 'medicaments', - 'psychicalHealthProblems', + 'psychicalHealthProblems', // 20 'foodPreferences', - 'foodPreferencesRaw', // 20 + 'foodPreferencesRaw', 'idNumber', 'scarf', - 'swimming', + 'swimming', // 25 'tshirt', - 'arrivalDate', // 25 + 'arrivalDate', 'departureDate', 'uploadedOriginalFilename', + 'printedHandbook', // 30 'notes', 'updatedAt', - 'registrationCloseDate', // 30 + 'registrationCloseDate', 'registrationApproveDate', - 'registrationPayDate', + 'registrationPayDate', // 35 'patrolLeaderId_patrolParticipantId', 'patrolName', - 'patrolParticipantCount', // 35 + 'patrolParticipantCount', 'istSkills', - 'istPreferredPosition', + 'istPreferredPosition', // 40 'driverLicense', ]; @@ -261,21 +262,22 @@ public function allRegistrationDataToCSV(Event $event, User $adminUser): array $participant->birthPlace ?? '', $participant->healthProblems ?? '', $participant->medicaments ?? '', - $participant->psychicalHealthProblems ?? '', + $participant->psychicalHealthProblems ?? '', // 20 $this->translator->trans($participant->foodPreferences ?? ''), - $participant->foodPreferences ?? '', // 20 + $participant->foodPreferences ?? '', $participant->idNumber ?? '', $participant->scarf ?? '', - $this->translator->trans($participant->swimming ?? ''), + $this->translator->trans($participant->swimming ?? ''), //25 $this->translator->trans($participant->getTshirtSize() ?? '') . ' - ' . $this->translator->trans($participant->getTshirtShape() ?? ''), - $participant->arrivalDate ? $participant->arrivalDate->format('d. m. Y') : '', // 25 + $participant->arrivalDate ? $participant->arrivalDate->format('d. m. Y') : '', $participant->departureDate ? $participant->departureDate->format('d. m. Y') : '', - $participant->uploadedOriginalFilename ?? '', + $participant->uploadedOriginalFilename ?? '', // 30 + $participant->printedHandbook ?? '', $participant->notes ?? '', $participant->updatedAt ? $participant->updatedAt->format('d. m. Y H:i:s') : '', - $participant->registrationCloseDate ? $participant->registrationCloseDate->format('d. m. Y H:i:s') : '', // 30 - $participant->registrationApproveDate ? $participant->registrationApproveDate->format('d. m. Y H:i:s') : '', + $participant->registrationCloseDate ? $participant->registrationCloseDate->format('d. m. Y H:i:s') : '', + $participant->registrationApproveDate ? $participant->registrationApproveDate->format('d. m. Y H:i:s') : '', // 35 $participant->registrationPayDate ? $participant->registrationPayDate->format('d. m. Y H:i:s') : '', ], $pPart, diff --git a/src/Participant/Participant.php b/src/Participant/Participant.php index 5c6db87c..28064f29 100755 --- a/src/Participant/Participant.php +++ b/src/Participant/Participant.php @@ -50,6 +50,7 @@ * @property string|null $skills * @property array|null $preferredPosition m:useMethods(getPreferredPosition|setPreferredPosition) * @property string|null $driversLicense + * @property string|null $printedHandbook * @property string|null $notes * @property DateTimeInterface|null $registrationCloseDate m:passThru(dateFromString|dateToString) * @property DateTimeInterface|null $registrationApproveDate m:passThru(dateFromString|dateToString) diff --git a/src/Participant/ParticipantService.php b/src/Participant/ParticipantService.php index 7cec894a..99960715 100755 --- a/src/Participant/ParticipantService.php +++ b/src/Participant/ParticipantService.php @@ -91,6 +91,7 @@ private function addParamsIntoPerson(array $params, Participant $p): Participant $preferredPosition = $params['preferredPosition'] ?? []; $p->preferredPosition = $preferredPosition; $p->driversLicense = $params['driversLicense'] ?? null; + $p->printedHandbook = $params['printedHandbook'] ?? null; $p->notes = $params['notes'] ?? null; return $p; diff --git a/src/Templates/cs.yaml b/src/Templates/cs.yaml index 062650d5..11a4c915 100755 --- a/src/Templates/cs.yaml +++ b/src/Templates/cs.yaml @@ -133,6 +133,8 @@ detail: uploadedFileSuccessful: "soubor úspěšně nahraný!" uploadedFileNote: "PDF s potvrzením najdeš na našem webu" uploadFileMissing: "soubor zatím není nahraný :(" + printedHandbook: "Tištěný handbook" + printedHandbook-detail: "Chci na akci dostat vytištěný handbook" notice: "Poznámky" notice-placeholder: "cokoli dalšího?" skills: "Dovednosti" diff --git a/src/Templates/en.yaml b/src/Templates/en.yaml index ed8029db..7c647a1a 100755 --- a/src/Templates/en.yaml +++ b/src/Templates/en.yaml @@ -133,6 +133,8 @@ detail: uploadedFileSuccessful: "file successfully uploaded!" uploadedFileNote: "PDF with consent can be found at our website" uploadFileMissing: "file not uploaded yet :(" + printedHandbook: "Paper Handbook" + printedHandbook-detail: "I want to obtain paper printed event handbook" notice: "Notice" notice-placeholder: "anything else?" skills: "Skills" diff --git a/src/Templates/translatable/widgets/changeDetails.twig b/src/Templates/translatable/widgets/changeDetails.twig index 6c8d55af..ad500682 100644 --- a/src/Templates/translatable/widgets/changeDetails.twig +++ b/src/Templates/translatable/widgets/changeDetails.twig @@ -454,7 +454,19 @@ -{% endif %}{% if ca.notes %} +{% endif %}{% if ca.printedhandbook %} +
+ + +
+ {% endif %}{% if ca.notes %}