BusinessDetails.js 20.6 KB
import { Formik } from "formik";
import { Fragment } from "react";
import { Button, Form } from "react-bootstrap";
import * as Yup from "yup";

const BusinessDetails = () => {
    const businessDetailsValidationSchema = Yup.object().shape({
        pan_number: Yup.string()
            .required("Pan Number is Required"),
        pan_file: Yup.string()
            .required("Pan Image is Required"),
        gst_number: Yup.string()
            .required("GST Number is Required"),
        gst_certificate_file: Yup.string()
            .required("GST Certificate is Required"),
        business_name: Yup.string()
            .required("Business Name is Required"),
        brand_logo_file: Yup.string()
            .required("Brand Logo is Required"),
        pincode: Yup.string()
            .required("Pincode is Required"),
        country: Yup.string()
            .required("Country is Required"),
        state: Yup.string()
            .required("State is Required"),
        city: Yup.string()
            .required("City is Required"),
        address_line1: Yup.string()
            .required("Address Line 1 is Required"),
        address_line2: Yup.string()
            .required("Address Line 2 is Required"),
    });

    return (
        <Fragment>
            <div className="container p-5">
                <div className="row">
                    <div className="col-12 col-lg-8">
                        <div className="content-div business-details">
                            <h2>Tell us about your business</h2>
                            <p>Please have the following ready before you begin</p>
                            <p><i className="fa fa-arrow-right me-1"></i> Your bank account details for receiving payments from ZanGO</p>
                            <p><i className="fa fa-arrow-right me-1"></i> Tax (GST/PAN) details of your business.</p>
                            <hr />
                            <div className="form-container">
                                <Formik
                                    initialValues={{
                                        pan_number: "",
                                        pan_file: "",
                                        gst_number: "",
                                        gst_certificate_file: "",
                                        business_name: "",
                                        brand_logo_file: "",
                                        pincode: "",
                                        country: "",
                                        state: "",
                                        city: "",
                                        address_line1: "",
                                        address_line2: ""
                                    }}
                                    validationSchema={businessDetailsValidationSchema}
                                    // enableReinitialize={true}
                                    onSubmit={values => {
                                        console.log("business details values", values)
                                    }}
                                >
                                    {({ values, errors, touched, handleChange, handleBlur, handleSubmit }) => (
                                        <Form
                                            onSubmit={e => {
                                                e.preventDefault();
                                                handleSubmit();
                                            }}
                                        >
                                            <h4>Vendor Business Information</h4>
                                            <div>
                                                <p>Business documents</p>
                                                <div className="row">
                                                    <div className="col-12 col-lg-5">
                                                        <div className="input-group">
                                                            <label>Enter Business PAN No.</label>
                                                            <input
                                                                type="text"
                                                                name="pan_number"
                                                                onChange={handleChange}
                                                                onBlur={handleBlur}
                                                                value={values.pan_number}
                                                            />
                                                            {errors.pan_number && touched.pan_number && (<span className="form-error">{errors.pan_number}</span>)}
                                                        </div>
                                                    </div>
                                                    <div className="col-12 offset-lg-1 col-lg-5">
                                                        <div className="input-group">
                                                            <label>Upload PAN</label>
                                                            <input
                                                                type="file"
                                                                name="pan_file"
                                                                onChange={handleChange}
                                                                onBlur={handleBlur}
                                                                value={values.pan_file}
                                                            />
                                                            {errors.pan_file && touched.pan_file && (<span className="form-error">{errors.pan_file}</span>)}
                                                        </div>
                                                    </div>
                                                </div>
                                                <div className="row">
                                                    <div className="col-12 col-lg-5">
                                                        <div className="input-group">
                                                            <label>GST Number</label>
                                                            <input
                                                                type="text"
                                                                name="gst_number"
                                                                onChange={handleChange}
                                                                onBlur={handleBlur}
                                                                value={values.gst_number}
                                                            />
                                                            {errors.gst_number && touched.gst_number && (<span className="form-error">{errors.gst_number}</span>)}
                                                        </div>
                                                    </div>
                                                    <div className="col-12 offset-lg-1 col-lg-5">
                                                        <div className="input-group">
                                                            <label>GST Certificate</label>
                                                            <input
                                                                type="file"
                                                                name="gst_certificate_file"
                                                                onChange={handleChange}
                                                                onBlur={handleBlur}
                                                                value={values.gst_certificate_file}
                                                            />
                                                            {errors.gst_certificate_file && touched.gst_certificate_file && (<span className="form-error">{errors.gst_certificate_file}</span>)}
                                                        </div>
                                                    </div>
                                                </div>
                                                <div className="row">
                                                    <div className="col-12 col-lg-5">
                                                        <div className="input-group">
                                                            <label>Business Name</label>
                                                            <input
                                                                type="text"
                                                                name="business_name"
                                                                onChange={handleChange}
                                                                onBlur={handleBlur}
                                                                value={values.business_name}
                                                            />
                                                            {errors.business_name && touched.business_name && (<span className="form-error">{errors.business_name}</span>)}
                                                        </div>
                                                    </div>
                                                    <div className="col-12 offset-lg-1 col-lg-5">
                                                        <div className="input-group">
                                                            <label>Brand Logo</label>
                                                            <input
                                                                type="file"
                                                                name="brand_logo_file"
                                                                onChange={handleChange}
                                                                onBlur={handleBlur}
                                                                value={values.brand_logo_file}
                                                            />
                                                            {errors.brand_logo_file && touched.brand_logo_file && (<span className="form-error">{errors.brand_logo_file}</span>)}
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <hr />
                                            <div>
                                                <p>Business Address</p>
                                                <div className="row">
                                                    <div className="col-12 col-lg-5">
                                                        <div className="input-group">
                                                            <label>Pincode</label>
                                                            <input
                                                                type="text"
                                                                name="pincode"
                                                                onChange={handleChange}
                                                                onBlur={handleBlur}
                                                                value={values.pincode}
                                                            />
                                                            {errors.pincode && touched.pincode && (<span className="form-error">{errors.pincode}</span>)}
                                                        </div>
                                                    </div>
                                                    <div className="col-12 offset-lg-1 col-lg-5">
                                                        <div className="input-group">
                                                            <label>Country</label>
                                                            <select
                                                                id="country"
                                                                name="country"
                                                                onChange={handleChange}
                                                                onBlur={handleBlur}
                                                            >
                                                                <option value="India">India</option>
                                                                <option value="America">America</option>
                                                            </select>
                                                            {errors.country && touched.country && (<span className="form-error">{errors.country}</span>)}
                                                        </div>
                                                    </div>
                                                </div>
                                                <div className="row">
                                                    <div className="col-12 col-lg-5">
                                                        <div className="input-group">
                                                            <label>State</label>
                                                            <select
                                                                id="state"
                                                                name="state"
                                                                onChange={handleChange}
                                                                onBlur={handleBlur}
                                                            >
                                                                <option value="India">India</option>
                                                                <option value="America">America</option>
                                                            </select>
                                                            {errors.state && touched.state && (<span className="form-error">{errors.state}</span>)}
                                                        </div>
                                                    </div>
                                                    <div className="col-12 offset-lg-1 col-lg-5">
                                                        <div className="input-group">
                                                            <label>City</label>
                                                            <select
                                                                id="city"
                                                                name="city"
                                                                onChange={handleChange}
                                                                onBlur={handleBlur}
                                                            >
                                                                <option value="India">India</option>
                                                                <option value="America">America</option>
                                                            </select>
                                                            {errors.city && touched.city && (<span className="form-error">{errors.city}</span>)}
                                                        </div>
                                                    </div>
                                                </div>
                                                <div className="row">
                                                    <div className="col-12 col-lg-5">
                                                        <div className="input-group">
                                                            <label>Address Line 1</label>
                                                            <input
                                                                type="text"
                                                                name="address_line1"
                                                                onChange={handleChange}
                                                                onBlur={handleBlur}
                                                                value={values.address_line1}
                                                            />
                                                            {errors.address_line1 && touched.address_line1 && (<span className="form-error">{errors.address_line1}</span>)}
                                                        </div>
                                                    </div>
                                                    <div className="col-12 offset-lg-1 col-lg-5">
                                                        <div className="input-group">
                                                            <label>Address Line 2</label>
                                                            <input
                                                                type="text"
                                                                name="address_line2"
                                                                onChange={handleChange}
                                                                onBlur={handleBlur}
                                                                value={values.address_line2}
                                                            />
                                                            {errors.address_line2 && touched.address_line2 && (<span className="form-error">{errors.address_line2}</span>)}
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div className="row mb-5">
                                                <div className="col-12 col-lg-5">
                                                    <div className="input-group">
                                                        <Button type="submit" className="btn btn-primary btn-submit">
                                                            Send for Approval
                                                        </Button>
                                                    </div>
                                                </div>
                                            </div>
                                        </Form>
                                    )}
                                </Formik>
                            </div>
                        </div>
                    </div>
                    <div className="col-12 col-lg-4">
                        <div className="content-div help-center">
                            <h2>Help Center</h2>
                            <ul className="helplist">
                                <li>
                                    <img src="/images/vendor/question.svg" className="img-fluid" />
                                    <p>Lorem Ipsum Dolor Sit?</p>
                                </li>
                                <li>
                                    <img src="/images/vendor/question.svg" className="img-fluid" />
                                    <p>Lorem Ipsum Dolor Sit?</p>
                                </li>
                                <li>
                                    <img src="/images/vendor/question.svg" className="img-fluid" />
                                    <p>Lorem Ipsum Dolor Sit?</p>
                                </li>
                                <li>
                                    <img src="/images/vendor/question.svg" className="img-fluid" />
                                    <p>Lorem Ipsum Dolor Sit?</p>
                                </li>
                                <li>
                                    <img src="/images/vendor/call.svg" className="img-fluid" />
                                    <p>+1 (407) 8798 789</p>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </Fragment >
    )
}

export default BusinessDetails;