spree_backend 4.2.0.rc2 → 4.2.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend.js +0 -1
  3. data/app/assets/javascripts/spree/backend/address_states.js +20 -9
  4. data/app/assets/javascripts/spree/backend/calculator.js +2 -0
  5. data/app/assets/javascripts/spree/backend/checkouts/edit.js +99 -71
  6. data/app/assets/javascripts/spree/backend/line_items_on_order_edit.js +1 -1
  7. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js +31 -37
  8. data/app/assets/javascripts/spree/backend/option_value_picker.js +50 -23
  9. data/app/assets/javascripts/spree/backend/product_picker.js +35 -19
  10. data/app/assets/javascripts/spree/backend/promotions.js +32 -27
  11. data/app/assets/javascripts/spree/backend/shipments.js +28 -37
  12. data/app/assets/javascripts/spree/backend/spree-select2.js +33 -14
  13. data/app/assets/javascripts/spree/backend/stock_transfer.js +32 -13
  14. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +30 -43
  15. data/app/assets/javascripts/spree/backend/taxons.js +60 -47
  16. data/app/assets/javascripts/spree/backend/user_picker.js +16 -18
  17. data/app/assets/javascripts/spree/backend/variant_autocomplete.js +23 -22
  18. data/app/assets/stylesheets/spree/backend/components/_badges.scss +1 -1
  19. data/app/assets/stylesheets/spree/backend/components/_tables.scss +2 -2
  20. data/app/assets/stylesheets/spree/backend/global/_variables.scss +1 -1
  21. data/app/assets/stylesheets/spree/backend/plugins/_select2_custom.scss +11 -0
  22. data/app/assets/stylesheets/spree/backend/plugins/select2_bootstrap4.scss +622 -0
  23. data/app/assets/stylesheets/spree/backend/spree_admin.css.scss +2 -1
  24. data/app/controllers/spree/admin/orders_controller.rb +15 -2
  25. data/app/controllers/spree/admin/products_controller.rb +2 -2
  26. data/app/controllers/spree/admin/states_controller.rb +1 -1
  27. data/app/controllers/spree/admin/taxons_controller.rb +15 -5
  28. data/app/helpers/spree/admin/base_helper.rb +21 -5
  29. data/app/helpers/spree/admin/navigation_helper.rb +11 -1
  30. data/app/helpers/spree/admin/payments_helper.rb +3 -3
  31. data/app/helpers/spree/admin/stock_movements_helper.rb +2 -0
  32. data/app/views/spree/admin/countries/index.html.erb +6 -6
  33. data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +3 -1
  34. data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +3 -1
  35. data/app/views/spree/admin/customer_returns/index.html.erb +2 -2
  36. data/app/views/spree/admin/customer_returns/new.html.erb +1 -1
  37. data/app/views/spree/admin/general_settings/edit.html.erb +25 -2
  38. data/app/views/spree/admin/option_types/index.html.erb +1 -1
  39. data/app/views/spree/admin/orders/_add_line_item.html.erb +1 -1
  40. data/app/views/spree/admin/orders/_add_product.html.erb +1 -1
  41. data/app/views/spree/admin/orders/_channel_form.html.erb +18 -0
  42. data/app/views/spree/admin/orders/_shipment.html.erb +3 -1
  43. data/app/views/spree/admin/orders/channel.html.erb +7 -0
  44. data/app/views/spree/admin/orders/customer_details/_autocomplete.js.erb +35 -12
  45. data/app/views/spree/admin/orders/customer_details/_form.html.erb +2 -2
  46. data/app/views/spree/admin/orders/customer_details/edit.html.erb +1 -1
  47. data/app/views/spree/admin/orders/index.html.erb +10 -11
  48. data/app/views/spree/admin/payment_methods/_form.html.erb +65 -46
  49. data/app/views/spree/admin/payment_methods/index.html.erb +1 -1
  50. data/app/views/spree/admin/products/_form.html.erb +4 -4
  51. data/app/views/spree/admin/products/index.html.erb +2 -1
  52. data/app/views/spree/admin/products/new.html.erb +2 -2
  53. data/app/views/spree/admin/promotion_rules/create.js.erb +1 -1
  54. data/app/views/spree/admin/promotions/_form.html.erb +1 -1
  55. data/app/views/spree/admin/promotions/actions/_create_line_items.html.erb +1 -1
  56. data/app/views/spree/admin/promotions/rules/_option_value.html.erb +8 -7
  57. data/app/views/spree/admin/promotions/rules/_product.html.erb +1 -1
  58. data/app/views/spree/admin/promotions/rules/_taxon.html.erb +1 -1
  59. data/app/views/spree/admin/promotions/rules/_user.html.erb +1 -1
  60. data/app/views/spree/admin/refunds/new.html.erb +1 -1
  61. data/app/views/spree/admin/reimbursements/edit.html.erb +4 -2
  62. data/app/views/spree/admin/reimbursements/show.html.erb +3 -1
  63. data/app/views/spree/admin/return_authorizations/_form.html.erb +7 -5
  64. data/app/views/spree/admin/return_authorizations/index.html.erb +2 -2
  65. data/app/views/spree/admin/return_index/customer_returns.html.erb +2 -2
  66. data/app/views/spree/admin/return_index/return_authorizations.html.erb +2 -2
  67. data/app/views/spree/admin/shared/_account_nav.html.erb +1 -1
  68. data/app/views/spree/admin/shared/_address_form.html.erb +7 -7
  69. data/app/views/spree/admin/shared/_head.html.erb +4 -0
  70. data/app/views/spree/admin/shared/_order_summary.html.erb +25 -21
  71. data/app/views/spree/admin/shared/_order_tabs.html.erb +9 -0
  72. data/app/views/spree/admin/shared/_refunds.html.erb +1 -1
  73. data/app/views/spree/admin/shared/_translations.html.erb +1 -0
  74. data/app/views/spree/admin/shared/_update_order_state.js.erb +6 -2
  75. data/app/views/spree/admin/shared/named_types/_index.html.erb +1 -1
  76. data/app/views/spree/admin/shipping_methods/_form.html.erb +2 -2
  77. data/app/views/spree/admin/shipping_methods/index.html.erb +5 -1
  78. data/app/views/spree/admin/stock_locations/_form.html.erb +1 -1
  79. data/app/views/spree/admin/stock_locations/index.html.erb +2 -2
  80. data/app/views/spree/admin/stock_transfers/_stock_movements.html.erb +1 -1
  81. data/app/views/spree/admin/stock_transfers/index.html.erb +42 -37
  82. data/app/views/spree/admin/stock_transfers/new.html.erb +1 -1
  83. data/app/views/spree/admin/stores/_form.html.erb +64 -11
  84. data/app/views/spree/admin/stores/index.html.erb +11 -6
  85. data/app/views/spree/admin/tax_categories/index.html.erb +1 -1
  86. data/app/views/spree/admin/tax_rates/index.html.erb +2 -2
  87. data/app/views/spree/admin/taxons/_form.html.erb +39 -35
  88. data/app/views/spree/admin/taxons/index.html.erb +1 -1
  89. data/app/views/spree/admin/users/_addresses_form.html.erb +4 -6
  90. data/app/views/spree/admin/variants/_form.html.erb +2 -2
  91. data/app/views/spree/admin/zones/index.html.erb +1 -1
  92. data/config/routes.rb +7 -1
  93. data/spree_backend.gemspec +1 -1
  94. metadata +15 -14
  95. data/app/assets/javascripts/spree/backend/tag_picker.js +0 -52
  96. data/app/assets/stylesheets/spree/backend/plugins/_select2.scss +0 -190
  97. data/app/views/spree/admin/general_settings/_form.html.erb +0 -17
