Skip to content

Commit

Permalink
added medicaments and mental issues in participant attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
paaton committed Nov 27, 2023
1 parent ec63ea2 commit c5bf563
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 3 deletions.
2 changes: 2 additions & 0 deletions sql/init-postgresql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ create table "participant"
email TEXT,
legal_representative TEXT,
health_problems TEXT,
medicaments TEXT,
psychical_health_problems TEXT,
food_preferences TEXT,
scout_unit TEXT,
tshirt TEXT,
Expand Down
2 changes: 2 additions & 0 deletions sql/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ create table participant
email TEXT,
legal_representative TEXT,
health_problems TEXT,
medicaments TEXT,
psychical_health_problems TEXT,
food_preferences TEXT,
scout_unit TEXT,
tshirt TEXT,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddPsychicalHealthAndMedications extends AbstractMigration
{
public function up(): void
{
$tableUser = $this->table('participant');
$tableUser->addColumn('medications', 'string', ['null' => true]);
$tableUser->addColumn('psychical_health_problems', 'string', ['null' => true]);
$tableUser->save();
}

public function down(): void
{
$tableUser = $this->table('participant');
$tableUser->removeColumn('medications');
$tableUser->removeColumn('psychical_health_problems');
$tableUser->save();
}
}
2 changes: 2 additions & 0 deletions src/Event/AbstractContentArbiter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ abstract class AbstractContentArbiter
public bool $birthDate = true;
public bool $birthPlace = false;
public bool $health = true;
public bool $medicaments = false;
public bool $psychicalHealth = false;
public bool $food = false;
public bool $idNumber = false;
public bool $scarf = false;
Expand Down
4 changes: 4 additions & 0 deletions src/Event/EventType/Obrok/EventTypeObrok.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public function getContentArbiterTroopLeader(): ContentArbiterTroopLeader
$ca->phone = true;
$ca->email = true;
$ca->unit = true;
$ca->medicaments = true;
$ca->psychicalHealth = true;

return $ca;
}
Expand All @@ -49,6 +51,8 @@ public function getContentArbiterTroopParticipant(): ContentArbiterTroopParticip
$ca->phone = true;
$ca->email = true;
$ca->unit = true;
$ca->medicaments = true;
$ca->psychicalHealth = true;

