Переглянути джерело

Add a vehicle or customer while booking, and book straight from plate lookup (#618)

* Add a vehicle or customer while booking, and book straight from plate lookup

The booking dialog and the work order picker open the full vehicle and
customer forms and take the new record back selected. The plate lookup
offers Book appointment and New work order on a vehicle on file, the
booking dialog opens from any screen, and the short add-vehicle form in
the work order picker is removed.

* Close gaps in booking with a new vehicle found in review

Offer a new customer only to roles that may add one, keep a booked job's
customer as the owner of a car added to it, drop the booking's customer
when the car added comes back without an owner, start a booking made
late in the day on tomorrow's first hour, reload the calendar after a
booking made from the header, and keep Enter from saving the vehicle
form while a registry lookup is still running.
Bernt Christian Egeland 1 день тому
батько
коміт
40016e8fea
87 змінених файлів з 2775 додано та 1104 видалено
  1. 15 10
      e2e/specs/cloud/plan-gates.spec.ts
  2. 31 16
      e2e/specs/settings/marine.spec.ts
  3. 11 3
      messages/de/calendar.json
  4. 2 1
      messages/de/customers.json
  5. 2 1
      messages/de/navigation.json
  6. 6 2
      messages/de/vehicles.json
  7. 0 10
      messages/de/workOrders.json
  8. 11 3
      messages/en/calendar.json
  9. 2 1
      messages/en/customers.json
  10. 2 1
      messages/en/navigation.json
  11. 6 2
      messages/en/vehicles.json
  12. 0 10
      messages/en/workOrders.json
  13. 11 3
      messages/es/calendar.json
  14. 2 1
      messages/es/customers.json
  15. 2 1
      messages/es/navigation.json
  16. 6 2
      messages/es/vehicles.json
  17. 0 10
      messages/es/workOrders.json
  18. 11 3
      messages/fr/calendar.json
  19. 2 1
      messages/fr/customers.json
  20. 2 1
      messages/fr/navigation.json
  21. 6 2
      messages/fr/vehicles.json
  22. 0 10
      messages/fr/workOrders.json
  23. 11 3
      messages/it/calendar.json
  24. 2 1
      messages/it/customers.json
  25. 2 1
      messages/it/navigation.json
  26. 6 2
      messages/it/vehicles.json
  27. 0 10
      messages/it/workOrders.json
  28. 11 3
      messages/lt/calendar.json
  29. 2 1
      messages/lt/customers.json
  30. 2 1
      messages/lt/navigation.json
  31. 6 2
      messages/lt/vehicles.json
  32. 0 10
      messages/lt/workOrders.json
  33. 11 3
      messages/nb/calendar.json
  34. 2 1
      messages/nb/customers.json
  35. 2 1
      messages/nb/navigation.json
  36. 6 2
      messages/nb/vehicles.json
  37. 0 10
      messages/nb/workOrders.json
  38. 11 3
      messages/nl/calendar.json
  39. 2 1
      messages/nl/customers.json
  40. 2 1
      messages/nl/navigation.json
  41. 6 2
      messages/nl/vehicles.json
  42. 0 10
      messages/nl/workOrders.json
  43. 11 3
      messages/pl/calendar.json
  44. 2 1
      messages/pl/customers.json
  45. 2 1
      messages/pl/navigation.json
  46. 6 2
      messages/pl/vehicles.json
  47. 0 10
      messages/pl/workOrders.json
  48. 11 3
      messages/pt-BR/calendar.json
  49. 2 1
      messages/pt-BR/customers.json
  50. 2 1
      messages/pt-BR/navigation.json
  51. 6 2
      messages/pt-BR/vehicles.json
  52. 0 10
      messages/pt-BR/workOrders.json
  53. 11 3
      messages/pt-PT/calendar.json
  54. 2 1
      messages/pt-PT/customers.json
  55. 2 1
      messages/pt-PT/navigation.json
  56. 6 2
      messages/pt-PT/vehicles.json
  57. 0 10
      messages/pt-PT/workOrders.json
  58. 11 3
      messages/ru/calendar.json
  59. 2 1
      messages/ru/customers.json
  60. 2 1
      messages/ru/navigation.json
  61. 6 2
      messages/ru/vehicles.json
  62. 0 10
      messages/ru/workOrders.json
  63. 11 3
      messages/tr/calendar.json
  64. 2 1
      messages/tr/customers.json
  65. 2 1
      messages/tr/navigation.json
  66. 6 2
      messages/tr/vehicles.json
  67. 0 10
      messages/tr/workOrders.json
  68. 82 0
      src/__tests__/components/quick-create-menu.test.tsx
  69. 193 49
      src/__tests__/components/vehicle-picker-dialog.test.tsx
  70. 376 15
      src/__tests__/features/calendar/booking-dialog.test.tsx
  71. 205 0
      src/__tests__/features/calendar/booking-host.test.tsx
  72. 244 0
      src/__tests__/features/vehicles/plate-lookup-command.test.tsx
  73. 164 4
      src/__tests__/features/vehicles/vehicle-form-dialog.test.tsx
  74. 89 70
      src/app/(authenticated)/layout.tsx
  75. 72 0
      src/components/booking-launcher.tsx
  76. 10 0
      src/components/quick-create-menu.tsx
  77. 201 382
      src/components/vehicle-picker-dialog.tsx
  78. 471 286
      src/features/calendar/Components/BookingDialog.tsx
  79. 83 0
      src/features/calendar/Components/BookingHost.tsx
  80. 8 0
      src/features/calendar/Components/CalendarClient.tsx
  81. 12 1
      src/features/customers/Components/CustomerForm.tsx
  82. 6 3
      src/features/quotes/Components/CustomerCombobox.tsx
  83. 9 2
      src/features/quotes/Components/VehicleCombobox.tsx
  84. 129 39
      src/features/vehicles/Components/PlateLookupCommand.tsx
  85. 90 6
      src/features/vehicles/Components/VehicleForm.tsx
  86. 2 0
      src/features/vehicles/Components/VehicleLookupButton.tsx
  87. 10 0
      src/features/vehicles/Lib/plate.ts

+ 15 - 10
e2e/specs/cloud/plan-gates.spec.ts

@@ -104,29 +104,34 @@ test.describe('the free plan', () => {
   })
   })
 
 
   test('offers the same upgrade when a new work order creates the customer', async ({ page }) => {
   test('offers the same upgrade when a new work order creates the customer', async ({ page }) => {
-    // The flow the getting-started checklist sends a new workshop to: vehicle,
-    // customer and job from one dialog. Still at the limit, the customer is
-    // refused, and with it the vehicle that would have belonged to them.
+    // The flow the getting-started checklist sends a new workshop to: the
+    // work order picker opens the full vehicle form, whose owner picker adds
+    // the customer. Still at the limit, the customer is refused, and with it
+    // the vehicle that would have belonged to them.
     const customers = await customerRows(organizationId)
     const customers = await customerRows(organizationId)
     const vehicles = await vehicleRows(organizationId)
     const vehicles = await vehicleRows(organizationId)
 
 
     await page.goto('/work-orders?new=1')
     await page.goto('/work-orders?new=1')
     await settle(page)
     await settle(page)
+    const vehicleForm = page.getByRole('dialog', { name: 'Add New Vehicle' })
     await expect(async () => {
     await expect(async () => {
       await page
       await page
         .getByRole('dialog', { name: 'Select Vehicle' })
         .getByRole('dialog', { name: 'Select Vehicle' })
         .getByRole('button', { name: 'Add New Vehicle' })
         .getByRole('button', { name: 'Add New Vehicle' })
         .first()
         .first()
         .click()
         .click()
-      await expect(page.locator('#new-make')).toBeVisible({ timeout: 2_000 })
+      await expect(vehicleForm.locator('#make')).toBeVisible({ timeout: 2_000 })
     }).toPass({ timeout: 30_000 })
     }).toPass({ timeout: 30_000 })
 
 
-    await page.locator('#new-make').fill('Volvo')
-    await page.locator('#new-model').fill('V70')
-    await page.locator('#new-year').fill('2015')
-    await page.getByRole('button', { name: 'Create new customer' }).click()
-    await page.locator('#new-customer-name').fill(`E2E Work order customer ${stamp}`)
-    await page.getByRole('button', { name: 'Create & Continue' }).click()
+    await vehicleForm.locator('#make').fill('Volvo')
+    await vehicleForm.locator('#model').fill('V70')
+    await vehicleForm.locator('#year').fill('2015')
+    await vehicleForm.getByRole('combobox').click()
+    await page.getByRole('button', { name: 'Add Customer', exact: true }).click()
+    const customerForm = page.getByRole('dialog', { name: 'Add New Customer' })
+    await expect(customerForm).toBeVisible()
+    await customerForm.locator('#name').fill(`E2E Work order customer ${stamp}`)
+    await customerForm.locator('button[type="submit"]').click()
 
 
     await expectUpgradeOffered(page, new RegExp(`up to ${FREE_CUSTOMERS} customers`))
     await expectUpgradeOffered(page, new RegExp(`up to ${FREE_CUSTOMERS} customers`))
     expect(await customerRows(organizationId), 'no customer written').toBe(customers)
     expect(await customerRows(organizationId), 'no customer written').toBe(customers)

+ 31 - 16
e2e/specs/settings/marine.spec.ts

@@ -103,11 +103,17 @@ async function setServiceType(page: Page, type: 'Automotive' | 'Marine'): Promis
     .toBe(type.toLowerCase())
     .toBe(type.toLowerCase())
 }
 }
 
 
-/** The vehicle list's add form, open. */
-async function openAddVehicle(page: Page): Promise<Locator> {
+/**
+ * The vehicle list's add form, open. A marine workshop's is titled "Add New
+ * Vessel", an automotive one's "Add New Vehicle".
+ */
+async function openAddVehicle(
+  page: Page,
+  title: 'Add New Vehicle' | 'Add New Vessel' = 'Add New Vehicle'
+): Promise<Locator> {
   await page.goto('/vehicles')
   await page.goto('/vehicles')
   await settle(page)
   await settle(page)
-  const dialog = page.getByRole('dialog', { name: 'Add New Vehicle' })
+  const dialog = page.getByRole('dialog', { name: title })
   await expect(async () => {
   await expect(async () => {
     await page
     await page
       .getByRole('button', { name: 'Add Vehicle' })
       .getByRole('button', { name: 'Add Vehicle' })
@@ -156,7 +162,7 @@ test.describe('a workshop that picks Marine', () => {
   })
   })
 
 
   test('asks for what a boat has when one is added', async ({ page }) => {
   test('asks for what a boat has when one is added', async ({ page }) => {
-    const dialog = await openAddVehicle(page)
+    const dialog = await openAddVehicle(page, 'Add New Vessel')
 
 
     await expect(label(dialog, 'make')).toHaveText('Manufacturer *')
     await expect(label(dialog, 'make')).toHaveText('Manufacturer *')
     await expect(label(dialog, 'mileage')).toHaveText('Engine Hours')
     await expect(label(dialog, 'mileage')).toHaveText('Engine Hours')
@@ -185,7 +191,7 @@ test.describe('a workshop that picks Marine', () => {
     await dialog.locator('#mileage').fill(VESSEL.hours)
     await dialog.locator('#mileage').fill(VESSEL.hours)
     await dialog.locator('#vin').fill(`BWC${stamp}`.slice(0, 12))
     await dialog.locator('#vin').fill(`BWC${stamp}`.slice(0, 12))
     await dialog.locator('#licensePlate').fill('NB-4521-E')
     await dialog.locator('#licensePlate').fill('NB-4521-E')
-    await dialog.getByRole('button', { name: 'Add New Vehicle' }).click()
+    await dialog.getByRole('button', { name: 'Add New Vessel' }).click()
     await expect(page.getByText('Vehicle added')).toBeVisible({ timeout: 30_000 })
     await expect(page.getByText('Vehicle added')).toBeVisible({ timeout: 30_000 })
   })
   })
 
 
@@ -249,22 +255,31 @@ test.describe('a workshop that picks Marine', () => {
     await expect(picker).toBeVisible({ timeout: 30_000 })
     await expect(picker).toBeVisible({ timeout: 30_000 })
     await expect(picker.getByPlaceholder('Search vessels...')).toBeVisible()
     await expect(picker.getByPlaceholder('Search vessels...')).toBeVisible()
 
 
+    // The full vessel form, the one the vessel list opens, over the picker.
+    const create = page.getByRole('dialog', { name: 'Add New Vessel' })
     await expect(async () => {
     await expect(async () => {
       await picker.getByRole('button', { name: 'Add New Vessel' }).first().click()
       await picker.getByRole('button', { name: 'Add New Vessel' }).first().click()
-      await expect(page.locator('#new-make')).toBeVisible({ timeout: 2_000 })
+      await expect(create.locator('#make')).toBeVisible({ timeout: 2_000 })
     }).toPass({ timeout: 30_000 })
     }).toPass({ timeout: 30_000 })
-    const create = page.getByRole('dialog', { name: 'Add New Vessel' })
-    await expect(create.getByText('Manufacturer *', { exact: true })).toBeVisible()
-    await expect(create.getByText('Registration Number', { exact: true })).toBeVisible()
+    await expect(label(create, 'make')).toHaveText('Manufacturer *')
+    await expect(label(create, 'licensePlate')).toContainText('Registration Number')
     await expect(create.getByText('License Plate', { exact: true })).toHaveCount(0)
     await expect(create.getByText('License Plate', { exact: true })).toHaveCount(0)
 
 
-    // A vessel and its owner, made in one go, for the customer page below.
-    await page.locator('#new-make').fill('Yamaha')
-    await page.locator('#new-model').fill(`242X ${stamp.toString(36)}`)
-    await page.locator('#new-year').fill('2019')
-    await page.getByRole('button', { name: 'Create new customer' }).click()
-    await page.locator('#new-customer-name').fill(SKIPPER)
-    await page.getByRole('button', { name: 'Create & Continue' }).click()
+    // A vessel and its owner, the owner added from the owner picker, for the
+    // customer page below.
+    await create.locator('#make').fill('Yamaha')
+    await create.locator('#model').fill(`242X ${stamp.toString(36)}`)
+    await create.locator('#year').fill('2019')
+    await create.getByRole('combobox').click()
+    await page.getByRole('button', { name: 'Add Customer', exact: true }).click()
+    const owner = page.getByRole('dialog', { name: 'Add New Customer' })
+    await expect(owner).toBeVisible()
+    await owner.locator('#name').fill(SKIPPER)
+    await owner.locator('button[type="submit"]').click()
+    await expect(owner).toBeHidden({ timeout: 30_000 })
+    await expect(create.getByRole('combobox')).toContainText(SKIPPER)
+
+    await create.getByRole('button', { name: 'Add New Vessel' }).click()
     await page.waitForURL(/\/vehicles\/[^/]+\/service\//, { timeout: 30_000 })
     await page.waitForURL(/\/vehicles\/[^/]+\/service\//, { timeout: 30_000 })
   })
   })
 
 

+ 11 - 3
messages/de/calendar.json

@@ -189,8 +189,8 @@
     "noVehiclesMarine": "Keine Boote gefunden.",
     "noVehiclesMarine": "Keine Boote gefunden.",
     "none": "Keine",
     "none": "Keine",
     "optional": "Optional",
     "optional": "Optional",
-    "whoHint": "Ein Kunde, ein Fahrzeug oder beides. Ein Fahrzeug, das noch nicht erfasst ist, kann bei der Ankunft zum Auftrag hinzugefügt werden.",
-    "whoHintMarine": "Ein Kunde, ein Boot oder beides. Ein Boot, das noch nicht erfasst ist, kann bei der Ankunft zum Auftrag hinzugefügt werden.",
+    "whoHint": "Ein Kunde, ein Fahrzeug oder beides. Noch nicht erfasst? Mit Neu anlegen.",
+    "whoHintMarine": "Ein Kunde, ein Boot oder beides. Noch nicht erfasst? Mit Neu anlegen.",
     "work": "Erforderliche Arbeiten",
     "work": "Erforderliche Arbeiten",
     "workPlaceholder": "Bremsen vorne quietschen\nÖlservice",
     "workPlaceholder": "Bremsen vorne quietschen\nÖlservice",
     "workPlaceholderMarine": "Motor überhitzt bei hoher Fahrt\nJahresservice",
     "workPlaceholderMarine": "Motor überhitzt bei hoher Fahrt\nJahresservice",
@@ -271,7 +271,15 @@
     "customerChannelNeedsCustomer": "Wählen Sie einen Kunden, um ihn zu benachrichtigen.",
     "customerChannelNeedsCustomer": "Wählen Sie einen Kunden, um ihn zu benachrichtigen.",
     "descriptionPlaceholder": "Beschreibung hinzufügen",
     "descriptionPlaceholder": "Beschreibung hinzufügen",
     "convertSubmit": "Arbeitsauftrag erstellen",
     "convertSubmit": "Arbeitsauftrag erstellen",
-    "saved": "Termin gespeichert"
+    "saved": "Termin gespeichert",
+    "new": "Neu",
+    "newCustomer": "Neuer Kunde",
+    "newCustomerNamed": "Neuer Kunde „{name}“",
+    "newVehicle": "Neues Fahrzeug",
+    "newVehicleMarine": "Neues Boot",
+    "newVehicleNamed": "Neues Fahrzeug mit Kennzeichen {plate}",
+    "newVehicleNamedMarine": "Neues Boot mit Kennzeichen {plate}",
+    "openCalendar": "Kalender öffnen"
   },
   },
   "notify": {
   "notify": {
     "inAppTitle": "Demnächst: {title}",
     "inAppTitle": "Demnächst: {title}",

+ 2 - 1
messages/de/customers.json

@@ -103,7 +103,8 @@
     "invoiceDesignDefault": "Werkstatt-Standard",
     "invoiceDesignDefault": "Werkstatt-Standard",
     "invoiceDesignHint": "Rechnungen für diesen Kunden werden mit diesem Design statt dem Werkstatt-Standard gedruckt. Eine Rechnung kann trotzdem ein eigenes wählen.",
     "invoiceDesignHint": "Rechnungen für diesen Kunden werden mit diesem Design statt dem Werkstatt-Standard gedruckt. Eine Rechnung kann trotzdem ein eigenes wählen.",
     "reminderOptOut": "Keine Erinnerungen",
     "reminderOptOut": "Keine Erinnerungen",
-    "reminderOptOutHint": "Diesen Kunden nicht in HU-Erinnerungen oder andere Kampagnen aufnehmen."
+    "reminderOptOutHint": "Diesen Kunden nicht in HU-Erinnerungen oder andere Kampagnen aufnehmen.",
+    "bookAppointment": "Termin buchen"
   },
   },
   "serviceRequests": {
   "serviceRequests": {
     "statusNew": "Neu",
     "statusNew": "Neu",

+ 2 - 1
messages/de/navigation.json

@@ -86,7 +86,8 @@
     "part": "Ersatzteil",
     "part": "Ersatzteil",
     "inspection": "Inspektion",
     "inspection": "Inspektion",
     "shopActions": "Werkstatt",
     "shopActions": "Werkstatt",
-    "person": "Person hinzufügen"
+    "person": "Person hinzufügen",
+    "appointment": "Termin"
   },
   },
   "purchaseWhiteLabel": "White-Label erwerben",
   "purchaseWhiteLabel": "White-Label erwerben",
   "licenseExpired": "Ihre Lizenz ist abgelaufen. Funktionen können eingeschränkt sein.",
   "licenseExpired": "Ihre Lizenz ist abgelaufen. Funktionen können eingeschränkt sein.",

+ 6 - 2
messages/de/vehicles.json

@@ -457,7 +457,9 @@
     "deleteVehicle": "Fahrzeug löschen",
     "deleteVehicle": "Fahrzeug löschen",
     "deleteVehicleMarine": "Boot löschen",
     "deleteVehicleMarine": "Boot löschen",
     "editMileage": "Kilometerstand ändern",
     "editMileage": "Kilometerstand ändern",
-    "editMileageMarine": "Betriebsstunden ändern"
+    "editMileageMarine": "Betriebsstunden ändern",
+    "bookAppointment": "Termin buchen",
+    "addTitleMarine": "Neues Wasserfahrzeug hinzufügen"
   },
   },
   "archiveDialog": {
   "archiveDialog": {
     "title": "Fahrzeug archivieren",
     "title": "Fahrzeug archivieren",
@@ -615,7 +617,9 @@
     "dueSoon": "Bald fällig",
     "dueSoon": "Bald fällig",
     "emptyTitle": "Beliebiges Kennzeichen abfragen",
     "emptyTitle": "Beliebiges Kennzeichen abfragen",
     "emptyBody": "Sehen Sie das Fahrzeug, wem es hier gehört und was {source} dazu führt. Noch nicht Ihres? In einem Schritt hinzufügen.",
     "emptyBody": "Sehen Sie das Fahrzeug, wem es hier gehört und was {source} dazu führt. Noch nicht Ihres? In einem Schritt hinzufügen.",
-    "registryWord": "das Register"
+    "registryWord": "das Register",
+    "bookAppointment": "Termin buchen",
+    "newWorkOrder": "Neuer Arbeitsauftrag"
   },
   },
   "safety": {
   "safety": {
     "title": "Sicherheit und bekannte Probleme",
     "title": "Sicherheit und bekannte Probleme",

+ 0 - 10
messages/de/workOrders.json

@@ -60,12 +60,6 @@
     "addNewVehicleMarine": "Neues Wasserfahrzeug hinzufügen",
     "addNewVehicleMarine": "Neues Wasserfahrzeug hinzufügen",
     "noPlate": "Kein Kennzeichen",
     "noPlate": "Kein Kennzeichen",
     "noPlateMarine": "Keine Registrierungsnummer",
     "noPlateMarine": "Keine Registrierungsnummer",
-    "make": "Hersteller *",
-    "makeMarine": "Hersteller *",
-    "model": "Modell *",
-    "year": "Jahr *",
-    "licensePlate": "Kennzeichen",
-    "licensePlateMarine": "Registrierungsnummer",
     "customer": "Kunde",
     "customer": "Kunde",
     "selectCustomer": "Wählen Sie einen Kunden (optional)",
     "selectCustomer": "Wählen Sie einen Kunden (optional)",
     "createNewCustomer": "Neuen Kunden erstellen",
     "createNewCustomer": "Neuen Kunden erstellen",
@@ -75,12 +69,8 @@
     "phone": "Telefon",
     "phone": "Telefon",
     "phonePlaceholder": "Telefonnummer",
     "phonePlaceholder": "Telefonnummer",
     "creating": "Wird erstellt...",
     "creating": "Wird erstellt...",
-    "createAndContinue": "Erstellen & Fortfahren",
-    "invalidYear": "Bitte geben Sie ein gültiges Jahr ein",
     "customerNameRequired": "Kundenname ist erforderlich",
     "customerNameRequired": "Kundenname ist erforderlich",
     "failedCreateCustomer": "Kunde konnte nicht erstellt werden",
     "failedCreateCustomer": "Kunde konnte nicht erstellt werden",
-    "failedCreateVehicle": "Fahrzeug konnte nicht erstellt werden",
-    "failedCreateVehicleMarine": "Wasserfahrzeug konnte nicht erstellt werden",
     "somethingWentWrong": "Etwas ist schief gelaufen",
     "somethingWentWrong": "Etwas ist schief gelaufen",
     "partsSale": "Reiner Teileverkauf",
     "partsSale": "Reiner Teileverkauf",
     "partsSaleDescription": "Rechnung ohne Fahrzeug erstellen, für Teileverkauf über die Theke.",
     "partsSaleDescription": "Rechnung ohne Fahrzeug erstellen, für Teileverkauf über die Theke.",

+ 11 - 3
messages/en/calendar.json

@@ -189,8 +189,8 @@
     "noVehiclesMarine": "No boats found.",
     "noVehiclesMarine": "No boats found.",
     "none": "None",
     "none": "None",
     "optional": "Optional",
     "optional": "Optional",
-    "whoHint": "A customer, a car or both. A car that is not on file yet can be added to the job when it arrives.",
-    "whoHintMarine": "A customer, a boat or both. A boat that is not on file yet can be added to the job when it arrives.",
+    "whoHint": "A customer, a car or both. Not on file yet? Add them with New.",
+    "whoHintMarine": "A customer, a boat or both. Not on file yet? Add them with New.",
     "work": "Work needed",
     "work": "Work needed",
     "workPlaceholder": "Front brakes squeal\nOil service",
     "workPlaceholder": "Front brakes squeal\nOil service",
     "workPlaceholderMarine": "Engine overheats at speed\nAnnual service",
     "workPlaceholderMarine": "Engine overheats at speed\nAnnual service",
@@ -271,7 +271,15 @@
     "customerChannelNeedsCustomer": "Choose a customer to notify them.",
     "customerChannelNeedsCustomer": "Choose a customer to notify them.",
     "descriptionPlaceholder": "Add description",
     "descriptionPlaceholder": "Add description",
     "convertSubmit": "Make work order",
     "convertSubmit": "Make work order",
-    "saved": "Booking saved"
+    "saved": "Booking saved",
+    "new": "New",
+    "newCustomer": "New customer",
+    "newCustomerNamed": "New customer \"{name}\"",
+    "newVehicle": "New vehicle",
+    "newVehicleMarine": "New boat",
+    "newVehicleNamed": "New vehicle with plate {plate}",
+    "newVehicleNamedMarine": "New boat with registration {plate}",
+    "openCalendar": "Open calendar"
   },
   },
   "notify": {
   "notify": {
     "inAppTitle": "Coming up: {title}",
     "inAppTitle": "Coming up: {title}",

+ 2 - 1
messages/en/customers.json

@@ -103,7 +103,8 @@
     "invoiceDesignDefault": "Workshop default",
     "invoiceDesignDefault": "Workshop default",
     "invoiceDesignHint": "Invoices for this customer print with this design instead of the workshop default. An invoice can still choose its own.",
     "invoiceDesignHint": "Invoices for this customer print with this design instead of the workshop default. An invoice can still choose its own.",
     "reminderOptOut": "No reminders",
     "reminderOptOut": "No reminders",
-    "reminderOptOutHint": "Do not include this customer in inspection reminders or other campaigns."
+    "reminderOptOutHint": "Do not include this customer in inspection reminders or other campaigns.",
+    "bookAppointment": "Book appointment"
   },
   },
   "serviceRequests": {
   "serviceRequests": {
     "statusNew": "New",
     "statusNew": "New",

+ 2 - 1
messages/en/navigation.json

@@ -86,7 +86,8 @@
     "part": "Part",
     "part": "Part",
     "inspection": "Inspection",
     "inspection": "Inspection",
     "shopActions": "Shop actions",
     "shopActions": "Shop actions",
-    "person": "Add a person"
+    "person": "Add a person",
+    "appointment": "Appointment"
   },
   },
   "purchaseWhiteLabel": "Purchase White-Label",
   "purchaseWhiteLabel": "Purchase White-Label",
   "licenseExpired": "Your license has expired. Features may be limited.",
   "licenseExpired": "Your license has expired. Features may be limited.",

+ 6 - 2
messages/en/vehicles.json

@@ -457,7 +457,9 @@
     "deleteVehicle": "Delete vehicle",
     "deleteVehicle": "Delete vehicle",
     "deleteVehicleMarine": "Delete boat",
     "deleteVehicleMarine": "Delete boat",
     "editMileage": "Change mileage",
     "editMileage": "Change mileage",
-    "editMileageMarine": "Change engine hours"
+    "editMileageMarine": "Change engine hours",
+    "bookAppointment": "Book appointment",
+    "addTitleMarine": "Add New Vessel"
   },
   },
   "archiveDialog": {
   "archiveDialog": {
     "title": "Archive Vehicle",
     "title": "Archive Vehicle",
@@ -615,7 +617,9 @@
     "dueSoon": "Due soon",
     "dueSoon": "Due soon",
     "emptyTitle": "Look up any plate",
     "emptyTitle": "Look up any plate",
     "emptyBody": "See the vehicle, who owns it here, and what {source} has on file. Not yours yet? Add it in one step.",
     "emptyBody": "See the vehicle, who owns it here, and what {source} has on file. Not yours yet? Add it in one step.",
-    "registryWord": "the registry"
+    "registryWord": "the registry",
+    "bookAppointment": "Book appointment",
+    "newWorkOrder": "New work order"
   },
   },
   "safety": {
   "safety": {
     "title": "Safety and known issues",
     "title": "Safety and known issues",

+ 0 - 10
messages/en/workOrders.json

@@ -60,12 +60,6 @@
     "addNewVehicleMarine": "Add New Vessel",
     "addNewVehicleMarine": "Add New Vessel",
     "noPlate": "No plate",
     "noPlate": "No plate",
     "noPlateMarine": "No registration",
     "noPlateMarine": "No registration",
-    "make": "Make *",
-    "makeMarine": "Manufacturer *",
-    "model": "Model *",
-    "year": "Year *",
-    "licensePlate": "License Plate",
-    "licensePlateMarine": "Registration Number",
     "customer": "Customer",
     "customer": "Customer",
     "selectCustomer": "Select a customer (optional)",
     "selectCustomer": "Select a customer (optional)",
     "createNewCustomer": "Create new customer",
     "createNewCustomer": "Create new customer",
@@ -75,12 +69,8 @@
     "phone": "Phone",
     "phone": "Phone",
     "phonePlaceholder": "Phone number",
     "phonePlaceholder": "Phone number",
     "creating": "Creating...",
     "creating": "Creating...",
-    "createAndContinue": "Create & Continue",
-    "invalidYear": "Please enter a valid year",
     "customerNameRequired": "Customer name is required",
     "customerNameRequired": "Customer name is required",
     "failedCreateCustomer": "Failed to create customer",
     "failedCreateCustomer": "Failed to create customer",
-    "failedCreateVehicle": "Failed to create vehicle",
-    "failedCreateVehicleMarine": "Failed to create vessel",
     "somethingWentWrong": "Something went wrong",
     "somethingWentWrong": "Something went wrong",
     "partsSale": "Parts-Only Sale",
     "partsSale": "Parts-Only Sale",
     "partsSaleDescription": "Create an invoice without a vehicle, for over-the-counter parts sales.",
     "partsSaleDescription": "Create an invoice without a vehicle, for over-the-counter parts sales.",

+ 11 - 3
messages/es/calendar.json

@@ -189,8 +189,8 @@
     "noVehiclesMarine": "No se encontraron embarcaciones.",
     "noVehiclesMarine": "No se encontraron embarcaciones.",
     "none": "Ninguno",
     "none": "Ninguno",
     "optional": "Opcional",
     "optional": "Opcional",
-    "whoHint": "Un cliente, un vehículo o ambos. Un vehículo que aún no está registrado se puede añadir a la orden cuando llegue.",
-    "whoHintMarine": "Un cliente, una embarcación o ambos. Una embarcación que aún no está registrada se puede añadir a la orden cuando llegue.",
+    "whoHint": "Un cliente, un vehículo o ambos. ¿Aún no está registrado? Añádelo con Nuevo.",
+    "whoHintMarine": "Un cliente, una embarcación o ambos. ¿Aún no está registrado? Añádelo con Nuevo.",
     "work": "Trabajo necesario",
     "work": "Trabajo necesario",
     "workPlaceholder": "Chirrían los frenos delanteros\nCambio de aceite",
     "workPlaceholder": "Chirrían los frenos delanteros\nCambio de aceite",
     "workPlaceholderMarine": "El motor se recalienta a alta velocidad\nRevisión anual",
     "workPlaceholderMarine": "El motor se recalienta a alta velocidad\nRevisión anual",
@@ -271,7 +271,15 @@
     "customerChannelNeedsCustomer": "Elige un cliente para avisarle.",
     "customerChannelNeedsCustomer": "Elige un cliente para avisarle.",
     "descriptionPlaceholder": "Añadir descripción",
     "descriptionPlaceholder": "Añadir descripción",
     "convertSubmit": "Crear orden de trabajo",
     "convertSubmit": "Crear orden de trabajo",
-    "saved": "Reserva guardada"
+    "saved": "Reserva guardada",
+    "new": "Nuevo",
+    "newCustomer": "Nuevo cliente",
+    "newCustomerNamed": "Nuevo cliente «{name}»",
+    "newVehicle": "Nuevo vehículo",
+    "newVehicleMarine": "Nueva embarcación",
+    "newVehicleNamed": "Nuevo vehículo con matrícula {plate}",
+    "newVehicleNamedMarine": "Nueva embarcación con matrícula {plate}",
+    "openCalendar": "Abrir calendario"
   },
   },
   "notify": {
   "notify": {
     "inAppTitle": "Próximamente: {title}",
     "inAppTitle": "Próximamente: {title}",

+ 2 - 1
messages/es/customers.json

@@ -103,7 +103,8 @@
     "invoiceDesignDefault": "Predeterminado del taller",
     "invoiceDesignDefault": "Predeterminado del taller",
     "invoiceDesignHint": "Las facturas de este cliente se imprimen con este diseño en lugar del predeterminado del taller. Una factura puede elegir el suyo.",
     "invoiceDesignHint": "Las facturas de este cliente se imprimen con este diseño en lugar del predeterminado del taller. Una factura puede elegir el suyo.",
     "reminderOptOut": "Sin recordatorios",
     "reminderOptOut": "Sin recordatorios",
-    "reminderOptOutHint": "No incluir a este cliente en recordatorios de inspección ni otras campañas."
+    "reminderOptOutHint": "No incluir a este cliente en recordatorios de inspección ni otras campañas.",
+    "bookAppointment": "Reservar cita"
   },
   },
   "serviceRequests": {
   "serviceRequests": {
     "statusNew": "Nuevo",
     "statusNew": "Nuevo",

+ 2 - 1
messages/es/navigation.json

@@ -86,7 +86,8 @@
     "part": "Pieza",
     "part": "Pieza",
     "inspection": "Inspección",
     "inspection": "Inspección",
     "shopActions": "Taller",
     "shopActions": "Taller",
-    "person": "Añadir a una persona"
+    "person": "Añadir a una persona",
+    "appointment": "Cita"
   },
   },
   "purchaseWhiteLabel": "Adquirir marca blanca",
   "purchaseWhiteLabel": "Adquirir marca blanca",
   "licenseExpired": "Su licencia ha expirado. Las funciones pueden estar limitadas.",
   "licenseExpired": "Su licencia ha expirado. Las funciones pueden estar limitadas.",

+ 6 - 2
messages/es/vehicles.json

@@ -457,7 +457,9 @@
     "deleteVehicle": "Eliminar vehículo",
     "deleteVehicle": "Eliminar vehículo",
     "deleteVehicleMarine": "Eliminar embarcación",
     "deleteVehicleMarine": "Eliminar embarcación",
     "editMileage": "Cambiar kilometraje",
     "editMileage": "Cambiar kilometraje",
-    "editMileageMarine": "Cambiar horas de motor"
+    "editMileageMarine": "Cambiar horas de motor",
+    "bookAppointment": "Reservar cita",
+    "addTitleMarine": "Agregar nueva embarcación"
   },
   },
   "archiveDialog": {
   "archiveDialog": {
     "title": "Archivar vehículo",
     "title": "Archivar vehículo",
@@ -615,7 +617,9 @@
     "dueSoon": "Pronto",
     "dueSoon": "Pronto",
     "emptyTitle": "Busca cualquier matrícula",
     "emptyTitle": "Busca cualquier matrícula",
     "emptyBody": "Ve el vehículo, quién es su dueño aquí y lo que {source} tiene registrado. ¿Aún no es tuyo? Añádelo en un paso.",
     "emptyBody": "Ve el vehículo, quién es su dueño aquí y lo que {source} tiene registrado. ¿Aún no es tuyo? Añádelo en un paso.",
-    "registryWord": "el registro"
+    "registryWord": "el registro",
+    "bookAppointment": "Reservar cita",
+    "newWorkOrder": "Nueva orden de trabajo"
   },
   },
   "safety": {
   "safety": {
     "title": "Seguridad y problemas conocidos",
     "title": "Seguridad y problemas conocidos",

+ 0 - 10
messages/es/workOrders.json

@@ -60,12 +60,6 @@
     "addNewVehicleMarine": "Agregar Nueva Embarcación",
     "addNewVehicleMarine": "Agregar Nueva Embarcación",
     "noPlate": "Sin placa",
     "noPlate": "Sin placa",
     "noPlateMarine": "Sin matrícula",
     "noPlateMarine": "Sin matrícula",
-    "make": "Marca *",
-    "makeMarine": "Fabricante *",
-    "model": "Modelo *",
-    "year": "Año *",
-    "licensePlate": "Placa de Licencia",
-    "licensePlateMarine": "Número de Registro",
     "customer": "Cliente",
     "customer": "Cliente",
     "selectCustomer": "Seleccionar un cliente (opcional)",
     "selectCustomer": "Seleccionar un cliente (opcional)",
     "createNewCustomer": "Crear nuevo cliente",
     "createNewCustomer": "Crear nuevo cliente",
@@ -75,12 +69,8 @@
     "phone": "Teléfono",
     "phone": "Teléfono",
     "phonePlaceholder": "Número de teléfono",
     "phonePlaceholder": "Número de teléfono",
     "creating": "Creando...",
     "creating": "Creando...",
-    "createAndContinue": "Crear y Continuar",
-    "invalidYear": "Por favor ingrese un año válido",
     "customerNameRequired": "El nombre del cliente es requerido",
     "customerNameRequired": "El nombre del cliente es requerido",
     "failedCreateCustomer": "Error al crear cliente",
     "failedCreateCustomer": "Error al crear cliente",
-    "failedCreateVehicle": "Error al crear vehículo",
-    "failedCreateVehicleMarine": "Error al crear embarcación",
     "somethingWentWrong": "Algo salió mal",
     "somethingWentWrong": "Algo salió mal",
     "partsSale": "Venta solo de piezas",
     "partsSale": "Venta solo de piezas",
     "partsSaleDescription": "Crea una factura sin vehículo, para ventas de piezas en mostrador.",
     "partsSaleDescription": "Crea una factura sin vehículo, para ventas de piezas en mostrador.",

+ 11 - 3
messages/fr/calendar.json

@@ -189,8 +189,8 @@
     "noVehiclesMarine": "Aucun bateau trouvé.",
     "noVehiclesMarine": "Aucun bateau trouvé.",
     "none": "Aucun",
     "none": "Aucun",
     "optional": "Facultatif",
     "optional": "Facultatif",
-    "whoHint": "Un client, un véhicule ou les deux. Un véhicule qui n’est pas encore enregistré peut être ajouté à l’ordre à son arrivée.",
-    "whoHintMarine": "Un client, un bateau ou les deux. Un bateau qui n’est pas encore enregistré peut être ajouté à l’ordre à son arrivée.",
+    "whoHint": "Un client, un véhicule ou les deux. Pas encore enregistré ? Ajoutez-le avec Nouveau.",
+    "whoHintMarine": "Un client, un bateau ou les deux. Pas encore enregistré ? Ajoutez-le avec Nouveau.",
     "work": "Travaux à faire",
     "work": "Travaux à faire",
     "workPlaceholder": "Les freins avant grincent\nVidange",
     "workPlaceholder": "Les freins avant grincent\nVidange",
     "workPlaceholderMarine": "Le moteur chauffe à haute vitesse\nEntretien annuel",
     "workPlaceholderMarine": "Le moteur chauffe à haute vitesse\nEntretien annuel",
@@ -271,7 +271,15 @@
     "customerChannelNeedsCustomer": "Choisissez un client pour le prévenir.",
     "customerChannelNeedsCustomer": "Choisissez un client pour le prévenir.",
     "descriptionPlaceholder": "Ajouter une description",
     "descriptionPlaceholder": "Ajouter une description",
     "convertSubmit": "Créer l’ordre de travail",
     "convertSubmit": "Créer l’ordre de travail",
-    "saved": "Réservation enregistrée"
+    "saved": "Réservation enregistrée",
+    "new": "Nouveau",
+    "newCustomer": "Nouveau client",
+    "newCustomerNamed": "Nouveau client « {name} »",
+    "newVehicle": "Nouveau véhicule",
+    "newVehicleMarine": "Nouveau bateau",
+    "newVehicleNamed": "Nouveau véhicule immatriculé {plate}",
+    "newVehicleNamedMarine": "Nouveau bateau immatriculé {plate}",
+    "openCalendar": "Ouvrir le calendrier"
   },
   },
   "notify": {
   "notify": {
     "inAppTitle": "Bientôt : {title}",
     "inAppTitle": "Bientôt : {title}",

+ 2 - 1
messages/fr/customers.json

@@ -103,7 +103,8 @@
     "invoiceDesignDefault": "Défaut de l'atelier",
     "invoiceDesignDefault": "Défaut de l'atelier",
     "invoiceDesignHint": "Les factures de ce client sont imprimées avec ce design au lieu du défaut de l'atelier. Une facture peut toujours choisir le sien.",
     "invoiceDesignHint": "Les factures de ce client sont imprimées avec ce design au lieu du défaut de l'atelier. Une facture peut toujours choisir le sien.",
     "reminderOptOut": "Pas de rappels",
     "reminderOptOut": "Pas de rappels",
-    "reminderOptOutHint": "Ne pas inclure ce client dans les rappels de contrôle ni les autres campagnes."
+    "reminderOptOutHint": "Ne pas inclure ce client dans les rappels de contrôle ni les autres campagnes.",
+    "bookAppointment": "Prendre rendez-vous"
   },
   },
   "serviceRequests": {
   "serviceRequests": {
     "statusNew": "Nouveau",
     "statusNew": "Nouveau",

+ 2 - 1
messages/fr/navigation.json

@@ -86,7 +86,8 @@
     "part": "Pièce",
     "part": "Pièce",
     "inspection": "Inspection",
     "inspection": "Inspection",
     "shopActions": "Atelier",
     "shopActions": "Atelier",
-    "person": "Ajouter une personne"
+    "person": "Ajouter une personne",
+    "appointment": "Rendez-vous"
   },
   },
   "purchaseWhiteLabel": "Acheter la marque blanche",
   "purchaseWhiteLabel": "Acheter la marque blanche",
   "licenseExpired": "Votre licence a expiré. Les fonctionnalités peuvent être limitées.",
   "licenseExpired": "Votre licence a expiré. Les fonctionnalités peuvent être limitées.",

