<%= select_tag "bundles", options_for_select([ "" ] + @bundle_names.values.sort, @selected_bundle || 'all') %>

<% if @account.present? && @timeline.present? %> <% @timeline.invoices.each do |invoice_stub| %> <% if invoice_stub.bundle_keys.present? %> <% bundles = invoice_stub.bundle_keys.split(",").map {|bundle_key| @bundle_names[bundle_key] }.join(",") %> <% end %> <% if invoice_stub.invoice_id.present? && @invoices_by_id.has_key?(invoice_stub.invoice_id) %> <% invoice = @invoices_by_id[invoice_stub.invoice_id] %> <% else %> <% invoice = invoice_stub %> <% end %> <% end %> <% @timeline.payments.each do |payment| %> <% if payment.bundle_keys.present? %> <% bundles = payment.bundle_keys.split(",").map {|bundle_key| @bundle_names[bundle_key] }.join(",") %> <% end %> <% if payment.invoice_id.present? %> <% invoice = @invoices_by_id[payment.invoice_id] %> <% else %> <% invoice = nil %> <% end %> <% end %> <% @timeline.bundles.each do |bundle| %> <% bundle.subscriptions.each do |sub| %> <% sub.events.each do |event| %> <% end %> <% end %> <% end %> <% end %>
Requested Date Effective Date Bundle Name Event Type Details Reason Code / Comments Actions
<% if invoice.invoice_dt.present? %> <%= format_date(invoice.invoice_dt).html_safe %> <% else %> [unknown] <% end %> <% if invoice.target_dt.present? %> <%= format_date(invoice.target_dt).html_safe %> <% else %> [unknown] <% end %> <% if invoice_stub.bundle_keys.present? %> <% invoice_stub.bundle_keys.split(",").each do |bundle_key| %> <%= link_to @bundle_names[bundle_key], Kaui.bundle_home_path.call(bundle_key) %>
<% end %> <% end %>
<%= "INVOICE" %> <%= "Amount:" %> <%= invoice.amount %>
<%= "Balance:" %> <%= invoice.balance %>
<%= "Invoice #" %> <%= link_to invoice.invoice_number, invoice_path(:id => invoice.invoice_id) %>
<% if invoice.balance > 0 %> <%= link_to "External Payment", kaui_engine.new_credit_path(:params => { :account_id => @account.account_id, :invoice_id => invoice.invoice_id }), :class => "btn btn-mini" %> <% end %>
<% if payment.requested_dt.present? %> <%= format_date(payment.requested_dt).html_safe %> <% else %> [unknown] <% end %> <% if payment.effective_dt.present? %> <%= format_date(payment.effective_dt).html_safe %> <% else %> [unknown] <% end %> <% payment.bundle_keys.split(",").each do |bundle_key| %> <%= link_to @bundle_names[bundle_key], Kaui.bundle_home_path.call(bundle_key) %>
<% end %>
<%= "PAYMENT" %> <%= "Total amount:" %> <%= payment.amount %> <%= @account.currency %>
<%= "Paid amount:" %> <%= payment.amount %> <%= @account.currency %>
class="alert-error" <% elsif payment.status == 'Success' %>class="alert-success" <% end %>> <%= payment.status %>
<%= "Invoice #" %> <%= link_to invoice.invoice_number, invoice_path(:id => invoice.invoice_id) %>
<% if payment.payment_id.present? %> <%= link_to 'Refund', kaui_engine.new_refund_path(:params => { :payment_id => payment.payment_id, :account_id => @account.account_id, :invoice_id => payment.invoice_id }), :class => "btn btn-mini" %> <%= link_to 'Chargeback', kaui_engine.new_chargeback_path(:params => { :payment_id => payment.payment_id, :account_id => @account.account_id, :invoice_id => payment.invoice_id }), :class => "btn btn-mini" %> <% elsif invoice.balance > 0 %> <%= link_to 'Pay', kaui_engine.new_chargeback_path(:params => { :payment_id => payment.payment_id, :account_id => @account.account_id, :invoice_id => payment.invoice_id }), :class => "btn btn-mini" %> <% end %>
<% if event.requested_dt.present? %> <%= format_date(event.requested_dt).html_safe %> <% else %> [unknown] <% end %> <% if event.effective_dt.present? %> <%= format_date(event.effective_dt).html_safe %> <% else %> [unknown] <% end %> <%= link_to @bundle_names[bundle.external_key], Kaui.bundle_home_path.call(bundle.external_key) %>
<%= event.event_type %> <%= event.product %> <%= event.billing_period == 'NO_BILLING_PERIOD' || event.billing_period.nil? ? "" : event.billing_period.downcase.capitalize %> <%= event.phase.downcase.capitalize if event.phase.present? %>
<%= link_to 'Back', :back, :class => 'btn' %>
<%= javascript_tag do %> function filterBundles() { var bundle = $("#bundles").val(); var dataTable = $("#timeline-table").dataTable(); $(dataTable.fnGetNodes()).each(function() { var tr = $(this); if (bundle == "" || tr.attr("title").split(",").indexOf(bundle) >= 0) { tr.removeClass("hide"); } else { tr.addClass("hide"); } }); dataTable.fnDraw(); } $(document).ready(function() { $("#bundles").change(filterBundles); filterBundles(); }); <% end %>