Просмотр исходного кода

Stop rendering a bare 0 for vehicles without a year (#634)

* Stop rendering a bare 0 for vehicles without a year

A vehicle whose year nobody has entered is stored as 0, because the
column is a non-null integer. The vehicle form keeps years above 1900,
but restores of older backups and third-party imports can carry a 0 in,
and that 0 was printed in vehicle names everywhere the name was built
inline ("0 Ford Edge").

Names now go through a shared vehicleName() helper that leaves the year
out when it is 0 or missing, matching what work order titles, the Xero
mapping and the transcription already did. It also takes a separator,
so the dash-joined inspection certificate file names keep their shape.

* Truncate the observation vehicle label on small screens

The observation card in the dashboard's small-screen list shows the
full vehicle name when the vehicle has no plate; with the model now in
the name, that line nearly fills the card. The label now truncates
with an ellipsis, and the badge and the time keep their width. The
desktop table already truncated its vehicle cell.
Shadoweee77 3 дней назад
Родитель
Сommit
62a4faac06
75 измененных файлов с 289 добавлено и 232 удалено
  1. 39 0
      src/__tests__/lib/vehicle-name.test.ts
  2. 18 23
      src/app/(authenticated)/(dashboard)/dashboard-client.tsx
  3. 3 2
      src/app/(authenticated)/billing/billing-client.tsx
  4. 5 6
      src/app/(authenticated)/customers/[id]/customer-detail-client.tsx
  5. 3 4
      src/app/(authenticated)/inspections/inspections-client.tsx
  6. 4 5
      src/app/(authenticated)/observations/observations-client.tsx
  7. 3 2
      src/app/(authenticated)/quotes/quotes-client.tsx
  8. 2 2
      src/app/(authenticated)/reports/reports-client.tsx
  9. 2 1
      src/app/(authenticated)/tire-hotel/[id]/tire-set-client.tsx
  10. 3 4
      src/app/(authenticated)/tire-hotel/tire-hotel-client.tsx
  11. 7 8
      src/app/(authenticated)/vehicles/[id]/_classic/vehicle-detail-classic.tsx
  12. 6 5
      src/app/(authenticated)/vehicles/[id]/vehicle-detail-client.tsx
  13. 2 1
      src/app/(authenticated)/vehicles/inspection-reminders/[id]/campaign-detail.tsx
  14. 20 35
      src/app/(authenticated)/vehicles/vehicles-client.tsx
  15. 4 5
      src/app/(authenticated)/work-orders/work-orders-client.tsx
  16. 2 1
      src/app/(public)/p/[token]/page.tsx
  17. 2 1
      src/app/(public)/portal/[orgId]/vehicles/(list)/page.tsx
  18. 2 1
      src/app/(public)/portal/[orgId]/vehicles/[vehicleId]/page.tsx
  19. 2 3
      src/app/(public)/share/inspection/[orgId]/[token]/inspection-view.tsx
  20. 2 3
      src/app/(public)/share/invoice/[orgId]/[token]/invoice-view.tsx
  21. 2 1
      src/app/(public)/share/status-report/[orgId]/[token]/status-report-view.tsx
  22. 2 1
      src/app/api/protected/inspections/[id]/pdf/route.ts
  23. 2 1
      src/app/api/protected/vehicles/[id]/service-history-pdf/route.ts
  24. 2 3
      src/components/vehicle-picker-dialog.tsx
  25. 5 7
      src/features/ai/Lib/askAiContext.ts
  26. 4 3
      src/features/billing/Components/RecurringInvoicesClient.tsx
  27. 2 1
      src/features/calendar/Actions/calendarActions.ts
  28. 3 2
      src/features/dashboard/custom-cards/server-registry.ts
  29. 2 1
      src/features/email/Actions/emailActions.ts
  30. 2 1
      src/features/fault-codes/Lib/service.server.ts
  31. 2 1
      src/features/import/Lib/pipeline.ts
  32. 4 3
      src/features/inspection-reminders/Actions/bookingActions.ts
  33. 2 1
      src/features/inspection-reminders/Lib/candidates.ts
  34. 2 1
      src/features/inspections/Actions/inspectionActions.ts
  35. 2 3
      src/features/inspections/Components/InspectionPDF.tsx
  36. 4 5
      src/features/inspections/Components/InspectionPageClient.tsx
  37. 2 1
      src/features/inspections/Pdf/buildCertificatePdfBuffer.ts
  38. 2 1
      src/features/inspections/Pdf/buildCertificatePrint.ts
  39. 2 1
      src/features/inspections/Pdf/customerCertificatePdf.ts
  40. 2 3
      src/features/integrations/Actions/videoCallActions.ts
  41. 5 5
      src/features/integrations/Lib/vehicle-safety.ts
  42. 2 3
      src/features/invoice-designer/Pdf/buildInvoicePrint.ts
  43. 2 3
      src/features/invoice-designer/Pdf/buildQuotePrint.ts
  44. 2 3
      src/features/invoice-designer/Pdf/buildWorkOrderPrint.ts
  45. 2 1
      src/features/portal/Actions/portalActions.ts
  46. 2 4
      src/features/quotes/Components/QuoteRightColumn.tsx
  47. 3 2
      src/features/quotes/Components/VehicleCombobox.tsx
  48. 2 1
      src/features/reports/Components/ReportPDF.tsx
  49. 2 1
      src/features/reports/Components/csv-export.ts
  50. 2 1
      src/features/search/Components/SearchCommand.tsx
  51. 2 1
      src/features/status-reports/Actions/sendStatusReport.ts
  52. 2 3
      src/features/tire-hotel/Components/CheckInDialog.tsx
  53. 2 1
      src/features/tire-hotel/Components/OwnerVehicleFields.tsx
  54. 2 1
      src/features/vehicles/Actions/inspectionStatusActions.ts
  55. 3 2
      src/features/vehicles/Actions/vehicleActions.ts
  56. 3 6
      src/features/vehicles/Components/MyActiveJobs.tsx
  57. 3 2
      src/features/vehicles/Components/ReminderFormDialog.tsx
  58. 2 1
      src/features/vehicles/Components/RemindersPageClient.tsx
  59. 2 1
      src/features/vehicles/Components/VehicleSafetyPanel.tsx
  60. 2 1
      src/features/vehicles/Components/service-history-pdf/ServiceHistoryPDF.tsx
  61. 3 6
      src/features/vehicles/Components/service-page/ServicePageClient.tsx
  62. 3 2
      src/features/vehicles/Components/service-page/modern/JobFactsCard.tsx
  63. 2 5
      src/features/vehicles/Components/service-page/modern/ModernDetails.tsx
  64. 2 1
      src/features/vehicles/Components/service-page/modern/ModernHero.tsx
  65. 2 3
      src/features/vehicles/Components/service-page/useServiceFormState.ts
  66. 3 2
      src/features/workboard/Components/BoardJobCard.tsx
  67. 2 1
      src/features/workboard/Components/JobDetailPopover.tsx
  68. 2 3
      src/features/workboard/Components/JobTooltip.tsx
  69. 2 1
      src/features/workboard/Components/PresenterKanbanView.tsx
  70. 3 2
      src/features/workboard/Components/WeekCardGrid.tsx
  71. 3 2
      src/lib/ai.ts
  72. 3 6
      src/lib/backup/explore.ts
  73. 2 1
      src/lib/cron/appointment-notifications.ts
  74. 2 1
      src/lib/cron/reminder-alerts.ts
  75. 27 0
      src/lib/vehicle-name.ts

+ 39 - 0
src/__tests__/lib/vehicle-name.test.ts

@@ -0,0 +1,39 @@
+import { describe, expect, it } from 'vitest'
+import { vehicleName } from '@/lib/vehicle-name'
+
+/**
+ * A vehicle whose year nobody has entered is stored with a year of 0 (the
+ * column is a non-null integer). The form keeps years above 1900, so only
+ * restores of older backups or third-party imports can carry a 0 in, but
+ * those rows stay in the workshop, and the name must not read that 0 as a
+ * year ("0 Ford Edge").
+ */
+describe('vehicleName', () => {
+  it('joins the known pieces with a space', () => {
+    expect(vehicleName({ year: 2021, make: 'Toyota', model: 'Camry' })).toBe('2021 Toyota Camry')
+  })
+
+  it('leaves a zero year out instead of reading it as a year', () => {
+    expect(vehicleName({ year: 0, make: 'Ford', model: 'Edge' })).toBe('Ford Edge')
+  })
+
+  it('leaves a missing or null year out', () => {
+    expect(vehicleName({ make: 'Ford', model: 'Edge' })).toBe('Ford Edge')
+    expect(vehicleName({ year: null, make: 'Ford', model: 'Edge' })).toBe('Ford Edge')
+  })
+
+  it('drops empty pieces, whatever is left', () => {
+    expect(vehicleName({ year: 0, make: '', model: 'Edge' })).toBe('Edge')
+    expect(vehicleName({})).toBe('')
+  })
+
+  it('reads a year stored as text the same way', () => {
+    expect(vehicleName({ year: '2021', make: 'Toyota', model: 'Camry' })).toBe('2021 Toyota Camry')
+    expect(vehicleName({ year: '0', make: 'Ford', model: 'Edge' })).toBe('Ford Edge')
+  })
+
+  it('honours a separator, as the dash-joined certificate names do', () => {
+    expect(vehicleName({ year: 0, make: 'Ford', model: 'Edge' }, '-')).toBe('Ford-Edge')
+    expect(vehicleName({ year: 2015, make: 'Ford', model: 'Edge' }, '-')).toBe('2015-Ford-Edge')
+  })
+})

+ 18 - 23
src/app/(authenticated)/(dashboard)/dashboard-client.tsx

@@ -104,6 +104,7 @@ import { isEventDone } from '@/features/calendar/Components/calendar-utils'
 import type { CalendarEvent } from '@/features/calendar/Actions/calendarActions'
 import { ServiceRequestFiles } from '@/features/portal/Components/ServiceRequestFiles'
 import type { RequestTextParts } from '@/features/portal/Lib/requestText'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface ServiceItem {
   id: string
@@ -802,9 +803,7 @@ export function DashboardClient({
                               )}
                             </div>
                             <div className="min-w-0">
-                              <p className="font-medium text-sm truncate">
-                                {v.year} {v.make} {v.model}
-                              </p>
+                              <p className="font-medium text-sm truncate">{vehicleName(v)}</p>
                               <p className="text-xs text-muted-foreground truncate">
                                 {v.licensePlate && `${v.licensePlate} · `}
                                 {t('maintenance.estimated', {
@@ -877,9 +876,7 @@ export function DashboardClient({
                             <EyeOff className="h-4 w-4 text-muted-foreground" />
                           </div>
                           <div className="min-w-0">
-                            <p className="font-medium text-sm truncate">
-                              {v.year} {v.make} {v.model}
-                            </p>
+                            <p className="font-medium text-sm truncate">{vehicleName(v)}</p>
                             <p className="text-xs text-muted-foreground truncate">
                               {v.licensePlate && `${v.licensePlate} · `}
                               {v.dismissedAt &&
@@ -991,7 +988,7 @@ export function DashboardClient({
                               <p className="font-medium text-sm truncate">{r.title}</p>
                               <p className="text-xs text-muted-foreground truncate">
                                 {r.vehicle
-                                  ? `${r.vehicle.year} ${r.vehicle.make} ${r.vehicle.model}${r.vehicle.licensePlate ? ` · ${r.vehicle.licensePlate}` : ''}`
+                                  ? `${vehicleName(r.vehicle)}${r.vehicle.licensePlate ? ` · ${r.vehicle.licensePlate}` : ''}`
                                   : (r.customer?.name ?? '')}
                               </p>
                             </div>
@@ -1174,7 +1171,7 @@ export function DashboardClient({
                             </div>
                             <div className="min-w-0">
                               <p className="font-medium text-sm truncate">
-                                {insp.vehicle.year} {insp.vehicle.make} {insp.vehicle.model}
+                                {vehicleName(insp.vehicle)}
                               </p>
                               <p className="text-xs text-muted-foreground truncate">
                                 {insp.vehicle.licensePlate && `${insp.vehicle.licensePlate} · `}
@@ -1225,7 +1222,7 @@ export function DashboardClient({
                             </div>
                             <div className="min-w-0">
                               <p className="font-medium text-sm truncate">
-                                {insp.vehicle.year} {insp.vehicle.make} {insp.vehicle.model}
+                                {vehicleName(insp.vehicle)}
                               </p>
                               <p className="text-xs text-muted-foreground truncate">
                                 {insp.vehicle.licensePlate && `${insp.vehicle.licensePlate} · `}
@@ -1296,7 +1293,7 @@ export function DashboardClient({
                           <div className="min-w-0">
                             <p className="truncate text-sm font-medium">
                               {req.vehicle
-                                ? `${req.vehicle.year} ${req.vehicle.make} ${req.vehicle.model}`
+                                ? `${vehicleName(req.vehicle)}`
                                 : (req.customer?.name ?? '')}
                             </p>
                             <p className="truncate text-xs text-muted-foreground">
@@ -1395,8 +1392,7 @@ export function DashboardClient({
                             </div>
                             <div className="min-w-0">
                               <p className="font-medium text-sm truncate">
-                                {req.inspection.vehicle.year} {req.inspection.vehicle.make}{' '}
-                                {req.inspection.vehicle.model}
+                                {vehicleName(req.inspection.vehicle)}
                               </p>
                               <p className="text-xs text-muted-foreground truncate">
                                 {req.inspection.vehicle.customer?.name &&
@@ -1421,7 +1417,7 @@ export function DashboardClient({
                                     (i) => i.condition === 'fail' || i.condition === 'attention'
                                   )
                                   const result = await createQuote({
-                                    title: `${req.inspection.vehicle.year} ${req.inspection.vehicle.make} ${req.inspection.vehicle.model} - Inspection Quote`,
+                                    title: `${vehicleName(req.inspection.vehicle)} - Inspection Quote`,
                                     vehicleId: req.inspection.vehicle.id,
                                     customerId: req.inspection.vehicle.customer?.id || undefined,
                                     inspectionId: req.inspection.id,
@@ -1674,7 +1670,7 @@ export function DashboardClient({
                                   {s.vehicle.licensePlate && (
                                     <span className="font-mono">{s.vehicle.licensePlate} · </span>
                                   )}
-                                  {s.vehicle.year} {s.vehicle.make} {s.vehicle.model}
+                                  {vehicleName(s.vehicle)}
                                 </>
                               )}
                               {rowCustomer && ` · ${rowCustomer.name}`}
@@ -1733,7 +1729,7 @@ export function DashboardClient({
                                             </span>
                                           )}
                                           <p className="text-xs text-muted-foreground">
-                                            {s.vehicle.year} {s.vehicle.make} {s.vehicle.model}
+                                            {vehicleName(s.vehicle)}
                                           </p>
                                         </TableCellLink>
                                       ) : (
@@ -1860,7 +1856,7 @@ export function DashboardClient({
                                   {s.vehicle.licensePlate && (
                                     <span className="font-mono">{s.vehicle.licensePlate} · </span>
                                   )}
-                                  {s.vehicle.year} {s.vehicle.make} {s.vehicle.model}
+                                  {vehicleName(s.vehicle)}
                                 </>
                               )}
                               {rowCustomer && ` · ${rowCustomer.name}`}
@@ -1911,7 +1907,7 @@ export function DashboardClient({
                                             </span>
                                           )}
                                           <p className="text-xs text-muted-foreground">
-                                            {s.vehicle.year} {s.vehicle.make} {s.vehicle.model}
+                                            {vehicleName(s.vehicle)}
                                           </p>
                                         </TableCellLink>
                                       ) : (
@@ -2088,15 +2084,14 @@ export function DashboardClient({
                           <div className="mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1">
                             <Badge
                               variant="outline"
-                              className={`px-1.5 py-0 text-[10px] ${observationSeverityColors[obs.severity] || ''}`}
+                              className={`shrink-0 px-1.5 py-0 text-[10px] ${observationSeverityColors[obs.severity] || ''}`}
                             >
                               {obs.severity}
                             </Badge>
-                            <span className="font-mono text-[11px] text-muted-foreground">
-                              {obs.vehicle.licensePlate ??
-                                `${obs.vehicle.year} ${obs.vehicle.make}`}
+                            <span className="min-w-0 max-w-full truncate font-mono text-[11px] text-muted-foreground">
+                              {obs.vehicle.licensePlate ?? `${vehicleName(obs.vehicle)}`}
                             </span>
-                            <span className="text-[11px] text-muted-foreground">
+                            <span className="shrink-0 text-[11px] text-muted-foreground">
                               {formatRelativeTime(obs.createdAt)}
                             </span>
                           </div>
@@ -2119,7 +2114,7 @@ export function DashboardClient({
                         <TableBody>
                           {recentObservations.map((obs) => {
                             const vehicleLabel =
-                              obs.vehicle.licensePlate ?? `${obs.vehicle.year} ${obs.vehicle.make}`
+                              obs.vehicle.licensePlate ?? `${vehicleName(obs.vehicle)}`
                             return (
                               <ContextMenu key={obs.id} modal={false}>
                                 <ContextMenuTrigger asChild>

+ 3 - 2
src/app/(authenticated)/billing/billing-client.tsx

@@ -44,6 +44,7 @@ import { useRememberedSort } from '@/hooks/use-remembered-sort'
 import { LIST_STATUS_TABS, type ListStatus, rememberListStatus } from '@/lib/list-status-preference'
 import { rememberCompletedOnly } from '@/lib/completed-only-preference'
 import { ListEmpty } from '@/components/list-empty'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface BillingRecord {
   id: string
@@ -481,7 +482,7 @@ export default function BillingClient({
                   <div className="mt-1 space-y-0.5 text-xs text-muted-foreground">
                     {record.vehicle && (
                       <p className="truncate">
-                        {record.vehicle.year} {record.vehicle.make} {record.vehicle.model}
+                        {vehicleName(record.vehicle)}
                         {record.vehicle.licensePlate && ` · ${record.vehicle.licensePlate}`}
                       </p>
                     )}
@@ -612,7 +613,7 @@ export default function BillingClient({
                     <TableCell className="truncate">
                       {record.vehicle ? (
                         <TableCellLink href={`/vehicles/${record.vehicle.id}`}>
-                          {record.vehicle.year} {record.vehicle.make} {record.vehicle.model}
+                          {vehicleName(record.vehicle)}
                         </TableCellLink>
                       ) : (
                         '\u2014'

+ 5 - 6
src/app/(authenticated)/customers/[id]/customer-detail-client.tsx

@@ -77,6 +77,7 @@ import { toast } from 'sonner'
 import { useServiceLabels } from '@/features/vehicles/Lib/useServiceLabels'
 import { ServiceRequestFiles } from '@/features/portal/Components/ServiceRequestFiles'
 import type { RequestTextParts } from '@/features/portal/Lib/requestText'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface ServiceRequestItem {
   id: string
@@ -611,7 +612,7 @@ export function CustomerDetailClient({
                     >
                       <div className="flex items-start justify-between gap-3">
                         <span className="min-w-0 flex-1 truncate font-medium">
-                          {v.year} {v.make} {v.model}
+                          {vehicleName(v)}
                         </span>
                         {v.licensePlate && (
                           <span className="shrink-0 font-mono text-sm">{v.licensePlate}</span>
@@ -660,9 +661,7 @@ export function CustomerDetailClient({
                           <TableCell className="font-mono text-sm">
                             {v.licensePlate || '-'}
                           </TableCell>
-                          <TableCell className="font-medium">
-                            {v.year} {v.make} {v.model}
-                          </TableCell>
+                          <TableCell className="font-medium">{vehicleName(v)}</TableCell>
                           <TableCell className="hidden sm:table-cell text-right font-mono text-sm">
                             {v.mileage.toLocaleString()} {readingUnit}
                           </TableCell>
@@ -898,7 +897,7 @@ function DocumentList({
   const tableNav = useTableKeyboardNav()
 
   const vehicleLabel = useCallback(
-    (v: DocumentRow['vehicle']) => (v ? `${v.year} ${v.make} ${v.model}` : ''),
+    (v: DocumentRow['vehicle']) => (v ? `${vehicleName(v)}` : ''),
     []
   )
 
@@ -1175,7 +1174,7 @@ export function ServiceRequestCard({
   }
 
   const canSms = smsEnabled && !!customerPhone
-  const vehicleDisplay = `${request.vehicle.year} ${request.vehicle.make} ${request.vehicle.model}`
+  const vehicleDisplay = `${vehicleName(request.vehicle)}`
   // A request from the portal can start with the quick choice the customer picked.
   const words = request.words ?? { topic: null, body: request.description }
 

+ 3 - 4
src/app/(authenticated)/inspections/inspections-client.tsx

@@ -52,6 +52,7 @@ import {
 import { useConditionLabels } from '@/features/inspections/Lib/useConditionLabels'
 import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
 import { ListEmpty } from '@/components/list-empty'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface InspectionRecord {
   id: string
@@ -333,7 +334,7 @@ export function InspectionsClient({
               >
                 <div className="flex items-start justify-between gap-3">
                   <span className="min-w-0 flex-1 truncate font-medium">
-                    {insp.vehicle.year} {insp.vehicle.make} {insp.vehicle.model}
+                    {vehicleName(insp.vehicle)}
                   </span>
                   <StatusBadge kind="inspection" status={insp.status} className="shrink-0">
                     {insp.status === 'in_progress' ? t('statusInProgress') : t('statusCompleted')}
@@ -431,9 +432,7 @@ export function InspectionsClient({
                     >
                       <TableCell>
                         <TableCellLink href={`/vehicles/${insp.vehicle.id}`} block>
-                          <p className="truncate font-medium">
-                            {insp.vehicle.year} {insp.vehicle.make} {insp.vehicle.model}
-                          </p>
+                          <p className="truncate font-medium">{vehicleName(insp.vehicle)}</p>
                           {insp.vehicle.licensePlate && (
                             <p className="text-xs text-muted-foreground font-mono">
                               {insp.vehicle.licensePlate}

+ 4 - 5
src/app/(authenticated)/observations/observations-client.tsx

@@ -33,6 +33,7 @@ import { TableContextMenuHint } from '@/components/table-context-menu-hint'
 import { TableCellLink } from '@/components/table-cell-link'
 import { useFormatDate } from '@/lib/use-format-date'
 import { Car, ExternalLink, Search, Loader2 } from 'lucide-react'
+import { vehicleName } from '@/lib/vehicle-name'
 
 type ObservationsData = {
   records: {
@@ -184,7 +185,7 @@ export function ObservationsClient({
                     {obs.vehicle.licensePlate}{' '}
                   </span>
                 )}
-                {obs.vehicle.year} {obs.vehicle.make} {obs.vehicle.model}
+                {vehicleName(obs.vehicle)}
               </p>
               <div className="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1.5">
                 <Badge
@@ -238,9 +239,7 @@ export function ObservationsClient({
               </TableRow>
             ) : (
               data.records.map((obs) => {
-                const vehicleLabel =
-                  obs.vehicle.licensePlate ??
-                  `${obs.vehicle.year} ${obs.vehicle.make} ${obs.vehicle.model}`
+                const vehicleLabel = obs.vehicle.licensePlate ?? `${vehicleName(obs.vehicle)}`
                 return (
                   <ContextMenu key={obs.id} modal={false}>
                     <ContextMenuTrigger asChild>
@@ -283,7 +282,7 @@ export function ObservationsClient({
                             </span>
                             {obs.vehicle.licensePlate && (
                               <span className="block text-[11px] text-muted-foreground">
-                                {obs.vehicle.year} {obs.vehicle.make} {obs.vehicle.model}
+                                {vehicleName(obs.vehicle)}
                               </span>
                             )}
                           </TableCellLink>

+ 3 - 2
src/app/(authenticated)/quotes/quotes-client.tsx

@@ -54,6 +54,7 @@ import {
 import { useFormatCurrency } from '@/components/currency-settings-context'
 import { NewQuoteDialog } from '@/features/quotes/Components/NewQuoteDialog'
 import { ListEmpty } from '@/components/list-empty'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface QuoteRecord {
   id: string
@@ -293,7 +294,7 @@ export function QuotesClient({
                     {q.vehicle && (
                       <p className="flex items-center gap-1.5 truncate">
                         <Car className="h-3 w-3 shrink-0" />
-                        {q.vehicle.year} {q.vehicle.make} {q.vehicle.model}
+                        {vehicleName(q.vehicle)}
                         {q.vehicle.licensePlate && ` · ${q.vehicle.licensePlate}`}
                       </p>
                     )}
@@ -425,7 +426,7 @@ export function QuotesClient({
                       <TableCell className="hidden truncate lg:table-cell text-muted-foreground">
                         {q.vehicle ? (
                           <TableCellLink href={`/vehicles/${q.vehicle.id}`}>
-                            {q.vehicle.year} {q.vehicle.make} {q.vehicle.model}
+                            {vehicleName(q.vehicle)}
                           </TableCellLink>
                         ) : (
                           '-'

+ 2 - 2
src/app/(authenticated)/reports/reports-client.tsx

@@ -124,6 +124,7 @@ import {
 import { ReportPDF } from '@/features/reports/Components/ReportPDF'
 import { pdf } from '@react-pdf/renderer'
 import { useServiceLabels } from '@/features/vehicles/Lib/useServiceLabels'
+import { vehicleName } from '@/lib/vehicle-name'
 
 type ReportTab =
   | 'financial'
@@ -2442,8 +2443,7 @@ export default function ReportsClient({
                     </div>
                     <div className="min-w-0">
                       <p className="text-base font-semibold">
-                        {vehicleData.vehicleInfo.year} {vehicleData.vehicleInfo.make}{' '}
-                        {vehicleData.vehicleInfo.model}
+                        {vehicleName(vehicleData.vehicleInfo)}
                       </p>
                       <p className="text-xs text-muted-foreground">
                         {[

+ 2 - 1
src/app/(authenticated)/tire-hotel/[id]/tire-set-client.tsx

@@ -55,6 +55,7 @@ import {
   User,
   Warehouse,
 } from 'lucide-react'
+import { vehicleName } from '@/lib/vehicle-name'
 
 type Measurement = {
   id: string
@@ -273,7 +274,7 @@ export function TireSetClient({
   }
 
   const title = set.vehicle
-    ? `${set.vehicle.year} ${set.vehicle.make} ${set.vehicle.model}`
+    ? `${vehicleName(set.vehicle)}`
     : (set.customer?.name ?? t('list.unassigned'))
 
   return (

+ 3 - 4
src/app/(authenticated)/tire-hotel/tire-hotel-client.tsx

@@ -49,6 +49,7 @@ import {
   TrendingUp,
   Warehouse,
 } from 'lucide-react'
+import { vehicleName } from '@/lib/vehicle-name'
 
 type TireSetRecord = {
   id: string
@@ -255,7 +256,7 @@ export function TireHotelClient({
               <div className="flex items-start justify-between gap-3">
                 <span className="min-w-0 flex-1 truncate font-medium">
                   {set.vehicle
-                    ? `${set.vehicle.year} ${set.vehicle.make} ${set.vehicle.model}`
+                    ? `${vehicleName(set.vehicle)}`
                     : (set.customer?.name ?? t('list.unassigned'))}
                 </span>
                 <Badge
@@ -340,9 +341,7 @@ export function TireHotelClient({
                       <TableCell>
                         {set.vehicle ? (
                           <TableCellLink href={`/vehicles/${set.vehicle.id}`} block>
-                            <p className="truncate font-medium">
-                              {set.vehicle.year} {set.vehicle.make} {set.vehicle.model}
-                            </p>
+                            <p className="truncate font-medium">{vehicleName(set.vehicle)}</p>
                             {set.vehicle.licensePlate && (
                               <p className="font-mono text-xs text-muted-foreground">
                                 {set.vehicle.licensePlate}

+ 7 - 8
src/app/(authenticated)/vehicles/[id]/_classic/vehicle-detail-classic.tsx

@@ -100,6 +100,7 @@ import { formatTypeKey } from '@/features/vehicles/Lib/typeKey'
 import { useTypeKeyEnabled } from '@/components/type-key-context'
 import { sanitizeHtml } from '@/lib/sanitize-html'
 import { useSwitchVehiclePageLayout } from '@/features/vehicles/Components/VehiclePageLayoutSwitch'
+import { vehicleName as vehicleNameOf } from '@/lib/vehicle-name'
 
 interface PaginatedServices {
   records: {
@@ -486,7 +487,7 @@ export function VehicleDetailClassic({
   const handleCreateWorkOrderFromFindings = async (findingIds: string[]) => {
     setCreatingWorkOrder(true)
     const selectedFindings = paginatedFindings.records.filter((f) => findingIds.includes(f.id))
-    const vehicleName = `${vehicle.year} ${vehicle.make} ${vehicle.model}`
+    const vehicleName = `${vehicleNameOf(vehicle)}`
     // An action that cannot reach the server throws instead of answering, so
     // it is caught and reported the way a refusal is.
     const result = await createServiceRecord({
@@ -577,7 +578,7 @@ export function VehicleDetailClassic({
   }
 
   const handleDelete = async () => {
-    const name = `${vehicle.year} ${vehicle.make} ${vehicle.model}`
+    const name = `${vehicleNameOf(vehicle)}`
     const ok = await confirm({
       title: t('deleteTitle'),
       description: t('deleteDescription', { name }),
@@ -689,9 +690,7 @@ export function VehicleDetailClassic({
           )}
           <div className="min-w-0 flex-1">
             <div className="flex flex-wrap items-baseline gap-x-2 gap-y-0.5">
-              <h1 className="text-lg font-bold leading-tight">
-                {vehicle.year} {vehicle.make} {vehicle.model}
-              </h1>
+              <h1 className="text-lg font-bold leading-tight">{vehicleNameOf(vehicle)}</h1>
               <div className="flex min-w-0 flex-wrap items-center gap-x-2 text-xs text-muted-foreground">
                 {vehicle.licensePlate && <span className="font-mono">{vehicle.licensePlate}</span>}
                 {vehicle.vin && (
@@ -927,7 +926,7 @@ export function VehicleDetailClassic({
           {aiEnabled && (
             <AskAiSheet
               subject={{ type: 'vehicle', id: vehicle.id }}
-              title={`${vehicle.year} ${vehicle.make} ${vehicle.model}`}
+              title={`${vehicleNameOf(vehicle)}`}
               className="h-7 text-xs"
             />
           )}
@@ -1836,7 +1835,7 @@ export function VehicleDetailClassic({
         open={showArchiveDialog}
         onOpenChange={setShowArchiveDialog}
         vehicleId={vehicle.id}
-        vehicleName={`${vehicle.year} ${vehicle.make} ${vehicle.model}`}
+        vehicleName={`${vehicleNameOf(vehicle)}`}
       />
 
       {/* Image lightbox */}
@@ -1848,7 +1847,7 @@ export function VehicleDetailClassic({
         >
           <img
             src={vehicle.imageUrl}
-            alt={`${vehicle.year} ${vehicle.make} ${vehicle.model}`}
+            alt={`${vehicleNameOf(vehicle)}`}
             className="max-h-[90vh] max-w-[90vw] rounded-lg object-contain"
             onClick={(e) => e.stopPropagation()}
           />

+ 6 - 5
src/app/(authenticated)/vehicles/[id]/vehicle-detail-client.tsx

@@ -108,6 +108,7 @@ import { FeatureHint } from '@/components/feature-hint'
 import { CopyValue } from '@/components/copy-value'
 import { StatusLamp, type LampTone } from '@/components/status-lamp'
 import { cn } from '@/lib/utils'
+import { vehicleName as vehicleNameOf } from '@/lib/vehicle-name'
 
 interface PaginatedServices {
   records: {
@@ -608,7 +609,7 @@ export function VehicleDetailClient({
     }
   }
 
-  const vehicleName = `${vehicle.year} ${vehicle.make} ${vehicle.model}`
+  const vehicleName = `${vehicleNameOf(vehicle)}`
   const VehicleIcon = isMarine ? Ship : Car
 
   // Without a lifetime total from the server, the latest ten are the best guess.
@@ -795,7 +796,7 @@ export function VehicleDetailClient({
   const handleCreateWorkOrderFromFindings = async (findingIds: string[]) => {
     setCreatingWorkOrder(true)
     const selectedFindings = paginatedFindings.records.filter((f) => findingIds.includes(f.id))
-    const vehicleName = `${vehicle.year} ${vehicle.make} ${vehicle.model}`
+    const vehicleName = `${vehicleNameOf(vehicle)}`
     // An action that cannot reach the server throws instead of answering, so
     // it is caught and reported the way a refusal is.
     const result = await createServiceRecord({
@@ -885,7 +886,7 @@ export function VehicleDetailClient({
   }
 
   const handleDelete = async () => {
-    const name = `${vehicle.year} ${vehicle.make} ${vehicle.model}`
+    const name = `${vehicleNameOf(vehicle)}`
     const ok = await confirm({
       title: t('deleteTitle'),
       description: t('deleteDescription', { name }),
@@ -2510,7 +2511,7 @@ export function VehicleDetailClient({
         open={showArchiveDialog}
         onOpenChange={setShowArchiveDialog}
         vehicleId={vehicle.id}
-        vehicleName={`${vehicle.year} ${vehicle.make} ${vehicle.model}`}
+        vehicleName={`${vehicleNameOf(vehicle)}`}
       />
 
       {/* Image lightbox */}
@@ -2522,7 +2523,7 @@ export function VehicleDetailClient({
         >
           <img
             src={vehicle.imageUrl}
-            alt={`${vehicle.year} ${vehicle.make} ${vehicle.model}`}
+            alt={`${vehicleNameOf(vehicle)}`}
             className="max-h-[90vh] max-w-[90vw] rounded-lg object-contain"
             onClick={(e) => e.stopPropagation()}
           />

+ 2 - 1
src/app/(authenticated)/vehicles/inspection-reminders/[id]/campaign-detail.tsx

@@ -15,6 +15,7 @@ import {
   retryFailedInspectionReminders,
 } from '@/features/inspection-reminders/Actions/inspectionReminderActions'
 import { useFormatDate } from '@/lib/use-format-date'
+import { vehicleName } from '@/lib/vehicle-name'
 
 type Campaign = NonNullable<Awaited<ReturnType<typeof getInspectionReminderCampaign>>['data']>
 
@@ -95,7 +96,7 @@ export function CampaignDetail({ campaign }: { campaign: Campaign }) {
               <div key={s.id} className="flex flex-wrap items-center gap-3 px-5 py-2.5 text-sm">
                 <span className="min-w-0 flex-1 truncate">
                   <TableCellLink href={`/vehicles/${s.vehicle.id}`}>
-                    {s.vehicle.year} {s.vehicle.make} {s.vehicle.model}
+                    {vehicleName(s.vehicle)}
                   </TableCellLink>
                   {s.vehicle.licensePlate && (
                     <span className="ml-2 font-mono text-xs text-muted-foreground">

+ 20 - 35
src/app/(authenticated)/vehicles/vehicles-client.tsx

@@ -71,6 +71,7 @@ import { useTranslations } from 'next-intl'
 import { useFormatDate } from '@/lib/use-format-date'
 import { useServiceType } from '@/components/service-type-context'
 import { ListEmpty } from '@/components/list-empty'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface Vehicle {
   id: string
@@ -466,9 +467,7 @@ export function VehiclesClient({
                   onClick={() => router.push(`/vehicles/${v.id}`)}
                 >
                   <div className="flex items-start justify-between gap-3">
-                    <span className="min-w-0 flex-1 truncate font-medium">
-                      {v.year} {v.make} {v.model}
-                    </span>
+                    <span className="min-w-0 flex-1 truncate font-medium">{vehicleName(v)}</span>
                     {v.licensePlate && (
                       <span className="shrink-0 font-mono text-sm">{v.licensePlate}</span>
                     )}
@@ -514,17 +513,13 @@ export function VehiclesClient({
                       </DropdownMenuItem>
                     )}
                     {isArchived ? (
-                      <DropdownMenuItem
-                        onClick={() => handleUnarchive(v.id, `${v.year} ${v.make} ${v.model}`)}
-                      >
+                      <DropdownMenuItem onClick={() => handleUnarchive(v.id, `${vehicleName(v)}`)}>
                         <ArchiveRestore className="mr-2 h-4 w-4" />
                         {t('unarchive')}
                       </DropdownMenuItem>
                     ) : (
                       <DropdownMenuItem
-                        onClick={() =>
-                          setArchiveTarget({ id: v.id, name: `${v.year} ${v.make} ${v.model}` })
-                        }
+                        onClick={() => setArchiveTarget({ id: v.id, name: `${vehicleName(v)}` })}
                       >
                         <Archive className="mr-2 h-4 w-4" />
                         {t('archive')}
@@ -532,7 +527,7 @@ export function VehiclesClient({
                     )}
                     <DropdownMenuItem
                       className="text-destructive"
-                      onClick={() => handleDelete(v.id, `${v.year} ${v.make} ${v.model}`)}
+                      onClick={() => handleDelete(v.id, `${vehicleName(v)}`)}
                     >
                       <Trash2 className="mr-2 h-4 w-4" />
                       {t('delete')}
@@ -618,9 +613,7 @@ export function VehiclesClient({
                       >
                         <TableCell className="font-mono text-sm">{v.licensePlate || '-'}</TableCell>
                         <TableCell className="truncate">
-                          <span className="font-medium">
-                            {v.year} {v.make} {v.model}
-                          </span>
+                          <span className="font-medium">{vehicleName(v)}</span>
                           {v.inspectionStatus?.dueAt && (
                             <span
                               className={`ml-2 rounded border px-1.5 py-0.5 font-sans text-xs ${INSPECTION_TONE_CLASS[inspectionTone(v.inspectionStatus.dueAt)]}`}
@@ -671,7 +664,7 @@ export function VehiclesClient({
                                 <DropdownMenuItem
                                   onClick={(e) => {
                                     e.stopPropagation()
-                                    handleUnarchive(v.id, `${v.year} ${v.make} ${v.model}`)
+                                    handleUnarchive(v.id, `${vehicleName(v)}`)
                                   }}
                                 >
                                   <ArchiveRestore className="mr-2 h-4 w-4" />
@@ -683,7 +676,7 @@ export function VehiclesClient({
                                     e.stopPropagation()
                                     setArchiveTarget({
                                       id: v.id,
-                                      name: `${v.year} ${v.make} ${v.model}`,
+                                      name: `${vehicleName(v)}`,
                                     })
                                   }}
                                 >
@@ -695,7 +688,7 @@ export function VehiclesClient({
                                 className="text-destructive"
                                 onClick={(e) => {
                                   e.stopPropagation()
-                                  handleDelete(v.id, `${v.year} ${v.make} ${v.model}`)
+                                  handleDelete(v.id, `${vehicleName(v)}`)
                                 }}
                               >
                                 <Trash2 className="mr-2 h-4 w-4" />
@@ -732,17 +725,13 @@ export function VehiclesClient({
                         </ContextMenuItem>
                       )}
                       {isArchived ? (
-                        <ContextMenuItem
-                          onClick={() => handleUnarchive(v.id, `${v.year} ${v.make} ${v.model}`)}
-                        >
+                        <ContextMenuItem onClick={() => handleUnarchive(v.id, `${vehicleName(v)}`)}>
                           <ArchiveRestore className="mr-2 h-4 w-4" />
                           {t('unarchive')}
                         </ContextMenuItem>
                       ) : (
                         <ContextMenuItem
-                          onClick={() =>
-                            setArchiveTarget({ id: v.id, name: `${v.year} ${v.make} ${v.model}` })
-                          }
+                          onClick={() => setArchiveTarget({ id: v.id, name: `${vehicleName(v)}` })}
                         >
                           <Archive className="mr-2 h-4 w-4" />
                           {t('archive')}
@@ -750,7 +739,7 @@ export function VehiclesClient({
                       )}
                       <ContextMenuItem
                         variant="destructive"
-                        onClick={() => handleDelete(v.id, `${v.year} ${v.make} ${v.model}`)}
+                        onClick={() => handleDelete(v.id, `${vehicleName(v)}`)}
                       >
                         <Trash2 className="mr-2 h-4 w-4" />
                         {t('delete')}
@@ -795,7 +784,7 @@ export function VehiclesClient({
                     <div className="relative aspect-[16/10] overflow-hidden bg-muted">
                       <Image
                         src={v.imageUrl || '/car_placeholder.avif'}
-                        alt={`${v.year} ${v.make} ${v.model}`}
+                        alt={`${vehicleName(v)}`}
                         fill
                         unoptimized
                         className="object-cover transition-transform duration-300 group-hover:scale-105"
@@ -807,7 +796,7 @@ export function VehiclesClient({
                         <h3
                           className={`font-bold text-white drop-shadow-sm ${view === 'grid6' ? 'text-sm' : 'text-lg'}`}
                         >
-                          {v.year} {v.make} {v.model}
+                          {vehicleName(v)}
                         </h3>
                         {v.licensePlate && (
                           <p
@@ -847,7 +836,7 @@ export function VehiclesClient({
                               <DropdownMenuItem
                                 onClick={(e) => {
                                   e.preventDefault()
-                                  handleUnarchive(v.id, `${v.year} ${v.make} ${v.model}`)
+                                  handleUnarchive(v.id, `${vehicleName(v)}`)
                                 }}
                               >
                                 <ArchiveRestore className="mr-2 h-4 w-4" />
@@ -859,7 +848,7 @@ export function VehiclesClient({
                                   e.preventDefault()
                                   setArchiveTarget({
                                     id: v.id,
-                                    name: `${v.year} ${v.make} ${v.model}`,
+                                    name: `${vehicleName(v)}`,
                                   })
                                 }}
                               >
@@ -871,7 +860,7 @@ export function VehiclesClient({
                               className="text-destructive"
                               onClick={(e) => {
                                 e.preventDefault()
-                                handleDelete(v.id, `${v.year} ${v.make} ${v.model}`)
+                                handleDelete(v.id, `${vehicleName(v)}`)
                               }}
                             >
                               <Trash2 className="mr-2 h-4 w-4" />
@@ -935,17 +924,13 @@ export function VehiclesClient({
                   </ContextMenuItem>
                 )}
                 {isArchived ? (
-                  <ContextMenuItem
-                    onClick={() => handleUnarchive(v.id, `${v.year} ${v.make} ${v.model}`)}
-                  >
+                  <ContextMenuItem onClick={() => handleUnarchive(v.id, `${vehicleName(v)}`)}>
                     <ArchiveRestore className="mr-2 h-4 w-4" />
                     {t('unarchive')}
                   </ContextMenuItem>
                 ) : (
                   <ContextMenuItem
-                    onClick={() =>
-                      setArchiveTarget({ id: v.id, name: `${v.year} ${v.make} ${v.model}` })
-                    }
+                    onClick={() => setArchiveTarget({ id: v.id, name: `${vehicleName(v)}` })}
                   >
                     <Archive className="mr-2 h-4 w-4" />
                     {t('archive')}
@@ -953,7 +938,7 @@ export function VehiclesClient({
                 )}
                 <ContextMenuItem
                   variant="destructive"
-                  onClick={() => handleDelete(v.id, `${v.year} ${v.make} ${v.model}`)}
+                  onClick={() => handleDelete(v.id, `${vehicleName(v)}`)}
                 >
                   <Trash2 className="mr-2 h-4 w-4" />
                   {t('delete')}

+ 4 - 5
src/app/(authenticated)/work-orders/work-orders-client.tsx

@@ -67,6 +67,7 @@ import { SETTING_KEYS } from '@/features/settings/Schema/settingsSchema'
 import { SMS_TEMPLATE_DEFAULTS, interpolateSmsTemplate } from '@/lib/sms-templates'
 import { ListEmpty } from '@/components/list-empty'
 import { useServiceLabels } from '@/features/vehicles/Lib/useServiceLabels'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface WorkOrder {
   id: string
@@ -269,9 +270,7 @@ export function WorkOrdersClient({
       const tplResult = await getSmsTemplates()
       const tplData = tplResult.success && tplResult.data ? tplResult.data : null
       const tpl = tplData?.templates[templateKey] || SMS_TEMPLATE_DEFAULTS[templateKey] || ''
-      const vehicle = workOrder.vehicle
-        ? `${workOrder.vehicle.year} ${workOrder.vehicle.make} ${workOrder.vehicle.model}`
-        : workOrder.title
+      const vehicle = workOrder.vehicle ? `${vehicleName(workOrder.vehicle)}` : workOrder.title
       const message = interpolateSmsTemplate(tpl, {
         customer_name: notifyTarget.name,
         vehicle,
@@ -441,7 +440,7 @@ export function WorkOrdersClient({
                           {r.vehicle.licensePlate}{' '}
                         </span>
                       )}
-                      {r.vehicle.year} {r.vehicle.make} {r.vehicle.model}
+                      {vehicleName(r.vehicle)}
                     </p>
                   )}
                   {rowCustomer && (
@@ -628,7 +627,7 @@ export function WorkOrdersClient({
                                 </span>
                               )}
                               <p className="truncate text-xs text-muted-foreground">
-                                {r.vehicle.year} {r.vehicle.make} {r.vehicle.model}
+                                {vehicleName(r.vehicle)}
                               </p>
                             </TableCellLink>
                           ) : (

+ 2 - 1
src/app/(public)/p/[token]/page.tsx

@@ -16,6 +16,7 @@ import { PhotoHandoffClient } from './photo-handoff-client'
 import { InspectionHandoffClient } from './inspection-handoff-client'
 import { FixHandoffClient } from './fix-handoff-client'
 import { VehicleHandoffClient } from './vehicle-handoff-client'
+import { vehicleName } from '@/lib/vehicle-name'
 
 export async function generateMetadata(): Promise<Metadata> {
   const t = await getTranslations('service.photoHandoff')
@@ -240,7 +241,7 @@ async function VehicleHandoffPage({ token }: { token: string }) {
       brand={brand}
       vehicle={{
         plate: vehicle.licensePlate,
-        name: `${vehicle.year} ${vehicle.make} ${vehicle.model}`,
+        name: `${vehicleName(vehicle)}`,
       }}
     />
   )

+ 2 - 1
src/app/(public)/portal/[orgId]/vehicles/(list)/page.tsx

@@ -24,6 +24,7 @@ import { resolvePortalOrg } from '@/lib/portal-slug'
 import { loadPortalWorkshop } from '@/features/portal/Lib/workshop.server'
 import { titleFrom } from '@/lib/page-title'
 import { ChevronRight } from 'lucide-react'
+import { vehicleName } from '@/lib/vehicle-name'
 
 // "Your cars" or "Your boats": the workshop read here is the one PortalShell
 // loads for the page anyway (request-cached), and a failure reads as cars.
@@ -70,7 +71,7 @@ export default async function PortalVehiclesPage({
 
   const vehicles = result.data.map((v) => ({
     v,
-    name: `${v.year} ${v.make} ${v.model}`,
+    name: `${vehicleName(v)}`,
     href: `/portal/${orgId}/vehicles/${v.id}`,
   }))
 

+ 2 - 1
src/app/(public)/portal/[orgId]/vehicles/[vehicleId]/page.tsx

@@ -31,6 +31,7 @@ import { resolvePortalOrg } from '@/lib/portal-slug'
 import { loadPortalWorkshop } from '@/features/portal/Lib/workshop.server'
 import { titleFrom } from '@/lib/page-title'
 import { getWarrantyStatus, type WarrantyStatus } from '@/lib/warranty'
+import { vehicleName } from '@/lib/vehicle-name'
 
 // "Your cars" or "Your boats": the workshop read here is the one PortalShell
 // loads for the page anyway (request-cached), and a failure reads as cars.
@@ -130,7 +131,7 @@ export default async function PortalVehicleDetailPage({
     <PortalShell orgId={orgId}>
       <PortalPageHead
         back={back}
-        title={`${v.year} ${v.make} ${v.model}`}
+        title={`${vehicleName(v)}`}
         badge={v.licensePlate ? <PortalPlate>{v.licensePlate}</PortalPlate> : undefined}
       />
 

+ 2 - 3
src/app/(public)/share/inspection/[orgId]/[token]/inspection-view.tsx

@@ -35,6 +35,7 @@ import {
   type SeverityScale,
 } from '@/features/inspections/Lib/conditions'
 import { toast } from 'sonner'
+import { vehicleName } from '@/lib/vehicle-name'
 
 const CONDITION_ICONS: Record<Condition, React.ComponentType<{ className?: string }>> = {
   pass: Check,
@@ -325,9 +326,7 @@ export function InspectionView({
                   <dt className="text-xs text-gray-500">
                     {serviceType === 'marine' ? t('vesselLabel') : t('vehicle')}
                   </dt>
-                  <dd className="font-semibold">
-                    {inspection.vehicle.year} {inspection.vehicle.make} {inspection.vehicle.model}
-                  </dd>
+                  <dd className="font-semibold">{vehicleName(inspection.vehicle)}</dd>
                 </div>
                 {inspection.vehicle.vin && (
                   <div>

+ 2 - 3
src/app/(public)/share/invoice/[orgId]/[token]/invoice-view.tsx

@@ -26,6 +26,7 @@ import {
 } from '@/features/settings/Schema/invoiceLayoutSchema'
 import { SpecSheet } from '@/features/invoice-designer/Render/SpecSheet'
 import { type PayVendor, VendorPayButton } from '@/features/payments/Components/VendorPayButton'
+import { vehicleName as vehicleNameOf } from '@/lib/vehicle-name'
 
 /** The vendors in the order their buttons stand, with the sentence each one is read out as. */
 const PAY_VENDORS: {
@@ -216,9 +217,7 @@ export function InvoiceView({
     })
   }, [token])
 
-  const vehicleName = record.vehicle
-    ? `${record.vehicle.year} ${record.vehicle.make} ${record.vehicle.model}`
-    : ''
+  const vehicleName = record.vehicle ? `${vehicleNameOf(record.vehicle)}` : ''
   const partsSubtotalStored = record.partItems.reduce((sum, p) => sum + p.total, 0)
   const laborSubtotalStored = record.laborItems.reduce((sum, l) => sum + l.total, 0)
   const computedSubtotalStored = partsSubtotalStored + laborSubtotalStored

+ 2 - 1
src/app/(public)/share/status-report/[orgId]/[token]/status-report-view.tsx

@@ -7,6 +7,7 @@ import { Button } from '@/components/ui/button'
 import { Textarea } from '@/components/ui/textarea'
 import { Loader2, CheckCircle, User, Calendar, Wrench, CarFront } from 'lucide-react'
 import { submitStatusReportFeedback } from '@/features/status-reports/Actions/submitFeedback'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface StatusReportViewProps {
   report: {
@@ -57,7 +58,7 @@ export function StatusReportView({
     month: 'long',
     day: 'numeric',
   })
-  const vehicleLabel = vehicle ? `${vehicle.year} ${vehicle.make} ${vehicle.model}` : null
+  const vehicleLabel = vehicle ? `${vehicleName(vehicle)}` : null
 
   async function handleSubmitFeedback() {
     if (!feedback.trim() || submitting) return

+ 2 - 1
src/app/api/protected/inspections/[id]/pdf/route.ts

@@ -21,6 +21,7 @@ import { getFeatures } from '@/lib/features'
 import { getTorqvoiceLogoDataUri } from '@/lib/torqvoice-branding'
 import { buildCertificatePdfBuffer } from '@/features/inspections/Pdf/buildCertificatePdfBuffer'
 import { gateTypeKey, typeKeyEnabledIn } from '@/features/vehicles/Lib/typeKeySetting'
+import { vehicleName as vehicleNameOf } from '@/lib/vehicle-name'
 
 export async function GET(_request: Request, { params }: { params: Promise<{ id: string }> }) {
   try {
@@ -184,7 +185,7 @@ export async function GET(_request: Request, { params }: { params: Promise<{ id:
     // The signed forms follow the certificate as pages of their own.
     const body = await appendCertificateDocuments(buffer, documents)
 
-    const vehicleName = `${inspection.vehicle.year}-${inspection.vehicle.make}-${inspection.vehicle.model}`
+    const vehicleName = vehicleNameOf(inspection.vehicle, '-')
     const fileName = `Inspection-${vehicleName}.pdf`
 
     return new NextResponse(body, {

+ 2 - 1
src/app/api/protected/vehicles/[id]/service-history-pdf/route.ts

@@ -16,6 +16,7 @@ import {
   withMarineDocumentLabels,
 } from '@/features/invoice-designer/Lib/marineLabels'
 import { gateTypeKey, typeKeyEnabledIn } from '@/features/vehicles/Lib/typeKeySetting'
+import { vehicleName as vehicleNameOf } from '@/lib/vehicle-name'
 
 export async function GET(_request: Request, { params }: { params: Promise<{ id: string }> }) {
   try {
@@ -181,7 +182,7 @@ export async function GET(_request: Request, { params }: { params: Promise<{ id:
     }) as any
     const pdfBuffer = await renderToBuffer(element)
 
-    const vehicleName = `${vehicle.year} ${vehicle.make} ${vehicle.model}`
+    const vehicleName = `${vehicleNameOf(vehicle)}`
     const fileName = `Service-History-${vehicleName.replace(/\s+/g, '-')}`
 
     const finalBuffer = pdfBuffer.buffer.slice(

+ 2 - 3
src/components/vehicle-picker-dialog.tsx

@@ -26,6 +26,7 @@ import { toast } from 'sonner'
 import { useTranslations } from 'next-intl'
 import { handleGated } from '@/components/upgrade-gate'
 import { useServiceType } from '@/components/service-type-context'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface Vehicle {
   id: string
@@ -269,9 +270,7 @@ export function VehiclePickerDialog({
                           <Car className="h-4 w-4 shrink-0 text-muted-foreground" />
                         )}
                         <div className="min-w-0 flex-1">
-                          <p className="truncate text-sm font-medium">
-                            {v.year} {v.make} {v.model}
-                          </p>
+                          <p className="truncate text-sm font-medium">{vehicleName(v)}</p>
                           <p className="truncate text-xs text-muted-foreground">
                             {[v.licensePlate, v.customer?.name].filter(Boolean).join(' · ') ||
                               (isMarine ? t('noPlateMarine') : t('noPlate'))}

+ 5 - 7
src/features/ai/Lib/askAiContext.ts

@@ -3,6 +3,7 @@ import { db } from '@/lib/db'
 import { zonedDayKey } from '@/lib/timezone'
 import { formatTypeKey } from '@/features/vehicles/Lib/typeKey'
 import { isTypeKeyEnabled } from '@/features/vehicles/Lib/typeKeySetting'
+import { vehicleName } from '@/lib/vehicle-name'
 
 /**
  * Everything the model is allowed to know when someone asks about one
@@ -177,7 +178,7 @@ function jobOneLine(job: JobRow, o: AskAiContextOptions, withVehicle: boolean):
   const date = dayOf(job.startDateTime ?? job.serviceDate, o.timeZone)
   const vehicle =
     withVehicle && job.vehicle
-      ? `${job.vehicle.year} ${job.vehicle.make} ${job.vehicle.model}${job.vehicle.licensePlate ? ` (${job.vehicle.licensePlate})` : ''}`
+      ? `${vehicleName(job.vehicle)}${job.vehicle.licensePlate ? ` (${job.vehicle.licensePlate})` : ''}`
       : withVehicle
         ? 'no vehicle (counter sale)'
         : ''
@@ -330,7 +331,7 @@ async function vehicleContext(
   })
   if (!vehicle) return null
 
-  const title = `${vehicle.year} ${vehicle.make} ${vehicle.model}`
+  const title = `${vehicleName(vehicle)}`
   const b = new Budget()
   b.add(`# Vehicle: ${title}${vehicle.licensePlate ? ` (${vehicle.licensePlate})` : ''}`)
   b.add(`link: /vehicles/${vehicle.id}`)
@@ -556,7 +557,7 @@ async function customerContext(
     `Vehicles (${customer.vehicles.length})`,
     customer.vehicles.map(
       (v) =>
-        `- ${v.year} ${v.make} ${v.model} [${fields([
+        `- ${vehicleName(v)} [${fields([
           ['plate', v.licensePlate],
           [`mileage (${distance})`, v.mileage],
           ['jobs', v._count.serviceRecords],
@@ -577,10 +578,7 @@ async function customerContext(
           ['number', q.quoteNumber],
           ['status', q.status],
           ['date', dayOf(q.createdAt, o.timeZone)],
-          [
-            'vehicle',
-            q.vehicle ? `${q.vehicle.year} ${q.vehicle.make} ${q.vehicle.model}` : undefined,
-          ],
+          ['vehicle', q.vehicle ? `${vehicleName(q.vehicle)}` : undefined],
           ['total', o.showMoney ? money(q.totalAmount, o.currencyCode) : undefined],
           ['link', `/quotes/${q.id}`],
         ])}]`

+ 4 - 3
src/features/billing/Components/RecurringInvoicesClient.tsx

@@ -56,6 +56,7 @@ import {
   processRecurringInvoices,
 } from '../Actions/recurringInvoiceActions'
 import { toast } from 'sonner'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface Vehicle {
   id: string
@@ -381,7 +382,7 @@ export default function RecurringInvoicesClient({
                       <span className="shrink-0 font-semibold">{fmt(total)}</span>
                     </div>
                     <p className="truncate text-xs text-muted-foreground">
-                      {inv.vehicle.year} {inv.vehicle.make} {inv.vehicle.model}
+                      {vehicleName(inv.vehicle)}
                       {inv.vehicle.customer && ` · ${inv.vehicle.customer.name}`}
                     </p>
                     <div className="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs text-muted-foreground">
@@ -467,7 +468,7 @@ export default function RecurringInvoicesClient({
                             <TableCell className="text-sm font-medium">{inv.title}</TableCell>
                             <TableCell className="text-sm">
                               <TableCellLink href={`/vehicles/${inv.vehicle.id}`}>
-                                {inv.vehicle.year} {inv.vehicle.make} {inv.vehicle.model}
+                                {vehicleName(inv.vehicle)}
                               </TableCellLink>
                             </TableCell>
                             <TableCell className="text-sm">
@@ -597,7 +598,7 @@ export default function RecurringInvoicesClient({
                   placeholder={t('recurring.selectVehicle')}
                   options={vehicles.map((v) => ({
                     value: v.id,
-                    label: `${v.year} ${v.make} ${v.model}${v.customer ? ` (${v.customer.name})` : ''}`,
+                    label: `${vehicleName(v)}${v.customer ? ` (${v.customer.name})` : ''}`,
                   }))}
                 />
               </div>

+ 2 - 1
src/features/calendar/Actions/calendarActions.ts

@@ -13,6 +13,7 @@ import { workshopTimeZone } from '@/lib/workshop-timezone'
 import { addZonedDays, zonedDate, zonedDayKey, zonedParts } from '@/lib/timezone'
 import { loadWorkshopCalendar } from '@/features/workshop-calendar/Lib/loadCalendar.server'
 import { type ClosedPeriod, eachDay } from '@/features/workshop-calendar/Lib/calendar'
+import { vehicleName } from '@/lib/vehicle-name'
 
 export type CalendarEventType =
   | 'service'
@@ -259,7 +260,7 @@ export async function getCalendarEvents(params: { start: string; end: string })
 
       const now = new Date()
       const vehicleLabel = (v: { year: number; make: string; model: string } | null) =>
-        v ? `${v.year} ${v.make} ${v.model}` : ''
+        v ? `${vehicleName(v)}` : ''
 
       // Closed days and time off, one all-day (or part-day) entry per day.
       const { calendar } = await loadWorkshopCalendar(organizationId, {

+ 3 - 2
src/features/dashboard/custom-cards/server-registry.ts

@@ -6,6 +6,7 @@ import { workshopTimeZone } from '@/lib/workshop-timezone'
 import { serviceRecordHref } from '@/lib/service-record'
 import type { CardEntity, CardFilter, CustomCardConfig } from './registry'
 import { getField } from './registry'
+import { vehicleName } from '@/lib/vehicle-name'
 
 /**
  * Server-side execution for custom cards. Every query is built exclusively
@@ -254,7 +255,7 @@ export async function runEntityQuery(
           techName: r.techName,
           totalAmount: r.totalAmount,
           serviceDate: iso(r.invoiceDate ?? r.startDateTime ?? r.serviceDate),
-          vehicle: r.vehicle ? `${r.vehicle.year} ${r.vehicle.make} ${r.vehicle.model}` : null,
+          vehicle: r.vehicle ? `${vehicleName(r.vehicle)}` : null,
           customer: (r.customer ?? r.vehicle?.customer)?.name ?? null,
         },
       }))
@@ -287,7 +288,7 @@ export async function runEntityQuery(
           validUntil: iso(r.validUntil),
           createdAt: iso(r.createdAt),
           customer: r.customer?.name ?? null,
-          vehicle: r.vehicle ? `${r.vehicle.year} ${r.vehicle.make} ${r.vehicle.model}` : null,
+          vehicle: r.vehicle ? `${vehicleName(r.vehicle)}` : null,
         },
       }))
     }

+ 2 - 1
src/features/email/Actions/emailActions.ts

@@ -21,6 +21,7 @@ import { ensureShareToken, renewShareLink } from '@/lib/share-token.server'
 import { resolveAttachPdf } from '@/features/email/Lib/documentEmail'
 import type { VehicleContext } from '@/features/email/Lib/emailContext'
 import { sendTemplatedMail } from '@/features/email/Lib/sendTemplatedMail'
+import { vehicleName as vehicleNameOf } from '@/lib/vehicle-name'
 
 /** Whoever pressed send, for a template that signs off with a name. */
 async function senderName(userId: string): Promise<string | null> {
@@ -440,7 +441,7 @@ export async function sendInspectionEmail(input: {
       // One language for the certificate's labels and the mail around it.
       const locale = await resolveDocumentLocale(organizationId)
 
-      const vehicleName = `${inspection.vehicle.year} ${inspection.vehicle.make} ${inspection.vehicle.model}`
+      const vehicleName = `${vehicleNameOf(inspection.vehicle)}`
       const fileName = `Inspection-${vehicleName}.pdf`
 
       let pdfBuffer: Buffer | null = null

+ 2 - 1
src/features/fault-codes/Lib/service.server.ts

@@ -52,6 +52,7 @@ import type {
   ResearchState,
   SharedFix,
 } from './types'
+import { vehicleName } from '@/lib/vehicle-name'
 
 /**
  * Fault codes as the app's screens and actions ask for them: through
@@ -724,7 +725,7 @@ export async function jobsWithCode(
     serviceRecordId: r.serviceRecord?.id ?? null,
     title: r.serviceRecord?.title ?? null,
     vehicleId: r.vehicleId,
-    vehicle: `${r.vehicle.year} ${r.vehicle.make} ${r.vehicle.model}`,
+    vehicle: `${vehicleName(r.vehicle)}`,
     licensePlate: r.vehicle.licensePlate,
     status: r.status,
     faultStatus: r.faultStatus,

+ 2 - 1
src/features/import/Lib/pipeline.ts

@@ -33,6 +33,7 @@ import {
   splitVehicleDescription,
 } from './normalize'
 import type { ColumnMapping } from './suggest'
+import { vehicleName } from '@/lib/vehicle-name'
 
 export type DuplicateRule = 'skip' | 'update' | 'create'
 
@@ -436,7 +437,7 @@ function vehicleLabel(v: {
   licensePlate: string | null
 }): string {
   const plate = v.licensePlate ? ` (${v.licensePlate})` : ''
-  return `${v.year} ${v.make} ${v.model}${plate}`
+  return `${vehicleName(v)}${plate}`
 }
 
 class ExistingIndex {

+ 4 - 3
src/features/inspection-reminders/Actions/bookingActions.ts

@@ -11,6 +11,7 @@ import { type InspectionReminderSettings, loadInspectionReminderSettings } from
 import { releaseFiles } from '@/lib/files/manager'
 import { serviceRecordFileUrls } from '@/lib/files/collect'
 import { assertNotRestoring } from '@/lib/backup/freeze'
+import { vehicleName } from '@/lib/vehicle-name'
 
 /**
  * The public side of a reminder link. No sign-in: the token was sent to the
@@ -146,7 +147,7 @@ export async function getBookingPage(rawToken: string): Promise<BookingPage | nu
   const base = {
     workshop,
     vehicle: {
-      label: `${send.vehicle.year} ${send.vehicle.make} ${send.vehicle.model}`,
+      label: `${vehicleName(send.vehicle)}`,
       licensePlate: send.vehicle.licensePlate,
     },
     dueAt: send.dueAt.toISOString(),
@@ -196,7 +197,7 @@ export async function confirmBooking(raw: unknown) {
   const end = new Date(start.getTime() + settings.durationMinutes * 60_000)
 
   const t = await getTranslations('portal.booking')
-  const vehicleLabel = `${send.vehicle.year} ${send.vehicle.make} ${send.vehicle.model}`
+  const vehicleLabel = `${vehicleName(send.vehicle)}`
   const title = t('workOrderTitle', { vehicle: vehicleLabel })
   const note = input.note?.trim() || null
 
@@ -313,7 +314,7 @@ export async function cancelBooking(rawToken: string) {
     throw new Error('There is no upcoming booking to cancel')
   }
   const t = await getTranslations('portal.booking')
-  const vehicleLabel = `${send.vehicle.year} ${send.vehicle.make} ${send.vehicle.model}`
+  const vehicleLabel = `${vehicleName(send.vehicle)}`
 
   if (send.bookedServiceRecordId) {
     // Only the placeholder the link created, and only while nobody has

+ 2 - 1
src/features/inspection-reminders/Lib/candidates.ts

@@ -1,4 +1,5 @@
 import { db } from '@/lib/db'
+import { vehicleName } from '@/lib/vehicle-name'
 
 /**
  * Who a reminder campaign may write to, and who it must not, with the
@@ -140,7 +141,7 @@ export async function reminderCandidates(input: {
         vehicleId: v.id,
         customerId: customer?.id ?? null,
         customerName: customer?.name ?? null,
-        vehicle: `${v.year} ${v.make} ${v.model}`,
+        vehicle: `${vehicleName(v)}`,
         licensePlate: v.licensePlate,
         dueAt: r.dueAt.toISOString(),
         recipient,

+ 2 - 1
src/features/inspections/Actions/inspectionActions.ts

@@ -40,6 +40,7 @@ import {
   isTypeKeyEnabled,
   typeKeySearch,
 } from '@/features/vehicles/Lib/typeKeySetting'
+import { vehicleName } from '@/lib/vehicle-name'
 
 export async function getInspectionsPaginated(params: {
   page?: number
@@ -880,7 +881,7 @@ export async function createQuoteFromInspection(id: string) {
         { organizationId, userId },
         createQuoteSchema.parse({
           title: t('quoteTitle', {
-            vehicle: `${vehicle.year} ${vehicle.make} ${vehicle.model}`,
+            vehicle: `${vehicleName(vehicle)}`,
           }),
           vehicleId: vehicle.id,
           customerId: vehicle.customerId ?? undefined,

+ 2 - 3
src/features/inspections/Components/InspectionPDF.tsx

@@ -14,6 +14,7 @@ import {
   type Condition,
 } from '../Lib/conditions'
 import { typeKeyLine } from '@/features/vehicles/Lib/typeKey'
+import { vehicleName } from '@/lib/vehicle-name'
 
 function fillTemplate(template: string, values: Record<string, string>): string {
   return Object.entries(values).reduce((str, [key, val]) => str.replace(`{${key}}`, val), template)
@@ -514,9 +515,7 @@ export function InspectionPDF({
         <View style={styles.infoRow}>
           <View style={{ ...styles.infoBox, flex: 1 }}>
             <Text style={styles.infoLabel}>{labels.vehicle || 'Vehicle'}</Text>
-            <Text style={styles.infoTextBold}>
-              {data.vehicle.year} {data.vehicle.make} {data.vehicle.model}
-            </Text>
+            <Text style={styles.infoTextBold}>{vehicleName(data.vehicle)}</Text>
             {data.vehicle.vin && (
               <Text style={styles.infoTextSmall}>
                 {labels.vin

+ 4 - 5
src/features/inspections/Components/InspectionPageClient.tsx

@@ -80,6 +80,7 @@ import {
 } from '../Lib/conditions'
 import { useConditionLabels } from '../Lib/useConditionLabels'
 import { findCompletionBlockers } from '../Lib/completion'
+import { vehicleName } from '@/lib/vehicle-name'
 
 export interface InspectionData {
   id: string
@@ -511,7 +512,7 @@ export function InspectionPageClient({
             <div className="bg-border h-5 w-px" aria-hidden="true" />
             <div className="min-w-0">
               <h1 className="truncate text-base leading-tight font-semibold">
-                {inspection.vehicle.year} {inspection.vehicle.make} {inspection.vehicle.model}
+                {vehicleName(inspection.vehicle)}
               </h1>
               <p className="text-muted-foreground truncate text-xs">
                 {inspection.template.name} &middot; {formatDate(new Date(inspection.createdAt))}
@@ -826,7 +827,7 @@ export function InspectionPageClient({
             inspectionId={inspection.id}
             attachments={inspection.attachments ?? []}
             organizationId={organizationId}
-            vehicleName={`${inspection.vehicle.year} ${inspection.vehicle.make} ${inspection.vehicle.model}`}
+            vehicleName={`${vehicleName(inspection.vehicle)}`}
             customer={
               inspection.vehicle.customer
                 ? {
@@ -1005,9 +1006,7 @@ export function InspectionPageClient({
                 <dt className="text-muted-foreground text-xs">
                   {serviceType === 'marine' ? t('vessel') : t('vehicle')}
                 </dt>
-                <dd>
-                  {inspection.vehicle.year} {inspection.vehicle.make} {inspection.vehicle.model}
-                </dd>
+                <dd>{vehicleName(inspection.vehicle)}</dd>
               </div>
               {inspection.vehicle.vin && (
                 <div>

+ 2 - 1
src/features/inspections/Pdf/buildCertificatePdfBuffer.ts

@@ -21,6 +21,7 @@ import {
   loadVehicleConditionMarks,
 } from '@/features/condition-map/Lib/loadMarks.server'
 import { gateTypeKey, typeKeyEnabledIn } from '@/features/vehicles/Lib/typeKeySetting'
+import { vehicleName as vehicleNameOf } from '@/lib/vehicle-name'
 
 export { certificateDesignSource, liveCertificateDesign } from './certificateDesign'
 
@@ -177,6 +178,6 @@ export async function buildCertificatePdfBuffer({
   }) as unknown as React.ReactElement<DocumentProps>
   const rendered = await renderToBuffer(element)
   const body = await appendCertificateDocuments(Buffer.from(rendered), documents)
-  const vehicleName = `${inspection.vehicle.year}-${inspection.vehicle.make}-${inspection.vehicle.model}`
+  const vehicleName = vehicleNameOf(inspection.vehicle, '-')
   return { body, fileName: `Inspection-${vehicleName}.pdf` }
 }

+ 2 - 1
src/features/inspections/Pdf/buildCertificatePrint.ts

@@ -35,6 +35,7 @@ import {
 } from '../Lib/conditions'
 import { defectsWorstFirst } from '../Lib/conversion'
 import { typeKeyLine } from '@/features/vehicles/Lib/typeKey'
+import { vehicleName } from '@/lib/vehicle-name'
 
 /**
  * A completed inspection, expressed as the document the designer edits, the
@@ -324,7 +325,7 @@ export function buildCertificatePrintSpec(input: CertificatePrintInput): Documen
     customer_email: data.vehicle.customer?.email || '',
     customer_phone: data.vehicle.customer?.phone || '',
     customer_tax_id: '',
-    vehicle_name: `${data.vehicle.year} ${data.vehicle.make} ${data.vehicle.model}`,
+    vehicle_name: `${vehicleName(data.vehicle)}`,
     vin: data.vehicle.vin ? fillTemplate(L('vin', 'VIN: {vin}'), { vin: data.vehicle.vin }) : '',
     hsn_tsn: typeKeyLine(data.vehicle, labels.typeKey),
     license_plate: data.vehicle.licensePlate

+ 2 - 1
src/features/inspections/Pdf/customerCertificatePdf.ts

@@ -21,6 +21,7 @@ import { getAppBaseUrl } from '@/lib/app-url'
 import { gateTypeKey, typeKeyEnabledIn } from '@/features/vehicles/Lib/typeKeySetting'
 import { linkedCertificateInspectionId } from '@/features/inspections/Lib/linkedCertificate.server'
 import { buildCertificatePdfBuffer } from './buildCertificatePdfBuffer'
+import { vehicleName as vehicleNameOf } from '@/lib/vehicle-name'
 
 /**
  * The inspection certificate as a customer receives it, whichever way it
@@ -197,7 +198,7 @@ export async function buildCustomerCertificatePdf({
   // The signed forms follow the certificate as pages of their own.
   const body = await appendCertificateDocuments(buffer, documents)
 
-  const vehicleName = `${inspection.vehicle.year}-${inspection.vehicle.make}-${inspection.vehicle.model}`
+  const vehicleName = vehicleNameOf(inspection.vehicle, '-')
   return { body, fileName: `Inspection-${vehicleName}.pdf` }
 }
 

+ 2 - 3
src/features/integrations/Actions/videoCallActions.ts

@@ -11,6 +11,7 @@ import { sendSmsToCustomer } from '@/features/sms/Actions/smsActions'
 import { sendNotificationEmail } from '@/features/email/Actions/emailActions'
 import { sendTelegramToCustomer } from '@/features/telegram/Actions/telegramActions'
 import { serviceVideoLink, videoCallMessage } from '../Lib/video-call'
+import { vehicleName } from '@/lib/vehicle-name'
 
 const sendVideoCallSchema = z.object({
   serviceRecordId: z.string(),
@@ -60,9 +61,7 @@ export async function sendServiceVideoCall(input: unknown) {
       const link = await serviceVideoLink(organizationId, record.id)
       if (!link) throw new Error('No video call on this work order')
 
-      const vehicle = record.vehicle
-        ? `${record.vehicle.year} ${record.vehicle.make} ${record.vehicle.model}`
-        : record.title
+      const vehicle = record.vehicle ? `${vehicleName(record.vehicle)}` : record.title
       const t = await getTranslations('service.videoCall.notify')
       let when: string | null = null
       if (record.startDateTime) {

+ 5 - 5
src/features/integrations/Lib/vehicle-safety.ts

@@ -2,6 +2,7 @@ import { db } from '@/lib/db'
 import { getManifest } from '@/integrations/registry'
 import { loadConnection } from './connections'
 import type { ConnectorContext, JobHandler, JobOutcome, VehicleSafetyReport } from './types'
+import { vehicleName } from '@/lib/vehicle-name'
 
 /**
  * Recalls, owner complaints and crash ratings for the vehicles a workshop
@@ -212,7 +213,7 @@ export async function refreshFleetReports(ctx: ConnectorContext): Promise<JobOut
     } catch (err) {
       await ctx.log(
         'warn',
-        `Could not refresh ${query.year} ${query.make} ${query.model}: ${err instanceof Error ? err.message : String(err)}`
+        `Could not refresh ${vehicleName(query)}: ${err instanceof Error ? err.message : String(err)}`
       )
     }
   }
@@ -253,8 +254,7 @@ export async function warmVehicleReport(
     return { summary: 'vehicle has no model to ask about' }
   const key = modelKey(vehicle)
   const cached = await readCache(connection.connectorId, key)
-  if (cached && !cached.stale)
-    return { summary: `${key.year} ${key.make} ${key.model} already fresh` }
+  if (cached && !cached.stale) return { summary: `${vehicleName(key)} already fresh` }
   const result = await fetchAndCache(ctx.connection.id, key, {
     make: vehicle.make,
     model: vehicle.model,
@@ -264,8 +264,8 @@ export async function warmVehicleReport(
   const recalls = result.report.recalls.length
   return {
     summary: result.report.matched
-      ? `${key.year} ${key.make} ${key.model}: ${recalls} recalls, ${result.report.complaints.total} complaints`
-      : `${key.year} ${key.make} ${key.model}: not known to the source`,
+      ? `${vehicleName(key)}: ${recalls} recalls, ${result.report.complaints.total} complaints`
+      : `${vehicleName(key)}: not known to the source`,
   }
 }
 

+ 2 - 3
src/features/invoice-designer/Pdf/buildInvoicePrint.ts

@@ -43,6 +43,7 @@ import {
   type InspectionResults,
   inspectionResultsForPrint,
 } from '@/features/inspections/Lib/inspectionResults'
+import { vehicleName as vehicleNameOf } from '@/lib/vehicle-name'
 
 /**
  * A real job, expressed as the document the designer edits.
@@ -208,9 +209,7 @@ export function buildInvoicePrintSpec(input: InvoicePrintInput): DocumentSpec {
 
   const shopDisplayName = workshop?.name || data.shopName || 'Torqvoice'
   const customer = data.customer ?? data.vehicle?.customer
-  const vehicleName = data.vehicle
-    ? `${data.vehicle.year} ${data.vehicle.make} ${data.vehicle.model}`
-    : ''
+  const vehicleName = data.vehicle ? `${vehicleNameOf(data.vehicle)}` : ''
   const tech = data.technician?.name || data.techName
 
   // -------------------------------------------------------------------------

+ 2 - 3
src/features/invoice-designer/Pdf/buildQuotePrint.ts

@@ -37,6 +37,7 @@ import {
   type InspectionResults,
   inspectionResultsForPrint,
 } from '@/features/inspections/Lib/inspectionResults'
+import { vehicleName } from '@/lib/vehicle-name'
 
 /**
  * A quote, expressed as the document the designer edits, the same way the
@@ -218,9 +219,7 @@ export function buildQuotePrintSpec(input: QuotePrintInput): DocumentSpec {
     customer_tax_id: data.customer?.taxId
       ? `${L('customerTaxId', 'Tax ID')}: ${data.customer.taxId}`
       : '',
-    vehicle_name: data.vehicle
-      ? `${data.vehicle.year} ${data.vehicle.make} ${data.vehicle.model}`
-      : '',
+    vehicle_name: data.vehicle ? `${vehicleName(data.vehicle)}` : '',
     vin: data.vehicle?.vin
       ? labels.vin
         ? fillTemplate(labels.vin, { vin: data.vehicle.vin })

+ 2 - 3
src/features/invoice-designer/Pdf/buildWorkOrderPrint.ts

@@ -45,6 +45,7 @@ import {
   type InspectionResults,
   inspectionResultsForPrint,
 } from '@/features/inspections/Lib/inspectionResults'
+import { vehicleName as vehicleNameOf } from '@/lib/vehicle-name'
 
 /**
  * A job as the sheet the customer signs and the technician works from.
@@ -232,9 +233,7 @@ export function buildWorkOrderPrintSpec(input: WorkOrderPrintInput): DocumentSpe
 
   const shopDisplayName = workshop?.name || data.shopName || 'Torqvoice'
   const customer = data.customer ?? data.vehicle?.customer
-  const vehicleName = data.vehicle
-    ? `${data.vehicle.year} ${data.vehicle.make} ${data.vehicle.model}`
-    : ''
+  const vehicleName = data.vehicle ? `${vehicleNameOf(data.vehicle)}` : ''
   // The technician first, then whoever is on the job with them.
   const tech = [data.technician?.name || data.techName || '', ...(job.helperNames ?? [])]
     .filter(Boolean)

+ 2 - 1
src/features/portal/Actions/portalActions.ts

@@ -28,6 +28,7 @@ import { gateTypeKey, isTypeKeyEnabled } from '@/features/vehicles/Lib/typeKeySe
 import { loadPortalLook } from '@/features/portal/Lib/portalLook.server'
 import { PORTAL_REQUEST_MAX_FILES } from '@/features/portal/Lib/portalUploads'
 import { ownPortalUploadUrl } from '@/features/portal/Lib/portalUploadOwner.server'
+import { vehicleName } from '@/lib/vehicle-name'
 
 // ─── Vehicles ─────────────────────────────────────────────────────────────
 
@@ -543,7 +544,7 @@ export async function reportVehicleSold(vehicleId: string) {
         where: { id: customerId },
         select: { name: true },
       })
-      const label = `${vehicle.year} ${vehicle.make} ${vehicle.model}${vehicle.licensePlate ? ` (${vehicle.licensePlate})` : ''}`
+      const label = `${vehicleName(vehicle)}${vehicle.licensePlate ? ` (${vehicle.licensePlate})` : ''}`
       await notify({
         organizationId,
         type: 'vehicle_sold',

+ 2 - 4
src/features/quotes/Components/QuoteRightColumn.tsx

@@ -25,6 +25,7 @@ import type { QuoteFormState } from './useQuoteFormState'
 import type { QuoteRecord } from './quote-page-types'
 import { VehicleCombobox } from './VehicleCombobox'
 import { CustomerCombobox } from './CustomerCombobox'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface QuoteRightColumnProps {
   state: QuoteFormState
@@ -181,10 +182,7 @@ export const QuoteRightColumn = memo(function QuoteRightColumn({
                 target="_blank"
                 className="min-w-0 flex-1 text-sm hover:underline"
               >
-                <span className="font-medium">
-                  {state.selectedVehicle.year} {state.selectedVehicle.make}{' '}
-                  {state.selectedVehicle.model}
-                </span>
+                <span className="font-medium">{vehicleName(state.selectedVehicle)}</span>
                 {state.selectedVehicle.licensePlate && (
                   <span className="ml-1.5 text-muted-foreground">
                     {state.selectedVehicle.licensePlate}

+ 3 - 2
src/features/quotes/Components/VehicleCombobox.tsx

@@ -14,6 +14,7 @@ import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover
 import { Check, ChevronsUpDown, Loader2 } from 'lucide-react'
 import { cn } from '@/lib/utils'
 import { searchVehicles } from '@/features/vehicles/Actions/vehicleActions'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface VehicleOption {
   id: string
@@ -51,7 +52,7 @@ interface VehicleComboboxProps {
 }
 
 function formatVehicle(v: VehicleOption) {
-  return `${v.year} ${v.make} ${v.model}${v.licensePlate ? ` (${v.licensePlate})` : ''}`
+  return `${vehicleName(v)}${v.licensePlate ? ` (${v.licensePlate})` : ''}`
 }
 
 export function VehicleCombobox({
@@ -235,7 +236,7 @@ export function VehicleCombobox({
                   />
                   <div>
                     <p className="text-sm">
-                      {v.year} {v.make} {v.model}
+                      {vehicleName(v)}
                       {v.licensePlate && (
                         <span className="ml-1.5 text-muted-foreground">· {v.licensePlate}</span>
                       )}

+ 2 - 1
src/features/reports/Components/ReportPDF.tsx

@@ -15,6 +15,7 @@ import type {
   VehicleReportData,
 } from '../Schema/reportTypes'
 import { formatCurrency } from '@/lib/format'
+import { vehicleName } from '@/lib/vehicle-name'
 
 // --------------- fonts ---------------
 
@@ -879,7 +880,7 @@ export function ReportPDF({
         <Page size="A4" style={s.page}>
           <ReportHeader
             title={l.vehiclesSection || 'Vehicle Report'}
-            subtitle={`${vehicleData.vehicleInfo.year} ${vehicleData.vehicleInfo.make} ${vehicleData.vehicleInfo.model}${[vehicleData.vehicleInfo.licensePlate, vehicleData.vehicleInfo.vin, vehicleData.vehicleInfo.customerName].filter(Boolean).length > 0 ? ` — ${[vehicleData.vehicleInfo.licensePlate, vehicleData.vehicleInfo.vin, vehicleData.vehicleInfo.customerName].filter(Boolean).join(' · ')}` : ''}`}
+            subtitle={`${vehicleName(vehicleData.vehicleInfo)}${[vehicleData.vehicleInfo.licensePlate, vehicleData.vehicleInfo.vin, vehicleData.vehicleInfo.customerName].filter(Boolean).length > 0 ? ` — ${[vehicleData.vehicleInfo.licensePlate, vehicleData.vehicleInfo.vin, vehicleData.vehicleInfo.customerName].filter(Boolean).join(' · ')}` : ''}`}
           />
 
           <View

+ 2 - 1
src/features/reports/Components/csv-export.ts

@@ -13,6 +13,7 @@ import type {
   VehicleReportData,
 } from '../Schema/reportTypes'
 import { formatCurrency } from '@/lib/format'
+import { vehicleName } from '@/lib/vehicle-name'
 
 function downloadCsv(
   filename: string,
@@ -304,7 +305,7 @@ export function exportVehicleReportCsv(
     partsCount: s.partsCount,
     laborHours: s.laborHours.toFixed(1),
   }))
-  const vehicleLabel = `${data.vehicleInfo.year} ${data.vehicleInfo.make} ${data.vehicleInfo.model}`
+  const vehicleLabel = `${vehicleName(data.vehicleInfo)}`
   downloadCsv(`vehicle-report-${vehicleLabel.replace(/\s+/g, '-')}.csv`, headers, rows, [
     'date',
     'title',

+ 2 - 1
src/features/search/Components/SearchCommand.tsx

@@ -63,6 +63,7 @@ import {
 import type { OemSearchHit } from '@/features/fault-codes/Lib/types'
 import { appointmentHref } from '@/features/calendar/Lib/appointmentLink'
 import { useFormatDate } from '@/lib/use-format-date'
+import { vehicleName } from '@/lib/vehicle-name'
 
 type Vehicle = {
   id: string
@@ -336,7 +337,7 @@ function Row({
 }
 
 function vehicleLine(v: Vehicle) {
-  return `${v.year} ${v.make} ${v.model}`
+  return `${vehicleName(v)}`
 }
 
 function iconForHref(href: string): LucideIcon {

+ 2 - 1
src/features/status-reports/Actions/sendStatusReport.ts

@@ -9,6 +9,7 @@ import { sendSmsToCustomer } from '@/features/sms/Actions/smsActions'
 import { sendNotificationEmail } from '@/features/email/Actions/emailActions'
 import { sendTelegramToCustomer } from '@/features/telegram/Actions/telegramActions'
 import { demoGuard } from '@/lib/demo'
+import { vehicleName as vehicleNameOf } from '@/lib/vehicle-name'
 
 export async function sendStatusReport(input: unknown) {
   return withAuth(
@@ -50,7 +51,7 @@ export async function sendStatusReport(input: unknown) {
       const publicUrl = `${appUrl}/share/status-report/${organizationId}/${report.publicToken}`
 
       const vehicleName = vehicle
-        ? `${vehicle.year} ${vehicle.make} ${vehicle.model}`
+        ? `${vehicleNameOf(vehicle)}`
         : (report.serviceRecord?.title ?? report.inspection?.template.name ?? '')
 
       const t = await getTranslations('statusReport.notify')

+ 2 - 3
src/features/tire-hotel/Components/CheckInDialog.tsx

@@ -53,6 +53,7 @@ import { defaultTreatments, type TreatmentPrices, type TreatmentType } from '../
 import { checkInTireSet, getReturningSets, returnTireSet } from '../Actions/tireSetActions'
 import { groupRounds } from '../Lib/wear'
 import { TIRE_SEASONS, TIRE_ROAD_POSITIONS, thirtySecondsToMm } from '../Lib/tireConstants'
+import { vehicleName } from '@/lib/vehicle-name'
 
 /** The three steps, in order. Keys only; the labels are translated where they are drawn. */
 const STEPS = ['tires', 'storage', 'review'] as const
@@ -441,9 +442,7 @@ export function CheckInDialog({
                           {lockedVehicle.licensePlate}
                         </span>
                       )}
-                      <p className="truncate text-sm font-medium">
-                        {lockedVehicle.year} {lockedVehicle.make} {lockedVehicle.model}
-                      </p>
+                      <p className="truncate text-sm font-medium">{vehicleName(lockedVehicle)}</p>
                     </div>
                   ) : (
                     <OwnerVehicleFields

+ 2 - 1
src/features/tire-hotel/Components/OwnerVehicleFields.tsx

@@ -6,6 +6,7 @@ import { Label } from '@/components/ui/label'
 import { SearchableSelect } from '@/components/ui/searchable-select'
 import { CustomerCombobox } from '@/features/quotes/Components/CustomerCombobox'
 import { X } from 'lucide-react'
+import { vehicleName } from '@/lib/vehicle-name'
 
 export type VehicleOption = {
   id: string
@@ -130,7 +131,7 @@ export function OwnerVehicleFields({
             className="min-w-0 flex-1"
             options={visibleVehicles.map((vehicle) => ({
               value: vehicle.id,
-              label: `${vehicle.licensePlate ? `${vehicle.licensePlate} - ` : ''}${vehicle.year} ${vehicle.make} ${vehicle.model}`,
+              label: `${vehicle.licensePlate ? `${vehicle.licensePlate} - ` : ''}${vehicleName(vehicle)}`,
             }))}
           />
           {/* The way back to another customer, since choosing a car narrows

+ 2 - 1
src/features/vehicles/Actions/inspectionStatusActions.ts

@@ -3,6 +3,7 @@
 import { db } from '@/lib/db'
 import { PermissionAction, PermissionSubject } from '@/lib/permissions'
 import { withAuth } from '@/lib/with-auth'
+import { vehicleName } from '@/lib/vehicle-name'
 
 const DAY_MS = 86_400_000
 
@@ -77,7 +78,7 @@ export async function getInspectionsDueSummary() {
             ? [
                 {
                   vehicleId: r.vehicle.id,
-                  label: `${r.vehicle.year} ${r.vehicle.make} ${r.vehicle.model}`,
+                  label: `${vehicleName(r.vehicle)}`,
                   licensePlate: r.vehicle.licensePlate,
                   customerName: r.vehicle.customer?.name ?? null,
                   dueAt: r.dueAt.toISOString(),

+ 3 - 2
src/features/vehicles/Actions/vehicleActions.ts

@@ -22,6 +22,7 @@ import { auditDetails } from '@/lib/audit'
 import { searchYear } from '@/features/vehicles/Lib/searchYear'
 import { searchWordsOf, typeKeySearchTerms } from '../Lib/typeKey'
 import { isTypeKeyEnabled } from '../Lib/typeKeySetting'
+import { vehicleName } from '@/lib/vehicle-name'
 
 export async function getVehicles() {
   return withAuth(
@@ -391,7 +392,7 @@ export async function updateVehicle(input: unknown) {
         licensePlate: licensePlate !== undefined ? licensePlate : before.licensePlate,
         vin: data.vin !== undefined ? data.vin : before.vin,
       })
-      const vehicleDisplay = `${before.year} ${before.make} ${before.model}${before.licensePlate ? ` (${before.licensePlate})` : ''}`
+      const vehicleDisplay = `${vehicleName(before)}${before.licensePlate ? ` (${before.licensePlate})` : ''}`
       const changedKeys = Object.keys(data).filter(
         (k) => (data as Record<string, unknown>)[k] !== undefined
       )
@@ -439,7 +440,7 @@ export async function deleteVehicle(vehicleId: string) {
       await db.vehicle.deleteMany({ where: { id: vehicleId, organizationId } })
       await releaseFiles(files, { organizationId, reason: 'vehicle deleted' })
 
-      const vehicleDisplay = `${vehicle.year} ${vehicle.make} ${vehicle.model}${vehicle.licensePlate ? ` (${vehicle.licensePlate})` : ''}`
+      const vehicleDisplay = `${vehicleName(vehicle)}${vehicle.licensePlate ? ` (${vehicle.licensePlate})` : ''}`
       revalidatePath('/')
       revalidatePath('/vehicles')
       return { vehicleId, vehicleDisplay }

+ 3 - 6
src/features/vehicles/Components/MyActiveJobs.tsx

@@ -50,6 +50,7 @@ import { useTimeClock } from '@/features/time-tracking/Components/TimeClockProvi
 import { useTick } from '@/features/time-tracking/hooks/useTick'
 import { formatElapsed } from '@/features/time-tracking/Lib/timesheet'
 import { cn } from '@/lib/utils'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface MyActiveJobsProps {
   jobs: MyActiveJob[]
@@ -424,7 +425,7 @@ export function MyActiveJobs({
                       </p>
                       <p className="text-xs text-muted-foreground truncate">
                         {job.vehicle
-                          ? `${job.vehicle.year} ${job.vehicle.make} ${job.vehicle.model}${job.vehicle.licensePlate ? ` · ${job.vehicle.licensePlate}` : ''}`
+                          ? `${vehicleName(job.vehicle)}${job.vehicle.licensePlate ? ` · ${job.vehicle.licensePlate}` : ''}`
                           : (job.customer?.name ?? '')}
                       </p>
                     </div>
@@ -767,11 +768,7 @@ export function MyActiveJobs({
                 if (!open) setStatusReportJobId(null)
               }}
               serviceRecordId={statusReportJobId}
-              vehicleName={
-                job.vehicle
-                  ? `${job.vehicle.year} ${job.vehicle.make} ${job.vehicle.model}`
-                  : job.title
-              }
+              vehicleName={job.vehicle ? `${vehicleName(job.vehicle)}` : job.title}
               customer={job.customer}
               smsEnabled={smsEnabled}
               emailEnabled={emailEnabled}

+ 3 - 2
src/features/vehicles/Components/ReminderFormDialog.tsx

@@ -30,6 +30,7 @@ import { useGlassModal } from '@/components/glass-modal'
 import { createReminder, updateReminder } from '../Actions/reminderActions'
 import { searchVehicles } from '../Actions/vehicleActions'
 import { clearableInput } from '@/lib/clearable'
+import { vehicleName } from '@/lib/vehicle-name'
 
 export interface ReminderFormVehicle {
   id: string
@@ -307,7 +308,7 @@ export function ReminderFormDialog({
                   className="w-full justify-between font-normal"
                 >
                   {selectedVehicle && formVehicleId
-                    ? `${selectedVehicle.year} ${selectedVehicle.make} ${selectedVehicle.model}${selectedVehicle.licensePlate ? ` · ${selectedVehicle.licensePlate}` : ''}`
+                    ? `${vehicleName(selectedVehicle)}${selectedVehicle.licensePlate ? ` · ${selectedVehicle.licensePlate}` : ''}`
                     : t('selectVehicle')}
                   <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
                 </Button>
@@ -371,7 +372,7 @@ export function ReminderFormDialog({
                           />
                           <div>
                             <p className="text-sm">
-                              {v.year} {v.make} {v.model}
+                              {vehicleName(v)}
                               {v.licensePlate && (
                                 <span className="ml-1.5 text-muted-foreground">
                                   · {v.licensePlate}

+ 2 - 1
src/features/vehicles/Components/RemindersPageClient.tsx

@@ -39,6 +39,7 @@ import { toast } from 'sonner'
 import { toggleReminder, deleteReminder } from '../Actions/reminderActions'
 import { ReminderFormDialog } from './ReminderFormDialog'
 import { ReminderImportDialog } from './ReminderImportDialog'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface Reminder {
   id: string
@@ -223,7 +224,7 @@ export function RemindersPageClient({ reminders, unitSystem }: RemindersPageClie
                           {r.vehicle ? (
                             <span className="text-xs text-muted-foreground">
                               <TableCellLink href={`/vehicles/${r.vehicle.id}?tab=reminders`}>
-                                {r.vehicle.year} {r.vehicle.make} {r.vehicle.model}
+                                {vehicleName(r.vehicle)}
                                 {r.vehicle.licensePlate && ` · ${r.vehicle.licensePlate}`}
                               </TableCellLink>
                             </span>

+ 2 - 1
src/features/vehicles/Components/VehicleSafetyPanel.tsx

@@ -18,6 +18,7 @@ import {
   Star,
 } from 'lucide-react'
 import { AppCard } from '@/components/app-card'
+import { vehicleName } from '@/lib/vehicle-name'
 import { Badge } from '@/components/ui/badge'
 import { Button } from '@/components/ui/button'
 import { Skeleton } from '@/components/ui/skeleton'
@@ -103,7 +104,7 @@ export function VehicleSafetyPanel({
   const urgent = recalls.some((r) => r.parkIt || r.parkOutside)
   const modelLabel = report?.matched
     ? `${report.matched.year} ${titleCase(report.matched.make)} ${titleCase(report.matched.model)}`
-    : `${year} ${make} ${model}`
+    : vehicleName({ year, make, model })
 
   const alreadyAdded = useMemo(() => {
     const set = new Set(added)

+ 2 - 1
src/features/vehicles/Components/service-history-pdf/ServiceHistoryPDF.tsx

@@ -8,6 +8,7 @@ import {
 import { createStyles, gray, getFontBold } from '../invoice-pdf/styles'
 import type { WorkshopInfo, InvoiceSettingsProps } from '../invoice-pdf/types'
 import { typeKeyLine } from '@/features/vehicles/Lib/typeKey'
+import { vehicleName as vehicleNameOf } from '@/lib/vehicle-name'
 
 interface ServiceHistoryRecord {
   id: string
@@ -85,7 +86,7 @@ export function ServiceHistoryPDF({
   const tz = invoiceSettings?.timezone || undefined
   const unitLabel = invoiceSettings?.unitSystem === 'metric' ? labels.km || 'km' : labels.mi || 'mi'
 
-  const vehicleName = `${vehicle.year} ${vehicle.make} ${vehicle.model}`
+  const vehicleName = `${vehicleNameOf(vehicle)}`
   const shopDisplayName = workshop?.name || 'Torqvoice'
 
   const grandTotal = records.reduce((sum, r) => {

+ 3 - 6
src/features/vehicles/Components/service-page/ServicePageClient.tsx

@@ -70,6 +70,7 @@ import { ModernDetails } from './modern/ModernDetails'
 import { ModernHero } from './modern/ModernHero'
 import type { WorkOrderJobProps, WorkOrderSidebarProps } from './modern/details-props'
 import { lineTotal, resolvePartPrice } from '@/features/inventory/Lib/partPricing'
+import { vehicleName } from '@/lib/vehicle-name'
 
 export type { ServicePageClientProps, BoardTechnicianOption } from './service-page-types'
 
@@ -288,9 +289,7 @@ export function ServicePageClient({
     const tplResult = await getSmsTemplates()
     const tplData = tplResult.success && tplResult.data ? tplResult.data : null
     const tpl = tplData?.templates[templateKey] || SMS_TEMPLATE_DEFAULTS[templateKey] || ''
-    const vehicle = record.vehicle
-      ? `${record.vehicle.year} ${record.vehicle.make} ${record.vehicle.model}`
-      : record.title
+    const vehicle = record.vehicle ? `${vehicleName(record.vehicle)}` : record.title
     const message = interpolateSmsTemplate(tpl, {
       customer_name: customer.name,
       vehicle,
@@ -309,9 +308,7 @@ export function ServicePageClient({
       if (!customer) return
       const tplResult = await getSmsTemplates()
       const tplData = tplResult.success && tplResult.data ? tplResult.data : null
-      const vehicle = record.vehicle
-        ? `${record.vehicle.year} ${record.vehicle.make} ${record.vehicle.model}`
-        : record.title
+      const vehicle = record.vehicle ? `${vehicleName(record.vehicle)}` : record.title
       const message = interpolateSmsTemplate(
         // Read raw: the text carries {tokens} of its own, which are filled in
         // below and are not message arguments.

+ 3 - 2
src/features/vehicles/Components/service-page/modern/JobFactsCard.tsx

@@ -18,6 +18,7 @@ import type { ServiceDetail } from '../../service-detail/types'
 import type { InitialData } from '../../service-edit/form-types'
 import { formatTypeKey } from '../../../Lib/typeKey'
 import { useTypeKeyEnabled } from '@/components/type-key-context'
+import { vehicleName as vehicleNameOf } from '@/lib/vehicle-name'
 
 interface JobFactsCardProps {
   record: ServiceDetail
@@ -286,7 +287,7 @@ export function JobFactsCard({
                   href={`/vehicles/${vehicle.id}`}
                   className={cn(nameLink, 'block truncate text-sm font-semibold leading-tight')}
                 >
-                  {vehicle.year} {vehicle.make} {vehicle.model}
+                  {vehicleNameOf(vehicle)}
                 </Link>
                 {vehicle.vin && (
                   <p className="flex min-w-0 items-center gap-0.5 font-mono text-xs text-muted-foreground">
@@ -454,7 +455,7 @@ function VehicleDetails({
     {
       key: 'vehicle',
       label: t('basicInfo.vehicle'),
-      value: `${vehicle.year} ${vehicle.make} ${vehicle.model}`,
+      value: vehicleNameOf(vehicle),
       copy: true,
     },
     { key: 'color', label: tv('color'), value: vehicle.color ?? null },

+ 2 - 5
src/features/vehicles/Components/service-page/modern/ModernDetails.tsx

@@ -38,6 +38,7 @@ import { JobFactsCard } from './JobFactsCard'
 import { MoneyBar, MoneyLine } from './MoneyBar'
 import type { WorkOrderStatusOption } from '@/features/work-order-statuses/Lib/stages'
 import { StatusStepper } from './StatusStepper'
+import { vehicleName } from '@/lib/vehicle-name'
 
 export interface ModernDetailsProps
   extends WorkOrderJobProps,
@@ -371,11 +372,7 @@ export function ModernDetails(props: ModernDetailsProps) {
                     openObservationsCount={props.openObservationsCount}
                     onShowExistingObservations={props.onShowExistingObservations}
                     vehicleId={record.vehicle?.id ?? null}
-                    vehicleLabel={
-                      record.vehicle
-                        ? `${record.vehicle.year} ${record.vehicle.make} ${record.vehicle.model}`
-                        : undefined
-                    }
+                    vehicleLabel={record.vehicle ? `${vehicleName(record.vehicle)}` : undefined}
                     guideStock={guideStock}
                     onAddGuidePart={(line) =>
                       formState.dirtySetPartItems((prev) => [servicePartFromFluid(line), ...prev])

+ 2 - 1
src/features/vehicles/Components/service-page/modern/ModernHero.tsx

@@ -23,6 +23,7 @@ import {
   statusMessageKeys,
   type ServiceDetail,
 } from '../../service-detail/types'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface ModernHeroProps {
   record: ServiceDetail
@@ -334,7 +335,7 @@ export function ModernHero({
                 {customer && vehicle && <span aria-hidden="true">·</span>}
                 {vehicle && (
                   <Link href={`/vehicles/${vehicle.id}`} className={factLink}>
-                    {vehicle.year} {vehicle.make} {vehicle.model}
+                    {vehicleName(vehicle)}
                   </Link>
                 )}
                 {vehicle?.licensePlate && (

+ 2 - 3
src/features/vehicles/Components/service-page/useServiceFormState.ts

@@ -22,6 +22,7 @@ import {
 import type { ConcernRow } from '../service-edit/form-types'
 import type { ServicePartInput, ServiceLaborInput, InitialData } from './service-page-types'
 import type { ServiceDetail } from '../service-detail/types'
+import { vehicleName as vehicleNameOf } from '@/lib/vehicle-name'
 
 export function useServiceFormState({
   vehicleId,
@@ -379,9 +380,7 @@ export function useServiceFormState({
         ? 'paid'
         : 'partial'
   const imageAttachments = record.attachments?.filter((a) => a.category === 'image') || []
-  const vehicleName = record.vehicle
-    ? `${record.vehicle.year} ${record.vehicle.make} ${record.vehicle.model}`
-    : ''
+  const vehicleName = record.vehicle ? `${vehicleNameOf(record.vehicle)}` : ''
 
   // Part/labor update helpers
   //

+ 3 - 2
src/features/workboard/Components/BoardJobCard.tsx

@@ -8,6 +8,7 @@ import type { WorkBoardJob } from '../Actions/boardActions'
 import { getJobDateRange, getDurationMinutes } from '../utils/datetime'
 import { formatDuration } from './DurationSlider'
 import { PromiseOverdueMark } from './PromiseOverdueMark'
+import { vehicleName } from '@/lib/vehicle-name'
 
 /** How many people are on a job besides its technician, on the card itself. */
 export function TeamCount({ count }: { count: number }) {
@@ -67,7 +68,7 @@ export function BoardJobCard({ job, onClick }: { job: WorkBoardJob; onClick?: ()
         </div>
         {job.vehicle && (
           <p className="truncate text-muted-foreground">
-            {job.vehicle.year} {job.vehicle.make} {job.vehicle.model}
+            {vehicleName(job.vehicle)}
             {job.vehicle.licensePlate ? ` · ${job.vehicle.licensePlate}` : ''}
           </p>
         )}
@@ -163,7 +164,7 @@ export function UnassignedJobCard({
         </div>
         {job.vehicle && (
           <p className="truncate text-muted-foreground">
-            {job.vehicle.year} {job.vehicle.make} {job.vehicle.model}
+            {vehicleName(job.vehicle)}
             {job.vehicle.licensePlate ? ` · ${job.vehicle.licensePlate}` : ''}
           </p>
         )}

+ 2 - 1
src/features/workboard/Components/JobDetailPopover.tsx

@@ -22,6 +22,7 @@ import { useDateSettings } from '@/components/date-settings-context'
 import { useTranslations } from 'next-intl'
 import { toast } from 'sonner'
 import { getJobDateRange } from '../utils/datetime'
+import { vehicleName } from '@/lib/vehicle-name'
 
 export function JobDetailPopover({
   job,
@@ -138,7 +139,7 @@ export function JobDetailPopover({
         <div className="space-y-3">
           {liveJob.vehicle && (
             <p className="text-sm text-muted-foreground">
-              {liveJob.vehicle.year} {liveJob.vehicle.make} {liveJob.vehicle.model}
+              {vehicleName(liveJob.vehicle)}
               {liveJob.vehicle.licensePlate ? ` · ${liveJob.vehicle.licensePlate}` : ''}
             </p>
           )}

+ 2 - 3
src/features/workboard/Components/JobTooltip.tsx

@@ -12,6 +12,7 @@ import { formatDuration } from './DurationSlider'
 import { isPromiseOverdue } from '@/features/vehicles/Lib/promise'
 import { useDateSettings } from '@/components/date-settings-context'
 import { toBoardDate } from '../utils/board-time'
+import { vehicleName } from '@/lib/vehicle-name'
 
 /** Status strings as the translation file spells them. */
 const STATUS_KEY: Record<string, string> = {
@@ -59,9 +60,7 @@ export function JobTooltip({
   const statusKey = STATUS_KEY[normalizeStatus(job.status)]
 
   const vehicle = job.vehicle
-    ? [`${job.vehicle.year} ${job.vehicle.make} ${job.vehicle.model}`, job.vehicle.licensePlate]
-        .filter(Boolean)
-        .join(' · ')
+    ? [`${vehicleName(job.vehicle)}`, job.vehicle.licensePlate].filter(Boolean).join(' · ')
     : null
 
   return (

+ 2 - 1
src/features/workboard/Components/PresenterKanbanView.tsx

@@ -5,6 +5,7 @@ import type { Technician } from '../store/workboardStore'
 import type { WorkBoardJob } from '../Actions/boardActions'
 import { jobOverlapsDate } from '../utils/datetime'
 import { useTranslations } from 'next-intl'
+import { vehicleName } from '@/lib/vehicle-name'
 
 const STATUS_COLUMNS = [
   { key: 'pending', i18nKey: 'pending', color: 'bg-yellow-500' },
@@ -36,7 +37,7 @@ function KanbanCard({ job, withLabel }: { job: WorkBoardJob; withLabel?: string
       </div>
       {job.vehicle && (
         <p className="mt-1 truncate text-sm text-muted-foreground">
-          {job.vehicle.year} {job.vehicle.make} {job.vehicle.model}
+          {vehicleName(job.vehicle)}
           {job.vehicle.licensePlate ? ` · ${job.vehicle.licensePlate}` : ''}
         </p>
       )}

+ 3 - 2
src/features/workboard/Components/WeekCardGrid.tsx

@@ -21,6 +21,7 @@ import { BoardJobCard, TeamCount } from './BoardJobCard'
 import { DayLoadFigure } from './DayLoad'
 import { JobTooltip } from './JobTooltip'
 import { LaneHeaderTooltip } from './LaneHeaderTooltip'
+import { vehicleName } from '@/lib/vehicle-name'
 
 /**
  * The week as a list per lane per day.
@@ -262,7 +263,7 @@ function StaticJobCard({ job }: { job: WorkBoardJob }) {
       </div>
       {job.vehicle && (
         <p className="truncate text-muted-foreground">
-          {job.vehicle.year} {job.vehicle.make} {job.vehicle.model}
+          {vehicleName(job.vehicle)}
           {job.vehicle.licensePlate ? ` · ${job.vehicle.licensePlate}` : ''}
         </p>
       )}
@@ -300,7 +301,7 @@ function ShadowJobCard({
       </div>
       {job.vehicle && (
         <p className="truncate text-muted-foreground">
-          {job.vehicle.year} {job.vehicle.make} {job.vehicle.model}
+          {vehicleName(job.vehicle)}
           {job.vehicle.licensePlate ? ` · ${job.vehicle.licensePlate}` : ''}
         </p>
       )}

+ 3 - 2
src/lib/ai.ts

@@ -10,6 +10,7 @@ import {
   OPENAI_BASE,
   normalizeBaseUrl,
 } from '@/integrations/ai/models'
+import { vehicleName } from '@/lib/vehicle-name'
 
 interface AiConfig {
   provider: string
@@ -329,7 +330,7 @@ upcomingMaintenance: predict 2-4 likely upcoming needs based on mileage, age, an
     )
     .join('\n')
 
-  const userPrompt = `Vehicle: ${vehicle.year} ${vehicle.make} ${vehicle.model}${vehicle.licensePlate ? ` (${vehicle.licensePlate})` : ''}
+  const userPrompt = `Vehicle: ${vehicleName(vehicle)}${vehicle.licensePlate ? ` (${vehicle.licensePlate})` : ''}
 
 Service history (${records.length} records):
 ${recordsStr || 'No service records found.'}
@@ -351,7 +352,7 @@ Return ONLY valid JSON, no markdown, no explanation. Use this exact schema:
 
 severity is 1-5 based on how widely reported the issue is (5 = extremely common/well-documented, affects majority of vehicles; 1 = rare but critical).${languageInstruction(locale)}`
 
-  const userPrompt = `What are the 5 most critical and common issues with the ${vehicle.year} ${vehicle.make} ${vehicle.model}? Return JSON only.`
+  const userPrompt = `What are the 5 most critical and common issues with the ${vehicleName(vehicle)}? Return JSON only.`
 
   return chatCompletion(organizationId, systemPrompt, userPrompt)
 }

+ 3 - 6
src/lib/backup/explore.ts

@@ -2,6 +2,7 @@ import { mkdir, readdir, rm, stat } from 'node:fs/promises'
 import path from 'node:path'
 import { z } from 'zod'
 import { dataRoot } from '@/lib/upload-root'
+import { vehicleName } from '@/lib/vehicle-name'
 import { type OpenedTarget, openTarget, type RunTarget } from './engine'
 import { MAX_OPEN_RESTORE_POINTS as MAX_OPEN, maxDataFileBytes } from './limits'
 import { UPLOAD_CATEGORIES } from './manifest'
@@ -384,12 +385,8 @@ function text(v: unknown): string {
 }
 
 function vehicleLabel(v: Row): string {
-  return [
-    text(v.licensePlate),
-    [text(v.year), text(v.make), text(v.model)].filter(Boolean).join(' '),
-  ]
-    .filter(Boolean)
-    .join(' · ')
+  const name = vehicleName({ year: text(v.year), make: text(v.make), model: text(v.model) })
+  return [text(v.licensePlate), name].filter(Boolean).join(' · ')
 }
 
 /** One row as the list shows it: a title, a line under it, and the fields searched. */

+ 2 - 1
src/lib/cron/appointment-notifications.ts

@@ -16,6 +16,7 @@ import { SETTING_KEYS } from '@/features/settings/Schema/settingsSchema'
 import { DEFAULT_TIME_FORMAT } from '@/lib/format'
 import { createLogger } from '@/lib/logger'
 import { createTickSummary } from './tick-summary'
+import { vehicleName } from '@/lib/vehicle-name'
 
 const log = createLogger('appointment-notifications')
 
@@ -45,7 +46,7 @@ const vehicleLabel = (v: {
   make: string
   model: string
   licensePlate: string | null
-}) => `${v.year} ${v.make} ${v.model}${v.licensePlate ? ` (${v.licensePlate})` : ''}`
+}) => `${vehicleName(v)}${v.licensePlate ? ` (${v.licensePlate})` : ''}`
 
 /**
  * Sends the notifications whose time has come: for appointments, and for

+ 2 - 1
src/lib/cron/reminder-alerts.ts

@@ -5,6 +5,7 @@ import { sendOrgMail, getOrgFromAddress } from '@/lib/email'
 import { frozenOrganizationIds, isRestoring } from '@/lib/backup/freeze'
 import { createLogger } from '@/lib/logger'
 import { createTickSummary } from './tick-summary'
+import { vehicleName } from '@/lib/vehicle-name'
 
 const log = createLogger('reminder-alerts')
 
@@ -30,7 +31,7 @@ type DueReminder = {
 /** What the reminder relates to: vehicle, customer, or the workshop itself. */
 function targetLabel(r: DueReminder) {
   if (r.vehicle) {
-    const base = `${r.vehicle.year} ${r.vehicle.make} ${r.vehicle.model}`
+    const base = `${vehicleName(r.vehicle)}`
     return r.vehicle.licensePlate ? `${base} (${r.vehicle.licensePlate})` : base
   }
   return r.customer?.name ?? null

+ 27 - 0
src/lib/vehicle-name.ts

@@ -0,0 +1,27 @@
+/**
+ * A vehicle's display name, the way the rest of the app builds it: the
+ * year, make and model, spaced, with whatever is known.
+ *
+ * The year column is a non-null integer, so a vehicle whose year nobody
+ * has ever entered reads as 0. That 0 is "unknown", not a year, so it is
+ * left out of the name instead of rendering a bare 0 in front of the make
+ * ("0 Ford Edge"). The vehicle form keeps years above 1900, but restores
+ * of older backups and third-party imports can still carry a 0, and those
+ * rows stay in the workshop until somebody fixes them. Rows read from an
+ * import may also hold the year as text, so a string is accepted as well.
+ */
+export function vehicleName(
+  vehicle: {
+    year?: number | string | null
+    make?: string | null
+    model?: string | null
+  },
+  separator = ' '
+): string {
+  const rawYear = vehicle.year
+  const year = rawYear === null || rawYear === undefined ? null : String(rawYear).trim()
+  const parts = [year === '0' ? null : year, vehicle.make, vehicle.model].filter(
+    (part): part is string => typeof part === 'string' && part.trim() !== ''
+  )
+  return parts.join(separator)
+}