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

Say why scanning or plate lookup is unavailable in the vehicle form (#667)

* Say why the scan and plate lookup buttons are off, beside them

* Offer the setup links only to people the settings pages let in
Bernt Christian Egeland 5 дней назад
Родитель
Сommit
35657e4982

+ 8 - 2
messages/bg/vehicles.json

@@ -432,7 +432,10 @@
     "ownerMatchScore": "{percent}% съвпадение",
     "ownerMatchScore": "{percent}% съвпадение",
     "ownerMatchCreateNew": "Създай нов клиент",
     "ownerMatchCreateNew": "Създай нов клиент",
     "ownerMatchChoose": "Избери клиент",
     "ownerMatchChoose": "Избери клиент",
-    "scanUnavailable": "Активирайте AI в настройките",
+    "scanNeedsAi": "За сканирането е нужен доставчик на AI.",
+    "scanNeedsAiAsk": "За сканирането е нужен доставчик на AI. Помолете администратор да настрои такъв.",
+    "scanSetUpAi": "Настройте AI",
+    "scanNotInPlan": "Сканирането не е включено във вашия план.",
     "sectionAssignment": "Снимка и собственик",
     "sectionAssignment": "Снимка и собственик",
     "sectionDetails": "Данни",
     "sectionDetails": "Данни",
     "addScannedOwner": "Добави клиент {name}",
     "addScannedOwner": "Добави клиент {name}",
@@ -442,7 +445,10 @@
     "lookupSuccess": "Полетата са попълнени от {source}",
     "lookupSuccess": "Полетата са попълнени от {source}",
     "lookupNotFound": "В регистъра няма превозно средство с този регистрационен номер",
     "lookupNotFound": "В регистъра няма превозно средство с този регистрационен номер",
     "lookupFailed": "Справката по регистрационен номер е неуспешна",
     "lookupFailed": "Справката по регистрационен номер е неуспешна",
-    "lookupUnavailable": "Свържете регистър на превозните средства от Настройки → Интеграции",
+    "lookupNeedsRegistry": "За проверката на номера е нужен регистър на превозните средства.",
+    "lookupNeedsRegistryAsk": "За проверката на номера е нужен регистър на превозните средства. Помолете администратор да свърже такъв.",
+    "lookupConnectRegistry": "Свържете регистър",
+    "lookupNotInPlan": "Проверката на номера не е включена във вашия план.",
     "lookupEnterPlate": "Първо въведете регистрационен номер",
     "lookupEnterPlate": "Първо въведете регистрационен номер",
     "lookupInspectionDue": "{source}: следващата периодична инспекция е до {date}",
     "lookupInspectionDue": "{source}: следващата периодична инспекция е до {date}",
     "lookupSource": "Попълнено от {source}",
     "lookupSource": "Попълнено от {source}",

+ 8 - 2
messages/de/vehicles.json

@@ -432,7 +432,10 @@
     "ownerMatchScore": "{percent}% Übereinstimmung",
     "ownerMatchScore": "{percent}% Übereinstimmung",
     "ownerMatchCreateNew": "Neuen Kunden anlegen",
     "ownerMatchCreateNew": "Neuen Kunden anlegen",
     "ownerMatchChoose": "Kunde auswählen",
     "ownerMatchChoose": "Kunde auswählen",
-    "scanUnavailable": "KI in den Einstellungen aktivieren",
+    "scanNeedsAi": "Zum Scannen wird ein KI-Anbieter benötigt.",
+    "scanNeedsAiAsk": "Zum Scannen wird ein KI-Anbieter benötigt. Bitten Sie einen Administrator, einen einzurichten.",
+    "scanSetUpAi": "KI einrichten",
+    "scanNotInPlan": "Das Scannen ist in Ihrem Tarif nicht enthalten.",
     "sectionAssignment": "Foto und Halter",
     "sectionAssignment": "Foto und Halter",
     "sectionDetails": "Details",
     "sectionDetails": "Details",
     "addScannedOwner": "Kunde {name} anlegen",
     "addScannedOwner": "Kunde {name} anlegen",
@@ -442,7 +445,10 @@
     "lookupSuccess": "Felder aus {source} ausgefüllt",
     "lookupSuccess": "Felder aus {source} ausgefüllt",
     "lookupNotFound": "Das Register kennt kein Fahrzeug mit diesem Kennzeichen",
     "lookupNotFound": "Das Register kennt kein Fahrzeug mit diesem Kennzeichen",
     "lookupFailed": "Kennzeichen konnte nicht nachgeschlagen werden",
     "lookupFailed": "Kennzeichen konnte nicht nachgeschlagen werden",
-    "lookupUnavailable": "Verbinden Sie ein Fahrzeugregister unter Einstellungen → Integrationen",
+    "lookupNeedsRegistry": "Für die Kennzeichenabfrage wird ein Fahrzeugregister benötigt.",
+    "lookupNeedsRegistryAsk": "Für die Kennzeichenabfrage wird ein Fahrzeugregister benötigt. Bitten Sie einen Administrator, eines zu verbinden.",
+    "lookupConnectRegistry": "Register verbinden",
+    "lookupNotInPlan": "Die Kennzeichenabfrage ist in Ihrem Tarif nicht enthalten.",
     "lookupEnterPlate": "Geben Sie zuerst ein Kennzeichen ein",
     "lookupEnterPlate": "Geben Sie zuerst ein Kennzeichen ein",
     "lookupInspectionDue": "{source}: nächste Hauptuntersuchung fällig am {date}",
     "lookupInspectionDue": "{source}: nächste Hauptuntersuchung fällig am {date}",
     "lookupSource": "Ausgefüllt aus {source}",
     "lookupSource": "Ausgefüllt aus {source}",

+ 8 - 2
messages/en/vehicles.json

@@ -432,7 +432,10 @@
     "ownerMatchScore": "{percent}% match",
     "ownerMatchScore": "{percent}% match",
     "ownerMatchCreateNew": "Create new customer",
     "ownerMatchCreateNew": "Create new customer",
     "ownerMatchChoose": "Choose customer",
     "ownerMatchChoose": "Choose customer",
-    "scanUnavailable": "Enable AI in settings",
+    "scanNeedsAi": "Scanning needs an AI provider.",
+    "scanNeedsAiAsk": "Scanning needs an AI provider. Ask an admin to set one up.",
+    "scanSetUpAi": "Set up AI",
+    "scanNotInPlan": "Scanning is not included in your plan.",
     "sectionAssignment": "Photo and owner",
     "sectionAssignment": "Photo and owner",
     "sectionDetails": "Details",
     "sectionDetails": "Details",
     "addScannedOwner": "Add customer {name}",
     "addScannedOwner": "Add customer {name}",
@@ -442,7 +445,10 @@
     "lookupSuccess": "Fields filled from {source}",
     "lookupSuccess": "Fields filled from {source}",
     "lookupNotFound": "The registry has no vehicle with that plate",
     "lookupNotFound": "The registry has no vehicle with that plate",
     "lookupFailed": "Could not look up the plate",
     "lookupFailed": "Could not look up the plate",
-    "lookupUnavailable": "Connect a vehicle registry under Settings → Integrations",
+    "lookupNeedsRegistry": "Plate lookup needs a vehicle registry.",
+    "lookupNeedsRegistryAsk": "Plate lookup needs a vehicle registry. Ask an admin to connect one.",
+    "lookupConnectRegistry": "Connect one",
+    "lookupNotInPlan": "Plate lookup is not included in your plan.",
     "lookupEnterPlate": "Type a plate first",
     "lookupEnterPlate": "Type a plate first",
     "lookupInspectionDue": "{source}: next periodic inspection due {date}",
     "lookupInspectionDue": "{source}: next periodic inspection due {date}",
     "lookupSource": "Filled from {source}",
     "lookupSource": "Filled from {source}",

+ 8 - 2
messages/es/vehicles.json

@@ -432,7 +432,10 @@
     "ownerMatchScore": "{percent}% de coincidencia",
     "ownerMatchScore": "{percent}% de coincidencia",
     "ownerMatchCreateNew": "Crear cliente nuevo",
     "ownerMatchCreateNew": "Crear cliente nuevo",
     "ownerMatchChoose": "Elegir cliente",
     "ownerMatchChoose": "Elegir cliente",
-    "scanUnavailable": "Activa la IA en los ajustes",
+    "scanNeedsAi": "El escaneo necesita un proveedor de IA.",
+    "scanNeedsAiAsk": "El escaneo necesita un proveedor de IA. Pide a un administrador que lo configure.",
+    "scanSetUpAi": "Configurar IA",
+    "scanNotInPlan": "El escaneo no está incluido en tu plan.",
     "sectionAssignment": "Foto y titular",
     "sectionAssignment": "Foto y titular",
     "sectionDetails": "Detalles",
     "sectionDetails": "Detalles",
     "addScannedOwner": "Añadir el cliente {name}",
     "addScannedOwner": "Añadir el cliente {name}",
@@ -442,7 +445,10 @@
     "lookupSuccess": "Campos rellenados desde {source}",
     "lookupSuccess": "Campos rellenados desde {source}",
     "lookupNotFound": "El registro no tiene ningún vehículo con esa matrícula",
     "lookupNotFound": "El registro no tiene ningún vehículo con esa matrícula",
     "lookupFailed": "No se pudo buscar la matrícula",
     "lookupFailed": "No se pudo buscar la matrícula",
-    "lookupUnavailable": "Conecta un registro de vehículos en Ajustes → Integraciones",
+    "lookupNeedsRegistry": "La búsqueda de matrícula necesita un registro de vehículos.",
+    "lookupNeedsRegistryAsk": "La búsqueda de matrícula necesita un registro de vehículos. Pide a un administrador que conecte uno.",
+    "lookupConnectRegistry": "Conectar uno",
+    "lookupNotInPlan": "La búsqueda de matrícula no está incluida en tu plan.",
     "lookupEnterPlate": "Escribe primero una matrícula",
     "lookupEnterPlate": "Escribe primero una matrícula",
     "lookupInspectionDue": "{source}: próxima inspección periódica el {date}",
     "lookupInspectionDue": "{source}: próxima inspección periódica el {date}",
     "lookupSource": "Rellenado desde {source}",
     "lookupSource": "Rellenado desde {source}",

+ 8 - 2
messages/fr/vehicles.json

@@ -432,7 +432,10 @@
     "ownerMatchScore": "{percent}% de correspondance",
     "ownerMatchScore": "{percent}% de correspondance",
     "ownerMatchCreateNew": "Créer un nouveau client",
     "ownerMatchCreateNew": "Créer un nouveau client",
     "ownerMatchChoose": "Choisir un client",
     "ownerMatchChoose": "Choisir un client",
-    "scanUnavailable": "Activez l'IA dans les paramètres",
+    "scanNeedsAi": "Le scan nécessite un fournisseur d'IA.",
+    "scanNeedsAiAsk": "Le scan nécessite un fournisseur d'IA. Demandez à un administrateur d'en configurer un.",
+    "scanSetUpAi": "Configurer l'IA",
+    "scanNotInPlan": "Le scan n'est pas inclus dans votre formule.",
     "sectionAssignment": "Photo et titulaire",
     "sectionAssignment": "Photo et titulaire",
     "sectionDetails": "Détails",
     "sectionDetails": "Détails",
     "addScannedOwner": "Ajouter le client {name}",
     "addScannedOwner": "Ajouter le client {name}",
@@ -442,7 +445,10 @@
     "lookupSuccess": "Champs remplis depuis {source}",
     "lookupSuccess": "Champs remplis depuis {source}",
     "lookupNotFound": "Le registre ne connaît aucun véhicule avec cette plaque",
     "lookupNotFound": "Le registre ne connaît aucun véhicule avec cette plaque",
     "lookupFailed": "Impossible de rechercher la plaque",
     "lookupFailed": "Impossible de rechercher la plaque",
-    "lookupUnavailable": "Connectez un registre des véhicules dans Paramètres → Intégrations",
+    "lookupNeedsRegistry": "La recherche de plaque nécessite un registre des véhicules.",
+    "lookupNeedsRegistryAsk": "La recherche de plaque nécessite un registre des véhicules. Demandez à un administrateur d'en connecter un.",
+    "lookupConnectRegistry": "En connecter un",
+    "lookupNotInPlan": "La recherche de plaque n'est pas incluse dans votre formule.",
     "lookupEnterPlate": "Saisissez d'abord une plaque",
     "lookupEnterPlate": "Saisissez d'abord une plaque",
     "lookupInspectionDue": "{source} : prochain contrôle périodique le {date}",
     "lookupInspectionDue": "{source} : prochain contrôle périodique le {date}",
     "lookupSource": "Rempli depuis {source}",
     "lookupSource": "Rempli depuis {source}",

+ 8 - 2
messages/it/vehicles.json

@@ -432,7 +432,10 @@
     "ownerMatchScore": "{percent}% di corrispondenza",
     "ownerMatchScore": "{percent}% di corrispondenza",
     "ownerMatchCreateNew": "Crea nuovo cliente",
     "ownerMatchCreateNew": "Crea nuovo cliente",
     "ownerMatchChoose": "Scegli cliente",
     "ownerMatchChoose": "Scegli cliente",
-    "scanUnavailable": "Attiva l'IA nelle impostazioni",
+    "scanNeedsAi": "La scansione richiede un fornitore di IA.",
+    "scanNeedsAiAsk": "La scansione richiede un fornitore di IA. Chiedi a un amministratore di configurarne uno.",
+    "scanSetUpAi": "Configura l'IA",
+    "scanNotInPlan": "La scansione non è inclusa nel tuo piano.",
     "sectionAssignment": "Foto e intestatario",
     "sectionAssignment": "Foto e intestatario",
     "sectionDetails": "Dettagli",
     "sectionDetails": "Dettagli",
     "addScannedOwner": "Aggiungi il cliente {name}",
     "addScannedOwner": "Aggiungi il cliente {name}",
@@ -442,7 +445,10 @@
     "lookupSuccess": "Campi compilati da {source}",
     "lookupSuccess": "Campi compilati da {source}",
     "lookupNotFound": "Il registro non ha alcun veicolo con questa targa",
     "lookupNotFound": "Il registro non ha alcun veicolo con questa targa",
     "lookupFailed": "Impossibile cercare la targa",
     "lookupFailed": "Impossibile cercare la targa",
-    "lookupUnavailable": "Collega un registro veicoli in Impostazioni → Integrazioni",
+    "lookupNeedsRegistry": "La ricerca della targa richiede un registro veicoli.",
+    "lookupNeedsRegistryAsk": "La ricerca della targa richiede un registro veicoli. Chiedi a un amministratore di collegarne uno.",
+    "lookupConnectRegistry": "Collegane uno",
+    "lookupNotInPlan": "La ricerca della targa non è inclusa nel tuo piano.",
     "lookupEnterPlate": "Inserisci prima una targa",
     "lookupEnterPlate": "Inserisci prima una targa",
     "lookupInspectionDue": "{source}: prossima revisione periodica il {date}",
     "lookupInspectionDue": "{source}: prossima revisione periodica il {date}",
     "lookupSource": "Compilato da {source}",
     "lookupSource": "Compilato da {source}",

+ 8 - 2
messages/lt/vehicles.json

@@ -432,7 +432,10 @@
     "ownerMatchScore": "{percent}% atitikmuo",
     "ownerMatchScore": "{percent}% atitikmuo",
     "ownerMatchCreateNew": "Sukurti naują klientą",
     "ownerMatchCreateNew": "Sukurti naują klientą",
     "ownerMatchChoose": "Pasirinkti klientą",
     "ownerMatchChoose": "Pasirinkti klientą",
-    "scanUnavailable": "Įjunkite DI nustatymuose",
+    "scanNeedsAi": "Skenavimui reikia DI teikėjo.",
+    "scanNeedsAiAsk": "Skenavimui reikia DI teikėjo. Paprašykite administratoriaus jį nustatyti.",
+    "scanSetUpAi": "Nustatyti DI",
+    "scanNotInPlan": "Skenavimas neįtrauktas į jūsų planą.",
     "sectionAssignment": "Nuotrauka ir savininkas",
     "sectionAssignment": "Nuotrauka ir savininkas",
     "sectionDetails": "Duomenys",
     "sectionDetails": "Duomenys",
     "addScannedOwner": "Pridėti klientą {name}",
     "addScannedOwner": "Pridėti klientą {name}",
@@ -442,7 +445,10 @@
     "lookupSuccess": "Laukai užpildyti iš {source}",
     "lookupSuccess": "Laukai užpildyti iš {source}",
     "lookupNotFound": "Registre nėra transporto priemonės su tokiu numeriu",
     "lookupNotFound": "Registre nėra transporto priemonės su tokiu numeriu",
     "lookupFailed": "Nepavyko rasti numerio",
     "lookupFailed": "Nepavyko rasti numerio",
-    "lookupUnavailable": "Prijunkite transporto priemonių registrą skiltyje Nustatymai → Integracijos",
+    "lookupNeedsRegistry": "Paieškai pagal numerį reikia transporto priemonių registro.",
+    "lookupNeedsRegistryAsk": "Paieškai pagal numerį reikia transporto priemonių registro. Paprašykite administratoriaus jį prijungti.",
+    "lookupConnectRegistry": "Prijungti registrą",
+    "lookupNotInPlan": "Paieška pagal numerį neįtraukta į jūsų planą.",
     "lookupEnterPlate": "Pirmiausia įveskite numerį",
     "lookupEnterPlate": "Pirmiausia įveskite numerį",
     "lookupInspectionDue": "{source}: kita techninė apžiūra iki {date}",
     "lookupInspectionDue": "{source}: kita techninė apžiūra iki {date}",
     "lookupSource": "Užpildyta iš {source}",
     "lookupSource": "Užpildyta iš {source}",

+ 8 - 2
messages/nb/vehicles.json

@@ -432,7 +432,10 @@
     "ownerMatchScore": "{percent}% treff",
     "ownerMatchScore": "{percent}% treff",
     "ownerMatchCreateNew": "Opprett ny kunde",
     "ownerMatchCreateNew": "Opprett ny kunde",
     "ownerMatchChoose": "Velg kunde",
     "ownerMatchChoose": "Velg kunde",
-    "scanUnavailable": "Aktiver KI i innstillingene",
+    "scanNeedsAi": "Skanning krever en KI-leverandør.",
+    "scanNeedsAiAsk": "Skanning krever en KI-leverandør. Be en administrator om å sette opp en.",
+    "scanSetUpAi": "Sett opp KI",
+    "scanNotInPlan": "Skanning er ikke inkludert i abonnementet ditt.",
     "sectionAssignment": "Bilde og eier",
     "sectionAssignment": "Bilde og eier",
     "sectionDetails": "Detaljer",
     "sectionDetails": "Detaljer",
     "addScannedOwner": "Legg til kunden {name}",
     "addScannedOwner": "Legg til kunden {name}",
@@ -442,7 +445,10 @@
     "lookupSuccess": "Feltene er fylt ut fra {source}",
     "lookupSuccess": "Feltene er fylt ut fra {source}",
     "lookupNotFound": "Registeret har ingen kjøretøy med det skiltet",
     "lookupNotFound": "Registeret har ingen kjøretøy med det skiltet",
     "lookupFailed": "Kunne ikke slå opp skiltet",
     "lookupFailed": "Kunne ikke slå opp skiltet",
-    "lookupUnavailable": "Koble til et kjøretøyregister under Innstillinger → Integrasjoner",
+    "lookupNeedsRegistry": "Skiltoppslag krever et kjøretøyregister.",
+    "lookupNeedsRegistryAsk": "Skiltoppslag krever et kjøretøyregister. Be en administrator om å koble til et.",
+    "lookupConnectRegistry": "Koble til et",
+    "lookupNotInPlan": "Skiltoppslag er ikke inkludert i abonnementet ditt.",
     "lookupEnterPlate": "Skriv inn et registreringsnummer først",
     "lookupEnterPlate": "Skriv inn et registreringsnummer først",
     "lookupInspectionDue": "{source}: frist for EU-kontroll {date}",
     "lookupInspectionDue": "{source}: frist for EU-kontroll {date}",
     "lookupSource": "Fylt ut fra {source}",
     "lookupSource": "Fylt ut fra {source}",

+ 8 - 2
messages/nl/vehicles.json

@@ -432,7 +432,10 @@
     "ownerMatchScore": "{percent}% overeenkomst",
     "ownerMatchScore": "{percent}% overeenkomst",
     "ownerMatchCreateNew": "Nieuwe klant aanmaken",
     "ownerMatchCreateNew": "Nieuwe klant aanmaken",
     "ownerMatchChoose": "Klant kiezen",
     "ownerMatchChoose": "Klant kiezen",
-    "scanUnavailable": "Schakel AI in bij instellingen",
+    "scanNeedsAi": "Scannen vereist een AI-aanbieder.",
+    "scanNeedsAiAsk": "Scannen vereist een AI-aanbieder. Vraag een beheerder er een in te stellen.",
+    "scanSetUpAi": "AI instellen",
+    "scanNotInPlan": "Scannen zit niet in je abonnement.",
     "sectionAssignment": "Foto en eigenaar",
     "sectionAssignment": "Foto en eigenaar",
     "sectionDetails": "Details",
     "sectionDetails": "Details",
     "addScannedOwner": "Klant {name} toevoegen",
     "addScannedOwner": "Klant {name} toevoegen",
@@ -442,7 +445,10 @@
     "lookupSuccess": "Velden ingevuld vanuit {source}",
     "lookupSuccess": "Velden ingevuld vanuit {source}",
     "lookupNotFound": "Het register kent geen voertuig met dit kenteken",
     "lookupNotFound": "Het register kent geen voertuig met dit kenteken",
     "lookupFailed": "Kenteken kon niet worden opgezocht",
     "lookupFailed": "Kenteken kon niet worden opgezocht",
-    "lookupUnavailable": "Koppel een voertuigregister onder Instellingen → Integraties",
+    "lookupNeedsRegistry": "Kenteken opzoeken vereist een voertuigregister.",
+    "lookupNeedsRegistryAsk": "Kenteken opzoeken vereist een voertuigregister. Vraag een beheerder er een te koppelen.",
+    "lookupConnectRegistry": "Koppel er een",
+    "lookupNotInPlan": "Kenteken opzoeken zit niet in je abonnement.",
     "lookupEnterPlate": "Voer eerst een kenteken in",
     "lookupEnterPlate": "Voer eerst een kenteken in",
     "lookupInspectionDue": "{source}: volgende periodieke keuring op {date}",
     "lookupInspectionDue": "{source}: volgende periodieke keuring op {date}",
     "lookupSource": "Ingevuld vanuit {source}",
     "lookupSource": "Ingevuld vanuit {source}",

+ 8 - 2
messages/pl/vehicles.json

@@ -432,7 +432,10 @@
     "ownerMatchScore": "{percent}% zgodności",
     "ownerMatchScore": "{percent}% zgodności",
     "ownerMatchCreateNew": "Utwórz nowego klienta",
     "ownerMatchCreateNew": "Utwórz nowego klienta",
     "ownerMatchChoose": "Wybierz klienta",
     "ownerMatchChoose": "Wybierz klienta",
-    "scanUnavailable": "Włącz AI w ustawieniach",
+    "scanNeedsAi": "Skanowanie wymaga dostawcy AI.",
+    "scanNeedsAiAsk": "Skanowanie wymaga dostawcy AI. Poproś administratora o skonfigurowanie go.",
+    "scanSetUpAi": "Skonfiguruj AI",
+    "scanNotInPlan": "Skanowanie nie jest dostępne w Twoim planie.",
     "sectionAssignment": "Zdjęcie i właściciel",
     "sectionAssignment": "Zdjęcie i właściciel",
     "sectionDetails": "Szczegóły",
     "sectionDetails": "Szczegóły",
     "addScannedOwner": "Dodaj klienta {name}",
     "addScannedOwner": "Dodaj klienta {name}",
@@ -442,7 +445,10 @@
     "lookupSuccess": "Pola uzupełnione z {source}",
     "lookupSuccess": "Pola uzupełnione z {source}",
     "lookupNotFound": "Rejestr nie zna pojazdu o tej tablicy",
     "lookupNotFound": "Rejestr nie zna pojazdu o tej tablicy",
     "lookupFailed": "Nie udało się sprawdzić tablicy",
     "lookupFailed": "Nie udało się sprawdzić tablicy",
-    "lookupUnavailable": "Podłącz rejestr pojazdów w Ustawienia → Integracje",
+    "lookupNeedsRegistry": "Sprawdzanie tablicy wymaga rejestru pojazdów.",
+    "lookupNeedsRegistryAsk": "Sprawdzanie tablicy wymaga rejestru pojazdów. Poproś administratora o podłączenie go.",
+    "lookupConnectRegistry": "Podłącz rejestr",
+    "lookupNotInPlan": "Sprawdzanie tablicy nie jest dostępne w Twoim planie.",
     "lookupEnterPlate": "Najpierw wpisz numer tablicy",
     "lookupEnterPlate": "Najpierw wpisz numer tablicy",
     "lookupInspectionDue": "{source}: następny przegląd okresowy do {date}",
     "lookupInspectionDue": "{source}: następny przegląd okresowy do {date}",
     "lookupSource": "Uzupełniono z {source}",
     "lookupSource": "Uzupełniono z {source}",

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

@@ -432,7 +432,10 @@
     "ownerMatchScore": "{percent}% de correspondência",
     "ownerMatchScore": "{percent}% de correspondência",
     "ownerMatchCreateNew": "Criar novo cliente",
     "ownerMatchCreateNew": "Criar novo cliente",
     "ownerMatchChoose": "Escolher cliente",
     "ownerMatchChoose": "Escolher cliente",
-    "scanUnavailable": "Ative a IA nas configurações",
+    "scanNeedsAi": "O escaneamento precisa de um provedor de IA.",
+    "scanNeedsAiAsk": "O escaneamento precisa de um provedor de IA. Peça a um administrador para configurar um.",
+    "scanSetUpAi": "Configurar IA",
+    "scanNotInPlan": "O escaneamento não está incluído no seu plano.",
     "sectionAssignment": "Foto e proprietário",
     "sectionAssignment": "Foto e proprietário",
     "sectionDetails": "Detalhes",
     "sectionDetails": "Detalhes",
     "addScannedOwner": "Adicionar o cliente {name}",
     "addScannedOwner": "Adicionar o cliente {name}",
@@ -442,7 +445,10 @@
     "lookupSuccess": "Campos preenchidos de {source}",
     "lookupSuccess": "Campos preenchidos de {source}",
     "lookupNotFound": "O registro não tem nenhum veículo com essa placa",
     "lookupNotFound": "O registro não tem nenhum veículo com essa placa",
     "lookupFailed": "Não foi possível consultar a placa",
     "lookupFailed": "Não foi possível consultar a placa",
-    "lookupUnavailable": "Conecte um registro de veículos em Configurações → Integrações",
+    "lookupNeedsRegistry": "A consulta de placa precisa de um registro de veículos.",
+    "lookupNeedsRegistryAsk": "A consulta de placa precisa de um registro de veículos. Peça a um administrador para conectar um.",
+    "lookupConnectRegistry": "Conectar um",
+    "lookupNotInPlan": "A consulta de placa não está incluída no seu plano.",
     "lookupEnterPlate": "Digite uma placa primeiro",
     "lookupEnterPlate": "Digite uma placa primeiro",
     "lookupInspectionDue": "{source}: próxima inspeção periódica em {date}",
     "lookupInspectionDue": "{source}: próxima inspeção periódica em {date}",
     "lookupSource": "Preenchido de {source}",
     "lookupSource": "Preenchido de {source}",

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

@@ -432,7 +432,10 @@
     "ownerMatchScore": "{percent}% de correspondência",
     "ownerMatchScore": "{percent}% de correspondência",
     "ownerMatchCreateNew": "Criar novo cliente",
     "ownerMatchCreateNew": "Criar novo cliente",
     "ownerMatchChoose": "Escolher cliente",
     "ownerMatchChoose": "Escolher cliente",
-    "scanUnavailable": "Ative a IA nas definições",
+    "scanNeedsAi": "A digitalização precisa de um fornecedor de IA.",
+    "scanNeedsAiAsk": "A digitalização precisa de um fornecedor de IA. Peça a um administrador para configurar um.",
+    "scanSetUpAi": "Configurar IA",
+    "scanNotInPlan": "A digitalização não está incluída no seu plano.",
     "sectionAssignment": "Fotografia e proprietário",
     "sectionAssignment": "Fotografia e proprietário",
     "sectionDetails": "Detalhes",
     "sectionDetails": "Detalhes",
     "addScannedOwner": "Adicionar o cliente {name}",
     "addScannedOwner": "Adicionar o cliente {name}",
@@ -442,7 +445,10 @@
     "lookupSuccess": "Campos preenchidos a partir de {source}",
     "lookupSuccess": "Campos preenchidos a partir de {source}",
     "lookupNotFound": "O registo não tem nenhuma viatura com essa matrícula",
     "lookupNotFound": "O registo não tem nenhuma viatura com essa matrícula",
     "lookupFailed": "Não foi possível consultar a matrícula",
     "lookupFailed": "Não foi possível consultar a matrícula",
-    "lookupUnavailable": "Ligue um registo automóvel em Definições → Integrações",
+    "lookupNeedsRegistry": "A consulta de matrícula precisa de um registo automóvel.",
+    "lookupNeedsRegistryAsk": "A consulta de matrícula precisa de um registo automóvel. Peça a um administrador para ligar um.",
+    "lookupConnectRegistry": "Ligar um",
+    "lookupNotInPlan": "A consulta de matrícula não está incluída no seu plano.",
     "lookupEnterPlate": "Introduza primeiro uma matrícula",
     "lookupEnterPlate": "Introduza primeiro uma matrícula",
     "lookupInspectionDue": "{source}: próxima inspeção periódica a {date}",
     "lookupInspectionDue": "{source}: próxima inspeção periódica a {date}",
     "lookupSource": "Preenchido a partir de {source}",
     "lookupSource": "Preenchido a partir de {source}",

+ 8 - 2
messages/ru/vehicles.json

@@ -432,7 +432,10 @@
     "ownerMatchScore": "совпадение {percent}%",
     "ownerMatchScore": "совпадение {percent}%",
     "ownerMatchCreateNew": "Создать нового клиента",
     "ownerMatchCreateNew": "Создать нового клиента",
     "ownerMatchChoose": "Выбрать клиента",
     "ownerMatchChoose": "Выбрать клиента",
-    "scanUnavailable": "Включите ИИ в настройках",
+    "scanNeedsAi": "Для сканирования нужен поставщик ИИ.",
+    "scanNeedsAiAsk": "Для сканирования нужен поставщик ИИ. Попросите администратора настроить его.",
+    "scanSetUpAi": "Настроить ИИ",
+    "scanNotInPlan": "Сканирование не входит в ваш тариф.",
     "sectionAssignment": "Фото и владелец",
     "sectionAssignment": "Фото и владелец",
     "sectionDetails": "Характеристики",
     "sectionDetails": "Характеристики",
     "addScannedOwner": "Добавить клиента {name}",
     "addScannedOwner": "Добавить клиента {name}",
@@ -442,7 +445,10 @@
     "lookupSuccess": "Поля заполнены из {source}",
     "lookupSuccess": "Поля заполнены из {source}",
     "lookupNotFound": "В реестре нет автомобиля с таким номером",
     "lookupNotFound": "В реестре нет автомобиля с таким номером",
     "lookupFailed": "Не удалось найти номер",
     "lookupFailed": "Не удалось найти номер",
-    "lookupUnavailable": "Подключите реестр транспортных средств в Настройки → Интеграции",
+    "lookupNeedsRegistry": "Для поиска по номеру нужен реестр транспортных средств.",
+    "lookupNeedsRegistryAsk": "Для поиска по номеру нужен реестр транспортных средств. Попросите администратора подключить его.",
+    "lookupConnectRegistry": "Подключить реестр",
+    "lookupNotInPlan": "Поиск по номеру не входит в ваш тариф.",
     "lookupEnterPlate": "Сначала введите номер",
     "lookupEnterPlate": "Сначала введите номер",
     "lookupInspectionDue": "{source}: следующий техосмотр до {date}",
     "lookupInspectionDue": "{source}: следующий техосмотр до {date}",
     "lookupSource": "Заполнено из {source}",
     "lookupSource": "Заполнено из {source}",

+ 8 - 2
messages/tr/vehicles.json

@@ -432,7 +432,10 @@
     "ownerMatchScore": "%{percent} eşleşme",
     "ownerMatchScore": "%{percent} eşleşme",
     "ownerMatchCreateNew": "Yeni müşteri oluştur",
     "ownerMatchCreateNew": "Yeni müşteri oluştur",
     "ownerMatchChoose": "Müşteri seç",
     "ownerMatchChoose": "Müşteri seç",
-    "scanUnavailable": "Ayarlardan yapay zekayı etkinleştirin",
+    "scanNeedsAi": "Tarama için bir yapay zeka sağlayıcısı gerekir.",
+    "scanNeedsAiAsk": "Tarama için bir yapay zeka sağlayıcısı gerekir. Bir yöneticiden kurmasını isteyin.",
+    "scanSetUpAi": "Yapay zekayı kur",
+    "scanNotInPlan": "Tarama planınıza dahil değil.",
     "sectionAssignment": "Fotoğraf ve sahibi",
     "sectionAssignment": "Fotoğraf ve sahibi",
     "sectionDetails": "Ayrıntılar",
     "sectionDetails": "Ayrıntılar",
     "addScannedOwner": "{name} müşterisini ekle",
     "addScannedOwner": "{name} müşterisini ekle",
@@ -442,7 +445,10 @@
     "lookupSuccess": "Alanlar {source} kaynağından dolduruldu",
     "lookupSuccess": "Alanlar {source} kaynağından dolduruldu",
     "lookupNotFound": "Sicilde bu plakaya sahip araç yok",
     "lookupNotFound": "Sicilde bu plakaya sahip araç yok",
     "lookupFailed": "Plaka sorgulanamadı",
     "lookupFailed": "Plaka sorgulanamadı",
-    "lookupUnavailable": "Ayarlar → Entegrasyonlar altından bir araç sicili bağlayın",
+    "lookupNeedsRegistry": "Plaka sorgulama için bir araç sicili gerekir.",
+    "lookupNeedsRegistryAsk": "Plaka sorgulama için bir araç sicili gerekir. Bir yöneticiden bağlamasını isteyin.",
+    "lookupConnectRegistry": "Sicil bağla",
+    "lookupNotInPlan": "Plaka sorgulama planınıza dahil değil.",
     "lookupEnterPlate": "Önce bir plaka yazın",
     "lookupEnterPlate": "Önce bir plaka yazın",
     "lookupInspectionDue": "{source}: sonraki periyodik muayene tarihi {date}",
     "lookupInspectionDue": "{source}: sonraki periyodik muayene tarihi {date}",
     "lookupSource": "{source} kaynağından dolduruldu",
     "lookupSource": "{source} kaynağından dolduruldu",

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

@@ -55,10 +55,10 @@ vi.mock('@/features/customers/Actions/customerActions', () => ({
 }))
 }))
 vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
 vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
   aiAnalyzeVehicleDocument: vi.fn(),
   aiAnalyzeVehicleDocument: vi.fn(),