+ 6 - 2
messages/fr/vehicles.json

@@ -457,7 +457,9 @@
     "deleteVehicle": "Supprimer le véhicule",
     "deleteVehicle": "Supprimer le véhicule",
     "deleteVehicleMarine": "Supprimer le bateau",
     "deleteVehicleMarine": "Supprimer le bateau",
     "editMileage": "Changer le kilométrage",
     "editMileage": "Changer le kilométrage",
-    "editMileageMarine": "Changer les heures moteur"
+    "editMileageMarine": "Changer les heures moteur",
+    "bookAppointment": "Prendre rendez-vous",
+    "addTitleMarine": "Ajouter un nouveau navire"
   },
   },
   "archiveDialog": {
   "archiveDialog": {
     "title": "Archiver le véhicule",
     "title": "Archiver le véhicule",
@@ -615,7 +617,9 @@
     "dueSoon": "Bientôt",
     "dueSoon": "Bientôt",
     "emptyTitle": "Recherchez n'importe quelle plaque",
     "emptyTitle": "Recherchez n'importe quelle plaque",
     "emptyBody": "Voyez le véhicule, à qui il appartient ici et ce que {source} a enregistré. Pas encore le vôtre ? Ajoutez-le en une étape.",
     "emptyBody": "Voyez le véhicule, à qui il appartient ici et ce que {source} a enregistré. Pas encore le vôtre ? Ajoutez-le en une étape.",
-    "registryWord": "le registre"
+    "registryWord": "le registre",
+    "bookAppointment": "Prendre rendez-vous",
+    "newWorkOrder": "Nouvel ordre de travail"
   },
   },
   "safety": {
   "safety": {
     "title": "Sécurité et problèmes connus",
     "title": "Sécurité et problèmes connus",

+ 0 - 10
messages/fr/workOrders.json

@@ -60,12 +60,6 @@
     "addNewVehicleMarine": "Ajouter un Nouveau Navire",
     "addNewVehicleMarine": "Ajouter un Nouveau Navire",
     "noPlate": "Pas de plaque",
     "noPlate": "Pas de plaque",
     "noPlateMarine": "Pas d'immatriculation",
     "noPlateMarine": "Pas d'immatriculation",
-    "make": "Marque *",
-    "makeMarine": "Fabricant *",
-    "model": "Modèle *",
-    "year": "Année *",
-    "licensePlate": "Plaque d'Immatriculation",
-    "licensePlateMarine": "Numéro d'Immatriculation",
     "customer": "Client",
     "customer": "Client",
     "selectCustomer": "Sélectionner un client (optionnel)",
     "selectCustomer": "Sélectionner un client (optionnel)",
     "createNewCustomer": "Créer un nouveau client",
     "createNewCustomer": "Créer un nouveau client",
@@ -75,12 +69,8 @@
     "phone": "Téléphone",
     "phone": "Téléphone",
     "phonePlaceholder": "Numéro de téléphone",
     "phonePlaceholder": "Numéro de téléphone",
     "creating": "Création...",
     "creating": "Création...",
-    "createAndContinue": "Créer et Continuer",
-    "invalidYear": "Veuillez entrer une année valide",
     "customerNameRequired": "Le nom du client est requis",
     "customerNameRequired": "Le nom du client est requis",
     "failedCreateCustomer": "Impossible de créer le client",
     "failedCreateCustomer": "Impossible de créer le client",
-    "failedCreateVehicle": "Impossible de créer le véhicule",
-    "failedCreateVehicleMarine": "Impossible de créer le navire",
     "somethingWentWrong": "Une erreur s'est produite",
     "somethingWentWrong": "Une erreur s'est produite",
     "partsSale": "Vente de pièces seule",
     "partsSale": "Vente de pièces seule",
     "partsSaleDescription": "Créez une facture sans véhicule, pour la vente de pièces au comptoir.",
     "partsSaleDescription": "Créez une facture sans véhicule, pour la vente de pièces au comptoir.",

+ 11 - 3
messages/it/calendar.json

@@ -189,8 +189,8 @@
     "noVehiclesMarine": "Nessuna imbarcazione trovata.",
     "noVehiclesMarine": "Nessuna imbarcazione trovata.",
     "none": "Nessuno",
     "none": "Nessuno",
     "optional": "Facoltativo",
     "optional": "Facoltativo",
-    "whoHint": "Un cliente, un'auto o entrambi. Un'auto non ancora registrata può essere aggiunta all'ordine quando arriva.",
-    "whoHintMarine": "Un cliente, un'imbarcazione o entrambi. Un'imbarcazione non ancora registrata può essere aggiunta all'ordine quando arriva.",
+    "whoHint": "Un cliente, un'auto o entrambi. Non ancora registrato? Aggiungilo con Nuovo.",
+    "whoHintMarine": "Un cliente, un'imbarcazione o entrambi. Non ancora registrato? Aggiungilo con Nuovo.",
     "work": "Lavori da fare",
     "work": "Lavori da fare",
     "workPlaceholder": "I freni anteriori fischiano\nCambio olio",
     "workPlaceholder": "I freni anteriori fischiano\nCambio olio",
     "workPlaceholderMarine": "Il motore si surriscalda ad alta velocità\nTagliando annuale",
     "workPlaceholderMarine": "Il motore si surriscalda ad alta velocità\nTagliando annuale",
@@ -271,7 +271,15 @@
     "customerChannelNeedsCustomer": "Scegli un cliente per avvisarlo.",
     "customerChannelNeedsCustomer": "Scegli un cliente per avvisarlo.",
     "descriptionPlaceholder": "Aggiungi descrizione",
     "descriptionPlaceholder": "Aggiungi descrizione",
     "convertSubmit": "Crea ordine di lavoro",
     "convertSubmit": "Crea ordine di lavoro",
-    "saved": "Prenotazione salvata"
+    "saved": "Prenotazione salvata",
+    "new": "Nuovo",
+    "newCustomer": "Nuovo cliente",
+    "newCustomerNamed": "Nuovo cliente «{name}»",
+    "newVehicle": "Nuovo veicolo",
+    "newVehicleMarine": "Nuova imbarcazione",
+    "newVehicleNamed": "Nuovo veicolo con targa {plate}",
+    "newVehicleNamedMarine": "Nuova imbarcazione con matricola {plate}",
+    "openCalendar": "Apri calendario"
   },
   },
   "notify": {
   "notify": {
     "inAppTitle": "In arrivo: {title}",
     "inAppTitle": "In arrivo: {title}",

+ 2 - 1
messages/it/customers.json

@@ -103,7 +103,8 @@
     "invoiceDesignDefault": "Predefinito dell'officina",
     "invoiceDesignDefault": "Predefinito dell'officina",
     "invoiceDesignHint": "Le fatture di questo cliente vengono stampate con questo design invece del predefinito dell'officina. Una fattura può comunque sceglierne uno proprio.",
     "invoiceDesignHint": "Le fatture di questo cliente vengono stampate con questo design invece del predefinito dell'officina. Una fattura può comunque sceglierne uno proprio.",
     "reminderOptOut": "Nessun promemoria",
     "reminderOptOut": "Nessun promemoria",
-    "reminderOptOutHint": "Non includere questo cliente nei promemoria revisione o in altre campagne."
+    "reminderOptOutHint": "Non includere questo cliente nei promemoria revisione o in altre campagne.",
+    "bookAppointment": "Prenota appuntamento"
   },
   },
   "serviceRequests": {
   "serviceRequests": {
     "statusNew": "Nuova",
     "statusNew": "Nuova",

+ 2 - 1
messages/it/navigation.json

@@ -86,7 +86,8 @@
     "part": "Ricambio",
     "part": "Ricambio",
     "inspection": "Ispezione",
     "inspection": "Ispezione",
     "shopActions": "Officina",
     "shopActions": "Officina",
-    "person": "Aggiungi una persona"
+    "person": "Aggiungi una persona",
+    "appointment": "Appuntamento"
   },
   },
   "purchaseWhiteLabel": "Acquista White-Label",
   "purchaseWhiteLabel": "Acquista White-Label",
   "licenseExpired": "La tua licenza è scaduta. Le funzionalità potrebbero essere limitate.",
   "licenseExpired": "La tua licenza è scaduta. Le funzionalità potrebbero essere limitate.",

+ 6 - 2
messages/it/vehicles.json

@@ -457,7 +457,9 @@
     "deleteVehicle": "Elimina veicolo",
     "deleteVehicle": "Elimina veicolo",
     "deleteVehicleMarine": "Elimina imbarcazione",
     "deleteVehicleMarine": "Elimina imbarcazione",
     "editMileage": "Cambia chilometraggio",
     "editMileage": "Cambia chilometraggio",
-    "editMileageMarine": "Cambia ore motore"
+    "editMileageMarine": "Cambia ore motore",
+    "bookAppointment": "Prenota appuntamento",
+    "addTitleMarine": "Aggiungi Nuova Imbarcazione"
   },
   },
   "archiveDialog": {
   "archiveDialog": {
     "title": "Archivia Veicolo",
     "title": "Archivia Veicolo",
@@ -615,7 +617,9 @@
     "dueSoon": "In scadenza",
     "dueSoon": "In scadenza",
     "emptyTitle": "Cerca qualsiasi targa",
     "emptyTitle": "Cerca qualsiasi targa",
     "emptyBody": "Vedi il veicolo, chi ne è il proprietario qui e cosa ha registrato {source}. Non è ancora tuo? Aggiungilo in un passaggio.",
     "emptyBody": "Vedi il veicolo, chi ne è il proprietario qui e cosa ha registrato {source}. Non è ancora tuo? Aggiungilo in un passaggio.",
-    "registryWord": "il registro"
+    "registryWord": "il registro",
+    "bookAppointment": "Prenota appuntamento",
+    "newWorkOrder": "Nuovo ordine di lavoro"
   },
   },
   "safety": {
   "safety": {
     "title": "Sicurezza e problemi noti",
     "title": "Sicurezza e problemi noti",

+ 0 - 10
messages/it/workOrders.json

@@ -60,12 +60,6 @@
     "addNewVehicleMarine": "Aggiungi Nuova Imbarcazione",
     "addNewVehicleMarine": "Aggiungi Nuova Imbarcazione",
     "noPlate": "Nessuna targa",
     "noPlate": "Nessuna targa",
     "noPlateMarine": "Nessuna immatricolazione",
     "noPlateMarine": "Nessuna immatricolazione",
-    "make": "Marca *",
-    "makeMarine": "Costruttore *",
-    "model": "Modello *",
-    "year": "Anno *",
-    "licensePlate": "Targa",
-    "licensePlateMarine": "Numero di Registrazione",
     "customer": "Cliente",
     "customer": "Cliente",
     "selectCustomer": "Seleziona un cliente (facoltativo)",
     "selectCustomer": "Seleziona un cliente (facoltativo)",
     "createNewCustomer": "Crea nuovo cliente",
     "createNewCustomer": "Crea nuovo cliente",
@@ -75,12 +69,8 @@
     "phone": "Telefono",
     "phone": "Telefono",
     "phonePlaceholder": "Numero di telefono",
     "phonePlaceholder": "Numero di telefono",
     "creating": "Creazione in corso...",
     "creating": "Creazione in corso...",
-    "createAndContinue": "Crea e Continua",
-    "invalidYear": "Inserisci un anno valido",
     "customerNameRequired": "Il nome del cliente è obbligatorio",
     "customerNameRequired": "Il nome del cliente è obbligatorio",
     "failedCreateCustomer": "Impossibile creare il cliente",
     "failedCreateCustomer": "Impossibile creare il cliente",
-    "failedCreateVehicle": "Impossibile creare il veicolo",
-    "failedCreateVehicleMarine": "Impossibile creare l'imbarcazione",
     "somethingWentWrong": "Qualcosa è andato storto",
     "somethingWentWrong": "Qualcosa è andato storto",
     "partsSale": "Vendita solo ricambi",
     "partsSale": "Vendita solo ricambi",
     "partsSaleDescription": "Crea una fattura senza veicolo, per la vendita di ricambi al banco.",
     "partsSaleDescription": "Crea una fattura senza veicolo, per la vendita di ricambi al banco.",

+ 11 - 3
messages/lt/calendar.json

@@ -189,8 +189,8 @@
     "noVehiclesMarine": "Valčių nerasta.",
     "noVehiclesMarine": "Valčių nerasta.",
     "none": "Nėra",
     "none": "Nėra",
     "optional": "Neprivaloma",
     "optional": "Neprivaloma",
-    "whoHint": "Klientas, automobilis arba abu. Automobilį, kurio dar nėra sistemoje, galima pridėti prie užsakymo, kai jis atvyks.",
-    "whoHintMarine": "Klientas, valtis arba abu. Valtį, kurios dar nėra sistemoje, galima pridėti prie užsakymo, kai ji bus pristatyta.",
+    "whoHint": "Klientas, automobilis arba abu. Dar nėra sistemoje? Pridėkite paspaudę Sukurti.",
+    "whoHintMarine": "Klientas, valtis arba abu. Dar nėra sistemoje? Pridėkite paspaudę Sukurti.",
     "work": "Reikalingi darbai",
     "work": "Reikalingi darbai",
     "workPlaceholder": "Cypia priekiniai stabdžiai\nAlyvos keitimas",
     "workPlaceholder": "Cypia priekiniai stabdžiai\nAlyvos keitimas",
     "workPlaceholderMarine": "Didesniu greičiu perkaista variklis\nMetinė priežiūra",
     "workPlaceholderMarine": "Didesniu greičiu perkaista variklis\nMetinė priežiūra",
@@ -271,7 +271,15 @@
     "customerChannelNeedsCustomer": "Pasirinkite klientą, kad jam būtų pranešta.",
     "customerChannelNeedsCustomer": "Pasirinkite klientą, kad jam būtų pranešta.",
     "descriptionPlaceholder": "Pridėti aprašymą",
     "descriptionPlaceholder": "Pridėti aprašymą",
     "convertSubmit": "Sukurti darbo užsakymą",
     "convertSubmit": "Sukurti darbo užsakymą",
-    "saved": "Registracija išsaugota"
+    "saved": "Registracija išsaugota",
+    "new": "Sukurti",
+    "newCustomer": "Naujas klientas",
+    "newCustomerNamed": "Naujas klientas „{name}“",
+    "newVehicle": "Nauja transporto priemonė",
+    "newVehicleMarine": "Nauja valtis",
+    "newVehicleNamed": "Nauja transporto priemonė su numeriu {plate}",
+    "newVehicleNamedMarine": "Nauja valtis su registracijos numeriu {plate}",
+    "openCalendar": "Atidaryti kalendorių"
   },
   },
   "notify": {
   "notify": {
     "inAppTitle": "Artėja: {title}",
     "inAppTitle": "Artėja: {title}",

+ 2 - 1
messages/lt/customers.json

@@ -103,7 +103,8 @@
     "invoiceDesignDefault": "Dirbtuvės numatytasis",
     "invoiceDesignDefault": "Dirbtuvės numatytasis",
     "invoiceDesignHint": "Šio kliento sąskaitos spausdinamos šiuo dizainu vietoj dirbtuvės numatytojo. Sąskaita vis tiek gali pasirinkti savo.",
     "invoiceDesignHint": "Šio kliento sąskaitos spausdinamos šiuo dizainu vietoj dirbtuvės numatytojo. Sąskaita vis tiek gali pasirinkti savo.",
     "reminderOptOut": "Be priminimų",
     "reminderOptOut": "Be priminimų",
-    "reminderOptOutHint": "Neįtraukti šio kliento į apžiūros priminimus ar kitas kampanijas."
+    "reminderOptOutHint": "Neįtraukti šio kliento į apžiūros priminimus ar kitas kampanijas.",
+    "bookAppointment": "Užregistruoti vizitą"
   },
   },
   "serviceRequests": {
   "serviceRequests": {
     "statusNew": "Nauja",
     "statusNew": "Nauja",

+ 2 - 1
messages/lt/navigation.json

@@ -86,7 +86,8 @@
     "part": "Dalis",
     "part": "Dalis",
     "inspection": "Apžiūra",
     "inspection": "Apžiūra",
     "shopActions": "Servisas",
     "shopActions": "Servisas",
-    "person": "Pridėti žmogų"
+    "person": "Pridėti žmogų",
+    "appointment": "Vizitas"
   },
   },
   "purchaseWhiteLabel": "Įsigyti \"White-Label\"",
   "purchaseWhiteLabel": "Įsigyti \"White-Label\"",
   "licenseExpired": "Jūsų licencija pasibaigė. Funkcijos gali būti ribotos.",
   "licenseExpired": "Jūsų licencija pasibaigė. Funkcijos gali būti ribotos.",

+ 6 - 2
messages/lt/vehicles.json

@@ -457,7 +457,9 @@
     "deleteVehicle": "Ištrinti transporto priemonę",
     "deleteVehicle": "Ištrinti transporto priemonę",
     "deleteVehicleMarine": "Ištrinti valtį",
     "deleteVehicleMarine": "Ištrinti valtį",
     "editMileage": "Pakeisti ridą",
     "editMileage": "Pakeisti ridą",
-    "editMileageMarine": "Pakeisti variklio valandas"
+    "editMileageMarine": "Pakeisti variklio valandas",
+    "bookAppointment": "Užregistruoti vizitą",
+    "addTitleMarine": "Pridėti naują laivą"
   },
   },
   "archiveDialog": {
   "archiveDialog": {
     "title": "Archyvuoti transporto priemonę",
     "title": "Archyvuoti transporto priemonę",
@@ -615,7 +617,9 @@
     "dueSoon": "Netrukus",
     "dueSoon": "Netrukus",
     "emptyTitle": "Ieškokite bet kurio numerio",
     "emptyTitle": "Ieškokite bet kurio numerio",
     "emptyBody": "Pamatykite transporto priemonę, kam ji čia priklauso ir ką apie ją turi {source}. Dar ne jūsų? Pridėkite vienu žingsniu.",
     "emptyBody": "Pamatykite transporto priemonę, kam ji čia priklauso ir ką apie ją turi {source}. Dar ne jūsų? Pridėkite vienu žingsniu.",
-    "registryWord": "registras"
+    "registryWord": "registras",
+    "bookAppointment": "Užregistruoti vizitą",
+    "newWorkOrder": "Naujas darbo užsakymas"
   },
   },
   "safety": {
   "safety": {
     "title": "Sauga ir žinomos problemos",
     "title": "Sauga ir žinomos problemos",

+ 0 - 10
messages/lt/workOrders.json

@@ -60,12 +60,6 @@
     "addNewVehicleMarine": "Pridėti naują laivą",
     "addNewVehicleMarine": "Pridėti naują laivą",
     "noPlate": "Be numerio",
     "noPlate": "Be numerio",
     "noPlateMarine": "Be registracijos numerio",
     "noPlateMarine": "Be registracijos numerio",
-    "make": "Markė *",
-    "makeMarine": "Gamintojas *",
-    "model": "Modelis *",
-    "year": "Metai *",
-    "licensePlate": "Valstybinis numeris",
-    "licensePlateMarine": "Registracijos numeris",
     "customer": "Klientas",
     "customer": "Klientas",
     "selectCustomer": "Pasirinkite klientą (neprivaloma)",
     "selectCustomer": "Pasirinkite klientą (neprivaloma)",
     "createNewCustomer": "Sukurti naują klientą",
     "createNewCustomer": "Sukurti naują klientą",
@@ -75,12 +69,8 @@
     "phone": "Telefonas",
     "phone": "Telefonas",
     "phonePlaceholder": "Telefono numeris",
     "phonePlaceholder": "Telefono numeris",
     "creating": "Kuriama...",
     "creating": "Kuriama...",
-    "createAndContinue": "Sukurti ir tęsti",
-    "invalidYear": "Įveskite teisingus metus",
     "customerNameRequired": "Kliento vardas yra privalomas",
     "customerNameRequired": "Kliento vardas yra privalomas",
     "failedCreateCustomer": "Nepavyko sukurti kliento",
     "failedCreateCustomer": "Nepavyko sukurti kliento",
-    "failedCreateVehicle": "Nepavyko sukurti transporto priemonės",
-    "failedCreateVehicleMarine": "Nepavyko sukurti laivo",
     "somethingWentWrong": "Kažkas nutiko",
     "somethingWentWrong": "Kažkas nutiko",
     "partsSale": "Tik dalių pardavimas",
     "partsSale": "Tik dalių pardavimas",
     "partsSaleDescription": "Sukurkite sąskaitą be transporto priemonės, dalių pardavimui prie prekystalio.",
     "partsSaleDescription": "Sukurkite sąskaitą be transporto priemonės, dalių pardavimui prie prekystalio.",

+ 11 - 3
messages/nb/calendar.json

@@ -189,8 +189,8 @@
     "noVehiclesMarine": "Ingen båter funnet.",
     "noVehiclesMarine": "Ingen båter funnet.",
     "none": "Ingen",
     "none": "Ingen",
     "optional": "Valgfritt",
     "optional": "Valgfritt",
-    "whoHint": "En kunde, en bil eller begge. En bil som ikke er registrert ennå, kan legges til jobben når den kommer.",
-    "whoHintMarine": "En kunde, en båt eller begge. En båt som ikke er registrert ennå, kan legges til jobben når den kommer.",
+    "whoHint": "En kunde, en bil eller begge. Ikke registrert ennå? Legg til med Ny.",
+    "whoHintMarine": "En kunde, en båt eller begge. Ikke registrert ennå? Legg til med Ny.",
     "work": "Arbeid som trengs",
     "work": "Arbeid som trengs",
     "workPlaceholder": "Bremsene foran piper\nOljeskift",
     "workPlaceholder": "Bremsene foran piper\nOljeskift",
     "workPlaceholderMarine": "Motoren blir for varm i høy fart\nÅrsservice",
     "workPlaceholderMarine": "Motoren blir for varm i høy fart\nÅrsservice",
@@ -271,7 +271,15 @@
     "customerChannelNeedsCustomer": "Velg en kunde for å varsle kunden.",
     "customerChannelNeedsCustomer": "Velg en kunde for å varsle kunden.",
     "descriptionPlaceholder": "Legg til beskrivelse",
     "descriptionPlaceholder": "Legg til beskrivelse",
     "convertSubmit": "Lag arbeidsordre",
     "convertSubmit": "Lag arbeidsordre",
-    "saved": "Booking lagret"
+    "saved": "Booking lagret",
+    "new": "Ny",
+    "newCustomer": "Ny kunde",
+    "newCustomerNamed": "Ny kunde «{name}»",
+    "newVehicle": "Nytt kjøretøy",
+    "newVehicleMarine": "Ny båt",
+    "newVehicleNamed": "Nytt kjøretøy med skilt {plate}",
+    "newVehicleNamedMarine": "Ny båt med registreringsnummer {plate}",
+    "openCalendar": "Åpne kalenderen"
   },
   },
   "notify": {
   "notify": {
     "inAppTitle": "Snart: {title}",
     "inAppTitle": "Snart: {title}",

+ 2 - 1
messages/nb/customers.json

@@ -103,7 +103,8 @@
     "invoiceDesignDefault": "Verkstedets standard",
     "invoiceDesignDefault": "Verkstedets standard",
     "invoiceDesignHint": "Fakturaer til denne kunden skrives ut med dette designet i stedet for verkstedets standard. En faktura kan fortsatt velge sitt eget.",
     "invoiceDesignHint": "Fakturaer til denne kunden skrives ut med dette designet i stedet for verkstedets standard. En faktura kan fortsatt velge sitt eget.",
     "reminderOptOut": "Ingen påminnelser",
     "reminderOptOut": "Ingen påminnelser",
-    "reminderOptOutHint": "Ikke ta med denne kunden i påminnelser om EU-kontroll eller andre utsendinger."
+    "reminderOptOutHint": "Ikke ta med denne kunden i påminnelser om EU-kontroll eller andre utsendinger.",
+    "bookAppointment": "Book time"
   },
   },
   "serviceRequests": {
   "serviceRequests": {
     "statusNew": "Ny",
     "statusNew": "Ny",

+ 2 - 1
messages/nb/navigation.json

@@ -86,7 +86,8 @@
     "part": "Del",
     "part": "Del",
     "inspection": "Inspeksjon",
     "inspection": "Inspeksjon",
     "shopActions": "Verkstedet",
     "shopActions": "Verkstedet",
-    "person": "Legg til en person"
+    "person": "Legg til en person",
+    "appointment": "Timeavtale"
   },
   },
   "purchaseWhiteLabel": "Kjøp White-Label",
   "purchaseWhiteLabel": "Kjøp White-Label",
   "licenseExpired": "Lisensen din har utløpt. Funksjoner kan være begrenset.",
   "licenseExpired": "Lisensen din har utløpt. Funksjoner kan være begrenset.",

+ 6 - 2
messages/nb/vehicles.json

@@ -457,7 +457,9 @@
     "deleteVehicle": "Slett kjøretøy",
     "deleteVehicle": "Slett kjøretøy",
     "deleteVehicleMarine": "Slett båt",
     "deleteVehicleMarine": "Slett båt",
     "editMileage": "Endre kilometerstand",
     "editMileage": "Endre kilometerstand",
-    "editMileageMarine": "Endre motortimer"
+    "editMileageMarine": "Endre motortimer",
+    "bookAppointment": "Book time",
+    "addTitleMarine": "Legg til nytt fartøy"
   },
   },
   "archiveDialog": {
   "archiveDialog": {
     "title": "Arkiver kjøretøy",
     "title": "Arkiver kjøretøy",
@@ -615,7 +617,9 @@
     "dueSoon": "Snart",
     "dueSoon": "Snart",
     "emptyTitle": "Slå opp et hvilket som helst skilt",
     "emptyTitle": "Slå opp et hvilket som helst skilt",
     "emptyBody": "Se kjøretøyet, hvem som eier det her, og hva {source} har registrert. Ikke ditt enda? Legg det til i ett steg.",
     "emptyBody": "Se kjøretøyet, hvem som eier det her, og hva {source} har registrert. Ikke ditt enda? Legg det til i ett steg.",
-    "registryWord": "registeret"
+    "registryWord": "registeret",
+    "bookAppointment": "Book time",
+    "newWorkOrder": "Ny arbeidsordre"
   },
   },
   "safety": {
   "safety": {
     "title": "Sikkerhet og kjente problemer",
     "title": "Sikkerhet og kjente problemer",

+ 0 - 10
messages/nb/workOrders.json

@@ -60,12 +60,6 @@
     "addNewVehicleMarine": "Legg til nytt fartøy",
     "addNewVehicleMarine": "Legg til nytt fartøy",
     "noPlate": "Ingen registreringsskilt",
     "noPlate": "Ingen registreringsskilt",
     "noPlateMarine": "Ingen registreringsnummer",
     "noPlateMarine": "Ingen registreringsnummer",
-    "make": "Merke *",
-    "makeMarine": "Produsent *",
-    "model": "Modell *",
-    "year": "År *",
-    "licensePlate": "Registreringsskilt",
-    "licensePlateMarine": "Registreringsnummer",
     "customer": "Kunde",
     "customer": "Kunde",
     "selectCustomer": "Velg en kunde (valgfritt)",
     "selectCustomer": "Velg en kunde (valgfritt)",
     "createNewCustomer": "Opprett ny kunde",
     "createNewCustomer": "Opprett ny kunde",
@@ -75,12 +69,8 @@
     "phone": "Telefon",
     "phone": "Telefon",
     "phonePlaceholder": "Telefonnummer",
     "phonePlaceholder": "Telefonnummer",
     "creating": "Oppretter...",
     "creating": "Oppretter...",
-    "createAndContinue": "Opprett og fortsett",
-    "invalidYear": "Vennligst skriv inn et gyldig år",
     "customerNameRequired": "Kundenavn er påkrevd",
     "customerNameRequired": "Kundenavn er påkrevd",
     "failedCreateCustomer": "Kunne ikke opprette kunde",
     "failedCreateCustomer": "Kunne ikke opprette kunde",
-    "failedCreateVehicle": "Kunne ikke opprette kjøretøy",
-    "failedCreateVehicleMarine": "Kunne ikke opprette fartøy",
     "somethingWentWrong": "Noe gikk galt",
     "somethingWentWrong": "Noe gikk galt",
     "partsSale": "Kun delesalg",
     "partsSale": "Kun delesalg",
     "partsSaleDescription": "Opprett en faktura uten kjøretøy, for salg av deler over disk.",
     "partsSaleDescription": "Opprett en faktura uten kjøretøy, for salg av deler over disk.",

+ 11 - 3
messages/nl/calendar.json

@@ -189,8 +189,8 @@
     "noVehiclesMarine": "Geen boten gevonden.",
     "noVehiclesMarine": "Geen boten gevonden.",
     "none": "Geen",
     "none": "Geen",
     "optional": "Optioneel",
     "optional": "Optioneel",
-    "whoHint": "Een klant, een auto of allebei. Een auto die nog niet in het systeem staat, kan aan de werkorder worden toegevoegd zodra hij binnenkomt.",
-    "whoHintMarine": "Een klant, een boot of allebei. Een boot die nog niet in het systeem staat, kan aan de werkorder worden toegevoegd zodra hij binnenkomt.",
+    "whoHint": "Een klant, een auto of allebei. Nog niet in het systeem? Voeg toe met Nieuw.",
+    "whoHintMarine": "Een klant, een boot of allebei. Nog niet in het systeem? Voeg toe met Nieuw.",
     "work": "Benodigd werk",
     "work": "Benodigd werk",
     "workPlaceholder": "Voorremmen piepen\nOlie verversen",
     "workPlaceholder": "Voorremmen piepen\nOlie verversen",
     "workPlaceholderMarine": "Motor wordt te heet bij hoge snelheid\nJaarlijkse onderhoudsbeurt",
     "workPlaceholderMarine": "Motor wordt te heet bij hoge snelheid\nJaarlijkse onderhoudsbeurt",
@@ -271,7 +271,15 @@
     "customerChannelNeedsCustomer": "Kies een klant om die op de hoogte te brengen.",
     "customerChannelNeedsCustomer": "Kies een klant om die op de hoogte te brengen.",
     "descriptionPlaceholder": "Beschrijving toevoegen",
     "descriptionPlaceholder": "Beschrijving toevoegen",
     "convertSubmit": "Werkorder maken",
     "convertSubmit": "Werkorder maken",
-    "saved": "Boeking opgeslagen"
+    "saved": "Boeking opgeslagen",
+    "new": "Nieuw",
+    "newCustomer": "Nieuwe klant",
+    "newCustomerNamed": "Nieuwe klant ‘{name}’",
+    "newVehicle": "Nieuw voertuig",
+    "newVehicleMarine": "Nieuwe boot",
+    "newVehicleNamed": "Nieuw voertuig met kenteken {plate}",
+    "newVehicleNamedMarine": "Nieuwe boot met registratienummer {plate}",
+    "openCalendar": "Kalender openen"
   },
   },
   "notify": {
   "notify": {
     "inAppTitle": "Binnenkort: {title}",
     "inAppTitle": "Binnenkort: {title}",

+ 2 - 1
messages/nl/customers.json

@@ -103,7 +103,8 @@
     "invoiceDesignDefault": "Standaard van de werkplaats",
     "invoiceDesignDefault": "Standaard van de werkplaats",
     "invoiceDesignHint": "Facturen voor deze klant worden met dit ontwerp afgedrukt in plaats van de standaard van de werkplaats. Een factuur kan nog steeds een eigen ontwerp kiezen.",
     "invoiceDesignHint": "Facturen voor deze klant worden met dit ontwerp afgedrukt in plaats van de standaard van de werkplaats. Een factuur kan nog steeds een eigen ontwerp kiezen.",
     "reminderOptOut": "Geen herinneringen",
     "reminderOptOut": "Geen herinneringen",
-    "reminderOptOutHint": "Deze klant niet opnemen in keuringsherinneringen of andere campagnes."
+    "reminderOptOutHint": "Deze klant niet opnemen in keuringsherinneringen of andere campagnes.",
+    "bookAppointment": "Afspraak inplannen"
   },
   },
   "serviceRequests": {
   "serviceRequests": {
     "statusNew": "Nieuw",
     "statusNew": "Nieuw",

+ 2 - 1
messages/nl/navigation.json

@@ -86,7 +86,8 @@
     "part": "Onderdeel",
     "part": "Onderdeel",
     "inspection": "Keuring",
     "inspection": "Keuring",
     "shopActions": "Werkplaats",
     "shopActions": "Werkplaats",
-    "person": "Persoon toevoegen"
+    "person": "Persoon toevoegen",
+    "appointment": "Afspraak"
   },
   },
   "purchaseWhiteLabel": "White-label aanschaffen",
   "purchaseWhiteLabel": "White-label aanschaffen",
   "licenseExpired": "Uw licentie is verlopen. Functies kunnen beperkt zijn.",
   "licenseExpired": "Uw licentie is verlopen. Functies kunnen beperkt zijn.",

