diff --git a/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx b/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx index d1f8f48..e5c73d6 100644 --- a/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx +++ b/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx @@ -34,6 +34,7 @@ export default function EditTemplate() { const [body, setBody] = useState(''); const [variables, setVariables] = useState<{ [key: string]: string }>({}); const [activeTab, setActiveTab] = useState('editor'); + const [codeMode, setCodeMode] = useState(false); // Fetch template const { data: template, isLoading } = useQuery({ @@ -46,7 +47,8 @@ export default function EditTemplate() { }); useEffect(() => { - if (template) { + if (template && template.subject !== undefined && template.body !== undefined) { + console.log('Setting template data:', template); setSubject(template.subject || ''); setBody(template.body || ''); setVariables(template.variables || {}); @@ -184,33 +186,34 @@ export default function EditTemplate() { return ( - + {template?.event_label || __('Edit Template')} } + description={`${template?.channel_label || ''} - ${__('Customize the notification template. Use variables like {customer_name} to personalize messages.')}`} + onSave={handleSave} + saveLabel={__('Save Template')} + isLoading={isLoading} + action={ + + } > {/* Tabs - Sticky in header area */}
@@ -250,15 +253,38 @@ export default function EditTemplate() { {/* Body */}
- - +
+ + +
+ + {codeMode ? ( +