Files
aperonight/app/views/components/_ticket_card.html.erb
2025-09-08 17:59:12 +02:00

64 lines
3.0 KiB
Plaintext
Executable File

<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-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-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 flex-col sm:flex-row sm:justify-between sm:items-center mt-4 gap-3">
<div class="<%= 'order-2 sm:order-1' unless sold_out %>">
<% 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">
<i data-lucide="x" class="w-2 h-2 mr-1 text-red-400"></i>
É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">
<i data-lucide="check-circle" class="w-2 h-2 mr-1 text-green-400"></i>
<%= remaining %> disponibles
</span>
<% end %>
</div>
<% unless sold_out %>
<div class="flex items-center space-x-2 order-1 sm:order-2">
<button type="button"
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="ticket-selection#decrement"
data-target="<%= id %>">
<span class="text-gray-600 font-bold">-</span>
</button>
<input type="number"
id="ticket_quantity_<%= id %>"
name="cart[<%= id %>][quantity]"
min="0"
max="<%= remaining %>"
value="0"
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 ticket-quantity-input"
data-ticket-selection-target="quantityInput"
data-action="change->ticket-selection#updateQuantity"
data-price="<%= price_cents %>"
data-target="<%= id %>">
<button type="button"
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="ticket-selection#increment"
data-target="<%= id %>">
<span class="text-gray-600 font-bold">+</span>
</button>
</div>
<% else %>
<div class="text-sm text-gray-500 font-medium order-1 sm:order-2">
<i data-lucide="lock" class="w-5 h-5 inline-block mr-1"></i>
Indisponible
</div>
<% end %>
</div>
</div>
</div>