+ 6 - 2
messages/nl/vehicles.json

@@ -457,7 +457,9 @@
     "deleteVehicle": "Voertuig verwijderen",
     "deleteVehicle": "Voertuig verwijderen",
     "deleteVehicleMarine": "Boot verwijderen",
     "deleteVehicleMarine": "Boot verwijderen",
     "editMileage": "Kilometerstand wijzigen",
     "editMileage": "Kilometerstand wijzigen",
-    "editMileageMarine": "Motoruren wijzigen"
+    "editMileageMarine": "Motoruren wijzigen",
+    "bookAppointment": "Afspraak inplannen",
+    "addTitleMarine": "Nieuw vaartuig toevoegen"
   },
   },
   "archiveDialog": {
   "archiveDialog": {
     "title": "Voertuig archiveren",
     "title": "Voertuig archiveren",
@@ -615,7 +617,9 @@
     "dueSoon": "Binnenkort",
     "dueSoon": "Binnenkort",
     "emptyTitle": "Zoek elk kenteken op",
     "emptyTitle": "Zoek elk kenteken op",
     "emptyBody": "Zie het voertuig, van wie het hier is en wat {source} erover heeft. Nog niet van jou? Voeg het in één stap toe.",
     "emptyBody": "Zie het voertuig, van wie het hier is en wat {source} erover heeft. Nog niet van jou? Voeg het in één stap toe.",
-    "registryWord": "het register"
+    "registryWord": "het register",
+    "bookAppointment": "Afspraak inplannen",
+    "newWorkOrder": "Nieuwe werkorder"
   },
   },
   "safety": {
   "safety": {
     "title": "Veiligheid en bekende problemen",
     "title": "Veiligheid en bekende problemen",

+ 0 - 10
messages/nl/workOrders.json

@@ -60,12 +60,6 @@
     "addNewVehicleMarine": "Nieuw vaartuig toevoegen",
     "addNewVehicleMarine": "Nieuw vaartuig toevoegen",
     "noPlate": "Geen kenteken",
     "noPlate": "Geen kenteken",
     "noPlateMarine": "Geen registratienummer",
     "noPlateMarine": "Geen registratienummer",
-    "make": "Merk *",
-    "makeMarine": "Fabrikant *",
-    "model": "Model *",
-    "year": "Jaar *",
-    "licensePlate": "Kenteken",
-    "licensePlateMarine": "Registratienummer",
     "customer": "Klant",
     "customer": "Klant",
     "selectCustomer": "Selecteer een klant (optioneel)",
     "selectCustomer": "Selecteer een klant (optioneel)",
     "createNewCustomer": "Nieuwe klant maken",
     "createNewCustomer": "Nieuwe klant maken",
@@ -75,12 +69,8 @@
     "phone": "Telefoon",
     "phone": "Telefoon",
     "phonePlaceholder": "Telefoonnummer",
     "phonePlaceholder": "Telefoonnummer",
     "creating": "Bezig met maken...",
     "creating": "Bezig met maken...",
-    "createAndContinue": "Maken & Doorgaan",
-    "invalidYear": "Voer een geldig jaar in",
     "customerNameRequired": "Klantnaam is verplicht",
     "customerNameRequired": "Klantnaam is verplicht",
     "failedCreateCustomer": "Klant maken mislukt",
     "failedCreateCustomer": "Klant maken mislukt",
-    "failedCreateVehicle": "Voertuig maken mislukt",
-    "failedCreateVehicleMarine": "Vaartuig maken mislukt",
     "somethingWentWrong": "Er is iets mis gegaan",
     "somethingWentWrong": "Er is iets mis gegaan",
     "partsSale": "Alleen onderdelenverkoop",
     "partsSale": "Alleen onderdelenverkoop",
     "partsSaleDescription": "Maak een factuur zonder voertuig, voor verkoop van onderdelen aan de balie.",
     "partsSaleDescription": "Maak een factuur zonder voertuig, voor verkoop van onderdelen aan de balie.",

+ 11 - 3
messages/pl/calendar.json

@@ -189,8 +189,8 @@
     "noVehiclesMarine": "Nie znaleziono łodzi.",
     "noVehiclesMarine": "Nie znaleziono łodzi.",
     "none": "Brak",
     "none": "Brak",
     "optional": "Opcjonalnie",
     "optional": "Opcjonalnie",
-    "whoHint": "Klient, auto lub jedno i drugie. Auto, którego jeszcze nie ma w bazie, można dodać do zlecenia, gdy trafi do warsztatu.",
-    "whoHintMarine": "Klient, łódź lub jedno i drugie. Łódź, której jeszcze nie ma w bazie, można dodać do zlecenia, gdy trafi do warsztatu.",
+    "whoHint": "Klient, auto lub jedno i drugie. Jeszcze nie ma w bazie? Dodaj przyciskiem Nowy.",
+    "whoHintMarine": "Klient, łódź lub jedno i drugie. Jeszcze nie ma w bazie? Dodaj przyciskiem Nowy.",
     "work": "Prace do wykonania",
     "work": "Prace do wykonania",
     "workPlaceholder": "Piszczą przednie hamulce\nWymiana oleju",
     "workPlaceholder": "Piszczą przednie hamulce\nWymiana oleju",
     "workPlaceholderMarine": "Silnik przegrzewa się przy dużej prędkości\nPrzegląd roczny",
     "workPlaceholderMarine": "Silnik przegrzewa się przy dużej prędkości\nPrzegląd roczny",
@@ -271,7 +271,15 @@
     "customerChannelNeedsCustomer": "Wybierz klienta, aby go powiadomić.",
     "customerChannelNeedsCustomer": "Wybierz klienta, aby go powiadomić.",
     "descriptionPlaceholder": "Dodaj opis",
     "descriptionPlaceholder": "Dodaj opis",
     "convertSubmit": "Utwórz zlecenie",
     "convertSubmit": "Utwórz zlecenie",
-    "saved": "Rezerwacja zapisana"
+    "saved": "Rezerwacja zapisana",
+    "new": "Nowy",
+    "newCustomer": "Nowy klient",
+    "newCustomerNamed": "Nowy klient „{name}”",
+    "newVehicle": "Nowy pojazd",
+    "newVehicleMarine": "Nowa łódź",
+    "newVehicleNamed": "Nowy pojazd o numerze rejestracyjnym {plate}",
+    "newVehicleNamedMarine": "Nowa łódź o numerze rejestracyjnym {plate}",
+    "openCalendar": "Otwórz kalendarz"
   },
   },
   "notify": {
   "notify": {
     "inAppTitle": "Wkrótce: {title}",
     "inAppTitle": "Wkrótce: {title}",

+ 2 - 1
messages/pl/customers.json

@@ -103,7 +103,8 @@
     "invoiceDesignDefault": "Domyślny warsztatu",
     "invoiceDesignDefault": "Domyślny warsztatu",
     "invoiceDesignHint": "Faktury dla tego klienta są drukowane z tym projektem zamiast domyślnego projektu warsztatu. Faktura nadal może wybrać własny.",
     "invoiceDesignHint": "Faktury dla tego klienta są drukowane z tym projektem zamiast domyślnego projektu warsztatu. Faktura nadal może wybrać własny.",
     "reminderOptOut": "Bez przypomnień",
     "reminderOptOut": "Bez przypomnień",
-    "reminderOptOutHint": "Nie uwzględniaj tego klienta w przypomnieniach o przeglądzie ani innych kampaniach."
+    "reminderOptOutHint": "Nie uwzględniaj tego klienta w przypomnieniach o przeglądzie ani innych kampaniach.",
+    "bookAppointment": "Umów wizytę"
   },
   },
   "serviceRequests": {
   "serviceRequests": {
     "statusNew": "Nowe",
     "statusNew": "Nowe",

+ 2 - 1
messages/pl/navigation.json

@@ -86,7 +86,8 @@
     "part": "Część",
     "part": "Część",
     "inspection": "Przegląd",
     "inspection": "Przegląd",
     "shopActions": "Warsztat",
     "shopActions": "Warsztat",
-    "person": "Dodaj osobę"
+    "person": "Dodaj osobę",
+    "appointment": "Wizyta"
   },
   },
   "purchaseWhiteLabel": "Kup White-Label",
   "purchaseWhiteLabel": "Kup White-Label",
   "licenseExpired": "Twoja licencja wygasła. Funkcje mogą być ograniczone.",
   "licenseExpired": "Twoja licencja wygasła. Funkcje mogą być ograniczone.",

+ 6 - 2
messages/pl/vehicles.json

@@ -457,7 +457,9 @@
     "deleteVehicle": "Usuń pojazd",
     "deleteVehicle": "Usuń pojazd",
     "deleteVehicleMarine": "Usuń łódź",
     "deleteVehicleMarine": "Usuń łódź",
     "editMileage": "Zmień przebieg",
     "editMileage": "Zmień przebieg",
-    "editMileageMarine": "Zmień godziny pracy silnika"
+    "editMileageMarine": "Zmień godziny pracy silnika",
+    "bookAppointment": "Umów wizytę",
+    "addTitleMarine": "Dodaj nową jednostkę"
   },
   },
   "archiveDialog": {
   "archiveDialog": {
     "title": "Archiwizuj pojazd",
     "title": "Archiwizuj pojazd",
@@ -615,7 +617,9 @@
     "dueSoon": "Wkrótce",
     "dueSoon": "Wkrótce",
     "emptyTitle": "Sprawdź dowolną tablicę",
     "emptyTitle": "Sprawdź dowolną tablicę",
     "emptyBody": "Zobacz pojazd, kto jest tu jego właścicielem i co ma o nim {source}. Jeszcze nie Twój? Dodaj go jednym krokiem.",
     "emptyBody": "Zobacz pojazd, kto jest tu jego właścicielem i co ma o nim {source}. Jeszcze nie Twój? Dodaj go jednym krokiem.",
-    "registryWord": "rejestr"
+    "registryWord": "rejestr",
+    "bookAppointment": "Umów wizytę",
+    "newWorkOrder": "Nowe zlecenie"
   },
   },
   "safety": {
   "safety": {
     "title": "Bezpieczeństwo i znane problemy",
     "title": "Bezpieczeństwo i znane problemy",

+ 0 - 10
messages/pl/workOrders.json

@@ -60,12 +60,6 @@
     "addNewVehicleMarine": "Dodaj Nową Jednostkę",
     "addNewVehicleMarine": "Dodaj Nową Jednostkę",
     "noPlate": "Brak tablicy",
     "noPlate": "Brak tablicy",
     "noPlateMarine": "Brak numeru rejestracyjnego",
     "noPlateMarine": "Brak numeru rejestracyjnego",
-    "make": "Marka *",
-    "makeMarine": "Producent *",
-    "model": "Model *",
-    "year": "Rok *",
-    "licensePlate": "Tablica Rejestracyjna",
-    "licensePlateMarine": "Numer Rejestracyjny",
     "customer": "Klient",
     "customer": "Klient",
     "selectCustomer": "Wybierz klienta (opcjonalnie)",
     "selectCustomer": "Wybierz klienta (opcjonalnie)",
     "createNewCustomer": "Utwórz nowego klienta",
     "createNewCustomer": "Utwórz nowego klienta",
@@ -75,12 +69,8 @@
     "phone": "Telefon",
     "phone": "Telefon",
     "phonePlaceholder": "Numer telefonu",
     "phonePlaceholder": "Numer telefonu",
     "creating": "Tworzenie...",
     "creating": "Tworzenie...",
-    "createAndContinue": "Utwórz i Kontynuuj",
-    "invalidYear": "Proszę wpisać prawidłowy rok",
     "customerNameRequired": "Nazwa klienta jest wymagana",
     "customerNameRequired": "Nazwa klienta jest wymagana",
     "failedCreateCustomer": "Nie udało się utworzyć klienta",
     "failedCreateCustomer": "Nie udało się utworzyć klienta",
-    "failedCreateVehicle": "Nie udało się utworzyć pojazdu",
-    "failedCreateVehicleMarine": "Nie udało się utworzyć jednostki",
     "somethingWentWrong": "Coś poszło nie tak",
     "somethingWentWrong": "Coś poszło nie tak",
     "partsSale": "Sprzedaż samych części",
     "partsSale": "Sprzedaż samych części",
     "partsSaleDescription": "Utwórz fakturę bez pojazdu, do sprzedaży części przy ladzie.",
     "partsSaleDescription": "Utwórz fakturę bez pojazdu, do sprzedaży części przy ladzie.",

+ 11 - 3
messages/pt-BR/calendar.json

@@ -189,8 +189,8 @@
     "noVehiclesMarine": "Nenhum barco encontrado.",
     "noVehiclesMarine": "Nenhum barco encontrado.",
     "none": "Nenhum",
     "none": "Nenhum",
     "optional": "Opcional",
     "optional": "Opcional",
-    "whoHint": "Um cliente, um carro ou os dois. Um carro que ainda não está cadastrado pode ser adicionado à ordem quando chegar.",
-    "whoHintMarine": "Um cliente, um barco ou os dois. Um barco que ainda não está cadastrado pode ser adicionado à ordem quando chegar.",
+    "whoHint": "Um cliente, um carro ou os dois. Ainda não cadastrado? Adicione com Novo.",
+    "whoHintMarine": "Um cliente, um barco ou os dois. Ainda não cadastrado? Adicione com Novo.",
     "work": "Serviço necessário",
     "work": "Serviço necessário",
     "workPlaceholder": "Freios dianteiros chiando\nTroca de óleo",
     "workPlaceholder": "Freios dianteiros chiando\nTroca de óleo",
     "workPlaceholderMarine": "Motor superaquece em alta velocidade\nRevisão anual",
     "workPlaceholderMarine": "Motor superaquece em alta velocidade\nRevisão anual",
@@ -271,7 +271,15 @@
     "customerChannelNeedsCustomer": "Escolha um cliente para notificá-lo.",
     "customerChannelNeedsCustomer": "Escolha um cliente para notificá-lo.",
     "descriptionPlaceholder": "Adicionar descrição",
     "descriptionPlaceholder": "Adicionar descrição",
     "convertSubmit": "Criar ordem de serviço",
     "convertSubmit": "Criar ordem de serviço",
-    "saved": "Agendamento salvo"
+    "saved": "Agendamento salvo",
+    "new": "Novo",
+    "newCustomer": "Novo cliente",
+    "newCustomerNamed": "Novo cliente “{name}”",
+    "newVehicle": "Novo veículo",
+    "newVehicleMarine": "Novo barco",
+    "newVehicleNamed": "Novo veículo com placa {plate}",
+    "newVehicleNamedMarine": "Novo barco com registro {plate}",
+    "openCalendar": "Abrir calendário"
   },
   },
   "notify": {
   "notify": {
     "inAppTitle": "Em breve: {title}",
     "inAppTitle": "Em breve: {title}",

+ 2 - 1
messages/pt-BR/customers.json

@@ -103,7 +103,8 @@
     "invoiceDesignDefault": "Padrão da oficina",
     "invoiceDesignDefault": "Padrão da oficina",
     "invoiceDesignHint": "As faturas deste cliente são impressas com este design em vez do padrão da oficina. Uma fatura ainda pode escolher o seu próprio.",
     "invoiceDesignHint": "As faturas deste cliente são impressas com este design em vez do padrão da oficina. Uma fatura ainda pode escolher o seu próprio.",
     "reminderOptOut": "Sem lembretes",
     "reminderOptOut": "Sem lembretes",
-    "reminderOptOutHint": "Não incluir este cliente em lembretes de inspeção ou outras campanhas."
+    "reminderOptOutHint": "Não incluir este cliente em lembretes de inspeção ou outras campanhas.",
+    "bookAppointment": "Agendar horário"
   },
   },
   "serviceRequests": {
   "serviceRequests": {
     "statusNew": "Novo",
     "statusNew": "Novo",

+ 2 - 1
messages/pt-BR/navigation.json

@@ -86,7 +86,8 @@
     "part": "Peça",
     "part": "Peça",
     "inspection": "Inspeção",
     "inspection": "Inspeção",
     "shopActions": "Ações da oficina",
     "shopActions": "Ações da oficina",
-    "person": "Adicionar uma pessoa"
+    "person": "Adicionar uma pessoa",
+    "appointment": "Agendamento"
   },
   },
   "purchaseWhiteLabel": "Adquirir White-Label",
   "purchaseWhiteLabel": "Adquirir White-Label",
   "licenseExpired": "Sua licença expirou. Os recursos podem estar limitados.",
   "licenseExpired": "Sua licença expirou. Os recursos podem estar limitados.",

+ 6 - 2
messages/pt-BR/vehicles.json

@@ -457,7 +457,9 @@
     "deleteVehicle": "Excluir veículo",
     "deleteVehicle": "Excluir veículo",
     "deleteVehicleMarine": "Excluir embarcação",
     "deleteVehicleMarine": "Excluir embarcação",
     "editMileage": "Alterar quilometragem",
     "editMileage": "Alterar quilometragem",
-    "editMileageMarine": "Alterar horas de motor"
+    "editMileageMarine": "Alterar horas de motor",
+    "bookAppointment": "Agendar horário",
+    "addTitleMarine": "Adicionar Nova Embarcação"
   },
   },
   "archiveDialog": {
   "archiveDialog": {
     "title": "Arquivar Veículo",
     "title": "Arquivar Veículo",
@@ -615,7 +617,9 @@
     "dueSoon": "Em breve",
     "dueSoon": "Em breve",
     "emptyTitle": "Consulte qualquer placa",
     "emptyTitle": "Consulte qualquer placa",
     "emptyBody": "Veja o veículo, de quem é aqui e o que {source} tem registrado. Ainda não é seu? Adicione em um passo.",
     "emptyBody": "Veja o veículo, de quem é aqui e o que {source} tem registrado. Ainda não é seu? Adicione em um passo.",
-    "registryWord": "o registro"
+    "registryWord": "o registro",
+    "bookAppointment": "Agendar horário",
+    "newWorkOrder": "Nova ordem de serviço"
   },
   },
   "safety": {
   "safety": {
     "title": "Segurança e problemas conhecidos",
     "title": "Segurança e problemas conhecidos",

+ 0 - 10
messages/pt-BR/workOrders.json

@@ -60,12 +60,6 @@
     "addNewVehicleMarine": "Adicionar Nova Embarcação",
     "addNewVehicleMarine": "Adicionar Nova Embarcação",
     "noPlate": "Sem placa",
     "noPlate": "Sem placa",
     "noPlateMarine": "Sem registro",
     "noPlateMarine": "Sem registro",
-    "make": "Marca *",
-    "makeMarine": "Fabricante *",
-    "model": "Modelo *",
-    "year": "Ano *",
-    "licensePlate": "Placa",
-    "licensePlateMarine": "Número de Registro",
     "customer": "Cliente",
     "customer": "Cliente",
     "selectCustomer": "Selecionar um cliente (opcional)",
     "selectCustomer": "Selecionar um cliente (opcional)",
     "createNewCustomer": "Criar novo cliente",
     "createNewCustomer": "Criar novo cliente",
@@ -75,12 +69,8 @@
     "phone": "Telefone",
     "phone": "Telefone",
     "phonePlaceholder": "Número de telefone",
     "phonePlaceholder": "Número de telefone",
     "creating": "Criando...",
     "creating": "Criando...",
-    "createAndContinue": "Criar e Continuar",
-    "invalidYear": "Por favor, insira um ano válido",
     "customerNameRequired": "Nome do cliente é obrigatório",
     "customerNameRequired": "Nome do cliente é obrigatório",
     "failedCreateCustomer": "Falha ao criar cliente",
     "failedCreateCustomer": "Falha ao criar cliente",
-    "failedCreateVehicle": "Falha ao criar veículo",
-    "failedCreateVehicleMarine": "Falha ao criar embarcação",
     "somethingWentWrong": "Algo deu errado",
     "somethingWentWrong": "Algo deu errado",
     "partsSale": "Venda apenas de peças",
     "partsSale": "Venda apenas de peças",
     "partsSaleDescription": "Crie uma fatura sem veículo, para vendas de peças no balcão.",
     "partsSaleDescription": "Crie uma fatura sem veículo, para vendas de peças no balcão.",

+ 11 - 3
messages/pt-PT/calendar.json

@@ -189,8 +189,8 @@
     "noVehiclesMarine": "Nenhum barco encontrado.",
     "noVehiclesMarine": "Nenhum barco encontrado.",
     "none": "Nenhum",
     "none": "Nenhum",
     "optional": "Opcional",
     "optional": "Opcional",
-    "whoHint": "Um cliente, uma viatura ou ambos. Uma viatura que ainda não esteja registada pode ser adicionada à ordem quando chegar.",
-    "whoHintMarine": "Um cliente, um barco ou ambos. Um barco que ainda não esteja registado pode ser adicionado à ordem quando chegar.",
+    "whoHint": "Um cliente, uma viatura ou ambos. Ainda não registado? Adicione com Novo.",
+    "whoHintMarine": "Um cliente, um barco ou ambos. Ainda não registado? Adicione com Novo.",
     "work": "Trabalho necessário",
     "work": "Trabalho necessário",
     "workPlaceholder": "Travões da frente a chiar\nMudança de óleo",
     "workPlaceholder": "Travões da frente a chiar\nMudança de óleo",
     "workPlaceholderMarine": "Motor sobreaquece a alta velocidade\nRevisão anual",
     "workPlaceholderMarine": "Motor sobreaquece a alta velocidade\nRevisão anual",
@@ -271,7 +271,15 @@
     "customerChannelNeedsCustomer": "Escolha um cliente para o notificar.",
     "customerChannelNeedsCustomer": "Escolha um cliente para o notificar.",
     "descriptionPlaceholder": "Adicionar descrição",
     "descriptionPlaceholder": "Adicionar descrição",
     "convertSubmit": "Criar ordem de serviço",
     "convertSubmit": "Criar ordem de serviço",
-    "saved": "Marcação guardada"
+    "saved": "Marcação guardada",
+    "new": "Novo",
+    "newCustomer": "Novo cliente",
+    "newCustomerNamed": "Novo cliente «{name}»",
+    "newVehicle": "Nova viatura",
+    "newVehicleMarine": "Novo barco",
+    "newVehicleNamed": "Nova viatura com matrícula {plate}",
+    "newVehicleNamedMarine": "Novo barco com matrícula {plate}",
+    "openCalendar": "Abrir calendário"
   },
   },
   "notify": {
   "notify": {
     "inAppTitle": "Em breve: {title}",
     "inAppTitle": "Em breve: {title}",

+ 2 - 1
messages/pt-PT/customers.json

@@ -103,7 +103,8 @@
     "invoiceDesignDefault": "Predefinição da oficina",
     "invoiceDesignDefault": "Predefinição da oficina",
     "invoiceDesignHint": "As faturas deste cliente são impressas com este design em vez do design predefinido da oficina. Cada fatura pode continuar a escolher o seu.",
     "invoiceDesignHint": "As faturas deste cliente são impressas com este design em vez do design predefinido da oficina. Cada fatura pode continuar a escolher o seu.",
     "reminderOptOut": "Sem lembretes",
     "reminderOptOut": "Sem lembretes",
-    "reminderOptOutHint": "Não incluir este cliente nos lembretes de inspeção nem noutras campanhas."
+    "reminderOptOutHint": "Não incluir este cliente nos lembretes de inspeção nem noutras campanhas.",
+    "bookAppointment": "Fazer marcação"
   },
   },
   "serviceRequests": {
   "serviceRequests": {
     "statusNew": "Novo",
     "statusNew": "Novo",

+ 2 - 1
messages/pt-PT/navigation.json

@@ -86,7 +86,8 @@
     "part": "Peça",
     "part": "Peça",
     "inspection": "Inspeção",
     "inspection": "Inspeção",
     "shopActions": "Oficina",
     "shopActions": "Oficina",
-    "person": "Adicionar uma pessoa"
+    "person": "Adicionar uma pessoa",
+    "appointment": "Marcação"
   },
   },
   "purchaseWhiteLabel": "Adquirir White-Label",
   "purchaseWhiteLabel": "Adquirir White-Label",
   "licenseExpired": "A sua licença expirou. Algumas funcionalidades podem estar limitadas.",
   "licenseExpired": "A sua licença expirou. Algumas funcionalidades podem estar limitadas.",

+ 6 - 2
messages/pt-PT/vehicles.json

@@ -457,7 +457,9 @@
     "deleteVehicle": "Eliminar viatura",
     "deleteVehicle": "Eliminar viatura",
     "deleteVehicleMarine": "Eliminar embarcação",
     "deleteVehicleMarine": "Eliminar embarcação",
     "editMileage": "Alterar quilometragem",
     "editMileage": "Alterar quilometragem",
-    "editMileageMarine": "Alterar horas de motor"
+    "editMileageMarine": "Alterar horas de motor",
+    "bookAppointment": "Fazer marcação",
+    "addTitleMarine": "Adicionar Nova Embarcação"
   },
   },
   "archiveDialog": {
   "archiveDialog": {
     "title": "Arquivar Viatura",
     "title": "Arquivar Viatura",
@@ -615,7 +617,9 @@
     "dueSoon": "Em breve",
     "dueSoon": "Em breve",
     "emptyTitle": "Consulte qualquer matrícula",
     "emptyTitle": "Consulte qualquer matrícula",
     "emptyBody": "Veja a viatura, a quem pertence aqui e o que {source} tem registado. Ainda não é sua? Adicione-a num passo.",
     "emptyBody": "Veja a viatura, a quem pertence aqui e o que {source} tem registado. Ainda não é sua? Adicione-a num passo.",
-    "registryWord": "o registo"
+    "registryWord": "o registo",
+    "bookAppointment": "Fazer marcação",
+    "newWorkOrder": "Nova ordem de serviço"
   },
   },
   "safety": {
   "safety": {
     "title": "Segurança e problemas conhecidos",
     "title": "Segurança e problemas conhecidos",

+ 0 - 10
messages/pt-PT/workOrders.json

@@ -60,12 +60,6 @@
     "addNewVehicleMarine": "Adicionar nova embarcação",
     "addNewVehicleMarine": "Adicionar nova embarcação",
     "noPlate": "Sem matrícula",
     "noPlate": "Sem matrícula",
     "noPlateMarine": "Sem registo",
     "noPlateMarine": "Sem registo",
-    "make": "Marca *",
-    "makeMarine": "Fabricante *",
-    "model": "Modelo *",
-    "year": "Ano *",
-    "licensePlate": "Matrícula",
-    "licensePlateMarine": "Número de registo",
     "customer": "Cliente",
     "customer": "Cliente",
     "selectCustomer": "Selecionar um cliente (opcional)",
     "selectCustomer": "Selecionar um cliente (opcional)",
     "createNewCustomer": "Criar novo cliente",
     "createNewCustomer": "Criar novo cliente",
@@ -75,12 +69,8 @@
     "phone": "Telefone",
     "phone": "Telefone",
     "phonePlaceholder": "Número de telefone",
     "phonePlaceholder": "Número de telefone",
     "creating": "A criar...",
     "creating": "A criar...",
-    "createAndContinue": "Criar e continuar",
-    "invalidYear": "Introduza um ano válido",
     "customerNameRequired": "O nome do cliente é obrigatório",
     "customerNameRequired": "O nome do cliente é obrigatório",
     "failedCreateCustomer": "Não foi possível criar o cliente",
     "failedCreateCustomer": "Não foi possível criar o cliente",
-    "failedCreateVehicle": "Não foi possível criar a viatura",
-    "failedCreateVehicleMarine": "Não foi possível criar a embarcação",
     "somethingWentWrong": "Algo correu mal",
     "somethingWentWrong": "Algo correu mal",
     "partsSale": "Venda só de peças",
     "partsSale": "Venda só de peças",
     "partsSaleDescription": "Crie uma fatura sem viatura, para vendas de peças ao balcão.",
     "partsSaleDescription": "Crie uma fatura sem viatura, para vendas de peças ao balcão.",

+ 11 - 3
messages/ru/calendar.json

@@ -189,8 +189,8 @@
     "noVehiclesMarine": "Лодки не найдены.",
     "noVehiclesMarine": "Лодки не найдены.",
     "none": "Нет",
     "none": "Нет",
     "optional": "Необязательно",
     "optional": "Необязательно",
-    "whoHint": "Клиент, автомобиль или и то, и другое. Автомобиль, которого ещё нет в базе, можно добавить в заказ-наряд, когда он прибудет.",
-    "whoHintMarine": "Клиент, лодка или и то, и другое. Лодку, которой ещё нет в базе, можно добавить в заказ-наряд, когда она прибудет.",
+    "whoHint": "Клиент, автомобиль или и то, и другое. Ещё нет в базе? Добавьте через «Создать».",
+    "whoHintMarine": "Клиент, лодка или и то, и другое. Ещё нет в базе? Добавьте через «Создать».",
     "work": "Необходимые работы",
     "work": "Необходимые работы",
     "workPlaceholder": "Скрипят передние тормоза\nЗамена масла",
     "workPlaceholder": "Скрипят передние тормоза\nЗамена масла",
     "workPlaceholderMarine": "Двигатель перегревается на высокой скорости\nЕжегодное ТО",
     "workPlaceholderMarine": "Двигатель перегревается на высокой скорости\nЕжегодное ТО",
@@ -271,7 +271,15 @@
     "customerChannelNeedsCustomer": "Выберите клиента, чтобы уведомить его.",
     "customerChannelNeedsCustomer": "Выберите клиента, чтобы уведомить его.",
     "descriptionPlaceholder": "Добавьте описание",
     "descriptionPlaceholder": "Добавьте описание",
     "convertSubmit": "Создать заказ-наряд",
     "convertSubmit": "Создать заказ-наряд",
-    "saved": "Запись сохранена"
+    "saved": "Запись сохранена",
+    "new": "Создать",
+    "newCustomer": "Новый клиент",
+    "newCustomerNamed": "Новый клиент «{name}»",
+    "newVehicle": "Новое транспортное средство",
+    "newVehicleMarine": "Новая лодка",
+    "newVehicleNamed": "Новое транспортное средство с номером {plate}",
+    "newVehicleNamedMarine": "Новая лодка с регистрационным номером {plate}",
+    "openCalendar": "Открыть календарь"
   },
   },
   "notify": {
   "notify": {
     "inAppTitle": "Скоро: {title}",
     "inAppTitle": "Скоро: {title}",

+ 2 - 1
messages/ru/customers.json

@@ -103,7 +103,8 @@
     "invoiceDesignDefault": "По умолчанию для мастерской",
     "invoiceDesignDefault": "По умолчанию для мастерской",
     "invoiceDesignHint": "Счета этого клиента печатаются с этим дизайном вместо дизайна мастерской по умолчанию. Счёт по-прежнему может выбрать свой.",
     "invoiceDesignHint": "Счета этого клиента печатаются с этим дизайном вместо дизайна мастерской по умолчанию. Счёт по-прежнему может выбрать свой.",
     "reminderOptOut": "Без напоминаний",
     "reminderOptOut": "Без напоминаний",
-    "reminderOptOutHint": "Не включать этого клиента в напоминания о техосмотре и другие рассылки."
+    "reminderOptOutHint": "Не включать этого клиента в напоминания о техосмотре и другие рассылки.",
+    "bookAppointment": "Создать запись"
   },
   },
   "serviceRequests": {
   "serviceRequests": {
     "statusNew": "Новая",
     "statusNew": "Новая",

+ 2 - 1
messages/ru/navigation.json

@@ -86,7 +86,8 @@
     "part": "Запчасть",
     "part": "Запчасть",
     "inspection": "Осмотр",
     "inspection": "Осмотр",
     "shopActions": "Мастерская",
     "shopActions": "Мастерская",
-    "person": "Добавить человека"
+    "person": "Добавить человека",
+    "appointment": "Запись"
   },
   },
   "purchaseWhiteLabel": "Купить White-Label",
   "purchaseWhiteLabel": "Купить White-Label",
   "licenseExpired": "Ваша лицензия истекла. Функции могут быть ограничены.",
   "licenseExpired": "Ваша лицензия истекла. Функции могут быть ограничены.",

+ 6 - 2
messages/ru/vehicles.json

@@ -457,7 +457,9 @@
     "deleteVehicle": "Удалить транспортное средство",
     "deleteVehicle": "Удалить транспортное средство",
     "deleteVehicleMarine": "Удалить лодку",
     "deleteVehicleMarine": "Удалить лодку",
     "editMileage": "Изменить пробег",
     "editMileage": "Изменить пробег",
-    "editMileageMarine": "Изменить моточасы"
+    "editMileageMarine": "Изменить моточасы",
+    "bookAppointment": "Создать запись",
+    "addTitleMarine": "Добавить новое судно"
   },
   },
   "archiveDialog": {
   "archiveDialog": {
     "title": "Архивировать транспортное средство",
     "title": "Архивировать транспортное средство",
@@ -615,7 +617,9 @@
     "dueSoon": "Скоро",
     "dueSoon": "Скоро",
     "emptyTitle": "Найдите любой номер",
     "emptyTitle": "Найдите любой номер",
     "emptyBody": "Посмотрите автомобиль, кто его владелец здесь и что о нём есть в {source}. Ещё не ваш? Добавьте за один шаг.",
     "emptyBody": "Посмотрите автомобиль, кто его владелец здесь и что о нём есть в {source}. Ещё не ваш? Добавьте за один шаг.",
-    "registryWord": "реестр"
+    "registryWord": "реестр",
+    "bookAppointment": "Создать запись",
+    "newWorkOrder": "Новый заказ-наряд"
   },
   },
   "safety": {
   "safety": {
     "title": "Безопасность и известные проблемы",
     "title": "Безопасность и известные проблемы",

+ 0 - 10
messages/ru/workOrders.json

@@ -60,12 +60,6 @@
     "addNewVehicleMarine": "Добавить новое судно",
     "addNewVehicleMarine": "Добавить новое судно",
     "noPlate": "Без госномера",
     "noPlate": "Без госномера",
     "noPlateMarine": "Без регистрационного номера",
     "noPlateMarine": "Без регистрационного номера",
-    "make": "Марка *",
-    "makeMarine": "Производитель *",
-    "model": "Модель *",
-    "year": "Год *",
-    "licensePlate": "Госномер",
-    "licensePlateMarine": "Регистрационный номер",
     "customer": "Клиент",
     "customer": "Клиент",
     "selectCustomer": "Выберите клиента (необязательно)",
     "selectCustomer": "Выберите клиента (необязательно)",
     "createNewCustomer": "Создать нового клиента",
     "createNewCustomer": "Создать нового клиента",
@@ -75,12 +69,8 @@
     "phone": "Телефон",
     "phone": "Телефон",
     "phonePlaceholder": "Номер телефона",
     "phonePlaceholder": "Номер телефона",
     "creating": "Создание...",
     "creating": "Создание...",
-    "createAndContinue": "Создать и продолжить",
-    "invalidYear": "Введите корректный год",
     "customerNameRequired": "Имя клиента обязательно",
     "customerNameRequired": "Имя клиента обязательно",
     "failedCreateCustomer": "Не удалось создать клиента",
     "failedCreateCustomer": "Не удалось создать клиента",
-    "failedCreateVehicle": "Не удалось создать транспортное средство",
-    "failedCreateVehicleMarine": "Не удалось создать судно",
     "somethingWentWrong": "Что-то пошло не так",
     "somethingWentWrong": "Что-то пошло не так",
     "partsSale": "Продажа только запчастей",
     "partsSale": "Продажа только запчастей",
     "partsSaleDescription": "Создайте счёт без автомобиля для продажи запчастей у прилавка.",
     "partsSaleDescription": "Создайте счёт без автомобиля для продажи запчастей у прилавка.",

+ 11 - 3
messages/tr/calendar.json

@@ -189,8 +189,8 @@
     "noVehiclesMarine": "Tekne bulunamadı.",
     "noVehiclesMarine": "Tekne bulunamadı.",
     "none": "Yok",
     "none": "Yok",
     "optional": "İsteğe bağlı",
     "optional": "İsteğe bağlı",
-    "whoHint": "Bir müşteri, bir araç ya da ikisi birden. Henüz kayıtlı olmayan bir araç, geldiğinde iş emrine eklenebilir.",
-    "whoHintMarine": "Bir müşteri, bir tekne ya da ikisi birden. Henüz kayıtlı olmayan bir tekne, geldiğinde iş emrine eklenebilir.",
+    "whoHint": "Bir müşteri, bir araç ya da ikisi birden. Henüz kayıtlı değil mi? Yeni ile ekleyin.",
+    "whoHintMarine": "Bir müşteri, bir tekne ya da ikisi birden. Henüz kayıtlı değil mi? Yeni ile ekleyin.",
     "work": "Yapılacak iş",
     "work": "Yapılacak iş",
     "workPlaceholder": "Ön frenler gıcırdıyor\nYağ değişimi",
     "workPlaceholder": "Ön frenler gıcırdıyor\nYağ değişimi",
     "workPlaceholderMarine": "Motor yüksek hızda aşırı ısınıyor\nYıllık bakım",
     "workPlaceholderMarine": "Motor yüksek hızda aşırı ısınıyor\nYıllık bakım",
@@ -271,7 +271,15 @@
     "customerChannelNeedsCustomer": "Bildirim göndermek için bir müşteri seçin.",
     "customerChannelNeedsCustomer": "Bildirim göndermek için bir müşteri seçin.",
     "descriptionPlaceholder": "Açıklama ekleyin",
     "descriptionPlaceholder": "Açıklama ekleyin",
     "convertSubmit": "İş emri oluştur",
     "convertSubmit": "İş emri oluştur",
-    "saved": "Randevu kaydedildi"
+    "saved": "Randevu kaydedildi",
+    "new": "Yeni",
+    "newCustomer": "Yeni müşteri",
+    "newCustomerNamed": "Yeni müşteri “{name}”",
+    "newVehicle": "Yeni araç",
+    "newVehicleMarine": "Yeni tekne",
+    "newVehicleNamed": "{plate} plakalı yeni araç",
+    "newVehicleNamedMarine": "{plate} tescil numaralı yeni tekne",
+    "openCalendar": "Takvimi aç"
   },
   },
   "notify": {
   "notify": {
     "inAppTitle": "Yaklaşıyor: {title}",
     "inAppTitle": "Yaklaşıyor: {title}",

+ 2 - 1
messages/tr/customers.json

@@ -103,7 +103,8 @@
     "invoiceDesignDefault": "Atölye varsayılanı",
     "invoiceDesignDefault": "Atölye varsayılanı",
     "invoiceDesignHint": "Bu müşterinin faturaları atölye varsayılanı yerine bu tasarımla yazdırılır. Bir fatura yine de kendi tasarımını seçebilir.",
     "invoiceDesignHint": "Bu müşterinin faturaları atölye varsayılanı yerine bu tasarımla yazdırılır. Bir fatura yine de kendi tasarımını seçebilir.",
     "reminderOptOut": "Hatırlatma yok",
     "reminderOptOut": "Hatırlatma yok",
-    "reminderOptOutHint": "Bu müşteriyi muayene hatırlatmalarına veya diğer kampanyalara dahil etme."
+    "reminderOptOutHint": "Bu müşteriyi muayene hatırlatmalarına veya diğer kampanyalara dahil etme.",
+    "bookAppointment": "Randevu oluştur"
   },
   },
   "serviceRequests": {
   "serviceRequests": {
     "statusNew": "Yeni",
     "statusNew": "Yeni",

+ 2 - 1
messages/tr/navigation.json

@@ -86,7 +86,8 @@
     "part": "Parça",
     "part": "Parça",
     "inspection": "Muayene",
     "inspection": "Muayene",
     "shopActions": "Servis",
     "shopActions": "Servis",
-    "person": "Kişi ekle"
+    "person": "Kişi ekle",
+    "appointment": "Randevu"
   },
   },
   "purchaseWhiteLabel": "Beyaz Etiket Satın Al",
   "purchaseWhiteLabel": "Beyaz Etiket Satın Al",
   "licenseExpired": "Lisansınız sona erdi. Özellikler sınırlı olabilir.",
   "licenseExpired": "Lisansınız sona erdi. Özellikler sınırlı olabilir.",

