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|
|
2022-07-12 17:46:01 +02:00
|
|
|
json.partial! 'api/availabilities/slot', slot: slot, operator_role: @operator_role
|
2016-06-28 12:45:41 +02:00
|
|
|
json.borderColor machines_slot_border_color(slot)
|
2016-03-23 18:39:41 +01:00
|
|
|
|
|
|
|
json.machine do
|
2022-07-11 17:59:56 +02:00
|
|
|
json.id @machine.id
|
|
|
|
json.name @machine.name
|
2016-03-23 18:39:41 +01:00
|
|
|
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
|
2022-04-05 14:11:46 +02:00
|
|
|
json.id slot.reservation.user&.id
|
|
|
|
json.name slot.reservation.user&.profile&.full_name
|
2020-02-07 17:37:00 +01:00
|
|
|
end
|
2020-04-27 12:58:44 +02:00
|
|
|
end
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|