spree_backend 2.3.13 → 2.4.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend/address_states.js +1 -3
  3. data/app/assets/javascripts/spree/backend/adjustments.js.coffee +1 -2
  4. data/app/assets/javascripts/spree/backend/admin.js.erb +11 -1
  5. data/app/assets/javascripts/spree/backend/checkouts/edit.js +1 -20
  6. data/app/assets/javascripts/spree/backend/line_items.js.coffee +2 -5
  7. data/app/assets/javascripts/spree/backend/line_items_on_order_edit.js.erb +50 -0
  8. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +2 -4
  9. data/app/assets/javascripts/spree/backend/orders/edit_form.js +2 -3
  10. data/app/assets/javascripts/spree/backend/payments/edit.js.coffee +5 -5
  11. data/app/assets/javascripts/spree/backend/product_picker.js +2 -4
  12. data/app/assets/javascripts/spree/backend/returns/expedited_exchanges_warning.coffee +4 -0
  13. data/app/assets/javascripts/spree/backend/returns/return_item_selection.js +35 -0
  14. data/app/assets/javascripts/spree/backend/shipments.js.erb +39 -52
  15. data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +1 -2
  16. data/app/assets/javascripts/spree/backend/stock_transfer.js.coffee +1 -2
  17. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js.erb +8 -6
  18. data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +5 -24
  19. data/app/assets/javascripts/spree/backend/taxons.js.coffee +2 -4
  20. data/app/assets/javascripts/spree/backend/user_picker.js +2 -3
  21. data/app/assets/javascripts/spree/backend/variant_autocomplete.js.coffee.erb +2 -2
  22. data/app/assets/stylesheets/spree/backend/components/_navigation.scss +0 -5
  23. data/app/assets/stylesheets/spree/backend/plugins/_select2.scss +5 -2
  24. data/app/assets/stylesheets/spree/backend/sections/_adjustments_table.scss +8 -0
  25. data/app/assets/stylesheets/spree/backend/sections/_products.scss +4 -0
  26. data/app/assets/stylesheets/spree/backend/sections/_return_authorizations.scss +24 -0
  27. data/app/assets/stylesheets/spree/backend/sections/_taxons.scss +1 -7
  28. data/app/assets/stylesheets/spree/backend/shared/_tables.scss +8 -0
  29. data/app/assets/stylesheets/spree/backend/spree_admin.scss +2 -0
  30. data/app/assets/stylesheets/spree/backend.css +1 -1
  31. data/app/controllers/spree/admin/adjustments_controller.rb +1 -7
  32. data/app/controllers/spree/admin/base_controller.rb +8 -2
  33. data/app/controllers/spree/admin/customer_returns_controller.rb +67 -0
  34. data/app/controllers/spree/admin/general_settings_controller.rb +1 -1
  35. data/app/controllers/spree/admin/images_controller.rb +1 -1
  36. data/app/controllers/spree/admin/log_entries_controller.rb +2 -2
  37. data/app/controllers/spree/admin/option_types_controller.rb +1 -1
  38. data/app/controllers/spree/admin/orders/customer_details_controller.rb +2 -2
  39. data/app/controllers/spree/admin/orders_controller.rb +21 -10
  40. data/app/controllers/spree/admin/payment_methods_controller.rb +3 -3
  41. data/app/controllers/spree/admin/payments_controller.rb +6 -12
  42. data/app/controllers/spree/admin/product_properties_controller.rb +2 -2
  43. data/app/controllers/spree/admin/products_controller.rb +1 -1
  44. data/app/controllers/spree/admin/promotion_actions_controller.rb +2 -2
  45. data/app/controllers/spree/admin/promotion_categories_controller.rb +6 -0
  46. data/app/controllers/spree/admin/promotion_rules_controller.rb +2 -2
  47. data/app/controllers/spree/admin/promotions_controller.rb +2 -1
  48. data/app/controllers/spree/admin/refund_reasons_controller.rb +6 -0
  49. data/app/controllers/spree/admin/refunds_controller.rb +31 -0
  50. data/app/controllers/spree/admin/reimbursement_types_controller.rb +6 -0
  51. data/app/controllers/spree/admin/reimbursements_controller.rb +44 -0
  52. data/app/controllers/spree/admin/resource_controller.rb +2 -2
  53. data/app/controllers/spree/admin/return_authorization_reasons_controller.rb +6 -0
  54. data/app/controllers/spree/admin/return_authorizations_controller.rb +35 -5
  55. data/app/controllers/spree/admin/return_items_controller.rb +9 -0
  56. data/app/controllers/spree/admin/search_controller.rb +1 -1
  57. data/app/controllers/spree/admin/shipping_methods_controller.rb +3 -3
  58. data/app/controllers/spree/admin/states_controller.rb +1 -1
  59. data/app/controllers/spree/admin/stock_items_controller.rb +1 -1
  60. data/app/controllers/spree/admin/stock_locations_controller.rb +1 -1
  61. data/app/controllers/spree/admin/stock_transfers_controller.rb +2 -2
  62. data/app/controllers/spree/admin/tax_rates_controller.rb +1 -1
  63. data/app/controllers/spree/admin/users_controller.rb +4 -4
  64. data/app/controllers/spree/admin/variants_controller.rb +2 -2
  65. data/app/controllers/spree/admin/zones_controller.rb +1 -1
  66. data/app/helpers/spree/admin/customer_returns_helper.rb +9 -0
  67. data/app/helpers/spree/admin/navigation_helper.rb +1 -1
  68. data/app/helpers/spree/admin/reimbursement_type_helper.rb +9 -0
  69. data/app/helpers/spree/admin/reimbursements_helper.rb +14 -0
  70. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +7 -3
  71. data/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +36 -0
  72. data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +50 -0
  73. data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +43 -0
  74. data/app/views/spree/admin/customer_returns/edit.html.erb +65 -0
  75. data/app/views/spree/admin/customer_returns/index.html.erb +60 -0
  76. data/app/views/spree/admin/customer_returns/new.html.erb +60 -0
  77. data/app/views/spree/admin/general_settings/edit.html.erb +6 -0
  78. data/app/views/spree/admin/images/_form.html.erb +6 -6
  79. data/app/views/spree/admin/log_entries/_credit_card.html.erb +4 -0
  80. data/app/views/spree/admin/log_entries/index.html.erb +2 -5
  81. data/app/views/spree/admin/option_types/_option_value_fields.html.erb +5 -7
  82. data/app/views/spree/admin/option_types/edit.html.erb +9 -2
  83. data/app/views/spree/admin/orders/_add_line_item.html.erb +18 -0
  84. data/app/views/spree/admin/orders/_form.html.erb +7 -7
  85. data/app/views/spree/admin/orders/_line_items_edit_form.html.erb +40 -0
  86. data/app/views/spree/admin/orders/_shipment.html.erb +1 -1
  87. data/app/views/spree/admin/orders/_shipment_manifest.html.erb +5 -4
  88. data/app/views/spree/admin/orders/cart.html.erb +39 -0
  89. data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
  90. data/app/views/spree/admin/orders/edit.html.erb +2 -2
  91. data/app/views/spree/admin/orders/index.html.erb +8 -14
  92. data/app/views/spree/admin/payment_methods/_form.html.erb +7 -7
  93. data/app/views/spree/admin/payments/_list.html.erb +11 -3
  94. data/app/views/spree/admin/payments/index.html.erb +13 -1
  95. data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +4 -6
  96. data/app/views/spree/admin/products/_form.html.erb +20 -6
  97. data/app/views/spree/admin/products/new.html.erb +3 -3
  98. data/app/views/spree/admin/products/stock.html.erb +1 -1
  99. data/app/views/spree/admin/promotion_categories/_form.html.erb +10 -0
  100. data/app/views/spree/admin/promotion_categories/edit.html.erb +17 -0
  101. data/app/views/spree/admin/promotion_categories/index.html.erb +34 -0
  102. data/app/views/spree/admin/promotion_categories/new.html.erb +16 -0
  103. data/app/views/spree/admin/promotion_rules/create.js.erb +2 -0
  104. data/app/views/spree/admin/promotions/_actions.html.erb +1 -1
  105. data/app/views/spree/admin/promotions/_form.html.erb +5 -0
  106. data/app/views/spree/admin/promotions/actions/_create_line_items.html.erb +7 -7
  107. data/app/views/spree/admin/promotions/index.html.erb +16 -6
  108. data/app/views/spree/admin/promotions/rules/_item_total.html.erb +4 -2
  109. data/app/views/spree/admin/promotions/rules/_one_use_per_user.html.erb +0 -0
  110. data/app/views/spree/admin/promotions/rules/_taxon.html.erb +9 -0
  111. data/app/views/spree/admin/prototypes/_form.html.erb +2 -2
  112. data/app/views/spree/admin/refund_reasons/edit.html.erb +4 -0
  113. data/app/views/spree/admin/refund_reasons/index.html.erb +5 -0
  114. data/app/views/spree/admin/refund_reasons/new.html.erb +4 -0
  115. data/app/views/spree/admin/refunds/edit.html.erb +31 -0
  116. data/app/views/spree/admin/refunds/new.html.erb +43 -0
  117. data/app/views/spree/admin/reimbursement_types/index.html.erb +33 -0
  118. data/app/views/spree/admin/reimbursements/edit.html.erb +108 -0
  119. data/app/views/spree/admin/reimbursements/index.html.erb +34 -0
  120. data/app/views/spree/admin/reimbursements/show.html.erb +94 -0
  121. data/app/views/spree/admin/return_authorization_reasons/edit.html.erb +4 -0
  122. data/app/views/spree/admin/return_authorization_reasons/index.html.erb +5 -0
  123. data/app/views/spree/admin/return_authorization_reasons/new.html.erb +4 -0
  124. data/app/views/spree/admin/return_authorizations/_form.html.erb +62 -50
  125. data/app/views/spree/admin/return_authorizations/edit.html.erb +6 -8
  126. data/app/views/spree/admin/return_authorizations/index.html.erb +3 -4
  127. data/app/views/spree/admin/return_authorizations/new.html.erb +1 -1
  128. data/app/views/spree/admin/shared/_configuration_menu.html.erb +5 -2
  129. data/app/views/spree/admin/shared/_destroy.js.erb +1 -1
  130. data/app/views/spree/admin/shared/_head.html.erb +1 -2
  131. data/app/views/spree/admin/shared/_order_submenu.html.erb +17 -3
  132. data/app/views/spree/admin/shared/_order_summary.html.erb +7 -0
  133. data/app/views/spree/admin/shared/_product_tabs.html.erb +1 -0
  134. data/app/views/spree/admin/shared/_refunds.html.erb +32 -0
  135. data/app/views/spree/admin/shared/_report_order_criteria.html.erb +12 -12
  136. data/app/views/spree/admin/shared/_tabs.html.erb +2 -2
  137. data/app/views/spree/admin/shared/named_types/_edit.html.erb +17 -0
  138. data/app/views/spree/admin/shared/named_types/_form.html.erb +16 -0
  139. data/app/views/spree/admin/shared/named_types/_index.html.erb +52 -0
  140. data/app/views/spree/admin/shared/named_types/_new.html.erb +16 -0
  141. data/app/views/spree/admin/shipping_categories/_form.html.erb +1 -1
  142. data/app/views/spree/admin/shipping_methods/_form.html.erb +8 -0
  143. data/app/views/spree/admin/stock_locations/_form.html.erb +77 -59
  144. data/app/views/spree/admin/stock_transfers/new.html.erb +2 -2
  145. data/app/views/spree/admin/tax_categories/_form.html.erb +9 -2
  146. data/app/views/spree/admin/tax_categories/index.html.erb +4 -1
  147. data/app/views/spree/admin/taxons/index.html.erb +4 -0
  148. data/app/views/spree/admin/trackers/_form.html.erb +4 -4
  149. data/app/views/spree/admin/users/_form.html.erb +1 -1
  150. data/app/views/spree/admin/users/index.html.erb +1 -1
  151. data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +49 -0
  152. data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +0 -1
  153. data/app/views/spree/admin/variants/_split.js.erb +1 -1
  154. data/app/views/spree/admin/zones/_form.html.erb +1 -1
  155. data/config/initializers/assets.rb +1 -1
  156. data/config/routes.rb +22 -1
  157. metadata +62 -32
  158. data/app/controllers/spree/admin/inventory_units_controller.rb +0 -6
  159. data/app/controllers/spree/admin/line_items_controller.rb +0 -49
  160. data/app/controllers/spree/admin/overview_controller.rb +0 -11
  161. data/app/views/spree/admin/inventory_units/adjust.html.erb +0 -31
  162. data/app/views/spree/test_mailer/test_email.text.erb +0 -4
  163. data/config/locales/en.yml +0 -6
