Resolve "Afficher les noms des usagers et l'entité concerné par l'entité notifiée dans la liste des notifications"

This commit is contained in:
2025-01-23 11:34:16 +00:00
committed by Julien Fastré
parent 9e191f1b5b
commit 9a5fd67842
28 changed files with 267 additions and 33 deletions

View File

@@ -15,6 +15,8 @@ use Chill\MainBundle\Entity\Notification;
use Chill\MainBundle\Notification\NotificationHandlerInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
use Symfony\Component\Translation\TranslatableMessage;
use Symfony\Contracts\Translation\TranslatableInterface;
final readonly class AccompanyingPeriodNotificationHandler implements NotificationHandlerInterface
{
@@ -37,4 +39,27 @@ final readonly class AccompanyingPeriodNotificationHandler implements Notificati
{
return AccompanyingPeriod::class === $notification->getRelatedEntityClass();
}
public function getTitle(Notification $notification, array $options = []): TranslatableInterface
{
if (null === $period = $this->getRelatedEntity($notification)) {
return new TranslatableMessage('accompanying_period.deleted');
}
return new TranslatableMessage('periods.title', ['id' => $period->getId()]);
}
public function getAssociatedPersons(Notification $notification, array $options = []): array
{
if (null === $period = $this->getRelatedEntity($notification)) {
return [];
}
return $period->getParticipations()->getValues();
}
public function getRelatedEntity(Notification $notification): ?AccompanyingPeriod
{
return $this->accompanyingPeriodRepository->find($notification->getRelatedEntityId());
}
}

View File

@@ -15,6 +15,8 @@ use Chill\MainBundle\Entity\Notification;
use Chill\MainBundle\Notification\NotificationHandlerInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocumentRepository;
use Symfony\Component\Translation\TranslatableMessage;
use Symfony\Contracts\Translation\TranslatableInterface;
final readonly class AccompanyingPeriodWorkEvaluationDocumentNotificationHandler implements NotificationHandlerInterface
{
@@ -38,4 +40,33 @@ final readonly class AccompanyingPeriodWorkEvaluationDocumentNotificationHandler
{
return AccompanyingPeriodWorkEvaluationDocument::class === $notification->getRelatedEntityClass();
}
public function getTitle(Notification $notification, array $options = []): TranslatableInterface
{
if (null === $eval = $this->getRelatedEntity($notification)) {
return new TranslatableMessage('evaluation.deleted');
}
return new TranslatableMessage(
'accompanying_course_evaluation_document.title',
[
'id' => $eval->getId(),
'doc_title' => $eval->getTitle(),
]
);
}
public function getAssociatedPersons(Notification $notification, array $options = []): array
{
if (null === $eval = $this->getRelatedEntity($notification)) {
return [];
}
return $eval->getAccompanyingPeriodWorkEvaluation()->getAccompanyingPeriodWork()->getPersons()->getValues();
}
public function getRelatedEntity(Notification $notification): ?AccompanyingPeriodWorkEvaluationDocument
{
return $this->accompanyingPeriodWorkEvaluationDocumentRepository->find($notification->getRelatedEntityId());
}
}

View File

@@ -13,12 +13,15 @@ namespace Chill\PersonBundle\Notification;
use Chill\MainBundle\Entity\Notification;
use Chill\MainBundle\Notification\NotificationHandlerInterface;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
use Symfony\Component\Translation\TranslatableMessage;
use Symfony\Contracts\Translation\TranslatableInterface;
final readonly class AccompanyingPeriodWorkNotificationHandler implements NotificationHandlerInterface
{
public function __construct(private AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository) {}
public function __construct(private AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository, private TranslatableStringHelperInterface $translatableStringHelper) {}
public function getTemplate(Notification $notification, array $options = []): string
{
@@ -37,4 +40,30 @@ final readonly class AccompanyingPeriodWorkNotificationHandler implements Notifi
{
return AccompanyingPeriodWork::class === $notification->getRelatedEntityClass();
}
public function getTitle(Notification $notification, array $options = []): TranslatableInterface
{
if (null === $work = $this->getRelatedEntity($notification)) {
return new TranslatableMessage('accompanying_course_work.deleted');
}
return new TranslatableMessage('accompanying_period_work.title', [
'id' => $work->getId(),
'action_title' => $this->translatableStringHelper->localize($work->getSocialAction()->getTitle()),
]);
}
public function getAssociatedPersons(Notification $notification, array $options = []): array
{
if (null === $work = $this->getRelatedEntity($notification)) {
return [];
}
return $work->getPersons()->getValues();
}
public function getRelatedEntity(Notification $notification): ?AccompanyingPeriodWork
{
return $this->accompanyingPeriodWorkRepository->find($notification->getRelatedEntityId());
}
}

View File

@@ -244,7 +244,7 @@ export default {
};
</script>
<style lang="scss">
<style lang="scss" scoped>
.filtered {
filter: grayscale(1) opacity(0.6);
}

View File

@@ -372,7 +372,11 @@ export default {
};
</script>
<style lang="scss">
<style lang="scss" scoped>
@import "ChillMainAssets/module/bootstrap/shared";
@import "ChillPersonAssets/chill/scss/mixins";
@import "ChillMainAssets/chill/scss/chill_variables";
.lastname:before {
content: " ";
}
@@ -384,6 +388,12 @@ div.flex-table {
width: 33%;
}
@include media-breakpoint-down(sm) {
div.item-col:first-child {
width: unset;
}
}
div.item-col:last-child {
justify-content: flex-start;
}

View File

@@ -74,7 +74,7 @@ class AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler implements EntityW
}
return $this->translator->trans(
'workflow.Doc for evaluation (n°%eval%)',
'entity_display_title.Doc for evaluation (n°%eval%)',
['%eval%' => $entityWorkflow->getRelatedEntityId()]
).' ('.$this->translatableStringHelper->localize($doc->getAccompanyingPeriodWorkEvaluation()
->getEvaluation()->getTitle()).') '.$doc->getTitle();