return $ca;
}
Expand Down
8 changes: 8 additions & 0 deletions src/Export/ExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public function healthDataToCSV(Event $event, User $adminUser): array
'surname', // 5
'gender',
'health informations',
'medicaments',
'psychical health',
'swimming',
'note',
];
Expand All @@ -69,6 +71,8 @@ public function healthDataToCSV(Event $event, User $adminUser): array
$participant->lastName ?? '', // 5
$participant->gender ?? '',
$participant->healthProblems ?? '',
$participant->medicaments ?? '',
$participant->psychicalHealthProblems ?? '',
$participant->swimming ?? '',
$participant->notes ?? '',
];
Expand Down Expand Up @@ -176,6 +180,8 @@ public function allRegistrationDataToCSV(Event $event, User $adminUser): array
'birthDate',
'birthPlace',
'healthProblems',
'medicaments',
'psychicalHealthProblems',
'foodPreferences',
'foodPreferencesRaw', // 20
'idNumber',
Expand Down Expand Up @@ -254,6 +260,8 @@ public function allRegistrationDataToCSV(Event $event, User $adminUser): array
$participant->birthDate ? $participant->birthDate->format('d. m. Y') : '',
$participant->birthPlace ?? '',
$participant->healthProblems ?? '',
$participant->medicaments ?? '',
$participant->psychicalHealthProblems ?? '',
$this->translator->trans($participant->foodPreferences ?? ''),
$participant->foodPreferences ?? '', // 20
$participant->idNumber ?? '',
Expand Down
2 changes: 2 additions & 0 deletions src/Participant/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
* @property DateTimeInterface|null $birthDate m:passThru(dateFromString|dateToString)
* @property string|null $birthPlace
* @property string|null $healthProblems
* @property string|null $medicaments
* @property string|null $psychicalHealthProblems
* @property string|null $foodPreferences
* @property string|null $idNumber
* @property string|null $scarf
Expand Down
2 changes: 2 additions & 0 deletions src/Participant/ParticipantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ private function addParamsIntoPerson(array $params, Participant $p): Participant
}
$p->birthPlace = $params['birthPlace'] ?? null;
$p->healthProblems = $params['healthProblems'] ?? null;
$p->medicaments = $params['medicaments'] ?? null;
$p->psychicalHealthProblems = $params['psychicalHealthProblems'] ?? null;
$p->foodPreferences = $params['foodPreferences'] ?? null;
$p->idNumber = $params['idNumber'] ?? null;
$p->scarf = $params['scarf'] ?? null;
Expand Down
6 changes: 5 additions & 1 deletion src/Templates/cs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ detail:
foodOther: "jiné - prosím upřesni v poznámce"
food-placeholder: "v případě jiné diety, která není uvedena výše, uveď svou preferenci do poznámky"
issues: "Zdravotní omezení"
issues-placeholder: "alergie, pravidelně užívané léky, zdravotní omezení"
issues-placeholder: "alergie, zdravotní omezení"
medicaments: "léky"
medicaments-placeholder: "pravidelně užívané léky"
psychicalIssues: "psychická onemocnění"
psychicalIssues-placeholder: "psychická onemocnění, jakékoliv psychické obtíže"
language: "Jazyky + úroveň"
language-placeholder: "např. angličtina B1, francouština C1, němčina pasivně"
idNumber: "Číslo občanky/pasu"
Expand Down
6 changes: 5 additions & 1 deletion src/Templates/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ detail:
foodOther: "other - please specify in the note"
food-placeholder: "in case of any other diet need, write your need in the note"
issues: "Health issues"
issues-placeholder: "allergies - trigger, symptoms, medicine used; regularly taken medicine; past serious illnesses and surgeries..."
issues-placeholder: "allergies - trigger, symptoms, medicine used; past serious illnesses and surgeries..."
medicaments: "medicine"
medicaments-placeholder: "regularly taken medicine"
psychicalIssues: "mental illness"
psychicalIssues-placeholder: "Are you dealing with worsened mental health in any way?"
language: "Languages + level"
language-placeholder: "e.g. English B1, French C1, passive German"
idNumber: "ID number"
Expand Down
26 changes: 25 additions & 1 deletion src/Templates/translatable/widgets/changeDetails.twig
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,31 @@
value="{{ personDetails.getHealthProblems }}"
>
</div>
{% endif %}{% if ca.languages %}
{% endif %}{% if ca.medicaments %}
<div class="form-group">
<label for="medicaments">{% trans %}detail.medicaments{% endtrans %}:</label>
<input
id="medicaments"
class="form-control form-wide"
type="text"
name="medicaments"
placeholder="{% trans %}detail.medicaments-placeholder{% endtrans %}"
value="{{ personDetails.getMedicaments }}"
>
</div>
{% endif %}{% if ca.psychicalHealth %}
<div class="form-group">
<label for="psychicalHealthProblems">{% trans %}detail.psychicalIssues{% endtrans %}:</label>
<input
id="psychicalHealthProblems"
class="form-control form-wide"
type="text"
name="PsychicalHealthProblems"
placeholder="{% trans %}detail.psychicalIssues-placeholder{% endtrans %}"
value="{{ personDetails.getPsychicalHealthProblems }}"
>
</div>
{% endif %}{% if ca.languages %}
<div class="form-group">
<label for="languages">{% trans %}detail.language{% endtrans %}:</label>
<input
Expand Down
4 changes: 4 additions & 0 deletions src/Templates/translatable/widgets/details.twig
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
{% trans %}detail.foodHeader{% endtrans %}: <b>{{ person.getFoodPreferences|trans }}</b><br/>
{% endif %}{% if ca.health %}
{% trans %}detail.issues{% endtrans %}: <b>{{ person.getHealthProblems }}</b><br/>
{% endif %}{% if ca.medicaments %}
{% trans %}detail.medicaments{% endtrans %}: <b>{{ person.getMedicaments }}</b><br/>
{% endif %}{% if ca.psychicalHealth %}
{% trans %}detail.psychicalIssues{% endtrans %}: <b>{{ person.getPsychicalHealthProblems }}</b><br/>
{% endif %}{% if ca.languages %}
{% trans %}detail.language{% endtrans %}: <b>{{ person.getLanguages }}</b><br/>
{% endif %}{% if ca.swimming %}
Expand Down

0 comments on commit c5bf563

Please sign in to comment.