From dc1273285631f399232e51fad5d24457f494e9c9 Mon Sep 17 00:00:00 2001 From: SanttuA Date: Wed, 13 Sep 2023 15:01:00 +0300 Subject: [PATCH] Changed my reservations page reservation tags My reservations page will now show a state label when a normal paid reservation is waiting for a payment. This will indicate that the user's payment has been aborted. --- .../reservation-state-label/ReservationStateLabel.js | 5 ++++- .../ReservationStateLabel.spec.js | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/shared/reservation-state-label/ReservationStateLabel.js b/app/shared/reservation-state-label/ReservationStateLabel.js index abc8b9d34..81bf64225 100644 --- a/app/shared/reservation-state-label/ReservationStateLabel.js +++ b/app/shared/reservation-state-label/ReservationStateLabel.js @@ -7,7 +7,10 @@ import Label from 'shared/label'; import { injectT } from 'i18n'; function ReservationStateLabel({ reservation, t }) { - if (!reservation.needManualConfirmation && reservation.state !== 'cancelled') { + const states = constants.RESERVATION_STATE; + const statesToExclude = [states.CANCELLED, states.WAITING_FOR_PAYMENT]; + + if (!reservation.needManualConfirmation && !statesToExclude.includes(reservation.state)) { return ; } const { labelBsStyle, labelTextId } = constants.RESERVATION_STATE_LABELS[reservation.state]; diff --git a/app/shared/reservation-state-label/ReservationStateLabel.spec.js b/app/shared/reservation-state-label/ReservationStateLabel.spec.js index b6416109e..d70407b16 100644 --- a/app/shared/reservation-state-label/ReservationStateLabel.spec.js +++ b/app/shared/reservation-state-label/ReservationStateLabel.spec.js @@ -70,6 +70,11 @@ describe('shared/reservation-state-label/ReservationStateLabel', () => { const state = 'requested'; getTests(needManualConfirmation, state); }); + + describe('if reservation state is "waiting_for_payment"', () => { + const state = 'waiting_for_payment'; + getTests(needManualConfirmation, state); + }); }); describe('if reservation does not need manual confirmation', () => { @@ -80,6 +85,11 @@ describe('shared/reservation-state-label/ReservationStateLabel', () => { getTests(needManualConfirmation, state); }); + describe('if reservation state is "waiting_for_payment"', () => { + const state = 'waiting_for_payment'; + getTests(needManualConfirmation, state); + }); + describe('if reservation state is "confirmed"', () => { const state = 'confirmed';