import { Grid } from "../../../../components/grid/Grid";
import { SPACING } from "../../../../data/spacing";
import { NavLink } from "../../../../components/nav-link/NavLink";
import { useLocation } from "react-router-dom";
import {
  ROUTE_PROVINCE_CITY_NEW_REQUESTS,
  ROUTE_PROVINCE_STATEMENTـOFـNEED_REQUESTS,
  ROUTE_PROVINCE_ALLOCATION_REQUESTS,
  ROUTE_PROVINCE_FREE_SALES_REQUESTS,
  ROUTE_PROVINCE_AUTO_ALLOCATION_REQUESTS,
  ROUTE_PROVINCE_ALLOCATED_REQUESTS,
  ROUTE_PROVINCE_PAYING_FEES_REQUESTS,
  ROUTE_PROVINCEـFREE_BUY,
  ROUTE_PROVINCE_ISSUANCE_OF_LETTER,
  ROUTE_PROVINCE_TRANSACTIONS,
  ROUTE_PROVINCE_CHAINS,
  ROUTE_PROVINCEـEXPORT,
  // ROUTE_PROVINCE_ROUTE_AGENT_SHARE,
} from "../../../../routes/routes";
import LinkItem from "../../../../components/link-item/LinkItem";
import { VscFolderActive, VscNewFolder } from "react-icons/vsc";
// import { FaFilePdf } from "react-icons/fa";
import { FaHornbill } from "react-icons/fa";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";

import {
  FaTruckLoading,
  FaFile,
  FaFilePdf,
  FaExchangeAlt,
} from "react-icons/fa";

import {
  MdCreateNewFolder,
  MdImportExport,
  MdOutlineRuleFolder,
} from "react-icons/md";
import { LineWithText } from "../../../../components/line-with-text/LineWithText";
import { OPEN_MODAL } from "../../../../lib/redux/slices/appSlice";
import { useDispatch } from "react-redux";
import PorvinceGetReportOperations from "../province-get-report-operations/PorvinceGetReportOperations";
import {
  Accordion,
  AccordionDetails,
  AccordionSummary,
  Typography,
} from "@mui/material";
// import { IoLogoUsd } from "react-icons/io";

