fix(dashboard): resolve tutorial QA notes (clips 2–6)
- settings/company: show success toast on save (2.1) - inspection templates: add explicit Save button (2.6) - parts: label price fields with AED currency (3.1) - service groups: add parts/services picker to packages (3.3) - vehicles: add insurance (has_insurance + insurance type) field (4.2) - appointments: add calendar view with list/calendar toggle (5.1) - job card check-in: require department (5.4) - job card payments: refresh job card/invoice queries so PAID shows (5.6) - vendors: add phone + address fields (6.1) - bill payments: surface real vendor/employee validation errors (6.4) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
"use client"
|
||||
|
||||
import { useState } from "react"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { ResourcePage } from "@/shared/data-view/resource-page"
|
||||
import { ColumnHeader } from "@/shared/data-view/table-view"
|
||||
import FormDialog from "@/shared/components/form-dialog"
|
||||
import { AppointmentForm } from "@/modules/appointments/appointment-form"
|
||||
import { AppointmentsCalendarView } from "@/modules/appointments/appointments-calendar-view"
|
||||
import { APPOINTMENT_ROUTES, AppointmentStatus } from "@garage/api"
|
||||
import type { AppointmentsClient } from "@garage/api"
|
||||
import { CalendarCheck2Icon, ClipboardListIcon, ClockIcon } from "lucide-react"
|
||||
import { CalendarCheck2Icon, CalendarDaysIcon, ClipboardListIcon, ClockIcon, ListIcon } from "lucide-react"
|
||||
import { Badge } from "@/shared/components/ui/badge"
|
||||
import { Button } from "@/shared/components/ui/button"
|
||||
import { RelationLink } from "@/shared/components/relation-link"
|
||||
import { formatEnum } from "@/shared/utils/formatters"
|
||||
|
||||
@@ -22,8 +25,44 @@ const STATUS_COLORS: Record<string, string> = {
|
||||
|
||||
export default function AppointmentsPage() {
|
||||
const router = useRouter()
|
||||
const [view, setView] = useState<"list" | "calendar">("list")
|
||||
|
||||
const viewToggle = (
|
||||
<div className="flex items-center justify-end gap-1 px-1">
|
||||
<Button
|
||||
type="button"
|
||||
variant={view === "list" ? "default" : "outline"}
|
||||
size="sm"
|
||||
onClick={() => setView("list")}
|
||||
>
|
||||
<ListIcon className="me-1 size-4" /> List
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant={view === "calendar" ? "default" : "outline"}
|
||||
size="sm"
|
||||
onClick={() => setView("calendar")}
|
||||
>
|
||||
<CalendarDaysIcon className="me-1 size-4" /> Calendar
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
|
||||
if (view === "calendar") {
|
||||
return (
|
||||
<div className="space-y-4 p-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<h1 className="text-xl font-semibold">Appointments</h1>
|
||||
{viewToggle}
|
||||
</div>
|
||||
<AppointmentsCalendarView />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
{viewToggle}
|
||||
<ResourcePage<AppointmentsClient>
|
||||
pageTitle="Appointments"
|
||||
routeKey={APPOINTMENT_ROUTES.INDEX}
|
||||
@@ -104,5 +143,6 @@ export default function AppointmentsPage() {
|
||||
actionsColumn(),
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user