1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-04 15:24:23 +01:00
fab-manager/app/views/api/availabilities/spaces.json.jbuilder

33 lines
925 B
Plaintext
Raw Normal View History

# frozen_string_literal: true
2017-02-23 17:45:55 +01:00
json.array!(@slots) do |slot|
2020-10-05 12:12:22 +02:00
json.slot_id slot.id if slot.id
2017-02-23 17:45:55 +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.is_completed slot.complete?
2017-02-23 17:45:55 +01:00
json.backgroundColor 'white'
json.borderColor space_slot_border_color(slot)
json.availability_id slot.availability_id
json.space do
json.id slot.space.id
json.name slot.space.name
2017-02-23 17:45:55 +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
2017-02-23 17:45:55 +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
json.plan_ids slot.availability.plan_ids
2017-02-23 17:45:55 +01:00
end