export const ProvinceRequestsOperations = () => {
  const { pathname } = useLocation();
  const dispatch = useDispatch();
  return (
    <Grid
      container
      gap={SPACING.SMALL}
      p={SPACING.SMALL}
      direction={{ xs: "column", md: "row" }}
      justifyContent="center"
      style={{ placeContent: "baseline" }}
    >
      <Grid container direction="column" style={{ width: "100%" }}>
        <Grid>
          <LineWithText text="مدیریت درخواست ها" />
        </Grid>
        <Grid container justifyContent="center" gap={SPACING.SMALL}>
          <NavLink
            to={ROUTE_PROVINCE_CITY_NEW_REQUESTS}
            active={
              pathname === ROUTE_PROVINCE_CITY_NEW_REQUESTS ? "true" : null
            }
          >
            <LinkItem
              icon={<VscNewFolder size={30} color="#244CCC" />}
              title="درخواست های کشتار"
              description="درخواست های کشتار مرغدار در انتظار بررسی"
            />
          </NavLink>
          <NavLink
            to={ROUTE_PROVINCE_STATEMENTـOFـNEED_REQUESTS}
            active={
              pathname === ROUTE_PROVINCE_STATEMENTـOFـNEED_REQUESTS
                ? "true"
                : null
            }
          >
            <LinkItem
              icon={<MdOutlineRuleFolder size={30} color="#244CCC" />}
              title="اعلام نیاز خریداران"
              description="درخواست های کشتار در انتظار بررسی"
            />
          </NavLink>
          {/* <NavLink
        to={ROUTE_PROVINCE_NEW_REQUESTS}
        active={pathname === ROUTE_PROVINCE_NEW_REQUESTS ? "true" : null}
      >
        <LinkItem
          icon={<VscNewFolder size={30} color="#244CCC" />}
          title="در انتظار تایید"
          description="درخواست های در انتظار تایید توسط استان"
        />
      </NavLink> */}

          <NavLink
            to={ROUTE_PROVINCE_ALLOCATION_REQUESTS}
            active={
              pathname === ROUTE_PROVINCE_ALLOCATION_REQUESTS ? "true" : null
            }
          >
            <LinkItem
              icon={<VscFolderActive size={30} color="#244CCC" />}
              title="تخصیصات"
              description="مشاهده و تخصیص درخواست ها"
            />
          </NavLink>
          <NavLink
            to={ROUTE_PROVINCE_PAYING_FEES_REQUESTS}
            active={
              pathname === ROUTE_PROVINCE_PAYING_FEES_REQUESTS ? "true" : null
            }
          >
            <LinkItem
              icon={<FaTruckLoading size={30} color="#244CCC" />}
              title="تعرفه  ها"
            />
          </NavLink>
        </Grid>
      </Grid>

      <Grid container direction="column" style={{ width: "100%" }}>
        <Grid>
          <LineWithText text="ویژه" />
        </Grid>
        <Grid container justifyContent="center" gap={SPACING.SMALL}>
          <NavLink
            to={ROUTE_PROVINCEـFREE_BUY}
            active={pathname === ROUTE_PROVINCEـFREE_BUY ? "true" : null}
          >
            <LinkItem
              icon={<MdCreateNewFolder size={30} color="#244CCC" />}
              title="خرید مستقیم"
            />
          </NavLink>
          <NavLink
            to={ROUTE_PROVINCEـEXPORT}
            active={pathname === ROUTE_PROVINCEـEXPORT ? "true" : null}
          >
            <LinkItem
              icon={<MdImportExport size={30} color="#244CCC" />}
              title="صادرات"
            />
          </NavLink>
          <NavLink
            to={ROUTE_PROVINCE_FREE_SALES_REQUESTS}
            // active={pathname === ROUTE_PROVINCE_ALLOCATION_REQUESTS ? "true" : null}
          >
            <LinkItem
              icon={<VscFolderActive size={30} color="#244CCC" />}
              title="فروش به خارج استان"
            />
          </NavLink>

          <NavLink
            to={ROUTE_PROVINCE_CHAINS}
            active={pathname === ROUTE_PROVINCE_CHAINS ? "true" : null}
          >
            <LinkItem
              icon={<FaHornbill size={30} color="#244CCC" />}
              title="زنجیره ها"
            />
          </NavLink>
          <NavLink
            to={ROUTE_PROVINCE_ALLOCATED_REQUESTS}
            active={
              pathname === ROUTE_PROVINCE_ALLOCATED_REQUESTS ? "true" : null
            }
          >
            <LinkItem
              icon={<VscFolderActive size={30} color="#244CCC" />}
              title="مدیریت تخصیصات"
            />
          </NavLink>
        </Grid>
      </Grid>

      <Grid
        container
        gap={SPACING.SMALL}
        p={SPACING.SMALL}
        direction="column"
        justifyContent="center"
        style={{ width: "100%" }}
      >
        <Accordion style={{ width: "100%" }}>
          <AccordionSummary expandIcon={<ExpandMoreIcon />}>
            <Typography variant="body1" color="error">
              نظارت درخواست ها
            </Typography>
          </AccordionSummary>
          <AccordionDetails>
            <Grid container justifyContent="center" gap={SPACING.SMALL} mb={2}>
              <NavLink
                to={ROUTE_PROVINCE_AUTO_ALLOCATION_REQUESTS}
                active={
                  pathname === ROUTE_PROVINCE_AUTO_ALLOCATION_REQUESTS
                    ? "true"
                    : null
                }
              >
                <LinkItem
                  icon={<VscFolderActive size={30} color="#244CCC" />}
                  title="تخصیصات خودکار"
                />
              </NavLink>
              <NavLink
                to={ROUTE_PROVINCE_ISSUANCE_OF_LETTER}
                active={
                  pathname === ROUTE_PROVINCE_ISSUANCE_OF_LETTER ? "true" : null
                }
              >
                <LinkItem
                  icon={<FaFile color="#244CCC" size={30} />}
                  title="صدور نامه"
                  description="ارسال نامه سیستمی"
                />
              </NavLink>
              <NavLink
                onClick={() =>
                  dispatch(
                    OPEN_MODAL({
                      title: "اطلاعات گزارش",
                      content: <PorvinceGetReportOperations />,
                    })
                  )
                }
              >
                <LinkItem
                  icon={<FaFilePdf color="#244CCC" size={30} />}
                  title="گزارش روزانه"
                  description="گزارش روزانه"
                />
              </NavLink>
              <NavLink
                to={ROUTE_PROVINCE_TRANSACTIONS}
                active={
                  pathname === ROUTE_PROVINCE_TRANSACTIONS ? "true" : null
                }
              >
                <LinkItem
                  icon={<FaExchangeAlt size={30} color="#244CCC" />}
                  title="تراکنش ها"
                />
              </NavLink>
            </Grid>
          </AccordionDetails>
        </Accordion>
      </Grid>
    </Grid>
  );
};
