diff --git a/apps/web/src/components/models/department/department-children-select.tsx b/apps/web/src/components/models/department/department-children-select.tsx new file mode 100644 index 0000000..abe6975 --- /dev/null +++ b/apps/web/src/components/models/department/department-children-select.tsx @@ -0,0 +1,26 @@ +import { useAuth } from "@web/src/providers/auth-provider" +import { api } from "@nice/client" +import { Select } from "antd" +import { Department } from "packages/common/dist" + +export default function DepartmentChildrenSelect() { + const { user, isAuthenticated } = useAuth() + + const { data: depts, isLoading: deptsLoading } + : { data: Department[], isLoading: boolean } + = isAuthenticated ? api.department.getChildSimpleTree.useQuery({ + rootId: user.deptId + }) : { data: null, isLoading: false } + + const deptSelectOptions = depts?.map((dept) => ({ + label: dept.name, + value: dept.id + })) + return ( + + - +