Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 9831 Rev 9832
Línea 4... Línea 4...
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'
7
import { useHistory, useParams } from 'react-router-dom'
7
import { useHistory, useParams } from 'react-router-dom'
8
import "react-datetime/css/react-datetime.css"
8
import "react-datetime/css/react-datetime.css"
-
 
9
import { validate } from 'uuid'
Línea 9... Línea 10...
9
 
10
 
Línea 10... Línea 11...
10
const FormView = ({ actionLink, googleApiKey }) => {
11
const FormView = ({ actionLink, googleApiKey }) => {
11
 
12
 
Línea 12... Línea 13...
12
  const history = useHistory()
13
  const history = useHistory()
Línea -... Línea 14...
-
 
14
  let { action } = useParams()
13
  let { action } = useParams()
15
 
14
 
16
  const { handleSubmit, register, setValue, errors } = useForm()
15
  const { handleSubmit, register, setValue } = useForm()
17
 
16
 
18
  const [inputErrors, setInputErrors] = useState({})
17
  const [location, setLocation] = useState({})
19
  const [location, setLocation] = useState({})
Línea 44... Línea 46...
44
      ...location,
46
      ...location,
45
      last_date: year,
47
      last_date: year,
46
      status: isActive ? "a" : "i"
48
      status: isActive ? "a" : "i"
47
    }
49
    }
Línea -... Línea 50...
-
 
50
 
48
 
51
    if (!location.formatted_address) { return setInputErrors({ ...inputErrors, location: "Empty location" }) }
49
    console.log(submitData)
52
    if (!year) { return setInputErrors({ ...inputErrors, year: "Empty last day" }) }
Línea 50... Línea 53...
50
  }
53
  }
Línea 51... Línea 54...
51
 
54
 
Línea 69... Línea 72...
69
                type="text"
72
                type="text"
70
                name="name"
73
                name="name"
71
                className="form-control"
74
                className="form-control"
72
                ref={register({ required: true, maxLength: 120 })}
75
                ref={register({ required: true, maxLength: 120 })}
73
              />
76
              />
-
 
77
              {errors.name && <p>{errors.name}</p>}
74
            </div>
78
            </div>
75
            <div className="form-group">
79
            <div className="form-group">
76
              <label>Cargo a evaluar</label>
80
              <label>Cargo a evaluar</label>
77
              <select name="job_description_id" className="form-control" ref={register({ required: true })}>
81
              <select name="job_description_id" className="form-control" ref={register({ required: true })} onChange={(e) => setJobsDescriptions(e.target.value)}>
78
                {
82
                {
79
                  jobsDescriptions.map(({ label, value }) => (
83
                  jobsDescriptions.map(({ label, value }) => (
80
                    <option value={value}>{label}</option>
84
                    <option value={value}>{label}</option>
81
                  ))
85
                  ))
82
                }
86
                }
83
              </select>
87
              </select>
84
            </div>
88
            </div>
85
            <div className="form-group">
89
            <div className="form-group">
86
              <label>Categoría de Empleo</label>
90
              <label>Categoría de Empleo</label>
87
              <select name="job_category_id" className="form-control" ref={register({ required: true })}>
91
              <select name="job_category_id" className="form-control" ref={register({ required: true })} onChange={(e) => setJobsCategory(e.target.value)}>
88
                {
92
                {
89
                  jobsCategory.map(({ label, value }) => (
93
                  jobsCategory.map(({ label, value }) => (
90
                    <option value={value}>{label}</option>
94
                    <option value={value}>{label}</option>
91
                  ))
95
                  ))
92
                }
96
                }
Línea 98... Línea 102...
98
                value={locationLabel}
102
                value={locationLabel}
99
                setValue={setLocationLabel}
103
                setValue={setLocationLabel}
100
                googleApiKey={googleApiKey}
104
                googleApiKey={googleApiKey}
101
                updateData={setLocation}
105
                updateData={setLocation}
102
              />
106
              />
-
 
107
              {inputErrors.location && <p>{inputErrors.location}</p>}
103
            </div>
108
            </div>
104
            <div className="form-group">
109
            <div className="form-group">
105
              <label>Industria</label>
110
              <label>Industria</label>
106
              <select name="industry_id" className="form-control" ref={register({ required: true })}>
111
              <select name="industry_id" className="form-control" ref={register({ required: true })} onChange={(e) => setIndustry(e.target.value)}>
107
                {
112
                {
108
                  industry.map(({ label, value }) => (
113
                  industry.map(({ label, value }) => (
109
                    <option value={value}>{label}</option>
114
                    <option value={value}>{label}</option>
110
                  ))
115
                  ))
111
                }
116
                }
Línea 120... Línea 125...
120
                  setYear(new Intl.DateTimeFormat({ year: 'numeric', month: 'numeric', day: 'numeric' }).format(e.toDate()))
125
                  setYear(new Intl.DateTimeFormat({ year: 'numeric', month: 'numeric', day: 'numeric' }).format(e.toDate()))
121
                }
126
                }
122
                inputProps={{ className: 'form-control' }}
127
                inputProps={{ className: 'form-control' }}
123
                closeOnSelect
128
                closeOnSelect
124
              />
129
              />
-
 
130
              {inputErrors.year && <p>{inputErrors.year}</p>}
125
            </div>
131
            </div>
126
            <div className="form-group">
132
            <div className="form-group">
127
              <label>Descripción</label>
133
              <label>Descripción</label>
128
              <DescriptionInput
134
              <DescriptionInput
129
                setValue={setValue}
135
                setValue={setValue}
Línea 151... Línea 157...
151
              </div>
157
              </div>
152
            </div>
158
            </div>
153
            <div className="form-group">
159
            <div className="form-group">
154
              <button
160
              <button
155
                type="submit"
161
                type="submit"
156
                className="btn btn-primary btn-form-save-close"
162
                className="btn btn-primary btn-form-save-close mr-2"
157
              >
163
              >
158
                Guardar
164
                Guardar
159
              </button>
165
              </button>
160
              <button
166
              <button
161
                type="button"
167
                type="button"