diff --git a/frontend/src/components/admin/AssignedEventsDialog.tsx b/frontend/src/components/admin/AssignedEventsDialog.tsx index 82668c4c..3cac211b 100644 --- a/frontend/src/components/admin/AssignedEventsDialog.tsx +++ b/frontend/src/components/admin/AssignedEventsDialog.tsx @@ -106,6 +106,16 @@ export const AssignedEventsDialog: React.FC = ({ customerId, isOpen, init ...prev, { id: ev.id, eventName: ev.event_name, eventDate: ev.event_date || null }, ]); + // Keep the typed query around so the admin can continue picking + // additional matches from the same search (e.g. "Smith Wedding" + // returns both the engagement + the wedding event; adding one + // shouldn't force a re-type to add the other). The just-added + // event drops out of the results automatically — the search + // effect re-filters against the new `selected` set. + searchInputRef.current?.focus(); + }; + + const clearQuery = () => { setQuery(''); setResults([]); searchInputRef.current?.focus(); @@ -234,8 +244,25 @@ export const AssignedEventsDialog: React.FC = ({ customerId, isOpen, init onChange={(e) => setQuery(e.target.value)} placeholder={t('customers.assignedEvents.searchPlaceholder', 'Search by event name')} disabled={saveMutation.isPending} - className="w-full pl-9 pr-3 py-2 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-900 dark:text-neutral-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500" + className="w-full pl-9 pr-9 py-2 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-900 dark:text-neutral-100 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500" /> + {/* Inline clear button — visible only while the query has + content. We keep the query through add() now so the + admin needs an explicit way to wipe it before starting + a new search. Esc would be lovely too but adding a + global key handler inside a modal is more risk than + this control is worth. */} + {query && ( + + )} {/* Results dropdown — inline (not a popover) since this is diff --git a/frontend/src/i18n/locales/de.json b/frontend/src/i18n/locales/de.json index 74ff2c1d..be0d9a66 100644 --- a/frontend/src/i18n/locales/de.json +++ b/frontend/src/i18n/locales/de.json @@ -2970,7 +2970,8 @@ "savedDiff": "Zuweisungen aktualisiert: {{parts}}", "addedN": "{{count}} hinzugefügt", "removedN": "{{count}} entfernt", - "error": "Zuweisungen konnten nicht aktualisiert werden" + "error": "Zuweisungen konnten nicht aktualisiert werden", + "clearSearchAria": "Suche löschen" } }, "clients": { diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json index 232151c6..24d31111 100644 --- a/frontend/src/i18n/locales/en.json +++ b/frontend/src/i18n/locales/en.json @@ -2970,7 +2970,8 @@ "savedDiff": "Assignments updated: {{parts}}", "addedN": "{{count}} added", "removedN": "{{count}} removed", - "error": "Could not update assignments" + "error": "Could not update assignments", + "clearSearchAria": "Clear search" } }, "clients": { diff --git a/frontend/src/i18n/locales/fr.json b/frontend/src/i18n/locales/fr.json index e9578d9d..3eac8951 100644 --- a/frontend/src/i18n/locales/fr.json +++ b/frontend/src/i18n/locales/fr.json @@ -2924,7 +2924,8 @@ "savedDiff": "Assignations mises à jour : {{parts}}", "addedN": "{{count}} ajoutée(s)", "removedN": "{{count}} retirée(s)", - "error": "Impossible de mettre à jour les assignations" + "error": "Impossible de mettre à jour les assignations", + "clearSearchAria": "Effacer la recherche" } }, "clients": { diff --git a/frontend/src/i18n/locales/nl.json b/frontend/src/i18n/locales/nl.json index b72d6864..bd44f02b 100644 --- a/frontend/src/i18n/locales/nl.json +++ b/frontend/src/i18n/locales/nl.json @@ -2970,7 +2970,8 @@ "savedDiff": "Toewijzingen bijgewerkt: {{parts}}", "addedN": "{{count}} toegevoegd", "removedN": "{{count}} verwijderd", - "error": "Toewijzingen konden niet worden bijgewerkt" + "error": "Toewijzingen konden niet worden bijgewerkt", + "clearSearchAria": "Zoekopdracht wissen" } }, "clients": { diff --git a/frontend/src/i18n/locales/pt.json b/frontend/src/i18n/locales/pt.json index d9c36027..c47e4126 100644 --- a/frontend/src/i18n/locales/pt.json +++ b/frontend/src/i18n/locales/pt.json @@ -3003,7 +3003,8 @@ "savedDiff": "Atribuições atualizadas: {{parts}}", "addedN": "{{count}} adicionada(s)", "removedN": "{{count}} removida(s)", - "error": "Não foi possível atualizar as atribuições" + "error": "Não foi possível atualizar as atribuições", + "clearSearchAria": "Limpar pesquisa" } }, "clients": { diff --git a/frontend/src/i18n/locales/ru.json b/frontend/src/i18n/locales/ru.json index 61e73094..e4ccd633 100644 --- a/frontend/src/i18n/locales/ru.json +++ b/frontend/src/i18n/locales/ru.json @@ -3036,7 +3036,8 @@ "savedDiff": "Назначения обновлены: {{parts}}", "addedN": "добавлено: {{count}}", "removedN": "удалено: {{count}}", - "error": "Не удалось обновить назначения" + "error": "Не удалось обновить назначения", + "clearSearchAria": "Очистить поиск" } }, "clients": {