2020-02-07 17:37:00 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-03-23 18:39:41 +01:00
|
|
|
json.array!(@slots) do |slot|
|
2020-09-30 16:32:01 +02:00
|
|
|
json.slot_id slot.id if slot.id
|
2016-03-23 18:39:41 +01:00
|
|
|
json.can_modify slot.can_modify
|
|
|
|
json.title slot.title
|
|
|
|
json.start slot.start_at.iso8601
|
|
|
|
json.end slot.end_at.iso8601
|
|
|
|
json.is_reserved slot.is_reserved
|
|
|
|
json.backgroundColor 'white'
|
2016-06-28 12:45:41 +02:00
|
|
|
json.borderColor machines_slot_border_color(slot)
|
2016-03-23 18:39:41 +01:00
|
|
|
|
|
|
|
json.availability_id slot.availability_id
|
|
|
|
json.machine do
|
|
|
|
json.id slot.machine.id
|
|
|
|
json.name slot.machine.name
|
|
|
|
end
|
2020-04-27 12:58:44 +02:00
|
|
|
# the user who booked the slot, if the slot was reserved
|
|
|
|
if (%w[admin manager].include? @current_user_role) && slot.reservation
|
2020-02-07 17:37:00 +01:00
|
|
|
json.user do
|
|
|
|
json.id slot.reservation.user.id
|
|
|
|
json.name slot.reservation.user.profile.full_name
|
|
|
|
end
|
2020-04-27 12:58:44 +02:00
|
|
|
end
|
2016-03-23 18:39:41 +01:00
|
|
|
json.tag_ids slot.availability.tag_ids
|
|
|
|
json.tags slot.availability.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
|