allisonlarson/rmmts

View on GitHub
app/views/payments/index.html.erb

Summary

Maintainability
Test Coverage
<div class="payments">
  <%= render "/shared/sidebar" %>

  <div class="main-content">
    <%= render "/shared/user_nav" %>


    <div class="content">
      <h3>Payments</h3>
      <table class="payments-table">
        <tr>
          <th>Name</th>
          <th>Amount</th>
          <th>Pay to</th>
          <th>Paid At</th>
        </tr>
        <% @payments.each do |payment| %>
          <tr>
            <td><%= payment.expense.name %></td>
            <td><%= payment.amount %></td>
            <td><%= payment.payee.name %></td>
            <td><%= payment.paid_at.try(:strftime, "%m/%d/%Y %l:%M %p") %></td>
            <td><% if !payment.paid_at %>
              <%= link_to "Pay", society_user_payment_pay_path(payment_id: payment.id), method: "POST", class: "btn" %>
            <% end %></td>
        </tr>
      <% end %>
      </table>

      <h3>Collections</h3>
      <table class="collections-table">
        <tr>
          <th>Name</th>
          <th>Amount</th>
          <th>Pay to</th>
          <th>Paid At</th>
        </tr>
        <% @collections.each do |collection| %>
          <tr>
            <td><%= collection.expense.name %></td>
            <td><%= collection.amount %></td>
            <td><%= collection.payer.name %></td>
            <td><%= collection.paid_at.try(:strftime, "%m/%d/%Y %l:%M %p") %></td>
            <td><% if !collection.paid_at %>
              <%= link_to "Mark as Paid", society_user_payment_path(id: collection.id, payment: { paid: 1 }), method: "PATCH", class: "btn" %>
            <% end %></td>
          </tr>
        <% end %>
      </table>
    </div>
  </div>
  <div>