diff --git a/apps/dashboard/app/(authenticated)/calendar/appointment/list/page.tsx b/apps/dashboard/app/(authenticated)/calendar/appointment/list/page.tsx index fc41a0d..5918cb1 100644 --- a/apps/dashboard/app/(authenticated)/calendar/appointment/list/page.tsx +++ b/apps/dashboard/app/(authenticated)/calendar/appointment/list/page.tsx @@ -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 = { export default function AppointmentsPage() { const router = useRouter() + const [view, setView] = useState<"list" | "calendar">("list") + + const viewToggle = ( +
+ + +
+ ) + + if (view === "calendar") { + return ( +
+
+

Appointments

+ {viewToggle} +
+ +
+ ) + } return ( +
+ {viewToggle} pageTitle="Appointments" routeKey={APPOINTMENT_ROUTES.INDEX} @@ -104,5 +143,6 @@ export default function AppointmentsPage() { actionsColumn(), ]} /> +
) } diff --git a/apps/dashboard/app/(authenticated)/settings/inspection-templates/[id]/page.tsx b/apps/dashboard/app/(authenticated)/settings/inspection-templates/[id]/page.tsx index 5f07d38..ed91541 100644 --- a/apps/dashboard/app/(authenticated)/settings/inspection-templates/[id]/page.tsx +++ b/apps/dashboard/app/(authenticated)/settings/inspection-templates/[id]/page.tsx @@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from "react" import Link from "next/link" import { useParams } from "next/navigation" -import { ChevronLeft, Pencil, Plus, Trash2 } from "lucide-react" +import { ChevronLeft, Pencil, Plus, Save, Trash2 } from "lucide-react" import { toast } from "sonner" import { Button } from "@/shared/components/ui/button" @@ -44,6 +44,9 @@ export default function InspectionTemplateEditorPage() { const api = useAuthApi() const [template, setTemplate] = useState(null) const [loading, setLoading] = useState(true) + const [name, setName] = useState("") + const [description, setDescription] = useState("") + const [saving, setSaving] = useState(false) const [editing, setEditing] = useState<{ section: InspectionTemplateSection @@ -55,6 +58,8 @@ export default function InspectionTemplateEditorPage() { try { const res = await api.inspectionTemplates.show(id) setTemplate(res.data) + setName(res.data.name ?? "") + setDescription(res.data.description ?? "") } catch (e: any) { toast.error(e?.message ?? "Failed to load template") } finally { @@ -74,6 +79,20 @@ export default function InspectionTemplateEditorPage() { } } + const saveTemplate = async () => { + if (!template) return + setSaving(true) + try { + const res = await api.inspectionTemplates.update(template.id, { name, description }) + setTemplate(res.data) + toast.success("Template saved") + } catch (e: any) { + toast.error(e?.message ?? "Failed to save") + } finally { + setSaving(false) + } + } + const addSection = async () => { if (!template) return const name = await prompt({ @@ -153,8 +172,8 @@ export default function InspectionTemplateEditorPage() {
e.currentTarget.value !== template.name && updateMeta({ name: e.currentTarget.value })} + value={name} + onChange={(e) => setName(e.target.value)} />
@@ -168,9 +187,9 @@ export default function InspectionTemplateEditorPage() {