Skip to content

Commit

Permalink
Hide discharge reason filter for non state admin users (#7788)
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad authored May 10, 2024
1 parent 15f7d44 commit 0b042f2
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions src/Components/Patient/PatientFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -377,23 +379,27 @@ export default function PatientFilter(props: any) {
}
/>
</div>
<div className="w-full flex-none" id="discharge-reason-select">
<FieldLabel className="text-sm">Discharge Reason</FieldLabel>
<SelectMenuV2
id="last_consultation__new_discharge_reason"
placeholder="Select discharge reason"
options={DISCHARGE_REASONS}
value={filterState.last_consultation__new_discharge_reason}
optionValue={(o) => o.id}
optionLabel={(o) => o.text}
onChange={(o) =>
setFilterState({
...filterState,
last_consultation__new_discharge_reason: o,
})
}
/>
</div>
{["StateAdmin", "StateReadOnlyAdmin"].includes(
authUser.user_type,
) && (
<div className="w-full flex-none" id="discharge-reason-select">
<FieldLabel className="text-sm">Discharge Reason</FieldLabel>
<SelectMenuV2
id="last_consultation__new_discharge_reason"
placeholder="Select discharge reason"
options={DISCHARGE_REASONS}
value={filterState.last_consultation__new_discharge_reason}
optionValue={(o) => o.id}
optionLabel={(o) => o.text}
onChange={(o) =>
setFilterState({
...filterState,
last_consultation__new_discharge_reason: o,
})
}
/>
</div>
)}
<div className="w-full flex-none">
<FieldLabel className="text-sm">Telemedicine</FieldLabel>
<SelectMenuV2
Expand Down

0 comments on commit 0b042f2

Please sign in to comment.