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

@@ -63,6 +63,7 @@ function data() {
companies: 'platformAdmin',
vendors: 'platformAdmin',
users: 'platformAdmin',
messages: 'platformAdmin',
// Vendor Operations (Products, Customers, Inventory, Orders, Shipping)
'marketplace-products': 'vendorOps',
'vendor-products': 'vendorOps',
@@ -221,4 +222,39 @@ function languageSelector(currentLang, enabledLanguages) {
}
// Export to window for use in templates
window.languageSelector = languageSelector;
window.languageSelector = languageSelector;
/**
* Header messages badge component
* Shows unread message count in header
*/
function headerMessages() {
return {
unreadCount: 0,
pollInterval: null,
async init() {
await this.fetchUnreadCount();
// Poll every 30 seconds
this.pollInterval = setInterval(() => this.fetchUnreadCount(), 30000);
},
destroy() {
if (this.pollInterval) {
clearInterval(this.pollInterval);
}
},
async fetchUnreadCount() {
try {
const response = await apiClient.get('/admin/messages/unread-count');
this.unreadCount = response.total_unread || 0;
} catch (error) {
// Silently fail - don't spam console for auth issues on login page
}
}
};
}
// Export to window
window.headerMessages = headerMessages;