-  isVehicleScanAvailable: vi.fn(async () => ({ success: true, data: false })),
+  getVehicleScanAvailability: vi.fn(async () => ({ success: true, data: false })),
 }))
 }))
 vi.mock('@/features/integrations/Actions/vehicleLookupActions', () => ({
 vi.mock('@/features/integrations/Actions/vehicleLookupActions', () => ({
-  isVehicleLookupAvailable: vi.fn(async () => ({ success: true, data: {} })),
+  getVehicleLookupAvailability: vi.fn(async () => ({ success: true, data: {} })),
   lookupVehicle: vi.fn(),
   lookupVehicle: vi.fn(),
 }))
 }))
 vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({
 vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({

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

@@ -87,10 +87,10 @@ vi.mock('@/features/customers/Actions/customerActions', () => ({
 // the server besides saving answers "nothing here".
 // the server besides saving answers "nothing here".
 vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
 vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
   aiAnalyzeVehicleDocument: vi.fn(),
   aiAnalyzeVehicleDocument: vi.fn(),
-  isVehicleScanAvailable: vi.fn(async () => ({ success: true, data: false })),
+  getVehicleScanAvailability: vi.fn(async () => ({ success: true, data: false })),
 }))
 }))
 vi.mock('@/features/integrations/Actions/vehicleLookupActions', () => ({
 vi.mock('@/features/integrations/Actions/vehicleLookupActions', () => ({
-  isVehicleLookupAvailable: vi.fn(async () => ({ success: true, data: {} })),
+  getVehicleLookupAvailability: vi.fn(async () => ({ success: true, data: {} })),
   lookupVehicle: vi.fn(),
   lookupVehicle: vi.fn(),
 }))
 }))
 vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({
 vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({

+ 4 - 4
src/__tests__/features/fleet-custom-fields/vehicle-form-fields.test.tsx

@@ -30,12 +30,12 @@ vi.mock('@/features/customers/Actions/customerActions', () => ({
 }))
 }))
 vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
 vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
   aiAnalyzeVehicleDocument: vi.fn(),
   aiAnalyzeVehicleDocument: vi.fn(),
-  isVehicleScanAvailable: vi.fn(async () => ({ success: true, data: false })),
+  getVehicleScanAvailability: vi.fn(async () => ({ success: true, data: false })),
 }))
 }))
