feat(promotion code): Promotion code system done
I added the features for users to use promotion code and for promoters to create on their events. May be rewrite to discount code?
This commit is contained in:
@@ -123,13 +123,58 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- Total -->
|
||||
<div class="mt-6">
|
||||
<!-- Promotion Codes Applied -->
|
||||
<% if @order.promotion_codes.any? %>
|
||||
<div class="mt-6 p-4 bg-green-50 border border-green-200 rounded-lg">
|
||||
<h3 class="text-lg font-semibold text-green-900 mb-3 flex items-center">
|
||||
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 5v2m0 4v2m0 4v2M5 5a2 2 0 00-2 2v3a2 2 0 110 4v3a2 2 0 002 2h14a2 2 0 002-2v-3a2 2 0 110-4V7a2 2 0 00-2-2H5z"/>
|
||||
</svg>
|
||||
Codes promotionnels appliqués
|
||||
</h3>
|
||||
<% @order.promotion_codes.each do |promo_code| %>
|
||||
<div class="flex items-center justify-between py-2 px-3 bg-white rounded-lg border border-green-200 mb-2 last:mb-0">
|
||||
<div class="flex items-center">
|
||||
<span class="text-sm font-medium text-green-800">
|
||||
<svg class="w-4 h-4 mr-1 inline" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
</svg>
|
||||
<%= promo_code.code %>
|
||||
</span>
|
||||
</div>
|
||||
<span class="text-sm font-semibold text-green-700">-<%= promo_code.discount_amount_euros %>€</span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- Price Breakdown -->
|
||||
<div class="mt-6 p-4 bg-gray-50 border border-gray-200 rounded-lg">
|
||||
<h3 class="text-lg font-semibold text-gray-900 mb-3">Détail du paiement</h3>
|
||||
<div class="space-y-2">
|
||||
<div class="flex items-center justify-between text-lg pt-2">
|
||||
<!-- Subtotal -->
|
||||
<div class="flex items-center justify-between text-sm">
|
||||
<span class="text-gray-600">Sous-total</span>
|
||||
<span class="font-medium text-gray-700"><%= @order.subtotal_amount_euros %>€</span>
|
||||
</div>
|
||||
|
||||
<!-- Discount -->
|
||||
<% if @order.discount_amount_cents > 0 %>
|
||||
<div class="flex items-center justify-between text-sm">
|
||||
<span class="text-green-600">Réduction</span>
|
||||
<span class="font-semibold text-green-600">-<%= @order.discount_amount_euros %>€</span>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- Total -->
|
||||
<div class="flex items-center justify-between pt-2 border-t border-gray-300">
|
||||
<span class="font-medium text-gray-900">Total payé</span>
|
||||
<span class="font-bold text-2xl text-green-600">
|
||||
<%= @order.total_amount_euros %>€
|
||||
<span class="font-bold text-xl text-green-600">
|
||||
<% if @order.total_amount_cents == 0 %>
|
||||
GRATUIT
|
||||
<% else %>
|
||||
<%= @order.total_amount_euros %>€
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user