mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 05:44:24 +00:00
[AccompanyingCourse location] Indicate course location on course index
page
This commit is contained in:
parent
75d3dfb830
commit
a0afaa568d
@ -499,6 +499,17 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
return $collection->count() > 0 ? $collection->first() : NULL;
|
return $collection->count() > 0 ? $collection->first() : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getOPenParticipations(): Collection
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->getParticipations()
|
||||||
|
->filter(
|
||||||
|
static function(AccompanyingPeriodParticipation $participation): bool {
|
||||||
|
return null === $participation->getEndDate();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the accompanying period contains a person.
|
* Return true if the accompanying period contains a person.
|
||||||
*
|
*
|
||||||
@ -974,6 +985,22 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
return $this->personLocation;
|
return $this->personLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of person which have an adresse available for a valid location
|
||||||
|
*
|
||||||
|
* @return Collection|Person[]
|
||||||
|
*/
|
||||||
|
public function getAvailablePersonLocation(): Collection
|
||||||
|
{
|
||||||
|
return $this->getOPenParticipations()
|
||||||
|
->filter(function(AccompanyingPeriodParticipation $p) {
|
||||||
|
return $p->getPerson()->hasCurrentHouseholdAddress();
|
||||||
|
})
|
||||||
|
->map(function(AccompanyingPeriodParticipation $p) {
|
||||||
|
return $p->getPerson();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Groups({"write"})
|
* @Groups({"write"})
|
||||||
*/
|
*/
|
||||||
|
@ -103,7 +103,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
*
|
*
|
||||||
* @ORM\Column(type="date", nullable=true)
|
* @ORM\Column(type="date", nullable=true)
|
||||||
*/
|
*/
|
||||||
private $birthdate;
|
private $birthdate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The person's deathdate
|
* The person's deathdate
|
||||||
@ -736,8 +736,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
{
|
{
|
||||||
return $this->birthdate;
|
return $this->birthdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAge(): ?int
|
public function getAge(): ?int
|
||||||
{
|
{
|
||||||
if ($this->birthdate instanceof \DateTimeInterface) {
|
if ($this->birthdate instanceof \DateTimeInterface) {
|
||||||
return date_diff($this->birthdate, date_create('now'))->format("%y");
|
return date_diff($this->birthdate, date_create('now'))->format("%y");
|
||||||
@ -1439,6 +1439,11 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasCurrentHouseholdAddress(?\DateTimeImmutable $at = null): bool
|
||||||
|
{
|
||||||
|
return null !== $this->getCurrentHouseholdAddress($at);
|
||||||
|
}
|
||||||
|
|
||||||
public function getGenderComment(): CommentEmbeddable
|
public function getGenderComment(): CommentEmbeddable
|
||||||
{
|
{
|
||||||
return $this->genderComment;
|
return $this->genderComment;
|
||||||
|
@ -1,5 +1,38 @@
|
|||||||
<div class="alert alert-danger alert-with-actions mb-0">
|
{%- set hasPersonLocation = accompanyingCourse.availablePersonLocation|length > 0 -%}
|
||||||
<div class="message">
|
<div class="border border-danger">
|
||||||
{{ 'This course is located at a temporarily address. You should locate this course to an user'|trans }}
|
<div class="alert alert-danger {% if hasPersonLocation %}alert-with-actions{% endif %} mb-0">
|
||||||
|
<div class="message">
|
||||||
|
{{ 'This course is located at a temporarily address. You should locate this course to an user'|trans }}
|
||||||
|
{% if not hasPersonLocation %}
|
||||||
|
{{ 'Associate at least one member with an household, and set an address to this household'|trans }}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if hasPersonLocation %}
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<button class="btn btn-chill-pink" data-bs-toggle="collapse" href="#locateAtPerson">
|
||||||
|
<i class="fa fa-fw fa-caret-down"></i><span class="text-light">{{ 'Choose a person to locate by'|trans }}</span>
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if hasPersonLocation %}
|
||||||
|
<div id="locateAtPerson">
|
||||||
|
<form method="GET" action="#">
|
||||||
|
<p>{{ 'Locate by'|trans }}:</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
{% for p in accompanyingCourse.availablePersonLocation %}
|
||||||
|
<li>
|
||||||
|
<input type="radio" name="persons[]" value="{{ p.id }}">
|
||||||
|
{{ p|chill_entity_render_box }}
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,11 +27,6 @@
|
|||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{% if accompanyingCourse.locationStatus == 'address' or accompanyingCourse.locationStatus == 'none' %}
|
|
||||||
<div class="alert alert-danger">
|
|
||||||
{{ 'This course is located at a temporarily address. You should locate this course to an user'|trans }}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h1>{{ 'Resume Accompanying Course'|trans }}</h1>
|
<h1>{{ 'Resume Accompanying Course'|trans }}</h1>
|
||||||
@ -54,12 +49,29 @@
|
|||||||
{% if withoutHousehold|length > 0 %}
|
{% if withoutHousehold|length > 0 %}
|
||||||
{% include '@ChillPerson/AccompanyingCourse/_join_household.html.twig' with {} %}
|
{% include '@ChillPerson/AccompanyingCourse/_join_household.html.twig' with {} %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if accompanyingCourse.locationStatus == 'address' or accompanyingCourse.locationStatus == 'none' %}
|
|
||||||
{% include '@ChillPerson/AccompanyingCourse/_warning_address.html.twig' with {} %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="location mb-5">
|
||||||
|
<h2 class="mb-3">{{ 'Accompanying course location'|trans }}</h2>
|
||||||
|
|
||||||
|
{% if accompanyingCourse.locationStatus == 'person' %}
|
||||||
|
<p>{{ 'This course is located by'|trans }}: {{ accompanyingCourse.personLocation|chill_entity_render_string }}</p>
|
||||||
|
{% elseif accompanyingCourse.locationStatus == 'address' %}
|
||||||
|
<p>{{ 'This course has a temporarily location'|trans }}</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if accompanyingCourse.locationStatus != 'none' %}
|
||||||
|
{{ accompanyingCourse.location|chill_entity_render_box }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if accompanyingCourse.locationStatus == 'address' or accompanyingCourse.locationStatus == 'none' %}
|
||||||
|
{% include '@ChillPerson/AccompanyingCourse/_warning_address.html.twig' with {} %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="requestor mb-5">
|
<div class="requestor mb-5">
|
||||||
<h2 class="mb-3">{{ 'Requestor'|trans }}</h2>
|
<h2 class="mb-3">{{ 'Requestor'|trans }}</h2>
|
||||||
{% if accompanyingCourse.requestorPerson is not empty %}
|
{% if accompanyingCourse.requestorPerson is not empty %}
|
||||||
|
@ -376,6 +376,12 @@ Edit Accompanying Course: Modifier le parcours
|
|||||||
Create Accompanying Course: Créer un nouveau parcours
|
Create Accompanying Course: Créer un nouveau parcours
|
||||||
Drop Accompanying Course: Supprimer le parcours
|
Drop Accompanying Course: Supprimer le parcours
|
||||||
This course is located at a temporarily address. You should locate this course to an user: Ce parcours est localisé à une adresse temporaire. Il devrait être localisé auprès d'un usager concerné.
|
This course is located at a temporarily address. You should locate this course to an user: Ce parcours est localisé à une adresse temporaire. Il devrait être localisé auprès d'un usager concerné.
|
||||||
|
Accompanying course location: Localisation du parcours
|
||||||
|
This course is located by: Ce parcours est localisé auprès de
|
||||||
|
This course has a temporarily location: Ce parcours a une localisation temporaire
|
||||||
|
Choose a person to locate by: Localiser auprès d'un usager concerné
|
||||||
|
Associate at least one member with an household, and set an address to this household: Associez au moins un membre du parcours à un ménage, et indiquez une adresse à ce ménage.
|
||||||
|
Locate by: Localiser auprès de
|
||||||
|
|
||||||
# Household
|
# Household
|
||||||
Household: Ménage
|
Household: Ménage
|
||||||
|
Loading…
x
Reference in New Issue
Block a user