Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 9761 Rev 9779
Línea 1... Línea 1...
1
import React from 'react'
1
import React, { useState } from 'react'
2
import { useForm } from 'react-hook-form'
2
import { useForm } from 'react-hook-form'
-
 
3
import { SearchInput } from '../components/TableComponents'
Línea 3... Línea 4...
3
 
4
 
Línea 4... Línea 5...
4
const FormView = ({ actionLink }) => {
5
const FormView = ({ actionLink, googleApiKey }) => {
-
 
6
 
-
 
7
  const { handleSubmit, register } = useForm()
-
 
8
  const [location, setLocation] = useState({})
-
 
9
  const [year, setYear] = useState(new Date().toString())
-
 
10
  const [locationLabel, setLocationLabel] = useState('')
-
 
11
  const [jobsDescriptions, setJobsDescriptions] = useState([
-
 
12
    {
-
 
13
      value: "8ff86a9a-651c-4dd0-86c1-b9c0716d09e0",
-
 
14
      label: "Programador Junior"
-
 
15
    }
-
 
16
  ])
-
 
17
  const [jobsCategory, setJobsCategory] = useState([
-
 
18
    {
-
 
19
      value: "7bd009b8-bd25-4602-bf85-9496af80afbd",
-
 
20
      label: "Finanzas"
-
 
21
    }
-
 
22
  ])
-
 
23
  const [industry, setIndustry] = useState([
-
 
24
    {
-
 
25
      value: "307c261f-2d27-4b3c-a86a-6f69a596edb8",
-
 
26
      label: "Bienes raíces"
-
 
27
    }
Línea 5... Línea 28...
5
 
28
  ])
6
  const { handleSubmit, register } = useForm()
29
 
7
 
30
 
8
  const onSubmit = (data) => {
31
  const onSubmit = (data) => {
Línea 20... Línea 43...
20
                name="name"
43
                name="name"
21
                className="form-control"
44
                className="form-control"
22
                ref={register({ required: true, maxLength: 120 })}
45
                ref={register({ required: true, maxLength: 120 })}
23
              />
46
              />
24
            </div>
47
            </div>
-
 
48
            <div className="form-group">
-
 
49
              <label>Cargo a evaluar</label>
-
 
50
              <select name="job_description_id" className="form-control" ref={register({ required: true })}>
-
 
51
                {
-
 
52
                  jobsDescriptions.map(({ label, value }) => (
-
 
53
                    <option value={value}>{label}</option>
-
 
54
                  ))
-
 
55
                }
-
 
56
              </select>
-
 
57
            </div>
-
 
58
            <div className="form-group">
-
 
59
              <label>Categoría de Empleo</label>
-
 
60
              <select name="job_category_id" className="form-control" ref={register({ required: true })}>
-
 
61
                {
-
 
62
                  jobsCategory.map(({ label, value }) => (
-
 
63
                    <option value={value}>{label}</option>
-
 
64
                  ))
-
 
65
                }
-
 
66
              </select>
-
 
67
            </div>
-
 
68
            <div className="form-group">
-
 
69
              <label>Ubicación</label>
-
 
70
              <SearchInput
-
 
71
                value={locationLabel}
-
 
72
                setValue={setLocationLabel}
-
 
73
                googleApiKey={googleApiKey}
-
 
74
                updateData={setLocation}
-
 
75
              />
-
 
76
            </div>
-
 
77
            <div className="form-group">
-
 
78
              <label>Industria</label>
-
 
79
              <select name="industry_id" className="form-control" ref={register({ required: true })}>
-
 
80
                {
-
 
81
                  industry.map(({ label, value }) => (
-
 
82
                    <option value={value}>{label}</option>
-
 
83
                  ))
-
 
84
                }
-
 
85
              </select>
-
 
86
            </div>
-
 
87
            <div className="form-group">
-
 
88
              <label>Último día de aplicación</label>
-
 
89
              <select name="industry_id" className="form-control" ref={register({ required: true })}>
-
 
90
                <Datetime
-
 
91
                  dateFormat="DD-MM-YYYY"
-
 
92
                  timeFormat={false}
-
 
93
                  onChange={(e) =>
-
 
94
                    setYear(new Intl.DateTimeFormat({ year: 'numeric', month: 'numeric', day: 'numeric' }).format(e.toDate()))
-
 
95
                  }
-
 
96
                  initialValue={Date.parse(year)}
-
 
97
                  inputProps={{ className: 'form-control' }}
-
 
98
                  closeOnSelect
-
 
99
                />
-
 
100
              </select>
-
 
101
            </div>
25
          </form>
102
          </form>
26
        </div>
103
        </div>
27
      </div>
104
      </div>
28
    </section>
105
    </section>
29
  )
106
  )