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 rightArrow from "assets/icons/arrows/arrowRight.svg";
import folder from "assets/icons/folder.svg";
import report from "assets/icons/report.svg";
import folder from "assets/icons/folder.svg"
import "./partnerСategories.scss";
@ -65,8 +65,7 @@ export const PartnerCategories = () => {
<Link className="table__info" to={`/profile/summary/${item.user_id}`}>
<p>{item?.employee.fio}</p>
<span>
{item?.employee.level_title} /{" "}
{item?.employee.position.name}
{item?.employee.level_title} / {item?.employee.position.name}
</span>
</Link>
)
@ -77,7 +76,12 @@ export const PartnerCategories = () => {
<div className="table__project">
{item?.employee.projects.length ? (
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>
@ -131,9 +135,9 @@ export const PartnerCategories = () => {
useEffect(() => {
setLoader(true);
apiRequest("/project/my-employee").then((el) => {
setNodes(el.managerEmployees)
setInitialNodes(el.managerEmployees)
setLoader(false)
setNodes(el.managerEmployees);
setInitialNodes(el.managerEmployees);
setLoader(false);
});
}, []);
@ -201,8 +205,7 @@ export const PartnerCategories = () => {
setActiveTab(tab.name);
setNodes(
initialNodes.filter(
(item) =>
item.employee.position.id === tab.value
(item) => item.employee.position.id === tab.value
)
);
}}
@ -225,56 +228,61 @@ export const PartnerCategories = () => {
sort={sort}
pagination={pagination}
/>
{Boolean(nodes.length) && pagination.state.getPages(data.nodes).length > 1 &&
<div className="table__pagination">
<button
className={
pagination.state.page === 0 ? "switch disable" : "switch"
}
type="button"
disabled={pagination.state.page === 0}
onClick={() =>
pagination.fns.onSetPage(pagination.state.page - 1)
}
>
{"<"}
</button>
<span className="table__pages">
{pagination.state.getPages(data.nodes).map((_, index) => (
{Boolean(nodes.length) &&
pagination.state.getPages(data.nodes).length > 1 && (
<div className="table__pagination">
<button
key={index}
type="button"
className={
pagination.state.page === index
? "page page--active "
: "page"
pagination.state.page === 0
? "switch disable"
: "switch"
}
type="button"
disabled={pagination.state.page === 0}
onClick={() =>
pagination.fns.onSetPage(pagination.state.page - 1)
}
onClick={() => pagination.fns.onSetPage(index)}
>
{index + 1}
{"<"}
</button>
))}
</span>
<button
className={
pagination.state.page + 1 ===
pagination.state.getPages(data.nodes).length
? "switch disable"
: "switch"
}
type="button"
disabled={
pagination.state.page + 1 ===
pagination.state.getPages(data.nodes).length
}
onClick={() =>
pagination.fns.onSetPage(pagination.state.page + 1)
}
>
{">"}
</button>
</div>
}
<span className="table__pages">
{pagination.state
.getPages(data.nodes)
.map((_, index) => (
<button
key={index}
type="button"
className={
pagination.state.page === index
? "page page--active "
: "page"
}
onClick={() => pagination.fns.onSetPage(index)}
>
{index + 1}
</button>
))}
</span>
<button
className={
pagination.state.page + 1 ===
pagination.state.getPages(data.nodes).length
? "switch disable"
: "switch"
}
type="button"
disabled={
pagination.state.page + 1 ===
pagination.state.getPages(data.nodes).length
}
onClick={() =>
pagination.fns.onSetPage(pagination.state.page + 1)
}
>
{">"}
</button>
</div>
)}
</>
) : (
<div className="partner-categories__empty">