import * as React from "react";
import { styled } from "@mui/material/styles";
import MuiDrawer from "@mui/material/Drawer";
import List from "@mui/material/List";
import InventoryIcon from "@mui/icons-material/Inventory";
// import Toolbar from "@mui/material/Toolbar";
// import IconButton from "@mui/material/IconButton";
// import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
// import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import FactoryIcon from "@mui/icons-material/Factory";
import WarehouseIcon from "@mui/icons-material/Warehouse";
import EggIcon from "@mui/icons-material/Egg";
import LocalShippingIcon from "@mui/icons-material/LocalShipping";
// import ThumbDownIcon from "@mui/icons-material/ThumbDown";
// import GavelIcon from "@mui/icons-material/Gavel";
import AttachMoneyIcon from "@mui/icons-material/AttachMoney";
import MeetingRoomIcon from "@mui/icons-material/MeetingRoom";
import NoteAltIcon from "@mui/icons-material/NoteAlt";
import PieChart from "@mui/icons-material/PieChart";
import MailOutlineIcon from "@mui/icons-material/MailOutline";
// import EggIcon from '@mui/icons-material/Egg';
import CorporateFareIcon from "@mui/icons-material/CorporateFare";
import { motion } from "framer-motion";
import AccountBoxIcon from "@mui/icons-material/AccountBox";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import SettingsSuggestIcon from "@mui/icons-material/SettingsSuggest";
import SettingsInputCompositeIcon from "@mui/icons-material/SettingsInputComposite";
import FeaturedPlayListIcon from "@mui/icons-material/FeaturedPlayList";
import ExpandLess from "@mui/icons-material/ExpandLess";
import ExpandMore from "@mui/icons-material/ExpandMore";
import ArrowBackIosNewIcon from "@mui/icons-material/ArrowBackIosNew";
import SummarizeIcon from "@mui/icons-material/Summarize";
import AddShoppingCartIcon from "@mui/icons-material/AddShoppingCart";
import AssignmentIcon from "@mui/icons-material/Assignment";
import LocalOfferIcon from "@mui/icons-material/LocalOffer";
import ShoppingCartIcon from "@mui/icons-material/ShoppingCart";
import FlightIcon from "@mui/icons-material/Flight";
import BusinessIcon from "@mui/icons-material/Business";
import LanIcon from "@mui/icons-material/Lan";
import AssignmentTurnedInIcon from "@mui/icons-material/AssignmentTurnedIn";
import AutoFixHighIcon from "@mui/icons-material/AutoFixHigh";
import DraftsIcon from "@mui/icons-material/Drafts";
import CompareArrowsIcon from "@mui/icons-material/CompareArrows";
import AttachFileIcon from "@mui/icons-material/AttachFile";
import PaymentIcon from "@mui/icons-material/Payment";
import AssignmentLateIcon from "@mui/icons-material/AssignmentLate";
import ArchiveIcon from "@mui/icons-material/Archive";
import WarningIcon from "@mui/icons-material/Warning";
import FolderOpenIcon from "@mui/icons-material/FolderOpen";
import ReportIcon from "@mui/icons-material/Report";
import NewReleasesIcon from "@mui/icons-material/NewReleases";
import TaskAltIcon from "@mui/icons-material/TaskAlt";
// import PaymentIcon from "@mui/icons-material/Payment";
import {
  Avatar,
  Button,
  Collapse,
  IconButton,
  ListItemButton,
  ListItemIcon,
  ListItemText,
  Tooltip,
  Typography,
  // ListSubheader,
} from "@mui/material";
// import DashboardIcon from "@mui/icons-material/Dashboard";
// import SupportAgentIcon from "@mui/icons-material/SupportAgent";
import PermPhoneMsgIcon from "@mui/icons-material/PermPhoneMsg";
import EmailIcon from "@mui/icons-material/Email";
import { Grid } from "../../components/grid/Grid";
import LogoutIcon from "@mui/icons-material/Logout";
import DirectionsCarIcon from "@mui/icons-material/DirectionsCar";
import { useLocation, useNavigate } from "react-router-dom";
import {
  ROUTE_CITY_POULTRY_FARMS,
  ROUTE_DRIVER_REQUESTS,
  ROUTE_GENERAL_MESSAGES,
  ROUTE_GENERAL_SUPPORT,
  ROUTE_PROVINCE_PRICING,
  ROUTE_SLAUGHTER_CAR_MANAGEMENT,
  ROUTE_VETFARM_REGISTER_INFO,
  ROUTE_AVICULTURE_ROUTE_HALLS,
  ROUTE_AVICULTURE_TICKET,
  ROUTE_PROVINCE_FINANCIAL_TICKET,
  ROUTE_CITY_TICKET,
  ROUTE_PROVINCE_TICKET,
  ROUTE_PROVINCE_INSPECTOR_TICKET,
  ROUTE_CITY_USER_MANAGEMENT,
  ROUTE_PROVINCE_INSPECTOR_REPORTING,
  ROUTE_ADMIN_STATICS,
  ROUTE_INSPECTOR_STATICS,
  ROUTE_PROVINCE_STATICS,
  ROUTE_CITY_STATICS,
  ROUTE_PROVINCE_FINANCIAL_STATICS,
  ROUTE_PROVINCE_FINANCIAL_DOCUMENT_REGISTRATION,
  ROUTE_CITY_HATCHING,
  ROUTE_PROVINCE_HATCHING,
  ROUTE_JAHAD_KILLS_STATS,
  ROUTE_VETFARM_ROUTE_ALLOCATIONS,
  ROUTE_VETـSUPERVISOR_ALLOCATIONS,
  ROUTE_JAHAD_ILLEGALـKILLING,
  ROUTE_VETـSUPERVISOR_ILLEGALـKILLING,
  ROUTE_PROVINCE_ROUTE_ALLOCATIONS,
  ROUTE_VETـSUPERVISOR_KILLS_STATS,
  ROUTE_PROVINCE_ROUTE_SMS,
  ROUTE_PROVINCE_PRICING3,
  ROUTE_CITY_PRICING,
  ROUTE_AVICULTURE_PRICING,
  ROUTE_SLAUGHTER_PRICING,
  ROUTE_PROVINCE_FINANCIAL_SETTLEMENT,
  ROUTE_PROVINCE_CARS,
  ROUTE_PROVINCE_USERS,
  ROUTE_PROVINCE_ASSIGN_VET_FARM,
  ROUTE_GENERAL_TRAINING,
  ROUTE_PROVINCE_ROUTE_FILES_STATE,
  ROUTE_JAHAD_PRICING,
  ROUTE_JAHAD_FILES_STATE,
  ROUTE_PROVINCE_ROUTE_MANAGE_GUILDS,
  ROUTE_CITY_ROUTE_ALLOCATIONS,
  ROUTE_CITY_ROUTE_FILES_STATE,
  ROUTE_STEWARD_INVENTORY,
  ROUTE_PROVINCE_POULTRIES,
  ROUTE_COMMERCE_ROUTE_MANAGE_GUILDS,
  ROUTE_COMMERCE_ROUTE_FILES_STATE,
  ROUTE_COMMERCE_ROUTE_ALLOCATIONS,
  ROUTE_CITY_COMMERCE_ROUTE_MANAGE_GUILDS,
  ROUTE_CITY_COMMERCE_ROUTE_FILES_STATE,
  ROUTE_CITY_COMMERCE_ROUTE_ALLOCATIONS,
  ROUTE_COMMERCE_STATICS,
  ROUTE_CITY_POULTRIES,
  ROUTE_SLAUGHTER_ROUTE_MANAGE_GUILDS,
  ROUTE_CITYVET_ROUTE_ALLOCATIONS,
  ROUTE_CITY_JIHAD_STATICS,
  ROUTE_CITY_JIHAD_ROUTE_FILES_STATE,
  ROUTE_CITY_JIHAD_ROUTE_ALLOCATIONS,
  ROUTE_CITY_JIHAD_ROUTE_MANAGE_GUILDS,
  ROUTE_PROVINCEـBROADCAST_MANAGEMENT,
  ROUTE_SLAUGHTER_MORGUE,
  ROUTE_OBSERVATORY_STATICS,
  ROUTE_PROVINCE_SUPERVISOR_STATICS,
  ROUTE_PROVINCE_SUPERVISOR_ROUTE_MANAGE_GUILDS,
  ROUTE_PROVINCE_SUPERVISOR_ROUTE_FILES_STATE,
  ROUTE_PROVINCE_SUPERVISOR_ROUTE_ALLOCATIONS,
  ROUTE_STEWARD_MANAGE_GUILDS,
  ROUTE_SENF_INVENTORY,
  ROUTE_COMMERCE_HATCHING,
  ROUTE_PROVINCE_SUPERVISOR_HATCHING,
  ROUTE_SLAUGHTER_ROUTE_MANAGE_BARS,
  ROUTE_PROVINCE_REPORT,
  ROUTE_VETـSUPERVISOR_STATICS,
  ROUTE_VETـSUPERVISOR_ROUTE_FILES_STATE,
  ROUTE_VETـSUPERVISOR_HATCHING,
  ROUTE_VETـSUPERVISOR_REPORTING,
  ROUTE_GUILD_ROOM_ROUTE_MANAGE_GUILDS,
  ROUTE_PSP_COMPANY_ROUTE_MANAGE_STEWARDS,
  ROUTE_PROVINCE_PRODUCTS,
  ROUTE_PROVINCE_GUILD_TRANSACTIONS,
  ROUTE_LIVE_STOCK_SUPPORT_MANAGE_BARS,
  ROUTE_LIVE_STOCK_SUPPORT_ROUTE_FILES_STATE,
  ROUTE_LIVE_STOCK_FREEZING_REQUESTS,
  ROUTE_LIVE_STOCK_COLD_HOUSE,
  ROUTE_SUPER_ADMIN_TICKET,
  ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS,
  ROUTE_SUPER_ADMIN_ROUTE_SMS,
  ROUTE_SUPER_ADMIN_ASSIGN_VET_FARM,
  ROUTE_SUPER_ADMIN_BROADCAST_MANAGEMENT,
  ROUTE_SUPER_ADMIN_PRODUCTS,
  ROUTE_SUPER_ADMIN_SLAUGHTERS,
  ROUTE_SUPER_ADMIN_POULTRIES,
  ROUTE_SUPER_ADMIN_GUILD_TRANSACTIONS,
  ROUTE_SUPER_ADMIN_USERS,
  ROUTE_SUPER_ADMIN_CARS,
  ROUTE_SUPER_ADMIN_ROUTE_MANAGE_GUILDS,
  ROUTE_SUPER_ADMIN_ROUTE_ALLOCATIONS,
  ROUTE_SUPER_ADMIN_ROUTE_FILES_STATE,
  ROUTE_SUPER_ADMIN_REPORT,
  ROUTE_SUPER_ADMIN_STATICS,
  ROUTE_SUPER_ADMIN_PRICING3,
  ROUTE_SUPER_ADMIN_HATCHING,
  ROUTE_PROVINCE_SUPERVISOR_REPORTING,
  ROUTE_CHAIN_COMPANY_POULTRIES,
  ROUTE_CHAIN_COMPANY_MANAGE_BARS,
  ROUTE_CHAIN_COMPANY_MANAGE_FEES,
  ROUTE_PROVINCE_SLAUGHTERS,
  ROUTE_ADMINX_PROVINCE_SWITCH,
  ROUTE_ADMINX_ROUTE_MANAGE_PROCESS,
  ROUTE_SUPPORTER_ROUTE_ALLOCATIONS,
  ROUTE_ADMINX_ROUTE_ALLOCATIONS,
  ROUTE_ADMINX_TICKET,
  ROUTE_ADMINX_ROUTE_SMS,
  ROUTE_ADMINX_ASSIGN_VET_FARM,
  ROUTE_ADMINX_BROADCAST_MANAGEMENT,
  ROUTE_ADMINX_PRODUCTS,
  ROUTE_ADMINX_SLAUGHTERS,
  ROUTE_ADMINX_POULTRIES,
  ROUTE_ADMINX_GUILD_TRANSACTIONS,
  ROUTE_ADMINX_USERS,
  ROUTE_ADMINX_CARS,
  ROUTE_ADMINX_ROUTE_MANAGE_GUILDS,
  ROUTE_ADMINX_ROUTE_FILES_STATE,
  ROUTE_ADMINX_REPORT,
  ROUTE_ADMINX_STATICS,
  ROUTE_ADMINX_PRICING3,
  ROUTE_ADMINX_HATCHING,
  ROUTE_ADMIN_VISOR_STATICS,
  ROUTE_ADMINX_VISOR_STATICS,
  ROUTE_CITY_VISOR_STATICS,
  ROUTE_OBSERVATORY_VISOR_STATICS,
  ROUTE_PROVINCEـVISOR_STATICS,
  ROUTE_SUPER_ADMIN_VISOR_STATICS,
  ROUTE_DISPENSER_DASHBOARD,
  ROUTE_ADMINX_EXCEL_CHECK,
  ROUTE_SLAUGHTER_DISPENSERS,
  ROUTE_ADMINX_DISPENSERS,
  ROUTE_CITY_POULTRY_STATICS,
  ROUTE_CITY_POULTRY_ROUTE_FILES_STATE,
  ROUTE_CITY_POULTRY_ROUTE_ALLOCATIONS,
  ROUTE_CITY_POULTRY_ROUTE_MANAGE_GUILDS,
  ROUTE_CITY_POULTRY_HATCHING,
  ROUTE_GENERAL_USER_PROFILE,
  ROUTE_PROVINCEـHATCHINGS,
  ROUTE_PROVINCE_SUPERVISORـHATCHINGS,
  ROUTE_CITY_POULTRYـHATCHINGS,
  ROUTE_SUPER_ADMINـHATCHINGS,
  ROUTE_ADMINXـHATCHINGS,
  ROUTE_SUPPORTERـHATCHINGS,
  ROUTE_CITYـHATCHINGS,
  ROUTE_PROVINCE_DISPENSERS,
  ROUTE_SUPER_ADMIN_DISPENSERS,
  ROUTE_SLAUGHTER_INVENTORY,
  ROUTE_PROVINCE_CITY_NEW_REQUESTS,
  ROUTE_PROVINCE_STATEMENTـOFـNEED_REQUESTS,
  ROUTE_PROVINCE_ALLOCATION_REQUESTS,
  ROUTE_PROVINCE_PAYING_FEES_REQUESTS,
  ROUTE_PROVINCEـFREE_BUY,
  ROUTE_PROVINCEـEXPORT,
  ROUTE_PROVINCE_FREE_SALES_REQUESTS,
  ROUTE_PROVINCE_CHAINS,
  ROUTE_PROVINCE_ALLOCATED_REQUESTS,
  ROUTE_PROVINCE_AUTO_ALLOCATION_REQUESTS,
  ROUTE_PROVINCE_ISSUANCE_OF_LETTER,
  ROUTE_PROVINCE_TRANSACTIONS,
  ROUTE_ADMINX_TRANSACTIONS,
  ROUTE_ADMINX_ISSUANCE_OF_LETTER,
  ROUTE_ADMINX_AUTO_ALLOCATION_REQUESTS,
  ROUTE_ADMINX_ALLOCATED_REQUESTS,
  ROUTE_ADMINX_CHAINS,
  ROUTE_ADMINX_FREE_SALES_REQUESTS,
  ROUTE_ADMINX_EXPORT,
  ROUTE_ADMINX_PAYING_FEES_REQUESTS,
  ROUTE_ADMINX_ALLOCATION_REQUESTS,
  ROUTE_ADMINX_STATEMENTـOFـNEED_REQUESTS,
  ROUTE_ADMINX_CITY_NEW_REQUESTS,
  ROUTE_SLAUGHTER_NEW_REQUESTS,
  ROUTE_SLAUGHTERـFREE_BUY,
  ROUTE_SLAUGHTERـEXPORT,
  ROUTE_SLAUGHTER_PENDING_REQUESTS,
  ROUTE_SLAUGHTER_ALLOCATION_REQUESTS,
  ROUTE_SLAUGHTER_ALLOCATE_CAR_REQUESTS,
  ROUTE_SLAUGHTER_ENTER_BAR_INFO,
  ROUTE_SLAUGHTER_PAYING_FEES_REQUESTS,
  ROUTE_SLAUGHTER_WALLET,
  ROUTE_SLAUGHTER_FINANCIAL_TRANSACTIONS,
  ROUTE_SLAUGHTER_PAY_FACTORS_REQUESTS,
  ROUTE_AVICULTURE_HATCHING,
  ROUTE_AVICULTURE_SUBMIT_REQUEST,
  ROUTE_AVICULTURE_AWAITING_PAYMENT_REQUESTS,
  ROUTE_AVICULTURE_AWAITING_INSPECTION_REQUESTS,
  ROUTE_AVICULTURE_REJECTED_REQUESTS,
  ROUTE_AVICULTURE_ARCHIVED_REQUESTS,
  ROUTE_AVICULTURE_GIVE_PERMISSION,
  ROUTE_CITY_ARCHIVED_REQUESTS,
  ROUTE_CITY_FREE_SALES_REQUESTS,
  ROUTE_CITY_REJECTED_REQUESTS,
  ROUTE_CITY_AWAITING_INSPECTION_REQUESTS,
  ROUTE_CITY_AWAITING_PAYMENT_REQUESTS,
  ROUTE_CITY_ACTIVE_REQUESTS,
  ROUTE_CITY_NEW_REQUESTS,
  ROUTE_PROVINCE_FINANCIAL_ARCHIVED_REQUESTS,
  ROUTE_PROVINCE_FINANCIAL_AWAITING_INSPECTION_REQUESTS,
  ROUTE_PROVINCE_FINANCIAL_ACTIVE_REQUESTS,
  ROUTE_PROVINCE_FINANCIAL_FINAL_FACTORS_REQUESTS,
  ROUTE_PROVINCE_FINANCIAL_TRANSACTIONS,
  ROUTE_PROVINCE_FINANCIAL_CHECK_PAYED_FACTOR_REQUESTS,
  ROUTE_PROVINCE_FINANCIAL_AWAITING_PAYMENT_REQUESTS,
  ROUTE_PROVINCE_FINANCIAL_PENDING_REQUESTS,
  ROUTE_INSPECTOR_REQUESTS_NEW_REQUESTS,
  ROUTE_PROVINCE_INSPECTOR_AWAITING_PAYMENT_REQUESTS,
  ROUTE_PROVINCE_INSPECTOR_AWAITING_INSPECTION_REQUESTS,
  ROUTE_INSPECTOR_REJECTED_REQUESTS,
  ROUTE_INSPECTOR_ARCHIVED_REQUESTS,
  ROUTE_SLAUGHTER_HOUSE_VET_FREE_BUY_ROUTE,
  ROUTE_SLAUGHTER_HOUSE_VET_NEW_REQUESTS,
  ROUTE_SLAUGHTER_HOUSE_VET_ENTER_BAR_INFO,
  ROUTE_SUPER_ADMIN_TRANSACTIONS,
  ROUTE_SUPER_ADMIN_ISSUANCE_OF_LETTER,
  ROUTE_SUPER_ADMIN_AUTO_ALLOCATION_REQUESTS,
  ROUTE_SUPER_ADMIN_ALLOCATED_REQUESTS,
  ROUTE_SUPER_ADMIN_CHAINS,
  ROUTE_SUPER_ADMIN_FREE_SALES_REQUESTS,
  ROUTE_SUPER_ADMIN_EXPORT,
  ROUTE_SUPER_ADMIN_PAYING_FEES_REQUESTS,
  ROUTE_SUPER_ADMIN_ALLOCATION_REQUESTS,
  ROUTE_SUPER_ADMIN_STATEMENTـOFـNEED_REQUESTS,
  ROUTE_SUPER_ADMIN_CITY_NEW_REQUESTS,
} from "../../routes/routes";
import { useDispatch, useSelector } from "react-redux";
import { LOG_OUT } from "../../lib/redux/slices/userSlice";
import { getFaUserRole } from "../../utils/getFaUserRole";
import { Box } from "@mui/system";
import VaccinesIcon from "@mui/icons-material/Vaccines";
import PersonAddAltIcon from "@mui/icons-material/PersonAddAlt";
import ErrorIcon from "@mui/icons-material/Error";
import CreditScoreIcon from "@mui/icons-material/CreditScore";
import { SPACING } from "../../data/spacing";
import useUserProfile from "../../features/authentication/hooks/useUserProfile";
import { SidebarContext } from "../../contexts/SidebarContext";
import ReceiptLongIcon from "@mui/icons-material/ReceiptLong";
import CoPresentIcon from "@mui/icons-material/CoPresent";
import {
  BACKDROP_HIDE,
  BACKDROP_SHOW,
  CLOSE_MODAL,
  DRAWER,
  OPEN_MODAL,
} from "../../lib/redux/slices/appSlice";
import SupportIcon from "@mui/icons-material/Support";
import { getUserProfile } from "../../features/authentication/services/getUserProfile";
import AccountTreeIcon from "@mui/icons-material/AccountTree";
import LightbulbIcon from "@mui/icons-material/Lightbulb";
import AcUnitIcon from "@mui/icons-material/AcUnit";
import { FaFile } from "react-icons/fa";
import KitchenIcon from "@mui/icons-material/Kitchen";
import { Accordion, AccordionSummary } from "@mui/material";
import { getIconUserRole } from "../../utils/getRoleIcon";
import ToggleOnIcon from "@mui/icons-material/ToggleOn";
import EqualizerIcon from "@mui/icons-material/Equalizer";
import { DocumentScanner } from "@mui/icons-material";
import PorvinceGetReportOperations from "../../features/province/components/province-get-report-operations/PorvinceGetReportOperations";
import FlightTakeoffIcon from "@mui/icons-material/FlightTakeoff";
import PendingActionsIcon from "@mui/icons-material/PendingActions";
import MonetizationOnIcon from "@mui/icons-material/MonetizationOn";
import AccountBalanceWalletIcon from "@mui/icons-material/AccountBalanceWallet";
import SwapHorizontalCircleIcon from "@mui/icons-material/SwapHorizontalCircle";
import ReceiptIcon from "@mui/icons-material/Receipt";
import PaidIcon from "@mui/icons-material/Paid";
import FactCheckIcon from "@mui/icons-material/FactCheck";
import LoopIcon from "@mui/icons-material/Loop";
import { Folder } from "@mui/icons-material";
import { AttachMoney } from "@mui/icons-material";
import { FileCopy } from "@mui/icons-material";
import { Archive } from "@mui/icons-material";
import { Warning } from "@mui/icons-material";
import { AddBox } from "@mui/icons-material";
import PersianDate from "persian-date";

