init new AccompanyingCourse (parcours) section

This commit is contained in:
Mathieu Jaumotte 2021-04-15 11:46:08 +02:00
parent 083f56bff0
commit 16b155d449
13 changed files with 337 additions and 17 deletions

View File

@ -0,0 +1,63 @@
<?php
namespace Chill\PersonBundle\Controller;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class AccompanyingCourseController
*
* @package Chill\PersonBundle\Controller
*/
class AccompanyingCourseController extends Controller
{
/**
* Homepage of Accompanying Course section
*
* @Route("/{_locale}/parcours/{accompanying_period_id}", name="chill_person_accompanying_course_index")
* @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
*/
public function indexAction(AccompanyingPeriod $accompanyingCourse): Response
{
return $this->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
]);
}
}

View File

@ -88,8 +88,8 @@ class AccompanyingPeriodController extends AbstractController
$this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person, $this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person,
'You are not allowed to update this person'); 'You are not allowed to update this person');
$accompanyingPeriod = new AccompanyingPeriod(new \DateTimeImmutable('now')); $accompanyingPeriod = new AccompanyingPeriod(new \DateTime('now'));
$accompanyingPeriod->setClosingDate(new \DateTimeImmutable('now')); $accompanyingPeriod->setClosingDate(new \DateTime('now'));
$accompanyingPeriod->addPerson($person); $accompanyingPeriod->addPerson($person);
//or $person->addAccompanyingPeriod($accompanyingPeriod); //or $person->addAccompanyingPeriod($accompanyingPeriod);

View File

@ -0,0 +1,58 @@
<?php
namespace Chill\PersonBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Class AccompanyingCourseMenuBuilder
*
* @package Chill\PersonBundle\Menu
* @author mathieu.jaumotte@champs-libres.coop
*/
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
{
/**
* @var TranslatorInterface
*/
protected $translator;
public function __construct(TranslatorInterface $translator)
{
$this->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]);
}
}

View File

@ -0,0 +1,41 @@
<div class="subheader">
<div class="grid-12 parent" id="header-accompanying_course-name" >
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
<div class="grid-5">{% set title = title %}
<h1>
<i class="fa fa-random fa-fw"></i>
{{ 'Accompanying Course'|trans }}{# ou défini en amont
{{ title|default('Accompanying Course'|trans)|raw }} #}
<span style="font-weight: lighter; font-size: 65%;">(n°{{ accompanyingCourse.id }})</span>
</h1>
</div>
<div class="grid-4">
<ul class="record_actions">
<li>ponctuel <i class="fa fa-toggle-on fa-fw"></i> régulier</li>
<li>ouvert</li>
<li>en file active</li>
<li>urgent</li>
</ul>
</div>
<div class="grid-3">
<p style="text-align: right;">
<i>ouvert le 11 avril 2019</i><br>
par <b>Soline Maillet | SIPAS</b>
</p>
</div>
</div>
</div>
<div class="grid-12 parent" id="header-accompanying_course-details" >
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
<div class="grid-4">Problématiques sociales</div>
<div class="grid-4">_</div>
<div class="grid-4">_</div>
</div>
</div>
</div>

View File

@ -0,0 +1,26 @@
{% extends 'ChillPersonBundle:AccompanyingCourse:layout.html.twig' %}
{% block title %}
{{ 'Accompanying Course Details'|trans }}
{% endblock %}
{% block content %}
<h1>{{ block('title') }}</h1>
<pre>
{{ 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 }} | <a href="{{ path('chill_person_accompanying_period_list', { person_id: p.person.id }) }}">{{ p.person.fullnamecanonical }}</a> | {{ p.startdate|format_date('short') }} | {{ p.enddate|format_date('short') }}
{% endfor %}
</pre>
{{ dump() }}
{% endblock %}

View File

@ -0,0 +1,26 @@
{% extends 'ChillPersonBundle:AccompanyingCourse:layout.html.twig' %}
{% block title %}
{{ 'Resume Accompanying Course'|trans }}
{% endblock %}
{% block content %}
<h1>{{ block('title') }}</h1>
<pre>
{{ 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 }} | <a href="{{ path('chill_person_accompanying_period_list', { person_id: p.person.id }) }}">{{ p.person.fullnamecanonical }}</a> | {{ p.startdate|format_date('short') }} | {{ p.enddate|format_date('short') }}
{% endfor %}
</pre>
{{ dump() }}
{% endblock %}

View File

@ -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 %}
<style>
div#header-accompanying_course-name {
background: none repeat scroll 0 0 #718596; /*#DF6D6D;*/
color: #FFF;
padding-top: 1em;
padding-bottom: 1em;
}
div#header-accompanying_course-name span a {
color: white;
}
div#header-accompanying_course-name span a:hover {
text-decoration: underline;
}
div#header-accompanying_course-details {
background: none repeat scroll 0 0 #718596ab; /*#DF8C8A;*/
color: #FFF;
padding-top: 1em;
padding-bottom: 1em;
}
/* /!\ Contourne le positionnement problématique du div#content_conainter suivant,
* car sa position: relative le place au-dessus du bandeau et les liens sont incliquables */
div.subheader {
height: 130px;
}
</style>
{% endblock %}
{% block js %}
{% endblock %}

