mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 02:23:51 +00:00
#365 Add works and activities counter
This commit is contained in:
@@ -204,20 +204,25 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
|
||||
['date' => 'DESC', 'id' => 'DESC'],
|
||||
);
|
||||
|
||||
$activities = \array_slice($activities, 0, 3);
|
||||
|
||||
$works = $this->workRepository->findByAccompanyingPeriod(
|
||||
$accompanyingCourse,
|
||||
['startDate' => 'DESC', 'endDate' => 'DESC'],
|
||||
3
|
||||
);
|
||||
|
||||
$counters = [
|
||||
'activities' => count($activities),
|
||||
'openWorks' => count($accompanyingCourse->getOpenWorks()),
|
||||
'works' => count($works),
|
||||
];
|
||||
|
||||
return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [
|
||||
'accompanyingCourse' => $accompanyingCourse,
|
||||
'withoutHousehold' => $withoutHousehold,
|
||||
'participationsByHousehold' => $accompanyingCourse->actualParticipationsByHousehold(),
|
||||
'works' => $works,
|
||||
'activities' => $activities,
|
||||
'activities' => \array_slice($activities, 0, 3),
|
||||
'counters' => $counters,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@@ -511,6 +511,14 @@ class AccompanyingPeriod implements
|
||||
return $this->getParticipationsContainsPerson($person)->count() > 0;
|
||||
}
|
||||
|
||||
public function getOpenWorks(): Collection
|
||||
{
|
||||
return $this->getWorks()->filter(
|
||||
static fn (AccompanyingPeriodWork $work): bool => null === $work->getEndDate()
|
||||
or $work->getEndDate() > new \DateTimeImmutable('today')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a new participation for a person.
|
||||
*/
|
||||
|
@@ -71,7 +71,7 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||
->setExtras(['order' => 30]);
|
||||
*/
|
||||
|
||||
$menu->addChild($this->translator->trans('Accompanying Course Comment'), [
|
||||
$menu->addChild($this->translator->trans('Accompanying Course Comments'), [
|
||||
'route' => 'chill_person_accompanying_period_comment_list',
|
||||
'routeParameters' => [
|
||||
'accompanying_period_id' => $period->getId(),
|
||||
@@ -80,12 +80,15 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||
}
|
||||
|
||||
if ($this->security->isGranted(AccompanyingPeriodWorkVoter::SEE, $period)) {
|
||||
$menu->addChild($this->translator->trans('Accompanying Course Action'), [
|
||||
$menu->addChild($this->translator->trans('Accompanying Course Actions'), [
|
||||
'route' => 'chill_person_accompanying_period_work_list',
|
||||
'routeParameters' => [
|
||||
'id' => $period->getId(),
|
||||
], ])
|
||||
->setExtras(['order' => 40]);
|
||||
->setExtras([
|
||||
'order' => 40,
|
||||
'counter' => count($period->getOpenWorks()) > 0 ? count($period->getOpenWorks()) : null,
|
||||
]);
|
||||
}
|
||||
|
||||
$workflow = $this->registry->get($period, 'accompanying_period_lifecycle');
|
||||
|
@@ -304,5 +304,14 @@ div#dashboards {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
div.count-item {
|
||||
font-size: 3rem;
|
||||
text-align: center;
|
||||
}
|
||||
div.count-item-label {
|
||||
font-size: 90%;
|
||||
font-variant: all-small-caps;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -201,7 +201,7 @@
|
||||
{% endif %}
|
||||
|
||||
{% if accompanyingCourse.step != 'DRAFT' %}
|
||||
<div class="mbloc col col-sm-6 col-lg-4">
|
||||
<div class="mbloc col col-sm-6 col-lg-8 col-xxl-4">
|
||||
<div class="notification-counter">
|
||||
<h4 class="item-key">{{ 'notification.Notifications'|trans }}</h4>
|
||||
{% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', accompanyingCourse.id) %}
|
||||
@@ -238,6 +238,31 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if counters.activities > 0 %}
|
||||
<div class="mbloc col col-sm-6 col-lg-4">
|
||||
<div class="count-activities">
|
||||
<div class="count-item">{{ counters.activities }}</div>
|
||||
<div class="count-item-label">
|
||||
{% if counters.activities == 1 %}
|
||||
{{ 'Activity'|trans }}
|
||||
{% else %}
|
||||
{{ 'Activities'|trans }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if counters.works > 0 %}
|
||||
<div class="mbloc col col-sm-6 col-lg-4">
|
||||
<div class="count-works">
|
||||
<div class="count-item">{{ counters.openWorks }} / {{ counters.works }}</div>
|
||||
<div class="count-item-label">{{ 'accompanying_course_work.On-going works over total'|trans }}</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="social-actions my-4">
|
||||
|
@@ -804,7 +804,7 @@ person_admin:
|
||||
|
||||
# specific to accompanying period
|
||||
accompanying_period:
|
||||
deleted: Parcours d'accompagnment supprimé
|
||||
deleted: Parcours d'accompagnement supprimé
|
||||
dates: Période
|
||||
dates_from_%opening_date%: Ouvert depuis le %opening_date%
|
||||
dates_from_%opening_date%_to_%closing_date%: Ouvert du %opening_date% au %closing_date%
|
||||
@@ -843,6 +843,7 @@ accompanying_course:
|
||||
administrative_location: Localisation administrative
|
||||
comment is pinned: Le commentaire est épinglé
|
||||
comment is unpinned: Le commentaire est désépinglé
|
||||
|
||||
show: Montrer
|
||||
hide: Masquer
|
||||
closed periods: parcours clôturés
|
||||
@@ -851,6 +852,7 @@ Social work configuration: Gestion des actions d'accompagnement social
|
||||
|
||||
# Accompanying Course comments
|
||||
Accompanying Course Comment: Commentaire
|
||||
Accompanying Course Comments: Commentaires
|
||||
Accompanying Course Comment list: Commentaires du parcours
|
||||
pinned: épinglé
|
||||
Pin comment: Épingler
|
||||
@@ -919,6 +921,7 @@ accompanying_course_work:
|
||||
date_filter: Filtrer par date
|
||||
types_filter: Filtrer par type d'action
|
||||
user_filter: Filtrer par intervenant
|
||||
On-going works over total: Actions en cours / Actions du parcours
|
||||
|
||||
|
||||
#
|
||||
|
Reference in New Issue
Block a user