mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
resume: list associated persons sorted by household. add method in entity
This commit is contained in:
parent
fbd17a1de6
commit
3a3baa79c8
@ -118,6 +118,7 @@ class AccompanyingCourseController extends Controller
|
|||||||
return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [
|
return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [
|
||||||
'accompanyingCourse' => $accompanyingCourse,
|
'accompanyingCourse' => $accompanyingCourse,
|
||||||
'withoutHousehold' => $withoutHousehold,
|
'withoutHousehold' => $withoutHousehold,
|
||||||
|
'participationsByHousehold' => $accompanyingCourse->actualParticipationsByHousehold(),
|
||||||
'works' => $works,
|
'works' => $works,
|
||||||
'activities' => $activities
|
'activities' => $activities
|
||||||
]);
|
]);
|
||||||
|
@ -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.
|
* Return true if the accompanying period contains a person.
|
||||||
*
|
*
|
||||||
|
@ -247,3 +247,24 @@ span.fa-holder {
|
|||||||
font-family: "Open Sans Extrabold";
|
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 {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -23,17 +23,27 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="accompanyingcourse-resume row">
|
<div class="accompanyingcourse-resume row">
|
||||||
|
|
||||||
<div class="concerned mb-5">
|
<div class="associated-persons mb-5">
|
||||||
{% for p in accompanyingCourse.participations %}
|
{% for h in participationsByHousehold %}
|
||||||
|
{% set householdClass = (h.household is not null) ? 'household-' ~ h.household.id : 'no-household' %}
|
||||||
|
<span class="household {{ householdClass }}">
|
||||||
|
{% if h.household is not null %}
|
||||||
|
<a href="{{ path('chill_person_household_summary', { 'household_id': h.household.id }) }}"
|
||||||
|
title="{{ 'household.Household number'|trans({'household_num': h.household.id }) }}"
|
||||||
|
><i class="fa fa-home fa-fw"></i></a>
|
||||||
|
{% endif %}
|
||||||
|
{% for p in h.members %}
|
||||||
|
|
||||||
{# include vue_onthefly component #}
|
{# include vue_onthefly component #}
|
||||||
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
|
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
|
||||||
targetEntity: { name: 'person', id: p.person.id },
|
targetEntity: { name: 'person', id: p.person.id },
|
||||||
action: 'show',
|
action: 'show',
|
||||||
displayBadge: true,
|
displayBadge: true,
|
||||||
buttonText: p.person|chill_entity_render_string
|
buttonText: p.person|chill_entity_render_string
|
||||||
} %}
|
} %}
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user