View File

@ -0,0 +1,7 @@
<ul class="tab-nav">
{% for menu in menus %}
<li class="">
<a href="{{ menu.uri }}" >{{ menu.label|upper }}</a>
</li>
{% endfor %}
</ul>

View File

@ -0,0 +1,27 @@
{% extends 'ChillPersonBundle:AccompanyingCourse:layout.html.twig' %}
{% block title %}
{{ 'Edit Accompanying Course'|trans }}
{% endblock %}
{% block content %}
<h1>{{ block('title') }}</h1>
<pre>
{{ 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 }} | <a href="{{ path('chill_person_accompanying_period_list', { person_id: p.person.id }) }}">{{ p.person.fullnamecanonical }}</a> | {{ p.startdate|format_date('short') }} | {{ p.enddate|format_date('short') }}
{% endfor %}
</pre>
{{ dump() }}
{% endblock %}

View File

@ -18,7 +18,7 @@
<th class="chill-orange">{{ 'Remark'|trans }}</th> <th class="chill-orange">{{ 'Remark'|trans }}</th>
<th>&nbsp;</th> <th>&nbsp;</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for accompanying_period in accompanying_periods %} {% for accompanying_period in accompanying_periods %}
@ -27,7 +27,7 @@
{% if accompanying_period.closingDate == null %} {% if accompanying_period.closingDate == null %}
{{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': accompanying_period.openingDate|format_date('long') } ) }} {{ 'accompanying_period.dates_from_%opening_date%'|trans({ '%opening_date%': accompanying_period.openingDate|format_date('long') } ) }}
{% else %} {% else %}
{{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({ {{ 'accompanying_period.dates_from_%opening_date%_to_%closing_date%'|trans({
'%opening_date%': accompanying_period.openingDate|format_date('long'), '%opening_date%': accompanying_period.openingDate|format_date('long'),
'%closing_date%': accompanying_period.closingDate|format_date('long')} '%closing_date%': accompanying_period.closingDate|format_date('long')}
) }} ) }}
@ -61,6 +61,12 @@
</td> </td>
<td> <td>
<ul class="record_actions"> <ul class="record_actions">
{# TODO if enable_accompanying_course_with_multiple_persons is true ... #}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': accompanying_period.id }) }}" class="sc-button bt-show"></a>
</li>
<li> <li>
<a href="{{ path('chill_person_accompanying_period_update', {'person_id' : person.id, 'period_id' : accompanying_period.id } ) }}" class="sc-button bt-update no-content"></a> <a href="{{ path('chill_person_accompanying_period_update', {'person_id' : person.id, 'period_id' : accompanying_period.id } ) }}" class="sc-button bt-update no-content"></a>
</li> </li>
@ -79,7 +85,7 @@
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -106,7 +112,7 @@
</a> </a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
{% endblock personcontent %} {% endblock personcontent %}

View File

@ -50,11 +50,11 @@ chill_person_accompanying_period_close:
chill_person_accompanying_period_open: chill_person_accompanying_period_open:
path: /{_locale}/person/{person_id}/accompanying-period/open path: /{_locale}/person/{person_id}/accompanying-period/open
controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::openAction controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::openAction
chill_person_accompanying_period_re_open: chill_person_accompanying_period_re_open:
path: /{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open path: /{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open
controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::reOpenAction controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::reOpenAction
chill_person_address_list: chill_person_address_list:
path: /{_locale}/person/{person_id}/address/list path: /{_locale}/person/{person_id}/address/list
controller: Chill\PersonBundle\Controller\PersonAddressController::listAction controller: Chill\PersonBundle\Controller\PersonAddressController::listAction
@ -63,15 +63,15 @@ chill_person_address_create:
path: /{_locale}/person/{person_id}/address/create path: /{_locale}/person/{person_id}/address/create
controller: Chill\PersonBundle\Controller\PersonAddressController::createAction controller: Chill\PersonBundle\Controller\PersonAddressController::createAction
methods: [POST] methods: [POST]
chill_person_address_new: chill_person_address_new:
path: /{_locale}/person/{person_id}/address/new path: /{_locale}/person/{person_id}/address/new
controller: Chill\PersonBundle\Controller\PersonAddressController::newAction controller: Chill\PersonBundle\Controller\PersonAddressController::newAction
chill_person_address_edit: chill_person_address_edit:
path: /{_locale}/person/{person_id}/address/{address_id}/edit path: /{_locale}/person/{person_id}/address/{address_id}/edit
controller: Chill\PersonBundle\Controller\PersonAddressController::editAction controller: Chill\PersonBundle\Controller\PersonAddressController::editAction
chill_person_address_update: chill_person_address_update:
path: /{_locale}/person/{person_id}/address/{address_id}/update path: /{_locale}/person/{person_id}/address/{address_id}/update
controller: Chill\PersonBundle\Controller\PersonAddressController::updateAction controller: Chill\PersonBundle\Controller\PersonAddressController::updateAction
@ -84,7 +84,7 @@ chill_person_timeline:
person: person:
order: 60 order: 60
label: Timeline label: Timeline
chill_person_admin: chill_person_admin:
path: "/{_locale}/admin/person" path: "/{_locale}/admin/person"
controller: Chill\PersonBundle\Controller\AdminController::indexAction controller: Chill\PersonBundle\Controller\AdminController::indexAction
@ -135,3 +135,7 @@ chill_person_maritalstatus_admin:
admin_person: admin_person:
order: 120 order: 120
label: 'person_admin.marital status' label: 'person_admin.marital status'
chill_person_controllers:
resource: "@ChillPersonBundle/Controller"
type: annotation

View File

@ -3,18 +3,24 @@ services:
arguments: arguments:
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface' $authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
$translator: '@Symfony\Component\Translation\TranslatorInterface' $translator: '@Symfony\Component\Translation\TranslatorInterface'
tags: tags:
- { name: 'chill.menu_builder' } - { name: 'chill.menu_builder' }
Chill\PersonBundle\Menu\AdminMenuBuilder: Chill\PersonBundle\Menu\AdminMenuBuilder:
arguments: arguments:
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface' $authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
tags: tags:
- { name: 'chill.menu_builder' } - { name: 'chill.menu_builder' }
Chill\PersonBundle\Menu\PersonMenuBuilder: Chill\PersonBundle\Menu\PersonMenuBuilder:
arguments: arguments:
$showAccompanyingPeriod: '%chill_person.accompanying_period%' $showAccompanyingPeriod: '%chill_person.accompanying_period%'
$translator: '@Symfony\Contracts\Translation\TranslatorInterface' $translator: '@Symfony\Contracts\Translation\TranslatorInterface'
tags: tags:
- { name: 'chill.menu_builder' }
Chill\PersonBundle\Menu\AccompanyingCourseMenuBuilder:
arguments:
$translator: '@Symfony\Contracts\Translation\TranslatorInterface'
tags:
- { name: 'chill.menu_builder' } - { name: 'chill.menu_builder' }

View File

@ -292,3 +292,12 @@ accompanying_period:
dates_from_%opening_date%_to_%closing_date%: Ouvert du %opening_date% au %closing_date% dates_from_%opening_date%_to_%closing_date%: Ouvert du %opening_date% au %closing_date%
occasional: ponctuel occasional: ponctuel
regular: régulier regular: régulier
# Accompanying Course
Accompanying Course: Parcours d'accompagnement
Accompanying Course Details: Détails du parcours
Resume Accompanying Course: Résumé du parcours
Show Accompanying Course: Voir le parcours
Edit Accompanying Course: Modifier le parcours
Create Accompanying Course: Créer un nouveau parcours
Drop Accompanying Course: Supprimer le parcours