Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 14230 | Rev 14259 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 14230 Rev 14258
Línea 1... Línea 1...
1
import React, { useState, useEffect } from 'react'
1
import React, { useState, useEffect, useRef } from 'react'
2
import { useForm } from 'react-hook-form'
2
import { useForm } from 'react-hook-form'
3
import Datetime from 'react-datetime'
3
import Datetime from 'react-datetime'
4
import axios from 'axios'
4
import axios from 'axios'
5
import SearchLocationInput from '../../../shared/SearchLocationInput'
5
import SearchLocationInput from '../../../shared/SearchLocationInput'
6
import DescriptionInput from '../../../shared/DescriptionInput'
6
import DescriptionInput from '../../../shared/DescriptionInput'
Línea 20... Línea 20...
20
 
20
 
21
	const history = useHistory()
21
	const history = useHistory()
22
	const { action } = useParams()
22
	const { action } = useParams()
Línea 23... Línea -...
23
	const dispatch = useDispatch()
-
 
-
 
23
	const dispatch = useDispatch()
24
 
24
 
Línea 25... Línea 25...
25
 
25
	const locationRef = useRef();
26
	const { handleSubmit, register, setValue, errors, watch } = useForm()
26
	const { handleSubmit, register, setValue, errors, watch } = useForm()
27
 
27
 
Línea 59... Línea 59...
59
			last_date: year,
59
			last_date: year,
60
			status: isActive ? 'a' : 'i'
60
			status: isActive ? 'a' : 'i'
61
		}
61
		}
Línea 62... Línea 62...
62
 
62
 
-
 
63
		if (!location.formatted_address) {
-
 
64
			locationRef.current.focus();
-
 
65
			dispatch(addNotification({
-
 
66
						style: 'error',
-
 
67
						msg: 'Es requerida una ubicación'
63
		if (!location.formatted_address) {
68
					}))
64
			return setInputErrors(prev => ({ ...prev, location: 'Es requerida una ubicación' }))
69
			return setInputErrors(prev => ({ ...prev, location: 'Es requerida una ubicación' }))
65
		}
70
		}
66
		if (!year) {
71
		if (!year) {
67
			return setInputErrors(prev => ({ ...prev, year: 'Este campo es requerido' }))
72
			return setInputErrors(prev => ({ ...prev, year: 'Este campo es requerido' }))
Línea 170... Línea 175...
170
							</select>
175
							</select>
171
						</div>
176
						</div>
172
						<div className="form-group">
177
						<div className="form-group">
173
							<label>Ubicación</label>
178
							<label>Ubicación</label>
174
							<SearchLocationInput
179
							<SearchLocationInput
-
 
180
								ref={locationRef}
175
								value={locationLabel}
181
								value={locationLabel}
176
								setValue={setLocationLabel}
182
								setValue={setLocationLabel}
177
								googleApiKey={googleApiKey}
183
								googleApiKey={googleApiKey}
178
								updateData={setLocation}
184
								updateData={setLocation}
179
							/>
185
							/>