diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php index 92db8efc6..37208c754 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php @@ -115,46 +115,29 @@ class CalendarController extends AbstractController } #[Route(path: '/{_locale}/calendar/calendar/{id}/cancel', name: 'chill_calendar_calendar_cancel')] + public function cancelAction(Calendar $calendar, Request $request): Response { $this->denyAccessUnlessGranted(CalendarVoter::EDIT, $calendar); [$person, $accompanyingPeriod] = [$calendar->getPerson(), $calendar->getAccompanyingPeriod()]; - $form = $this->createForm(CancelType::class, $calendar); - $form->add('submit', SubmitType::class); - if ($accompanyingPeriod instanceof AccompanyingPeriod) { $view = '@ChillCalendar/Calendar/cancelCalendarByAccompanyingCourse.html.twig'; - $redirectRoute = $this->generateUrl('chill_calendar_calendar_list_by_period', ['id' => $accompanyingPeriod->getId()]); +// $redirectRoute = $this->generateUrl('chill_calendar_calendar_list_by_period', ['id' => $accompanyingPeriod->getId()]); } elseif ($person instanceof Person) { $view = '@ChillCalendar/Calendar/cancelCalendarByPerson.html.twig'; - $redirectRoute = $this->generateUrl('chill_calendar_calendar_list_by_person', ['id' => $person->getId()]); +// $redirectRoute = $this->generateUrl('chill_calendar_calendar_list_by_person', ['id' => $person->getId()]); } else { throw new \RuntimeException('nor person or accompanying period'); } - $form->handleRequest($request); + // Cancellation form - if ($form->isSubmitted() && $form->isValid()) { - - $this->logger->notice('A calendar event has been cancelled', [ - 'by_user' => $this->getUser()->getUsername(), - 'calendar_id' => $calendar->getId(), - ]); - - $calendar->setStatus($calendar::STATUS_CANCELED); - $calendar->setSmsStatus($calendar::SMS_CANCEL_PENDING); - $this->em->flush(); - - $this->addFlash('success', $this->translator->trans('chill_calendar.calendar_canceled')); - - return new RedirectResponse($redirectRoute); - } return $this->render($view, [ 'calendar' => $calendar, - 'form' => $form->createView(), +// 'delete_form' => $form->createView(), 'accompanyingCourse' => $accompanyingPeriod, 'person' => $person, ]); diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/_list.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/_list.html.twig index dd24c875f..167341c23 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/_list.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/_list.html.twig @@ -235,7 +235,10 @@ class="btn btn-remove">{{ 'cancel'|trans }} {% endif %} - +
  • + {{ 'cancel'|trans }} +
  • {% if is_granted('CHILL_CALENDAR_CALENDAR_DELETE', calendar) %}
  • -
  • - - {{ 'Cancel'|trans|chill_return_path_label }} - -
  • -
  • - {{ form_widget(form.submit, { 'attr' : { 'class': 'btn btn-save' }, 'label': 'Save' } ) }} -
  • - - - {{ form_end(form) }} - -{% endblock %} diff --git a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/cancelCalendarByPerson.html.twig b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/cancelCalendarByPerson.html.twig index d6f71cc13..b3db97e0f 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/cancelCalendarByPerson.html.twig +++ b/src/Bundle/ChillCalendarBundle/Resources/views/Calendar/cancelCalendarByPerson.html.twig @@ -3,27 +3,3 @@ {% set activeRouteKey = 'chill_calendar_calendar_list' %} {% block title 'chill_calendar.cancel_calendar_item'|trans %} - -{% block content %} - - {{ form_start(form) }} - - {{ form_row(form.cancelReason) }} - - - - {{ form_end(form) }} - -{% endblock %} diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index 5e7c58bb4..e35a46d97 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -45,7 +45,6 @@ crud: chill_calendar: cancel_calendar_item: Annuler rendez-vous - calendar_canceled: Le rendez-vous a été annulé Document: Document d'un rendez-vous form: The main user is mandatory. He will organize the appointment.: L'utilisateur principal est obligatoire. Il est l'organisateur de l'événement. @@ -67,8 +66,6 @@ chill_calendar: Remove a calendar document: Supprimer un document d'un rendez-vous Are you sure you want to remove the doc?: Êtes-vous sûr·e de vouloir supprimer le document associé ? Document outdated: La date et l'heure du rendez-vous ont été modifiés après la création du document - cancel_reason: Raison d'annulation - canceled: Annulé remote_ms_graph: freebusy_statuses: