## Backend Implementation
Enhanced TicketType model with helper methods and better validations So the full context is: ## Backend Implementation - Enhanced TicketType model with helper methods and better validations - New Promoter::TicketTypesController with full authorization - Sales status tracking (draft, available, upcoming, expired, sold_out) - New Promoter::TicketTypesController with full authorization - Safe calculation methods preventing nil value errors - Sales status tracking (draft, available, upcoming, expired, sold_out) ## Frontend Features - Modern responsive UI with Tailwind CSS styling - Interactive forms with Stimulus controller for dynamic calculations - Revenue calculators showing potential, current, and remaining revenue - Status indicators with appropriate colors and icons - Buyer analytics and purchase history display ## JavaScript Enhancements - New TicketTypeFormController for dynamic pricing calculations - Real-time total updates as users type price/quantity - Proper French currency formatting - Form validation for minimum quantities based on existing sales ## Bug Fixes Fixed nil value errors in price_euros method when price_cents is nil Added defensive programming for all calculation methods Graceful handling of incomplete ticket types during creation Proper default values for new ticket type instances ## Files Added/Modified - app/controllers/promoter/ticket_types_controller.rb (new) - app/javascript/controllers/ticket_type_form_controller.js (new) - app/views/promoter/ticket_types/*.html.erb (4 new view files) - app/models/ticket_type.rb (enhanced with helper methods) - config/routes.rb (added nested ticket_types routes) - db/migrate/*_add_requires_id_to_ticket_types.rb (new migration) ## Integration - Seamless integration with existing event management system - Updated promoter event show page with ticket management link - Proper scoping ensuring promoters only manage their own tickets - Compatible with existing ticket purchasing and checkout flow
This commit is contained in:
@@ -209,9 +209,9 @@
|
||||
<div class="bg-white rounded-lg border border-gray-200 p-6">
|
||||
<h3 class="text-lg font-semibold text-gray-900 mb-4">Actions rapides</h3>
|
||||
<div class="space-y-3">
|
||||
<%= link_to "#", class: "w-full inline-flex items-center px-4 py-2 bg-gray-50 text-gray-700 font-medium rounded-lg hover:bg-gray-100 transition-colors duration-200" do %>
|
||||
<%= link_to promoter_event_ticket_types_path(@event), class: "w-full inline-flex items-center px-4 py-2 bg-purple-600 text-white font-medium rounded-lg hover:bg-purple-700 transition-colors duration-200" do %>
|
||||
<i data-lucide="ticket" class="w-4 h-4 mr-2"></i>
|
||||
Gérer les billets
|
||||
Gérer les types de billets
|
||||
<% end %>
|
||||
<%= button_to mark_sold_out_promoter_event_path(@event), method: :patch, class: "w-full inline-flex items-center px-4 py-2 bg-gray-50 text-gray-700 font-medium rounded-lg hover:bg-gray-100 transition-colors duration-200", disabled: !@event.published? do %>
|
||||
<i data-lucide="users" class="w-4 h-4 mr-2"></i>
|
||||
|
||||
Reference in New Issue
Block a user