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

Add medico-legal case toggle and filter #6440

Merged
merged 8 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion src/Components/Assets/AssetType/ONVIFCamera.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ const ONVIFCamera = ({ assetId, facilityId, asset, onUpdated }: Props) => {
}
setLoadingAddPreset(false);
};

if (isLoading || loading || !facility) return <Loading />;

const fallbackMiddleware =
Expand Down
5 changes: 4 additions & 1 deletion src/Components/Common/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ interface DropdownMenuProps {
children: JSX.Element | JSX.Element[];
disabled?: boolean | undefined;
className?: string | undefined;
itemClassName?: string | undefined;
}

export default function DropdownMenu({
Expand All @@ -36,7 +37,9 @@ export default function DropdownMenu({
<CareIcon className="care-l-angle-down -mr-1 ml-2 text-lg" />
</Menu.Button>
<DropdownTransition>
<Menu.Items className="absolute right-0 z-10 mt-2 min-w-full origin-top-right rounded-lg bg-white py-1 shadow-lg ring-1 ring-black/5 focus:outline-none sm:min-w-[250px] md:w-max">
<Menu.Items
className={`absolute right-0 z-10 mt-2 min-w-full origin-top-right rounded-lg bg-white py-1 shadow-lg ring-1 ring-black/5 focus:outline-none sm:min-w-[250px] md:w-max ${props.itemClassName}`}
>
<>{props.children}</>
</Menu.Items>
</DropdownTransition>
Expand Down
16 changes: 8 additions & 8 deletions src/Components/Common/components/SwitchTabs.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="relative grid w-full grid-cols-2 items-center gap-4 rounded-md bg-primary-500/10 px-4 py-3 lg:w-52">
<div
className={`absolute z-0 w-[50%] origin-left rounded bg-primary-500 py-4 transition-all duration-200 ease-out lg:left-1.5 ${
props.activeTab ? "right-1.5 lg:translate-x-[89%]" : "left-1.5"
props.isTab2Active ? "right-1.5 lg:translate-x-[89%]" : "left-1.5"
}`}
></div>
<div
className={`z-10 flex cursor-pointer items-center justify-center text-sm transition-all duration-200 ease-out ${
props.activeTab
props.isTab2Active
? "text-primary-500 hover:font-medium hover:text-green-600"
: "text-white"
} `}
onClick={props.onClickTab1}
>
{props.Tab1}
{props.tab1}
</div>
<div
className={`z-10 flex cursor-pointer items-center justify-center text-sm transition-all duration-200 ease-out ${
!props.activeTab
!props.isTab2Active
? "ml-2 text-primary-500 hover:font-medium hover:text-green-600"
: "text-white"
}`}
onClick={props.onClickTab2}
>
{props.Tab2}
{props.tab2}
</div>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/Components/Facility/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export interface ConsultationModel {
death_datetime?: string;
death_confirmed_doctor?: string;
is_readmission?: boolean;
medico_legal_case?: boolean;
}
export interface PatientStatsModel {
id?: number;
Expand Down
13 changes: 10 additions & 3 deletions src/Components/Patient/ManagePatients.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -768,11 +771,11 @@ export const PatientManager = () => {
</div>
<div className="flex w-full flex-col justify-end gap-2 lg:w-fit lg:flex-row lg:gap-3">
<SwitchTabs
Tab1="Live"
Tab2="Discharged"
tab1="Live"
tab2="Discharged"
onClickTab1={() => updateQuery({ is_active: "True" })}
onClickTab2={() => updateQuery({ is_active: "False" })}
activeTab={tabValue ? true : false}
isTab2Active={tabValue ? true : false}
/>
{showDoctorConnect && (
<ButtonV2
Expand Down Expand Up @@ -932,6 +935,10 @@ export const PatientManager = () => {
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),
Expand Down
23 changes: 23 additions & 0 deletions src/Components/Patient/PatientFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: "",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
),
Expand Down Expand Up @@ -473,6 +479,23 @@ export default function PatientFilter(props: any) {
}
/>
</div>
<div className="w-full flex-none">
<FieldLabel className="text-sm">Is Medico-Legal Case</FieldLabel>
<SelectMenuV2
placeholder="Show all"
options={["true", "false"]}
optionLabel={(o) =>
o === "true" ? "Medico-Legal" : "Non-Medico-Legal"
}
value={filterState.last_consultation_medico_legal_case}
onChange={(v) =>
setFilterState({
...filterState,
last_consultation_medico_legal_case: v,
})
}
/>
</div>
</div>
</AccordionV2>
<AccordionV2
Expand Down
Loading
Loading