Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15210 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 15210 Rev 16696
Línea 3... Línea 3...
3
import { useForm } from 'react-hook-form'
3
import { useForm } from 'react-hook-form'
4
import SearchLocationInput from '../../../shared/SearchLocationInput'
4
import SearchLocationInput from '../../../shared/SearchLocationInput'
5
import SubmitModal from './SubmitModal'
5
import SubmitModal from './SubmitModal'
Línea 6... Línea 6...
6
 
6
 
7
const jobTypeOptions = [
7
const jobTypeOptions = [
8
	{ label: 'Tiempo completo', value: 'f' },
8
  { label: 'Tiempo completo', value: 'f' },
9
	{ label: 'Tiempo parcial', value: 'p' },
9
  { label: 'Tiempo parcial', value: 'p' },
10
	{ label: 'Contratado', value: 'c' },
10
  { label: 'Contratado', value: 'c' },
11
	{ label: 'Temporal', value: 't' },
11
  { label: 'Temporal', value: 't' }
Línea -... Línea 12...
-
 
12
]
-
 
13
 
-
 
14
const AddModal = ({
-
 
15
  closeModal,
-
 
16
  dataLink,
-
 
17
  googleApiKey,
-
 
18
  jobCategoryOptions,
-
 
19
  onComplete
-
 
20
}) => {
12
]
21
  const { register, watch } = useForm()
-
 
22
  const [year, setYear] = useState(
-
 
23
    new Intl.DateTimeFormat('en').format(new Date())
-
 
24
  )
Línea 13... Línea -...
13
 
-
 
14
const AddModal = ({ closeModal, dataLink, googleApiKey, jobCategoryOptions, onComplete }) => {
-
 
15
 
-
 
16
	const { register, watch } = useForm()
-
 
17
	const [year, setYear] = useState(new Intl.DateTimeFormat('en').format(new Date()))
-
 
18
	const [value, setValue] = useState('')
25
  const [value, setValue] = useState('')
19
	const [data, setData] = useState({})
26
  const [data, setData] = useState({})
20
 
27
 
21
	return (
28
  return (
22
		<SubmitModal
29
    <SubmitModal
23
			closeModal={closeModal}
30
      closeModal={closeModal}
24
			postLink={dataLink}
31
      postLink={dataLink}
25
			onComplete={onComplete}
32
      onComplete={onComplete}
26
			submitData={{
33
      submitData={{
27
				...data,
34
        ...data,
28
				title: watch('title'),
35
        title: watch('title'),
29
				employment_type: watch('employment_type'),
36
        employment_type: watch('employment_type'),
30
				last_date_of_application: year,
37
        last_date_of_application: year,
31
				job_category_id: watch('job_category-id'),
38
        job_category_id: watch('job_category-id'),
32
				add_location_search: value
39
        add_location_search: value
33
			}}
40
      }}
34
			title="Nuevo empleo"
41
      title="Nuevo empleo"
-
 
42
    >
-
 
43
      <div className="form-group">
-
 
44
        <label>Título</label>
-
 
45
        <input
35
		>
46
          className="form-control"
-
 
47
          type="text"
36
			<div className="form-group">
48
          name="title"
37
				<label>Título</label>
49
          ref={register({ required: true })}
38
				<input className='form-control' type='text' name='title' ref={register({ required: true })} />
50
        />
39
			</div>
51
      </div>
40
			<div className="form-group">
52
      <div className="form-group">
41
				<label>Tipo de empleo</label>
53
        <label>Tipo de empleo</label>
42
				<select
54
        <select
43
					className='form-control'
55
          className="form-control"
44
					name="employment_type"
56
          name="employment_type"
45
					ref={register({ required: true })}
57
          ref={register({ required: true })}
-
 
58
        >
-
 
59
          {jobTypeOptions.map(({ value, label }) => (
46
				>
60
            <option key={value} value={value}>
47
					{jobTypeOptions.map(({ value, label }) =>
61
              {label}
48
						<option key={value} value={value}>{label}</option>
62
            </option>
49
					)}
63
          ))}
50
				</select>
64
        </select>
51
			</div>
65
      </div>
52
			<div className="form-group">
66
      <div className="form-group">
53
				<label>Último día de aplicación</label>
67
        <label>Último día de aplicación</label>
54
				<Datetime
68
        <Datetime
-
 
69
          dateFormat="DD-MM-YYYY"
55
					dateFormat="DD-MM-YYYY"
70
          timeFormat={false}
-
 
71
          onChange={(e) =>
-
 
72
            setYear(
-
 
73
              new Intl.DateTimeFormat('en', {
-
 
74
                year: 'numeric',
-
 
75
                month: 'numeric',
56
					timeFormat={false}
76
                day: 'numeric'
57
					onChange={(e) =>
77
              }).format(e.toDate())
58
						setYear(new Intl.DateTimeFormat('en', { year: 'numeric', month: 'numeric', day: 'numeric' }).format(e.toDate()))
78
            )
59
					}
79
          }
60
					inputProps={{ className: 'form-control' }}
80
          inputProps={{ className: 'form-control' }}
61
					initialValue={Date.parse(year)}
81
          initialValue={Date.parse(year)}
62
					closeOnSelect
82
          closeOnSelect
63
					value={year}
83
          value={year}
64
				/>
84
        />
65
			</div>
85
      </div>
66
			<div className="form-group">
86
      <div className="form-group">
67
				<label>Categoría de Empleo</label>
87
        <label>Categoría de Empleo</label>
68
				<select
88
        <select
69
					className='form-control'
89
          className="form-control"
70
					name="job_category-id"
-
 
71
					ref={register({ required: true })}
90
          name="job_category-id"
72
				>
91
          ref={register({ required: true })}
73
					{
92
        >
-
 
93
          {Object.entries(jobCategoryOptions).map(([value, name]) => (
74
						Object.entries(jobCategoryOptions).map(([value, name]) => (
94
            <option key={value} value={value}>
75
							<option key={value} value={value}>{name}</option>
95
              {name}
76
						))
96
            </option>
77
					}
97
          ))}
78
				</select>
98
        </select>
79
			</div>
99
      </div>
80
			<div className="form-group">
100
      <div className="form-group">
81
				<label>Ubicación</label>
101
        <label>Ubicación</label>
82
				<SearchLocationInput
102
        <SearchLocationInput
83
					value={value}
103
          value={value}
84
					setValue={setValue}
104
          setValue={setValue}
85
					googleApiKey={googleApiKey}
105
          googleApiKey={googleApiKey}
86
					updateData={setData}
106
          updateData={setData}
87
				/>
107
        />
88
			</div>
108
      </div>
Línea 89... Línea -...
89
		</SubmitModal >
-
 
90
	)
109
    </SubmitModal>
-
 
110
  )