const drawerWidth = 280;

const openedMixin = (theme) => ({
  width: drawerWidth,
  transition: theme.transitions.create("width", {
    easing: theme.transitions.easing.sharp,
    duration: theme.transitions.duration.enteringScreen,
  }),
  overflowX: "hidden",
});

const closedMixin = (theme) => ({
  transition: theme.transitions.create("width", {
    easing: theme.transitions.easing.sharp,
    duration: theme.transitions.duration.leavingScreen,
  }),
  overflowX: "hidden",
  width: `calc(${theme.spacing(7)} + 1px)`,
  [theme.breakpoints.up("sm")]: {
    width: `calc(${theme.spacing(8)} + 1px)`,
  },
});

// export const secondaryListItems = (
//   <React.Fragment>
//     <ListSubheader component="div" inset>
//       Saved reports
//     </ListSubheader>
//     <ListItemButton>
//       <ListItemIcon>
//         <AssignmentIcon />
//       </ListItemIcon>
//       <ListItemText primary="Current month" />
//     </ListItemButton>
//     <ListItemButton>
//       <ListItemIcon>
//         <AssignmentIcon />
//       </ListItemIcon>
//       <ListItemText primary="Last quarter" />
//     </ListItemButton>
//     <ListItemButton>
//       <ListItemIcon>
//         <AssignmentIcon />
//       </ListItemIcon>
//       <ListItemText primary="Year-end sale" />
//     </ListItemButton>
//   </React.Fragment>
// );

const Drawer = styled(MuiDrawer, {
  shouldForwardProp: (prop) => prop !== "open",
})(({ theme, open }) => ({
  width: drawerWidth,
  flexShrink: 0,
  whiteSpace: "nowrap",
  boxSizing: "border-box",
  position: "absolute",
  ...(open && {
    ...openedMixin(theme),
    "& .MuiDrawer-paper": openedMixin(theme),
  }),
  ...(!open && {
    ...closedMixin(theme),
    "& .MuiDrawer-paper": closedMixin(theme),
  }),
}));

