mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
concerned parties, split in activity model persons associated or not
This commit is contained in:
parent
987815471c
commit
4ace2fef99
@ -237,6 +237,11 @@ class ActivityController extends AbstractController
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||
}
|
||||
|
||||
if (null !== $accompanyingPeriod) {
|
||||
$entity->personsAssociated = $entity->getPersonsAssociated();
|
||||
$entity->personsNotAssociated = $entity->getPersonsNotAssociated();
|
||||
}
|
||||
|
||||
// TODO revoir le Voter de Activity pour tenir compte qu'une activité peut appartenir a une période
|
||||
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
|
||||
|
@ -419,6 +419,34 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
return $this->persons;
|
||||
}
|
||||
|
||||
public function getPersonsAssociated(): array
|
||||
{
|
||||
if (null !== $this->accompanyingPeriod) {
|
||||
$personsAssociated = [];
|
||||
foreach ($this->accompanyingPeriod->getParticipations() as $participation) {
|
||||
if ($this->persons->contains($participation->getPerson())) {
|
||||
$personsAssociated[] = $participation->getPerson();
|
||||
}
|
||||
}
|
||||
return $personsAssociated;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getPersonsNotAssociated(): array
|
||||
{
|
||||
if (null !== $this->accompanyingPeriod) {
|
||||
$personsNotAssociated = [];
|
||||
foreach ($this->persons as $person) {
|
||||
if (!in_array($person, $this->getPersonsAssociated())) {
|
||||
$personsNotAssociated[] = $person;
|
||||
}
|
||||
}
|
||||
return $personsNotAssociated;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
public function setPersons(?Collection $persons): self
|
||||
{
|
||||
$this->persons = $persons;
|
||||
|
@ -1,13 +1,13 @@
|
||||
{% if context == 'person' %}
|
||||
{% set blocs = [
|
||||
{ 'title': 'Persons associated'|trans, 'items': entity.persons },
|
||||
{ 'title': 'ThirdParties'|trans, 'items': entity.thirdParties },
|
||||
{ 'title': 'Others persons'|trans, 'items': entity.persons },
|
||||
{ 'title': 'Third parties'|trans, 'items': entity.thirdParties },
|
||||
{ 'title': 'Users concerned'|trans, 'items': entity.users },
|
||||
] %}
|
||||
{% else %}
|
||||
{% set blocs = [
|
||||
{ 'title': 'Persons in accompanying course'|trans, 'items': entity.persons },
|
||||
{ 'title': 'Third persons'|trans, 'items': entity.persons },
|
||||
{ 'title': 'Persons in accompanying course'|trans, 'items': entity.personsAssociated },
|
||||
{ 'title': 'Third persons'|trans, 'items': entity.personsNotAssociated },
|
||||
{ 'title': 'ThirdParties'|trans, 'items': entity.thirdParties },
|
||||
{ 'title': 'Users concerned'|trans, 'items': entity.users },
|
||||
] %}
|
||||
|
@ -64,8 +64,8 @@ Choose a type: Choisir un type
|
||||
Concerned groups: Parties concernées
|
||||
Persons in accompanying course: Usagers du parcours
|
||||
Third persons: Tiers non-pro.
|
||||
Persons associated: Usagers
|
||||
ThirdParties: Tiers professionnels
|
||||
Others persons: Usagers
|
||||
Third parties: Tiers professionnels
|
||||
Users concerned: T(M)S
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user