From f214ed933a5cf052cf7a18db21d4a4f1ac8b9811 Mon Sep 17 00:00:00 2001 From: SanoferSameera Date: Tue, 11 Jun 2024 17:37:44 +0530 Subject: [PATCH 1/2] BAH-3760 | Fix. warning popup shouldn't be displayed after successful save --- .../components/AddAppointment/AddAppointment.jsx | 6 ++++-- .../EditAppointment/EditAppointment.jsx | 6 ++++-- .../containers/AppointmentContainer.jsx | 16 ++++++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ui/react-components/components/AddAppointment/AddAppointment.jsx b/ui/react-components/components/AddAppointment/AddAppointment.jsx index 59e02f08b..421c3cae0 100644 --- a/ui/react-components/components/AddAppointment/AddAppointment.jsx +++ b/ui/react-components/components/AddAppointment/AddAppointment.jsx @@ -72,7 +72,7 @@ import Notification from "../Notifications/Notifications.jsx"; const AddAppointment = props => { - const {appConfig, intl, appointmentParams, currentProvider, urlParams } = props; + const {appConfig, intl, appointmentParams, currentProvider, urlParams, setIsAppointmentModalOpen } = props; const {setViewDate} = React.useContext(AppContext); const errorTranslations = getErrorTranslations(intl); @@ -345,6 +345,7 @@ const AddAppointment = props => { const date = startDate ? moment(startDate) : moment(); setViewDate(date.startOf('day').toDate()) setShowSuccessPopup(true); + setIsAppointmentModalOpen(false); reInitialiseComponent(); }; @@ -874,7 +875,8 @@ AddAppointment.propTypes = { appConfig: PropTypes.object, appointmentParams: PropTypes.object, currentProvider: PropTypes.object, - urlParams: PropTypes.object + urlParams: PropTypes.object, + setIsAppointmentModalOpen: PropTypes.func }; export const isVirtual = (appt) => { diff --git a/ui/react-components/components/EditAppointment/EditAppointment.jsx b/ui/react-components/components/EditAppointment/EditAppointment.jsx index 21480f9c2..7f19bab31 100644 --- a/ui/react-components/components/EditAppointment/EditAppointment.jsx +++ b/ui/react-components/components/EditAppointment/EditAppointment.jsx @@ -69,7 +69,7 @@ import Notification from "../Notifications/Notifications.jsx"; const EditAppointment = props => { - const {appConfig, appointmentUuid, isRecurring, intl, currentProvider} = props; + const {appConfig, appointmentUuid, isRecurring, intl, currentProvider, setIsAppointmentModalOpen } = props; const {setViewDate} = React.useContext(AppContext); @@ -320,6 +320,7 @@ const EditAppointment = props => { const date = startDate ? moment(startDate) : moment(); setViewDate(date.startOf('day').toDate()) setShowUpdateSuccessPopup(true); + setIsAppointmentModalOpen(false); }; const isRescheduled = function (appointmentTimeBeforeEdit) { @@ -811,7 +812,8 @@ EditAppointment.propTypes = { appConfig: PropTypes.object, appointmentUuid: PropTypes.string.isRequired, isRecurring: PropTypes.string.isRequired, - currentProvider: PropTypes.object + currentProvider: PropTypes.object, + setIsAppointmentModalOpen: PropTypes.func }; export default injectIntl(EditAppointment); diff --git a/ui/react-components/containers/AppointmentContainer.jsx b/ui/react-components/containers/AppointmentContainer.jsx index a32d58c34..fc9027264 100644 --- a/ui/react-components/containers/AppointmentContainer.jsx +++ b/ui/react-components/containers/AppointmentContainer.jsx @@ -20,7 +20,11 @@ class AppointmentContainer extends Component { locale: getLocale() === 'pt_BR' ? 'pt-BR': getLocale(), messages: translations[props.locale], appConfig: null, + isAppointmentModalOpen: true }; + + this.setIsAppointmentModalOpen = this.setIsAppointmentModalOpen.bind(this); + (async () => { this.setState({messages: await getMessages(getLocale())}); this.setState({appConfig: await getAppConfig()}); @@ -28,18 +32,22 @@ class AppointmentContainer extends Component { moment.locale(getLocale() === 'pt_BR' ? 'pt-BR': getLocale()); } + setIsAppointmentModalOpen(isOpen) { + this.setState({ isAppointmentModalOpen: isOpen }); + }; + render() { - const { locale, messages, appConfig } = this.state; + const { locale, messages, appConfig, isAppointmentModalOpen } = this.state; const {appointmentUuid,isRecurring, setViewDate, onBack, appointmentParams, currentProvider, urlParams, editConflict, resetEditConflict} = this.props; return (
{appointmentUuid - ? - : + ? + : } - { editConflict && } + { isAppointmentModalOpen && editConflict && }
); From de7e44a5af379f24d31e0c13744704107b73d360 Mon Sep 17 00:00:00 2001 From: SanoferSameera Date: Tue, 11 Jun 2024 18:34:46 +0530 Subject: [PATCH 2/2] BAH-3760 | Fix. test failure --- .../components/AddAppointment/AddAppointment.test.jsx | 4 ++-- .../components/EditAppointment/EditAppointment.spec.jsx | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/react-components/components/AddAppointment/AddAppointment.test.jsx b/ui/react-components/components/AddAppointment/AddAppointment.test.jsx index d83b638d7..2fc5a26b9 100644 --- a/ui/react-components/components/AddAppointment/AddAppointment.test.jsx +++ b/ui/react-components/components/AddAppointment/AddAppointment.test.jsx @@ -623,7 +623,7 @@ describe('Add appointment with appointment request enabled', () => { it('should update the appointment status and provider responses if the AppointmentRequest is Enabled', async () => { const {container, queryAllByText, getByText, getByTestId, queryByText} = renderWithReactIntl( - + ); @@ -649,7 +649,7 @@ describe('Add appointment with appointment request enabled', () => { it('should update the appointment status as Scheduled when current provider is part of appointment', async () => { const {container, getByTestId, getByText, queryByText} = renderWithReactIntl( - + ); diff --git a/ui/react-components/components/EditAppointment/EditAppointment.spec.jsx b/ui/react-components/components/EditAppointment/EditAppointment.spec.jsx index f5e7a37a0..b71a6d639 100644 --- a/ui/react-components/components/EditAppointment/EditAppointment.spec.jsx +++ b/ui/react-components/components/EditAppointment/EditAppointment.spec.jsx @@ -537,7 +537,7 @@ describe('Edit appointment with appointment request enabled', () => { const {container, getByText, queryByText, getByTestId} = renderWithReactIntl( renderWithReactIntl(); + isRecurring="false" currentProvider={currentProvider} setIsAppointmentModalOpen={jest.fn()}/>); ); @@ -571,7 +571,7 @@ describe('Edit appointment with appointment request enabled', () => { const {container, getByText, queryByText, getByTestId} = renderWithReactIntl( renderWithReactIntl(); + isRecurring="false" currentProvider={currentProvider} setIsAppointmentModalOpen={jest.fn()} />); ); @@ -604,7 +604,7 @@ describe('Edit appointment with appointment request enabled', () => { const {container, getByText, queryByText, getByTestId} = renderWithReactIntl( renderWithReactIntl(); + isRecurring="false" currentProvider={currentProvider} setIsAppointmentModalOpen={jest.fn()} />); ); @@ -644,7 +644,7 @@ describe('Edit appointment with appointment request enabled', () => { renderWithReactIntl(); + isRecurring="false" currentProvider={currentProvider} currentProvider={currentProvider} setIsAppointmentModalOpen={jest.fn()} />); ); getByTextInDom = getByText;