error display name for timeline_days changed

This commit is contained in:
victorAnumudu
2023-05-18 15:58:48 +01:00
parent 1a50788730
commit 07c72b5459
+30 -41
View File
@@ -33,7 +33,7 @@ const validationSchema = Yup.object().shape({
timeline_days: Yup.number()
.typeError("you must specify a number")
.min(1, "Price must be greater than 0")
.required("Price is required"),
.required("Timeline is required"),
});
let initialValues = {
@@ -51,15 +51,14 @@ function AddJob() {
const navigate = useNavigate();
let {userDetails} = useSelector((state)=> state.userDetails)
console.log(userDetails, userDetails.country)
let [pageLoading, setPageLoading] = useState(true); // State used for knowing when the page is mounting
// let [country, setCountry] = useState({
// loading: false,
// status: false,
// data: [],
// }); // To Hold the array of country getUserCountry returns
let [country, setCountry] = useState({
loading: true,
status: false,
data: '',
}); // To Hold the array of country getUserCountry returns
let [requestStatus, setRequestStatus] = useState({
loading: false,
@@ -68,24 +67,24 @@ function AddJob() {
}); // Holds state when submit button is pressed
// FUNCTION TO GET COUNTRY
// const getUserCountry = () => {
// setCountry((prev) => ({ ...prev, loading: true }));
// ApiCall.getSignupCountryData()
// .then((res) => {
// if (res.data.internal_return < 1) {
// setCountry({ loading: false, status: true, data: [] });
// return;
// }
// setCountry({
// loading: false,
// status: true,
// data: res.data.signup_country,
// });
// })
// .catch((err) => {
// setCountry({ loading: false, status: false, data: [] });
// });
// };
const getUserCountry = () => {
setCountry((prev) => ({ ...prev, loading: true }));
ApiCall.getSignupCountryData()
.then((res) => {
if (res.data.internal_return < 1) {
setCountry({ loading: false, status: true, data: '' });
return;
}
setCountry({
loading: false,
status: true,
data: res.data.signup_country?.find(item => item[0]==userDetails.country)[1],
});
})
.catch((err) => {
setCountry({ loading: false, status: false, data: '' });
});
};
// FUNCTION TO HANDLE ADD JOB FORM
const handleAddJob = (values, helpers) => {
@@ -125,7 +124,7 @@ function AddJob() {
useEffect(() => {
setPageLoading(false);
// getUserCountry();
getUserCountry();
}, []);
return pageLoading.loading ? (
@@ -161,8 +160,9 @@ function AddJob() {
type="text"
name="country"
disable={true}
// placeholder="Select Country"
value={userDetails.country}
value={country.loading ? 'loading' : country.data ? country.data : 'no country found!'}
// inputHandler={(e)=> setCountry((prev) => ({...prev, data:e.target.value}))}
/>
{/* <label
htmlFor="country"
@@ -202,8 +202,8 @@ function AddJob() {
No Options Found! Try Again
</option>
)}
</select>
{props.errors.country && props.touched.country && (
</select> */}
{/* {props.errors.country && props.touched.country && (
<p className="text-sm text-red-500">
{props.errors.country}
</p>
@@ -277,17 +277,6 @@ function AddJob() {
{/* Details */}
<div className="field w-full mb-6">
{/* <InputCom
fieldClass="px-6"
label="Job Delivery Details"
labelClass='tracking-wide'
inputBg = 'bg-slate-100'
type="text"
name="details"
// placeholder="Please Enter Detail Description of Job"
value={props.values.details}
inputHandler={props.handleChange}
/> */}
<label
htmlFor="Job Delivery Details"
className='className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold block"'