@@ -3,8 +3,9 @@ module Spree
3
3
  class ReturnAuthorizationsController < ResourceController
4
4
  belongs_to 'spree/order', :find_by => :number
5
5
 
6
- update.after :associate_inventory_units
7
- create.after :associate_inventory_units
6
+ before_action :load_form_data, only: [:new, :edit]
7
+ create.fails :load_form_data
8
+ update.fails :load_form_data
8
9
 
9
10
  def fire
10
11
  @return_authorization.send("#{params[:e]}!")
@@ -12,10 +13,39 @@ module Spree
12
13
  redirect_to :back
13
14
  end
14
15
 
15
- protected
16
- def associate_inventory_units
17
- (params[:return_quantity] || []).each { |variant_id, qty| @return_authorization.add_variant(variant_id.to_i, qty.to_i) }
16
+ private
17
+
18
+ def load_form_data
19
+ load_return_items
20
+ load_reimbursement_types
21
+ load_return_authorization_reasons
22
+ end
23
+
24
+ # To satisfy how nested attributes works we want to create placeholder ReturnItems for
25
+ # any InventoryUnits that have not already been added to the ReturnAuthorization.
26
+ def load_return_items
27
+ all_inventory_units = @return_authorization.order.inventory_units
28
+ associated_inventory_units = @return_authorization.return_items.map(&:inventory_unit)
29
+ unassociated_inventory_units = all_inventory_units - associated_inventory_units
30
+
31
+ new_return_items = unassociated_inventory_units.map do |new_unit|
32
+ Spree::ReturnItem.new(inventory_unit: new_unit).tap(&:set_default_pre_tax_amount)
18
33
  end
