diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index 82581641e..de67602b4 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -7,6 +7,7 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent; use Chill\PersonBundle\Entity\Person; +use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Symfony\Bundle\FrameworkBundle\Controller\Controller; @@ -35,14 +36,18 @@ class AccompanyingCourseController extends Controller protected ValidatorInterface $validator; + private AccompanyingPeriodWorkRepository $workRepository; + public function __construct( SerializerInterface $serializer, EventDispatcherInterface $dispatcher, - ValidatorInterface $validator + ValidatorInterface $validator, + AccompanyingPeriodWorkRepository $workRepository ) { $this->serializer = $serializer; $this->dispatcher = $dispatcher; $this->validator = $validator; + $this->workRepository = $workRepository; } /** @@ -102,9 +107,16 @@ class AccompanyingCourseController extends Controller ['date' => 'DESC'], ); + $works = $this->workRepository->findByAccompanyingPeriod( + $accompanyingCourse, + ['startDate' => 'DESC', 'endDate' => 'DESC'], + 3 + ); + return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [ 'accompanyingCourse' => $accompanyingCourse, 'withoutHousehold' => $withoutHousehold, + 'works' => $works, 'activities' => $activities ]); } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index 364f8c7fd..09eee9351 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -222,11 +222,103 @@

{{ 'Social actions'|trans }}

- {% set person = null %} + {% for w in works %} +
+
+

+ {{ w.socialAction|chill_entity_render_box({ 'no-badge': false }) }} +

+
+ +
+ +
+ + {% if w.results|length > 0 %} +
+
+

{{ 'accompanying_course_work.goal'|trans }}

+

{{ 'accompanying_course_work.results without objective'|trans }}

+
+
+

{{ 'accompanying_course_work.results'|trans }}

+
    + {% for r in w.results %} +
  • {{ r.title|localize_translatable_string }}
  • + {% endfor %} +
+
+
+ {% endif %} + + {% if w.goals|length > 0 %} + {% for g in w.goals %} +
+
+

{{ 'accompanying_course_work.goal'|trans }}

+

{{ g.goal.title|localize_translatable_string }}

+
+
+ {% if g.results|length == 0 %} +

{{ 'accompanying_course_work.results'|trans }}

+

{{ 'accompanying_course_work.no_results'|trans }}

+ {% else %} +

{{ 'accompanying_course_work.results'|trans }}

+
    + {% for r in g.results %} +
  • {{ r.title|localize_translatable_string }}
  • + {% endfor %} +
+ {% endif %} +
+
+ {% endfor %} + {% endif %} + +
+ {{ 'Last updated by'|trans}}: {{ w.updatedBy|chill_entity_render_box }}, {{ w.updatedAt|format_datetime('long', 'short') }} +
+ +
+ {% endfor %} + + {% block contentActivity %} + {% set person = null %} {% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse', 'context': 'person'} %} {% endblock %} {# ==> insert accompanyingCourse vue component #}
{% endblock %} + + +{% block css %} + {{ parent() }} + {{ encore_entry_link_tags('accompanying_course_work_list') }} +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/config/services/controller.yaml b/src/Bundle/ChillPersonBundle/config/services/controller.yaml index e7c34e78f..bad7e1745 100644 --- a/src/Bundle/ChillPersonBundle/config/services/controller.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/controller.yaml @@ -46,6 +46,7 @@ services: $serializer: '@Symfony\Component\Serializer\SerializerInterface' $dispatcher: '@Symfony\Contracts\EventDispatcher\EventDispatcherInterface' $validator: '@Symfony\Component\Validator\Validator\ValidatorInterface' + $workRepository: '@Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository' tags: ['controller.service_arguments'] Chill\PersonBundle\Controller\AccompanyingCourseApiController: