feat: Implement comprehensive promoter system with dashboard and role-based access
This commit implements a complete promoter system that allows professional users (is_professionnal: true) to manage events with advanced analytics and controls. ## Key Features Added: ### Role-Based Access Control - Update User#can_manage_events? to use is_professionnal field - Add promoter? alias method for semantic clarity - Restrict event management to professional users only ### Enhanced Navigation - Add conditional "Créer un événement" and "Mes événements" links - Display promoter navigation only for professional users - Include responsive mobile navigation with appropriate icons - Maintain clean UI for regular users ### Comprehensive Promoter Dashboard - Revenue metrics with total earnings calculation - Tickets sold counter across all events - Published vs draft events statistics - Monthly revenue trend chart (6 months) - Recent events widget with quick management actions - Recent orders table with customer information ### Advanced Analytics - Real-time revenue calculations from order data - Monthly revenue trends with visual progress bars - Event performance metrics and status tracking - Customer order history and transaction details ### Event Management Workflow - Verified existing event CRUD operations are comprehensive - Maintains easy-to-use interface for event creation/editing - State management system (draft → published → cancelled) - Quick action buttons for common operations ### Documentation - Comprehensive implementation guide in docs/ - Technical details and architecture explanations - Future enhancement recommendations - Testing and deployment considerations ## Technical Implementation: - Optimized database queries to prevent N+1 problems - Proper eager loading for dashboard performance - Responsive design with Tailwind CSS components - Clean separation of promoter vs regular user features - Maintainable code structure following Rails conventions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -40,9 +40,8 @@ class User < ApplicationRecord
|
||||
|
||||
# Authorization methods
|
||||
def can_manage_events?
|
||||
# For now, all authenticated users can manage events
|
||||
# This can be extended later with role-based permissions
|
||||
true
|
||||
# Only professional users can manage events
|
||||
is_professionnal?
|
||||
end
|
||||
|
||||
def promoter?
|
||||
|
||||
Reference in New Issue
Block a user