From bcbafd1c619928894c723c7515c45f3802534fdb Mon Sep 17 00:00:00 2001 From: renoseHarsh Date: Fri, 9 Aug 2024 18:09:07 +0530 Subject: [PATCH 1/4] Modified --- src/Common/constants.tsx | 6 +- .../CriticalCare__Index.res | 2 +- .../ConsultationUpdatesTab.tsx | 2 +- .../ConsultationDetails/Events/EventsList.tsx | 87 ++++++++++--------- .../Notifications/NotificationsList.tsx | 20 ++++- .../Patient/DailyRoundListDetails.tsx | 3 +- 6 files changed, 71 insertions(+), 49 deletions(-) diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 2bfecf94395..ec537f672aa 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -587,7 +587,7 @@ export const NOTIFICATION_EVENTS: NotificationEvent[] = [ }, { id: "PATIENT_CONSULTATION_UPDATED", - text: "Patient Consultation Updated", + text: "Patient Log Updated", icon: "l-heart-medical", }, { @@ -612,12 +612,12 @@ export const NOTIFICATION_EVENTS: NotificationEvent[] = [ }, { id: "PATIENT_CONSULTATION_UPDATE_CREATED", - text: "Patient Consultation Update Created", + text: "Patient Log Update Created", icon: "l-heart", }, { id: "PATIENT_CONSULTATION_UPDATE_UPDATED", - text: "Patient Consultation Update Updated", + text: "Patient Log Update Updated", icon: "l-heart-medical", }, { diff --git a/src/Components/CriticalCareRecording/CriticalCare__Index.res b/src/Components/CriticalCareRecording/CriticalCare__Index.res index 0290728fd82..945849f89a6 100644 --- a/src/Components/CriticalCareRecording/CriticalCare__Index.res +++ b/src/Components/CriticalCareRecording/CriticalCare__Index.res @@ -113,7 +113,7 @@ let make = (
-

{str("Consultation Update")}

+

{str("Log Update")}

diff --git a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx index d00b77d9bca..c1aa4a1f3ae 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx @@ -661,7 +661,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
} - tab1="Daily Rounds" + tab1="Log Updates" onClickTab1={() => setShowEvents(false)} onClickTab2={() => setShowEvents(true)} isTab2Active={showEvents} diff --git a/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx b/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx index d77b3d9a8c2..acb70bf7eac 100644 --- a/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx +++ b/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx @@ -44,51 +44,54 @@ export default function EventsList() { className="flex grow flex-col gap-3"> - {(item, items) => ( - - {(() => { - const entries = Object.entries(item.value).filter( - ([_, value]) => value != null && value !== "", - ); - - if (entries.length === 0) { - return ( -
- - {t("no_changes")} - -
- ); + {(item, items) => { + const name: string = + item.event_type.name === "DAILY_ROUND_DETAILS" + ? "LOG_UPDATE_DETAILS" + : item.event_type.name; + return ( + + {(() => { + const entries = Object.entries(item.value).filter( + ([_, value]) => value != null && value !== "", + ); - const values = Object.fromEntries(entries); + if (entries.length === 0) { + return ( +
+ + {t("no_changes")} + +
+ ); + } - switch (item.event_type.name) { - case "INTERNAL_TRANSFER": - case "CLINICAL": - case "DIAGNOSIS": - case "ENCOUNTER_SUMMARY": - case "HEALTH": - default: - return ; - } - })()} -
- )} + const values = Object.fromEntries(entries); + + switch (item.event_type.name) { + case "INTERNAL_TRANSFER": + case "CLINICAL": + case "DIAGNOSIS": + case "ENCOUNTER_SUMMARY": + case "HEALTH": + default: + return ; + } + })()} +
+ ); + }}
diff --git a/src/Components/Notifications/NotificationsList.tsx b/src/Components/Notifications/NotificationsList.tsx index 2de3ae7922c..530795ed5a7 100644 --- a/src/Components/Notifications/NotificationsList.tsx +++ b/src/Components/Notifications/NotificationsList.tsx @@ -350,7 +350,25 @@ export default function NotificationsList({ }) .then((res) => { if (res && res.data) { - setData(res.data.results); + const toChangeId = [ + "PATIENT_CONSULTATION_UPDATED", + "PATIENT_CONSULTATION_UPDATE_CREATED", + "PATIENT_CONSULTATION_UPDATE_UPDATED", + ]; + const modifiedData = res.data.results.map((notification: any) => { + if (toChangeId.includes(notification.event)) { + return { + ...notification, + message: notification.message.replace( + "Consultation", + "Log Update", + ), + }; + } else { + return notification; + } + }); + setData(modifiedData); setUnreadCount( res.data.results?.reduce( (acc: number, result: any) => acc + (result.read_at ? 0 : 1), diff --git a/src/Components/Patient/DailyRoundListDetails.tsx b/src/Components/Patient/DailyRoundListDetails.tsx index 66536c986ca..86e8ef3f958 100644 --- a/src/Components/Patient/DailyRoundListDetails.tsx +++ b/src/Components/Patient/DailyRoundListDetails.tsx @@ -33,8 +33,9 @@ export const DailyRoundListDetails = (props: any) => { return (
Date: Sat, 10 Aug 2024 15:33:56 +0530 Subject: [PATCH 2/4] Changed URL --- .../Facility/ConsultationDetails/Events/EventsList.tsx | 9 ++++----- src/Components/Notifications/NotificationsList.tsx | 1 - src/Components/Patient/DailyRoundListDetails.tsx | 3 +-- src/Components/Patient/DailyRounds.tsx | 2 +- src/Routers/routes/ConsultationRoutes.tsx | 4 ++-- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx b/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx index acb70bf7eac..dc0fe49b1fb 100644 --- a/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx +++ b/src/Components/Facility/ConsultationDetails/Events/EventsList.tsx @@ -45,14 +45,13 @@ export default function EventsList() { className="flex grow flex-col gap-3"> {(item, items) => { - const name: string = - item.event_type.name === "DAILY_ROUND_DETAILS" - ? "LOG_UPDATE_DETAILS" - : item.event_type.name; return ( { if (res && res.data) { const toChangeId = [ - "PATIENT_CONSULTATION_UPDATED", "PATIENT_CONSULTATION_UPDATE_CREATED", "PATIENT_CONSULTATION_UPDATE_UPDATED", ]; diff --git a/src/Components/Patient/DailyRoundListDetails.tsx b/src/Components/Patient/DailyRoundListDetails.tsx index 86e8ef3f958..4b3d225be2f 100644 --- a/src/Components/Patient/DailyRoundListDetails.tsx +++ b/src/Components/Patient/DailyRoundListDetails.tsx @@ -34,8 +34,7 @@ export const DailyRoundListDetails = (props: any) => { return (
{ }} backUrl={ id - ? `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/daily-rounds` + ? `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/log-update` : `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}` } className="mx-auto max-w-4xl" diff --git a/src/Routers/routes/ConsultationRoutes.tsx b/src/Routers/routes/ConsultationRoutes.tsx index 2484acca0fd..8b55e01ed85 100644 --- a/src/Routers/routes/ConsultationRoutes.tsx +++ b/src/Routers/routes/ConsultationRoutes.tsx @@ -82,7 +82,7 @@ export default { consultationId={id} /> ), - "/facility/:facilityId/patient/:patientId/consultation/:consultationId/daily-rounds/:id/update": + "/facility/:facilityId/patient/:patientId/consultation/:consultationId/log-update/:id/update": ({ facilityId, patientId, consultationId, id }: any) => ( ), - "/facility/:facilityId/patient/:patientId/consultation/:consultationId/daily-rounds/:id": + "/facility/:facilityId/patient/:patientId/consultation/:consultationId/log-update/:id": ({ facilityId, patientId, consultationId, id }: any) => ( Date: Sat, 10 Aug 2024 15:35:30 +0530 Subject: [PATCH 3/4] Removed Consultation Updated --- src/Common/constants.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index ec537f672aa..6cd8eedb6d2 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -587,7 +587,7 @@ export const NOTIFICATION_EVENTS: NotificationEvent[] = [ }, { id: "PATIENT_CONSULTATION_UPDATED", - text: "Patient Log Updated", + text: "Patient Consultation Updated", icon: "l-heart-medical", }, { From e527205478966b9b6b02e5b3d7c87ccf778975fc Mon Sep 17 00:00:00 2001 From: renoseHarsh Date: Sat, 10 Aug 2024 15:36:56 +0530 Subject: [PATCH 4/4] Removed --- .../Notifications/NotificationsList.tsx | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/Components/Notifications/NotificationsList.tsx b/src/Components/Notifications/NotificationsList.tsx index d5c66357812..2de3ae7922c 100644 --- a/src/Components/Notifications/NotificationsList.tsx +++ b/src/Components/Notifications/NotificationsList.tsx @@ -350,24 +350,7 @@ export default function NotificationsList({ }) .then((res) => { if (res && res.data) { - const toChangeId = [ - "PATIENT_CONSULTATION_UPDATE_CREATED", - "PATIENT_CONSULTATION_UPDATE_UPDATED", - ]; - const modifiedData = res.data.results.map((notification: any) => { - if (toChangeId.includes(notification.event)) { - return { - ...notification, - message: notification.message.replace( - "Consultation", - "Log Update", - ), - }; - } else { - return notification; - } - }); - setData(modifiedData); + setData(res.data.results); setUnreadCount( res.data.results?.reduce( (acc: number, result: any) => acc + (result.read_at ? 0 : 1),