1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

(bug) cannot save pre registration end date is empty

This commit is contained in:
Du Peng 2023-06-28 12:05:02 +02:00
parent 26cf72a846
commit 83ced44741
5 changed files with 8 additions and 1 deletions

View File

@ -100,6 +100,9 @@ export const EventForm: React.FC<EventFormProps> = ({ action, event, onError, on
* Callback triggered when the user validates the machine form: handle create or update * Callback triggered when the user validates the machine form: handle create or update
*/ */
const onSubmit: SubmitHandler<Event> = (data: Event) => { const onSubmit: SubmitHandler<Event> = (data: Event) => {
if (data.pre_registration_end_date.toString() === 'Invalid Date') {
data.pre_registration_end_date = null;
}
if (action === 'update') { if (action === 'update') {
if (event?.recurrence_events?.length > 0) { if (event?.recurrence_events?.length > 0) {
setUpdatingEvent(data); setUpdatingEvent(data);

View File

@ -303,7 +303,8 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
$scope.now.isBefore($scope.eventEndDateTime) && $scope.now.isBefore($scope.eventEndDateTime) &&
helpers.isUserValidatedByType($scope.ctrl.member, $scope.settings, 'event'); helpers.isUserValidatedByType($scope.ctrl.member, $scope.settings, 'event');
if ($scope.event.pre_registration) { 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 { } else {
return bookable; return bookable;
} }

View File

@ -75,6 +75,7 @@
<div> <div>
<span ng-if="event.event_type === 'nominative'" class="v-middle badge text-base bg-event" translate="">{{ 'app.public.events_show.event_type.nominative' }}</span> <span ng-if="event.event_type === 'nominative'" class="v-middle badge text-base bg-event" translate="">{{ 'app.public.events_show.event_type.nominative' }}</span>
<span ng-if="event.event_type === 'family'" class="v-middle badge text-base bg-event" translate="">{{ 'app.public.events_show.event_type.family' }}</span> <span ng-if="event.event_type === 'family'" class="v-middle badge text-base bg-event" translate="">{{ 'app.public.events_show.event_type.family' }}</span>
<span ng-if="event.pre_registration" class="v-middle badge text-base bg-info" translate="">{{ 'app.public.events_show.pre_registration' }}</span>
</div> </div>
<dl class="text-sm"> <dl class="text-sm">

View File

@ -371,6 +371,7 @@ en:
last_name_and_first_name: "Last name and first name" last_name_and_first_name: "Last name and first name"
pre_book: "Pre-book" pre_book: "Pre-book"
pre_registration_end_date: "Pre-registration end date" pre_registration_end_date: "Pre-registration end date"
pre_registration: "Pre-registration"
#public calendar #public calendar
calendar: calendar:
calendar: "Calendar" calendar: "Calendar"

View File

@ -371,6 +371,7 @@ fr:
last_name_and_first_name: "Nom et prénom" last_name_and_first_name: "Nom et prénom"
pre_book: "Pré-réserver" pre_book: "Pré-réserver"
pre_registration_end_date: "Date de fin de pré-réservation" pre_registration_end_date: "Date de fin de pré-réservation"
pre_registration: "Pré-réservation"
#public calendar #public calendar
calendar: calendar:
calendar: "Calendrier" calendar: "Calendrier"