solidus_admin 0.3.1 → 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 +164 -132
- 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 +7 -9
- data/app/components/solidus_admin/layout/navigation/account/component.rb +2 -2
- data/app/components/solidus_admin/layout/navigation/component.js +1 -1
- data/app/components/solidus_admin/layout/navigation/component.rb +1 -1
- data/app/components/solidus_admin/layout/navigation/item/component.html.erb +2 -2
- data/app/components/solidus_admin/layout/navigation/item/component.rb +3 -6
- data/app/components/solidus_admin/orders/index/component.rb +3 -3
- data/app/components/solidus_admin/orders/show/address/component.js +2 -2
- data/app/components/solidus_admin/orders/show/adjustments/index/adjustable/component.rb +1 -1
- data/app/components/solidus_admin/orders/show/adjustments/index/source/component.rb +1 -1
- 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/products/status/component.rb +1 -1
- 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 +10 -6
- data/app/components/solidus_admin/stock_locations/index/component.rb +2 -2
- 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 +18 -18
- 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/icon/component.rb +3 -1
- 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 +11 -6
- 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/component.rb +1 -1
- data/app/components/solidus_admin/ui/table/ransack_filter/component.js +18 -16
- data/app/components/solidus_admin/ui/thumbnail_with_caption/component.rb +1 -1
- data/app/components/solidus_admin/ui/toast/component.html.erb +1 -1
- 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/index/component.rb +1 -1
- 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 +65 -0
- data/app/components/solidus_admin/users/store_credits/index/component.rb +114 -0
- data/app/components/solidus_admin/users/store_credits/index/component.yml +12 -0
- 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/controller_helpers/search.rb +4 -4
- 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/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 -1
- data/lib/generators/solidus_admin/install/install_generator.rb +2 -0
- data/lib/solidus_admin/component_registry.rb +1 -1
- data/lib/solidus_admin/configuration.rb +3 -8
- 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/feature_helpers.rb +1 -1
- 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
- data/solidus_admin.gemspec +2 -2
- metadata +39 -8
- data/bin/rails +0 -13
@@ -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 @adjustment_reason, url:
|
3
|
+
<%= form_for @adjustment_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
|
<%= render component("ui/forms/field").text_field(f, :code, class: "required") %>
|
@@ -24,4 +24,3 @@
|
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
26
|
<% end %>
|
27
|
-
<%= render component("adjustment_reasons/index").new(page: @page) %>
|
@@ -1,12 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::AdjustmentReasons::Edit::Component < SolidusAdmin::
|
4
|
-
def initialize(page:, adjustment_reason:)
|
5
|
-
@page = page
|
6
|
-
@adjustment_reason = adjustment_reason
|
7
|
-
end
|
8
|
-
|
9
|
-
def form_id
|
10
|
-
dom_id(@adjustment_reason, "#{stimulus_id}_edit_adjustment_reason_form")
|
11
|
-
end
|
3
|
+
class SolidusAdmin::AdjustmentReasons::Edit::Component < SolidusAdmin::Resources::Edit::Component
|
12
4
|
end
|
@@ -17,7 +17,8 @@ class SolidusAdmin::AdjustmentReasons::Index::Component < SolidusAdmin::RefundsA
|
|
17
17
|
render component("ui/button").new(
|
18
18
|
tag: :a,
|
19
19
|
text: t('.add'),
|
20
|
-
href: solidus_admin.new_adjustment_reason_path,
|
20
|
+
href: solidus_admin.new_adjustment_reason_path(**search_filter_params),
|
21
|
+
data: { turbo_frame: :resource_modal },
|
21
22
|
icon: "add-line",
|
22
23
|
class: "align-self-end w-full",
|
23
24
|
)
|
@@ -25,20 +26,19 @@ class SolidusAdmin::AdjustmentReasons::Index::Component < SolidusAdmin::RefundsA
|
|
25
26
|
|
26
27
|
def turbo_frames
|
27
28
|
%w[
|
28
|
-
|
29
|
-
edit_adjustment_reason_modal
|
29
|
+
resource_modal
|
30
30
|
]
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
34
|
-
spree.edit_admin_adjustment_reason_path(adjustment_reason,
|
33
|
+
def edit_path(adjustment_reason)
|
34
|
+
spree.edit_admin_adjustment_reason_path(adjustment_reason, **search_filter_params)
|
35
35
|
end
|
36
36
|
|
37
37
|
def batch_actions
|
38
38
|
[
|
39
39
|
{
|
40
40
|
label: t('.batch_actions.delete'),
|
41
|
-
action: solidus_admin.adjustment_reasons_path,
|
41
|
+
action: solidus_admin.adjustment_reasons_path(**search_filter_params),
|
42
42
|
method: :delete,
|
43
43
|
icon: 'delete-bin-7-line',
|
44
44
|
},
|
@@ -47,8 +47,22 @@ class SolidusAdmin::AdjustmentReasons::Index::Component < SolidusAdmin::RefundsA
|
|
47
47
|
|
48
48
|
def columns
|
49
49
|
[
|
50
|
-
|
51
|
-
|
50
|
+
{
|
51
|
+
header: :name,
|
52
|
+
data: ->(adjustment_reason) do
|
53
|
+
link_to adjustment_reason.name, edit_path(adjustment_reason),
|
54
|
+
class: 'body-link',
|
55
|
+
data: { turbo_frame: :resource_modal }
|
56
|
+
end
|
57
|
+
},
|
58
|
+
{
|
59
|
+
header: :code,
|
60
|
+
data: ->(adjustment_reason) do
|
61
|
+
link_to adjustment_reason.code, edit_path(adjustment_reason),
|
62
|
+
class: 'body-link',
|
63
|
+
data: { turbo_frame: :resource_modal }
|
64
|
+
end
|
65
|
+
},
|
52
66
|
{
|
53
67
|
header: :active,
|
54
68
|
data: ->(adjustment_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 @adjustment_reason, url:
|
3
|
+
<%= form_for @adjustment_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
|
<%= render component("ui/forms/field").text_field(f, :code, class: "required") %>
|
@@ -24,5 +24,3 @@
|
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
26
|
<% end %>
|
27
|
-
|
28
|
-
<%= render component("adjustment_reasons/index").new(page: @page) %>
|
@@ -1,12 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::AdjustmentReasons::New::Component < SolidusAdmin::
|
4
|
-
def initialize(page:, adjustment_reason:)
|
5
|
-
@page = page
|
6
|
-
@adjustment_reason = adjustment_reason
|
7
|
-
end
|
8
|
-
|
9
|
-
def form_id
|
10
|
-
dom_id(@adjustment_reason, "#{stimulus_id}_new_adjustment_reason_form")
|
11
|
-
end
|
3
|
+
class SolidusAdmin::AdjustmentReasons::New::Component < SolidusAdmin::Resources::New::Component
|
12
4
|
end
|
@@ -7,10 +7,11 @@ module SolidusAdmin
|
|
7
7
|
# BaseComponent is the base class for all components in Solidus Admin.
|
8
8
|
class BaseComponent < ViewComponent::Base
|
9
9
|
include SolidusAdmin::ComponentsHelper
|
10
|
+
include SolidusAdmin::VoidElementsHelper
|
10
11
|
include Turbo::FramesHelper
|
11
12
|
|
12
13
|
def icon_tag(name, **attrs)
|
13
|
-
render component("ui/icon").new(name
|
14
|
+
render component("ui/icon").new(name:, **attrs)
|
14
15
|
end
|
15
16
|
|
16
17
|
def missing_translation(key, options)
|
@@ -25,6 +26,10 @@ module SolidusAdmin
|
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
29
|
+
def self.i18n_scope
|
30
|
+
@i18n_scope ||= name.underscore.tr("/", ".")
|
31
|
+
end
|
32
|
+
|
28
33
|
def self.stimulus_id
|
29
34
|
@stimulus_id ||= name.underscore
|
30
35
|
.sub(/^solidus_admin\/(.*)\/component$/, '\1')
|
@@ -33,13 +38,6 @@ module SolidusAdmin
|
|
33
38
|
end
|
34
39
|
|
35
40
|
delegate :stimulus_id, to: :class
|
36
|
-
|
37
|
-
def spree
|
38
|
-
@spree ||= Spree::Core::Engine.routes.url_helpers
|
39
|
-
end
|
40
|
-
|
41
|
-
def solidus_admin
|
42
|
-
@solidus_admin ||= SolidusAdmin::Engine.routes.url_helpers
|
43
|
-
end
|
41
|
+
delegate :search_filter_params, to: :helpers
|
44
42
|
end
|
45
43
|
end
|
@@ -11,7 +11,7 @@ class SolidusAdmin::Layout::Navigation::Account::Component < SolidusAdmin::BaseC
|
|
11
11
|
def locale_options_for_select(available_locales)
|
12
12
|
available_locales.map do |locale|
|
13
13
|
[
|
14
|
-
t("spree.i18n.this_file_language", locale
|
14
|
+
t("spree.i18n.this_file_language", locale:, default: locale.to_s, fallback: false),
|
15
15
|
locale,
|
16
16
|
]
|
17
17
|
end.sort
|
@@ -27,7 +27,7 @@ class SolidusAdmin::Layout::Navigation::Account::Component < SolidusAdmin::BaseC
|
|
27
27
|
block_given? ? capture(&block) : nil,
|
28
28
|
tag.label(safe_join([
|
29
29
|
icon_tag(icon, class: "w-full max-w-[20px] h-5 fill-current shrink"),
|
30
|
-
tag.select(options, name
|
30
|
+
tag.select(options, name:, onchange: "this.form.requestSubmit()", class: "w-full appearance-none grow bg-transparent outline-none"),
|
31
31
|
icon_tag("expand-up-down-line", class: "w-full max-w-[20px] h-5 fill-current shrink"),
|
32
32
|
]), class: "flex gap-2 items-center px-2"),
|
33
33
|
])
|
@@ -9,7 +9,7 @@ class SolidusAdmin::Layout::Navigation::Component < SolidusAdmin::BaseComponent
|
|
9
9
|
@logo_path = logo_path
|
10
10
|
@items = items.map do |attrs|
|
11
11
|
children = attrs[:children].to_a.map { SolidusAdmin::MenuItem.new(**_1, top_level: false) }
|
12
|
-
SolidusAdmin::MenuItem.new(**attrs, children
|
12
|
+
SolidusAdmin::MenuItem.new(**attrs, children:, top_level: true)
|
13
13
|
end
|
14
14
|
@store = store
|
15
15
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<li class="group <%= "active" if active? %>">
|
2
2
|
<a
|
3
3
|
href="<%= path %>"
|
4
|
-
aria-current="<%= @item.current?(
|
4
|
+
aria-current="<%= @item.current?(self, @fullpath) ? "page" : "false" %>"
|
5
5
|
class="
|
6
6
|
flex gap-3 items-center
|
7
7
|
py-1 px-3 rounded
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
<% if @item.children? %>
|
22
22
|
<ul class="flex flex-col gap-0.5 pt-0.5 <%= "hidden" unless active? %>">
|
23
|
-
<%= render self.class.with_collection(@item.children,
|
23
|
+
<%= render self.class.with_collection(@item.children, fullpath: @fullpath) %>
|
24
24
|
</ul>
|
25
25
|
<% end %>
|
26
26
|
</li>
|
@@ -6,22 +6,19 @@ class SolidusAdmin::Layout::Navigation::Item::Component < SolidusAdmin::BaseComp
|
|
6
6
|
|
7
7
|
# @param item [SolidusAdmin::MenuItem]
|
8
8
|
# @param fullpath [String] the current path
|
9
|
-
# @param url_helpers [#solidus_admin, #spree] context for generating paths
|
10
9
|
def initialize(
|
11
10
|
item:,
|
12
|
-
fullpath: "#"
|
13
|
-
url_helpers: Struct.new(:spree, :solidus_admin).new(spree, solidus_admin)
|
11
|
+
fullpath: "#"
|
14
12
|
)
|
15
13
|
@item = item
|
16
|
-
@url_helpers = url_helpers
|
17
14
|
@fullpath = fullpath
|
18
15
|
end
|
19
16
|
|
20
17
|
def path
|
21
|
-
@item.path(
|
18
|
+
@item.path(self)
|
22
19
|
end
|
23
20
|
|
24
21
|
def active?
|
25
|
-
@item.active?(
|
22
|
+
@item.active?(self, @fullpath)
|
26
23
|
end
|
27
24
|
end
|
@@ -124,7 +124,7 @@ class SolidusAdmin::Orders::Index::Component < SolidusAdmin::UI::Pages::Index::C
|
|
124
124
|
'canceled' => :blue,
|
125
125
|
'cart' => :graphite_light,
|
126
126
|
}[order.state] || :yellow
|
127
|
-
component('ui/badge').new(name: order.state.humanize, color:
|
127
|
+
component('ui/badge').new(name: order.state.humanize, color:)
|
128
128
|
end
|
129
129
|
}
|
130
130
|
end
|
@@ -143,7 +143,7 @@ class SolidusAdmin::Orders::Index::Component < SolidusAdmin::UI::Pages::Index::C
|
|
143
143
|
col: { class: "w-[400px]" },
|
144
144
|
header: :customer,
|
145
145
|
data: ->(order) do
|
146
|
-
customer_email = order.
|
146
|
+
customer_email = order.email
|
147
147
|
content_tag :div, String(customer_email)
|
148
148
|
end
|
149
149
|
}
|
@@ -153,7 +153,7 @@ class SolidusAdmin::Orders::Index::Component < SolidusAdmin::UI::Pages::Index::C
|
|
153
153
|
{
|
154
154
|
header: :total,
|
155
155
|
data: ->(order) do
|
156
|
-
content_tag :div,
|
156
|
+
content_tag :div, order.display_total
|
157
157
|
end
|
158
158
|
}
|
159
159
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { Controller } from
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
4
|
static targets = ["addresses"]
|
5
5
|
|
6
6
|
close() {
|
7
|
-
this.addressesTarget.removeAttribute(
|
7
|
+
this.addressesTarget.removeAttribute("open")
|
8
8
|
}
|
9
9
|
}
|
@@ -10,7 +10,7 @@ class SolidusAdmin::Orders::Show::Adjustments::Index::Adjustable::Component < So
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def call
|
13
|
-
render component("ui/thumbnail_with_caption").new(caption
|
13
|
+
render component("ui/thumbnail_with_caption").new(caption:, detail:) do
|
14
14
|
thumbnail
|
15
15
|
end
|
16
16
|
end
|
@@ -10,7 +10,7 @@ class SolidusAdmin::Orders::Show::Adjustments::Index::Source::Component < Solidu
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def call
|
13
|
-
render component("ui/thumbnail_with_caption").new(icon
|
13
|
+
render component("ui/thumbnail_with_caption").new(icon:, caption:, detail:)
|
14
14
|
end
|
15
15
|
|
16
16
|
def caption
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { Controller } from
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
4
|
closeMenus() {
|
5
|
-
this.element.querySelectorAll(
|
5
|
+
this.element.querySelectorAll("details").forEach((details) => details.removeAttribute("open"))
|
6
6
|
}
|
7
7
|
}
|
@@ -1,14 +1,15 @@
|
|
1
|
-
import { Controller } from
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
4
|
static values = { customersUrl: String }
|
5
5
|
|
6
6
|
async search({ detail: { query, controller } }) {
|
7
|
-
controller.resultsValue =
|
8
|
-
|
7
|
+
controller.resultsValue = await (
|
8
|
+
await fetch(`${this.customersUrlValue}?q[name_or_variants_including_master_sku_cont]=${query}`)
|
9
|
+
).text()
|
9
10
|
}
|
10
11
|
|
11
12
|
submit(event) {
|
12
|
-
event.detail.resultTarget.querySelector(
|
13
|
+
event.detail.resultTarget.querySelector("form").submit()
|
13
14
|
}
|
14
15
|
}
|
@@ -2,12 +2,12 @@
|
|
2
2
|
<%= render component('ui/panel').new(title: t('.summary')) do %>
|
3
3
|
<%= render component('ui/details_list').new(
|
4
4
|
items: [
|
5
|
-
{ label: t('.subtotal'), value:
|
6
|
-
{ label: t('.taxes'), value:
|
7
|
-
{ label: t('.shipping'), value:
|
8
|
-
{ label: link_to(t('.add_promo_code'), '#', class: "body-link"), value:
|
9
|
-
{ label: link_to(t('.adjustments'), solidus_admin.order_adjustments_path(@order), class: "body-link"), value:
|
10
|
-
{ label: t('.total'), value:
|
5
|
+
{ label: t('.subtotal'), value: @order.display_item_total, class: 'font-semibold' },
|
6
|
+
{ label: t('.taxes'), value: @order.display_additional_tax_total },
|
7
|
+
{ label: t('.shipping'), value: @order.display_shipment_total },
|
8
|
+
{ label: link_to(t('.add_promo_code'), '#', class: "body-link"), value: @order.display_promo_total },
|
9
|
+
{ label: link_to(t('.adjustments'), solidus_admin.order_adjustments_path(@order), class: "body-link"), value: @order.display_adjustment_total },
|
10
|
+
{ label: t('.total'), value: @order.display_total, class: 'font-semibold' }
|
11
11
|
]
|
12
12
|
) %>
|
13
13
|
<% end %>
|
@@ -36,8 +36,14 @@
|
|
36
36
|
<%= render component("ui/forms/field").text_field(f, :meta_title) %>
|
37
37
|
<%= render component("ui/forms/field").text_field(f, :meta_description) %>
|
38
38
|
<%= render component("ui/forms/field").text_area(f, :meta_keywords) %>
|
39
|
+
<%= render component("ui/forms/field").text_field(f, :gtin) %>
|
40
|
+
<%= render component("ui/forms/field").select(
|
41
|
+
f,
|
42
|
+
:condition,
|
43
|
+
condition_options,
|
44
|
+
include_blank: t('spree.unset'),
|
45
|
+
) %>
|
39
46
|
<% end %>
|
40
|
-
|
41
47
|
<%= render component('ui/panel').new(title: "Media") do |panel| %>
|
42
48
|
<% panel.with_action(
|
43
49
|
name: t(".manage_images"),
|
@@ -25,4 +25,10 @@ class SolidusAdmin::Products::Show::Component < SolidusAdmin::BaseComponent
|
|
25
25
|
["#{_1} (#{_2})", _3]
|
26
26
|
end
|
27
27
|
end
|
28
|
+
|
29
|
+
def condition_options
|
30
|
+
@condition_options ||= Spree::Variant.conditions.map do |key, value|
|
31
|
+
[t("spree.condition.#{key}"), value]
|
32
|
+
end
|
33
|
+
end
|
28
34
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
|
+
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
+
<%= form_for @property, url: form_url, html: { id: form_id } do |f| %>
|
4
|
+
<div class="flex flex-col gap-6 pb-4">
|
5
|
+
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
6
|
+
<%= render component("ui/forms/field").text_field(f, :presentation, class: "required") %>
|
7
|
+
</div>
|
8
|
+
<% modal.with_actions do %>
|
9
|
+
<form method="dialog">
|
10
|
+
<%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %>
|
11
|
+
</form>
|
12
|
+
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
@@ -5,6 +5,10 @@ class SolidusAdmin::Properties::Index::Component < SolidusAdmin::UI::Pages::Inde
|
|
5
5
|
Spree::Property
|
6
6
|
end
|
7
7
|
|
8
|
+
def title
|
9
|
+
t('solidus_admin.properties.title')
|
10
|
+
end
|
11
|
+
|
8
12
|
def search_key
|
9
13
|
:name_cont
|
10
14
|
end
|
@@ -13,15 +17,20 @@ class SolidusAdmin::Properties::Index::Component < SolidusAdmin::UI::Pages::Inde
|
|
13
17
|
solidus_admin.properties_path
|
14
18
|
end
|
15
19
|
|
16
|
-
def
|
17
|
-
|
20
|
+
def edit_path(property)
|
21
|
+
solidus_admin.edit_property_path(property, **search_filter_params)
|
22
|
+
end
|
23
|
+
|
24
|
+
def turbo_frames
|
25
|
+
%w[resource_modal]
|
18
26
|
end
|
19
27
|
|
20
28
|
def page_actions
|
21
29
|
render component("ui/button").new(
|
22
30
|
tag: :a,
|
23
31
|
text: t('.add'),
|
24
|
-
href:
|
32
|
+
href: solidus_admin.new_property_path(**search_filter_params),
|
33
|
+
data: { turbo_frame: :resource_modal },
|
25
34
|
icon: "add-line",
|
26
35
|
)
|
27
36
|
end
|
@@ -30,7 +39,7 @@ class SolidusAdmin::Properties::Index::Component < SolidusAdmin::UI::Pages::Inde
|
|
30
39
|
[
|
31
40
|
{
|
32
41
|
label: t('.batch_actions.delete'),
|
33
|
-
action: solidus_admin.properties_path,
|
42
|
+
action: solidus_admin.properties_path(**search_filter_params),
|
34
43
|
method: :delete,
|
35
44
|
icon: 'delete-bin-7-line',
|
36
45
|
},
|
@@ -48,7 +57,9 @@ class SolidusAdmin::Properties::Index::Component < SolidusAdmin::UI::Pages::Inde
|
|
48
57
|
{
|
49
58
|
header: :name,
|
50
59
|
data: ->(property) do
|
51
|
-
|
60
|
+
link_to property.name, edit_path(property),
|
61
|
+
data: { turbo_frame: :resource_modal },
|
62
|
+
class: 'body-link'
|
52
63
|
end
|
53
64
|
}
|
54
65
|
end
|
@@ -57,7 +68,9 @@ class SolidusAdmin::Properties::Index::Component < SolidusAdmin::UI::Pages::Inde
|
|
57
68
|
{
|
58
69
|
header: :presentation,
|
59
70
|
data: ->(property) do
|
60
|
-
|
71
|
+
link_to property.presentation, edit_path(property),
|
72
|
+
data: { turbo_frame: :resource_modal },
|
73
|
+
class: 'body-link'
|
61
74
|
end
|
62
75
|
}
|
63
76
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= turbo_frame_tag :resource_modal, target: "_top" do %>
|
2
|
+
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
+
<%= form_for @property, url: form_url, html: { id: form_id } do |f| %>
|
4
|
+
<div class="flex flex-col gap-6 pb-4">
|
5
|
+
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
|
6
|
+
<%= render component("ui/forms/field").text_field(f, :presentation, class: "required") %>
|
7
|
+
</div>
|
8
|
+
<% modal.with_actions do %>
|
9
|
+
<form method="dialog">
|
10
|
+
<%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %>
|
11
|
+
</form>
|
12
|
+
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
<% 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 @refund_reason, url:
|
3
|
+
<%= form_for @refund_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
|
<%= render component("ui/forms/field").text_field(f, :code, class: "required") %>
|
@@ -24,4 +24,3 @@
|
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
26
|
<% end %>
|
27
|
-
<%= render component("refund_reasons/index").new(page: @page) %>
|
@@ -1,12 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::RefundReasons::Edit::Component < SolidusAdmin::
|
4
|
-
def initialize(page:, refund_reason:)
|
5
|
-
@page = page
|
6
|
-
@refund_reason = refund_reason
|
7
|
-
end
|
8
|
-
|
9
|
-
def form_id
|
10
|
-
dom_id(@refund_reason, "#{stimulus_id}_edit_refund_reason_form")
|
11
|
-
end
|
3
|
+
class SolidusAdmin::RefundReasons::Edit::Component < SolidusAdmin::Resources::Edit::Component
|
12
4
|
end
|
@@ -13,14 +13,13 @@ class SolidusAdmin::RefundReasons::Index::Component < SolidusAdmin::RefundsAndRe
|
|
13
13
|
:name_or_code_cont
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
spree.edit_admin_refund_reason_path(refund_reason,
|
16
|
+
def edit_path(refund_reason)
|
17
|
+
spree.edit_admin_refund_reason_path(refund_reason, **search_filter_params)
|
18
18
|
end
|
19
19
|
|
20
20
|
def turbo_frames
|
21
21
|
%w[
|
22
|
-
|
23
|
-
edit_refund_reason_modal
|
22
|
+
resource_modal
|
24
23
|
]
|
25
24
|
end
|
26
25
|
|
@@ -28,7 +27,8 @@ class SolidusAdmin::RefundReasons::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_refund_reason_path,
|
30
|
+
href: solidus_admin.new_refund_reason_path(**search_filter_params),
|
31
|
+
data: { turbo_frame: :resource_modal },
|
32
32
|
icon: "add-line",
|
33
33
|
class: "align-self-end w-full",
|
34
34
|
)
|
@@ -38,7 +38,7 @@ class SolidusAdmin::RefundReasons::Index::Component < SolidusAdmin::RefundsAndRe
|
|
38
38
|
[
|
39
39
|
{
|
40
40
|
label: t('.batch_actions.delete'),
|
41
|
-
action: solidus_admin.refund_reasons_path,
|
41
|
+
action: solidus_admin.refund_reasons_path(**search_filter_params),
|
42
42
|
method: :delete,
|
43
43
|
icon: 'delete-bin-7-line',
|
44
44
|
},
|
@@ -47,8 +47,22 @@ class SolidusAdmin::RefundReasons::Index::Component < SolidusAdmin::RefundsAndRe
|
|
47
47
|
|
48
48
|
def columns
|
49
49
|
[
|
50
|
-
|
51
|
-
|
50
|
+
{
|
51
|
+
header: :name,
|
52
|
+
data: ->(refund_reason) do
|
53
|
+
link_to refund_reason.name, edit_path(refund_reason),
|
54
|
+
data: { turbo_frame: :resource_modal },
|
55
|
+
class: 'body-link'
|
56
|
+
end
|
57
|
+
},
|
58
|
+
{
|
59
|
+
header: :code,
|
60
|
+
data: ->(refund_reason) do
|
61
|
+
link_to_if refund_reason.code, refund_reason.code, edit_path(refund_reason),
|
62
|
+
data: { turbo_frame: :resource_modal },
|
63
|
+
class: 'body-link'
|
64
|
+
end
|
65
|
+
},
|
52
66
|
{
|
53
67
|
header: :active,
|
54
68
|
data: ->(refund_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 @refund_reason, url:
|
3
|
+
<%= form_for @refund_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
|
<%= render component("ui/forms/field").text_field(f, :code, class: "required") %>
|
@@ -23,5 +23,3 @@
|
|
23
23
|
<% end %>
|
24
24
|
<% end %>
|
25
25
|
<% end %>
|
26
|
-
|
27
|
-
<%= render component("refund_reasons/index").new(page: @page) %>
|
@@ -1,12 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::RefundReasons::New::Component < SolidusAdmin::
|
4
|
-
def initialize(page:, refund_reason:)
|
5
|
-
@page = page
|
6
|
-
@refund_reason = refund_reason
|
7
|
-
end
|
8
|
-
|
9
|
-
def form_id
|
10
|
-
dom_id(@refund_reason, "#{stimulus_id}_new_refund_reason_form")
|
11
|
-
end
|
3
|
+
class SolidusAdmin::RefundReasons::New::Component < SolidusAdmin::Resources::New::Component
|
12
4
|
end
|