From e251711b4aa9277175f5e4053d661c6de8fc4345 Mon Sep 17 00:00:00 2001 From: Mikola Date: Sun, 10 Mar 2024 23:28:39 +0300 Subject: [PATCH] table employees --- .../PartnerСategories/PartnerСategories.jsx | 89 +++++++++++++------ 1 file changed, 60 insertions(+), 29 deletions(-) diff --git a/src/pages/PartnerСategories/PartnerСategories.jsx b/src/pages/PartnerСategories/PartnerСategories.jsx index db0d230f..5abf140f 100644 --- a/src/pages/PartnerСategories/PartnerСategories.jsx +++ b/src/pages/PartnerСategories/PartnerСategories.jsx @@ -1,9 +1,10 @@ -import React, { useEffect, useState } from "react"; -import { CompactTable } from "@table-library/react-table-library/compact"; -import { useTheme } from "@table-library/react-table-library/theme"; import { getTheme } from "@table-library/react-table-library/baseline"; +import { CompactTable } from "@table-library/react-table-library/compact"; import { useSort } from "@table-library/react-table-library/sort"; +import { useTheme } from "@table-library/react-table-library/theme"; +import React, { useEffect, useState } from "react"; import { Link, Navigate } from "react-router-dom"; + import { urlForLocal } from "@utils/helper"; import { apiRequest } from "@api/request"; @@ -14,6 +15,8 @@ import { Navigation } from "@components/Navigation/Navigation"; import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs"; import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; +import rightArrow from "assets/icons/arrows/arrowRight.svg"; + // import PartnerPersonCard from "@components/PartnerPersonCard/PartnerPersonCard"; // import { useDispatch } from "react-redux"; // import { setPartnerEmployees } from "@redux/outstaffingSlice"; @@ -28,9 +31,7 @@ import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; // import SmmImg from "assets/images/partnerProfile/PersonalSMM.svg"; // import TestImg from "assets/images/partnerProfile/PersonalTesters.svg"; // import BackEndImg from "assets/images/partnerProfile/personalBackEnd.svg"; - import "./partnerСategories.scss"; -import rightArrow from "assets/icons/arrows/arrowRight.svg"; export const PartnerCategories = () => { // const dispatch = useDispatch(); @@ -40,28 +41,41 @@ export const PartnerCategories = () => { const [loader, setLoader] = useState(false); const theme = useTheme(getTheme()); - const [nodes, setNodes] = useState([ - ]) - const [initialNodes, setInitialNodes] = useState([]) + const [nodes, setNodes] = useState([]); + const [initialNodes, setInitialNodes] = useState([]); - const [search, setSearch] = useState('') + const [search, setSearch] = useState(""); const COLUMNS = [ - { label: 'Аватар', renderCell: (item) => avatar }, { - label: 'ФИО', - renderCell: (item) => item?.employee.fio, - sort: { sortKey: "NAME" }, + label: "Аватар", + renderCell: (item) => ( + avatar + ) }, - { label: 'Резюме', renderCell: (item) => - Подробный отчет -
- arrow -
- }, + { + label: "ФИО", + renderCell: (item) => item?.employee.fio, + sort: { sortKey: "NAME" } + }, + { + label: "Резюме", + renderCell: (item) => ( + + Подробный отчет +
+ arrow +
+ + ) + } ]; let data = { nodes }; @@ -69,12 +83,13 @@ export const PartnerCategories = () => { const sort = useSort( data, { - onChange: onSortChange, + onChange: onSortChange }, { sortFns: { - NAME: (array) => array.sort((a, b) => a.employee.fio.localeCompare(b.employee.fio)), - }, + NAME: (array) => + array.sort((a, b) => a.employee.fio.localeCompare(b.employee.fio)) + } } ); @@ -89,7 +104,13 @@ export const PartnerCategories = () => { const handleSearch = (event) => { setSearch(event.target.value); - setNodes(initialNodes.filter((item) => item.employee.fio.toLowerCase().includes(event.target.value.toLowerCase()))) + setNodes( + initialNodes.filter((item) => + item.employee.fio + .toLowerCase() + .includes(event.target.value.toLowerCase()) + ) + ); }; function onSortChange(action, state) { @@ -216,11 +237,21 @@ export const PartnerCategories = () => {
{Boolean(initialNodes.length) ? ( <> -