spree_cm_commissioner 2.15.6 → 2.16.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/Gemfile.lock +1 -1
- data/app/controllers/spree/admin/taxon_sections_controller.rb +202 -0
- data/app/controllers/spree/admin/taxons_controller_decorator.rb +2 -0
- data/app/controllers/spree/api/v2/platform/homepage_section_relatable_options_controller.rb +15 -16
- data/app/controllers/spree/api/v2/storefront/homepage_sections_controller.rb +3 -0
- data/app/helpers/spree_cm_commissioner/admin/taxon_setting_defaults_helper.rb +13 -0
- data/app/models/concerns/spree_cm_commissioner/line_item_seat_selection.rb +2 -1
- data/app/models/concerns/spree_cm_commissioner/order_pricing_channel.rb +19 -0
- data/app/{services → models}/spree_cm_commissioner/channel_pricing/calculator.rb +10 -3
- data/app/models/spree_cm_commissioner/oauth_application_decorator.rb +1 -1
- data/app/models/spree_cm_commissioner/order_decorator.rb +1 -1
- data/app/models/spree_cm_commissioner/pricing_channel.rb +32 -0
- data/app/models/spree_cm_commissioner/taxon_decorator.rb +2 -1
- data/app/models/spree_cm_commissioner/taxon_vendor.rb +1 -1
- data/app/overrides/spree/admin/oauth_applications/_form/pricing_channel_field.html.erb.deface +1 -1
- data/app/overrides/spree/admin/taxons/_form/advanced_settings.html.erb.deface +64 -0
- data/app/overrides/spree/admin/taxons/_form/check_in_and_operator.html.erb.deface +33 -0
- data/app/overrides/spree/admin/taxons/_form/live_stock.html.erb.deface +30 -0
- data/app/queries/spree_cm_commissioner/settlement_summary_query.rb +2 -2
- data/app/services/spree_cm_commissioner/agencies/onboard.rb +76 -0
- data/app/services/spree_cm_commissioner/channel_pricing/{find_or_create_policy.rb → find_or_create_buy_policy.rb} +1 -1
- data/app/services/spree_cm_commissioner/channel_pricing/list_trip_prices.rb +49 -0
- data/app/services/spree_cm_commissioner/channel_pricing/preview_rule.rb +88 -0
- data/app/services/spree_cm_commissioner/channel_pricing/price_trip_results.rb +1 -1
- data/app/services/spree_cm_commissioner/channel_pricing/resolve.rb +1 -1
- data/app/services/spree_cm_commissioner/seats/assign_guest.rb +124 -0
- data/app/services/spree_cm_commissioner/seats/auto_assign.rb +13 -11
- data/app/services/spree_cm_commissioner/settlements/generate_entries_batch.rb +1 -1
- data/app/views/spree/admin/shared/_taxon_tabs.html.erb +8 -24
- data/app/views/spree/admin/taxon_sections/_add_modal.html.erb +38 -0
- data/app/views/spree/admin/taxon_sections/_columns.html.erb +12 -0
- data/app/views/spree/admin/taxon_sections/_delete_link.html.erb +10 -0
- data/app/views/spree/admin/taxon_sections/_hotel_picker.html.erb +26 -0
- data/app/views/spree/admin/taxon_sections/_hotels_table.html.erb +81 -0
- data/app/views/spree/admin/taxon_sections/_new_section_modal.html.erb +36 -0
- data/app/views/spree/admin/taxon_sections/_product_picker.html.erb +27 -0
- data/app/views/spree/admin/taxon_sections/_products_table.html.erb +80 -0
- data/app/views/spree/admin/taxon_sections/_section.html.erb +78 -0
- data/app/views/spree/admin/taxon_sections/index.html.erb +103 -0
- data/config/locales/en.yml +59 -0
- data/config/locales/km.yml +59 -0
- data/config/routes.rb +16 -7
- data/lib/spree_cm_commissioner/version.rb +1 -1
- metadata +25 -25
- data/app/controllers/spree/admin/classifications_controller.rb +0 -49
- data/app/controllers/spree/admin/taxon_childrens_controller.rb +0 -20
- data/app/controllers/spree/admin/taxon_vendors_controller.rb +0 -35
- data/app/models/concerns/spree_cm_commissioner/order_pricing_channel_resolver.rb +0 -67
- data/app/overrides/spree/admin/taxons/_form/background_color_and_foreground_color.html.erb.deface +0 -35
- data/app/overrides/spree/admin/taxons/_form/check_in_flows.html.erb.deface +0 -36
- data/app/overrides/spree/admin/taxons/_form/custom_redirect_url.html.erb.deface +0 -8
- data/app/overrides/spree/admin/taxons/_form/enforce_waiting_room_session.html.erb.deface +0 -10
- data/app/overrides/spree/admin/taxons/_form/hide_video_banner.html.erb.deface +0 -9
- data/app/overrides/spree/admin/taxons/_form/live_stock_window_form_date.html.erb.deface +0 -41
- data/app/overrides/spree/admin/taxons/_form/preview_checkbox.html.erb.deface +0 -11
- data/app/overrides/spree/admin/taxons/_form/show_badge_status.html.erb.deface +0 -13
- data/app/views/spree/admin/classifications/edit.html.erb +0 -58
- data/app/views/spree/admin/classifications/index.html.erb +0 -24
- data/app/views/spree/admin/classifications/new.html.erb +0 -47
- data/app/views/spree/admin/shared/_products.html.erb +0 -71
- data/app/views/spree/admin/taxon_childrens/index.html.erb +0 -34
- data/app/views/spree/admin/taxon_vendors/_form.html.erb +0 -10
- data/app/views/spree/admin/taxon_vendors/edit.html.erb +0 -24
- data/app/views/spree/admin/taxon_vendors/index.html.erb +0 -55
- data/app/views/spree/admin/taxon_vendors/new.html.erb +0 -28
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_cm_commissioner
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.16.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- You
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: spree
|
|
@@ -831,7 +831,6 @@ files:
|
|
|
831
831
|
- app/controllers/spree/admin/base_controller_decorator.rb
|
|
832
832
|
- app/controllers/spree/admin/base_import_orders_controller.rb
|
|
833
833
|
- app/controllers/spree/admin/blazer_queries_controller.rb
|
|
834
|
-
- app/controllers/spree/admin/classifications_controller.rb
|
|
835
834
|
- app/controllers/spree/admin/cms_pages_controller_decorator.rb
|
|
836
835
|
- app/controllers/spree/admin/customer_notifications_controller.rb
|
|
837
836
|
- app/controllers/spree/admin/date_price_rules_controller.rb
|
|
@@ -907,8 +906,7 @@ files:
|
|
|
907
906
|
- app/controllers/spree/admin/system/maintenance_tasks_controller.rb
|
|
908
907
|
- app/controllers/spree/admin/system/waiting_room_controller.rb
|
|
909
908
|
- app/controllers/spree/admin/system/waiting_room_sessions_controller.rb
|
|
910
|
-
- app/controllers/spree/admin/
|
|
911
|
-
- app/controllers/spree/admin/taxon_vendors_controller.rb
|
|
909
|
+
- app/controllers/spree/admin/taxon_sections_controller.rb
|
|
912
910
|
- app/controllers/spree/admin/taxons_controller_decorator.rb
|
|
913
911
|
- app/controllers/spree/admin/telegram_bots_controller.rb
|
|
914
912
|
- app/controllers/spree/admin/tenant_vendors_controller.rb
|
|
@@ -1237,6 +1235,7 @@ files:
|
|
|
1237
1235
|
- app/helpers/spree_cm_commissioner/admin/product_setting_defaults_helper.rb
|
|
1238
1236
|
- app/helpers/spree_cm_commissioner/admin/rates_availabilities_helper.rb
|
|
1239
1237
|
- app/helpers/spree_cm_commissioner/admin/service_calendars_helper.rb
|
|
1238
|
+
- app/helpers/spree_cm_commissioner/admin/taxon_setting_defaults_helper.rb
|
|
1240
1239
|
- app/helpers/spree_cm_commissioner/admin/ticket_transfers_helper.rb
|
|
1241
1240
|
- app/helpers/spree_cm_commissioner/admin/video_on_demand_helper.rb
|
|
1242
1241
|
- app/helpers/spree_cm_commissioner/external_integrations_helper.rb
|
|
@@ -1526,7 +1525,7 @@ files:
|
|
|
1526
1525
|
- app/models/concerns/spree_cm_commissioner/order_holdable.rb
|
|
1527
1526
|
- app/models/concerns/spree_cm_commissioner/order_integration.rb
|
|
1528
1527
|
- app/models/concerns/spree_cm_commissioner/order_prepaid_payment.rb
|
|
1529
|
-
- app/models/concerns/spree_cm_commissioner/
|
|
1528
|
+
- app/models/concerns/spree_cm_commissioner/order_pricing_channel.rb
|
|
1530
1529
|
- app/models/concerns/spree_cm_commissioner/order_qr_codeable.rb
|
|
1531
1530
|
- app/models/concerns/spree_cm_commissioner/order_scopes.rb
|
|
1532
1531
|
- app/models/concerns/spree_cm_commissioner/order_seat_auto_assignable.rb
|
|
@@ -1599,6 +1598,7 @@ files:
|
|
|
1599
1598
|
- app/models/spree_cm_commissioner/calculators/service_fee_percent.rb
|
|
1600
1599
|
- app/models/spree_cm_commissioner/channel_price_policy.rb
|
|
1601
1600
|
- app/models/spree_cm_commissioner/channel_price_rule.rb
|
|
1601
|
+
- app/models/spree_cm_commissioner/channel_pricing/calculator.rb
|
|
1602
1602
|
- app/models/spree_cm_commissioner/check_in.rb
|
|
1603
1603
|
- app/models/spree_cm_commissioner/check_in_ability.rb
|
|
1604
1604
|
- app/models/spree_cm_commissioner/check_in_record.rb
|
|
@@ -1733,6 +1733,7 @@ files:
|
|
|
1733
1733
|
- app/models/spree_cm_commissioner/pricing_actions/create_guest_adjustments.rb
|
|
1734
1734
|
- app/models/spree_cm_commissioner/pricing_actions/create_line_item_adjustments.rb
|
|
1735
1735
|
- app/models/spree_cm_commissioner/pricing_actions/create_route_adjustments.rb
|
|
1736
|
+
- app/models/spree_cm_commissioner/pricing_channel.rb
|
|
1736
1737
|
- app/models/spree_cm_commissioner/pricing_model.rb
|
|
1737
1738
|
- app/models/spree_cm_commissioner/pricing_model_route.rb
|
|
1738
1739
|
- app/models/spree_cm_commissioner/pricing_model_variant.rb
|
|
@@ -2035,18 +2036,13 @@ files:
|
|
|
2035
2036
|
- app/overrides/spree/admin/stores/_form/telegram_auth.html.erb.deface
|
|
2036
2037
|
- app/overrides/spree/admin/stores/form/_layout/default_notification_image.html.erb.deface
|
|
2037
2038
|
- app/overrides/spree/admin/taxonomies/_form/kind.html.erb.deface
|
|
2039
|
+
- app/overrides/spree/admin/taxons/_form/advanced_settings.html.erb.deface
|
|
2038
2040
|
- app/overrides/spree/admin/taxons/_form/assets_form.html.erb.deface
|
|
2039
2041
|
- app/overrides/spree/admin/taxons/_form/available_on.html.erb.deface
|
|
2040
|
-
- app/overrides/spree/admin/taxons/_form/
|
|
2041
|
-
- app/overrides/spree/admin/taxons/_form/check_in_flows.html.erb.deface
|
|
2042
|
-
- app/overrides/spree/admin/taxons/_form/custom_redirect_url.html.erb.deface
|
|
2043
|
-
- app/overrides/spree/admin/taxons/_form/enforce_waiting_room_session.html.erb.deface
|
|
2044
|
-
- app/overrides/spree/admin/taxons/_form/hide_video_banner.html.erb.deface
|
|
2042
|
+
- app/overrides/spree/admin/taxons/_form/check_in_and_operator.html.erb.deface
|
|
2045
2043
|
- app/overrides/spree/admin/taxons/_form/kind_html.erb.deface
|
|
2046
|
-
- app/overrides/spree/admin/taxons/_form/
|
|
2047
|
-
- app/overrides/spree/admin/taxons/_form/preview_checkbox.html.erb.deface
|
|
2044
|
+
- app/overrides/spree/admin/taxons/_form/live_stock.html.erb.deface
|
|
2048
2045
|
- app/overrides/spree/admin/taxons/_form/purchasable_on_status.html.erb.deface
|
|
2049
|
-
- app/overrides/spree/admin/taxons/_form/show_badge_status.html.erb.deface
|
|
2050
2046
|
- app/overrides/spree/admin/taxons/_form/sub_title.html.erb.deface
|
|
2051
2047
|
- app/overrides/spree/admin/taxons/_form/to_date_form_date.html.erb.deface
|
|
2052
2048
|
- app/overrides/spree/admin/taxons/_form/vendor.html.erb.deface
|
|
@@ -2370,6 +2366,7 @@ files:
|
|
|
2370
2366
|
- app/services/sms_adapter/plasgate.rb
|
|
2371
2367
|
- app/services/sms_adapter/twillio.rb
|
|
2372
2368
|
- app/services/spree_cm_commissioner/aes_encryption_service.rb
|
|
2369
|
+
- app/services/spree_cm_commissioner/agencies/onboard.rb
|
|
2373
2370
|
- app/services/spree_cm_commissioner/agency_categories/create.rb
|
|
2374
2371
|
- app/services/spree_cm_commissioner/agency_users/add.rb
|
|
2375
2372
|
- app/services/spree_cm_commissioner/agency_users/create.rb
|
|
@@ -2391,10 +2388,11 @@ files:
|
|
|
2391
2388
|
- app/services/spree_cm_commissioner/cart/remove_item_decorator.rb
|
|
2392
2389
|
- app/services/spree_cm_commissioner/cart/remove_line_item_decorator.rb
|
|
2393
2390
|
- app/services/spree_cm_commissioner/cart/set_quantity_decorator.rb
|
|
2394
|
-
- app/services/spree_cm_commissioner/channel_pricing/calculator.rb
|
|
2395
2391
|
- app/services/spree_cm_commissioner/channel_pricing/create.rb
|
|
2396
2392
|
- app/services/spree_cm_commissioner/channel_pricing/find_buy_policy.rb
|
|
2397
|
-
- app/services/spree_cm_commissioner/channel_pricing/
|
|
2393
|
+
- app/services/spree_cm_commissioner/channel_pricing/find_or_create_buy_policy.rb
|
|
2394
|
+
- app/services/spree_cm_commissioner/channel_pricing/list_trip_prices.rb
|
|
2395
|
+
- app/services/spree_cm_commissioner/channel_pricing/preview_rule.rb
|
|
2398
2396
|
- app/services/spree_cm_commissioner/channel_pricing/price_trip_results.rb
|
|
2399
2397
|
- app/services/spree_cm_commissioner/channel_pricing/resolve.rb
|
|
2400
2398
|
- app/services/spree_cm_commissioner/channel_pricing/save_agreement.rb
|
|
@@ -2732,6 +2730,7 @@ files:
|
|
|
2732
2730
|
- app/services/spree_cm_commissioner/seat_layouts/save_seat_order.rb
|
|
2733
2731
|
- app/services/spree_cm_commissioner/seat_layouts/update.rb
|
|
2734
2732
|
- app/services/spree_cm_commissioner/seats/apply_locks.rb
|
|
2733
|
+
- app/services/spree_cm_commissioner/seats/assign_guest.rb
|
|
2735
2734
|
- app/services/spree_cm_commissioner/seats/auto_assign.rb
|
|
2736
2735
|
- app/services/spree_cm_commissioner/seats/block_date_iteration.rb
|
|
2737
2736
|
- app/services/spree_cm_commissioner/seats/block_history.rb
|
|
@@ -2871,9 +2870,6 @@ files:
|
|
|
2871
2870
|
- app/views/spree/admin/blazer_queries/edit.html.erb
|
|
2872
2871
|
- app/views/spree/admin/blazer_queries/index.html.erb
|
|
2873
2872
|
- app/views/spree/admin/blazer_queries/new.html.erb
|
|
2874
|
-
- app/views/spree/admin/classifications/edit.html.erb
|
|
2875
|
-
- app/views/spree/admin/classifications/index.html.erb
|
|
2876
|
-
- app/views/spree/admin/classifications/new.html.erb
|
|
2877
2873
|
- app/views/spree/admin/cm_imports/index.html.erb
|
|
2878
2874
|
- app/views/spree/admin/customer_notifications/_form.html.erb
|
|
2879
2875
|
- app/views/spree/admin/customer_notifications/edit.html.erb
|
|
@@ -3094,7 +3090,6 @@ files:
|
|
|
3094
3090
|
- app/views/spree/admin/shared/_import_order_tabs.html.erb
|
|
3095
3091
|
- app/views/spree/admin/shared/_product_places_sidebar_tabs.html.erb
|
|
3096
3092
|
- app/views/spree/admin/shared/_product_places_sub_tabs.html.erb
|
|
3097
|
-
- app/views/spree/admin/shared/_products.html.erb
|
|
3098
3093
|
- app/views/spree/admin/shared/_reschedule_policies_tabs.html.erb
|
|
3099
3094
|
- app/views/spree/admin/shared/_send_all_form.html.erb
|
|
3100
3095
|
- app/views/spree/admin/shared/_send_test_form.html.erb
|
|
@@ -3137,11 +3132,16 @@ files:
|
|
|
3137
3132
|
- app/views/spree/admin/system/waiting_room_sessions/_tabs.html.erb
|
|
3138
3133
|
- app/views/spree/admin/system/waiting_room_sessions/guests.html.erb
|
|
3139
3134
|
- app/views/spree/admin/system/waiting_room_sessions/index.html.erb
|
|
3140
|
-
- app/views/spree/admin/
|
|
3141
|
-
- app/views/spree/admin/
|
|
3142
|
-
- app/views/spree/admin/
|
|
3143
|
-
- app/views/spree/admin/
|
|
3144
|
-
- app/views/spree/admin/
|
|
3135
|
+
- app/views/spree/admin/taxon_sections/_add_modal.html.erb
|
|
3136
|
+
- app/views/spree/admin/taxon_sections/_columns.html.erb
|
|
3137
|
+
- app/views/spree/admin/taxon_sections/_delete_link.html.erb
|
|
3138
|
+
- app/views/spree/admin/taxon_sections/_hotel_picker.html.erb
|
|
3139
|
+
- app/views/spree/admin/taxon_sections/_hotels_table.html.erb
|
|
3140
|
+
- app/views/spree/admin/taxon_sections/_new_section_modal.html.erb
|
|
3141
|
+
- app/views/spree/admin/taxon_sections/_product_picker.html.erb
|
|
3142
|
+
- app/views/spree/admin/taxon_sections/_products_table.html.erb
|
|
3143
|
+
- app/views/spree/admin/taxon_sections/_section.html.erb
|
|
3144
|
+
- app/views/spree/admin/taxon_sections/index.html.erb
|
|
3145
3145
|
- app/views/spree/admin/telegram_bots/_form.html.erb
|
|
3146
3146
|
- app/views/spree/admin/telegram_bots/edit.html.erb
|
|
3147
3147
|
- app/views/spree/admin/telegram_bots/index.html.erb
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Admin
|
|
3
|
-
class ClassificationsController < Spree::Admin::ResourceController
|
|
4
|
-
before_action :load_taxon_and_products
|
|
5
|
-
|
|
6
|
-
def recalculate_conversions
|
|
7
|
-
if @taxon.parent.event?
|
|
8
|
-
SpreeCmCommissioner::MaintenanceTasks::Event.pending.create_or_find_by(
|
|
9
|
-
maintainable_type: 'Spree::Taxon',
|
|
10
|
-
maintainable_id: @taxon.parent.id
|
|
11
|
-
) do |task|
|
|
12
|
-
task.manually_triggered = true
|
|
13
|
-
end.async_execute
|
|
14
|
-
|
|
15
|
-
flash[:success] = flash_message_for(@taxon, :successfully_updated)
|
|
16
|
-
else
|
|
17
|
-
flash[:error] = 'Conversion recalculation can only be performed for taxons under an event.' # rubocop:disable Rails/I18nLocaleTexts
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
redirect_to collection_url
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
private
|
|
24
|
-
|
|
25
|
-
def edit_object_url(product, options = {})
|
|
26
|
-
classification = @taxon.classifications.find_by(product_id: product.id)
|
|
27
|
-
edit_admin_taxonomy_taxon_classification_url(taxonomy_id: @taxonomy.id, taxon_id: @taxon.id, id: classification.id, options: options)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def object_url(product, options = {})
|
|
31
|
-
classification = @taxon.classifications.find_by(product_id: product.id)
|
|
32
|
-
admin_taxonomy_taxon_classification_url(taxonomy_id: @taxonomy.id, taxon_id: @taxon.id, id: classification.id, options: options)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def load_taxon_and_products
|
|
36
|
-
@taxonomy = Spree::Taxonomy.find(params[:taxonomy_id])
|
|
37
|
-
@taxon = @taxonomy.taxons.find(params[:taxon_id])
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def model_class
|
|
41
|
-
Spree::Classification
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def collection_url
|
|
45
|
-
admin_taxonomy_taxon_classifications_url(taxonomy: @taxonomy, taxon: @taxon)
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Admin
|
|
3
|
-
class TaxonChildrensController < Spree::Admin::ResourceController
|
|
4
|
-
before_action :load_taxonomy_taxon, only: [:index]
|
|
5
|
-
|
|
6
|
-
def index; end
|
|
7
|
-
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
def model_class
|
|
11
|
-
Spree::Taxon
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def load_taxonomy_taxon
|
|
15
|
-
@taxonomy = Spree::Taxonomy.find(params[:taxonomy_id])
|
|
16
|
-
@taxon = @taxonomy.taxons.find(params[:taxon_id])
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Admin
|
|
3
|
-
class TaxonVendorsController < Spree::Admin::ResourceController
|
|
4
|
-
before_action :load_taxonomy_taxon, except: [:index]
|
|
5
|
-
|
|
6
|
-
def index
|
|
7
|
-
@taxonomy = Spree::Taxonomy.find(params[:taxonomy_id])
|
|
8
|
-
@taxon = @taxonomy.taxons.find(params[:taxon_id])
|
|
9
|
-
|
|
10
|
-
# Retrieve taxon vendors associated with the taxon, including the vendor association
|
|
11
|
-
@taxon_vendors = @taxon.taxon_vendors.includes(:vendor)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
def load_taxonomy_taxon
|
|
17
|
-
@taxonomy = Spree::Taxonomy.find(params[:taxonomy_id])
|
|
18
|
-
@taxon = @taxonomy.taxons.find(params[:taxon_id])
|
|
19
|
-
@taxon_vendors = @taxon.taxon_vendors
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def model_class
|
|
23
|
-
SpreeCmCommissioner::TaxonVendor
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def object_name
|
|
27
|
-
'spree_cm_commissioner_taxon_vendor'
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def collection_url(options = {})
|
|
31
|
-
admin_taxonomy_taxon_taxon_vendors_url(taxonomy: @taxonomy, taxon: @taxon, options: options)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
module SpreeCmCommissioner
|
|
2
|
-
module OrderPricingChannelResolver
|
|
3
|
-
extend ActiveSupport::Concern
|
|
4
|
-
|
|
5
|
-
# An order carries a `pricing_channel` string (set at state cart) that encodes
|
|
6
|
-
# both who is selling (direct vendor, BookMe+ platform, or agency) and through
|
|
7
|
-
# which surface (app, web, walk-in, web dashboard).
|
|
8
|
-
#
|
|
9
|
-
# This mapping translates that single string into two structured values:
|
|
10
|
-
# - channel_type → which price policy to look up (direct/platform/agency)
|
|
11
|
-
# - platform → which surface-specific price policy to apply
|
|
12
|
-
#
|
|
13
|
-
# ChannelPricing::Resolve reads these two values to query cm_channel_price_policies with
|
|
14
|
-
# (vendor_id + channel_type + platform) and return the correct price policy.
|
|
15
|
-
#
|
|
16
|
-
# Data Example:
|
|
17
|
-
# -- spree_orders
|
|
18
|
-
# number | pricing_channel | resolved_channel_type | resolved_platform
|
|
19
|
-
# R1001 | tenant_app | channel_direct | app
|
|
20
|
-
# R1002 | platform_app | channel_platform | app
|
|
21
|
-
# R1003 | platform_agency_web_dashboard | channel_platform_agency | web_dashboard
|
|
22
|
-
# R1004 | direct_walk_in | channel_direct | walk_in
|
|
23
|
-
# R1006 | vendor_agency_web_dashboard | channel_vendor_agency | web_dashboard
|
|
24
|
-
SOURCE_TO_CHANNEL_MAPPING = {
|
|
25
|
-
# Direct channel — the vendor sells by itself: its tenant's own app/web, or staff at the counter (dashboard)
|
|
26
|
-
'tenant_app' => { channel_type: :channel_direct, platform: :app },
|
|
27
|
-
'tenant_web' => { channel_type: :channel_direct, platform: :web },
|
|
28
|
-
'direct_walk_in' => { channel_type: :channel_direct, platform: :walk_in },
|
|
29
|
-
|
|
30
|
-
# Platform channel — BookMe+ marketplace sells on behalf of the vendor
|
|
31
|
-
'platform_app' => { channel_type: :channel_platform, platform: :app },
|
|
32
|
-
'platform_web' => { channel_type: :channel_platform, platform: :web },
|
|
33
|
-
'platform_mini_app' => { channel_type: :channel_platform, platform: :mini_app },
|
|
34
|
-
'platform_telegram' => { channel_type: :channel_platform, platform: :telegram },
|
|
35
|
-
|
|
36
|
-
# Vendor agency — vendor-contracted agency; agency knows vendor's base price
|
|
37
|
-
'vendor_agency_web_dashboard' => { channel_type: :channel_vendor_agency, platform: :web_dashboard },
|
|
38
|
-
|
|
39
|
-
# Platform agency — platform-contracted agency; agency only sees wholesale, not vendor's base
|
|
40
|
-
'platform_agency_web_dashboard' => { channel_type: :channel_platform_agency, platform: :web_dashboard }
|
|
41
|
-
}.freeze
|
|
42
|
-
|
|
43
|
-
# Looks up this order's `pricing_channel` in SOURCE_TO_CHANNEL_MAPPING and
|
|
44
|
-
# returns the :channel_type needed to find the right price policy.
|
|
45
|
-
# ChannelPricing::Resolve uses this to branch between resolve_non_agency and
|
|
46
|
-
# resolve_agency before querying cm_channel_price_policies.
|
|
47
|
-
#
|
|
48
|
-
# pricing_channel: 'platform_app' → :channel_platform
|
|
49
|
-
# pricing_channel: 'direct_walk_in' → :channel_direct
|
|
50
|
-
# pricing_channel: 'vendor_agency_web_dashboard' → :channel_vendor_agency
|
|
51
|
-
def resolved_channel_type
|
|
52
|
-
SOURCE_TO_CHANNEL_MAPPING[pricing_channel]&.fetch(:channel_type)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# Looks up this order's `pricing_channel` in SOURCE_TO_CHANNEL_MAPPING and
|
|
56
|
-
# returns the :platform needed to find the right price policy.
|
|
57
|
-
# ChannelPricing::Resolve uses this together with vendor_id + channel_type to
|
|
58
|
-
# query cm_channel_price_policies for the surface-specific price policy.
|
|
59
|
-
#
|
|
60
|
-
# pricing_channel: 'platform_app' → :app
|
|
61
|
-
# pricing_channel: 'direct_walk_in' → :walk_in
|
|
62
|
-
# pricing_channel: 'vendor_agency_web_dashboard' → :web_dashboard
|
|
63
|
-
def resolved_platform
|
|
64
|
-
SOURCE_TO_CHANNEL_MAPPING[pricing_channel]&.fetch(:platform)
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
data/app/overrides/spree/admin/taxons/_form/background_color_and_foreground_color.html.erb.deface
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<!-- insert_before "erb[loud]:contains('field_container :meta_title')" -->
|
|
2
|
-
|
|
3
|
-
<%# Sections don't use colors, so we hide the form here to avoid confusing admin. %>
|
|
4
|
-
|
|
5
|
-
<div class="row <%= "d-none" unless @taxon.depth == 1 %>">
|
|
6
|
-
<div class="col-md-6">
|
|
7
|
-
<%= f.label :background_color, Spree.t('background_color'), class: 'form-label' %>
|
|
8
|
-
<%= f.text_field :background_color, class: 'form-control color-picker', placeholder: '#FFFFFF', value: @object.background_color %>
|
|
9
|
-
<div class="color-preview" style="margin-top: 10px;">
|
|
10
|
-
<%= content_tag :div, nil, style: "background-color: #{@object.background_color}; width: 60px; height: 60px; border: 1px solid #ccc; box-sizing: border-box; display: block;" %>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
<div class="col-md-6">
|
|
14
|
-
<%= f.label :foreground_color, Spree.t('foreground_color'), class: 'form-label' %>
|
|
15
|
-
<%= f.text_field :foreground_color, class: 'form-control color-picker', placeholder: '#FFFFFF', value: @object.foreground_color %>
|
|
16
|
-
<div class="color-preview" style="margin-top: 10px;">
|
|
17
|
-
<%= content_tag :div, nil, style: "background-color: #{@object.foreground_color}; width: 60px; height: 60px; border: 1px solid #ccc; box-sizing: border-box; display: block;" %>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
<script>
|
|
23
|
-
document.addEventListener('DOMContentLoaded', function() {
|
|
24
|
-
const colorPickers = document.querySelectorAll('.color-picker');
|
|
25
|
-
|
|
26
|
-
colorPickers.forEach(picker => {
|
|
27
|
-
const colorPreview = picker.nextElementSibling;
|
|
28
|
-
|
|
29
|
-
picker.addEventListener('input', function() {
|
|
30
|
-
colorPreview.querySelector('div').style.backgroundColor = picker.value;
|
|
31
|
-
});
|
|
32
|
-
colorPreview.querySelector('div').style.backgroundColor = picker.value;
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
</script>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<!-- insert_before "erb[loud]:contains('field_container :hide_from_nav')" -->
|
|
2
|
-
|
|
3
|
-
<%# Sections don't use video banner, so we hide the form here to avoid confusing admin. %>
|
|
4
|
-
|
|
5
|
-
<%= f.field_container :group_check_in_enabled, class: ['custom-control', 'custom-checkbox', 'my-4'] do %>
|
|
6
|
-
<%= f.check_box :group_check_in_enabled, class: 'custom-control-input' %>
|
|
7
|
-
<%= f.label :group_check_in_enabled, Spree.t(:enable_group_check_in), class: 'custom-control-label' %>
|
|
8
|
-
<%= f.error_message_on :group_check_in_enabled %>
|
|
9
|
-
<small class="form-text text-muted">
|
|
10
|
-
Enabled by default for most events where users can purchase multiple tickets or use group scanning. For large events (like PSK, ASK, etc.) or invitation-based events, you should disable this to ensure each ticket or invitation is scanned individually.
|
|
11
|
-
</small>
|
|
12
|
-
<% end if @taxon.event? && @taxon.depth == 1 %> %>
|
|
13
|
-
|
|
14
|
-
<%= f.field_container :individual_check_in_enabled, class: ['custom-control', 'custom-checkbox', 'my-4'] do %>
|
|
15
|
-
<%= f.check_box :individual_check_in_enabled, class: 'custom-control-input' %>
|
|
16
|
-
<%= f.label :individual_check_in_enabled, Spree.t(:enable_individual_check_in), class: 'custom-control-label' %>
|
|
17
|
-
<%= f.error_message_on :individual_check_in_enabled %>
|
|
18
|
-
<% end if @taxon.event? && @taxon.depth == 1 %> %>
|
|
19
|
-
|
|
20
|
-
<%= f.field_container :allow_manual_search_for_operator, class: ['custom-control', 'custom-checkbox', 'my-4'] do %>
|
|
21
|
-
<%= f.check_box :allow_manual_search_for_operator, class: 'custom-control-input' %>
|
|
22
|
-
<%= f.label :allow_manual_search_for_operator, Spree.t(:allow_manual_search_for_operator), class: 'custom-control-label' %>
|
|
23
|
-
<%= f.error_message_on :allow_manual_search_for_operator %>
|
|
24
|
-
<% end if @taxon.event? && @taxon.depth == 1 %> %>
|
|
25
|
-
|
|
26
|
-
<%= f.field_container :allow_event_overview_for_operator, class: ['custom-control', 'custom-checkbox', 'my-4'] do %>
|
|
27
|
-
<%= f.check_box :allow_event_overview_for_operator, class: 'custom-control-input' %>
|
|
28
|
-
<%= f.label :allow_event_overview_for_operator, Spree.t(:allow_event_overview_for_operator), class: 'custom-control-label' %>
|
|
29
|
-
<%= f.error_message_on :allow_event_overview_for_operator %>
|
|
30
|
-
<% end if @taxon.event? && @taxon.depth == 1 %> %>
|
|
31
|
-
|
|
32
|
-
<%= f.field_container :allow_event_chart_for_operator, class: ['custom-control', 'custom-checkbox', 'my-4'] do %>
|
|
33
|
-
<%= f.check_box :allow_event_chart_for_operator, class: 'custom-control-input' %>
|
|
34
|
-
<%= f.label :allow_event_chart_for_operator, Spree.t(:allow_event_chart_for_operator), class: 'custom-control-label' %>
|
|
35
|
-
<%= f.error_message_on :allow_event_chart_for_operator %>
|
|
36
|
-
<% end if @taxon.event? && @taxon.depth == 1 %> %>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<!-- insert_after "erb[loud]:contains('field_container :permalink')" -->
|
|
2
|
-
|
|
3
|
-
<%# Sections don't use custom_redirect_url, so we hide the form here to avoid confusing admin. %>
|
|
4
|
-
|
|
5
|
-
<%= f.field_container :custom_redirect_url do %>
|
|
6
|
-
<%= f.label :custom_redirect_url, Spree.t(:custom_redirect_url) %>
|
|
7
|
-
<%= f.text_field :custom_redirect_url, class: 'form-control', rows: 6 %>
|
|
8
|
-
<% end if @taxon.depth == 1 %>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<!-- insert_before "erb[loud]:contains('field_container :hide_from_nav')" -->
|
|
2
|
-
|
|
3
|
-
<%= f.field_container :enforce_waiting_room_session, class: ['custom-control', 'custom-checkbox', 'my-4'] do %>
|
|
4
|
-
<%= f.check_box :enforce_waiting_room_session, class: 'custom-control-input' %>
|
|
5
|
-
<%= f.label :enforce_waiting_room_session, Spree.t(:enforce_waiting_room_session), class: 'custom-control-label' %>
|
|
6
|
-
<%= f.error_message_on :enforce_waiting_room_session %>
|
|
7
|
-
<small class="form-text text-muted">
|
|
8
|
-
<%= Spree.t(:enforce_waiting_room_session_hint) %>
|
|
9
|
-
</small>
|
|
10
|
-
<% end if @taxon.event? && @taxon.depth == 1 %> %>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<!-- insert_before "erb[loud]:contains('field_container :hide_from_nav')" -->
|
|
2
|
-
|
|
3
|
-
<%# Sections don't use video banner, so we hide the form here to avoid confusing admin. %>
|
|
4
|
-
|
|
5
|
-
<%= f.field_container :hide_video_banner, class: ['custom-control', 'custom-checkbox', 'my-4'] do %>
|
|
6
|
-
<%= f.check_box :hide_video_banner, class: 'custom-control-input' %>
|
|
7
|
-
<%= f.label :hide_video_banner, Spree.t(:hide_video_banner), class: 'custom-control-label' %>
|
|
8
|
-
<%= f.error_message_on :hide_video_banner %>
|
|
9
|
-
<% end if @taxon.depth == 1 %> %>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<!-- insert_after "erb[loud]:contains('field_container :permalink')" -->
|
|
2
|
-
|
|
3
|
-
<%# See Spree::Taxon.live_stock_active / SpreeCmCommissioner::StockStatusPollJob — the scheduled
|
|
4
|
-
poll only publishes live stock updates to Firestore while this window is open. Same
|
|
5
|
-
event-only, top-level-only visibility rule as from_date/to_date above. %>
|
|
6
|
-
|
|
7
|
-
<div class="form-group date-range-filter <%= "d-none" unless @object.event? && @object.depth == 1 %>">
|
|
8
|
-
<div class="date-range-filter row">
|
|
9
|
-
<div class="col-12 col-md-6 mb-3 mb-md-0">
|
|
10
|
-
<%= label_tag nil, Spree.t(:live_stock_starts_at, default: 'Live Stock On') %>
|
|
11
|
-
<div class="input-group datePickerFrom"
|
|
12
|
-
data-wrap="true"
|
|
13
|
-
data-alt-input="true"
|
|
14
|
-
data-max-date="<%= @object.live_stock_ends_at %>"
|
|
15
|
-
data-enable-time="true">
|
|
16
|
-
<%= f.text_field :live_stock_starts_at,
|
|
17
|
-
value: @object.live_stock_starts_at,
|
|
18
|
-
placeholder: Spree.t(:select_a_date),
|
|
19
|
-
class: 'form-control shadow-none',
|
|
20
|
-
'data-input':'' %>
|
|
21
|
-
<%= render partial: 'spree/admin/shared/cal_close' %>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<div class="col-12 col-md-6 mt-3 mt-md-0">
|
|
26
|
-
<%= label_tag nil, Spree.t(:live_stock_ends_at, default: 'Live Stock Off') %>
|
|
27
|
-
<div class="input-group datePickerTo"
|
|
28
|
-
data-wrap="true"
|
|
29
|
-
data-alt-input="true"
|
|
30
|
-
data-min-date="<%= @object.live_stock_starts_at %>"
|
|
31
|
-
data-enable-time="true">
|
|
32
|
-
<%= f.text_field :live_stock_ends_at,
|
|
33
|
-
value: @object.live_stock_ends_at,
|
|
34
|
-
placeholder: Spree.t(:select_a_date),
|
|
35
|
-
class: 'form-control shadow-none',
|
|
36
|
-
'data-input':'' %>
|
|
37
|
-
<%= render partial: 'spree/admin/shared/cal_close' %>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<!-- insert_before "erb[loud]:contains('field_container :hide_from_nav')" -->
|
|
2
|
-
|
|
3
|
-
<% if @taxon.depth == 1 %>
|
|
4
|
-
|
|
5
|
-
<%= f.field_container :preview, class: ['custom-control', 'custom-checkbox', 'my-4'] do %>
|
|
6
|
-
<%= f.check_box :preview, class: 'custom-control-input' %>
|
|
7
|
-
<%= f.label :preview, 'Preview (internal team only)', class: 'custom-control-label' %>
|
|
8
|
-
<%= f.error_message_on :preview %>
|
|
9
|
-
<% end %>
|
|
10
|
-
|
|
11
|
-
<% end %>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!-- insert_before "erb[loud]:contains('field_container :parent_id')" -->
|
|
2
|
-
|
|
3
|
-
<%# Sections don't use show_badge_status, so we hide the form here to avoid confusing admin. %>
|
|
4
|
-
|
|
5
|
-
<%= f.field_container :show_badge_status do %>
|
|
6
|
-
<%= f.label :show_badge_status, Spree.t('show_badge_status'), class: 'form-label' %>
|
|
7
|
-
<%= f.select :show_badge_status,
|
|
8
|
-
options_for_select([['On', true], ['Off', false]], f.object.show_badge_status),
|
|
9
|
-
{ },
|
|
10
|
-
{ class: 'select2 form-control' } %>
|
|
11
|
-
<%= f.error_message_on :show_badge_status, class: 'text-danger' %>
|
|
12
|
-
<% end if @taxon.depth == 1 %>
|
|
13
|
-
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<% content_for :page_title do %>
|
|
2
|
-
<%= link_to Spree.t(:taxonomies), spree.admin_taxonomies_url %> /
|
|
3
|
-
<%= link_to @taxonomy.root.name, spree.edit_admin_taxonomy_url(@taxonomy) %>
|
|
4
|
-
<% unless @taxon.root? %>
|
|
5
|
-
/ <%= link_to @taxon.name %>
|
|
6
|
-
<% end %> / <%= Spree.t(:edit) %>
|
|
7
|
-
<% end %>
|
|
8
|
-
|
|
9
|
-
<div data-hook="admin_taxonomy_taxon_edit_general_settings" class="card mb-3">
|
|
10
|
-
|
|
11
|
-
<div class="card-header">
|
|
12
|
-
<h5 class="card-title mb-0 h6">
|
|
13
|
-
<%= Spree.t(:taxon_products) %>
|
|
14
|
-
</h5>
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
<div class="card-body">
|
|
18
|
-
<div data-hook="admin_taxonomy_taxon_taxon_products_edit_form_header">
|
|
19
|
-
<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @object } %>
|
|
20
|
-
</div>
|
|
21
|
-
<div data-hook="admin_taxonomy_taxon_taxon_products_edit_form">
|
|
22
|
-
<%= form_with model: @object, url: { action: 'update', id: @object } do |f| %>
|
|
23
|
-
<div class="form-group" data-hook="product">
|
|
24
|
-
<%= f.field_container :product do %>
|
|
25
|
-
<%= f.label :product_id, Spree.t(:products) %>
|
|
26
|
-
<%= f.select :product_id,
|
|
27
|
-
options_for_select(Spree::Product.all.map { |p| [p.name, p.id, p.offline? ? { data: { offline: true } } : {}] }, f.object.product_id),
|
|
28
|
-
{ include_hidden: true }, class: 'select2 form-control', disabled: f.object.persisted?, data: { offline_badge: true } %>
|
|
29
|
-
<%= f.error_message_on :product_id %>
|
|
30
|
-
<% end %>
|
|
31
|
-
<%= f.field_container :visible do %>
|
|
32
|
-
<%= f.label :visible, Spree.t(:visible) %>
|
|
33
|
-
<%= f.select :visible, [['Yes', true], ['No', false]], { } , class: "form-control select2", required: true %>
|
|
34
|
-
<%= f.error_message_on :visible %>
|
|
35
|
-
<% end %>
|
|
36
|
-
</div>
|
|
37
|
-
<div data-hook="admin_taxonomy_taxon_taxon_products_edit_form_button">
|
|
38
|
-
<%= render partial: 'spree/admin/shared/edit_resource_links' %>
|
|
39
|
-
</div>
|
|
40
|
-
<% end %>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<%# Re-inits the product select2 so options flagged with data-offline render an "Offline" badge. %>
|
|
46
|
-
<script>
|
|
47
|
-
document.addEventListener("spree:load", function () {
|
|
48
|
-
// Returns a jQuery node (not a string) so select2 renders the badge markup; `.text()` keeps the name escaped.
|
|
49
|
-
var label = function (item) {
|
|
50
|
-
if (!$(item.element).data("offline")) return item.text;
|
|
51
|
-
|
|
52
|
-
return $("<span>").text(item.text)
|
|
53
|
-
.append(" ", $("<span class='badge badge-info ml-1'>").text("Offline"));
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
$("select[data-offline-badge]").select2({ templateResult: label, templateSelection: label });
|
|
57
|
-
});
|
|
58
|
-
</script>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<% content_for :page_title do %>
|
|
2
|
-
<%= link_to Spree.t(:taxonomies), spree.admin_taxonomies_url %> /
|
|
3
|
-
|
|
4
|
-
<%= link_to @taxonomy.root.name, spree.edit_admin_taxonomy_url(@taxonomy) %>
|
|
5
|
-
<%if @taxon.depth !=1 && @taxon.parent.present? %>
|
|
6
|
-
/ <%= link_to @taxon.parent.name, spree.edit_admin_taxonomy_taxon_url(@taxonomy,@taxon.parent.id) %>
|
|
7
|
-
<%end%>
|
|
8
|
-
<% unless @taxon.root? %>
|
|
9
|
-
/ <%= @taxon.name %>
|
|
10
|
-
<% end %>
|
|
11
|
-
<% end %>
|
|
12
|
-
|
|
13
|
-
<% content_for :page_actions do %>
|
|
14
|
-
<%= button_link_to Spree.t(:recalculate), recalculate_conversions_admin_taxonomy_taxon_classifications_path(taxonomy_id: @taxonomy.id, taxon_id: @taxon.id), method: :post, class: "btn btn-outline-primary", id: 'admin_recalculate_link' %>
|
|
15
|
-
<%= button_link_to Spree.t(:add_new_product), new_admin_taxonomy_taxon_classification_path, class: "btn-success", icon: 'add.svg', id: 'admin_new_vendor_link' %>
|
|
16
|
-
<% end if can? :create, Spree::Classification %>
|
|
17
|
-
|
|
18
|
-
<%= render partial: 'spree/admin/shared/taxon_tabs', locals: { current: :products } %>
|
|
19
|
-
|
|
20
|
-
<%= render partial: 'spree/admin/shared/products', locals: {
|
|
21
|
-
products: @taxon.products,
|
|
22
|
-
action_object: @taxon,
|
|
23
|
-
empty_message: I18n.t('taxon_vendor.empty_info'),
|
|
24
|
-
} %>
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<% content_for :page_title do %>
|
|
2
|
-
<%= link_to Spree.t(:taxonomies), spree.admin_taxonomies_url %> /
|
|
3
|
-
<%= link_to @taxonomy.root.name, spree.edit_admin_taxonomy_url(@taxonomy) %>
|
|
4
|
-
<% unless @taxon.root? %>
|
|
5
|
-
/ <%= link_to @taxon.name %>
|
|
6
|
-
<% end %> / <%= Spree.t(:new) %>
|
|
7
|
-
<% end %>
|
|
8
|
-
|
|
9
|
-
<div data-hook="admin_new_user_identity_provider_new_form_header">
|
|
10
|
-
<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @object } %>
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
<div class="card">
|
|
14
|
-
<div class="card-body">
|
|
15
|
-
<%= form_with model: @object, url: { action: 'create' } do |f| %>
|
|
16
|
-
<%= f.hidden_field :taxon_id, value: @taxon.id %>
|
|
17
|
-
<div class="form-group" data-hook="product">
|
|
18
|
-
<%= f.field_container :product do %>
|
|
19
|
-
<%= f.label :product_id, Spree.t('product') %>
|
|
20
|
-
<%= f.select :product_id,
|
|
21
|
-
options_for_select(Spree::Product.all.map { |p| [p.name, p.id, p.offline? ? { data: { offline: true } } : {}] }),
|
|
22
|
-
{ include_hidden: true },
|
|
23
|
-
class: 'select2 form-control',
|
|
24
|
-
data: { offline_badge: true } %>
|
|
25
|
-
<% end %>
|
|
26
|
-
</div>
|
|
27
|
-
<fieldset data-hook="new_taxon_product">
|
|
28
|
-
<%= render partial: 'spree/admin/shared/new_resource_links' %>
|
|
29
|
-
</fieldset>
|
|
30
|
-
<% end %>
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<%# Re-inits the product select2 so options flagged with data-offline render an "Offline" badge. %>
|
|
35
|
-
<script>
|
|
36
|
-
document.addEventListener("spree:load", function () {
|
|
37
|
-
// Returns a jQuery node (not a string) so select2 renders the badge markup; `.text()` keeps the name escaped.
|
|
38
|
-
var label = function (item) {
|
|
39
|
-
if (!$(item.element).data("offline")) return item.text;
|
|
40
|
-
|
|
41
|
-
return $("<span>").text(item.text)
|
|
42
|
-
.append(" ", $("<span class='badge badge-info ml-1'>").text("Offline"));
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
$("select[data-offline-badge]").select2({ templateResult: label, templateSelection: label });
|
|
46
|
-
});
|
|
47
|
-
</script>
|