Commit 9794cb28 by jaymehta

.

1 parent 2d4bb548
...@@ -32,10 +32,10 @@ export const GenericHeader = ({ venderBusiness, venderEmail, businessLogo, admin ...@@ -32,10 +32,10 @@ export const GenericHeader = ({ venderBusiness, venderEmail, businessLogo, admin
// Function to handle click outside // Function to handle click outside
const handleClickOutside = event => { const handleClickOutside = event => {
if (innersBoxRef.current && !innersBoxRef.current.contains(event.target)) { if (innersBoxRef.current && !innersBoxRef.current.contains(event.target)) {
// setTimeout(() => { // setTimeout(() => {
// }, 500); // setisopen(false);
// }, 500);
setIsGridViewOpen(false); // Close if clicked outside setIsGridViewOpen(false); // Close if clicked outside
// setisopen();
} }
}; };
// Effect to add click event listener when component mounts // Effect to add click event listener when component mounts
......
...@@ -24,6 +24,7 @@ const BusinessDetails = () => { ...@@ -24,6 +24,7 @@ const BusinessDetails = () => {
console.log("vendorDetails", vendorDetails); console.log("vendorDetails", vendorDetails);
const [disableFields, setdisableFields] = useState(); const [disableFields, setdisableFields] = useState();
const [brandLogo, setbrandLogo] = useState(); const [brandLogo, setbrandLogo] = useState();
const [einDocument, seteinDocument] = useState();
useEffect(() => { useEffect(() => {
console.log("user", loadedUser); console.log("user", loadedUser);
if (loadedUser) { if (loadedUser) {
...@@ -50,8 +51,8 @@ const BusinessDetails = () => { ...@@ -50,8 +51,8 @@ const BusinessDetails = () => {
// gstCertificateFile: Yup.mixed(), // gstCertificateFile: Yup.mixed(),
businessName: Yup.string().required("Business Name is Required"), businessName: Yup.string().required("Business Name is Required"),
einNumber: Yup.string() einNumber: Yup.string()
.matches(/^\d{9}$/, 'EIN Number must be exactly 9 digits') .matches(/^\d{9}$/, "EIN Number must be exactly 9 digits")
.required('EIN Number is Required'), .required("EIN Number is Required"),
// brandLogoFile: Yup.mixed(), // brandLogoFile: Yup.mixed(),
pincode: Yup.string().required("Pincode is Required"), pincode: Yup.string().required("Pincode is Required"),
country: Yup.string().required("Country is Required"), country: Yup.string().required("Country is Required"),
...@@ -83,14 +84,15 @@ const BusinessDetails = () => { ...@@ -83,14 +84,15 @@ const BusinessDetails = () => {
state: vendorDetails.attributes.state, state: vendorDetails.attributes.state,
city: vendorDetails.attributes.city, city: vendorDetails.attributes.city,
addressLine1: vendorDetails.attributes.addressLine1, addressLine1: vendorDetails.attributes.addressLine1,
addressLine2: vendorDetails.attributes.addressLine2, addressLine2: vendorDetails.attributes.addressLine2
}; };
} }
console.log("vendorDetails", vendorDetails); console.log("vendorDetails", vendorDetails);
useEffect(() => { useEffect(() => {
setbrandLogo(vendorDetails?.attributes.brandLogo.data?.id) setbrandLogo(vendorDetails?.attributes.brandLogo?.data?.id);
}, []) seteinDocument(vendorDetails?.attributes.einDocument?.data?.id);
}, []);
const ApprovalStatus = () => { const ApprovalStatus = () => {
if (loadedUser) { if (loadedUser) {
...@@ -173,7 +175,8 @@ const BusinessDetails = () => { ...@@ -173,7 +175,8 @@ const BusinessDetails = () => {
country: values.country, country: values.country,
addressLine1: values.addressLine1, addressLine1: values.addressLine1,
addressLine2: values.addressLine2, addressLine2: values.addressLine2,
brandLogo: brandLogo brandLogo: brandLogo,
einDocument: einDocument
}; };
// await dispatch(updateVendorBusinessDetails({businessDetails, })) // await dispatch(updateVendorBusinessDetails({businessDetails, }))
...@@ -209,9 +212,16 @@ const BusinessDetails = () => { ...@@ -209,9 +212,16 @@ const BusinessDetails = () => {
<div className="col-12 col-lg-5"> <div className="col-12 col-lg-5">
<div className="input-group"> <div className="input-group">
<label>Employer Identification Number</label> <label>Employer Identification Number</label>
<input disabled={disableFields} type="text" <input
disabled={disableFields}
type="number"
pattern="[0-9]" 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>} {errors.einNumber && touched.einNumber && <span className="form-error">{errors.einNumber}</span>}
</div> </div>
</div> </div>
...@@ -233,7 +243,12 @@ const BusinessDetails = () => { ...@@ -233,7 +243,12 @@ const BusinessDetails = () => {
Upload Upload
</label> </label>
</div> */} </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> <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>} {errors.brandLogoFile && touched.brandLogoFile && <span className="form-error">{errors.brandLogoFile}</span>}
</div> </div>
......
...@@ -146,10 +146,19 @@ const UploadImageCustom = ({ isUpdate, setImage, populatedImages, imagesArrayCom ...@@ -146,10 +146,19 @@ const UploadImageCustom = ({ isUpdate, setImage, populatedImages, imagesArrayCom
message.error(`Failed to remove ${file.name}`); 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 ( return (
<div> <div>
<Upload <Upload
disabled={disabled} disabled={disabled}
beforeUpload={beforeUpload}
// customRequest={handleCustomRequest} // customRequest={handleCustomRequest}
// enterButton={true} // enterButton={true}
// showUploadList={{ showRemoveIcon: false }} // showUploadList={{ showRemoveIcon: false }}
......
...@@ -113,7 +113,7 @@ export const getLoggedInVendor = () => async dispatch => { ...@@ -113,7 +113,7 @@ export const getLoggedInVendor = () => async dispatch => {
id: { $eq: session.id } id: { $eq: session.id }
} }
}, },
populate: ["brandLogo"] populate: ["brandLogo", "einDocument"]
}; };
const queryString = qs.stringify(query, { const queryString = qs.stringify(query, {
...@@ -163,7 +163,7 @@ export const getVendorDetails = () => async dispatch => { ...@@ -163,7 +163,7 @@ export const getVendorDetails = () => async dispatch => {
} }
} }
}, },
populate: ["user", "brandLogo"] populate: ["user", "brandLogo", "einDocument"]
}; };
console.log("here 3", query); console.log("here 3", query);
...@@ -214,7 +214,7 @@ export const getAllVendors = ...@@ -214,7 +214,7 @@ export const getAllVendors =
// } // }
// } // }
}, },
populate: ["user", "experiences", "brandLogo"], populate: ["user", "experiences", "brandLogo", "einDocument"],
sort: ["createdAt:desc"], sort: ["createdAt:desc"],
pagination: { pagination: {
pageSize: pageSize, 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!