diff --git a/src/Components/Assets/AssetType/ONVIFCamera.tsx b/src/Components/Assets/AssetType/ONVIFCamera.tsx index 4a3a003d0a1..4a3e475419e 100644 --- a/src/Components/Assets/AssetType/ONVIFCamera.tsx +++ b/src/Components/Assets/AssetType/ONVIFCamera.tsx @@ -134,7 +134,6 @@ const ONVIFCamera = ({ assetId, facilityId, asset, onUpdated }: Props) => { } setLoadingAddPreset(false); }; - if (isLoading || loading || !facility) return ; const fallbackMiddleware = 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/Common/components/SwitchTabs.tsx b/src/Components/Common/components/SwitchTabs.tsx index 0592f0272dd..047dba53b4b 100644 --- a/src/Components/Common/components/SwitchTabs.tsx +++ b/src/Components/Common/components/SwitchTabs.tsx @@ -1,36 +1,36 @@ export default function SwitchTabs(props: { - activeTab: boolean; + isTab2Active: boolean; onClickTab1: () => void; onClickTab2: () => void; - Tab1: string; - Tab2: string; + tab1: string; + tab2: string; }) { return (
- {props.Tab1} + {props.tab1}
- {props.Tab2} + {props.tab2}
); diff --git a/src/Components/Facility/models.tsx b/src/Components/Facility/models.tsx index 78670f32c6f..ce2def8a92a 100644 --- a/src/Components/Facility/models.tsx +++ b/src/Components/Facility/models.tsx @@ -150,6 +150,7 @@ export interface ConsultationModel { death_datetime?: string; death_confirmed_doctor?: string; is_readmission?: boolean; + medico_legal_case?: boolean; } export interface PatientStatsModel { diff --git a/src/Components/Patient/ManagePatients.tsx b/src/Components/Patient/ManagePatients.tsx index aa3a837647d..61b18faa367 100644 --- a/src/Components/Patient/ManagePatients.tsx +++ b/src/Components/Patient/ManagePatients.tsx @@ -185,6 +185,8 @@ export const PatientManager = () => { qParams.date_declared_positive_after || undefined, date_of_result_before: qParams.date_of_result_before || undefined, date_of_result_after: qParams.date_of_result_after || undefined, + last_consultation_medico_legal_case: + qParams.last_consultation_medico_legal_case || undefined, last_consultation_admission_date_before: qParams.last_consultation_admission_date_before || undefined, last_consultation_admission_date_after: @@ -333,6 +335,7 @@ export const PatientManager = () => { }); }, [ dispatch, + qParams.last_consultation_medico_legal_case, qParams.last_consultation_admission_date_before, qParams.last_consultation_admission_date_after, qParams.last_consultation_discharge_date_before, @@ -768,11 +771,11 @@ export const PatientManager = () => {
updateQuery({ is_active: "True" })} onClickTab2={() => updateQuery({ is_active: "False" })} - activeTab={tabValue ? true : false} + isTab2Active={tabValue ? true : false} /> {showDoctorConnect && ( { kasp(), badge("COWIN ID", "covin_id"), badge("Is Antenatal", "is_antenatal"), + badge( + "Is Medico-Legal Case", + "last_consultation_medico_legal_case" + ), value("Facility", "facility", facilityBadgeName), badge("Facility Type", "facility_type"), value("District", "district", districtName), diff --git a/src/Components/Patient/PatientFilter.tsx b/src/Components/Patient/PatientFilter.tsx index 205ac39ac9c..97f5a6c6b9c 100644 --- a/src/Components/Patient/PatientFilter.tsx +++ b/src/Components/Patient/PatientFilter.tsx @@ -65,6 +65,8 @@ export default function PatientFilter(props: any) { age_max: filter.age_max || null, date_of_result: filter.date_of_result || null, date_declared_positive: filter.date_declared_positive || null, + last_consultation_medico_legal_case: + filter.last_consultation_medico_legal_case || null, last_consultation_admission_date_before: filter.last_consultation_admission_date_before || null, last_consultation_admission_date_after: @@ -120,6 +122,7 @@ export default function PatientFilter(props: any) { age_max: "", date_of_result: null, date_declared_positive: null, + last_consultation_medico_legal_case: null, last_consultation_admission_date_before: "", last_consultation_admission_date_after: "", last_consultation_discharge_date_before: "", @@ -229,6 +232,7 @@ export default function PatientFilter(props: any) { age_min, age_max, date_of_result, + last_consultation_medico_legal_case, last_consultation_admission_date_before, last_consultation_admission_date_after, last_consultation_discharge_date_before, @@ -266,6 +270,8 @@ export default function PatientFilter(props: any) { modified_date_before: dateQueryString(modified_date_before), modified_date_after: dateQueryString(modified_date_after), date_of_result: dateQueryString(date_of_result), + last_consultation_medico_legal_case: + last_consultation_medico_legal_case || "", last_consultation_admission_date_before: dateQueryString( last_consultation_admission_date_before ), @@ -473,6 +479,23 @@ export default function PatientFilter(props: any) { } />
+
+ Is Medico-Legal Case + + o === "true" ? "Medico-Legal" : "Non-Medico-Legal" + } + value={filterState.last_consultation_medico_legal_case} + onChange={(v) => + setFilterState({ + ...filterState, + last_consultation_medico_legal_case: v, + }) + } + /> +
{ + if (!consultation?.id || value === medicoLegalCase) return; + const { res, data } = await request(routes.partialUpdateConsultation, { + pathParams: { id: consultation?.id }, + body: { medico_legal_case: value }, + }); + + if (res?.status !== 200 || !data) { + Notification.Error({ + msg: "Failed to update Medico Legal Case", + }); + setMedicoLegalCase(!value); + } else { + Notification.Success({ + msg: "Medico Legal Case updated successfully", + }); + } + }; + return ( <> 0 && (
)} + {medicoLegalCase && ( + + MLC + + )}
{!!consultation?.discharge_date && (

@@ -326,131 +359,225 @@ export default function PatientInfoCard(props: { , ], ], - [ - `/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}/claims`, - "Claims", - "copy-landscape", - consultation?.id, - ], - ] - : [] - ) - .map( - (action: any, i) => - action[3] && ( -

- + action[3] && ( +
+ { + if ( consultation?.admitted && !consultation?.current_bed && i === 1 - ? undefined - : `${action[0]}` + ) { + Notification.Error({ + msg: "Please assign a bed to the patient", + }); + setOpen(true); } - onClick={() => { - 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] && action[4][0] && ( - <> -

- {action[4][1]} -

- - )} -
+ }} + className="w-full" + > + + +

{action[1]}

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

+ {action[4][1]} +

+ + )} +
+ ) + )} + } + > +
+ {[ + [ + `/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}/claims`, + "Claims", + "copy-landscape", + consultation?.id, + ], + ] + : [] ) - )} - {enable_abdm && - (patient.abha_number ? ( - <> - setShowABHAProfile(true)} - > - - -

Show ABHA Profile

-
-
- setShowLinkCareContext(true)} - > - - -

Link Care Context

-
-
- setShowABHAProfile(false)} - /> - setShowLinkCareContext(false)} - /> - - ) : ( - <> - setShowLinkABHANumber(true)} - > - - -

