Línea 1... |
Línea 1... |
1 |
import React, { useEffect, useState } from 'react'
|
1 |
import React, { useEffect, useState } from 'react'
|
2 |
import { Link } from 'react-router-dom'
|
2 |
import { Link } from 'react-router-dom'
|
3 |
import { getData } from '../../helpers/fetchHelpers';
|
3 |
import { getData } from '../../helpers/fetchHelpers'
|
4 |
import EditItem from '../components/EditItem';
|
4 |
import EditItem from '../components/EditItem'
|
5 |
import CategoryModal from '../components/Modals/CategoryModal';
|
5 |
import CategoryModal from '../components/Modals/CategoryModal'
|
6 |
import DegreesModal from '../components/Modals/DegreesModal';
|
6 |
import DegreesModal from '../components/Modals/DegreesModal'
|
7 |
import EmploymentTypeModal from '../components/Modals/EmploymentTypeModal';
|
7 |
import EmploymentTypeModal from '../components/Modals/EmploymentTypeModal'
|
8 |
import ExperienceModal from '../components/Modals/ExperiencieModal';
|
8 |
import ExperienceModal from '../components/Modals/ExperiencieModal'
|
9 |
import LanguageModal from '../components/Modals/LanguageModal';
|
9 |
import LanguageModal from '../components/Modals/LanguageModal'
|
10 |
import LastAplicationDayModal from '../components/Modals/LastAplicationDayModal';
|
10 |
import LastAplicationDayModal from '../components/Modals/LastAplicationDayModal'
|
11 |
import LocationModal from '../components/Modals/LocationModal';
|
11 |
import LocationModal from '../components/Modals/LocationModal'
|
12 |
import OverviewModal from '../components/Modals/OverviewModal';
|
12 |
import OverviewModal from '../components/Modals/OverviewModal'
|
13 |
import SalaryModal from '../components/Modals/SalaryModal';
|
13 |
import SalaryModal from '../components/Modals/SalaryModal'
|
14 |
import SkillsModal from '../components/Modals/SkillsModal';
|
14 |
import SkillsModal from '../components/Modals/SkillsModal'
|
15 |
import StatusModal from '../components/Modals/StatusModal';
|
15 |
import StatusModal from '../components/Modals/StatusModal'
|
16 |
import TitleModal from '../components/Modals/TitleModal';
|
16 |
import TitleModal from '../components/Modals/TitleModal'
|
Línea 17... |
Línea 17... |
17 |
|
17 |
|
Línea 18... |
Línea 18... |
18 |
const JobsEditView = ({ linkEdit, googleApi }) => {
|
18 |
const JobsEditView = ({ linkEdit, googleApi }) => {
|
19 |
|
19 |
|
20 |
const [modalToShow, setModalToShow] = useState(null);
|
20 |
const [modalToShow, setModalToShow] = useState(null)
|
21 |
const [itemsData, setItemsData] = useState({
|
21 |
const [itemsData, setItemsData] = useState({
|
22 |
title: '',
|
22 |
title: '',
|
23 |
status: '',
|
23 |
status: '',
|
24 |
description: '',
|
24 |
description: '',
|
25 |
location: '',
|
25 |
location: '',
|
26 |
employment_type: '',
|
26 |
employment_type: '',
|
27 |
last_date_of_application: '',
|
27 |
last_date_of_application: '',
|
28 |
job_category: '',
|
28 |
job_category: '',
|
29 |
experience: '',
|
29 |
experience: '',
|
30 |
salary: '',
|
30 |
salary: '',
|
31 |
degrees: [],
|
31 |
degrees: [],
|
32 |
languages: [],
|
32 |
languages: [],
|
33 |
skills: []
|
33 |
skills: []
|
34 |
});
|
34 |
})
|
35 |
const [itemsRoutes, setItemsRoutes] = useState({
|
35 |
const [itemsRoutes, setItemsRoutes] = useState({
|
36 |
route_degrees: "",
|
36 |
route_degrees: '',
|
37 |
route_employment_type: "",
|
37 |
route_employment_type: '',
|
38 |
route_experience: "",
|
38 |
route_experience: '',
|
39 |
route_extended: "",
|
39 |
route_extended: '',
|
40 |
route_job_category: "",
|
40 |
route_job_category: '',
|
41 |
route_languages: "",
|
41 |
route_languages: '',
|
42 |
route_last_date_of_application: "",
|
42 |
route_last_date_of_application: '',
|
43 |
route_location: "",
|
43 |
route_location: '',
|
44 |
route_salary: "",
|
44 |
route_salary: '',
|
45 |
route_skills: "",
|
45 |
route_skills: '',
|
46 |
route_status: "",
|
46 |
route_status: '',
|
47 |
route_title: ""
|
47 |
route_title: ''
|
48 |
});
|
48 |
})
|
49 |
|
49 |
|
50 |
const closeModal = () => setModalToShow(null)
|
50 |
const closeModal = () => setModalToShow(null)
|
51 |
|
51 |
|
52 |
useEffect(() => {
|
52 |
useEffect(() => {
|
53 |
getData(linkEdit)
|
53 |
getData(linkEdit)
|
54 |
.then(results => {
|
54 |
.then(results => {
|
55 |
setItemsData({
|
55 |
setItemsData({
|
56 |
...itemsData,
|
56 |
...itemsData,
|
57 |
title: results.title,
|
57 |
title: results.title,
|
58 |
status: results.status,
|
58 |
status: results.status,
|
59 |
description: results.description,
|
59 |
description: results.description,
|
60 |
location: results.location,
|
60 |
location: results.location,
|
61 |
employment_type: results.employment_type,
|
61 |
employment_type: results.employment_type,
|
62 |
last_date_of_application: results.last_date_of_application,
|
62 |
last_date_of_application: results.last_date_of_application,
|
63 |
job_category: results.job_category,
|
63 |
job_category: results.job_category,
|
64 |
experience: results.experience,
|
64 |
experience: results.experience,
|
65 |
salary: results.salary,
|
65 |
salary: results.salary,
|
66 |
degrees: results.degrees,
|
66 |
degrees: results.degrees,
|
67 |
languages: results.languages,
|
67 |
languages: results.languages,
|
68 |
skills: results.skills
|
68 |
skills: results.skills
|
69 |
})
|
69 |
})
|
70 |
setItemsRoutes({
|
70 |
setItemsRoutes({
|
71 |
route_degrees: results.route_degrees,
|
71 |
route_degrees: results.route_degrees,
|
72 |
route_employment_type: results.route_employment_type,
|
72 |
route_employment_type: results.route_employment_type,
|
73 |
route_experience: results.route_experience,
|
73 |
route_experience: results.route_experience,
|
74 |
route_extended: results.route_extended,
|
74 |
route_extended: results.route_extended,
|
75 |
route_job_category: results.route_job_category,
|
75 |
route_job_category: results.route_job_category,
|
76 |
route_languages: results.route_languages,
|
76 |
route_languages: results.route_languages,
|
77 |
route_last_date_of_application: results.route_last_date_of_application,
|
77 |
route_last_date_of_application: results.route_last_date_of_application,
|
78 |
route_location: results.route_location,
|
78 |
route_location: results.route_location,
|
79 |
route_salary: results.route_salary,
|
79 |
route_salary: results.route_salary,
|
80 |
route_skills: results.route_skills,
|
80 |
route_skills: results.route_skills,
|
81 |
route_status: results.route_status,
|
81 |
route_status: results.route_status,
|
82 |
route_title: results.route_title
|
82 |
route_title: results.route_title
|
83 |
})
|
83 |
})
|
84 |
})
|
84 |
})
|
85 |
}, [modalToShow]);
|
85 |
}, [modalToShow])
|
86 |
|
86 |
|
87 |
const ModalOptions = {
|
87 |
const ModalOptions = {
|
88 |
"Estatus": <StatusModal closeModal={closeModal} modalData={itemsData.status} dataLink={itemsRoutes.route_status} />,
|
88 |
'Estatus': <StatusModal closeModal={closeModal} modalData={itemsData.status} dataLink={itemsRoutes.route_status} />,
|
89 |
"Título": <TitleModal closeModal={closeModal} modalData={itemsData.title} dataLink={itemsRoutes.route_title} />,
|
89 |
'Título': <TitleModal closeModal={closeModal} modalData={itemsData.title} dataLink={itemsRoutes.route_title} />,
|
90 |
"Visión general": <OverviewModal closeModal={closeModal} modalData={itemsData.description} dataLink={itemsRoutes.route_extended} />,
|
90 |
'Visión general': <OverviewModal closeModal={closeModal} modalData={itemsData.description} dataLink={itemsRoutes.route_extended} />,
|
91 |
"Último día de aplicación": <LastAplicationDayModal closeModal={closeModal} modalData={itemsData.last_date_of_application} dataLink={itemsRoutes.route_last_date_of_application} />,
|
91 |
'Último día de aplicación': <LastAplicationDayModal closeModal={closeModal} modalData={itemsData.last_date_of_application} dataLink={itemsRoutes.route_last_date_of_application} />,
|
92 |
"Tipo de empleo": <EmploymentTypeModal closeModal={closeModal} modalData={itemsData.employment_type} dataLink={itemsRoutes.route_employment_type} />,
|
92 |
'Tipo de empleo': <EmploymentTypeModal closeModal={closeModal} modalData={itemsData.employment_type} dataLink={itemsRoutes.route_employment_type} />,
|
93 |
"Ubicación": <LocationModal closeModal={closeModal} modalData={itemsData.location} dataLink={itemsRoutes.route_location} googleApiKey={googleApi} />,
|
93 |
'Ubicación': <LocationModal closeModal={closeModal} modalData={itemsData.location} dataLink={itemsRoutes.route_location} googleApiKey={googleApi} />,
|
94 |
"Idiomas": <LanguageModal closeModal={closeModal} dataLink={itemsRoutes.route_languages} />,
|
94 |
'Idiomas': <LanguageModal closeModal={closeModal} dataLink={itemsRoutes.route_languages} />,
|
95 |
"Habilidades": <SkillsModal closeModal={closeModal} dataLink={itemsRoutes.route_skills} />,
|
95 |
'Habilidades': <SkillsModal closeModal={closeModal} dataLink={itemsRoutes.route_skills} />,
|
96 |
"Grados": <DegreesModal closeModal={closeModal} dataLink={itemsRoutes.route_degrees} />,
|
96 |
'Grados': <DegreesModal closeModal={closeModal} dataLink={itemsRoutes.route_degrees} />,
|
97 |
"Categoría": <CategoryModal closeModal={closeModal} dataLink={itemsRoutes.route_job_category} />,
|
97 |
'Categoría': <CategoryModal closeModal={closeModal} dataLink={itemsRoutes.route_job_category} />,
|
98 |
"Experiencia": <ExperienceModal closeModal={closeModal} dataLink={itemsRoutes.route_experience} />,
|
98 |
'Experiencia': <ExperienceModal closeModal={closeModal} dataLink={itemsRoutes.route_experience} />,
|
99 |
"Salario": <SalaryModal closeModal={closeModal} dataLink={itemsRoutes.route_salary} />,
|
99 |
'Salario': <SalaryModal closeModal={closeModal} dataLink={itemsRoutes.route_salary} />,
|
100 |
}
|
100 |
}
|
101 |
|
101 |
|
102 |
return (
|
102 |
return (
|
103 |
<>
|
103 |
<>
|
104 |
<section className="content-header">
|
104 |
<section className="content-header">
|
105 |
<div className="container-fluid">
|
105 |
<div className="container-fluid">
|
106 |
<div className="row mb-2">
|
106 |
<div className="row mb-2">
|
107 |
<div className="col-sm-12">
|
107 |
<div className="col-sm-12">
|
108 |
<Link to='/jobs' className='text-decoration-none text-body'>
|
108 |
<Link to='/jobs' className='text-decoration-none text-body'>
|
109 |
<h1>
|
109 |
<h1>
|
110 |
<i className='fa fa-angle-left fw-bold mr-2' />
|
110 |
<i className='fa fa-angle-left fw-bold mr-2' />
|
111 |
Editar empleo
|
111 |
Editar empleo
|
112 |
</h1>
|
112 |
</h1>
|
113 |
</Link>
|
113 |
</Link>
|
114 |
</div>
|
114 |
</div>
|
115 |
</div>
|
115 |
</div>
|
116 |
</div>
|
116 |
</div>
|
117 |
</section>
|
117 |
</section>
|
118 |
<section class="content">
|
118 |
<section className="content">
|
119 |
<div class="container-fluid">
|
119 |
<div className="container-fluid">
|
120 |
<div class="row">
|
120 |
<div className="row">
|
121 |
<div class="col-lg-3">
|
121 |
<div className="col-lg-3">
|
122 |
</div>
|
122 |
</div>
|
123 |
<div class="col-lg-6">
|
123 |
<div className="col-lg-6">
|
124 |
<div class="main-ws-sec">
|
124 |
<div className="main-ws-sec">
|
125 |
<EditItem title='Estatus' data={itemsData.status} showModal={setModalToShow} />
|
125 |
<EditItem title='Estatus' data={itemsData.status} showModal={setModalToShow} />
|
126 |
<EditItem title='Título' data={itemsData.title} showModal={setModalToShow} />
|
126 |
<EditItem title='Título' data={itemsData.title} showModal={setModalToShow} />
|
127 |
<EditItem title='Visión general' data={itemsData.description} showModal={setModalToShow} />
|
127 |
<EditItem title='Visión general' data={itemsData.description} showModal={setModalToShow} />
|
128 |
<EditItem title='Último día de aplicación' data={itemsData.last_date_of_application} showModal={setModalToShow} />
|
128 |
<EditItem title='Último día de aplicación' data={itemsData.last_date_of_application} showModal={setModalToShow} />
|
129 |
<EditItem title='Tipo de empleo' data={itemsData.employment_type} showModal={setModalToShow} />
|
129 |
<EditItem title='Tipo de empleo' data={itemsData.employment_type} showModal={setModalToShow} />
|
130 |
<EditItem title='Ubicación' data={itemsData.location} showModal={setModalToShow} />
|
130 |
<EditItem title='Ubicación' data={itemsData.location} showModal={setModalToShow} />
|
131 |
<EditItem title='Experiencia' data={itemsData.experience} showModal={setModalToShow} />
|
131 |
<EditItem title='Experiencia' data={itemsData.experience} showModal={setModalToShow} />
|
132 |
<EditItem title='Salario' data={itemsData.salary} showModal={setModalToShow} />
|
132 |
<EditItem title='Salario' data={itemsData.salary} showModal={setModalToShow} />
|
133 |
<EditItem title='Categoría' data={itemsData.job_category} showModal={setModalToShow} />
|
133 |
<EditItem title='Categoría' data={itemsData.job_category} showModal={setModalToShow} />
|
134 |
<EditItem title='Habilidades' data={itemsData.skills} showModal={setModalToShow} />
|
134 |
<EditItem title='Habilidades' data={itemsData.skills} showModal={setModalToShow} />
|
135 |
<EditItem title='Idiomas' data={itemsData.languages} showModal={setModalToShow} />
|
135 |
<EditItem title='Idiomas' data={itemsData.languages} showModal={setModalToShow} />
|
136 |
<EditItem title='Grados' data={itemsData.degrees} showModal={setModalToShow} />
|
136 |
<EditItem title='Grados' data={itemsData.degrees} showModal={setModalToShow} />
|
137 |
</div>
|
137 |
</div>
|
138 |
{
|
138 |
{
|
139 |
ModalOptions[modalToShow]
|
139 |
ModalOptions[modalToShow]
|
140 |
}
|
140 |
}
|
141 |
</div>
|
141 |
</div>
|
142 |
<div class="col-lg-3">
|
142 |
<div className="col-lg-3">
|
143 |
</div>
|
143 |
</div>
|
144 |
</div>
|
144 |
</div>
|
145 |
</div>
|
145 |
</div>
|
146 |
</section>
|
146 |
</section>
|
147 |
</>
|
147 |
</>
|
Línea 148... |
Línea 148... |
148 |
)
|
148 |
)
|
149 |
}
|
149 |
}
|