@@ -83,8 +83,8 @@
83
83
  <%= f.fields_for :ship_address do |sa_form| %>
84
84
  <div class="form-group">
85
85
  <span data-hook="use_billing">
86
- <%= check_box_tag 'order[use_billing]', '1', @order.shipping_eq_billing_address? %>
87
- <%= label_tag 'order[use_billing]', Spree.t(:use_billing_address) %>
86
+ <%= check_box_tag 'order[use_billing]', '1', @order.shipping_eq_billing_address?, class: 'checkbox' %>
87
+ <%= label_tag 'order[use_billing]', Spree.t(:use_billing_address), class: 'form-check-label' %>
88
88
  </span>
89
89
  </div>
90
90
 
@@ -12,7 +12,7 @@
12
12
  </h1>
13
13
  </div>
14
14
  <div class="card-body" id="customer-search-field">
15
- <%= hidden_field_tag :customer_search, nil, class: 'error-message' %>
15
+ <%= select_tag :customer_search, nil, class: 'd-block w-100' %>
16
16
  <%= render partial: "spree/admin/orders/customer_details/autocomplete", formats: :js %>
17
17
  </div>
18
18
  </div>
@@ -67,21 +67,21 @@
67
67
  <%= f.select :state_eq,
68
68
  Spree::Order.state_machines[:state].states.map {|s| [Spree.t("order_state.#{s.name}"), s.value]},
