/
_order_details.html.erb
115 lines (106 loc) 路 4.55 KB
/
_order_details.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<div class="row steps-data">
<div class="columns alpha four">
<h6><%= t(:shipping_address) %> <%= link_to "(#{t(:edit)})", checkout_state_path(:address) unless @order.completed? %></h6>
<div class="address">
<%= order.ship_address %>
</div>
</div>
<div class="columns alpha four">
<h6><%= t(:billing_address) %> <%= link_to "(#{t(:edit)})", checkout_state_path(:address) unless @order.completed? %></h6>
<div class="address">
<%= order.bill_address %>
</div>
</div>
<% if @order.has_step?("delivery") %>
<div class="columns alpha four">
<h6><%= t(:shipping_method) %> <%= link_to "(#{t(:edit)})", checkout_state_path(:delivery) unless @order.completed? %></h6>
<div class="delivery">
<%= order.shipping_method.name %>
</div>
</div>
<% end %>
<div class="columns omega four">
<h6><%= t(:payment_information) %> <%= link_to "(#{t(:edit)})", checkout_state_path(:payment) unless @order.completed? %></h6>
<div class="payment-info">
<% unless order.credit_cards.empty? %>
<span class="cc-type">
<%= image_tag "credit_cards/icons/#{order.credit_cards.first.cc_type}.png" %>
<%= t(:ending_in)%> <%= order.credit_cards.first.last_digits %>
</span>
<br />
<span class="full-name">
<%= order.credit_cards.first.first_name %>
<%= order.credit_cards.first.last_name %>
</span>
<% end %>
</div>
</div>
</div>
<hr />
<table class="index columns alpha omega sixteen" data-hook="order_details">
<col width="15%" valign="middle" halign="center">
<col width="70%" valign="middle">
<col width="5%" valign="middle" halign="center">
<col width="5%" valign="middle" halign="center">
<col width="5%" valign="middle" halign="center">
<thead id="line-items" data-hook>
<tr data-hook="order_details_line_items_headers">
<th colspan="2"><%= t(:item) %></th>
<th class="price"><%= t(:price) %></th>
<th class="qty"><%= t(:qty) %></th>
<th class="total"><span><%= t(:total) %></span></th>
</tr>
</thead>
<tbody id="line-items" data-hook>
<% @order.line_items.each do |item| %>
<tr data-hook="order_details_line_item_row">
<td data-hook="order_item_image">
<% if item.variant.images.length == 0 %>
<%= link_to small_image(item.variant.product), item.variant.product %>
<% else %>
<%= link_to image_tag(item.variant.images.first.attachment.url(:small)), item.variant.product %>
<% end %>
</td>
<td data-hook="order_item_description">
<h4><%= item.variant.product.name %></h4>
<%= truncate(item.variant.product.description, :length => 100, :omission => "...") %>
<%= "(" + variant_options(item.variant) + ")" unless item.variant .option_values.empty? %>
</td>
<td data-hook="order_item_price" class="price"><span><%= number_to_currency item.price %></span></td>
<td data-hook="order_item_qty"><%= item.quantity %></td>
<td data-hook="order_item_total" class="total"><span><%= number_to_currency (item.price * item.quantity) %></span></td>
</tr>
<% end %>
</tbody>
<tfoot id="order-total" data-hook="order_details_total">
<tr class="total">
<td colspan="4"><b><%= t(:order_total) %>:</b></td>
<td class="total"><span id="order_total"><%= number_to_currency @order.total %></span></td>
</tr>
</tfoot>
<% if order.price_adjustment_totals.present? %>
<tfoot id="price-adjustments" data-hook="order_details_price_adjustments">
<% @order.price_adjustment_totals.keys.each do |key| %>
<tr class="total">
<td colspan="4"><strong><%= key %></strong></td>
<td class="total"><span><%= number_to_currency @order.price_adjustment_totals[key] %></span></td>
</tr>
<% end %>
</tfoot>
<% end %>
<tfoot id="subtotal" data-hook="order_details_subtotal">
<tr class="total" id="subtotal-row">
<td colspan="4"><b><%= t(:subtotal) %>:</b></td>
<td class="total"><span><%= number_to_currency @order.item_total %></span></td>
</tr>
</tfoot>
<tfoot id="order-charges" data-hook="order_details_adjustments">
<% @order.adjustments.eligible.each do |adjustment| %>
<% next if (adjustment.originator_type == 'Spree::TaxRate') and (adjustment.amount == 0) %>
<tr class="total">
<td colspan="4"><strong><%= adjustment.label %></strong></td>
<td class="total"><span><%= number_to_currency adjustment.amount %></span></td>
</tr>
<% end %>
</tfoot>
</table>