<% content_for(:title, @event.name) %>
<%= render 'components/breadcrumb', crumbs: [ { name: 'Accueil', path: root_path }, { name: 'Tableau de bord', path: dashboard_path }, { name: 'Mes événements', path: promoter_events_path }, { name: @event.name } ] %>
<%= link_to promoter_events_path, class: "text-gray-400 hover:text-gray-600 transition-colors flex-shrink-0" do %> <% end %>

<%= @event.name %>

<%= @event.start_time&.strftime("%d/%m/%Y à %H:%M") || "Date non définie" %> <%= @event.venue_name %>
<%= link_to edit_promoter_event_path(@event), class: "w-full sm:w-auto inline-flex items-center justify-center px-4 py-2 bg-white border border-gray-300 text-gray-700 font-medium rounded-lg hover:bg-gray-50 transition-colors duration-200" do %> Modifier <% end %> <% if @event.draft? %> <% if @event.ticket_types.blank? %> <%= button_to publish_promoter_event_path(@event), method: :patch, disabled: true, class: "w-full sm:w-auto inline-flex items-center justify-center px-4 py-2 bg-gray-400 text-white font-medium rounded-lg cursor-not-allowed transition-colors duration-200", title: "Vous devez créer au moins un type de billet avant de publier" do %> Publier <% end %> <% else %> <%= button_to publish_promoter_event_path(@event), method: :patch, class: "w-full sm:w-auto inline-flex items-center justify-center px-4 py-2 bg-green-600 text-white font-medium rounded-lg hover:bg-green-700 transition-colors duration-200" do %> Publier <% end %> <% end %> <% elsif @event.published? %> <%= button_to unpublish_promoter_event_path(@event), method: :patch, class: "w-full sm:w-auto inline-flex items-center justify-center px-4 py-2 bg-yellow-600 text-white font-medium rounded-lg hover:bg-yellow-700 transition-colors duration-200" do %> Dépublier <% end %> <% end %> <% if @event.published? %> <%= button_to cancel_promoter_event_path(@event), method: :patch, class: "w-full sm:w-auto inline-flex items-center justify-center px-4 py-2 bg-red-600 text-white font-medium rounded-lg hover:bg-red-700 transition-colors duration-200", data: { confirm: "Êtes-vous sûr de vouloir annuler cet événement ?" } do %> Annuler <% end %> <% end %>
<% case @event.state %> <% when "draft" %>

Événement en brouillon

Cet événement n'est pas visible publiquement. Publiez-le pour le rendre accessible aux utilisateurs.

<% if @event.ticket_types.blank? %>

Aucun type de billet configuré

Vous devez créer au moins un type de billet avant de pouvoir publier cet événement.

<%= link_to promoter_event_ticket_types_path(@event), class: "text-amber-600 hover:text-amber-800 font-medium text-sm whitespace-nowrap" do %> Configurer les billets <% end %>
<% end %> <% when "published" %>

Événement publié

Cet événement est visible publiquement et les utilisateurs peuvent acheter des billets.

<%= link_to event_path(@event.slug, @event), target: "_blank", class: "text-green-600 hover:text-green-800 font-medium text-sm whitespace-nowrap" do %> Voir la fiche publique <% end %>
<% when "canceled" %>

Événement annulé

Cet événement a été annulé et n'est plus accessible aux utilisateurs.

<% when "sold_out" %>

Événement complet

Tous les billets pour cet événement ont été vendus.

<%= button_to mark_available_promoter_event_path(@event), method: :patch, class: "ml-4 inline-flex items-center px-3 py-1 bg-white border border-blue-300 text-blue-700 text-sm font-medium rounded-lg hover:bg-blue-50 transition-colors duration-200" do %> Marquer comme disponible <% end %>
<% end %> <% if @event.featured? %>

Événement à la une

Cet événement est mis en avant sur la page d'accueil.

<% end %> <% if @event.published? && @event.event_started? && !@event.allow_booking_during_event? %>

Réservations fermées

L'événement a commencé et les nouvelles réservations sont désactivées.

<% end %>
<% if @event.image.present? %>
<%= @event.name %>
<% end %>

Description

<%= simple_format(@event.description) %>

Lieu

<%= @event.venue_name %>

<%= @event.venue_address %>

<%= @event.latitude %>, <%= @event.longitude %>

Statistiques

Types de billets <%= @event.ticket_types.count %>
Billets vendus <%= @event.tickets.count %>
Revenus <%= number_to_currency(@event.tickets.sum(:price_cents) / 100.0, unit: "€") %>

Informations

Créé le

<%= @event.created_at.strftime("%d/%m/%Y à %H:%M") %>

Modifié le

<%= @event.updated_at.strftime("%d/%m/%Y à %H:%M") %>

Réservation pendant l'événement

<% if @event.allow_booking_during_event? %> Autorisée <% else %> Interdite <% end %>

<% if @event.start_time %>
Début

<%= @event.start_time.strftime("%d/%m/%Y à %H:%M") %>

<% end %> <% if @event.end_time %>
Fin

<%= @event.end_time.strftime("%d/%m/%Y à %H:%M") %>

<% end %>

Actions rapides

<%= link_to promoter_event_ticket_types_path(@event), class: "w-full inline-flex items-center justify-center px-4 py-3 bg-purple-600 text-white font-medium text-sm rounded-lg hover:bg-purple-700 transition-colors duration-200" do %> Gérer les types de billets <% end %> <% if @event.sold_out? %> <%= button_to mark_available_promoter_event_path(@event), method: :patch, class: "w-full inline-flex items-center justify-center px-4 py-3 bg-blue-50 text-blue-700 font-medium text-sm rounded-lg hover:bg-blue-100 transition-colors duration-200" do %> Marquer comme disponible <% end %> <% elsif @event.published? %> <%= button_to mark_sold_out_promoter_event_path(@event), method: :patch, class: "w-full inline-flex items-center justify-center px-4 py-3 bg-gray-50 text-gray-700 font-medium text-sm rounded-lg hover:bg-gray-100 transition-colors duration-200" do %> Marquer comme complet <% end %> <% end %>
<%= button_to promoter_event_path(@event), method: :delete, data: { confirm: "Êtes-vous sûr de vouloir supprimer cet événement ? Cette action est irréversible." }, class: "w-full inline-flex items-center justify-center px-4 py-3 text-red-600 font-medium text-sm rounded-lg hover:bg-red-50 transition-colors duration-200" do %> Supprimer l'événement <% end %>