/* eslint-disable @typescript-eslint/no-explicit-any */
import React from "react";
import TabMenu from "./TabMenu";
import OrderForm from "./OrderForm";
import AddressList from "../../MyProfile/Containers/AddressList";

const AddModal = ({ onHide, onSubmit, setRefreshList, defaultDetails }: any) => {
  const [tab, setTab] = React.useState<number>(1);
  const handleTabChange = (_tab: number) => setTab(_tab || 1);
  const [addressChangeModal, setAddressChangeModal] =
    React.useState<boolean>(false);
  const toggleAddressChange = () => setAddressChangeModal(!addressChangeModal);

  // const onSubmit = (filter:FormData) => onSaveFilter(filter)
  return (
    <>
      {addressChangeModal ? (
        <AddressList toggleAddressChange={toggleAddressChange} />
      ) : (
        <div
          id="order-filter"
          className="menu menu-box-bottom rounded-m order-filter bg-white col-lg-7 menu-active"
          style={{ display: "block" }}
        >
          <div className="menu-title">
            <h1 className="font-24">Bulk Order</h1>
            <a href="#" className="close-menu" onClick={onHide}>
              <i className="fa fa-times-circle" />
            </a>
          </div>
          <div className="signin-box filter-section">
            <div className="card card-style">
              <div className="content filter-content-box" id="tab-group-3">
                <TabMenu handleTabChange={handleTabChange} tab={tab} disabled={true} />
                <div
                  className="divider position-absolute tab-divider start-0 end-0 stepBorderBox"
                  style={{ zIndex: -2, marginTop: "-37px" }}
                />
                <div className="content filter-content draft mx-0 bg-transparent px-0 collapse show">
                  <OrderForm tab={tab} onSubmit={onSubmit} setTab={setTab} onClose={onSubmit} toggleAddressChange={toggleAddressChange} setRefreshList={setRefreshList} defaultDetails={defaultDetails} />
                </div>
              </div>
            </div>
          </div>
        </div>
      )}
    </>
  );
};

export default AddModal;
