mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
accompanying course: re-open: translations + fine-tuning
This commit is contained in:
parent
d4efe81dbb
commit
343b2a6f2f
@ -282,51 +282,26 @@ class AccompanyingCourseController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function reOpenAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response
|
public function reOpenAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response
|
||||||
{
|
{
|
||||||
//$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $accompanyingCourse);
|
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $accompanyingCourse);
|
||||||
|
|
||||||
// $form = $this->createForm(AccompanyingCourseType::class, $accompanyingCourse, [
|
if (null === $accompanyingCourse) {
|
||||||
// 'validation_groups' => [AccompanyingPeriod::STEP_CLOSED],
|
throw $this->createNotFoundException('period not found');
|
||||||
// ]);
|
}
|
||||||
|
|
||||||
$form = $this->createFormBuilder([])->getForm();
|
$form = $this->createFormBuilder([])->getForm();
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$em = $this->getDoctrine()->getManager();
|
|
||||||
|
|
||||||
$accompanyingCourse->reOpen();
|
$accompanyingCourse->reOpen();
|
||||||
$em->flush();
|
$this->getDoctrine()->getManager()->flush();
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_person_accompanying_course_index', [
|
return $this->redirectToRoute('chill_person_accompanying_course_index', [
|
||||||
'accompanying_period_id' => $accompanyingCourse->getId(),
|
'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(),
|
'form' => $form->createView(),
|
||||||
'accompanyingCourse' => $accompanyingCourse,
|
'accompanyingCourse' => $accompanyingCourse,
|
||||||
]);
|
]);
|
||||||
|
@ -83,7 +83,7 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
$workflow = $this->registry->get($period, 'accompanying_period_lifecycle');
|
$workflow = $this->registry->get($period, 'accompanying_period_lifecycle');
|
||||||
|
|
||||||
if (null !== $period->getClosingDate()) {
|
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',
|
'route' => 'chill_person_accompanying_course_reopen',
|
||||||
'routeParameters' => [
|
'routeParameters' => [
|
||||||
'accompanying_period_id' => $period->getId(),
|
'accompanying_period_id' => $period->getId(),
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
|
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
|
||||||
|
|
||||||
{% block title %}{{ 'Reopen accompanying course'|trans }}{% endblock %}
|
{% block title 'Re-Open a period'|trans %}
|
||||||
|
|
||||||
{% block content %}
|
{% 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) }}
|
{{ form_start(form) }}
|
||||||
|
|
@ -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."
|
"Period not opened : form is invalid": "La période n'a pas été ouverte: le formulaire est invalide."
|
||||||
'Closing motive': 'Motif de clôture'
|
'Closing motive': 'Motif de clôture'
|
||||||
Close accompanying course: Clôturer le parcours
|
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'
|
'Person details': 'Détails de la personne'
|
||||||
'Update details for %name%': 'Modifier détails de %name%'
|
'Update details for %name%': 'Modifier détails de %name%'
|
||||||
An accompanying period ends: Une periode d'accompagnement se clôture
|
An accompanying period ends: Une periode d'accompagnement se clôture
|
||||||
|
Loading…
x
Reference in New Issue
Block a user