|
|
|
@@ -13,9 +13,13 @@ import HashPositions from './HashPositions'; |
|
|
|
import ReCAPTCHA from 'react-google-recaptcha'; |
|
|
|
import axios from 'axios'; |
|
|
|
import { UIContext } from '../../context/UIContextProvider'; |
|
|
|
import { strapiApiBuilder } from '../../utils/strapiApiBuilder'; |
|
|
|
import useFetchCollections from '../../hooks/useFetchCollections'; |
|
|
|
|
|
|
|
const api_url = process.env.REACT_APP_API_URL; |
|
|
|
|
|
|
|
const strapiPopulate = []; |
|
|
|
|
|
|
|
export default function JobForm(props) { |
|
|
|
const [btnText, setBtnText] = useState(''); |
|
|
|
const [sucMsg, setSucMsg] = useState(false); |
|
|
|
@@ -34,6 +38,10 @@ export default function JobForm(props) { |
|
|
|
const [errorMsgPosition, setErrorMsgPosition] = useState(''); |
|
|
|
const fileInput = useRef(); |
|
|
|
|
|
|
|
const strapi = strapiApiBuilder('jobs', strapiPopulate, ''); |
|
|
|
|
|
|
|
const [{ data, isLoading, isError }, doFetch] = useFetchCollections(strapi); |
|
|
|
|
|
|
|
function changeFormHandler(event) { |
|
|
|
const { name, value } = event.target; |
|
|
|
setJobForm(prevState => ({ |
|
|
|
@@ -51,9 +59,9 @@ export default function JobForm(props) { |
|
|
|
|
|
|
|
function hashToFormData(selected, other) { |
|
|
|
setJobForm(prevState => ({ |
|
|
|
...prevState, |
|
|
|
position: selected, |
|
|
|
other: other, |
|
|
|
...prevState, |
|
|
|
position: selected, |
|
|
|
other: other, |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -62,7 +70,7 @@ export default function JobForm(props) { |
|
|
|
...prevState, |
|
|
|
position: selectedPosition, |
|
|
|
})); |
|
|
|
},[selectedPosition]) |
|
|
|
}, [selectedPosition]); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
setBtnText(props.cta); |
|
|
|
@@ -223,16 +231,19 @@ export default function JobForm(props) { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{/* <RadioBoxesGroup/> */} |
|
|
|
<HashPositions |
|
|
|
changeFormHandler={changeFormHandler} |
|
|
|
cntCareers={cntCareersJobs} |
|
|
|
otherInputState={otherInputState} |
|
|
|
hashToFormData={hashToFormData} |
|
|
|
setOtherInputState={setOtherInputState} |
|
|
|
defaultPositionSelection={defaultPositionSelection} |
|
|
|
selectedPosition={selectedPosition} |
|
|
|
setSelectedPosition={setSelectedPosition} |
|
|
|
/> |
|
|
|
{data && ( |
|
|
|
<HashPositions |
|
|
|
changeFormHandler={changeFormHandler} |
|
|
|
data={data} |
|
|
|
otherInputState={otherInputState} |
|
|
|
hashToFormData={hashToFormData} |
|
|
|
setOtherInputState={setOtherInputState} |
|
|
|
defaultPositionSelection={defaultPositionSelection} |
|
|
|
selectedPosition={selectedPosition} |
|
|
|
setSelectedPosition={setSelectedPosition} |
|
|
|
/> |
|
|
|
)} |
|
|
|
|
|
|
|
<div className="py-1"> |
|
|
|
<label |
|
|
|
htmlFor="first-name" |