Merge branch 'main' of https://git.itguild.info/apuc/guild_front
This commit is contained in:
		| @@ -92,13 +92,13 @@ export const PartnerEmployeeReport = () => { | |||||||
|           <> |           <> | ||||||
|             <div className="employee-report__info"> |             <div className="employee-report__info"> | ||||||
|               <div className="employee-report__name"> |               <div className="employee-report__name"> | ||||||
|                 <h2>{userInfo.fio}</h2> |                 <h2>{userInfo?.userCard.fio}</h2> | ||||||
|                 <p>{userInfo.position}</p> |                 <p>{userInfo?.userCard.position.name}</p> | ||||||
|               </div> |               </div> | ||||||
|               <div className="employee-report__skills"> |               <div className="employee-report__skills"> | ||||||
|                 {userInfo?.stack && |                 {userInfo?.userCard?.skillValues && | ||||||
|                   userInfo.stack.map((skill, index) => { |                   userInfo?.userCard?.skillValues.map((skill) => { | ||||||
|                     return <span key={index}>{skill}</span>; |                     return <span key={skill.id}>{skill.skill.name}</span>; | ||||||
|                   })} |                   })} | ||||||
|               </div> |               </div> | ||||||
|             </div> |             </div> | ||||||
|   | |||||||
| @@ -65,23 +65,25 @@ export const PartnerCategories = () => { | |||||||
|     { |     { | ||||||
|       label: "", |       label: "", | ||||||
|       renderCell: (item) => ( |       renderCell: (item) => ( | ||||||
|         <img |         <Link to={`/profile/summary/${item.user_id}`}> | ||||||
|           className="table__avatar" |           <img | ||||||
|           src={urlForLocal(item?.employee.avatar)} |             className="table__avatar" | ||||||
|           alt="avatar" |             src={urlForLocal(item?.employee.avatar)} | ||||||
|         /> |             alt="avatar" | ||||||
|  |           /> | ||||||
|  |         </Link> | ||||||
|       ) |       ) | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       label: "Данные", |       label: "Данные", | ||||||
|       renderCell: (item) => ( |       renderCell: (item) => ( | ||||||
|         <div className="table__info"> |         <Link className="table__info" to={`/profile/summary/${item.user_id}`}> | ||||||
|           <p>{item?.employee.fio}</p> |           <p>{item?.employee.fio}</p> | ||||||
|           <span> |           <span> | ||||||
|             {LEVELS[item?.resume.userCard.level]} /{" "} |             {LEVELS[item?.resume.userCard.level]} /{" "} | ||||||
|             {SKILLS[item?.resume.userCard.position_id]} |             {SKILLS[item?.resume.userCard.position_id]} | ||||||
|           </span> |           </span> | ||||||
|         </div> |         </Link> | ||||||
|       ) |       ) | ||||||
|       // sort: { sortKey: "NAME" } |       // sort: { sortKey: "NAME" } | ||||||
|     }, |     }, | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ import ClassicEditor from "@ckeditor/ckeditor5-build-classic"; | |||||||
| import { CKEditor } from "@ckeditor/ckeditor5-react"; | import { CKEditor } from "@ckeditor/ckeditor5-react"; | ||||||
| import React, { useEffect, useState } from "react"; | import React, { useEffect, useState } from "react"; | ||||||
| import { useSelector } from "react-redux"; | import { useSelector } from "react-redux"; | ||||||
| import { Navigate } from "react-router-dom"; | import { useParams } from "react-router-dom"; | ||||||
|  |  | ||||||
| import { getProfileInfo } from "@redux/outstaffingSlice"; | import { getProfileInfo } from "@redux/outstaffingSlice"; | ||||||
|  |  | ||||||
| @@ -27,19 +27,18 @@ import avatarMok from "assets/images/avatarMok.webp"; | |||||||
| import "./summary.scss"; | import "./summary.scss"; | ||||||
|  |  | ||||||
| export const Summary = () => { | export const Summary = () => { | ||||||
|   if (localStorage.getItem("role_status") === "18") { |  | ||||||
|     return <Navigate to="/profile" replace />; |  | ||||||
|   } |  | ||||||
|   const profileInfo = useSelector(getProfileInfo); |   const profileInfo = useSelector(getProfileInfo); | ||||||
|   const [openGit, setOpenGit] = useState(false); |   const [openGit, setOpenGit] = useState(false); | ||||||
|   const [gitInfo, setGitInfo] = useState([]); |   const [gitInfo, setGitInfo] = useState([]); | ||||||
|   const [editSummaryOpen, setEditSummaryOpen] = useState(false); |   const [editSummaryOpen, setEditSummaryOpen] = useState(false); | ||||||
|   const [editSkills, setEditSkills] = useState(false); |   const [editSkills, setEditSkills] = useState(false); | ||||||
|  |   const [userInfo, setUserInfo] = useState({}); | ||||||
|   const [summary, setSummary] = useState(""); |   const [summary, setSummary] = useState(""); | ||||||
|   const [selectedSkills, setSelectedSkills] = useState([]); |   const [selectedSkills, setSelectedSkills] = useState([]); | ||||||
|   const [selectSkillsOpen, setSelectSkillsOpen] = useState(false); |   const [selectSkillsOpen, setSelectSkillsOpen] = useState(false); | ||||||
|   const [skillsList, seSkillsList] = useState([]); |   const [skillsList, seSkillsList] = useState([]); | ||||||
|   const { showNotification } = useNotification(); |   const { showNotification } = useNotification(); | ||||||
|  |   const { id: userId } = useParams(); | ||||||
|  |  | ||||||
|   useEffect(() => { |   useEffect(() => { | ||||||
|     apiRequest( |     apiRequest( | ||||||
| @@ -48,8 +47,10 @@ export const Summary = () => { | |||||||
|   }, []); |   }, []); | ||||||
|  |  | ||||||
|   useEffect(() => { |   useEffect(() => { | ||||||
|     setSummary(profileInfo.vc_text); |     if (!userId) { | ||||||
|     setSelectedSkills(profileInfo.skillValues); |       setSummary(profileInfo.vc_text); | ||||||
|  |       setSelectedSkills(profileInfo.skillValues); | ||||||
|  |     } | ||||||
|   }, [profileInfo]); |   }, [profileInfo]); | ||||||
|  |  | ||||||
|   useEffect(() => { |   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 addSkill = (skill) => { | ||||||
|     const isSkillFound = selectedSkills.some( |     const isSkillFound = selectedSkills.some( | ||||||
|       (item) => item.skill_id == skill.id |       (item) => item.skill_id == skill.id | ||||||
| @@ -133,7 +150,9 @@ export const Summary = () => { | |||||||
|             <div className="summary__person"> |             <div className="summary__person"> | ||||||
|               <img |               <img | ||||||
|                 src={ |                 src={ | ||||||
|                   profileInfo?.photo |                   userId | ||||||
|  |                     ? urlForLocal(userInfo.photo) | ||||||
|  |                     : profileInfo?.photo | ||||||
|                     ? urlForLocal(profileInfo.photo) |                     ? urlForLocal(profileInfo.photo) | ||||||
|                     : avatarMok |                     : avatarMok | ||||||
|                 } |                 } | ||||||
| @@ -141,12 +160,18 @@ export const Summary = () => { | |||||||
|                 alt="avatar" |                 alt="avatar" | ||||||
|               /> |               /> | ||||||
|               <p className="summary__name"> |               <p className="summary__name"> | ||||||
|                 {profileInfo?.fio || profileInfo?.username}{" "} |                 {userId | ||||||
|                 {profileInfo.specification} |                   ? userInfo.fio | ||||||
|  |                   : profileInfo?.fio || profileInfo?.username}{" "} | ||||||
|  |                 {userId ? userInfo.specification : profileInfo.specification} | ||||||
|               </p> |               </p> | ||||||
|               <hr /> |               <hr /> | ||||||
|               <div className="summary__direction">Front End</div> |               <div className="summary__direction"> | ||||||
|               <div className="summary__level">Middle+</div> |                 {userId ? userInfo.position : profileInfo?.position?.name} | ||||||
|  |               </div> | ||||||
|  |               <div className="summary__level"> | ||||||
|  |                 {userId ? userInfo.level : profileInfo?.level_title} | ||||||
|  |               </div> | ||||||
|             </div> |             </div> | ||||||
|             {!openGit && ( |             {!openGit && ( | ||||||
|               <button className="summary__git" onClick={() => setOpenGit(true)}> |               <button className="summary__git" onClick={() => setOpenGit(true)}> | ||||||
| @@ -159,17 +184,19 @@ export const Summary = () => { | |||||||
|           <div className="summary__skills skills__section"> |           <div className="summary__skills skills__section"> | ||||||
|             <div className="summary__sections__head"> |             <div className="summary__sections__head"> | ||||||
|               <h3>Основной стек</h3> |               <h3>Основной стек</h3> | ||||||
|               <button |               {!userId && ( | ||||||
|                 className={editSkills ? "edit" : ""} |                 <button | ||||||
|                 onClick={() => { |                   className={editSkills ? "edit" : ""} | ||||||
|                   if (editSkills) { |                   onClick={() => { | ||||||
|                     setSkills(); |                     if (editSkills) { | ||||||
|                   } |                       setSkills(); | ||||||
|                   setEditSkills(!editSkills); |                     } | ||||||
|                 }} |                     setEditSkills(!editSkills); | ||||||
|               > |                   }} | ||||||
|                 {editSkills ? "Сохранить" : "Редактировать"} |                 > | ||||||
|               </button> |                   {editSkills ? "Сохранить" : "Редактировать"} | ||||||
|  |                 </button> | ||||||
|  |               )} | ||||||
|             </div> |             </div> | ||||||
|             <div className="skills__section__items"> |             <div className="skills__section__items"> | ||||||
|               {editSkills ? ( |               {editSkills ? ( | ||||||
| @@ -239,17 +266,19 @@ export const Summary = () => { | |||||||
|             <div className="experience__block"> |             <div className="experience__block"> | ||||||
|               <div className="summary__sections__head"> |               <div className="summary__sections__head"> | ||||||
|                 <h3>Опыт работы</h3> |                 <h3>Опыт работы</h3> | ||||||
|                 <button |                 {!userId && ( | ||||||
|                   className={editSummaryOpen ? "edit" : ""} |                   <button | ||||||
|                   onClick={() => { |                     className={editSummaryOpen ? "edit" : ""} | ||||||
|                     if (editSummaryOpen) { |                     onClick={() => { | ||||||
|                       editSummary(); |                       if (editSummaryOpen) { | ||||||
|                     } |                         editSummary(); | ||||||
|                     setEditSummaryOpen(!editSummaryOpen); |                       } | ||||||
|                   }} |                       setEditSummaryOpen(!editSummaryOpen); | ||||||
|                 > |                     }} | ||||||
|                   {editSummaryOpen ? "Сохранить" : "Редактировать"} |                   > | ||||||
|                 </button> |                     {editSummaryOpen ? "Сохранить" : "Редактировать"} | ||||||
|  |                   </button> | ||||||
|  |                 )} | ||||||
|               </div> |               </div> | ||||||
|               {editSummaryOpen ? ( |               {editSummaryOpen ? ( | ||||||
|                 <CKEditor |                 <CKEditor | ||||||
|   | |||||||
| @@ -20,6 +20,7 @@ import { Profile } from "@pages/Profile/Profile"; | |||||||
| import { ProjectTracker } from "@pages/ProjectTracker/ProjectTracker"; | import { ProjectTracker } from "@pages/ProjectTracker/ProjectTracker"; | ||||||
| import { Stack } from "@pages/Stack/Stack"; | import { Stack } from "@pages/Stack/Stack"; | ||||||
| import Statistics from "@pages/Statistics/Statistics"; | import Statistics from "@pages/Statistics/Statistics"; | ||||||
|  | import { Summary } from "@pages/Summary/Summary"; | ||||||
| import { Tracker } from "@pages/Tracker/Tracker"; | import { Tracker } from "@pages/Tracker/Tracker"; | ||||||
| import { TrackerIntro } from "@pages/TrackerIntro/TrackerIntro"; | import { TrackerIntro } from "@pages/TrackerIntro/TrackerIntro"; | ||||||
| import { ViewReport } from "@pages/ViewReport/ViewReport"; | import { ViewReport } from "@pages/ViewReport/ViewReport"; | ||||||
| @@ -66,6 +67,7 @@ export const PartnerPage = () => { | |||||||
|         <Route exact path="requests-edit" element={<PartnerAddRequest />} /> |         <Route exact path="requests-edit" element={<PartnerAddRequest />} /> | ||||||
|         <Route exact path="requests-bid" element={<PartnerBid />} /> |         <Route exact path="requests-bid" element={<PartnerBid />} /> | ||||||
|         <Route exact path="employees" element={<PartnerCategories />} /> |         <Route exact path="employees" element={<PartnerCategories />} /> | ||||||
|  |         <Route exact path="summary/:id" element={<Summary />} /> | ||||||
|         <Route |         <Route | ||||||
|           exact |           exact | ||||||
|           path="employees/report/:uuid" |           path="employees/report/:uuid" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user