- Create new TicketsController with actions for name collection, creation, and checkout - Add dedicated ticket views (new.html.erb, checkout.html.erb, show.html.erb) - Update ticket_selection_controller.js to handle form submission via AJAX - Add store_cart endpoint in EventsController for session-based cart management - Update routes to support new ticket flow: /tickets/new, /create, /checkout - Fix attribute name consistency across views (title→name, starts_at→start_time) - Add Stripe checkout integration with proper error handling - Remove deprecated collect_names flow in favor of streamlined approach The flow is now: Event selection → AJAX cart storage → Name collection → Checkout → Payment
185 lines
6.7 KiB
Plaintext
Executable File
185 lines
6.7 KiB
Plaintext
Executable File
<div class="container mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
|
<div class="flex justify-between items-center my-8">
|
|
<h1 class="text-3xl font-bold text-gray-900">Événements à venir</h1>
|
|
<div class="text-sm text-gray-500">
|
|
<%= @events.total_count %>
|
|
événements trouvés
|
|
</div>
|
|
</div>
|
|
<!-- Breadcrumb -->
|
|
<nav class="mb-6" aria-label="Breadcrumb">
|
|
<ol class="flex items-center space-x-2 text-sm">
|
|
<%= link_to root_path, class: "text-gray-500 hover:text-purple-600 transition-colors" do %>
|
|
<svg
|
|
class="w-4 h-4 inline-block mr-1"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
viewBox="0 0 24 24"
|
|
>
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"
|
|
/>
|
|
</svg>
|
|
Accueil
|
|
<% end %>
|
|
<svg
|
|
class="w-4 h-4 text-gray-400"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
viewBox="0 0 24 24"
|
|
>
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M9 5l7 7-7 7"
|
|
/>
|
|
</svg>
|
|
<%= link_to events_path, class: "text-gray-500 hover:text-purple-600 transition-colors" do %>
|
|
Événements
|
|
<% end %>
|
|
</ol>
|
|
</nav>
|
|
|
|
<% if @events.any? %>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
<% @events.each do |event| %>
|
|
<div
|
|
class="
|
|
bg-white rounded-xl shadow-md overflow-hidden hover:shadow-xl transition-all
|
|
duration-300 transform hover:-translate-y-1
|
|
"
|
|
>
|
|
<% if event.image.present? %>
|
|
<div class="h-48 overflow-hidden">
|
|
<%= link_to event_path(event.slug, event) do %>
|
|
<img
|
|
src="<%= event.image %>"
|
|
alt="<%= event.name %>"
|
|
class="featured-event-image"
|
|
data-featured-event-target="animated"
|
|
>
|
|
<% end %>
|
|
</div>
|
|
<% else %>
|
|
<div
|
|
class="
|
|
h-48 bg-gradient-to-r from-purple-500 to-indigo-600 flex items-center
|
|
justify-center
|
|
"
|
|
>
|
|
<svg
|
|
class="w-16 h-16 text-white opacity-80"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
viewBox="0 0 24 24"
|
|
>
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
|
|
/>
|
|
</svg>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="p-6">
|
|
<div class="flex justify-between items-start mb-3">
|
|
<div>
|
|
<h2 class="text-xl font-bold text-gray-900 line-clamp-1"><%= event.name %></h2>
|
|
<p class="text-xs text-gray-500 flex items-center mt-1">
|
|
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"
|
|
/>
|
|
</svg>
|
|
<%= event.venue_name.truncate(20) %>
|
|
</p>
|
|
</div>
|
|
<span
|
|
class="
|
|
inline-flex items-center my-2 px-2.5 py-2 rounded-full text-xs font-medium
|
|
bg-purple-100 text-purple-800
|
|
"
|
|
>
|
|
<%= event.start_time.strftime("%d/%m") %>
|
|
</span>
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<p class="text-gray-600 text-sm line-clamp-2"><%= event.description.truncate(100) %></p>
|
|
</div>
|
|
|
|
<div class="flex justify-between items-center">
|
|
<div>
|
|
<% if event.ticket_types.any? %>
|
|
<p class="text-sm font-medium text-gray-900">
|
|
À partir de
|
|
<%= format_price(event.ticket_types.minimum(:price_cents)) %>€
|
|
</p>
|
|
<% else %>
|
|
<p class="text-sm text-gray-500">Pas de billets disponibles</p>
|
|
<% end %>
|
|
</div>
|
|
|
|
<%= link_to event_path(event.slug, event), class: "inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-lg shadow-sm text-white bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-700 hover:to-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 transition-all duration-200" do %>
|
|
Détails
|
|
<svg class="w-4 h-4 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M9 5l7 7-7 7"
|
|
/>
|
|
</svg>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="mt-8 flex justify-center">
|
|
<%= paginate @events, theme: "tailwind" %>
|
|
</div>
|
|
<% else %>
|
|
<div class="text-center py-16">
|
|
<div class="mx-auto max-w-md">
|
|
<div
|
|
class="
|
|
w-24 h-24 mx-auto bg-gradient-to-r from-purple-100 to-indigo-100 rounded-full
|
|
flex items-center justify-center mb-6
|
|
"
|
|
>
|
|
<svg
|
|
class="w-12 h-12 text-purple-600"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
viewBox="0 0 24 24"
|
|
>
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
|
|
/>
|
|
</svg>
|
|
</div>
|
|
<h3 class="text-lg font-medium text-gray-900 mb-2">Aucun événement disponible</h3>
|
|
<p class="text-gray-500 mb-6">Il n'y a aucun événement à venir pour le moment.</p>
|
|
<%= link_to "Retour à l'accueil",
|
|
root_path,
|
|
class:
|
|
"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-700 hover:to-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500" %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|