- Rename download_ticket action to download for consistency - Use QR code lookup consistently in both show and download actions - Simplify routes to use QR code pattern for both viewing and downloading - Remove complex dual-lookup logic in favor of consistent QR code access - Clean up route constraints and duplicate route definitions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
193 lines
9.8 KiB
Plaintext
193 lines
9.8 KiB
Plaintext
<div class="min-h-screen bg-gradient-to-br from-gray-50 to-gray-100 py-8">
|
|
<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
<!-- Breadcrumb -->
|
|
<nav class="mb-8" 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 dashboard_path, class: "text-gray-500 hover:text-purple-600 transition-colors" do %>
|
|
Tableau de bord
|
|
<% 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>
|
|
<li class="font-medium text-gray-900" aria-current="page">Billet #<%= @ticket.id %></li>
|
|
</ol>
|
|
</nav>
|
|
|
|
<div class="bg-white rounded-2xl shadow-xl overflow-hidden">
|
|
<!-- Ticket Header -->
|
|
<div class="bg-gradient-to-r from-purple-600 to-indigo-600 px-8 py-6">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<h1 class="text-2xl md:text-3xl font-bold text-white mb-2">Billet Électronique</h1>
|
|
<p class="text-purple-100">ID: #<%= @ticket.id %></p>
|
|
</div>
|
|
<div class="text-right">
|
|
<div class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium <%=
|
|
case @ticket.status
|
|
when 'active' then 'bg-green-100 text-green-800'
|
|
when 'draft' then 'bg-yellow-100 text-yellow-800'
|
|
when 'used' then 'bg-gray-100 text-gray-800'
|
|
when 'expired' then 'bg-red-100 text-red-800'
|
|
when 'refunded' then 'bg-blue-100 text-blue-800'
|
|
else 'bg-gray-100 text-gray-800'
|
|
end %>">
|
|
<%=
|
|
case @ticket.status
|
|
when 'active' then 'Valide'
|
|
when 'draft' then 'En attente'
|
|
when 'used' then 'Utilisé'
|
|
when 'expired' then 'Expiré'
|
|
when 'refunded' then 'Remboursé'
|
|
else @ticket.status.humanize
|
|
end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="p-8">
|
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
|
<!-- Event Details -->
|
|
<div>
|
|
<h2 class="text-xl font-semibold text-gray-900 mb-6">Détails de l'événement</h2>
|
|
|
|
<div class="space-y-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-500 mb-1">Événement</label>
|
|
<p class="text-lg font-semibold text-gray-900"><%= @event.name %></p>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-500 mb-1">Date et heure</label>
|
|
<div class="flex items-center text-gray-900">
|
|
<svg class="w-4 h-4 mr-2 text-gray-400" 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>
|
|
<%= @event.start_time.strftime("%d %B %Y") %><br>
|
|
<small class="text-gray-600"><%= @event.start_time.strftime("%H:%M") %></small>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-500 mb-1">Lieu</label>
|
|
<div class="flex items-center text-gray-900">
|
|
<svg class="w-4 h-4 mr-2 text-gray-400" 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"/>
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"/>
|
|
</svg>
|
|
<%= @event.venue_name %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-500 mb-1">Type de billet</label>
|
|
<p class="text-gray-900 font-medium"><%= @ticket.ticket_type.name %></p>
|
|
<p class="text-sm text-gray-600"><%= @ticket.ticket_type.description %></p>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-500 mb-1">Prix</label>
|
|
<p class="text-xl font-bold text-gray-900">
|
|
<%= number_to_currency(@ticket.price_euros, unit: "€", separator: ",", delimiter: " ", format: "%n %u") %>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Ticket Details -->
|
|
<div>
|
|
<h2 class="text-xl font-semibold text-gray-900 mb-6">Informations du billet</h2>
|
|
|
|
<div class="space-y-4">
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-500 mb-1">Prénom</label>
|
|
<p class="text-gray-900 font-medium"><%= @ticket.first_name %></p>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-500 mb-1">Nom</label>
|
|
<p class="text-gray-900 font-medium"><%= @ticket.last_name %></p>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-500 mb-1">Date d'achat</label>
|
|
<p class="text-gray-900"><%= @ticket.created_at.strftime("%d %B %Y à %H:%M") %></p>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-500 mb-1">QR Code</label>
|
|
<div class="bg-gray-50 rounded-lg p-4 text-center">
|
|
<div class="inline-block bg-white p-4 rounded-lg shadow-sm">
|
|
<div data-controller="qr-code" data-qr-code-data-value="<%= @ticket.qr_code %>" class="w-32 h-32">
|
|
<!-- Loading indicator -->
|
|
<div data-qr-code-target="loading" class="w-32 h-32 bg-gray-100 rounded flex items-center justify-center">
|
|
<div class="animate-spin rounded-full h-8 w-8 border-b-2 border-purple-600"></div>
|
|
</div>
|
|
<!-- QR code container -->
|
|
<div data-qr-code-target="container" class="w-32 h-32"></div>
|
|
</div>
|
|
</div>
|
|
<p class="text-xs text-gray-500 mt-2 font-mono"><%= @ticket.qr_code %></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Actions -->
|
|
<div class="mt-8 pt-6 border-t border-gray-200">
|
|
<div class="flex flex-col sm:flex-row gap-4">
|
|
<%= link_to dashboard_path,
|
|
class: "px-6 py-3 border border-gray-300 text-gray-700 rounded-xl hover:bg-gray-50 text-center font-medium transition-colors duration-200" do %>
|
|
<svg class="w-4 h-4 inline-block mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16l-4-4m0 0l4-4m-4 4h18"/>
|
|
</svg>
|
|
Retour au tableau de bord
|
|
<% end %>
|
|
|
|
<% if @ticket.status == 'active' %>
|
|
<%= link_to ticket_download_path(@ticket.qr_code),
|
|
class: "flex-1 bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-700 hover:to-indigo-700 text-white font-medium py-3 px-6 rounded-xl shadow-sm transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-2 transform hover:-translate-y-0.5 text-center" do %>
|
|
<svg class="w-4 h-4 inline-block mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
|
|
</svg>
|
|
Télécharger le PDF
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Important Notice -->
|
|
<div class="mt-6 bg-blue-50 border border-blue-200 rounded-lg p-4">
|
|
<div class="flex items-start">
|
|
<svg class="w-5 h-5 text-blue-600 mr-2 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
|
</svg>
|
|
<div class="flex-1">
|
|
<h3 class="text-blue-800 font-medium mb-1">Informations importantes</h3>
|
|
<ul class="text-blue-700 text-sm space-y-1">
|
|
<li>• Présentez ce billet (ou son code QR) à l'entrée de l'événement</li>
|
|
<li>• Arrivez en avance pour éviter les files d'attente</li>
|
|
<li>• En cas de problème, contactez l'organisateur</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|