solidus_admin 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +61 -7
- data/Rakefile +1 -0
- data/app/assets/builds/solidus_admin/tailwind.css +197 -162
- data/app/assets/stylesheets/solidus_admin/dark.css +1 -0
- data/app/assets/stylesheets/solidus_admin/dimmed.css +1 -0
- data/app/components/solidus_admin/adjustment_reasons/edit/component.html.erb +27 -0
- data/app/components/solidus_admin/adjustment_reasons/edit/component.rb +12 -0
- data/app/components/solidus_admin/adjustment_reasons/edit/component.yml +8 -0
- data/app/components/solidus_admin/adjustment_reasons/index/component.rb +26 -19
- data/app/components/solidus_admin/adjustment_reasons/new/component.html.erb +28 -0
- data/app/components/solidus_admin/adjustment_reasons/new/component.rb +12 -0
- data/app/components/solidus_admin/adjustment_reasons/new/component.yml +8 -0
- data/app/components/solidus_admin/base_component.rb +4 -1
- data/app/components/solidus_admin/option_types/index/component.rb +21 -7
- data/app/components/solidus_admin/orders/index/component.rb +28 -23
- data/app/components/solidus_admin/orders/index/component.yml +1 -1
- data/app/components/solidus_admin/orders/show/address/component.html.erb +56 -54
- data/app/components/solidus_admin/orders/show/adjustments/index/adjustable/component.rb +27 -0
- data/app/components/solidus_admin/orders/show/adjustments/index/adjustable/spree_line_item/component.rb +14 -0
- data/app/components/solidus_admin/orders/show/adjustments/index/adjustable/spree_order/component.rb +11 -0
- data/app/components/solidus_admin/orders/show/adjustments/index/adjustable/spree_shipment/component.rb +15 -0
- data/app/components/solidus_admin/orders/show/adjustments/index/component.rb +147 -0
- data/app/components/solidus_admin/orders/show/adjustments/index/component.yml +21 -0
- data/app/components/solidus_admin/orders/show/adjustments/index/source/component.rb +26 -0
- data/app/components/solidus_admin/orders/show/adjustments/index/source/spree_tax_rate/component.rb +17 -0
- data/app/components/solidus_admin/orders/show/adjustments/index/source/spree_unit_cancel/component.rb +7 -0
- data/app/components/solidus_admin/orders/show/component.html.erb +7 -3
- data/app/components/solidus_admin/orders/show/component.rb +8 -0
- data/app/components/solidus_admin/orders/show/email/component.html.erb +18 -13
- data/app/components/solidus_admin/orders/show/email/component.rb +0 -4
- data/app/components/solidus_admin/orders/show/summary/component.html.erb +1 -1
- data/app/components/solidus_admin/payment_methods/index/component.rb +29 -19
- data/app/components/solidus_admin/payment_methods/index/component.yml +0 -5
- data/app/components/solidus_admin/products/index/component.rb +25 -15
- data/app/components/solidus_admin/products/index/component.yml +0 -2
- data/app/components/solidus_admin/products/show/component.html.erb +14 -3
- data/app/components/solidus_admin/products/status/component.rb +4 -1
- data/app/components/solidus_admin/products/status/component.yml +1 -0
- data/app/components/solidus_admin/properties/index/component.rb +18 -19
- data/app/components/solidus_admin/refund_reasons/edit/component.html.erb +27 -0
- data/app/components/solidus_admin/refund_reasons/edit/component.rb +12 -0
- data/app/components/solidus_admin/refund_reasons/edit/component.yml +8 -0
- data/app/components/solidus_admin/refund_reasons/index/component.rb +26 -19
- data/app/components/solidus_admin/refund_reasons/new/component.html.erb +27 -0
- data/app/components/solidus_admin/refund_reasons/new/component.rb +12 -0
- data/app/components/solidus_admin/refund_reasons/new/component.yml +6 -0
- data/app/components/solidus_admin/refunds_and_returns/component.rb +33 -13
- data/app/components/solidus_admin/reimbursement_types/index/component.rb +7 -25
- data/app/components/solidus_admin/return_reasons/edit/component.html.erb +26 -0
- data/app/components/solidus_admin/return_reasons/edit/component.rb +12 -0
- data/app/components/solidus_admin/return_reasons/edit/component.yml +8 -0
- data/app/components/solidus_admin/return_reasons/index/component.rb +27 -19
- data/app/components/solidus_admin/return_reasons/new/component.html.erb +27 -0
- data/app/components/solidus_admin/return_reasons/new/component.rb +12 -0
- data/app/components/solidus_admin/return_reasons/new/component.yml +8 -0
- data/app/components/solidus_admin/roles/edit/component.html.erb +33 -0
- data/app/components/solidus_admin/roles/edit/component.rb +20 -0
- data/app/components/solidus_admin/roles/edit/component.yml +19 -0
- data/app/components/solidus_admin/roles/index/component.rb +70 -0
- data/app/components/solidus_admin/roles/index/component.yml +6 -0
- data/app/components/solidus_admin/roles/new/component.html.erb +33 -0
- data/app/components/solidus_admin/roles/new/component.rb +20 -0
- data/app/components/solidus_admin/roles/new/component.yml +19 -0
- data/app/components/solidus_admin/shipping/component.rb +23 -11
- data/app/components/solidus_admin/shipping_categories/edit/component.html.erb +16 -0
- data/app/components/solidus_admin/shipping_categories/edit/component.rb +12 -0
- data/app/components/solidus_admin/shipping_categories/edit/component.yml +6 -0
- data/app/components/solidus_admin/shipping_categories/index/component.rb +37 -20
- data/app/components/solidus_admin/shipping_categories/new/component.html.erb +17 -0
- data/app/components/solidus_admin/shipping_categories/new/component.rb +12 -0
- data/app/components/solidus_admin/shipping_categories/new/component.yml +6 -0
- data/app/components/solidus_admin/shipping_methods/index/component.rb +19 -19
- data/app/components/solidus_admin/stock_items/edit/component.html.erb +66 -72
- data/app/components/solidus_admin/stock_items/edit/component.rb +0 -5
- data/app/components/solidus_admin/stock_items/index/component.rb +13 -20
- data/app/components/solidus_admin/stock_locations/index/component.rb +19 -11
- data/app/components/solidus_admin/stock_locations/index/component.yml +0 -3
- data/app/components/solidus_admin/store_credit_reasons/edit/component.html.erb +26 -0
- data/app/components/solidus_admin/store_credit_reasons/edit/component.rb +12 -0
- data/app/components/solidus_admin/store_credit_reasons/edit/component.yml +8 -0
- data/app/components/solidus_admin/store_credit_reasons/index/component.rb +26 -19
- data/app/components/solidus_admin/store_credit_reasons/new/component.html.erb +27 -0
- data/app/components/solidus_admin/store_credit_reasons/new/component.rb +12 -0
- data/app/components/solidus_admin/store_credit_reasons/new/component.yml +8 -0
- data/app/components/solidus_admin/stores/index/component.rb +18 -19
- data/app/components/solidus_admin/tax_categories/edit/component.html.erb +28 -0
- data/app/components/solidus_admin/tax_categories/edit/component.rb +12 -0
- data/app/components/solidus_admin/tax_categories/edit/component.yml +8 -0
- data/app/components/solidus_admin/tax_categories/index/component.rb +28 -21
- data/app/components/solidus_admin/tax_categories/new/component.html.erb +28 -0
- data/app/components/solidus_admin/tax_categories/new/component.rb +12 -0
- data/app/components/solidus_admin/tax_categories/new/component.yml +8 -0
- data/app/components/solidus_admin/tax_rates/index/component.rb +21 -17
- data/app/components/solidus_admin/taxes/component.rb +8 -8
- data/app/components/solidus_admin/taxonomies/index/component.rb +18 -12
- data/app/components/solidus_admin/ui/button/component.rb +1 -1
- data/app/components/solidus_admin/ui/checkbox_row/component.html.erb +29 -0
- data/app/components/solidus_admin/ui/checkbox_row/component.rb +11 -0
- data/app/components/solidus_admin/ui/forms/address/component.html.erb +27 -9
- data/app/components/solidus_admin/ui/forms/address/component.js +38 -13
- data/app/components/solidus_admin/ui/forms/search/component.html.erb +2 -3
- data/app/components/solidus_admin/ui/forms/search/component.js +3 -3
- data/app/components/solidus_admin/ui/modal/component.html.erb +7 -7
- data/app/components/solidus_admin/ui/modal/component.js +7 -0
- data/app/components/solidus_admin/ui/modal/component.rb +1 -1
- data/app/components/solidus_admin/ui/pages/index/component.html.erb +44 -0
- data/app/components/solidus_admin/ui/pages/index/component.rb +105 -0
- data/app/components/solidus_admin/ui/panel/component.html.erb +5 -16
- data/app/components/solidus_admin/ui/panel/component.rb +11 -7
- data/app/components/solidus_admin/ui/table/component.html.erb +2 -1
- data/app/components/solidus_admin/ui/table/component.js +31 -2
- data/app/components/solidus_admin/ui/table/component.rb +24 -8
- data/app/components/solidus_admin/ui/table/component.yml +1 -0
- data/app/components/solidus_admin/ui/thumbnail/component.rb +1 -1
- data/app/components/solidus_admin/ui/thumbnail_with_caption/component.html.erb +17 -0
- data/app/components/solidus_admin/ui/thumbnail_with_caption/component.rb +15 -0
- data/app/components/solidus_admin/users/addresses/component.html.erb +46 -0
- data/app/components/solidus_admin/users/addresses/component.rb +61 -0
- data/app/components/solidus_admin/users/addresses/component.yml +14 -0
- data/app/components/solidus_admin/users/edit/api_access/component.html.erb +49 -0
- data/app/components/solidus_admin/users/edit/api_access/component.js +9 -0
- data/app/components/solidus_admin/users/edit/api_access/component.rb +7 -0
- data/app/components/solidus_admin/users/edit/api_access/component.yml +10 -0
- data/app/components/solidus_admin/users/edit/component.html.erb +52 -0
- data/app/components/solidus_admin/users/edit/component.rb +51 -0
- data/app/components/solidus_admin/users/edit/component.yml +12 -0
- data/app/components/solidus_admin/users/index/component.rb +25 -16
- data/app/components/solidus_admin/users/index/component.yml +0 -3
- data/app/components/solidus_admin/users/items/component.html.erb +41 -0
- data/app/components/solidus_admin/users/items/component.rb +170 -0
- data/app/components/solidus_admin/users/items/component.yml +16 -0
- data/app/components/solidus_admin/users/orders/component.html.erb +42 -0
- data/app/components/solidus_admin/users/orders/component.rb +131 -0
- data/app/components/solidus_admin/users/orders/component.yml +12 -0
- data/app/components/solidus_admin/users/stats/component.html.erb +11 -0
- data/app/components/solidus_admin/users/stats/component.rb +9 -0
- data/app/components/solidus_admin/users/stats/component.yml +2 -0
- data/app/components/solidus_admin/users_and_roles/component.rb +24 -0
- data/app/components/solidus_admin/users_and_roles/component.yml +2 -0
- data/app/components/solidus_admin/zones/index/component.rb +19 -11
- data/app/controllers/solidus_admin/addresses_controller.rb +6 -1
- data/app/controllers/solidus_admin/adjustment_reasons_controller.rb +85 -10
- data/app/controllers/solidus_admin/adjustments_controller.rb +57 -0
- data/app/controllers/solidus_admin/customers_controller.rb +5 -1
- data/app/controllers/solidus_admin/orders_controller.rb +5 -1
- data/app/controllers/solidus_admin/products_controller.rb +11 -0
- data/app/controllers/solidus_admin/properties_controller.rb +1 -1
- data/app/controllers/solidus_admin/refund_reasons_controller.rb +85 -10
- data/app/controllers/solidus_admin/reimbursement_types_controller.rb +0 -5
- data/app/controllers/solidus_admin/return_reasons_controller.rb +85 -10
- data/app/controllers/solidus_admin/roles_controller.rb +118 -0
- data/app/controllers/solidus_admin/shipping_categories_controller.rb +87 -10
- data/app/controllers/solidus_admin/shipping_methods_controller.rb +0 -5
- data/app/controllers/solidus_admin/stock_items_controller.rb +6 -6
- data/app/controllers/solidus_admin/stock_locations_controller.rb +0 -5
- data/app/controllers/solidus_admin/store_credit_reasons_controller.rb +85 -10
- data/app/controllers/solidus_admin/stores_controller.rb +0 -5
- data/app/controllers/solidus_admin/tax_categories_controller.rb +89 -10
- data/app/controllers/solidus_admin/tax_rates_controller.rb +0 -5
- data/app/controllers/solidus_admin/users_controller.rb +85 -6
- data/app/controllers/solidus_admin/zones_controller.rb +0 -5
- data/app/helpers/solidus_admin/last_login_helper.rb +16 -0
- data/app/helpers/solidus_admin/permission_sets_helper.rb +32 -0
- data/app/views/layouts/solidus_admin/application.html.erb +2 -1
- data/app/views/layouts/solidus_admin/preview.html.erb +2 -0
- data/config/initializers/view_component.rb +1 -1
- data/config/locales/adjustment_reasons.en.yml +5 -1
- data/config/locales/adjustments.en.yml +10 -0
- data/config/locales/refund_reasons.en.yml +10 -0
- data/config/locales/return_reasons.en.yml +5 -1
- data/config/locales/roles.en.yml +10 -0
- data/config/locales/shipping_categories.en.yml +4 -0
- data/config/locales/store_credit_reasons.en.yml +5 -1
- data/config/locales/tax_categories.en.yml +4 -0
- data/config/locales/users.en.yml +10 -0
- data/config/routes.rb +24 -7
- data/docs/components.md +109 -0
- data/docs/{customizing_view_components.md → customizing_components.md} +2 -7
- data/docs/index_pages.md +146 -0
- data/docs/{customizing_menu_items.md → menu_items.md} +1 -1
- data/docs/stimulusjs.md +85 -0
- data/docs/{customizing_tailwindcss.md → tailwindcss.md} +27 -8
- data/lib/solidus_admin/component_registry.rb +40 -0
- data/lib/solidus_admin/configuration.rb +5 -27
- data/lib/solidus_admin/install_tailwindcss.rb +3 -1
- data/lib/solidus_admin/testing_support/admin_assets.rb +10 -0
- data/lib/solidus_admin/testing_support/component_helpers.rb +27 -0
- data/lib/solidus_admin/testing_support/dummy_app/rake_tasks.rb +60 -0
- data/lib/solidus_admin/testing_support/feature_helpers.rb +34 -0
- data/lib/solidus_admin/version.rb +1 -1
- data/solidus_admin.gemspec +7 -3
- metadata +111 -59
- data/app/components/solidus_admin/adjustment_reasons/index/component.html.erb +0 -32
- data/app/components/solidus_admin/adjustment_reasons/index/component.yml +0 -4
- data/app/components/solidus_admin/option_types/index/component.html.erb +0 -30
- data/app/components/solidus_admin/orders/index/component.html.erb +0 -35
- data/app/components/solidus_admin/payment_methods/index/component.html.erb +0 -38
- data/app/components/solidus_admin/products/index/component.html.erb +0 -34
- data/app/components/solidus_admin/promotion_categories/index/component.html.erb +0 -26
- data/app/components/solidus_admin/promotion_categories/index/component.rb +0 -57
- data/app/components/solidus_admin/promotion_categories/index/component.yml +0 -4
- data/app/components/solidus_admin/promotions/index/component.html.erb +0 -34
- data/app/components/solidus_admin/promotions/index/component.rb +0 -97
- data/app/components/solidus_admin/promotions/index/component.yml +0 -14
- data/app/components/solidus_admin/properties/index/component.html.erb +0 -34
- data/app/components/solidus_admin/properties/index/component.yml +0 -4
- data/app/components/solidus_admin/refund_reasons/index/component.html.erb +0 -31
- data/app/components/solidus_admin/refund_reasons/index/component.yml +0 -4
- data/app/components/solidus_admin/refunds_and_returns/component.html.erb +0 -26
- data/app/components/solidus_admin/reimbursement_types/index/component.html.erb +0 -22
- data/app/components/solidus_admin/reimbursement_types/index/component.yml +0 -4
- data/app/components/solidus_admin/return_reasons/index/component.html.erb +0 -31
- data/app/components/solidus_admin/return_reasons/index/component.yml +0 -4
- data/app/components/solidus_admin/shipping/component.html.erb +0 -30
- data/app/components/solidus_admin/shipping_categories/index/component.html.erb +0 -32
- data/app/components/solidus_admin/shipping_categories/index/component.yml +0 -4
- data/app/components/solidus_admin/shipping_methods/index/component.html.erb +0 -32
- data/app/components/solidus_admin/shipping_methods/index/component.yml +0 -4
- data/app/components/solidus_admin/stock_items/index/component.html.erb +0 -26
- data/app/components/solidus_admin/stock_locations/index/component.html.erb +0 -32
- data/app/components/solidus_admin/store_credit_reasons/index/component.html.erb +0 -31
- data/app/components/solidus_admin/store_credit_reasons/index/component.yml +0 -4
- data/app/components/solidus_admin/stores/index/component.html.erb +0 -34
- data/app/components/solidus_admin/stores/index/component.yml +0 -4
- data/app/components/solidus_admin/tax_categories/index/component.html.erb +0 -32
- data/app/components/solidus_admin/tax_categories/index/component.yml +0 -6
- data/app/components/solidus_admin/tax_rates/index/component.html.erb +0 -32
- data/app/components/solidus_admin/tax_rates/index/component.yml +0 -4
- data/app/components/solidus_admin/taxes/component.html.erb +0 -24
- data/app/components/solidus_admin/taxonomies/index/component.html.erb +0 -28
- data/app/components/solidus_admin/taxonomies/index/component.yml +0 -4
- data/app/components/solidus_admin/users/index/component.html.erb +0 -34
- data/app/components/solidus_admin/zones/index/component.html.erb +0 -35
- data/app/components/solidus_admin/zones/index/component.yml +0 -4
- data/app/controllers/solidus_admin/promotion_categories_controller.rb +0 -38
- data/app/controllers/solidus_admin/promotions_controller.rb +0 -46
- data/config/locales/promotion_categories.en.yml +0 -6
- data/config/locales/promotions.en.yml +0 -6
- data/config/locales/refund_reasons_.en.yml +0 -6
- /data/app/components/solidus_admin/{option_types → ui/pages}/index/component.yml +0 -0
@@ -1,20 +1,40 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::RefundsAndReturns::Component < SolidusAdmin::
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
class SolidusAdmin::RefundsAndReturns::Component < SolidusAdmin::UI::Pages::Index::Component
|
4
|
+
def title
|
5
|
+
page_header_title safe_join([
|
6
|
+
tag.div(t(".title")),
|
7
|
+
tag.div(t(".subtitle"), class: "font-normal text-sm text-gray-500"),
|
8
|
+
])
|
9
9
|
end
|
10
10
|
|
11
11
|
def tabs
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
[
|
13
|
+
{
|
14
|
+
text: Spree::RefundReason.model_name.human(count: 2),
|
15
|
+
href: solidus_admin.refund_reasons_path,
|
16
|
+
current: model_class == Spree::RefundReason,
|
17
|
+
},
|
18
|
+
{
|
19
|
+
text: Spree::ReimbursementType.model_name.human(count: 2),
|
20
|
+
href: solidus_admin.reimbursement_types_path,
|
21
|
+
current: model_class == Spree::ReimbursementType,
|
22
|
+
},
|
23
|
+
{
|
24
|
+
text: Spree::ReturnReason.model_name.human(count: 2),
|
25
|
+
href: solidus_admin.return_reasons_path,
|
26
|
+
current: model_class == Spree::ReturnReason,
|
27
|
+
},
|
28
|
+
{
|
29
|
+
text: Spree::AdjustmentReason.model_name.human(count: 2),
|
30
|
+
href: solidus_admin.adjustment_reasons_path,
|
31
|
+
current: model_class == Spree::AdjustmentReason,
|
32
|
+
},
|
33
|
+
{
|
34
|
+
text: Spree::StoreCreditReason.model_name.human(count: 2),
|
35
|
+
href: solidus_admin.store_credit_reasons_path,
|
36
|
+
current: model_class == Spree::StoreCreditReason,
|
37
|
+
},
|
38
|
+
]
|
19
39
|
end
|
20
40
|
end
|
@@ -1,34 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::ReimbursementTypes::Index::Component < SolidusAdmin::
|
4
|
-
|
5
|
-
|
6
|
-
def initialize(page:)
|
7
|
-
@page = page
|
8
|
-
end
|
9
|
-
|
10
|
-
def title
|
11
|
-
Spree::ReimbursementType.model_name.human.pluralize
|
12
|
-
end
|
13
|
-
|
14
|
-
def prev_page_path
|
15
|
-
solidus_admin.url_for(**request.params, page: @page.number - 1, only_path: true) unless @page.first?
|
16
|
-
end
|
17
|
-
|
18
|
-
def next_page_path
|
19
|
-
solidus_admin.url_for(**request.params, page: @page.next_param, only_path: true) unless @page.last?
|
20
|
-
end
|
21
|
-
|
22
|
-
def batch_actions
|
23
|
-
[]
|
3
|
+
class SolidusAdmin::ReimbursementTypes::Index::Component < SolidusAdmin::RefundsAndReturns::Component
|
4
|
+
def model_class
|
5
|
+
Spree::ReimbursementType
|
24
6
|
end
|
25
7
|
|
26
|
-
def
|
27
|
-
|
8
|
+
def search_url
|
9
|
+
solidus_admin.reimbursement_types_path
|
28
10
|
end
|
29
11
|
|
30
|
-
def
|
31
|
-
|
12
|
+
def search_key
|
13
|
+
:name_cont
|
32
14
|
end
|
33
15
|
|
34
16
|
def columns
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<%= turbo_frame_tag :edit_return_reason_modal do %>
|
2
|
+
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
+
<%= form_for @return_reason, url: solidus_admin.return_reason_path(@return_reason), 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
|
+
<label class="flex gap-2 items-center">
|
7
|
+
<%= hidden_field_tag "#{f.object_name}[active]", "0" %>
|
8
|
+
<%= render component("ui/forms/checkbox").new(
|
9
|
+
name: "#{f.object_name}[active]",
|
10
|
+
value: "1",
|
11
|
+
checked: f.object.active
|
12
|
+
) %>
|
13
|
+
<span class="font-semibold text-xs ml-2"><%= Spree::ReturnReason.human_attribute_name :active %></span>
|
14
|
+
<%= render component("ui/toggletip").new(text: t(".hints.active")) %>
|
15
|
+
</label>
|
16
|
+
</div>
|
17
|
+
<% modal.with_actions do %>
|
18
|
+
<form method="dialog">
|
19
|
+
<%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %>
|
20
|
+
</form>
|
21
|
+
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
<%= render component("return_reasons/index").new(page: @page) %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SolidusAdmin::ReturnReasons::Edit::Component < SolidusAdmin::BaseComponent
|
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
|
12
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Add your component translations here.
|
2
|
+
# Use the translation in the example in your template with `t(".hello")`.
|
3
|
+
en:
|
4
|
+
title: "Edit Return Reason"
|
5
|
+
cancel: "Cancel"
|
6
|
+
submit: "Update Return Reason"
|
7
|
+
hints:
|
8
|
+
active: "When checked, this return reason will be available for selection when returning orders."
|
@@ -1,28 +1,44 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::ReturnReasons::Index::Component < SolidusAdmin::
|
4
|
-
|
3
|
+
class SolidusAdmin::ReturnReasons::Index::Component < SolidusAdmin::RefundsAndReturns::Component
|
4
|
+
def model_class
|
5
|
+
Spree::ReturnReason
|
6
|
+
end
|
7
|
+
|
8
|
+
def search_url
|
9
|
+
solidus_admin.return_reasons_path
|
10
|
+
end
|
5
11
|
|
6
|
-
def
|
7
|
-
|
12
|
+
def search_key
|
13
|
+
:name_cont
|
8
14
|
end
|
9
15
|
|
10
|
-
def
|
11
|
-
|
16
|
+
def row_url(return_reason)
|
17
|
+
spree.edit_admin_return_reason_path(return_reason, _turbo_frame: :edit_return_reason_modal)
|
12
18
|
end
|
13
19
|
|
14
|
-
def
|
15
|
-
|
20
|
+
def turbo_frames
|
21
|
+
%w[
|
22
|
+
new_return_reason_modal
|
23
|
+
edit_return_reason_modal
|
24
|
+
]
|
16
25
|
end
|
17
26
|
|
18
|
-
def
|
19
|
-
|
27
|
+
def page_actions
|
28
|
+
render component("ui/button").new(
|
29
|
+
tag: :a,
|
30
|
+
text: t('.add'),
|
31
|
+
href: solidus_admin.new_return_reason_path,
|
32
|
+
data: { turbo_frame: :new_return_reason_modal },
|
33
|
+
icon: "add-line",
|
34
|
+
class: "align-self-end w-full",
|
35
|
+
)
|
20
36
|
end
|
21
37
|
|
22
38
|
def batch_actions
|
23
39
|
[
|
24
40
|
{
|
25
|
-
|
41
|
+
label: t('.batch_actions.delete'),
|
26
42
|
action: solidus_admin.return_reasons_path,
|
27
43
|
method: :delete,
|
28
44
|
icon: 'delete-bin-7-line',
|
@@ -30,14 +46,6 @@ class SolidusAdmin::ReturnReasons::Index::Component < SolidusAdmin::BaseComponen
|
|
30
46
|
]
|
31
47
|
end
|
32
48
|
|
33
|
-
def scopes
|
34
|
-
[]
|
35
|
-
end
|
36
|
-
|
37
|
-
def filters
|
38
|
-
[]
|
39
|
-
end
|
40
|
-
|
41
49
|
def columns
|
42
50
|
[
|
43
51
|
:name,
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= turbo_frame_tag :new_return_reason_modal do %>
|
2
|
+
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
+
<%= form_for @return_reason, url: solidus_admin.return_reasons_path, 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
|
+
<label class="flex gap-2 items-center">
|
7
|
+
<%= hidden_field_tag "#{f.object_name}[active]", "0" %>
|
8
|
+
<%= render component("ui/forms/checkbox").new(
|
9
|
+
name: "#{f.object_name}[active]",
|
10
|
+
value: "1",
|
11
|
+
checked: f.object.active
|
12
|
+
) %>
|
13
|
+
<span class="font-semibold text-xs ml-2"><%= Spree::ReturnReason.human_attribute_name :active %></span>
|
14
|
+
<%= render component("ui/toggletip").new(text: t(".hints.active")) %>
|
15
|
+
</label>
|
16
|
+
</div>
|
17
|
+
<% modal.with_actions do %>
|
18
|
+
<form method="dialog">
|
19
|
+
<%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %>
|
20
|
+
</form>
|
21
|
+
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<%= render component("return_reasons/index").new(page: @page) %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SolidusAdmin::ReturnReasons::New::Component < SolidusAdmin::BaseComponent
|
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
|
12
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Add your component translations here.
|
2
|
+
# Use the translation in the example in your template with `t(".hello")`.
|
3
|
+
en:
|
4
|
+
title: "New Return Reason"
|
5
|
+
cancel: "Cancel"
|
6
|
+
submit: "Add Return Reason"
|
7
|
+
hints:
|
8
|
+
active: "When checked, this return reason will be available for selection when returning orders."
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<%= turbo_frame_tag :edit_role_modal do %>
|
2
|
+
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
+
<%= form_for @role, url: solidus_admin.role_path(@role), 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, :description) %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<% if permission_set_options.present? %>
|
10
|
+
<h3 class="text-l py-4 font-semibold text-gray-900">
|
11
|
+
<%= t(".choose_permissions") %>
|
12
|
+
</h3>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<%= render component("ui/checkbox_row").new(options: permission_set_options[:order], row_title: t('.orders'), form: f, method: :permission_set_ids) %>
|
16
|
+
<%= render component("ui/checkbox_row").new(options: permission_set_options[:product], row_title: t('.products'), form: f, method: :permission_set_ids) %>
|
17
|
+
<%= render component("ui/checkbox_row").new(options: permission_set_options[:stock], row_title: t('.stock'), form: f, method: :permission_set_ids) %>
|
18
|
+
<%= render component("ui/checkbox_row").new(options: permission_set_options[:user], row_title: t('.customers'), form: f, method: :permission_set_ids) %>
|
19
|
+
<%= render component("ui/checkbox_row").new(options: permission_set_options[:restricted_stock], row_title: t('.restricted_stock'), form: f, method: :permission_set_ids) %>
|
20
|
+
<%= render component("ui/checkbox_row").new(options: permission_set_options[:configuration], row_title: t('.settings'), form: f, method: :permission_set_ids) %>
|
21
|
+
<%= render component("ui/checkbox_row").new(options: permission_set_options[:other], row_title: t('.other'), form: f, method: :permission_set_ids, layout: :subsection) %>
|
22
|
+
|
23
|
+
<% modal.with_actions do %>
|
24
|
+
<form method="dialog">
|
25
|
+
<%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %>
|
26
|
+
</form>
|
27
|
+
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
|
28
|
+
<% end %>
|
29
|
+
<% end %>
|
30
|
+
<% end %>
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
<%= render component("roles/index").new(page: @page) %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SolidusAdmin::Roles::Edit::Component < SolidusAdmin::BaseComponent
|
4
|
+
include SolidusAdmin::PermissionSetsHelper
|
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
|
+
private
|
16
|
+
|
17
|
+
def permission_set_options
|
18
|
+
@permission_set_options ||= organize_permissions(permission_sets: Spree::PermissionSet.all, view_label: t(".view"), edit_label: t(".edit"))
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Add your component translations here.
|
2
|
+
# Use the translation in the example in your template with `t(".hello")`.
|
3
|
+
en:
|
4
|
+
title: "Edit Role"
|
5
|
+
cancel: "Cancel"
|
6
|
+
submit: "Update Role"
|
7
|
+
edit: "Edit"
|
8
|
+
view: "View"
|
9
|
+
name_placeholder: "Enter a clear role name"
|
10
|
+
description_placeholder: "Enter a brief description"
|
11
|
+
choose_permissions: "Choose permissions"
|
12
|
+
orders: "Orders"
|
13
|
+
products: "Products"
|
14
|
+
stock: "Stock"
|
15
|
+
restricted_stock: "Restricted Stock"
|
16
|
+
customers: "Customers"
|
17
|
+
promotions: "Promotions"
|
18
|
+
settings: "Settings"
|
19
|
+
other: "Other permissions"
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SolidusAdmin::Roles::Index::Component < SolidusAdmin::UsersAndRoles::Component
|
4
|
+
def model_class
|
5
|
+
Spree::Role
|
6
|
+
end
|
7
|
+
|
8
|
+
def search_key
|
9
|
+
:name_cont
|
10
|
+
end
|
11
|
+
|
12
|
+
def search_url
|
13
|
+
solidus_admin.roles_path
|
14
|
+
end
|
15
|
+
|
16
|
+
def row_url(role)
|
17
|
+
solidus_admin.edit_role_path(role, _turbo_frame: :edit_role_modal)
|
18
|
+
end
|
19
|
+
|
20
|
+
def page_actions
|
21
|
+
render component("ui/button").new(
|
22
|
+
tag: :a,
|
23
|
+
text: t('.add'),
|
24
|
+
href: solidus_admin.new_role_path, data: { turbo_frame: :new_role_modal },
|
25
|
+
icon: "add-line",
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def turbo_frames
|
30
|
+
%w[
|
31
|
+
new_role_modal
|
32
|
+
edit_role_modal
|
33
|
+
]
|
34
|
+
end
|
35
|
+
|
36
|
+
def batch_actions
|
37
|
+
[
|
38
|
+
{
|
39
|
+
label: t('.batch_actions.delete'),
|
40
|
+
action: solidus_admin.roles_path,
|
41
|
+
method: :delete,
|
42
|
+
icon: 'delete-bin-7-line',
|
43
|
+
},
|
44
|
+
]
|
45
|
+
end
|
46
|
+
|
47
|
+
def scopes
|
48
|
+
[
|
49
|
+
{ name: :all, label: t('.scopes.all'), default: true },
|
50
|
+
{ name: :admin, label: t('.scopes.admin') },
|
51
|
+
]
|
52
|
+
end
|
53
|
+
|
54
|
+
def filters
|
55
|
+
[]
|
56
|
+
end
|
57
|
+
|
58
|
+
def columns
|
59
|
+
[
|
60
|
+
{
|
61
|
+
header: :role,
|
62
|
+
data: :name,
|
63
|
+
},
|
64
|
+
{
|
65
|
+
header: :description,
|
66
|
+
data: :description,
|
67
|
+
}
|
68
|
+
]
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<%= turbo_frame_tag :new_role_modal do %>
|
2
|
+
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
+
<%= form_for @role, url: solidus_admin.roles_path, 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", placeholder: t(".name_placeholder")) %>
|
6
|
+
<%= render component("ui/forms/field").text_field(f, :description, placeholder: t(".description_placeholder")) %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<% if permission_set_options.present? %>
|
10
|
+
<h3 class="text-l py-4 font-semibold text-gray-900">
|
11
|
+
<%= t(".choose_permissions") %>
|
12
|
+
</h3>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<%= render component("ui/checkbox_row").new(options: permission_set_options[:order], row_title: t('.orders'), form: f, method: :permission_set_ids) %>
|
16
|
+
<%= render component("ui/checkbox_row").new(options: permission_set_options[:product], row_title: t('.products'), form: f, method: :permission_set_ids) %>
|
17
|
+
<%= render component("ui/checkbox_row").new(options: permission_set_options[:stock], row_title: t('.stock'), form: f, method: :permission_set_ids) %>
|
18
|
+
<%= render component("ui/checkbox_row").new(options: permission_set_options[:user], row_title: t('.customers'), form: f, method: :permission_set_ids) %>
|
19
|
+
<%= render component("ui/checkbox_row").new(options: permission_set_options[:restricted_stock], row_title: t('.restricted_stock'), form: f, method: :permission_set_ids) %>
|
20
|
+
<%= render component("ui/checkbox_row").new(options: permission_set_options[:configuration], row_title: t('.settings'), form: f, method: :permission_set_ids) %>
|
21
|
+
<%= render component("ui/checkbox_row").new(options: permission_set_options[:other], row_title: t('.other'), form: f, method: :permission_set_ids, layout: :subsection) %>
|
22
|
+
|
23
|
+
<% modal.with_actions do %>
|
24
|
+
<form method="dialog">
|
25
|
+
<%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %>
|
26
|
+
</form>
|
27
|
+
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
|
28
|
+
<% end %>
|
29
|
+
<% end %>
|
30
|
+
<% end %>
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
<%= render component("roles/index").new(page: @page) %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SolidusAdmin::Roles::New::Component < SolidusAdmin::BaseComponent
|
4
|
+
include SolidusAdmin::PermissionSetsHelper
|
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
|
+
private
|
16
|
+
|
17
|
+
def permission_set_options
|
18
|
+
@permission_set_options ||= organize_permissions(permission_sets: Spree::PermissionSet.all, view_label: t(".view"), edit_label: t(".edit"))
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Add your component translations here.
|
2
|
+
# Use the translation in the example in your template with `t(".hello")`.
|
3
|
+
en:
|
4
|
+
title: "New Role"
|
5
|
+
cancel: "Cancel"
|
6
|
+
submit: "Add Role"
|
7
|
+
edit: "Edit"
|
8
|
+
view: "View"
|
9
|
+
name_placeholder: "Enter a clear role name"
|
10
|
+
description_placeholder: "Enter a brief description"
|
11
|
+
choose_permissions: "Choose permissions"
|
12
|
+
orders: "Orders"
|
13
|
+
products: "Products"
|
14
|
+
stock: "Stock"
|
15
|
+
restricted_stock: "Restricted Stock"
|
16
|
+
customers: "Customers"
|
17
|
+
promotions: "Promotions"
|
18
|
+
settings: "Settings"
|
19
|
+
other: "Other permissions"
|
@@ -1,18 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::Shipping::Component < SolidusAdmin::
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
class SolidusAdmin::Shipping::Component < SolidusAdmin::UI::Pages::Index::Component
|
4
|
+
def title
|
5
|
+
page_header_title safe_join([
|
6
|
+
tag.div(t(".title")),
|
7
|
+
tag.div(t(".subtitle"), class: "font-normal text-sm text-gray-500"),
|
8
|
+
])
|
9
9
|
end
|
10
10
|
|
11
11
|
def tabs
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
[
|
13
|
+
{
|
14
|
+
text: Spree::ShippingMethod.model_name.human.pluralize,
|
15
|
+
href: solidus_admin.shipping_methods_path,
|
16
|
+
current: model_class == Spree::ShippingMethod,
|
17
|
+
},
|
18
|
+
{
|
19
|
+
text: Spree::ShippingCategory.model_name.human.pluralize,
|
20
|
+
href: solidus_admin.shipping_categories_path,
|
21
|
+
current: model_class == Spree::ShippingCategory,
|
22
|
+
},
|
23
|
+
{
|
24
|
+
text: Spree::StockLocation.model_name.human.pluralize,
|
25
|
+
href: solidus_admin.stock_locations_path,
|
26
|
+
current: model_class == Spree::StockLocation,
|
27
|
+
},
|
28
|
+
]
|
17
29
|
end
|
18
30
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= turbo_frame_tag :edit_shipping_category_modal do %>
|
2
|
+
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
|
3
|
+
<%= form_for @shipping_category, url: solidus_admin.shipping_category_path(@shipping_category), 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) %>
|
6
|
+
</div>
|
7
|
+
<% modal.with_actions do %>
|
8
|
+
<form method="dialog">
|
9
|
+
<%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %>
|
10
|
+
</form>
|
11
|
+
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
<%= render component("shipping_categories/index").new(page: @page) %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SolidusAdmin::ShippingCategories::Edit::Component < SolidusAdmin::ShippingCategories::Index::Component
|
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
|
12
|
+
end
|
@@ -1,28 +1,53 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class SolidusAdmin::ShippingCategories::Index::Component < SolidusAdmin::
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
class SolidusAdmin::ShippingCategories::Index::Component < SolidusAdmin::Shipping::Component
|
4
|
+
def model_class
|
5
|
+
Spree::ShippingCategory
|
6
|
+
end
|
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
|
+
def page_actions
|
19
|
+
render component("ui/button").new(
|
20
|
+
tag: :a,
|
21
|
+
text: t('.add'),
|
22
|
+
href: solidus_admin.new_shipping_category_path, data: { turbo_frame: :new_shipping_category_modal },
|
23
|
+
icon: "add-line",
|
24
|
+
class: "align-self-end w-full",
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def turbo_frames
|
29
|
+
%w[
|
30
|
+
new_shipping_category_modal
|
31
|
+
edit_shipping_category_modal
|
32
|
+
]
|
8
33
|
end
|
9
34
|
|
10
|
-
def
|
11
|
-
|
35
|
+
def row_url(shipping_category)
|
36
|
+
spree.edit_admin_shipping_category_path(shipping_category, _turbo_frame: :edit_shipping_category_modal)
|
12
37
|
end
|
13
38
|
|
14
|
-
def
|
15
|
-
|
39
|
+
def search_key
|
40
|
+
:name_cont
|
16
41
|
end
|
17
42
|
|
18
|
-
def
|
19
|
-
solidus_admin.
|
43
|
+
def search_url
|
44
|
+
solidus_admin.shipping_categories_path
|
20
45
|
end
|
21
46
|
|
22
47
|
def batch_actions
|
23
48
|
[
|
24
49
|
{
|
25
|
-
|
50
|
+
label: t('.batch_actions.delete'),
|
26
51
|
action: solidus_admin.shipping_categories_path,
|
27
52
|
method: :delete,
|
28
53
|
icon: 'delete-bin-7-line',
|
@@ -30,14 +55,6 @@ class SolidusAdmin::ShippingCategories::Index::Component < SolidusAdmin::BaseCom
|
|
30
55
|
]
|
31
56
|
end
|
32
57
|
|
33
|
-
def scopes
|
34
|
-
[]
|
35
|
-
end
|
36
|
-
|
37
|
-
def filters
|
38
|
-
[]
|
39
|
-
end
|
40
|
-
|
41
58
|
def columns
|
42
59
|
[
|
43
60
|
:name
|