-const isVehicleLookupAvailable = vi.hoisted(() => vi.fn())
+const getVehicleLookupAvailability = vi.hoisted(() => vi.fn())
 const lookupVehicle = vi.hoisted(() => vi.fn())
 const lookupVehicle = vi.hoisted(() => vi.fn())
 vi.mock('@/features/integrations/Actions/vehicleLookupActions', () => ({
 vi.mock('@/features/integrations/Actions/vehicleLookupActions', () => ({
-  isVehicleLookupAvailable,
+  getVehicleLookupAvailability,
   lookupVehicle,
   lookupVehicle,
 }))
 }))
 vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({
 vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({
@@ -128,7 +128,7 @@ const pressSave = async () => {
 
 
 beforeEach(() => {
 beforeEach(() => {
   vi.clearAllMocks()
   vi.clearAllMocks()
-  isVehicleLookupAvailable.mockResolvedValue({ success: true, data: {} })
+  getVehicleLookupAvailability.mockResolvedValue({ success: true, data: {} })
   vi.mocked(updateVehicle).mockResolvedValue({ success: true } as never)
   vi.mocked(updateVehicle).mockResolvedValue({ success: true } as never)
   save.mockResolvedValue({ success: true, data: { saved: true } })
   save.mockResolvedValue({ success: true, data: { saved: true } })
   loadValues.mockResolvedValue({ success: true, data: FIELDS })
   loadValues.mockResolvedValue({ success: true, data: FIELDS })

+ 25 - 0
src/__tests__/features/integrations/vin-lookup.test.ts

@@ -23,6 +23,7 @@ vi.mock('@/lib/db', () => ({
 }))
 }))
 
 
 import {
 import {
+  getVehicleLookupAvailability,
   isVehicleLookupAvailable,
   isVehicleLookupAvailable,
   lookupVehicle,
   lookupVehicle,
 } from '@/features/integrations/Actions/vehicleLookupActions'
 } from '@/features/integrations/Actions/vehicleLookupActions'
@@ -162,6 +163,30 @@ describe('isVehicleLookupAvailable', () => {
   })
   })
 })
 })
 
 
