spree_cm_commissioner 2.3.1.pre.pre2 → 2.3.1
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/product_completion_steps_controller.rb +1 -17
- data/app/controllers/spree/admin/tenants_controller.rb +1 -1
- data/app/controllers/spree/api/v2/storefront/intercity_taxi/draft_orders_controller.rb +1 -0
- data/app/interactors/spree_cm_commissioner/create_ticket.rb +0 -2
- data/app/interactors/spree_cm_commissioner/host_matcher.rb +1 -1
- data/app/interactors/spree_cm_commissioner/vendor_creation_telegram_alert_sender.rb +1 -1
- data/app/mailers/spree/order_mailer_decorator.rb +9 -8
- data/app/models/concerns/spree_cm_commissioner/service_recommendations.rb +2 -2
- data/app/models/concerns/spree_cm_commissioner/store_preference.rb +0 -1
- data/app/models/spree_cm_commissioner/product_completion_step.rb +1 -4
- data/app/models/spree_cm_commissioner/product_completion_steps/social_entry_url.rb +19 -86
- data/app/models/spree_cm_commissioner/tenant.rb +1 -10
- data/app/models/spree_cm_commissioner/vendor_place.rb +1 -10
- data/app/overrides/spree/admin/stores/_form/store_preferences.html.erb.deface +0 -9
- data/app/queries/spree_cm_commissioner/trip_query.rb +17 -23
- data/app/serializers/spree_cm_commissioner/v2/storefront/trip_vehicle_serializer.rb +1 -1
- data/app/services/spree_cm_commissioner/intercity_taxi_order/create.rb +0 -8
- data/app/services/spree_cm_commissioner/intercity_taxi_order/update.rb +45 -35
- data/app/views/shared/_asset_field.html.erb +0 -13
- data/app/views/spree/admin/product_completion_steps/_form.html.erb +2 -28
- data/app/views/spree/admin/tenants/_form.html.erb +1 -1
- data/config/initializers/spree_permitted_attributes.rb +0 -1
- data/config/locales/en.yml +0 -4
- data/config/locales/km.yml +61 -65
- data/config/routes.rb +0 -16
- data/lib/spree_cm_commissioner/version.rb +1 -1
- metadata +4 -12
- data/app/controllers/spree/api/v2/tenant/intercity_taxi/draft_orders_controller.rb +0 -41
- data/app/controllers/spree/api/v2/tenant/trip_places_controller.rb +0 -48
- data/app/controllers/spree/api/v2/tenant/trip_search_controller.rb +0 -103
- data/app/controllers/spree/api/v2/tenant/trips_controller.rb +0 -32
- data/app/models/spree_cm_commissioner/product_completion_step_banner.rb +0 -12
- data/app/views/spree/admin/product_completion_steps/_supported_fields.html.erb +0 -33
- data/db/migrate/20251119093000_add_tenant_id_to_cm_vendor_places.rb +0 -7
- data/lib/spree_cm_commissioner/test_helper/factories/product_completion_step_banner_factory.rb +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div data-hook="admin_product_completion_step_form_fields">
|
|
2
2
|
<div data-hook="product_completion_step" class="row">
|
|
3
3
|
<div class="col-12 col-md-6">
|
|
4
|
-
<div class="mb-3
|
|
4
|
+
<div class="card mb-3">
|
|
5
5
|
<div class="card-header">
|
|
6
6
|
<h5 class="mb-0"><%= Spree.t(:settings) %></h5>
|
|
7
7
|
</div>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
</div>
|
|
33
33
|
|
|
34
34
|
<div class="col-12 col-md-6">
|
|
35
|
-
<div class="mb-3
|
|
35
|
+
<div class="card mb-3">
|
|
36
36
|
<div class="card-header">
|
|
37
37
|
<h5 class="mb-0"><%= Spree.t(:completion_settings) %></h5>
|
|
38
38
|
</div>
|
|
@@ -49,32 +49,6 @@
|
|
|
49
49
|
</div>
|
|
50
50
|
</div>
|
|
51
51
|
</div>
|
|
52
|
-
|
|
53
|
-
<div class="mb-3 card">
|
|
54
|
-
<div class="card-header">
|
|
55
|
-
<h5 class="mb-0"><%= Spree.t(:banner) %></h5>
|
|
56
|
-
</div>
|
|
57
|
-
<div class="card-body">
|
|
58
|
-
<%= render 'shared/asset_field',
|
|
59
|
-
field: :banner,
|
|
60
|
-
label: Spree.t(:banner),
|
|
61
|
-
asset: @object.banner,
|
|
62
|
-
remove_url: (@object.banner.present? ? remove_banner_admin_product_product_completion_step_url(@object.product, @object) : nil),
|
|
63
|
-
form: f,
|
|
64
|
-
size_info: 'Min: 480x270, Max: 960x540',
|
|
65
|
-
aspect_ratio: '16x9',
|
|
66
|
-
classes: ['col-md-12']
|
|
67
|
-
%>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
52
|
</div>
|
|
71
53
|
</div>
|
|
72
|
-
|
|
73
|
-
<% if @object.is_a?(SpreeCmCommissioner::ProductCompletionSteps::SocialEntryUrl) %>
|
|
74
|
-
<div class="row mt-3">
|
|
75
|
-
<div class="col-12">
|
|
76
|
-
<%= render 'supported_fields' %>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
<% end %>
|
|
80
54
|
</div>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
<div class="col-12">
|
|
37
37
|
<%= f.field_container :host do %>
|
|
38
38
|
<%= f.label :host, raw(Spree.t(:host) + required_span_tag) %>
|
|
39
|
-
<%= f.text_field :host, required: true, class: 'form-control', placeholder: '
|
|
39
|
+
<%= f.text_field :host, required: true, class: 'form-control', placeholder: 'host' %>
|
|
40
40
|
<% if f.object.errors[:host].any? %>
|
|
41
41
|
<div class="error text-danger"><%= f.object.errors[:host].join(', ') %></div>
|
|
42
42
|
<% end %>
|
|
@@ -48,7 +48,6 @@ module Spree
|
|
|
48
48
|
:preferred_sms_sender_id,
|
|
49
49
|
:preferred_telegram_order_alert_chat_id,
|
|
50
50
|
:preferred_telegram_order_request_alert_chat_id,
|
|
51
|
-
:preferred_telegram_new_vendor_alert_chat_id,
|
|
52
51
|
:preferred_assetlinks,
|
|
53
52
|
:preferred_apple_app_site_association,
|
|
54
53
|
{ default_notification_image_attributes: {} },
|
data/config/locales/en.yml
CHANGED
data/config/locales/km.yml
CHANGED
|
@@ -370,10 +370,6 @@ km:
|
|
|
370
370
|
attributes:
|
|
371
371
|
exception_rules:
|
|
372
372
|
invalid_json: "Format មិនត្រឹមត្រូវ"
|
|
373
|
-
spree_cm_commissioner/tenant:
|
|
374
|
-
attributes:
|
|
375
|
-
host:
|
|
376
|
-
format: "មិនអនុញ្ញាតឱ្យបញ្ចូលឈ្មោះដែលភ្ជាប់ជាមួយ (http:// ឬ https://)"
|
|
377
373
|
|
|
378
374
|
mail:
|
|
379
375
|
order_mailer:
|
|
@@ -473,64 +469,64 @@ km:
|
|
|
473
469
|
|
|
474
470
|
blazer:
|
|
475
471
|
columns:
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
472
|
+
'No.': "លេខរៀង"
|
|
473
|
+
'Reservation No.': "លេខកក់"
|
|
474
|
+
'Direction': "ទិសដៅ"
|
|
475
|
+
'Vehicle type': "ប្រភេទយានយន្ត"
|
|
476
|
+
'Seller': "អ្នកលក់"
|
|
477
|
+
'Paid to': "បង់ទៅ"
|
|
478
|
+
'Branch': "សាខា"
|
|
479
|
+
'Gateway': "ច្រកទ្វារ"
|
|
480
|
+
'Departure': "ចេញដំណើរ"
|
|
481
|
+
'Issued': "ចេញឲ្យ"
|
|
482
|
+
'Paid': "បានបង់"
|
|
483
|
+
'# of seats': "ចំនួនកៅអី"
|
|
484
|
+
'Source': "ប្រភព"
|
|
485
|
+
'Status': "ស្ថានភាព"
|
|
486
|
+
'Fare': "តម្លៃឈ្នួល"
|
|
487
|
+
'Discount': "ការបញ្ចុះតម្លៃ"
|
|
488
|
+
'Commission': "កម្រៃជើងសារ"
|
|
489
|
+
'Amount': "ចំនួនទឹកប្រាក់"
|
|
490
|
+
'Metric': "រង្វាស់"
|
|
491
|
+
'Value': "តម្លៃ"
|
|
492
|
+
'Group': "ក្រុម"
|
|
493
|
+
'Orders': "ការបញ្ជាទិញ"
|
|
494
|
+
'Passengers': "អ្នកដំណើរ"
|
|
495
|
+
'Total fare': "តម្លៃឈ្នួលសរុប"
|
|
496
|
+
'Total discount': "ការបញ្ចុះតម្លៃសរុប"
|
|
497
|
+
'Total commission': "កម្រៃជើងសារសរុប"
|
|
498
|
+
'Total amount': "ចំនួនទឹកប្រាក់សរុប"
|
|
499
|
+
'Trip ID': "លេខសម្គាល់ជើងដំណើរ"
|
|
500
|
+
'Route': "ផ្លូវ"
|
|
501
|
+
'Origin': "ទីតាំងដើម"
|
|
502
|
+
'Destination': "ទីតាំងគោលដៅ"
|
|
503
|
+
'Departure Time': "ម៉ោងចេញដំណើរ"
|
|
504
|
+
'Vehicle': "យានយន្ត"
|
|
505
|
+
'Total Seats': "ចំនួនកៅអីសរុប"
|
|
506
|
+
'Bookings': "ការកក់"
|
|
507
|
+
'Seats Sold': "កៅអីលក់បាន"
|
|
508
|
+
'Occupancy %': "ភាគរយនៃការកាន់កាប់"
|
|
509
|
+
'Total Revenue': "ចំណូលសរុប"
|
|
510
|
+
'Avg Ticket Price': "តម្លៃសំបុត្រជាមធ្យម"
|
|
511
|
+
'Date': "កាលបរិច្ឆេទ"
|
|
512
|
+
'Time': "ម៉ោង"
|
|
513
|
+
'From': "ពី"
|
|
514
|
+
'To': "ទៅ"
|
|
515
|
+
'Capacity': "ចំណុះ"
|
|
516
|
+
'Available': "ទំនេរ"
|
|
517
|
+
'Filled %': "ភាគរយនៃការបំពេញ"
|
|
518
|
+
'Vehicle Code': "លេខកូដយានយន្ត"
|
|
519
|
+
'Plate': "ស្លាកលេខ"
|
|
520
|
+
'Type': "ប្រភេទ"
|
|
521
|
+
'Total Trips': "ចំនួនជើងដំណើរសរុប"
|
|
522
|
+
'Trips with Bookings': "ជើងដំណើរមានការកក់"
|
|
523
|
+
'Total Bookings': "ចំនួនការកក់សរុប"
|
|
524
|
+
'Total Passengers': "ចំនួនអ្នកដំណើរសរុប"
|
|
525
|
+
'Avg Occupancy %': "ភាគរយនៃការកាន់កាប់ជាមធ្យម"
|
|
526
|
+
'Lead Time': "រយៈពេលនៃការរង់ចាំ"
|
|
527
|
+
'Revenue': "ចំណូល"
|
|
528
|
+
'Avg Days in Advance': "ចំនួនថ្ងៃជាមធ្យមមុន"
|
|
529
|
+
'Current Period': "រយៈពេលបច្ចុប្បន្ន"
|
|
530
|
+
'Previous Period': "រយៈពេលមុន"
|
|
531
|
+
'Change': "បំលាស់ប្តូរ"
|
|
532
|
+
'Change %': "ភាគរយនៃបំលាស់ប្តូរ"
|
data/config/routes.rb
CHANGED
|
@@ -163,10 +163,6 @@ Spree::Core::Engine.add_routes do
|
|
|
163
163
|
collection do
|
|
164
164
|
post :update_positions
|
|
165
165
|
end
|
|
166
|
-
|
|
167
|
-
member do
|
|
168
|
-
delete :remove_banner
|
|
169
|
-
end
|
|
170
166
|
end
|
|
171
167
|
|
|
172
168
|
resources :product_places do
|
|
@@ -550,18 +546,6 @@ Spree::Core::Engine.add_routes do
|
|
|
550
546
|
resources :guest_card_classes
|
|
551
547
|
resources :tickets, only: :index
|
|
552
548
|
|
|
553
|
-
resources :trip_places, only: :index
|
|
554
|
-
resources :trip_search, only: [:index]
|
|
555
|
-
resources :trips, only: %i[show]
|
|
556
|
-
|
|
557
|
-
namespace :intercity_taxi do
|
|
558
|
-
resources :draft_orders, only: [:create] do
|
|
559
|
-
collection do
|
|
560
|
-
patch :update
|
|
561
|
-
end
|
|
562
|
-
end
|
|
563
|
-
end
|
|
564
|
-
|
|
565
549
|
resource :reset_passwords, only: [:update]
|
|
566
550
|
resource :change_passwords, only: [:update]
|
|
567
551
|
resource :user_contacts, only: [:update]
|
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.3.1
|
|
4
|
+
version: 2.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- You
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: spree
|
|
@@ -1013,7 +1013,6 @@ files:
|
|
|
1013
1013
|
- app/controllers/spree/api/v2/tenant/guests_controller.rb
|
|
1014
1014
|
- app/controllers/spree/api/v2/tenant/homepage_sections_controller.rb
|
|
1015
1015
|
- app/controllers/spree/api/v2/tenant/id_cards_controller.rb
|
|
1016
|
-
- app/controllers/spree/api/v2/tenant/intercity_taxi/draft_orders_controller.rb
|
|
1017
1016
|
- app/controllers/spree/api/v2/tenant/line_items_controller.rb
|
|
1018
1017
|
- app/controllers/spree/api/v2/tenant/notifications_controller.rb
|
|
1019
1018
|
- app/controllers/spree/api/v2/tenant/order_histories_controller.rb
|
|
@@ -1026,9 +1025,6 @@ files:
|
|
|
1026
1025
|
- app/controllers/spree/api/v2/tenant/s3_signed_urls_controller.rb
|
|
1027
1026
|
- app/controllers/spree/api/v2/tenant/taxons_controller.rb
|
|
1028
1027
|
- app/controllers/spree/api/v2/tenant/tickets_controller.rb
|
|
1029
|
-
- app/controllers/spree/api/v2/tenant/trip_places_controller.rb
|
|
1030
|
-
- app/controllers/spree/api/v2/tenant/trip_search_controller.rb
|
|
1031
|
-
- app/controllers/spree/api/v2/tenant/trips_controller.rb
|
|
1032
1028
|
- app/controllers/spree/api/v2/tenant/user_account_linkages_controller.rb
|
|
1033
1029
|
- app/controllers/spree/api/v2/tenant/user_contacts_controller.rb
|
|
1034
1030
|
- app/controllers/spree/api/v2/tenant/user_device_tokens_controller.rb
|
|
@@ -1488,7 +1484,6 @@ files:
|
|
|
1488
1484
|
- app/models/spree_cm_commissioner/place.rb
|
|
1489
1485
|
- app/models/spree_cm_commissioner/price_decorator.rb
|
|
1490
1486
|
- app/models/spree_cm_commissioner/product_completion_step.rb
|
|
1491
|
-
- app/models/spree_cm_commissioner/product_completion_step_banner.rb
|
|
1492
1487
|
- app/models/spree_cm_commissioner/product_completion_steps/chatrace_telegram.rb
|
|
1493
1488
|
- app/models/spree_cm_commissioner/product_completion_steps/social_entry_url.rb
|
|
1494
1489
|
- app/models/spree_cm_commissioner/product_decorator.rb
|
|
@@ -2106,7 +2101,6 @@ files:
|
|
|
2106
2101
|
- app/views/spree/admin/orders/notifications.html.erb
|
|
2107
2102
|
- app/views/spree/admin/product_commissions/index.html.erb
|
|
2108
2103
|
- app/views/spree/admin/product_completion_steps/_form.html.erb
|
|
2109
|
-
- app/views/spree/admin/product_completion_steps/_supported_fields.html.erb
|
|
2110
2104
|
- app/views/spree/admin/product_completion_steps/edit.html.erb
|
|
2111
2105
|
- app/views/spree/admin/product_completion_steps/index.html.erb
|
|
2112
2106
|
- app/views/spree/admin/product_completion_steps/new.html.erb
|
|
@@ -2856,7 +2850,6 @@ files:
|
|
|
2856
2850
|
- db/migrate/20251009073040_add_lock_version_to_cm_routes.rb
|
|
2857
2851
|
- db/migrate/20251009073929_add_lock_version_to_cm_vendor_routes.rb
|
|
2858
2852
|
- db/migrate/20251113081853_add_index_to_spree_orders_updated_at.rb
|
|
2859
|
-
- db/migrate/20251119093000_add_tenant_id_to_cm_vendor_places.rb
|
|
2860
2853
|
- docker-compose.yml
|
|
2861
2854
|
- docs/api/scoped-access-token-endpoints.md
|
|
2862
2855
|
- docs/option_types/attr_types.md
|
|
@@ -2929,7 +2922,6 @@ files:
|
|
|
2929
2922
|
- lib/spree_cm_commissioner/test_helper/factories/permission.rb
|
|
2930
2923
|
- lib/spree_cm_commissioner/test_helper/factories/pin_code_factory.rb
|
|
2931
2924
|
- lib/spree_cm_commissioner/test_helper/factories/place_factory.rb
|
|
2932
|
-
- lib/spree_cm_commissioner/test_helper/factories/product_completion_step_banner_factory.rb
|
|
2933
2925
|
- lib/spree_cm_commissioner/test_helper/factories/product_completion_step_factory.rb
|
|
2934
2926
|
- lib/spree_cm_commissioner/test_helper/factories/product_factory.rb
|
|
2935
2927
|
- lib/spree_cm_commissioner/test_helper/factories/products_taxons_factory.rb
|
|
@@ -3021,9 +3013,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
3021
3013
|
version: '2.7'
|
|
3022
3014
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
3023
3015
|
requirements:
|
|
3024
|
-
- - "
|
|
3016
|
+
- - ">="
|
|
3025
3017
|
- !ruby/object:Gem::Version
|
|
3026
|
-
version:
|
|
3018
|
+
version: '0'
|
|
3027
3019
|
requirements:
|
|
3028
3020
|
- none
|
|
3029
3021
|
rubygems_version: 3.4.1
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Api
|
|
3
|
-
module V2
|
|
4
|
-
module Tenant
|
|
5
|
-
module IntercityTaxi
|
|
6
|
-
class DraftOrdersController < BaseController
|
|
7
|
-
def create
|
|
8
|
-
order = SpreeCmCommissioner::IntercityTaxiOrder::Create.call(
|
|
9
|
-
trip_id: params[:trip_id],
|
|
10
|
-
from_date: params[:from_date],
|
|
11
|
-
to_date: params[:to_date],
|
|
12
|
-
user_id: params[:user_id],
|
|
13
|
-
quantity: params[:quantity]
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
render_serialized_payload { serialize_resource(order) }
|
|
17
|
-
rescue StandardError => e
|
|
18
|
-
render_error_payload(e.message)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def update
|
|
22
|
-
order = SpreeCmCommissioner::IntercityTaxiOrder::Update.call(
|
|
23
|
-
params: params
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
render_serialized_payload { serialize_resource(order) }
|
|
27
|
-
rescue StandardError => e
|
|
28
|
-
render_error_payload(e.message)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
|
|
33
|
-
def resource_serializer
|
|
34
|
-
SpreeCmCommissioner::V2::Storefront::IntercityTaxiCartSerializer
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Api
|
|
3
|
-
module V2
|
|
4
|
-
module Tenant
|
|
5
|
-
class TripPlacesController < BaseController
|
|
6
|
-
def index
|
|
7
|
-
render_serialized_payload do
|
|
8
|
-
serialize_collection(paginated_collection)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
private
|
|
13
|
-
|
|
14
|
-
def paginated_collection
|
|
15
|
-
collection.page(params[:page]).per(params[:per_page])
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def collection
|
|
19
|
-
@collection ||= begin
|
|
20
|
-
base_scope = scope
|
|
21
|
-
|
|
22
|
-
if params[:q].present?
|
|
23
|
-
@search = base_scope.ransack(params[:q])
|
|
24
|
-
@search.result
|
|
25
|
-
else
|
|
26
|
-
base_scope
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def scope
|
|
32
|
-
model_class.joins(:location_vendor_places)
|
|
33
|
-
.where(location_vendor_places: { tenant_id: @tenant.id })
|
|
34
|
-
.distinct
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def model_class
|
|
38
|
-
SpreeCmCommissioner::Place
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def collection_serializer
|
|
42
|
-
SpreeCmCommissioner::V2::Storefront::TripPlaceSerializer
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Api
|
|
3
|
-
module V2
|
|
4
|
-
module Tenant
|
|
5
|
-
class TripSearchController < BaseController
|
|
6
|
-
CACHE_EXPIRES_IN = 5.minutes
|
|
7
|
-
|
|
8
|
-
def index
|
|
9
|
-
render_serialized_payload do
|
|
10
|
-
Rails.cache.fetch(collection_cache_key, collection_cache_opts) do
|
|
11
|
-
trips = SpreeCmCommissioner::TripQuery.new(
|
|
12
|
-
origin_id: params[:origin_id],
|
|
13
|
-
destination_id: params[:destination_id],
|
|
14
|
-
date: params[:date],
|
|
15
|
-
route_type: params[:route_type],
|
|
16
|
-
number_of_guests: params[:number_of_guests],
|
|
17
|
-
tenant_id: @tenant.id,
|
|
18
|
-
params: params
|
|
19
|
-
).call
|
|
20
|
-
|
|
21
|
-
serialize_collection(trips)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
private
|
|
27
|
-
|
|
28
|
-
# override from ContentCacheable
|
|
29
|
-
def max_age
|
|
30
|
-
CACHE_EXPIRES_IN.to_i
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# override
|
|
34
|
-
def collection_cache_key
|
|
35
|
-
cache_key_parts = [
|
|
36
|
-
'trip_search',
|
|
37
|
-
@tenant.id,
|
|
38
|
-
params[:origin_id],
|
|
39
|
-
params[:destination_id],
|
|
40
|
-
params[:date],
|
|
41
|
-
params[:route_type],
|
|
42
|
-
params[:number_of_guests],
|
|
43
|
-
resource_includes&.sort&.join(','),
|
|
44
|
-
sparse_fields&.sort&.join(','),
|
|
45
|
-
serializer_params.to_json,
|
|
46
|
-
params[:page]&.to_s&.strip,
|
|
47
|
-
params[:per_page]&.to_s&.strip
|
|
48
|
-
].compact.join('-')
|
|
49
|
-
|
|
50
|
-
Digest::MD5.hexdigest(cache_key_parts)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# override
|
|
54
|
-
def collection_cache_opts
|
|
55
|
-
{
|
|
56
|
-
namespace: Spree::Api::Config[:api_v2_collection_cache_namespace],
|
|
57
|
-
expires_in: CACHE_EXPIRES_IN
|
|
58
|
-
}
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
# override
|
|
62
|
-
def default_resource_includes
|
|
63
|
-
[
|
|
64
|
-
'trips.vendor',
|
|
65
|
-
'trips.vendor.logo',
|
|
66
|
-
'trips.vehicle',
|
|
67
|
-
'trips.vehicle.vehicle_photos',
|
|
68
|
-
'trips.amenities'
|
|
69
|
-
]
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def serialize_collection(collection)
|
|
73
|
-
serialized_data = SpreeCmCommissioner::V2::Storefront::TripQueryResultSerializer.new(
|
|
74
|
-
collection,
|
|
75
|
-
include: default_resource_includes,
|
|
76
|
-
params: serializer_params
|
|
77
|
-
).serializable_hash
|
|
78
|
-
serialized_data[:meta] = {
|
|
79
|
-
count: collection.size,
|
|
80
|
-
total_count: collection.respond_to?(:total_count) ? collection.total_count : collection.size,
|
|
81
|
-
current_page: collection.respond_to?(:current_page) ? collection.current_page : 1,
|
|
82
|
-
per_page: collection.respond_to?(:limit_value) ? collection.limit_value : collection.size,
|
|
83
|
-
pages: collection.respond_to?(:total_pages) ? collection.total_pages : 1,
|
|
84
|
-
next_page: collection.respond_to?(:next_page) ? collection.next_page : nil,
|
|
85
|
-
prev_page: collection.respond_to?(:prev_page) ? collection.prev_page : nil
|
|
86
|
-
}
|
|
87
|
-
serialized_data
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
# override
|
|
91
|
-
def serializer_params
|
|
92
|
-
params.permit(:include).to_hash
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
# override
|
|
96
|
-
def required_schema
|
|
97
|
-
SpreeCmCommissioner::TripSearchRequestSchema
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Api
|
|
3
|
-
module V2
|
|
4
|
-
module Tenant
|
|
5
|
-
class TripsController < BaseController
|
|
6
|
-
def show
|
|
7
|
-
resource = scope.find(params[:id])
|
|
8
|
-
|
|
9
|
-
render_serialized_payload do
|
|
10
|
-
serialize_resource(resource)
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
def scope
|
|
17
|
-
model_class.joins(:vendor)
|
|
18
|
-
.where(spree_vendors: { tenant_id: @tenant.id })
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def model_class
|
|
22
|
-
SpreeCmCommissioner::Trip
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def resource_serializer
|
|
26
|
-
SpreeCmCommissioner::V2::Storefront::TripSerializer
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
<div class="mb-3 card">
|
|
2
|
-
<div class="card-header">
|
|
3
|
-
<h5 class="mb-0">Supported Placeholder Fields</h5>
|
|
4
|
-
</div>
|
|
5
|
-
<div class="card-body">
|
|
6
|
-
<p class="text-muted mb-3">Use these placeholders in your entry point link template:</p>
|
|
7
|
-
|
|
8
|
-
<% if @object.is_a?(SpreeCmCommissioner::ProductCompletionSteps::SocialEntryUrl) && @object.supported_fields.present? %>
|
|
9
|
-
<% @object.supported_fields.each do |category, fields| %>
|
|
10
|
-
<div class="mb-3">
|
|
11
|
-
<h6 class="fw-bold text-capitalize">
|
|
12
|
-
<%= category.to_s.humanize %>
|
|
13
|
-
<span class="badge bg-secondary"><%= fields.count %></span>
|
|
14
|
-
</h6>
|
|
15
|
-
<div class="field-list">
|
|
16
|
-
<% fields.each do |field| %>
|
|
17
|
-
<div class="field-item d-inline-block me-2 mb-2">
|
|
18
|
-
<code class="bg-light p-2 rounded">
|
|
19
|
-
{<%= category %><%= category == :guests ? '[index]' : '' %>.<%=field %>}
|
|
20
|
-
</code>
|
|
21
|
-
</div>
|
|
22
|
-
<% end %>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
<% end %>
|
|
26
|
-
|
|
27
|
-
<div class="alert alert-info mt-3">
|
|
28
|
-
<strong>Example:</strong><br>
|
|
29
|
-
<code>https://example.com?order={order.number}&name={bill_address.first_name}&guest={guests[0].first_name}</code>
|
|
30
|
-
</div>
|
|
31
|
-
<% end %>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
class AddTenantIdToCmVendorPlaces < ActiveRecord::Migration[7.0]
|
|
2
|
-
def change
|
|
3
|
-
add_column :cm_vendor_places, :tenant_id, :integer, if_not_exists: true
|
|
4
|
-
add_index :cm_vendor_places, :tenant_id, if_not_exists: true
|
|
5
|
-
add_index :cm_vendor_places, %i[tenant_id vendor_id], if_not_exists: true, name: 'index_cm_vendor_places_on_tenant_and_vendor'
|
|
6
|
-
end
|
|
7
|
-
end
|
data/lib/spree_cm_commissioner/test_helper/factories/product_completion_step_banner_factory.rb
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
FactoryBot.define do
|
|
2
|
-
factory :cm_product_completion_step_banner, class: SpreeCmCommissioner::ProductCompletionStepBanner do
|
|
3
|
-
viewable_type { 'SpreeCmCommissioner::ProductCompletionStep' }
|
|
4
|
-
viewable_id { nil }
|
|
5
|
-
attachment { Rack::Test::UploadedFile.new(Spree::Core::Engine.root.join('spec', 'fixtures', 'files', 'icon_256x256.png'), 'image/*') }
|
|
6
|
-
end
|
|
7
|
-
end
|