Feature: [calendar] Add button to generate document immediatly after saving the calendar

This commit is contained in:
2022-10-21 10:40:51 +02:00
parent 55095ee6ac
commit 2c5fa82380
5 changed files with 30 additions and 12 deletions

View File

@@ -152,7 +152,10 @@ class CalendarController extends AbstractController
$view = '@ChillCalendar/Calendar/editByUser.html.twig';
}
$form = $this->createForm(CalendarType::class, $entity);
$form = $this->createForm(CalendarType::class, $entity)
->add('save', SubmitType::class)
->add('save_and_create_doc', SubmitType::class);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
@@ -162,6 +165,10 @@ class CalendarController extends AbstractController
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
if ($form->get('save_and_create_doc')->isClicked()) {
return $this->redirectToRoute('chill_calendar_calendardoc_pick_template', ['id' => $entity->getId()]);
}
return $this->redirectToRoute('chill_calendar_calendar_list_by_period', $params);
}
@@ -277,7 +284,10 @@ class CalendarController extends AbstractController
$entity->setAccompanyingPeriod($accompanyingPeriod);
}
$form = $this->createForm(CalendarType::class, $entity);
$form = $this->createForm(CalendarType::class, $entity)
->add('save', SubmitType::class)
->add('save_and_create_doc', SubmitType::class);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
@@ -288,6 +298,10 @@ class CalendarController extends AbstractController
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
if ($form->get('save_and_create_doc')->isClicked()) {
return $this->redirectToRoute('chill_calendar_calendardoc_pick_template', ['id' => $entity->getId()]);
}
return $this->redirectToRoute('chill_calendar_calendar_list_by_period', $params);
}