dress/resources/js/components/app-sidebar.tsx

120 lines
3.0 KiB
TypeScript

import { Link } from '@inertiajs/react';
import { Boxes, DollarSign, History, LayoutGrid, List, ScrollText, Settings, ShoppingBag, ShoppingCart, User, Wallet } from 'lucide-react';
import AppLogo from '@/components/app-logo';
import { NavMain } from '@/components/nav-main';
import {
Sidebar,
SidebarContent,
SidebarHeader,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
} from '@/components/ui/sidebar';
import { dashboard } from '@/routes';
import category from '@/routes/category';
import type { NavItem } from '@/types';
import product from '@/routes/product';
import expense from '@/routes/expense';
import payroll from '@/routes/payroll';
import user from '@/routes/user';
import system from '@/routes/system';
import purchase from '@/routes/purchase';
import order from '@/routes/order';
const mainNavItems: NavItem[] = [
{
title: 'Dasbor',
href: dashboard().url,
icon: LayoutGrid,
},
];
const masterNavItems: NavItem[] = [
{
title: 'Pegawai',
href: user.index().url,
icon: User,
},
{
title: 'Kategori',
href: category.index().url,
icon: List,
},
{
title: 'Produk',
href: product.index().url,
icon: Boxes,
},
];
const manageNavItems: NavItem[] = [
{
title: 'Pesanan',
href: order.index().url,
icon: ShoppingBag,
},
{
title: 'Belanja',
href: purchase.index().url,
icon: ShoppingCart,
},
];
const financeNavItems: NavItem[] = [
{
title: 'Pengeluaran',
href: expense.index().url,
icon: Wallet,
},
{
title: 'Penggajian',
href: payroll.index().url,
icon: DollarSign,
},
];
const systemNavItems: NavItem[] = [
{
title: 'Pengaturan',
href: system.settings.index().url,
icon: Settings,
},
{
title: 'Logs',
href: system.logs.index().url,
icon: ScrollText,
},
{
title: 'Riwayat',
href: system.activityLogs.index().url,
icon: History,
},
];
export function AppSidebar() {
return (
<Sidebar collapsible="icon" variant="inset">
<SidebarHeader>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton size="lg" asChild>
<Link href={dashboard().url} prefetch>
<AppLogo />
</Link>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarHeader>
<SidebarContent>
<NavMain items={mainNavItems} />
<NavMain items={masterNavItems} label='Master' />
<NavMain items={manageNavItems} label='Kelola' />
<NavMain items={financeNavItems} label='Keuangan' />
<NavMain items={systemNavItems} label='Sistem' />
</SidebarContent>
</Sidebar>
);
}