+describe('getVehicleLookupAvailability', () => {
+  it('says no registry answers to a plate when only a VIN decoder is connected', async () => {
+    connected('nhtsa')
+    const res = await getVehicleLookupAvailability()
+    expect(res).toMatchObject({
+      success: true,
+      data: { plate: false, vin: true, reason: 'notConnected', canEditSettings: true },
+    })
+  })
+
+  it('names the plan as the reason when it has no integrations', async () => {
+    vi.mocked(getFeatures).mockResolvedValue({ integrations: false } as never)
+    connected('regcheck')
+    const res = await getVehicleLookupAvailability()
+    expect(res).toMatchObject({ success: true, data: { plate: false, reason: 'notInPlan' } })
+  })
+
+  it('gives no reason when a registry answers to a plate', async () => {
+    connected('regcheck')
+    const res = await getVehicleLookupAvailability()
+    expect(res).toMatchObject({ success: true, data: { plate: true, reason: null } })
+  })
+})
+
 describe('lookupVehicle by VIN', () => {
 describe('lookupVehicle by VIN', () => {
   it('asks the decoder with the VIN alone and records nothing on the vehicle', async () => {
   it('asks the decoder with the VIN alone and records nothing on the vehicle', async () => {
     connected('regcheck', 'nhtsa')
     connected('regcheck', 'nhtsa')

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

@@ -46,11 +46,11 @@ vi.mock('@/features/customers/Actions/customerActions', () => ({
 }))
 }))
 vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
 vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
   aiAnalyzeVehicleDocument: vi.fn(),
   aiAnalyzeVehicleDocument: vi.fn(),
-  isVehicleScanAvailable: vi.fn(async () => ({ success: true, data: false })),
+  getVehicleScanAvailability: vi.fn(async () => ({ success: true, data: false })),
 }))
 }))
 const lookupVehicle = 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: { plate: true } })),
