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

Improve visual feedback when filters are applied in CNS and Live Feed page #8156

Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import useFilters from "../../../Common/hooks/useFilters";
import { Fragment } from "react";
import CareIcon from "../../../CAREUI/icons/CareIcon";
import useSlug from "../../../Common/hooks/useSlug";
import { useTranslation } from "react-i18next";

interface Props {
perPageLimit: number;
Expand All @@ -16,6 +17,7 @@ interface Props {
}

const LiveMonitoringFilters = (props: Props) => {
const { t } = useTranslation();
const facilityId = useSlug("facility");
const { qParams, updateQuery, removeFilter, updatePage } = useFilters({
limit: props.perPageLimit,
Expand All @@ -25,9 +27,9 @@ const LiveMonitoringFilters = (props: Props) => {
<div className="flex flex-row-reverse items-center gap-4 md:flex-row">
<Popover className="relative">
<Popover.Button>
<ButtonV2 variant="secondary" border>
<ButtonV2 variant={qParams.location ? "primary" : "secondary"} border>
<CareIcon icon="l-setting" className="text-lg" />
Settings and Filters
{t("settings_and_filters")}
</ButtonV2>
</Popover.Button>
<Transition
Expand Down Expand Up @@ -73,37 +75,6 @@ const LiveMonitoringFilters = (props: Props) => {
/>
</div>
</div>
{/* <CheckBoxFormField
name="in_use_by_consultation"
label="Hide cameras without patient"
value={qParams.in_use_by_consultation === "true"}
onChange={({ name, value }) => {
if (value) {
updateQuery({ [name]: value });
} else {
removeFilter(name);
}
}}
labelClassName="text-sm"
errorClassName="hidden"
/>
<CheckBoxFormField
name="is_working"
label="Camera is Working"
value={
qParams.is_working === "true" ||
qParams.is_working === undefined
}
onChange={({ name, value }) => {
if (value) {
updateQuery({ [name]: value });
} else {
removeFilter(name);
}
}}
labelClassName="text-sm"
errorClassName="hidden"
/> */}
<ButtonV2
variant="secondary"
border
Expand Down
21 changes: 14 additions & 7 deletions src/Components/Facility/CentralNursingStation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ export default function CentralNursingStation({ facilityId }: Props) {
asset_class: "HL7MONITOR",
ordering: qParams.ordering || "bed__name",
bed_is_occupied:
(qParams.hide_monitors_without_patient ?? "true") === "true" ||
undefined,
qParams.monitors_without_patient === "true" ? undefined : "true",
},
});

Expand Down Expand Up @@ -81,9 +80,17 @@ export default function CentralNursingStation({ facilityId }: Props) {
<div className="flex flex-row-reverse items-center gap-4 md:flex-row">
<Popover className="relative">
<Popover.Button>
<ButtonV2 variant="secondary" border>
<ButtonV2
variant={
qParams.location ||
qParams.monitors_without_patient === "true"
? "primary"
: "secondary"
}
border
>
<CareIcon icon="l-setting" className="text-lg" />
Settings and Filters
{t("settings_and_filters")}
</ButtonV2>
</Popover.Button>
<Transition
Expand Down Expand Up @@ -150,10 +157,10 @@ export default function CentralNursingStation({ facilityId }: Props) {
errorClassName="hidden"
/>
<CheckBoxFormField
name="hide_monitors_without_patient"
label="Hide Monitors without Patient"
name="monitors_without_patient"
label="Include monitors without patient"
value={JSON.parse(
qParams.hide_monitors_without_patient ?? true,
qParams.monitors_without_patient ?? "false",
)}
onChange={(e) => updateQuery({ [e.name]: `${e.value}` })}
labelClassName="text-sm"
Expand Down
1 change: 1 addition & 0 deletions src/Locale/en/Common.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"apply": "Apply",
"filter_by": "Filter By",
"filter": "Filter",
"settings_and_filters": "Settings and Filters",
"ordering": "Ordering",
"phone_number": "Phone Number",
"international_mobile": "International Mobile",
Expand Down
Loading