2021-04-29 16:29:35 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-03-23 18:39:41 +01:00
|
|
|
json.id reservation.id
|
2019-06-05 12:24:01 +02:00
|
|
|
json.user_id reservation.statistic_profile.user_id
|
2022-04-05 14:11:46 +02:00
|
|
|
json.user_full_name reservation.user&.profile&.full_name
|
2016-03-23 18:39:41 +01:00
|
|
|
json.message reservation.message
|
2022-07-12 17:46:01 +02:00
|
|
|
json.slots_reservations_attributes reservation.slots_reservations do |sr|
|
|
|
|
json.id sr.id
|
|
|
|
json.canceled_at sr.canceled_at&.iso8601
|
2023-07-11 10:36:44 +02:00
|
|
|
json.is_valid sr.is_valid
|
2023-06-26 19:28:26 +02:00
|
|
|
json.slot_id sr.slot_id
|
2022-07-12 17:46:01 +02:00
|
|
|
json.slot_attributes do
|
|
|
|
json.id sr.slot_id
|
|
|
|
json.start_at sr.slot.start_at.iso8601
|
|
|
|
json.end_at sr.slot.end_at.iso8601
|
|
|
|
json.availability_id sr.slot.availability_id
|
|
|
|
end
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|
|
|
|
json.nb_reserve_places reservation.nb_reserve_places
|
2022-06-28 18:42:41 +02:00
|
|
|
json.tickets_attributes reservation.tickets do |t|
|
2016-08-29 16:28:26 +02:00
|
|
|
json.extract! t, :booked, :created_at
|
|
|
|
json.event_price_category do
|
|
|
|
json.extract! t.event_price_category, :id, :price_category_id
|
2016-08-29 17:51:11 +02:00
|
|
|
json.price_category do
|
|
|
|
json.extract! t.event_price_category.price_category, :id, :name
|
|
|
|
end
|
2016-08-29 16:28:26 +02:00
|
|
|
end
|
|
|
|
end
|
2019-11-25 10:45:54 +01:00
|
|
|
json.total_booked_seats reservation.total_booked_seats(canceled: true)
|
2016-03-23 18:39:41 +01:00
|
|
|
json.created_at reservation.created_at.iso8601
|
|
|
|
json.reservable_id reservation.reservable_id
|
|
|
|
json.reservable_type reservation.reservable_type
|
2022-06-28 18:42:41 +02:00
|
|
|
json.reservable do
|
|
|
|
json.id reservation.reservable.id
|
|
|
|
json.name reservation.reservable.name
|
|
|
|
end
|
2023-05-15 18:23:13 +02:00
|
|
|
json.booking_users_attributes reservation.booking_users.order(booked_type: :desc) do |bu|
|
|
|
|
json.id bu.id
|
|
|
|
json.name bu.name
|
|
|
|
json.event_price_category_id bu.event_price_category_id
|
|
|
|
json.booked_id bu.booked_id
|
|
|
|
json.booked_type bu.booked_type
|
2023-07-11 14:17:03 +02:00
|
|
|
json.age ((Time.zone.now - bu.booked.birthday.to_time) / 1.year.seconds).floor if bu.booked_type == 'Child'
|
2023-05-15 18:23:13 +02:00
|
|
|
end
|
2023-07-11 10:36:44 +02:00
|
|
|
json.is_valid reservation.slots_reservations[0].is_valid
|
2023-08-31 16:10:43 +02:00
|
|
|
json.is_paid reservation.slots_reservations[0].is_confirm
|