Updated order display
[depot.git] / app / views / orders / index.html.erb
1 <div id="product-list">
2 <h1>Listing orders</h1>
3
4 <table>
5 <tr>
6 <th>Name</th>
7 <th>Address</th>
8 <th>Email</th>
9 <th>Pay type</th>
10 <th>Total value</th>
11 </tr>
12
13 <% for order in @orders %>
14 <tr class="<%= cycle('list-line-odd', 'list-line-even') %>">
15 <td><%=h order.name %></td>
16 <td><%=h order.address %></td>
17 <td><%=h order.email %></td>
18 <td><%=h order.pay_type %></td>
19 <td><%= number_to_currency (order.line_items.inject(0) {|sum,item| sum + item.total_price}), :unit => "£" %></td>
20 <td><%= link_to 'Show', order %></td>
21 <td><%= link_to 'Edit', edit_order_path(order) %></td>
22 <td><%= link_to 'Destroy', order, :confirm => 'Are you sure?', :method => :delete %></td>
23 </tr>
24 <% for li in order.line_items %>
25 <tr class="<%= current_cycle %>">
26 <td> </td>
27 <td colspan="7"><i><%= li.quantity%> &times;
28 <%= h li.product.title %> =
29 <%= number_to_currency li.total_price, :unit => "£" %>
30 </i></td>
31 </tr>
32 <% end %>
33
34 <% end %>
35 </table>
36
37 <br />
38
39 <%= link_to 'New order', new_order_path %>
40 </div>