solidus_admin 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.prettierrc +4 -0
- data/app/assets/builds/solidus_admin/tailwind.css +13 -1
- data/app/components/solidus_admin/adjustment_reasons/edit/component.html.erb +2 -3
- data/app/components/solidus_admin/adjustment_reasons/edit/component.rb +1 -9
- data/app/components/solidus_admin/adjustment_reasons/index/component.rb +22 -8
- data/app/components/solidus_admin/adjustment_reasons/new/component.html.erb +2 -4
- data/app/components/solidus_admin/adjustment_reasons/new/component.rb +1 -9
- data/app/components/solidus_admin/base_component.rb +2 -18
- data/app/components/solidus_admin/layout/navigation/component.js +1 -1
- data/app/components/solidus_admin/orders/index/component.rb +2 -2
- data/app/components/solidus_admin/orders/show/address/component.js +2 -2
- data/app/components/solidus_admin/orders/show/component.js +2 -2
- data/app/components/solidus_admin/orders/show/customer_search/component.js +5 -4
- data/app/components/solidus_admin/orders/show/summary/component.html.erb +6 -6
- data/app/components/solidus_admin/products/show/component.html.erb +7 -1
- data/app/components/solidus_admin/products/show/component.rb +6 -0
- data/app/components/solidus_admin/properties/edit/component.html.erb +16 -0
- data/app/components/solidus_admin/properties/edit/component.rb +4 -0
- data/app/components/solidus_admin/properties/edit/component.yml +4 -0
- data/app/components/solidus_admin/properties/index/component.rb +19 -6
- data/app/components/solidus_admin/properties/new/component.html.erb +16 -0
- data/app/components/solidus_admin/properties/new/component.rb +4 -0
- data/app/components/solidus_admin/properties/new/component.yml +4 -0
- data/app/components/solidus_admin/refund_reasons/edit/component.html.erb +2 -3
- data/app/components/solidus_admin/refund_reasons/edit/component.rb +1 -9
- data/app/components/solidus_admin/refund_reasons/index/component.rb +22 -8
- data/app/components/solidus_admin/refund_reasons/new/component.html.erb +2 -4
- data/app/components/solidus_admin/refund_reasons/new/component.rb +1 -9
- data/app/components/solidus_admin/resources/base_component.rb +20 -0
- data/app/components/solidus_admin/resources/edit/component.rb +11 -0
- data/app/components/solidus_admin/resources/new/component.rb +11 -0
- data/app/components/solidus_admin/return_reasons/edit/component.html.erb +2 -3
- data/app/components/solidus_admin/return_reasons/edit/component.rb +1 -9
- data/app/components/solidus_admin/return_reasons/index/component.rb +13 -7
- data/app/components/solidus_admin/return_reasons/new/component.html.erb +2 -4
- data/app/components/solidus_admin/return_reasons/new/component.rb +1 -9
- data/app/components/solidus_admin/roles/edit/component.html.erb +2 -4
- data/app/components/solidus_admin/roles/edit/component.rb +1 -10
- data/app/components/solidus_admin/roles/index/component.rb +16 -8
- data/app/components/solidus_admin/roles/new/component.html.erb +2 -4
- data/app/components/solidus_admin/roles/new/component.rb +1 -10
- data/app/components/solidus_admin/shipping_categories/edit/component.html.erb +2 -3
- data/app/components/solidus_admin/shipping_categories/edit/component.rb +1 -9
- data/app/components/solidus_admin/shipping_categories/index/component.rb +14 -17
- data/app/components/solidus_admin/shipping_categories/new/component.html.erb +2 -4
- data/app/components/solidus_admin/shipping_categories/new/component.rb +1 -9
- data/app/components/solidus_admin/stock_items/edit/component.html.erb +74 -73
- data/app/components/solidus_admin/stock_items/edit/component.js +4 -3
- data/app/components/solidus_admin/stock_items/edit/component.rb +1 -10
- data/app/components/solidus_admin/stock_items/index/component.rb +9 -5
- data/app/components/solidus_admin/store_credit_reasons/edit/component.html.erb +2 -3
- data/app/components/solidus_admin/store_credit_reasons/edit/component.rb +1 -9
- data/app/components/solidus_admin/store_credit_reasons/index/component.rb +14 -7
- data/app/components/solidus_admin/store_credit_reasons/new/component.html.erb +2 -4
- data/app/components/solidus_admin/store_credit_reasons/new/component.rb +1 -9
- data/app/components/solidus_admin/tax_categories/edit/component.html.erb +2 -4
- data/app/components/solidus_admin/tax_categories/edit/component.rb +1 -9
- data/app/components/solidus_admin/tax_categories/index/component.rb +30 -9
- data/app/components/solidus_admin/tax_categories/new/component.html.erb +2 -4
- data/app/components/solidus_admin/tax_categories/new/component.rb +1 -9
- data/app/components/solidus_admin/ui/dropdown/component.js +3 -3
- data/app/components/solidus_admin/ui/forms/address/component.js +5 -6
- data/app/components/solidus_admin/ui/forms/field/component.rb +1 -1
- data/app/components/solidus_admin/ui/forms/input/component.js +3 -4
- data/app/components/solidus_admin/ui/forms/input/component.rb +15 -4
- data/app/components/solidus_admin/ui/modal/component.js +2 -2
- data/app/components/solidus_admin/ui/pages/index/component.html.erb +3 -3
- data/app/components/solidus_admin/ui/pages/index/component.rb +6 -1
- data/app/components/solidus_admin/ui/table/component.html.erb +4 -3
- data/app/components/solidus_admin/ui/table/component.js +13 -17
- data/app/components/solidus_admin/ui/table/ransack_filter/component.js +18 -16
- data/app/components/solidus_admin/ui/toast/component.js +3 -3
- data/app/components/solidus_admin/ui/toggletip/component.js +14 -12
- data/app/components/solidus_admin/users/orders/component.rb +1 -1
- data/app/components/solidus_admin/users/store_credits/edit_amount/component.html.erb +22 -0
- data/app/components/solidus_admin/users/store_credits/edit_amount/component.rb +22 -0
- data/app/components/solidus_admin/users/store_credits/edit_amount/component.yml +5 -0
- data/app/components/solidus_admin/users/store_credits/edit_memo/component.html.erb +15 -0
- data/app/components/solidus_admin/users/store_credits/edit_memo/component.rb +16 -0
- data/app/components/solidus_admin/users/store_credits/edit_memo/component.yml +4 -0
- data/app/components/solidus_admin/users/store_credits/edit_validity/component.html.erb +21 -0
- data/app/components/solidus_admin/users/store_credits/edit_validity/component.rb +22 -0
- data/app/components/solidus_admin/users/store_credits/edit_validity/component.yml +5 -0
- data/app/components/solidus_admin/users/store_credits/index/component.html.erb +27 -11
- data/app/components/solidus_admin/users/store_credits/index/component.rb +18 -10
- data/app/components/solidus_admin/users/store_credits/new/component.html.erb +30 -0
- data/app/components/solidus_admin/users/store_credits/new/component.rb +22 -0
- data/app/components/solidus_admin/users/store_credits/new/component.yml +5 -0
- data/app/components/solidus_admin/users/store_credits/show/component.html.erb +83 -0
- data/app/components/solidus_admin/users/store_credits/show/component.rb +120 -0
- data/app/components/solidus_admin/users/store_credits/show/component.yml +18 -0
- data/app/controllers/solidus_admin/adjustment_reasons_controller.rb +3 -105
- data/app/controllers/solidus_admin/authentication_adapters/backend.rb +1 -1
- data/app/controllers/solidus_admin/base_controller.rb +12 -1
- data/app/controllers/solidus_admin/properties_controller.rb +6 -24
- data/app/controllers/solidus_admin/refund_reasons_controller.rb +5 -105
- data/app/controllers/solidus_admin/resources_controller.rb +152 -0
- data/app/controllers/solidus_admin/return_reasons_controller.rb +4 -104
- data/app/controllers/solidus_admin/roles_controller.rb +3 -105
- data/app/controllers/solidus_admin/shipping_categories_controller.rb +3 -107
- data/app/controllers/solidus_admin/stock_items_controller.rb +12 -29
- data/app/controllers/solidus_admin/store_credit_reasons_controller.rb +5 -105
- data/app/controllers/solidus_admin/store_credits_controller.rb +231 -0
- data/app/controllers/solidus_admin/tax_categories_controller.rb +3 -109
- data/app/controllers/solidus_admin/users_controller.rb +1 -9
- data/app/helpers/solidus_admin/void_elements_helper.rb +13 -0
- data/app/views/layouts/solidus_admin/application.html.erb +3 -0
- data/config/locales/menu_item.en.yml +0 -1
- data/config/locales/properties.en.yml +4 -0
- data/config/locales/store_credits.en.yml +16 -0
- data/config/routes.rb +12 -2
- data/lib/solidus_admin/configuration.rb +0 -5
- data/lib/solidus_admin/engine.rb +6 -0
- data/lib/solidus_admin/install_tailwindcss.rb +1 -1
- data/lib/solidus_admin/testing_support/component_helpers.rb +3 -9
- data/lib/solidus_admin/testing_support/shared_examples/bulk_delete_resources.rb +20 -0
- data/lib/solidus_admin/testing_support/shared_examples/crud_resource_requests.rb +138 -0
- data/lib/solidus_admin/testing_support/shared_examples/promotion_categories_features.rb +72 -0
- data/lib/solidus_admin/version.rb +1 -1
- metadata +35 -6
@@ -1,12 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::ReturnReasons::Edit::Component < SolidusAdmin::
|
4
|
-
def initialize(page:, return_reason:)
|
5
|
-
@page = page
|
6
|
-
@return_reason = return_reason
|
7
|
-
end
|
8
|
-
|
9
|
-
def form_id
|
10
|
-
dom_id(@return_reason, "#{stimulus_id}_edit_return_reason_form")
|
11
|
-
end
|
3
|
+
class SolidusAdmin::ReturnReasons::Edit::Component < SolidusAdmin::Resources::Edit::Component
|
12
4
|
end
|
@@ -13,14 +13,13 @@ class SolidusAdmin::ReturnReasons::Index::Component < SolidusAdmin::RefundsAndRe
|
|
13
13
|
:name_cont
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
spree.edit_admin_return_reason_path(return_reason,
|
16
|
+
def edit_path(return_reason)
|
17
|
+
spree.edit_admin_return_reason_path(return_reason, **search_filter_params)
|
18
18
|
end
|
19
19
|
|
20
20
|
def turbo_frames
|
21
21
|
%w[
|
22
|
-
|
23
|
-
edit_return_reason_modal
|
22
|
+
resource_modal
|
24
23
|
]
|
25
24
|
end
|
26
25
|
|
@@ -28,8 +27,8 @@ class SolidusAdmin::ReturnReasons::Index::Component < SolidusAdmin::RefundsAndRe
|
|
28
27
|
render component("ui/button").new(
|
29
28
|
tag: :a,
|
30
29
|
text: t('.add'),
|
31
|
-
href: solidus_admin.new_return_reason_path,
|
32
|
-
data: { turbo_frame: :
|
30
|
+
href: solidus_admin.new_return_reason_path(**search_filter_params),
|
31
|
+
data: { turbo_frame: :resource_modal },
|
33
32
|
icon: "add-line",
|
34
33
|
class: "align-self-end w-full",
|
35
34
|
)
|
@@ -48,7 +47,14 @@ class SolidusAdmin::ReturnReasons::Index::Component < SolidusAdmin::RefundsAndRe
|
|
48
47
|
|
49
48
|
def columns
|
50
49
|
[
|
51
|
-
|
50
|
+
{
|
51
|
+
header: :name,
|
52
|
+
data: ->(return_reason) do
|
53
|
+
link_to return_reason.name, edit_path(return_reason),
|
54
|
+
data: { turbo_frame: :resource_modal },
|
55
|
+
class: 'body-link'
|
56
|
+
end
|
57
|
+
},
|
52
58
|
{
|
53
59
|
header: :active,
|
54
60
|
data: ->(return_reason) do
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= turbo_frame_tag :
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
2
|
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
-
<%= form_for @return_reason, url:
|
3
|
+
<%= form_for @return_reason, url: form_url, html: { id: form_id } do |f| %>
|
4
4
|
<div class="flex flex-col gap-6 pb-4">
|
5
5
|
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
6
6
|
<label class="flex gap-2 items-center">
|
@@ -23,5 +23,3 @@
|
|
23
23
|
<% end %>
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
|
-
|
27
|
-
<%= render component("return_reasons/index").new(page: @page) %>
|
@@ -1,12 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::ReturnReasons::New::Component < SolidusAdmin::
|
4
|
-
def initialize(page:, return_reason:)
|
5
|
-
@page = page
|
6
|
-
@return_reason = return_reason
|
7
|
-
end
|
8
|
-
|
9
|
-
def form_id
|
10
|
-
dom_id(@return_reason, "#{stimulus_id}_new_return_reason_form")
|
11
|
-
end
|
3
|
+
class SolidusAdmin::ReturnReasons::New::Component < SolidusAdmin::Resources::New::Component
|
12
4
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= turbo_frame_tag :
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
2
|
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
-
<%= form_for @role, url:
|
3
|
+
<%= form_for @role, url: form_url, html: { id: form_id } do |f| %>
|
4
4
|
<div class="flex flex-col gap-6 pb-4">
|
5
5
|
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
6
6
|
<%= render component("ui/forms/field").text_field(f, :description) %>
|
@@ -29,5 +29,3 @@
|
|
29
29
|
<% end %>
|
30
30
|
<% end %>
|
31
31
|
<% end %>
|
32
|
-
|
33
|
-
<%= render component("roles/index").new(page: @page) %>
|
@@ -1,17 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::Roles::Edit::Component < SolidusAdmin::
|
3
|
+
class SolidusAdmin::Roles::Edit::Component < SolidusAdmin::Resources::Edit::Component
|
4
4
|
include SolidusAdmin::PermissionSetsHelper
|
5
5
|
|
6
|
-
def initialize(page:, role:)
|
7
|
-
@page = page
|
8
|
-
@role = role
|
9
|
-
end
|
10
|
-
|
11
|
-
def form_id
|
12
|
-
dom_id(@role, "#{stimulus_id}_edit_role_form")
|
13
|
-
end
|
14
|
-
|
15
6
|
private
|
16
7
|
|
17
8
|
def permission_set_options
|
@@ -13,23 +13,23 @@ class SolidusAdmin::Roles::Index::Component < SolidusAdmin::UsersAndRoles::Compo
|
|
13
13
|
solidus_admin.roles_path
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
solidus_admin.edit_role_path(role,
|
16
|
+
def edit_path(role)
|
17
|
+
solidus_admin.edit_role_path(role, **search_filter_params)
|
18
18
|
end
|
19
19
|
|
20
20
|
def page_actions
|
21
21
|
render component("ui/button").new(
|
22
22
|
tag: :a,
|
23
23
|
text: t('.add'),
|
24
|
-
href: solidus_admin.new_role_path,
|
24
|
+
href: solidus_admin.new_role_path(**search_filter_params),
|
25
|
+
data: { turbo_frame: :resource_modal },
|
25
26
|
icon: "add-line",
|
26
27
|
)
|
27
28
|
end
|
28
29
|
|
29
30
|
def turbo_frames
|
30
31
|
%w[
|
31
|
-
|
32
|
-
edit_role_modal
|
32
|
+
resource_modal
|
33
33
|
]
|
34
34
|
end
|
35
35
|
|
@@ -37,7 +37,7 @@ class SolidusAdmin::Roles::Index::Component < SolidusAdmin::UsersAndRoles::Compo
|
|
37
37
|
[
|
38
38
|
{
|
39
39
|
label: t('.batch_actions.delete'),
|
40
|
-
action: solidus_admin.roles_path,
|
40
|
+
action: solidus_admin.roles_path(**search_filter_params),
|
41
41
|
method: :delete,
|
42
42
|
icon: 'delete-bin-7-line',
|
43
43
|
},
|
@@ -59,11 +59,19 @@ class SolidusAdmin::Roles::Index::Component < SolidusAdmin::UsersAndRoles::Compo
|
|
59
59
|
[
|
60
60
|
{
|
61
61
|
header: :role,
|
62
|
-
data:
|
62
|
+
data: ->(role) do
|
63
|
+
link_to role.name, edit_path(role),
|
64
|
+
data: { turbo_frame: :resource_modal },
|
65
|
+
class: "body-link"
|
66
|
+
end,
|
63
67
|
},
|
64
68
|
{
|
65
69
|
header: :description,
|
66
|
-
data:
|
70
|
+
data: ->(role) do
|
71
|
+
link_to_if role.description, role.description, edit_path(role),
|
72
|
+
data: { turbo_frame: :resource_modal },
|
73
|
+
class: "body-link"
|
74
|
+
end
|
67
75
|
}
|
68
76
|
]
|
69
77
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= turbo_frame_tag :
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
2
|
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
-
<%= form_for @role, url:
|
3
|
+
<%= form_for @role, url: form_url, html: { id: form_id } do |f| %>
|
4
4
|
<div class="flex flex-col gap-6 pb-4">
|
5
5
|
<%= render component("ui/forms/field").text_field(f, :name, class: "required", placeholder: t(".name_placeholder")) %>
|
6
6
|
<%= render component("ui/forms/field").text_field(f, :description, placeholder: t(".description_placeholder")) %>
|
@@ -29,5 +29,3 @@
|
|
29
29
|
<% end %>
|
30
30
|
<% end %>
|
31
31
|
<% end %>
|
32
|
-
|
33
|
-
<%= render component("roles/index").new(page: @page) %>
|
@@ -1,17 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::Roles::New::Component < SolidusAdmin::
|
3
|
+
class SolidusAdmin::Roles::New::Component < SolidusAdmin::Resources::New::Component
|
4
4
|
include SolidusAdmin::PermissionSetsHelper
|
5
5
|
|
6
|
-
def initialize(page:, role:)
|
7
|
-
@page = page
|
8
|
-
@role = role
|
9
|
-
end
|
10
|
-
|
11
|
-
def form_id
|
12
|
-
dom_id(@role, "#{stimulus_id}_new_role_form")
|
13
|
-
end
|
14
|
-
|
15
6
|
private
|
16
7
|
|
17
8
|
def permission_set_options
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= turbo_frame_tag :
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
2
|
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
-
<%= form_for @shipping_category, url:
|
3
|
+
<%= form_for @shipping_category, url: form_url, html: { id: form_id } do |f| %>
|
4
4
|
<div class="flex flex-col gap-6 pb-4">
|
5
5
|
<%= render component("ui/forms/field").text_field(f, :name) %>
|
6
6
|
</div>
|
@@ -13,4 +13,3 @@
|
|
13
13
|
<% end %>
|
14
14
|
<% end %>
|
15
15
|
<% end %>
|
16
|
-
<%= render component("shipping_categories/index").new(page: @page) %>
|
@@ -1,12 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::ShippingCategories::Edit::Component < SolidusAdmin::
|
4
|
-
def initialize(page:, shipping_category:)
|
5
|
-
@page = page
|
6
|
-
@shipping_category = shipping_category
|
7
|
-
end
|
8
|
-
|
9
|
-
def form_id
|
10
|
-
dom_id(@shipping_category, "#{stimulus_id}_edit_shipping_category_form")
|
11
|
-
end
|
3
|
+
class SolidusAdmin::ShippingCategories::Edit::Component < SolidusAdmin::Resources::Edit::Component
|
12
4
|
end
|
@@ -5,21 +5,12 @@ class SolidusAdmin::ShippingCategories::Index::Component < SolidusAdmin::Shippin
|
|
5
5
|
Spree::ShippingCategory
|
6
6
|
end
|
7
7
|
|
8
|
-
def actions
|
9
|
-
render component("ui/button").new(
|
10
|
-
tag: :a,
|
11
|
-
text: t('.add'),
|
12
|
-
href: spree.new_admin_shipping_category_path,
|
13
|
-
icon: "add-line",
|
14
|
-
class: "align-self-end w-full",
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
8
|
def page_actions
|
19
9
|
render component("ui/button").new(
|
20
10
|
tag: :a,
|
21
11
|
text: t('.add'),
|
22
|
-
href: solidus_admin.new_shipping_category_path,
|
12
|
+
href: solidus_admin.new_shipping_category_path(**search_filter_params),
|
13
|
+
data: { turbo_frame: :resource_modal },
|
23
14
|
icon: "add-line",
|
24
15
|
class: "align-self-end w-full",
|
25
16
|
)
|
@@ -27,13 +18,12 @@ class SolidusAdmin::ShippingCategories::Index::Component < SolidusAdmin::Shippin
|
|
27
18
|
|
28
19
|
def turbo_frames
|
29
20
|
%w[
|
30
|
-
|
31
|
-
edit_shipping_category_modal
|
21
|
+
resource_modal
|
32
22
|
]
|
33
23
|
end
|
34
24
|
|
35
|
-
def
|
36
|
-
spree.edit_admin_shipping_category_path(shipping_category,
|
25
|
+
def edit_url(shipping_category)
|
26
|
+
spree.edit_admin_shipping_category_path(shipping_category, **search_filter_params)
|
37
27
|
end
|
38
28
|
|
39
29
|
def search_key
|
@@ -48,7 +38,7 @@ class SolidusAdmin::ShippingCategories::Index::Component < SolidusAdmin::Shippin
|
|
48
38
|
[
|
49
39
|
{
|
50
40
|
label: t('.batch_actions.delete'),
|
51
|
-
action: solidus_admin.shipping_categories_path,
|
41
|
+
action: solidus_admin.shipping_categories_path(**search_filter_params),
|
52
42
|
method: :delete,
|
53
43
|
icon: 'delete-bin-7-line',
|
54
44
|
},
|
@@ -57,7 +47,14 @@ class SolidusAdmin::ShippingCategories::Index::Component < SolidusAdmin::Shippin
|
|
57
47
|
|
58
48
|
def columns
|
59
49
|
[
|
60
|
-
|
50
|
+
{
|
51
|
+
header: :name,
|
52
|
+
data: ->(shipping_category) do
|
53
|
+
link_to shipping_category.name, edit_url(shipping_category),
|
54
|
+
data: { turbo_frame: :resource_modal },
|
55
|
+
class: "body-link"
|
56
|
+
end
|
57
|
+
},
|
61
58
|
]
|
62
59
|
end
|
63
60
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= turbo_frame_tag :
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
2
|
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
-
<%= form_for @shipping_category, url:
|
3
|
+
<%= form_for @shipping_category, url: form_url, html: { id: form_id } do |f| %>
|
4
4
|
<div class="flex flex-col gap-6 pb-4">
|
5
5
|
<%= render component("ui/forms/field").text_field(f, :name) %>
|
6
6
|
</div>
|
@@ -13,5 +13,3 @@
|
|
13
13
|
<% end %>
|
14
14
|
<% end %>
|
15
15
|
<% end %>
|
16
|
-
|
17
|
-
<%= render component("shipping_categories/index").new(page: @page) %>
|
@@ -1,12 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::ShippingCategories::New::Component < SolidusAdmin::
|
4
|
-
def initialize(page:, shipping_category:)
|
5
|
-
@page = page
|
6
|
-
@shipping_category = shipping_category
|
7
|
-
end
|
8
|
-
|
9
|
-
def form_id
|
10
|
-
dom_id(@shipping_category, "#{stimulus_id}_new_shipping_category_form")
|
11
|
-
end
|
3
|
+
class SolidusAdmin::ShippingCategories::New::Component < SolidusAdmin::Resources::New::Component
|
12
4
|
end
|
@@ -1,83 +1,84 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
<%= render component("ui/forms/field").text_field(
|
35
|
-
f,
|
36
|
-
:count_on_hand,
|
37
|
-
disabled: true,
|
38
|
-
value: @stock_item.count_on_hand_was || @stock_item.count_on_hand,
|
39
|
-
"data-#{stimulus_id}-target": 'countOnHand',
|
40
|
-
) %>
|
41
|
-
<%= render component("ui/forms/field").new(
|
42
|
-
label: t(".quantity_adjustment"),
|
43
|
-
hint: t(".quantity_adjustment_hint_html"),
|
44
|
-
) do %>
|
45
|
-
<%= render component("ui/forms/input").new(
|
46
|
-
value: params[:quantity_adjustment] || 0,
|
47
|
-
name: :quantity_adjustment,
|
48
|
-
type: :number,
|
49
|
-
step: 1,
|
50
|
-
"data-#{stimulus_id}-target": 'quantityAdjustment',
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
|
+
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
+
<%= form_for @stock_item, url: form_url, html: { id: form_id } do |f| %>
|
4
|
+
<div
|
5
|
+
class="flex flex-col gap-6 pb-4"
|
6
|
+
data-controller="<%= stimulus_id %>"
|
7
|
+
data-<%= stimulus_id %>-initial-count-on-hand-value="<%= @stock_item.count_on_hand_was || @stock_item.count_on_hand %>"
|
8
|
+
data-action="input-><%= stimulus_id %>#updateCountOnHand"
|
9
|
+
>
|
10
|
+
<div class="flex gap-4">
|
11
|
+
<%= link_to spree.edit_admin_product_variant_path(
|
12
|
+
@stock_item.variant.product,
|
13
|
+
@stock_item.variant,
|
14
|
+
),
|
15
|
+
data: {turbo_frame: "_top"},
|
16
|
+
class: 'hover:bg-gray-25 rounded p-1 w-1/2 border border-gray-100' do %>
|
17
|
+
<%= render component("ui/resource_item").new(
|
18
|
+
thumbnail:
|
19
|
+
(
|
20
|
+
@stock_item.variant.images.first ||
|
21
|
+
@stock_item.variant.product.gallery.images.first
|
22
|
+
)&.url(:small),
|
23
|
+
title: @stock_item.variant.name,
|
24
|
+
subtitle:
|
25
|
+
"#{@stock_item.variant.sku}#{@stock_item.variant.options_text.presence&.prepend(" - ")}",
|
26
|
+
) %>
|
27
|
+
<% end %>
|
28
|
+
<%= link_to spree.edit_admin_stock_location_path(@stock_item.stock_location),
|
29
|
+
data: {turbo_frame: "_top"},
|
30
|
+
class: 'hover:bg-gray-25 rounded p-1 w-1/2 border border-gray-100' do %>
|
31
|
+
<%= render component("ui/resource_item").new(
|
32
|
+
title: @stock_item.stock_location.name,
|
33
|
+
subtitle: "#{Spree::StockLocation.model_name.human} #{@stock_item.stock_location.code}",
|
51
34
|
) %>
|
52
35
|
<% end %>
|
53
|
-
|
54
|
-
<%= render component("ui/forms/switch_field").new(
|
55
|
-
name: "#{f.object_name}[backorderable]",
|
56
|
-
label: Spree::StockItem.human_attribute_name(:backorderable),
|
57
|
-
error: f.object.errors[:backorderable],
|
58
|
-
hint: t(".backorderable_hint_html"),
|
59
|
-
checked: f.object.backorderable?,
|
60
|
-
include_hidden: true,
|
61
|
-
) %>
|
62
36
|
</div>
|
63
|
-
<% end %>
|
64
37
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
38
|
+
<%= render component("ui/forms/field").text_field(
|
39
|
+
f,
|
40
|
+
:count_on_hand,
|
41
|
+
readonly: true,
|
42
|
+
value: @stock_item.count_on_hand_was || @stock_item.count_on_hand,
|
43
|
+
"data-#{stimulus_id}-target": 'countOnHand',
|
44
|
+
) %>
|
45
|
+
<%= render component("ui/forms/field").new(
|
46
|
+
label: t(".quantity_adjustment"),
|
47
|
+
hint: t(".quantity_adjustment_hint_html"),
|
48
|
+
) do %>
|
49
|
+
<%= render component("ui/forms/input").new(
|
50
|
+
value: params[:quantity_adjustment] || 0,
|
51
|
+
name: :quantity_adjustment,
|
52
|
+
type: :number,
|
53
|
+
step: 1,
|
54
|
+
"data-#{stimulus_id}-target": 'quantityAdjustment',
|
70
55
|
) %>
|
71
|
-
|
56
|
+
<% end %>
|
57
|
+
|
58
|
+
<%= render component("ui/forms/switch_field").new(
|
59
|
+
name: "#{f.object_name}[backorderable]",
|
60
|
+
label: Spree::StockItem.human_attribute_name(:backorderable),
|
61
|
+
error: f.object.errors[:backorderable],
|
62
|
+
hint: t(".backorderable_hint_html"),
|
63
|
+
checked: f.object.backorderable?,
|
64
|
+
include_hidden: true,
|
65
|
+
) %>
|
66
|
+
</div>
|
67
|
+
<% end %>
|
72
68
|
|
69
|
+
<% modal.with_actions do %>
|
70
|
+
<form method="dialog">
|
73
71
|
<%= render component("ui/button").new(
|
74
|
-
|
75
|
-
text: t(".
|
76
|
-
form: form_id,
|
72
|
+
scheme: :secondary,
|
73
|
+
text: t(".cancel"),
|
77
74
|
) %>
|
78
|
-
|
75
|
+
</form>
|
76
|
+
|
77
|
+
<%= render component("ui/button").new(
|
78
|
+
tag: :button,
|
79
|
+
text: t(".submit"),
|
80
|
+
form: form_id,
|
81
|
+
) %>
|
79
82
|
<% end %>
|
80
83
|
<% end %>
|
81
|
-
|
82
|
-
<%= render component("stock_items/index").new(page: @page) %>
|
83
|
-
</div>
|
84
|
+
<% end %>
|
@@ -1,17 +1,18 @@
|
|
1
|
-
import { Controller } from
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
4
|
static values = {
|
5
5
|
initialCountOnHand: Number,
|
6
6
|
}
|
7
7
|
|
8
|
-
static targets = [
|
8
|
+
static targets = ["countOnHand", "quantityAdjustment"]
|
9
9
|
|
10
10
|
connect() {
|
11
11
|
this.updateCountOnHand()
|
12
12
|
}
|
13
13
|
|
14
14
|
updateCountOnHand() {
|
15
|
-
this.countOnHandTarget.value =
|
15
|
+
this.countOnHandTarget.value =
|
16
|
+
parseInt(this.initialCountOnHandValue) + parseInt(this.quantityAdjustmentTarget.value)
|
16
17
|
}
|
17
18
|
}
|
@@ -1,18 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::StockItems::Edit::Component < SolidusAdmin::
|
4
|
-
def initialize(stock_item:, page:)
|
5
|
-
@stock_item = stock_item
|
6
|
-
@page = page
|
7
|
-
end
|
8
|
-
|
3
|
+
class SolidusAdmin::StockItems::Edit::Component < SolidusAdmin::Resources::Edit::Component
|
9
4
|
def title
|
10
5
|
[
|
11
6
|
"#{Spree::StockLocation.model_name.human}: #{@stock_item.stock_location.name}",
|
12
7
|
].join(' / ')
|
13
8
|
end
|
14
|
-
|
15
|
-
def form_id
|
16
|
-
"#{stimulus_id}-#{dom_id(@stock_item)}"
|
17
|
-
end
|
18
9
|
end
|
@@ -13,8 +13,8 @@ class SolidusAdmin::StockItems::Index::Component < SolidusAdmin::UI::Pages::Inde
|
|
13
13
|
solidus_admin.stock_items_path
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
solidus_admin.edit_stock_item_path(stock_item,
|
16
|
+
def edit_path(stock_item)
|
17
|
+
solidus_admin.edit_stock_item_path(stock_item, **search_filter_params)
|
18
18
|
end
|
19
19
|
|
20
20
|
def scopes
|
@@ -90,7 +90,9 @@ class SolidusAdmin::StockItems::Index::Component < SolidusAdmin::UI::Pages::Inde
|
|
90
90
|
{
|
91
91
|
header: :name,
|
92
92
|
data: ->(stock_item) do
|
93
|
-
|
93
|
+
link_to stock_item.variant.name, edit_path(stock_item),
|
94
|
+
data: { turbo_frame: :resource_modal },
|
95
|
+
class: 'body-link'
|
94
96
|
end
|
95
97
|
}
|
96
98
|
end
|
@@ -99,7 +101,9 @@ class SolidusAdmin::StockItems::Index::Component < SolidusAdmin::UI::Pages::Inde
|
|
99
101
|
{
|
100
102
|
header: :sku,
|
101
103
|
data: ->(stock_item) do
|
102
|
-
|
104
|
+
link_to stock_item.variant.sku, edit_path(stock_item),
|
105
|
+
data: { turbo_frame: :resource_modal },
|
106
|
+
class: 'body-link'
|
103
107
|
end
|
104
108
|
}
|
105
109
|
end
|
@@ -168,6 +172,6 @@ class SolidusAdmin::StockItems::Index::Component < SolidusAdmin::UI::Pages::Inde
|
|
168
172
|
end
|
169
173
|
|
170
174
|
def turbo_frames
|
171
|
-
%w[
|
175
|
+
%w[resource_modal]
|
172
176
|
end
|
173
177
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= turbo_frame_tag :
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
2
|
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
-
<%= form_for @store_credit_reason, url:
|
3
|
+
<%= form_for @store_credit_reason, url: form_url, html: { id: form_id } do |f| %>
|
4
4
|
<div class="flex flex-col gap-6 pb-4">
|
5
5
|
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
6
6
|
<label class="flex gap-2 items-center">
|
@@ -23,4 +23,3 @@
|
|
23
23
|
<% end %>
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
|
-
<%= render component("store_credit_reasons/index").new(page: @page) %>
|
@@ -1,12 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::StoreCreditReasons::Edit::Component < SolidusAdmin::
|
4
|
-
def initialize(page:, store_credit_reason:)
|
5
|
-
@page = page
|
6
|
-
@store_credit_reason = store_credit_reason
|
7
|
-
end
|
8
|
-
|
9
|
-
def form_id
|
10
|
-
dom_id(@store_credit_reason, "#{stimulus_id}_edit_store_credit_reason_form")
|
11
|
-
end
|
3
|
+
class SolidusAdmin::StoreCreditReasons::Edit::Component < SolidusAdmin::Resources::Edit::Component
|
12
4
|
end
|