Skip to content

Commit

Permalink
fix(O3-3137) : Remove the cancelled Appointments in patient dashboard (
Browse files Browse the repository at this point in the history
  • Loading branch information
senthil-athiban authored May 3, 2024
1 parent a22efef commit dcbfb22
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const AppointmentsTable: React.FC<AppointmentsTableProps> = ({ appointments, isL
const { visits } = useTodaysVisits();
const layout = useLayoutType();
const responsiveSize = isDesktop(layout) ? 'sm' : 'lg';

const headerData = [
{
header: t('patientName', 'Patient name'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,26 @@ interface AppointmentsListProps {
status?: string;
title: string;
date: string;
filterCancelled?: boolean;
}
const AppointmentsList: React.FC<AppointmentsListProps> = ({ appointmentServiceType, status, title, date }) => {
const AppointmentsList: React.FC<AppointmentsListProps> = ({
appointmentServiceType,
status,
title,
date,
filterCancelled = false,
}) => {
const { appointmentList, isLoading } = useAppointmentList(status, date);

const appointments = filterByServiceType(appointmentList, appointmentServiceType).map((appointment) => ({
id: appointment.uuid,
...appointment,
}));

return <AppointmentsTable appointments={appointments} isLoading={isLoading} tableHeading={title} />;
const activeAppointments = filterCancelled
? appointments.filter((appointment) => appointment.status !== 'Cancelled')
: appointments;
return <AppointmentsTable appointments={activeAppointments} isLoading={isLoading} tableHeading={title} />;
};

export default AppointmentsList;
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const HomeAppointments = () => {

return (
<div className={styles.container}>
<AppointmentsList date={toOmrsIsoString(dayjs().startOf('day').toDate())} title={t('todays', "Today's")} />
<AppointmentsList
date={toOmrsIsoString(dayjs().startOf('day').toDate())}
title={t('todays', "Today's")}
filterCancelled={true}
/>
<Overlay />
</div>
);
Expand Down

0 comments on commit dcbfb22

Please sign in to comment.