149 lines
5.0 KiB
JavaScript
Raw Normal View History

2023-05-25 16:42:37 +03:00
import React, { useState } from "react";
import { useSelector } from "react-redux";
2023-05-25 16:42:37 +03:00
import { getProfileInfo } from "../../redux/outstaffingSlice";
import { urlForLocal } from "../../helper";
2023-05-25 16:42:37 +03:00
import { ProfileHeader } from "../../components/ProfileHeader/ProfileHeader";
import { ProfileBreadcrumbs } from "../../components/ProfileBreadcrumbs/ProfileBreadcrumbs";
import { Footer } from "../../components/Footer/Footer";
import { CardControl } from "../../components/CardControl/CardControl";
import { Navigation } from "../../components/Navigation/Navigation";
2023-05-25 16:42:37 +03:00
import reportsIcon from "../../assets/images/reports.png";
import summaryIcon from "../../assets/icons/summaryIcon.png";
import timerIcon from "../../assets/icons/timerIcon.png";
import paymentIcon from "../../assets/icons/paymentIcon.png";
import settingIcon from "../../assets/icons/settingIcon.png";
import avatarMok from "../../assets/images/avatarMok.png";
2023-05-25 16:42:37 +03:00
import "./profile.scss";
export const Profile = () => {
const profileInfo = useSelector(getProfileInfo);
2023-05-25 16:42:37 +03:00
const [user] = useState(
localStorage.getItem("role_status") === "18" ? "partner" : "developer"
);
const [profileItemsInfo] = useState({
developer: [
{
2023-05-25 16:42:37 +03:00
path: "profile/calendar",
img: reportsIcon,
2023-05-25 16:42:37 +03:00
title: "Ваша отчетность",
description: "<span></span>Отработанных в этом месяце часов",
},
{
2023-05-25 16:42:37 +03:00
path: "profile/summary",
img: summaryIcon,
2023-05-25 16:42:37 +03:00
title: "Данные и резюме",
description: "Ваше резюме<br/><span>заполнено</span>",
},
{
2023-05-25 16:42:37 +03:00
path: "profile/tracker",
img: timerIcon,
2023-05-25 16:42:37 +03:00
title: "Трекер времени",
description: "Сколько времени занимает<br/> выполнение задач",
},
{
2023-05-25 16:42:37 +03:00
path: "profile/payouts",
img: paymentIcon,
2023-05-25 16:42:37 +03:00
title: "Выплаты",
description: "У вас <span>подтвержден</span><br/> статус самозанятого",
},
{
2023-05-25 16:42:37 +03:00
path: "profile/settings",
img: settingIcon,
2023-05-25 16:42:37 +03:00
title: "Настройки аккаунта",
description: "Перейдите чтобы начать<br/> редактирование",
},
],
partner: [
{
2023-05-25 16:42:37 +03:00
path: "profile/requests",
img: reportsIcon,
2023-05-25 16:42:37 +03:00
title: "Запросы и открытые позиции",
description:
"<span>У вас 2 вакансии<br/></span>открытые от лица компании",
},
{
2023-05-25 16:42:37 +03:00
path: "profile/categories",
img: summaryIcon,
2023-05-25 16:42:37 +03:00
title: "Данные персонала",
description: "Наши специалисты <br/><span>уже работающие у вас</span>",
},
{
2023-05-25 16:42:37 +03:00
path: "profile/tracker",
img: timerIcon,
2023-05-25 16:42:37 +03:00
title: "Трекер времени",
description: "Контроль времени и<br/> выполнение задач",
},
{
2023-05-25 16:42:37 +03:00
path: "profile/treaties",
img: paymentIcon,
2023-05-25 16:42:37 +03:00
title: "Договора и отчетность",
description: "Ключевые условия<br/> договора",
},
{
2023-05-25 16:42:37 +03:00
path: "profile/settings",
img: settingIcon,
2023-05-25 16:42:37 +03:00
title: "Настройки аккаунта",
description: "Перейдите чтобы начать<br/> редактирование",
},
],
});
return (
2023-05-25 16:42:37 +03:00
<div className="profile">
<ProfileHeader />
<Navigation />
<div className="container">
<ProfileBreadcrumbs links={[{ name: "Главная", link: "/profile" }]} />
<h2 className="profile__title">
{user === "developer" ? (
<span>
<p>Добрый день,&nbsp;</p>
{profileInfo.fio}
</span>
) : (
"ООО НДВ Консалтинг"
)}
</h2>
<div className="summary__info">
<div className="summary__person">
<img
src={
profileInfo.photo ? urlForLocal(profileInfo.photo) : avatarMok
}
className="summary__avatar"
alt="avatar"
/>
<p className="summary__name">
{user === "developer" ? (
<span>
{profileInfo.fio}, {profileInfo.specification} разработчик
</span>
) : (
"ООО НДВ Консалтинг"
)}
</p>
</div>
2023-05-25 16:42:37 +03:00
</div>
<div className="profile__items">
{profileItemsInfo[user].map((item, index) => {
return (
<CardControl
description={item.description}
2023-04-19 20:22:06 +03:00
img={item.img}
path={item.path}
title={item.title}
key={index}
2023-05-25 16:42:37 +03:00
/>
);
})}
</div>
</div>
2023-05-25 16:42:37 +03:00
<Footer />
</div>
);
};