Skip to content

Commit

Permalink
disable facility type filter if location is not selected
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacobjeevan committed Jan 13, 2025
1 parent e0f4527 commit 03ee501
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1770,6 +1770,7 @@
"select_investigation_groups": "Select Investigation Groups",
"select_investigations": "Select Investigations",
"select_local_body": "Select Local Body",
"select_location_first": "Select Location First",
"select_method": "Select method",
"select_new_role": "Select New Role",
"select_patient": "Select Patient",
Expand Down
6 changes: 6 additions & 0 deletions src/pages/Facility/FacilitiesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ export function FacilitiesPage() {
<div className="flex flex-col w-full gap-4 mt-4">
{isLoading ? (
<Loading />
) : !qParams.organization ? (
<Card className="p-6">
<div className="text-lg font-medium text-muted-foreground">
{t("select_location_first")}
</div>
</Card>
) : !facilitiesResponse?.results.length ? (
<Card className="p-6">
<div className="text-lg font-medium text-muted-foreground">
Expand Down
9 changes: 8 additions & 1 deletion src/pages/Organization/components/OrganizationFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,16 @@ export default function OrganizationFilter(props: OrganizationFilterProps) {
?.id,
});
}}
disabled={selected.length === 0}
>
<SelectTrigger className="sm:max-w-56 h-[38px]">
<SelectValue placeholder={t("select_facility_type")} />
<SelectValue
placeholder={
selected.length === 0
? t("select_location_first")
: t("select_facility_type")
}
/>
</SelectTrigger>
<SelectContent>
{FACILITY_TYPES.map((type) => (
Expand Down

0 comments on commit 03ee501

Please sign in to comment.