34
+
35
+ @form_return_items = (@return_authorization.return_items + new_return_items).sort_by(&:inventory_unit_id)
36
+ end
37
+
38
+ def load_reimbursement_types
39
+ @reimbursement_types = Spree::ReimbursementType.accessible_by(current_ability, :read).active
40
+ end
41
+
42
+ def load_return_authorization_reasons
43
+ @reasons = Spree::ReturnAuthorizationReason.active
44
+ # Only allow an inactive reason if it's already associated to the RMA
45
+ if @return_authorization.reason && !@return_authorization.reason.active?
46
+ @reasons << @return_authorization.reason
47
+ end
48
+ end
19
49
  end
20
50
  end
21
51
  end
@@ -0,0 +1,9 @@
1
+ module Spree
2
+ module Admin
3
+ class ReturnItemsController < ResourceController
4
+ def location_after_save
5
+ url_for([:edit, :admin, @return_item.customer_return.order, @return_item.customer_return])
6
+ end
7
+ end
8
+ end
9
+ end
@@ -2,7 +2,7 @@ module Spree
2
2
  module Admin
3
3
  class SearchController < Spree::Admin::BaseController
4
4
  # http://spreecommerce.com/blog/2010/11/02/json-hijacking-vulnerability/
5
- before_filter :check_json_authenticity, :only => :index
5
+ before_action :check_json_authenticity, only: :index
6
6
  respond_to :json
