<%= render 'components/breadcrumb', crumbs: [ { name: 'Accueil', path: root_path }, { name: 'Tableau de bord', path: dashboard_path } ] %>

Mon tableau de bord

Gérez vos commandes et accédez à vos billets

<% if current_user.promoter? %>
<%= link_to promoter_events_path, class: "inline-flex items-center justify-center px-4 py-2 bg-purple-600 text-white font-medium rounded-lg hover:bg-purple-700 transition-colors duration-200" do %> Mes Événements <% end %> <%= link_to new_promoter_event_path, class: "inline-flex items-center justify-center px-4 py-2 bg-gray-900 text-white font-medium rounded-lg hover:bg-gray-800 transition-colors duration-200" do %> Créer un Événement <% end %>
<% else %> <%= link_to events_path, class: "inline-flex items-center justify-center px-4 py-2 bg-purple-600 text-white font-medium rounded-lg hover:bg-purple-700 transition-colors duration-200" do %> Découvrir des Événements <% end %> <% end %>
<% if current_user.promoter? && @promoter_events.present? %>

Revenus Total

€<%= number_with_delimiter(@total_revenue, delimiter: ' ') %>

Billets Vendus

<%= @total_tickets_sold %>

Événements Publiés

<%= @active_events_count %>

Brouillons

<%= @draft_events_count %>

Revenus Mensuels

Derniers 6 mois

<% @monthly_revenue.each do |month_data| %>
<%= month_data[:month] %>
€<%= number_with_delimiter(month_data[:revenue], delimiter: ' ') %>
<% end %>

Mes Événements

<%= link_to promoter_events_path, class: "text-purple-600 hover:text-purple-800 font-medium text-sm" do %> Voir tout → <% end %>
<% @promoter_events.each do |event| %>

<%= event.name %>

<%= event.state.humanize %>
<%= event.start_time&.strftime("%d %B %Y") || "Non programmé" %>
<%= event.tickets.where(status: 'active').count %> billets vendus
<%= link_to promoter_event_path(event), class: "text-purple-600 hover:text-purple-800 text-xs font-medium" do %> Gérer → <% end %>
<% end %>
<%= link_to new_promoter_event_path, class: "inline-flex items-center px-4 py-2 bg-gray-900 text-white text-sm font-medium rounded-lg hover:bg-gray-800 transition-colors" do %> Nouvel Événement <% end %>
<% if @recent_orders.any? %>

Commandes Récentes

Dernières commandes pour vos événements

<% @recent_orders.each do |order| %> <% end %>
Événement Client Billets Montant Date
<%= order.event.name %> <%= order.user.email %> <%= order.tickets.count %> €<%= order.total_amount_euros %> <%= order.created_at.strftime("%d/%m/%Y") %>
<% end %> <% end %> <% if @draft_orders.any? %>

Commandes en Attente de Paiement

Vous avez des commandes qui nécessitent un paiement

<% @draft_orders.each do |order| %>

<%= order.event.name %>

<%= order.event.start_time.strftime("%d %B %Y à %H:%M") %>

Order #<%= order.id %>
<% order.tickets.each do |ticket| %>
<%= ticket.ticket_type.name %> - <%= ticket.first_name %> <%= ticket.last_name %>
<%= number_to_currency(ticket.price_euros, unit: "€") %>
<% end %>
Tentatives: <%= order.payment_attempts %>/3
<% if order.expiring_soon? %> ⚠️ Expire dans <%= time_ago_in_words(order.expires_at) %> <% else %> Expire dans <%= time_ago_in_words(order.expires_at) %> <% end %>
<%= link_to retry_payment_order_path(order), method: :post, class: "inline-flex items-center px-4 py-2 bg-orange-600 text-white text-sm font-medium rounded-lg hover:bg-orange-700 transition-colors duration-200 whitespace-nowrap" do %> Reprendre le Paiement (€<%= order.total_amount_euros %>) <% end %>
<% end %>
<% end %>

Mes Commandes

<%= pluralize(@user_orders.count, 'commande') %>
<% if @user_orders.any? %>
<% @user_orders.each do |order| %>

<%= order.event.name %>

<%= order.status.humanize %>
<%= order.event.start_time.strftime("%d %B %Y à %H:%M") %>
<%= order.event.venue_name %>
<%= pluralize(order.tickets.count, 'billet') %>
Order #<%= order.id %> • <%= order.created_at.strftime("%m/%d/%Y") %> • €<%= order.total_amount_euros %>
<%= link_to order_path(order), class: "inline-flex items-center px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white text-sm font-medium rounded-lg transition-colors duration-200 whitespace-nowrap" do %> Voir les Détails <% end %>
<% order.tickets.limit(3).each do |ticket| %>
<%= ticket.ticket_type.name %> - <%= ticket.first_name %> <%= ticket.last_name %>
<%= link_to ticket_download_path(ticket.qr_code), class: "text-purple-600 hover:text-purple-800" do %> <% end %>
<% end %> <% if order.tickets.count > 3 %>
et <%= pluralize(order.tickets.count - 3, 'autre billet') %>
<% end %>
<% end %>
<% if @user_orders.count >= 10 %>
<%= link_to "Voir Toutes Mes Commandes", orders_path, class: "text-purple-600 hover:text-purple-800 font-medium transition-colors duration-200" %>
<% end %> <% else %>

Aucune Commande

Vous n'avez pas encore passé de commandes.

<%= link_to events_path, class: "inline-flex items-center px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors duration-200" do %> Découvrir des Événements <% end %>
<% end %>
<% if @user_orders.any? %>

Découvrir d'autres événements

<%= link_to events_path, class: "text-purple-600 hover:text-purple-800 font-medium transition-colors duration-200 whitespace-nowrap" do %> Voir tout → <% end %>
<% if @upcoming_preview_events.any? %>
<% @upcoming_preview_events.each do |event| %>

<%= event.name %>

<%= event.start_time.strftime("%d %B") %>
<%= event.venue_name %>
<%= link_to event_path(event.slug, event), class: "text-purple-600 hover:text-purple-800 text-sm font-medium" do %> Voir l'Événement → <% end %>
<% end %>
<% else %>

Aucun événement à venir pour le moment.

<% end %>
<% end %>