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

"Log Update" Consistency #8283

Closed
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
{
Expand All @@ -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",
},
{
Expand Down
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ let make = (
<div>
<div
className="bg-white px-2 md:px-6 py-5 border-b border-secondary-200 sm:px-6 max-w-5xl mx-auto border mt-4 shadow rounded-lg">
<h1 className="text-4xl sm:text-5xl"> {str("Consultation Update")} </h1>
<h1 className="text-4xl sm:text-5xl"> {str("Log Update")} </h1>
<div>
<CriticalCare__PageTitle title="General" />
<DailyRound__General others title renderOptionalDescription />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
</span>
</div>
}
tab1="Daily Rounds"
tab1="Log Updates"
onClickTab1={() => setShowEvents(false)}
onClickTab2={() => setShowEvents(true)}
isTab2Active={showEvents}
Expand Down
87 changes: 45 additions & 42 deletions src/Components/Facility/ConsultationDetails/Events/EventsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,51 +44,54 @@ export default function EventsList() {
<LoadingLogUpdateCard />
</PaginatedList.WhenLoading>
<PaginatedList.Items<EventGeneric> className="flex grow flex-col gap-3">
{(item, items) => (
<TimelineNode
name={
t(item.event_type.name.toLowerCase()).replaceAll(
/_/g,
" ",
) + " Event"
}
event={{
type: item.change_type.replace(/_/g, " ").toLowerCase(),
timestamp: item.created_date?.toString() ?? "",
by: item.caused_by,
icon: getEventIcon(item.event_type.name),
}}
isLast={items.indexOf(item) == items.length - 1}
>
{(() => {
const entries = Object.entries(item.value).filter(
([_, value]) => value != null && value !== "",
);

if (entries.length === 0) {
return (
<div className="flex w-full flex-col items-center gap-2 md:flex-row">
<span className="text-xs uppercase text-secondary-700">
{t("no_changes")}
</span>
</div>
);
{(item, items) => {
const name: string =
item.event_type.name === "DAILY_ROUND_DETAILS"
? "LOG_UPDATE_DETAILS"
: item.event_type.name;
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
return (
<TimelineNode
name={
t(name.toLowerCase()).replaceAll(/_/g, " ") + " Event"
}
event={{
type: item.change_type.replace(/_/g, " ").toLowerCase(),
timestamp: item.created_date?.toString() ?? "",
by: item.caused_by,
icon: getEventIcon(item.event_type.name),
}}
isLast={items.indexOf(item) == items.length - 1}
>
{(() => {
const entries = Object.entries(item.value).filter(
([_, value]) => value != null && value !== "",
);

const values = Object.fromEntries(entries);
if (entries.length === 0) {
return (
<div className="flex w-full flex-col items-center gap-2 md:flex-row">
<span className="text-xs uppercase text-secondary-700">
{t("no_changes")}
</span>
</div>
);
}

switch (item.event_type.name) {
case "INTERNAL_TRANSFER":
case "CLINICAL":
case "DIAGNOSIS":
case "ENCOUNTER_SUMMARY":
case "HEALTH":
default:
return <GenericEvent values={values} />;
}
})()}
</TimelineNode>
)}
const values = Object.fromEntries(entries);

switch (item.event_type.name) {
case "INTERNAL_TRANSFER":
case "CLINICAL":
case "DIAGNOSIS":
case "ENCOUNTER_SUMMARY":
case "HEALTH":
default:
return <GenericEvent values={values} />;
}
})()}
</TimelineNode>
);
}}
</PaginatedList.Items>
<div className="flex w-full items-center justify-center">
<PaginatedList.Paginator hideIfSinglePage />
Expand Down
20 changes: 19 additions & 1 deletion src/Components/Notifications/NotificationsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
setData(modifiedData);
setUnreadCount(
res.data.results?.reduce(
(acc: number, result: any) => acc + (result.read_at ? 0 : 1),
Expand Down
3 changes: 2 additions & 1 deletion src/Components/Patient/DailyRoundListDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ export const DailyRoundListDetails = (props: any) => {

return (
<Page
title={`Consultation Update #${id}`}
title={`Log Update #${id}`}
backUrl={`/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/daily-rounds`}
crumbsReplacements={{ ["daily-rounds"]: { name: "Log Update" } }}
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
>
<div
className="mt-4 h-full rounded-lg border bg-white p-4 text-black shadow hover:border-primary-500"
Expand Down
Loading