accompanying course: re-open: translations + fine-tuning

This commit is contained in:
nobohan 2022-01-20 08:21:09 +01:00
parent d4efe81dbb
commit 343b2a6f2f
4 changed files with 13 additions and 36 deletions

View File

@ -282,51 +282,26 @@ class AccompanyingCourseController extends Controller
*/
public function reOpenAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response
{
//$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $accompanyingCourse);
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $accompanyingCourse);
// $form = $this->createForm(AccompanyingCourseType::class, $accompanyingCourse, [
// 'validation_groups' => [AccompanyingPeriod::STEP_CLOSED],
// ]);
if (null === $accompanyingCourse) {
throw $this->createNotFoundException('period not found');
}
$form = $this->createFormBuilder([])->getForm();
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$accompanyingCourse->reOpen();
$em->flush();
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('chill_person_accompanying_course_index', [
'accompanying_period_id' => $accompanyingCourse->getId(),
]);
//TODO: delete motif de cloture and date de cloture (NULL)
//TODO: which redirection?
//TODO workflow stuff?
//TODO: error handling
// $workflow = $this->registry->get($accompanyingCourse);
// if ($workflow->can($accompanyingCourse, 'close')) {
// $workflow->apply($accompanyingCourse, 'close');
// $em->flush();
// return $this->redirectToRoute('chill_person_accompanying_course_index', [
// 'accompanying_period_id' => $accompanyingCourse->getId(),
// ]);
// }
// /** @var ConstraintViolationListInterface $errors */
// $errors = $this->validator->validate($accompanyingCourse, null, [$accompanyingCourse::STEP_CLOSED]);
// $this->addFlash('error', $this->translator->trans('It is not possible to close this course'));
// foreach ($errors as $e) {
// /** @var ConstraintViolationInterface $e */
// $this->addFlash('error', $e->getMessage());
// }
}
return $this->render('@ChillPerson/AccompanyingCourse/reopen.html.twig', [
return $this->render('@ChillPerson/AccompanyingCourse/re_open.html.twig', [
'form' => $form->createView(),
'accompanyingCourse' => $accompanyingCourse,
]);

View File

@ -83,7 +83,7 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
$workflow = $this->registry->get($period, 'accompanying_period_lifecycle');
if (null !== $period->getClosingDate()) {
$menu->addChild($this->translator->trans('Re-open Accompanying Course'), [
$menu->addChild($this->translator->trans('Re-open accompanying course'), [
'route' => 'chill_person_accompanying_course_reopen',
'routeParameters' => [
'accompanying_period_id' => $period->getId(),

View File

@ -1,9 +1,11 @@
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
{% block title %}{{ 'Reopen accompanying course'|trans }}{% endblock %}
{% block title 'Re-Open a period'|trans %}
{% block content %}
<h1>{{ "Reopen accompanying course"|trans }}</h1>
<h1>{{ "Re-Open a period"|trans }}</h1>
<p class="message-confirm">{{ 'Are you sure you want to re-open this period ?'|trans }}<p>
{{ form_start(form) }}

View File

@ -170,7 +170,7 @@ Update accompanying period: Mettre à jour une période d'accompagnement
"Period not opened : form is invalid": "La période n'a pas été ouverte: le formulaire est invalide."
'Closing motive': 'Motif de clôture'
Close accompanying course: Clôturer le parcours
Re-open Accompanying Course: Ré-ouvrir le parcours
Re-open accompanying course: Ré-ouvrir le parcours
'Person details': 'Détails de la personne'
'Update details for %name%': 'Modifier détails de %name%'
An accompanying period ends: Une periode d'accompagnement se clôture