Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 11909 Rev 14216
Línea 1... Línea 1...
1
import React, { useState } from 'react'
1
import React, { useState } from 'react'
2
import Datetime from 'react-datetime'
2
import Datetime from 'react-datetime'
3
import { useForm } from 'react-hook-form'
3
import { useForm } from 'react-hook-form'
-
 
4
import { useDispatch } from 'react-redux'
-
 
5
import { addNotification } from '../../../redux/notification/notification.actions'
4
import SearchLocationInput from '../../../shared/SearchLocationInput'
6
import SearchLocationInput from '../../../shared/SearchLocationInput'
5
import SubmitModal from './SubmitModal'
7
import SubmitModal from './SubmitModal'
Línea 6... Línea 8...
6
 
8
 
7
const jobTypeOptions = [
9
const jobTypeOptions = [
Línea 11... Línea 13...
11
	{ label: 'Temporal', value: 't' },
13
	{ label: 'Temporal', value: 't' },
12
]
14
]
Línea 13... Línea 15...
13
 
15
 
Línea -... Línea 16...
-
 
16
const AddModal = ({ closeModal, dataLink, googleApiKey, jobCategoryOptions }) => {
14
const AddModal = ({ closeModal, dataLink, googleApiKey, jobCategoryOptions }) => {
17
 
15
 
18
	const dispatch = useDispatch()
16
	const { register, watch } = useForm()
19
	const { register, watch } = useForm()
17
	const [year, setYear] = useState()
20
	const [year, setYear] = useState()
Línea 53... Línea 56...
53
			<div className="form-group">
56
			<div className="form-group">
54
				<label>Último día de aplicación</label>
57
				<label>Último día de aplicación</label>
55
				<Datetime
58
				<Datetime
56
					dateFormat="DD-MM-YYYY"
59
					dateFormat="DD-MM-YYYY"
57
					timeFormat={false}
60
					timeFormat={false}
58
					onChange={(e) =>
61
					onChange={(e) => {
-
 
62
						if (Date.now() > new Date(e.toDate()).getTime()) {
-
 
63
							return dispatch(addNotification({
-
 
64
								style: 'danger',
-
 
65
								msg: 'La fecha no puede ser igual o anterior a la actual'
-
 
66
							}))
-
 
67
						}
59
						setYear(new Intl.DateTimeFormat({ year: 'numeric', month: 'numeric', day: 'numeric' }).format(e.toDate()))
68
						setYear(new Intl.DateTimeFormat({ year: 'numeric', month: 'numeric', day: 'numeric' }).format(e.toDate()))
60
					}
69
					}}
-
 
70
					initialValue={new Date(new Intl.DateTimeFormat('es-ES', year).format())}
61
					inputProps={{ className: 'form-control' }}
71
					inputProps={{ className: 'form-control' }}
62
					closeOnSelect
72
					closeOnSelect
63
				/>
73
				/>
64
			</div>
74
			</div>
65
			<div className="form-group">
75
			<div className="form-group">