| Línea 23... |
Línea 23... |
| 23 |
const locationRef = useRef()
|
23 |
const locationRef = useRef()
|
| 24 |
const { handleSubmit, register, setValue, errors, getValues } = useForm()
|
24 |
const { handleSubmit, register, setValue, errors, getValues } = useForm()
|
| 25 |
const [inputErrors, setInputErrors] = useState({})
|
25 |
const [inputErrors, setInputErrors] = useState({})
|
| 26 |
const [location, setLocation] = useState({})
|
26 |
const [location, setLocation] = useState({})
|
| 27 |
const [isActive, setIsActive] = useState(false)
|
27 |
const [isActive, setIsActive] = useState(false)
|
| 28 |
const [year, setYear] = useState(Date.now())
|
28 |
const [year, setYear] = useState(new Date)
|
| 29 |
const [locationLabel, setLocationLabel] = useState('')
|
29 |
const [locationLabel, setLocationLabel] = useState('')
|
| 30 |
const [jobsDescriptions, setJobsDescriptions] = useState([])
|
30 |
const [jobsDescriptions, setJobsDescriptions] = useState([])
|
| 31 |
const [jobsCategory, setJobsCategory] = useState([])
|
31 |
const [jobsCategory, setJobsCategory] = useState([])
|
| 32 |
const [industry, setIndustry] = useState([])
|
32 |
const [industry, setIndustry] = useState([])
|
| Línea 37... |
Línea 37... |
| 37 |
const formData = new FormData()
|
37 |
const formData = new FormData()
|
| 38 |
const submitData = {
|
38 |
const submitData = {
|
| 39 |
...data,
|
39 |
...data,
|
| 40 |
...location,
|
40 |
...location,
|
| 41 |
last_date: action === 'edit'
|
41 |
last_date: action === 'edit'
|
| 42 |
? new Intl.DateTimeFormat('en').format(new Date(year))
|
42 |
? new Intl.DateTimeFormat('az').format(new Date(year))
|
| 43 |
: new Intl.DateTimeFormat('es').format(year),
|
43 |
: new Intl.DateTimeFormat('az').format(year),
|
| 44 |
status: isActive ? 'a' : 'i'
|
44 |
status: isActive ? 'a' : 'i'
|
| 45 |
}
|
45 |
}
|
| 46 |
if (!location.formatted_address) {
|
46 |
if (!location.formatted_address) {
|
| 47 |
// locationRef.current.focus();
|
47 |
// locationRef.current.focus();
|
| 48 |
dispatch(addNotification({
|
48 |
dispatch(addNotification({
|
| Línea 118... |
Línea 118... |
| 118 |
city2: respData.city2,
|
118 |
city2: respData.city2,
|
| 119 |
country: respData.country,
|
119 |
country: respData.country,
|
| 120 |
postal_code: respData.postal_code,
|
120 |
postal_code: respData.postal_code,
|
| 121 |
state: respData.state
|
121 |
state: respData.state
|
| 122 |
})
|
122 |
})
|
| 123 |
setYear(respData.last_date)
|
123 |
setYear(new Date(respData.last_date))
|
| 124 |
respData.status === 'a' ? setIsActive(true) : setIsActive(false)
|
124 |
respData.status === 'a' ? setIsActive(true) : setIsActive(false)
|
| Línea 125... |
Línea 125... |
| 125 |
|
125 |
|
| 126 |
Object.entries(respData.job_category.category_options).map(([value, label]) => {
|
126 |
Object.entries(respData.job_category.category_options).map(([value, label]) => {
|
| 127 |
setJobsCategory(prev => [...prev, { value: value, label: label }])
|
127 |
setJobsCategory(prev => [...prev, { value: value, label: label }])
|
| Línea 139... |
Línea 139... |
| 139 |
setValue('description', respData.description)
|
139 |
setValue('description', respData.description)
|
| Línea 140... |
Línea 140... |
| 140 |
|
140 |
|
| 141 |
setValue('job_description_id', respData.job_description.current_description.description_id)
|
141 |
setValue('job_description_id', respData.job_description.current_description.description_id)
|
| 142 |
setValue('job_category_id', respData.job_category.current_category.job_category_id)
|
142 |
setValue('job_category_id', respData.job_category.current_category.job_category_id)
|
| 143 |
setValue('industry_id', respData.industry.current_industry.industry_id)
|
- |
|
| 144 |
|
- |
|
| 145 |
|
- |
|
| 146 |
|
143 |
setValue('industry_id', respData.industry.current_industry.industry_id)
|
| 147 |
}
|
144 |
}
|
| 148 |
})
|
145 |
})
|
| 149 |
}
|
146 |
}
|