diff --git a/src/Components/Common/components/Menu.tsx b/src/Components/Common/components/Menu.tsx index 4b52a293f9e..49ee02b393e 100644 --- a/src/Components/Common/components/Menu.tsx +++ b/src/Components/Common/components/Menu.tsx @@ -16,6 +16,7 @@ interface DropdownMenuProps { children: JSX.Element | JSX.Element[]; disabled?: boolean | undefined; className?: string | undefined; + itemClassName?: string | undefined; } export default function DropdownMenu({ @@ -36,7 +37,9 @@ export default function DropdownMenu({ - + <>{props.children} diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx index b98ecd6c7eb..78792ad55d0 100644 --- a/src/Components/Patient/PatientInfoCard.tsx +++ b/src/Components/Patient/PatientInfoCard.tsx @@ -20,7 +20,7 @@ import LinkCareContextModal from "../ABDM/LinkCareContextModal"; import { PatientModel } from "./models"; import { getDimensionOrDash } from "../../Common/utils"; import useConfig from "../../Common/hooks/useConfig"; -import { Fragment, useState } from "react"; +import { useState } from "react"; import { classNames, formatAge, @@ -30,7 +30,8 @@ import { import dayjs from "../../Utils/dayjs"; import request from "../../Utils/request/request.js"; import routes from "../../Redux/api.js"; -import { Menu, Transition } from "@headlessui/react"; +import { Menu } from "@headlessui/react"; +import DropdownMenu from "../Common/components/Menu.js"; export default function PatientInfoCard(props: { patient: PatientModel; @@ -385,203 +386,155 @@ export default function PatientInfoCard(props: { ) )} - - - {({ open }) => ( - <> - - - - {open ? ( - - ) : ( - - )} -

- {open ? "Hide More" : "Show More"} -

-
-
-
- - -
- {[ - [ - `/patient/${patient.id}/investigation_reports`, - "Investigation Summary", - "align-alt", - true, - ], + } + > +
+ {[ + [ + `/patient/${patient.id}/investigation_reports`, + "Investigation Summary", + "align-alt", + true, + ], + [ + `/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/treatment-summary`, + "Treatment Summary", + "file-medical", + consultation?.id, + ], + ] + .concat( + enable_hcx + ? [ [ - `/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/treatment-summary`, - "Treatment Summary", - "file-medical", + `/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/claims`, + "Claims", + "copy-landscape", consultation?.id, ], ] - .concat( - enable_hcx - ? [ - [ - `/facility/${patient.facility}/patient/${patient.id}/consultation/${consultation?.id}/claims`, - "Claims", - "copy-landscape", - consultation?.id, - ], - ] - : [] - ) - .map( - (action: any, i) => - action[3] && ( -
- { - if ( - consultation?.admitted && - !consultation?.current_bed && - i === 1 - ) { - Notification.Error({ - msg: "Please assign a bed to the patient", - }); - setOpen(true); - } - }} - className="w-full" - > - - -

{action[1]}

-
-
- {action?.[4]?.[0] && ( - <> -

- {action[4][1]} -

- - )} -
- ) - )} -
-
- {enable_abdm && - (patient.abha_number ? ( - <> - - {({ close }) => ( - <> - { - close(); - setShowABHAProfile(true); - }} - > - - -

Show ABHA Profile

-
-
- { - close(); - setShowLinkCareContext(true); - }} - > - - -

Link Care Context

-
-
- - )} -
- - ) : ( - <> - setShowLinkABHANumber(true)} - > - - -

Link ABHA Number

-
-
- - ))} -
- +
+ {enable_abdm && + (patient.abha_number ? ( + <> + + {({ close }) => ( + <> +
{ + close(); + setShowABHAProfile(true); + }} + > + + Show ABHA Profile +
+
{ + close(); + setShowLinkCareContext(true); + }} + > + + Link Care Context +
+ + )} +
+ + ) : ( + <> +
setShowLinkABHANumber(true)} + > + + +

Link ABHA Number

+
- - - - )} -
+ + ))} + +
+ + { + setMedicoLegalCase(checked); + switchMedicoLegalCase(checked); + }} + className={classNames( + medicoLegalCase ? "bg-primary" : "bg-gray-200", + "relative inline-flex h-4 w-8 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none " + )} + > + + + + Medico-Legal Case + {" "} + + +
+