diff --git a/src/Locale/en.json b/src/Locale/en.json index 1d9f5cfe4ae..77a47439ed9 100644 --- a/src/Locale/en.json +++ b/src/Locale/en.json @@ -872,6 +872,7 @@ "no_tests_taken": "No tests taken", "no_treating_physicians_available": "This facility does not have any home facility doctors. Please contact your admin.", "no_users_found": "No Users Found", + "no_vitals_present": "No Vitals Monitor present in this location or facility", "none": "None", "normal": "Normal", "not_eligible": "Not Eligible", @@ -1243,6 +1244,7 @@ "virtual_nursing_assistant": "Virtual Nursing Assistant", "vitals": "Vitals", "vitals_monitor": "Vitals Monitor", + "vitals_present": "Vitals Monitor present", "ward": "Ward", "warranty_amc_expiry": "Warranty / AMC Expiry", "what_facility_assign_the_patient_to": "What facility would you like to assign the patient to", diff --git a/src/components/Common/LocationSelect.tsx b/src/components/Common/LocationSelect.tsx index cf8a4e2d6b8..cb1b7514ac0 100644 --- a/src/components/Common/LocationSelect.tsx +++ b/src/components/Common/LocationSelect.tsx @@ -15,6 +15,8 @@ interface LocationSelectProps { selected: string | string[] | null; setSelected: (selected: string | string[] | null) => void; errorClassName?: string; + bedIsOccupied?: boolean; + disableOnOneOrFewer?: boolean; } export const LocationSelect = (props: LocationSelectProps) => { @@ -23,6 +25,8 @@ export const LocationSelect = (props: LocationSelectProps) => { { query: { limit: 14, + bed_is_occupied: + props.bedIsOccupied === undefined ? undefined : !props.bedIsOccupied, }, pathParams: { facility_external_id: props.facilityId, @@ -31,6 +35,10 @@ export const LocationSelect = (props: LocationSelectProps) => { }, ); + if (props.disableOnOneOrFewer && data && data.count <= 1) { + props = { ...props, disabled: true }; + } + return props.multiple ? ( + updatePage(page)} + />
- {totalCount} Vitals - Monitor present + {totalCount}{" "} + {t("vitals_present")}
@@ -134,6 +141,10 @@ export default function CentralNursingStation({ facilityId }: Props) { facilityId={facilityId} errors="" errorClassName="hidden" + bedIsOccupied={JSON.parse( + qParams.monitors_without_patient ?? "false", + )} + disableOnOneOrFewer /> @@ -164,7 +175,9 @@ export default function CentralNursingStation({ facilityId }: Props) { value={JSON.parse( qParams.monitors_without_patient ?? "false", )} - onChange={(e) => updateQuery({ [e.name]: `${e.value}` })} + onChange={(e) => + updateQuery({ [e.name]: `${e.value}`, location: "" }) + } labelClassName="text-sm" errorClassName="hidden" /> @@ -189,14 +202,6 @@ export default function CentralNursingStation({ facilityId }: Props) {
- - updatePage(page)} - /> } > @@ -204,7 +209,7 @@ export default function CentralNursingStation({ facilityId }: Props) { ) : data.length === 0 ? (
- No Vitals Monitor present in this location or facility. + {t("no_vitals_present")}
) : (