diff --git a/packages/telemed-ehr/app/src/components/AppointmentStatusSwitcher.tsx b/packages/telemed-ehr/app/src/components/AppointmentStatusSwitcher.tsx index be31fdf6..049cd51a 100644 --- a/packages/telemed-ehr/app/src/components/AppointmentStatusSwitcher.tsx +++ b/packages/telemed-ehr/app/src/components/AppointmentStatusSwitcher.tsx @@ -8,7 +8,6 @@ import { getPatchBinary, getStatusFromExtension } from 'ehr-utils'; import { VisitStatus, STATI } from '../helpers/mappingUtils'; import { useApiClients } from '../hooks/useAppClients'; import { getAppointmentStatusChip } from './AppointmentTableRow'; -import { Box } from '@mui/system'; const statuses = STATI; @@ -113,7 +112,7 @@ export default function AppointmentStatusSwitcher({ }} > {statuses - .filter((status) => status !== 'unknown') + .filter((status) => status !== 'unknown' && status !== 'cancelled') .map((status) => ( {getAppointmentStatusChip(status)} diff --git a/packages/telemed-ehr/app/src/telemed/components/CancelVisitDialog.tsx b/packages/telemed-ehr/app/src/telemed/components/CancelVisitDialog.tsx index 5ff664ba..920a45e9 100644 --- a/packages/telemed-ehr/app/src/telemed/components/CancelVisitDialog.tsx +++ b/packages/telemed-ehr/app/src/telemed/components/CancelVisitDialog.tsx @@ -21,7 +21,7 @@ import { telemedCancellationReasons, inPersonCancellationReasons } from '../../t interface CancelVisitDialogProps { onClose: () => void; - appointmentType: 'telemed' | 'in-person'; + appointmentType: 'telemedicine' | 'in-person'; } const CancelVisitDialog = ({ onClose, appointmentType }: CancelVisitDialogProps): ReactElement => { @@ -33,7 +33,8 @@ const CancelVisitDialog = ({ onClose, appointmentType }: CancelVisitDialogProps) const { id: appointmentID } = useParams(); const navigate = useNavigate(); - const cancellationReasons = appointmentType === 'telemed' ? telemedCancellationReasons : inPersonCancellationReasons; + const cancellationReasons = + appointmentType === 'telemedicine' ? telemedCancellationReasons : inPersonCancellationReasons; const handleReasonChange = (event: SelectChangeEvent): void => { setReason(event.target.value); @@ -56,7 +57,7 @@ const CancelVisitDialog = ({ onClose, appointmentType }: CancelVisitDialogProps) if (!zambdaIntakeClient) throw new Error('Zambda client not found'); try { let response; - if (appointmentType === 'telemed') { + if (appointmentType === 'telemedicine') { console.log('canceling telemed appointment', appointmentID, reason, otherReason); response = await cancelTelemedAppointment(zambdaIntakeClient, { appointmentID: appointmentID || '', @@ -76,7 +77,7 @@ const CancelVisitDialog = ({ onClose, appointmentType }: CancelVisitDialogProps) console.error('Failed to cancel appointment', error); } finally { setIsCancelling(false); - if (appointmentType === 'telemed') { + if (appointmentType === 'telemedicine') { navigate('/telemed/appointments'); } else if (appointmentType === 'in-person') { navigate('/in-person/appointments'); diff --git a/packages/telemed-ehr/app/src/telemed/features/appointment/AppointmentSidePanel.tsx b/packages/telemed-ehr/app/src/telemed/features/appointment/AppointmentSidePanel.tsx index 8e9f030d..41f61042 100644 --- a/packages/telemed-ehr/app/src/telemed/features/appointment/AppointmentSidePanel.tsx +++ b/packages/telemed-ehr/app/src/telemed/features/appointment/AppointmentSidePanel.tsx @@ -54,7 +54,7 @@ enum Gender { } interface AppointmentSidePanelProps { - appointmentType: 'telemed' | 'in-person'; + appointmentType: 'telemedicine' | 'in-person'; } export const AppointmentSidePanel: FC = ({ appointmentType }) => { @@ -160,7 +160,7 @@ export const AppointmentSidePanel: FC = ({ appointmen - {appointmentType === 'telemed' && + {appointmentType === 'telemedicine' && getAppointmentStatusChip(mapStatusToTelemed(encounter.status, appointment?.status))} {appointment?.id && ( @@ -179,9 +179,11 @@ export const AppointmentSidePanel: FC = ({ appointmen )} - {appointmentType === 'in-person' && ( + {appointmentType === 'in-person' && isPractitionerAllowedToCancelThisVisit && ( )} + {!isPractitionerAllowedToCancelThisVisit && + getAppointmentStatusChip(mapStatusToTelemed(encounter.status, appointment?.status))} diff --git a/packages/telemed-ehr/app/src/telemed/pages/AppointmentPage.tsx b/packages/telemed-ehr/app/src/telemed/pages/AppointmentPage.tsx index a87b2fb4..2dc4e0c6 100644 --- a/packages/telemed-ehr/app/src/telemed/pages/AppointmentPage.tsx +++ b/packages/telemed-ehr/app/src/telemed/pages/AppointmentPage.tsx @@ -165,7 +165,7 @@ export const AppointmentPage: FC = () => { - + void; appointmentType: 'telemed' | 'in-person' }; +type CancelVisitDialogProps = { onClose: () => void; appointmentType: 'telemedicine' | 'in-person' }; export const CancelVisitDialog: FC = ({ onClose, appointmentType }: CancelVisitDialogProps) => { const apiClient = useZapEHRAPIClient(); @@ -29,7 +29,6 @@ export const CancelVisitDialog: FC = ({ onClose, appoint throw new Error('apiClient is not defined'); } - navigate(IntakeFlowPageRoute.PatientPortal.path); cancelAppointment.mutate( { apiClient: apiClient, @@ -47,8 +46,6 @@ export const CancelVisitDialog: FC = ({ onClose, appoint }, }, ); - - handleClose(); }; const handleClose = (): void => { diff --git a/packages/telemed-intake/app/src/features/appointments/appointment.queries.ts b/packages/telemed-intake/app/src/features/appointments/appointment.queries.ts index f2a83fdc..d1fec9f3 100644 --- a/packages/telemed-intake/app/src/features/appointments/appointment.queries.ts +++ b/packages/telemed-intake/app/src/features/appointments/appointment.queries.ts @@ -67,9 +67,9 @@ export const useCancelAppointmentMutation = () => apiClient: ZapEHRAPIClient; appointmentID: string; cancellationReason: string; - appointmentType: 'telemed' | 'in-person'; + appointmentType: 'telemedicine' | 'in-person'; }) => { - if (appointmentType === 'telemed') { + if (appointmentType === 'telemedicine') { return apiClient.cancelTelemedAppointment({ appointmentID, cancellationReason, @@ -101,7 +101,7 @@ export const useGetAppointments = (apiClient: ZapEHRAPIClient | null, enabled = onError: (err) => { console.error('Error during fetching appointments: ', err); }, - staleTime: 1000 * 60 * 5, + refetchOnMount: true, }, ); diff --git a/packages/telemed-intake/app/src/pages/PatientPortal.tsx b/packages/telemed-intake/app/src/pages/PatientPortal.tsx index dbfcc219..7bcc2535 100644 --- a/packages/telemed-intake/app/src/pages/PatientPortal.tsx +++ b/packages/telemed-intake/app/src/pages/PatientPortal.tsx @@ -3,12 +3,12 @@ import { Link } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { IntakeFlowPageRoute } from '../App'; import { otherColors } from '../IntakeThemeProvider'; -import { useGetAppointments } from '../features/appointments'; import { CustomContainer, useIntakeCommonStore } from '../features/common'; import HomepageOption from '../features/homepage/HomepageOption'; import { useZapEHRAPIClient } from '../utils'; import { requestVisit, pastVisits, contactSupport } from '@theme/icons'; import { useGetPatients, usePatientsStore } from 'src/features/patients'; +import { useGetAppointments } from 'src/features/appointments'; const PatientPortal = (): JSX.Element => { localStorage.removeItem('welcomePath'); diff --git a/packages/telemed-intake/app/src/pages/ThankYou.tsx b/packages/telemed-intake/app/src/pages/ThankYou.tsx index ecbb0b5d..0b20ac46 100644 --- a/packages/telemed-intake/app/src/pages/ThankYou.tsx +++ b/packages/telemed-intake/app/src/pages/ThankYou.tsx @@ -47,7 +47,7 @@ const ThankYou = (): JSX.Element => { {isCancelDialogOpen && ( setIsCancelDialogOpen(false)} - appointmentType={visitService as 'in-person' | 'telemed'} + appointmentType={visitService as 'in-person' | 'telemedicine'} /> )}