feat: Restructure notifications - Staff and Customer separation (WIP)

## 🎯 Phase 1: Backend + Frontend Structure

### Backend Changes

**NotificationsController.php:**
-  Added `/notifications/staff/events` endpoint
-  Added `/notifications/customer/events` endpoint
-  Created `get_all_events()` helper method
-  Added `recipient_type` field to all events
-  Filter events by recipient (staff vs customer)

### Frontend Changes

**Main Notifications Page:**
-  Restructured to show cards for Staff, Customer, Activity Log
-  Entry point with clear separation
-  Modern card-based UI

**Staff Notifications:**
-  Created `/settings/notifications/staff` route
-  Moved Channels.tsx → Staff/Channels.tsx
-  Moved Events.tsx → Staff/Events.tsx
-  Updated Staff/Events to use `/notifications/staff/events`
-  Fixed import paths

### Structure

```
Settings → Notifications
├── Staff Notifications (admin alerts)
│   ├── Channels (Email, Push)
│   ├── Events (Orders, Products, Customers)
│   └── Templates
└── Customer Notifications (customer emails)
    ├── Channels (Email, Push, SMS)
    ├── Events (Orders, Shipping, Account)
    └── Templates
```

---

**Next:** Customer notifications page + routes
This commit is contained in:
dwindown
2025-11-11 19:00:52 +07:00
parent 90407dcfc8
commit 7c0605d379
5 changed files with 1001 additions and 25 deletions

View File

@@ -0,0 +1,49 @@
import React, { useState } from 'react';
import { Link } from 'react-router-dom';
import { SettingsLayout } from '../components/SettingsLayout';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Button } from '@/components/ui/button';
import { __ } from '@/lib/i18n';
import { ChevronLeft } from 'lucide-react';
import StaffChannels from './Staff/Channels';
import StaffEvents from './Staff/Events';
import NotificationTemplates from './Templates';
export default function StaffNotifications() {
const [activeTab, setActiveTab] = useState('channels');
return (
<SettingsLayout
title={__('Staff Notifications')}
description={__('Configure notifications for admins and staff members')}
action={
<Link to="/settings/notifications">
<Button variant="ghost" size="sm">
<ChevronLeft className="mr-2 h-4 w-4" />
{__('Back to Notifications')}
</Button>
</Link>
}
>
<Tabs value={activeTab} onValueChange={setActiveTab} className="space-y-6">
<TabsList className="grid w-full grid-cols-3">
<TabsTrigger value="channels">{__('Channels')}</TabsTrigger>
<TabsTrigger value="events">{__('Events')}</TabsTrigger>
<TabsTrigger value="templates">{__('Templates')}</TabsTrigger>
</TabsList>
<TabsContent value="channels" className="space-y-4">
<StaffChannels />
</TabsContent>
<TabsContent value="events" className="space-y-4">
<StaffEvents />
</TabsContent>
<TabsContent value="templates" className="space-y-4">
<NotificationTemplates recipientType="staff" />
</TabsContent>
</Tabs>
</SettingsLayout>
);
}