diff --git a/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkEvaluationNotificationHandler.php b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkEvaluationNotificationHandler.php new file mode 100644 index 000000000..63e395a98 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Notification/AccompanyingPeriodWorkEvaluationNotificationHandler.php @@ -0,0 +1,46 @@ +accompanyingPeriodWorkEvaluationRepository = $accompanyingPeriodWorkEvaluationRepository; + } + + public function getTemplate(Notification $notification, array $options = []): string + { + return 'ChillPersonBundle:AccompanyingCourseWork:showEvaluationInNotification.html.twig'; + } + + public function getTemplateData(Notification $notification, array $options = []): array + { + return [ + 'notification' => $notification, + 'evaluation' => $this->accompanyingPeriodWorkEvaluationRepository->find($notification->getRelatedEntityId()), + ]; + } + + public function supports(Notification $notification, array $options = []): bool + { + return $notification->getRelatedEntityClass() === AccompanyingPeriodWorkEvaluation::class; + } +} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/_objectifs_results_evaluations.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/_objectifs_results_evaluations.html.twig index 0dd0cc84a..3778f312b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/_objectifs_results_evaluations.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/_objectifs_results_evaluations.html.twig @@ -129,13 +129,15 @@ {% import "@ChillDocStore/Macro/macro.html.twig" as m %} {% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %} - {% if e.documents|length > 0 %} {% for d in e.documents %} + {% endfor %} @@ -143,7 +145,7 @@ {% else %} {{ 'No document found'|trans }} {% endif %} - + {% endif %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/showEvaluationInNotification.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/showEvaluationInNotification.html.twig new file mode 100644 index 000000000..d35cf44c3 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/showEvaluationInNotification.html.twig @@ -0,0 +1,24 @@ +{% macro recordAction(evaluation) %} +
  • + +
  • +{% endmacro %} +{% if evaluation is not null %} +
    + {% if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', evaluation) %} + {% else %} + {% endif %} + {% include 'ChillPersonBundle:AccompanyingCourseWork:_objectifs_results_evaluations.html.twig' with { + 'w': evaluation.accompanyingPeriodWork + } %} +
    + {{ 'This is the minimal period details'|trans ~ ': ' ~ evaluation.id }}
    + {{ 'You are getting a notification for a period you are not allowed to see'|trans }} +
    +
    +{% else %} +
    + {{ 'You are getting a notification for a period which does not exists any more'|trans }} +
    +{% endif %} diff --git a/src/Bundle/ChillPersonBundle/config/services/notification.yaml b/src/Bundle/ChillPersonBundle/config/services/notification.yaml index 7fd64bfbf..360873bee 100644 --- a/src/Bundle/ChillPersonBundle/config/services/notification.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/notification.yaml @@ -5,3 +5,6 @@ services: Chill\PersonBundle\Notification\AccompanyingPeriodWorkNotificationHandler: autowire: true autoconfigure: true + Chill\PersonBundle\Notification\AccompanyingPeriodWorkEvaluationNotificationHandler: + autowire: true + autoconfigure: true
    {{ d.title }} {{ mm.mimeIcon(d.storedObject.type) }} + + {{ d.storedObject|chill_document_button_group(d.title, is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', w), {'small': true}) }}