+  getVehicleLookupAvailability: vi.fn(async () => ({ success: true, data: { plate: true } })),
   lookupVehicle,
   lookupVehicle,
 }))
 }))
 vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({
 vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({

+ 157 - 0
src/__tests__/features/vehicles/scan-lookup-unavailable.test.tsx

@@ -0,0 +1,157 @@
+/**
+ * The vehicle form's "Scan registration document" and plate lookup buttons
+ * when they cannot be used: the reason is written beside them, where a phone
+ * shows it too, with a way to switch the feature on for whoever may change
+ * settings, and the scan hint no longer promises fields that fill themselves.
+ * When they can be used, nothing of that shows.
+ */
+
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { fireEvent, render, screen, waitFor } from '@testing-library/react'
+
+const getVehicleScanAvailability = vi.hoisted(() => vi.fn())
+vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
+  aiAnalyzeVehicleDocument: vi.fn(),
+  getVehicleScanAvailability,
+}))
+const getVehicleLookupAvailability = vi.hoisted(() => vi.fn())
+vi.mock('@/features/integrations/Actions/vehicleLookupActions', () => ({
+  getVehicleLookupAvailability,
+  lookupVehicle: vi.fn(),
+}))
+const handleGated = vi.hoisted(() => vi.fn())
+vi.mock('@/components/upgrade-gate', () => ({ handleGated }))
+vi.mock('sonner', () => ({ toast: { error: vi.fn(), success: vi.fn(), loading: vi.fn() } }))
+
+import { TooltipProvider } from '@/components/ui/tooltip'
+import { ScanDocumentButton } from '@/features/vehicles/Components/ScanDocumentButton'
+import { VehicleLookupButton } from '@/features/vehicles/Components/VehicleLookupButton'
+
+const HINT = 'Photograph the vehicle papers and the fields fill in automatically.'
+
+function renderScan() {
+  return render(
+    <TooltipProvider>
+      <ScanDocumentButton onScanned={vi.fn()} stacked />
+    </TooltipProvider>
+  )
+}
+
+function renderLookup() {
+  return render(
+    <TooltipProvider>
+      <VehicleLookupButton by="plate" text="Look up" getValue={() => ''} onFound={vi.fn()} />
+    </TooltipProvider>
+  )
+}
+
+const scanButton = () => screen.getByRole('button', { name: /Scan registration document/ })
+const lookupButton = () => screen.getByRole('button', { name: 'Look up plate' })
+
+beforeEach(() => {
+  vi.clearAllMocks()
+})
+
+describe('scan registration document', () => {
+  it('says AI is missing and links to the AI providers for someone who may change settings', async () => {
+    getVehicleScanAvailability.mockResolvedValue({
+      success: true,
+      data: { available: false, reason: 'notConfigured', canEditSettings: true },
+    })
+    renderScan()
+    expect(await screen.findByText(/Scanning needs an AI provider\./)).toBeVisible()
+    expect(scanButton()).toBeDisabled()
+    expect(screen.getByRole('link', { name: 'Set up AI' })).toHaveAttribute(
+      'href',
+      '/settings/integrations?category=ai'
+    )
+    expect(screen.queryByText(HINT)).not.toBeInTheDocument()
+  })
+
+  it('gives the reason without a link to someone who may not change settings', async () => {
+    getVehicleScanAvailability.mockResolvedValue({
+      success: true,
+      data: { available: false, reason: 'notConfigured', canEditSettings: false },
+    })
+    renderScan()
+    expect(
+      await screen.findByText('Scanning needs an AI provider. Ask an admin to set one up.')
+    ).toBeVisible()
+    expect(screen.queryByRole('link')).not.toBeInTheDocument()
+    expect(screen.queryByText(HINT)).not.toBeInTheDocument()
+  })
+
+  it('offers the plans when the plan leaves AI out', async () => {
+    getVehicleScanAvailability.mockResolvedValue({
+      success: true,
+      data: { available: false, reason: 'notInPlan', canEditSettings: true },
+    })
+    renderScan()
+    expect(await screen.findByText(/Scanning is not included in your plan\./)).toBeVisible()
+    fireEvent.click(screen.getByRole('button', { name: 'View Plans' }))
+    expect(handleGated).toHaveBeenCalledWith({ gated: { feature: 'ai' } })
+  })
+
+  it('shows the hint and no reason when scanning is available', async () => {
+    getVehicleScanAvailability.mockResolvedValue({
+      success: true,
+      data: { available: true, reason: null, canEditSettings: true },
+    })
+    renderScan()
+    await waitFor(() => expect(scanButton()).toBeEnabled())
+    expect(screen.getByText(HINT)).toBeVisible()
+    expect(screen.queryByText(/needs an AI provider/)).not.toBeInTheDocument()
+    expect(screen.queryByRole('link')).not.toBeInTheDocument()
+  })
+})
+
+describe('plate lookup', () => {
+  it('says no registry is connected and links to the registries for someone who may change settings', async () => {
+    getVehicleLookupAvailability.mockResolvedValue({
+      success: true,
+      data: { plate: false, vin: false, reason: 'notConnected', canEditSettings: true },
+    })
+    renderLookup()
+    expect(await screen.findByText(/Plate lookup needs a vehicle registry\./)).toBeVisible()
+    expect(lookupButton()).toBeDisabled()
+    expect(screen.getByRole('link', { name: 'Connect one' })).toHaveAttribute(
+      'href',
+      '/settings/integrations?category=registry'
+    )
+  })
+
+  it('gives the reason without a link to someone who may not change settings', async () => {
+    getVehicleLookupAvailability.mockResolvedValue({
+      success: true,
+      data: { plate: false, vin: false, reason: 'notConnected', canEditSettings: false },
+    })
+    renderLookup()
+    expect(
+      await screen.findByText('Plate lookup needs a vehicle registry. Ask an admin to connect one.')
+    ).toBeVisible()
+    expect(screen.queryByRole('link')).not.toBeInTheDocument()
+  })
+
+  it('offers the plans when the plan leaves integrations out', async () => {
+    getVehicleLookupAvailability.mockResolvedValue({
+      success: true,
+      data: { plate: false, vin: false, reason: 'notInPlan', canEditSettings: true },
+    })
+    renderLookup()
+    expect(await screen.findByText(/Plate lookup is not included in your plan\./)).toBeVisible()
+    expect(screen.queryByRole('link')).not.toBeInTheDocument()
+    fireEvent.click(screen.getByRole('button', { name: 'View Plans' }))
+    expect(handleGated).toHaveBeenCalledWith({ gated: { feature: 'integrations' } })
+  })
+
+  it('shows no reason when a registry is connected', async () => {
+    getVehicleLookupAvailability.mockResolvedValue({
+      success: true,
+      data: { plate: true, vin: false, reason: null, canEditSettings: true },
+    })
+    renderLookup()
+    await waitFor(() => expect(lookupButton()).toBeEnabled())
+    expect(screen.queryByText(/vehicle registry/)).not.toBeInTheDocument()
+    expect(screen.queryByText(/not included in your plan/)).not.toBeInTheDocument()
+  })
+})

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

@@ -30,12 +30,12 @@ vi.mock('@/features/customers/Actions/customerActions', () => ({
 }))
 }))
 vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
 vi.mock('@/features/vehicles/Actions/aiAnalyzeVehicleDocument', () => ({
   aiAnalyzeVehicleDocument: vi.fn(),
   aiAnalyzeVehicleDocument: vi.fn(),
-  isVehicleScanAvailable: vi.fn(async () => ({ success: true, data: false })),
+  getVehicleScanAvailability: vi.fn(async () => ({ success: true, data: false })),
 }))
 }))
