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": "Entrez un slug de page CMS (ex. conditions-generales) pour afficher les CGV complètes depuis le module CMS",
"terms_conditions": "Conditions Générales (secours)",
"terms_fallback_hint": "Utilisé quand aucun slug CMS n'est défini",
"terms_text_hint": "Texte de secours. Ce champ OU le slug CMS ci-dessus est requis afin que les clients puissent lire les conditions sur la page d'inscription.",
"terms_required_warning": "Les clients doivent pouvoir lire vos conditions avant de les accepter. Remplissez soit le slug de page CMS ci-dessus, soit le texte de secours ci-dessous — tant que ce n'est pas fait, le lien « Conditions Générales » sur la page d'inscription du storefront n'est pas cliquable.",
"terms_required_tooltip": "Remplissez le slug CMS ou le texte des conditions avant d'enregistrer.",
"privacy_policy_url": "URL politique de confidentialité",
"program_status": "Statut du programme",
"program_active": "Programme actif",