From db5896d29b39375c58bd6de0f87aa96f296daad2 Mon Sep 17 00:00:00 2001 From: M1kola Date: Fri, 26 Jul 2024 19:53:57 +0300 Subject: [PATCH] employees table --- src/assets/icons/report.svg | 3 + .../PartnerСategories/PartnerСategories.jsx | 65 +++++++++++----- .../partnerСategories.scss | 77 ++++++++++++++++++- 3 files changed, 125 insertions(+), 20 deletions(-) create mode 100644 src/assets/icons/report.svg diff --git a/src/assets/icons/report.svg b/src/assets/icons/report.svg new file mode 100644 index 00000000..0ef93371 --- /dev/null +++ b/src/assets/icons/report.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/pages/PartnerСategories/PartnerСategories.jsx b/src/pages/PartnerСategories/PartnerСategories.jsx index d37bd0a4..9586dd73 100644 --- a/src/pages/PartnerСategories/PartnerСategories.jsx +++ b/src/pages/PartnerСategories/PartnerСategories.jsx @@ -17,6 +17,7 @@ import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadc import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; import rightArrow from "assets/icons/arrows/arrowRight.svg"; +import report from "assets/icons/report.svg"; // import PartnerPersonCard from "@components/PartnerPersonCard/PartnerPersonCard"; // import { useDispatch } from "react-redux"; @@ -33,6 +34,7 @@ import rightArrow from "assets/icons/arrows/arrowRight.svg"; // import TestImg from "assets/images/partnerProfile/PersonalTesters.svg"; // import BackEndImg from "assets/images/partnerProfile/personalBackEnd.svg"; import "./partnerСategories.scss"; +import { LEVELS, SKILLS } from "@utils/constants"; export const PartnerCategories = () => { // const dispatch = useDispatch(); if (localStorage.getItem("role_status") !== "18") { @@ -46,6 +48,17 @@ export const PartnerCategories = () => { const [search, setSearch] = useState(""); + const tabs = [ + { + name: 'Фронтенд', + value: 2 + }, + { + name: 'Бэкенд', + value: 1 + } + ] + const COLUMNS = [ { label: "", @@ -59,18 +72,15 @@ export const PartnerCategories = () => { }, { label: "Данные", - renderCell: (item) =>

{item?.employee.fio}

, + renderCell: (item) =>

{item?.employee.fio}

{LEVELS[item?.resume.userCard.level]} / {SKILLS[item?.resume.userCard.position_id]}
, // sort: { sortKey: "NAME" } }, { - label: "Резюме", + label: "Участвует в проекте", renderCell: (item) => ( - - Резюме -
- arrow -
- +
+ {item.resume.userCard.at_project ?
item.resume.userCard.at_project
: Нет проектов} +
) }, { @@ -80,6 +90,7 @@ export const PartnerCategories = () => { className="table__link" to={`/profile/employees/report/${item.user_id}`} > + report Подробный отчет
arrow @@ -88,14 +99,12 @@ export const PartnerCategories = () => { ) }, { - label: "Действие", - renderCell: (item) => ( - Действие, + renderCell: () => ( +
- 123 - +
) } ]; @@ -125,9 +134,23 @@ export const PartnerCategories = () => { useEffect(() => { setLoader(true); apiRequest("/project/my-employee").then((el) => { - setLoader(false); - setNodes(el?.managerEmployees); - setInitialNodes(el.managerEmployees); + const fetchResumes = async () => { + const promises = el.managerEmployees.map(async (manager) => { + const resume = await apiRequest(`/resume?userId=${manager.user_id}`); + return { ...manager, resume }; // Возвращаем объект с добавленным ключом resume + }); + + try { + const updatedManagers = await Promise.all(promises); + setInitialNodes(updatedManagers); + setNodes(updatedManagers); + setLoader(false); + } catch (error) { + console.error("Ошибка при получении резюме:", error); + } + }; + + fetchResumes(); }); }, []); @@ -276,6 +299,12 @@ export const PartnerCategories = () => { onChange={handleSearch} /> +
+
Все
+ {tabs.map((tab) => { + return
{tab.name}
+ })} +