Link ABHA Number

-
-
- setShowLinkABHANumber(false)} - patientId={patient.id as any} - onSuccess={(_) => { - window.location.href += "?show-abha-profile=true"; + .map( + (action: any, i) => + action[3] && ( + + ) + )} +
+
+ {enable_abdm && + (patient.abha_number ? ( + <> + + {({ close }) => ( + <> +
{ + close(); + setShowABHAProfile(true); + }} + > + + Show ABHA Profile +
+
{ + close(); + setShowLinkCareContext(true); + }} + > + + Link Care Context +
+ + )} +
+ + ) : ( + + {({ close }) => ( +
{ + close(); + 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 + {" "} + + +
+
+ setShowLinkABHANumber(false)} + patientId={patient.id as any} + onSuccess={(_) => { + window.location.href += "?show-abha-profile=true"; + }} + /> + setShowABHAProfile(false)} + /> + setShowLinkCareContext(false)} + /> ); } diff --git a/src/Components/Resource/ResourceBoardView.tsx b/src/Components/Resource/ResourceBoardView.tsx index d3b2b202649..17fb70c662f 100644 --- a/src/Components/Resource/ResourceBoardView.tsx +++ b/src/Components/Resource/ResourceBoardView.tsx @@ -59,11 +59,11 @@ export default function BoardView() {
setBoardFilter(ACTIVE)} onClickTab2={() => setBoardFilter(COMPLETED)} - activeTab={boardFilter !== ACTIVE} + isTab2Active={boardFilter !== ACTIVE} />
diff --git a/src/Components/Shifting/BoardView.tsx b/src/Components/Shifting/BoardView.tsx index 85815770acf..9c96daa0e59 100644 --- a/src/Components/Shifting/BoardView.tsx +++ b/src/Components/Shifting/BoardView.tsx @@ -85,11 +85,11 @@ export default function BoardView() { /> setBoardFilter(activeBoards)} onClickTab2={() => setBoardFilter(completedBoards)} - activeTab={boardFilter[0].text !== activeBoards[0].text} + isTab2Active={boardFilter[0].text !== activeBoards[0].text} />
diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx index 21dee89c209..bd5c6aefb2d 100644 --- a/src/Redux/api.tsx +++ b/src/Redux/api.tsx @@ -426,6 +426,8 @@ const routes = { partialUpdateConsultation: { path: "/api/v1/consultation/{id}/", method: "PATCH", + TRes: Type>(), + TBody: Type(), }, deleteConsultation: { path: "/api/v1/consultation/{id}/",