2026-03-26 16:50:43 +03:00

219 lines
7.2 KiB
TypeScript

"use client"
import type { NavGroup } from "@/base/types/navigation"
import {
AlarmClockIcon,
AwardIcon,
BanknoteArrowDownIcon,
BarChart3Icon,
BellRingIcon,
BookIcon,
BriefcaseBusinessIcon,
Building2Icon,
CalendarCheck2Icon,
CalendarDaysIcon,
LayoutDashboardIcon,
ClipboardListIcon,
UsersIcon,
CalendarIcon,
CarIcon,
ClipboardCheckIcon,
Clock3Icon,
ClockIcon,
GemIcon,
GitBranchIcon,
HandCoinsIcon,
ListIcon,
ListTodoIcon,
MegaphoneIcon,
PackageIcon,
PhoneCallIcon,
PlugZapIcon,
ReceiptIcon,
ReceiptTextIcon,
SettingsIcon,
ShoppingBasketIcon,
CircleDollarSign,
StarIcon,
StoreIcon,
TimerIcon,
UserCogIcon,
WalletIcon,
WrenchIcon,
ShoppingCartIcon,
} from "lucide-react"
import Image from "next/image"
import { DashboardLayout } from "@/base/components/layout/dashboard"
import { useAuth } from "@/shared/hooks/use-auth"
const navGroups: NavGroup[] = [
{
items: [
{
title: "Dashboard",
href: "/",
icon: <LayoutDashboardIcon />,
},
{
title: "Job Cards",
href: "/sales/workorder/list",
icon: <ClipboardListIcon />,
},
{
title: "Customer & Vehicles",
href: "/customer-vehicles",
icon: <UsersIcon />,
},
{
title: "Reports",
href: "/reports",
icon: <BarChart3Icon />,
},
],
},
{
label: "Management",
items: [
{
title: "Calendars",
href: "/calendars",
icon: <CalendarIcon />,
items: [
{ title: "Work Schedule", href: "/calendar/work-schedule/list", icon: <Clock3Icon /> },
{ title: "Appointments", href: "/calendar/appointment/list", icon: <CalendarCheck2Icon /> },
],
},
{
title: "Sales",
href: "/sales",
icon: <CircleDollarSign />,
items: [
{ title: "Customers", href: "/sales/customers", icon: <UsersIcon /> },
{ title: "Vehicles", href: "/sales/vehicles", icon: <CarIcon /> },
{ title: "Inspections", href: "/sales/inspections", icon: <ClipboardCheckIcon /> },
{ title: "Estimates", href: "/sales/estimate", icon: <ReceiptTextIcon /> },
{ title: "Job Cards", href: "/sales/workorder/list", icon: <ClipboardListIcon /> },
{ title: "Invoices", href: "/sales/invoice", icon: <ReceiptIcon /> },
{ title: "Payments Received", href: "/sales/payment-received", icon: <HandCoinsIcon /> },
{ title: "Credit Notes", href: "/sales/credit-notes", icon: <ReceiptTextIcon /> },
],
},
{
title: "Purchases",
href: "/purchases",
icon: <ShoppingCartIcon />,
items: [
{ title: "Vendors", href: "/purchase/vendor", icon: <StoreIcon /> },
{ title: "Expenses", href: "/purchase/expense", icon: <WalletIcon /> },
{ title: "Purchase Orders", href: "/purchase/purchase-order", icon: <ShoppingBasketIcon /> },
{ title: "Bills", href: "/purchase/bill", icon: <ReceiptIcon /> },
{ title: "Payments Made", href: "/purchase/payments-made", icon: <BanknoteArrowDownIcon /> },
{ title: "Vendor Credits", href: "/purchase/vendor-credit", icon: <ReceiptTextIcon /> },
],
},
{
title: "CRM",
href: "/crm",
icon: <BriefcaseBusinessIcon />,
items: [
{ title: "Leads", href: "/crm/leads/list", icon: <GemIcon /> },
{ title: "Calls", href: "/crm/calls-follow-up/list", icon: <PhoneCallIcon /> },
{ title: "Tasks", href: "/crm/tasks/list", icon: <ListTodoIcon /> },
],
},
{
title: "Marketing",
href: "/marketing",
icon: <MegaphoneIcon />,
items: [
{ title: "Service Reminders", href: "/marketing/service-reminder/list", icon: <AlarmClockIcon /> },
{ title: "Rating & Reviews", href: "/marketing/rating-review", icon: <StarIcon /> },
{ title: "Google Business Reviews", href: "/marketing/google-rating-review", icon: <AwardIcon /> },
],
},
{
title: "Accountants",
href: "/accountants",
icon: <BookIcon />,
items: [
{ title: "Manual Journals", href: "/accountants/manual-journal", icon: <BookIcon /> },
{ title: "Chart of Accounts", href: "/accountants/chart-of-account", icon: <GitBranchIcon /> },
],
},
{
title: "Employees",
href: "/productivity",
icon: <UserCogIcon />,
items: [
{ title: "Employees", href: "/productivity/employees", icon: <UsersIcon /> },
{ title: "Time Clocks", href: "/productivity/time-clocks", icon: <TimerIcon /> },
{ title: "Time Sheets", href: "/productivity/timesheet", icon: <ClockIcon /> },
{ title: "Payroll", href: "/productivity/payroll", icon: <WalletIcon /> },
{ title: "Payments Made", href: "/productivity/employee-payments-made", icon: <HandCoinsIcon /> },
{ title: "Shop Calendars", href: "/productivity/shop-calendars", icon: <CalendarDaysIcon /> },
{ title: "Shop Timing", href: "/productivity/shop-timings", icon: <Clock3Icon /> },
{ title: "Holidays", href: "/productivity/holidays", icon: <CalendarIcon /> },
],
},
{
title: "Items",
href: "/items",
icon: <PackageIcon />,
items: [
{ title: "Services", href: "/items/services", icon: <WrenchIcon /> },
{ title: "Parts", href: "/items/parts", icon: <WrenchIcon /> },
{ title: "Expense Item", href: "/items/expense-item", icon: <WalletIcon /> },
{ title: "Service Group", href: "/items/service-group", icon: <PackageIcon /> },
{ title: "Inspections", href: "/items/inspection", icon: <ClipboardCheckIcon /> },
{ title: "Inventory Adjustments", href: "/items/adjustment", icon: <ListIcon /> },
],
},
{
title: "Settings",
href: "/setting",
icon: <SettingsIcon />,
items: [
{ title: "Company", href: "/setting/company", icon: <Building2Icon /> },
{ title: "Shop Types", href: "/setting/shop-type", icon: <CarIcon /> },
{ title: "Tax & Rates", href: "/setting/tax-rates", icon: <ReceiptTextIcon /> },
{ title: "Configurations", href: "/setting/configurations/preferences/sales", icon: <SettingsIcon /> },
{ title: "Templates", href: "/setting/templates", icon: <ClipboardListIcon /> },
{ title: "Integrations", href: "/setting/integrations/providers", icon: <PlugZapIcon /> },
{ title: "Master", href: "/setting/master/body-type", icon: <ListIcon /> },
],
},
],
},
]
function Logo() {
return (
<div className="flex items-center gap-2">
<Image alt="Logo" src={'/assets/logo.png'} height={200} width={200}/>
</div>
)
}
export default function AuthenticatedLayout({
children,
}: {
children: React.ReactNode
}) {
const { user } = useAuth()
const userInfo = user
? {
name: user.name,
email: user.email,
initials: user.name.charAt(0).toUpperCase(),
}
: undefined
return (
<DashboardLayout navGroups={navGroups} logo={<Logo />} user={userInfo}>
{children}
</DashboardLayout>
)
}