diff --git a/backend/whatsapp_templates.py b/backend/whatsapp_templates.py index b1b7b7e..16d04e5 100644 --- a/backend/whatsapp_templates.py +++ b/backend/whatsapp_templates.py @@ -169,12 +169,21 @@ TEMPLATES: Dict[str, Dict[str, Any]] = { "event_date", # body {{5}} "event_time", # body {{6}} "guest_link", # body {{7}} - "event_id", # button {{1}} - for dynamic URL (not in body text) ], "button_type": "URL", "button_text": "הצבע על הזמנה", "button_url": "https://invy.dvirlabs.com/guest/{{1}}", "button_param_key": "event_id", + "form_params": [ # All params shown in form + "contact_name", + "groom_name", + "bride_name", + "venue", + "event_date", + "event_time", + "guest_link", + "event_id", # Button param - shown in form but NOT sent as body parameter + ], "fallbacks": { "contact_name": "חבר", "groom_name": "החתן", @@ -295,6 +304,7 @@ def list_templates_for_frontend(db: Session) -> list: "button_text": tpl.get("button_text", ""), "button_url": tpl.get("button_url", ""), "button_param_key": tpl.get("button_param_key", ""), + "form_params": tpl.get("form_params", tpl["body_params"]), # All params for form display "guest_name_key": tpl.get("guest_name_key", ""), "url_button": tpl.get("url_button", None), } diff --git a/frontend/src/components/WhatsAppInviteModal.jsx b/frontend/src/components/WhatsAppInviteModal.jsx index 966fd4e..ade9b24 100644 --- a/frontend/src/components/WhatsAppInviteModal.jsx +++ b/frontend/src/components/WhatsAppInviteModal.jsx @@ -94,13 +94,14 @@ function WhatsAppInviteModal({ isOpen, onClose, selectedGuests = [], eventData = // Unique param keys for this template (header + body, deduplicated, skip contact_name & guest_name_key & guest_link) const paramKeys = useMemo(() => { if (!selectedTemplate) return [] - const all = [ + // Use form_params if available, otherwise fall back to body_params + header_params + const paramList = selectedTemplate.form_params || [ ...(selectedTemplate.header_params || []), ...(selectedTemplate.body_params || []), ] const seen = new Set() const gnk = selectedTemplate.guest_name_key || '' - return all.filter(k => { + return paramList.filter(k => { if (k === 'contact_name' || k === gnk || k === 'guest_link' || seen.has(k)) return false seen.add(k); return true })