7
7
 
8
8
  # TODO: Clean this up by moving searching out to user_class_extensions
@@ -1,9 +1,9 @@
1
1
  module Spree
2
2
  module Admin
3
3
  class ShippingMethodsController < ResourceController
4
- before_filter :load_data, :except => [:index]
5
- before_filter :set_shipping_category, :only => [:create, :update]
6
- before_filter :set_zones, :only => [:create, :update]
4
+ before_action :load_data, except: :index
5
+ before_action :set_shipping_category, only: [:create, :update]
6
+ before_action :set_zones, only: [:create, :update]
7
7
 
8
8
  def destroy
9
9
  @object.destroy
@@ -2,7 +2,7 @@ module Spree
2
2
  module Admin
3
3
  class StatesController < ResourceController
4
4
  belongs_to 'spree/country'
5
- before_filter :load_data
5
+ before_action :load_data
6
6
 
7
7
  def index
8
8
  respond_with(@collection) do |format|
@@ -1,7 +1,7 @@
1
1
  module Spree
2
2
  module Admin
3
3
  class StockItemsController < Spree::Admin::BaseController
4
- before_filter :determine_backorderable, only: :update
4
+ before_action :determine_backorderable, only: :update
5
5
 
6
6
  def update
7
7
  stock_item.save
@@ -2,7 +2,7 @@ module Spree
2
2
  module Admin
3
3
  class StockLocationsController < ResourceController
4
4
 
5
- before_filter :set_country, :only => :new
5
+ before_action :set_country, only: :new
6
6
 
7
7
  private
8
8
 
@@ -1,7 +1,7 @@
1
1
  module Spree
2
2
  module Admin
3
3
  class StockTransfersController < Admin::BaseController
4
- before_filter :load_stock_locations, :only => :index
4
+ before_action :load_stock_locations, only: :index
5
5
 
6
6
  def index
7
7
  @q = StockTransfer.ransack(params[:q])
@@ -37,7 +37,7 @@ module Spree
37
37
 
38
38
  private
39
39
  def load_stock_locations
40
- @stock_locations = Spree::StockLocation.active.order('name ASC')
40
+ @stock_locations = Spree::StockLocation.active.order_default
41
41
  end
42
42
 
43
43
  def source_location
@@ -1,7 +1,7 @@
1
1
  module Spree
2
2
  module Admin
3
3
  class TaxRatesController < ResourceController
4
- before_filter :load_data
4
+ before_action :load_data
5
5
 
6
6
  private
7
7
 
@@ -3,11 +3,11 @@ module Spree
3
3
  class UsersController < ResourceController
4
4
  rescue_from Spree::Core::DestroyWithOrdersError, :with => :user_destroy_with_orders_error
5
5
 
6
- after_filter :sign_in_if_change_own_password, :only => :update
6
+ after_action :sign_in_if_change_own_password, only: :update
7
7
 
8
8
  # http://spreecommerce.com/blog/2010/11/02/json-hijacking-vulnerability/
9
- before_filter :check_json_authenticity, :only => :index
10
- before_filter :load_roles
9
+ before_action :check_json_authenticity, only: :index
10
+ before_action :load_roles
11
11
 
12
12
  def index
13
13
  respond_with(@collection) do |format|
@@ -66,7 +66,7 @@ module Spree
66
66
 
67
67
  def orders
68
68
  params[:q] ||= {}
69
- @search = Spree::Order.ransack(params[:q].merge(user_id_eq: @user.id))
69
+ @search = Spree::Order.reverse_chronological.ransack(params[:q].merge(user_id_eq: @user.id))
70
70
  @orders = @search.result.page(params[:page]).per(Spree::Config[:admin_products_per_page])
71
71
  end
72
72
 
@@ -3,9 +3,9 @@ module Spree
3
3
  class VariantsController < ResourceController
4
4
  belongs_to 'spree/product', :find_by => :slug
5
5
  new_action.before :new_before
6
- before_filter :load_data, :only => [:new, :create, :edit, :update]
6
+ before_action :load_data, only: [:new, :create, :edit, :update]
7
7
 
8
- # override the destory method to set deleted_at value
8
+ # override the destroy method to set deleted_at value
9
9
  # instead of actually deleting the product.
10
10
  def destroy
11
11
  @variant = Variant.find(params[:id])
@@ -1,7 +1,7 @@
1
1
  module Spree
2
2
  module Admin
3
3
  class ZonesController < ResourceController
4
- before_filter :load_data, :except => [:index]
4
+ before_action :load_data, except: :index
5
5
 
6
6
  def new
7
7
  @zone.zone_members.build
@@ -0,0 +1,9 @@
1
+ module Spree
2
+ module Admin
3
+ module CustomerReturnsHelper
4
+ def reimbursement_types
5
+ @reimbursement_types ||= Spree::ReimbursementType.accessible_by(current_ability, :read).active
6
+ end
7
+ end
8
+ end
9
+ end
@@ -145,7 +145,7 @@ module Spree
145
145
  end