View File

@@ -56,7 +56,7 @@ readonly class AccompanyingPeriodWorkEvaluationWorkflowHandler implements Entity
$evaluation = $this->getRelatedEntity($entityWorkflow);
return $this->translator->trans(
'workflow.Evaluation (n°%eval%)',
'entity_display_title.Evaluation (n°%eval%)',
['%eval%' => $entityWorkflow->getRelatedEntityId()]
).' - '.$this->translatableStringHelper->localize($evaluation->getEvaluation()->getTitle());
}

View File

@@ -59,7 +59,7 @@ readonly class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHa
}
return
$this->translator->trans('workflow.Work (n°%w%)', ['%w%' => $entityWorkflow->getRelatedEntityId()])
$this->translator->trans('entity_display_title.Work (n°%w%)', ['%w%' => $entityWorkflow->getRelatedEntityId()])
.' - '.$this->translatableStringHelper->localize($work->getSocialAction()->getTitle());
}

View File

@@ -118,6 +118,7 @@ household_composition:
}
periods:
title: Parcours d'accompagnement (n°{id})
show closed periods: >-
{nb_items, plural,
=0 {Aucun parcours clôturé}
@@ -177,5 +178,9 @@ exports:
}
accompanying_course_evaluation_document:
title: Évaluation (n°{id}) - {doc_title}
duplicated_at: >-
Dupliqué le {at, date, long} à {at, time, short}
accompanying_period_work:
title: Action d'accompagnement (n°{id}) - {action_title}

View File

@@ -732,6 +732,7 @@ origin:
noActiveAfter: désactivé après
evaluation:
deleted: Évaluation supprimé
delay: Délai
notificationDelay: Délai de notification
url: Lien internet
@@ -788,6 +789,7 @@ person_admin:
# specific to accompanying period
accompanying_period:
deleted: Parcours d'accompagnment 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%
@@ -876,6 +878,7 @@ Accompanying Course Action: Action d'accompagnement
Are you sure you want to remove this work of the accompanying period %name% ?: Êtes-vous sûr de vouloir supprimer cette action du parcours d'accompagnement %name% ?
The accompanying period work has been successfully removed.: L'action d'accompagnement a été supprimée.
accompanying_course_work:
deleted: Action d'accompagnement supprimé
create: Créer une action
Create accompanying course work: Créer une action d'accompagnement
Edit accompanying course work: Modifier une action d'accompagnement
@@ -962,7 +965,6 @@ Display draft periods created by me: Affiche les parcours en attente de confirma
Number of periods: Nombre de parcours
workflow:
Doc for evaluation (n°%eval%): Document de l'évaluation n°%eval%
doc for evaluation deleted: Document supprimé dans une évaluation
SocialAction deleted: Action sociale supprimée
signature_list:
@@ -1470,3 +1472,8 @@ generic_doc:
filter:
keys:
accompanying_period_work_evaluation_document: Document des actions d'accompagnement
entity_display_title:
Evaluation (n°%eval%): "Évaluation (n°%eval%)"
Work (n°%w%): "Action d'accompagnement (n°%w%)"
Accompanying Course (n°%w%): "Parcours d'accompagnement (n°%w%)"

View File

@@ -578,9 +578,6 @@ Linked evaluations: Gerelateerde evaluaties
My accompanying periods: Mijn hulpverleningstrajecten
My accompanying periods in draft: Mijn hulpverleningstrajecten in ontwerp
workflow:
Doc for evaluation (n°%eval%): Evaluatiedocument n°%eval%
period_by_user_list:
Period by user: Hulpverleningstrajecten per gebruiker
Pick a user: Selecteer een gebruiker om zijn/haar hulpverleningstrajecten te zien