69
69
  { include_blank: true },
70
- class: 'select2 js-filterable' %>
70
+ class: 'select2-clear js-filterable' %>
71
71
  </div>
72
72
  </div>
73
73
 
74
74
  <div class="col-12 col-lg-4">
75
75
  <div class="form-group">
76
76
  <%= label_tag :q_payment_state_eq, Spree.t(:payment_state) %>
77
- <%= f.select :payment_state_eq, Spree::Order::PAYMENT_STATES.map {|s| [Spree.t("payment_states.#{s}"), s]}, { include_blank: true }, class: 'select2 js-filterable' %>
77
+ <%= f.select :payment_state_eq, Spree::Order::PAYMENT_STATES.map {|s| [Spree.t("payment_states.#{s}"), s]}, { include_blank: true }, class: 'select2-clear js-filterable' %>
78
78
  </div>
79
79
  </div>
80
80
 
81
81
  <div class="col-12 col-lg-4">
82
82
  <div class="form-group">
83
83
  <%= label_tag :q_shipment_state_eq, Spree.t(:shipment_state) %>
84
- <%= f.select :shipment_state_eq, Spree::Order::SHIPMENT_STATES.map {|s| [Spree.t("shipment_states.#{s}"), s]}, { include_blank: true }, class: 'select2 js-filterable' %>
84
+ <%= f.select :shipment_state_eq, Spree::Order::SHIPMENT_STATES.map {|s| [Spree.t("shipment_states.#{s}"), s]}, { include_blank: true }, class: 'select2-clear js-filterable' %>
85
85
  </div>
86
86
  </div>
87
87
 
@@ -124,21 +124,21 @@
124
124
  <div class="col-12 col-lg-4">
125
125
  <div class="form-group">
126
126
  <%= label_tag :q_promotions_id_in, Spree.t(:promotion) %>
127
- <%= f.select :promotions_id_in, Spree::Promotion.applied.pluck(:name, :id), { include_blank: true }, class: 'select2 js-filterable' %>
127
+ <%= f.select :promotions_id_in, Spree::Promotion.applied.pluck(:name, :id), { include_blank: true }, class: 'select2-clear js-filterable' %>
128
128
  </div>
129
129
  </div>
130
130
 
131
131
  <div class="col-12 col-lg-4">
132
132
  <div class="form-group">
133
133
  <%= label_tag :q_store_id_in, Spree.t(:store) %>
134
- <%= f.select :store_id_in, Spree::Store.order(:name).pluck(:name, :id), { include_blank: true }, class: 'select2 js-filterable' %>
134
+ <%= f.select :store_id_in, Spree::Store.order(:name).pluck(:name, :id), { include_blank: true }, class: 'select2-clear js-filterable' %>
135
135
  </div>
136
136
  </div>
137
137
 
138
138
  <div class="col-12 col-lg-4">
139
139
  <div class="form-group">
140
140
  <%= label_tag :q_channel_eq, Spree.t(:channel) %>
141
- <%= f.select :channel_eq, Spree::Order.distinct.pluck(:channel), { include_blank: true }, class: 'select2 js-filterable' %>
141
+ <%= f.select :channel_eq, Spree::Order.distinct.pluck(:channel), { include_blank: true }, class: 'select2-clear js-filterable' %>
142
142
  </div>
143
143
  </div>
144
144
 
@@ -206,22 +206,21 @@
206
206
  <%= order_time(@show_only_completed ? order.completed_at : order.created_at) %>
207
207
  </td>
208
208
  <td>
209
- <span class="badge badge-<%= order.considered_risky ? 'considered_risky' : 'considered_safe' %>">
209
+ <span class="badge badge-<%= order.considered_risky ? 'considered_risky' : 'considered_safe' %> text-uppercase">
210
210
  <%= order.considered_risky ? Spree.t("risky") : Spree.t("safe") %>
211
211
  </span>
212
212
  </td>
213
213
  <td class="no-wrap">
214
- <span class="badge badge-<%= order.state.downcase %>"><%= Spree.t("order_state.#{order.state.downcase}") %></span>
214
+ <span class="badge badge-<%= order.state.downcase %> text-uppercase"><%= Spree.t("order_state.#{order.state}") %></span>
215
215
  <span class="filterable js-add-filter" data-ransack-field="q_state_eq" data-ransack-value="<%= order.state %>">
216
216
  <%= svg_icon name: "filter.svg", width: '14', height: '14' %>
217
217
  </span>
218
218
  </td>
219
219
  <td class="no-wrap">
220
220
  <% if order.payment_state %>
