Add Income tracking to the Purchase System
[cs356-p2-videostore.git] / app / views / purchase / list.rhtml
index 593b7a6..504bc61 100644 (file)
@@ -1,20 +1,21 @@
 <h1>Listing purchases</h1>
 
-<table>
+<table border="1">
   <tr>
-  <% for column in Purchase.content_columns %>
-    <th><%= column.human_name %></th>
-  <% end %>
+    <th>Date</th>
+    <th>Type</th>
+    <th>Title</th>
+    <th>Price</th>
+    <th>Customer</th>
   </tr>
   
 <% for purchase in @purchases %>
   <tr>
-  <% for column in Purchase.content_columns %>
-    <td><%=h purchase.send(column.name) %></td>
-  <% end %>
-    <td><%= link_to 'Show', :action => 'show', :id => purchase %></td>
-    <td><%= link_to 'Edit', :action => 'edit', :id => purchase %></td>
-    <td><%= link_to 'Destroy', { :action => 'destroy', :id => purchase }, :confirm => 'Are you sure?', :method => :post %></td>
+    <td><%=link_to purchase.date, :action => 'filterbydate', :id => purchase.date %></td>
+    <td><%=link_to purchase.class, :action => 'filterbytype', :id => purchase.type %></td>
+    <td><%=h purchase.title %></td>
+    <td><%=h number_to_currency(purchase.price) %></td>
+    <td><%=link_to purchase.customer.name, :action => 'filterbycust', :id => purchase.customer_id %></td>
   </tr>
 <% end %>
 </table>
@@ -22,6 +23,3 @@
 <%= link_to 'Previous page', { :page => @purchase_pages.current.previous } if @purchase_pages.current.previous %>
 <%= link_to 'Next page', { :page => @purchase_pages.current.next } if @purchase_pages.current.next %> 
 
-<br />
-
-<%= link_to 'New purchase', :action => 'new' %>