diff --git a/src/common/constants.tsx b/src/common/constants.tsx index 1ce2a011725..8c8dd4731ea 100644 --- a/src/common/constants.tsx +++ b/src/common/constants.tsx @@ -1,5 +1,16 @@ +import { + Ambulance, + BedDouble, + Building2, + Home, + MonitorSmartphone, + Stethoscope, +} from "lucide-react"; + import { IconName } from "@/CAREUI/icons/CareIcon"; +import { EncounterClass } from "@/types/emr/encounter"; + export const RESULTS_PER_PAGE_LIMIT = 14; /** @@ -354,6 +365,14 @@ export const FILE_EXTENSIONS = { PRESENTATION: ["pptx"], DOCUMENT: ["pdf", "docx"], } as const; +export const encounterIcons = { + imp: , + amb: , + obsenc: , + emer: , + vr: , + hh: , +} as const satisfies Record; export const PREVIEWABLE_FILE_EXTENSIONS = [ "html", diff --git a/src/components/Facility/EncounterCard.tsx b/src/components/Facility/EncounterCard.tsx index 313f2be4b0c..a9fc72dff59 100644 --- a/src/components/Facility/EncounterCard.tsx +++ b/src/components/Facility/EncounterCard.tsx @@ -1,13 +1,15 @@ import { t } from "i18next"; -import { BedSingle, CircleCheck, CircleDashed, Clock } from "lucide-react"; +import { BadgeCheck, CircleDashed, Clock, Eye } from "lucide-react"; import { Link } from "raviger"; import { cn } from "@/lib/utils"; -import CareIcon from "@/CAREUI/icons/CareIcon"; - import { Badge } from "@/components/ui/badge"; -import { buttonVariants } from "@/components/ui/button"; +import { Button } from "@/components/ui/button"; +import { Card, CardContent } from "@/components/ui/card"; +import { Separator } from "@/components/ui/separator"; + +import { encounterIcons } from "@/common/constants"; import { formatDateTime } from "@/Utils/utils"; import { Encounter, completedEncounterStatus } from "@/types/emr/encounter"; @@ -18,90 +20,114 @@ interface EncounterCardProps { export const EncounterCard = (props: EncounterCardProps) => { const { encounter } = props; + + const Icon = encounterIcons[encounter.encounter_class]; + return ( <> -
- +
+
{completedEncounterStatus.includes(encounter.status) ? ( - +
+ +
) : ( - +
+ +
)} - {t(`encounter_status__${encounter.status}`)} - +
+ +
+
+ + +
+ + {completedEncounterStatus.includes(encounter.status) ? ( + + ) : ( + + )} + {t(`encounter_status__${encounter.status}`)} + + + {Icon} + {t(`encounter_class__${encounter.encounter_class}`)} + +
-
- {[ - { - label: t("facility"), - value: ( -
+
+
+
{t("facility")}
+
{encounter.facility.name}
- ), - }, - { - label: t("encounter_class"), - value: ( -
- - {t(`encounter_class__${encounter.encounter_class}`)} +
+ +
+
{t("start_date")}
+
+ {encounter.period.start + ? formatDateTime(encounter.period.start) + : t("not_started")}
- ), - }, - { - label: t("priority"), - value: ( -
+
+ +
+
{t("priority")}
+
{t(`encounter_priority__${encounter.priority.toLowerCase()}`)}
- ), - }, - { - label: t("start_date"), - value: encounter.period.start - ? formatDateTime(encounter.period.start) - : t("not_started"), - }, - { - label: t("end_date"), - hide: !encounter.period.end, - value: formatDateTime(encounter.period.end), - }, - { - label: t("external_id"), - hide: !encounter.external_identifier, - value: encounter.external_identifier, - }, - ] - .filter((f) => !f.hide) - .map((field, i) => ( -
-
{field.label}
-
{field.value}
- ))} -
+ {encounter.period.end && ( +
+
{t("end_date")}
+
+ {formatDateTime(encounter.period.end)} +
+
+ )} - - - {t("view_encounter")} - + {encounter.external_identifier && ( +
+
+ {t("external_id")} +
+
+ {encounter.external_identifier} +
+
+ )} +
+
+ +
+ +
);