221
-
222
221
  <%= link_to Spree.t("payment_states.#{order.payment_state}"),
223
222
  admin_order_payments_path(order),
224
- class: "badge badge-#{order.payment_state}" %>
223
+ class: "badge badge-#{order.payment_state} text-uppercase" %>
225
224
 
226
225
  <span class="filterable js-add-filter"
227
226
  data-ransack-field="q_payment_state_eq"
@@ -233,7 +232,7 @@
233
232
  <% if Spree::Order.checkout_step_names.include?(:delivery) %>
234
233
  <td class="no-wrap">
235
234
  <% if order.shipment_state %>
236
- <span class="badge badge-<%= order.shipment_state %>"><%= Spree.t("shipment_states.#{order.shipment_state}") %></span>
235
+ <span class="badge badge-<%= order.shipment_state %> text-uppercase"><%= Spree.t("shipment_states.#{order.shipment_state}") %></span>
237
236
  <span class="filterable js-add-filter" data-ransack-field="q_shipment_state_eq" data-ransack-value="<%= order.shipment_state %>">
238
237
  <%= svg_icon name: "filter.svg", width: '14', height: '14' %>
239
238
  </span>
@@ -2,59 +2,78 @@
2
2
 
3
3
  <div data-hook="payment_method" class="row">
4
4
 
5
- <div class="col-12 col-md-4">
6
- <div id="preference-settings" data-hook class="form-group">
7
- <%= f.label :type, Spree.t(:provider) %>
8
- <%= collection_select(:payment_method, :type, @providers, :to_s, :name, {}, {id: 'gtwy-type', class: 'select2'}) %>
9
-
10
- <% unless @object.new_record? %>
11
- <%= preference_fields(@object, f) %>
12
-
13
- <% if @object.respond_to?(:preferences) %>
14
- <div id="gateway-settings-warning" class="info warning"><%= Spree.t(:provider_settings_warning) %></div>
15
- <% end %>
16
- <% end %>
17
- </div>
18
- <div data-hook="store" class="form-group">
19
- <%= label_tag :payment_method_store, Spree.t(:store) %>
20
- <%= collection_select(:payment_method, :store_id, @stores, :id, :unique_name, { include_blank: true }, {id: 'store_id', class: 'select2'}) %>
21
- </div>
22
- <div data-hook="display" class="form-group">
23
- <%= label_tag :payment_method_display_on, Spree.t(:display) %>
24
- <%= select(:payment_method, :display_on, Spree::PaymentMethod::DISPLAY.collect { |display| [Spree.t(display), display.to_s] }, {}, {class: 'select2'}) %>
25
- </div>
26
- <div data-hook="auto_capture" class="form-group">
27
- <%= label_tag :payment_method_auto_capture, Spree.t(:auto_capture) %>
28
- <%= select(:payment_method, :auto_capture, [["#{Spree.t(:use_app_default)} (#{Spree::Config[:auto_capture]})", ''], [Spree.t(:say_yes), true], [Spree.t(:say_no), false]], {}, {class: 'select2'}) %>
29
- </div>
30
- <div data-hook="active" class="form-group">
31
- <strong><%= Spree.t(:active) %></strong>
32
- <div class="radio my-2">
33
- <%= label_tag :payment_method_active_true do %>
34
- <%= radio_button :payment_method, :active, true %>
35
- <%= Spree.t(:say_yes) %>
36
- <% end %>
5
+ <div class="col-12 col-md-6">
6
+ <div class="card mb-3">
7
+ <div class="card-header">
8
+ <h5 class="mb-0"><%= Spree.t(:settings) %></h5>
37
9
  </div>
10
+ <div class="card-body">
11
+ <div class="form-group">
12
+ <%= f.label :type, Spree.t(:provider) %>
13
+ <%= collection_select(:payment_method, :type, @providers, :to_s, :name, {}, {id: 'gtwy-type', class: 'select2'}) %>
14
+ </div>
15
+ <hr class="my-4">
16
+ <%= field_container :payment_method, :name, class: ['form-group'], 'data-hook' => 'name' do %>
17
+ <%= label_tag :payment_method_name, Spree.t(:name) %>
18
+ <%= text_field :payment_method, :name, class: 'form-control' %>
19
+ <%= error_message_on :payment_method, :name %>
20
+ <% end %>
38
21
 