146
146
 
147
147
  def configurations_sidebar_menu_item(link_text, url, options = {})
148
- is_active = url.ends_with?(controller.controller_name) ||
148
+ is_active = url.ends_with?(controller.controller_name) ||
149
149
  url.ends_with?("#{controller.controller_name}/edit") ||
150
150
  url.ends_with?("#{controller.controller_name.singularize}/edit")
151
151
  options.merge!(:class => is_active ? 'active' : nil)
@@ -0,0 +1,9 @@
1
+ module Spree
2
+ module Admin
3
+ module ReimbursementTypeHelper
4
+ def reimbursement_type_name(reimbursement_type)
5
+ reimbursement_type.present? ? reimbursement_type.name.humanize : ''
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ module Spree
2
+ module Admin
3
+ module ReimbursementsHelper
4
+ def reimbursement_status_color(reimbursement)
5
+ case reimbursement.reimbursement_status
6
+ when 'reimbursed' then 'success'
7
+ when 'pending' then 'notice'
8
+ when 'errored' then 'error'
9
+ else raise "unknown reimbursement status: #{reimbursement.reimbursement_status}"
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -10,10 +10,14 @@
10
10
  </thead>
11
11
  <tbody>
12
12
  <%= render :partial => "adjustment", :collection => @adjustments %>
13
- <tr>
13
+ <tr data-hook="adjustment_buttons">
14
14
  <td class="align-center" colspan='4'>
15
- <%= button_to Spree.t(:open_all_adjustments), open_adjustments_admin_order_path(@order), :method => :get %>&nbsp;
16
- <%= button_to Spree.t(:close_all_adjustments), close_adjustments_admin_order_path(@order), :method => :get %>
15
+ <div>
16
+ <%= button_to Spree.t(:open_all_adjustments), open_adjustments_admin_order_path(@order), method: :get %>
17
+ </div>
18
+ <div>
19
+ <%= button_to Spree.t(:close_all_adjustments), close_adjustments_admin_order_path(@order), method: :get %>
20
+ </div>
17
21
  </td>
18
22
  <td class='actions'>&nbsp;</td>
19
23
  </tr>
