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

Discharged patients for stateAdmin facility page: consistent sort and advanced filters #8756

Closed
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
9 changes: 0 additions & 9 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,6 @@ export const EVENTS_SORT_OPTIONS: SortOption[] = [
{ isAscending: true, value: "taken_at" },
];

export const DISCHARGED_PATIENT_SORT_OPTIONS: SortOption[] = [
{ isAscending: false, value: "-created_date" },
{ isAscending: true, value: "created_date" },
{ isAscending: false, value: "-modified_date" },
{ isAscending: true, value: "modified_date" },
{ isAscending: true, value: "name" },
{ isAscending: false, value: "-name" },
];

export const BED_TYPES = [100, 200, 300, 400, 500];

export const DOCTOR_SPECIALIZATION: Array<OptionsType> = [
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Facility/DischargedPatientsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SearchInput from "../Form/SearchInput";
import {
ADMITTED_TO,
CONSENT_TYPE_CHOICES,
DISCHARGED_PATIENT_SORT_OPTIONS,
PATIENT_SORT_OPTIONS,
DISCHARGE_REASONS,
GENDER_TYPES,
PATIENT_CATEGORIES,
Expand Down Expand Up @@ -267,7 +267,7 @@ const DischargedPatientsList = ({
onClick={() => advancedFilter.setShow(true)}
/>
<SortDropdownMenu
options={DISCHARGED_PATIENT_SORT_OPTIONS}
options={PATIENT_SORT_OPTIONS}
selected={qParams.ordering}
onSelect={(e) => updateQuery({ ordering: e.ordering })}
/>
Expand Down
88 changes: 39 additions & 49 deletions src/Components/Patient/PatientFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,7 @@ export default function PatientFilter(props: any) {
</div>
</div>
<div className="w-full flex-none" id="bed-type-select">
<FieldLabel className="text-sm">
{props.dischargePage && "Last "}Admitted to (Bed Types)
</FieldLabel>
<FieldLabel className="text-sm">Admitted to (Bed Types)</FieldLabel>
<MultiSelectMenuV2
id="last_consultation_admitted_bed_type_list"
placeholder="Select bed types"
Expand Down Expand Up @@ -455,21 +453,17 @@ export default function PatientFilter(props: any) {
/>
</div> */}
<div className="w-full flex-none">
{props.dischargePage || (
<>
<FieldLabel className="text-sm">Review Missed</FieldLabel>
<SelectMenuV2
id="review-advancefilter"
placeholder="Show all"
options={["true", "false"]}
optionLabel={(o) => (o === "true" ? "Yes" : "No")}
value={filterState.review_missed}
onChange={(v) =>
setFilterState({ ...filterState, review_missed: v })
}
/>
</>
)}
<FieldLabel className="text-sm">Review Missed</FieldLabel>
<SelectMenuV2
id="review-advancefilter"
placeholder="Show all"
options={["true", "false"]}
optionLabel={(o) => (o === "true" ? "Yes" : "No")}
value={filterState.review_missed}
onChange={(v) =>
setFilterState({ ...filterState, review_missed: v })
}
/>
</div>
<div className="w-full flex-none">
<FieldLabel className="text-sm">Is Medico-Legal Case</FieldLabel>
Expand Down Expand Up @@ -595,18 +589,16 @@ export default function PatientFilter(props: any) {
className="rounded-md"
>
<div className="space-y-4">
{!props.dischargePage && (
<div id="facility-name">
<FieldLabel className="text-sm">Facility</FieldLabel>
<FacilitySelect
multiple={false}
name="facility"
showAll={false}
selected={filterState.facility_ref}
setSelected={(obj) => setFilterWithRef("facility", obj)}
/>
</div>
)}
<div id="facility-name">
<FieldLabel className="text-sm">Facility</FieldLabel>
<FacilitySelect
multiple={false}
name="facility"
showAll={false}
selected={filterState.facility_ref}
setSelected={(obj) => setFilterWithRef("facility", obj)}
/>
</div>
{filterState.facility && (
<div>
<FieldLabel className="text-sm">Location</FieldLabel>
Expand All @@ -625,25 +617,23 @@ export default function PatientFilter(props: any) {
/>
</div>
)}
{!props.dischargePage && (
<div>
<FieldLabel className="text-sm">Facility type</FieldLabel>
<SelectMenuV2
id="facility-type"
placeholder="Show all"
options={FACILITY_TYPES}
optionLabel={(o) => o.text}
optionValue={(o) => o.text}
value={filterState.facility_type}
onChange={(v) =>
setFilterState({ ...filterState, facility_type: v })
}
optionIcon={() => (
<CareIcon icon="l-hospital" className="text-lg" />
)}
/>
</div>
)}
<div>
<FieldLabel className="text-sm">Facility type</FieldLabel>
<SelectMenuV2
id="facility-type"
placeholder="Show all"
options={FACILITY_TYPES}
optionLabel={(o) => o.text}
optionValue={(o) => o.text}
value={filterState.facility_type}
onChange={(v) =>
setFilterState({ ...filterState, facility_type: v })
}
optionIcon={() => (
<CareIcon icon="l-hospital" className="text-lg" />
)}
/>
</div>
<div>
<FieldLabel className="text-sm">LSG Body</FieldLabel>
<div className="">
Expand Down
Loading