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 useDataFetching from '../../hooks/useDataFetching';
|
- |
|
5 |
import Spinner from '../../shared/Spinner';
|
- |
|
6 |
import EditItem from '../components/EditItem';
|
4 |
import EditItem from '../components/EditItem';
|
7 |
import CategoryModal from '../components/Modals/CategoryModal';
|
5 |
import CategoryModal from '../components/Modals/CategoryModal';
|
8 |
import DegreesModal from '../components/Modals/DegreesModal';
|
6 |
import DegreesModal from '../components/Modals/DegreesModal';
|
9 |
import EmploymentTypeModal from '../components/Modals/EmploymentTypeModal';
|
7 |
import EmploymentTypeModal from '../components/Modals/EmploymentTypeModal';
|
10 |
import LanguageModal from '../components/Modals/LanguageModal';
|
8 |
import LanguageModal from '../components/Modals/LanguageModal';
|
Línea 15... |
Línea 13... |
15 |
import StatusModal from '../components/Modals/StatusModal';
|
13 |
import StatusModal from '../components/Modals/StatusModal';
|
16 |
import TitleModal from '../components/Modals/TitleModal';
|
14 |
import TitleModal from '../components/Modals/TitleModal';
|
Línea 17... |
Línea 15... |
17 |
|
15 |
|
Línea 18... |
Línea -... |
18 |
const JobsEditView = ({ linkEdit, googleApi }) => {
|
- |
|
19 |
|
16 |
const JobsEditView = ({ linkEdit, googleApi }) => {
|
20 |
const { results, loading, error } = useDataFetching(linkEdit)
|
17 |
|
21 |
const [modalToShow, setModalToShow] = useState(null);
|
18 |
const [modalToShow, setModalToShow] = useState(null);
|
22 |
const [itemsData, setItemsData] = useState({
|
19 |
const [itemsData, setItemsData] = useState({
|
23 |
title: '',
|
20 |
title: '',
|
Línea 49... |
Línea 46... |
49 |
});
|
46 |
});
|
Línea 50... |
Línea 47... |
50 |
|
47 |
|
Línea 51... |
Línea 48... |
51 |
const closeModal = () => setModalToShow(null)
|
48 |
const closeModal = () => setModalToShow(null)
|
- |
|
49 |
|
52 |
|
50 |
useEffect(() => {
|
53 |
useEffect(() => {
|
51 |
getData(linkEdit)
|
54 |
if (results) {
|
52 |
.then(results => {
|
55 |
setItemsData({
|
53 |
setItemsData({
|
56 |
...itemsData,
|
54 |
...itemsData,
|
57 |
title: results.title,
|
55 |
title: results.title,
|
58 |
status: results.status,
|
56 |
status: results.status,
|
59 |
description: results.description,
|
57 |
description: results.description,
|
60 |
location: results.location,
|
58 |
location: results.location,
|
61 |
employment_type: results.employment_type,
|
59 |
employment_type: results.employment_type,
|
62 |
last_date_of_application: results.last_date_of_application,
|
60 |
last_date_of_application: results.last_date_of_application,
|
63 |
job_category: results.job_category,
|
61 |
job_category: results.job_category,
|
64 |
experience: results.experience,
|
62 |
experience: results.experience,
|
65 |
salary: results.salary,
|
63 |
salary: results.salary,
|
66 |
degrees: results.degrees,
|
64 |
degrees: results.degrees,
|
- |
|
65 |
languages: results.languages,
|
- |
|
66 |
skills: results.skills
|
- |
|
67 |
})
|
- |
|
68 |
setItemsRoutes({
|
- |
|
69 |
route_degrees: results.route_degrees,
|
- |
|
70 |
route_employment_type: results.route_employment_type,
|
- |
|
71 |
route_experience: results.route_experience,
|
- |
|
72 |
route_extended: results.route_extended,
|
- |
|
73 |
route_job_category: results.route_job_category,
|
- |
|
74 |
route_languages: results.route_languages,
|
- |
|
75 |
route_last_date_of_application: results.route_last_date_of_application,
|
- |
|
76 |
route_location: results.route_location,
|
- |
|
77 |
route_salary: results.route_salary,
|
- |
|
78 |
route_skills: results.route_skills,
|
- |
|
79 |
route_status: results.route_status,
|
67 |
languages: results.languages,
|
80 |
route_title: results.route_title
|
68 |
skills: results.skills
|
- |
|
69 |
})
|
- |
|
70 |
setItemsRoutes({
|
- |
|
71 |
route_degrees: results.route_degrees,
|
- |
|
72 |
route_employment_type: results.route_employment_type,
|
- |
|
73 |
route_experience: results.route_experience,
|
- |
|
74 |
route_extended: results.route_extended,
|
- |
|
75 |
route_job_category: results.route_job_category,
|
- |
|
76 |
route_languages: results.route_languages,
|
- |
|
77 |
route_last_date_of_application: results.route_last_date_of_application,
|
- |
|
78 |
route_location: results.route_location,
|
- |
|
79 |
route_salary: results.route_salary,
|
- |
|
80 |
route_skills: results.route_skills,
|
- |
|
81 |
route_status: results.route_status,
|
- |
|
82 |
route_title: results.route_title
|
- |
|
83 |
})
|
81 |
})
|
Línea 84... |
Línea 82... |
84 |
}
|
82 |
})
|
85 |
}, [modalToShow])
|
83 |
}, [modalToShow]);
|
86 |
|
84 |
|
87 |
const ModalOptions = {
|
85 |
const ModalOptions = {
|
Línea 119... |
Línea 117... |
119 |
<div class="container-fluid">
|
117 |
<div class="container-fluid">
|
120 |
<div class="row">
|
118 |
<div class="row">
|
121 |
<div class="col-lg-3">
|
119 |
<div class="col-lg-3">
|
122 |
</div>
|
120 |
</div>
|
123 |
<div class="col-lg-6">
|
121 |
<div class="col-lg-6">
|
124 |
{
|
- |
|
125 |
loading
|
- |
|
126 |
? <Spinner />
|
- |
|
127 |
:
|
- |
|
128 |
<div class="main-ws-sec">
|
122 |
<div class="main-ws-sec">
|
129 |
<EditItem title='Estatus' data={itemsData.status} showModal={setModalToShow} />
|
123 |
<EditItem title='Estatus' data={itemsData.status} showModal={setModalToShow} />
|
130 |
<EditItem title='Título' data={itemsData.title} showModal={setModalToShow} />
|
124 |
<EditItem title='Título' data={itemsData.title} showModal={setModalToShow} />
|
131 |
<EditItem title='Visión general' data={itemsData.description} showModal={setModalToShow} />
|
125 |
<EditItem title='Visión general' data={itemsData.description} showModal={setModalToShow} />
|
132 |
<EditItem title='Último día de aplicación' data={itemsData.last_date_of_application} showModal={setModalToShow} />
|
126 |
<EditItem title='Último día de aplicación' data={itemsData.last_date_of_application} showModal={setModalToShow} />
|
133 |
<EditItem title='Tipo de empleo' data={itemsData.employment_type} showModal={setModalToShow} />
|
127 |
<EditItem title='Tipo de empleo' data={itemsData.employment_type} showModal={setModalToShow} />
|
134 |
<EditItem title='Ubicación' data={itemsData.location} showModal={setModalToShow} />
|
128 |
<EditItem title='Ubicación' data={itemsData.location} showModal={setModalToShow} />
|
135 |
<EditItem title='Experiencia' data={itemsData.experience} showModal={setModalToShow} />
|
129 |
<EditItem title='Experiencia' data={itemsData.experience} showModal={setModalToShow} />
|
136 |
<EditItem title='Salario' data={itemsData.salary} showModal={setModalToShow} />
|
130 |
<EditItem title='Salario' data={itemsData.salary} showModal={setModalToShow} />
|
137 |
<EditItem title='Categoría' data={itemsData.job_category} showModal={setModalToShow} />
|
131 |
<EditItem title='Categoría' data={itemsData.job_category} showModal={setModalToShow} />
|
138 |
<EditItem title='Habilidades' data={itemsData.skills} showModal={setModalToShow} />
|
132 |
<EditItem title='Habilidades' data={itemsData.skills} showModal={setModalToShow} />
|
139 |
<EditItem title='Idiomas' data={itemsData.languages} showModal={setModalToShow} />
|
133 |
<EditItem title='Idiomas' data={itemsData.languages} showModal={setModalToShow} />
|
140 |
<EditItem title='Grados' data={itemsData.degrees} showModal={setModalToShow} />
|
134 |
<EditItem title='Grados' data={itemsData.degrees} showModal={setModalToShow} />
|
141 |
</div>
|
- |
|
142 |
}
|
135 |
</div>
|
143 |
{
|
136 |
{
|
144 |
ModalOptions[modalToShow]
|
137 |
ModalOptions[modalToShow]
|
145 |
}
|
138 |
}
|
146 |
</div>
|
139 |
</div>
|
147 |
<div class="col-lg-3">
|
140 |
<div class="col-lg-3">
|