Adding payments
This commit is contained in:
25
app/views/payments/_form.html.erb
Normal file
25
app/views/payments/_form.html.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<%= form_for(@payment) do |f| %>
|
||||
<% if @payment.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@payment.errors.count, "error") %> prohibited this payment from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @payment.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :user_id, "User" %><br />
|
||||
<%= collection_select(:payment, :user_id, @users, :id, :name_with_payee_and_member_level) %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :date, "Paid for month beginning" %><br />
|
||||
<%= f.date_select :date %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
6
app/views/payments/edit.html.erb
Normal file
6
app/views/payments/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing payment</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @payment %> |
|
||||
<%= link_to 'Back', payments_path %>
|
||||
24
app/views/payments/index.html.erb
Normal file
24
app/views/payments/index.html.erb
Normal file
@@ -0,0 +1,24 @@
|
||||
<h1>Listing payments</h1>
|
||||
|
||||
<%= link_to 'New Payment', new_payment_path %>
|
||||
<br />
|
||||
<table>
|
||||
<tr>
|
||||
<th>User</th>
|
||||
<th>Paid for month <br/>beginning</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @payments.each do |payment| %>
|
||||
<tr>
|
||||
<td><%= link_to payment.user.name_with_payee_and_member_level, payment.user unless payment.user.blank? %></td>
|
||||
<td><%= payment.human_date %></td>
|
||||
<td><%= link_to 'Details', payment %></td>
|
||||
<td><%= link_to 'Edit', edit_payment_path(payment) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
|
||||
5
app/views/payments/new.html.erb
Normal file
5
app/views/payments/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New payment</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', payments_path %>
|
||||
29
app/views/payments/show.html.erb
Normal file
29
app/views/payments/show.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<p>
|
||||
<b>User:</b>
|
||||
<%= @payment.user.name_with_payee_and_member_level unless @payment.user.blank? %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Paid for month beginning:</b>
|
||||
<%= @payment.date %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Last Modified by:</b>
|
||||
<%= user = @users.find{|u| u.id == @payment.created_by}; link_to user.name, user unless user.blank? %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Created date:</b>
|
||||
<%= @payment.created_at %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Updated date:</b>
|
||||
<%= @payment.updated_at %>
|
||||
</p>
|
||||
|
||||
|
||||
<%= link_to 'Edit', edit_payment_path(@payment) %> |
|
||||
<%= link_to 'Destroy', @payment, :confirm => 'Are you sure you want to destroy this payment?', :method => :delete if can? :destroy, @payment %> |
|
||||
<%= link_to 'Back', payments_path %>
|
||||
Reference in New Issue
Block a user