diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php new file mode 100644 index 000000000..cfd677373 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -0,0 +1,63 @@ +render('@ChillPerson/AccompanyingCourse/index.html.twig', [ + 'accompanyingCourse' => $accompanyingCourse + ]); + } + + /** + * Show page of Accompanying Course section + * + * the page show all blocks except one active edit block, managed by vuejs component + * that's why title of page is 'edit accompanying course' + * + * @Route("/{_locale}/parcours/{accompanying_period_id}/show", name="chill_person_accompanying_course_show") + * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) + */ + public function showAction(AccompanyingPeriod $accompanyingCourse): Response + { + return $this->render('@ChillPerson/AccompanyingCourse/show.html.twig', [ + 'accompanyingCourse' => $accompanyingCourse + ]); + } + + /** + * History page of Accompanying Course section + * + * the page show anti chronologic history with all actions, title of page is 'accompanying course details' + * + * @Route("/{_locale}/parcours/{accompanying_period_id}/history", name="chill_person_accompanying_course_history") + * @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"}) + */ + public function historyAction(AccompanyingPeriod $accompanyingCourse): Response + { + return $this->render('@ChillPerson/AccompanyingCourse/history.html.twig', [ + 'accompanyingCourse' => $accompanyingCourse + ]); + } +} + + diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php index 2b51e9191..5c862ee4f 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php @@ -88,8 +88,8 @@ class AccompanyingPeriodController extends AbstractController $this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person, 'You are not allowed to update this person'); - $accompanyingPeriod = new AccompanyingPeriod(new \DateTimeImmutable('now')); - $accompanyingPeriod->setClosingDate(new \DateTimeImmutable('now')); + $accompanyingPeriod = new AccompanyingPeriod(new \DateTime('now')); + $accompanyingPeriod->setClosingDate(new \DateTime('now')); $accompanyingPeriod->addPerson($person); //or $person->addAccompanyingPeriod($accompanyingPeriod); diff --git a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php new file mode 100644 index 000000000..74052e87c --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php @@ -0,0 +1,58 @@ +translator = $translator; + } + + public static function getMenuIds(): array + { + return [ 'accompanyingCourse' ]; + } + + public function buildMenu($menuId, MenuItem $menu, array $parameters): void + { + $menu->addChild($this->translator->trans('Resume Accompanying Course'), [ + 'route' => 'chill_person_accompanying_course_index', + 'routeParameters' => [ + 'accompanying_period_id' => $parameters['accompanyingCourse']->getId() + ]]) + ->setExtras(['order' => 10]); + + $menu->addChild($this->translator->trans('Edit Accompanying Course'), [ + 'route' => 'chill_person_accompanying_course_show', + 'routeParameters' => [ + 'accompanying_period_id' => $parameters['accompanyingCourse']->getId() + ]]) + ->setExtras(['order' => 20]); + + $menu->addChild($this->translator->trans('Accompanying Course Details'), [ + 'route' => 'chill_person_accompanying_course_history', + 'routeParameters' => [ + 'accompanying_period_id' => $parameters['accompanyingCourse']->getId() + ]]) + ->setExtras(['order' => 30]); + } + + +} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/banner.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/banner.html.twig new file mode 100644 index 000000000..6ddb46246 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/banner.html.twig @@ -0,0 +1,41 @@ +
+ ouvert le 11 avril 2019
+ par Soline Maillet | SIPAS
+
+{{ accompanyingCourse.id }} +{{ accompanyingCourse.openingDate|format_date('short') }} +{{ accompanyingCourse.closingDate|format_date('short') }} +{{ accompanyingCourse.closingMotive|chill_entity_render_box }} +{{ accompanyingCourse.remark|raw }} +{{ accompanyingCourse.user }} +usagers: +{% for p in accompanyingCourse.participations %} + {{ p.person.id }} | {{ p.person.fullnamecanonical }} | {{ p.startdate|format_date('short') }} | {{ p.enddate|format_date('short') }} +{% endfor %} ++ + {{ dump() }} + +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig new file mode 100644 index 000000000..82f7102fd --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -0,0 +1,26 @@ +{% extends 'ChillPersonBundle:AccompanyingCourse:layout.html.twig' %} + +{% block title %} + {{ 'Resume Accompanying Course'|trans }} +{% endblock %} + +{% block content %} + +
+{{ accompanyingCourse.id }} +{{ accompanyingCourse.openingDate|format_date('short') }} +{{ accompanyingCourse.closingDate|format_date('short') }} +{{ accompanyingCourse.closingMotive|chill_entity_render_box }} +{{ accompanyingCourse.remark|raw }} +{{ accompanyingCourse.user }} +usagers: +{% for p in accompanyingCourse.participations %} + {{ p.person.id }} | {{ p.person.fullnamecanonical }} | {{ p.startdate|format_date('short') }} | {{ p.enddate|format_date('short') }} +{% endfor %} ++ + {{ dump() }} + +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/layout.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/layout.html.twig new file mode 100644 index 000000000..3e880fb62 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/layout.html.twig @@ -0,0 +1,47 @@ +{% extends "ChillMainBundle::layoutWithVerticalMenu.html.twig" %} + +{% block top_banner %} + {{ include('ChillPersonBundle:AccompanyingCourse:banner.html.twig', { title: block('title') }) }} +{% endblock %} + +{% block layout_wvm_content %} + {% block content %}{% endblock %} +{% endblock %} + +{% block vertical_menu_content %} + {{ chill_menu('accompanyingCourse', { + 'layout': 'ChillPersonBundle:AccompanyingCourse:menu.html.twig', + 'args' : { 'accompanyingCourse': accompanyingCourse } + }) }} +{% endblock %} + +{% block css %} + +{% endblock %} + +{% block js %} +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/menu.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/menu.html.twig new file mode 100644 index 000000000..a60abe7eb --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/menu.html.twig @@ -0,0 +1,7 @@ +
+{{ accompanyingCourse.id }} +{{ accompanyingCourse.openingDate|format_date('short') }} +{{ accompanyingCourse.closingDate|format_date('short') }} +{{ accompanyingCourse.closingMotive|chill_entity_render_box }} +{{ accompanyingCourse.remark|raw }} +{{ accompanyingCourse.user }} +usagers: +{% for p in accompanyingCourse.participations %} + {{ p.person.id }} | {{ p.person.fullnamecanonical }} | {{ p.startdate|format_date('short') }} | {{ p.enddate|format_date('short') }} +{% endfor %} ++ + {{ dump() }} + + +{% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig index c0c50dbab..05e4702aa 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/list.html.twig @@ -18,7 +18,7 @@