From d5fa71e1130adc3bdc4faa70c1868d237569d5b5 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Tue, 25 Jul 2023 18:53:12 +0200 Subject: [PATCH] (bug) event pre-registration status --- .../components/events/event-reservation-item.tsx | 15 +++++++++++---- app/frontend/src/javascript/models/reservation.ts | 3 ++- config/locales/app.logged.en.yml | 3 +++ config/locales/app.logged.fr.yml | 3 +++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/frontend/src/javascript/components/events/event-reservation-item.tsx b/app/frontend/src/javascript/components/events/event-reservation-item.tsx index 12b619fae..b186fd508 100644 --- a/app/frontend/src/javascript/components/events/event-reservation-item.tsx +++ b/app/frontend/src/javascript/components/events/event-reservation-item.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { react2angular } from 'react2angular'; +import _ from 'lodash'; import { Reservation } from '../../models/reservation'; import FormatLib from '../../lib/format'; import { IApplication } from '../../models/application'; @@ -44,14 +45,20 @@ export const EventReservationItem: React.FC = ({ rese * Return the pre-registration status */ const preRegistrationStatus = () => { - if (!reservation.is_valid && !reservation.canceled_at && !reservation.is_paid) { + if (!_.isBoolean(reservation.is_valid) && !reservation.canceled_at && !reservation.is_paid) { return t('app.logged.event_reservation_item.in_the_process_of_validation'); - } else if (reservation.is_valid && !reservation.canceled_at && !reservation.is_paid) { + } else if (reservation.is_valid && !reservation.canceled_at && !reservation.is_paid && reservation.reservable.amount !== 0) { return t('app.logged.event_reservation_item.settle_your_payment'); - } else if (reservation.is_paid && !reservation.canceled_at) { + } else if (reservation.is_valid && !reservation.canceled_at && !reservation.is_paid && reservation.reservable.amount === 0) { + return t('app.logged.event_reservation_item.registered'); + } else if (!reservation.is_valid && !reservation.canceled_at) { + return t('app.logged.event_reservation_item.not_validated'); + } else if (reservation.is_paid && !reservation.canceled_at && reservation.reservable.amount !== 0) { return t('app.logged.event_reservation_item.paid'); + } else if (reservation.is_paid && !reservation.canceled_at && reservation.reservable.amount === 0) { + return t('app.logged.event_reservation_item.present'); } else if (reservation.canceled_at) { - return t('app.logged.event_reservation_item.paid'); + return t('app.logged.event_reservation_item.canceled'); } }; diff --git a/app/frontend/src/javascript/models/reservation.ts b/app/frontend/src/javascript/models/reservation.ts index 7f2d7d415..dca86afa8 100644 --- a/app/frontend/src/javascript/models/reservation.ts +++ b/app/frontend/src/javascript/models/reservation.ts @@ -27,7 +27,8 @@ export interface Reservation { slots_reservations_attributes: Array, reservable?: { id: number, - name: string + name: string, + amount?: number }, nb_reserve_places?: number, tickets_attributes?: Array<{ diff --git a/config/locales/app.logged.en.yml b/config/locales/app.logged.en.yml index 8698bc923..125ca1b45 100644 --- a/config/locales/app.logged.en.yml +++ b/config/locales/app.logged.en.yml @@ -49,6 +49,9 @@ en: settle_your_payment: "Come to the reception desk to settle" paid: "Paid" canceled: "Canceled" + registered: "Registered" + not_validated: "Not validated" + present: "Present" dashboard: #dashboard: public profile profile: diff --git a/config/locales/app.logged.fr.yml b/config/locales/app.logged.fr.yml index f9a41a3e9..226196459 100644 --- a/config/locales/app.logged.fr.yml +++ b/config/locales/app.logged.fr.yml @@ -49,6 +49,9 @@ fr: settle_your_payment: "Venez régler à l'accueil" paid: "Payé" canceled: "Annulé" + registered: "Inscrit" + not_validated: "Non validé" + present: "Présent" dashboard: #dashboard: public profile profile: