Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 9761 | Rev 9782 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
9779 stevensc 1
import React, { useState } from 'react'
9759 stevensc 2
import { useForm } from 'react-hook-form'
9779 stevensc 3
import { SearchInput } from '../components/TableComponents'
9469 stevensc 4
 
9779 stevensc 5
const FormView = ({ actionLink, googleApiKey }) => {
9759 stevensc 6
 
7
  const { handleSubmit, register } = useForm()
9779 stevensc 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
    }
28
  ])
9759 stevensc 29
 
9779 stevensc 30
 
9759 stevensc 31
  const onSubmit = (data) => {
32
    console.log(data)
33
  }
9469 stevensc 34
  return (
9759 stevensc 35
    <section className="container">
36
      <div className="row">
37
        <div className="col-xs-12 col-md-12">
38
          <form onSubmit={handleSubmit(onSubmit)}>
39
            <div className="form-group">
40
              <label>Nombre</label>
41
              <input
42
                type="text"
43
                name="name"
44
                className="form-control"
9761 stevensc 45
                ref={register({ required: true, maxLength: 120 })}
9759 stevensc 46
              />
47
            </div>
9779 stevensc 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>
9759 stevensc 102
          </form>
103
        </div>
104
      </div>
105
    </section>
9469 stevensc 106
  )
107
}
108
export default FormView