1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/app/views/api/invoices/list.json.jbuilder

15 lines
651 B
Ruby

max_invoices = @invoices.except(:offset, :limit, :order).count
json.array!(@invoices) do |invoice|
json.maxInvoices max_invoices
json.extract! invoice, :id, :created_at, :reference, :invoiced_type, :user_id, :avoir_date
json.total (invoice.total / 100.00)
json.url invoice_url(invoice, format: :json)
json.name invoice.user.profile.full_name
json.has_avoir invoice.has_avoir
json.is_avoir invoice.is_a?(Avoir)
json.is_subscription_invoice invoice.is_subscription_invoice?
json.stripe invoice.stp_invoice_id?
json.date invoice.is_a?(Avoir) ? invoice.avoir_date : invoice.created_at
json.prevent_refund invoice.prevent_refund?
end