+ 6 - 2
messages/tr/vehicles.json

@@ -457,7 +457,9 @@
     "deleteVehicle": "Aracı sil",
     "deleteVehicle": "Aracı sil",
     "deleteVehicleMarine": "Tekneyi sil",
     "deleteVehicleMarine": "Tekneyi sil",
     "editMileage": "Kilometreyi değiştir",
     "editMileage": "Kilometreyi değiştir",
-    "editMileageMarine": "Motor saatlerini değiştir"
+    "editMileageMarine": "Motor saatlerini değiştir",
+    "bookAppointment": "Randevu oluştur",
+    "addTitleMarine": "Yeni Tekne Ekle"
   },
   },
   "archiveDialog": {
   "archiveDialog": {
     "title": "Aracı Arşivle",
     "title": "Aracı Arşivle",
@@ -615,7 +617,9 @@
     "dueSoon": "Yaklaşıyor",
     "dueSoon": "Yaklaşıyor",
     "emptyTitle": "Herhangi bir plakayı sorgulayın",
     "emptyTitle": "Herhangi bir plakayı sorgulayın",
     "emptyBody": "Aracı, burada kime ait olduğunu ve {source} kaydında ne olduğunu görün. Henüz sizin değil mi? Tek adımda ekleyin.",
     "emptyBody": "Aracı, burada kime ait olduğunu ve {source} kaydında ne olduğunu görün. Henüz sizin değil mi? Tek adımda ekleyin.",
-    "registryWord": "sicil"
+    "registryWord": "sicil",
+    "bookAppointment": "Randevu oluştur",
+    "newWorkOrder": "Yeni iş emri"
   },
   },
   "safety": {
   "safety": {
     "title": "Güvenlik ve bilinen sorunlar",
     "title": "Güvenlik ve bilinen sorunlar",

+ 0 - 10
messages/tr/workOrders.json

@@ -60,12 +60,6 @@
     "addNewVehicleMarine": "Yeni Tekne Ekle",
     "addNewVehicleMarine": "Yeni Tekne Ekle",
     "noPlate": "Plaka yok",
     "noPlate": "Plaka yok",
     "noPlateMarine": "Tescil numarası yok",
     "noPlateMarine": "Tescil numarası yok",
-    "make": "Marka *",
-    "makeMarine": "Üretici *",
-    "model": "Model *",
-    "year": "Yıl *",
-    "licensePlate": "Plaka",
-    "licensePlateMarine": "Tescil Numarası",
     "customer": "Müşteri",
     "customer": "Müşteri",
     "selectCustomer": "Müşteri seç (isteğe bağlı)",
     "selectCustomer": "Müşteri seç (isteğe bağlı)",
     "createNewCustomer": "Yeni müşteri oluştur",
     "createNewCustomer": "Yeni müşteri oluştur",
@@ -75,12 +69,8 @@
     "phone": "Telefon",
     "phone": "Telefon",
     "phonePlaceholder": "Telefon numarası",
     "phonePlaceholder": "Telefon numarası",
     "creating": "Oluşturuluyor...",
     "creating": "Oluşturuluyor...",
-    "createAndContinue": "Oluştur & Devam Et",
-    "invalidYear": "Lütfen geçerli bir yıl girin",
     "customerNameRequired": "Müşteri adı gereklidir",
     "customerNameRequired": "Müşteri adı gereklidir",
     "failedCreateCustomer": "Müşteri oluşturulamadı",
     "failedCreateCustomer": "Müşteri oluşturulamadı",
-    "failedCreateVehicle": "Araç oluşturulamadı",
-    "failedCreateVehicleMarine": "Tekne oluşturulamadı",
     "somethingWentWrong": "Bir sorun oluştu",
     "somethingWentWrong": "Bir sorun oluştu",
     "partsSale": "Yalnızca parça satışı",
     "partsSale": "Yalnızca parça satışı",
     "partsSaleDescription": "Tezgahtan parça satışları için araçsız bir fatura oluşturun.",
     "partsSaleDescription": "Tezgahtan parça satışları için araçsız bir fatura oluşturun.",

+ 82 - 0
src/__tests__/components/quick-create-menu.test.tsx

@@ -0,0 +1,82 @@
+/**
+ * The header's Quick Add menu books an appointment from any screen, for
+ * whoever may book, beside starting a work order.
+ */
+
+import { fireEvent, render, screen } from '@testing-library/react'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+
+const noop = () => undefined
+vi.stubGlobal(
+  'ResizeObserver',
+  class {
+    observe = noop
+    unobserve = noop
+    disconnect = noop
+  }
+)
+Element.prototype.scrollIntoView = noop
+Element.prototype.hasPointerCapture = () => false
+Element.prototype.releasePointerCapture = noop
+
+vi.mock('next/navigation', () => ({
+  useRouter: () => ({ push: vi.fn(), refresh: vi.fn(), replace: vi.fn() }),
+  usePathname: () => '/',
+  useSearchParams: () => new URLSearchParams(),
+}))
+vi.mock('@/features/vehicles/Actions/vehicleActions', () => ({
+  searchVehicles: vi.fn(async () => ({ success: true, data: [] })),
+  createVehicle: vi.fn(),
+  updateVehicle: vi.fn(),
+}))
+vi.mock('@/features/vehicles/Actions/createDraftServiceRecord', () => ({
+  createDraftCounterSale: vi.fn(),
+}))
+vi.mock('@/features/customers/Actions/customerActions', () => ({
+  searchCustomers: vi.fn(async () => ({ success: true, data: [] })),
+  createCustomer: vi.fn(),
+  updateCustomer: vi.fn(),
+  findOwnerCandidates: vi.fn(async () => ({ success: true, data: [] })),
+  getCustomerOption: vi.fn(async () => ({ success: true, data: null })),
+}))
+vi.mock('@/features/inspections/Actions/inspectionActions', () => ({ createInspection: vi.fn() }))
+vi.mock('@/features/inspections/Actions/templateActions', () => ({
+  getTemplates: vi.fn(async () => ({ success: true, data: [] })),
+}))
+vi.mock('@/features/shortcuts/Actions/saveKeyboardShortcuts', () => ({
+  saveKeyboardShortcuts: vi.fn(),
+}))
+
+import { BOOKING_EVENT, BookingAccessProvider } from '@/components/booking-launcher'
+import { QuickCreateMenu } from '@/components/quick-create-menu'
+
+function openMenu(canBook: boolean) {
+  render(
+    <BookingAccessProvider value={{ canBook, canAddCustomer: true }}>
+      <QuickCreateMenu />
+    </BookingAccessProvider>
+  )
+  fireEvent.keyDown(screen.getByRole('button', { name: 'Quick Add' }), { key: 'Enter' })
+}
+
+beforeEach(() => {
+  vi.clearAllMocks()
+})
+
+describe('QuickCreateMenu', () => {
+  it('opens a booking from "Appointment"', async () => {
+    openMenu(true)
+    const booked = vi.fn()
+    document.addEventListener(BOOKING_EVENT, booked)
+    fireEvent.click(await screen.findByRole('menuitem', { name: 'Appointment' }))
+    document.removeEventListener(BOOKING_EVENT, booked)
+    expect(booked).toHaveBeenCalledTimes(1)
+    expect((booked.mock.calls[0][0] as CustomEvent).detail).toEqual({})
+  })
+
+  it('offers no appointment to someone who may not book', async () => {
+    openMenu(false)
+    expect(await screen.findByRole('menuitem', { name: /Work Order/ })).toBeInTheDocument()
+    expect(screen.queryByRole('menuitem', { name: 'Appointment' })).not.toBeInTheDocument()
+  })
+})

+ 193 - 49
src/__tests__/components/vehicle-picker-dialog.test.tsx

@@ -5,45 +5,80 @@
  * number rather than a licence plate. An automotive workshop's wording has to
  * number rather than a licence plate. An automotive workshop's wording has to
  * stay exactly as it was, because the end-to-end specs find the dialog and its
  * stay exactly as it was, because the end-to-end specs find the dialog and its
  * buttons by those words.
  * buttons by those words.
+ *
+ * A vehicle not on file is added in the full vehicle form, the same one the
+ * vehicles page opens, and its work order opens as soon as it is saved.
  */
  */
 
 
-import { describe, it, expect, vi } from 'vitest'
+import { beforeEach, describe, it, expect, vi } from 'vitest'
 import { fireEvent, render, screen, waitFor } from '@testing-library/react'
 import { fireEvent, render, screen, waitFor } from '@testing-library/react'
 import { ServiceTypeProvider } from '@/components/service-type-context'
 import { ServiceTypeProvider } from '@/components/service-type-context'
+import { PlateLookupProvider } from '@/components/plate-lookup-context'
+import { TooltipProvider } from '@/components/ui/tooltip'
+
+// Radix measures and captures pointers; jsdom does neither.
+const noop = () => undefined
+vi.stubGlobal(
+  'ResizeObserver',
+  class {
+    observe = noop
+    unobserve = noop
+    disconnect = noop
+  }
+)
+Element.prototype.scrollIntoView = noop
+Element.prototype.hasPointerCapture = () => false
+Element.prototype.releasePointerCapture = noop
 
 
+const push = vi.hoisted(() => vi.fn())
 vi.mock('next/navigation', () => ({
 vi.mock('next/navigation', () => ({
-  useRouter: () => ({ push: vi.fn(), refresh: vi.fn() }),
+  useRouter: () => ({ push, refresh: vi.fn(), replace: vi.fn() }),
+  usePathname: () => '/',
+  useSearchParams: () => new URLSearchParams(),
 }))
 }))
 const searchVehicles = vi.hoisted(() => vi.fn())
 const searchVehicles = vi.hoisted(() => vi.fn())
+const createVehicle = vi.hoisted(() => vi.fn())
 vi.mock('@/features/vehicles/Actions/vehicleActions', () => ({
 vi.mock('@/features/vehicles/Actions/vehicleActions', () => ({
   createVehicle,
   createVehicle,
   searchVehicles,
   searchVehicles,
+  updateVehicle: vi.fn(),
 }))
 }))
 vi.mock('@/features/vehicles/Actions/createDraftServiceRecord', () => ({
 vi.mock('@/features/vehicles/Actions/createDraftServiceRecord', () => ({
   createDraftCounterSale: vi.fn(),
   createDraftCounterSale: vi.fn(),
 }))
 }))
-const createVehicle = vi.hoisted(() => vi.fn())
-vi.mock('@/features/customers/Actions/customerActions', () => ({ createCustomer: vi.fn() }))
-// Stands in for the server search: one button picks a customer, and it names
-// whoever it was handed, which is what a user sees in the real one.
-vi.mock('@/features/quotes/Components/CustomerCombobox', () => ({
-  CustomerCombobox: ({
-    initialCustomer,
-    onChange,
-  }: {
-    initialCustomer?: { name: string } | null
-    onChange: (id: string, c: { id: string; name: string; company: null }) => void
-  }) => (
-    <button
-      type="button"
-      onClick={() => onChange('c1', { id: 'c1', name: 'Ann Berg', company: null })}
-    >
-      {initialCustomer?.name ?? 'Select a customer (optional)'}
-    </button>
-  ),
+const searchCustomers = vi.hoisted(() => vi.fn())
+vi.mock('@/features/customers/Actions/customerActions', () => ({
+  createCustomer: vi.fn(),
+  findOwnerCandidates: vi.fn(async () => ({ success: true, data: [] })),
+  getCustomerOption: vi.fn(async () => ({ success: true, data: null })),
+  searchCustomers,
+}))
+vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
+  aiAnalyzeVehicleDocument: vi.fn(),
+  isVehicleScanAvailable: vi.fn(async () => ({ success: true, data: false })),
+}))
+vi.mock('@/features/integrations/Actions/vehicleLookupActions', () => ({
+  isVehicleLookupAvailable: vi.fn(async () => ({ success: true, data: {} })),
+  lookupVehicle: vi.fn(),
+}))
+vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({
+  countPhotosSince: vi.fn(),
+  createPhotoHandoffLink: vi.fn(),
+  createVehiclePhotoHandoffLink: vi.fn(),
+  getVehiclePhotoUrl: vi.fn(),
 }))
 }))
+vi.mock('@/features/inspections/Actions/attachmentActions', () => ({
+  countInspectionMedia: vi.fn(),
+  createInspectionHandoffLink: vi.fn(),
+}))
+vi.mock('@/features/invoice-designer/Actions/documentDesignActions', () => ({
+  listDesignOptions: vi.fn(async () => ({ success: true, data: [] })),
+}))
+vi.mock('@/components/glass-modal', () => ({ useGlassModal: () => ({ open: vi.fn() }) }))
 vi.mock('@/components/upgrade-gate', () => ({ handleGated: () => false }))
 vi.mock('@/components/upgrade-gate', () => ({ handleGated: () => false }))
-vi.mock('sonner', () => ({ toast: { error: vi.fn(), success: vi.fn() } }))
+vi.mock('sonner', () => ({
+  toast: { error: vi.fn(), success: vi.fn(), loading: vi.fn(), warning: vi.fn() },
+}))
 
 
 const { VehiclePickerDialog } = await import('@/components/vehicle-picker-dialog')
 const { VehiclePickerDialog } = await import('@/components/vehicle-picker-dialog')
 
 
@@ -56,7 +91,23 @@ const unregistered = {
   customer: null,
   customer: null,
 }
 }
 
 
-function renderPicker(serviceType: string, props: { title?: string; empty?: boolean } = {}) {
+beforeEach(() => {
+  vi.clearAllMocks()
+  searchCustomers.mockResolvedValue({
+    success: true,
+    data: [{ id: 'c1', name: 'Ann Berg', company: null }],
+  })
+})
+
+function renderPicker(
+  serviceType: string,
+  props: {
+    title?: string
+    empty?: boolean
+    canCreate?: boolean
+    redirectQuery?: Record<string, string>
+  } = {}
+) {
   searchVehicles.mockReset()
   searchVehicles.mockReset()
   searchVehicles.mockResolvedValue({
   searchVehicles.mockResolvedValue({
     success: true,
     success: true,
@@ -64,11 +115,30 @@ function renderPicker(serviceType: string, props: { title?: string; empty?: bool
   })
   })
   return render(
   return render(
     <ServiceTypeProvider serviceType={serviceType}>
     <ServiceTypeProvider serviceType={serviceType}>
-      <VehiclePickerDialog open onOpenChange={vi.fn()} title={props.title} />
+      <PlateLookupProvider
+        value={{ available: false, canCreate: props.canCreate ?? true, registryName: null }}
+      >
+        <TooltipProvider>
+          <VehiclePickerDialog
+            open
+            onOpenChange={vi.fn()}
+            title={props.title}
+            redirectQuery={props.redirectQuery}
+          />
+        </TooltipProvider>
+      </PlateLookupProvider>
     </ServiceTypeProvider>
     </ServiceTypeProvider>
   )
   )
 }
 }
 
 
+/** Fills what a vehicle must have and saves the form. */
+function saveNewVehicle(make: string, model: string, year: string, submit = 'Add New Vehicle') {
+  fireEvent.change(screen.getByLabelText(/^(Make|Manufacturer) \*$/), { target: { value: make } })
+  fireEvent.change(screen.getByLabelText('Model *'), { target: { value: model } })
+  fireEvent.change(screen.getByLabelText('Year *'), { target: { value: year } })
+  fireEvent.click(screen.getByRole('button', { name: submit }))
+}
+
 describe('VehiclePickerDialog, automotive', () => {
 describe('VehiclePickerDialog, automotive', () => {
   it('keeps its vehicle wording on the select step', async () => {
   it('keeps its vehicle wording on the select step', async () => {
     renderPicker('automotive')
     renderPicker('automotive')
@@ -97,32 +167,90 @@ describe('VehiclePickerDialog, automotive', () => {
     await waitFor(() => expect(searchVehicles).toHaveBeenCalledWith('smith', 30))
     await waitFor(() => expect(searchVehicles).toHaveBeenCalledWith('smith', 30))
   })
   })
 
 
-  it('names the customer a new vehicle will be saved to, after going back and forth', async () => {
+  it('opens the work order of a vehicle picked from the list, with the redirect query', async () => {
+    renderPicker('automotive', { redirectQuery: { date: '2026-11-16' } })
+    fireEvent.click(await screen.findByText('2020 Yamaha F150'))
+    expect(push).toHaveBeenCalledWith('/vehicles/v1/service/new?date=2026-11-16')
+  })
+
+  it('opens the full vehicle form to add a vehicle, not a short one', async () => {
     renderPicker('automotive')
     renderPicker('automotive')
-    createVehicle.mockReset()
-    createVehicle.mockResolvedValue({ success: true, data: { id: 'v9' } })
-    fireEvent.click(screen.getByRole('button', { name: 'Parts-Only Sale' }))
-    fireEvent.click(screen.getByRole('button', { name: 'Select a customer (optional)' }))
-    fireEvent.click(screen.getAllByRole('button')[0]) // back
     fireEvent.click(screen.getByRole('button', { name: 'Add New Vehicle' }))
     fireEvent.click(screen.getByRole('button', { name: 'Add New Vehicle' }))
+    const form = await screen.findByRole('dialog', { name: 'Add New Vehicle' })
+    expect(form).toBeVisible()
+    expect(screen.getByLabelText('Make *')).toHaveAttribute('placeholder', 'Toyota')
+    expect(screen.getByLabelText('License Plate')).toBeInTheDocument()
+    // The whole form: the owner, the fuel, the VIN.
+    expect(screen.getByRole('radiogroup', { name: 'Fuel Type' })).toBeInTheDocument()
+    expect(screen.getByLabelText('VIN')).toBeInTheDocument()
+    expect(screen.queryByRole('button', { name: 'Create & Continue' })).not.toBeInTheDocument()
+  })
+
+  it('opens the new work order once the vehicle is saved, with the redirect query', async () => {
+    createVehicle.mockResolvedValue({
+      success: true,
+      data: {
+        id: 'v9',
+        make: 'Volvo',
+        model: 'V70',
+        year: 2015,
+        licensePlate: null,
+        customerId: null,
+      },
+    })
+    renderPicker('automotive', { redirectQuery: { date: '2026-11-16', time: '09:30' } })
+    fireEvent.click(screen.getByRole('button', { name: 'Add New Vehicle' }))
+    await screen.findByRole('dialog', { name: 'Add New Vehicle' })
+    saveNewVehicle('Volvo', 'V70', '2015')
 
 
-    expect(screen.getByRole('button', { name: 'Ann Berg' })).toBeInTheDocument()
-    fireEvent.change(screen.getByLabelText('Make *'), { target: { value: 'Volvo' } })
-    fireEvent.change(screen.getByLabelText('Model *'), { target: { value: 'V70' } })
-    fireEvent.change(screen.getByLabelText('Year *'), { target: { value: '2015' } })
-    fireEvent.click(screen.getByRole('button', { name: 'Create & Continue' }))
     await waitFor(() =>
     await waitFor(() =>
-      expect(createVehicle).toHaveBeenCalledWith(expect.objectContaining({ customerId: 'c1' }))
+      expect(push).toHaveBeenCalledWith('/vehicles/v9/service/new?date=2026-11-16&time=09%3A30')
+    )
+    expect(createVehicle).toHaveBeenCalledWith(
+      expect.objectContaining({ make: 'Volvo', model: 'V70', year: 2015 })
     )
     )
   })
   })
 
 
-  it('keeps its vehicle wording on the create step', () => {
-    renderPicker('automotive')
+  it('starts the new vehicle with the plate that was searched for', async () => {
+    renderPicker('automotive', { empty: true })
+    fireEvent.change(screen.getByPlaceholderText('Search vehicles...'), {
+      target: { value: 'ab 12345' },
+    })
     fireEvent.click(screen.getByRole('button', { name: 'Add New Vehicle' }))
     fireEvent.click(screen.getByRole('button', { name: 'Add New Vehicle' }))
-    expect(screen.getByRole('dialog', { name: 'Add New Vehicle' })).toBeVisible()
-    expect(screen.getByLabelText('Make *')).toHaveAttribute('placeholder', 'e.g. Toyota')
-    expect(screen.getByLabelText('License Plate')).toBeInTheDocument()
-    expect(screen.getByRole('button', { name: 'Create & Continue' })).toBeInTheDocument()
+    await screen.findByRole('dialog', { name: 'Add New Vehicle' })
+    await waitFor(() => expect(screen.getByLabelText('License Plate')).toHaveValue('AB 12345'))
+    expect(screen.getByLabelText('License Plate')).toHaveFocus()
+  })
+
+  it('leaves the plate empty when the search was for a name', async () => {
+    renderPicker('automotive', { empty: true })
+    fireEvent.change(screen.getByPlaceholderText('Search vehicles...'), {
+      target: { value: 'smith' },
+    })
+    fireEvent.click(screen.getByRole('button', { name: 'Add New Vehicle' }))
+    await screen.findByRole('dialog', { name: 'Add New Vehicle' })
+    await waitFor(() => expect(screen.getByLabelText('License Plate')).toHaveFocus())
+    expect(screen.getByLabelText('License Plate')).toHaveValue('')
+  })
+
+  it('offers no new vehicle to someone who may not add one', async () => {
+    renderPicker('automotive', { canCreate: false })
+    expect(await screen.findByText('No plate')).toBeInTheDocument()
+    expect(screen.queryByRole('button', { name: 'Add New Vehicle' })).not.toBeInTheDocument()
+    expect(screen.getByRole('button', { name: 'Parts-Only Sale' })).toBeInTheDocument()
+  })
+
+  it('keeps the customer chosen for a parts sale after going back and forth', async () => {
+    renderPicker('automotive')
+    fireEvent.click(screen.getByRole('button', { name: 'Parts-Only Sale' }))
+    fireEvent.click(screen.getByRole('combobox'))
+    fireEvent.click(await screen.findByRole('option', { name: /Ann Berg/ }))
+    expect(screen.getByRole('combobox')).toHaveTextContent('Ann Berg')
+
+    fireEvent.click(screen.getAllByRole('button')[0]) // back
+    fireEvent.click(screen.getByRole('button', { name: 'Parts-Only Sale' }))
+    expect(screen.getByRole('combobox')).toHaveTextContent('Ann Berg')
+    expect(screen.getByRole('button', { name: 'Create Sale' })).toBeEnabled()
   })
   })
 })
 })
 
 
@@ -141,17 +269,33 @@ describe('VehiclePickerDialog, marine', () => {
     expect(await screen.findByText('No vessels found.')).toBeInTheDocument()
     expect(await screen.findByText('No vessels found.')).toBeInTheDocument()
   })
   })
 
 
-  it('asks for what a boat has on the create step', () => {
+  it('asks for what a boat has in the full form', async () => {
     renderPicker('marine')
     renderPicker('marine')
     fireEvent.click(screen.getByRole('button', { name: 'Add New Vessel' }))
     fireEvent.click(screen.getByRole('button', { name: 'Add New Vessel' }))
-    expect(screen.getByRole('dialog', { name: 'Add New Vessel' })).toBeVisible()
-    expect(screen.getByLabelText('Manufacturer *')).toHaveAttribute(
-      'placeholder',
-      'e.g. Boston Whaler'
-    )
+    expect(await screen.findByRole('dialog', { name: 'Add New Vessel' })).toBeVisible()
+    expect(screen.getByLabelText('Manufacturer *')).toHaveAttribute('placeholder', 'Boston Whaler')
     expect(screen.getByLabelText('Registration Number')).toBeInTheDocument()
     expect(screen.getByLabelText('Registration Number')).toBeInTheDocument()
     expect(screen.queryByText('License Plate')).toBeNull()
     expect(screen.queryByText('License Plate')).toBeNull()
-    expect(screen.getByRole('button', { name: 'Create & Continue' })).toBeInTheDocument()
+    expect(screen.getByRole('button', { name: 'Add New Vessel' })).toBeInTheDocument()
+  })
+
+  it('opens the new work order once the vessel is saved', async () => {
+    createVehicle.mockResolvedValue({
+      success: true,
+      data: {
+        id: 'b1',
+        make: 'Boston Whaler',
+        model: 'Montauk 170',
+        year: 2019,
+        licensePlate: 'LK 1234',
+        customerId: null,
+      },
+    })
+    renderPicker('marine')
+    fireEvent.click(screen.getByRole('button', { name: 'Add New Vessel' }))
+    await screen.findByRole('dialog', { name: 'Add New Vessel' })
+    saveNewVehicle('Boston Whaler', 'Montauk 170', '2019', 'Add New Vessel')
+    await waitFor(() => expect(push).toHaveBeenCalledWith('/vehicles/b1/service/new'))
   })
   })
 
 
   it('offers a parts sale without a vessel', () => {
   it('offers a parts sale without a vessel', () => {

+ 376 - 15
src/__tests__/features/calendar/booking-dialog.test.tsx

@@ -32,7 +32,9 @@ vi.mock('@/components/date-settings-context', () => ({
     weekStartDay: 1,
     weekStartDay: 1,
   }),
   }),
 }))
 }))
-vi.mock('sonner', () => ({ toast: { error: vi.fn(), success: vi.fn(), warning: vi.fn() } }))
+vi.mock('sonner', () => ({
+  toast: { error: vi.fn(), success: vi.fn(), warning: vi.fn(), loading: vi.fn() },
+}))
 vi.mock('@/components/service-type-context', () => ({ useServiceType: () => 'automotive' }))
 vi.mock('@/components/service-type-context', () => ({ useServiceType: () => 'automotive' }))
 // Tiptap does not run in jsdom; a plain text box stands in for the editor.
 // Tiptap does not run in jsdom; a plain text box stands in for the editor.
 vi.mock('@/components/ui/rich-text-editor', () => ({
 vi.mock('@/components/ui/rich-text-editor', () => ({
@@ -64,12 +66,57 @@ vi.mock('@/features/calendar/Actions/getBookingOptions', () => ({ getBookingOpti
 const createServiceMeeting = vi.hoisted(() => vi.fn())
 const createServiceMeeting = vi.hoisted(() => vi.fn())
 vi.mock('@/features/integrations/Actions/integrationActions', () => ({ createServiceMeeting }))
 vi.mock('@/features/integrations/Actions/integrationActions', () => ({ createServiceMeeting }))
 const searchVehicles = vi.hoisted(() => vi.fn())
 const searchVehicles = vi.hoisted(() => vi.fn())
-vi.mock('@/features/vehicles/Actions/vehicleActions', () => ({ searchVehicles }))
+const createVehicle = vi.hoisted(() => vi.fn())
+vi.mock('@/features/vehicles/Actions/vehicleActions', () => ({
+  searchVehicles,
+  createVehicle,
+  updateVehicle: vi.fn(),
+}))
 const searchCustomers = vi.hoisted(() => vi.fn())
 const searchCustomers = vi.hoisted(() => vi.fn())
-vi.mock('@/features/customers/Actions/customerActions', () => ({ searchCustomers }))
+const createCustomer = vi.hoisted(() => vi.fn())
+vi.mock('@/features/customers/Actions/customerActions', () => ({
+  searchCustomers,
+  createCustomer,
+  updateCustomer: vi.fn(),
+  findOwnerCandidates: vi.fn(async () => ({ success: true, data: [] })),
+  getCustomerOption: vi.fn(async () => ({ success: true, data: null })),
+}))
+// The full vehicle and customer forms open over the booking; what they ask
+// the server besides saving answers "nothing here".
+vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
+  aiAnalyzeVehicleDocument: vi.fn(),
+  isVehicleScanAvailable: vi.fn(async () => ({ success: true, data: false })),
+}))
+vi.mock('@/features/integrations/Actions/vehicleLookupActions', () => ({
+  isVehicleLookupAvailable: vi.fn(async () => ({ success: true, data: {} })),
+  lookupVehicle: vi.fn(),
+}))
+vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({
+  countPhotosSince: vi.fn(),
+  createPhotoHandoffLink: vi.fn(),
+  createVehiclePhotoHandoffLink: vi.fn(),
+  getVehiclePhotoUrl: vi.fn(),
+}))
+vi.mock('@/features/inspections/Actions/attachmentActions', () => ({
+  countInspectionMedia: vi.fn(),
+  createInspectionHandoffLink: vi.fn(),
+}))
+vi.mock('@/features/invoice-designer/Actions/documentDesignActions', () => ({
+  listDesignOptions: vi.fn(async () => ({ success: true, data: [] })),
+}))
+vi.mock('@/components/glass-modal', () => ({ useGlassModal: () => ({ open: vi.fn() }) }))
+const push = vi.hoisted(() => vi.fn())
+vi.mock('next/navigation', () => ({
+  useRouter: () => ({ push, refresh: vi.fn(), replace: vi.fn() }),
+  usePathname: () => '/',
+  useSearchParams: () => new URLSearchParams(),
+}))
 
 
 import { toast } from 'sonner'
 import { toast } from 'sonner'
 import { BookingDialog } from '@/features/calendar/Components/BookingDialog'
 import { BookingDialog } from '@/features/calendar/Components/BookingDialog'
+import { PlateLookupProvider } from '@/components/plate-lookup-context'
+import { BookingAccessProvider } from '@/components/booking-launcher'
+import { TooltipProvider } from '@/components/ui/tooltip'
 
 
 const kari = { id: 'cust-1', name: 'Kari Nordmann', company: null }
 const kari = { id: 'cust-1', name: 'Kari Nordmann', company: null }
 const karisCar = {
 const karisCar = {
@@ -119,18 +166,31 @@ function loadedBooking(partial: Partial<BookingForEdit> = {}): BookingForEdit {
   }
   }
 }
 }
 
 
-async function renderDialog(props: Partial<Parameters<typeof BookingDialog>[0]> = {}) {
+async function renderDialog(
+  props: Partial<Parameters<typeof BookingDialog>[0]> = {},
+  access: { canCreate?: boolean; canBook?: boolean; canAddCustomer?: boolean } = {}
+) {
   const onSaved = vi.fn()
   const onSaved = vi.fn()
   const onOpenChange = vi.fn()
   const onOpenChange = vi.fn()
   render(
   render(
-    <BookingDialog
-      open
-      onOpenChange={onOpenChange}
-      defaultDate="2026-11-16"
-      defaultTime="09:30"
-      onSaved={onSaved}
-      {...props}
-    />
+    <BookingAccessProvider
+      value={{ canBook: access.canBook ?? true, canAddCustomer: access.canAddCustomer ?? true }}
+    >
+      <PlateLookupProvider
+        value={{ available: false, canCreate: access.canCreate ?? true, registryName: null }}
+      >
+        <TooltipProvider>
+          <BookingDialog
+            open
+            onOpenChange={onOpenChange}
+            defaultDate="2026-11-16"
+            defaultTime="09:30"
+            onSaved={onSaved}
+            {...props}
+          />
+        </TooltipProvider>
+      </PlateLookupProvider>
+    </BookingAccessProvider>
   )
   )
   // What the workshop offers arrives after the dialog opens.
   // What the workshop offers arrives after the dialog opens.
   await waitFor(() => expect(getBookingOptions).toHaveBeenCalled())
   await waitFor(() => expect(getBookingOptions).toHaveBeenCalled())
@@ -238,7 +298,8 @@ describe('a new booking', () => {
       { channel: 'in_app', amount: 1, unit: 'hours', atTime: null },
       { channel: 'in_app', amount: 1, unit: 'hours', atTime: null },
     ])
     ])
     expect(updateBooking).not.toHaveBeenCalled()
     expect(updateBooking).not.toHaveBeenCalled()
-    expect(toast.success).toHaveBeenCalledWith('Appointment booked')
+    // On the calendar itself there is no way to the calendar to offer.
+    expect(toast.success).toHaveBeenCalledWith('Appointment booked', undefined)
     expect(onOpenChange).toHaveBeenCalledWith(false)
     expect(onOpenChange).toHaveBeenCalledWith(false)
   })
   })
 
 
@@ -356,7 +417,8 @@ describe('a new booking', () => {
 
 
     await waitFor(() => expect(onSaved).toHaveBeenCalled())
     await waitFor(() => expect(onSaved).toHaveBeenCalled())
     expect(toast.warning).toHaveBeenCalledWith(
     expect(toast.warning).toHaveBeenCalledWith(
-      'Appointment booked, but no bay or technician is free at that time. Check the work board.'
+      'Appointment booked, but no bay or technician is free at that time. Check the work board.',
+      undefined
     )
     )
     expect(toast.success).not.toHaveBeenCalled()
     expect(toast.success).not.toHaveBeenCalled()
   })
   })
@@ -485,7 +547,7 @@ describe('changing a booking', () => {
         notifications: [{ channel: 'in_app', amount: 1, unit: 'hours', atTime: null }],
         notifications: [{ channel: 'in_app', amount: 1, unit: 'hours', atTime: null }],
       })
       })
     )
     )
-    expect(toast.success).toHaveBeenCalledWith('Booking saved')
+    expect(toast.success).toHaveBeenCalledWith('Booking saved', undefined)
   })
   })
 
 
   it('shows the car of a booked job but does not let it change here', async () => {
   it('shows the car of a booked job but does not let it change here', async () => {
@@ -607,3 +669,302 @@ describe('making an appointment a work order', () => {
     expect(sent.id).toBeUndefined()
     expect(sent.id).toBeUndefined()
   })
   })
 })
 })
