feat: add admin messaging interface

- Add admin messages API endpoints (/api/v1/admin/messages)
- Add admin messages page route (/admin/messages)
- Add messages.html template with split-panel conversation view
- Add messages.js Alpine component for messaging UI
- Add Messages link to admin sidebar under Platform Administration
- Add message icon with unread badge to admin header
- Update init-alpine.js with headerMessages component

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-21 14:09:48 +01:00
parent 8b7d2fe312
commit 081511ff8a
8 changed files with 1787 additions and 37 deletions

View File

@@ -476,6 +476,79 @@ async def admin_customers_page(
)
# ============================================================================
# NOTIFICATIONS ROUTES
# ============================================================================
@router.get("/notifications", response_class=HTMLResponse, include_in_schema=False)
async def admin_notifications_page(
request: Request,
current_user: User = Depends(get_current_admin_from_cookie_or_header),
db: Session = Depends(get_db),
):
"""
Render notifications management page.
Shows all admin notifications and platform alerts.
"""
return templates.TemplateResponse(
"admin/notifications.html",
{
"request": request,
"user": current_user,
},
)
# ============================================================================
# MESSAGING ROUTES
# ============================================================================
@router.get("/messages", response_class=HTMLResponse, include_in_schema=False)
async def admin_messages_page(
request: Request,
current_user: User = Depends(get_current_admin_from_cookie_or_header),
db: Session = Depends(get_db),
):
"""
Render messaging page.
Shows all conversations (admin_vendor and admin_customer channels).
"""
return templates.TemplateResponse(
"admin/messages.html",
{
"request": request,
"user": current_user,
},
)
@router.get(
"/messages/{conversation_id}",
response_class=HTMLResponse,
include_in_schema=False,
)
async def admin_conversation_detail_page(
request: Request,
conversation_id: int = Path(..., description="Conversation ID"),
current_user: User = Depends(get_current_admin_from_cookie_or_header),
db: Session = Depends(get_db),
):
"""
Render conversation detail page.
Shows the full conversation thread with messages.
"""
return templates.TemplateResponse(
"admin/messages.html",
{
"request": request,
"user": current_user,
"conversation_id": conversation_id,
},
)
# ============================================================================
# INVENTORY MANAGEMENT ROUTES
# ============================================================================