@@ -0,0 +1,36 @@
1
+ <table class="index">
2
+ <thead data-hook="customer_return_header">
3
+ <tr>
4
+ <th><%= Spree.t(:number) %></th>
5
+ <th><%= Spree.t(:total) %></th>
6
+ <th><%= Spree.t(:status) %></th>
7
+ <th><%= "#{Spree.t('date')}/#{Spree.t('time')}" %></th>
8
+ <th class="actions"></th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <% reimbursements.each do |reimbursement| %>
13
+ <tr id="<%= spree_dom_id(reimbursement) %>" data-hook="reimbursement_row" class="<%= cycle('odd', 'even')%>">
14
+ <td>
15
+ <% if reimbursement.reimbursed? %>
16
+ <%= link_to reimbursement.number, url_for([:admin, @order, reimbursement]) %>
17
+ <% else %>
18
+ <%= reimbursement.number %>
19
+ <% end %>
20
+ </td>
21
+ <td><%= reimbursement.display_total %></td>
22
+ <td>
23
+ <span class="state <%= reimbursement_status_color(reimbursement) %>">
24
+ <%= reimbursement.reimbursement_status %>
25
+ </span>
26
+ </td>
27
+ <td><%= pretty_time(reimbursement.created_at) %></td>
28
+ <td class="actions">
29
+ <% if !reimbursement.reimbursed? %>
30
+ <%= link_to_edit_url url_for([:edit, :admin, @order, reimbursement]), title: "admin_edit_#{dom_id(reimbursement)}", no_text: true %>
31
+ <% end %>
32
+ </td>
33
+ </tr>
34
+ <% end %>
35
+ </tbody>
36
+ </table>
@@ -0,0 +1,50 @@
1
+ <table class="show return-items-table">
2
+ <thead>
3
+ <tr>
4
+ <th><%= Spree.t(:product) %></th>
5
+ <th><%= Spree.t(:sku) %></th>
6
+ <th><%= Spree.t(:pre_tax_amount) %></th>
7
+ <th><%= Spree.t(:preferred_reimbursement_type) %></th>
8
+ <th><%= Spree.t(:exchange_for) %></th>
9
+ <th><%= Spree.t(:acceptance_errors) %></th>
10
+ <% if show_decision %>
11
+ <th class="actions"></th>
12
+ <% end %>
13
+ </tr>
14
+ </thead>
15
+ <tbody>
16
+ <% return_items.each do |return_item| %>
17
+ <tr>
18
+ <td>
19
+ <div class="variant-name"><%= return_item.inventory_unit.variant.name %></div>
20
+ <div class="variant-options"><%= return_item.inventory_unit.variant.options_text %></div>
21
+ </td>
22
+ <td>
23
+ <%= return_item.inventory_unit.variant.sku %>
24
+ </td>
25
+ <td class="align-center">
26
+ <%= return_item.display_pre_tax_amount %>
27
+ </td>
28
+ <td class="align-center">
29
+ <%= reimbursement_type_name(return_item.preferred_reimbursement_type) %>
30
+ </td>
31
+ <td class="align-center">
32
+ <%= return_item.exchange_variant.try(:options_text) %>
33
+ </td>
34
+ <td class="align-center">
35
+ <%= return_item.acceptance_status_errors %>
36
+ </td>
37
+ <% if show_decision %>
38
+ <td class='actions'>
39
+ <%= button_to [:admin, return_item], { class: 'fa fa-thumbs-up icon_link no-text with-tip', params: { "return_item[acceptance_status]" => 'accepted' }, "data-action" => 'save', title: Spree.t(:accept), method: 'put' } do %>
40
+ Spree.t(:accept)
41
+ <% end %>
42
+ <%= button_to [:admin, return_item], { class: 'fa fa-thumbs-down icon_link no-text with-tip', params: { "return_item[acceptance_status]" => 'rejected' }, "data-action" => 'remove', title: Spree.t(:reject), method: 'put' } do %>
43
+ Spree.t(:reject)
44
+ <% end %>
45
+ </td>
46
+ <% end %>
47
+ </tr>
48
+ <% end %>
49
+ </tbody>
50
+ </table>
@@ -0,0 +1,43 @@
1
+ <table class="index return-items-table">
2
+ <thead>
3
+ <tr>
4
+ <th>
5
+ <%= check_box_tag 'select-all' %>
6
+ </th>
7
+ <th><%= Spree.t(:product) %></th>
8
+ <th><%= Spree.t(:sku) %></th>
9
+ <th><%= Spree.t(:pre_tax_amount) %></th>
10
+ <th><%= Spree.t(:exchange_for) %></th>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <%= f.fields_for :return_items, return_items do |item_fields| %>
15
+ <% return_item = item_fields.object %>
16
+
17
+ <tr>
18
+ <td class="align-center" class="inventory-unit-checkbox">
19
+ <div style="display:none">
20
+ <%= item_fields.hidden_field :inventory_unit_id %>
21
+ <%= item_fields.hidden_field :return_authorization_id %>
22
+ <%= item_fields.hidden_field :pre_tax_amount %>
23
+ </div>
24
+
25
+ <%= item_fields.check_box :returned, {checked: false, class: 'add-item', "data-price" => return_item.pre_tax_amount}, '1', '0' %>
26
+ </td>
27
+ <td>
28
+ <div class="variant-name"><%= return_item.inventory_unit.variant.name %></div>
29
+ <div class="variant-options"><%= return_item.inventory_unit.variant.options_text %></div>
30
+ </td>
31
+ <td>
32
+ <%= return_item.inventory_unit.variant.sku %>
33
+ </td>
34
+ <td class="align-center">
35
+ <%= return_item.display_pre_tax_amount %>
36
+ </td>
37
+ <td class="align-center">
38
+ <%= return_item.exchange_variant.try(:options_text) %>
39
+ </td>
40
+ </tr>
41
+ <% end %>
42
+ </tbody>
43
+ </table>
@@ -0,0 +1,65 @@
1
+ <%= render :partial => 'spree/admin/shared/order_tabs', :locals => { :current => 'Customer Returns' } %>
2
+
3
+ <% content_for :page_title do %>
4
+ <i class="fa fa-arrow-right"></i> <%= Spree.t(:customer_return) %> #<%= @customer_return.number %>
5
+ <% end %>
6
+
7
+ <% content_for :page_actions do %>
8
+ <li><%= button_link_to Spree.t(:back_to_customer_return_list), spree.admin_order_customer_returns_url(@order), :icon => 'arrow-left' %></li>
9
+ <% end %>
10
+
11
+ <% if @manual_intervention_return_items.any? %>
12
+ <fieldset data-hook="manual_intervention_return_items" class="no-border-bottom">
13
+ <legend align="center"><%= Spree.t(:manual_intervention_required) %></legend>
14
+ <%= render partial: 'return_item_decision', locals: {return_items: @manual_intervention_return_items, show_decision: true} %>
15
+ </fieldset>
16
+ <% end %>
17
+
18
+ <% if @pending_return_items.any? %>
19
+ <fieldset data-hook="accepted_return_items" class="no-border-bottom">
20
+ <legend align="center"><%= Spree.t(:pending) %></legend>
21
+ <%= render partial: 'return_item_decision', locals: {return_items: @pending_return_items, show_decision: true} %>
22
+ </fieldset>
23
+ <% end %>
24
+
25
+ <% if @accepted_return_items.any? %>
26
+ <fieldset data-hook="accepted_return_items" class="no-border-bottom">
27
+ <legend align="center"><%= Spree.t(:accepted) %></legend>
28
+ <%= render partial: 'return_item_decision', locals: {return_items: @accepted_return_items, show_decision: false} %>
29
+ </fieldset>
30
+ <% end %>
31
+
32
+ <% if @rejected_return_items.any? %>
33
+ <fieldset data-hook="rejected_return_items" class="no-border-bottom">
34
+ <legend align="center"><%= Spree.t(:rejected) %></legend>
35
+ <%= render partial: 'return_item_decision', locals: {return_items: @rejected_return_items, show_decision: false} %>
36
+ </fieldset>
37
+ <% end %>
38
+
39
+ <% if !@customer_return.fully_reimbursed? && @pending_reimbursements.empty? %>
40
+ <fieldset data-hook="reimbursements" class="no-border-bottom no-border-top align-center">
41
+ <% if @customer_return.completely_decided? %>
42
+ <%= form_for [:admin, @order, Spree::Reimbursement.new] do |f| %>
43
+ <%= hidden_field_tag :build_from_customer_return_id, @customer_return.id %>
44
+ <%= f.button class: 'button fa fa-reply' do %>
45
+ <%= Spree.t(:create_reimbursement) %>
46
+ <% end %>
47
+ <% end %>
48
+ <% else %>
49
+ <div class="no-objects-found">
50
+ <%= Spree.t(:unable_to_create_reimbursements) %>
51
+ </div>
52
+ <% end %>
53
+ </fieldset>
54
+ <% end %>
55
+
56
+ <fieldset data-hook="reimbursements" class="no-border-bottom align-center">
57
+ <legend align="center"><%= Spree.t(:reimbursements) %></legend>
58
+ <% if @customer_return.reimbursements.any? %>
59
+ <%= render partial: 'reimbursements_table', locals: {reimbursements: @customer_return.reimbursements} %>
60
+ <% else %>
61
+ <div class="no-objects-found">
62
+ <%= Spree.t(:none) %>
63
+ </div>
64
+ <% end %>
65
+ </fieldset>
@@ -0,0 +1,60 @@
1
+ <%= render :partial => 'spree/admin/shared/order_tabs', :locals => { :current => 'Customer Returns' } %>
2
+
3
+ <% content_for :page_actions do %>
4
+ <% if @order.shipments.any?(&:shipped?) %>
5
+ <li>
6
+ <%= button_link_to Spree.t(:new_customer_return), spree.new_admin_order_customer_return_path(@order), icon: 'plus' %>
7
+ </li>
8
+ <% end %>
9
+ <li><%= button_link_to Spree.t(:back_to_orders_list), spree.admin_orders_path, :icon => 'arrow-left' %></li>
10
+ <% end %>
11
+
12
+ <% content_for :page_title do %>
13
+ <i class="fa fa-arrow-right"></i> <%= Spree.t(:customer_returns) %>
14
+ <% end %>
15
+
16
+ <% if @order.shipments.any?(&:shipped?) %>
17
+
18
+ <% if @customer_returns.any? %>
19
+ <table class="index">
20
+ <thead data-hook="customer_return_header">
21
+ <tr>
22
+ <th><%= Spree.t(:return_number) %></th>
23
+ <th><%= Spree.t(:pre_tax_total) %></th>
24
+ <th><%= "#{Spree.t('date')}/#{Spree.t('time')}" %></th>
25
+ <th><%= Spree.t(:reimbursement_status) %></th>
26
+ <th class="actions"></th>
27
+ </tr>
28
+ </thead>
29
+ <tbody>
30
+ <% @customer_returns.each do |customer_return| %>
31
+ <tr id="<%= spree_dom_id(customer_return) %>" data-hook="customer_return_row" class="<%= cycle('odd', 'even')%>">
32
+ <td><%= link_to customer_return.number, edit_admin_order_customer_return_path(@order, customer_return) %></td>
33
+ <td><%= customer_return.display_pre_tax_total.to_html %></td>
34
+ <td><%= pretty_time(customer_return.created_at) %></td>
35
+ <td>
36
+ <% if customer_return.fully_reimbursed? %>
37
+ <span class="state success"><%= Spree.t(:reimbursed) %></span>
38
+ <% else %>
39
+ <span class="state notice"><%= Spree.t(:incomplete) %></span>
40
+ <% end %>
41
+ </td>
42
+ <td class='actions align-center' data-hook="admin_orders_customer_returns_index_row_actions">
43
+ <%= link_to_edit_url edit_admin_order_customer_return_path(@order, customer_return), title: "admin_edit_#{dom_id(customer_return)}", no_text: true %>
44
+ </td>
45
+ </tr>
46
+ <% end %>
47
+ </tbody>
48
+ </table>
49
+ <% else %>
50
+ <div class="alpha twelve columns no-objects-found">
51
+ <%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/customer_return')) %>,
52
+ <%= link_to Spree.t(:add_one), spree.new_admin_order_customer_return_path(@order) %>!
53
+ </div>
54
+ <% end %>
55
+
56
+ <% else %>
57
+ <div data-hook="customer_return_cannot_create" class="no-objects-found">
58
+ <%= Spree.t(:cannot_create_customer_returns) %>
59
+ </div>
60
+ <% end %>
@@ -0,0 +1,60 @@
1
+ <%= render :partial => 'spree/admin/shared/order_tabs', :locals => { :current => 'Customer Returns' } %>
2
+
3
+ <% content_for :page_title do %>
4
+ <i class="fa fa-arrow-right"></i> <%= Spree.t(:new_customer_return) %>
5
+ <% end %>
6
+
7
+ <% content_for :page_actions do %>
8
+ <li><%= button_link_to Spree.t(:back_to_customer_return_list), spree.admin_order_customer_returns_url(@order), :icon => 'arrow-left' %></li>
9
+ <% end %>
10
+
11
+ <% if @rma_return_items.any? || @new_return_items.any? %>
12
+
13
+ <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @customer_return } %>
14
+ <%= form_for [:admin, @order, @customer_return] do |f| %>
15
+ <fieldset class="no-border-top">
16
+ <div data-hook="admin_customer_return_form_fields">
17
+ <fieldset class='no-border-bottom'>
18
+ <legend align='center'><%= Spree.t(:items_in_rmas) %></legend>
19
+ <% if @rma_return_items.any? %>
20
+ <%= render partial: 'return_item_selection', locals: {f: f, return_items: @rma_return_items} %>
21
+ <% else %>
22
+ <div class="alpha twelve columns no-objects-found"><%= Spree.t(:none) %></div>
23
+ <% end %>
24
+ </fieldset>
25
+
26
+ <fieldset class='no-border-bottom'>
27
+ <legend align='center'><%= Spree.t(:other_items_in_other) %></legend>
28
+ <% if @new_return_items.any? %>
29
+ <%= render partial: 'return_item_selection', locals: {f: f, return_items: @new_return_items} %>
30
+ <% else %>
31
+ <div class="alpha twelve columns no-objects-found"><%= Spree.t(:none) %></div>
32
+ <% end %>
33
+ </fieldset>
34
+
35
+ <%= f.field_container :stock_location do %>
36
+ <%= f.label :stock_location, Spree.t(:stock_location) %>
37
+ <%= f.select :stock_location_id, Spree::StockLocation.order_default.active.to_a.collect{|l|[l.name.humanize, l.id]}, {include_blank: true}, {class: 'select2 fullwidth', "data-placeholder" => Spree.t(:select_a_stock_location)} %>
38
+ <%= f.error_message_on :stock_location_id %>
39
+ <% end %>
40
+
41
+ </div>
42
+
43
+ <div class="form-buttons filter-actions actions" data-hook="buttons">
44
+ <%= button Spree.t(:create), 'ok' %>
45
+ <span class="or"><%= Spree.t(:or) %></span>
46
+ <%= button_link_to Spree.t('actions.cancel'), admin_order_customer_returns_url(@order), :icon => 'remove' %>
47
+ </div>
48
+ </fieldset>
49
+ <% end %>
50
+
51
+ <% else %>
52
+
53
+ <div class="twelve columns">
54
+ <div class="alpha twelve columns no-objects-found">
55
+ <%= Spree.t(:all_items_have_been_returned) %>,
56
+ <%= link_to Spree.t(:back_to_customer_return_list), spree.admin_order_customer_returns_path(@order) %>.
57
+ </div>
58
+ </div>
59
+
60
+ <% end %>
@@ -39,6 +39,12 @@
39
39
  <br />
