X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=app%2Fviews%2Forders%2Findex.html.erb;fp=app%2Fviews%2Forders%2Findex.html.erb;h=640e77e3bea4078a5276769b9bdb2afc8f469eea;hb=8c46f52399ab17d3434ec91b426ec2b29c8f20ef;hp=39e117ecda9b3a5ac7514eb0116bac0f57f0bf10;hpb=889799c14324fbfb783a6e57dd8bfa5615670925;p=depot.git
diff --git a/app/views/orders/index.html.erb b/app/views/orders/index.html.erb
index 39e117e..640e77e 100644
--- a/app/views/orders/index.html.erb
+++ b/app/views/orders/index.html.erb
@@ -6,6 +6,7 @@
Address |
Email |
Pay type |
+ Total value |
<% for order in @orders %>
@@ -14,10 +15,21 @@
<%=h order.address %> |
<%=h order.email %> |
<%=h order.pay_type %> |
+ <%= number_to_currency (order.line_items.inject(0) {|sum,item| sum + item.total_price}), :unit => "£" %> |
<%= link_to 'Show', order %> |
<%= link_to 'Edit', edit_order_path(order) %> |
<%= link_to 'Destroy', order, :confirm => 'Are you sure?', :method => :delete %> |
+ <% for li in order.line_items %>
+
+ |
+ <%= li.quantity%> ×
+ <%= h li.product.title %> =
+ <%= number_to_currency li.total_price, :unit => "£" %>
+ |
+
+ <% end %>
+
<% end %>