From 0b042f2e9cd4a73b80df57034f36e30c1a1b6313 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Fri, 10 May 2024 16:01:38 +0530 Subject: [PATCH] Hide discharge reason filter for non state admin users (#7788) --- src/Components/Patient/PatientFilter.tsx | 40 ++++++++++++++---------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/Components/Patient/PatientFilter.tsx b/src/Components/Patient/PatientFilter.tsx index 1bc27733242..ce0b576b468 100644 --- a/src/Components/Patient/PatientFilter.tsx +++ b/src/Components/Patient/PatientFilter.tsx @@ -31,11 +31,13 @@ import DiagnosesFilter, { FILTER_BY_DIAGNOSES_KEYS } from "./DiagnosesFilter"; import useQuery from "../../Utils/request/useQuery"; import routes from "../../Redux/api"; import request from "../../Utils/request/request"; +import useAuthUser from "../../Common/hooks/useAuthUser"; const getDate = (value: any) => value && dayjs(value).isValid() && dayjs(value).toDate(); export default function PatientFilter(props: any) { + const authUser = useAuthUser(); const { kasp_enabled, kasp_string } = useConfig(); const { filter, onChange, closeFilter, removeFilters } = props; @@ -377,23 +379,27 @@ export default function PatientFilter(props: any) { } /> -
- Discharge Reason - o.id} - optionLabel={(o) => o.text} - onChange={(o) => - setFilterState({ - ...filterState, - last_consultation__new_discharge_reason: o, - }) - } - /> -
+ {["StateAdmin", "StateReadOnlyAdmin"].includes( + authUser.user_type, + ) && ( +
+ Discharge Reason + o.id} + optionLabel={(o) => o.text} + onChange={(o) => + setFilterState({ + ...filterState, + last_consultation__new_discharge_reason: o, + }) + } + /> +
+ )}
Telemedicine