-const isVehicleLookupAvailable = vi.hoisted(() => vi.fn())
+const getVehicleLookupAvailability = vi.hoisted(() => vi.fn())
 const lookupVehicle = vi.hoisted(() => vi.fn())
 const lookupVehicle = vi.hoisted(() => vi.fn())
 vi.mock('@/features/integrations/Actions/vehicleLookupActions', () => ({
 vi.mock('@/features/integrations/Actions/vehicleLookupActions', () => ({
-  isVehicleLookupAvailable,
+  getVehicleLookupAvailability,
   lookupVehicle,
   lookupVehicle,
 }))
 }))
 vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({
 vi.mock('@/features/vehicles/Actions/photoHandoffActions', () => ({
@@ -94,7 +94,7 @@ function renderForm(props: Partial<React.ComponentProps<typeof VehicleForm>> = {
 beforeEach(() => {
 beforeEach(() => {
   vi.clearAllMocks()
   vi.clearAllMocks()
   // No registry connected unless a test connects one.
   // No registry connected unless a test connects one.
-  isVehicleLookupAvailable.mockResolvedValue({ success: true, data: {} })
+  getVehicleLookupAvailability.mockResolvedValue({ success: true, data: {} })
 })
 })
 
 
 describe('edit vehicle dialog', () => {
 describe('edit vehicle dialog', () => {
@@ -327,7 +327,7 @@ describe('adding a vehicle', () => {
   })
   })
 
 
   it('asks the registry when Enter is pressed in the plate field', async () => {
   it('asks the registry when Enter is pressed in the plate field', async () => {
-    isVehicleLookupAvailable.mockResolvedValue({ success: true, data: { plate: true } })
+    getVehicleLookupAvailability.mockResolvedValue({ success: true, data: { plate: true } })
     lookupVehicle.mockResolvedValue({ success: true, data: null })
     lookupVehicle.mockResolvedValue({ success: true, data: null })
     renderNew()
     renderNew()
     await waitFor(() => expect(screen.getByRole('button', { name: 'Look up plate' })).toBeEnabled())
     await waitFor(() => expect(screen.getByRole('button', { name: 'Look up plate' })).toBeEnabled())
@@ -344,7 +344,7 @@ describe('adding a vehicle', () => {
   })
   })
 
 
   it('does not save the form on a second Enter while the registry is still answering', async () => {
   it('does not save the form on a second Enter while the registry is still answering', async () => {
-    isVehicleLookupAvailable.mockResolvedValue({ success: true, data: { plate: true } })
+    getVehicleLookupAvailability.mockResolvedValue({ success: true, data: { plate: true } })
     // The registry never answers in this test.
     // The registry never answers in this test.
     lookupVehicle.mockReturnValue(new Promise(() => undefined))
     lookupVehicle.mockReturnValue(new Promise(() => undefined))
     renderNew()
     renderNew()
@@ -370,7 +370,7 @@ describe('adding a vehicle', () => {
 
 
   it('asks nothing on Enter without a registry', async () => {
   it('asks nothing on Enter without a registry', async () => {
     renderNew()
     renderNew()
-    await waitFor(() => expect(isVehicleLookupAvailable).toHaveBeenCalled())
+    await waitFor(() => expect(getVehicleLookupAvailability).toHaveBeenCalled())
     const plate = screen.getByLabelText('License Plate')
     const plate = screen.getByLabelText('License Plate')
     expect(screen.getByRole('button', { name: 'Look up plate' })).toBeDisabled()
     expect(screen.getByRole('button', { name: 'Look up plate' })).toBeDisabled()
     fireEvent.change(plate, { target: { value: 'AB12345' } })
     fireEvent.change(plate, { target: { value: 'AB12345' } })

+ 39 - 0
src/features/integrations/Actions/vehicleLookupActions.ts

@@ -3,6 +3,7 @@
 import { db } from '@/lib/db'
 import { db } from '@/lib/db'
 import { getFeatures } from '@/lib/features'
 import { getFeatures } from '@/lib/features'
 import { PermissionAction, PermissionSubject } from '@/lib/permissions'
 import { PermissionAction, PermissionSubject } from '@/lib/permissions'
+import { canEditSettings } from '@/lib/settings-access'
 import { withAuth } from '@/lib/with-auth'
 import { withAuth } from '@/lib/with-auth'
 import { lookupAppliesTo } from '@/features/vehicles/Lib/registryLookup'
 import { lookupAppliesTo } from '@/features/vehicles/Lib/registryLookup'
 import { recordRegistryAnswer } from '../Lib/inspection-sync'
 import { recordRegistryAnswer } from '../Lib/inspection-sync'
@@ -51,6 +52,44 @@ export async function isVehicleLookupAvailable() {
   )
   )
 }
 }
 
 
+/** Why the plate lookup cannot be used, for the line under the button. */
+export type VehicleLookupUnavailableReason = 'notInPlan' | 'notConnected'
+
+export interface VehicleLookupAvailability extends Record<VehicleLookupKey, boolean> {
+  /** Set when the plate lookup is off: the plan leaves it out, or no registry is connected. */
+  reason: VehicleLookupUnavailableReason | null
+  /** Whether this person may open settings to change that, so the line may link there. */
+  canEditSettings: boolean
+}
+
+/**
+ * The same answer as `isVehicleLookupAvailable`, plus why the plate lookup is
+ * off and whether this person could switch it on. A new name rather than a
+ * new shape for the old one: a tab opened before the deploy still reads a
+ * plain pair of booleans from it.
+ */
+export async function getVehicleLookupAvailability() {
+  return withAuth(
+    async ({ organizationId, userId, role }): Promise<VehicleLookupAvailability> => {
+      const features = await getFeatures(organizationId)
+      const editor = await canEditSettings(userId, role)
+      if (!features.integrations)
+        return { plate: false, vin: false, reason: 'notInPlan', canEditSettings: editor }
+      const [plate, vin] = await Promise.all([
+        findLookupConnection(organizationId, 'plate'),
+        findLookupConnection(organizationId, 'vin'),
+      ])
+      return {
+        plate: plate !== null,
+        vin: vin !== null,
+        reason: plate === null ? 'notConnected' : null,
+        canEditSettings: editor,
+      }
+    },
+    { requiredPermissions: READ_VEHICLES }
+  )
+}
+
 /**
 /**
  * One lookup for the form, by plate or by VIN, sent to a registry that
  * One lookup for the form, by plate or by VIN, sent to a registry that
  * answers to it. When the vehicle already exists, is this organisation's,
  * answers to it. When the vehicle already exists, is this organisation's,

+ 36 - 0
src/features/vehicles/Actions/aiAnalyzeVehicleDocument.ts

@@ -1,6 +1,8 @@
 'use server'
 'use server'
 
 
 import { withAuth } from '@/lib/with-auth'
 import { withAuth } from '@/lib/with-auth'
+import { getFeatures } from '@/lib/features'
+import { canEditSettings } from '@/lib/settings-access'
 import { PermissionAction, PermissionSubject } from '@/lib/permissions'
 import { PermissionAction, PermissionSubject } from '@/lib/permissions'
 import { isAiConfigured } from '@/features/integrations/Lib/ai'
 import { isAiConfigured } from '@/features/integrations/Lib/ai'
 import { visionCompletion } from '@/lib/ai'
 import { visionCompletion } from '@/lib/ai'
@@ -45,6 +47,40 @@ export async function isVehicleScanAvailable() {
   })
   })
 }
 }
 
 
+export interface VehicleScanAvailability {
+  available: boolean
+  /** Set when scanning is off: the plan leaves AI out, or no AI provider is set up. */
+  reason: 'notInPlan' | 'notConfigured' | null
+  /** Whether this person may open settings to change that, so the line may link there. */
+  canEditSettings: boolean
+}
+
+/**
+ * The same answer as `isVehicleScanAvailable`, plus why scanning is off and
+ * whether this person could switch it on. A new name rather than a new shape
+ * for the old one: a tab opened before the deploy still reads a boolean.
+ */
+export async function getVehicleScanAvailability() {
+  return withAuth(
+    async ({ organizationId, userId, role }): Promise<VehicleScanAvailability> => {
+      const editor = await canEditSettings(userId, role)
+      if (await isAiConfigured(organizationId))
+        return { available: true, reason: null, canEditSettings: editor }
+      // A provider can only be connected on a plan with AI, so without one
+      // the plan is the reason, not the missing key.
+      const features = await getFeatures(organizationId)
+      return {
+        available: false,
+        reason: features.ai ? 'notConfigured' : 'notInPlan',
+        canEditSettings: editor,
+      }
+    },
+    {
+      requiredPermissions: [{ action: PermissionAction.READ, subject: PermissionSubject.VEHICLES }],
+    }
+  )
+}
+
 function validHsn(value: string): string | undefined {
 function validHsn(value: string): string | undefined {
   const hsn = normalizeHsn(value)
   const hsn = normalizeHsn(value)
   return HSN_PATTERN.test(hsn) ? hsn : undefined
   return HSN_PATTERN.test(hsn) ? hsn : undefined

+ 88 - 32
src/features/vehicles/Components/ScanDocumentButton.tsx

@@ -1,15 +1,17 @@
 'use client'
 'use client'
 
 
-import { useCallback, useEffect, useRef, useState } from 'react'
+import { useCallback, useEffect, useId, useRef, useState } from 'react'
+import Link from 'next/link'
 import { useTranslations } from 'next-intl'
 import { useTranslations } from 'next-intl'
 import { toast } from 'sonner'
 import { toast } from 'sonner'
 import { Button } from '@/components/ui/button'
 import { Button } from '@/components/ui/button'
-import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
+import { handleGated } from '@/components/upgrade-gate'
 import { Loader2, ScanLine } from 'lucide-react'
 import { Loader2, ScanLine } from 'lucide-react'
 import {
 import {
   aiAnalyzeVehicleDocument,
   aiAnalyzeVehicleDocument,
-  isVehicleScanAvailable,
+  getVehicleScanAvailability,
   type VehicleDocumentScan,
   type VehicleDocumentScan,
+  type VehicleScanAvailability,
 } from '../Actions/aiAnalyzeVehicleDocument'
 } from '../Actions/aiAnalyzeVehicleDocument'
 import { documentToDataUri } from '../Lib/documentImage'
 import { documentToDataUri } from '../Lib/documentImage'
 import { cn } from '@/lib/utils'
 import { cn } from '@/lib/utils'
@@ -38,15 +40,22 @@ export function ScanDocumentButton({
   const t = useTranslations('vehicles.form')
   const t = useTranslations('vehicles.form')
   const [scanning, setScanning] = useState(false)
   const [scanning, setScanning] = useState(false)
   /** null while the availability check is still in flight. */
   /** null while the availability check is still in flight. */
-  const [available, setAvailable] = useState<boolean | null>(null)
+  const [availability, setAvailability] = useState<VehicleScanAvailability | null>(null)
   const inputRef = useRef<HTMLInputElement>(null)
   const inputRef = useRef<HTMLInputElement>(null)
+  const reasonId = useId()
+  const available = availability ? availability.available : null
 
 
   // Scanning needs an AI provider configured for the organization. Checked
   // Scanning needs an AI provider configured for the organization. Checked
   // here rather than passed in, so no call site has to thread it down.
   // here rather than passed in, so no call site has to thread it down.
   useEffect(() => {
   useEffect(() => {
     let active = true
     let active = true
-    isVehicleScanAvailable().then((result) => {
-      if (active) setAvailable(result.success && result.data === true)
+    getVehicleScanAvailability().then((result) => {
+      if (!active) return
+      setAvailability(
+        result.success && result.data
+          ? result.data
+          : { available: false, reason: 'notConfigured', canEditSettings: false }
+      )
     })
     })
     return () => {
     return () => {
       active = false
       active = false
@@ -85,33 +94,39 @@ export function ScanDocumentButton({
         stacked ? 'flex flex-col gap-2' : 'flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3'
         stacked ? 'flex flex-col gap-2' : 'flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3'
       }
       }
     >
     >
-      <Tooltip>
-        {/* A disabled button swallows pointer events, so the trigger has to be
-            the wrapper rather than the button itself. */}
-        <TooltipTrigger asChild>
-          <span className="block">
-            <Button
-              type="button"
-              variant="outline"
-              className={stacked ? 'w-full' : 'w-full sm:w-auto'}
-              onClick={() => inputRef.current?.click()}
-              disabled={scanning || !available}
-            >
-              {scanning ? (
-                <Loader2 className="mr-2 h-4 w-4 animate-spin" />
-              ) : (
-                <ScanLine className="mr-2 h-4 w-4" />
-              )}
-              {t('scanDocument')}
-            </Button>
-          </span>
-        </TooltipTrigger>
-        {available === false && <TooltipContent>{t('scanUnavailable')}</TooltipContent>}
-      </Tooltip>
-      {showHint && (
-        <p className={cn('text-xs text-muted-foreground', stacked ? 'leading-snug' : 'sm:flex-1')}>
-          {t('scanDocumentHint')}
+      <Button
+        type="button"
+        variant="outline"
+        className={stacked ? 'w-full' : 'w-full sm:w-auto'}
+        onClick={() => inputRef.current?.click()}
+        disabled={scanning || !available}
+        aria-describedby={available === false ? reasonId : undefined}
+      >
+        {scanning ? (
+          <Loader2 className="mr-2 h-4 w-4 animate-spin" />
+        ) : (
+          <ScanLine className="mr-2 h-4 w-4" />
+        )}
+        {t('scanDocument')}
+      </Button>
+      {/* Unavailable: the reason takes the hint's place, in plain sight. A
+          tooltip on a disabled button never shows on a phone, and the hint
+          would promise fields that cannot fill. */}
+      {availability && !availability.available ? (
+        <p
+          id={reasonId}
+          className={cn('text-xs text-muted-foreground', stacked ? 'leading-snug' : 'sm:flex-1')}
+        >
+          <ScanUnavailableReason availability={availability} />
         </p>
         </p>
+      ) : (
+        showHint && (
+          <p
+            className={cn('text-xs text-muted-foreground', stacked ? 'leading-snug' : 'sm:flex-1')}
+          >
+            {t('scanDocumentHint')}
+          </p>
+        )
       )}
       )}
       <input
       <input
         ref={inputRef}
         ref={inputRef}
@@ -123,3 +138,44 @@ export function ScanDocumentButton({
     </div>
     </div>
   )
   )
 }
 }
+
+const linkClass = 'font-medium text-primary underline-offset-2 hover:underline'
+
+/**
+ * Why scanning is off, with the way to switch it on for whoever may: the AI
+ * providers in the integrations catalog, or the plans when the plan is what
+ * leaves it out. Someone who cannot change settings gets the reason alone.
+ */
+function ScanUnavailableReason({ availability }: { availability: VehicleScanAvailability }) {
+  const t = useTranslations('vehicles.form')
+  const ts = useTranslations('common.shared')
+  const { reason, canEditSettings } = availability
+  if (reason === 'notInPlan') {
+    return (
+      <>
+        {t('scanNotInPlan')}
+        {canEditSettings && (
+          <>
+            {' '}
+            <button
+              type="button"
+              className={linkClass}
+              onClick={() => handleGated({ gated: { feature: 'ai' } })}
+            >
+              {ts('viewPlans')}
+            </button>
+          </>
+        )}
+      </>
+    )
+  }
+  if (!canEditSettings) return <>{t('scanNeedsAiAsk')}</>
+  return (
+    <>
+      {t('scanNeedsAi')}{' '}
+      <Link href="/settings/integrations?category=ai" className={linkClass}>
+        {t('scanSetUpAi')}
+      </Link>
+    </>
+  )
+}

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

@@ -1128,7 +1128,8 @@ export function VehicleForm({
                     <Label htmlFor="licensePlate">
                     <Label htmlFor="licensePlate">
                       {isMarine ? t('licensePlateMarine') : t('licensePlate')}
                       {isMarine ? t('licensePlateMarine') : t('licensePlate')}
                     </Label>
                     </Label>
-                    <div className="flex gap-2">
+                    {/* Wraps so the lookup's reason, when it is off, sits under the field */}
+                    <div className="flex flex-wrap gap-2">
                       <Input
                       <Input
                         id="licensePlate"
                         id="licensePlate"
                         name="licensePlate"
                         name="licensePlate"

+ 94 - 22
src/features/vehicles/Components/VehicleLookupButton.tsx

@@ -1,15 +1,18 @@
 'use client'
 'use client'
 
 
-import { useCallback, useEffect, useState } from 'react'
+import { useCallback, useEffect, useId, useState } from 'react'
+import Link from 'next/link'
 import { useTranslations } from 'next-intl'
 import { useTranslations } from 'next-intl'
 import { toast } from 'sonner'
 import { toast } from 'sonner'
 import { Loader2, Search } from 'lucide-react'
 import { Loader2, Search } from 'lucide-react'
 import { Button } from '@/components/ui/button'
 import { Button } from '@/components/ui/button'
 import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
 import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
+import { handleGated } from '@/components/upgrade-gate'
 import {
 import {
-  isVehicleLookupAvailable,
+  getVehicleLookupAvailability,
   lookupVehicle,
   lookupVehicle,
   type VehicleLookup,
   type VehicleLookup,
+  type VehicleLookupAvailability,
 } from '@/features/integrations/Actions/vehicleLookupActions'
 } from '@/features/integrations/Actions/vehicleLookupActions'
 
 
 interface VehicleLookupButtonProps {
 interface VehicleLookupButtonProps {
@@ -38,6 +41,10 @@ interface VehicleLookupButtonProps {
  * registries exist. The plate button stays visible but disabled without a
  * registries exist. The plate button stays visible but disabled without a
  * registry, so a workshop learns one can be connected; the VIN button only
  * registry, so a workshop learns one can be connected; the VIN button only
  * appears once something that decodes VINs is.
  * appears once something that decodes VINs is.
+ *
+ * The disabled plate button says why on a line of its own, which the row
+ * around it wraps under the field (`flex-wrap`): a tooltip on a disabled
+ * button never appears on a phone.
  */
  */
 export function VehicleLookupButton({
 export function VehicleLookupButton({
   by,
   by,
@@ -49,12 +56,19 @@ export function VehicleLookupButton({
   const t = useTranslations('vehicles.form')
   const t = useTranslations('vehicles.form')
   const [busy, setBusy] = useState(false)
   const [busy, setBusy] = useState(false)
   /** null while the availability check is still in flight. */
   /** null while the availability check is still in flight. */
-  const [available, setAvailable] = useState<boolean | null>(null)
+  const [availability, setAvailability] = useState<VehicleLookupAvailability | null>(null)
+  const available = availability ? availability[by] : null
+  const reasonId = useId()
 
 
   useEffect(() => {
   useEffect(() => {
     let active = true
     let active = true
-    isVehicleLookupAvailable().then((result) => {
-      if (active) setAvailable(result.success && result.data?.[by] === true)
+    getVehicleLookupAvailability().then((result) => {
+      if (!active) return
+      setAvailability(
+        result.success && result.data
+          ? result.data
+          : { plate: false, vin: false, reason: 'notConnected', canEditSettings: false }
+      )
     })
     })
     return () => {
     return () => {
       active = false
       active = false
@@ -93,29 +107,87 @@ export function VehicleLookupButton({
   if (by === 'vin' && !available) return null
   if (by === 'vin' && !available) return null
 
 
   const label = by === 'vin' ? t('lookupVin') : t('lookupPlate')
   const label = by === 'vin' ? t('lookupVin') : t('lookupPlate')
+  const unavailable = availability !== null && !available
+  const button = (
+    <Button
+      type="button"
+      variant="outline"
+      size={text ? 'default' : 'icon'}
+      aria-label={label}
+      aria-describedby={unavailable ? reasonId : undefined}
+      data-lookup={by}
+      data-busy={busy || undefined}
+      onClick={handleClick}
+      disabled={busy || !available}
+      className={text ? 'gap-1.5 px-3' : undefined}
+    >
+      {busy ? <Loader2 className="h-4 w-4 animate-spin" /> : <Search className="h-4 w-4" />}
+      {text && <span aria-hidden>{text}</span>}
+    </Button>
+  )
+
+  if (unavailable && availability) {
+    return (
+      <>
+        {button}
+        <p id={reasonId} className="basis-full text-xs text-muted-foreground">
+          <LookupUnavailableReason availability={availability} />
+        </p>
+      </>
+    )
+  }
+
   return (
   return (
     <Tooltip>
     <Tooltip>
       {/* A disabled button swallows pointer events, so the trigger has to be
       {/* A disabled button swallows pointer events, so the trigger has to be
           the wrapper rather than the button itself. */}
           the wrapper rather than the button itself. */}
       <TooltipTrigger asChild>
       <TooltipTrigger asChild>
-        <span className="block">
-          <Button
-            type="button"
-            variant="outline"
-            size={text ? 'default' : 'icon'}
-            aria-label={label}
-            data-lookup={by}
-            data-busy={busy || undefined}
-            onClick={handleClick}
-            disabled={busy || !available}
-            className={text ? 'gap-1.5 px-3' : undefined}
-          >
-            {busy ? <Loader2 className="h-4 w-4 animate-spin" /> : <Search className="h-4 w-4" />}
-            {text && <span aria-hidden>{text}</span>}
-          </Button>
-        </span>
+        <span className="block">{button}</span>
       </TooltipTrigger>
       </TooltipTrigger>
-      <TooltipContent>{available === false ? t('lookupUnavailable') : label}</TooltipContent>
+      <TooltipContent>{label}</TooltipContent>
     </Tooltip>
     </Tooltip>
   )
   )
 }
 }
+
+const linkClass = 'font-medium text-primary underline-offset-2 hover:underline'
+
+/**
+ * Why the plate lookup is off, with the way to switch it on for whoever may:
+ * the registry connectors in the integrations catalog, or the plans when the
+ * plan leaves integrations out. No registry is named, since which one fits
+ * depends on the country. Someone who cannot change settings gets the reason
+ * alone.
+ */
+function LookupUnavailableReason({ availability }: { availability: VehicleLookupAvailability }) {
+  const t = useTranslations('vehicles.form')
+  const ts = useTranslations('common.shared')
+  const { reason, canEditSettings } = availability
+  if (reason === 'notInPlan') {
+    return (
+      <>
+        {t('lookupNotInPlan')}
+        {canEditSettings && (
+          <>
+            {' '}
+            <button
+              type="button"
+              className={linkClass}
+              onClick={() => handleGated({ gated: { feature: 'integrations' } })}
+            >
+              {ts('viewPlans')}
+            </button>
+          </>
+        )}
+      </>
+    )
+  }
+  if (!canEditSettings) return <>{t('lookupNeedsRegistryAsk')}</>
+  return (
+    <>
+      {t('lookupNeedsRegistry')}{' '}
+      <Link href="/settings/integrations?category=registry" className={linkClass}>
+        {t('lookupConnectRegistry')}
+      </Link>
+    </>
+  )
+}