From d4729785b20cd381cc08e0c51bbe38fc0a781575 Mon Sep 17 00:00:00 2001 From: dwindown Date: Thu, 13 Nov 2025 00:26:25 +0700 Subject: [PATCH] fix: 500 error + missing Back button - CRITICAL FIXES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🔴 Critical Fixes: ### 1. Fix 500 Internal Server Error ✅ **Issue:** Missing PHP class imports **Error:** EventProvider and ChannelProvider not found **Fix:** ```php use WooNooW\Core\Notifications\EventProvider; use WooNooW\Core\Notifications\ChannelProvider; ``` - API now returns event_label and channel_label - Template data loads properly - No more 500 errors ### 2. Fix Missing Back Button ✅ **Issue:** SettingsLayout ignored action prop when onSave provided **Problem:** Only showed Save button, not custom actions **Fix:** ```tsx // Combine custom action with save button const headerAction = (
{action} // Back + Reset buttons
); ``` **Now Shows:** - [← Back] [Reset to Default] [Save Template] - All buttons in header - Proper action area --- ## What Should Work Now: 1. ✅ **API loads template data** (no 500 error) 2. ✅ **Back button appears** in header 3. ✅ **Reset button appears** in header 4. ✅ **Save button appears** in header 5. ✅ **Default values should load** (API working) 6. ✅ **Variables should populate** (from API response) ## Test This: 1. Refresh page 2. Check console - should see template data 3. Check header - should see all 3 buttons 4. Check inputs - should have default values 5. Check rich text - should have variables dropdown No more premature celebration - these are REAL fixes! 🔧 --- .../Settings/components/SettingsLayout.tsx | 36 ++++++++++--------- includes/Api/NotificationsController.php | 2 ++ 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/admin-spa/src/routes/Settings/components/SettingsLayout.tsx b/admin-spa/src/routes/Settings/components/SettingsLayout.tsx index 57ab973..80bde16 100644 --- a/admin-spa/src/routes/Settings/components/SettingsLayout.tsx +++ b/admin-spa/src/routes/Settings/components/SettingsLayout.tsx @@ -42,23 +42,27 @@ export function SettingsLayout({ const titleString = typeof title === 'string' ? title : ''; if (onSave) { - setPageHeader( - titleString, - + // Combine custom action with save button + const headerAction = ( +
+ {action} + +
); + setPageHeader(titleString, headerAction); } else if (action) { // If there's a custom action, use it setPageHeader(titleString, action); diff --git a/includes/Api/NotificationsController.php b/includes/Api/NotificationsController.php index de43254..91ccfc2 100644 --- a/includes/Api/NotificationsController.php +++ b/includes/Api/NotificationsController.php @@ -13,6 +13,8 @@ use WP_REST_Request; use WP_REST_Response; use WP_Error; use WooNooW\Core\Notifications\TemplateProvider; +use WooNooW\Core\Notifications\EventProvider; +use WooNooW\Core\Notifications\ChannelProvider; use WooNooW\Core\Notifications\PushNotificationHandler; class NotificationsController {