1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/app/views/archive/_reservation.json.jbuilder
2019-03-12 12:15:14 +01:00

24 lines
922 B
Ruby

# frozen_string_literal: true
json.extract! invoiced, :created_at, :stp_invoice_id
json.reservable do
json.type invoiced.reservable_type
json.id invoiced.reservable_id
if [Training.name, Machine.name, Space.name].include?(invoiced.reservable_type) && !invoiced.reservable.nil?
json.extract! invoiced.reservable, :name, :created_at
elsif invoiced.reservable_type == Event.name && !invoiced.reservable.nil?
json.extract! invoiced.reservable, :title, :created_at
json.prices do
json.standard_price do
json.partial! 'archive/vat', price: invoiced.reservable.amount, vat_rate: vat_rate
end
json.other_prices invoiced.reservable.event_price_categories do |price|
json.partial! 'archive/vat', price: price.amount, vat_rate: vat_rate
json.price_category do
json.extract! price.price_category, :id, :name, :created_at
end
end
end
end
end