40
40
  <%= f.text_field :url, class: 'fullwidth' %>
41
41
  </div>
42
+
43
+ <div class="field" data-hook="admin_general_setting_mail_from_address">
44
+ <%= f.label :mail_from_address %>
45
+ <br />
46
+ <%= f.text_field :mail_from_address, class: 'fullwidth' %>
47
+ </div>
42
48
  <% end %>
43
49
 
44
50
  <div class="row">
@@ -1,18 +1,18 @@
1
1
  <div data-hook="admin_image_form_fields">
2
2
  <div class="four columns alpha">
3
3
  <div data-hook="file" class="field">
4
- <%= f.label Spree.t(:filename) %><br>
4
+ <%= f.label :attachment, Spree.t(:filename) %><br>
5
5
  <%= f.file_field :attachment %>
6
6
  </div>
7
7
  <div data-hook="variant" class="field">
8
- <%= f.label Spree::Variant.model_name.human %><br>
9
- <%= f.select :viewable_id, @variants, {}, {:class => 'select2 fullwidth'} %>
8
+ <%= f.label :viewable_id, Spree::Variant.model_name.human %><br>
9
+ <%= f.select :viewable_id, @variants, {}, { class: 'select2 fullwidth' } %>
10
10
  </div>
11
11
  </div>
12
12
  <div data-hook="alt_text" class="field omega five columns">
13
- <%= f.label Spree.t(:alt_text) %><br>
14
- <%= f.text_area :alt, :rows => 4, :class => 'fullwidth' %>
13
+ <%= f.label :alt, Spree.t(:alt_text) %><br>
14
+ <%= f.text_area :alt, rows: 4, class: 'fullwidth' %>
15
15
  </div>
16
16
  </div>
17
17
 
18
- <div class="clear"></div>
18
+ <div class="clear"></div>
@@ -0,0 +1,4 @@
1
+ <tr>
2
+ <td>Message</td>
3
+ <td><%= entry.parsed_details.message %></td>
4
+ </tr>
@@ -22,10 +22,7 @@
22
22
  </tr>
23
23
  </thead>
24
24
  <tbody>
25
- <tr>
26
- <td>Message</td>
27
- <td><%= entry.parsed_details.message %></td>
28
- </tr>
25
+ <%= render "spree/admin/log_entries/#{@payment.payment_method.name.gsub(' ', '').underscore}", entry: entry %>
29
26
  </tbody>
30
27
  <% end %>
31
- </table>
28
+ </table>