employees table

This commit is contained in:
2024-07-26 19:53:57 +03:00
parent 4697383bf3
commit db5896d29b
3 changed files with 125 additions and 20 deletions

View File

@ -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) => <p>{item?.employee.fio}</p>,
renderCell: (item) => <div className="table__info"><p>{item?.employee.fio}</p><span>{LEVELS[item?.resume.userCard.level]} / {SKILLS[item?.resume.userCard.position_id]}</span></div>,
// sort: { sortKey: "NAME" }
},
{
label: "Резюме",
label: "Участвует в проекте",
renderCell: (item) => (
<Link className="table__link" to={`/candidate/${item.user_id}`}>
Резюме
<div className="img__wrapper">
<img src={rightArrow} alt="arrow" />
</div>
</Link>
<div className="table__project">
{item.resume.userCard.at_project ? <div>item.resume.userCard.at_project</div> : <span>Нет проектов</span>}
</div>
)
},
{
@ -80,6 +90,7 @@ export const PartnerCategories = () => {
className="table__link"
to={`/profile/employees/report/${item.user_id}`}
>
<img src={report} alt="report" />
Подробный отчет
<div className="img__wrapper">
<img src={rightArrow} alt="arrow" />
@ -88,14 +99,12 @@ export const PartnerCategories = () => {
)
},
{
label: "Действие",
renderCell: (item) => (
<Link
className="table__link"
to={`/profile/employees/report/${item.user_id}`}
label: <span className="table__action">Действие</span>,
renderCell: () => (
<div
className="table__more"
>
123
</Link>
</div>
)
}
];
@ -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}
/>
</label>
<div className="table__tabs">
<div className="table__tab">Все</div>
{tabs.map((tab) => {
return <div className="table__tab" key={tab.value}>{tab.name}</div>
})}
</div>
<CompactTable
columns={COLUMNS}
data={data}

View File

@ -178,10 +178,37 @@
}
}
&__tabs {
display: flex;
margin: 0 auto 30px 18px;
padding: 4px 8px;
gap: 10px;
align-items: center;
font-size: 16px;
background: rgba(240, 242, 245, 1);
border-radius: 5px;
}
&__avatar {
max-width: 45px;
width: 40px;
height: 40px;
margin-left: 18px;
}
&__info {
p {
color: rgba(46, 58, 89, 1);
font-size: 14px;
font-weight: 500;
line-height: 17.5px;
}
span {
color: rgba(155, 171, 197, 1);
font-size: 14px;
line-height: 17.5px;
}
}
&__link {
display: flex;
column-gap: 10px;
@ -199,11 +226,56 @@
justify-content: center;
img {
width: 14px;
width: 8px;
}
}
}
&__project {
color: rgba(46, 58, 89, 1);
font-size: 14px;
font-weight: 500;
line-height: 17.5px;
}
&__action {
color: rgba(155, 171, 197, 1);
font-size: 14px;
font-weight: 400;
}
&__more {
position: relative;
height: 30px;
cursor: pointer;
width: 10px;
display: flex;
align-items: center;
justify-content: space-evenly;
flex-direction: column;
&:before {
content: '';
display: flex;
top: 2px;
width: 4px;
height: 4px;
background: rgba(155, 171, 197, 1);
border-radius: 50px;
position: relative;
}
&:after {
content: '';
display: flex;
bottom: 2px;
width: 4px;
height: 4px;
background: rgba(155, 171, 197, 1);
border-radius: 50px;
position: relative;
}
}
&__pagination {
width: 100%;
display: flex;
@ -251,6 +323,7 @@
}
table {
--data-table-library_grid-template-columns: minmax(0px, 0.5fr) minmax(0px, 1.5fr) minmax(0px, 1fr) minmax(0px, 1fr) minmax(0px, 1fr) !important;
th {
border-top: 0;
border-bottom: 1px solid #EDEDED;