diff --git a/app/frontend/src/javascript/components/events/event-form.tsx b/app/frontend/src/javascript/components/events/event-form.tsx index 0d8c0b81b..209f17553 100644 --- a/app/frontend/src/javascript/components/events/event-form.tsx +++ b/app/frontend/src/javascript/components/events/event-form.tsx @@ -100,6 +100,9 @@ export const EventForm: React.FC = ({ action, event, onError, on * Callback triggered when the user validates the machine form: handle create or update */ const onSubmit: SubmitHandler = (data: Event) => { + if (data.pre_registration_end_date.toString() === 'Invalid Date') { + data.pre_registration_end_date = null; + } if (action === 'update') { if (event?.recurrence_events?.length > 0) { setUpdatingEvent(data); diff --git a/app/frontend/src/javascript/controllers/events.js.erb b/app/frontend/src/javascript/controllers/events.js.erb index 7b983f7cb..3fbcd3fdf 100644 --- a/app/frontend/src/javascript/controllers/events.js.erb +++ b/app/frontend/src/javascript/controllers/events.js.erb @@ -303,7 +303,8 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', ' $scope.now.isBefore($scope.eventEndDateTime) && helpers.isUserValidatedByType($scope.ctrl.member, $scope.settings, 'event'); if ($scope.event.pre_registration) { - return bookable && $scope.event.pre_registration_end_date && $scope.now.isSameOrBefore($scope.event.pre_registration_end_date, 'day'); + const endDate = $scope.event.pre_registration_end_date || $scope.event.end_date + return bookable && $scope.now.isSameOrBefore(endDate, 'day'); } else { return bookable; } diff --git a/app/frontend/templates/events/show.html b/app/frontend/templates/events/show.html index 421ec4aa6..bc6138d30 100644 --- a/app/frontend/templates/events/show.html +++ b/app/frontend/templates/events/show.html @@ -75,6 +75,7 @@
{{ 'app.public.events_show.event_type.nominative' }} {{ 'app.public.events_show.event_type.family' }} + {{ 'app.public.events_show.pre_registration' }}
diff --git a/config/locales/app.public.en.yml b/config/locales/app.public.en.yml index a1adeb107..07345c9b4 100644 --- a/config/locales/app.public.en.yml +++ b/config/locales/app.public.en.yml @@ -371,6 +371,7 @@ en: last_name_and_first_name: "Last name and first name" pre_book: "Pre-book" pre_registration_end_date: "Pre-registration end date" + pre_registration: "Pre-registration" #public calendar calendar: calendar: "Calendar" diff --git a/config/locales/app.public.fr.yml b/config/locales/app.public.fr.yml index d51500525..879bdfd68 100644 --- a/config/locales/app.public.fr.yml +++ b/config/locales/app.public.fr.yml @@ -371,6 +371,7 @@ fr: last_name_and_first_name: "Nom et prénom" pre_book: "Pré-réserver" pre_registration_end_date: "Date de fin de pré-réservation" + pre_registration: "Pré-réservation" #public calendar calendar: calendar: "Calendrier"