true, 'sms_enabled' => true, 'push_enabled' => false, 'notification_frequency' => 'immediate', 'quiet_hours_start' => '22:00', 'quiet_hours_end' => '08:00', 'event_types' => [], ]; public $filters = [ 'search' => '', 'channel' => '', 'status' => '', 'event_type' => '', 'date_range' => '', ]; public $globalSettings = [ 'email_enabled' => true, 'sms_enabled' => true, 'push_enabled' => false, 'webhook_enabled' => false, 'max_daily_notifications' => 100, 'quiet_hours_start' => '22:00', 'quiet_hours_end' => '08:00', 'webhook_url' => '', ]; public function getStatsProperty() { return [ 'unread_count' => 3, 'recent_alerts' => collect([ (object) ['message' => 'Device offline', 'time' => now()->subMinutes(5)], (object) ['message' => 'Speed exceeded', 'time' => now()->subMinutes(15)], (object) ['message' => 'Geofence exit', 'time' => now()->subMinutes(30)], ]), 'system_notifications' => collect([ (object) ['message' => 'System maintenance scheduled', 'time' => now()->subHours(2)], (object) ['message' => 'New feature available', 'time' => now()->subHours(5)], ]), 'notifications_sent_today' => 47, 'email_notifications_sent' => 32, 'sms_notifications_sent' => 15, 'pending_notifications' => 3, 'failed_notifications' => 1, 'notification_rate' => 96.2, 'delivery_success_rate' => 95.5, 'average_delivery_time' => 2.3, 'total_notifications_sent' => 1247, 'webhook_notifications_sent' => 0, ]; } public function render() { // Mock user settings with proper user objects $userSettings = collect([ (object) [ 'id' => 1, 'user_id' => 1, 'email_enabled' => true, 'sms_enabled' => true, 'push_enabled' => false, 'notification_frequency' => 'immediate', 'quiet_hours_start' => '22:00', 'quiet_hours_end' => '08:00', 'user' => (object) [ 'id' => 1, 'name' => 'John Doe', 'email' => 'john@example.com' ] ], (object) [ 'id' => 2, 'user_id' => 2, 'email_enabled' => false, 'sms_enabled' => true, 'push_enabled' => true, 'notification_frequency' => 'daily', 'quiet_hours_start' => '23:00', 'quiet_hours_end' => '07:00', 'user' => (object) [ 'id' => 2, 'name' => 'Jane Smith', 'email' => 'jane@example.com' ] ] ]); // Mock notifications with user data to prevent property access errors $notifications = collect([ (object) [ 'id' => 1, 'type' => 'email', 'message' => 'Device offline alert', 'created_at' => now()->subMinutes(5), 'status' => 'sent', 'user' => (object) [ 'id' => 1, 'name' => 'John Doe', 'email' => 'john@example.com' ] ], (object) [ 'id' => 2, 'type' => 'sms', 'message' => 'Speed limit exceeded', 'created_at' => now()->subMinutes(15), 'status' => 'pending', 'user' => (object) [ 'id' => 2, 'name' => 'Jane Smith', 'email' => 'jane@example.com' ] ] ]); // Mock recent notifications for the activity feed $recentNotifications = collect([ (object) [ 'id' => 1, 'channel' => 'email', 'event_type' => 'Vehicle Maintenance', 'message' => 'Vehicle maintenance reminder sent to John Doe', 'created_at' => now()->subMinutes(5), 'status' => 'delivered', 'recipient' => 'john@example.com' ], (object) [ 'id' => 2, 'channel' => 'sms', 'event_type' => 'Speed Violation', 'message' => 'Speed violation alert sent to Jane Smith', 'created_at' => now()->subMinutes(15), 'status' => 'delivered', 'recipient' => '+1234567890' ], (object) [ 'id' => 3, 'channel' => 'push', 'event_type' => 'Device Offline', 'message' => 'Device offline notification', 'created_at' => now()->subMinutes(30), 'status' => 'pending', 'recipient' => 'Mobile App' ], (object) [ 'id' => 4, 'channel' => 'email', 'event_type' => 'Weekly Report', 'message' => 'Weekly report sent to admin users', 'created_at' => now()->subHours(2), 'status' => 'delivered', 'recipient' => 'admin@example.com' ] ]); return view('livewire.notification-center', [ 'userSettings' => $userSettings, 'notifications' => $notifications, 'recentNotifications' => $recentNotifications, ]); } public function editUserSettings($userId) { $this->editingUserSettings = (object) [ 'id' => $userId, 'user_id' => $userId, 'email_enabled' => true, 'sms_enabled' => true, 'push_enabled' => false, 'notification_frequency' => 'immediate', 'quiet_hours_start' => '22:00', 'quiet_hours_end' => '08:00', 'user' => (object) [ 'id' => $userId, 'name' => $userId == 1 ? 'John Doe' : 'Jane Smith', 'email' => $userId == 1 ? 'john@example.com' : 'jane@example.com' ] ]; $this->showUserSettingsModal = true; } public function closeSettingsModal() { $this->showSettingsModal = false; } public function closeUserSettingsModal() { $this->showUserSettingsModal = false; $this->editingUserSettings = null; } // Handle legacy method names (backward compatibility) public function showGlobalsettingsModal() { $this->showSettingsModal = true; } public function updateGlobalSettings() { // Here you would typically save to database // For now, just keep the in-memory changes session()->flash('message', 'Global settings updated successfully.'); } public function showUsersettingsModal($userId = null) { if ($userId) { $this->editUserSettings($userId); } else { $this->showUserSettingsModal = true; } } }