-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathorders.html.erb
83 lines (78 loc) · 3.36 KB
/
orders.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
<% admin_breadcrumb(link_to plural_resource_name(Spree::LegacyUser), spree.admin_users_path) %>
<% admin_breadcrumb(link_to @user.email, edit_admin_user_url(@user)) %>
<% admin_breadcrumb(t('spree.admin.user.order_history')) %>
<%= render 'spree/admin/users/sidebar' %>
<%= render 'spree/admin/users/tabs', current: :orders %>
<%= render partial: 'spree/admin/users/user_page_actions' %>
<fieldset data-hook="admin_user_order_history" class="no-border-bottom">
<legend><%= t("spree.admin.user.order_history") %></legend>
<%= paginate @orders, theme: "solidus_admin" %>
<% if @orders.any? %>
<%# TODO add search interface %>
<table class="index" id="listing_orders" data-hook>
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr data-hook="admin_orders_index_headers">
<th><%= sort_link @search, :completed_at, Spree::Order.human_attribute_name(:completed_at), {title: 'orders_completed_at_title'} %></th>
<th><%= sort_link @search, :number, Spree::Order.human_attribute_name(:number), {title: 'orders_number_title'} %></th>
<th><%= sort_link @search, :state %></th>
<th><%= sort_link @search, :payment_state %></th>
<% if Spree::Order.checkout_step_names.include?(:delivery) %>
<th><%= sort_link @search, :shipment_state %></th>
<% end %>
<th><%= sort_link @search, :total, Spree::Order.human_attribute_name(:total), {title: 'orders_total_title'} %></th>
</tr>
</thead>
<tbody>
<% @orders.each do |order| %>
<tr data-hook="admin_orders_index_rows">
<td class="order-completed-at"><%= l(order.completed_at.to_date) if order.completed_at %></td>
<td class="order-number">
<% if can?(:admin, order) && can?(:edit, order) %>
<%= link_to order.number, edit_admin_order_path(order) %>
<% else %>
<%= order.number %>
<% end %>
</td>
<td>
<span class="pill pill-<%= order.state %>">
<%= t(order.state, scope: 'spree.order_state') %>
</span>
</td>
<td>
<% if order.payment_state %>
<span class="pill pill-<%= order.payment_state %>">
<%= t(order.payment_state, scope: 'spree.payment_states') %>
</span>
<% end %>
</td>
<% if Spree::Order.checkout_step_names.include?(:delivery) %>
<td>
<% if order.shipment_state %>
<span class="pill pill-<%= order.shipment_state %>">
<%= t(order.shipment_state, scope: 'spree.shipment_states') %>
</span>
<% end %>
</td>
<% end %>
<td class="order-total"><%= order.display_total.to_html %></td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<div class="no-objects-found">
<% if can? :manage, Spree::Order %>
<%= render 'spree/admin/shared/no_objects_found',
resource: Spree::Order,
new_resource_url: spree.new_admin_order_path(user_id: @user.id) %>
<% end %>
</div>
<% end %>
<%= paginate @orders, theme: "solidus_admin" %>
</fieldset>