solidus_admin 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc.json +7 -0
- data/README.md +1 -1
- data/Rakefile +26 -0
- data/app/assets/builds/.keep +0 -0
- data/app/assets/builds/solidus_admin/tailwind.css +2799 -0
- data/app/assets/config/solidus_admin_manifest.js +1 -0
- data/app/assets/stylesheets/solidus_admin/application.tailwind.css +4 -0
- data/app/assets/stylesheets/solidus_admin/dark.css +12 -0
- data/app/assets/stylesheets/solidus_admin/dimmed.css +11 -0
- data/app/components/solidus_admin/adjustment_reasons/index/component.html.erb +32 -0
- data/app/components/solidus_admin/adjustment_reasons/index/component.rb +53 -0
- data/app/components/solidus_admin/adjustment_reasons/index/component.yml +4 -0
- data/app/components/solidus_admin/layout/feedback/component.html.erb +15 -0
- data/app/components/solidus_admin/layout/feedback/component.rb +4 -0
- data/app/components/solidus_admin/layout/feedback/component.yml +3 -0
- data/app/components/solidus_admin/layout/navigation/account/component.html.erb +74 -0
- data/app/components/solidus_admin/layout/navigation/account/component.js +16 -0
- data/app/components/solidus_admin/layout/navigation/account/component.rb +36 -0
- data/app/components/solidus_admin/{sidebar → layout/navigation}/component.html.erb +9 -9
- data/app/components/solidus_admin/layout/navigation/component.rb +26 -0
- data/app/components/solidus_admin/{sidebar → layout/navigation}/item/component.html.erb +5 -5
- data/app/components/solidus_admin/{sidebar → layout/navigation}/item/component.rb +2 -2
- data/app/components/solidus_admin/layout/page_helpers.rb +55 -0
- data/app/components/solidus_admin/{skip_link → layout/skip_link}/component.rb +2 -4
- data/app/components/solidus_admin/option_types/index/component.html.erb +30 -0
- data/app/components/solidus_admin/option_types/index/component.rb +57 -0
- data/app/components/solidus_admin/option_types/index/component.yml +4 -0
- data/app/components/solidus_admin/orders/cart/component.html.erb +77 -0
- data/app/components/solidus_admin/orders/cart/component.js +37 -0
- data/app/components/solidus_admin/orders/cart/component.rb +7 -0
- data/app/components/solidus_admin/orders/cart/component.yml +3 -0
- data/app/components/solidus_admin/orders/cart/result/component.html.erb +26 -0
- data/app/components/solidus_admin/orders/cart/result/component.rb +11 -0
- data/app/components/solidus_admin/orders/index/component.html.erb +26 -22
- data/app/components/solidus_admin/orders/index/component.rb +80 -16
- data/app/components/solidus_admin/orders/index/component.yml +10 -3
- data/app/components/solidus_admin/orders/show/address/component.html.erb +67 -0
- data/app/components/solidus_admin/orders/show/address/component.js +9 -0
- data/app/components/solidus_admin/orders/show/address/component.rb +53 -0
- data/app/components/solidus_admin/orders/show/address/component.yml +14 -0
- data/app/components/solidus_admin/orders/show/component.html.erb +76 -0
- data/app/components/solidus_admin/orders/show/component.js +7 -0
- data/app/components/solidus_admin/orders/show/component.rb +40 -0
- data/app/components/solidus_admin/orders/show/component.yml +21 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.html.erb +14 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.js +14 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.rb +7 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.yml +2 -0
- data/app/components/solidus_admin/orders/show/customer_search/result/component.html.erb +17 -0
- data/app/components/solidus_admin/orders/show/customer_search/result/component.rb +11 -0
- data/app/components/solidus_admin/orders/show/email/component.html.erb +18 -0
- data/app/components/solidus_admin/orders/show/email/component.rb +15 -0
- data/app/components/solidus_admin/orders/show/email/component.yml +8 -0
- data/app/components/solidus_admin/orders/show/summary/component.html.erb +14 -0
- data/app/components/solidus_admin/orders/show/summary/component.rb +7 -0
- data/app/components/solidus_admin/orders/show/summary/component.yml +8 -0
- data/app/components/solidus_admin/payment_methods/index/component.html.erb +38 -0
- data/app/components/solidus_admin/payment_methods/index/component.rb +93 -0
- data/app/components/solidus_admin/payment_methods/index/component.yml +15 -0
- data/app/components/solidus_admin/products/index/component.html.erb +26 -22
- data/app/components/solidus_admin/products/index/component.rb +36 -36
- data/app/components/solidus_admin/products/index/component.yml +9 -6
- data/app/components/solidus_admin/products/show/component.html.erb +32 -38
- data/app/components/solidus_admin/products/show/component.rb +2 -0
- data/app/components/solidus_admin/products/show/component.yml +5 -5
- data/app/components/solidus_admin/products/status/component.rb +20 -18
- data/app/components/solidus_admin/products/status/component.yml +1 -0
- data/app/components/solidus_admin/products/stock/component.rb +38 -0
- data/app/components/solidus_admin/products/stock/component.yml +5 -0
- data/app/components/solidus_admin/promotion_categories/index/component.html.erb +26 -0
- data/app/components/solidus_admin/promotion_categories/index/component.rb +57 -0
- data/app/components/solidus_admin/promotion_categories/index/component.yml +4 -0
- data/app/components/solidus_admin/promotions/index/component.html.erb +34 -0
- data/app/components/solidus_admin/promotions/index/component.rb +97 -0
- data/app/components/solidus_admin/promotions/index/component.yml +14 -0
- data/app/components/solidus_admin/properties/index/component.html.erb +34 -0
- data/app/components/solidus_admin/properties/index/component.rb +65 -0
- data/app/components/solidus_admin/properties/index/component.yml +4 -0
- data/app/components/solidus_admin/refund_reasons/index/component.html.erb +31 -0
- data/app/components/solidus_admin/refund_reasons/index/component.rb +53 -0
- data/app/components/solidus_admin/refund_reasons/index/component.yml +4 -0
- data/app/components/solidus_admin/refunds_and_returns/component.html.erb +26 -0
- data/app/components/solidus_admin/refunds_and_returns/component.rb +20 -0
- data/app/components/solidus_admin/refunds_and_returns/component.yml +3 -0
- data/app/components/solidus_admin/reimbursement_types/index/component.html.erb +22 -0
- data/app/components/solidus_admin/reimbursement_types/index/component.rb +45 -0
- data/app/components/solidus_admin/reimbursement_types/index/component.yml +4 -0
- data/app/components/solidus_admin/return_reasons/index/component.html.erb +31 -0
- data/app/components/solidus_admin/return_reasons/index/component.rb +52 -0
- data/app/components/solidus_admin/return_reasons/index/component.yml +4 -0
- data/app/components/solidus_admin/shipping/component.html.erb +30 -0
- data/app/components/solidus_admin/shipping/component.rb +18 -0
- data/app/components/solidus_admin/shipping/component.yml +3 -0
- data/app/components/solidus_admin/shipping_categories/index/component.html.erb +32 -0
- data/app/components/solidus_admin/shipping_categories/index/component.rb +46 -0
- data/app/components/solidus_admin/shipping_categories/index/component.yml +4 -0
- data/app/components/solidus_admin/shipping_methods/index/component.html.erb +32 -0
- data/app/components/solidus_admin/shipping_methods/index/component.rb +61 -0
- data/app/components/solidus_admin/shipping_methods/index/component.yml +4 -0
- data/app/components/solidus_admin/stock_items/edit/component.html.erb +89 -0
- data/app/components/solidus_admin/stock_items/edit/component.js +17 -0
- data/app/components/solidus_admin/stock_items/edit/component.rb +23 -0
- data/app/components/solidus_admin/stock_items/edit/component.yml +10 -0
- data/app/components/solidus_admin/stock_items/index/component.html.erb +26 -0
- data/app/components/solidus_admin/stock_items/index/component.rb +180 -0
- data/app/components/solidus_admin/stock_items/index/component.yml +10 -0
- data/app/components/solidus_admin/stock_locations/index/component.html.erb +32 -0
- data/app/components/solidus_admin/stock_locations/index/component.rb +81 -0
- data/app/components/solidus_admin/stock_locations/index/component.yml +6 -0
- data/app/components/solidus_admin/store_credit_reasons/index/component.html.erb +31 -0
- data/app/components/solidus_admin/store_credit_reasons/index/component.rb +52 -0
- data/app/components/solidus_admin/store_credit_reasons/index/component.yml +4 -0
- data/app/components/solidus_admin/stores/index/component.html.erb +34 -0
- data/app/components/solidus_admin/stores/index/component.rb +59 -0
- data/app/components/solidus_admin/stores/index/component.yml +4 -0
- data/app/components/solidus_admin/tax_categories/index/component.html.erb +32 -0
- data/app/components/solidus_admin/tax_categories/index/component.rb +58 -0
- data/app/components/solidus_admin/tax_categories/index/component.yml +6 -0
- data/app/components/solidus_admin/tax_rates/index/component.html.erb +32 -0
- data/app/components/solidus_admin/tax_rates/index/component.rb +84 -0
- data/app/components/solidus_admin/tax_rates/index/component.yml +4 -0
- data/app/components/solidus_admin/taxes/component.html.erb +24 -0
- data/app/components/solidus_admin/taxes/component.rb +25 -0
- data/app/components/solidus_admin/taxes/component.yml +3 -0
- data/app/components/solidus_admin/taxonomies/index/component.html.erb +28 -0
- data/app/components/solidus_admin/taxonomies/index/component.rb +47 -0
- data/app/components/solidus_admin/taxonomies/index/component.yml +4 -0
- data/app/components/solidus_admin/ui/badge/component.rb +18 -8
- data/app/components/solidus_admin/ui/badge/component.yml +3 -0
- data/app/components/solidus_admin/ui/button/component.rb +32 -32
- data/app/components/solidus_admin/ui/details_list/component.html.erb +10 -0
- data/app/components/solidus_admin/ui/details_list/component.rb +7 -0
- data/app/components/solidus_admin/ui/dropdown/component.html.erb +50 -0
- data/app/components/solidus_admin/ui/dropdown/component.js +16 -0
- data/app/components/solidus_admin/ui/dropdown/component.rb +28 -0
- data/app/components/solidus_admin/ui/dropdown/component.yml +2 -0
- data/app/components/solidus_admin/ui/forms/address/component.html.erb +36 -0
- data/app/components/solidus_admin/ui/forms/address/component.js +34 -0
- data/app/components/solidus_admin/ui/forms/address/component.rb +14 -0
- data/app/components/solidus_admin/ui/forms/field/component.html.erb +5 -4
- data/app/components/solidus_admin/ui/forms/field/component.rb +53 -15
- data/app/components/solidus_admin/ui/forms/input/component.rb +11 -5
- data/app/components/solidus_admin/ui/forms/search/component.html.erb +52 -0
- data/app/components/solidus_admin/ui/forms/search/component.js +116 -0
- data/app/components/solidus_admin/ui/forms/search/component.rb +8 -0
- data/app/components/solidus_admin/ui/forms/search/component.yml +4 -0
- data/app/components/solidus_admin/ui/forms/search/result/component.rb +12 -0
- data/app/components/solidus_admin/ui/forms/search_field/component.html.erb +20 -0
- data/app/{javascript/solidus_admin/controllers/hello_controller.js → components/solidus_admin/ui/forms/search_field/component.js} +4 -2
- data/app/components/solidus_admin/ui/forms/search_field/component.rb +10 -0
- data/app/components/solidus_admin/ui/forms/search_field/component.yml +2 -0
- data/app/components/solidus_admin/ui/forms/switch/component.rb +27 -31
- data/app/components/solidus_admin/ui/forms/switch_field/component.html.erb +20 -0
- data/app/components/solidus_admin/ui/forms/switch_field/component.rb +11 -0
- data/app/components/solidus_admin/ui/icon/component.rb +4 -0
- data/app/components/solidus_admin/ui/modal/component.html.erb +37 -0
- data/app/components/solidus_admin/ui/modal/component.rb +12 -0
- data/app/components/solidus_admin/ui/modal/component.yml +2 -0
- data/app/components/solidus_admin/ui/panel/component.html.erb +26 -12
- data/app/components/solidus_admin/ui/panel/component.rb +17 -0
- data/app/components/solidus_admin/ui/panel/component.yml +1 -3
- data/app/components/solidus_admin/ui/resource_item/component.html.erb +10 -0
- data/app/components/solidus_admin/ui/resource_item/component.rb +9 -0
- data/app/components/solidus_admin/ui/tab/component.rb +9 -8
- data/app/components/solidus_admin/ui/table/component.html.erb +146 -135
- data/app/components/solidus_admin/ui/table/component.js +56 -17
- data/app/components/solidus_admin/ui/table/component.rb +94 -70
- data/app/components/solidus_admin/ui/table/component.yml +0 -1
- data/app/components/solidus_admin/ui/table/ransack_filter/component.html.erb +72 -0
- data/app/components/solidus_admin/ui/table/ransack_filter/component.js +73 -0
- data/app/components/solidus_admin/ui/table/ransack_filter/component.rb +68 -0
- data/app/components/solidus_admin/ui/table/ransack_filter/component.yml +3 -0
- data/app/components/solidus_admin/ui/table/toolbar/component.rb +21 -0
- data/app/components/solidus_admin/ui/thumbnail/component.rb +46 -0
- data/app/components/solidus_admin/ui/toast/component.html.erb +9 -5
- data/app/components/solidus_admin/ui/toast/component.js +9 -6
- data/app/components/solidus_admin/ui/toast/component.rb +2 -2
- data/app/components/solidus_admin/ui/toggletip/component.html.erb +14 -10
- data/app/components/solidus_admin/ui/toggletip/component.js +22 -4
- data/app/components/solidus_admin/ui/toggletip/component.rb +8 -85
- data/app/components/solidus_admin/users/index/component.html.erb +34 -0
- data/app/components/solidus_admin/users/index/component.rb +89 -0
- data/app/components/solidus_admin/users/index/component.yml +18 -0
- data/app/components/solidus_admin/zones/index/component.html.erb +35 -0
- data/app/components/solidus_admin/zones/index/component.rb +55 -0
- data/app/components/solidus_admin/zones/index/component.yml +4 -0
- data/app/controllers/solidus_admin/addresses_controller.rb +92 -0
- data/app/controllers/solidus_admin/adjustment_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/base_controller.rb +1 -0
- data/app/controllers/solidus_admin/controller_helpers/authorization.rb +5 -1
- data/app/controllers/solidus_admin/controller_helpers/locale.rb +2 -2
- data/app/controllers/solidus_admin/controller_helpers/search.rb +48 -0
- data/app/controllers/solidus_admin/controller_helpers/theme.rb +30 -0
- data/app/controllers/solidus_admin/countries_controller.rb +12 -0
- data/app/controllers/solidus_admin/customers_controller.rb +29 -0
- data/app/controllers/solidus_admin/line_items_controller.rb +45 -0
- data/app/controllers/solidus_admin/option_types_controller.rb +46 -0
- data/app/controllers/solidus_admin/orders_controller.rb +104 -7
- data/app/controllers/solidus_admin/payment_methods_controller.rb +52 -0
- data/app/controllers/solidus_admin/products_controller.rb +26 -17
- data/app/controllers/solidus_admin/promotion_categories_controller.rb +38 -0
- data/app/controllers/solidus_admin/promotions_controller.rb +46 -0
- data/app/controllers/solidus_admin/properties_controller.rb +33 -0
- data/app/controllers/solidus_admin/refund_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/reimbursement_types_controller.rb +31 -0
- data/app/controllers/solidus_admin/return_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/shipping_categories_controller.rb +40 -0
- data/app/controllers/solidus_admin/shipping_methods_controller.rb +40 -0
- data/app/controllers/solidus_admin/stock_items_controller.rb +67 -0
- data/app/controllers/solidus_admin/stock_locations_controller.rb +40 -0
- data/app/controllers/solidus_admin/store_credit_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/stores_controller.rb +40 -0
- data/app/controllers/solidus_admin/tax_categories_controller.rb +40 -0
- data/app/controllers/solidus_admin/tax_rates_controller.rb +40 -0
- data/app/controllers/solidus_admin/taxonomies_controller.rb +46 -0
- data/app/controllers/solidus_admin/users_controller.rb +50 -0
- data/app/controllers/solidus_admin/zones_controller.rb +40 -0
- data/app/javascript/solidus_admin/controllers/components.js +3 -1
- data/app/javascript/solidus_admin/controllers/confirm_controller.js +21 -0
- data/app/javascript/solidus_admin/controllers/details_click_outside_controller.js +12 -0
- data/app/javascript/solidus_admin/controllers/readonly_when_submitting_controller.js +17 -0
- data/app/javascript/solidus_admin/controllers/sortable_controller.js +33 -0
- data/app/views/layouts/solidus_admin/application.html.erb +16 -10
- data/app/views/layouts/solidus_admin/preview.html.erb +0 -1
- data/app/views/solidus_admin/base/unauthorized.html.erb +4 -0
- data/config/importmap.rb +2 -0
- data/config/initializers/view_component.rb +20 -0
- data/config/locales/adjustment_reasons.en.yml +6 -0
- data/config/locales/customers.en.yml +7 -0
- data/config/locales/errors.en.yml +7 -0
- data/config/locales/line_items.en.yml +9 -0
- data/config/locales/{main_nav.en.yml → menu_item.en.yml} +8 -2
- data/config/locales/option_types.en.yml +6 -0
- data/config/locales/orders.en.yml +9 -0
- data/config/locales/payment_methods.en.yml +6 -0
- data/config/locales/promotion_categories.en.yml +6 -0
- data/config/locales/promotions.en.yml +6 -0
- data/config/locales/properties.en.yml +6 -0
- data/config/locales/refund_reasons_.en.yml +6 -0
- data/config/locales/reimbursement_types.en.yml +4 -0
- data/config/locales/return_reasons.en.yml +6 -0
- data/config/locales/shipping_categories.en.yml +6 -0
- data/config/locales/shipping_methods.en.yml +6 -0
- data/config/locales/stock_items.en.yml +4 -0
- data/config/locales/stock_locations.en.yml +6 -0
- data/config/locales/store_credit_reasons.en.yml +6 -0
- data/config/locales/stores.en.yml +6 -0
- data/config/locales/tax_categories.en.yml +6 -0
- data/config/locales/tax_rates.en.yml +6 -0
- data/config/locales/taxonomies.en.yml +6 -0
- data/config/locales/users.en.yml +6 -0
- data/config/locales/zones.en.yml +6 -0
- data/config/routes.rb +50 -3
- data/config/tailwind.config.js +119 -0
- data/docs/{customizing_main_navigation.md → customizing_menu_items.md} +2 -2
- data/docs/customizing_tailwindcss.md +57 -0
- data/docs/customizing_view_components.md +17 -38
- data/lib/generators/solidus_admin/install/install_generator.rb +13 -4
- data/lib/generators/solidus_admin/install/templates/config/initializers/{solidus_admin.rb → solidus_admin.rb.tt} +10 -14
- data/lib/solidus_admin/admin_resources.rb +23 -0
- data/lib/solidus_admin/configuration.rb +93 -67
- data/lib/solidus_admin/install_tailwindcss.rb +102 -0
- data/lib/solidus_admin/{main_nav_item.rb → menu_item.rb} +2 -2
- data/lib/solidus_admin/version.rb +1 -1
- data/lib/solidus_admin.rb +1 -2
- data/lib/tasks/tailwind.rake +10 -0
- data/solidus_admin.gemspec +3 -4
- metadata +230 -50
- data/app/assets/stylesheets/solidus_admin/application.tailwind.css.erb +0 -35
- data/app/components/solidus_admin/feedback/component.html.erb +0 -11
- data/app/components/solidus_admin/feedback/component.rb +0 -4
- data/app/components/solidus_admin/feedback/component.yml +0 -5
- data/app/components/solidus_admin/sidebar/account_nav/component.html.erb +0 -67
- data/app/components/solidus_admin/sidebar/account_nav/component.rb +0 -15
- data/app/components/solidus_admin/sidebar/component.rb +0 -21
- data/app/components/solidus_admin/ui/panel/component.js +0 -14
- data/config/solidus_admin/tailwind.config.js.erb +0 -95
- data/docs/customizing_tailwind.md +0 -78
- data/lib/solidus_admin/tailwindcss.rb +0 -58
- data/lib/tasks/tailwindcss.rake +0 -55
- /data/app/components/solidus_admin/{sidebar/account_nav → layout/navigation/account}/component.yml +0 -0
- /data/app/components/solidus_admin/{sidebar → layout/navigation}/component.js +0 -0
- /data/app/components/solidus_admin/{sidebar → layout/navigation}/component.yml +0 -0
- /data/app/components/solidus_admin/{skip_link → layout/skip_link}/component.yml +0 -0
@@ -2,20 +2,117 @@
|
|
2
2
|
|
3
3
|
module SolidusAdmin
|
4
4
|
class OrdersController < SolidusAdmin::BaseController
|
5
|
+
include Spree::Core::ControllerHelpers::StrongParameters
|
6
|
+
include SolidusAdmin::ControllerHelpers::Search
|
7
|
+
|
8
|
+
search_scope(:completed, default: true) { _1.complete }
|
9
|
+
search_scope(:canceled) { _1.canceled }
|
10
|
+
search_scope(:returned) { _1.with_state(:returned) }
|
11
|
+
search_scope(:in_progress) { _1.with_state([:cart] + _1.checkout_step_names) }
|
12
|
+
search_scope(:all) { _1 }
|
13
|
+
|
5
14
|
def index
|
6
|
-
orders =
|
15
|
+
orders = apply_search_to(
|
16
|
+
Spree::Order.order(created_at: :desc, id: :desc),
|
17
|
+
param: :q,
|
18
|
+
)
|
19
|
+
|
20
|
+
set_page_and_extract_portion_from(orders)
|
21
|
+
|
22
|
+
respond_to do |format|
|
23
|
+
format.html { render component('orders/index').new(page: @page) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def new
|
28
|
+
order = Spree::Order.create!(
|
29
|
+
created_by: current_solidus_admin_user,
|
30
|
+
frontend_viewable: false,
|
31
|
+
store_id: current_store.try(:id)
|
32
|
+
)
|
33
|
+
|
34
|
+
redirect_to order_url(order), status: :see_other
|
35
|
+
end
|
36
|
+
|
37
|
+
def show
|
38
|
+
load_order
|
39
|
+
|
40
|
+
respond_to do |format|
|
41
|
+
format.html { render component('orders/show').new(order: @order) }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def update
|
46
|
+
load_order
|
47
|
+
|
48
|
+
@order.assign_attributes(order_params)
|
49
|
+
@order.email ||= @order.user.email if @order.user && @order.user.changed?
|
50
|
+
|
51
|
+
if @order.save
|
52
|
+
flash[:notice] = t('.success')
|
53
|
+
else
|
54
|
+
flash[:error] = t('.error')
|
55
|
+
end
|
56
|
+
|
57
|
+
redirect_to spree.edit_admin_order_path(@order)
|
58
|
+
end
|
59
|
+
|
60
|
+
def edit
|
61
|
+
redirect_to action: :show
|
62
|
+
end
|
63
|
+
|
64
|
+
def variants_for
|
65
|
+
load_order
|
66
|
+
|
67
|
+
# We need to eager load active storage attachments when using it
|
68
|
+
if Spree::Image.include?(Spree::Image::ActiveStorageAttachment)
|
69
|
+
image_includes = {
|
70
|
+
attachment_attachment: { blob: { variant_records: { image_attachment: :blob } } }
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
@variants = Spree::Variant
|
75
|
+
.where.not(id: @order.line_items.select(:variant_id))
|
76
|
+
.order(created_at: :desc, id: :desc)
|
77
|
+
.where(product_id: Spree::Product.ransack(params[:q]).result.select(:id))
|
78
|
+
.limit(10)
|
79
|
+
.eager_load(
|
80
|
+
:prices,
|
81
|
+
images: image_includes || {},
|
82
|
+
option_values: :option_type,
|
83
|
+
stock_items: :stock_location,
|
84
|
+
)
|
85
|
+
|
86
|
+
respond_to do |format|
|
87
|
+
format.html { render component('orders/cart/result').with_collection(@variants, order: @order), layout: false }
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def customers_for
|
92
|
+
load_order
|
93
|
+
|
94
|
+
@users = Spree.user_class
|
95
|
+
.where.not(id: @order.user_id)
|
7
96
|
.order(created_at: :desc, id: :desc)
|
8
97
|
.ransack(params[:q])
|
9
98
|
.result(distinct: true)
|
10
|
-
|
11
|
-
|
12
|
-
orders,
|
13
|
-
per_page: SolidusAdmin::Config[:orders_per_page]
|
14
|
-
)
|
99
|
+
.includes(:default_user_bill_address, :default_user_ship_address)
|
100
|
+
.limit(10)
|
15
101
|
|
16
102
|
respond_to do |format|
|
17
|
-
format.html { render component('orders/
|
103
|
+
format.html { render component('orders/show/customer_search/result').with_collection(@users, order: @order), layout: false }
|
18
104
|
end
|
19
105
|
end
|
106
|
+
|
107
|
+
private
|
108
|
+
|
109
|
+
def load_order
|
110
|
+
@order = Spree::Order.find_by!(number: params[:id])
|
111
|
+
authorize! action_name, @order
|
112
|
+
end
|
113
|
+
|
114
|
+
def order_params
|
115
|
+
params.require(:order).permit(:user_id, permitted_order_attributes)
|
116
|
+
end
|
20
117
|
end
|
21
118
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusAdmin
|
4
|
+
class PaymentMethodsController < SolidusAdmin::BaseController
|
5
|
+
include SolidusAdmin::ControllerHelpers::Search
|
6
|
+
|
7
|
+
before_action :load_payment_method, only: [:move]
|
8
|
+
|
9
|
+
search_scope(:all)
|
10
|
+
search_scope(:active, default: true, &:active)
|
11
|
+
search_scope(:inactive) { _1.where.not(active: true) }
|
12
|
+
search_scope(:storefront, &:available_to_users)
|
13
|
+
search_scope(:admin, &:available_to_admin)
|
14
|
+
|
15
|
+
def index
|
16
|
+
payment_methods = apply_search_to(
|
17
|
+
Spree::PaymentMethod.ordered_by_position,
|
18
|
+
param: :q,
|
19
|
+
)
|
20
|
+
|
21
|
+
set_page_and_extract_portion_from(payment_methods)
|
22
|
+
|
23
|
+
respond_to do |format|
|
24
|
+
format.html { render component('payment_methods/index').new(page: @page) }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def move
|
29
|
+
@payment_method.insert_at(params[:position].to_i)
|
30
|
+
|
31
|
+
respond_to do |format|
|
32
|
+
format.js { head :no_content }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def destroy
|
37
|
+
@payment_methods = Spree::PaymentMethod.where(id: params[:id])
|
38
|
+
|
39
|
+
Spree::PaymentMethod.transaction { @payment_methods.destroy_all }
|
40
|
+
|
41
|
+
flash[:notice] = t('.success')
|
42
|
+
redirect_back_or_to payment_methods_path, status: :see_other
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def load_payment_method
|
48
|
+
@payment_method = Spree::PaymentMethod.find_by!(id: params[:id])
|
49
|
+
authorize! action_name, @payment_method
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -2,12 +2,37 @@
|
|
2
2
|
|
3
3
|
module SolidusAdmin
|
4
4
|
class ProductsController < SolidusAdmin::BaseController
|
5
|
+
include SolidusAdmin::ControllerHelpers::Search
|
6
|
+
|
7
|
+
search_scope(:all, default: true)
|
8
|
+
search_scope(:deleted) { _1.with_discarded.discarded }
|
9
|
+
search_scope(:discontinued) { _1.where(discontinue_on: ...Time.current) }
|
10
|
+
search_scope(:available) { _1.available }
|
11
|
+
search_scope(:in_stock) { _1.where(id: Spree::Variant.in_stock.distinct.select(:product_id)) }
|
12
|
+
search_scope(:out_of_stock) { _1.where.not(id: Spree::Variant.in_stock.distinct.select(:product_id)) }
|
13
|
+
|
14
|
+
def index
|
15
|
+
products = apply_search_to(
|
16
|
+
Spree::Product.includes(:master, :variants),
|
17
|
+
param: :q,
|
18
|
+
)
|
19
|
+
|
20
|
+
set_page_and_extract_portion_from(
|
21
|
+
products,
|
22
|
+
ordered_by: { updated_at: :desc, id: :desc },
|
23
|
+
)
|
24
|
+
|
25
|
+
respond_to do |format|
|
26
|
+
format.html { render component('products/index').new(page: @page) }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
5
30
|
def edit
|
6
31
|
redirect_to action: :show
|
7
32
|
end
|
8
33
|
|
9
34
|
def show
|
10
|
-
@product = Spree::Product.friendly.find(params[:id])
|
35
|
+
@product = Spree::Product.with_discarded.friendly.find(params[:id])
|
11
36
|
|
12
37
|
respond_to do |format|
|
13
38
|
format.html { render component('products/show').new(product: @product) }
|
@@ -33,22 +58,6 @@ module SolidusAdmin
|
|
33
58
|
end
|
34
59
|
end
|
35
60
|
|
36
|
-
def index
|
37
|
-
products = Spree::Product
|
38
|
-
.order(created_at: :desc, id: :desc)
|
39
|
-
.ransack(params[:q])
|
40
|
-
.result(distinct: true)
|
41
|
-
|
42
|
-
set_page_and_extract_portion_from(
|
43
|
-
products,
|
44
|
-
per_page: SolidusAdmin::Config[:products_per_page]
|
45
|
-
)
|
46
|
-
|
47
|
-
respond_to do |format|
|
48
|
-
format.html { render component('products/index').new(page: @page) }
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
61
|
def destroy
|
53
62
|
@products = Spree::Product.where(id: params[:id])
|
54
63
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusAdmin
|
4
|
+
class PromotionCategoriesController < SolidusAdmin::BaseController
|
5
|
+
include SolidusAdmin::ControllerHelpers::Search
|
6
|
+
|
7
|
+
before_action :load_promotion_category, only: [:move]
|
8
|
+
|
9
|
+
def index
|
10
|
+
promotion_categories = apply_search_to(
|
11
|
+
Spree::PromotionCategory.all,
|
12
|
+
param: :q,
|
13
|
+
)
|
14
|
+
|
15
|
+
set_page_and_extract_portion_from(promotion_categories)
|
16
|
+
|
17
|
+
respond_to do |format|
|
18
|
+
format.html { render component('promotion_categories/index').new(page: @page) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def destroy
|
23
|
+
@promotion_categories = Spree::PromotionCategory.where(id: params[:id])
|
24
|
+
|
25
|
+
Spree::PromotionCategory.transaction { @promotion_categories.destroy_all }
|
26
|
+
|
27
|
+
flash[:notice] = t('.success')
|
28
|
+
redirect_back_or_to promotion_categories_path, status: :see_other
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def load_promotion_category
|
34
|
+
@promotion_category = Spree::PromotionCategory.find(params[:id])
|
35
|
+
authorize! action_name, @promotion_category
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusAdmin
|
4
|
+
class PromotionsController < SolidusAdmin::BaseController
|
5
|
+
include SolidusAdmin::ControllerHelpers::Search
|
6
|
+
|
7
|
+
search_scope(:active, default: true, &:active)
|
8
|
+
search_scope(:draft) { _1.where.not(id: _1.has_actions.select(:id)) }
|
9
|
+
search_scope(:future) { _1.has_actions.where(starts_at: Time.current..) }
|
10
|
+
search_scope(:expired) { _1.has_actions.where(expires_at: ..Time.current) }
|
11
|
+
search_scope(:all)
|
12
|
+
|
13
|
+
def index
|
14
|
+
promotions = apply_search_to(
|
15
|
+
Spree::Promotion.order(id: :desc),
|
16
|
+
param: :q,
|
17
|
+
)
|
18
|
+
|
19
|
+
set_page_and_extract_portion_from(promotions)
|
20
|
+
|
21
|
+
respond_to do |format|
|
22
|
+
format.html { render component('promotions/index').new(page: @page) }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def destroy
|
27
|
+
@promotions = Spree::Promotion.where(id: params[:id])
|
28
|
+
|
29
|
+
Spree::Promotion.transaction { @promotions.destroy_all }
|
30
|
+
|
31
|
+
flash[:notice] = t('.success')
|
32
|
+
redirect_back_or_to promotions_path, status: :see_other
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def load_promotion
|
38
|
+
@promotion = Spree::Promotion.find_by!(number: params[:id])
|
39
|
+
authorize! action_name, @promotion
|
40
|
+
end
|
41
|
+
|
42
|
+
def promotion_params
|
43
|
+
params.require(:promotion).permit(:user_id, permitted_promotion_attributes)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusAdmin
|
4
|
+
class PropertiesController < SolidusAdmin::BaseController
|
5
|
+
include SolidusAdmin::ControllerHelpers::Search
|
6
|
+
|
7
|
+
def index
|
8
|
+
properties = apply_search_to(
|
9
|
+
Spree::Property.order(created_at: :desc, id: :desc),
|
10
|
+
param: :q,
|
11
|
+
)
|
12
|
+
|
13
|
+
set_page_and_extract_portion_from(
|
14
|
+
properties,
|
15
|
+
)
|
16
|
+
|
17
|
+
respond_to do |format|
|
18
|
+
format.html { render component('properties/index').new(page: @page) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def destroy
|
23
|
+
@properties = Spree::Property.where(id: params[:id])
|
24
|
+
|
25
|
+
Spree::Property.transaction do
|
26
|
+
@properties.discard_all
|
27
|
+
end
|
28
|
+
|
29
|
+
flash[:notice] = t('.success')
|
30
|
+
redirect_to properties_path, status: :see_other
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusAdmin
|
4
|
+
class RefundReasonsController < SolidusAdmin::BaseController
|
5
|
+
include SolidusAdmin::ControllerHelpers::Search
|
6
|
+
|
7
|
+
def index
|
8
|
+
refund_reasons = apply_search_to(
|
9
|
+
Spree::RefundReason.unscoped.order(id: :desc),
|
10
|
+
param: :q,
|
11
|
+
)
|
12
|
+
|
13
|
+
set_page_and_extract_portion_from(refund_reasons)
|
14
|
+
|
15
|
+
respond_to do |format|
|
16
|
+
format.html { render component('refund_reasons/index').new(page: @page) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def destroy
|
21
|
+
@refund_reason = Spree::RefundReason.find_by!(id: params[:id])
|
22
|
+
|
23
|
+
Spree::RefundReason.transaction { @refund_reason.destroy }
|
24
|
+
|
25
|
+
flash[:notice] = t('.success')
|
26
|
+
redirect_back_or_to refund_reasons_path, status: :see_other
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def load_refund_reason
|
32
|
+
@refund_reason = Spree::RefundReason.find_by!(id: params[:id])
|
33
|
+
authorize! action_name, @refund_reason
|
34
|
+
end
|
35
|
+
|
36
|
+
def refund_reason_params
|
37
|
+
params.require(:refund_reason).permit(:refund_reason_id, permitted_refund_reason_attributes)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusAdmin
|
4
|
+
class ReimbursementTypesController < SolidusAdmin::BaseController
|
5
|
+
include SolidusAdmin::ControllerHelpers::Search
|
6
|
+
|
7
|
+
def index
|
8
|
+
reimbursement_types = apply_search_to(
|
9
|
+
Spree::ReimbursementType.unscoped.order(id: :desc),
|
10
|
+
param: :q,
|
11
|
+
)
|
12
|
+
|
13
|
+
set_page_and_extract_portion_from(reimbursement_types)
|
14
|
+
|
15
|
+
respond_to do |format|
|
16
|
+
format.html { render component('reimbursement_types/index').new(page: @page) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def load_reimbursement_type
|
23
|
+
@reimbursement_type = Spree::ReimbursementType.find_by!(id: params[:id])
|
24
|
+
authorize! action_name, @reimbursement_type
|
25
|
+
end
|
26
|
+
|
27
|
+
def reimbursement_type_params
|
28
|
+
params.require(:reimbursement_type).permit(:reimbursement_type_id, permitted_reimbursement_type_attributes)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusAdmin
|
4
|
+
class ReturnReasonsController < SolidusAdmin::BaseController
|
5
|
+
include SolidusAdmin::ControllerHelpers::Search
|
6
|
+
|
7
|
+
def index
|
8
|
+
return_reasons = apply_search_to(
|
9
|
+
Spree::ReturnReason.unscoped.order(id: :desc),
|
10
|
+
param: :q,
|
11
|
+
)
|
12
|
+
|
13
|
+
set_page_and_extract_portion_from(return_reasons)
|
14
|
+
|
15
|
+
respond_to do |format|
|
16
|
+
format.html { render component('return_reasons/index').new(page: @page) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def destroy
|
21
|
+
@return_reason = Spree::ReturnReason.find_by!(id: params[:id])
|
22
|
+
|
23
|
+
Spree::ReturnReason.transaction { @return_reason.destroy }
|
24
|
+
|
25
|
+
flash[:notice] = t('.success')
|
26
|
+
redirect_back_or_to return_reasons_path, status: :see_other
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def load_return_reason
|
32
|
+
@return_reason = Spree::ReturnReason.find_by!(id: params[:id])
|
33
|
+
authorize! action_name, @return_reason
|
34
|
+
end
|
35
|
+
|
36
|
+
def return_reason_params
|
37
|
+
params.require(:return_reason).permit(:return_reason_id, permitted_return_reason_attributes)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusAdmin
|
4
|
+
class ShippingCategoriesController < SolidusAdmin::BaseController
|
5
|
+
include SolidusAdmin::ControllerHelpers::Search
|
6
|
+
|
7
|
+
def index
|
8
|
+
shipping_categories = apply_search_to(
|
9
|
+
Spree::ShippingCategory.order(id: :desc),
|
10
|
+
param: :q,
|
11
|
+
)
|
12
|
+
|
13
|
+
set_page_and_extract_portion_from(shipping_categories)
|
14
|
+
|
15
|
+
respond_to do |format|
|
16
|
+
format.html { render component('shipping_categories/index').new(page: @page) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def destroy
|
21
|
+
@shipping_category = Spree::ShippingCategory.find_by!(id: params[:id])
|
22
|
+
|
23
|
+
Spree::ShippingCategory.transaction { @shipping_category.destroy }
|
24
|
+
|
25
|
+
flash[:notice] = t('.success')
|
26
|
+
redirect_back_or_to shipping_categories_path, status: :see_other
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def load_shipping_category
|
32
|
+
@shipping_category = Spree::ShippingCategory.find_by!(id: params[:id])
|
33
|
+
authorize! action_name, @shipping_category
|
34
|
+
end
|
35
|
+
|
36
|
+
def shipping_category_params
|
37
|
+
params.require(:shipping_category).permit(:shipping_category_id, permitted_shipping_category_attributes)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusAdmin
|
4
|
+
class ShippingMethodsController < SolidusAdmin::BaseController
|
5
|
+
include SolidusAdmin::ControllerHelpers::Search
|
6
|
+
|
7
|
+
def index
|
8
|
+
shipping_methods = apply_search_to(
|
9
|
+
Spree::ShippingMethod.order(id: :desc),
|
10
|
+
param: :q,
|
11
|
+
)
|
12
|
+
|
13
|
+
set_page_and_extract_portion_from(shipping_methods)
|
14
|
+
|
15
|
+
respond_to do |format|
|
16
|
+
format.html { render component('shipping_methods/index').new(page: @page) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def destroy
|
21
|
+
@shipping_methods = Spree::ShippingMethod.where(id: params[:id])
|
22
|
+
|
23
|
+
Spree::ShippingMethod.transaction { @shipping_methods.destroy_all }
|
24
|
+
|
25
|
+
flash[:notice] = t('.success')
|
26
|
+
redirect_back_or_to shipping_methods_path, status: :see_other
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def load_shipping_method
|
32
|
+
@shipping_method = Spree::ShippingMethod.find_by!(number: params[:id])
|
33
|
+
authorize! action_name, @shipping_method
|
34
|
+
end
|
35
|
+
|
36
|
+
def shipping_method_params
|
37
|
+
params.require(:shipping_method).permit(:shipping_method_id, permitted_shipping_method_attributes)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusAdmin
|
4
|
+
class StockItemsController < SolidusAdmin::BaseController
|
5
|
+
include SolidusAdmin::ControllerHelpers::Search
|
6
|
+
before_action :load_stock_items, only: [:index, :edit, :update]
|
7
|
+
before_action :load_stock_item, only: [:edit, :update]
|
8
|
+
|
9
|
+
search_scope(:all, default: true) { _1 }
|
10
|
+
search_scope(:back_orderable) { _1.where(backorderable: true) }
|
11
|
+
search_scope(:out_of_stock) { _1.where('count_on_hand <= 0') }
|
12
|
+
search_scope(:low_stock) { _1.where('count_on_hand > 0 AND count_on_hand < ?', SolidusAdmin::Config[:low_stock_value]) }
|
13
|
+
search_scope(:in_stock) { _1.where('count_on_hand > 0') }
|
14
|
+
|
15
|
+
def index
|
16
|
+
respond_to do |format|
|
17
|
+
format.html { render component('stock_items/index').new(page: @page) }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def edit
|
22
|
+
respond_to do |format|
|
23
|
+
format.html { render component('stock_items/edit').new(stock_item: @stock_item, page: @page) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def update
|
28
|
+
quantity_adjustment = params[:quantity_adjustment].to_i
|
29
|
+
@stock_item.assign_attributes(stock_item_params.except(:page, :q))
|
30
|
+
@stock_item.stock_movements.build(quantity: quantity_adjustment, originator: current_solidus_admin_user)
|
31
|
+
|
32
|
+
if @stock_item.save
|
33
|
+
redirect_to solidus_admin.stock_items_path(
|
34
|
+
page: stock_item_params[:page].to_i.presence,
|
35
|
+
q: stock_item_params[:q].presence&.then { |q| JSON.parse(q) }
|
36
|
+
), status: :see_other
|
37
|
+
else
|
38
|
+
respond_to do |format|
|
39
|
+
format.html { render component('stock_items/edit').new(stock_item: @stock_item, page: @page), status: :unprocessable_entity }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def load_stock_items
|
47
|
+
@stock_items = apply_search_to(
|
48
|
+
Spree::StockItem.reorder(nil),
|
49
|
+
param: :q,
|
50
|
+
)
|
51
|
+
|
52
|
+
set_page_and_extract_portion_from(@stock_items, ordered_by: {
|
53
|
+
variant_id: :desc,
|
54
|
+
stock_location_id: :desc,
|
55
|
+
id: :desc,
|
56
|
+
})
|
57
|
+
end
|
58
|
+
|
59
|
+
def load_stock_item
|
60
|
+
@stock_item = Spree::StockItem.find(params[:id])
|
61
|
+
end
|
62
|
+
|
63
|
+
def stock_item_params
|
64
|
+
params.require(:stock_item).permit(:backorderable, :page, :q)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidusAdmin
|
4
|
+
class StockLocationsController < SolidusAdmin::BaseController
|
5
|
+
include SolidusAdmin::ControllerHelpers::Search
|
6
|
+
|
7
|
+
def index
|
8
|
+
stock_locations = apply_search_to(
|
9
|
+
Spree::StockLocation.order(id: :desc),
|
10
|
+
param: :q,
|
11
|
+
)
|
12
|
+
|
13
|
+
set_page_and_extract_portion_from(stock_locations)
|
14
|
+
|
15
|
+
respond_to do |format|
|
16
|
+
format.html { render component('stock_locations/index').new(page: @page) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def destroy
|
21
|
+
@stock_locations = Spree::StockLocation.where(id: params[:id])
|
22
|
+
|
23
|
+
Spree::StockLocation.transaction { @stock_locations.destroy_all }
|
24
|
+
|
25
|
+
flash[:notice] = t('.success')
|
26
|
+
redirect_back_or_to stock_locations_path, status: :see_other
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def load_stock_location
|
32
|
+
@stock_location = Spree::StockLocation.find_by!(number: params[:id])
|
33
|
+
authorize! action_name, @stock_location
|
34
|
+
end
|
35
|
+
|
36
|
+
def stock_location_params
|
37
|
+
params.require(:stock_location).permit(:stock_location_id, permitted_stock_location_attributes)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|