39
- <div class="radio my-2">
40
- <%= label_tag :payment_method_active_false do %>
41
- <%= radio_button :payment_method, :active, false %>
42
- <%= Spree.t(:say_no) %>
22
+ <%= field_container :payment_method, :description, class: ['form-group'], 'data-hook' => 'description' do %>
23
+ <%= label_tag :payment_method_description, Spree.t(:description) %>
24
+ <%= text_area :payment_method, :description, { cols: 60, rows: 6, class: 'form-control' } %>
43
25
  <% end %>
26
+
27
+ <div data-hook="store" class="form-group">
28
+ <%= label_tag :payment_method_stores, Spree.t(:stores) %>
29
+ <%= collection_select(:payment_method, :store_ids, @stores, :id, :unique_name, {}, { multiple: true, class: 'select2' }) %>
30
+ </div>
31
+
32
+ <div data-hook="display" class="form-group">
33
+ <%= label_tag :payment_method_display_on, Spree.t(:display) %>
34
+ <%= select(:payment_method, :display_on, Spree::PaymentMethod::DISPLAY.collect { |display| [Spree.t(display), display.to_s] }, {}, {class: 'select2'}) %>
35
+ </div>
36
+ <div data-hook="auto_capture" class="form-group">
37
+ <%= label_tag :payment_method_auto_capture, Spree.t(:auto_capture) %>
38
+ <%= select(:payment_method, :auto_capture, [["#{Spree.t(:use_app_default)} (#{Spree::Config[:auto_capture]})", ''], [Spree.t(:say_yes), true], [Spree.t(:say_no), false]], {}, {class: 'select2'}) %>
39
+ </div>
40
+
41
+ <div data-hook="active" class="form-group">
42
+ <strong><%= Spree.t(:active) %></strong>
43
+ <div class="radio my-2 form-check">
44
+ <%= radio_button :payment_method, :active, true, class: 'form-check-input' %>
45
+ <%= label_tag :payment_method_active_true, Spree.t(:say_yes), class: 'form-check-label' %>
46
+ </div>
47
+
48
+ <div class="radio my-2 form-check">
49
+ <%= radio_button :payment_method, :active, false, class: 'form-check-input' %>
50
+ <%= label_tag :payment_method_active_false, Spree.t(:say_no), class: 'form-check-label' %>
51
+ </div>
52
+ </div>
44
53
  </div>
45
54
  </div>
46
55
  </div>
47
56
 
48
- <div class="col-12 col-md-8">
49
- <%= field_container :payment_method, :name, class: ['form-group'], 'data-hook' => 'name' do %>
50
- <%= label_tag :payment_method_name, Spree.t(:name) %>
51
- <%= text_field :payment_method, :name, class: 'form-control' %>
52
- <%= error_message_on :payment_method, :name %>
53
- <% end %>
54
- <%= field_container :payment_method, :description, class: ['form-group'], 'data-hook' => 'description' do %>
55
- <%= label_tag :payment_method_description, Spree.t(:description) %>
56
- <%= text_area :payment_method, :description, { cols: 60, rows: 6, class: 'form-control' } %>
57
- <% end %>
57
+ <div class="col-12 col-md-6">
58
+ <div class="card mb-3">
59
+ <div class="card-header">
60
+ <h5 class="mb-0"><%= Spree.t(:payment_provider_settings) %></h5>
61
+ </div>
62
+ <div class="card-body">
63
+ <div id="preference-settings" data-hook class="form-group">
64
+ <% unless @object.new_record? %>
65
+ <% if preference_fields(@object, f).empty? %>
66
+ <%= Spree.t('no_payment_provider_settings_message') %>
67
+ <% end %>
68
+ <%= preference_fields(@object, f) %>
69
+
70
+ <% if @object.respond_to?(:preferences) %>
71
+ <div id="gateway-settings-warning" class="info warning"><%= Spree.t(:provider_settings_warning) %></div>
72
+ <% end %>
73
+ <% end %>
74
+ </div>
75
+ </div>
76
+ </div>
58
77
  </div>
59
78
  </div>
60
79
  </div>
@@ -30,7 +30,7 @@
30
30
  <td><%= method.name %></td>
31
31
  <td><%= method.type.split('::', 3).last %></td>
32
32
  <td class="text-center"><%= Spree.t(method.display_on) %></td>
33
- <td class="text-center"><%= method.active ? Spree.t(:say_yes) : Spree.t(:say_no) %></td>
33
+ <td class="text-center"><%= active_badge(method.active) %></td>
34
34
  <td data-hook="admin_payment_methods_index_row_actions" class="actions actions-2 text-right">
35
35
  <%= link_to_edit(method, no_text: true) if can? :edit, method %>
36
36
  <%= link_to_delete(method, no_text: true) if can? :delete, method %>
