2019-03-28 11:30:25 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-05-12 14:54:56 +02:00
|
|
|
json.extract! event, :id, :title, :description
|
2022-11-08 17:41:18 +01:00
|
|
|
if event.event_image
|
|
|
|
json.event_image_attributes do
|
|
|
|
json.id event.event_image.id
|
|
|
|
json.attachment_name event.event_image.attachment_identifier
|
2023-02-15 16:30:21 +01:00
|
|
|
json.attachment_url "#{event.event_image.attachment_url}?#{event.event_image.updated_at.to_i}"
|
2022-11-08 17:41:18 +01:00
|
|
|
end
|
|
|
|
end
|
2015-05-05 03:10:25 +02:00
|
|
|
json.event_files_attributes event.event_files do |f|
|
|
|
|
json.id f.id
|
2022-11-08 17:41:18 +01:00
|
|
|
json.attachment_name f.attachment_identifier
|
2015-05-05 03:10:25 +02:00
|
|
|
json.attachment_url f.attachment_url
|
|
|
|
end
|
2016-07-25 16:16:25 +02:00
|
|
|
json.category_id event.category_id
|
2019-03-28 11:30:25 +01:00
|
|
|
if event.category
|
|
|
|
json.category do
|
|
|
|
json.id event.category.id
|
|
|
|
json.name event.category.name
|
2019-04-02 16:19:23 +02:00
|
|
|
json.slug event.category.slug
|
2019-03-28 11:30:25 +01:00
|
|
|
end
|
|
|
|
end
|
2016-06-29 17:05:42 +02:00
|
|
|
json.event_theme_ids event.event_theme_ids
|
|
|
|
json.event_themes event.event_themes do |e|
|
|
|
|
json.name e.name
|
|
|
|
end
|
|
|
|
json.age_range_id event.age_range_id
|
2019-03-28 11:30:25 +01:00
|
|
|
if event.age_range
|
|
|
|
json.age_range do
|
|
|
|
json.name event.age_range.name
|
|
|
|
end
|
|
|
|
end
|
2022-11-08 17:41:18 +01:00
|
|
|
json.start_date event.availability.start_at.to_date
|
|
|
|
json.start_time event.availability.start_at.strftime('%R')
|
|
|
|
json.end_date event.availability.end_at.to_date
|
|
|
|
json.end_time event.availability.end_at.strftime('%R')
|
2016-03-23 18:39:41 +01:00
|
|
|
json.month t('date.month_names')[event.availability.start_at.month]
|
2015-05-05 03:10:25 +02:00
|
|
|
json.month_id event.availability.start_at.month
|
|
|
|
json.year event.availability.start_at.year
|
2022-06-15 09:42:39 +02:00
|
|
|
json.all_day event.all_day?
|
2015-05-05 03:10:25 +02:00
|
|
|
json.availability do
|
|
|
|
json.id event.availability.id
|
|
|
|
json.start_at event.availability.start_at
|
|
|
|
json.end_at event.availability.end_at
|
2022-07-20 15:54:04 +02:00
|
|
|
json.slot_id event.availability.slots.first&.id
|
2015-05-05 03:10:25 +02:00
|
|
|
end
|
|
|
|
json.availability_id event.availability_id
|
2022-11-08 17:41:18 +01:00
|
|
|
json.amount event.amount / 100.0 if event.amount
|
|
|
|
json.event_price_categories_attributes event.event_price_categories do |p_cat|
|
2016-08-25 13:56:07 +02:00
|
|
|
json.id p_cat.id
|
2022-11-08 17:41:18 +01:00
|
|
|
json.price_category_id p_cat.price_category.id
|
|
|
|
json.amount p_cat.amount / 100.0
|
2016-08-25 13:56:07 +02:00
|
|
|
json.category do
|
|
|
|
json.extract! p_cat.price_category, :id, :name
|
|
|
|
end
|
|
|
|
end
|
2015-05-05 03:10:25 +02:00
|
|
|
json.nb_total_places event.nb_total_places
|
2016-03-23 18:39:41 +01:00
|
|
|
json.nb_free_places event.nb_free_places || event.nb_total_places
|
2016-06-29 17:05:42 +02:00
|
|
|
|
2022-11-10 16:14:49 +01:00
|
|
|
if event.advanced_accounting
|
|
|
|
json.advanced_accounting_attributes do
|
|
|
|
json.partial! 'api/advanced_accounting/advanced_accounting', advanced_accounting: event.advanced_accounting
|
|
|
|
end
|
|
|
|
end
|