2020-02-07 17:37:00 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-03-23 18:39:41 +01:00
|
|
|
json.array!(@availabilities) do |a|
|
2017-02-22 17:45:22 +01:00
|
|
|
json.id a.slot_id if a.slot_id
|
2016-03-23 18:39:41 +01:00
|
|
|
if a.is_reserved
|
2016-06-22 12:54:12 +02:00
|
|
|
json.is_reserved true
|
2016-03-23 18:39:41 +01:00
|
|
|
json.title "#{a.trainings[0].name}' - #{t('trainings.i_ve_reserved')}"
|
2018-12-03 15:10:04 +01:00
|
|
|
elsif a.completed?
|
2016-06-22 12:54:12 +02:00
|
|
|
json.is_completed true
|
2016-03-23 18:39:41 +01:00
|
|
|
json.title "#{a.trainings[0].name} - #{t('trainings.completed')}"
|
|
|
|
else
|
|
|
|
json.title a.trainings[0].name
|
|
|
|
end
|
2016-06-29 17:37:22 +02:00
|
|
|
json.borderColor trainings_events_border_color(a)
|
2016-03-23 18:39:41 +01:00
|
|
|
json.start a.start_at.iso8601
|
|
|
|
json.end a.end_at.iso8601
|
|
|
|
json.backgroundColor 'white'
|
|
|
|
json.can_modify a.can_modify
|
|
|
|
json.nb_total_places a.nb_total_places
|
2017-02-23 11:13:25 +01:00
|
|
|
json.availability_id a.id
|
2016-03-23 18:39:41 +01:00
|
|
|
|
|
|
|
json.training do
|
|
|
|
json.id a.trainings.first.id
|
|
|
|
json.name a.trainings.first.name
|
|
|
|
json.description a.trainings.first.description
|
|
|
|
json.machines a.trainings.first.machines do |m|
|
|
|
|
json.id m.id
|
|
|
|
json.name m.name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
json.tag_ids a.tag_ids
|
|
|
|
json.tags a.tags do |t|
|
|
|
|
json.id t.id
|
|
|
|
json.name t.name
|
|
|
|
end
|
2020-02-07 17:37:00 +01:00
|
|
|
json.plan_ids slot.availability.plan_ids
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|