73 lines
2.3 KiB
TypeScript
73 lines
2.3 KiB
TypeScript
import {Cylinder, Package, Truck} from "lucide-react";
|
|
import {
|
|
SidebarGroup,
|
|
SidebarGroupContent,
|
|
SidebarGroupLabel,
|
|
SidebarMenu,
|
|
SidebarMenuButton,
|
|
SidebarMenuItem,
|
|
} from "../../ui/sidebar";
|
|
import {hasPageAccess} from "@/utils/userAccess";
|
|
import {User} from "@/types/users";
|
|
// this will need to be moved to a links section the db to make it more easy to remove and add
|
|
const items = [
|
|
{
|
|
title: "Silo Adjustments",
|
|
url: "#",
|
|
icon: Cylinder,
|
|
role: ["technician", "supervisor", "manager", "admin", "systemAdmin"],
|
|
module: "logistics",
|
|
active: true,
|
|
},
|
|
{
|
|
title: "Bulk orders",
|
|
url: "#",
|
|
icon: Truck,
|
|
role: ["technician", "supervisor", "manager", "admin", "systemAdmin"],
|
|
module: "logistics",
|
|
active: true,
|
|
},
|
|
{
|
|
title: "Forecast",
|
|
url: "#",
|
|
icon: Truck,
|
|
role: ["technician", "supervisor", "manager", "admin", "systemAdmin"],
|
|
module: "logistics",
|
|
active: true,
|
|
},
|
|
{
|
|
title: "Ocme cycle counts",
|
|
url: "#",
|
|
icon: Package,
|
|
role: ["technician", "supervisor", "manager", "admin", "systemAdmin"],
|
|
module: "logistics",
|
|
active: false,
|
|
},
|
|
];
|
|
|
|
export function LogisticsSideBar({user, moduleID}: {user: User | null; moduleID: string}) {
|
|
return (
|
|
<SidebarGroup>
|
|
<SidebarGroupLabel>Logistics</SidebarGroupLabel>
|
|
<SidebarGroupContent>
|
|
<SidebarMenu>
|
|
{items.map((item) => (
|
|
<SidebarMenuItem key={item.title}>
|
|
<>
|
|
{hasPageAccess(user, item.role, moduleID) && item.active && (
|
|
<SidebarMenuButton asChild>
|
|
<a href={item.url}>
|
|
<item.icon />
|
|
<span>{item.title}</span>
|
|
</a>
|
|
</SidebarMenuButton>
|
|
)}
|
|
</>
|
|
</SidebarMenuItem>
|
|
))}
|
|
</SidebarMenu>
|
|
</SidebarGroupContent>
|
|
</SidebarGroup>
|
|
);
|
|
}
|