87 lines
2.1 KiB
TypeScript
87 lines
2.1 KiB
TypeScript
import {
|
|
UsersIcon,
|
|
DocumentTextIcon,
|
|
ChartBarIcon,
|
|
UserIcon,
|
|
} from "@heroicons/react/24/outline";
|
|
import { ItemWithSubItems } from "../types/userPermissions";
|
|
import { checkMenuPermission } from "../utils/checkMenuPermission";
|
|
|
|
export const getInspectionMenuItems = (
|
|
permissions: string[] = [],
|
|
): ItemWithSubItems[] => {
|
|
const items: ItemWithSubItems[] = [];
|
|
|
|
if (checkMenuPermission("nationalinfo", permissions)) {
|
|
items.push({
|
|
en: "nationalinfo",
|
|
fa: "اطلاعات",
|
|
icon: () => <UserIcon className="w-6 h-6" />,
|
|
subItems: [
|
|
{
|
|
name: "nationalinfo",
|
|
path: "/nationalinfo",
|
|
component: () => import("../Pages/NationalInfo"),
|
|
},
|
|
{
|
|
name: "ladinginfo",
|
|
path: "/ladinginfo",
|
|
component: () => import("../Pages/LadingInfo"),
|
|
},
|
|
{
|
|
name: "veterinarytransfer",
|
|
path: "/veterinarytransfer",
|
|
component: () => import("../Pages/VeterinaryTransfer"),
|
|
},
|
|
],
|
|
});
|
|
}
|
|
|
|
if (checkMenuPermission("users", permissions)) {
|
|
items.push({
|
|
en: "users",
|
|
fa: "کاربران",
|
|
icon: () => <UsersIcon className="w-6 h-6" />,
|
|
subItems: [
|
|
{
|
|
name: "users",
|
|
path: "/users",
|
|
component: () => import("../Pages/Users"),
|
|
},
|
|
],
|
|
});
|
|
}
|
|
|
|
if (checkMenuPermission("inspections", permissions)) {
|
|
items.push({
|
|
en: "inspections",
|
|
fa: "سوابق بازرسی",
|
|
icon: () => <DocumentTextIcon className="w-6 h-6" />,
|
|
subItems: [
|
|
{
|
|
name: "inspections",
|
|
path: "/inspections",
|
|
component: () => import("../Pages/UserInspections"),
|
|
},
|
|
],
|
|
});
|
|
}
|
|
|
|
if (checkMenuPermission("statics", permissions)) {
|
|
items.push({
|
|
en: "statics",
|
|
fa: "آمار",
|
|
icon: () => <ChartBarIcon className="w-6 h-6" />,
|
|
subItems: [
|
|
{
|
|
name: "statics",
|
|
path: "/statics",
|
|
component: () => import("../Pages/Statics"),
|
|
},
|
|
],
|
|
});
|
|
}
|
|
|
|
return items;
|
|
};
|