fix: Match Customer Channels to Staff layout and fix event filtering
## 🐛 Bug Fixes ### Customer/Channels.tsx - ✅ Matched layout to Staff Channels - ✅ Added "Extend with Addons" section - ✅ WhatsApp, Telegram, SMS addon cards - ✅ Consistent UI with Staff page - ✅ Removed confusing SMS "Coming Soon" inline card ### NotificationsController.php - ✅ Fixed `get_staff_events()` filtering logic - ✅ Fixed `get_customer_events()` filtering logic - ✅ Now uses `recipient_type` field instead of `reset()` on channels - ✅ Customer events will now show correctly ### Issues Fixed 1. ❌ Customer Channels inconsistent with Staff → ✅ Now matches 2. ❌ Customer Events showing "No Events" → ✅ Now filters correctly --- **Result:** Both Staff and Customer pages now have consistent UI and working event filtering! 🎉
This commit is contained in:
@@ -317,12 +317,11 @@ class NotificationsController {
|
||||
public function get_staff_events(WP_REST_Request $request) {
|
||||
$all_events = $this->get_all_events();
|
||||
|
||||
// Filter events where default recipient is 'admin' or 'staff'
|
||||
// Filter events where recipient_type is 'staff'
|
||||
$staff_events = [];
|
||||
foreach ($all_events as $category => $events) {
|
||||
$filtered = array_filter($events, function($event) {
|
||||
$first_channel = reset($event['channels']);
|
||||
return in_array($first_channel['recipient'] ?? 'admin', ['admin', 'staff']);
|
||||
return ($event['recipient_type'] ?? 'staff') === 'staff';
|
||||
});
|
||||
|
||||
if (!empty($filtered)) {
|
||||
@@ -342,12 +341,11 @@ class NotificationsController {
|
||||
public function get_customer_events(WP_REST_Request $request) {
|
||||
$all_events = $this->get_all_events();
|
||||
|
||||
// Filter events where default recipient is 'customer'
|
||||
// Filter events where recipient_type is 'customer'
|
||||
$customer_events = [];
|
||||
foreach ($all_events as $category => $events) {
|
||||
$filtered = array_filter($events, function($event) {
|
||||
$first_channel = reset($event['channels']);
|
||||
return ($first_channel['recipient'] ?? 'admin') === 'customer';
|
||||
return ($event['recipient_type'] ?? 'staff') === 'customer';
|
||||
});
|
||||
|
||||
if (!empty($filtered)) {
|
||||
|
||||
Reference in New Issue
Block a user