export const Sidebar = () => {
  const { pathname } = useLocation();
  const navigate = useNavigate();
  const dispatch = useDispatch();
  const [role, userProfile] = useUserProfile();
  const roles = [...role];
  const { slaughterPermissionState } = useSelector(
    (item) => item.slaughterSlice
  );

  React.useEffect(() => {
    if (Array.isArray(role)) {
      roles.sort();
    }
    dispatch(getUserProfile());
  }, []);

  function stringAvatar(name) {
    if (name) {
      const nameArr = name
        ?.split(" ")
        ?.filter((item) => item)
        ?.map((item) => item[0]);
      return {
        sx: {
          bgcolor: "#353b48",
        },
        children: nameArr[0],
      };
    }
    return {};
  }

  const [open, setOpen] = React.useState(false);
  // const toggleDrawer = () => {
  //   setOpen(!open);
  // };

  const [expandedItems, setExpandedItems] = React.useState([]);

  const handleAccordionChange = (index) => {
    const newExpandedItems = [...expandedItems];
    const currentIndex = newExpandedItems.indexOf(index);
    if (currentIndex === -1) {
      newExpandedItems.push(index);
    } else {
      newExpandedItems.splice(currentIndex, 1);
    }
    setExpandedItems(newExpandedItems);
  };

  React.useEffect(() => {
    const handleDocumentClick = (e) => {
      if (open && !e.target.closest("#sidebar")) {
        closeSidebar();
      }
    };

    document.addEventListener("click", handleDocumentClick);

    return () => {
      document.removeEventListener("click", handleDocumentClick);
    };
  }, [open]);

  const [sidebarMobileState, setSidebarMobileState] =
    React.useContext(SidebarContext);

  const closeSidebar = () => {
    setSidebarMobileState(false);
    setOpen(false);
  };

  React.useEffect(() => {
    setOpen(sidebarMobileState);
  }, [sidebarMobileState]);

  React.useEffect(() => {
    if (open) {
      dispatch(BACKDROP_SHOW());
    } else {
      dispatch(BACKDROP_HIDE());
    }
  }, [open]);

  const [openSub, setOpenSub] = React.useState({
    province: false,
    adminx: false,
    slaughter: false,
    avicuture: false,
    city: false,
    provinceFinancial: false,
    inspector: false,
    slaughterVet: false,
    superAdmin: false,
  });

  const handleRenderDashboardItems = (items) => {
    return (
      <>
        {items.map((item, i) => {
          return (
            <ListItemButton
              fullWidth
              key={i}
              onClick={() => {
                dispatch(
                  DRAWER({ right: false, bottom: false, content: null })
                );
                navigate(item?.route);
                closeSidebar();
              }}
              selected={pathname.includes(item?.route)}
            >
              <ListItemIcon>
                {item?.icon ? item.icon : <ArrowBackIosNewIcon />}
              </ListItemIcon>
              <ListItemText primary={item.text} />
            </ListItemButton>
          );
        })}
      </>
    );
  };

  // const [currentTime, setCurrentTime] = React.useState(new Date());

  // useEffect(() => {
  //   const intervalId = setInterval(() => {
  //     setCurrentTime(new Date());
  //   }, 1000);

  //   return () => clearInterval(intervalId);
  // }, []);
  const generalItems = (
    <>
      {/* <Tooltip title={open ? "" : "پیام های شما"} placement="left-start">
        <ListItemButton
          selected={pathname.includes("massages")}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_GENERAL_MESSAGES);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <EmailIcon />
          </ListItemIcon>
          <ListItemText primary="پیام های شما" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "آموزش"} placement="left-start">
        <ListItemButton
          selected={pathname.includes("training")}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_GENERAL_TRAINING);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SchoolIcon />
          </ListItemIcon>
          <ListItemText primary="اموزش" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "پشتیبانی"} placement="left-start">
        <ListItemButton
          selected={pathname === ROUTE_GENERAL_SUPPORT}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_GENERAL_SUPPORT);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SupportAgentIcon />
          </ListItemIcon>
          <ListItemText primary="پشتیبانی" />
        </ListItemButton>
      </Tooltip> */}

      <Tooltip title={open ? "" : "خروج"} placement="left-start">
        <ListItemButton
          onClick={() => {
            closeSidebar();
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            dispatch(
              OPEN_MODAL({
                title: "از سامانه خارج میشوید؟",
                content: (
                  <Grid container gap={SPACING.SMALL}>
                    <Button
                      color="error"
                      variant="contained"
                      onClick={() => {
                        dispatch(BACKDROP_HIDE());
                        closeSidebar();
                        dispatch(CLOSE_MODAL());
                        dispatch(LOG_OUT());
                        // window.location = "https://rasadyaar.ir/?exit=1";
                      }}
                    >
                      بله
                    </Button>
                    <Button
                      variant="outlined"
                      onClick={() => {
                        dispatch(CLOSE_MODAL());
                      }}
                    >
                      خیر
                    </Button>
                  </Grid>
                ),
              })
            );
          }}
        >
          <ListItemIcon>
            <LogoutIcon color="primary" />
          </ListItemIcon>
          <ListItemText color="primary" primary="خروج" />
        </ListItemButton>
      </Tooltip>
    </>
  );

  const dispenserItems = (
    <>
      <Tooltip title={open ? "" : "پنل مدیریت"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_DISPENSER_DASHBOARD)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_DISPENSER_DASHBOARD);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SettingsSuggestIcon />
          </ListItemIcon>
          <ListItemText primary="پنل مدیریت" />
        </ListItemButton>
      </Tooltip>
    </>
  );

  const vetFarmItems = (
    <>
      <Tooltip title={open ? "" : "کدرهگیری قرنطینه"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_VETFARM_ROUTE_ALLOCATIONS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_VETFARM_ROUTE_ALLOCATIONS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SettingsSuggestIcon />
          </ListItemIcon>
          <ListItemText primary="کدرهگیری قرنطینه" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت فارم"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_VETFARM_REGISTER_INFO)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_VETFARM_REGISTER_INFO);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <VaccinesIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت فارم" />
        </ListItemButton>
      </Tooltip>
      {/* <Tooltip title={open ? "" : "مدیریت کشتار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_VETFARM_ROUTE_HATCHING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_VETFARM_ROUTE_HATCHING)}
        >
          <ListItemIcon>
            <EggIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت کشتار" />
        </ListItemButton>
      </Tooltip> */}
    </>
  );

  const inspectorItems = (
    <>
      <ListItemButton
        onClick={() => {
          setOpenSub((prevState) => ({
            ...prevState,
            inspector: !prevState.inspector,
          }));
        }}
      >
        <ListItemIcon>
          <SettingsSuggestIcon />
        </ListItemIcon>
        <ListItemText primary="پنل مدیریت" />
        {openSub.inspector ? <ExpandLess /> : <ExpandMore />}
      </ListItemButton>
      <Collapse
        fullWidth
        in={openSub.inspector}
        timeout="auto"
        unmountOnExit
        style={{
          width: "100%",
          // borderStyle: "solid",
          // borderWidth: "2px",
          //
          boxShadow: "inset 0 0 5px gray",
        }}
      >
        <List component="div" disablePadding>
          {handleRenderDashboardItems([
            {
              route: ROUTE_INSPECTOR_REQUESTS_NEW_REQUESTS,
              icon: <Folder />,
              text: "درخواست های جدید",
            },
            {
              route: ROUTE_PROVINCE_INSPECTOR_AWAITING_PAYMENT_REQUESTS,
              icon: <AttachMoney />,
              text: "در انتظار پرداخت",
            },
            {
              route: ROUTE_PROVINCE_INSPECTOR_AWAITING_INSPECTION_REQUESTS,
              icon: <FileCopy />,
              text: "در انتظار بازرسی",
            },
            {
              route: ROUTE_INSPECTOR_REJECTED_REQUESTS,
              icon: <Warning />,
              text: "درخواست های رد شده",
            },
            {
              route: ROUTE_INSPECTOR_ARCHIVED_REQUESTS,
              icon: <Archive />,
              text: "بایگانی",
            },
          ])}
        </List>
      </Collapse>

      {/* <Tooltip title={open ? "" : "قیمت روز"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_INSPECTOR_PRICING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_INSPECTOR_PRICING)}
        >
          <ListItemIcon>
            <AttachMoneyIcon />
          </ListItemIcon>
          <ListItemText primary="قیمت روز" />
        </ListItemButton>
      </Tooltip> */}
      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_INSPECTOR_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_INSPECTOR_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "گزارشات"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_INSPECTOR_REPORTING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_INSPECTOR_REPORTING)}
        >
          <ListItemIcon>
            <NoteAltIcon />
          </ListItemIcon>
          <ListItemText primary="گزارشات" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "تیکت ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_INSPECTOR_TICKET);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_INSPECTOR_TICKET)}
        >
          <ListItemIcon>
            <SupportIcon />
          </ListItemIcon>
          <ListItemText primary="تیکت ها" />
        </ListItemButton>
      </Tooltip>
      {/* <Tooltip title={open ? "" : "سامانه بازرسی"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            window.open(
              `https://seeyo.ir/autologin/${userInfo.authToken}/${userInfo.userProfile.province}`,
              "_blank"
            );
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LoginIcon />
          </ListItemIcon>
          <ListItemText primary="سامانه بازرسی" />
        </ListItemButton>
      </Tooltip> */}
    </>
  );

  const cityItems = (
    <React.Fragment>
      <ListItemButton
        onClick={() => {
          setOpenSub((prevState) => ({
            ...prevState,
            city: !prevState.city,
          }));
        }}
      >
        <ListItemIcon>
          <SettingsSuggestIcon />
        </ListItemIcon>
        <ListItemText primary="پنل مدیریت" />
        {openSub.city ? <ExpandLess /> : <ExpandMore />}
      </ListItemButton>
      <Collapse
        fullWidth
        in={openSub.city}
        timeout="auto"
        unmountOnExit
        style={{
          width: "100%",
          // borderStyle: "solid",
          // borderWidth: "2px",
          //
          boxShadow: "inset 0 0 5px gray",
        }}
      >
        <List component="div" disablePadding>
          {handleRenderDashboardItems([
            {
              route: ROUTE_CITY_NEW_REQUESTS,
              icon: <NewReleasesIcon />,
              text: "درخواست های جدید",
            },
            {
              route: ROUTE_CITY_ACTIVE_REQUESTS,
              icon: <TaskAltIcon />,
              text: "درخواست های فعال",
            },
            {
              route: ROUTE_CITY_AWAITING_PAYMENT_REQUESTS,
              icon: <PaymentIcon />,
              text: "در انتظار پرداخت",
            },
            {
              route: ROUTE_CITY_AWAITING_INSPECTION_REQUESTS,
              icon: <ReportIcon />,
              text: "در انتظار بازرسی",
            },
            {
              route: ROUTE_CITY_REJECTED_REQUESTS,
              icon: <ReportIcon />,
              text: "درخواست های رد شده",
            },
            {
              route: ROUTE_CITY_FREE_SALES_REQUESTS,
              icon: <FolderOpenIcon />,
              text: "فروش خارج از استان",
            },
            {
              route: ROUTE_CITY_ARCHIVED_REQUESTS,
              icon: <ArchiveIcon />,
              text: "بایگانی",
            },
          ])}
        </List>
      </Collapse>

      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_VISOR_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_CITY_VISOR_STATICS)}
        >
          <ListItemIcon>
            <EqualizerIcon />
          </ListItemIcon>
          <ListItemText primary="تحلیل داده" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت کشتار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_HATCHING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_CITY_HATCHING)}
        >
          <ListItemIcon>
            <EggIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت کشتار" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_CITY_ROUTE_FILES_STATE)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_ROUTE_FILES_STATE);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="پرونده های کشتار" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت جوجه ریزی"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_CITYـHATCHINGS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITYـHATCHINGS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SettingsInputCompositeIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت جوجه ریزی" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت بارها"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_CITY_ROUTE_ALLOCATIONS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_ROUTE_ALLOCATIONS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LocalShippingIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت بارها" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "قیمت روز"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_PRICING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_CITY_PRICING)}
        >
          <ListItemIcon>
            <AttachMoneyIcon />
          </ListItemIcon>
          <ListItemText primary="قیمت روز" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت فارم ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_POULTRIES);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_CITY_POULTRIES)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت فارم ها" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مرغداران زیر مجموعه"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_POULTRY_FARMS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_CITY_POULTRY_FARMS)}
        >
          <ListItemIcon>
            <WarehouseIcon />
          </ListItemIcon>
          <ListItemText primary="مرغداران" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_CITY_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "کاربران"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_USER_MANAGEMENT);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_CITY_USER_MANAGEMENT)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="کاربران" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "تیکت ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_TICKET);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_CITY_TICKET)}
        >
          <ListItemIcon>
            <SupportIcon />
          </ListItemIcon>
          <ListItemText primary="تیکت ها" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const avicultureItems = (
    <React.Fragment>
      <ListItemButton
        onClick={() => {
          setOpenSub((prevState) => ({
            ...prevState,
            avicuture: !prevState.avicuture,
          }));
        }}
      >
        <ListItemIcon>
          <SettingsSuggestIcon />
        </ListItemIcon>
        <ListItemText primary="پنل مدیریت" />
        {openSub.avicuture ? <ExpandLess /> : <ExpandMore />}
      </ListItemButton>
      <Collapse
        fullWidth
        in={openSub.avicuture}
        timeout="auto"
        unmountOnExit
        style={{
          width: "100%",
          // borderStyle: "solid",
          // borderWidth: "2px",
          //
          boxShadow: "inset 0 0 5px gray",
        }}
      >
        <List component="div" disablePadding>
          {handleRenderDashboardItems([
            {
              route: ROUTE_AVICULTURE_HATCHING,
              icon: <EggIcon />,
              text: "جوجه ریزی",
            },
            {
              route: ROUTE_AVICULTURE_SUBMIT_REQUEST,
              icon: <AttachFileIcon />,
              text: "درخواست های کشتار",
            },
            {
              route: ROUTE_AVICULTURE_AWAITING_PAYMENT_REQUESTS,
              icon: <PaymentIcon />,
              text: "در انتظار پرداخت",
            },
            {
              route: ROUTE_AVICULTURE_AWAITING_INSPECTION_REQUESTS,
              icon: <AssignmentLateIcon />,
              text: "در انتظار بازرسی",
            },
            {
              route: ROUTE_AVICULTURE_REJECTED_REQUESTS,
              icon: <WarningIcon />,
              text: "درخواست های رد شده",
            },
            {
              route: ROUTE_AVICULTURE_ARCHIVED_REQUESTS,
              icon: <ArchiveIcon />,
              text: "بایگانی",
            },
            {
              route: ROUTE_AVICULTURE_GIVE_PERMISSION,
              icon: <ArchiveIcon />,
              text: "وکالت",
            },
          ])}
        </List>
      </Collapse>

      <Tooltip title={open ? "" : "قیمت روز"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_AVICULTURE_PRICING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_AVICULTURE_PRICING)}
        >
          <ListItemIcon>
            <AttachMoneyIcon />
          </ListItemIcon>
          <ListItemText primary="قیمت روز " />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "سالن ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_AVICULTURE_ROUTE_HALLS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_AVICULTURE_ROUTE_HALLS)}
        >
          <ListItemIcon>
            <MeetingRoomIcon />
          </ListItemIcon>
          <ListItemText primary="سالن ها" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "تیکت ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_AVICULTURE_TICKET);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_AVICULTURE_TICKET)}
        >
          <ListItemIcon>
            <SupportIcon />
          </ListItemIcon>
          <ListItemText primary="تیکت ها" />
        </ListItemButton>
      </Tooltip>

      {/* <Tooltip title={open ? "" : "گزارش مرغدار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_AVICULTURE_REPORTS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_AVICULTURE_REPORTS)}
        >
          <ListItemIcon>
            <NoteAltIcon />
          </ListItemIcon>
          <ListItemText primary="گزارش مرغدار" />
        </ListItemButton>
      </Tooltip> */}

      {/* <Tooltip title={open ? "" : "مزایده"} placement="left-start">
        <ListItemButton
          onClick={() => {
            navigate(ROUTE_AVICULTURE_AUCTION);
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_AVICULTURE_AUCTION)}
        >
          <ListItemIcon>
            <GavelIcon />
          </ListItemIcon>
          <ListItemText primary="مزایده" />
        </ListItemButton>
      </Tooltip> */}
    </React.Fragment>
  );

  const provinceItems = (
    <React.Fragment>
      <ListItemButton
        onClick={() => {
          setOpenSub((prevState) => ({
            ...prevState,
            province: !prevState.province,
          }));
        }}
      >
        <ListItemIcon>
          <SettingsSuggestIcon />
        </ListItemIcon>
        <ListItemText primary="پنل مدیریت" />
        {openSub.province ? <ExpandLess /> : <ExpandMore />}
      </ListItemButton>
      <Collapse
        fullWidth
        in={openSub.province}
        timeout="auto"
        unmountOnExit
        style={{
          width: "100%",
          // borderStyle: "solid",
          // borderWidth: "2px",
          //
          boxShadow: "inset 0 0 5px gray",
        }}
      >
        <List component="div" disablePadding>
          {handleRenderDashboardItems([
            {
              text: "مدیریت درخواست ها",
              route: ROUTE_PROVINCE_CITY_NEW_REQUESTS,
              icon: <FeaturedPlayListIcon />,
            },
            {
              text: "اعلام نیاز خریداران",
              route: ROUTE_PROVINCE_STATEMENTـOFـNEED_REQUESTS,
              icon: <AddShoppingCartIcon />,
            },
            {
              text: "تخصیصات",
              route: ROUTE_PROVINCE_ALLOCATION_REQUESTS,
              icon: <AssignmentIcon />,
            },
            {
              text: "تعرفه ها",
              route: ROUTE_PROVINCE_PAYING_FEES_REQUESTS,
              icon: <LocalOfferIcon />,
            },
            {
              text: "خرید مستقیم",
              route: ROUTE_PROVINCEـFREE_BUY,
              icon: <ShoppingCartIcon />,
            },
            {
              text: "صادرات",
              route: ROUTE_PROVINCEـEXPORT,
              icon: <FlightIcon />,
            },
            {
              text: "فروش به خارج استان",
              route: ROUTE_PROVINCE_FREE_SALES_REQUESTS,
              icon: <BusinessIcon />,
            },
            {
              text: "زنجیره ها",
              route: ROUTE_PROVINCE_CHAINS,
              icon: <LanIcon />,
            },
            {
              text: "مدیریت تخصیصات",
              route: ROUTE_PROVINCE_ALLOCATED_REQUESTS,
              icon: <AssignmentTurnedInIcon />,
            },
            {
              text: "تخصیصات خودکار",
              route: ROUTE_PROVINCE_AUTO_ALLOCATION_REQUESTS,
              icon: <AutoFixHighIcon />,
            },
            {
              text: "صدور نامه",
              route: ROUTE_PROVINCE_ISSUANCE_OF_LETTER,
              icon: <DraftsIcon />,
            },
            {
              text: "تراکنش ها",
              route: ROUTE_PROVINCE_TRANSACTIONS,
              icon: <CompareArrowsIcon />,
            },
          ])}
        </List>
      </Collapse>

      <ListItemButton
        fullWidth
        onClick={() =>
          dispatch(
            OPEN_MODAL({
              title: "اطلاعات گزارش",
              content: <PorvinceGetReportOperations />,
            })
          )
        }
      >
        <ListItemIcon>
          <SummarizeIcon />
        </ListItemIcon>
        <ListItemText primary={"گزارش روزانه"} />
      </ListItemButton>

      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCEـVISOR_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCEـVISOR_STATICS)}
        >
          <ListItemIcon>
            <EqualizerIcon />
          </ListItemIcon>
          <ListItemText primary="تحلیل داده" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت کشتار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_HATCHING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_HATCHING)}
        >
          <ListItemIcon>
            <EggIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت کشتار" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت جوجه ریزی"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_PROVINCEـHATCHINGS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCEـHATCHINGS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SettingsInputCompositeIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت جوجه ریزی" />
        </ListItemButton>
      </Tooltip>

      {/* <SidebarMenuItem sidebarState={open} /> */}

      <Tooltip title={open ? "" : "قیمت روز"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_PRICING3);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_PRICING3)}
        >
          <ListItemIcon>
            <AttachMoneyIcon />
          </ListItemIcon>
          <ListItemText primary="قیمت روز" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "گزارشات"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_REPORT);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_REPORT)}
        >
          <ListItemIcon>
            <FaFile size={22} />
          </ListItemIcon>
          <ListItemText primary="گزارشات" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_PROVINCE_ROUTE_FILES_STATE)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_ROUTE_FILES_STATE);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="پرونده های کشتار" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت بارها"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_PROVINCE_ROUTE_ALLOCATIONS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_ROUTE_ALLOCATIONS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LocalShippingIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت بارها" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت توزیع"} placement="left-start">
        <ListItemButton
          // disabled
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_DISPENSERS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_DISPENSERS)}
        >
          <ListItemIcon>
            <CoPresentIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت توزیع" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت اصناف"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_PROVINCE_ROUTE_MANAGE_GUILDS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_ROUTE_MANAGE_GUILDS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <CorporateFareIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت اصناف" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "خودروها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_CARS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_CARS)}
        >
          <ListItemIcon>
            <DirectionsCarIcon />
          </ListItemIcon>
          <ListItemText primary="خودروها" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "کاربران"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_USERS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_USERS)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="کاربران" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت تراکنش ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_GUILD_TRANSACTIONS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_GUILD_TRANSACTIONS)}
        >
          <ListItemIcon>
            <ReceiptLongIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت تراکنش ها" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت فارم ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_POULTRIES);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_POULTRIES)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت فارم ها" />
        </ListItemButton>
      </Tooltip>
      {/* <Tooltip title={open ? "" : "مدیریت کاربران"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_MANAGE_USERS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_MANAGE_USERS)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت کاربران" />
        </ListItemButton>
      </Tooltip> */}
      <Tooltip title={open ? "" : "خریداران"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_SLAUGHTERS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_SLAUGHTERS)}
        >
          <ListItemIcon>
            <FactoryIcon />
          </ListItemIcon>
          <ListItemText primary="خریداران" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "محصولات"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_PRODUCTS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_PRODUCTS)}
        >
          <ListItemIcon>
            <InventoryIcon />
          </ListItemIcon>
          <ListItemText primary="محصولات" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "دامپزشکان"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCEـBROADCAST_MANAGEMENT);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCEـBROADCAST_MANAGEMENT)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت پخش" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "دامپزشکان"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_ASSIGN_VET_FARM);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_ASSIGN_VET_FARM)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="دامپزشکان" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "پیامک"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_ROUTE_SMS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_ROUTE_SMS)}
        >
          <ListItemIcon>
            <MailOutlineIcon />
          </ListItemIcon>
          <ListItemText primary="پنل اطلاع رسانی" />
        </ListItemButton>
      </Tooltip>
      {/* <Tooltip title={open ? "" : "ارسال پیام"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_SEND_MESSAGE);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_SEND_MESSAGE)}
        >
          <ListItemIcon>
            <MessageIcon />
          </ListItemIcon>
          <ListItemText primary="ارسال پیام" />
        </ListItemButton>
      </Tooltip> */}
      {/* 
      <Tooltip title={open ? "" : "کشتارکن ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_KILLER_MANAGMENT);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_KILLER_MANAGMENT)}
        >
          <ListItemIcon>
            <ManageAccountsIcon />
          </ListItemIcon>
          <ListItemText primary="کشتارکن ها" />
        </ListItemButton>
      </Tooltip> */}

      {/* <Tooltip title={open ? "" : "مدیریت فرآیند"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_PROVINCE_ROUTE_MANAGE_PROCESS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_ROUTE_MANAGE_PROCESS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت فرآیند" />
        </ListItemButton>
      </Tooltip> */}

      {/* <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_PROVINCE_ROUTE_CASE_STATUS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_ROUTE_CASE_STATUS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="پرونده های کشتار" />
        </ListItemButton>
      </Tooltip> */}
      {/* 
      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip> */}

      <Tooltip title={open ? "" : "تیکت ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_TICKET);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_TICKET)}
        >
          <ListItemIcon>
            <SupportIcon />
          </ListItemIcon>
          <ListItemText primary="تیکت ها" />
        </ListItemButton>
      </Tooltip>

      {/* <Tooltip title={open ? "" : "سامانه بازرسی"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            window.open(
              `https://seeyo.ir/autologin/${userInfo.authToken}/${userInfo.userProfile.province}`,
              "_blank"
            );
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LoginIcon />
          </ListItemIcon>
          <ListItemText primary="سامانه بازرسی" />
        </ListItemButton>
      </Tooltip> */}
    </React.Fragment>
  );

  const superAdminItems = (
    <React.Fragment>
      <ListItemButton
        onClick={() => {
          setOpenSub((prevState) => ({
            ...prevState,
            superAdmin: !prevState.superAdmin,
          }));
        }}
      >
        <ListItemIcon>
          <SettingsSuggestIcon />
        </ListItemIcon>
        <ListItemText primary="پنل مدیریت" />
        {openSub.superAdmin ? <ExpandLess /> : <ExpandMore />}
      </ListItemButton>
      <Collapse
        fullWidth
        in={openSub.superAdmin}
        timeout="auto"
        unmountOnExit
        style={{
          width: "100%",
          // borderStyle: "solid",
          // borderWidth: "2px",
          //
          boxShadow: "inset 0 0 5px gray",
        }}
      >
        <List component="div" disablePadding>
          {handleRenderDashboardItems([
            {
              text: "مدیریت درخواست ها",
              route: ROUTE_SUPER_ADMIN_CITY_NEW_REQUESTS,
              icon: <FeaturedPlayListIcon />,
            },
            {
              text: "اعلام نیاز خریداران",
              route: ROUTE_SUPER_ADMIN_STATEMENTـOFـNEED_REQUESTS,
              icon: <AddShoppingCartIcon />,
            },
            {
              text: "تخصیصات",
              route: ROUTE_SUPER_ADMIN_ALLOCATION_REQUESTS,
              icon: <AssignmentIcon />,
            },
            {
              text: "تعرفه ها",
              route: ROUTE_SUPER_ADMIN_PAYING_FEES_REQUESTS,
              icon: <LocalOfferIcon />,
            },
            {
              text: "خرید مستقیم",
              route: ROUTE_PROVINCEـFREE_BUY,
              icon: <ShoppingCartIcon />,
            },
            {
              text: "صادرات",
              route: ROUTE_SUPER_ADMIN_EXPORT,
              icon: <FlightIcon />,
            },
            {
              text: "فروش به خارج استان",
              route: ROUTE_SUPER_ADMIN_FREE_SALES_REQUESTS,
              icon: <BusinessIcon />,
            },
            {
              text: "زنجیره ها",
              route: ROUTE_SUPER_ADMIN_CHAINS,
              icon: <LanIcon />,
            },
            {
              text: "مدیریت تخصیصات",
              route: ROUTE_SUPER_ADMIN_ALLOCATED_REQUESTS,
              icon: <AssignmentTurnedInIcon />,
            },
            {
              text: "تخصیصات خودکار",
              route: ROUTE_SUPER_ADMIN_AUTO_ALLOCATION_REQUESTS,
              icon: <AutoFixHighIcon />,
            },
            {
              text: "صدور نامه",
              route: ROUTE_SUPER_ADMIN_ISSUANCE_OF_LETTER,
              icon: <DraftsIcon />,
            },
            {
              text: "تراکنش ها",
              route: ROUTE_SUPER_ADMIN_TRANSACTIONS,
              icon: <CompareArrowsIcon />,
            },
          ])}
        </List>
      </Collapse>

      <ListItemButton
        fullWidth
        onClick={() =>
          dispatch(
            OPEN_MODAL({
              title: "اطلاعات گزارش",
              content: <PorvinceGetReportOperations />,
            })
          )
        }
      >
        <ListItemIcon>
          <SummarizeIcon />
        </ListItemIcon>
        <ListItemText primary={"گزارش روزانه"} />
      </ListItemButton>

      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_VISOR_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_VISOR_STATICS)}
        >
          <ListItemIcon>
            <EqualizerIcon />
          </ListItemIcon>
          <ListItemText primary="تحلیل داده" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت کشتار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_HATCHING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_HATCHING)}
        >
          <ListItemIcon>
            <EggIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت کشتار" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت جوجه ریزی"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_SUPER_ADMINـHATCHINGS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMINـHATCHINGS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SettingsInputCompositeIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت جوجه ریزی" />
        </ListItemButton>
      </Tooltip>

      {/* <SidebarMenuItem sidebarState={open} /> */}

      <Tooltip title={open ? "" : "قیمت روز"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_PRICING3);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_PRICING3)}
        >
          <ListItemIcon>
            <AttachMoneyIcon />
          </ListItemIcon>
          <ListItemText primary="قیمت روز" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "گزارشات"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_REPORT);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_REPORT)}
        >
          <ListItemIcon>
            <FaFile size={22} />
          </ListItemIcon>
          <ListItemText primary="گزارشات" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_SUPER_ADMIN_ROUTE_FILES_STATE)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_ROUTE_FILES_STATE);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="پرونده های کشتار" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت بارها"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_SUPER_ADMIN_ROUTE_ALLOCATIONS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_ROUTE_ALLOCATIONS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LocalShippingIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت بارها" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت توزیع"} placement="left-start">
        <ListItemButton
          // disabled
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_DISPENSERS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_DISPENSERS)}
        >
          <ListItemIcon>
            <CoPresentIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت توزیع" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت اصناف"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_SUPER_ADMIN_ROUTE_MANAGE_GUILDS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_ROUTE_MANAGE_GUILDS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <CorporateFareIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت اصناف" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "خودروها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_CARS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_CARS)}
        >
          <ListItemIcon>
            <DirectionsCarIcon />
          </ListItemIcon>
          <ListItemText primary="خودروها" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "کاربران"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_USERS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_USERS)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="کاربران" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت تراکنش ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_GUILD_TRANSACTIONS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_GUILD_TRANSACTIONS)}
        >
          <ListItemIcon>
            <ReceiptLongIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت تراکنش ها" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت فارم ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_POULTRIES);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_POULTRIES)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت فارم ها" />
        </ListItemButton>
      </Tooltip>
      {/* <Tooltip title={open ? "" : "مدیریت کاربران"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_MANAGE_USERS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_MANAGE_USERS)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت کاربران" />
        </ListItemButton>
      </Tooltip> */}
      <Tooltip title={open ? "" : "خریداران"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_SLAUGHTERS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_SLAUGHTERS)}
        >
          <ListItemIcon>
            <FactoryIcon />
          </ListItemIcon>
          <ListItemText primary="خریداران" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "محصولات"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_PRODUCTS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_PRODUCTS)}
        >
          <ListItemIcon>
            <InventoryIcon />
          </ListItemIcon>
          <ListItemText primary="محصولات" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "دامپزشکان"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_BROADCAST_MANAGEMENT);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_BROADCAST_MANAGEMENT)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت پخش" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "دامپزشکان"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_ASSIGN_VET_FARM);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_ASSIGN_VET_FARM)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="دامپزشکان" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "پیامک"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_ROUTE_SMS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_ROUTE_SMS)}
        >
          <ListItemIcon>
            <MailOutlineIcon />
          </ListItemIcon>
          <ListItemText primary="پنل اطلاع رسانی" />
        </ListItemButton>
      </Tooltip>
      {/* <Tooltip title={open ? "" : "ارسال پیام"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_SEND_MESSAGE);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_SEND_MESSAGE)}
        >
          <ListItemIcon>
            <MessageIcon />
          </ListItemIcon>
          <ListItemText primary="ارسال پیام" />
        </ListItemButton>
      </Tooltip> */}
      {/* 
      <Tooltip title={open ? "" : "کشتارکن ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_KILLER_MANAGMENT);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_KILLER_MANAGMENT)}
        >
          <ListItemIcon>
            <ManageAccountsIcon />
          </ListItemIcon>
          <ListItemText primary="کشتارکن ها" />
        </ListItemButton>
      </Tooltip> */}

      <Tooltip title={open ? "" : "مدیریت فرآیند"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت فرآیند" />
        </ListItemButton>
      </Tooltip>

      {/* <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_SUPER_ADMIN_ROUTE_CASE_STATUS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_ROUTE_CASE_STATUS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="پرونده های کشتار" />
        </ListItemButton>
      </Tooltip> */}
      {/* 
      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip> */}

      <Tooltip title={open ? "" : "تیکت ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPER_ADMIN_TICKET);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SUPER_ADMIN_TICKET)}
        >
          <ListItemIcon>
            <SupportIcon />
          </ListItemIcon>
          <ListItemText primary="تیکت ها" />
        </ListItemButton>
      </Tooltip>

      {/* <Tooltip title={open ? "" : "سامانه بازرسی"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            window.open(
              `https://seeyo.ir/autologin/${userInfo.authToken}/${userInfo.userProfile.province}`,
              "_blank"
            );
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LoginIcon />
          </ListItemIcon>
          <ListItemText primary="سامانه بازرسی" />
        </ListItemButton>
      </Tooltip> */}
    </React.Fragment>
  );

  const vetSupervisorItems = (
    <React.Fragment>
      <Tooltip title={open ? "" : "مدیریت جوجه ریزی"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_VETـSUPERVISOR_HATCHING)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_VETـSUPERVISOR_HATCHING);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SettingsInputCompositeIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت جوجه ریزی" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_VETـSUPERVISOR_ROUTE_FILES_STATE)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_VETـSUPERVISOR_ROUTE_FILES_STATE);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="پرونده های کشتار" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_VETـSUPERVISOR_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_VETـSUPERVISOR_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "کدرهگیری قرنطینه"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_VETـSUPERVISOR_ALLOCATIONS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_VETـSUPERVISOR_ALLOCATIONS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SettingsSuggestIcon />
          </ListItemIcon>
          <ListItemText primary="کدرهگیری قرنطینه" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "کشتار غیرمجاز"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_VETـSUPERVISOR_ILLEGALـKILLING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_VETـSUPERVISOR_ILLEGALـKILLING)}
        >
          <ListItemIcon>
            <ErrorIcon />
          </ListItemIcon>
          <ListItemText primary="کشتار غیرمجاز" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "آمار کشتار استان"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_VETـSUPERVISOR_KILLS_STATS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_VETـSUPERVISOR_KILLS_STATS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار کشتار استان" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "گزارشات"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_VETـSUPERVISOR_REPORTING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_VETـSUPERVISOR_REPORTING)}
        >
          <ListItemIcon>
            <NoteAltIcon />
          </ListItemIcon>
          <ListItemText primary="گزارشات" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const slaughterHouseItems = (
    <React.Fragment>
      <ListItemButton
        onClick={() => {
          setOpenSub((prevState) => ({
            ...prevState,
            slaughter: !prevState.slaughter,
          }));
        }}
      >
        <ListItemIcon>
          <SettingsSuggestIcon />
        </ListItemIcon>
        <ListItemText primary="پنل مدیریت" />
        {openSub.slaughter ? <ExpandLess /> : <ExpandMore />}
      </ListItemButton>
      <Collapse
        fullWidth
        in={openSub.slaughter}
        timeout="auto"
        unmountOnExit
        style={{
          width: "100%",
          // borderStyle: "solid",
          // borderWidth: "2px",
          //
          boxShadow: "inset 0 0 5px gray",
        }}
      >
        <List component="div" disablePadding>
          {handleRenderDashboardItems([
            {
              text: "ثبت درخواست",
              route: ROUTE_SLAUGHTER_NEW_REQUESTS,
              icon: <FeaturedPlayListIcon />,
            },
            {
              text: "خرید مستقیم",
              route: ROUTE_SLAUGHTERـFREE_BUY,
              icon: <ShoppingCartIcon />,
            },
            {
              text: "صادرات",
              route: ROUTE_SLAUGHTERـEXPORT,
              icon: <FlightTakeoffIcon />,
            },
            {
              text: "سفارش های دریافت شده",
              route: ROUTE_SLAUGHTER_PENDING_REQUESTS,
              icon: <PendingActionsIcon />,
            },
            {
              text: "تخصیصات",
              route: ROUTE_SLAUGHTER_ALLOCATION_REQUESTS,
              icon: <AssignmentTurnedInIcon />,
            },
            {
              text: "تخصیص خودرو",
              route: ROUTE_SLAUGHTER_ALLOCATE_CAR_REQUESTS,
              icon: <LocalShippingIcon />,
            },
            {
              text: "وارد کردن اطلاعات بار",
              route: ROUTE_SLAUGHTER_ENTER_BAR_INFO,
              icon: <LocalShippingIcon />,
            },
            // {
            //   text: "انبار و توزیع",
            //   route: ROUTE_SLAUGHTER_INVENTORY,
            //   icon: <InventoryIcon />,
            // },
            {
              text: "مدیریت تعرفه ها",
              route: ROUTE_SLAUGHTER_PAYING_FEES_REQUESTS,
              icon: <MonetizationOnIcon />,
            },
            {
              text: "کیف پول",
              route: ROUTE_SLAUGHTER_WALLET,
              icon: <AccountBalanceWalletIcon />,
            },
            {
              text: "مدیریت تراکنش ها",
              route: ROUTE_SLAUGHTER_FINANCIAL_TRANSACTIONS,
              icon: <SwapHorizontalCircleIcon />,
            },
            {
              text: "مدیریت فاکتورها",
              route: ROUTE_SLAUGHTER_PAY_FACTORS_REQUESTS,
              icon: <ReceiptIcon />,
            },
          ])}
        </List>
      </Collapse>

      <Tooltip title={open ? "" : "مدیریت بارها"} placement="left-start">
        <ListItemButton
          disabled={!slaughterPermissionState}
          selected={pathname.includes(ROUTE_SLAUGHTER_ROUTE_MANAGE_BARS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SLAUGHTER_ROUTE_MANAGE_BARS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <CorporateFareIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت بارها" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت اصناف"} placement="left-start">
        <ListItemButton
          disabled={!slaughterPermissionState}
          selected={pathname.includes(ROUTE_SLAUGHTER_ROUTE_MANAGE_GUILDS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SLAUGHTER_ROUTE_MANAGE_GUILDS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <CorporateFareIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت اصناف" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "قیمت روز "} placement="left-start">
        <ListItemButton
          disabled={!slaughterPermissionState}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SLAUGHTER_PRICING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SLAUGHTER_PRICING)}
        >
          <ListItemIcon>
            <AttachMoneyIcon />
          </ListItemIcon>
          <ListItemText primary="قیمت روز " />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "خودروها"} placement="left-start">
        <ListItemButton
          disabled={!slaughterPermissionState}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SLAUGHTER_CAR_MANAGEMENT);
            closeSidebar();
          }}
          selected={pathname.includes("cars")}
        >
          <ListItemIcon>
            <DirectionsCarIcon />
          </ListItemIcon>
          <ListItemText primary="خودروها" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت توزیع"} placement="left-start">
        <ListItemButton
          disabled
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SLAUGHTER_DISPENSERS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SLAUGHTER_DISPENSERS)}
        >
          <ListItemIcon>
            <CoPresentIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت توزیع" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "انبار و توزیع"} placement="left-start">
        <ListItemButton
          disabled={!slaughterPermissionState}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SLAUGHTER_INVENTORY);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SLAUGHTER_INVENTORY)}
        >
          <ListItemIcon>
            <WarehouseIcon />
          </ListItemIcon>
          <ListItemText primary="انبار و توزیع" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "سردخانه"} placement="left-start">
        <ListItemButton
          disabled={!slaughterPermissionState}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SLAUGHTER_MORGUE);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SLAUGHTER_MORGUE)}
        >
          <ListItemIcon>
            <AcUnitIcon />
          </ListItemIcon>
          <ListItemText primary="سردخانه" />
        </ListItemButton>
      </Tooltip>

      {/* <Tooltip title={open ? "" : "تیکت ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SLAUGHTER_TICKET);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SLAUGHTER_TICKET)}
        >
          <ListItemIcon>
            <SupportIcon />
          </ListItemIcon>
          <ListItemText primary="تیکت ها" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "افت نامتعارف"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SLAUGHTER_COMPLAINTS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SLAUGHTER_COMPLAINTS)}
        >
          <ListItemIcon>
            <ThumbDownIcon />
          </ListItemIcon>
          <ListItemText primary="افت نامتعارف" />
        </ListItemButton>
      </Tooltip>*/}

      {/* <Tooltip title={open ? "" : "سهم مباشرین"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SLAUGHTER_AGENT_SHARE);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SLAUGHTER_AGENT_SHARE)}
        >
          <ListItemIcon>
            <PaymentIcon />
          </ListItemIcon>
          <ListItemText primary="سهم مباشرین" />
        </ListItemButton>
      </Tooltip> */}

      {/* <Tooltip title={open ? "" : "مزایده"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SLAUGHTER_AUCTION);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SLAUGHTER_AUCTION)}
        >
          <ListItemIcon>
            <GavelIcon />
          </ListItemIcon>
          <ListItemText primary="مزایده" />
        </ListItemButton>
      </Tooltip> */}
    </React.Fragment>
  );

  const cityJihadItems = (
    <>
      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_JIHAD_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_CITY_JIHAD_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_CITY_JIHAD_ROUTE_FILES_STATE)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_JIHAD_ROUTE_FILES_STATE);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="پرونده های کشتار" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت بارها"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_CITY_JIHAD_ROUTE_ALLOCATIONS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_JIHAD_ROUTE_ALLOCATIONS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LocalShippingIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت بارها" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت اصناف"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_CITY_JIHAD_ROUTE_MANAGE_GUILDS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_JIHAD_ROUTE_MANAGE_GUILDS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <CorporateFareIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت اصناف" />
        </ListItemButton>
      </Tooltip>
    </>
  );

  const cityPoultryItems = (
    <>
      <Tooltip title={open ? "" : "مدیریت کشتار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_POULTRY_HATCHING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_CITY_POULTRY_HATCHING)}
        >
          <ListItemIcon>
            <EggIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت کشتار" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_POULTRY_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_CITY_POULTRY_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_CITY_POULTRY_ROUTE_FILES_STATE)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_POULTRY_ROUTE_FILES_STATE);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="پرونده های کشتار" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت جوجه ریزی"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_CITY_POULTRYـHATCHINGS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_POULTRYـHATCHINGS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SettingsInputCompositeIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت جوجه ریزی" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت بارها"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_CITY_POULTRY_ROUTE_ALLOCATIONS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_POULTRY_ROUTE_ALLOCATIONS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LocalShippingIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت بارها" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت اصناف"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_CITY_POULTRY_ROUTE_MANAGE_GUILDS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_POULTRY_ROUTE_MANAGE_GUILDS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <CorporateFareIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت اصناف" />
        </ListItemButton>
      </Tooltip>
    </>
  );

  const slaughterHouseVetItems = (
    <>
      <ListItemButton
        onClick={() => {
          setOpenSub((prevState) => ({
            ...prevState,
            slaughterVet: !prevState.slaughterVet,
          }));
        }}
      >
        <ListItemIcon>
          <SettingsSuggestIcon />
        </ListItemIcon>
        <ListItemText primary="پنل مدیریت" />
        {openSub.slaughterVet ? <ExpandLess /> : <ExpandMore />}
      </ListItemButton>
      <Collapse
        fullWidth
        in={openSub.slaughterVet}
        timeout="auto"
        unmountOnExit
        style={{
          width: "100%",
          // borderStyle: "solid",
          // borderWidth: "2px",
          //
          boxShadow: "inset 0 0 5px gray",
        }}
      >
        <List component="div" disablePadding>
          {handleRenderDashboardItems([
            {
              route: ROUTE_SLAUGHTER_HOUSE_VET_FREE_BUY_ROUTE,
              icon: <Folder />,
              text: "بارهای خارج استان",
            },
            {
              route: ROUTE_SLAUGHTER_HOUSE_VET_NEW_REQUESTS,
              icon: <AddBox />,
              text: "بارهای جدید",
            },
            {
              route: ROUTE_SLAUGHTER_HOUSE_VET_ENTER_BAR_INFO,
              icon: <AddBox />,
              text: "وارد کردن اطلاعات بار",
            },
          ])}
        </List>
      </Collapse>
    </>
  );

  const driverItems = (
    <React.Fragment>
      <Tooltip title={open ? "" : "پنل مدیریت"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_DRIVER_REQUESTS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_DRIVER_REQUESTS)}
        >
          <ListItemIcon>
            <SettingsSuggestIcon />
          </ListItemIcon>
          <ListItemText primary="پنل مدیریت" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const provinceFinancialItems = (
    <React.Fragment>
      <ListItemButton
        onClick={() => {
          setOpenSub((prevState) => ({
            ...prevState,
            provinceFinancial: !prevState.provinceFinancial,
          }));
        }}
      >
        <ListItemIcon>
          <SettingsSuggestIcon />
        </ListItemIcon>
        <ListItemText primary="پنل مدیریت" />
        {openSub.provinceFinancial ? <ExpandLess /> : <ExpandMore />}
      </ListItemButton>
      <Collapse
        fullWidth
        in={openSub.provinceFinancial}
        timeout="auto"
        unmountOnExit
        style={{
          width: "100%",
          // borderStyle: "solid",
          // borderWidth: "2px",
          //
          boxShadow: "inset 0 0 5px gray",
        }}
      >
        <List component="div" disablePadding>
          {handleRenderDashboardItems([
            {
              route: ROUTE_PROVINCE_FINANCIAL_PENDING_REQUESTS,
              icon: <PendingActionsIcon />,
              text: "صدور فاکتور",
            },
            {
              route: ROUTE_PROVINCE_FINANCIAL_AWAITING_PAYMENT_REQUESTS,
              icon: <AttachMoneyIcon />,
              text: "در انتظار پرداخت",
            },
            {
              route: ROUTE_PROVINCE_FINANCIAL_CHECK_PAYED_FACTOR_REQUESTS,
              icon: <PaidIcon />,
              text: "فاکتورهای پرداخت شده",
            },
            {
              route: ROUTE_PROVINCE_FINANCIAL_TRANSACTIONS,
              icon: <LoopIcon />,
              text: "تراکنش ها",
            },
            {
              route: ROUTE_PROVINCE_FINANCIAL_FINAL_FACTORS_REQUESTS,
              icon: <FactCheckIcon />,
              text: "اسناد مالی",
            },
            {
              route: ROUTE_PROVINCE_FINANCIAL_ACTIVE_REQUESTS,
              icon: <FolderOpenIcon />,
              text: "درخواست های فعال",
            },
            {
              route: ROUTE_PROVINCE_FINANCIAL_AWAITING_INSPECTION_REQUESTS,
              icon: <PendingActionsIcon />,
              text: "در انتظار بازرسی",
            },
            {
              route: ROUTE_PROVINCE_FINANCIAL_ARCHIVED_REQUESTS,
              icon: <ArchiveIcon />,
              text: "بایگانی",
            },
          ])}
        </List>
      </Collapse>

      <Tooltip title={open ? "" : "تسویه با کشتارگاه"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_FINANCIAL_SETTLEMENT);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_FINANCIAL_SETTLEMENT)}
        >
          <ListItemIcon>
            <CreditScoreIcon />
          </ListItemIcon>
          <ListItemText primary="تسویه حساب" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "قیمت گذاری"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_PRICING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_PRICING)}
        >
          <ListItemIcon>
            <AttachMoneyIcon />
          </ListItemIcon>
          <ListItemText primary="قیمت گذاری" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_FINANCIAL_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_FINANCIAL_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "تیکت ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_FINANCIAL_TICKET);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_FINANCIAL_TICKET)}
        >
          <ListItemIcon>
            <SupportIcon />
          </ListItemIcon>
          <ListItemText primary="تیکت ها" />
        </ListItemButton>
      </Tooltip>

      {/* <Tooltip title={open ? "" : "شکایات"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_FINANCIAL_COMPLAINTS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_FINANCIAL_COMPLAINTS)}
        >
          <ListItemIcon>
            <ThumbDownIcon />
          </ListItemIcon>
          <ListItemText primary="شکایات" />
        </ListItemButton>
      </Tooltip> */}

      {/* <Tooltip title={open ? "" : "ثبت بدهی"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_FINANCIAL_ROUTE_DEBT);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_FINANCIAL_ROUTE_DEBT)}
        >
          <ListItemIcon>
            <EggIcon />
          </ListItemIcon>
          <ListItemText primary="بدهی مرغداران" />
        </ListItemButton>
      </Tooltip> */}

      <Tooltip title={open ? "" : "ثبت سند مالی"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_FINANCIAL_DOCUMENT_REGISTRATION);
            closeSidebar();
          }}
          selected={pathname.includes(
            ROUTE_PROVINCE_FINANCIAL_DOCUMENT_REGISTRATION
          )}
        >
          <ListItemIcon>
            <AttachMoneyIcon />
          </ListItemIcon>
          <ListItemText primary="ثبت سند مالی" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const adminItems = (
    <React.Fragment>
      {/* <Tooltip title={open ? "" : "پنل مدیریت"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMIN_REQUESTS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMIN_REQUESTS)}
        >
          <ListItemIcon>
            <SettingsSuggestIcon />
          </ListItemIcon>
          <ListItemText primary="پنل مدیریت" />
        </ListItemButton>
      </Tooltip> */}

      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMIN_VISOR_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMIN_VISOR_STATICS)}
        >
          <ListItemIcon>
            <EqualizerIcon />
          </ListItemIcon>
          <ListItemText primary="تحلیل داده" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMIN_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMIN_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const jahadItems = (
    <React.Fragment>
      <Tooltip title={open ? "" : "آمار کشتار استان"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_JAHAD_KILLS_STATS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_JAHAD_KILLS_STATS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار کشتار استان" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "کشتار غیرمجاز"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_JAHAD_ILLEGALـKILLING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_JAHAD_ILLEGALـKILLING)}
        >
          <ListItemIcon>
            <ErrorIcon />
          </ListItemIcon>
          <ListItemText primary="کشتار غیرمجاز" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "قیمت روز"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_JAHAD_PRICING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_JAHAD_PRICING)}
        >
          <ListItemIcon>
            <AttachMoneyIcon />
          </ListItemIcon>
          <ListItemText primary="قیمت روز" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_JAHAD_FILES_STATE)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_JAHAD_FILES_STATE);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="پرونده های کشتار" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const guildItems = (
    <React.Fragment>
      <Tooltip title={open ? "" : "انبار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_STEWARD_INVENTORY);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_STEWARD_INVENTORY)}
        >
          <ListItemIcon>
            <WarehouseIcon />
          </ListItemIcon>
          <ListItemText primary="انبار" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت اصناف"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_STEWARD_MANAGE_GUILDS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_STEWARD_MANAGE_GUILDS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <CorporateFareIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت اصناف" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const senfItems = (
    <React.Fragment>
      <Tooltip title={open ? "" : "انبار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SENF_INVENTORY);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_SENF_INVENTORY)}
        >
          <ListItemIcon>
            <WarehouseIcon />
          </ListItemIcon>
          <ListItemText primary="انبار" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const commerceItems = (
    <React.Fragment>
      <ListItemButton
        fullWidth
        onClick={() =>
          dispatch(
            OPEN_MODAL({
              title: "اطلاعات گزارش",
              content: <PorvinceGetReportOperations />,
            })
          )
        }
      >
        <ListItemIcon>
          <SummarizeIcon />
        </ListItemIcon>
        <ListItemText primary={"گزارش روزانه"} />
      </ListItemButton>

      <Tooltip title={open ? "" : "پروفایل آماری"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_COMMERCE_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_COMMERCE_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت اصناف"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_COMMERCE_ROUTE_MANAGE_GUILDS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_COMMERCE_ROUTE_MANAGE_GUILDS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <CorporateFareIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت اصناف" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_COMMERCE_ROUTE_FILES_STATE)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_COMMERCE_ROUTE_FILES_STATE);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="پرونده های کشتار" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت بارها"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_COMMERCE_ROUTE_ALLOCATIONS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_COMMERCE_ROUTE_ALLOCATIONS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LocalShippingIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت بارها" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت جوجه ریزی"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_COMMERCE_HATCHING)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_COMMERCE_HATCHING);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SettingsInputCompositeIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت جوجه ریزی" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );
  const ProvinceSupervisorItems = (
    <React.Fragment>
      <ListItemButton
        fullWidth
        onClick={() =>
          dispatch(
            OPEN_MODAL({
              title: "اطلاعات گزارش",
              content: <PorvinceGetReportOperations />,
            })
          )
        }
      >
        <ListItemIcon>
          <SummarizeIcon />
        </ListItemIcon>
        <ListItemText primary={"گزارش روزانه"} />
      </ListItemButton>
      <Tooltip title={open ? "" : "پروفایل آماری"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_SUPERVISOR_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_SUPERVISOR_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(
            ROUTE_PROVINCE_SUPERVISOR_ROUTE_FILES_STATE
          )}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_SUPERVISOR_ROUTE_FILES_STATE);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="پرونده های کشتار" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت جوجه ریزی"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_PROVINCE_SUPERVISORـHATCHINGS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_SUPERVISORـHATCHINGS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SettingsInputCompositeIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت جوجه ریزی" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت بارها"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(
            ROUTE_PROVINCE_SUPERVISOR_ROUTE_ALLOCATIONS
          )}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_SUPERVISOR_ROUTE_ALLOCATIONS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LocalShippingIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت بارها" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت جوجه ریزی"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_PROVINCE_SUPERVISOR_HATCHING)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_SUPERVISOR_HATCHING);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SettingsInputCompositeIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت جوجه ریزی" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت اصناف"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(
            ROUTE_PROVINCE_SUPERVISOR_ROUTE_MANAGE_GUILDS
          )}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_SUPERVISOR_ROUTE_MANAGE_GUILDS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <CorporateFareIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت اصناف" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "گزارشات"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PROVINCE_SUPERVISOR_REPORTING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PROVINCE_SUPERVISOR_REPORTING)}
        >
          <ListItemIcon>
            <FaFile size={22} />
          </ListItemIcon>
          <ListItemText primary="گزارشات" />
        </ListItemButton>
      </Tooltip>

      {/* <Tooltip title={open ? "" : "سامانه بازرسی"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            window.open(
              `https://seeyo.ir/autologin/${userInfo.authToken}/${userInfo.userProfile.province}`,
              "_blank"
            );
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LoginIcon />
          </ListItemIcon>
          <ListItemText primary="سامانه بازرسی" />
        </ListItemButton>
      </Tooltip> */}
      {/* <Tooltip title={open ? "" : "گزارشات"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_VETـSUPERVISOR_REPORTING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_VETـSUPERVISOR_REPORTING)}
        >
          <ListItemIcon>
            <NoteAltIcon />
          </ListItemIcon>
          <ListItemText primary="گزارشات" />
        </ListItemButton>
      </Tooltip> */}
    </React.Fragment>
  );

  const cityCommerceItems = (
    <React.Fragment>
      <Tooltip title={open ? "" : "مدیریت اصناف"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_CITY_COMMERCE_ROUTE_MANAGE_GUILDS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_COMMERCE_ROUTE_MANAGE_GUILDS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <CorporateFareIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت اصناف" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_CITY_COMMERCE_ROUTE_FILES_STATE)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_COMMERCE_ROUTE_FILES_STATE);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="پرونده های کشتار" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت بارها"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_CITY_COMMERCE_ROUTE_ALLOCATIONS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITY_COMMERCE_ROUTE_ALLOCATIONS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LocalShippingIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت بارها" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const liveStockItems = (
    <React.Fragment>
      <Tooltip title={open ? "" : "مدیریت بارها"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_LIVE_STOCK_SUPPORT_MANAGE_BARS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_LIVE_STOCK_SUPPORT_MANAGE_BARS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LocalShippingIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت بارها" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(
            ROUTE_LIVE_STOCK_SUPPORT_ROUTE_FILES_STATE
          )}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_LIVE_STOCK_SUPPORT_ROUTE_FILES_STATE);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="پرونده های کشتار" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "درخواست های انجماد"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_LIVE_STOCK_FREEZING_REQUESTS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_LIVE_STOCK_FREEZING_REQUESTS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <KitchenIcon />
          </ListItemIcon>
          <ListItemText primary="درخواست های انجماد" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "سردخانه"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_LIVE_STOCK_COLD_HOUSE)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_LIVE_STOCK_COLD_HOUSE);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AcUnitIcon />
          </ListItemIcon>
          <ListItemText primary="سردخانه" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const cityVetItems = (
    <React.Fragment>
      <Tooltip title={open ? "" : "مدیریت بارها"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_CITYVET_ROUTE_ALLOCATIONS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CITYVET_ROUTE_ALLOCATIONS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LocalShippingIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت بارها" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const observatoryItems = (
    <React.Fragment>
      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_OBSERVATORY_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_OBSERVATORY_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_OBSERVATORY_VISOR_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_OBSERVATORY_VISOR_STATICS)}
        >
          <ListItemIcon>
            <EqualizerIcon />
          </ListItemIcon>
          <ListItemText primary="تحلیل داده" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const guildRoomItems = (
    <React.Fragment>
      <Tooltip title={open ? "" : "اتاق اصناف"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_GUILD_ROOM_ROUTE_MANAGE_GUILDS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_GUILD_ROOM_ROUTE_MANAGE_GUILDS)}
        >
          <ListItemIcon>
            <CorporateFareIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت اصناف" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const pspCompanyItems = (
    <React.Fragment>
      <Tooltip title={open ? "" : "اتاق اصناف"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_PSP_COMPANY_ROUTE_MANAGE_STEWARDS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_PSP_COMPANY_ROUTE_MANAGE_STEWARDS)}
        >
          <ListItemIcon>
            <CorporateFareIcon />
          </ListItemIcon>
          <ListItemText primary="صنوف" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const chainCompanyItems = (
    <React.Fragment>
      <Tooltip title={open ? "" : "مرغداران زیرمجموعه"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CHAIN_COMPANY_POULTRIES);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_CHAIN_COMPANY_POULTRIES)}
        >
          <ListItemIcon>
            <WarehouseIcon />
          </ListItemIcon>
          <ListItemText primary="مرغداران زیرمجموعه" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت بارها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CHAIN_COMPANY_MANAGE_BARS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_CHAIN_COMPANY_MANAGE_BARS)}
        >
          <ListItemIcon>
            <LocalShippingIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت بارها" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت تعرفه"} placement="left-start">
        <ListItemButton
          disabled
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_CHAIN_COMPANY_MANAGE_FEES);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_CHAIN_COMPANY_MANAGE_FEES)}
        >
          <ListItemIcon>
            <AttachMoneyIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت تعرفه" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const adminXItems = (
    <React.Fragment>
      <ListItemButton
        onClick={() => {
          setOpenSub((prevState) => ({
            ...prevState,
            adminx: !prevState.adminx,
          }));
        }}
      >
        <ListItemIcon>
          <SettingsSuggestIcon />
        </ListItemIcon>
        <ListItemText primary="پنل مدیریت" />
        {openSub.adminx ? <ExpandLess /> : <ExpandMore />}
      </ListItemButton>
      <Collapse
        fullWidth
        in={openSub.adminx}
        timeout="auto"
        unmountOnExit
        style={{
          width: "100%",
          // borderStyle: "solid",
          // borderWidth: "2px",
          //
          boxShadow: "inset 0 0 5px gray",
        }}
      >
        <List component="div" disablePadding>
          {handleRenderDashboardItems([
            {
              text: "مدیریت درخواست ها",
              route: ROUTE_ADMINX_CITY_NEW_REQUESTS,
              icon: <FeaturedPlayListIcon />,
            },
            {
              text: "اعلام نیاز خریداران",
              route: ROUTE_ADMINX_STATEMENTـOFـNEED_REQUESTS,
              icon: <AddShoppingCartIcon />,
            },
            {
              text: "تخصیصات",
              route: ROUTE_ADMINX_ALLOCATION_REQUESTS,
              icon: <AssignmentIcon />,
            },
            {
              text: "تعرفه ها",
              route: ROUTE_ADMINX_PAYING_FEES_REQUESTS,
              icon: <LocalOfferIcon />,
            },
            {
              text: "خرید مستقیم",
              route: ROUTE_PROVINCEـFREE_BUY,
              icon: <ShoppingCartIcon />,
            },
            {
              text: "صادرات",
              route: ROUTE_ADMINX_EXPORT,
              icon: <FlightIcon />,
            },
            {
              text: "فروش به خارج استان",
              route: ROUTE_ADMINX_FREE_SALES_REQUESTS,
              icon: <BusinessIcon />,
            },
            {
              text: "زنجیره ها",
              route: ROUTE_ADMINX_CHAINS,
              icon: <LanIcon />,
            },
            {
              text: "مدیریت تخصیصات",
              route: ROUTE_ADMINX_ALLOCATED_REQUESTS,
              icon: <AssignmentTurnedInIcon />,
            },
            {
              text: "تخصیصات خودکار",
              route: ROUTE_ADMINX_AUTO_ALLOCATION_REQUESTS,
              icon: <AutoFixHighIcon />,
            },
            {
              text: "صدور نامه",
              route: ROUTE_ADMINX_ISSUANCE_OF_LETTER,
              icon: <DraftsIcon />,
            },
            {
              text: "تراکنش ها",
              route: ROUTE_ADMINX_TRANSACTIONS,
              icon: <CompareArrowsIcon />,
            },
          ])}
        </List>
      </Collapse>

      <Tooltip title={open ? "" : "انتخاب استان"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_PROVINCE_SWITCH);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_PROVINCE_SWITCH)}
        >
          <ListItemIcon>
            <ToggleOnIcon />
          </ListItemIcon>
          <ListItemText primary="انتخاب استان" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_VISOR_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_VISOR_STATICS)}
        >
          <ListItemIcon>
            <EqualizerIcon />
          </ListItemIcon>
          <ListItemText primary="تحلیل داده" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت کشتار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_HATCHING);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_HATCHING)}
        >
          <ListItemIcon>
            <EggIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت کشتار" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت جوجه ریزی"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_ADMINXـHATCHINGS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINXـHATCHINGS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SettingsInputCompositeIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت جوجه ریزی" />
        </ListItemButton>
      </Tooltip>

      {/* <SidebarMenuItem sidebarState={open} /> */}

      <Tooltip title={open ? "" : "قیمت روز"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_PRICING3);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_PRICING3)}
        >
          <ListItemIcon>
            <AttachMoneyIcon />
          </ListItemIcon>
          <ListItemText primary="قیمت روز" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "آمار"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_STATICS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_STATICS)}
        >
          <ListItemIcon>
            <PieChart />
          </ListItemIcon>
          <ListItemText primary="آمار و اطلاعات" />
        </ListItemButton>
      </Tooltip>

      <ListItemButton
        fullWidth
        onClick={() =>
          dispatch(
            OPEN_MODAL({
              title: "اطلاعات گزارش",
              content: <PorvinceGetReportOperations />,
            })
          )
        }
      >
        <ListItemIcon>
          <SummarizeIcon />
        </ListItemIcon>
        <ListItemText primary={"گزارش روزانه"} />
      </ListItemButton>

      <Tooltip title={open ? "" : "گزارشات"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_REPORT);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_REPORT)}
        >
          <ListItemIcon>
            <FaFile size={22} />
          </ListItemIcon>
          <ListItemText primary="گزارشات" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_ADMINX_ROUTE_FILES_STATE)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_ROUTE_FILES_STATE);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="پرونده های کشتار" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت بارها"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_ADMINX_ROUTE_ALLOCATIONS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_ROUTE_ALLOCATIONS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LocalShippingIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت بارها" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت توزیع"} placement="left-start">
        <ListItemButton
          // disabled
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_DISPENSERS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_DISPENSERS)}
        >
          <ListItemIcon>
            <CoPresentIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت توزیع" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "مدیریت اصناف"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_ADMINX_ROUTE_MANAGE_GUILDS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_ROUTE_MANAGE_GUILDS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <CorporateFareIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت اصناف" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "خودروها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_CARS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_CARS)}
        >
          <ListItemIcon>
            <DirectionsCarIcon />
          </ListItemIcon>
          <ListItemText primary="خودروها" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "کاربران"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_USERS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_USERS)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="کاربران" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت تراکنش ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_GUILD_TRANSACTIONS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_GUILD_TRANSACTIONS)}
        >
          <ListItemIcon>
            <ReceiptLongIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت تراکنش ها" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت فارم ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_POULTRIES);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_POULTRIES)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت فارم ها" />
        </ListItemButton>
      </Tooltip>
      {/* <Tooltip title={open ? "" : "مدیریت کاربران"} placement="left-start">
            <ListItemButton
              onClick={() => {
                dispatch(DRAWER({ right: false, bottom: false, content: null }));
                navigate(ROUTE_ADMINX_MANAGE_USERS);
                closeSidebar();
              }}
              selected={pathname.includes(ROUTE_ADMINX_MANAGE_USERS)}
            >
              <ListItemIcon>
                <PersonAddAltIcon />
              </ListItemIcon>
              <ListItemText primary="مدیریت کاربران" />
            </ListItemButton>
          </Tooltip> */}
      <Tooltip title={open ? "" : "خریداران"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_SLAUGHTERS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_SLAUGHTERS)}
        >
          <ListItemIcon>
            <FactoryIcon />
          </ListItemIcon>
          <ListItemText primary="خریداران" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "محصولات"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_PRODUCTS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_PRODUCTS)}
        >
          <ListItemIcon>
            <InventoryIcon />
          </ListItemIcon>
          <ListItemText primary="محصولات" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "دامپزشکان"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_BROADCAST_MANAGEMENT);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_BROADCAST_MANAGEMENT)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت پخش" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "دامپزشکان"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_ASSIGN_VET_FARM);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_ASSIGN_VET_FARM)}
        >
          <ListItemIcon>
            <PersonAddAltIcon />
          </ListItemIcon>
          <ListItemText primary="دامپزشکان" />
        </ListItemButton>
      </Tooltip>

      <Tooltip title={open ? "" : "پیامک"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_ROUTE_SMS);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_ROUTE_SMS)}
        >
          <ListItemIcon>
            <MailOutlineIcon />
          </ListItemIcon>
          <ListItemText primary="پنل اطلاع رسانی" />
        </ListItemButton>
      </Tooltip>
      {/* <Tooltip title={open ? "" : "ارسال پیام"} placement="left-start">
            <ListItemButton
              onClick={() => {
                dispatch(DRAWER({ right: false, bottom: false, content: null }));
                navigate(ROUTE_ADMINX_SEND_MESSAGE);
                closeSidebar();
              }}
              selected={pathname.includes(ROUTE_ADMINX_SEND_MESSAGE)}
            >
              <ListItemIcon>
                <MessageIcon />
              </ListItemIcon>
              <ListItemText primary="ارسال پیام" />
            </ListItemButton>
          </Tooltip> */}
      {/* 
          <Tooltip title={open ? "" : "کشتارکن ها"} placement="left-start">
            <ListItemButton
              onClick={() => {
                dispatch(DRAWER({ right: false, bottom: false, content: null }));
                navigate(ROUTE_ADMINX_KILLER_MANAGMENT);
                closeSidebar();
              }}
              selected={pathname.includes(ROUTE_ADMINX_KILLER_MANAGMENT)}
            >
              <ListItemIcon>
                <ManageAccountsIcon />
              </ListItemIcon>
              <ListItemText primary="کشتارکن ها" />
            </ListItemButton>
          </Tooltip> */}

      <Tooltip title={open ? "" : "مدیریت فرآیند"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_ADMINX_ROUTE_MANAGE_PROCESS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_ROUTE_MANAGE_PROCESS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <AccountTreeIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت فرآیند" />
        </ListItemButton>
      </Tooltip>

      {/* <Tooltip title={open ? "" : "پرونده های کشتار"} placement="left-start">
            <ListItemButton
              selected={pathname.includes(ROUTE_ADMINX_ROUTE_CASE_STATUS)}
              onClick={() => {
                dispatch(DRAWER({ right: false, bottom: false, content: null }));
                navigate(ROUTE_ADMINX_ROUTE_CASE_STATUS);
                closeSidebar();
              }}
            >
              <ListItemIcon>
                <AccountTreeIcon />
              </ListItemIcon>
              <ListItemText primary="پرونده های کشتار" />
            </ListItemButton>
          </Tooltip> */}
      {/* 
          <Tooltip title={open ? "" : "آمار"} placement="left-start">
            <ListItemButton
              onClick={() => {
                dispatch(DRAWER({ right: false, bottom: false, content: null }));
                navigate(ROUTE_ADMINX_STATICS);
                closeSidebar();
              }}
              selected={pathname.includes(ROUTE_ADMINX_STATICS)}
            >
              <ListItemIcon>
                <PieChart />
              </ListItemIcon>
              <ListItemText primary="آمار و اطلاعات" />
            </ListItemButton>
          </Tooltip> */}

      <Tooltip title={open ? "" : "تیکت ها"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_TICKET);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_TICKET)}
        >
          <ListItemIcon>
            <SupportIcon />
          </ListItemIcon>
          <ListItemText primary="تیکت ها" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "بررسی اکسل"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_ADMINX_EXCEL_CHECK);
            closeSidebar();
          }}
          selected={pathname.includes(ROUTE_ADMINX_EXCEL_CHECK)}
        >
          <ListItemIcon>
            <DocumentScanner />
          </ListItemIcon>
          <ListItemText primary="بررسی اکسل" />
        </ListItemButton>
      </Tooltip>

      {/* <Tooltip title={open ? "" : "سامانه بازرسی"} placement="left-start">
        <ListItemButton
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            window.open(
              `https://seeyo.ir/autologin/${userInfo.authToken}/${userInfo.userProfile.province}`,
              "_blank"
            );
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LoginIcon />
          </ListItemIcon>
          <ListItemText primary="سامانه بازرسی" />
        </ListItemButton>
      </Tooltip> */}
    </React.Fragment>
  );

  const supporterItems = (
    <React.Fragment>
      <Tooltip title={open ? "" : "مدیریت بارها"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_SUPPORTER_ROUTE_ALLOCATIONS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPPORTER_ROUTE_ALLOCATIONS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <LocalShippingIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت بارها" />
        </ListItemButton>
      </Tooltip>
      <Tooltip title={open ? "" : "مدیریت جوجه ریزی"} placement="left-start">
        <ListItemButton
          selected={pathname.includes(ROUTE_SUPPORTERـHATCHINGS)}
          onClick={() => {
            dispatch(DRAWER({ right: false, bottom: false, content: null }));
            navigate(ROUTE_SUPPORTERـHATCHINGS);
            closeSidebar();
          }}
        >
          <ListItemIcon>
            <SettingsInputCompositeIcon />
          </ListItemIcon>
          <ListItemText primary="مدیریت جوجه ریزی" />
        </ListItemButton>
      </Tooltip>
    </React.Fragment>
  );

  const getSidebarItemsByRole = (role) => {
    switch (role) {
      case "AdminX":
        return adminXItems;
      case "Admin":
        return { ...adminItems, ...inspectorItems };
      case "CityOperator":
        return cityItems;
      case "Poultry":
        return avicultureItems;
      case "ProvinceOperator":
        return provinceItems;
      case "ProvinceFinancial":
        return provinceFinancialItems;
      case "KillHouse":
        return slaughterHouseItems;
      case "KillHouseVet":
        return slaughterHouseVetItems;
      case "VetFarm":
        return vetFarmItems;
      case "Driver":
        return driverItems;
      case "VetSupervisor":
        return vetSupervisorItems;
      case "ProvinceInspector":
        return inspectorItems;
      case "Jahad":
        return jahadItems;
      case "ProvincialGovernment":
        return jahadItems;
      case "Guilds":
        return senfItems;
      case "Steward":
        return guildItems;
      case "Commerce":
        return commerceItems;
      case "ProvinceSupervisor":
        return ProvinceSupervisorItems;
      case "CityCommerce":
        return cityCommerceItems;
      case "CityVet":
        return cityVetItems;
      case "CityJahad":
        return cityJihadItems;
      case "Observatory":
        return observatoryItems;
      case "GuildRoom":
        return guildRoomItems;
      case "PosCompany":
        return pspCompanyItems;
      case "LiveStockSupport":
        return liveStockItems;
      case "SuperAdmin":
        return superAdminItems;
      case "ChainCompany":
        return chainCompanyItems;
      case "Supporter":
        return supporterItems;
      case "Dispenser":
        return dispenserItems;
      case "CityPoultry":
        return cityPoultryItems;
      default:
        return null;
    }
  };

  // const topItems = (
  //   <>
  //     <Tooltip title={open ? "" : "پنل مدیریت"} placement="left-start">
  //       <ListItemButton
  //         onClick={() => {
  //           dispatch(DRAWER({ right: false, bottom: false, content: null }));
  //           navigate("/");
  //           closeSidebar();
  //         }}
  //         selected={pathname === "/"}
  //       >
  //         <ListItemIcon>
  //           <DashboardIcon />
  //         </ListItemIcon>
  //         <ListItemText primary="پنل مدیریت" />
  //       </ListItemButton>
  //     </Tooltip>
  //   </>
  // );

  const [width, setWidth] = React.useState(window.innerWidth);

  function handleWindowSizeChange() {
    setWidth(window.innerWidth);
  }
  React.useEffect(() => {
    window.addEventListener("resize", handleWindowSizeChange);
    return () => {
      window.removeEventListener("resize", handleWindowSizeChange);
    };
  }, []);

  const isMobile = width <= 768;

  // const [sidebarSelectRolesOptions, setSidebarSelectRolesOptions] =
  //   React.useState([]);

  React.useEffect(() => {
    // const sidebarSelectRoles = roles.map((userRole, i) => {
    //   return {
    //     label: getFaUserRole(userRole),
    //     value: userRole,
    //   };
    // });
    // setSidebarSelectRolesOptions(sidebarSelectRoles);
  }, []);

  // React.useEffect(() => {
  //   if (!selectedRoles.length) {
  //     if (sidebarSelectRolesOptions?.length) {
  //       dispatch(CHANGE_SELECTED_ROLES(roles));
  //     }
  //   }
  // }, [sidebarSelectRolesOptions]);

  return (
    <Drawer
      id="sidebar"
      onMouseEnter={() => {
        if (!isMobile) {
          setOpen(true);
        }
      }}
      onMouseLeave={() => {
        if (!isMobile) {
          setOpen(false);
        }
      }}
      variant="permanent"
      open={open}
      sx={{
        display: {
          xs: open ? "block" : "none",
          sm: open ? "block" : "none",
          md: "block",
        },
        zIndex: (theme) => theme.zIndex.drawer + 11,
      }}
    >
      {/* <Toolbar
        sx={{
          display: "flex",
          alignItems: "center",
          px: [1],
        }}
      >
        <Grid container sx={{ flexGrow: 1, justifyContent: "flex-end" }}>
          <IconButton onClick={toggleDrawer}>
            {open ? <ChevronRightIcon /> : <ChevronLeftIcon />}
          </IconButton>
        </Grid>
      </Toolbar>
      <Divider /> */}
      <List component="nav">
        <Box display={"flex"} gap={SPACING.SMALL}>
          <Grid container xs={12} justifyContent={"center"} gap={2}>
            {userProfile?.image &&
            userProfile?.image !== "empty" &&
            userProfile?.fullname ? (
              <Avatar
                alt="User Profile"
                src={userProfile?.image}
                // sx={{ width: 56, height: 56 }}
                color="secondary"
              />
            ) : (
              <Avatar {...stringAvatar(userProfile?.fullname)} />
            )}
            {open && (
              <Grid
                container
                direction="column"
                justifyContent="center"
                alignItems="flex-start"
              >
                <Typography variant="body1">{userProfile?.fullname}</Typography>
                <Typography variant="caption" color={"grey"}>
                  موبایل: {userProfile?.mobile}
                </Typography>
              </Grid>
            )}
          </Grid>
        </Box>

        <Grid container xs={12} justifyContent="center" gap={1}>
          <Tooltip title="پروفایل" placement="top">
            <IconButton
              color="primary"
              onClick={() => {
                dispatch(
                  DRAWER({ right: false, bottom: false, content: null })
                );
                navigate(ROUTE_GENERAL_USER_PROFILE);
                closeSidebar();
              }}
            >
              <AccountBoxIcon />
            </IconButton>
          </Tooltip>
          <Tooltip title="پیام های شما" placement="top">
            <IconButton
              color="primary"
              onClick={() => {
                dispatch(
                  DRAWER({ right: false, bottom: false, content: null })
                );
                navigate(ROUTE_GENERAL_MESSAGES);
                closeSidebar();
              }}
            >
              <EmailIcon />
            </IconButton>
          </Tooltip>
          <Tooltip title="آموزش" placement="top">
            <IconButton
              color="primary"
              onClick={() => {
                dispatch(
                  DRAWER({ right: false, bottom: false, content: null })
                );
                navigate(ROUTE_GENERAL_TRAINING);
                closeSidebar();
              }}
            >
              <LightbulbIcon />
            </IconButton>
          </Tooltip>
          <Tooltip title="پشتیبانی" placement="top">
            <IconButton
              color="primary"
              onClick={() => {
                dispatch(
                  DRAWER({ right: false, bottom: false, content: null })
                );
                navigate(ROUTE_GENERAL_SUPPORT);
                closeSidebar();
              }}
            >
              <PermPhoneMsgIcon />
            </IconButton>
          </Tooltip>
        </Grid>

        {open && (
          <Grid
            container
            alignItems="center"
            sx={{ userSelect: "none" }}
            xs={12}
            justifyContent="center"
            mb={2}
          >
            {/* <Typography
              sx={{
                display: { xs: "none", md: "flex", marginRight: 5 },
                fontSize: "12px",
                color: "red",
                textDecoration: "none",
              }}
            >
              (
            </Typography> */}
            <Typography
              variant="body2"
              sx={{
                display: { xs: "none", md: "flex" },
                fontSize: "12px",
                color: "red",
                textDecoration: "none",
              }}
            >
              {new PersianDate().toLocale("fa").format("dddd DD MMMM")}
            </Typography>
            {/* <Typography
              variant="body2"
              sx={{
                display: { xs: "none", md: "flex", color: "yellow" },
                fontSize: "12px",
                color: "red",
                textDecoration: "none",
                ml: 1,
                mr: 1,
              }}
            >
              -
            </Typography>
            <Typography
              variant="body2"
              sx={{
                display: {
                  xs: "none",
                  md: "flex",
                  width: "50px",
                },
                fontSize: "12px",
                color: "red",
                textDecoration: "none",
              }}
              style={{ justifyContent: "left" }}
            >
              {currentTime.toLocaleTimeString([], {
                hour: "2-digit",
                minute: "2-digit",
                second: "2-digit",
                hour12: false,
              })}
            </Typography>
            <Typography
              sx={{
                display: { xs: "none", md: "flex", marginLeft: 5 },
                fontSize: "12px",
                color: "red",
                textDecoration: "none",
              }}
            >
              )
            </Typography> */}
          </Grid>
        )}
        {/* <Divider sx={{ my: 1 }} /> */}
        {/* {topItems} */}

        {roles.map((userRole, i) => {
          const jsx = getSidebarItemsByRole(userRole);
          return (
            <Accordion
              key={i}
              style={{
                borderRadius: "8px",
              }}
            >
              <AccordionSummary
                onClick={() => handleAccordionChange(i)}
                expandIcon={
                  <ExpandMoreIcon
                    style={{
                      display: open ? "flex" : "none",
                      color: expandedItems.includes(i) ? "#fff" : "#273c75",
                    }}
                  />
                }
                style={{
                  backgroundColor: expandedItems.includes(i)
                    ? "#0fb9b1"
                    : "#dfe6e9",
                  boxShadow: expandedItems.includes(i)
                    ? "inset 0 0 2px rgba(0,0,0,0.75)"
                    : "none",
                }}
              >
                {open ? (
                  <motion.div
                    initial="closed"
                    animate="open"
                    variants={{
                      open: {
                        opacity: 1,
                        x: 0,
                        transition: {
                          opacity: { duration: 0.4 },
                          x: { type: "spring", stiffness: 200, damping: 25 },
                        },
                      },
                      closed: {
                        opacity: 0,
                        x: 100,
                        transition: {
                          opacity: { duration: 0.4 },
                          x: { type: "spring", stiffness: 200, damping: 25 },
                        },
                      },
                    }}
                    style={{
                      whiteSpace: "nowrap",
                      display: "flex",
                      alignItems: "center",
                    }}
                  >
                    <Grid container spacing={2} alignItems="center">
                      <Grid item>
                        <Typography
                          variant="body2"
                          style={{
                            color: expandedItems.includes(i)
                              ? "white"
                              : "#273c75",
                          }}
                        >
                          {getIconUserRole(userRole)}
                        </Typography>
                      </Grid>
                      <Grid item>
                        <Typography
                          fontWeight="bold"
                          variant="body2"
                          style={{
                            color: expandedItems.includes(i)
                              ? "white"
                              : "#273c75",
                          }}
                        >
                          {getFaUserRole(userRole)}
                        </Typography>
                      </Grid>
                    </Grid>
                  </motion.div>
                ) : (
                  <Typography
                    fontWeight="bold"
                    variant="body1"
                    style={{
                      color: expandedItems.includes(i) ? "#fff" : "#273c75",
                    }}
                  >
                    {getIconUserRole(userRole)}
                  </Typography>
                )}
              </AccordionSummary>
              <Grid
                container
                xs={12}
                style={{ backgroundColor: "rgb(239 239 240)" }}
              >
                {jsx}
              </Grid>
            </Accordion>
          );
        })}

        {generalItems}
        {/* {secondaryListItems} */}
      </List>
    </Drawer>
  );
};
