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/reservations/show.json.jbuilder
2022-06-29 15:34:04 +02:00

19 lines
635 B
Ruby

# frozen_string_literal: true
json.partial! 'api/reservations/reservation', reservation: @reservation
json.user do
json.id @reservation.user.id
if @reservation.user.subscribed_plan
json.subscribed_plan do
json.partial! 'api/shared/plan', plan: @reservation.user.subscribed_plan
end
end
json.training_credits @reservation.user.training_credits do |tc|
json.training_id tc.creditable_id
end
json.machine_credits @reservation.user.machine_credits do |mc|
json.machine_id mc.creditable_id
json.hours_used mc.users_credits.find_by(user_id: @reservation.statistic_profile.user_id).hours_used
end
end