+
+describe('someone not on file yet', () => {
+  const teslaOfKari = {
+    id: 'veh-9',
+    make: 'Tesla',
+    model: 'Model 3',
+    year: 2022,
+    licensePlate: 'EL12345',
+    customerId: 'cust-1',
+  }
+
+  /** Fills what a vehicle must have and saves the vehicle form. */
+  function saveVehicleForm(form: HTMLElement) {
+    fireEvent.change(within(form).getByLabelText('Make *'), { target: { value: 'Tesla' } })
+    fireEvent.change(within(form).getByLabelText('Model *'), { target: { value: 'Model 3' } })
+    fireEvent.change(within(form).getByLabelText('Year *'), { target: { value: '2022' } })
+    fireEvent.click(within(form).getByRole('button', { name: 'Add New Vehicle' }))
+  }
+
+  it('adds a car in the full vehicle form and books it, owner and all', async () => {
+    createVehicle.mockResolvedValue({ success: true, data: teslaOfKari })
+    const { onSaved } = await renderDialog()
+    chooseKind('Appointment')
+    fireEvent.change(titleField(), { target: { value: 'Tyre change' } })
+
+    fireEvent.click(screen.getByRole('button', { name: 'New vehicle' }))
+    const form = await screen.findByRole('dialog', { name: 'Add New Vehicle' })
+    // The whole form, not a short one.
+    expect(within(form).getByRole('radiogroup', { name: 'Fuel Type' })).toBeInTheDocument()
+    // The owner is chosen in the vehicle form.
+    fireEvent.click(within(form).getByRole('combobox'))
+    fireEvent.click(await screen.findByRole('option', { name: /Kari Nordmann/ }))
+    fireEvent.change(within(form).getByLabelText('License Plate'), {
+      target: { value: 'EL12345' },
+    })
+    saveVehicleForm(form)
+
+    await waitFor(() =>
+      expect(screen.queryByRole('dialog', { name: 'Add New Vehicle' })).not.toBeInTheDocument()
+    )
+    expect(createVehicle).toHaveBeenCalledWith(
+      expect.objectContaining({ make: 'Tesla', customerId: 'cust-1', licensePlate: 'EL12345' })
+    )
+    // Saving the car is not booking it.
+    expect(createBooking).not.toHaveBeenCalled()
+    expect(vehicleField()).toHaveTextContent('2022 Tesla Model 3 (EL12345)')
+    expect(customerField()).toHaveTextContent('Kari Nordmann')
+    expect(titleField()).toHaveValue('Tyre change')
+
+    fireEvent.click(saveButton())
+    await waitFor(() => expect(onSaved).toHaveBeenCalled())
+    expect(createBooking).toHaveBeenCalledTimes(1)
+    expect(createBooking).toHaveBeenCalledWith(
+      expect.objectContaining({
+        title: 'Tyre change',
+        vehicleId: 'veh-9',
+        customerId: 'cust-1',
+      })
+    )
+  })
+
+  it('makes the owner added inside the vehicle form the booking customer', async () => {
+    createCustomer.mockResolvedValue({
+      success: true,
+      data: { id: 'cust-2', name: 'Ola Hansen', company: null },
+    })
+    createVehicle.mockResolvedValue({
+      success: true,
+      data: { ...teslaOfKari, customerId: 'cust-2' },
+    })
+    const { onSaved } = await renderDialog()
+    chooseKind('Work order')
+    fireEvent.change(titleField(), { target: { value: 'Brake job' } })
+
+    fireEvent.click(screen.getByRole('button', { name: 'New vehicle' }))
+    const form = await screen.findByRole('dialog', { name: 'Add New Vehicle' })
+    fireEvent.click(within(form).getByRole('combobox'))
+    fireEvent.click(await screen.findByRole('button', { name: 'Add Customer' }))
+    const customerForm = await screen.findByRole('dialog', { name: 'Add New Customer' })
+    fireEvent.change(within(customerForm).getByLabelText('Name *'), {
+      target: { value: 'Ola Hansen' },
+    })
+    fireEvent.click(within(customerForm).getByRole('button', { name: 'Add New Customer' }))
+    await waitFor(() =>
+      expect(screen.queryByRole('dialog', { name: 'Add New Customer' })).not.toBeInTheDocument()
+    )
+    // Back in the vehicle form, with the new owner chosen.
+    const vehicleForm = screen.getByRole('dialog', { name: 'Add New Vehicle' })
+    expect(within(vehicleForm).getByRole('combobox')).toHaveTextContent('Ola Hansen')
+    saveVehicleForm(vehicleForm)
+
+    await waitFor(() => expect(vehicleField()).toHaveTextContent('2022 Tesla Model 3 (EL12345)'))
+    expect(customerField()).toHaveTextContent('Ola Hansen')
+    expect(titleField()).toHaveValue('Brake job')
+    expect(createBooking).not.toHaveBeenCalled()
+
+    fireEvent.click(saveButton())
+    await waitFor(() => expect(onSaved).toHaveBeenCalled())
+    expect(createBooking).toHaveBeenCalledWith(
+      expect.objectContaining({ kind: 'workOrder', vehicleId: 'veh-9', customerId: 'cust-2' })
+    )
+  })
+
+  it('starts the new car with the plate typed in the vehicle search', async () => {
+    await renderDialog()
+    fireEvent.click(vehicleField())
+    fireEvent.change(await screen.findByPlaceholderText('Search by plate, make or model'), {
+      target: { value: 'el 12345' },
+    })
+    fireEvent.click(await screen.findByRole('button', { name: 'New vehicle with plate EL 12345' }))
+    const form = await screen.findByRole('dialog', { name: 'Add New Vehicle' })
+    await waitFor(() =>
+      expect(within(form).getByLabelText('License Plate')).toHaveValue('EL 12345')
+    )
+  })
+
+  it('adds a customer in the full customer form, named as searched, and books them', async () => {
+    createCustomer.mockResolvedValue({
+      success: true,
+      data: { id: 'cust-2', name: 'Ola Hansen', company: null },
+    })
+    const { onSaved } = await renderDialog()
+    chooseKind('Appointment')
+    fireEvent.change(titleField(), { target: { value: 'Call Ola' } })
+
+    fireEvent.click(customerField())
+    fireEvent.change(await screen.findByPlaceholderText('Search customers'), {
+      target: { value: 'Ola' },
+    })
+    fireEvent.click(await screen.findByRole('button', { name: 'New customer "Ola"' }))
+    const form = await screen.findByRole('dialog', { name: 'Add New Customer' })
+    const name = within(form).getByLabelText('Name *')
+    expect(name).toHaveValue('Ola')
+    fireEvent.change(name, { target: { value: 'Ola Hansen' } })
+    fireEvent.click(within(form).getByRole('button', { name: 'Add New Customer' }))
+
+    await waitFor(() => expect(customerField()).toHaveTextContent('Ola Hansen'))
+    expect(createBooking).not.toHaveBeenCalled()
+    expect(titleField()).toHaveValue('Call Ola')
+
+    fireEvent.click(saveButton())
+    await waitFor(() => expect(onSaved).toHaveBeenCalled())
+    expect(createBooking).toHaveBeenCalledWith(
+      expect.objectContaining({ title: 'Call Ola', customerId: 'cust-2' })
+    )
+  })
+
+  it('opens an empty customer form from the New button', async () => {
+    await renderDialog()
+    fireEvent.click(screen.getByRole('button', { name: 'New customer' }))
+    const form = await screen.findByRole('dialog', { name: 'Add New Customer' })
+    expect(within(form).getByLabelText('Name *')).toHaveValue('')
+  })
+
+  it('offers no new car to someone who may not add vehicles', async () => {
+    await renderDialog({}, { canCreate: false })
+    expect(screen.queryByRole('button', { name: 'New vehicle' })).not.toBeInTheDocument()
+    expect(screen.getByRole('button', { name: 'New customer' })).toBeInTheDocument()
+    fireEvent.click(vehicleField())
+    await screen.findByPlaceholderText('Search by plate, make or model')
+    expect(screen.queryByRole('button', { name: /^New vehicle/ })).not.toBeInTheDocument()
+  })
+
+  it('offers no new customer to someone who may not add customers', async () => {
+    const { onSaved } = await renderDialog({}, { canAddCustomer: false })
+    chooseKind('Appointment')
+    fireEvent.change(titleField(), { target: { value: 'Call Kari' } })
+    expect(screen.queryByRole('button', { name: 'New customer' })).not.toBeInTheDocument()
+    // A new car is still theirs to add.
+    expect(screen.getByRole('button', { name: 'New vehicle' })).toBeInTheDocument()
+
+    fireEvent.click(customerField())
+    fireEvent.change(await screen.findByPlaceholderText('Search customers'), {
+      target: { value: 'Ola' },
+    })
+    await waitFor(() => expect(searchCustomers).toHaveBeenCalled())
+    await act(async () => undefined)
+    expect(screen.queryByRole('button', { name: /^New customer/ })).not.toBeInTheDocument()
+
+    // Someone already on file can still be booked.
+    fireEvent.change(screen.getByPlaceholderText('Search customers'), {
+      target: { value: '' },
+    })
+    fireEvent.click(await screen.findByRole('option', { name: 'Kari Nordmann' }))
+    expect(customerField()).toHaveTextContent('Kari Nordmann')
+    fireEvent.click(saveButton())
+    await waitFor(() => expect(onSaved).toHaveBeenCalled())
+    expect(createBooking).toHaveBeenCalledWith(expect.objectContaining({ customerId: 'cust-1' }))
+  })
+
+  it("adds a car to a booked job without a car only for the job's customer", async () => {
+    getBooking.mockResolvedValue({
+      success: true,
+      data: loadedBooking({
+        kind: 'workOrder',
+        id: 'job-1',
+        title: 'Brake job',
+        customer: kari,
+        vehicle: null,
+        locked: { who: false, work: false },
+      }),
+    })
+    await renderDialog({
+      edit: { mode: 'edit', event: calendarEvent({ id: 'job-1', type: 'service' }) },
+    })
+    expect(await screen.findByDisplayValue('Brake job')).toBeInTheDocument()
+    expect(customerField()).toBeDisabled()
+
+    fireEvent.click(screen.getByRole('button', { name: 'New vehicle' }))
+    const form = await screen.findByRole('dialog', { name: 'Add New Vehicle' })
+    const owner = within(form).getByRole('combobox')
+    expect(owner).toBeDisabled()
+    expect(owner).toHaveTextContent('Kari Nordmann')
+  })
+
+  it('drops the customer when the car added for them is saved with no owner', async () => {
+    createVehicle.mockResolvedValue({
+      success: true,
+      data: { ...teslaOfKari, customerId: null },
+    })
+    const { onSaved } = await renderDialog()
+    chooseKind('Appointment')
+    fireEvent.change(titleField(), { target: { value: 'Tyre change' } })
+    await chooseCustomer()
+    expect(customerField()).toHaveTextContent('Kari Nordmann')
+
+    fireEvent.click(screen.getByRole('button', { name: 'New vehicle' }))
+    const form = await screen.findByRole('dialog', { name: 'Add New Vehicle' })
+    saveVehicleForm(form)
+
+    await waitFor(() => expect(vehicleField()).toHaveTextContent('2022 Tesla Model 3 (EL12345)'))
+    expect(customerField()).toHaveTextContent('Select customer')
+    expect(customerField()).not.toHaveTextContent('Kari Nordmann')
+
+    fireEvent.click(saveButton())
+    await waitFor(() => expect(onSaved).toHaveBeenCalled())
+    const sent = createBooking.mock.calls[0][0]
+    expect(sent.vehicleId).toBe('veh-9')
+    expect(sent.customerId).toBeUndefined()
+  })
+
+  it('offers neither on a booked job whose car has arrived', async () => {
+    getBooking.mockResolvedValue({
+      success: true,
+      data: loadedBooking({
+        kind: 'workOrder',
+        id: 'job-1',
+        title: 'Brake job',
+        vehicle: karisCar,
+        locked: { who: true, work: false },
+      }),
+    })
+    await renderDialog({
+      edit: { mode: 'edit', event: calendarEvent({ id: 'job-1', type: 'service' }) },
+    })
+    expect(await screen.findByDisplayValue('Brake job')).toBeInTheDocument()
+    expect(screen.queryByRole('button', { name: 'New customer' })).not.toBeInTheDocument()
+    expect(screen.queryByRole('button', { name: 'New vehicle' })).not.toBeInTheDocument()
+  })
+})
+
+describe('a booking opened from another screen', () => {
+  it('starts with the car and its owner chosen, and books them', async () => {
+    const { onSaved } = await renderDialog({ start: { vehicle: karisCar } })
+    expect(vehicleField()).toHaveTextContent('2012 Volvo V70 (AB12345)')
+    expect(customerField()).toHaveTextContent('Kari Nordmann')
+
+    chooseKind('Appointment')
+    fireEvent.change(titleField(), { target: { value: 'Service' } })
+    fireEvent.click(saveButton())
+    await waitFor(() => expect(onSaved).toHaveBeenCalled())
+    expect(createBooking).toHaveBeenCalledWith(
+      expect.objectContaining({ vehicleId: 'veh-1', customerId: 'cust-1' })
+    )
+  })
+
+  it('starts with a customer alone when that is all it has', async () => {
+    await renderDialog({ start: { customer: kari } })
+    expect(customerField()).toHaveTextContent('Kari Nordmann')
+    expect(vehicleField()).toHaveTextContent('Select vehicle')
+  })
+
+  it('offers the way to the booked day in the confirmation', async () => {
+    const { onSaved } = await renderDialog({ start: { vehicle: karisCar }, calendarLink: true })
+    chooseKind('Appointment')
+    fireEvent.change(titleField(), { target: { value: 'Service' } })
+    fireEvent.click(saveButton())
+    await waitFor(() => expect(onSaved).toHaveBeenCalled())
+
+    const [message, options] = vi.mocked(toast.success).mock.calls[0] as [
+      string,
+      { action: { label: string; onClick: () => void } },
+    ]
+    expect(message).toBe('Appointment booked')
+    expect(options.action.label).toBe('Open calendar')
+    options.action.onClick()
+    expect(push).toHaveBeenCalledWith('/calendar?view=day&date=2026-11-16')
+  })
+})

+ 205 - 0
src/__tests__/features/calendar/booking-host.test.tsx

@@ -0,0 +1,205 @@
+/**
+ * Booking from anywhere: "Book appointment" on any screen opens the booking
+ * dialog with the car and customer the asker already has, on the workshop's
+ * today, and nothing at all for someone who may not book.
+ */
+
+import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+
+const noop = () => undefined
+vi.stubGlobal(
+  'ResizeObserver',
+  class {
+    observe = noop
+    unobserve = noop
+    disconnect = noop
+  }
+)
+Element.prototype.scrollIntoView = noop
+Element.prototype.hasPointerCapture = () => false
+Element.prototype.releasePointerCapture = noop
+
+// Far from UTC: in Auckland it is already tomorrow.
+vi.mock('@/components/date-settings-context', () => ({
+  useDateSettings: () => ({
+    dateFormat: 'yyyy-MM-dd',
+    timeFormat: '24h',
+    timezone: 'Pacific/Auckland',
+    weekStartDay: 1,
+  }),
+}))
+vi.mock('sonner', () => ({
+  toast: { error: vi.fn(), success: vi.fn(), warning: vi.fn(), loading: vi.fn() },
+}))
+vi.mock('@/components/service-type-context', () => ({ useServiceType: () => 'automotive' }))
+vi.mock('@/components/ui/rich-text-editor', () => ({
+  RichTextEditor: ({ content }: { content: string }) => <textarea value={content} readOnly />,
+}))
+const refresh = vi.hoisted(() => vi.fn())
+vi.mock('next/navigation', () => ({
+  useRouter: () => ({ push: vi.fn(), refresh, replace: vi.fn() }),
+  usePathname: () => '/',
+  useSearchParams: () => new URLSearchParams(),
+}))
+const createBooking = vi.hoisted(() => vi.fn())
+vi.mock('@/features/calendar/Actions/createBooking', () => ({ createBooking }))
+vi.mock('@/features/calendar/Actions/updateBooking', () => ({ updateBooking: vi.fn() }))
+vi.mock('@/features/calendar/Actions/getBooking', () => ({ getBooking: vi.fn() }))
+vi.mock('@/features/calendar/Actions/getBookingOptions', () => ({
+  getBookingOptions: vi.fn(async () => ({
+    success: true,
+    data: { channels: ['in_app', 'email'], video: [] },
+  })),
+}))
+vi.mock('@/features/integrations/Actions/integrationActions', () => ({
+  createServiceMeeting: vi.fn(),
+}))
+vi.mock('@/features/vehicles/Actions/vehicleActions', () => ({
+  searchVehicles: vi.fn(async () => ({ success: true, data: [] })),
+  createVehicle: vi.fn(),
+  updateVehicle: vi.fn(),
+}))
+vi.mock('@/features/customers/Actions/customerActions', () => ({
+  searchCustomers: vi.fn(async () => ({ success: true, data: [] })),
+  createCustomer: vi.fn(),
+  updateCustomer: vi.fn(),
+  findOwnerCandidates: vi.fn(async () => ({ success: true, data: [] })),
+  getCustomerOption: vi.fn(async () => ({ success: true, data: null })),
+}))
+
+import {
+  BOOKING_SAVED_EVENT,
+  BookingAccessProvider,
+  openBooking,
+} from '@/components/booking-launcher'
+import { BookingHost } from '@/features/calendar/Components/BookingHost'
+
+const karisCar = {
+  id: 'veh-1',
+  make: 'Volvo',
+  model: 'V70',
+  year: 2012,
+  licensePlate: 'AB12345',
+  customerId: 'cust-1',
+  customer: { id: 'cust-1', name: 'Kari Nordmann' },
+}
+
+function renderHost(canBook = true) {
+  render(
+    <BookingAccessProvider value={{ canBook, canAddCustomer: true }}>
+      <BookingHost />
+    </BookingAccessProvider>
+  )
+}
+
+/** The picker under a field's label in the form: "Customer", "Vehicle". */
+function fieldUnder(label: string) {
+  const row = screen.getByText(label, { selector: 'p' }).parentElement as HTMLElement
+  return within(row).getByRole('combobox')
+}
+
+/** Opens a booking for Kari's car from anywhere and books it as an appointment. */
+async function bookKarisCar() {
+  act(() => openBooking({ vehicle: karisCar }))
+  await screen.findByRole('dialog', { name: 'Book appointment' })
+  fireEvent.mouseDown(screen.getByRole('tab', { name: 'Appointment' }), { button: 0 })
+  fireEvent.change(screen.getByLabelText('Title'), { target: { value: 'Service' } })
+  fireEvent.click(screen.getByRole('button', { name: 'Book appointment' }))
+  await waitFor(() => expect(createBooking).toHaveBeenCalledTimes(1))
+}
+
+beforeEach(() => {
+  vi.clearAllMocks()
+  window.localStorage.clear()
+  vi.useFakeTimers({ toFake: ['Date'] })
+  vi.setSystemTime(new Date('2026-11-16T20:00:00Z'))
+  createBooking.mockResolvedValue({
+    success: true,
+    data: {
+      kind: 'appointment',
+      id: 'appt-1',
+      ref: 'Service',
+      vehicleId: 'veh-1',
+      overbooked: false,
+    },
+  })
+})
+
+afterEach(() => {
+  vi.useRealTimers()
+})
+
+describe('BookingHost', () => {
+  it('opens the booking with the car and its owner, on the workshop today', async () => {
+    renderHost()
+    expect(screen.queryByRole('dialog')).not.toBeInTheDocument()
+
+    act(() => openBooking({ vehicle: karisCar }))
+    expect(await screen.findByRole('dialog', { name: 'Book appointment' })).toBeInTheDocument()
+    expect(fieldUnder('Vehicle')).toHaveTextContent('2012 Volvo V70 (AB12345)')
+    expect(fieldUnder('Customer')).toHaveTextContent('Kari Nordmann')
+
+    fireEvent.mouseDown(screen.getByRole('tab', { name: 'Appointment' }), { button: 0 })
+    fireEvent.change(screen.getByLabelText('Title'), { target: { value: 'Service' } })
+    fireEvent.click(screen.getByRole('button', { name: 'Book appointment' }))
+
+    await waitFor(() => expect(createBooking).toHaveBeenCalledTimes(1))
+    expect(createBooking).toHaveBeenCalledWith(
+      expect.objectContaining({
+        vehicleId: 'veh-1',
+        customerId: 'cust-1',
+        // 20:00 UTC on the 16th is the 17th in Auckland.
+        startDate: '2026-11-17',
+      })
+    )
+    await waitFor(() => expect(refresh).toHaveBeenCalled())
+  })
+
+  it('opens an empty booking when asked with nothing', async () => {
+    renderHost()
+    act(() => openBooking())
+    expect(await screen.findByRole('dialog', { name: 'Book appointment' })).toBeInTheDocument()
+    expect(fieldUnder('Vehicle')).toHaveTextContent('Select vehicle')
+    expect(fieldUnder('Customer')).toHaveTextContent('Select customer')
+  })
+
+  it('starts at the next full hour on the workshop clock', async () => {
+    // 10:20 on the 17th in Auckland.
+    vi.setSystemTime(new Date('2026-11-16T21:20:00Z'))
+    renderHost()
+    await bookKarisCar()
+    expect(createBooking).toHaveBeenCalledWith(
+      expect.objectContaining({ startDate: '2026-11-17', startTime: '11:00' })
+    )
+  })
+
+  it('starts at midnight tomorrow when booked after the last hour of the day', async () => {
+    // 23:30 on the 17th in Auckland: the next hour is the 18th.
+    vi.setSystemTime(new Date('2026-11-17T10:30:00Z'))
+    renderHost()
+    await bookKarisCar()
+    expect(createBooking).toHaveBeenCalledWith(
+      expect.objectContaining({ startDate: '2026-11-18', startTime: '00:00' })
+    )
+  })
+
+  it('tells the screen underneath that a booking was saved', async () => {
+    const saved = vi.fn()
+    document.addEventListener(BOOKING_SAVED_EVENT, saved)
+    try {
+      renderHost()
+      await bookKarisCar()
+      await waitFor(() => expect(saved).toHaveBeenCalledTimes(1))
+    } finally {
+      document.removeEventListener(BOOKING_SAVED_EVENT, saved)
+    }
+  })
+
+  it('opens nothing for someone who may not book', async () => {
+    renderHost(false)
+    act(() => openBooking({ vehicle: karisCar }))
+    await act(async () => undefined)
+    expect(screen.queryByRole('dialog')).not.toBeInTheDocument()
+  })
+})

+ 244 - 0
src/__tests__/features/vehicles/plate-lookup-command.test.tsx

@@ -0,0 +1,244 @@
+/**
+ * The header's plate lookup never ends at "found it". A car the workshop has
+ * on file can be booked in or given a work order from the answer sheet, and a
+ * car added from the sheet comes straight back to it as one of the
+ * workshop's, without asking the registry (which may charge) a second time.
+ */
+
+import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+
+const noop = () => undefined
+vi.stubGlobal(
+  'ResizeObserver',
+  class {
+    observe = noop
+    unobserve = noop
+    disconnect = noop
+  }
+)
+Element.prototype.scrollIntoView = noop
+Element.prototype.hasPointerCapture = () => false
+Element.prototype.releasePointerCapture = noop
+
+const push = vi.hoisted(() => vi.fn())
+vi.mock('next/navigation', () => ({
+  useRouter: () => ({ push, refresh: vi.fn(), replace: vi.fn() }),
+  usePathname: () => '/',
+  useSearchParams: () => new URLSearchParams(),
+}))
+vi.mock('sonner', () => ({
+  toast: { error: vi.fn(), success: vi.fn(), loading: vi.fn(), warning: vi.fn() },
+}))
+const lookupPlate = vi.hoisted(() => vi.fn())
+vi.mock('@/features/vehicles/Actions/plateLookupActions', () => ({ lookupPlate }))
+const createVehicle = vi.hoisted(() => vi.fn())
+vi.mock('@/features/vehicles/Actions/vehicleActions', () => ({
+  createVehicle,
+  updateVehicle: vi.fn(),
+  searchVehicles: vi.fn(async () => ({ success: true, data: [] })),
+}))
+vi.mock('@/features/customers/Actions/customerActions', () => ({
+  createCustomer: vi.fn(),
+  findOwnerCandidates: vi.fn(async () => ({ success: true, data: [] })),
+  getCustomerOption: vi.fn(async () => ({ success: true, data: null })),
+  searchCustomers: vi.fn(async () => ({ success: true, data: [] })),
+}))
+vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
+  aiAnalyzeVehicleDocument: vi.fn(),
+  isVehicleScanAvailable: vi.fn(async () => ({ success: true, data: false })),
+}))
+const lookupVehicle = vi.hoisted(() => vi.fn())
+vi.mock('@/features/integrations/Actions/vehicleLookupActions', () => ({
+  isVehicleLookupAvailable: vi.fn(async () => ({ success: true, data: { plate: true } })),
+  lookupVehicle,
+}))
+vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({
+  countPhotosSince: vi.fn(),
+  createPhotoHandoffLink: vi.fn(),
+  createVehiclePhotoHandoffLink: vi.fn(),
+  getVehiclePhotoUrl: vi.fn(),
+}))
+vi.mock('@/features/inspections/Actions/attachmentActions', () => ({
+  countInspectionMedia: vi.fn(),
+  createInspectionHandoffLink: vi.fn(),
+}))
+vi.mock('@/features/invoice-designer/Actions/documentDesignActions', () => ({
+  listDesignOptions: vi.fn(async () => ({ success: true, data: [] })),
+}))
+vi.mock('@/features/shortcuts/Actions/saveKeyboardShortcuts', () => ({
+  saveKeyboardShortcuts: vi.fn(),
+}))
+vi.mock('@/components/glass-modal', () => ({ useGlassModal: () => ({ open: vi.fn() }) }))
+
+import { BOOKING_EVENT, BookingAccessProvider } from '@/components/booking-launcher'
+import { PlateLookupProvider, openPlateLookup } from '@/components/plate-lookup-context'
+import { TooltipProvider } from '@/components/ui/tooltip'
+import { PlateLookupCommand } from '@/features/vehicles/Components/PlateLookupCommand'
+
+const karisCar = {
+  id: 'veh-1',
+  make: 'Volvo',
+  model: 'V70',
+  year: 2012,
+  licensePlate: 'AB12345',
+  vin: null,
+  color: null,
+  mileage: 0,
+  imageUrl: null,
+  isArchived: false,
+  customer: { id: 'cust-1', name: 'Kari Nordmann', company: null, phone: null },
+  inspectionDueAt: null,
+  serviceCount: 3,
+  lastServiceAt: null,
+}
+
+const registryAnswer = {
+  make: 'Tesla',
+  model: 'Model 3',
+  year: 2022,
+  licensePlate: 'EL12345',
+  source: 'Statens vegvesen',
+  connectorId: 'vegvesen',
+}
+
+function answer(partial: Record<string, unknown>) {
+  return {
+    success: true,
+    data: {
+      plate: 'AB12345',
+      vehicle: null,
+      registry: null,
+      registryError: null,
+      source: 'Statens vegvesen',
+      ...partial,
+    },
+  }
+}
+
+function renderPalette(access: { canBook?: boolean } = {}) {
+  render(
+    <PlateLookupProvider
+      value={{ available: true, canCreate: true, registryName: 'Statens vegvesen' }}
+    >
+      <BookingAccessProvider value={{ canBook: access.canBook ?? true, canAddCustomer: true }}>
+        <TooltipProvider>
+          <PlateLookupCommand />
+        </TooltipProvider>
+      </BookingAccessProvider>
+    </PlateLookupProvider>
+  )
+}
+
+/** Opens the palette on a plate, the way the header button does. */
+async function lookUp(plate: string) {
+  act(() => openPlateLookup(plate))
+  await waitFor(() => expect(lookupPlate).toHaveBeenCalled())
+}
+
+beforeEach(() => {
+  vi.clearAllMocks()
+  window.localStorage.clear()
+})
+
+describe('a car the workshop has on file', () => {
+  it('books it in, with its owner, from the answer', async () => {
+    lookupPlate.mockResolvedValue(answer({ vehicle: karisCar }))
+    renderPalette()
+    await lookUp('AB12345')
+    expect(await screen.findByText('In your workshop')).toBeInTheDocument()
+
+    const booked = vi.fn()
+    document.addEventListener(BOOKING_EVENT, booked)
+    fireEvent.click(screen.getByRole('button', { name: 'Book appointment' }))
+    document.removeEventListener(BOOKING_EVENT, booked)
+
+    expect(booked).toHaveBeenCalledTimes(1)
+    expect((booked.mock.calls[0][0] as CustomEvent).detail).toEqual({
+      vehicle: {
+        id: 'veh-1',
+        make: 'Volvo',
+        model: 'V70',
+        year: 2012,
+        licensePlate: 'AB12345',
+        customerId: 'cust-1',
+        customer: { id: 'cust-1', name: 'Kari Nordmann' },
+      },
+      customer: { id: 'cust-1', name: 'Kari Nordmann', company: null },
+    })
+    // The palette makes way for the booking.
+    await waitFor(() => expect(screen.queryByText('In your workshop')).not.toBeInTheDocument())
+  })
+
+  it('opens a new work order for it', async () => {
+    lookupPlate.mockResolvedValue(answer({ vehicle: karisCar }))
+    renderPalette()
+    await lookUp('AB12345')
+    fireEvent.click(await screen.findByRole('button', { name: 'New work order' }))
+    expect(push).toHaveBeenCalledWith('/vehicles/veh-1/service/new')
+  })
+
+  it('still opens the vehicle', async () => {
+    lookupPlate.mockResolvedValue(answer({ vehicle: karisCar }))
+    renderPalette()
+    await lookUp('AB12345')
+    fireEvent.click(await screen.findByRole('button', { name: 'Open vehicle' }))
+    expect(push).toHaveBeenCalledWith('/vehicles/veh-1')
+  })
+
+  it('offers neither for an archived car', async () => {
+    lookupPlate.mockResolvedValue(answer({ vehicle: { ...karisCar, isArchived: true } }))
+    renderPalette()
+    await lookUp('AB12345')
+    expect(await screen.findByText('In your workshop, archived')).toBeInTheDocument()
+    expect(screen.getByRole('button', { name: 'Open vehicle' })).toBeInTheDocument()
+    expect(screen.queryByRole('button', { name: 'Book appointment' })).not.toBeInTheDocument()
+    expect(screen.queryByRole('button', { name: 'New work order' })).not.toBeInTheDocument()
+  })
+
+  it('offers neither to someone who may not book', async () => {
+    lookupPlate.mockResolvedValue(answer({ vehicle: karisCar }))
+    renderPalette({ canBook: false })
+    await lookUp('AB12345')
+    expect(await screen.findByText('In your workshop')).toBeInTheDocument()
+    expect(screen.queryByRole('button', { name: 'Book appointment' })).not.toBeInTheDocument()
+    expect(screen.queryByRole('button', { name: 'New work order' })).not.toBeInTheDocument()
+  })
+})
+
+describe('a car added from the answer', () => {
+  it('comes back as one of the workshop cars, without asking the registry again', async () => {
+    lookupPlate.mockResolvedValue(answer({ plate: 'EL12345', registry: registryAnswer }))
+    createVehicle.mockResolvedValue({
+      success: true,
+      data: {
+        id: 'veh-9',
+        make: 'Tesla',
+        model: 'Model 3',
+        year: 2022,
+        licensePlate: 'EL12345',
+        customerId: null,
+      },
+    })
+    renderPalette()
+    await lookUp('EL12345')
+    expect(await screen.findByText('Not in your workshop yet')).toBeInTheDocument()
+    fireEvent.click(screen.getByRole('button', { name: 'Add vehicle' }))
+
+    // The full form, filled in with what the registry said.
+    const form = await screen.findByRole('dialog', { name: 'Add New Vehicle' })
+    await waitFor(() => expect(within(form).getByLabelText('Make *')).toHaveValue('Tesla'))
+    expect(within(form).getByLabelText('Model *')).toHaveValue('Model 3')
+    expect(within(form).getByLabelText('License Plate')).toHaveValue('EL12345')
+    fireEvent.click(within(form).getByRole('button', { name: 'Add New Vehicle' }))
+
+    expect(await screen.findByText('In your workshop')).toBeInTheDocument()
+    expect(screen.getByText('2022 Tesla Model 3')).toBeInTheDocument()
+    expect(screen.getByRole('button', { name: 'Book appointment' })).toBeInTheDocument()
+    fireEvent.click(screen.getByRole('button', { name: 'New work order' }))
+    expect(push).toHaveBeenCalledWith('/vehicles/veh-9/service/new')
+
+    expect(lookupPlate).toHaveBeenCalledTimes(1)
+    expect(lookupVehicle).not.toHaveBeenCalled()
+  })
+})

+ 164 - 4
src/__tests__/features/vehicles/vehicle-form-dialog.test.tsx

@@ -1,7 +1,9 @@
 /**
 /**
  * The edit vehicle dialog: which vehicle is open, the choices in sight, the
  * The edit vehicle dialog: which vehicle is open, the choices in sight, the
  * VIN counted as it is typed, delete handed to the page, and a dialog closed
  * VIN counted as it is typed, delete handed to the page, and a dialog closed
- * without saving that opens again on what is saved.
+ * without saving that opens again on what is saved. Adding one: the vehicle
+ * handed to whoever goes on with it, or a booking offered straight from the
+ * confirmation, and Enter in the plate asking the registry.
  */
  */
 
 
 import { beforeEach, describe, expect, it, vi } from 'vitest'
 import { beforeEach, describe, expect, it, vi } from 'vitest'
@@ -17,6 +19,9 @@ vi.mock('@/features/vehicles/Actions/vehicleActions', () => ({
   createVehicle: vi.fn(),
   createVehicle: vi.fn(),
   updateVehicle: vi.fn(async () => ({ success: true })),
   updateVehicle: vi.fn(async () => ({ success: true })),
 }))
 }))
+vi.mock('sonner', () => ({
+  toast: { error: vi.fn(), success: vi.fn(), loading: vi.fn(), warning: vi.fn() },
+}))
 vi.mock('@/features/customers/Actions/customerActions', () => ({
 vi.mock('@/features/customers/Actions/customerActions', () => ({
   createCustomer: vi.fn(),
   createCustomer: vi.fn(),
   findOwnerCandidates: vi.fn(async () => ({ success: true, data: [] })),
   findOwnerCandidates: vi.fn(async () => ({ success: true, data: [] })),
@@ -27,9 +32,11 @@ vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
   aiAnalyzeVehicleDocument: vi.fn(),
   aiAnalyzeVehicleDocument: vi.fn(),
   isVehicleScanAvailable: vi.fn(async () => ({ success: true, data: false })),
   isVehicleScanAvailable: vi.fn(async () => ({ success: true, data: false })),
 }))
 }))
