diff --git a/resources/js/components/app-sidebar.tsx b/resources/js/components/app-sidebar.tsx index c0b6b13..40107e0 100644 --- a/resources/js/components/app-sidebar.tsx +++ b/resources/js/components/app-sidebar.tsx @@ -1,34 +1,120 @@ import { Link } from '@inertiajs/react'; -import { LayoutGrid } from 'lucide-react'; +import type { LucideIcon } from 'lucide-react'; +import { + Activity, + ArrowUpFromLine, + BarChart3, + Boxes, + CalendarCheck, + CalendarDays, + ClipboardCheck, + DollarSign, + FileText, + HandCoins, + LayoutGrid, + Package, + RefreshCw, + Scissors, + Settings, + ShoppingCart, + Tags, + Truck, + UserCircle, + Users, + Wallet, +} from 'lucide-react'; import AppLogo from '@/components/app-logo'; -import { NavMain } from '@/components/nav-main'; import { Sidebar, SidebarContent, + SidebarGroup, + SidebarGroupLabel, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem, } from '@/components/ui/sidebar'; +import { useCurrentUrl } from '@/hooks/use-current-url'; import { dashboard } from '@/routes'; -import type { NavItem } from '@/types'; -const mainNavItems: NavItem[] = [ - { - title: 'Dasbor', - href: dashboard(), - icon: LayoutGrid, - }, +type NavMenuItem = { title: string; href: string; icon: LucideIcon }; + +const dasborItem: NavMenuItem = { + title: 'Dasbor', + href: dashboard.url(), + icon: LayoutGrid, +}; + +const analisaItem: NavMenuItem = { + title: 'Analisa', + href: '#', + icon: BarChart3, +}; + +const masterItems: NavMenuItem[] = [ + { title: 'Kategori', href: '#', icon: Tags }, + { title: 'Produk', href: '#', icon: Package }, + { title: 'Bahan Baku', href: '#', icon: Boxes }, + { title: 'Supplier', href: '#', icon: Truck }, + { title: 'Customer', href: '#', icon: Users }, ]; +const kelolaItems: NavMenuItem[] = [ + { title: 'Belanja', href: '#', icon: ShoppingCart }, + { title: 'Cutting', href: '#', icon: Scissors }, + { title: 'Restock', href: '#', icon: RefreshCw }, + { title: 'Stok Opname', href: '#', icon: ClipboardCheck }, + { title: 'Pesanan', href: '#', icon: FileText }, +]; + +const keuanganItems: NavMenuItem[] = [ + { title: 'Kas Toko', href: '#', icon: Wallet }, + { title: 'Pengeluaran', href: '#', icon: ArrowUpFromLine }, + { title: 'Kasbon', href: '#', icon: HandCoins }, + { title: 'Gaji', href: '#', icon: DollarSign }, +]; + +const sdmItems: NavMenuItem[] = [ + { title: 'Pegawai', href: '#', icon: UserCircle }, + { title: 'Presensi', href: '#', icon: CalendarCheck }, + { title: 'Cuti', href: '#', icon: CalendarDays }, +]; + +const sistemItems: NavMenuItem[] = [ + { title: 'Pengaturan', href: '#', icon: Settings }, + { title: 'Log Aktivitas', href: '#', icon: Activity }, +]; + +function MenuGroup({ label, items }: { label: string; items: NavMenuItem[] }) { + return ( + + {label} + + {items.map((item) => ( + + + + + {item.title} + + + + ))} + + + ); +} + export function AppSidebar() { + const { isCurrentUrl } = useCurrentUrl(); + return ( - + @@ -37,7 +123,37 @@ export function AppSidebar() { - + + + + + + + {dasborItem.title} + + + + + + + + + + + + + {analisaItem.title} + + + + + + + + + + + ); diff --git a/resources/js/components/nav-footer.tsx b/resources/js/components/nav-footer.tsx deleted file mode 100644 index 8430e49..0000000 --- a/resources/js/components/nav-footer.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import type { ComponentPropsWithoutRef } from 'react'; -import { - SidebarGroup, - SidebarGroupContent, - SidebarMenu, - SidebarMenuButton, - SidebarMenuItem, -} from '@/components/ui/sidebar'; -import { toUrl } from '@/lib/utils'; -import type { NavItem } from '@/types'; - -export function NavFooter({ - items, - className, - ...props -}: ComponentPropsWithoutRef & { - items: NavItem[]; -}) { - return ( - - - - {items.map((item) => ( - - - - {item.icon && ( - - )} - {item.title} - - - - ))} - - - - ); -} diff --git a/resources/js/components/nav-main.tsx b/resources/js/components/nav-main.tsx deleted file mode 100644 index 2eb96d1..0000000 --- a/resources/js/components/nav-main.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Link } from '@inertiajs/react'; -import { - SidebarGroup, - SidebarMenu, - SidebarMenuButton, - SidebarMenuItem -} from '@/components/ui/sidebar'; -import { useCurrentUrl } from '@/hooks/use-current-url'; -import type { NavItem } from '@/types'; - -export function NavMain({ items = [] }: { items: NavItem[] }) { - const { isCurrentUrl } = useCurrentUrl(); - - return ( - - - {items.map((item) => ( - - - - {item.icon && } - {item.title} - - - - ))} - - - ); -}