@@ -56,7 +56,7 @@
56
56
  <div data-hook="admin_product_form_cost_currency" class="omega two columns">
57
57
  <%= f.field_container :cost_currency, class: ['form-group'] do %>
58
58
  <%= f.label :cost_currency, Spree.t(:cost_currency) %>
59
- <%= f.text_field :cost_currency, class: 'form-control' %>
59
+ <%= f.select :cost_currency, currency_options(@product.cost_currency), {}, { class: 'select2' } %>
60
60
  <%= f.error_message_on :cost_currency %>
61
61
  <% end %>
62
62
  </div>
@@ -195,7 +195,7 @@
195
195
  <%= f.label :taxon_ids, Spree.t(:taxons) %>
196
196
 
197
197
  <% if can? :modify, Spree::Classification %>
198
- <%= f.hidden_field :taxon_ids, value: @product.taxon_ids.join(',') %>
198
+ <%= f.select :taxon_ids, options_from_collection_for_select(@product.taxons, :id, :pretty_name, @product.taxons.pluck(:id)), { include_hidden: true }, multiple: true, class: 'select2-hidden-accessible' %>
199
199
  <% elsif @product.taxons.any? %>
200
200
  <ul class="text_list">
201
201
  <% @product.taxons.each do |taxon| %>
@@ -214,7 +214,7 @@
214
214
  <%= f.label :option_type_ids, Spree.t(:option_types) %>
215
215
 
216
216
  <% if can? :modify, Spree::ProductOptionType %>
217
- <%= f.hidden_field :option_type_ids, value: @product.option_type_ids.join(',') %>
217
+ <%= f.select :option_type_ids, options_from_collection_for_select(Spree::OptionType.all, :id, :name, @product.option_types.pluck(:id)), { include_hidden: true }, multiple: true, class: 'select2-hidden-accessible' %>
218
218
  <% elsif @product.option_types.any? %>
219
219
  <ul class="text_list">
220
220
  <% @product.option_types.each do |type| %>
@@ -246,7 +246,7 @@
246
246
  <div data-hook="admin_product_form_meta_description">
247
247
  <%= f.field_container :meta_description, class: ['form-group'] do %>
248
248
  <%= f.label :meta_description, Spree.t(:meta_description) %>
249
- <%= f.text_field :meta_description, class: 'form-control' %>
249
+ <%= f.text_area :meta_description, class: 'form-control' %>
250
250
  <% end %>
251
251
  </div>
252
252
 
@@ -64,6 +64,7 @@
64
64
  </thead>
65
65
  <tbody>
66
66
  <% @collection.each do |product| %>
67
+ <% available_status = available_status(product) %>
67
68
  <tr <%== "style='color: red;'" if product.deleted? %> id="<%= spree_dom_id product %>" data-hook="admin_products_index_rows" class="<%= cycle('odd', 'even') %>">
68
69
  <td scope="row" class="image">
69
70
  <%= link_to edit_admin_product_path(product) do %>
@@ -72,7 +73,7 @@
72
73
  </td>
73
74
  <td><%= link_to product.try(:name), edit_admin_product_path(product) %></td>
74
75
  <td class="sku"><%= product.sku rescue '' %></td>
75
- <td class="status"><%= available_status(product) %> </td>
76
+ <td class="status"><%= active_badge(available_status == Spree.t(:available), label: available_status) %></td>
76
77
  <td class="text-center"><%= display_price(product) %></td>
77
78
  <td class="actions " data-hook="admin_products_index_row_actions">
78
79
  <span class="d-flex justify-content-end">
@@ -27,7 +27,7 @@
27
27
  <div data-hook="new_product_prototype" class="col-12 col-md-4">
28
28
  <%= f.field_container :prototype, class: ['form-group'] do %>
29
29
  <%= f.label :prototype_id, Spree.t(:prototype) %>
30
- <%= f.collection_select :prototype_id, Spree::Prototype.all, :id, :name, {include_blank: true}, {class: 'select2'} %>
30
+ <%= f.collection_select :prototype_id, Spree::Prototype.all, :id, :name, { include_blank: true }, { class: 'select2-clear w-100' } %>
31
31
  <% end %>
32
32
  </div>
33
33
 
@@ -59,7 +59,7 @@
59
59
  <div data-hook="new_product_shipping_category" class="col-12 col-md-4">
60
60
  <%= f.field_container :shipping_category, class: ['form-group'] do %>
61
61
  <%= f.label :shipping_category_id, Spree.t(:shipping_categories) %><span class="required">*</span>
62
- <%= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2' }) %>
62
+ <%= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2 w-100' }) %>
63
63
  <%= f.error_message_on :shipping_category_id %>
