houdini/app/views/nonprofits/payouts/index.html.erb

107 lines
3.1 KiB
Text
Raw Permalink Normal View History

2020-06-12 20:03:43 +00:00
<%- # License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE -%>
<%= content_for :stylesheets do %>
<%= stylesheet_link_tag 'nonprofits/payouts/index/page' %>
<% end %>
<% content_for(:footer_hidden) {'hidden'} %>
<%= content_for :javascripts do %>
2019-12-04 22:22:48 +00:00
<%= javascript_pack_tag 'i18n', 'page__nonprofits__payouts__index' %>
<script>
appl.def('has_bank', <%= !!@nonprofit.bank_account %>)
</script>
<% end %>
<%= render 'nonprofits/transaction_title',
active: :payouts,
icon_class: 'icon-bank-1',
page_name: 'Payouts' %>
<section class='table-meta'>
<div class='container--wide'>
<span class='table-meta-metric'>
2018-07-23 21:35:27 +00:00
Pending balance: <%= print_currency @pending_total, @nonprofit.currency_symbol %>
</span>
<span class='table-meta-metric'>
2018-07-23 21:35:27 +00:00
Available balance: <%= print_currency @available_total, @nonprofit.currency_symbol %>
</span>
<% if @can_make_payouts %>
<span class='table-meta-metric--blue'>
Next automatic payout: <%= 1.month.from_now.strftime('%_m/1/%Y') %>
</span>
<% end %>
<span> <%= render 'payout_button' %> </span>
</div>
</section>
<div class='panelsLayout container--wide'>
<section class='u-padding--10 u-marginTop--10'>
<% if @can_make_payouts && current_role?(:nonprofit_admin) %>
<p>Your connected bank account is <strong><%= @nonprofit.bank_account && @nonprofit.bank_account.name %></strong>.
<a class='button--micro edit'>
<!--= on 'click' (open_modal 'newBankModal') -->
<i class='fa fa-pencil'></i> Change Bank Account
</a>
</p>
<% elsif current_role?(:nonprofit_admin) %>
<%= render 'todos' %>
<% end %>
<% if @payouts.empty? %>
<p class='u-padding--30 noResults'><em>No payouts have been made yet.</em></p>
<% else %>
</section>
<table class='table--plaid'>
<thead>
<tr>
<th>Date</th>
<th>Net Amount</th>
<th>Bank account</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
<% @payouts.each do |payout| %>
<tr>
<td><%= simple_date(payout.created_at) %></td>
2018-07-23 21:35:27 +00:00
<td class='table-bigNum'><%= print_currency(payout.net_amount, payout.nonprofit.currency_symbol) %></td>
<td><%= payout.bank_name %></td>
<td>
<% if payout.status == 'paid' || payout.status == 'succeeded' %>
<span class='succeeded'>Succeeded</span>
<% elsif payout.status == 'pending' %>
<span class='pending'>Pending</span>
<% elsif payout.status == 'failed' %>
<span class='failed'>Failed</span><br />
<% unless payout.failure_message.blank? %>
<span class='failure-msg'>Message received: <br /><%= payout.failure_message %></span>
<% end %>
</span>
<% end %>
</td>
<td>
<a class='button--small u-width--full details' href='./payouts/<%=payout.id%>.csv' target='_blank'>
<i class='fa fa-file-text'></i>
Payout report (CSV)
</a>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
</div>
<div class='js-flimflam-verification'></div>
<%= render 'nonprofits/bank_accounts/modal' %>
<%= render 'nonprofits/payouts/modal' %>