+const isVehicleLookupAvailable = vi.hoisted(() => vi.fn())
+const lookupVehicle = vi.hoisted(() => vi.fn())
 vi.mock('@/features/integrations/Actions/vehicleLookupActions', () => ({
 vi.mock('@/features/integrations/Actions/vehicleLookupActions', () => ({
-  isVehicleLookupAvailable: vi.fn(async () => ({ success: true, data: true })),
-  lookupVehicle: vi.fn(),
+  isVehicleLookupAvailable,
+  lookupVehicle,
 }))
 }))
 vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({
 vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({
   countPhotosSince: vi.fn(),
   countPhotosSince: vi.fn(),
@@ -42,9 +49,11 @@ vi.mock('@/features/inspections/Actions/attachmentActions', () => ({
   createInspectionHandoffLink: vi.fn(),
   createInspectionHandoffLink: vi.fn(),
 }))
 }))
 
 
+import { toast } from 'sonner'
 import { TooltipProvider } from '@/components/ui/tooltip'
 import { TooltipProvider } from '@/components/ui/tooltip'
+import { BOOKING_EVENT, BookingAccessProvider } from '@/components/booking-launcher'
 import { VehicleForm } from '@/features/vehicles/Components/VehicleForm'
 import { VehicleForm } from '@/features/vehicles/Components/VehicleForm'
-import { updateVehicle } from '@/features/vehicles/Actions/vehicleActions'
+import { createVehicle, updateVehicle } from '@/features/vehicles/Actions/vehicleActions'
 
 
 const VEHICLE = {
 const VEHICLE = {
   id: 'veh-1',
   id: 'veh-1',
@@ -83,6 +92,8 @@ function renderForm(props: Partial<React.ComponentProps<typeof VehicleForm>> = {
 
 
 beforeEach(() => {
 beforeEach(() => {
   vi.clearAllMocks()
   vi.clearAllMocks()
+  // No registry connected unless a test connects one.
+  isVehicleLookupAvailable.mockResolvedValue({ success: true, data: {} })
 })
 })
 
 
 describe('edit vehicle dialog', () => {
 describe('edit vehicle dialog', () => {
@@ -226,3 +237,152 @@ describe('saving the photo', () => {
     expect(vi.mocked(updateVehicle).mock.calls[0][0]).toMatchObject({ imageUrl: '' })
     expect(vi.mocked(updateVehicle).mock.calls[0][0]).toMatchObject({ imageUrl: '' })
   })
   })
 })
 })
+
+describe('adding a vehicle', () => {
+  const SAVED = {
+    id: 'veh-9',
+    make: 'Volvo',
+    model: 'V70',
+    year: 2015,
+    licensePlate: 'AB12345',
+    customerId: null,
+  }
+
+  function renderNew(
+    props: Partial<React.ComponentProps<typeof VehicleForm>> = {},
+    canBook = true
+  ) {
+    const onOpenChange = vi.fn()
+    render(
+      <BookingAccessProvider value={{ canBook, canAddCustomer: true }}>
+        <TooltipProvider>
+          <VehicleForm open onOpenChange={onOpenChange} {...props} />
+        </TooltipProvider>
+      </BookingAccessProvider>
+    )
+    return { onOpenChange }
+  }
+
+  async function fillAndSave() {
+    fireEvent.change(await screen.findByLabelText('Make *'), { target: { value: 'Volvo' } })
+    fireEvent.change(screen.getByLabelText('Model *'), { target: { value: 'V70' } })
+    fireEvent.change(screen.getByLabelText('Year *'), { target: { value: '2015' } })
+    fireEvent.change(screen.getByLabelText('License Plate'), { target: { value: 'AB12345' } })
+    fireEvent.click(screen.getByRole('button', { name: 'Add New Vehicle' }))
+    await waitFor(() => expect(createVehicle).toHaveBeenCalled())
+  }
+
+  beforeEach(() => {
+    vi.mocked(createVehicle).mockResolvedValue({ success: true, data: SAVED } as never)
+  })
+
+  it('hands the vehicle just added to the caller that goes on with it', async () => {
+    const onCreated = vi.fn()
+    const { onOpenChange } = renderNew({ onCreated })
+    await fillAndSave()
+
+    await waitFor(() => expect(onCreated).toHaveBeenCalledTimes(1))
+    expect(onCreated).toHaveBeenCalledWith({
+      id: 'veh-9',
+      make: 'Volvo',
+      model: 'V70',
+      year: 2015,
+      licensePlate: 'AB12345',
+      customerId: null,
+      customer: null,
+    })
+    expect(onOpenChange).toHaveBeenCalledWith(false)
+    // The caller books it or opens its work order; the toast offers nothing more.
+    expect(toast.success).toHaveBeenCalledWith('Vehicle added')
+  })
+
+  it('offers to book the new vehicle in from the confirmation', async () => {
+    renderNew()
+    await fillAndSave()
+    await waitFor(() => expect(toast.success).toHaveBeenCalled())
+
+    const [message, options] = vi.mocked(toast.success).mock.calls[0] as unknown as [
+      string,
+      { action: { label: string; onClick: () => void } },
+    ]
+    expect(message).toBe('Vehicle added')
+    expect(options.action.label).toBe('Book appointment')
+
+    const booked = vi.fn()
+    document.addEventListener(BOOKING_EVENT, booked)
+    options.action.onClick()
+    document.removeEventListener(BOOKING_EVENT, booked)
+    expect(booked).toHaveBeenCalledTimes(1)
+    expect((booked.mock.calls[0][0] as CustomEvent).detail).toEqual({
+      vehicle: expect.objectContaining({ id: 'veh-9', make: 'Volvo', licensePlate: 'AB12345' }),
+    })
+  })
+
+  it('offers no booking to someone who may not book', async () => {
+    renderNew({}, false)
+    await fillAndSave()
+    await waitFor(() => expect(toast.success).toHaveBeenCalled())
+    expect(toast.success).toHaveBeenCalledWith('Vehicle added')
+  })
+
+  it('asks the registry when Enter is pressed in the plate field', async () => {
+    isVehicleLookupAvailable.mockResolvedValue({ success: true, data: { plate: true } })
+    lookupVehicle.mockResolvedValue({ success: true, data: null })
+    renderNew()
+    await waitFor(() => expect(screen.getByRole('button', { name: 'Look up plate' })).toBeEnabled())
+    const plate = screen.getByLabelText('License Plate')
+    fireEvent.change(plate, { target: { value: 'AB12345' } })
+    fireEvent.keyDown(plate, { key: 'Enter' })
+
+    await waitFor(() =>
+      expect(lookupVehicle).toHaveBeenCalledWith(
+        expect.objectContaining({ by: 'plate', value: 'AB12345' })
+      )
+    )
+    expect(createVehicle).not.toHaveBeenCalled()
+  })
+
+  it('does not save the form on a second Enter while the registry is still answering', async () => {
+    isVehicleLookupAvailable.mockResolvedValue({ success: true, data: { plate: true } })
+    // The registry never answers in this test.
+    lookupVehicle.mockReturnValue(new Promise(() => undefined))
+    renderNew()
+    await waitFor(() => expect(screen.getByRole('button', { name: 'Look up plate' })).toBeEnabled())
+    // Everything a save needs is filled in.
+    fireEvent.change(screen.getByLabelText('Make *'), { target: { value: 'Volvo' } })
+    fireEvent.change(screen.getByLabelText('Model *'), { target: { value: 'V70' } })
+    fireEvent.change(screen.getByLabelText('Year *'), { target: { value: '2015' } })
+    const plate = screen.getByLabelText('License Plate')
+    fireEvent.change(plate, { target: { value: 'AB12345' } })
+
+    expect(fireEvent.keyDown(plate, { key: 'Enter' })).toBe(false)
+    await waitFor(() =>
+      expect(screen.getByRole('button', { name: 'Look up plate' })).toBeDisabled()
+    )
+    // The second Enter is taken by the lookup still running, not the form.
+    expect(fireEvent.keyDown(plate, { key: 'Enter' })).toBe(false)
+    await act(async () => undefined)
+
+    expect(lookupVehicle).toHaveBeenCalledTimes(1)
+    expect(createVehicle).not.toHaveBeenCalled()
+  })
+
+  it('asks nothing on Enter without a registry', async () => {
+    renderNew()
+    await waitFor(() => expect(isVehicleLookupAvailable).toHaveBeenCalled())
+    const plate = screen.getByLabelText('License Plate')
+    expect(screen.getByRole('button', { name: 'Look up plate' })).toBeDisabled()
+    fireEvent.change(plate, { target: { value: 'AB12345' } })
+    // Enter is left to the form, as in any other field.
+    expect(fireEvent.keyDown(plate, { key: 'Enter' })).toBe(true)
+    await act(async () => undefined)
+    expect(lookupVehicle).not.toHaveBeenCalled()
+    expect(createVehicle).not.toHaveBeenCalled()
+  })
+
+  it('starts on a plate typed elsewhere, with the cursor in it', async () => {
+    renderNew({ initialPlate: 'AB 12345' })
+    await waitFor(() => expect(screen.getByLabelText('License Plate')).toHaveValue('AB 12345'))
+    expect(screen.getByLabelText('License Plate')).toHaveFocus()
+  })
+})

+ 89 - 70
src/app/(authenticated)/layout.tsx

@@ -50,6 +50,8 @@ import { getManifest, listManifests } from '@/integrations/registry'
 import { isCloudLinked } from '@/lib/torqvoice-com-link'
 import { isCloudLinked } from '@/lib/torqvoice-com-link'
 import { PlateLookupProvider } from '@/components/plate-lookup-context'
 import { PlateLookupProvider } from '@/components/plate-lookup-context'
 import { PlateLookupCommand } from '@/features/vehicles/Components/PlateLookupCommand'
 import { PlateLookupCommand } from '@/features/vehicles/Components/PlateLookupCommand'
+import { BookingAccessProvider } from '@/components/booking-launcher'
+import { BookingHost } from '@/features/calendar/Components/BookingHost'
 import { OPEN_SERVICE_STATUSES } from '@/lib/service-record'
 import { OPEN_SERVICE_STATUSES } from '@/lib/service-record'
 import { countUnreadMessages } from '@/features/messaging/Lib/unreadCount'
 import { countUnreadMessages } from '@/features/messaging/Lib/unreadCount'
 import { addZonedDays, safeTimeZone, startOfZonedDay } from '@/lib/timezone'
 import { addZonedDays, safeTimeZone, startOfZonedDay } from '@/lib/timezone'
@@ -136,6 +138,10 @@ export default async function DashboardLayout({ children }: { children: React.Re
   let hasAnyAccess = true
   let hasAnyAccess = true
   /** Whether the plate lookup may offer to add a vehicle it did not find. */
   /** Whether the plate lookup may offer to add a vehicle it did not find. */
   let canCreateVehicles = true
   let canCreateVehicles = true
+  /** Whether a vehicle found or added anywhere may be booked in from there. */
+  let canBook = true
+  /** Whether a booking may offer to add the customer it is for. */
+  let canAddCustomer = true
 
 
   if (!isOwnerOrAdmin) {
   if (!isOwnerOrAdmin) {
     const membership = await getCachedMembership(data.userId)
     const membership = await getCachedMembership(data.userId)
@@ -156,6 +162,8 @@ export default async function DashboardLayout({ children }: { children: React.Re
        */
        */
       visibleSubjects = []
       visibleSubjects = []
       canCreateVehicles = false
       canCreateVehicles = false
+      canBook = false
+      canAddCustomer = false
       hasAnyAccess = false
       hasAnyAccess = false
     } else {
     } else {
       const userPermissions = membership?.customRole?.permissions ?? []
       const userPermissions = membership?.customRole?.permissions ?? []
@@ -169,6 +177,14 @@ export default async function DashboardLayout({ children }: { children: React.Re
         action: PermissionAction.CREATE,
         action: PermissionAction.CREATE,
         subject: PermissionSubject.VEHICLES,
         subject: PermissionSubject.VEHICLES,
       })
       })
+      canBook = hasPermission(userPermissions, {
+        action: PermissionAction.CREATE,
+        subject: PermissionSubject.SERVICES,
+      })
+      canAddCustomer = hasPermission(userPermissions, {
+        action: PermissionAction.CREATE,
+        subject: PermissionSubject.CUSTOMERS,
+      })
       // A role that grants nothing readable. Every page behind the nav would
       // A role that grants nothing readable. Every page behind the nav would
       // answer "Your role does not allow this", so say it once instead.
       // answer "Your role does not allow this", so say it once instead.
       hasAnyAccess = visibleSubjects.length > 0
       hasAnyAccess = visibleSubjects.length > 0
@@ -412,83 +428,86 @@ export default async function DashboardLayout({ children }: { children: React.Re
                         currencyFormat={data.currencyFormat}
                         currencyFormat={data.currencyFormat}
                       >
                       >
                         <ConfirmProvider>
                         <ConfirmProvider>
-                          <PlateLookupProvider
-                            value={{
-                              available: plateLookupAvailable,
-                              canCreate: canCreateVehicles,
-                              registryName: plateLookupRegistry,
-                            }}
-                          >
-                            <FeatureHintProvider
-                              initialSeen={seenHints}
-                              pending={[...pendingHints, ...announcements]}
+                          <BookingAccessProvider value={{ canBook, canAddCustomer }}>
+                            <PlateLookupProvider
+                              value={{
+                                available: plateLookupAvailable,
+                                canCreate: canCreateVehicles,
+                                registryName: plateLookupRegistry,
+                              }}
                             >
                             >
-                              {/* One socket for the whole app: record changes, who
+                              <FeatureHintProvider
+                                initialSeen={seenHints}
+                                pending={[...pendingHints, ...announcements]}
+                              >
+                                {/* One socket for the whole app: record changes, who
                           else is on a record, and the older workshop-wide
                           else is on a record, and the older workshop-wide
                           channels the remaining pages still read. */}
                           channels the remaining pages still read. */}
-                              <RealtimeProvider>
-                                <TimeClockProvider technicianIds={technicianIds}>
-                                  <SaveShortcutListener />
-                                  <SidebarShortcut />
-                                  <AnalyticsIdentity
-                                    userId={data.userId}
-                                    organizationId={data.organizationId}
-                                  />
-                                  <AppSidebar
-                                    companyLogo={data.companyLogo}
-                                    organizations={data.organizations}
-                                    activeOrgId={data.organizationId}
-                                    isSuperAdmin={data.isSuperAdmin}
-                                    features={features}
-                                    tireHotelEnabled={tireHotelEnabled}
-                                    aiEnabled={aiEnabled}
-                                    faultCodesEnabled={faultCodesEnabled}
-                                    visibleSubjects={visibleSubjects}
-                                    announcement={announcements[0] ?? null}
-                                    isAdminOrOwner={isOwnerOrAdmin}
-                                    counts={sidebarCounts}
-                                    isTechnician={technicianIds.length > 0}
-                                    supportEnabled={supportEnabled}
-                                  />
-                                  <SidebarInset
-                                    id="main-content"
-                                    tabIndex={-1}
-                                    className="outline-none"
-                                  >
-                                    {/* A flex column with a real height, so the `flex-1` every
+                                <RealtimeProvider>
+                                  <TimeClockProvider technicianIds={technicianIds}>
+                                    <SaveShortcutListener />
+                                    <SidebarShortcut />
+                                    <AnalyticsIdentity
+                                      userId={data.userId}
+                                      organizationId={data.organizationId}
+                                    />
+                                    <AppSidebar
+                                      companyLogo={data.companyLogo}
+                                      organizations={data.organizations}
+                                      activeOrgId={data.organizationId}
+                                      isSuperAdmin={data.isSuperAdmin}
+                                      features={features}
+                                      tireHotelEnabled={tireHotelEnabled}
+                                      aiEnabled={aiEnabled}
+                                      faultCodesEnabled={faultCodesEnabled}
+                                      visibleSubjects={visibleSubjects}
+                                      announcement={announcements[0] ?? null}
+                                      isAdminOrOwner={isOwnerOrAdmin}
+                                      counts={sidebarCounts}
+                                      isTechnician={technicianIds.length > 0}
+                                      supportEnabled={supportEnabled}
+                                    />
+                                    <SidebarInset
+                                      id="main-content"
+                                      tabIndex={-1}
+                                      className="outline-none"
+                                    >
+                                      {/* A flex column with a real height, so the `flex-1` every
                           page already writes on its wrapper actually resolves.
                           page already writes on its wrapper actually resolves.
                           Without it a page that wants to fill the window (the
                           Without it a page that wants to fill the window (the
                           work board's week timeline) stopped at its content and
                           work board's week timeline) stopped at its content and
                           left the rest of the screen blank. */}
                           left the rest of the screen blank. */}
-                                    <div className="flex min-h-0 flex-1 flex-col pb-14 md:pb-0">
-                                      {children}
-                                    </div>
-                                  </SidebarInset>
-                                  <SearchCommand
-                                    visibleSubjects={visibleSubjects}
-                                    features={features}
-                                    tireHotelEnabled={tireHotelEnabled}
-                                    aiEnabled={aiEnabled}
-                                    isAdminOrOwner={isOwnerOrAdmin}
-                                    isCloud={cloudLinked}
-                                    supportEnabled={supportEnabled}
-                                    isMarine={data.serviceType === 'marine'}
-                                    connectors={searchConnectors}
-                                    faultCodesEnabled={faultCodesEnabled}
-                                  />
-                                  <PlateLookupCommand />
-                                  {isOwnerOrAdmin && <NotificationInitializer />}
-                                  <OnlineTracker />
-                                  <ConnectionWatcher />
-                                  <UpdateWatcher version={buildVersion()} />
-                                  <InstallBanner
-                                    appName={appBranding.name}
-                                    iconUrl={appBranding.iconUrl}
-                                  />
-                                </TimeClockProvider>
-                              </RealtimeProvider>
-                            </FeatureHintProvider>
-                          </PlateLookupProvider>
+                                      <div className="flex min-h-0 flex-1 flex-col pb-14 md:pb-0">
+                                        {children}
+                                      </div>
+                                    </SidebarInset>
+                                    <SearchCommand
+                                      visibleSubjects={visibleSubjects}
+                                      features={features}
+                                      tireHotelEnabled={tireHotelEnabled}
+                                      aiEnabled={aiEnabled}
+                                      isAdminOrOwner={isOwnerOrAdmin}
+                                      isCloud={cloudLinked}
+                                      supportEnabled={supportEnabled}
+                                      isMarine={data.serviceType === 'marine'}
+                                      connectors={searchConnectors}
+                                      faultCodesEnabled={faultCodesEnabled}
+                                    />
+                                    <PlateLookupCommand />
+                                    <BookingHost />
+                                    {isOwnerOrAdmin && <NotificationInitializer />}
+                                    <OnlineTracker />
+                                    <ConnectionWatcher />
+                                    <UpdateWatcher version={buildVersion()} />
+                                    <InstallBanner
+                                      appName={appBranding.name}
+                                      iconUrl={appBranding.iconUrl}
+                                    />
+                                  </TimeClockProvider>
+                                </RealtimeProvider>
+                              </FeatureHintProvider>
+                            </PlateLookupProvider>
+                          </BookingAccessProvider>
                         </ConfirmProvider>
                         </ConfirmProvider>
                       </CurrencySettingsProvider>
                       </CurrencySettingsProvider>
                     </DateSettingsProvider>
                     </DateSettingsProvider>

+ 72 - 0
src/components/booking-launcher.tsx

@@ -0,0 +1,72 @@
+'use client'
+
+import { createContext, useContext } from 'react'
+
+/**
+ * Booking from anywhere.
+ *
+ * The desk has a customer on the phone and may be on any screen. Whatever
+ * made or found the vehicle (the plate lookup, the vehicle form, the + menu)
+ * asks for the booking dialog here, with the vehicle and customer it already
+ * has, so nobody searches for the same car twice.
+ */
+
+/** A vehicle as the pickers show it. */
+export interface BookingVehicle {
+  id: string
+  make: string
+  model: string
+  year: number
+  licensePlate: string | null
+  customerId: string | null
+  customer: { id: string; name: string } | null
+}
+
+export interface BookingCustomer {
+  id: string
+  name: string
+  company: string | null
+}
+
+/** What a booking opened from outside the calendar starts with. */
+export interface BookingStart {
+  vehicle?: BookingVehicle | null
+  customer?: BookingCustomer | null
+}
+
+export interface BookingAccess {
+  /** The signed-in account may book: it can create work orders. */
+  canBook: boolean
+  /** It may also add a customer, so a booking can offer to. */
+  canAddCustomer: boolean
+}
+
+const BookingAccessContext = createContext<BookingAccess>({ canBook: false, canAddCustomer: false })
+
+/** Resolved once in the layout, like the plate lookup's access. */
+export function BookingAccessProvider({
+  value,
+  children,
+}: {
+  value: BookingAccess
+  children: React.ReactNode
+}) {
+  return <BookingAccessContext.Provider value={value}>{children}</BookingAccessContext.Provider>
+}
+
+export function useBookingAccess() {
+  return useContext(BookingAccessContext)
+}
+
+/** The event a "Book appointment" anywhere fires; the host in the layout listens for it. */
+export const BOOKING_EVENT = 'torqvoice:booking'
+
+/**
+ * Fired once a booking opened this way is saved. A screen that keeps its own
+ * list of what is booked, as the calendar does, reads it again on this.
+ */
+export const BOOKING_SAVED_EVENT = 'torqvoice:booking-saved'
+
+export function openBooking(start?: BookingStart) {
+  document.dispatchEvent(new CustomEvent(BOOKING_EVENT, { detail: start ?? {} }))
+}

+ 10 - 0
src/components/quick-create-menu.tsx

@@ -15,6 +15,7 @@ import {
 import {
 import {
   Plus,
   Plus,
   Loader2,
   Loader2,
+  CalendarPlus,
   Wrench,
   Wrench,
   Users,
   Users,
   Car,
   Car,
@@ -26,6 +27,7 @@ import {
 import { VehiclePickerDialog } from '@/components/vehicle-picker-dialog'
 import { VehiclePickerDialog } from '@/components/vehicle-picker-dialog'
 import { NewInspectionDialog } from '@/features/inspections/Components/NewInspectionDialog'
 import { NewInspectionDialog } from '@/features/inspections/Components/NewInspectionDialog'
 import { getTemplates } from '@/features/inspections/Actions/templateActions'
 import { getTemplates } from '@/features/inspections/Actions/templateActions'
+import { openBooking, useBookingAccess } from '@/components/booking-launcher'
 import { ShortcutKeys } from '@/features/shortcuts/Components/ShortcutKeys'
 import { ShortcutKeys } from '@/features/shortcuts/Components/ShortcutKeys'
 import { useShortcut } from '@/features/shortcuts/Components/ShortcutsProvider'
 import { useShortcut } from '@/features/shortcuts/Components/ShortcutsProvider'
 
 
@@ -40,6 +42,7 @@ export function QuickCreateMenu() {
   // Through the save guard: the menu is in the header of every page, an
   // Through the save guard: the menu is in the header of every page, an
   // open work order or quote with unsaved edits included.
   // open work order or quote with unsaved edits included.
   const go = useGuardedPush()
   const go = useGuardedPush()
+  const { canBook } = useBookingAccess()
   const [vehicleDialogOpen, setVehicleDialogOpen] = useState(false)
   const [vehicleDialogOpen, setVehicleDialogOpen] = useState(false)
   const [inspectionDialogOpen, setInspectionDialogOpen] = useState(false)
   const [inspectionDialogOpen, setInspectionDialogOpen] = useState(false)
   const [loading, setLoading] = useState(false)
   const [loading, setLoading] = useState(false)
@@ -95,6 +98,13 @@ export function QuickCreateMenu() {
             {t('quickCreate.workOrder')}
             {t('quickCreate.workOrder')}
             <ShortcutKeys id="create.workOrder" className="ml-auto" />
             <ShortcutKeys id="create.workOrder" className="ml-auto" />
           </DropdownMenuItem>
           </DropdownMenuItem>
+          {/* Beside the work order: the same car, for another day. */}
+          {canBook && (
+            <DropdownMenuItem onSelect={() => openBooking()}>
+              <CalendarPlus className="h-4 w-4" />
+              {t('quickCreate.appointment')}
+            </DropdownMenuItem>
+          )}
           <DropdownMenuItem onSelect={() => go('/customers?create=true')}>
           <DropdownMenuItem onSelect={() => go('/customers?create=true')}>
             <Users className="h-4 w-4" />
             <Users className="h-4 w-4" />
             {t('quickCreate.customer')}
             {t('quickCreate.customer')}

+ 201 - 382
src/components/vehicle-picker-dialog.tsx

@@ -15,7 +15,10 @@ import {
 } from '@/components/ui/dialog'
 } from '@/components/ui/dialog'
 import { cn } from '@/lib/utils'
 import { cn } from '@/lib/utils'
 import { Loader2, Plus, Car, Search, ArrowLeft, UserPlus, ShoppingCart, Ship } from 'lucide-react'
 import { Loader2, Plus, Car, Search, ArrowLeft, UserPlus, ShoppingCart, Ship } from 'lucide-react'
-import { createVehicle, searchVehicles } from '@/features/vehicles/Actions/vehicleActions'
+import { searchVehicles } from '@/features/vehicles/Actions/vehicleActions'
+import { VehicleForm } from '@/features/vehicles/Components/VehicleForm'
+import { plateFromSearch } from '@/features/vehicles/Lib/plate'
+import { usePlateLookupAccess } from '@/components/plate-lookup-context'
 import { createDraftCounterSale } from '@/features/vehicles/Actions/createDraftServiceRecord'
 import { createDraftCounterSale } from '@/features/vehicles/Actions/createDraftServiceRecord'
 import { CustomerCombobox } from '@/features/quotes/Components/CustomerCombobox'
 import { CustomerCombobox } from '@/features/quotes/Components/CustomerCombobox'
 import { createCustomer } from '@/features/customers/Actions/customerActions'
 import { createCustomer } from '@/features/customers/Actions/customerActions'
@@ -64,12 +67,12 @@ export function VehiclePickerDialog({
   const displayTitle = isMarine ? t('titleMarine') : title || t('title')
   const displayTitle = isMarine ? t('titleMarine') : title || t('title')
 
 
   const [vehicleSearch, setVehicleSearch] = useState('')
   const [vehicleSearch, setVehicleSearch] = useState('')
-  const [pickerStep, setPickerStep] = useState<'select' | 'create' | 'sale'>('select')
-
-  const [newMake, setNewMake] = useState('')
-  const [newModel, setNewModel] = useState('')
-  const [newYear, setNewYear] = useState('')
-  const [newPlate, setNewPlate] = useState('')
+  const [pickerStep, setPickerStep] = useState<'select' | 'sale'>('select')
+  const { canCreate: canAddVehicle } = usePlateLookupAccess()
+  // A vehicle not on file is added in the same form as everywhere else, and
+  // its work order opens as soon as it is saved. `null` is closed; the string
+  // is the plate the search was for, to start the new vehicle from.
+  const [newVehicle, setNewVehicle] = useState<string | null>(null)
   // Kept as the whole customer, not just its id: the combobox remounts when the
   // Kept as the whole customer, not just its id: the combobox remounts when the
   // step changes and needs the customer to show who the record will be saved to.
   // step changes and needs the customer to show who the record will be saved to.
   const [selectedCustomer, setSelectedCustomer] = useState<CustomerOption | null>(null)
   const [selectedCustomer, setSelectedCustomer] = useState<CustomerOption | null>(null)
@@ -138,10 +141,7 @@ export function VehiclePickerDialog({
     setPickerStep('select')
     setPickerStep('select')
     setVehicleSearch('')
     setVehicleSearch('')
     setActiveIndex(0)
     setActiveIndex(0)
-    setNewMake('')
-    setNewModel('')
-    setNewYear('')
-    setNewPlate('')
+    setNewVehicle(null)
     setSelectedCustomer(null)
     setSelectedCustomer(null)
     setShowNewCustomer(false)
     setShowNewCustomer(false)
     setNewCustomerName('')
     setNewCustomerName('')
@@ -203,397 +203,216 @@ export function VehiclePickerDialog({
     if (!nextOpen) resetState()
     if (!nextOpen) resetState()
   }
   }
 
 
-  const handleQuickCreate = async () => {
-    if (!newMake.trim() || !newModel.trim() || !newYear.trim()) return
-    const yearNum = parseInt(newYear, 10)
-    if (isNaN(yearNum) || yearNum < 1900 || yearNum > new Date().getFullYear() + 2) {
-      toast.error(t('invalidYear'))
-      return
-    }
-    if (showNewCustomer && !newCustomerName.trim()) {
-      toast.error(t('customerNameRequired'))
-      return
-    }
-
-    setCreating(true)
-    try {
-      let customerId = selectedCustomerId || undefined
-
-      if (showNewCustomer && newCustomerName.trim()) {
-        const customerResult = await createCustomer({
-          name: newCustomerName.trim(),
-          phone: newCustomerPhone.trim() || undefined,
-        })
-        if (!customerResult.success || !customerResult.data) {
-          if (!handleGated(customerResult)) {
-            toast.error(customerResult.error || t('failedCreateCustomer'))
-          }
-          setCreating(false)
-          return
-        }
-        customerId = customerResult.data.id
-      }
-
-      const vehicleResult = await createVehicle({
-        make: newMake.trim(),
-        model: newModel.trim(),
-        year: yearNum,
-        licensePlate: newPlate.trim() || undefined,
-        customerId,
-      })
-      if (!vehicleResult.success || !vehicleResult.data) {
-        toast.error(
-          vehicleResult.error ||
-            (isMarine ? t('failedCreateVehicleMarine') : t('failedCreateVehicle'))
-        )
-        setCreating(false)
-        return
-      }
-
-      handleSelect(vehicleResult.data.id)
-    } catch {
-      toast.error(t('somethingWentWrong'))
-      setCreating(false)
-    }
-  }
-
   return (
   return (
-    <Dialog open={open} onOpenChange={handleOpenChange}>
-      <DialogContent className="max-w-md" aria-describedby={undefined}>
-        {pickerStep === 'select' ? (
-          <>
-            <DialogHeader>
-              <DialogTitle>{displayTitle}</DialogTitle>
-              {/* The search box is pinned above the list, so it never moves under the cursor */}
-              <div className="relative mt-1">
-                <Search className="pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
-                <Input
-                  placeholder={isMarine ? t('searchPlaceholderMarine') : t('searchPlaceholder')}
-                  value={vehicleSearch}
-                  onChange={(e) => setVehicleSearch(e.target.value)}
-                  onKeyDown={handleSearchKeyDown}
-                  className="pl-9"
-                  autoFocus
-                />
-                {/* A search in flight runs a thin bar under the box; the old rows stay in place */}
-                {vehiclesLoading && filteredVehicles.length > 0 && (
-                  <span className="search-progress" aria-hidden="true" />
-                )}
-              </div>
-            </DialogHeader>
-            {/* One fixed height whatever the list holds, so the dialog never resizes or
-                re-centres while results, a spinner and the empty message take turns */}
-            <DialogBody ref={listRef} className="h-80 p-2">
-              {vehiclesLoading && filteredVehicles.length === 0 ? (
-                <div className="flex h-full items-center justify-center">
-                  <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
-                </div>
-              ) : filteredVehicles.length === 0 ? (
-                <div className="flex h-full items-center justify-center px-6 text-center">
-                  <p className="text-sm text-muted-foreground">
-                    {!vehicleSearch.trim()
-                      ? isMarine
-                        ? t('emptyMarine')
-                        : t('empty')
-                      : isMarine
-                        ? t('emptySearchMarine')
-                        : t('emptySearch')}
-                  </p>
-                </div>
-              ) : (
-                <div
-                  className={cn('space-y-0.5 transition-opacity', vehiclesLoading && 'opacity-60')}
-                >
-                  {filteredVehicles.map((v, index) => (
-                    <button
-                      key={v.id}
-                      type="button"
-                      data-active={index === activeIndex}
-                      className="flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left transition-colors data-[active=true]:bg-muted"
-                      onMouseMove={() => setActiveIndex(index)}
-                      onClick={() => handleSelect(v.id)}
-                    >
-                      {isMarine ? (
-                        <Ship className="h-4 w-4 shrink-0 text-muted-foreground" />
-                      ) : (
-                        <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-xs text-muted-foreground">
-                          {[v.licensePlate, v.customer?.name].filter(Boolean).join(' · ') ||
-                            (isMarine ? t('noPlateMarine') : t('noPlate'))}
-                        </p>
-                      </div>
-                    </button>
-                  ))}
+    <>
+      <Dialog open={open} onOpenChange={handleOpenChange}>
+        <DialogContent className="max-w-md" aria-describedby={undefined}>
+          {pickerStep === 'select' ? (
+            <>
+              <DialogHeader>
+                <DialogTitle>{displayTitle}</DialogTitle>
+                {/* The search box is pinned above the list, so it never moves under the cursor */}
+                <div className="relative mt-1">
+                  <Search className="pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
+                  <Input
+                    placeholder={isMarine ? t('searchPlaceholderMarine') : t('searchPlaceholder')}
+                    value={vehicleSearch}
+                    onChange={(e) => setVehicleSearch(e.target.value)}
+                    onKeyDown={handleSearchKeyDown}
+                    className="pl-9"
+                    autoFocus
+                  />
+                  {/* A search in flight runs a thin bar under the box; the old rows stay in place */}
+                  {vehiclesLoading && filteredVehicles.length > 0 && (
+                    <span className="search-progress" aria-hidden="true" />
+                  )}
                 </div>
                 </div>
-              )}
-            </DialogBody>
-            <DialogFooter className="flex-row">
-              <Button variant="ghost" className="flex-1" onClick={() => setPickerStep('create')}>
-                <Plus className="h-4 w-4 mr-1" />
-                {isMarine ? t('addNewVehicleMarine') : t('addNewVehicle')}
-              </Button>
-              <Button variant="ghost" className="flex-1" onClick={() => setPickerStep('sale')}>
-                <ShoppingCart className="h-4 w-4 mr-1" />
-                {t('partsSale')}
-              </Button>
-            </DialogFooter>
-          </>
-        ) : pickerStep === 'sale' ? (
-          <>
-            <DialogHeader>
-              <div className="flex items-center gap-2">
-                <Button
-                  variant="ghost"
-                  size="icon"
-                  className="h-7 w-7 shrink-0"
-                  onClick={() => setPickerStep('select')}
-                >
-                  <ArrowLeft className="h-4 w-4" />
-                </Button>
-                <DialogTitle>{t('partsSale')}</DialogTitle>
-              </div>
-            </DialogHeader>
-            <div className="space-y-4">
-              <p className="text-sm text-muted-foreground">
-                {isMarine ? t('partsSaleDescriptionMarine') : t('partsSaleDescription')}
-              </p>
-              <div className="space-y-1.5">
-                <Label>{t('customer')}</Label>
-                {!showNewCustomer ? (
-                  <>
-                    <CustomerCombobox
-                      value={selectedCustomerId}
-                      placeholder={t('selectCustomer')}
-                      noneLabel={t('none')}
-                      initialCustomer={selectedCustomer}
-                      onChange={(_id, customer) => setSelectedCustomer(customer)}
-                    />
-                    <Button
-                      variant="ghost"
-                      size="sm"
-                      className="h-8 px-2 text-xs text-muted-foreground"
-                      onClick={() => {
-                        setShowNewCustomer(true)
-                        setSelectedCustomer(null)
-                      }}
-                    >
-                      <UserPlus className="h-3.5 w-3.5 mr-1" />
-                      {t('createNewCustomer')}
-                    </Button>
-                  </>
+              </DialogHeader>
+              {/* One fixed height whatever the list holds, so the dialog never resizes or
+                re-centres while results, a spinner and the empty message take turns */}
+              <DialogBody ref={listRef} className="h-80 p-2">
+                {vehiclesLoading && filteredVehicles.length === 0 ? (
+                  <div className="flex h-full items-center justify-center">
+                    <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
+                  </div>
+                ) : filteredVehicles.length === 0 ? (
+                  <div className="flex h-full items-center justify-center px-6 text-center">
+                    <p className="text-sm text-muted-foreground">
+                      {!vehicleSearch.trim()
+                        ? isMarine
+                          ? t('emptyMarine')
+                          : t('empty')
+                        : isMarine
+                          ? t('emptySearchMarine')
+                          : t('emptySearch')}
+                    </p>
+                  </div>
                 ) : (
                 ) : (
-                  <div className="space-y-3 rounded-md border p-3">
-                    <div className="flex items-center justify-between">
-                      <p className="text-sm font-medium">{t('newCustomer')}</p>
-                      <Button
-                        variant="ghost"
-                        size="sm"
-                        className="h-7 text-xs"
-                        onClick={() => {
-                          setShowNewCustomer(false)
-                          setNewCustomerName('')
-                          setNewCustomerPhone('')
-                        }}
+                  <div
+                    className={cn(
+                      'space-y-0.5 transition-opacity',
+                      vehiclesLoading && 'opacity-60'
+                    )}
+                  >
+                    {filteredVehicles.map((v, index) => (
+                      <button
+                        key={v.id}
+                        type="button"
+                        data-active={index === activeIndex}
+                        className="flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left transition-colors data-[active=true]:bg-muted"
+                        onMouseMove={() => setActiveIndex(index)}
+                        onClick={() => handleSelect(v.id)}
                       >
                       >
-                        {tc('cancel')}
-                      </Button>
-                    </div>
-                    <div className="grid grid-cols-2 gap-3">
-                      <div className="space-y-1.5">
-                        <Label htmlFor="sale-customer-name">{t('customerName')}</Label>
-                        <Input
-                          id="sale-customer-name"
-                          placeholder={t('customerNamePlaceholder')}
-                          value={newCustomerName}
-                          onChange={(e) => setNewCustomerName(e.target.value)}
-                        />
-                      </div>
-                      <div className="space-y-1.5">
-                        <Label htmlFor="sale-customer-phone">{t('phone')}</Label>
-                        <Input
-                          id="sale-customer-phone"
-                          placeholder={t('phonePlaceholder')}
-                          value={newCustomerPhone}
-                          onChange={(e) => setNewCustomerPhone(e.target.value)}
-                        />
-                      </div>
-                    </div>
+                        {isMarine ? (
+                          <Ship className="h-4 w-4 shrink-0 text-muted-foreground" />
+                        ) : (
+                          <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-xs text-muted-foreground">
+                            {[v.licensePlate, v.customer?.name].filter(Boolean).join(' · ') ||
+                              (isMarine ? t('noPlateMarine') : t('noPlate'))}
+                          </p>
+                        </div>
+                      </button>
+                    ))}
                   </div>
                   </div>
                 )}
                 )}
-              </div>
-              <Button
-                className="w-full"
-                disabled={
-                  creating || (showNewCustomer ? !newCustomerName.trim() : !selectedCustomerId)
-                }
-                onClick={handleCreateSale}
-              >
-                {creating ? (
-                  <>
-                    <Loader2 className="h-4 w-4 mr-1 animate-spin" />
-                    {t('creating')}
-                  </>
-                ) : (
-                  t('createSale')
+              </DialogBody>
+              <DialogFooter className="flex-row">
+                {canAddVehicle && (
+                  <Button
+                    variant="ghost"
+                    className="flex-1"
+                    onClick={() => setNewVehicle(plateFromSearch(vehicleSearch))}
+                  >
+                    <Plus className="h-4 w-4 mr-1" />
+                    {isMarine ? t('addNewVehicleMarine') : t('addNewVehicle')}
+                  </Button>
                 )}
                 )}
-              </Button>
-            </div>
-          </>
-        ) : (
-          <>
-            <DialogHeader>
-              <div className="flex items-center gap-2">
-                <Button
-                  variant="ghost"
-                  size="icon"
-                  className="h-7 w-7 shrink-0"
-                  onClick={() => setPickerStep('select')}
-                >
-                  <ArrowLeft className="h-4 w-4" />
+                <Button variant="ghost" className="flex-1" onClick={() => setPickerStep('sale')}>
+                  <ShoppingCart className="h-4 w-4 mr-1" />
+                  {t('partsSale')}
                 </Button>
                 </Button>
-                <DialogTitle>
-                  {isMarine ? t('addNewVehicleMarine') : t('addNewVehicle')}
-                </DialogTitle>
-              </div>
-            </DialogHeader>
-            <div className="space-y-4">
-              <div className="grid grid-cols-2 gap-3">
-                <div className="space-y-1.5">
-                  <Label htmlFor="new-make">{isMarine ? t('makeMarine') : t('make')}</Label>
-                  <Input
-                    id="new-make"
-                    placeholder={isMarine ? 'e.g. Boston Whaler' : 'e.g. Toyota'}
-                    value={newMake}
-                    onChange={(e) => setNewMake(e.target.value)}
-                    autoFocus
-                  />
+              </DialogFooter>
+            </>
+          ) : (
+            <>
+              <DialogHeader>
+                <div className="flex items-center gap-2">
+                  <Button
+                    variant="ghost"
+                    size="icon"
+                    className="h-7 w-7 shrink-0"
+                    onClick={() => setPickerStep('select')}
+                  >
+                    <ArrowLeft className="h-4 w-4" />
+                  </Button>
+                  <DialogTitle>{t('partsSale')}</DialogTitle>
                 </div>
                 </div>
+              </DialogHeader>
+              <div className="space-y-4">
+                <p className="text-sm text-muted-foreground">
+                  {isMarine ? t('partsSaleDescriptionMarine') : t('partsSaleDescription')}
+                </p>
                 <div className="space-y-1.5">
                 <div className="space-y-1.5">
-                  <Label htmlFor="new-model">{t('model')}</Label>
-                  <Input
-                    id="new-model"
-                    placeholder={isMarine ? 'e.g. Montauk 170' : 'e.g. Camry'}
-                    value={newModel}
-                    onChange={(e) => setNewModel(e.target.value)}
-                  />
-                </div>
-              </div>
-              <div className="grid grid-cols-2 gap-3">
-                <div className="space-y-1.5">
-                  <Label htmlFor="new-year">{t('year')}</Label>
-                  <Input
-                    id="new-year"
-                    type="number"
-                    placeholder={`e.g. ${new Date().getFullYear()}`}
-                    value={newYear}
-                    onChange={(e) => setNewYear(e.target.value)}
-                  />
-                </div>
-                <div className="space-y-1.5">
-                  <Label htmlFor="new-plate">
-                    {isMarine ? t('licensePlateMarine') : t('licensePlate')}
-                  </Label>
-                  <Input
-                    id="new-plate"
-                    placeholder="e.g. ABC-1234"
-                    value={newPlate}
-                    onChange={(e) => setNewPlate(e.target.value)}
-                  />
-                </div>
-              </div>
-              <div className="space-y-1.5">
-                <Label>{t('customer')}</Label>
-                {!showNewCustomer ? (
-                  <>
-                    <CustomerCombobox
-                      value={selectedCustomerId}
-                      placeholder={t('selectCustomer')}
-                      noneLabel={t('none')}
-                      initialCustomer={selectedCustomer}
-                      onChange={(_id, customer) => setSelectedCustomer(customer)}
-                    />
-                    <Button
-                      variant="ghost"
-                      size="sm"
-                      className="h-8 px-2 text-xs text-muted-foreground"
-                      onClick={() => {
-                        setShowNewCustomer(true)
-                        setSelectedCustomer(null)
-                      }}
-                    >
-                      <UserPlus className="h-3.5 w-3.5 mr-1" />
-                      {t('createNewCustomer')}
-                    </Button>
-                  </>
-                ) : (
-                  <div className="space-y-3 rounded-md border p-3">
-                    <div className="flex items-center justify-between">
-                      <p className="text-sm font-medium">{t('newCustomer')}</p>
+                  <Label>{t('customer')}</Label>
+                  {!showNewCustomer ? (
+                    <>
+                      <CustomerCombobox
+                        value={selectedCustomerId}
+                        placeholder={t('selectCustomer')}
+                        noneLabel={t('none')}
+                        initialCustomer={selectedCustomer}
+                        onChange={(_id, customer) => setSelectedCustomer(customer)}
+                      />
                       <Button
                       <Button
                         variant="ghost"
                         variant="ghost"
                         size="sm"
                         size="sm"
-                        className="h-7 text-xs"
+                        className="h-8 px-2 text-xs text-muted-foreground"
                         onClick={() => {
                         onClick={() => {
-                          setShowNewCustomer(false)
-                          setNewCustomerName('')
-                          setNewCustomerPhone('')
+                          setShowNewCustomer(true)
+                          setSelectedCustomer(null)
                         }}
                         }}
                       >
                       >
-                        {tc('cancel')}
+                        <UserPlus className="h-3.5 w-3.5 mr-1" />
+                        {t('createNewCustomer')}
                       </Button>
                       </Button>
-                    </div>
-                    <div className="grid grid-cols-2 gap-3">
-                      <div className="space-y-1.5">
-                        <Label htmlFor="new-customer-name">{t('customerName')}</Label>
-                        <Input
-                          id="new-customer-name"
-                          placeholder={t('customerNamePlaceholder')}
-                          value={newCustomerName}
-                          onChange={(e) => setNewCustomerName(e.target.value)}
-                        />
+                    </>
+                  ) : (
+                    <div className="space-y-3 rounded-md border p-3">
+                      <div className="flex items-center justify-between">
+                        <p className="text-sm font-medium">{t('newCustomer')}</p>
+                        <Button
+                          variant="ghost"
+                          size="sm"
+                          className="h-7 text-xs"
+                          onClick={() => {
+                            setShowNewCustomer(false)
+                            setNewCustomerName('')
+                            setNewCustomerPhone('')
+                          }}
+                        >
+                          {tc('cancel')}
+                        </Button>
                       </div>
                       </div>
-                      <div className="space-y-1.5">
-                        <Label htmlFor="new-customer-phone">{t('phone')}</Label>
-                        <Input
-                          id="new-customer-phone"
-                          placeholder={t('phonePlaceholder')}
-                          value={newCustomerPhone}
-                          onChange={(e) => setNewCustomerPhone(e.target.value)}
-                        />
+                      <div className="grid grid-cols-2 gap-3">
+                        <div className="space-y-1.5">
+                          <Label htmlFor="sale-customer-name">{t('customerName')}</Label>
+                          <Input
+                            id="sale-customer-name"
+                            placeholder={t('customerNamePlaceholder')}
+                            value={newCustomerName}
+                            onChange={(e) => setNewCustomerName(e.target.value)}
+                          />
+                        </div>
+                        <div className="space-y-1.5">
+                          <Label htmlFor="sale-customer-phone">{t('phone')}</Label>
+                          <Input
+                            id="sale-customer-phone"
+                            placeholder={t('phonePlaceholder')}
+                            value={newCustomerPhone}
+                            onChange={(e) => setNewCustomerPhone(e.target.value)}
+                          />
+                        </div>
                       </div>
                       </div>
                     </div>
                     </div>
-                  </div>
-                )}
+                  )}
+                </div>
+                <Button
+                  className="w-full"
+                  disabled={
+                    creating || (showNewCustomer ? !newCustomerName.trim() : !selectedCustomerId)
+                  }
+                  onClick={handleCreateSale}
+                >
+                  {creating ? (
+                    <>
+                      <Loader2 className="h-4 w-4 mr-1 animate-spin" />
+                      {t('creating')}
+                    </>
+                  ) : (
+                    t('createSale')
+                  )}
+                </Button>
               </div>
               </div>
-              <Button
-                className="w-full"
-                disabled={
-                  creating ||
-                  !newMake.trim() ||
-                  !newModel.trim() ||
-                  !newYear.trim() ||
-                  (showNewCustomer && !newCustomerName.trim())
-                }
-                onClick={handleQuickCreate}
-              >
-                {creating ? (
-                  <>
-                    <Loader2 className="h-4 w-4 mr-1 animate-spin" />
-                    {t('creating')}
-                  </>
-                ) : (
-                  t('createAndContinue')
-                )}
-              </Button>
-            </div>
-          </>
-        )}
-      </DialogContent>
-    </Dialog>
+            </>
+          )}
+        </DialogContent>
+      </Dialog>
+      {/* Beside the picker, not inside it: the same form the vehicles page
+          opens, with the plate lookup and the full customer form in it. */}
+      <VehicleForm
+        open={newVehicle !== null}
+        onOpenChange={(next) => {
+          if (!next) setNewVehicle(null)
+        }}
+        initialPlate={newVehicle ?? ''}
+        onCreated={(created) => handleSelect(created.id)}
+      />
+    </>
   )
   )
 }
 }

+ 471 - 286
src/features/calendar/Components/BookingDialog.tsx

@@ -43,6 +43,12 @@ import {
 } from '@/components/ui/select'
 } from '@/components/ui/select'
 import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
 import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
 import { useServiceType } from '@/components/service-type-context'
 import { useServiceType } from '@/components/service-type-context'
+import { type BookingStart, useBookingAccess } from '@/components/booking-launcher'
+import { usePlateLookupAccess } from '@/components/plate-lookup-context'
+import { useGuardedPush } from '@/hooks/use-guarded-push'
+import { CustomerForm } from '@/features/customers/Components/CustomerForm'
+import { VehicleForm } from '@/features/vehicles/Components/VehicleForm'
+import { plateFromSearch } from '@/features/vehicles/Lib/plate'
 import { CustomerCombobox } from '@/features/quotes/Components/CustomerCombobox'
 import { CustomerCombobox } from '@/features/quotes/Components/CustomerCombobox'
 import { VehicleCombobox } from '@/features/quotes/Components/VehicleCombobox'
 import { VehicleCombobox } from '@/features/quotes/Components/VehicleCombobox'
 import { createServiceMeeting } from '@/features/integrations/Actions/integrationActions'
 import { createServiceMeeting } from '@/features/integrations/Actions/integrationActions'
@@ -130,6 +136,8 @@ export function BookingDialog({
   defaultDate,
   defaultDate,
   defaultTime,
   defaultTime,
   edit,
   edit,
+  start,
+  calendarLink,
   onSaved,
   onSaved,
 }: {
 }: {
   open: boolean
   open: boolean
@@ -140,6 +148,10 @@ export function BookingDialog({
   defaultTime?: string
   defaultTime?: string
   /** An appointment or a booked job to change, or an appointment to make a work order. */
   /** An appointment or a booked job to change, or an appointment to make a work order. */
   edit?: BookingEdit | null
   edit?: BookingEdit | null
+  /** The vehicle and customer a booking opened from elsewhere already has. */
+  start?: BookingStart | null
+  /** Away from the calendar: the confirmation offers the way to the booked day. */
+  calendarLink?: boolean
   onSaved?: () => void
   onSaved?: () => void
 }) {
 }) {
   const t = useTranslations('calendar.appointment')
   const t = useTranslations('calendar.appointment')
@@ -171,6 +183,8 @@ export function BookingDialog({
             defaultDate={defaultDate}
             defaultDate={defaultDate}
             defaultTime={defaultTime}
             defaultTime={defaultTime}
             edit={edit ?? null}
             edit={edit ?? null}
+            start={edit ? null : (start ?? null)}
+            calendarLink={calendarLink}
             saving={saving}
             saving={saving}
             onSavingChange={setSaving}
             onSavingChange={setSaving}
             onCancel={() => onOpenChange(false)}
             onCancel={() => onOpenChange(false)}
@@ -189,6 +203,8 @@ function BookingForm({
   defaultDate,
   defaultDate,
   defaultTime,
   defaultTime,
   edit,
   edit,
+  start: startWith,
+  calendarLink,
   saving,
   saving,
   onSavingChange,
   onSavingChange,
   onCancel,
   onCancel,
@@ -197,6 +213,8 @@ function BookingForm({
   defaultDate?: string
   defaultDate?: string
   defaultTime?: string
   defaultTime?: string
   edit: BookingEdit | null
   edit: BookingEdit | null
+  start: BookingStart | null
+  calendarLink?: boolean
   saving: boolean
   saving: boolean
   onSavingChange: (saving: boolean) => void
   onSavingChange: (saving: boolean) => void
   onCancel: () => void
   onCancel: () => void
@@ -205,6 +223,9 @@ function BookingForm({
   const t = useTranslations('calendar.appointment')
   const t = useTranslations('calendar.appointment')
   const tc = useTranslations('common.buttons')
   const tc = useTranslations('common.buttons')
   const isMarine = useServiceType() === 'marine'
   const isMarine = useServiceType() === 'marine'
+  const go = useGuardedPush()
+  const { canCreate: canAddVehicle } = usePlateLookupAccess()
+  const { canAddCustomer } = useBookingAccess()
 
 
   // What is being changed: nothing (a new booking), an appointment, a job.
   // What is being changed: nothing (a new booking), an appointment, a job.
   const editing = edit?.mode === 'edit' ? edit.event : null
   const editing = edit?.mode === 'edit' ? edit.event : null
@@ -224,15 +245,27 @@ function BookingForm({
   )
   )
   const [titleText, setTitleText] = useState('')
   const [titleText, setTitleText] = useState('')
   const [description, setDescription] = useState('')
   const [description, setDescription] = useState('')
-  const [customerId, setCustomerId] = useState('')
+  // A booking opened with a vehicle already has its owner too.
+  const startCustomer =
+    startWith?.customer ??
+    (startWith?.vehicle?.customer ? { ...startWith.vehicle.customer, company: null } : null)
+  const [customerId, setCustomerId] = useState(startCustomer?.id ?? '')
   const [customerInitial, setCustomerInitial] = useState<{
   const [customerInitial, setCustomerInitial] = useState<{
     id: string
     id: string
     name: string
     name: string
     company: string | null
     company: string | null
-  } | null>(null)
-  const [vehicleId, setVehicleId] = useState('')
-  const [vehicleInitial, setVehicleInitial] = useState<BookingForEdit['vehicle']>(null)
-  const [vehicleCustomerId, setVehicleCustomerId] = useState<string | null>(null)
+  } | null>(startCustomer)
+  const [vehicleId, setVehicleId] = useState(startWith?.vehicle?.id ?? '')
+  const [vehicleInitial, setVehicleInitial] = useState<BookingForEdit['vehicle']>(
+    startWith?.vehicle ?? null
+  )
+  const [vehicleCustomerId, setVehicleCustomerId] = useState<string | null>(
+    startWith?.vehicle?.customerId ?? null
+  )
+  // The full forms, opened over the booking for someone not on file yet.
+  // `null` is closed; the string is what was typed in the search that missed.
+  const [newCustomer, setNewCustomer] = useState<string | null>(null)
+  const [newVehicle, setNewVehicle] = useState<string | null>(null)
   const [work, setWork] = useState('')
   const [work, setWork] = useState('')
   const startDefault = defaultTime ?? '09:00'
   const startDefault = defaultTime ?? '09:00'
   const [start, setStart] = useState({ date: defaultDate ?? '', time: startDefault })
   const [start, setStart] = useState({ date: defaultDate ?? '', time: startDefault })
@@ -416,8 +449,18 @@ function BookingForm({
         toast.error(result.error || t('failed'))
         toast.error(result.error || t('failed'))
         return
         return
       }
       }
-      if (result.data.overbooked) toast.warning(t('bookedNobodyFree'))
-      else toast.success(editing ? t('saved') : t('booked'))
+      // Booked from another screen, the way to the day it landed on.
+      const day = start.date
+      const seeIt = calendarLink
+        ? {
+            action: {
+              label: t('openCalendar'),
+              onClick: () => go(`/calendar?view=day&date=${day}`),
+            },
+          }
+        : undefined
+      if (result.data.overbooked) toast.warning(t('bookedNobodyFree'), seeIt)
+      else toast.success(editing ? t('saved') : t('booked'), seeIt)
       // The meeting is made once the job exists; a failure leaves the booking standing.
       // The meeting is made once the job exists; a failure leaves the booking standing.
       if (meeting && result.data.kind === 'workOrder') {
       if (meeting && result.data.kind === 'workOrder') {
         const made = await createServiceMeeting(result.data.id, meeting).catch(() => null)
         const made = await createServiceMeeting(result.data.id, meeting).catch(() => null)
@@ -446,313 +489,455 @@ function BookingForm({
     customer_email: t('channel.customerEmail'),
     customer_email: t('channel.customerEmail'),
   }
   }
 
 
+  // Who is not on file yet is added here, in the same forms as everywhere
+  // else, and comes back chosen. A customer on a booked job is fixed, and so
+  // is a car that has arrived, so neither is offered then.
+  const canPickCustomer = !(editing && sourceKind === 'workOrder')
+  const offerNewCustomer = canPickCustomer && canAddCustomer
+  const offerNewVehicle = canAddVehicle && !lockedWho
+  const vehicleWord = isMarine ? t('newVehicleMarine') : t('newVehicle')
+
   return (
   return (
-    <form onSubmit={handleSubmit} className="flex min-h-0 flex-1 flex-col">
-      <DialogBody className="space-y-4">
-        {/* Title and what it is, the way a calendar app opens. */}
-        <div className="space-y-2.5 pr-6">
-          <Input
-            ref={titleRef}
-            aria-label={t('titleLabel')}
-            aria-invalid={tried && !titleText.trim() ? true : undefined}
-            value={titleText}
-            onChange={(e) => setTitleText(e.target.value)}
-            placeholder={t('titlePlaceholder')}
-            maxLength={200}
-            autoFocus
-            className="h-14 rounded-none border-0 border-b-2 border-border bg-transparent px-1 text-2xl font-medium tracking-tight shadow-none placeholder:font-normal placeholder:text-muted-foreground/70 focus-visible:border-primary focus-visible:ring-0 aria-invalid:border-destructive aria-invalid:focus-visible:border-destructive md:text-2xl dark:bg-transparent"
-          />
-          <div className="flex flex-wrap items-center gap-3">
-            <Tabs value={kind} onValueChange={(v) => chooseKind(v as BookingKind)}>
-              <TabsList>
-                <TabsTrigger
-                  value="appointment"
-                  disabled={Boolean(converting || (editing && sourceKind === 'workOrder'))}
-                  className="gap-1.5"
-                >
-                  <CalendarDays className="h-3.5 w-3.5" />
-                  {t('kind.appointment')}
-                </TabsTrigger>
-                <TabsTrigger
-                  value="workOrder"
-                  disabled={Boolean(editing && sourceKind === 'appointment')}
-                  className="gap-1.5"
-                >
-                  <Wrench className="h-3.5 w-3.5" />
-                  {t('kind.workOrder')}
-                </TabsTrigger>
-              </TabsList>
-            </Tabs>
-            <p className="text-xs text-muted-foreground">
-              {isWorkOrder
-                ? t('kind.workOrderHint')
-                : isMarine
-                  ? t('kind.appointmentHintMarine')
-                  : t('kind.appointmentHint')}
-            </p>
+    <>
+      <form onSubmit={handleSubmit} className="flex min-h-0 flex-1 flex-col">
+        <DialogBody className="space-y-4">
+          {/* Title and what it is, the way a calendar app opens. */}
+          <div className="space-y-2.5 pr-6">
+            <Input
+              ref={titleRef}
+              aria-label={t('titleLabel')}
+              aria-invalid={tried && !titleText.trim() ? true : undefined}
+              value={titleText}
+              onChange={(e) => setTitleText(e.target.value)}
+              placeholder={t('titlePlaceholder')}
+              maxLength={200}
+              autoFocus
+              className="h-14 rounded-none border-0 border-b-2 border-border bg-transparent px-1 text-2xl font-medium tracking-tight shadow-none placeholder:font-normal placeholder:text-muted-foreground/70 focus-visible:border-primary focus-visible:ring-0 aria-invalid:border-destructive aria-invalid:focus-visible:border-destructive md:text-2xl dark:bg-transparent"
+            />
+            <div className="flex flex-wrap items-center gap-3">
+              <Tabs value={kind} onValueChange={(v) => chooseKind(v as BookingKind)}>
+                <TabsList>
+                  <TabsTrigger
+                    value="appointment"
+                    disabled={Boolean(converting || (editing && sourceKind === 'workOrder'))}
+                    className="gap-1.5"
+                  >
+                    <CalendarDays className="h-3.5 w-3.5" />
+                    {t('kind.appointment')}
+                  </TabsTrigger>
+                  <TabsTrigger
+                    value="workOrder"
+                    disabled={Boolean(editing && sourceKind === 'appointment')}
+                    className="gap-1.5"
+                  >
+                    <Wrench className="h-3.5 w-3.5" />
+                    {t('kind.workOrder')}
+                  </TabsTrigger>
+                </TabsList>
+              </Tabs>
+              <p className="text-xs text-muted-foreground">
+                {isWorkOrder
+                  ? t('kind.workOrderHint')
+                  : isMarine
+                    ? t('kind.appointmentHintMarine')
+                    : t('kind.appointmentHint')}
+              </p>
+            </div>
           </div>
           </div>
-        </div>
 
 
-        {/* When: one day, start to end, as a calendar shows it. A second date
+          {/* When: one day, start to end, as a calendar shows it. A second date
             only for a booking that runs into another day. */}
             only for a booking that runs into another day. */}
-        <Row icon={Clock} label={t('when')}>
-          <div className="flex flex-wrap items-center gap-2">
-            <div className="w-40">
-              <DateInput
-                id="booking-start-date"
-                value={start.date}
-                onChange={(date) => moveStart({ ...start, date })}
-              />
-            </div>
-            <Input
-              aria-label={t('start')}
-              type="time"
-              value={start.time}
-              onChange={(e) => moveStart({ ...start, time: e.target.value })}
-              className="w-28"
-              required
-            />
-            <span className="text-muted-foreground">–</span>
-            <Input
-              aria-label={t('end')}
-              type="time"
-              value={end.time}
-              onChange={(e) => setEnd({ ...end, time: e.target.value })}
-              className="w-28"
-              required
-            />
-            {showEndDate ? (
+          <Row icon={Clock} label={t('when')}>
+            <div className="flex flex-wrap items-center gap-2">
               <div className="w-40">
               <div className="w-40">
                 <DateInput
                 <DateInput
-                  id="booking-end-date"
-                  value={end.date}
-                  onChange={(date) => setEnd({ ...end, date })}
+                  id="booking-start-date"
+                  value={start.date}
+                  onChange={(date) => moveStart({ ...start, date })}
                 />
                 />
               </div>
               </div>
-            ) : (
-              <Button
-                type="button"
-                variant="ghost"
-                size="sm"
-                className="h-8 px-2 text-xs text-primary"
-                onClick={() => setMultiDay(true)}
-              >
-                {t('endsAnotherDay')}
-              </Button>
-            )}
-            {timesValid && durationLabel && (
-              <span className="text-xs text-muted-foreground">{durationLabel}</span>
-            )}
-          </div>
-          {!timesValid && <p className="text-xs text-destructive">{t('endAfterStart')}</p>}
-        </Row>
-
-        <div className="grid gap-x-8 gap-y-4 md:grid-cols-[minmax(0,4fr)_minmax(0,6fr)]">
-          <div className="space-y-4">
-            <Row icon={User} label={t('customer')} optional={optionalLabel}>
-              <CustomerCombobox
-                value={customerId}
-                initialCustomer={customerInitial}
-                placeholder={t('selectCustomer')}
-                searchPlaceholder={t('searchCustomer')}
-                noneLabel={t('none')}
-                emptyLabel={t('noCustomers')}
-                // On a booked job only a missing car can be added here; the
-                // customer, and so the prices, change on the work order.
-                disabled={Boolean(editing && sourceKind === 'workOrder')}
-                onChange={(id) => {
-                  setCustomerId(id)
-                  // A car belonging to someone else no longer fits.
-                  if (id && vehicleId && vehicleCustomerId !== id) {
-                    setVehicleId('')
-                    setVehicleCustomerId(null)
-                  }
-                }}
+              <Input
+                aria-label={t('start')}
+                type="time"
+                value={start.time}
+                onChange={(e) => moveStart({ ...start, time: e.target.value })}
+                className="w-28"
+                required
               />
               />
-            </Row>
-            <Row
-              icon={Car}
-              label={isMarine ? t('vehicleMarine') : t('vehicle')}
-              optional={optionalLabel}
-            >
-              <VehicleCombobox
-                value={vehicleId}
-                initialVehicle={vehicleInitial}
-                customerId={customerId || undefined}
-                placeholder={isMarine ? t('selectVehicleMarine') : t('selectVehicle')}
-                searchPlaceholder={isMarine ? t('searchVehicleMarine') : t('searchVehicle')}
-                noneLabel={t('none')}
-                emptyLabel={isMarine ? t('noVehiclesMarine') : t('noVehicles')}
-                disabled={lockedWho}
-                onChange={(id, vehicle) => {
-                  setVehicleId(id)
-                  setVehicleCustomerId(vehicle?.customerId ?? null)
-                  if (vehicle?.customer) {
-                    setCustomerId(vehicle.customer.id)
-                    setCustomerInitial({ ...vehicle.customer, company: null })
-                  }
-                }}
+              <span className="text-muted-foreground">–</span>
+              <Input
+                aria-label={t('end')}
+                type="time"
+                value={end.time}
+                onChange={(e) => setEnd({ ...end, time: e.target.value })}
+                className="w-28"
+                required
               />
               />
-              {(lockedWho || isWorkOrder) && (
-                <p
-                  className={cn(
-                    'text-xs',
-                    tried && isWorkOrder && !hasCustomer
-                      ? 'text-destructive'
-                      : 'text-muted-foreground'
-                  )}
+              {showEndDate ? (
+                <div className="w-40">
+                  <DateInput
+                    id="booking-end-date"
+                    value={end.date}
+                    onChange={(date) => setEnd({ ...end, date })}
+                  />
+                </div>
+              ) : (
+                <Button
+                  type="button"
+                  variant="ghost"
+                  size="sm"
+                  className="h-8 px-2 text-xs text-primary"
+                  onClick={() => setMultiDay(true)}
                 >
                 >
-                  {lockedWho
-                    ? isMarine
-                      ? t('whoLockedMarine')
-                      : t('whoLocked')
-                    : isMarine
-                      ? t('whoHintMarine')
-                      : t('whoHint')}
-                </p>
+                  {t('endsAnotherDay')}
+                </Button>
               )}
               )}
-            </Row>
-            <Row icon={AlignLeft} label={t('description')}>
-              <RichTextEditor
-                content={description}
-                onChange={setDescription}
-                placeholder={t('descriptionPlaceholder')}
-                contentClassName="min-h-[8rem] max-h-[30vh]"
-              />
-            </Row>
-          </div>
+              {timesValid && durationLabel && (
+                <span className="text-xs text-muted-foreground">{durationLabel}</span>
+              )}
+            </div>
+            {!timesValid && <p className="text-xs text-destructive">{t('endAfterStart')}</p>}
+          </Row>
 
 
-          <div className="space-y-4">
-            <Row icon={Bell} label={t('notifications')}>
-              <div className="space-y-2">
-                {rows.map((row) => (
-                  <NotificationEditor
-                    key={row.key}
-                    row={row}
-                    channels={channels}
-                    channelLabel={channelLabel}
-                    hasCustomer={hasCustomer}
-                    onChange={(next) =>
-                      setRows((all) => all.map((r) => (r.key === row.key ? next : r)))
-                    }
-                    onRemove={() => setRows((all) => all.filter((r) => r.key !== row.key))}
-                  />
-                ))}
-                {!customerRowsOk && (
-                  <p className="text-xs text-destructive">{t('customerChannelNeedsCustomer')}</p>
-                )}
-                {rows.length < MAX_NOTIFICATIONS && (
-                  <Button
-                    type="button"
-                    variant="ghost"
-                    size="sm"
-                    className="-ml-2 h-8 text-primary"
-                    onClick={() => setRows((all) => [...all, newRow()])}
+          <div className="grid gap-x-8 gap-y-4 md:grid-cols-[minmax(0,4fr)_minmax(0,6fr)]">
+            <div className="min-w-0 space-y-4">
+              <Row icon={User} label={t('customer')} optional={optionalLabel}>
+                <div className="flex gap-2">
+                  <div className="min-w-0 flex-1">
+                    <CustomerCombobox
+                      value={customerId}
+                      initialCustomer={customerInitial}
+                      placeholder={t('selectCustomer')}
+                      searchPlaceholder={t('searchCustomer')}
+                      noneLabel={t('none')}
+                      emptyLabel={t('noCustomers')}
+                      // On a booked job only a missing car can be added here; the
+                      // customer, and so the prices, change on the work order.
+                      disabled={!canPickCustomer}
+                      onChange={(id, customer) => {
+                        setCustomerId(id)
+                        setCustomerInitial(customer)
+                        // A car belonging to someone else no longer fits.
+                        if (id && vehicleId && vehicleCustomerId !== id) {
+                          setVehicleId('')
+                          setVehicleCustomerId(null)
+                        }
+                      }}
+                      footer={
+                        offerNewCustomer
+                          ? (close, search) => (
+                              <AddFromSearch
+                                label={
+                                  search.trim()
+                                    ? t('newCustomerNamed', { name: search.trim() })
+                                    : t('newCustomer')
+                                }
+                                onClick={() => {
+                                  close()
+                                  setNewCustomer(search.trim())
+                                }}
+                              />
+                            )
+                          : undefined
+                      }
+                    />
+                  </div>
+                  {offerNewCustomer && (
+                    <Button
+                      type="button"
+                      variant="outline"
+                      className="shrink-0 gap-1.5 px-3"
+                      aria-label={t('newCustomer')}
+                      onClick={() => setNewCustomer('')}
+                    >
+                      <Plus className="h-4 w-4" />
+                      <span aria-hidden>{t('new')}</span>
+                    </Button>
+                  )}
+                </div>
+              </Row>
+              <Row
+                icon={Car}
+                label={isMarine ? t('vehicleMarine') : t('vehicle')}
+                optional={optionalLabel}
+              >
+                <div className="flex gap-2">
+                  <div className="min-w-0 flex-1">
+                    <VehicleCombobox
+                      value={vehicleId}
+                      initialVehicle={vehicleInitial}
+                      customerId={customerId || undefined}
+                      placeholder={isMarine ? t('selectVehicleMarine') : t('selectVehicle')}
+                      searchPlaceholder={isMarine ? t('searchVehicleMarine') : t('searchVehicle')}
+                      noneLabel={t('none')}
+                      emptyLabel={isMarine ? t('noVehiclesMarine') : t('noVehicles')}
+                      disabled={lockedWho}
+                      onChange={(id, vehicle) => {
+                        setVehicleId(id)
+                        setVehicleCustomerId(vehicle?.customerId ?? null)
+                        if (vehicle?.customer) {
+                          setCustomerId(vehicle.customer.id)
+                          setCustomerInitial({ ...vehicle.customer, company: null })
+                        }
+                      }}
+                      footer={
+                        offerNewVehicle
+                          ? (close, search) => (
+                              <AddFromSearch
+                                label={
+                                  plateFromSearch(search)
+                                    ? t(isMarine ? 'newVehicleNamedMarine' : 'newVehicleNamed', {
+                                        plate: plateFromSearch(search),
+                                      })
+                                    : vehicleWord
+                                }
+                                onClick={() => {
+                                  close()
+                                  setNewVehicle(plateFromSearch(search))
+                                }}
+                              />
+                            )
+                          : undefined
+                      }
+                    />
+                  </div>
+                  {offerNewVehicle && (
+                    <Button
+                      type="button"
+                      variant="outline"
+                      className="shrink-0 gap-1.5 px-3"
+                      aria-label={vehicleWord}
+                      onClick={() => setNewVehicle('')}
+                    >
+                      <Plus className="h-4 w-4" />
+                      <span aria-hidden>{t('new')}</span>
+                    </Button>
+                  )}
+                </div>
+                {(lockedWho || isWorkOrder) && (
+                  <p
+                    className={cn(
+                      'text-xs',
+                      tried && isWorkOrder && !hasCustomer
+                        ? 'text-destructive'
+                        : 'text-muted-foreground'
+                    )}
                   >
                   >
-                    <Plus className="mr-1.5 h-3.5 w-3.5" />
-                    {t('addNotification')}
-                  </Button>
-                )}
-              </div>
-            </Row>
-            {isWorkOrder && (
-              <Row icon={ListChecks} label={t('work')}>
-                <ConcernListEditor
-                  value={work}
-                  onChange={setWork}
-                  disabled={lockedWork}
-                  placeholder={isMarine ? t('addConcernMarine') : t('addConcern')}
-                />
-                {(lockedWork || work.trim() === '') && (
-                  <p className="px-2 text-xs text-muted-foreground">
-                    {lockedWork ? t('workLocked') : t('workEmptyHint')}
+                    {lockedWho
+                      ? isMarine
+                        ? t('whoLockedMarine')
+                        : t('whoLocked')
+                      : isMarine
+                        ? t('whoHintMarine')
+                        : t('whoHint')}
                   </p>
                   </p>
                 )}
                 )}
               </Row>
               </Row>
-            )}
-            {isWorkOrder && video.length > 0 && (
-              <Row icon={Video} label={t('video')}>
-                {loaded?.meeting ? (
-                  <a
-                    href={loaded.meeting.url}
-                    target="_blank"
-                    rel="noopener noreferrer"
-                    className="inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:underline"
-                  >
-                    {t('joinMeeting')}
-                    <ExternalLink className="h-3.5 w-3.5" />
-                  </a>
-                ) : meeting ? (
-                  <div className="flex items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm">
-                    <span>
-                      {t('meetingAdded', {
-                        name: video.find((v) => v.connectorId === meeting)?.name ?? '',
-                      })}
-                    </span>
+              <Row icon={AlignLeft} label={t('description')}>
+                <RichTextEditor
+                  content={description}
+                  onChange={setDescription}
+                  placeholder={t('descriptionPlaceholder')}
+                  contentClassName="min-h-[8rem] max-h-[30vh]"
+                />
+              </Row>
+            </div>
+
+            <div className="min-w-0 space-y-4">
+              <Row icon={Bell} label={t('notifications')}>
+                <div className="space-y-2">
+                  {rows.map((row) => (
+                    <NotificationEditor
+                      key={row.key}
+                      row={row}
+                      channels={channels}
+                      channelLabel={channelLabel}
+                      hasCustomer={hasCustomer}
+                      onChange={(next) =>
+                        setRows((all) => all.map((r) => (r.key === row.key ? next : r)))
+                      }
+                      onRemove={() => setRows((all) => all.filter((r) => r.key !== row.key))}
+                    />
+                  ))}
+                  {!customerRowsOk && (
+                    <p className="text-xs text-destructive">{t('customerChannelNeedsCustomer')}</p>
+                  )}
+                  {rows.length < MAX_NOTIFICATIONS && (
                     <Button
                     <Button
                       type="button"
                       type="button"
                       variant="ghost"
                       variant="ghost"
-                      size="icon"
-                      className="h-7 w-7"
-                      aria-label={t('removeMeeting')}
-                      onClick={() => setMeeting(null)}
+                      size="sm"
+                      className="-ml-2 h-8 text-primary"
+                      onClick={() => setRows((all) => [...all, newRow()])}
                     >
                     >
-                      <X className="h-4 w-4" />
+                      <Plus className="mr-1.5 h-3.5 w-3.5" />
+                      {t('addNotification')}
                     </Button>
                     </Button>
-                  </div>
-                ) : (
-                  <div className="flex flex-wrap gap-2">
-                    {video.map((v) => (
+                  )}
+                </div>
+              </Row>
+              {isWorkOrder && (
+                <Row icon={ListChecks} label={t('work')}>
+                  <ConcernListEditor
+                    value={work}
+                    onChange={setWork}
+                    disabled={lockedWork}
+                    placeholder={isMarine ? t('addConcernMarine') : t('addConcern')}
+                  />
+                  {(lockedWork || work.trim() === '') && (
+                    <p className="px-2 text-xs text-muted-foreground">
+                      {lockedWork ? t('workLocked') : t('workEmptyHint')}
+                    </p>
+                  )}
+                </Row>
+              )}
+              {isWorkOrder && video.length > 0 && (
+                <Row icon={Video} label={t('video')}>
+                  {loaded?.meeting ? (
+                    <a
+                      href={loaded.meeting.url}
+                      target="_blank"
+                      rel="noopener noreferrer"
+                      className="inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:underline"
+                    >
+                      {t('joinMeeting')}
+                      <ExternalLink className="h-3.5 w-3.5" />
+                    </a>
+                  ) : meeting ? (
+                    <div className="flex items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm">
+                      <span>
+                        {t('meetingAdded', {
+                          name: video.find((v) => v.connectorId === meeting)?.name ?? '',
+                        })}
+                      </span>
                       <Button
                       <Button
-                        key={v.connectorId}
                         type="button"
                         type="button"
-                        variant="outline"
-                        size="sm"
-                        onClick={() => setMeeting(v.connectorId)}
+                        variant="ghost"
+                        size="icon"
+                        className="h-7 w-7"
+                        aria-label={t('removeMeeting')}
+                        onClick={() => setMeeting(null)}
                       >
                       >
-                        <Video className="mr-1.5 h-3.5 w-3.5" />
-                        {t('addMeeting', { name: v.name })}
+                        <X className="h-4 w-4" />
                       </Button>
                       </Button>
-                    ))}
-                  </div>
-                )}
-              </Row>
-            )}
+                    </div>
+                  ) : (
+                    <div className="flex flex-wrap gap-2">
+                      {video.map((v) => (
+                        <Button
+                          key={v.connectorId}
+                          type="button"
+                          variant="outline"
+                          size="sm"
+                          onClick={() => setMeeting(v.connectorId)}
+                        >
+                          <Video className="mr-1.5 h-3.5 w-3.5" />
+                          {t('addMeeting', { name: v.name })}
+                        </Button>
+                      ))}
+                    </div>
+                  )}
+                </Row>
+              )}
+            </div>
           </div>
           </div>
-        </div>
-      </DialogBody>
-      <DialogFooter>
-        <Button type="button" variant="outline" onClick={onCancel} disabled={saving}>
-          {tc('cancel')}
-        </Button>
-        <Button
-          data-save-shortcut
-          type="submit"
-          disabled={saving}
-          // On the press, not only on submit: a field the browser itself
-          // refuses (an emptied time, a fractional amount) never reaches the
-          // form's submit, and the press must still say what is missing.
-          onClick={() => {
-            if (!ready) setTried(true)
-          }}
-          aria-describedby={tried && missing ? 'booking-missing' : undefined}
-        >
-          {saving && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
-          {editing ? tc('save') : converting ? t('convertSubmit') : t('submit')}
-        </Button>
-        {/* Last in the markup so it sits above the buttons on a phone, where
-            the footer stacks upwards; first on a wider screen. */}
-        {tried && missing && (
-          <p
-            id="booking-missing"
-            role="alert"
-            className="text-sm text-destructive sm:order-first sm:mr-auto sm:self-center"
+        </DialogBody>
+        <DialogFooter>
+          <Button type="button" variant="outline" onClick={onCancel} disabled={saving}>
+            {tc('cancel')}
+          </Button>
+          <Button
+            data-save-shortcut
+            type="submit"
+            disabled={saving}
+            // On the press, not only on submit: a field the browser itself
+            // refuses (an emptied time, a fractional amount) never reaches the
+            // form's submit, and the press must still say what is missing.
+            onClick={() => {
+              if (!ready) setTried(true)
+            }}
+            aria-describedby={tried && missing ? 'booking-missing' : undefined}
           >
           >
-            {missing}
-          </p>
-        )}
-      </DialogFooter>
-    </form>
+            {saving && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
+            {editing ? tc('save') : converting ? t('convertSubmit') : t('submit')}
+          </Button>
+          {/* Last in the markup so it sits above the buttons on a phone, where
+            the footer stacks upwards; first on a wider screen. */}
+          {tried && missing && (
+            <p
+              id="booking-missing"
+              role="alert"
+              className="text-sm text-destructive sm:order-first sm:mr-auto sm:self-center"
+            >
+              {missing}
+            </p>
+          )}
+        </DialogFooter>
+      </form>
+
+      {/* Outside the booking's own form: a submit inside these would otherwise
+        rise through React to it and try to save the booking. */}
+      <CustomerForm
+        open={newCustomer !== null}
+        onOpenChange={(next) => {
+          if (!next) setNewCustomer(null)
+        }}
+        defaults={newCustomer ? { name: newCustomer } : undefined}
+        onCreated={(created) => {
+          setCustomerId(created.id)
+          setCustomerInitial(created)
+          // A car belonging to someone else no longer fits.
+          if (vehicleId && vehicleCustomerId !== created.id) {
+            setVehicleId('')
+            setVehicleInitial(null)
+            setVehicleCustomerId(null)
+          }
+        }}
+      />
+      <VehicleForm
+        open={newVehicle !== null}
+        onOpenChange={(next) => {
+          if (!next) setNewVehicle(null)
+        }}
+        defaultCustomerId={customerId || undefined}
+        defaultCustomer={customerInitial}
+        initialPlate={newVehicle ?? ''}
+        // A booked job's customer is fixed, and its car must be theirs.
+        ownerLocked={!canPickCustomer && Boolean(customerId)}
+        onCreated={(created) => {
+          setVehicleId(created.id)
+          setVehicleInitial(created)
+          setVehicleCustomerId(created.customerId)
+          // The owner chosen or added inside the vehicle form is the booking's too.
+          if (created.customer) {
+            setCustomerId(created.customer.id)
+            setCustomerInitial({ ...created.customer, company: null })
+          } else if (canPickCustomer) {
+            // Having no owner is the booking's too: a booking with a car is
+            // saved under the car's owner, so a customer left showing here
+            // would be lost without a word.
+            setCustomerId('')
+            setCustomerInitial(null)
+          }
+        }}
+      />
+    </>
+  )
+}
+
+/** The last line of a picker's list: add who the search did not find. */
+function AddFromSearch({ label, onClick }: { label: string; onClick: () => void }) {
+  return (
+    <div className="border-t p-1">
+      <button
+        type="button"
+        className="flex w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent"
+        onClick={onClick}
+      >
+        <Plus className="h-4 w-4 shrink-0" />
+        <span className="truncate">{label}</span>
+      </button>
+    </div>
   )
   )
 }
 }
 
 

+ 83 - 0
src/features/calendar/Components/BookingHost.tsx

@@ -0,0 +1,83 @@
+'use client'
+
+import { useEffect, useState } from 'react'
+import { useRouter } from 'next/navigation'
+import {
+  BOOKING_EVENT,
+  BOOKING_SAVED_EVENT,
+  type BookingStart,
+  useBookingAccess,
+} from '@/components/booking-launcher'
+import { useDateSettings } from '@/components/date-settings-context'
+import { zonedDayKey } from '@/lib/timezone'
+import { BookingDialog } from './BookingDialog'
+
+/**
+ * The next full hour on the workshop's clock, and the day it falls on: a
+ * booking made now is for later, and one made after 23:00 is for tomorrow.
+ */
+function nextHour(timeZone: string): { date: string; time: string } {
+  const inAnHour = new Date(Date.now() + 60 * 60 * 1000)
+  const hour = Number(
+    new Intl.DateTimeFormat('en-GB', { hour: '2-digit', hourCycle: 'h23', timeZone }).format(
+      inAnHour
+    )
+  )
+  return {
+    date: zonedDayKey(inAnHour, timeZone),
+    time: `${String(hour).padStart(2, '0')}:00`,
+  }
+}
+
+/**
+ * The booking dialog for every screen but the calendar, which has its own.
+ *
+ * Mounted once in the layout and opened by `openBooking`, with the vehicle
+ * and customer the asker already has. It starts on the workshop's today at
+ * the next full hour; the day and time are the first thing the dialog asks.
+ */
+export function BookingHost() {
+  const { canBook } = useBookingAccess()
+  const { timezone } = useDateSettings()
+  const router = useRouter()
+  const [open, setOpen] = useState(false)
+  const [start, setStart] = useState<BookingStart | null>(null)
+  const [today, setToday] = useState('')
+  const [time, setTime] = useState('09:00')
+  // A new opening is a new booking, even with the same vehicle as the last.
+  const [opening, setOpening] = useState(0)
+
+  useEffect(() => {
+    if (!canBook) return
+    const onEvent = (e: Event) => {
+      setStart((e as CustomEvent<BookingStart>).detail ?? null)
+      // The workshop's day, not the browser's or the server's.
+      const next = nextHour(timezone || 'UTC')
+      setToday(next.date)
+      setTime(next.time)
+      setOpening((n) => n + 1)
+      setOpen(true)
+    }
+    document.addEventListener(BOOKING_EVENT, onEvent)
+    return () => document.removeEventListener(BOOKING_EVENT, onEvent)
+  }, [canBook, timezone])
+
+  if (!canBook) return null
+
+  return (
+    <BookingDialog
+      key={opening}
+      open={open}
+      onOpenChange={setOpen}
+      defaultDate={today}
+      defaultTime={time}
+      start={start}
+      calendarLink
+      onSaved={() => {
+        router.refresh()
+        // The calendar keeps its own events and would not show this one.
+        document.dispatchEvent(new CustomEvent(BOOKING_SAVED_EVENT))
+      }}
+    />
+  )
+}

+ 8 - 0
src/features/calendar/Components/CalendarClient.tsx

@@ -11,6 +11,7 @@ import { Button } from '@/components/ui/button'
 import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'
 import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'
 import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet'
 import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet'
 import { VehiclePickerDialog } from '@/components/vehicle-picker-dialog'
 import { VehiclePickerDialog } from '@/components/vehicle-picker-dialog'
+import { BOOKING_SAVED_EVENT } from '@/components/booking-launcher'
 import { useIsMobile } from '@/hooks/use-mobile'
 import { useIsMobile } from '@/hooks/use-mobile'
 import { ReminderFormDialog } from '@/features/vehicles/Components/ReminderFormDialog'
 import { ReminderFormDialog } from '@/features/vehicles/Components/ReminderFormDialog'
 import { NewQuoteDialog } from '@/features/quotes/Components/NewQuoteDialog'
 import { NewQuoteDialog } from '@/features/quotes/Components/NewQuoteDialog'
@@ -187,6 +188,13 @@ export default function CalendarClient({
     load(loadedRange ?? fetchRangeFor(view, date, weekStartDay))
     load(loadedRange ?? fetchRangeFor(view, date, weekStartDay))
   }, [load, loadedRange, view, date, weekStartDay])
   }, [load, loadedRange, view, date, weekStartDay])
 
 
+  // A booking made from the header while the calendar is open: the events
+  // here are the calendar's own, so they are read again.
+  useEffect(() => {
+    document.addEventListener(BOOKING_SAVED_EVENT, refresh)
+    return () => document.removeEventListener(BOOKING_SAVED_EVENT, refresh)
+  }, [refresh])
+
   // ── URL ────────────────────────────────────────────────────────────────
   // ── URL ────────────────────────────────────────────────────────────────
   const firstRender = useRef(true)
   const firstRender = useRef(true)
   useEffect(() => {
   useEffect(() => {

+ 12 - 1
src/features/customers/Components/CustomerForm.tsx

@@ -31,6 +31,7 @@ import type { VehicleDocumentScan } from '@/features/vehicles/Actions/aiAnalyzeV
 import { Loader2 } from 'lucide-react'
 import { Loader2 } from 'lucide-react'
 import { clearableInput } from '@/lib/clearable'
 import { clearableInput } from '@/lib/clearable'
 import { handleGated } from '@/components/upgrade-gate'
 import { handleGated } from '@/components/upgrade-gate'
+import { openBooking, useBookingAccess } from '@/components/booking-launcher'
 
 
 interface CustomerFormProps {
 interface CustomerFormProps {
   open: boolean
   open: boolean
@@ -65,6 +66,7 @@ export function CustomerForm({
   onCreated,
   onCreated,
 }: CustomerFormProps) {
 }: CustomerFormProps) {
   const t = useTranslations('customers.form')
   const t = useTranslations('customers.form')
+  const { canBook } = useBookingAccess()
   const tc = useTranslations('common')
   const tc = useTranslations('common')
   const router = useRouter()
   const router = useRouter()
   const modal = useGlassModal()
   const modal = useGlassModal()
@@ -146,10 +148,19 @@ export function CustomerForm({
 
 
     if (result.success) {
     if (result.success) {
       if (!customer) track('customer:create')
       if (!customer) track('customer:create')
-      toast.success(customer ? t('customerUpdated') : t('customerCreated'))
       const created = result.data as
       const created = result.data as
         | { id: string; name: string; company: string | null }
         | { id: string; name: string; company: string | null }
         | undefined
         | undefined
+      if (!customer && created && !onCreated && canBook) {
+        // Never a dead end: a customer added on their own can be booked in
+        // straight from the confirmation.
+        const start = { id: created.id, name: created.name, company: created.company ?? null }
+        toast.success(t('customerCreated'), {
+          action: { label: t('bookAppointment'), onClick: () => openBooking({ customer: start }) },
+        })
+      } else {
+        toast.success(customer ? t('customerUpdated') : t('customerCreated'))
+      }
       const customerId = customer?.id ?? created?.id
       const customerId = customer?.id ?? created?.id
 
 
       // The scanned papers describe a vehicle too, and the customer it belongs
       // The scanned papers describe a vehicle too, and the customer it belongs

+ 6 - 3
src/features/quotes/Components/CustomerCombobox.tsx

@@ -33,8 +33,11 @@ interface CustomerComboboxProps {
   noneLabel?: string
   noneLabel?: string
   /** What the list says when nothing matches */
   /** What the list says when nothing matches */
   emptyLabel?: string
   emptyLabel?: string
-  /** Shown under the list, e.g. a way to add a customer; `close` shuts the list */
-  footer?: (close: () => void) => ReactNode
+  /**
+   * Shown under the list, e.g. a way to add a customer; `close` shuts the
+   * list, and `search` is what was typed, for a form that starts from it
+   */
+  footer?: (close: () => void, search: string) => ReactNode
   /** Shown but not changeable here */
   /** Shown but not changeable here */
   disabled?: boolean
   disabled?: boolean
   /** The chosen customer's initials in a circle before the name, as an owner is shown */
   /** The chosen customer's initials in a circle before the name, as an owner is shown */
@@ -207,7 +210,7 @@ export function CustomerCombobox({
               </div>
               </div>
             )}
             )}
           </CommandList>
           </CommandList>
-          {footer?.(() => setOpen(false))}
+          {footer?.(() => setOpen(false), search)}
         </Command>
         </Command>
       </PopoverContent>
       </PopoverContent>
     </Popover>
     </Popover>

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

@@ -1,6 +1,6 @@
 'use client'
 'use client'
 
 
-import { useState, useEffect, useRef, useCallback } from 'react'
+import { useState, useEffect, useRef, useCallback, type ReactNode } from 'react'
 import { Button } from '@/components/ui/button'
 import { Button } from '@/components/ui/button'
 import {
 import {
   Command,
   Command,
@@ -41,6 +41,11 @@ interface VehicleComboboxProps {
   emptyLabel?: string
   emptyLabel?: string
   /** When set, only this customer's vehicles are offered */
   /** When set, only this customer's vehicles are offered */
   customerId?: string
   customerId?: string
+  /**
+   * Shown under the list, e.g. a way to add a vehicle; `close` shuts the
+   * list, and `search` is what was typed, for a form that starts from it
+   */
+  footer?: (close: () => void, search: string) => ReactNode
   /** Shown but not changeable here */
   /** Shown but not changeable here */
   disabled?: boolean
   disabled?: boolean
 }
 }
@@ -59,6 +64,7 @@ export function VehicleCombobox({
   allowNone = true,
   allowNone = true,
   emptyLabel = 'No vehicles found.',
   emptyLabel = 'No vehicles found.',
   customerId,
   customerId,
+  footer,
   disabled = false,
   disabled = false,
 }: VehicleComboboxProps) {
 }: VehicleComboboxProps) {
   const [open, setOpen] = useState(false)
   const [open, setOpen] = useState(false)
@@ -188,7 +194,7 @@ export function VehicleCombobox({
           <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
           <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
         </Button>
         </Button>
       </PopoverTrigger>
       </PopoverTrigger>
-      <PopoverContent className="w-[var(--radix-popover-trigger-width)] p-0">
+      <PopoverContent className="w-(--radix-popover-trigger-width) min-w-64 p-0">
         <Command shouldFilter={false}>
         <Command shouldFilter={false}>
           <CommandInput
           <CommandInput
             placeholder={searchPlaceholder ?? placeholder}
             placeholder={searchPlaceholder ?? placeholder}
@@ -247,6 +253,7 @@ export function VehicleCombobox({
               </div>
               </div>
             )}
             )}
           </CommandList>
           </CommandList>
+          {footer?.(() => setOpen(false), search)}
         </Command>
         </Command>
       </PopoverContent>
       </PopoverContent>
     </Popover>
     </Popover>

+ 129 - 39
src/features/vehicles/Components/PlateLookupCommand.tsx

@@ -6,6 +6,7 @@ import { useFormatter, useTranslations } from 'next-intl'
 import {
 import {
   ArrowRight,
   ArrowRight,
   Building2,
   Building2,
+  CalendarPlus,
   Car,
   Car,
   Check,
   Check,
   Copy,
   Copy,
@@ -15,11 +16,13 @@ import {
   ShieldCheck,
   ShieldCheck,
   ShieldOff,
   ShieldOff,
   User,
   User,
+  Wrench,
   X,
   X,
 } from 'lucide-react'
 } from 'lucide-react'
 import { Button } from '@/components/ui/button'
 import { Button } from '@/components/ui/button'
 import { Dialog, DialogContent, DialogDescription, DialogTitle } from '@/components/ui/dialog'
 import { Dialog, DialogContent, DialogDescription, DialogTitle } from '@/components/ui/dialog'
 import { PLATE_LOOKUP_EVENT, usePlateLookupAccess } from '@/components/plate-lookup-context'
 import { PLATE_LOOKUP_EVENT, usePlateLookupAccess } from '@/components/plate-lookup-context'
+import { openBooking, useBookingAccess } from '@/components/booking-launcher'
 import type { VehicleLookup } from '@/features/integrations/Actions/vehicleLookupActions'
 import type { VehicleLookup } from '@/features/integrations/Actions/vehicleLookupActions'
 import { cn } from '@/lib/utils'
 import { cn } from '@/lib/utils'
 import { type PlateLookup, lookupPlate } from '../Actions/plateLookupActions'
 import { type PlateLookup, lookupPlate } from '../Actions/plateLookupActions'
@@ -35,7 +38,10 @@ import { ShortcutKeys } from '@/features/shortcuts/Components/ShortcutKeys'
  * (the vehicle, its owner, its history) beside what the registry publishes
  * (the vehicle, its owner, its history) beside what the registry publishes
  * (identity, engine, dates, tyres). A vehicle the workshop has not seen gets
  * (identity, engine, dates, tyres). A vehicle the workshop has not seen gets
  * an "Add vehicle" that opens the ordinary form with the registry's answer
  * an "Add vehicle" that opens the ordinary form with the registry's answer
- * already typed in.
+ * already typed in, and comes back here once saved.
+ *
+ * A vehicle on file is never the end of the errand: it can be booked onto the
+ * calendar or given a work order from the sheet, with nothing to search again.
  *
  *
  * Opened from the header button, from Ctrl+Shift+L, or by any code that
  * Opened from the header button, from Ctrl+Shift+L, or by any code that
  * dispatches the plate-lookup event, optionally with a plate to search.
  * dispatches the plate-lookup event, optionally with a plate to search.
@@ -75,6 +81,7 @@ export function PlateLookupCommand() {
   const format = useFormatter()
   const format = useFormatter()
   const go = useGuardedPush()
   const go = useGuardedPush()
   const { available, canCreate, registryName } = usePlateLookupAccess()
   const { available, canCreate, registryName } = usePlateLookupAccess()
+  const { canBook } = useBookingAccess()
 
 
   const [open, setOpen] = useState(false)
   const [open, setOpen] = useState(false)
   const [plate, setPlate] = useState('')
   const [plate, setPlate] = useState('')
@@ -160,6 +167,29 @@ export function PlateLookupCommand() {
     go(`/vehicles/${id}`)
     go(`/vehicles/${id}`)
   }
   }
 
 
+  const bookVehicle = (v: NonNullable<PlateLookup['vehicle']>) => {
+    handleOpenChange(false)
+    openBooking({
+      vehicle: {
+        id: v.id,
+        make: v.make,
+        model: v.model,
+        year: v.year,
+        licensePlate: v.licensePlate,
+        customerId: v.customer?.id ?? null,
+        customer: v.customer ? { id: v.customer.id, name: v.customer.name } : null,
+      },
+      customer: v.customer
+        ? { id: v.customer.id, name: v.customer.name, company: v.customer.company }
+        : null,
+    })
+  }
+
+  const newWorkOrder = (id: string) => {
+    handleOpenChange(false)
+    go(`/vehicles/${id}/service/new`)
+  }
+
   const addVehicle = async () => {
   const addVehicle = async () => {
     if (!result) return
     if (!result) return
     const registry = result.registry
     const registry = result.registry
@@ -258,7 +288,9 @@ export function PlateLookupCommand() {
     <>
     <>
       <Dialog open={open} onOpenChange={handleOpenChange}>
       <Dialog open={open} onOpenChange={handleOpenChange}>
         <DialogContent
         <DialogContent
-          className="gap-0 overflow-hidden p-0 sm:max-w-2xl"
+          // One column that cannot grow past the dialog: on a phone the sheet
+          // used to be as wide as its longest line and ran off both edges.
+          className="grid-cols-[minmax(0,1fr)] gap-0 overflow-hidden p-0 sm:max-w-2xl"
           showCloseButton={false}
           showCloseButton={false}
           onOpenAutoFocus={(e) => e.preventDefault()}
           onOpenAutoFocus={(e) => e.preventDefault()}
         >
         >
@@ -460,46 +492,72 @@ export function PlateLookupCommand() {
 
 
                 {/* The workshop's half: the car is yours, or it could be. */}
                 {/* The workshop's half: the car is yours, or it could be. */}
                 {vehicle ? (
                 {vehicle ? (
-                  <div className="flex flex-wrap items-center gap-4 px-5 py-3">
-                    <div className="flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-primary/10 text-primary">
-                      {vehicle.imageUrl ? (
-                        // eslint-disable-next-line @next/next/no-img-element
-                        <img src={vehicle.imageUrl} alt="" className="h-full w-full object-cover" />
-                      ) : (
-                        <Car className="h-5 w-5" />
-                      )}
-                    </div>
-                    <div className="min-w-0 flex-1">
-                      <p className="text-sm font-medium">
-                        {vehicle.isArchived ? t('inWorkshopArchived') : t('inWorkshop')}
-                      </p>
-                      <p className="flex flex-wrap items-center gap-x-2 text-xs text-muted-foreground">
-                        {vehicle.customer ? (
-                          <span className="inline-flex items-center gap-1">
-                            {vehicle.customer.company ? (
-                              <Building2 className="h-3 w-3" />
-                            ) : (
-                              <User className="h-3 w-3" />
-                            )}
-                            {vehicle.customer.name}
-                            {vehicle.customer.company ? ` (${vehicle.customer.company})` : ''}
-                          </span>
+                  <div className="space-y-3 px-5 py-3">
+                    <div className="flex flex-wrap items-center gap-4">
+                      <div className="flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-primary/10 text-primary">
+                        {vehicle.imageUrl ? (
+                          // eslint-disable-next-line @next/next/no-img-element
+                          <img
+                            src={vehicle.imageUrl}
+                            alt=""
+                            className="h-full w-full object-cover"
+                          />
                         ) : (
                         ) : (
-                          <span>{t('noOwner')}</span>
-                        )}
-                        {vehicle.mileage > 0 && (
-                          <span>· {t('mileage', { km: format.number(vehicle.mileage) })}</span>
+                          <Car className="h-5 w-5" />
                         )}
                         )}
-                        <span>· {t('services', { count: vehicle.serviceCount })}</span>
-                        {vehicle.lastServiceAt && (
-                          <span>· {t('lastService', { date: date(vehicle.lastServiceAt) })}</span>
-                        )}
-                      </p>
+                      </div>
+                      <div className="min-w-0 flex-1">
+                        <p className="text-sm font-medium">
+                          {vehicle.isArchived ? t('inWorkshopArchived') : t('inWorkshop')}
+                        </p>
+                        <p className="flex flex-wrap items-center gap-x-2 text-xs text-muted-foreground">
+                          {vehicle.customer ? (
+                            <span className="inline-flex items-center gap-1">
+                              {vehicle.customer.company ? (
+                                <Building2 className="h-3 w-3" />
+                              ) : (
+                                <User className="h-3 w-3" />
+                              )}
+                              {vehicle.customer.name}
+                              {vehicle.customer.company ? ` (${vehicle.customer.company})` : ''}
+                            </span>
+                          ) : (
+                            <span>{t('noOwner')}</span>
+                          )}
+                          {vehicle.mileage > 0 && (
+                            <span>· {t('mileage', { km: format.number(vehicle.mileage) })}</span>
+                          )}
+                          <span>· {t('services', { count: vehicle.serviceCount })}</span>
+                          {vehicle.lastServiceAt && (
+                            <span>· {t('lastService', { date: date(vehicle.lastServiceAt) })}</span>
+                          )}
+                        </p>
+                      </div>
+                      {!(canBook && !vehicle.isArchived) && (
+                        <Button size="sm" onClick={() => openVehicle(vehicle.id)}>
+                          {t('openVehicle')}
+                          <ArrowRight className="ml-1 h-3.5 w-3.5" />
+                        </Button>
+                      )}
                     </div>
                     </div>
-                    <Button size="sm" onClick={() => openVehicle(vehicle.id)}>
-                      {t('openVehicle')}
-                      <ArrowRight className="ml-1 h-3.5 w-3.5" />
-                    </Button>
+                    {/* What the desk does next with a car it has on file, in
+                        one row: book it, start on it, or read its record. */}
+                    {canBook && !vehicle.isArchived && (
+                      <div className="grid gap-2 sm:grid-cols-[1fr_1fr_auto]">
+                        <Button onClick={() => bookVehicle(vehicle)}>
+                          <CalendarPlus className="mr-1.5 h-4 w-4" />
+                          {t('bookAppointment')}
+                        </Button>
+                        <Button variant="outline" onClick={() => newWorkOrder(vehicle.id)}>
+                          <Wrench className="mr-1.5 h-4 w-4" />
+                          {t('newWorkOrder')}
+                        </Button>
+                        <Button variant="ghost" onClick={() => openVehicle(vehicle.id)}>
+                          {t('openVehicle')}
+                          <ArrowRight className="ml-1 h-3.5 w-3.5" />
+                        </Button>
+                      </div>
+                    )}
                   </div>
                   </div>
                 ) : (
                 ) : (
                   (registry || canCreate) && (
                   (registry || canCreate) && (
@@ -616,6 +674,38 @@ export function PlateLookupCommand() {
           if (!next) setFormLookup(null)
           if (!next) setFormLookup(null)
         }}
         }}
         initialLookup={formLookup}
         initialLookup={formLookup}
+        // Saved, the sheet opens again on the same answer, now a vehicle of
+        // the workshop's with its next steps beside it. Nothing is asked of
+        // the registry a second time: some charge for every question.
+        onCreated={(created) => {
+          if (!result) {
+            go(`/vehicles/${created.id}`)
+            return
+          }
+          setResult({
+            ...result,
+            vehicle: {
+              id: created.id,
+              make: created.make,
+              model: created.model,
+              year: created.year,
+              licensePlate: created.licensePlate,
+              vin: null,
+              color: null,
+              mileage: 0,
+              imageUrl: null,
+              isArchived: false,
+              customer: created.customer
+                ? { ...created.customer, company: null, phone: null }
+                : null,
+              inspectionDueAt: null,
+              serviceCount: 0,
+              lastServiceAt: null,
+            },
+          })
+          setPhase('done')
+          setOpen(true)
+        }}
       />
       />
     </>
     </>
   )
   )

+ 90 - 6
src/features/vehicles/Components/VehicleForm.tsx

@@ -28,6 +28,7 @@ import { createVehicle, updateVehicle } from '../Actions/vehicleActions'
 import type { VehicleDocumentScan } from '../Actions/aiAnalyzeVehicleDocument'
 import type { VehicleDocumentScan } from '../Actions/aiAnalyzeVehicleDocument'
 import { ScanDocumentButton } from './ScanDocumentButton'
 import { ScanDocumentButton } from './ScanDocumentButton'
 import { VehicleLookupButton } from './VehicleLookupButton'
 import { VehicleLookupButton } from './VehicleLookupButton'
+import { type BookingVehicle, openBooking, useBookingAccess } from '@/components/booking-launcher'
 import type { VehicleLookup } from '@/features/integrations/Actions/vehicleLookupActions'
 import type { VehicleLookup } from '@/features/integrations/Actions/vehicleLookupActions'
 import { nameSimilarity } from '@/lib/name-similarity'
 import { nameSimilarity } from '@/lib/name-similarity'
 import { Camera, Check, Loader2, Pencil, Plus, Trash2, X } from 'lucide-react'
 import { Camera, Check, Loader2, Pencil, Plus, Trash2, X } from 'lucide-react'
@@ -101,6 +102,13 @@ interface VehicleFormProps {
    * plate lookup: filled in as if the search button had been pressed.
    * plate lookup: filled in as if the search button had been pressed.
    */
    */
   initialLookup?: VehicleLookup | null
   initialLookup?: VehicleLookup | null
+  /**
+   * A plate typed somewhere else, such as a vehicle search that found
+   * nothing: the new vehicle starts with it in the plate field and the cursor
+   * there, so Enter asks the registry where one is connected. An empty string
+   * only puts the cursor there. Nothing is looked up until the person asks.
+   */
+  initialPlate?: string
   /**
   /**
    * Offers "Delete vehicle" in the footer, for a page that has its own
    * Offers "Delete vehicle" in the footer, for a page that has its own
    * confirmation to hand the delete to. Left out where nothing should be deleted.
    * confirmation to hand the delete to. Left out where nothing should be deleted.
@@ -108,6 +116,17 @@ interface VehicleFormProps {
   onDelete?: () => void
   onDelete?: () => void
   /** "km" or "mi", where the caller knows it, shown beside the mileage. */
   /** "km" or "mi", where the caller knows it, shown beside the mileage. */
   distanceUnit?: string
   distanceUnit?: string
+  /**
+   * Handed the vehicle just added, for a caller that goes on with it: the
+   * booking dialog selects it, the work order picker opens its work order.
+   * Without one, the form itself offers to book the new vehicle in.
+   */
+  onCreated?: (vehicle: BookingVehicle) => void
+  /**
+   * The owner is the one given and cannot be changed here: a vehicle added
+   * to a job that already has its customer has to belong to that customer.
+   */
+  ownerLocked?: boolean
 }
 }
 
 
 export function VehicleForm({
 export function VehicleForm({
@@ -117,9 +136,13 @@ export function VehicleForm({
   defaultCustomerId,
   defaultCustomerId,
   defaultCustomer,
   defaultCustomer,
   initialLookup,
   initialLookup,
+  initialPlate,
   onDelete,
   onDelete,
   distanceUnit,
   distanceUnit,
+  onCreated,
+  ownerLocked = false,
 }: VehicleFormProps) {
 }: VehicleFormProps) {
+  const { canBook } = useBookingAccess()
   const serviceType = useServiceType()
   const serviceType = useServiceType()
   const isMarine = serviceType === 'marine'
   const isMarine = serviceType === 'marine'
   // Only a workshop that switched the type key on sees the two boxes; a hidden
   // Only a workshop that switched the type key on sees the two boxes; a hidden
@@ -412,6 +435,16 @@ export function VehicleForm({
     // their change would overwrite what the user has since typed.
     // their change would overwrite what the user has since typed.
     // eslint-disable-next-line react-hooks/exhaustive-deps
     // eslint-disable-next-line react-hooks/exhaustive-deps
   }, [open, vehicle, initialLookup])
   }, [open, vehicle, initialLookup])
+  useEffect(() => {
+    if (!open || vehicle || initialPlate === undefined) return
+    const frame = requestAnimationFrame(() => {
+      const input = formRef.current?.elements.namedItem('licensePlate') as HTMLInputElement | null
+      if (!input) return
+      if (initialPlate && !input.value) input.value = initialPlate
+      input.focus()
+    })
+    return () => cancelAnimationFrame(frame)
+  }, [open, vehicle, initialPlate])
   useEffect(() => {
   useEffect(() => {
     if (!open) {
     if (!open) {
       appliedLookupRef.current = null
       appliedLookupRef.current = null
@@ -531,10 +564,44 @@ export function VehicleForm({
         : await createVehicle(payload)
         : await createVehicle(payload)
 
 
       if (result.success) {
       if (result.success) {
-        toast.success(vehicle ? t('vehicleUpdated') : t('vehicleAdded'))
+        // The vehicle as a picker shows it, with the owner it was saved under:
+        // the one chosen, or the keeper off the papers just made a customer.
+        const saved = !vehicle && result.data && 'make' in result.data ? result.data : null
+        const owner = selectedCustomer
+        const created: BookingVehicle | null = saved
+          ? {
+              id: saved.id,
+              make: saved.make,
+              model: saved.model,
+              year: saved.year,
+              licensePlate: saved.licensePlate,
+              customerId: saved.customerId,
+              customer: saved.customerId
+                ? {
+                    id: saved.customerId,
+                    name: owner?.id === saved.customerId ? owner.name : (scannedOwner?.name ?? ''),
+                  }
+                : null,
+            }
+          : null
+        if (created && !onCreated && canBook) {
+          // Never a dead end: a vehicle added on its own can be booked in
+          // straight from the confirmation.
+          toast.success(t('vehicleAdded'), {
+            action: {
+              label: t('bookAppointment'),
+              onClick: () => openBooking({ vehicle: created }),
+            },
+          })
+        } else {
+          toast.success(vehicle ? t('vehicleUpdated') : t('vehicleAdded'))
+        }
         onOpenChange(false)
         onOpenChange(false)
         setImageFile(null)
         setImageFile(null)
-        router.refresh()
+        // A caller that goes on with the vehicle shows it itself; anywhere
+        // else the page underneath is read again to list it.
+        if (created && onCreated) onCreated(created)
+        else router.refresh()
       } else {
       } else {
         modal.open('error', 'Error', result.error || t('saveError'))
         modal.open('error', 'Error', result.error || t('saveError'))
       }
       }
@@ -591,6 +658,7 @@ export function VehicleForm({
     vehicle.inspectionStatus.source !== 'manual' &&
     vehicle.inspectionStatus.source !== 'manual' &&
     inspectionDraft === openedInspectionDue
     inspectionDraft === openedInspectionDue
   const vinLength = vinDraft.trim().length
   const vinLength = vinDraft.trim().length
+  const addTitle = isMarine ? t('addTitleMarine') : t('addTitle')
   const swatch = cssColor(colorDraft)
   const swatch = cssColor(colorDraft)
 
 
   return (
   return (
@@ -620,11 +688,11 @@ export function VehicleForm({
                       {`${vehicle.make} ${vehicle.model}`.trim()}
                       {`${vehicle.make} ${vehicle.model}`.trim()}
                     </>
                     </>
                   ) : (
                   ) : (
-                    t('addTitle')
+                    addTitle
                   )}
                   )}
                 </DialogTitle>
                 </DialogTitle>
                 <DialogDescription className={vehicleSummary ? 'text-[13px]' : 'sr-only'}>
                 <DialogDescription className={vehicleSummary ? 'text-[13px]' : 'sr-only'}>
-                  {vehicleSummary || (vehicle ? t('editTitle') : t('addTitle'))}
+                  {vehicleSummary || (vehicle ? t('editTitle') : addTitle)}
                 </DialogDescription>
                 </DialogDescription>
               </div>
               </div>
               <DocsLink href="/docs/features/vehicles" variant="hint" className="mt-1 shrink-0" />
               <DocsLink href="/docs/features/vehicles" variant="hint" className="mt-1 shrink-0" />
@@ -714,6 +782,7 @@ export function VehicleForm({
                     </Label>
                     </Label>
                     <CustomerCombobox
                     <CustomerCombobox
                       showAvatar
                       showAvatar
+                      disabled={ownerLocked}
                       value={selectedCustomerId === 'none' ? '' : selectedCustomerId}
                       value={selectedCustomerId === 'none' ? '' : selectedCustomerId}
                       initialCustomer={selectedCustomer}
                       initialCustomer={selectedCustomer}
                       // A customer given by id alone is named once the lookup below answers
                       // A customer given by id alone is named once the lookup below answers
@@ -906,6 +975,21 @@ export function VehicleForm({
                         placeholder="ABC-1234"
                         placeholder="ABC-1234"
                         defaultValue={vehicle?.licensePlate ?? ''}
                         defaultValue={vehicle?.licensePlate ?? ''}
                         className="flex-1"
                         className="flex-1"
+                        // Enter in the plate asks the registry, where one is
+                        // connected, instead of trying to save half a form.
+                        onKeyDown={(e) => {
+                          if (e.key !== 'Enter') return
+                          const lookup = formRef.current?.querySelector<HTMLButtonElement>(
+                            'button[data-lookup="plate"]'
+                          )
+                          // No registry: Enter is the form's own.
+                          if (!lookup || (lookup.disabled && !lookup.dataset.busy)) return
+                          // A second Enter while the registry is still
+                          // answering must not save the form under it; a
+                          // click on the busy button does nothing.
+                          e.preventDefault()
+                          lookup.click()
+                        }}
                       />
                       />
                       {!isMarine && (
                       {!isMarine && (
                         <VehicleLookupButton
                         <VehicleLookupButton
@@ -1192,7 +1276,7 @@ export function VehicleForm({
               </Button>
               </Button>
               <Button data-save-shortcut type="submit" disabled={loading || ownerLookupPending}>
               <Button data-save-shortcut type="submit" disabled={loading || ownerLookupPending}>
                 {loading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
                 {loading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
-                {vehicle ? tc('saveChanges') : t('addTitle')}
+                {vehicle ? tc('saveChanges') : addTitle}
               </Button>
               </Button>
             </DialogFooter>
             </DialogFooter>
           </form>
           </form>
@@ -1332,7 +1416,7 @@ function cssColor(name: string): string | null {
 /** A titled card holding one group of the form's fields. */
 /** A titled card holding one group of the form's fields. */
 function FormCard({ title, children }: { title: string; children: React.ReactNode }) {
 function FormCard({ title, children }: { title: string; children: React.ReactNode }) {
   return (
   return (
-    <section className="rounded-xl border bg-card">
+    <section className="min-w-0 rounded-xl border bg-card">
       <h3 className="border-b px-4 py-2.5 text-[11px] font-semibold uppercase tracking-[0.07em] text-muted-foreground">
       <h3 className="border-b px-4 py-2.5 text-[11px] font-semibold uppercase tracking-[0.07em] text-muted-foreground">
         {title}
         {title}
       </h3>
       </h3>

+ 2 - 0
src/features/vehicles/Components/VehicleLookupButton.tsx

@@ -104,6 +104,8 @@ export function VehicleLookupButton({
             variant="outline"
             variant="outline"
             size={text ? 'default' : 'icon'}
             size={text ? 'default' : 'icon'}
             aria-label={label}
             aria-label={label}
+            data-lookup={by}
+            data-busy={busy || undefined}
             onClick={handleClick}
             onClick={handleClick}
             disabled={busy || !available}
             disabled={busy || !available}
             className={text ? 'gap-1.5 px-3' : undefined}
             className={text ? 'gap-1.5 px-3' : undefined}

+ 10 - 0
src/features/vehicles/Lib/plate.ts

@@ -12,3 +12,13 @@ export function looksLikePlate(plate: string): boolean {
   const compact = compactPlate(plate)
   const compact = compactPlate(plate)
   return compact.length >= 2 && compact.length <= 12
   return compact.length >= 2 && compact.length <= 12
 }
 }
+
+/**
+ * The plate in a vehicle search that found nothing, for the new vehicle that
+ * follows: a plate has a digit in it, which a make or a customer's name does
+ * not. Empty when the search was for something else.
+ */
+export function plateFromSearch(search: string): string {
+  const typed = search.trim().toUpperCase()
+  return /\d/.test(typed) && looksLikePlate(typed) ? typed : ''
+}