import Link from "next/link"; import { ArrowLeft, ClipboardList } from "lucide-react"; import { serverAuth } from "@/lib/pb"; import { JobCardsTable, type JobRow } from "@/components/JobCardsTable"; export const dynamic = "force-dynamic"; /** * Job cards: the work mechanics log from the Plant Clock app. A mechanic scans a vehicle's * QR to start a job and scans it again to finish, giving the odometer, the kind of work * and a note. Time on the job is first scan to second scan. */ export default async function JobCardsPage() { const pb = await serverAuth(); const cards = await pb.collection("job_cards").getFullList({ expand: "asset", sort: "-started_at" }); const rows: JobRow[] = cards.map((j) => ({ id: j.id, startedAt: String(j.started_at || ""), endedAt: String(j.ended_at || ""), open: j.status === "open", asset: String(j.expand?.asset?.code || ""), assetName: String(j.expand?.asset?.name || ""), mechanic: String(j.mechanic_name || ""), type: String(j.job_type || ""), minutes: Number(j.duration_minutes || 0), odometer: j.status === "closed" && !j.no_meter ? Number(j.odometer || 0) : null, note: String(j.note || ""), })); return (
Work done on each vehicle, logged by mechanics in the Plant Clock app