import React from "react";
import { SPACING } from "../../../../data/spacing";
import { Grid } from "../../../../components/grid/Grid";
import { NavLink } from "../../../../components/nav-link/NavLink";
import LinkItem from "../../../../components/link-item/LinkItem";
import { BackButton } from "../../../../components/back-button/BackButton";
import { VscBroadcast } from "react-icons/vsc";
import { FaStore } from "react-icons/fa";
import { GiMeat } from "react-icons/gi";
import {
  ROUTE_ADMINX_DISPENSERS_STOCK_KILLHOUSE,
  ROUTE_SUPER_ADMIN_DISPENSERS_STOCK_KILLHOUSE,
  ROUTE_ADMINX_DISPENSERS_STOCK_STEWARD,
  ROUTE_SUPER_ADMIN_DISPENSERS_STOCK_STEWARD,
  ROUTE_ADMINX_DISPENSERS_STOCK_GUILD,
  ROUTE_SUPER_ADMIN_DISPENSERS_STOCK_GUILD,
  ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_STOCK_STEWARD,
  ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_STOCK_GUILD,
  ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_STOCK_KILLHOUSE,
} from "../../../../routes/routes";
import { useLocation } from "react-router-dom";
import { Box } from "@mui/material";
import { getRoleFromUrl } from "../../../../utils/getRoleFromUrl";

const ProvinceDispensersStock = () => {
  const { pathname } = useLocation();

  return (
    <Box display={"flex"} justifyContent="center">
      <Grid
        container
        justifyContent="center"
        gap={SPACING.SMALL}
        p={SPACING.SMALL}
        direction="column"
        xs={12}
        sm={12}
        md={10}
        lg={10}
      >
        <Grid container>
          <BackButton />
        </Grid>

        <Grid
          container
          gap={SPACING.SMALL}
          direction={{ xs: "column", md: "row" }}
          justifyContent="center"
          alignItems="center"
          style={{ placeContent: "baseline" }}
          xs={12}
        >
          <Grid container gap={SPACING.SMALL} justifyContent="center" xs={12}>
            <NavLink
              to={
                getRoleFromUrl() === "AdminX"
                  ? ROUTE_ADMINX_DISPENSERS_STOCK_KILLHOUSE
                  : getRoleFromUrl() === "SuperAdmin"
                  ? ROUTE_SUPER_ADMIN_DISPENSERS_STOCK_KILLHOUSE
                  : ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_STOCK_KILLHOUSE
              }
              active={
                pathname ===
                (getRoleFromUrl() === "AdminX"
                  ? ROUTE_ADMINX_DISPENSERS_STOCK_KILLHOUSE
                  : getRoleFromUrl() === "SuperAdmin"
                  ? ROUTE_SUPER_ADMIN_DISPENSERS_STOCK_KILLHOUSE
                  : ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_STOCK_KILLHOUSE)
                  ? "true"
                  : null
              }
            >
              <LinkItem
                icon={<FaStore size={30} color="#244CCC" />}
                title="کشتارگاه"
                description="کشتارگاه"
              />
            </NavLink>

            <NavLink
              to={
                getRoleFromUrl() === "AdminX"
                  ? ROUTE_ADMINX_DISPENSERS_STOCK_STEWARD
                  : getRoleFromUrl() === "SuperAdmin"
                  ? ROUTE_SUPER_ADMIN_DISPENSERS_STOCK_STEWARD
                  : ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_STOCK_STEWARD
              }
              active={
                pathname ===
                (getRoleFromUrl() === "AdminX"
                  ? ROUTE_ADMINX_DISPENSERS_STOCK_STEWARD
                  : getRoleFromUrl() === "SuperAdmin"
                  ? ROUTE_SUPER_ADMIN_DISPENSERS_STOCK_STEWARD
                  : ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_STOCK_STEWARD)
                  ? "true"
                  : null
              }
            >
              <LinkItem
                icon={<VscBroadcast size={30} color="#244CCC" />}
                title="مباشر"
                description="مباشر"
              />
            </NavLink>

            <NavLink
              to={
                getRoleFromUrl() === "AdminX"
                  ? ROUTE_ADMINX_DISPENSERS_STOCK_GUILD
                  : getRoleFromUrl() === "SuperAdmin"
                  ? ROUTE_SUPER_ADMIN_DISPENSERS_STOCK_GUILD
                  : ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_STOCK_GUILD
              }
              active={
                pathname ===
                (getRoleFromUrl() === "AdminX"
                  ? ROUTE_ADMINX_DISPENSERS_STOCK_GUILD
                  : getRoleFromUrl() === "SuperAdmin"
                  ? ROUTE_SUPER_ADMIN_DISPENSERS_STOCK_GUILD
                  : ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_STOCK_GUILD)
                  ? "true"
                  : null
              }
            >
              <LinkItem
                icon={<GiMeat size={30} color="#244CCC" />}
                title="صنف"
                description="صنف"
              />
            </NavLink>
          </Grid>
        </Grid>
      </Grid>
    </Box>
  );
};

export default ProvinceDispensersStock;
