feat: Implement complete event ticketing system with Stripe integration and email confirmations

- Enhanced events index page with improved visual design and better information display
- Completely redesigned event show page with modern layout, ticket selection, and checkout functionality
- Implemented Stripe payment processing for ticket purchases
- Created ticket generation system with PDF tickets and QR codes
- Added email confirmation system with ticket attachments
- Updated database configuration to use SQLite for easier development setup
- Fixed gem dependencies and resolved conflicts
- Improved error handling throughout the checkout process
- Enhanced Stimulus controller for ticket cart management
- Added proper redirect handling for successful and cancelled payments
This commit is contained in:
kbe
2025-08-28 18:03:48 +02:00
parent 49ad935855
commit 4e2445198f
23 changed files with 1376 additions and 279 deletions

View File

@@ -8,9 +8,9 @@
<div class="hidden sm:flex space-x-6">
<%= link_to t("header.parties"), events_path,
class: "bg-black text-gray-100 hover:text-purple-200 px-3 py-2 rounded-md text-sm font-medium transition-colors duration-200" %>
class: "text-gray-100 hover:text-purple-200 py-2 rounded-md text-sm font-medium transition-colors duration-200" %>
<%= link_to t("header.concerts"), "#",
class: "bg-black text-gray-100 hover:text-purple-200 px-3 py-2 rounded-md text-sm font-medium transition-colors duration-200" %>
class: "text-gray-100 hover:text-purple-200 py-2 rounded-md text-sm font-medium transition-colors duration-200" %>
</div>
</div>
@@ -34,7 +34,7 @@
class: "block px-4 py-2 text-sm bg-black text-gray-100 hover:bg-purple-700" %>
<%= link_to t("header.logout"), destroy_user_session_path,
data: { controller: "logout", action: "click->logout#signOut",
logout_url_value: destroy_user_session_path, login_url_value: new_user_session_path, turbo: false },
logout_url_value: destroy_user_session_path, redirect_url_value: "/", turbo: false },
class: "block px-4 py-2 text-sm bg-black text-gray-100 hover:bg-purple-700 last:rounded-b-md" %>
</div>
</div>

View File

@@ -1,66 +1,69 @@
<div class="card rounded-2xl <%= sold_out ? "border border-neutral-200 opacity-75" : "border border-neutral-200 " %>">
<div class="card-body p-6">
<div class="flex justify-between items-start mb-4">
<div class="bg-white rounded-xl border <%= sold_out ? "border-gray-200 opacity-75" : "border-purple-200" %> shadow-sm overflow-hidden">
<div class="p-5">
<div class="flex justify-between items-start mb-3">
<div>
<h3 class="text-xl font-bold text-primary <%= "text-slate-400" if sold_out %>"><%= name %></h3>
<p class="text-neutral-600 text-sm <%= "text-slate-400" if sold_out %>"><%= description %></p>
<h3 class="text-lg font-bold text-gray-900 <%= "text-gray-400" if sold_out %>"><%= name %></h3>
<p class="text-gray-600 text-sm <%= "text-gray-400" if sold_out %>"><%= description %></p>
</div>
<div class="text-right">
<p class="text-2xl font-bold text-primary <%= "text-slate-400" if sold_out %>">
<p class="text-xl font-bold text-purple-700 <%= "text-gray-400" if sold_out %>">
<%= number_to_currency(price_cents / 100.0, unit: "€") %>
</p>
</div>
</div>
<div class="flex justify-between items-center">
<div class="flex justify-between items-center mt-4">
<div>
<p class="text-sm text-neutral-600 flex items-center">
<% if sold_out %>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800 ml-2">
<svg class="-ml-0.5 mr-1.5 h-2 w-2 text-red-400" fill="currentColor" viewBox="0 0 8 8">
<circle cx="4" cy="4" r="3" />
</svg>
Sold Out
</span>
<% else %>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 ml-2">
<svg class="-ml-0.5 mr-1.5 h-2 w-2 text-green-400" fill="currentColor" viewBox="0 0 8 8">
<circle cx="4" cy="4" r="3" />
</svg>
<%= remaining %> available
</span>
<% end %>
</p>
<% if sold_out %>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
<svg class="-ml-0.5 mr-1 h-2 w-2 text-red-400" fill="currentColor" viewBox="0 0 8 8">
<circle cx="4" cy="4" r="3" />
</svg>
Épuisé
</span>
<% else %>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
<svg class="-ml-0.5 mr-1 h-2 w-2 text-green-400" fill="currentColor" viewBox="0 0 8 8">
<circle cx="4" cy="4" r="3" />
</svg>
<%= remaining %> disponibles
</span>
<% end %>
</div>
<% unless sold_out %>
<div class="flex items-center space-x-2">
<button type="button"
class="w-8 h-8 rounded-full bg-slate-200 hover:bg-slate-300 flex items-center justify-center transition-colors duration-200"
onclick="decreaseQuantity(<%= id %>)">
<span class="text-slate-600">-</span>
class="w-8 h-8 rounded-full bg-gray-100 hover:bg-gray-200 flex items-center justify-center transition-colors duration-200"
data-action="click->ticket-cart#decreaseQuantity"
data-ticket-cart-ticket-type-id-param="<%= id %>"
data-ticket-cart-max-param="<%= remaining %>">
<span class="text-gray-600 font-bold">-</span>
</button>
<input type="number"
id="quantity_<%= id %>"
min="0"
max="<%= remaining %>"
value="0"
class="w-12 text-center border border-slate-300 rounded px-2 py-1 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-2"
class="w-12 text-center border border-gray-300 rounded-md px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-1"
data-ticket-cart-target="quantity"
data-ticket-type-id="<%= id %>"
data-name="<%= name %>"
data-price="<%= price_cents %>"
onchange="updateCart(<%= id %>, this.dataset.name, this.dataset.price)">
data-price="<%= price_cents %>">
<button type="button"
class="w-8 h-8 rounded-full bg-slate-200 hover:bg-slate-300 flex items-center justify-center transition-colors duration-200"
onclick="increaseQuantity(<%= id %>, <%= remaining %>)">
<span class="text-slate-600">+</span>
class="w-8 h-8 rounded-full bg-gray-100 hover:bg-gray-200 flex items-center justify-center transition-colors duration-200"
data-action="click->ticket-cart#increaseQuantity"
data-ticket-cart-ticket-type-id-param="<%= id %>"
data-ticket-cart-max-param="<%= remaining %>">
<span class="text-gray-600 font-bold">+</span>
</button>
</div>
<% else %>
<div class="text-sm text-slate-500 font-medium">
<div class="text-sm text-gray-500 font-medium">
<svg class="w-5 h-5 inline-block mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path>
</svg>
Unavailable
Indisponible
</div>
<% end %>
</div>