Commit 9794cb28 by jaymehta

.

1 parent 2d4bb548
......@@ -32,10 +32,10 @@ export const GenericHeader = ({ venderBusiness, venderEmail, businessLogo, admin
// Function to handle click outside
const handleClickOutside = event => {
if (innersBoxRef.current && !innersBoxRef.current.contains(event.target)) {
// setTimeout(() => {
// }, 500);
// setTimeout(() => {
// setisopen(false);
// }, 500);
setIsGridViewOpen(false); // Close if clicked outside
// setisopen();
}
};
// Effect to add click event listener when component mounts
......
......@@ -24,6 +24,7 @@ const BusinessDetails = () => {
console.log("vendorDetails", vendorDetails);
const [disableFields, setdisableFields] = useState();
const [brandLogo, setbrandLogo] = useState();
const [einDocument, seteinDocument] = useState();
useEffect(() => {
console.log("user", loadedUser);
if (loadedUser) {
......@@ -50,8 +51,8 @@ const BusinessDetails = () => {
// gstCertificateFile: Yup.mixed(),
businessName: Yup.string().required("Business Name is Required"),
einNumber: Yup.string()
.matches(/^\d{9}$/, 'EIN Number must be exactly 9 digits')
.required('EIN Number is Required'),
.matches(/^\d{9}$/, "EIN Number must be exactly 9 digits")
.required("EIN Number is Required"),
// brandLogoFile: Yup.mixed(),
pincode: Yup.string().required("Pincode is Required"),
country: Yup.string().required("Country is Required"),
......@@ -83,14 +84,15 @@ const BusinessDetails = () => {
state: vendorDetails.attributes.state,
city: vendorDetails.attributes.city,
addressLine1: vendorDetails.attributes.addressLine1,
addressLine2: vendorDetails.attributes.addressLine2,
addressLine2: vendorDetails.attributes.addressLine2
};
}
console.log("vendorDetails", vendorDetails);
useEffect(() => {
setbrandLogo(vendorDetails?.attributes.brandLogo.data?.id)
}, [])
setbrandLogo(vendorDetails?.attributes.brandLogo?.data?.id);
seteinDocument(vendorDetails?.attributes.einDocument?.data?.id);
}, []);
const ApprovalStatus = () => {
if (loadedUser) {
......@@ -173,7 +175,8 @@ const BusinessDetails = () => {
country: values.country,
addressLine1: values.addressLine1,
addressLine2: values.addressLine2,
brandLogo: brandLogo
brandLogo: brandLogo,
einDocument: einDocument
};
// await dispatch(updateVendorBusinessDetails({businessDetails, }))
......@@ -209,9 +212,16 @@ const BusinessDetails = () => {
<div className="col-12 col-lg-5">
<div className="input-group">
<label>Employer Identification Number</label>
<input disabled={disableFields} type="text"
<input
disabled={disableFields}
type="number"
pattern="[0-9]"
maxLength="9" name="einNumber" onChange={handleChange} onBlur={handleBlur} value={values.einNumber} />
maxLength="9"
name="einNumber"
onChange={handleChange}
onBlur={handleBlur}
value={values.einNumber}
/>
{errors.einNumber && touched.einNumber && <span className="form-error">{errors.einNumber}</span>}
</div>
</div>
......@@ -233,7 +243,12 @@ const BusinessDetails = () => {
Upload
</label>
</div> */}
<UploadImageCustom disabled={disableFields} setImage={setbrandLogo} isPdf={false} populatedImages={vendorDetails?.attributes.brandLogo} />
<UploadImageCustom
disabled={disableFields}
setImage={seteinDocument}
isPdf={false}
populatedImages={vendorDetails?.attributes.einDocument}
/>
<p className="textS pe-5 pt-2">File size to be less than 2MB</p>
{errors.brandLogoFile && touched.brandLogoFile && <span className="form-error">{errors.brandLogoFile}</span>}
</div>
......
......@@ -146,10 +146,19 @@ const UploadImageCustom = ({ isUpdate, setImage, populatedImages, imagesArrayCom
message.error(`Failed to remove ${file.name}`);
}
};
const beforeUpload = (file) => {
const isJpgOrPngOrPdf = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg' || file.type === 'application/pdf';
if (!isJpgOrPngOrPdf) {
message.error('You can only upload JPG, JPEG, PNG, or PDF files!');
}
return isJpgOrPngOrPdf;
};
return (
<div>
<Upload
disabled={disabled}
beforeUpload={beforeUpload}
// customRequest={handleCustomRequest}
// enterButton={true}
// showUploadList={{ showRemoveIcon: false }}
......
......@@ -113,7 +113,7 @@ export const getLoggedInVendor = () => async dispatch => {
id: { $eq: session.id }
}
},
populate: ["brandLogo"]
populate: ["brandLogo", "einDocument"]
};
const queryString = qs.stringify(query, {
......@@ -163,7 +163,7 @@ export const getVendorDetails = () => async dispatch => {
}
}
},
populate: ["user", "brandLogo"]
populate: ["user", "brandLogo", "einDocument"]
};
console.log("here 3", query);
......@@ -214,7 +214,7 @@ export const getAllVendors =
// }
// }
},
populate: ["user", "experiences", "brandLogo"],
populate: ["user", "experiences", "brandLogo", "einDocument"],
sort: ["createdAt:desc"],
pagination: {
pageSize: pageSize,
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!