1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-11 22:24:21 +01:00
fab-manager/app/views/api/availabilities/machine.json.jbuilder

19 lines
562 B
Plaintext
Raw Normal View History

# frozen_string_literal: true
2016-03-23 18:39:41 +01:00
json.array!(@slots) do |slot|
json.partial! 'api/availabilities/slot', slot: slot, operator_role: @operator_role, reservable: @machine
json.borderColor machines_slot_border_color(slot)
2016-03-23 18:39:41 +01:00
json.machine do
json.id @machine.id
json.name @machine.name
2016-03-23 18:39:41 +01:00
end
# the user who booked the slot, if the slot was reserved
if (%w[admin manager].include? @current_user_role) && slot.reservation
json.user do
json.id slot.reservation.user&.id
json.name slot.reservation.user&.profile&.full_name
end
end
2016-03-23 18:39:41 +01:00
end