64
64
  <% end %>
65
65
  </div>
@@ -7,4 +7,4 @@ $('.user_picker').userAutocomplete();
7
7
  $('#promotion_rule_type').html('<%= escape_javascript options_for_promotion_rule_types(@promotion) %>');
8
8
  $('#promotion_rule_type').select2();
9
9
 
10
- set_taxon_select('#product_taxon_ids')
10
+ $('#product_taxon_ids').taxonAutocomplete()
@@ -43,7 +43,7 @@
43
43
 
44
44
  <%= f.field_container :category, class: ['form-group'] do %>
45
45
  <%= f.label :promotion_category %>
46
- <%= f.collection_select(:promotion_category_id, @promotion_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2' }) %>
46
+ <%= f.collection_select(:promotion_category_id, @promotion_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2 w-100' }) %>
47
47
  <% end %>
48
48
  </div>
49
49
 
@@ -15,7 +15,7 @@
15
15
  <% line_item_prefix = "#{param_prefix}[promotion_action_line_items_attributes][#{index}]" %>
16
16
  <div class="form-group">
17
17
  <%= label_tag "#{line_item_prefix}_variant_id", Spree.t(:variant) %>
18
- <%= hidden_field_tag "#{line_item_prefix}[variant_id]", line_item.variant_id, class: "variant_autocomplete" %>
18
+ <%= select_tag "#{line_item_prefix}[variant_id]", line_item.variant_id, class: 'variant_autocomplete d-block w-100' %>
19
19
  </div>
20
20
  <div class="form-group mb-0">
21
21
  <%= label_tag "#{line_item_prefix}_quantity", Spree.t(:quantity) %>
@@ -1,6 +1,6 @@
1
1
  <div class="card-body">
2
2
  <div class="promo-rule-option-values">
3
- <div class="js-promo-rule-option-values"></div>
3
+ <div class="js-promo-rule-option-values"></div> <!-- display div for option value select -->
4
4
  <button class="btn btn-primary btn-success js-add-promo-rule-option-value">
5
5
  <%= svg_icon name: "add.svg", width: '16', height: '16' %>
6
6
  <%= Spree.t(:add) %>
@@ -12,11 +12,11 @@
12
12
  data: { :'original-option-values' => promotion_rule.preferred_eligible_values } %>
13
13
 
14
14
  <script type="text/x-handlebars-template" id="promo-rule-option-value-option-values-select-name-template">
15
- <%= param_prefix %>[preferred_eligible_values][{{productId}}]
15
+ <%= param_prefix %>[preferred_eligible_values][{{productId}}][]
16
16
  </script>
17
17
 
18
18
  <script type="text/x-handlebars-template" id="promo-rule-option-value-template">
19
- <div class="promo-rule-option-value panel card mb-3">
19
+ <div class="promo-rule-option-value panel card mb-3" id="promo-rule-option-value-{{productId}}">
20
20
  <div class="card-header d-flex justify-content-between">
21
21
  <label><%= Spree.t(:product) %> <%= Spree.t(:option_values) %></label>
22
22
  <a class="js-remove-promo-rule-option-value delete pull-right">
@@ -24,12 +24,13 @@
24
24
  </a>
25
25
  </div>
26
26
  <div class="card-body row p-3">
27
- <div class="col-12 col-md-6">
28
- <input class="js-promo-rule-option-value-product-select fullwidth" type="hidden" value="{{ productSelect.value }}">
27
+ <div class="col-12 col-md-6 product-select">
28
+ <%= select_tag "product", nil, class: 'js-promo-rule-option-value-product-select d-block w-100', id: "promo-rule-option-value-product-select-{{productId}}" %>
29
29
  </div>
30
- <div class="col-12 col-md-6">
31
- <input class="js-promo-rule-option-value-option-values-select fullwidth" name="<%= param_prefix %>[preferred_eligible_values][{{ productSelect.value }}]" type="hidden" value={{optionValuesSelect.value}}>
30
+ <div class="col-12 col-md-6 option-value-select">
31
+ <%= select_tag "#{param_prefix}[preferred_eligible_values][{{ productId }}][]", nil, multiple: true, disabled: true, class: 'js-promo-rule-option-value-option-values-select d-none w-100', id: "promo-rule-option-value-option-values-select-{{productId}}" %>
32
32
  </div>
33
33
  </div>
34
34
  </div>
35
35
  </script>
36
+
@@ -1,7 +1,7 @@
1
1
  <div class="card-body">
2
2
  <div class="form-group products_rule_products">
3
3
  <%= label_tag "#{param_prefix}_product_ids_string", Spree.t('product_rule.choose_products') %>
4
- <%= hidden_field_tag "#{param_prefix}[product_ids_string]", promotion_rule.product_ids.join(","), class: "product_picker" %>
4
+ <%= select "#{param_prefix}", 'product_ids_string', options_from_collection_for_select(promotion_rule.products, :id, :name, promotion_rule.products.pluck(:id)), { include_hidden: true }, multiple: true, class: 'product_picker d-block w-100' %>
5
5
  </div>
6
6
  <div class="form-group mb-0">
7
7
  <%= label_tag Spree.t('product_rule.label') %>
@@ -1,7 +1,7 @@
1
1
  <div class="card-body">
2
2
  <div class="form-group taxons_rule_taxons">
3
3
  <%= label_tag "#{param_prefix}_taxon_ids_string", Spree.t('taxon_rule.choose_taxons') %>
4
- <%= hidden_field_tag "#{param_prefix}[taxon_ids_string]", promotion_rule.taxon_ids.join(","), class: "taxon_picker", id: 'product_taxon_ids' %>
4
+ <%= select_tag "#{param_prefix}[taxon_ids_string]", nil, class: 'taxon_picker d-block w-100', id: :product_taxon_ids %>
5
5
  </div>
6
6
  <div class="form-group mb-0">
7
7
  <%= label_tag Spree.t('taxon_rule.label') %>
@@ -1,6 +1,6 @@
1
1
  <div class="card-body">
2
2
  <div class="form-group mb-0">
3
3
  <%= label_tag Spree.t('user_rule.choose_users') %>
4
- <input type='hidden' name='<%= param_prefix %>[user_ids_string]' class='user_picker' value='<%= promotion_rule.user_ids.join(",") %>'>
4
+ <%= select "#{param_prefix}", 'user_ids_string', options_from_collection_for_select(promotion_rule.users, :id, :email, promotion_rule.users.pluck(:id)), { include_hidden: true }, multiple: true, class: 'user_picker d-block w-100' %>
5
5
  </div>
6
6
  </div>
@@ -25,7 +25,7 @@
25
25
  <% end %>
26
26
  <%= f.field_container :reason, class: ['form-group'] do %>
27
27
  <%= f.label :refund_reason_id, Spree.t(:reason) %>
28
- <%= f.collection_select(:refund_reason_id, refund_reasons, :id, :name, {include_blank: true}, {class: 'select2'}) %>
28
+ <%= f.collection_select(:refund_reason_id, refund_reasons, :id, :name, {include_blank: true}, {class: 'select2-clear'}) %>
29
29
  <%= f.error_message_on :reason %>
30
30
  <% end %>
31
31
  </div>
@@ -26,7 +26,9 @@
26
26
  <% return_item = item_fields.object %>
27
27
  <tr>
28
28
  <td>
29
- <div class="variant-name"><%= return_item.inventory_unit.variant.name %></div>
29
+ <div class="variant-name">
30
+ <%= link_to return_item.inventory_unit.variant.name, spree.edit_admin_product_path(return_item.inventory_unit.variant.product) %>
31
+ </div>
30
32
  <div class="variant-options"><%= return_item.inventory_unit.variant.options_text %></div>
31
33
  </td>
32
34
  <td>
@@ -49,7 +51,7 @@
49
51
  <% if return_item.exchange_processed? %>
50
52
  <%= return_item.exchange_variant.exchange_name %>
51
53
  <% else %>
52
- <%= item_fields.collection_select :exchange_variant_id, return_item.eligible_exchange_variants, :id, :exchange_name, { include_blank: true }, { class: "select2 return-item-exchange-selection" } %>
54
+ <%= item_fields.collection_select :exchange_variant_id, return_item.eligible_exchange_variants, :id, :exchange_name, { include_blank: true }, { class: "select2-clear return-item-exchange-selection" } %>
53
55
  <% end %>
54
56
  </td>
55
57
  </tr>
@@ -24,7 +24,9 @@
24
24
  <% @reimbursement.return_items.each do |return_item| %>
25
25
  <tr>
26
26
  <td>
27
- <div class="variant-name"><%= return_item.inventory_unit.variant.name %></div>
27
+ <div class="variant-name">
28
+ <%= link_to return_item.inventory_unit.variant.name, spree.edit_admin_product_path(return_item.inventory_unit.variant.product) %>
29
+ </div>
28
30
  <div class="variant-options"><%= return_item.inventory_unit.variant.options_text %></div>
29
31
  </td>
30
32
  <td>