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": "Gitt e CMS-Säiten-Slug an (z.B. agb) fir déi komplett AGB vum CMS-Modul unzeweisen",
"terms_conditions": "Allgemeng Geschäftsbedingungen (Fallback)",
"terms_fallback_hint": "Gëtt benotzt wann keen CMS-Slug gesat ass",
"terms_text_hint": "Plain-Text-Ersatz. Entweder dëst Feld ODER de CMS-Säit-Slug uewendriwwer ass erfuerderlech, fir datt Clienten d'AGB op der Aschreiwungssäit liesen kënnen.",
"terms_required_warning": "Clienten musse fäeg sinn Är AGB ze liese ier se se akzeptéieren. Fëllt entweder de CMS-Säit-Slug uewendriwwer oder de Plain-Text-Ersatz hei drënner aus — bis dat gemaach ass, ass de \"AGB\"-Link op der Aschreiwungssäit vum Storefront net cliquéierbar.",
"terms_required_tooltip": "Fëllt de CMS-Slug oder den AGB-Plain-Text aus ier Dir späichert.",
"privacy_policy_url": "Dateschutzrichtlinn-URL",
"program_status": "Programmstatus",
"program_active": "Programm aktiv",