solidus_admin 0.0.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.eslintrc.json +7 -0
- data/README.md +2 -2
- data/Rakefile +26 -0
- data/app/assets/builds/.keep +0 -0
- data/app/assets/builds/solidus_admin/tailwind.css +2799 -0
- data/app/assets/config/solidus_admin_manifest.js +1 -0
- data/app/assets/stylesheets/solidus_admin/application.tailwind.css +4 -0
- data/app/assets/stylesheets/solidus_admin/dark.css +12 -0
- data/app/assets/stylesheets/solidus_admin/dimmed.css +11 -0
- data/app/components/solidus_admin/adjustment_reasons/index/component.rb +43 -0
- data/app/components/solidus_admin/base_component.rb +29 -1
- data/app/components/solidus_admin/layout/feedback/component.html.erb +15 -0
- data/app/components/solidus_admin/layout/feedback/component.rb +4 -0
- data/app/components/solidus_admin/layout/feedback/component.yml +3 -0
- data/app/components/solidus_admin/layout/navigation/account/component.html.erb +74 -0
- data/app/components/solidus_admin/layout/navigation/account/component.js +16 -0
- data/app/components/solidus_admin/layout/navigation/account/component.rb +36 -0
- data/app/components/solidus_admin/{sidebar → layout/navigation}/component.html.erb +9 -9
- data/app/components/solidus_admin/layout/navigation/component.rb +26 -0
- data/app/components/solidus_admin/{sidebar → layout/navigation}/item/component.html.erb +5 -5
- data/app/components/solidus_admin/{sidebar → layout/navigation}/item/component.rb +2 -2
- data/app/components/solidus_admin/layout/page_helpers.rb +55 -0
- data/app/components/solidus_admin/{skip_link → layout/skip_link}/component.rb +2 -4
- data/app/components/solidus_admin/option_types/index/component.rb +71 -0
- data/app/components/solidus_admin/orders/cart/component.html.erb +77 -0
- data/app/components/solidus_admin/orders/cart/component.js +37 -0
- data/app/components/solidus_admin/orders/cart/component.rb +7 -0
- data/app/components/solidus_admin/orders/cart/component.yml +3 -0
- data/app/components/solidus_admin/orders/cart/result/component.html.erb +26 -0
- data/app/components/solidus_admin/orders/cart/result/component.rb +11 -0
- data/app/components/solidus_admin/orders/index/component.rb +92 -23
- data/app/components/solidus_admin/orders/index/component.yml +10 -4
- data/app/components/solidus_admin/orders/show/address/component.html.erb +67 -0
- data/app/components/solidus_admin/orders/show/address/component.js +9 -0
- data/app/components/solidus_admin/orders/show/address/component.rb +53 -0
- data/app/components/solidus_admin/orders/show/address/component.yml +14 -0
- data/app/components/solidus_admin/orders/show/component.html.erb +76 -0
- data/app/components/solidus_admin/orders/show/component.js +7 -0
- data/app/components/solidus_admin/orders/show/component.rb +40 -0
- data/app/components/solidus_admin/orders/show/component.yml +21 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.html.erb +14 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.js +14 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.rb +7 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.yml +2 -0
- data/app/components/solidus_admin/orders/show/customer_search/result/component.html.erb +17 -0
- data/app/components/solidus_admin/orders/show/customer_search/result/component.rb +11 -0
- data/app/components/solidus_admin/orders/show/email/component.html.erb +18 -0
- data/app/components/solidus_admin/orders/show/email/component.rb +15 -0
- data/app/components/solidus_admin/orders/show/email/component.yml +8 -0
- data/app/components/solidus_admin/orders/show/summary/component.html.erb +14 -0
- data/app/components/solidus_admin/orders/show/summary/component.rb +7 -0
- data/app/components/solidus_admin/orders/show/summary/component.yml +8 -0
- data/app/components/solidus_admin/payment_methods/index/component.rb +103 -0
- data/app/components/solidus_admin/payment_methods/index/component.yml +10 -0
- data/app/components/solidus_admin/products/index/component.rb +48 -41
- data/app/components/solidus_admin/products/index/component.yml +8 -7
- data/app/components/solidus_admin/products/show/component.html.erb +32 -38
- data/app/components/solidus_admin/products/show/component.rb +2 -0
- data/app/components/solidus_admin/products/show/component.yml +5 -5
- data/app/components/solidus_admin/products/status/component.rb +20 -18
- data/app/components/solidus_admin/products/status/component.yml +1 -0
- data/app/components/solidus_admin/products/stock/component.rb +38 -0
- data/app/components/solidus_admin/products/stock/component.yml +5 -0
- data/app/components/solidus_admin/promotion_categories/index/component.rb +56 -0
- data/app/components/solidus_admin/promotions/index/component.rb +104 -0
- data/app/components/solidus_admin/promotions/index/component.yml +10 -0
- data/app/components/solidus_admin/properties/index/component.rb +64 -0
- data/app/components/solidus_admin/refund_reasons/index/component.rb +53 -0
- data/app/components/solidus_admin/refunds_and_returns/component.rb +40 -0
- data/app/components/solidus_admin/refunds_and_returns/component.yml +3 -0
- data/app/components/solidus_admin/reimbursement_types/index/component.rb +27 -0
- data/app/components/solidus_admin/return_reasons/index/component.rb +42 -0
- data/app/components/solidus_admin/shipping/component.rb +30 -0
- data/app/components/solidus_admin/shipping/component.yml +3 -0
- data/app/components/solidus_admin/shipping_categories/index/component.rb +46 -0
- data/app/components/solidus_admin/shipping_methods/index/component.rb +61 -0
- data/app/components/solidus_admin/stock_items/edit/component.html.erb +89 -0
- data/app/components/solidus_admin/stock_items/edit/component.js +17 -0
- data/app/components/solidus_admin/stock_items/edit/component.rb +23 -0
- data/app/components/solidus_admin/stock_items/edit/component.yml +10 -0
- data/app/components/solidus_admin/stock_items/index/component.rb +174 -0
- data/app/components/solidus_admin/stock_items/index/component.yml +10 -0
- data/app/components/solidus_admin/stock_locations/index/component.rb +89 -0
- data/app/components/solidus_admin/stock_locations/index/component.yml +3 -0
- data/app/components/solidus_admin/store_credit_reasons/index/component.rb +52 -0
- data/app/components/solidus_admin/stores/index/component.rb +58 -0
- data/app/components/solidus_admin/tax_categories/index/component.rb +58 -0
- data/app/components/solidus_admin/tax_rates/index/component.rb +88 -0
- data/app/components/solidus_admin/taxes/component.rb +25 -0
- data/app/components/solidus_admin/taxes/component.yml +3 -0
- data/app/components/solidus_admin/taxonomies/index/component.rb +53 -0
- data/app/components/solidus_admin/ui/badge/component.rb +18 -8
- data/app/components/solidus_admin/ui/badge/component.yml +3 -0
- data/app/components/solidus_admin/ui/button/component.rb +32 -32
- data/app/components/solidus_admin/ui/details_list/component.html.erb +10 -0
- data/app/components/solidus_admin/ui/details_list/component.rb +7 -0
- data/app/components/solidus_admin/ui/dropdown/component.html.erb +50 -0
- data/app/components/solidus_admin/ui/dropdown/component.js +16 -0
- data/app/components/solidus_admin/ui/dropdown/component.rb +28 -0
- data/app/components/solidus_admin/ui/dropdown/component.yml +2 -0
- data/app/components/solidus_admin/ui/forms/address/component.html.erb +36 -0
- data/app/components/solidus_admin/ui/forms/address/component.js +34 -0
- data/app/components/solidus_admin/ui/forms/address/component.rb +14 -0
- data/app/components/solidus_admin/ui/forms/field/component.html.erb +5 -4
- data/app/components/solidus_admin/ui/forms/field/component.rb +53 -15
- data/app/components/solidus_admin/ui/forms/input/component.rb +11 -5
- data/app/components/solidus_admin/ui/forms/search/component.html.erb +52 -0
- data/app/components/solidus_admin/ui/forms/search/component.js +116 -0
- data/app/components/solidus_admin/ui/forms/search/component.rb +8 -0
- data/app/components/solidus_admin/ui/forms/search/component.yml +4 -0
- data/app/components/solidus_admin/ui/forms/search/result/component.rb +12 -0
- data/app/components/solidus_admin/ui/forms/search_field/component.html.erb +20 -0
- data/app/{javascript/solidus_admin/controllers/hello_controller.js → components/solidus_admin/ui/forms/search_field/component.js} +4 -2
- data/app/components/solidus_admin/ui/forms/search_field/component.rb +10 -0
- data/app/components/solidus_admin/ui/forms/search_field/component.yml +2 -0
- data/app/components/solidus_admin/ui/forms/switch/component.rb +27 -31
- data/app/components/solidus_admin/ui/forms/switch_field/component.html.erb +20 -0
- data/app/components/solidus_admin/ui/forms/switch_field/component.rb +11 -0
- data/app/components/solidus_admin/ui/icon/component.rb +4 -0
- data/app/components/solidus_admin/ui/modal/component.html.erb +37 -0
- data/app/components/solidus_admin/ui/modal/component.rb +12 -0
- data/app/components/solidus_admin/ui/modal/component.yml +2 -0
- data/app/components/solidus_admin/ui/pages/index/component.html.erb +30 -0
- data/app/components/solidus_admin/ui/pages/index/component.rb +119 -0
- data/app/components/solidus_admin/ui/pages/index/component.yml +4 -0
- data/app/components/solidus_admin/ui/panel/component.html.erb +26 -12
- data/app/components/solidus_admin/ui/panel/component.rb +17 -0
- data/app/components/solidus_admin/ui/panel/component.yml +1 -3
- data/app/components/solidus_admin/ui/resource_item/component.html.erb +10 -0
- data/app/components/solidus_admin/ui/resource_item/component.rb +9 -0
- data/app/components/solidus_admin/ui/tab/component.rb +9 -8
- data/app/components/solidus_admin/ui/table/component.html.erb +147 -135
- data/app/components/solidus_admin/ui/table/component.js +56 -17
- data/app/components/solidus_admin/ui/table/component.rb +94 -70
- data/app/components/solidus_admin/ui/table/component.yml +0 -1
- data/app/components/solidus_admin/ui/table/ransack_filter/component.html.erb +72 -0
- data/app/components/solidus_admin/ui/table/ransack_filter/component.js +73 -0
- data/app/components/solidus_admin/ui/table/ransack_filter/component.rb +68 -0
- data/app/components/solidus_admin/ui/table/ransack_filter/component.yml +3 -0
- data/app/components/solidus_admin/ui/table/toolbar/component.rb +21 -0
- data/app/components/solidus_admin/ui/thumbnail/component.rb +46 -0
- data/app/components/solidus_admin/ui/toast/component.html.erb +9 -5
- data/app/components/solidus_admin/ui/toast/component.js +9 -6
- data/app/components/solidus_admin/ui/toast/component.rb +2 -2
- data/app/components/solidus_admin/ui/toggletip/component.html.erb +14 -10
- data/app/components/solidus_admin/ui/toggletip/component.js +22 -4
- data/app/components/solidus_admin/ui/toggletip/component.rb +8 -85
- data/app/components/solidus_admin/users/index/component.rb +96 -0
- data/app/components/solidus_admin/users/index/component.yml +15 -0
- data/app/components/solidus_admin/zones/index/component.rb +63 -0
- data/app/controllers/solidus_admin/addresses_controller.rb +92 -0
- data/app/controllers/solidus_admin/adjustment_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/base_controller.rb +1 -0
- data/app/controllers/solidus_admin/controller_helpers/authorization.rb +5 -1
- data/app/controllers/solidus_admin/controller_helpers/locale.rb +2 -2
- data/app/controllers/solidus_admin/controller_helpers/search.rb +48 -0
- data/app/controllers/solidus_admin/controller_helpers/theme.rb +30 -0
- data/app/controllers/solidus_admin/countries_controller.rb +12 -0
- data/app/controllers/solidus_admin/customers_controller.rb +29 -0
- data/app/controllers/solidus_admin/line_items_controller.rb +45 -0
- data/app/controllers/solidus_admin/option_types_controller.rb +46 -0
- data/app/controllers/solidus_admin/orders_controller.rb +104 -7
- data/app/controllers/solidus_admin/payment_methods_controller.rb +52 -0
- data/app/controllers/solidus_admin/products_controller.rb +26 -17
- data/app/controllers/solidus_admin/promotion_categories_controller.rb +29 -0
- data/app/controllers/solidus_admin/promotions_controller.rb +46 -0
- data/app/controllers/solidus_admin/properties_controller.rb +33 -0
- data/app/controllers/solidus_admin/refund_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/reimbursement_types_controller.rb +31 -0
- data/app/controllers/solidus_admin/return_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/shipping_categories_controller.rb +40 -0
- data/app/controllers/solidus_admin/shipping_methods_controller.rb +40 -0
- data/app/controllers/solidus_admin/stock_items_controller.rb +67 -0
- data/app/controllers/solidus_admin/stock_locations_controller.rb +40 -0
- data/app/controllers/solidus_admin/store_credit_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/stores_controller.rb +40 -0
- data/app/controllers/solidus_admin/tax_categories_controller.rb +40 -0
- data/app/controllers/solidus_admin/tax_rates_controller.rb +40 -0
- data/app/controllers/solidus_admin/taxonomies_controller.rb +46 -0
- data/app/controllers/solidus_admin/users_controller.rb +50 -0
- data/app/controllers/solidus_admin/zones_controller.rb +40 -0
- data/app/javascript/solidus_admin/controllers/components.js +3 -1
- data/app/javascript/solidus_admin/controllers/confirm_controller.js +21 -0
- data/app/javascript/solidus_admin/controllers/details_click_outside_controller.js +12 -0
- data/app/javascript/solidus_admin/controllers/readonly_when_submitting_controller.js +17 -0
- data/app/javascript/solidus_admin/controllers/sortable_controller.js +33 -0
- data/app/views/layouts/solidus_admin/application.html.erb +16 -10
- data/app/views/layouts/solidus_admin/preview.html.erb +2 -1
- data/app/views/solidus_admin/base/unauthorized.html.erb +4 -0
- data/config/importmap.rb +2 -0
- data/config/initializers/view_component.rb +20 -0
- data/config/locales/adjustment_reasons.en.yml +6 -0
- data/config/locales/customers.en.yml +7 -0
- data/config/locales/errors.en.yml +7 -0
- data/config/locales/line_items.en.yml +9 -0
- data/config/locales/{main_nav.en.yml → menu_item.en.yml} +8 -2
- data/config/locales/option_types.en.yml +6 -0
- data/config/locales/orders.en.yml +9 -0
- data/config/locales/payment_methods.en.yml +6 -0
- data/config/locales/promotion_categories.en.yml +6 -0
- data/config/locales/promotions.en.yml +6 -0
- data/config/locales/properties.en.yml +6 -0
- data/config/locales/refund_reasons_.en.yml +6 -0
- data/config/locales/reimbursement_types.en.yml +4 -0
- data/config/locales/return_reasons.en.yml +6 -0
- data/config/locales/shipping_categories.en.yml +6 -0
- data/config/locales/shipping_methods.en.yml +6 -0
- data/config/locales/stock_items.en.yml +4 -0
- data/config/locales/stock_locations.en.yml +6 -0
- data/config/locales/store_credit_reasons.en.yml +6 -0
- data/config/locales/stores.en.yml +6 -0
- data/config/locales/tax_categories.en.yml +6 -0
- data/config/locales/tax_rates.en.yml +6 -0
- data/config/locales/taxonomies.en.yml +6 -0
- data/config/locales/users.en.yml +6 -0
- data/config/locales/zones.en.yml +6 -0
- data/config/routes.rb +50 -3
- data/config/tailwind.config.js +119 -0
- data/docs/{customizing_main_navigation.md → customizing_menu_items.md} +2 -2
- data/docs/customizing_tailwindcss.md +57 -0
- data/docs/customizing_view_components.md +17 -38
- data/lib/generators/solidus_admin/install/install_generator.rb +13 -4
- data/lib/generators/solidus_admin/install/templates/config/initializers/{solidus_admin.rb → solidus_admin.rb.tt} +10 -14
- data/lib/solidus_admin/admin_resources.rb +23 -0
- data/lib/solidus_admin/configuration.rb +95 -67
- data/lib/solidus_admin/install_tailwindcss.rb +102 -0
- data/lib/solidus_admin/{main_nav_item.rb → menu_item.rb} +2 -2
- data/lib/solidus_admin/version.rb +1 -1
- data/lib/solidus_admin.rb +1 -2
- data/lib/tasks/tailwind.rake +10 -0
- data/solidus_admin.gemspec +3 -4
- metadata +193 -50
- data/app/assets/stylesheets/solidus_admin/application.tailwind.css.erb +0 -35
- data/app/components/solidus_admin/feedback/component.html.erb +0 -11
- data/app/components/solidus_admin/feedback/component.rb +0 -4
- data/app/components/solidus_admin/feedback/component.yml +0 -5
- data/app/components/solidus_admin/orders/index/component.html.erb +0 -31
- data/app/components/solidus_admin/products/index/component.html.erb +0 -30
- data/app/components/solidus_admin/sidebar/account_nav/component.html.erb +0 -67
- data/app/components/solidus_admin/sidebar/account_nav/component.rb +0 -15
- data/app/components/solidus_admin/sidebar/component.rb +0 -21
- data/app/components/solidus_admin/ui/panel/component.js +0 -14
- data/config/solidus_admin/tailwind.config.js.erb +0 -95
- data/docs/customizing_tailwind.md +0 -78
- data/lib/solidus_admin/tailwindcss.rb +0 -58
- data/lib/tasks/tailwindcss.rake +0 -55
- /data/app/components/solidus_admin/{sidebar/account_nav → layout/navigation/account}/component.yml +0 -0
- /data/app/components/solidus_admin/{sidebar → layout/navigation}/component.js +0 -0
- /data/app/components/solidus_admin/{sidebar → layout/navigation}/component.yml +0 -0
- /data/app/components/solidus_admin/{skip_link → layout/skip_link}/component.yml +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<div class="<%= stimulus_id %> w-full">
|
|
2
|
+
<%= render component('ui/panel').new(title: t('.summary')) do %>
|
|
3
|
+
<%= render component('ui/details_list').new(
|
|
4
|
+
items: [
|
|
5
|
+
{ label: t('.subtotal'), value: number_to_currency(@order.item_total), class: 'font-semibold' },
|
|
6
|
+
{ label: t('.taxes'), value: number_to_currency(@order.additional_tax_total) },
|
|
7
|
+
{ label: t('.shipping'), value: number_to_currency(@order.shipment_total) },
|
|
8
|
+
{ label: link_to(t('.add_promo_code'), '#', class: "body-link"), value: number_to_currency(@order.promo_total) },
|
|
9
|
+
{ label: link_to(t('.adjustments'), '#', class: "body-link"), value: number_to_currency(@order.adjustment_total) },
|
|
10
|
+
{ label: t('.total'), value: number_to_currency(@order.total), class: 'font-semibold' }
|
|
11
|
+
]
|
|
12
|
+
) %>
|
|
13
|
+
<% end %>
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class SolidusAdmin::PaymentMethods::Index::Component < SolidusAdmin::UI::Pages::Index::Component
|
|
4
|
+
def model_class
|
|
5
|
+
Spree::PaymentMethod
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def search_key
|
|
9
|
+
:name_or_description_cont
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def search_url
|
|
13
|
+
solidus_admin.payment_methods_path
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def row_url(payment_method)
|
|
17
|
+
spree.edit_admin_payment_method_path(payment_method)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def sortable_options
|
|
21
|
+
{
|
|
22
|
+
url: ->(payment_method) { solidus_admin.move_payment_method_path(payment_method) },
|
|
23
|
+
param: 'position',
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def page_actions
|
|
28
|
+
render component("ui/button").new(
|
|
29
|
+
tag: :a,
|
|
30
|
+
text: t('.add'),
|
|
31
|
+
href: spree.new_admin_payment_method_path,
|
|
32
|
+
icon: "add-line",
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def batch_actions
|
|
37
|
+
[
|
|
38
|
+
{
|
|
39
|
+
display_name: t('.batch_actions.delete'),
|
|
40
|
+
action: solidus_admin.payment_methods_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: :active, label: t('.scopes.active') },
|
|
51
|
+
{ name: :inactive, label: t('.scopes.inactive') },
|
|
52
|
+
{ name: :storefront, label: t('.scopes.storefront') },
|
|
53
|
+
{ name: :admin, label: t('.scopes.admin') },
|
|
54
|
+
]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def columns
|
|
58
|
+
[
|
|
59
|
+
{
|
|
60
|
+
header: :name,
|
|
61
|
+
data: ->(payment_method) do
|
|
62
|
+
content_tag :div, payment_method.name
|
|
63
|
+
end
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
header: :type,
|
|
67
|
+
data: ->(payment_method) do
|
|
68
|
+
content_tag :div, payment_method.model_name.human
|
|
69
|
+
end
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
header: :available_to_users,
|
|
73
|
+
data: ->(payment_method) do
|
|
74
|
+
if payment_method.available_to_users?
|
|
75
|
+
component('ui/badge').yes
|
|
76
|
+
else
|
|
77
|
+
component('ui/badge').no
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
header: :available_to_admin,
|
|
83
|
+
data: ->(payment_method) do
|
|
84
|
+
if payment_method.available_to_admin?
|
|
85
|
+
component('ui/badge').yes
|
|
86
|
+
else
|
|
87
|
+
component('ui/badge').no
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
header: :status,
|
|
93
|
+
data: ->(payment_method) do
|
|
94
|
+
if payment_method.active?
|
|
95
|
+
render component('ui/badge').new(name: t('.status.active'), color: :green)
|
|
96
|
+
else
|
|
97
|
+
render component('ui/badge').new(name: t('.status.inactive'), color: :graphite_light)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
},
|
|
101
|
+
]
|
|
102
|
+
end
|
|
103
|
+
end
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
class SolidusAdmin::Products::Index::Component < SolidusAdmin::
|
|
4
|
-
def
|
|
5
|
-
|
|
3
|
+
class SolidusAdmin::Products::Index::Component < SolidusAdmin::UI::Pages::Index::Component
|
|
4
|
+
def model_class
|
|
5
|
+
Spree::Product
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
def
|
|
9
|
-
|
|
8
|
+
def search_key
|
|
9
|
+
:name_or_variants_including_master_sku_cont
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
def
|
|
13
|
-
|
|
12
|
+
def search_url
|
|
13
|
+
solidus_admin.products_path
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def
|
|
17
|
-
|
|
16
|
+
def row_url(product)
|
|
17
|
+
solidus_admin.product_path(product)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def page_actions
|
|
21
|
+
render component("ui/button").new(
|
|
22
|
+
tag: :a,
|
|
23
|
+
text: t('.add'),
|
|
24
|
+
href: spree.new_admin_product_path,
|
|
25
|
+
icon: "add-line",
|
|
26
|
+
)
|
|
18
27
|
end
|
|
19
28
|
|
|
20
29
|
def batch_actions
|
|
@@ -40,16 +49,29 @@ class SolidusAdmin::Products::Index::Component < SolidusAdmin::BaseComponent
|
|
|
40
49
|
]
|
|
41
50
|
end
|
|
42
51
|
|
|
43
|
-
def
|
|
52
|
+
def scopes
|
|
44
53
|
[
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
54
|
+
{ name: :all, label: t('.scopes.all'), default: true },
|
|
55
|
+
{ name: :in_stock, label: t('.scopes.in_stock') },
|
|
56
|
+
{ name: :out_of_stock, label: t('.scopes.out_of_stock') },
|
|
57
|
+
{ name: :available, label: t('.scopes.available') },
|
|
58
|
+
{ name: :discontinued, label: t('.scopes.discontinued') },
|
|
59
|
+
{ name: :deleted, label: t('.scopes.deleted') },
|
|
50
60
|
]
|
|
51
61
|
end
|
|
52
62
|
|
|
63
|
+
def filters
|
|
64
|
+
Spree::OptionType.all.map do |option_type|
|
|
65
|
+
{
|
|
66
|
+
presentation: option_type.presentation,
|
|
67
|
+
combinator: 'or',
|
|
68
|
+
attribute: "variants_option_values",
|
|
69
|
+
predicate: "in",
|
|
70
|
+
options: option_type.option_values.pluck(:name, :id),
|
|
71
|
+
}
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
53
75
|
def columns
|
|
54
76
|
[
|
|
55
77
|
image_column,
|
|
@@ -62,16 +84,16 @@ class SolidusAdmin::Products::Index::Component < SolidusAdmin::BaseComponent
|
|
|
62
84
|
|
|
63
85
|
def image_column
|
|
64
86
|
{
|
|
65
|
-
|
|
66
|
-
header: tag.span('aria-label': t('.
|
|
87
|
+
col: { class: "w-[72px]" },
|
|
88
|
+
header: tag.span('aria-label': t('.image'), role: 'text'),
|
|
67
89
|
data: ->(product) do
|
|
68
90
|
image = product.gallery.images.first or return
|
|
69
91
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
92
|
+
render(
|
|
93
|
+
component('ui/thumbnail').new(
|
|
94
|
+
src: image.url(:small),
|
|
95
|
+
alt: product.name
|
|
96
|
+
)
|
|
75
97
|
)
|
|
76
98
|
end
|
|
77
99
|
}
|
|
@@ -81,7 +103,7 @@ class SolidusAdmin::Products::Index::Component < SolidusAdmin::BaseComponent
|
|
|
81
103
|
{
|
|
82
104
|
header: :name,
|
|
83
105
|
data: ->(product) do
|
|
84
|
-
|
|
106
|
+
content_tag :div, product.name
|
|
85
107
|
end
|
|
86
108
|
}
|
|
87
109
|
end
|
|
@@ -89,29 +111,14 @@ class SolidusAdmin::Products::Index::Component < SolidusAdmin::BaseComponent
|
|
|
89
111
|
def status_column
|
|
90
112
|
{
|
|
91
113
|
header: :status,
|
|
92
|
-
data: ->(product) { component('products/status').
|
|
114
|
+
data: ->(product) { component('products/status').from_product(product) }
|
|
93
115
|
}
|
|
94
116
|
end
|
|
95
117
|
|
|
96
118
|
def stock_column
|
|
97
119
|
{
|
|
98
120
|
header: :stock,
|
|
99
|
-
data: ->(product)
|
|
100
|
-
stock_info =
|
|
101
|
-
case (on_hand = product.total_on_hand)
|
|
102
|
-
when Float::INFINITY
|
|
103
|
-
content_tag :span, t('.stock.in_stock', on_hand: t('.stock.infinity')), class: 'text-forest'
|
|
104
|
-
when 1..Float::INFINITY
|
|
105
|
-
content_tag :span, t('.stock.in_stock', on_hand: on_hand), class: 'text-forest'
|
|
106
|
-
else
|
|
107
|
-
content_tag :span, t('.stock.in_stock', on_hand: on_hand), class: 'text-red-500'
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
variant_info =
|
|
111
|
-
t('.for_variants', count: product.variants.count)
|
|
112
|
-
|
|
113
|
-
content_tag :div, safe_join([stock_info, variant_info], ' ')
|
|
114
|
-
end
|
|
121
|
+
data: ->(product) { component('products/stock').from_product(product) }
|
|
115
122
|
}
|
|
116
123
|
end
|
|
117
124
|
|
|
@@ -119,7 +126,7 @@ class SolidusAdmin::Products::Index::Component < SolidusAdmin::BaseComponent
|
|
|
119
126
|
{
|
|
120
127
|
header: :price,
|
|
121
128
|
data: ->(product) do
|
|
122
|
-
content_tag :div, product.master.display_price
|
|
129
|
+
content_tag :div, product.master.display_price&.to_html
|
|
123
130
|
end
|
|
124
131
|
}
|
|
125
132
|
end
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
en:
|
|
2
|
-
|
|
3
|
-
add_product: 'Add Product'
|
|
4
|
-
stock:
|
|
5
|
-
infinity: '∞'
|
|
6
|
-
in_stock: '%{on_hand} in stock'
|
|
7
|
-
for_variants: 'for %{count} variants'
|
|
2
|
+
image: 'Image'
|
|
8
3
|
batch_actions:
|
|
9
|
-
delete: 'Delete'
|
|
10
4
|
discontinue: 'Discontinue'
|
|
11
5
|
activate: 'Activate'
|
|
12
6
|
filters:
|
|
13
7
|
with_deleted: Include deleted
|
|
8
|
+
scopes:
|
|
9
|
+
all: All
|
|
10
|
+
available: Available
|
|
11
|
+
discontinued: Discontinued
|
|
12
|
+
in_stock: In stock
|
|
13
|
+
out_of_stock: Out of stock
|
|
14
|
+
deleted: Deleted
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<%=
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
href: solidus_admin.products_path
|
|
9
|
-
) %>
|
|
10
|
-
<h1 class="flex items-center gap-2">
|
|
11
|
-
<span class="body-title"><%= @product.name %></span>
|
|
12
|
-
<%= render component("products/status").new(product: @product) %>
|
|
13
|
-
</h1>
|
|
14
|
-
|
|
15
|
-
<div class="ml-auto flex gap-2 items-center">
|
|
16
|
-
<%= render component("feedback").new %>
|
|
1
|
+
<%= page do %>
|
|
2
|
+
<%= page_header do %>
|
|
3
|
+
<%= page_header_back(solidus_admin.products_path) %>
|
|
4
|
+
<%= page_header_title(@product.name) do %>
|
|
5
|
+
<%= render component("products/status").from_product(@product) %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<%= page_header_actions do %>
|
|
17
8
|
<%= render component("ui/button").new(
|
|
18
9
|
tag: :a,
|
|
19
10
|
text: t(".duplicate"),
|
|
@@ -29,19 +20,19 @@
|
|
|
29
20
|
scheme: :ghost
|
|
30
21
|
) %>
|
|
31
22
|
<%= render component("ui/button").new(tag: :button, text: t(".save"), form: form_id) %>
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
<% end %>
|
|
24
|
+
<% end %>
|
|
34
25
|
|
|
35
26
|
<%= form_for @product, url: solidus_admin.product_path(@product), html: { id: form_id } do |f| %>
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
<%= page_with_sidebar do %>
|
|
28
|
+
<%= page_with_sidebar_main do %>
|
|
38
29
|
<%= render component('ui/panel').new do %>
|
|
39
30
|
<%= render component("ui/forms/field").text_field(f, :name) %>
|
|
40
31
|
<%= render component("ui/forms/field").text_field(f, :slug) %>
|
|
41
32
|
<%= render component("ui/forms/field").text_area(f, :description) %>
|
|
42
33
|
<% end %>
|
|
43
34
|
|
|
44
|
-
<%= render component('ui/panel').new(title: 'SEO'
|
|
35
|
+
<%= render component('ui/panel').new(title: 'SEO') do %>
|
|
45
36
|
<%= render component("ui/forms/field").text_field(f, :meta_title) %>
|
|
46
37
|
<%= render component("ui/forms/field").text_field(f, :meta_description) %>
|
|
47
38
|
<%= render component("ui/forms/field").text_area(f, :meta_keywords) %>
|
|
@@ -105,35 +96,38 @@
|
|
|
105
96
|
href: spree.admin_product_product_properties_path(@product)
|
|
106
97
|
) %>
|
|
107
98
|
<% end %>
|
|
108
|
-
|
|
99
|
+
<% end %>
|
|
109
100
|
|
|
110
|
-
|
|
101
|
+
<%= page_with_sidebar_aside do %>
|
|
111
102
|
<%= render component('ui/panel').new(title: "Publishing") do %>
|
|
112
|
-
<%= render component("ui/forms/field").text_field(f, :available_on,
|
|
113
|
-
<%= render component("ui/forms/field").text_field(f, :discontinue_on,
|
|
103
|
+
<%= render component("ui/forms/field").text_field(f, :available_on, hint: t(".available_on_html"), type: :date) %>
|
|
104
|
+
<%= render component("ui/forms/field").text_field(f, :discontinue_on, hint: t(".discontinue_on_html"), type: :date) %>
|
|
114
105
|
|
|
115
106
|
<label class="flex gap-2 items-center">
|
|
116
107
|
<%= render component("ui/forms/checkbox").new(
|
|
117
108
|
name: "#{f.object_name}[promotionable]",
|
|
118
109
|
checked: f.object.promotionable
|
|
119
110
|
) %>
|
|
120
|
-
<span class="
|
|
121
|
-
<%= render component("ui/toggletip").new(
|
|
122
|
-
text: t(".hints.promotionable_html"),
|
|
123
|
-
position: :left
|
|
124
|
-
) %>
|
|
111
|
+
<span class="font-normal text-xs"><%= Spree::Product.human_attribute_name :promotionable %></span>
|
|
112
|
+
<%= render component("ui/toggletip").new(text: t(".hints.promotionable_html")) %>
|
|
125
113
|
</label>
|
|
126
114
|
<% end %>
|
|
127
115
|
|
|
128
116
|
<%= render component('ui/panel').new(title: "Product organization") do %>
|
|
129
|
-
<%= render component("ui/forms/field").select(
|
|
117
|
+
<%= render component("ui/forms/field").select(
|
|
118
|
+
f,
|
|
119
|
+
:taxon_ids,
|
|
120
|
+
taxon_options,
|
|
121
|
+
multiple: true,
|
|
122
|
+
"size" => taxon_options.size, # use a string key to avoid setting the size of the component
|
|
123
|
+
) %>
|
|
130
124
|
<% end %>
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
<% end %>
|
|
126
|
+
<% end %>
|
|
133
127
|
<% end %>
|
|
134
128
|
|
|
135
|
-
|
|
136
|
-
|
|
129
|
+
<%= page_footer do %>
|
|
130
|
+
<%= page_footer_actions do %>
|
|
137
131
|
<%= form_for @product, url: solidus_admin.product_path(@product), method: :delete do %>
|
|
138
132
|
<%= render component("ui/button").new(
|
|
139
133
|
tag: :button,
|
|
@@ -143,7 +137,7 @@
|
|
|
143
137
|
"data-#{stimulus_id}-message-param": t(".delete_confirmation"),
|
|
144
138
|
) %>
|
|
145
139
|
<% end %>
|
|
146
|
-
|
|
140
|
+
<% end %>
|
|
147
141
|
<%= render component("ui/button").new(tag: :button, text: t(".save"), form: form_id) %>
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
<% end %>
|
|
143
|
+
<% end %>
|
|
@@ -9,9 +9,9 @@ en:
|
|
|
9
9
|
manage_properties: "Manage product specifications"
|
|
10
10
|
manage_stock: "Manage stock"
|
|
11
11
|
delete_confirmation: "Are you sure you want to delete this product?"
|
|
12
|
+
available_on_html: 'Product availability starts from the set date.<br> Empty date indicates no availability.'
|
|
13
|
+
discontinue_on_html: 'Product availability ends from the set date.<br> Empty date indicates continuous availability.'
|
|
12
14
|
hints:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
shipping_category_html: 'This determines what kind of shipping this product requires.<br> Default: Default'
|
|
17
|
-
tax_category_html: 'This determines what kind of taxation is applied to this product.<br> Default: %{default_tax_category}'
|
|
15
|
+
promotionable_html: Promotions can apply to this product
|
|
16
|
+
shipping_category_html: Manage Shipping in Settings
|
|
17
|
+
tax_category_html: Manage Taxes in Settings
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
class SolidusAdmin::Products::Status::Component < SolidusAdmin::BaseComponent
|
|
4
|
-
|
|
4
|
+
STATUSES = {
|
|
5
5
|
available: :green,
|
|
6
|
-
discontinued: :
|
|
6
|
+
discontinued: :yellow,
|
|
7
|
+
deleted: :red,
|
|
7
8
|
}.freeze
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
def self.from_product(product)
|
|
11
|
+
status =
|
|
12
|
+
if product.deleted?
|
|
13
|
+
:deleted
|
|
14
|
+
elsif product.discontinued?
|
|
15
|
+
:discontinued
|
|
16
|
+
else
|
|
17
|
+
:available
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
new(status: status)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def initialize(status:)
|
|
24
|
+
@status = status
|
|
12
25
|
end
|
|
13
26
|
|
|
14
27
|
def call
|
|
15
28
|
render component('ui/badge').new(
|
|
16
|
-
name: t(".#{status}"),
|
|
17
|
-
color:
|
|
29
|
+
name: t(".#{@status}"),
|
|
30
|
+
color: STATUSES.fetch(@status)
|
|
18
31
|
)
|
|
19
32
|
end
|
|
20
|
-
|
|
21
|
-
# @return [Symbol]
|
|
22
|
-
# :available when the product is available
|
|
23
|
-
# :discontinued when the product is not available
|
|
24
|
-
def status
|
|
25
|
-
if @product.available?
|
|
26
|
-
:available
|
|
27
|
-
else
|
|
28
|
-
:discontinued
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
33
|
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class SolidusAdmin::Products::Stock::Component < SolidusAdmin::BaseComponent
|
|
4
|
+
def self.from_product(product)
|
|
5
|
+
new(
|
|
6
|
+
on_hand: product.total_on_hand,
|
|
7
|
+
variants_count: product.variants.count,
|
|
8
|
+
)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.from_variant(variant)
|
|
12
|
+
new(
|
|
13
|
+
on_hand: variant.total_on_hand,
|
|
14
|
+
variants_count: nil,
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def initialize(on_hand:, variants_count:)
|
|
19
|
+
@on_hand = on_hand
|
|
20
|
+
@variants_count = variants_count
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def call
|
|
24
|
+
stock_info =
|
|
25
|
+
case @on_hand
|
|
26
|
+
when Float::INFINITY
|
|
27
|
+
tag.span t('.stock.in_stock', on_hand: t('.stock.infinity')), class: 'text-forest'
|
|
28
|
+
when 1..Float::INFINITY
|
|
29
|
+
tag.span t('.stock.in_stock', on_hand: @on_hand), class: 'text-forest'
|
|
30
|
+
else
|
|
31
|
+
tag.span t('.stock.in_stock', on_hand: @on_hand), class: 'text-red-500'
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
variant_info = t('.for_variants', count: @variants_count) if @variants_count
|
|
35
|
+
|
|
36
|
+
tag.span safe_join([stock_info, variant_info], ' ')
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class SolidusAdmin::PromotionCategories::Index::Component < SolidusAdmin::UI::Pages::Index::Component
|
|
4
|
+
def model_class
|
|
5
|
+
Spree::PromotionCategory
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def row_url(promotion_category)
|
|
9
|
+
spree.edit_admin_promotion_category_path(promotion_category)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def page_actions
|
|
13
|
+
render component("ui/button").new(
|
|
14
|
+
tag: :a,
|
|
15
|
+
text: t('.add'),
|
|
16
|
+
href: spree.new_admin_promotion_category_path,
|
|
17
|
+
icon: "add-line",
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def batch_actions
|
|
22
|
+
[
|
|
23
|
+
{
|
|
24
|
+
display_name: t('.batch_actions.delete'),
|
|
25
|
+
action: solidus_admin.promotion_categories_path,
|
|
26
|
+
method: :delete,
|
|
27
|
+
icon: 'delete-bin-7-line',
|
|
28
|
+
},
|
|
29
|
+
]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def columns
|
|
33
|
+
[
|
|
34
|
+
name_column,
|
|
35
|
+
code_column,
|
|
36
|
+
]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def name_column
|
|
40
|
+
{
|
|
41
|
+
header: :name,
|
|
42
|
+
data: ->(promotion_category) do
|
|
43
|
+
content_tag :div, promotion_category.name
|
|
44
|
+
end
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def code_column
|
|
49
|
+
{
|
|
50
|
+
header: :code,
|
|
51
|
+
data: ->(promotion_category) do
|
|
52
|
+
content_tag :div, promotion_category.code
|
|
53
|
+
end
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
end
|