Skip to content

Commit

Permalink
added printed handbook check
Browse files Browse the repository at this point in the history
  • Loading branch information
paaton committed Nov 28, 2023
1 parent 6386ce7 commit f376986
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 19 deletions.
1 change: 1 addition & 0 deletions sql/init-postgresql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions sql/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddPrintedHandbookSwitch extends AbstractMigration
{
public function up(): void
{
$tableUser = $this->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();
}
}
3 changes: 2 additions & 1 deletion src/Event/AbstractContentArbiter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
2 changes: 2 additions & 0 deletions src/Event/EventType/Obrok/EventTypeObrok.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function getContentArbiterTroopLeader(): ContentArbiterTroopLeader
$ca->unit = true;
$ca->medicaments = true;
$ca->psychicalHealth = true;
$ca->printedHandbook = true;

return $ca;
}
Expand All @@ -53,6 +54,7 @@ public function getContentArbiterTroopParticipant(): ContentArbiterTroopParticip
$ca->unit = true;
$ca->medicaments = true;
$ca->psychicalHealth = true;
$ca->printedHandbook = true;

return $ca;
}
Expand Down
36 changes: 19 additions & 17 deletions src/Export/ExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function healthDataToCSV(Event $event, User $adminUser): array
'health informations',
'medicaments',
'psychical health',
'swimming',
'swimming', // 10
'note',
];

Expand All @@ -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 ?? '',
];
}
Expand Down Expand Up @@ -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',
];

Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/Participant/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/Participant/ParticipantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/Templates/cs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions src/Templates/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 13 additions & 1 deletion src/Templates/translatable/widgets/changeDetails.twig
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,19 @@
</option>
</select>
</div>
{% endif %}{% if ca.notes %}
{% endif %}{% if ca.printedhandbook %}
<div class="form-group">
<label for="printedHandbook">{% trans %}detail.printedHandbook-detail{% endtrans %}:</label>
<input
id="printedHandbook"
class="form-control form-wide"
type="checkbox"
name="printedHandbook"
value="yes"
{% if personDetails.getPrintedHandbook == 'yes' %} checked{% endif %}
/>
</div>
{% endif %}{% if ca.notes %}
<div class="form-group">
<label for="notes">{% trans %}detail.notice{% endtrans %}:</label>
<textarea
Expand Down
2 changes: 2 additions & 0 deletions src/Templates/translatable/widgets/details.twig
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
{% else %}
{{ detail.uploadFileMissing|trans }}
{% endif %}<br/>
{% endif %}{% if ca.printedHandbook %}
{% trans %}detail.printedHandbook{% endtrans %}:<b>{{ person.getPrintedHandbook ?? 'no' }}</b><br/>
{% endif %}{% if ca.notes %}
{% trans %}detail.notice{% endtrans %}: <b>{{ person.getNotes }}</b><br/>
{% endif %}

0 comments on commit f376986

Please sign in to comment.