75 lines
2.1 KiB
JavaScript
75 lines
2.1 KiB
JavaScript
import { MdCorporateFare } from "react-icons/md";
|
|
import { Grid } from "../../../../components/grid/Grid";
|
|
import LinkItem from "../../../../components/link-item/LinkItem";
|
|
import { NavLink } from "../../../../components/nav-link/NavLink";
|
|
import { SPACING } from "../../../../data/spacing";
|
|
import {
|
|
ROUTE_ADMINX_ROUTE_AGENT_SHARE,
|
|
ROUTE_ADMINX_ROUTE_STEWARD_SHARE,
|
|
ROUTE_PROVINCE_ROUTE_AGENT_SHARE,
|
|
ROUTE_PROVINCE_ROUTE_STEWARD_SHARE,
|
|
ROUTE_SUPER_ADMIN_ROUTE_AGENT_SHARE,
|
|
ROUTE_SUPER_ADMIN_ROUTE_STEWARD_SHARE,
|
|
} from "../../../../routes/routes";
|
|
import { Typography } from "@mui/material";
|
|
import { getRoleFromUrl } from "../../../../utils/getRoleFromUrl";
|
|
|
|
const getRouteByRole = (isAgentRoute) => {
|
|
const role = getRoleFromUrl();
|
|
|
|
if (role === "SuperAdmin") {
|
|
if (isAgentRoute) {
|
|
return ROUTE_SUPER_ADMIN_ROUTE_AGENT_SHARE;
|
|
}
|
|
return ROUTE_SUPER_ADMIN_ROUTE_STEWARD_SHARE;
|
|
}
|
|
|
|
if (role === "AdminX") {
|
|
if (isAgentRoute) {
|
|
return ROUTE_ADMINX_ROUTE_AGENT_SHARE;
|
|
}
|
|
return ROUTE_ADMINX_ROUTE_STEWARD_SHARE;
|
|
}
|
|
|
|
if (isAgentRoute) {
|
|
return ROUTE_PROVINCE_ROUTE_AGENT_SHARE;
|
|
}
|
|
return ROUTE_PROVINCE_ROUTE_STEWARD_SHARE;
|
|
};
|
|
|
|
export const BroadcastManagementOperations = () => {
|
|
return (
|
|
<Grid
|
|
container
|
|
gap={SPACING.SMALL}
|
|
p={SPACING.SMALL}
|
|
direction={{ xs: "column", md: "row" }}
|
|
justifyContent="center"
|
|
>
|
|
<NavLink to={getRouteByRole(true)}>
|
|
<LinkItem
|
|
icon={<MdCorporateFare size={30} color="#244CCC" />}
|
|
title={
|
|
<>
|
|
<Typography>گزارش پخش روزانه</Typography>
|
|
<Typography variant="caption">کشتارگاه به مباشر/ صنف</Typography>
|
|
</>
|
|
}
|
|
/>
|
|
</NavLink>
|
|
|
|
<NavLink to={getRouteByRole(false)}>
|
|
<LinkItem
|
|
icon={<MdCorporateFare size={30} color="#244CCC" />}
|
|
title={
|
|
<>
|
|
<Typography>گزارش پخش روزانه</Typography>
|
|
<Typography variant="caption">مباشر به صنف</Typography>
|
|
</>
|
|
}
|
|
/>
|
|
</NavLink>
|
|
</Grid>
|
|
);
|
|
};
|