diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index aa849ac2b..52d87635e 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -48,4 +48,24 @@ class UserAccompanyingPeriodController extends AbstractController 'pagination' => $pagination, ]); } + + /** + * @Route("/{_locale}/accompanying-periods/drafts", name="chill_person_accompanying_period_draft_user") + */ + public function listDraftsAction(Request $request) + { + $total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser(), 'step' => 'DRAFT']); + $pagination = $this->paginatorFactory->create($total); + $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy( + ['user' => $this->getUser(), 'step' => 'DRAFT'], + ['id' => 'DESC'], + $pagination->getItemsPerPage(), + $pagination->getCurrentPageFirstItemNumber() + ); + + return $this->render('@ChillPerson/AccompanyingPeriod/user_draft_periods_list.html.twig', [ + 'accompanyingPeriods' => $accompanyingPeriods, + 'pagination' => $pagination, + ]); + } } diff --git a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php index 0a9d2a31c..857838780 100644 --- a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php @@ -44,6 +44,13 @@ class UserMenuBuilder implements LocalMenuBuilderInterface 'order' => 20, 'icon' => 'tasks', ]); + $menu->addChild('My accompanying periods in draft', [ + 'route' => 'chill_person_accompanying_period_draft_user', + ]) + ->setExtras([ + 'order' => 30, + 'icon' => 'tasks' + ]); } } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig new file mode 100644 index 000000000..5faaf378f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig @@ -0,0 +1,30 @@ +{% extends "@ChillMain/layout.html.twig" %} + +{% set activeRouteKey = 'chill_person_accompanying_period_user_list' %} + +{% block title %}{{ 'My accompanying periods in draft'|trans }}{% endblock title %} + +{% macro recordAction(period) %} +
  • + +
  • +{% endmacro %} + + +{% block content %} + +
    +

    {{ 'My accompanying periods in draft'|trans }}

    + +
    + {% for period in accompanyingPeriods %} + {% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %} + {% endfor %} +
    + + {{ chill_pagination(pagination) }} + +
    + +{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 91aed0304..99b2c2558 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -566,3 +566,4 @@ Linked evaluations: Évaluations associées # Accompanying period per user My accompanying periods: Mes parcours +My accompanying periods in draft: Mes parcours brouillon \ No newline at end of file