Skip to content

Commit

Permalink
Support for self-healing Consultation URL (#6893)
Browse files Browse the repository at this point in the history
* added newRoute consultation/:id

* fix based on review

* minor fix

* minor fix
  • Loading branch information
konavivekramakrishna authored and Ashesh3 committed Jan 2, 2024
1 parent be3b082 commit 31e65a7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
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

0 comments on commit 31e65a7

Please sign in to comment.