diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index 1bf40d146..5c11f4802 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -118,6 +118,7 @@ class AccompanyingCourseController extends Controller return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [ 'accompanyingCourse' => $accompanyingCourse, 'withoutHousehold' => $withoutHousehold, + 'participationsByHousehold' => $accompanyingCourse->actualParticipationsByHousehold(), 'works' => $works, 'activities' => $activities ]); diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 14fb26f1a..8a834736b 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -513,6 +513,44 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface ); } + /** + * Return an array with open participations sorted by household + * [ + * [ + * "household" => Household x, + * "members" => [ + * Participation y , Participation z, ... + * ] + * ], + * ] + * + */ + public function actualParticipationsByHousehold(): array + { + $participations = $this->getOPenParticipations()->toArray(); + + $households = []; + foreach ($participations as $p) { + $households[] = $p->getPerson()->getCurrentHousehold(); + } + $households = array_unique($households, SORT_REGULAR); + + $array = []; + foreach ($households as $household) { + $members = []; + foreach ($participations as $p) { + if ($household === $p->getPerson()->getCurrentHousehold()) { + $members[] = array_shift($participations); + } else { + $participations[] = array_shift($participations); + } + } + $array[] = [ 'household' => $household, 'members' => $members ]; + } + + return $array; + } + /** * Return true if the accompanying period contains a person. * diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss index 071d0f9a5..64ea09cdc 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss @@ -247,3 +247,24 @@ span.fa-holder { font-family: "Open Sans Extrabold"; } } + +div.accompanyingcourse-resume { + div.associated-persons { + span.household { + border-radius: 8px; + border: 1px solid $white; + &:hover { + border: 1px solid $chill-beige; + } + i { + color: $chill-beige; + } + padding: 0.5em; + margin-right: 2px; + span.badge-person, span.badge-thirdparty { + margin-bottom: 1em; + } + &.no-household {} + } + } +} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index fa30389fc..a879e1ccb 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -23,17 +23,27 @@ {% block content %}