fix candidate resume

This commit is contained in:
Victor Batischev 2024-04-24 19:20:21 +03:00
parent d49a2eb0c8
commit 3f46d60720
3 changed files with 19 additions and 20 deletions

View File

@ -32,7 +32,7 @@ export const Candidate = () => {
if (localStorage.getItem("role_status") !== "18") { if (localStorage.getItem("role_status") !== "18") {
return <Navigate to="/profile" replace />; return <Navigate to="/profile" replace />;
} }
// const { id: candidateId } = useParams(); const { id: candidateId } = useParams();
const navigate = useNavigate(); const navigate = useNavigate();
@ -47,7 +47,7 @@ export const Candidate = () => {
}, []); }, []);
useEffect(() => { useEffect(() => {
apiRequest(`/user/me`, {}).then((el) => apiRequest(`/resume?userId=${candidateId}`).then((el) =>
dispatch(currentCandidate(el.userCard)) dispatch(currentCandidate(el.userCard))
); );
}, [dispatch]); }, [dispatch]);
@ -103,9 +103,7 @@ export const Candidate = () => {
link: "/profile/catalog" link: "/profile/catalog"
}, },
{ {
name: `${currentCandidateObj.specification} ${ name: `${currentCandidateObj.fio}`,
SKILLS[currentCandidateObj.position_id]
}, ${LEVELS[currentCandidateObj.level]}`,
link: `/candidate/${currentCandidateObj.id}` link: `/candidate/${currentCandidateObj.id}`
} }
]} ]}
@ -115,6 +113,7 @@ export const Candidate = () => {
<div className="col-12 candidate__header"> <div className="col-12 candidate__header">
<div className="candidate__header__left"> <div className="candidate__header__left">
<h3> <h3>
{currentCandidateObj.fio} &nbsp;{" "}
{currentCandidateObj.specification} &nbsp;{" "} {currentCandidateObj.specification} &nbsp;{" "}
{SKILLS[currentCandidateObj.position_id]} &nbsp;{" "} {SKILLS[currentCandidateObj.position_id]} &nbsp;{" "}
{LEVELS[currentCandidateObj.level]} {LEVELS[currentCandidateObj.level]}

View File

@ -1,7 +1,7 @@
import moment from "moment/moment"; import moment from "moment/moment";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { Navigate, useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { getRequestDates, setRequestDate } from "@redux/reportSlice"; import { getRequestDates, setRequestDate } from "@redux/reportSlice";

View File

@ -33,9 +33,9 @@ export const Summary = () => {
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 [editSummeryOpen, setEditSummeryOpen] = useState(false); const [editSummaryOpen, setEditSummaryOpen] = useState(false);
const [editSkills, setEditSkills] = useState(false); const [editSkills, setEditSkills] = useState(false);
const [summery, setSummery] = 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([]);
@ -48,7 +48,7 @@ export const Summary = () => {
}, []); }, []);
useEffect(() => { useEffect(() => {
setSummery(profileInfo.vc_text); setSummary(profileInfo.vc_text);
setSelectedSkills(profileInfo.skillValues); setSelectedSkills(profileInfo.skillValues);
}, [profileInfo]); }, [profileInfo]);
@ -69,11 +69,11 @@ export const Summary = () => {
}).then(() => {}); }).then(() => {});
} }
function editSummery() { function editSummary() {
apiRequest("/resume/edit-text", { apiRequest("/resume/edit-text", {
method: "PUT", method: "PUT",
data: { data: {
resume: summery resume: summary
} }
}).then(() => { }).then(() => {
showNotification({ showNotification({
@ -221,21 +221,21 @@ export const Summary = () => {
<div className="summary__sections__head"> <div className="summary__sections__head">
<h3>Опыт работы</h3> <h3>Опыт работы</h3>
<button <button
className={editSummeryOpen ? "edit" : ""} className={editSummaryOpen ? "edit" : ""}
onClick={() => { onClick={() => {
if (editSummeryOpen) { if (editSummaryOpen) {
editSummery(); editSummary();
} }
setEditSummeryOpen(!editSummeryOpen); setEditSummaryOpen(!editSummaryOpen);
}} }}
> >
{editSummeryOpen ? "Сохранить" : "Редактировать"} {editSummaryOpen ? "Сохранить" : "Редактировать"}
</button> </button>
</div> </div>
{editSummeryOpen ? ( {editSummaryOpen ? (
<CKEditor <CKEditor
editor={ClassicEditor} editor={ClassicEditor}
data={summery} data={summary}
config={{ config={{
removePlugins: [ removePlugins: [
"CKFinderUploadAdapter", "CKFinderUploadAdapter",
@ -252,13 +252,13 @@ export const Summary = () => {
}} }}
onChange={(event, editor) => { onChange={(event, editor) => {
const data = editor.getData(); const data = editor.getData();
setSummery(data); setSummary(data);
}} }}
/> />
) : ( ) : (
<div <div
className="experience__content" className="experience__content"
dangerouslySetInnerHTML={{ __html: summery }} dangerouslySetInnerHTML={{ __html: summary }}
></div> ></div>
)} )}
</div> </div>