Compare commits

..

3 Commits

Author SHA1 Message Date
9cb59b61d6 Merge pull request 'developer_resume' (#41) from developer_resume into main
Reviewed-on: #41
2024-08-07 18:07:22 +03:00
4464324ae2 developer resume 2024-08-07 18:06:10 +03:00
4cd3118649 developer resume 2024-08-07 18:06:03 +03:00
4 changed files with 78 additions and 45 deletions

View File

@ -92,13 +92,13 @@ export const PartnerEmployeeReport = () => {
<>
<div className="employee-report__info">
<div className="employee-report__name">
<h2>{userInfo.fio}</h2>
<p>{userInfo.position}</p>
<h2>{userInfo?.userCard.fio}</h2>
<p>{userInfo?.userCard.position.name}</p>
</div>
<div className="employee-report__skills">
{userInfo?.stack &&
userInfo.stack.map((skill, index) => {
return <span key={index}>{skill}</span>;
{userInfo?.userCard?.skillValues &&
userInfo?.userCard?.skillValues.map((skill) => {
return <span key={skill.id}>{skill.skill.name}</span>;
})}
</div>
</div>

View File

@ -65,23 +65,25 @@ export const PartnerCategories = () => {
{
label: "",
renderCell: (item) => (
<img
className="table__avatar"
src={urlForLocal(item?.employee.avatar)}
alt="avatar"
/>
<Link to={`/profile/summary/${item.user_id}`}>
<img
className="table__avatar"
src={urlForLocal(item?.employee.avatar)}
alt="avatar"
/>
</Link>
)
},
{
label: "Данные",
renderCell: (item) => (
<div className="table__info">
<Link className="table__info" to={`/profile/summary/${item.user_id}`}>
<p>{item?.employee.fio}</p>
<span>
{LEVELS[item?.resume.userCard.level]} /{" "}
{SKILLS[item?.resume.userCard.position_id]}
</span>
</div>
</Link>
)
// sort: { sortKey: "NAME" }
},

View File

@ -2,7 +2,7 @@ import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import { CKEditor } from "@ckeditor/ckeditor5-react";
import React, { useEffect, useState } from "react";
import { useSelector } from "react-redux";
import { Navigate } from "react-router-dom";
import { useParams } from "react-router-dom";
import { getProfileInfo } from "@redux/outstaffingSlice";
@ -27,19 +27,18 @@ import avatarMok from "assets/images/avatarMok.webp";
import "./summary.scss";
export const Summary = () => {
if (localStorage.getItem("role_status") === "18") {
return <Navigate to="/profile" replace />;
}
const profileInfo = useSelector(getProfileInfo);
const [openGit, setOpenGit] = useState(false);
const [gitInfo, setGitInfo] = useState([]);
const [editSummaryOpen, setEditSummaryOpen] = useState(false);
const [editSkills, setEditSkills] = useState(false);
const [userInfo, setUserInfo] = useState({});
const [summary, setSummary] = useState("");
const [selectedSkills, setSelectedSkills] = useState([]);
const [selectSkillsOpen, setSelectSkillsOpen] = useState(false);
const [skillsList, seSkillsList] = useState([]);
const { showNotification } = useNotification();
const { id: userId } = useParams();
useEffect(() => {
apiRequest(
@ -48,8 +47,10 @@ export const Summary = () => {
}, []);
useEffect(() => {
setSummary(profileInfo.vc_text);
setSelectedSkills(profileInfo.skillValues);
if (!userId) {
setSummary(profileInfo.vc_text);
setSelectedSkills(profileInfo.skillValues);
}
}, [profileInfo]);
useEffect(() => {
@ -58,6 +59,22 @@ export const Summary = () => {
});
}, []);
useEffect(() => {
if (userId) {
apiRequest(`/resume?userId=${userId}`).then((res) => {
setUserInfo({
photo: res.userCard.photo,
fio: res.userCard.fio,
specification: res.userCard.specification,
level: res.userCard.level_title,
position: res.userCard.position.name
});
setSummary(res.userCard.vc_text);
setSelectedSkills(res.userCard.skillValues);
});
}
}, [userId]);
const addSkill = (skill) => {
const isSkillFound = selectedSkills.some(
(item) => item.skill_id == skill.id
@ -133,7 +150,9 @@ export const Summary = () => {
<div className="summary__person">
<img
src={
profileInfo?.photo
userId
? urlForLocal(userInfo.photo)
: profileInfo?.photo
? urlForLocal(profileInfo.photo)
: avatarMok
}
@ -141,12 +160,18 @@ export const Summary = () => {
alt="avatar"
/>
<p className="summary__name">
{profileInfo?.fio || profileInfo?.username}{" "}
{profileInfo.specification}
{userId
? userInfo.fio
: profileInfo?.fio || profileInfo?.username}{" "}
{userId ? userInfo.specification : profileInfo.specification}
</p>
<hr />
<div className="summary__direction">Front End</div>
<div className="summary__level">Middle+</div>
<div className="summary__direction">
{userId ? userInfo.position : profileInfo?.position?.name}
</div>
<div className="summary__level">
{userId ? userInfo.level : profileInfo?.level_title}
</div>
</div>
{!openGit && (
<button className="summary__git" onClick={() => setOpenGit(true)}>
@ -159,17 +184,19 @@ export const Summary = () => {
<div className="summary__skills skills__section">
<div className="summary__sections__head">
<h3>Основной стек</h3>
<button
className={editSkills ? "edit" : ""}
onClick={() => {
if (editSkills) {
setSkills();
}
setEditSkills(!editSkills);
}}
>
{editSkills ? "Сохранить" : "Редактировать"}
</button>
{!userId && (
<button
className={editSkills ? "edit" : ""}
onClick={() => {
if (editSkills) {
setSkills();
}
setEditSkills(!editSkills);
}}
>
{editSkills ? "Сохранить" : "Редактировать"}
</button>
)}
</div>
<div className="skills__section__items">
{editSkills ? (
@ -239,17 +266,19 @@ export const Summary = () => {
<div className="experience__block">
<div className="summary__sections__head">
<h3>Опыт работы</h3>
<button
className={editSummaryOpen ? "edit" : ""}
onClick={() => {
if (editSummaryOpen) {
editSummary();
}
setEditSummaryOpen(!editSummaryOpen);
}}
>
{editSummaryOpen ? "Сохранить" : "Редактировать"}
</button>
{!userId && (
<button
className={editSummaryOpen ? "edit" : ""}
onClick={() => {
if (editSummaryOpen) {
editSummary();
}
setEditSummaryOpen(!editSummaryOpen);
}}
>
{editSummaryOpen ? "Сохранить" : "Редактировать"}
</button>
)}
</div>
{editSummaryOpen ? (
<CKEditor

View File

@ -20,6 +20,7 @@ import { Profile } from "@pages/Profile/Profile";
import { ProjectTracker } from "@pages/ProjectTracker/ProjectTracker";
import { Stack } from "@pages/Stack/Stack";
import Statistics from "@pages/Statistics/Statistics";
import { Summary } from "@pages/Summary/Summary";
import { Tracker } from "@pages/Tracker/Tracker";
import { TrackerIntro } from "@pages/TrackerIntro/TrackerIntro";
import { ViewReport } from "@pages/ViewReport/ViewReport";
@ -64,6 +65,7 @@ export const PartnerPage = () => {
<Route exact path="requests-edit" element={<PartnerAddRequest />} />
<Route exact path="requests-bid" element={<PartnerBid />} />
<Route exact path="employees" element={<PartnerCategories />} />
<Route exact path="summary/:id" element={<Summary />} />
<Route
exact
path="employees/report/:uuid"