diff --git a/src/components/accessories/admin/exams/examsTable/ExamsTable.tsx b/src/components/accessories/admin/exams/examsTable/ExamsTable.tsx index 50835219b..419e607ac 100644 --- a/src/components/accessories/admin/exams/examsTable/ExamsTable.tsx +++ b/src/components/accessories/admin/exams/examsTable/ExamsTable.tsx @@ -48,7 +48,7 @@ export const ExamsTable = ({ onDelete, onEdit, headerActions }: IOwnProps) => { const filters: TFilterField[] = [ { - key: "type", + key: "examtype", label: t("exam.examtype"), type: "select", options: examTypesOptions, @@ -124,7 +124,10 @@ export const ExamsTable = ({ onDelete, onEdit, headerActions }: IOwnProps) => { onDelete={onDelete} headerActions={headerActions} filterColumns={filters} - rawData={data ?? []} + rawData={(data ?? []).map((exam) => ({ + ...exam, + examtype: exam.examtype?.code, + }))} manualFilter={false} rowKey="code" /> diff --git a/src/components/accessories/admin/operations/Operations.tsx b/src/components/accessories/admin/operations/Operations.tsx index 3b4e0cffc..01c07fb92 100644 --- a/src/components/accessories/admin/operations/Operations.tsx +++ b/src/components/accessories/admin/operations/Operations.tsx @@ -2,6 +2,7 @@ import { useAppDispatch } from "libraries/hooks/redux"; import React, { useEffect } from "react"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router"; +import { getOperationTypes } from "state/types/operations"; import { PATHS } from "../../../../consts"; import { OperationDTO } from "../../../../generated"; import { @@ -20,6 +21,7 @@ export const Operations = () => { useEffect(() => { dispatch(getOperations()); + dispatch(getOperationTypes()); return () => { dispatch(deleteOperationReset()); diff --git a/src/components/accessories/admin/users/usersTable/UsersTable.tsx b/src/components/accessories/admin/users/usersTable/UsersTable.tsx index f76cb76cb..7c5a332a9 100644 --- a/src/components/accessories/admin/users/usersTable/UsersTable.tsx +++ b/src/components/accessories/admin/users/usersTable/UsersTable.tsx @@ -9,6 +9,7 @@ import InfoBox from "../../../infoBox/InfoBox"; import Table from "../../../table/Table"; import { TFilterField } from "../../../table/filter/types"; +import { getUserGroups } from "state/usergroups"; import classes from "./UsersTable.module.scss"; interface IOwnProps { @@ -21,6 +22,7 @@ export const UsersTable = ({ headerActions }: IOwnProps) => { useEffect(() => { dispatch(getUsers({})); + dispatch(getUserGroups()); }, [dispatch]); const header = ["userName", "userGroupName", "desc"]; @@ -31,8 +33,21 @@ export const UsersTable = ({ headerActions }: IOwnProps) => { desc: t("user.description"), }; const order = ["userName", "userGroupName", "desc"]; + const userGroupOptions = useAppSelector( + (state) => + state.usergroups.groupList.data?.map((item) => ({ + value: item.code ?? "", + label: item.desc ?? item.code ?? "", + })) ?? [] + ); const filters: TFilterField[] = [ + { + key: "userGroupName", + label: t("user.groups"), + type: "select", + options: userGroupOptions, + }, { key: "userName", label: t("user.username"), type: "text" }, ]; @@ -75,7 +90,10 @@ export const UsersTable = ({ headerActions }: IOwnProps) => { filterColumns={filters} manualFilter={false} isCollapsabile={false} - rawData={data} + rawData={(data ?? []).map((user) => ({ + ...user, + userGroupName: user.userGroupName?.code, + }))} rowKey="userName" headerActions={headerActions} />