<% display_payment_options = (!dry_run && ((can?(:credit, Kaui::Account) && @invoice.status == 'DRAFT') || (can?(:charge, Kaui::Account) && @invoice.status == 'DRAFT') || (@invoice.balance > 0 && can?(:trigger, Kaui::Payment)))) if !(@custom_fields ||= nil).blank? || display_payment_options %>
<%= render :partial => 'kaui/custom_fields/list_bar', :locals => {:custom_fields => @custom_fields} %> <% if display_payment_options %>
<% if can?(:credit, Kaui::Account) && @invoice.status == 'DRAFT' %> <%= link_to ' Add credit'.html_safe, kaui_engine.new_account_credit_path(@invoice.account_id, :currency => @invoice.currency, :invoice_id => @invoice.invoice_id) %> <% end %> <% if can?(:charge, Kaui::Account) && @invoice.status == 'DRAFT' %> <%= link_to ' Create charge'.html_safe, kaui_engine.new_account_charge_path(@invoice.account_id, :currency => @invoice.currency, :invoice_id => @invoice.invoice_id) %> <% end %> <% if @invoice.balance > 0 && can?(:trigger, Kaui::Payment) %> <%= link_to ' Make payment'.html_safe, kaui_engine.new_account_payment_path(@invoice.account_id, :invoice_id => @invoice.invoice_id) %> <% end %>
<% end %>
<% end %> <% unless (@available_invoice_item_tags ||= nil).blank? && (@custom_fields_per_invoice_item ||= nil).blank? %> <% end %> <% @invoice.items.each do |item| %> > <% unless @available_invoice_item_tags.blank? && @custom_fields_per_invoice_item.blank? %> <% end %> <% end %>
Description Start date End date Subscription ID Amount Comments
<% unless @available_invoice_item_tags.blank? %>
Tag as: <%= render :partial => 'kaui/bundle_tags/form_bar', :locals => {:params => { :invoice_id => item.invoice_id, :account_id => item.account_id}, :tag_names => (@tags_per_invoice_item[item.invoice_item_id] || []).map { |tag| tag.tag_definition_name }, :available_tags => @available_invoice_item_tags, :update_tags_path => update_invoice_items_tags_path(item.invoice_item_id) } %>
<% end %> <%= render :partial => 'kaui/custom_fields/list_bar', :locals => {:custom_fields => @custom_fields_per_invoice_item[item.invoice_item_id] || []} %>
<%= item.description %> <%= item.start_date.html_safe if item.start_date %> <%= item.end_date.html_safe if item.end_date %> <%= item.subscription_id %> <%= humanized_money_with_symbol Kaui::InvoiceItem.amount_to_money(item) %> (<%= item.currency %>) <%= item.audit_logs.map { |log| log.comments }.compact.join('
') if item.audit_logs.present? %>
<% if can? :item_adjust, Kaui::Invoice %> <%= link_to 'Adjust', kaui_engine.edit_account_invoice_item_path(@invoice.account_id, item.invoice_item_id, :invoice_id => @invoice.invoice_id), :class => "btn btn-xs #{'disabled' unless item.amount > 0}" %> <% end %>
Invoice Total: <%= humanized_money_with_symbol @invoice.amount_to_money %> (<%= @invoice.currency %>)
Credits: <%= humanized_money_with_symbol @invoice.credit_adjustment_to_money %> (<%= @invoice.currency %>)
Refunded: <%= humanized_money_with_symbol @invoice.refund_adjustment_to_money %> (<%= @invoice.currency %>)
Balance: <%= humanized_money_with_symbol @invoice.balance_to_money %> (<%= @invoice.currency %>)