solidus_admin 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc.json +7 -0
- data/README.md +1 -1
- data/Rakefile +26 -0
- data/app/assets/builds/.keep +0 -0
- data/app/assets/builds/solidus_admin/tailwind.css +2799 -0
- data/app/assets/config/solidus_admin_manifest.js +1 -0
- data/app/assets/stylesheets/solidus_admin/application.tailwind.css +4 -0
- data/app/assets/stylesheets/solidus_admin/dark.css +12 -0
- data/app/assets/stylesheets/solidus_admin/dimmed.css +11 -0
- data/app/components/solidus_admin/adjustment_reasons/index/component.html.erb +32 -0
- data/app/components/solidus_admin/adjustment_reasons/index/component.rb +53 -0
- data/app/components/solidus_admin/adjustment_reasons/index/component.yml +4 -0
- data/app/components/solidus_admin/layout/feedback/component.html.erb +15 -0
- data/app/components/solidus_admin/layout/feedback/component.rb +4 -0
- data/app/components/solidus_admin/layout/feedback/component.yml +3 -0
- data/app/components/solidus_admin/layout/navigation/account/component.html.erb +74 -0
- data/app/components/solidus_admin/layout/navigation/account/component.js +16 -0
- data/app/components/solidus_admin/layout/navigation/account/component.rb +36 -0
- data/app/components/solidus_admin/{sidebar → layout/navigation}/component.html.erb +9 -9
- data/app/components/solidus_admin/layout/navigation/component.rb +26 -0
- data/app/components/solidus_admin/{sidebar → layout/navigation}/item/component.html.erb +5 -5
- data/app/components/solidus_admin/{sidebar → layout/navigation}/item/component.rb +2 -2
- data/app/components/solidus_admin/layout/page_helpers.rb +55 -0
- data/app/components/solidus_admin/{skip_link → layout/skip_link}/component.rb +2 -4
- data/app/components/solidus_admin/option_types/index/component.html.erb +30 -0
- data/app/components/solidus_admin/option_types/index/component.rb +57 -0
- data/app/components/solidus_admin/option_types/index/component.yml +4 -0
- data/app/components/solidus_admin/orders/cart/component.html.erb +77 -0
- data/app/components/solidus_admin/orders/cart/component.js +37 -0
- data/app/components/solidus_admin/orders/cart/component.rb +7 -0
- data/app/components/solidus_admin/orders/cart/component.yml +3 -0
- data/app/components/solidus_admin/orders/cart/result/component.html.erb +26 -0
- data/app/components/solidus_admin/orders/cart/result/component.rb +11 -0
- data/app/components/solidus_admin/orders/index/component.html.erb +26 -22
- data/app/components/solidus_admin/orders/index/component.rb +80 -16
- data/app/components/solidus_admin/orders/index/component.yml +10 -3
- data/app/components/solidus_admin/orders/show/address/component.html.erb +67 -0
- data/app/components/solidus_admin/orders/show/address/component.js +9 -0
- data/app/components/solidus_admin/orders/show/address/component.rb +53 -0
- data/app/components/solidus_admin/orders/show/address/component.yml +14 -0
- data/app/components/solidus_admin/orders/show/component.html.erb +76 -0
- data/app/components/solidus_admin/orders/show/component.js +7 -0
- data/app/components/solidus_admin/orders/show/component.rb +40 -0
- data/app/components/solidus_admin/orders/show/component.yml +21 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.html.erb +14 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.js +14 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.rb +7 -0
- data/app/components/solidus_admin/orders/show/customer_search/component.yml +2 -0
- data/app/components/solidus_admin/orders/show/customer_search/result/component.html.erb +17 -0
- data/app/components/solidus_admin/orders/show/customer_search/result/component.rb +11 -0
- data/app/components/solidus_admin/orders/show/email/component.html.erb +18 -0
- data/app/components/solidus_admin/orders/show/email/component.rb +15 -0
- data/app/components/solidus_admin/orders/show/email/component.yml +8 -0
- data/app/components/solidus_admin/orders/show/summary/component.html.erb +14 -0
- data/app/components/solidus_admin/orders/show/summary/component.rb +7 -0
- data/app/components/solidus_admin/orders/show/summary/component.yml +8 -0
- data/app/components/solidus_admin/payment_methods/index/component.html.erb +38 -0
- data/app/components/solidus_admin/payment_methods/index/component.rb +93 -0
- data/app/components/solidus_admin/payment_methods/index/component.yml +15 -0
- data/app/components/solidus_admin/products/index/component.html.erb +26 -22
- data/app/components/solidus_admin/products/index/component.rb +36 -36
- data/app/components/solidus_admin/products/index/component.yml +9 -6
- data/app/components/solidus_admin/products/show/component.html.erb +32 -38
- data/app/components/solidus_admin/products/show/component.rb +2 -0
- data/app/components/solidus_admin/products/show/component.yml +5 -5
- data/app/components/solidus_admin/products/status/component.rb +20 -18
- data/app/components/solidus_admin/products/status/component.yml +1 -0
- data/app/components/solidus_admin/products/stock/component.rb +38 -0
- data/app/components/solidus_admin/products/stock/component.yml +5 -0
- data/app/components/solidus_admin/promotion_categories/index/component.html.erb +26 -0
- data/app/components/solidus_admin/promotion_categories/index/component.rb +57 -0
- data/app/components/solidus_admin/promotion_categories/index/component.yml +4 -0
- data/app/components/solidus_admin/promotions/index/component.html.erb +34 -0
- data/app/components/solidus_admin/promotions/index/component.rb +97 -0
- data/app/components/solidus_admin/promotions/index/component.yml +14 -0
- data/app/components/solidus_admin/properties/index/component.html.erb +34 -0
- data/app/components/solidus_admin/properties/index/component.rb +65 -0
- data/app/components/solidus_admin/properties/index/component.yml +4 -0
- data/app/components/solidus_admin/refund_reasons/index/component.html.erb +31 -0
- data/app/components/solidus_admin/refund_reasons/index/component.rb +53 -0
- data/app/components/solidus_admin/refund_reasons/index/component.yml +4 -0
- data/app/components/solidus_admin/refunds_and_returns/component.html.erb +26 -0
- data/app/components/solidus_admin/refunds_and_returns/component.rb +20 -0
- data/app/components/solidus_admin/refunds_and_returns/component.yml +3 -0
- data/app/components/solidus_admin/reimbursement_types/index/component.html.erb +22 -0
- data/app/components/solidus_admin/reimbursement_types/index/component.rb +45 -0
- data/app/components/solidus_admin/reimbursement_types/index/component.yml +4 -0
- data/app/components/solidus_admin/return_reasons/index/component.html.erb +31 -0
- data/app/components/solidus_admin/return_reasons/index/component.rb +52 -0
- data/app/components/solidus_admin/return_reasons/index/component.yml +4 -0
- data/app/components/solidus_admin/shipping/component.html.erb +30 -0
- data/app/components/solidus_admin/shipping/component.rb +18 -0
- data/app/components/solidus_admin/shipping/component.yml +3 -0
- data/app/components/solidus_admin/shipping_categories/index/component.html.erb +32 -0
- data/app/components/solidus_admin/shipping_categories/index/component.rb +46 -0
- data/app/components/solidus_admin/shipping_categories/index/component.yml +4 -0
- data/app/components/solidus_admin/shipping_methods/index/component.html.erb +32 -0
- data/app/components/solidus_admin/shipping_methods/index/component.rb +61 -0
- data/app/components/solidus_admin/shipping_methods/index/component.yml +4 -0
- data/app/components/solidus_admin/stock_items/edit/component.html.erb +89 -0
- data/app/components/solidus_admin/stock_items/edit/component.js +17 -0
- data/app/components/solidus_admin/stock_items/edit/component.rb +23 -0
- data/app/components/solidus_admin/stock_items/edit/component.yml +10 -0
- data/app/components/solidus_admin/stock_items/index/component.html.erb +26 -0
- data/app/components/solidus_admin/stock_items/index/component.rb +180 -0
- data/app/components/solidus_admin/stock_items/index/component.yml +10 -0
- data/app/components/solidus_admin/stock_locations/index/component.html.erb +32 -0
- data/app/components/solidus_admin/stock_locations/index/component.rb +81 -0
- data/app/components/solidus_admin/stock_locations/index/component.yml +6 -0
- data/app/components/solidus_admin/store_credit_reasons/index/component.html.erb +31 -0
- data/app/components/solidus_admin/store_credit_reasons/index/component.rb +52 -0
- data/app/components/solidus_admin/store_credit_reasons/index/component.yml +4 -0
- data/app/components/solidus_admin/stores/index/component.html.erb +34 -0
- data/app/components/solidus_admin/stores/index/component.rb +59 -0
- data/app/components/solidus_admin/stores/index/component.yml +4 -0
- data/app/components/solidus_admin/tax_categories/index/component.html.erb +32 -0
- data/app/components/solidus_admin/tax_categories/index/component.rb +58 -0
- data/app/components/solidus_admin/tax_categories/index/component.yml +6 -0
- data/app/components/solidus_admin/tax_rates/index/component.html.erb +32 -0
- data/app/components/solidus_admin/tax_rates/index/component.rb +84 -0
- data/app/components/solidus_admin/tax_rates/index/component.yml +4 -0
- data/app/components/solidus_admin/taxes/component.html.erb +24 -0
- data/app/components/solidus_admin/taxes/component.rb +25 -0
- data/app/components/solidus_admin/taxes/component.yml +3 -0
- data/app/components/solidus_admin/taxonomies/index/component.html.erb +28 -0
- data/app/components/solidus_admin/taxonomies/index/component.rb +47 -0
- data/app/components/solidus_admin/taxonomies/index/component.yml +4 -0
- data/app/components/solidus_admin/ui/badge/component.rb +18 -8
- data/app/components/solidus_admin/ui/badge/component.yml +3 -0
- data/app/components/solidus_admin/ui/button/component.rb +32 -32
- data/app/components/solidus_admin/ui/details_list/component.html.erb +10 -0
- data/app/components/solidus_admin/ui/details_list/component.rb +7 -0
- data/app/components/solidus_admin/ui/dropdown/component.html.erb +50 -0
- data/app/components/solidus_admin/ui/dropdown/component.js +16 -0
- data/app/components/solidus_admin/ui/dropdown/component.rb +28 -0
- data/app/components/solidus_admin/ui/dropdown/component.yml +2 -0
- data/app/components/solidus_admin/ui/forms/address/component.html.erb +36 -0
- data/app/components/solidus_admin/ui/forms/address/component.js +34 -0
- data/app/components/solidus_admin/ui/forms/address/component.rb +14 -0
- data/app/components/solidus_admin/ui/forms/field/component.html.erb +5 -4
- data/app/components/solidus_admin/ui/forms/field/component.rb +53 -15
- data/app/components/solidus_admin/ui/forms/input/component.rb +11 -5
- data/app/components/solidus_admin/ui/forms/search/component.html.erb +52 -0
- data/app/components/solidus_admin/ui/forms/search/component.js +116 -0
- data/app/components/solidus_admin/ui/forms/search/component.rb +8 -0
- data/app/components/solidus_admin/ui/forms/search/component.yml +4 -0
- data/app/components/solidus_admin/ui/forms/search/result/component.rb +12 -0
- data/app/components/solidus_admin/ui/forms/search_field/component.html.erb +20 -0
- data/app/{javascript/solidus_admin/controllers/hello_controller.js → components/solidus_admin/ui/forms/search_field/component.js} +4 -2
- data/app/components/solidus_admin/ui/forms/search_field/component.rb +10 -0
- data/app/components/solidus_admin/ui/forms/search_field/component.yml +2 -0
- data/app/components/solidus_admin/ui/forms/switch/component.rb +27 -31
- data/app/components/solidus_admin/ui/forms/switch_field/component.html.erb +20 -0
- data/app/components/solidus_admin/ui/forms/switch_field/component.rb +11 -0
- data/app/components/solidus_admin/ui/icon/component.rb +4 -0
- data/app/components/solidus_admin/ui/modal/component.html.erb +37 -0
- data/app/components/solidus_admin/ui/modal/component.rb +12 -0
- data/app/components/solidus_admin/ui/modal/component.yml +2 -0
- data/app/components/solidus_admin/ui/panel/component.html.erb +26 -12
- data/app/components/solidus_admin/ui/panel/component.rb +17 -0
- data/app/components/solidus_admin/ui/panel/component.yml +1 -3
- data/app/components/solidus_admin/ui/resource_item/component.html.erb +10 -0
- data/app/components/solidus_admin/ui/resource_item/component.rb +9 -0
- data/app/components/solidus_admin/ui/tab/component.rb +9 -8
- data/app/components/solidus_admin/ui/table/component.html.erb +146 -135
- data/app/components/solidus_admin/ui/table/component.js +56 -17
- data/app/components/solidus_admin/ui/table/component.rb +94 -70
- data/app/components/solidus_admin/ui/table/component.yml +0 -1
- data/app/components/solidus_admin/ui/table/ransack_filter/component.html.erb +72 -0
- data/app/components/solidus_admin/ui/table/ransack_filter/component.js +73 -0
- data/app/components/solidus_admin/ui/table/ransack_filter/component.rb +68 -0
- data/app/components/solidus_admin/ui/table/ransack_filter/component.yml +3 -0
- data/app/components/solidus_admin/ui/table/toolbar/component.rb +21 -0
- data/app/components/solidus_admin/ui/thumbnail/component.rb +46 -0
- data/app/components/solidus_admin/ui/toast/component.html.erb +9 -5
- data/app/components/solidus_admin/ui/toast/component.js +9 -6
- data/app/components/solidus_admin/ui/toast/component.rb +2 -2
- data/app/components/solidus_admin/ui/toggletip/component.html.erb +14 -10
- data/app/components/solidus_admin/ui/toggletip/component.js +22 -4
- data/app/components/solidus_admin/ui/toggletip/component.rb +8 -85
- data/app/components/solidus_admin/users/index/component.html.erb +34 -0
- data/app/components/solidus_admin/users/index/component.rb +89 -0
- data/app/components/solidus_admin/users/index/component.yml +18 -0
- data/app/components/solidus_admin/zones/index/component.html.erb +35 -0
- data/app/components/solidus_admin/zones/index/component.rb +55 -0
- data/app/components/solidus_admin/zones/index/component.yml +4 -0
- data/app/controllers/solidus_admin/addresses_controller.rb +92 -0
- data/app/controllers/solidus_admin/adjustment_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/base_controller.rb +1 -0
- data/app/controllers/solidus_admin/controller_helpers/authorization.rb +5 -1
- data/app/controllers/solidus_admin/controller_helpers/locale.rb +2 -2
- data/app/controllers/solidus_admin/controller_helpers/search.rb +48 -0
- data/app/controllers/solidus_admin/controller_helpers/theme.rb +30 -0
- data/app/controllers/solidus_admin/countries_controller.rb +12 -0
- data/app/controllers/solidus_admin/customers_controller.rb +29 -0
- data/app/controllers/solidus_admin/line_items_controller.rb +45 -0
- data/app/controllers/solidus_admin/option_types_controller.rb +46 -0
- data/app/controllers/solidus_admin/orders_controller.rb +104 -7
- data/app/controllers/solidus_admin/payment_methods_controller.rb +52 -0
- data/app/controllers/solidus_admin/products_controller.rb +26 -17
- data/app/controllers/solidus_admin/promotion_categories_controller.rb +38 -0
- data/app/controllers/solidus_admin/promotions_controller.rb +46 -0
- data/app/controllers/solidus_admin/properties_controller.rb +33 -0
- data/app/controllers/solidus_admin/refund_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/reimbursement_types_controller.rb +31 -0
- data/app/controllers/solidus_admin/return_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/shipping_categories_controller.rb +40 -0
- data/app/controllers/solidus_admin/shipping_methods_controller.rb +40 -0
- data/app/controllers/solidus_admin/stock_items_controller.rb +67 -0
- data/app/controllers/solidus_admin/stock_locations_controller.rb +40 -0
- data/app/controllers/solidus_admin/store_credit_reasons_controller.rb +40 -0
- data/app/controllers/solidus_admin/stores_controller.rb +40 -0
- data/app/controllers/solidus_admin/tax_categories_controller.rb +40 -0
- data/app/controllers/solidus_admin/tax_rates_controller.rb +40 -0
- data/app/controllers/solidus_admin/taxonomies_controller.rb +46 -0
- data/app/controllers/solidus_admin/users_controller.rb +50 -0
- data/app/controllers/solidus_admin/zones_controller.rb +40 -0
- data/app/javascript/solidus_admin/controllers/components.js +3 -1
- data/app/javascript/solidus_admin/controllers/confirm_controller.js +21 -0
- data/app/javascript/solidus_admin/controllers/details_click_outside_controller.js +12 -0
- data/app/javascript/solidus_admin/controllers/readonly_when_submitting_controller.js +17 -0
- data/app/javascript/solidus_admin/controllers/sortable_controller.js +33 -0
- data/app/views/layouts/solidus_admin/application.html.erb +16 -10
- data/app/views/layouts/solidus_admin/preview.html.erb +0 -1
- data/app/views/solidus_admin/base/unauthorized.html.erb +4 -0
- data/config/importmap.rb +2 -0
- data/config/initializers/view_component.rb +20 -0
- data/config/locales/adjustment_reasons.en.yml +6 -0
- data/config/locales/customers.en.yml +7 -0
- data/config/locales/errors.en.yml +7 -0
- data/config/locales/line_items.en.yml +9 -0
- data/config/locales/{main_nav.en.yml → menu_item.en.yml} +8 -2
- data/config/locales/option_types.en.yml +6 -0
- data/config/locales/orders.en.yml +9 -0
- data/config/locales/payment_methods.en.yml +6 -0
- data/config/locales/promotion_categories.en.yml +6 -0
- data/config/locales/promotions.en.yml +6 -0
- data/config/locales/properties.en.yml +6 -0
- data/config/locales/refund_reasons_.en.yml +6 -0
- data/config/locales/reimbursement_types.en.yml +4 -0
- data/config/locales/return_reasons.en.yml +6 -0
- data/config/locales/shipping_categories.en.yml +6 -0
- data/config/locales/shipping_methods.en.yml +6 -0
- data/config/locales/stock_items.en.yml +4 -0
- data/config/locales/stock_locations.en.yml +6 -0
- data/config/locales/store_credit_reasons.en.yml +6 -0
- data/config/locales/stores.en.yml +6 -0
- data/config/locales/tax_categories.en.yml +6 -0
- data/config/locales/tax_rates.en.yml +6 -0
- data/config/locales/taxonomies.en.yml +6 -0
- data/config/locales/users.en.yml +6 -0
- data/config/locales/zones.en.yml +6 -0
- data/config/routes.rb +50 -3
- data/config/tailwind.config.js +119 -0
- data/docs/{customizing_main_navigation.md → customizing_menu_items.md} +2 -2
- data/docs/customizing_tailwindcss.md +57 -0
- data/docs/customizing_view_components.md +17 -38
- data/lib/generators/solidus_admin/install/install_generator.rb +13 -4
- data/lib/generators/solidus_admin/install/templates/config/initializers/{solidus_admin.rb → solidus_admin.rb.tt} +10 -14
- data/lib/solidus_admin/admin_resources.rb +23 -0
- data/lib/solidus_admin/configuration.rb +93 -67
- data/lib/solidus_admin/install_tailwindcss.rb +102 -0
- data/lib/solidus_admin/{main_nav_item.rb → menu_item.rb} +2 -2
- data/lib/solidus_admin/version.rb +1 -1
- data/lib/solidus_admin.rb +1 -2
- data/lib/tasks/tailwind.rake +10 -0
- data/solidus_admin.gemspec +3 -4
- metadata +228 -48
- data/app/assets/stylesheets/solidus_admin/application.tailwind.css.erb +0 -35
- data/app/components/solidus_admin/feedback/component.html.erb +0 -11
- data/app/components/solidus_admin/feedback/component.rb +0 -4
- data/app/components/solidus_admin/feedback/component.yml +0 -5
- data/app/components/solidus_admin/sidebar/account_nav/component.html.erb +0 -67
- data/app/components/solidus_admin/sidebar/account_nav/component.rb +0 -15
- data/app/components/solidus_admin/sidebar/component.rb +0 -21
- data/app/components/solidus_admin/ui/panel/component.js +0 -14
- data/config/solidus_admin/tailwind.config.js.erb +0 -95
- data/docs/customizing_tailwind.md +0 -78
- data/lib/solidus_admin/tailwindcss.rb +0 -58
- data/lib/tasks/tailwindcss.rake +0 -55
- /data/app/components/solidus_admin/{sidebar/account_nav → layout/navigation/account}/component.yml +0 -0
- /data/app/components/solidus_admin/{sidebar → layout/navigation}/component.js +0 -0
- /data/app/components/solidus_admin/{sidebar → layout/navigation}/component.yml +0 -0
- /data/app/components/solidus_admin/{skip_link → layout/skip_link}/component.yml +0 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= render component('ui/forms/search/result').new do %>
|
2
|
+
<% if @customer %>
|
3
|
+
<%= form_for(@order, url: solidus_admin.order_path(@order), html: {
|
4
|
+
"data-controller": "readonly-when-submitting",
|
5
|
+
class: "flex items-center",
|
6
|
+
}) do |f| %>
|
7
|
+
<%= hidden_field_tag("#{f.object_name}[user_id]", @customer.id) %>
|
8
|
+
<button type="submit" class="flex gap-2 grow items-center">
|
9
|
+
<%= render component("ui/icon").new(name: "user-line", class: 'w-5 h-5 m-2') %>
|
10
|
+
<div class="flex-col text-left">
|
11
|
+
<div class="leading-5 text-black font-semibold text-sm"><%= @name %></div>
|
12
|
+
<div class="leading-5 text-gray-500 font-normal text-sm"><%= @customer.email %></div>
|
13
|
+
</div>
|
14
|
+
</button>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SolidusAdmin::Orders::Show::CustomerSearch::Result::Component < SolidusAdmin::BaseComponent
|
4
|
+
with_collection_parameter :customer
|
5
|
+
|
6
|
+
def initialize(order:, customer:)
|
7
|
+
@order = order
|
8
|
+
@customer = customer
|
9
|
+
@name = (customer.default_user_bill_address || customer.default_user_ship_address)&.address&.name if customer
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<div class="<%= stimulus_id %>">
|
2
|
+
<%= render component("orders/show").new(order: @order) %>
|
3
|
+
<%= render component("ui/modal").new(title: t(".title"), close_path: close_path) do |modal| %>
|
4
|
+
<%= form_for @order, url: close_path, html: { id: form_id} do |f| %>
|
5
|
+
<%= render component("ui/forms/field").text_field(f, :email) %>
|
6
|
+
<label class="font-normal text-sm mt-4 block">
|
7
|
+
<%= t('.guest_checkout') %>:
|
8
|
+
<output class="font-semibold text-sm"><%= @order.user ? t('.no') : t('.yes') %></output>
|
9
|
+
<%= render component('ui/toggletip').new(text: t('.guest_checkout_tip'), class: "align-middle") %>
|
10
|
+
</label>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<% modal.with_actions do %>
|
14
|
+
<%= render component("ui/button").new(tag: :a, scheme: :secondary, href: close_path, type: :submit, text: t('.cancel')) %>
|
15
|
+
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %>
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
18
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SolidusAdmin::Orders::Show::Email::Component < SolidusAdmin::BaseComponent
|
4
|
+
def initialize(order:)
|
5
|
+
@order = order
|
6
|
+
end
|
7
|
+
|
8
|
+
def form_id
|
9
|
+
dom_id(@order, "#{stimulus_id}_email_form")
|
10
|
+
end
|
11
|
+
|
12
|
+
def close_path
|
13
|
+
@close_path ||= solidus_admin.order_path(@order)
|
14
|
+
end
|
15
|
+
end
|
@@ -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,38 @@
|
|
1
|
+
<%= page do %>
|
2
|
+
<%= page_header do %>
|
3
|
+
<%= page_header_title title %>
|
4
|
+
<%= page_header_actions do %>
|
5
|
+
<%= render component("ui/button").new(
|
6
|
+
tag: :a,
|
7
|
+
text: t('.add'),
|
8
|
+
href: spree.new_admin_payment_method_path,
|
9
|
+
icon: "add-line",
|
10
|
+
) %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= render component('ui/table').new(
|
15
|
+
id: stimulus_id,
|
16
|
+
data: {
|
17
|
+
class: Spree::PaymentMethod,
|
18
|
+
rows: @page.records,
|
19
|
+
prev: prev_page_path,
|
20
|
+
next: next_page_path,
|
21
|
+
url: ->(payment_method) { spree.edit_admin_payment_method_path(payment_method) },
|
22
|
+
columns: columns,
|
23
|
+
batch_actions: batch_actions,
|
24
|
+
},
|
25
|
+
search: {
|
26
|
+
name: :q,
|
27
|
+
value: params[:q],
|
28
|
+
url: solidus_admin.payment_methods_path,
|
29
|
+
searchbar_key: :name_or_description_cont,
|
30
|
+
scopes: scopes,
|
31
|
+
filters: filters,
|
32
|
+
},
|
33
|
+
sortable: {
|
34
|
+
url: ->(payment_method) { solidus_admin.move_payment_method_path(payment_method) },
|
35
|
+
param: 'position',
|
36
|
+
},
|
37
|
+
) %>
|
38
|
+
<% end %>
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SolidusAdmin::PaymentMethods::Index::Component < SolidusAdmin::BaseComponent
|
4
|
+
include SolidusAdmin::Layout::PageHelpers
|
5
|
+
|
6
|
+
def initialize(page:)
|
7
|
+
@page = page
|
8
|
+
end
|
9
|
+
|
10
|
+
def title
|
11
|
+
Spree::PaymentMethod.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
|
+
[
|
24
|
+
{
|
25
|
+
display_name: t('.batch_actions.delete'),
|
26
|
+
action: solidus_admin.payment_methods_path,
|
27
|
+
method: :delete,
|
28
|
+
icon: 'delete-bin-7-line',
|
29
|
+
},
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
def scopes
|
34
|
+
[
|
35
|
+
{ name: :all, label: t('.scopes.all'), default: true },
|
36
|
+
{ name: :active, label: t('.scopes.active') },
|
37
|
+
{ name: :inactive, label: t('.scopes.inactive') },
|
38
|
+
{ name: :storefront, label: t('.scopes.storefront') },
|
39
|
+
{ name: :admin, label: t('.scopes.admin') },
|
40
|
+
]
|
41
|
+
end
|
42
|
+
|
43
|
+
def filters
|
44
|
+
[]
|
45
|
+
end
|
46
|
+
|
47
|
+
def columns
|
48
|
+
[
|
49
|
+
{
|
50
|
+
header: :name,
|
51
|
+
data: ->(payment_method) do
|
52
|
+
content_tag :div, payment_method.name
|
53
|
+
end
|
54
|
+
},
|
55
|
+
{
|
56
|
+
header: :type,
|
57
|
+
data: ->(payment_method) do
|
58
|
+
content_tag :div, payment_method.model_name.human
|
59
|
+
end
|
60
|
+
},
|
61
|
+
{
|
62
|
+
header: :available_to_users,
|
63
|
+
data: ->(payment_method) do
|
64
|
+
if payment_method.available_to_users?
|
65
|
+
component('ui/badge').new(name: t('.yes'), color: :green)
|
66
|
+
else
|
67
|
+
component('ui/badge').new(name: t('.no'), color: :graphite_light)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
},
|
71
|
+
{
|
72
|
+
header: :available_to_admin,
|
73
|
+
data: ->(payment_method) do
|
74
|
+
if payment_method.available_to_admin?
|
75
|
+
component('ui/badge').new(name: t('.yes'), color: :green)
|
76
|
+
else
|
77
|
+
component('ui/badge').new(name: t('.no'), color: :graphite_light)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
},
|
81
|
+
{
|
82
|
+
header: :status,
|
83
|
+
data: ->(payment_method) do
|
84
|
+
if payment_method.active?
|
85
|
+
render component('ui/badge').new(name: t('.status.active'), color: :green)
|
86
|
+
else
|
87
|
+
render component('ui/badge').new(name: t('.status.inactive'), color: :graphite_light)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
},
|
91
|
+
]
|
92
|
+
end
|
93
|
+
end
|
@@ -1,30 +1,34 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
</h1>
|
6
|
-
|
7
|
-
<div class="ml-auto flex gap-2 items-center">
|
8
|
-
<%= render component("feedback").new %>
|
1
|
+
<%= page do %>
|
2
|
+
<%= page_header do %>
|
3
|
+
<%= page_header_title title %>
|
4
|
+
<%= page_header_actions do %>
|
9
5
|
<%= render component("ui/button").new(
|
10
6
|
tag: :a,
|
11
|
-
text: t('.
|
7
|
+
text: t('.add'),
|
12
8
|
href: spree.new_admin_product_path,
|
13
9
|
icon: "add-line",
|
14
10
|
) %>
|
15
|
-
|
16
|
-
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
17
13
|
|
18
14
|
<%= render component('ui/table').new(
|
19
|
-
id:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
15
|
+
id: stimulus_id,
|
16
|
+
data: {
|
17
|
+
class: Spree::Product,
|
18
|
+
rows: @page.records,
|
19
|
+
url: ->(product) { solidus_admin.product_path(product) },
|
20
|
+
prev: prev_page_path,
|
21
|
+
next: next_page_path,
|
22
|
+
columns: columns,
|
23
|
+
batch_actions: batch_actions,
|
24
|
+
},
|
25
|
+
search: {
|
26
|
+
name: :q,
|
27
|
+
value: params[:q],
|
28
|
+
url: solidus_admin.products_path,
|
29
|
+
searchbar_key: :name_or_variants_including_master_sku_cont,
|
30
|
+
scopes: scopes,
|
31
|
+
filters: filters,
|
32
|
+
},
|
29
33
|
) %>
|
30
|
-
|
34
|
+
<% end %>
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class SolidusAdmin::Products::Index::Component < SolidusAdmin::BaseComponent
|
4
|
+
include SolidusAdmin::Layout::PageHelpers
|
5
|
+
|
4
6
|
def initialize(page:)
|
5
7
|
@page = page
|
6
8
|
end
|
@@ -9,12 +11,12 @@ class SolidusAdmin::Products::Index::Component < SolidusAdmin::BaseComponent
|
|
9
11
|
Spree::Product.model_name.human.pluralize
|
10
12
|
end
|
11
13
|
|
12
|
-
def
|
13
|
-
|
14
|
+
def prev_page_path
|
15
|
+
solidus_admin.url_for(**request.params, page: @page.number - 1, only_path: true) unless @page.first?
|
14
16
|
end
|
15
17
|
|
16
|
-
def
|
17
|
-
|
18
|
+
def next_page_path
|
19
|
+
solidus_admin.url_for(**request.params, page: @page.next_param, only_path: true) unless @page.last?
|
18
20
|
end
|
19
21
|
|
20
22
|
def batch_actions
|
@@ -40,16 +42,29 @@ class SolidusAdmin::Products::Index::Component < SolidusAdmin::BaseComponent
|
|
40
42
|
]
|
41
43
|
end
|
42
44
|
|
43
|
-
def
|
45
|
+
def scopes
|
44
46
|
[
|
45
|
-
{
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
},
|
47
|
+
{ name: :all, label: t('.scopes.all'), default: true },
|
48
|
+
{ name: :in_stock, label: t('.scopes.in_stock') },
|
49
|
+
{ name: :out_of_stock, label: t('.scopes.out_of_stock') },
|
50
|
+
{ name: :available, label: t('.scopes.available') },
|
51
|
+
{ name: :discontinued, label: t('.scopes.discontinued') },
|
52
|
+
{ name: :deleted, label: t('.scopes.deleted') },
|
50
53
|
]
|
51
54
|
end
|
52
55
|
|
56
|
+
def filters
|
57
|
+
Spree::OptionType.all.map do |option_type|
|
58
|
+
{
|
59
|
+
presentation: option_type.presentation,
|
60
|
+
combinator: 'or',
|
61
|
+
attribute: "variants_option_values",
|
62
|
+
predicate: "in",
|
63
|
+
options: option_type.option_values.pluck(:name, :id),
|
64
|
+
}
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
53
68
|
def columns
|
54
69
|
[
|
55
70
|
image_column,
|
@@ -62,16 +77,16 @@ class SolidusAdmin::Products::Index::Component < SolidusAdmin::BaseComponent
|
|
62
77
|
|
63
78
|
def image_column
|
64
79
|
{
|
65
|
-
|
66
|
-
header: tag.span('aria-label': t('.
|
80
|
+
col: { class: "w-[72px]" },
|
81
|
+
header: tag.span('aria-label': t('.image'), role: 'text'),
|
67
82
|
data: ->(product) do
|
68
83
|
image = product.gallery.images.first or return
|
69
84
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
85
|
+
render(
|
86
|
+
component('ui/thumbnail').new(
|
87
|
+
src: image.url(:small),
|
88
|
+
alt: product.name
|
89
|
+
)
|
75
90
|
)
|
76
91
|
end
|
77
92
|
}
|
@@ -81,7 +96,7 @@ class SolidusAdmin::Products::Index::Component < SolidusAdmin::BaseComponent
|
|
81
96
|
{
|
82
97
|
header: :name,
|
83
98
|
data: ->(product) do
|
84
|
-
|
99
|
+
content_tag :div, product.name
|
85
100
|
end
|
86
101
|
}
|
87
102
|
end
|
@@ -89,29 +104,14 @@ class SolidusAdmin::Products::Index::Component < SolidusAdmin::BaseComponent
|
|
89
104
|
def status_column
|
90
105
|
{
|
91
106
|
header: :status,
|
92
|
-
data: ->(product) { component('products/status').
|
107
|
+
data: ->(product) { component('products/status').from_product(product) }
|
93
108
|
}
|
94
109
|
end
|
95
110
|
|
96
111
|
def stock_column
|
97
112
|
{
|
98
113
|
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
|
114
|
+
data: ->(product) { component('products/stock').from_product(product) }
|
115
115
|
}
|
116
116
|
end
|
117
117
|
|
@@ -119,7 +119,7 @@ class SolidusAdmin::Products::Index::Component < SolidusAdmin::BaseComponent
|
|
119
119
|
{
|
120
120
|
header: :price,
|
121
121
|
data: ->(product) do
|
122
|
-
content_tag :div, product.master.display_price
|
122
|
+
content_tag :div, product.master.display_price&.to_html
|
123
123
|
end
|
124
124
|
}
|
125
125
|
end
|
@@ -1,13 +1,16 @@
|
|
1
1
|
en:
|
2
|
-
|
3
|
-
|
4
|
-
stock:
|
5
|
-
infinity: '∞'
|
6
|
-
in_stock: '%{on_hand} in stock'
|
7
|
-
for_variants: 'for %{count} variants'
|
2
|
+
image: 'Image'
|
3
|
+
add: 'Add new'
|
8
4
|
batch_actions:
|
9
5
|
delete: 'Delete'
|
10
6
|
discontinue: 'Discontinue'
|
11
7
|
activate: 'Activate'
|
12
8
|
filters:
|
13
9
|
with_deleted: Include deleted
|
10
|
+
scopes:
|
11
|
+
all: All
|
12
|
+
available: Available
|
13
|
+
discontinued: Discontinued
|
14
|
+
in_stock: In stock
|
15
|
+
out_of_stock: Out of stock
|
16
|
+
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
|