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

Hide discharge reason filter for non state admin users #7788

Merged
Merged
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
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
Loading