initialize
This commit is contained in:
@@ -0,0 +1,218 @@
|
||||
"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>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { DashboardHeader } from "@/base/components/layout/dashboard";
|
||||
import DashboardPage from "@/base/components/layout/dashboard/dashboard-page";
|
||||
export default function page() {
|
||||
return (
|
||||
<DashboardPage header={<DashboardHeader />} >
|
||||
<div className="space-y-6">
|
||||
<h1 className="text-2xl font-bold tracking-tight">Dashboard</h1>
|
||||
<p className="text-muted-foreground">
|
||||
Welcome to your dashboard. Select an item from the sidebar to get started.
|
||||
</p>
|
||||
</div>
|
||||
</DashboardPage>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
"use client"
|
||||
|
||||
import { ResourcePage } from '@/shared/data-view/resource-page'
|
||||
import { ColumnHeader } from '@/shared/data-view/table-view'
|
||||
import { CustomerForm } from '@/modules/customers/customer-form'
|
||||
import { CUSTOMER_ROUTES } from '@repo/api'
|
||||
import type { CustomersClient } from '@repo/api'
|
||||
import { Building2Icon, UserIcon } from 'lucide-react'
|
||||
|
||||
export default function CustomersPage() {
|
||||
return (
|
||||
<ResourcePage<CustomersClient>
|
||||
pageTitle='Customers'
|
||||
title="Customer"
|
||||
routeKey={CUSTOMER_ROUTES.INDEX}
|
||||
getClient={(api) => api.customers}
|
||||
columns={({ actionsColumn }) => [
|
||||
|
||||
{
|
||||
accessorKey: "first_name",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Customer" />,
|
||||
cell: ({ row }) => {
|
||||
const customerName = row.original.first_name
|
||||
const isCompany = row.original.customer_type?.name?.toLocaleLowerCase() === "company";
|
||||
const companyName = row.original.company_name
|
||||
const name = isCompany && companyName ? `${customerName} (${row.original.last_name})` : customerName
|
||||
|
||||
return (<div className="flex items-center gap-2">
|
||||
{isCompany ? <Building2Icon className="text-muted-foreground" /> : <UserIcon className="text-muted-foreground" />}
|
||||
<span>{name}</span>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "email",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Email" />,
|
||||
},
|
||||
{
|
||||
accessorKey: "phone",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Phone" />,
|
||||
},
|
||||
actionsColumn(),
|
||||
]}
|
||||
renderForm={({ resourceId, initialData, onSuccess }) => (
|
||||
<CustomerForm
|
||||
resourceId={resourceId}
|
||||
initialData={initialData}
|
||||
onSuccess={onSuccess}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
"use client"
|
||||
|
||||
import { ResourcePage } from '@/shared/data-view/resource-page'
|
||||
import { ColumnHeader } from '@/shared/data-view/table-view'
|
||||
import { VehicleForm } from '@/modules/vehicles/vehicle-form'
|
||||
import { VEHICLE_ROUTES } from '@repo/api'
|
||||
import type { VehiclesClient } from '@repo/api'
|
||||
import { CarIcon } from 'lucide-react'
|
||||
|
||||
export default function VehiclesPage() {
|
||||
return (
|
||||
<ResourcePage<VehiclesClient>
|
||||
pageTitle="Vehicles"
|
||||
title="Vehicle"
|
||||
routeKey={VEHICLE_ROUTES.INDEX}
|
||||
getClient={(api) => api.vehicles}
|
||||
columns={({ actionsColumn }) => [
|
||||
{
|
||||
accessorKey: "name",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Vehicle" />,
|
||||
cell: ({ row }) => {
|
||||
const r = row.original as any
|
||||
const display = r.name || `${r.make ?? ""} ${r.model ?? ""}`.trim() || "—"
|
||||
return (
|
||||
<div className="flex items-center gap-2">
|
||||
<CarIcon className="h-4 w-4 text-muted-foreground" />
|
||||
<span>{display}</span>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "year",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Year" />,
|
||||
cell: ({ row }) => (row.original as any).year ?? "—",
|
||||
},
|
||||
{
|
||||
accessorKey: "license_plate",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="License Plate" />,
|
||||
cell: ({ row }) => (row.original as any).license_plate ?? "—",
|
||||
},
|
||||
{
|
||||
accessorKey: "mileage",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Mileage" />,
|
||||
cell: ({ row }) => (row.original as any).mileage ?? "—",
|
||||
},
|
||||
actionsColumn(),
|
||||
]}
|
||||
renderForm={({ resourceId, initialData, onSuccess }) => (
|
||||
<VehicleForm
|
||||
resourceId={resourceId}
|
||||
initialData={initialData}
|
||||
onSuccess={onSuccess}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
"use client"
|
||||
|
||||
import { ResourcePage } from "@/shared/data-view/resource-page"
|
||||
import { ColumnHeader } from "@/shared/data-view/table-view"
|
||||
import { ShopTypeForm } from "@/modules/settings/shop-type/shop-type-form"
|
||||
import { SHOP_TYPE_ROUTES } from "@repo/api"
|
||||
import type { ShopTypesClient } from "@repo/api"
|
||||
import { CheckIcon, XIcon } from "lucide-react"
|
||||
|
||||
export default function ShopTypesPage() {
|
||||
return (
|
||||
<ResourcePage<ShopTypesClient>
|
||||
pageTitle="Shop Types"
|
||||
title="Shop Type"
|
||||
routeKey={SHOP_TYPE_ROUTES.INDEX}
|
||||
getClient={(api) => api.shopTypes}
|
||||
columns={({ actionsColumn }) => [
|
||||
{
|
||||
accessorKey: "title",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Title" />,
|
||||
},
|
||||
{
|
||||
accessorKey: "shop_type",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Type" />,
|
||||
},
|
||||
{
|
||||
accessorKey: "note",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Note" />,
|
||||
cell: ({ row }) => (
|
||||
<span className="text-muted-foreground line-clamp-1">
|
||||
{(row.original as any).note ?? "—"}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "is_default",
|
||||
header: ({ column }) => <ColumnHeader column={column} title="Default" />,
|
||||
cell: ({ row }) =>
|
||||
(row.original as any).is_default
|
||||
? <CheckIcon className="h-4 w-4 text-green-600" />
|
||||
: <XIcon className="h-4 w-4 text-muted-foreground" />,
|
||||
},
|
||||
actionsColumn(),
|
||||
]}
|
||||
renderForm={({ resourceId, initialData, onSuccess }) => (
|
||||
<ShopTypeForm
|
||||
resourceId={resourceId}
|
||||
initialData={initialData}
|
||||
onSuccess={onSuccess}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user