diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 35790e77b16..4a490f34e78 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -46,6 +46,15 @@ export const USER_TYPE_OPTIONS = [ { id: "StateAdmin", role: "State Admin", readOnly: false }, ] as const; +export const USER_LAST_ACTIVE_OPTIONS = [ + { id: 1, text: "24 hours" }, + { id: 7, text: "7 days" }, + { id: 30, text: "30 days" }, + { id: 90, text: "90 days" }, + { id: 365, text: "1 Year" }, + { id: "never", text: "Never" }, +]; + export type UserRole = (typeof USER_TYPE_OPTIONS)[number]["id"]; export const USER_TYPES = USER_TYPE_OPTIONS.map((o) => o.id); diff --git a/src/Components/Users/ManageUsers.tsx b/src/Components/Users/ManageUsers.tsx index 446b210aa9d..9660f13c269 100644 --- a/src/Components/Users/ManageUsers.tsx +++ b/src/Components/Users/ManageUsers.tsx @@ -94,6 +94,7 @@ export default function ManageUsers() { user_type: qParams.user_type, district_id: qParams.district, home_facility: qParams.home_facility, + last_active_days: qParams.last_active_days, }, }); @@ -557,6 +558,13 @@ export default function ManageUsers() { "home_facility", qParams.home_facility ? homeFacilityData?.name || "" : "", ), + value( + "Last Active", + "last_active_days", + qParams.last_active_days === "never" + ? "Never" + : `in the last ${qParams.last_active_days} day${qParams.last_active_days > 1 ? "s" : ""}`, + ), ]} /> diff --git a/src/Components/Users/UserFilter.tsx b/src/Components/Users/UserFilter.tsx index d5c16d22571..f79968cef4f 100644 --- a/src/Components/Users/UserFilter.tsx +++ b/src/Components/Users/UserFilter.tsx @@ -2,7 +2,10 @@ import { parsePhoneNumber } from "../../Utils/utils"; import TextFormField from "../Form/FormFields/TextFormField"; import SelectMenuV2 from "../Form/SelectMenuV2"; import { FieldLabel } from "../Form/FormFields/FormField"; -import { USER_TYPE_OPTIONS } from "../../Common/constants"; +import { + USER_LAST_ACTIVE_OPTIONS, + USER_TYPE_OPTIONS, +} from "../../Common/constants"; import useMergeState from "../../Common/hooks/useMergeState"; import PhoneNumberFormField from "../Form/FormFields/PhoneNumberFormField"; import FiltersSlideover from "../../CAREUI/interactive/FiltersSlideover"; @@ -35,6 +38,7 @@ export default function UserFilter(props: any) { state: filter.state || "", home_facility: filter.home_facility || "", home_facility_ref: null, + last_active_days: filter.last_active_days || "", }); useQuery(routes.getAnyFacility, { @@ -53,6 +57,7 @@ export default function UserFilter(props: any) { district, state, home_facility, + last_active_days, } = filterState; const data = { first_name: first_name || "", @@ -63,6 +68,7 @@ export default function UserFilter(props: any) { district: district || "", state: district ? state || "" : "", home_facility: home_facility || "", + last_active_days: last_active_days || "", }; if (state && !district) { Notify.Warn({ @@ -142,6 +148,21 @@ export default function UserFilter(props: any) { /> +