partner categories fixes

This commit is contained in:
Николай Полтщук 2024-08-09 21:09:02 +03:00
parent a156557d57
commit 214d309ffb

View File

@ -17,8 +17,8 @@ import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadc
import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader";
import rightArrow from "assets/icons/arrows/arrowRight.svg"; import rightArrow from "assets/icons/arrows/arrowRight.svg";
import folder from "assets/icons/folder.svg";
import report from "assets/icons/report.svg"; import report from "assets/icons/report.svg";
import folder from "assets/icons/folder.svg"
import "./partnerСategories.scss"; import "./partnerСategories.scss";
@ -65,8 +65,7 @@ export const PartnerCategories = () => {
<Link className="table__info" to={`/profile/summary/${item.user_id}`}> <Link className="table__info" to={`/profile/summary/${item.user_id}`}>
<p>{item?.employee.fio}</p> <p>{item?.employee.fio}</p>
<span> <span>
{item?.employee.level_title} /{" "} {item?.employee.level_title} / {item?.employee.position.name}
{item?.employee.position.name}
</span> </span>
</Link> </Link>
) )
@ -77,7 +76,12 @@ export const PartnerCategories = () => {
<div className="table__project"> <div className="table__project">
{item?.employee.projects.length ? ( {item?.employee.projects.length ? (
item.employee.projects.map((project) => { item.employee.projects.map((project) => {
return <div className="table__project__item" key={project.id}><img src={folder} alt="folder" /> <p>{project.project.name}</p></div> return (
<div className="table__project__item" key={project.id}>
<img src={folder} alt="folder" />{" "}
<p>{project.project.name}</p>
</div>
);
}) })
) : ( ) : (
<span>Нет проектов</span> <span>Нет проектов</span>
@ -131,9 +135,9 @@ export const PartnerCategories = () => {
useEffect(() => { useEffect(() => {
setLoader(true); setLoader(true);
apiRequest("/project/my-employee").then((el) => { apiRequest("/project/my-employee").then((el) => {
setNodes(el.managerEmployees) setNodes(el.managerEmployees);
setInitialNodes(el.managerEmployees) setInitialNodes(el.managerEmployees);
setLoader(false) setLoader(false);
}); });
}, []); }, []);
@ -201,8 +205,7 @@ export const PartnerCategories = () => {
setActiveTab(tab.name); setActiveTab(tab.name);
setNodes( setNodes(
initialNodes.filter( initialNodes.filter(
(item) => (item) => item.employee.position.id === tab.value
item.employee.position.id === tab.value
) )
); );
}} }}
@ -225,11 +228,14 @@ export const PartnerCategories = () => {
sort={sort} sort={sort}
pagination={pagination} pagination={pagination}
/> />
{Boolean(nodes.length) && pagination.state.getPages(data.nodes).length > 1 && {Boolean(nodes.length) &&
pagination.state.getPages(data.nodes).length > 1 && (
<div className="table__pagination"> <div className="table__pagination">
<button <button
className={ className={
pagination.state.page === 0 ? "switch disable" : "switch" pagination.state.page === 0
? "switch disable"
: "switch"
} }
type="button" type="button"
disabled={pagination.state.page === 0} disabled={pagination.state.page === 0}
@ -240,7 +246,9 @@ export const PartnerCategories = () => {
{"<"} {"<"}
</button> </button>
<span className="table__pages"> <span className="table__pages">
{pagination.state.getPages(data.nodes).map((_, index) => ( {pagination.state
.getPages(data.nodes)
.map((_, index) => (
<button <button
key={index} key={index}
type="button" type="button"
@ -274,7 +282,7 @@ export const PartnerCategories = () => {
{">"} {">"}
</button> </button>
</div> </div>
} )}
</> </>
) : ( ) : (
<div className="partner-categories__empty"> <div className="partner-categories__empty">