feat: Add booking control during events

- Add allow_booking_during_event boolean field to events (defaults to false)
- Implement booking_allowed? method to check if tickets can be purchased
- Add event_started? and event_ended? helper methods
- Include new option in event edit form with clear explanation
- Display booking policy status on event show page
- Add visual indicator when booking is disabled during ongoing events
- Update controller to permit new parameter

This allows promoters to control whether attendees can purchase tickets
after an event has started, providing flexibility for different event types.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
kbe
2025-09-11 08:49:01 +02:00
parent 21919c813e
commit f54742b041
7 changed files with 73 additions and 17 deletions

View File

@@ -71,23 +71,12 @@ class PagesController < ApplicationController
@monthly_revenue = (0..5).map do |months_ago|
start_date = months_ago.months.ago.beginning_of_month
end_date = months_ago.months.ago.end_of_month
<<<<<<< HEAD
revenue = current_user.events
.joins(:orders)
.where(orders: { status: ['paid', 'completed'] })
.where(orders: { created_at: start_date..end_date })
.sum('orders.total_amount_cents') / 100.0
=======
revenue = current_user.events
.joins(:orders)
.where(orders: { status: [ "paid", "completed" ] })
.where(orders: { created_at: start_date..end_date })
.sum("orders.total_amount_cents") / 100.0
>>>>>>> develop
{
month: start_date.strftime("%B %Y"),
revenue: revenue

View File

@@ -111,7 +111,7 @@ class Promoter::EventsController < ApplicationController
params.require(:event).permit(
:name, :slug, :description, :image,
:venue_name, :venue_address, :latitude, :longitude,
:start_time, :end_time, :featured
:start_time, :end_time, :featured, :allow_booking_during_event
)
end
end