fix(loyalty-admin): require at least one terms field on program form
Some checks failed
CI / ruff (push) Successful in 19s
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / pytest (push) Has been cancelled

If a merchant saves a loyalty program with both terms_text and
terms_cms_page_slug empty, the storefront enrollment page renders the
"Terms & Conditions" link as a non-clickable <span> (see enroll.html
template branch) — customers can't read what they're agreeing to.

Two changes to the shared program-form to make this impossible to ship
by accident:

1. Yellow warning banner inside the Terms section, visible only when
   both fields are empty. Tells the admin what the storefront will
   look like and what to fix.
2. Save button is disabled until at least one of the two terms
   fields is filled. The button gets a localised :title tooltip
   explaining why it's disabled, and disabled:cursor-not-allowed so
   the disabled state is obvious on hover.

Added three i18n keys (terms_required_warning, terms_text_hint,
terms_required_tooltip) in en/fr/de/lb, plus a small "either this or
the slug above is required" hint under the textarea so each field is
self-explanatory in isolation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-18 23:36:14 +02:00
parent ab3e133af7
commit 5f2885023c
5 changed files with 33 additions and 2 deletions

View File

@@ -411,6 +411,9 @@
"terms_cms_page_hint": "Geben Sie einen CMS-Seiten-Slug ein (z.B. agb) um die vollständigen AGB aus dem CMS-Modul anzuzeigen",
"terms_conditions": "Allgemeine Geschäftsbedingungen (Fallback)",
"terms_fallback_hint": "Wird verwendet wenn kein CMS-Slug gesetzt ist",
"terms_text_hint": "Klartext-Fallback. Entweder dieses Feld ODER der CMS-Seiten-Slug oben ist erforderlich, damit Kunden die AGB auf der Anmeldeseite lesen können.",
"terms_required_warning": "Kunden müssen Ihre AGB lesen können, bevor sie diese akzeptieren. Füllen Sie entweder den CMS-Seiten-Slug oben oder den Klartext-Fallback unten aus — bis dahin ist der \"AGB\"-Link auf der Anmeldeseite des Storefronts nicht klickbar.",
"terms_required_tooltip": "Füllen Sie den CMS-Slug oder den Klartext der AGB aus, bevor Sie speichern.",
"privacy_policy_url": "Datenschutzrichtlinien-URL",
"program_status": "Programmstatus",
"program_active": "Programm aktiv",