Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for self-healing Consultation URL #6893

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/Components/Facility/ConsultationDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ const symptomChoices = [...SYMPTOM_CHOICES];

export interface ConsultationTabProps {
consultationId: string;
facilityId: string;
patientId: string;
consultationData: ConsultationModel;
patientData: PatientModel;
}
Expand Down Expand Up @@ -120,6 +118,11 @@ export const ConsultationDetails = (props: any) => {
});
data.symptoms_text = symptoms.join(", ");
}
if (facilityId != data.facility || patientId != data.patient) {
navigate(
`/facility/${data.facility}/patient/${data.patient}/consultation/${data?.id}`
);
}
setConsultationData(data);
const assetRes = data?.current_bed?.bed_object?.id
? await dispatch(
Expand Down Expand Up @@ -153,6 +156,7 @@ export const ConsultationDetails = (props: any) => {
: "No",
is_vaccinated: patientData.is_vaccinated ? "Yes" : "No",
};

setPatientData(data);
}

Expand Down Expand Up @@ -184,8 +188,6 @@ export const ConsultationDetails = (props: any) => {

const consultationTabProps: ConsultationTabProps = {
consultationId,
facilityId,
patientId,
consultationData,
patientData,
};
Expand Down
8 changes: 2 additions & 6 deletions src/Components/Facility/Consultations/DailyRoundsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ interface Props {
}

export default function DailyRoundsList({ consultation }: Props) {
const [facilityId, patientId, consultationId] = useSlugs(
"facility",
"patient",
"consultation"
);
const [consultationId] = useSlugs("consultation");
const { t } = useTranslation();

const consultationUrl = `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`;
const consultationUrl = `/facility/${consultation.facility}/patient/${consultation.patient}/consultation/${consultation.id}`;

return (
<PaginatedList
Expand Down
3 changes: 3 additions & 0 deletions src/Routers/routes/ConsultationRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ export default {
tab={"updates"}
/>
),
"/consultation/:consultationId": ({ consultationId }: any) => (
<ConsultationDetails consultationId={consultationId} tab={"updates"} />
),
"/facility/:facilityId/patient/:patientId/consultation/:consultationId/treatment-summary":
({ facilityId, patientId, consultationId }: any) => (
<TreatmentSummary
Expand Down
Loading