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,
'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);

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

@ -61,6 +61,12 @@
</td>
<td>
<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>
<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>

View File

@ -135,3 +135,7 @@ chill_person_maritalstatus_admin:
admin_person:
order: 120
label: 'person_admin.marital status'
chill_person_controllers:
resource: "@ChillPersonBundle/Controller"
type: annotation

View File

@ -18,3 +18,9 @@ services:
$translator: '@Symfony\Contracts\Translation\TranslatorInterface'
tags:
- { name: 'chill.menu_builder' }
Chill\PersonBundle\Menu\AccompanyingCourseMenuBuilder:
arguments:
$translator: '@Symfony\Contracts\Translation\TranslatorInterface'
tags:
- { 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%
occasional: ponctuel
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