spree_cm_commissioner 1.8.5 → 1.8.6

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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/app/controllers/blazer/base_controller_decorator.rb +18 -0
  4. data/app/controllers/spree/admin/event_blazer_queries_controller.rb +23 -0
  5. data/app/controllers/spree/api/v2/storefront/active_homepage_events_controller.rb +23 -0
  6. data/app/controllers/spree/api/v2/tenant/account/orders_controller.rb +48 -0
  7. data/app/models/spree_cm_commissioner/order_decorator.rb +1 -0
  8. data/app/models/spree_cm_commissioner/role_decorator.rb +9 -0
  9. data/app/models/spree_cm_commissioner/taxon_blazer_query.rb +8 -0
  10. data/app/models/spree_cm_commissioner/taxon_decorator.rb +13 -1
  11. data/app/models/spree_cm_commissioner/trip_connection.rb +30 -0
  12. data/app/models/spree_cm_commissioner/user_decorator.rb +9 -0
  13. data/app/overrides/spree/admin/taxons/_form/hide_video_banner.html.erb.deface +7 -0
  14. data/app/serializers/spree/v2/storefront/active_homepage_event_serializer.rb +18 -0
  15. data/app/serializers/spree/v2/storefront/taxon_serializer_decorator.rb +1 -1
  16. data/app/serializers/spree/v2/tenant/booking_card_class_serializer.rb +10 -0
  17. data/app/serializers/spree/v2/tenant/guest_card_class_serializer.rb +11 -0
  18. data/app/serializers/spree/v2/tenant/order_serializer.rb +1 -0
  19. data/app/views/blazer/queries/_content.html.erb +85 -0
  20. data/app/views/blazer/queries/embed/_content.html.erb +85 -0
  21. data/app/views/blazer/queries/embed/_download_button.html.erb +7 -0
  22. data/app/views/blazer/queries/show.html.erb +12 -0
  23. data/app/views/layouts/blazer/application.html.erb +35 -0
  24. data/config/initializers/spree_permitted_attributes.rb +1 -0
  25. data/config/locales/en.yml +3 -0
  26. data/config/locales/km.yml +5 -1
  27. data/config/routes.rb +6 -0
  28. data/db/migrate/20250321041406_create_trip_connections.rb +12 -0
  29. data/db/migrate/20250327074327_add_hide_video_banner_to_spree_taxon.rb +5 -0
  30. data/db/migrate/20250327094626_create_spree_cm_commissioner_taxon_blazer_query.rb +10 -0
  31. data/db/migrate/20250328072717_add_description_to_spree_roles.rb +5 -0
  32. data/db/migrate/20250328072841_add_vendor_id_to_spree_roles.rb +6 -0
  33. data/db/migrate/20250328072947_remove_unique_constraint_from_name_in_spree_roles.rb +7 -0
  34. data/docs/sql/events/active_homepage_events.sql +14 -0
  35. data/lib/spree_cm_commissioner/version.rb +1 -1
  36. metadata +24 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53d7b7682c7178ee43a82fa1bed180bff277284eb4cc11790f7b9286d4aa2c98
4
- data.tar.gz: e352ffca56db709ce091fd5d1900b0893ef86fc55a0c0254da1443cad454a49f
3
+ metadata.gz: 8cd5a0a2e3fc958b2a2e6bf0fd4dcd5773be9b512038dd183613b9586162c725
4
+ data.tar.gz: 3d37e405da973e87aa03bd9177dd3474d720106e8f44ac9524156623aa586d4a
5
5
  SHA512:
6
- metadata.gz: ab207fab5a440fb505cb157f7d29070c3d0f53a89117854bcdfceb0141e9cea8cc497d73d80afae1b6921c79b566744b52e86e4783c747527fa36bfb19505e5a
7
- data.tar.gz: 790e0b20a95d9a52c525b1e0528f6421479742d2713fd87fc325e3b69c09ab8c6804db3969fee36256d13e728ace25277a2a2f3e96aad496ff3e02fa0695d2ac
6
+ metadata.gz: f16265bfb68e1ed87973e1b5afc987d99362e627f7a0072f56e10445712c2516b841a3a8285ee8f20961cbcf3eddfcfbacbd7829156b834875126b16834684fe
7
+ data.tar.gz: 7bde1b69e06d5e56ab2b505784f44e75ecf930ca381f19a758c851dfc7da721b9e24895da8b51553ff0ac613f5de1b0a6a24f27066917e768728bfdc062e27f1
data/Gemfile.lock CHANGED
@@ -34,7 +34,7 @@ GIT
34
34
  PATH
35
35
  remote: .
36
36
  specs:
37
- spree_cm_commissioner (1.8.5)
37
+ spree_cm_commissioner (1.8.6)
38
38
  activerecord-multi-tenant
39
39
  activerecord_json_validator (~> 2.1, >= 2.1.3)
40
40
  aws-sdk-cloudfront
@@ -0,0 +1,18 @@
1
+ module Blazer
2
+ module BaseControllerDecorator
3
+ def self.prepended(base)
4
+ base.before_action :restrict_organizer_access
5
+ end
6
+
7
+ private
8
+
9
+ def restrict_organizer_access
10
+ return unless spree_current_user.organizer? && !spree_current_user.admin?
11
+ return if controller_name == 'queries' && %w[show run].include?(action_name)
12
+
13
+ raise ActionController::RoutingError, 'Unauthorized'
14
+ end
15
+ end
16
+ end
17
+
18
+ Blazer::BaseController.prepend(Blazer::BaseControllerDecorator) if defined?(Blazer::BaseController)
@@ -0,0 +1,23 @@
1
+ module Spree
2
+ module Admin
3
+ class EventBlazerQueriesController < Spree::Admin::ResourceController
4
+ def model_class
5
+ SpreeCmCommissioner::TaxonBlazerQuery
6
+ end
7
+
8
+ def object_name
9
+ 'spree_cm_commissioner_taxon_blazer_query'
10
+ end
11
+
12
+ def create
13
+ event_blazer = SpreeCmCommissioner::TaxonBlazerQuery.new(taxon_id: params[:event_id], blazer_query_id: params[:blazer_query_id])
14
+ if event_blazer.save
15
+ flash[:success] = I18n.t('event_blazer_queries.success')
16
+ else
17
+ flash[:alert] = event_blazer.errors.full_messages.join(', ')
18
+ end
19
+ redirect_to blazer.query_path(id: event_blazer.blazer_query_id, event_id: event_blazer.taxon_id)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module Spree
2
+ module Api
3
+ module V2
4
+ module Storefront
5
+ class ActiveHomepageEventsController < Spree::Api::V2::ResourceController
6
+ private
7
+
8
+ def collection
9
+ @collection ||= model_class.active_homepage_events
10
+ end
11
+
12
+ def model_class
13
+ Spree::Taxon
14
+ end
15
+
16
+ def collection_serializer
17
+ Spree::V2::Storefront::ActiveHomepageEventSerializer
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,48 @@
1
+ module Spree
2
+ module Api
3
+ module V2
4
+ module Tenant
5
+ module Account
6
+ class OrdersController < BaseController
7
+ around_action :wrap_with_multitenant_without
8
+ before_action :require_spree_current_user
9
+
10
+ def collection
11
+ scope
12
+ end
13
+
14
+ def resource
15
+ @resource ||= scope.find_by!(number: params[:id])
16
+ end
17
+
18
+ private
19
+
20
+ def wrap_with_multitenant_without(&block)
21
+ MultiTenant.without(&block)
22
+ end
23
+
24
+ def allowed_sort_attributes
25
+ super << :completed_at
26
+ end
27
+
28
+ def scope
29
+ spree_current_user.orders.complete
30
+ end
31
+
32
+ def collection_serializer
33
+ Spree::V2::Tenant::OrderSerializer
34
+ end
35
+
36
+ def resource_serializer
37
+ Spree::V2::Tenant::OrderSerializer
38
+ end
39
+
40
+ def model_class
41
+ Spree::Order
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -38,6 +38,7 @@ module SpreeCmCommissioner
38
38
  base.has_many :vendors, through: :products, class_name: 'Spree::Vendor'
39
39
  base.has_many :taxons, through: :products, class_name: 'Spree::Taxon'
40
40
  base.has_many :guests, through: :line_items, class_name: 'SpreeCmCommissioner::Guest'
41
+ base.has_many :guest_card_classes, class_name: 'SpreeCmCommissioner::GuestCardClass', through: :variants
41
42
 
42
43
  base.delegate :customer, to: :user, allow_nil: true
43
44
 
@@ -4,7 +4,16 @@ module SpreeCmCommissioner
4
4
  base.has_many :role_permissions, class_name: 'SpreeCmCommissioner::RolePermission'
5
5
  base.has_many :permissions, through: :role_permissions, class_name: 'SpreeCmCommissioner::Permission'
6
6
 
7
+ base.belongs_to :vendor, optional: true
8
+
9
+ base.scope :non_vendor, -> { where(vendor_id: nil) }
10
+
7
11
  base.accepts_nested_attributes_for :role_permissions, allow_destroy: true
12
+
13
+ base._validators.reject! { |key, _| key == :name }
14
+ base._validate_callbacks.each { |c| c.filter.attributes.delete(:name) if c.filter.respond_to?(:attributes) }
15
+
16
+ base.validates :name, uniqueness: { scope: :vendor_id, allow_blank: true }
8
17
  end
9
18
  end
10
19
  end
@@ -0,0 +1,8 @@
1
+ module SpreeCmCommissioner
2
+ class TaxonBlazerQuery < SpreeCmCommissioner::Base
3
+ belongs_to :taxon, class_name: 'Spree::Taxon'
4
+ belongs_to :blazer_query, class_name: 'Blazer::Query'
5
+
6
+ validates :taxon_id, uniqueness: { scope: :blazer_query_id, message: I18n.t('event_blazer_queries.fail') }
7
+ end
8
+ end
@@ -1,7 +1,7 @@
1
1
  module SpreeCmCommissioner
2
2
  module TaxonDecorator
3
3
  # rubocop:disable Metrics/MethodLength
4
- def self.prepended(base)
4
+ def self.prepended(base) # rubocop:disable Metrics/AbcSize
5
5
  base.include SpreeCmCommissioner::TaxonKind
6
6
  base.include SpreeCmCommissioner::Transit::TaxonBitwise
7
7
 
@@ -54,6 +54,18 @@ module SpreeCmCommissioner
54
54
  base.has_many :invite_user_events, through: :user_events, class_name: 'SpreeCmCommissioner::InviteUserEvent'
55
55
 
56
56
  base.has_many :line_items, through: :products
57
+ base.has_many :event_blazer_queries, class_name: 'SpreeCmCommissioner::TaxonBlazerQuery'
58
+ base.has_many :blazer_queries, through: :event_blazer_queries, class_name: 'Blazer::Query'
59
+
60
+ def base.active_homepage_events
61
+ joins(:homepage_section_relatables)
62
+ .joins("INNER JOIN spree_taxons taxon ON taxon.id = cm_homepage_section_relatables.relatable_id
63
+ AND cm_homepage_section_relatables.relatable_type = 'Spree::Taxon'"
64
+ )
65
+ .joins('INNER JOIN cm_homepage_sections ON cm_homepage_section_relatables.homepage_section_id = cm_homepage_sections.id')
66
+ .where(cm_homepage_sections: { tenant_id: nil, active: true })
67
+ .where(kind: :event)
68
+ end
57
69
  end
58
70
  # rubocop:enable Metrics/MethodLength
59
71
 
@@ -0,0 +1,30 @@
1
+ module SpreeCmCommissioner
2
+ class TripConnection < ApplicationRecord
3
+ attr_accessor :hours, :minutes
4
+
5
+ belongs_to :from_trip, class_name: 'Spree::Variant'
6
+ belongs_to :to_trip, class_name: 'Spree::Variant'
7
+
8
+ validate :both_trip_cannot_be_the_same
9
+ before_validation :calculate_connection_time_minutes
10
+
11
+ private
12
+
13
+ def calculate_connection_time_minutes
14
+ return if from_trip.nil? || to_trip.nil?
15
+
16
+ connection_time_in_minutes = (to_trip.options.departure_time - from_trip.options.arrival_time) / 60
17
+ if connection_time_in_minutes.between?(0, 180)
18
+ self.connection_time_minutes = connection_time_in_minutes
19
+ else
20
+ errors.add(:base, 'Connection time should be between 0 and 180 minutes')
21
+ end
22
+ end
23
+
24
+ def both_trip_cannot_be_the_same
25
+ return unless from_trip.id == to_trip.id
26
+
27
+ errors.add(:base, 'Both trip cannot be the same')
28
+ end
29
+ end
30
+ end
@@ -55,6 +55,15 @@ module SpreeCmCommissioner
55
55
  base.has_many :places, through: :user_places, class_name: 'SpreeCmCommissioner::Place'
56
56
  end
57
57
 
58
+ def permissions_for_vendor(vendor_id)
59
+ permissions.joins(role_permissions: :role).where(spree_roles: { vendor_id: vendor_id })
60
+ end
61
+
62
+ # override
63
+ def has_spree_role?(role_name) # rubocop:disable Naming/PredicateName
64
+ spree_roles.non_vendor.exists?(name: role_name)
65
+ end
66
+
58
67
  def super_admin?
59
68
  has_spree_role?('super_admin')
60
69
  end
@@ -0,0 +1,7 @@
1
+ <!-- insert_before "erb[loud]:contains('field_container :hide_from_nav')" -->
2
+
3
+ <%= f.field_container :hide_video_banner, class: ['custom-control', 'custom-checkbox', 'my-4'] do %>
4
+ <%= f.check_box :hide_video_banner, class: 'custom-control-input' %>
5
+ <%= f.label :hide_video_banner, Spree.t(:hide_video_banner), class: 'custom-control-label' %>
6
+ <%= f.error_message_on :hide_video_banner %>
7
+ <% end %>
@@ -0,0 +1,18 @@
1
+ module Spree
2
+ module V2
3
+ module Storefront
4
+ class ActiveHomepageEventSerializer < BaseSerializer
5
+ attributes :name, :pretty_name, :permalink, :seo_title,
6
+ :description, :meta_title, :meta_description, :meta_keywords,
7
+ :depth, :updated_at, :custom_redirect_url, :kind,
8
+ :subtitle, :from_date, :to_date
9
+
10
+ attribute :is_root, &:root?
11
+ attribute :is_child, &:child?
12
+ attribute :is_leaf, &:leaf?
13
+
14
+ has_one :category_icon, serializer: ::SpreeCmCommissioner::V2::Storefront::AssetSerializer
15
+ end
16
+ end
17
+ end
18
+ end
@@ -14,7 +14,7 @@ module Spree
14
14
 
15
15
  base.attributes :custom_redirect_url, :kind, :subtitle, :from_date, :to_date,
16
16
  :background_color, :foreground_color, :show_badge_status,
17
- :purchasable_on, :vendor_id, :available_on
17
+ :purchasable_on, :vendor_id, :available_on, :hide_video_banner
18
18
 
19
19
  base.attribute :purchasable_on_app do |taxon|
20
20
  taxon.purchasable_on == 'app' || taxon.purchasable_on == 'both'
@@ -0,0 +1,10 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class BookingCardClassSerializer < GuestCardClassSerializer
5
+ attributes :name, :class_type
6
+ has_one :background_image, serializer: SpreeCmCommissioner::V2::Storefront::AssetSerializer
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class GuestCardClassSerializer < BaseSerializer
5
+ attributes :id, :name
6
+
7
+ belongs_to :taxon, serializer: Spree::V2::Storefront::TaxonSerializer
8
+ end
9
+ end
10
+ end
11
+ end
@@ -2,6 +2,7 @@ module Spree
2
2
  module V2
3
3
  module Tenant
4
4
  class OrderSerializer < Spree::V2::Storefront::CartSerializer
5
+ has_many :guest_card_classes, serializer: Spree::V2::Tenant::BookingCardClassSerializer
5
6
  end
6
7
  end
7
8
  end
@@ -0,0 +1,85 @@
1
+ <% blazer_title @query.name %>
2
+
3
+ <div class="topbar">
4
+ <div class="container">
5
+ <div class="row" style="padding-top: 13px;">
6
+ <div class="col-sm-9">
7
+ <%= render partial: "blazer/nav" %>
8
+ <h3 style="line-height: 34px; display: inline; margin-left: 5px;">
9
+ <%= @query.name %>
10
+ </h3>
11
+ </div>
12
+ <div class="col-sm-3 text-right">
13
+ <%= link_to "Edit", edit_query_path(@query, params: variable_params(@query)), class: "btn btn-default", disabled: !@query.editable?(blazer_user) %>
14
+ <%= link_to "Fork", new_query_path(params: {variables: variable_params(@query), fork_query_id: @query.id, data_source: @query.data_source, name: @query.name}), class: "btn btn-info" %>
15
+
16
+ <% if !@error && @success %>
17
+ <%= button_to "Download", run_queries_path(format: "csv"), params: @run_data, class: "btn btn-primary" %>
18
+ <% end %>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ </div>
23
+
24
+ <div style="margin-bottom: 60px;"></div>
25
+
26
+ <% if @sql_errors.any? %>
27
+ <div class="alert alert-danger">
28
+ <ul>
29
+ <% @sql_errors.each do |message| %>
30
+ <li><%= message %></li>
31
+ <% end %>
32
+ </ul>
33
+ </div>
34
+ <% end %>
35
+
36
+ <% if @query.description.present? %>
37
+ <p style="white-space: pre-line;"><%= @query.description %></p>
38
+ <% end %>
39
+
40
+ <div style="display: flex;">
41
+ <%= render partial: "blazer/variables", locals: { action: query_path(@query) } %>
42
+ <% if !@error && @success && params[:event_id].present? %>
43
+ <div>
44
+ <%= link_to 'Save Event',
45
+ spree.admin_event_blazer_queries_path(event_id: params[:event_id], blazer_query_id: params[:id].split('-').first),
46
+ method: :post,
47
+ class: "btn btn-primary",
48
+ style: "margin-left: 10px;" %>
49
+ </div>
50
+ <% end %>
51
+ </div>
52
+
53
+ <% if flash[:success] %>
54
+ <div class="alert alert-success">
55
+ <%= flash[:success] %>
56
+ </div>
57
+ <% elsif flash[:alert] %>
58
+ <div class="alert alert-danger">
59
+ <%= flash[:alert] %>
60
+ </div>
61
+ <% end %>
62
+
63
+
64
+ <pre id="code"><code><%= @statement.display_statement %></code></pre>
65
+
66
+ <% if @success %>
67
+ <div id="results">
68
+ <p class="text-muted">Loading...</p>
69
+ </div>
70
+
71
+ <script>
72
+ function showRun(data) {
73
+ $("#results").html(data)
74
+ $("#results table").stupidtable(stupidtableCustomSettings).stickyTableHeaders({fixedOffset: 60})
75
+ }
76
+
77
+ function showError(message) {
78
+ $("#results").addClass("query-error").html(message)
79
+ }
80
+
81
+ <%= blazer_js_var "data", @run_data %>
82
+
83
+ runQuery(data, showRun, showError)
84
+ </script>
85
+ <% end %>
@@ -0,0 +1,85 @@
1
+ <div class="topbar">
2
+ <div class="row" style="padding-top: 13px; margin: 0;">
3
+ <div class="col-sm-9"></div>
4
+ <div class="col-sm-3 text-right">
5
+ <%= render partial: 'blazer/queries/embed/download_button' %>
6
+ </div>
7
+ </div>
8
+ </div>
9
+ <div style="margin-bottom: 10px;"></div>
10
+
11
+ <% if @success %>
12
+ <div id="results" style="font-family: 'Poppins', sans-serif;"></div>
13
+ <p class="text-muted">Loading...</p>
14
+ </div>
15
+
16
+ <script>
17
+ function showRun(data) {
18
+ $("#results").html(data)
19
+ $("#results table").stupidtable(stupidtableCustomSettings).stickyTableHeaders({fixedOffset: 60})
20
+ }
21
+
22
+ function showError(message) {
23
+ $("#results").addClass("query-error").html(message)
24
+ }
25
+
26
+ <%= blazer_js_var "data", @run_data %>
27
+
28
+ runQuery(data, showRun, showError)
29
+ </script>
30
+ <% end %>
31
+
32
+
33
+ <% theme = cookies[:theme] %>
34
+ <%
35
+ colors = {
36
+ 'dark' => { background: '#1a1f26', text: '#fff', table_background: 'oklch(25.33% 0.016 252.42)', border: '#2f353d' },
37
+ 'light' => { background: '#f7f9fa', text: '#000', table_background: '#fff', border: '#E5E7EB' }
38
+ }
39
+ theme_colors = colors[theme] || colors['light']
40
+ %>
41
+
42
+ <style>
43
+ .topbar {
44
+ background-color: <%= theme_colors[:background] %>;
45
+ }
46
+
47
+ #results table {
48
+ background-color: <%= theme_colors[:table_background] %>;
49
+ color: <%= theme_colors[:text] %>;
50
+ border: none;
51
+ }
52
+
53
+ #results table th,
54
+ #results table td {
55
+ font-size: 16px;
56
+ padding: 15px;
57
+ border-bottom: 1px solid <%= theme_colors[:border] %>;
58
+ }
59
+
60
+ #results table th {
61
+ font-weight: 700;
62
+ background-color: <%= theme_colors[:table_background] %>;
63
+ }
64
+
65
+ #results table td {
66
+ font-size: 14px;
67
+ }
68
+
69
+ .download-btn {
70
+ background-color: <%= theme_colors[:table_background] %>;
71
+ border: 1px solid <%= theme_colors[:border] %>;
72
+ border-radius: 50%;
73
+ width: 40px;
74
+ height: 40px;
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: center;
78
+ }
79
+
80
+ .download-btn svg {
81
+ width: 15px;
82
+ height: 15px;
83
+ fill: <%= theme_colors[:text] %>;
84
+ }
85
+ </style>
@@ -0,0 +1,7 @@
1
+ <% if !@error && @success %>
2
+ <%= button_to run_queries_path(format: "csv"), params: @run_data, class: "download-btn" do %>
3
+ <svg width="18" height="19" viewBox="0 0 18 19" fill="none" xmlns="http://www.w3.org/2000/svg">
4
+ <path d="M0 17H18V19H0V17ZM10 11.1716L16.0711 5.1005L17.4853 6.51472L9 15L0.51472 6.51472L1.92893 5.1005L8 11.1716V0H10V11.1716Z" />
5
+ </svg>
6
+ <% end %>
7
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <% if params[:embed].present? %>
2
+ <%= render partial: "blazer/queries/embed/content" %>
3
+ <% else %>
4
+ <%= render partial: "content" %>
5
+ <% end %>
6
+
7
+ <script>
8
+ var code = $("#code code");
9
+ if (code.text().length < 10000) {
10
+ hljs.highlightElement(code.get(0));
11
+ }
12
+ </script>
@@ -0,0 +1,35 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= blazer_title ? blazer_title : "Blazer" %></title>
5
+
6
+ <link rel="preconnect" href="https://fonts.googleapis.com">
7
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
8
+ <link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
9
+
10
+ <meta charset="utf-8" />
11
+ <%= favicon_link_tag "blazer/favicon.png" %>
12
+ <% if defined?(Propshaft::Railtie) %>
13
+ <%= stylesheet_link_tag "blazer/bootstrap-propshaft", "blazer/bootstrap", "blazer/selectize", "blazer/github", "blazer/daterangepicker", "blazer/application" %>
14
+ <%= javascript_include_tag "blazer/jquery", "blazer/rails-ujs", "blazer/stupidtable", "blazer/stupidtable-custom-settings", "blazer/jquery.stickytableheaders", "blazer/selectize", "blazer/highlight.min", "blazer/moment", "blazer/moment-timezone-with-data", "blazer/daterangepicker", "blazer/chart.umd", "blazer/chartjs-adapter-date-fns.bundle", "blazer/chartkick", "blazer/mapkick.bundle", "blazer/ace/ace", "blazer/ace/ext-language_tools", "blazer/ace/theme-twilight", "blazer/ace/mode-sql", "blazer/ace/snippets/text", "blazer/ace/snippets/sql", "blazer/Sortable", "blazer/bootstrap", "blazer/vue.global.prod", "blazer/routes", "blazer/queries", "blazer/fuzzysearch", "blazer/application" %>
15
+ <% else %>
16
+ <%= stylesheet_link_tag "blazer/application" %>
17
+ <%= javascript_include_tag "blazer/application" %>
18
+ <% end %>
19
+ <script>
20
+ <%= blazer_js_var "rootPath", root_path %>
21
+ </script>
22
+ <%= csrf_meta_tags %>
23
+ </head>
24
+ <body>
25
+ <% if params[:embed].present? %>
26
+ <div>
27
+ <%= yield %>
28
+ </div>
29
+ <% else %>
30
+ <div class="container">
31
+ <%= yield %>
32
+ </div>
33
+ <% end %>
34
+ </body>
35
+ </html>
@@ -34,6 +34,7 @@ module Spree
34
34
  show_badge_status
35
35
  purchasable_on
36
36
  available_on
37
+ hide_video_banner
37
38
  vendor_id
38
39
  ]
39
40
 
@@ -573,4 +573,7 @@ en:
573
573
  url_expired: 'Invitation link is expired'
574
574
  already_invited: 'Failed: User already invited to event'
575
575
  update_fail: 'Failed: to Update invite user'
576
+ event_blazer_queries:
577
+ success: 'Event saved Successfully'
578
+ fail: 'Event already saved'
576
579
 
@@ -417,4 +417,8 @@ km:
417
417
  accept_fail: 'បរាជ័យក្នុងការទទួលយកការអញ្ជើញ'
418
418
  url_expired: 'តំណ​អញ្ជើញ​បាន​ផុត​កំណត់'
419
419
  already_invited: 'បរាជ័យ៖ អ្នកប្រើប្រាស់បានអញ្ជើញចូលរួមព្រឹត្តិការណ៍រួចហើយ'
420
- update_fail: 'បរាជ័យ៖ ធ្វើបច្ចុប្បន្នភាពអ្នកប្រើប្រាស់អញ្ជើញ'
420
+ update_fail: 'បរាជ័យ៖ ធ្វើបច្ចុប្បន្នភាពអ្នកប្រើប្រាស់អញ្ជើញ'
421
+
422
+ event_blazer_queries:
423
+ success: 'បានរក្សាទុកព្រឹត្តិការណ៍ដោយជោគជ័យ'
424
+ fail: 'បានរក្សាទុកព្រឹត្តិការណ៍រួចហើយs'
data/config/routes.rb CHANGED
@@ -267,6 +267,7 @@ Spree::Core::Engine.add_routes do
267
267
  resources :tenants do
268
268
  resources :vendors, controller: :tenant_vendors
269
269
  end
270
+ resources :event_blazer_queries
270
271
  end
271
272
 
272
273
  resources :events, controller: 'events/base' do
@@ -463,6 +464,9 @@ Spree::Core::Engine.add_routes do
463
464
  resource :account, controller: :account, only: %i[show update]
464
465
  resource :account_deletions, only: %i[destroy]
465
466
  resource :account_recovers, only: [:update]
467
+ namespace :account do
468
+ resources :orders, controller: :orders, only: %i[index show]
469
+ end
466
470
 
467
471
  resource :cart, controller: :cart, only: %i[show create destroy] do
468
472
  post :add_item
@@ -498,6 +502,7 @@ Spree::Core::Engine.add_routes do
498
502
  resource :s3_signed_urls
499
503
  resource :profile_images, only: %i[update destroy]
500
504
  resources :line_items, only: %i[index show]
505
+ resources :guest_card_classes
501
506
  end
502
507
 
503
508
  namespace :storefront do
@@ -577,6 +582,7 @@ Spree::Core::Engine.add_routes do
577
582
  resources :homepage_sections, only: [:index]
578
583
  resource :homepage_background, controller: :homepage_background, only: [:show]
579
584
  end
585
+ resources :active_homepage_events, only: [:index]
580
586
 
581
587
  resources :qr_urls, only: [:show]
582
588
  resources :guest_qrs, only: [:show]
@@ -0,0 +1,12 @@
1
+ class CreateTripConnections < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :cm_trip_connections, if_not_exists: true do |t|
4
+ t.references :from_trip, null: false, foreign_key: { to_table: :spree_variants }, index: true,if_not_exists: true
5
+ t.references :to_trip, null: false, foreign_key: { to_table: :spree_variants }, index: true, if_not_exists: true
6
+ t.integer :connection_time_minutes, null: false, if_not_exists: true
7
+ t.text :description, null: true, if_not_exists: true
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ class AddHideVideoBannerToSpreeTaxon < ActiveRecord::Migration[7.0]
2
+ def change
3
+ add_column :spree_taxons, :hide_video_banner, :boolean, default: false, if_not_exists: true
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ class CreateSpreeCmCommissionerTaxonBlazerQuery < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :cm_taxon_blazer_queries,if_not_exists: true do |t|
4
+ t.references :taxon, foreign_key: { to_table: :spree_taxons }, null: false, index: true
5
+ t.references :blazer_query, foreign_key: { to_table: :blazer_queries }, null: false, index: true
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
10
+
@@ -0,0 +1,5 @@
1
+ class AddDescriptionToSpreeRoles < ActiveRecord::Migration[7.0]
2
+ def change
3
+ add_column :spree_roles, :description, :text
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ class AddVendorIdToSpreeRoles < ActiveRecord::Migration[7.0]
2
+ def change
3
+ add_column :spree_roles, :vendor_id, :integer, if_not_exists: true
4
+ add_index :spree_roles, :vendor_id
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ class RemoveUniqueConstraintFromNameInSpreeRoles < ActiveRecord::Migration[7.0]
2
+ def change
3
+ if index_exists?(:spree_roles, :name, unique: true)
4
+ remove_index :spree_roles, :name
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,14 @@
1
+ SELECT
2
+ *
3
+ FROM spree_taxons
4
+
5
+ INNER JOIN cm_homepage_section_relatables
6
+ ON spree_taxons.id = cm_homepage_section_relatables.relatable_id
7
+ AND cm_homepage_section_relatables.relatable_type = 'Spree::Taxon'
8
+
9
+ INNER JOIN cm_homepage_sections
10
+ ON cm_homepage_section_relatables.homepage_section_id = cm_homepage_sections.id
11
+
12
+ WHERE cm_homepage_sections.tenant_id IS NULL
13
+ AND cm_homepage_sections.active = TRUE
14
+ AND spree_taxons.kind = 2
@@ -1,5 +1,5 @@
1
1
  module SpreeCmCommissioner
2
- VERSION = '1.8.5'.freeze
2
+ VERSION = '1.8.6'.freeze
3
3
 
4
4
  module_function
5
5
 
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: 1.8.5
4
+ version: 1.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - You
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-26 00:00:00.000000000 Z
11
+ date: 2025-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree
@@ -657,6 +657,7 @@ files:
657
657
  - app/assets/stylesheets/spree_cm_commissioner/telegram/telegram_bot.css.scss
658
658
  - app/assets/stylesheets/spree_cm_commissioner/vehicle_seat.css
659
659
  - app/controllers/.gitkeep
660
+ - app/controllers/blazer/base_controller_decorator.rb
660
661
  - app/controllers/concerns/spree/billing/order_parents_concern.rb
661
662
  - app/controllers/concerns/spree/billing/payment_creatable.rb
662
663
  - app/controllers/concerns/spree/billing/payment_fireable.rb
@@ -674,6 +675,7 @@ files:
674
675
  - app/controllers/spree/admin/classifications_controller.rb
675
676
  - app/controllers/spree/admin/customer_notifications_controller.rb
676
677
  - app/controllers/spree/admin/device_tokens_controller.rb
678
+ - app/controllers/spree/admin/event_blazer_queries_controller.rb
677
679
  - app/controllers/spree/admin/feature_images_controller.rb
678
680
  - app/controllers/spree/admin/google_wallets_controller.rb
679
681
  - app/controllers/spree/admin/guest_card_classes_controller.rb
@@ -761,6 +763,7 @@ files:
761
763
  - app/controllers/spree/api/v2/storefront/account_checker_controller.rb
762
764
  - app/controllers/spree/api/v2/storefront/account_deletions_controller.rb
763
765
  - app/controllers/spree/api/v2/storefront/account_recovers_controller.rb
766
+ - app/controllers/spree/api/v2/storefront/active_homepage_events_controller.rb
764
767
  - app/controllers/spree/api/v2/storefront/anonymous_line_items_controller.rb
765
768
  - app/controllers/spree/api/v2/storefront/anonymous_orders_controller.rb
766
769
  - app/controllers/spree/api/v2/storefront/cart_guests_controller.rb
@@ -812,6 +815,7 @@ files:
812
815
  - app/controllers/spree/api/v2/storefront/waiting_room_sessions_controller.rb
813
816
  - app/controllers/spree/api/v2/storefront/wished_items_controller.rb
814
817
  - app/controllers/spree/api/v2/storefront/wishlists_controller_decorator.rb
818
+ - app/controllers/spree/api/v2/tenant/account/orders_controller.rb
815
819
  - app/controllers/spree/api/v2/tenant/account_checker_controller.rb
816
820
  - app/controllers/spree/api/v2/tenant/account_controller.rb
817
821
  - app/controllers/spree/api/v2/tenant/account_deletions_controller.rb
@@ -1211,6 +1215,7 @@ files:
1211
1215
  - app/models/spree_cm_commissioner/store_decorator.rb
1212
1216
  - app/models/spree_cm_commissioner/subscription.rb
1213
1217
  - app/models/spree_cm_commissioner/taxon_app_banner.rb
1218
+ - app/models/spree_cm_commissioner/taxon_blazer_query.rb
1214
1219
  - app/models/spree_cm_commissioner/taxon_brand_logo.rb
1215
1220
  - app/models/spree_cm_commissioner/taxon_category_icon.rb
1216
1221
  - app/models/spree_cm_commissioner/taxon_decorator.rb
@@ -1222,6 +1227,7 @@ files:
1222
1227
  - app/models/spree_cm_commissioner/telegram_bot.rb
1223
1228
  - app/models/spree_cm_commissioner/tenant.rb
1224
1229
  - app/models/spree_cm_commissioner/trip.rb
1230
+ - app/models/spree_cm_commissioner/trip_connection.rb
1225
1231
  - app/models/spree_cm_commissioner/trip_stop.rb
1226
1232
  - app/models/spree_cm_commissioner/user_decorator.rb
1227
1233
  - app/models/spree_cm_commissioner/user_deletion_survey.rb
@@ -1350,6 +1356,7 @@ files:
1350
1356
  - app/overrides/spree/admin/taxons/_form/available_on.html.erb.deface
1351
1357
  - app/overrides/spree/admin/taxons/_form/background_color_and_foreground_color.html.erb.deface
1352
1358
  - app/overrides/spree/admin/taxons/_form/custom_redirect_url.html.erb.deface
1359
+ - app/overrides/spree/admin/taxons/_form/hide_video_banner.html.erb.deface
1353
1360
  - app/overrides/spree/admin/taxons/_form/kind_html.erb.deface
1354
1361
  - app/overrides/spree/admin/taxons/_form/purchasable_on_status.html.erb.deface
1355
1362
  - app/overrides/spree/admin/taxons/_form/show_badge_status.html.erb.deface
@@ -1422,6 +1429,7 @@ files:
1422
1429
  - app/serializers/spree/v2/organizer/ticket_serializer.rb
1423
1430
  - app/serializers/spree/v2/organizer/user_serializer.rb
1424
1431
  - app/serializers/spree/v2/storefront/accommodation_serializer.rb
1432
+ - app/serializers/spree/v2/storefront/active_homepage_event_serializer.rb
1425
1433
  - app/serializers/spree/v2/storefront/address_serializer_decorator.rb
1426
1434
  - app/serializers/spree/v2/storefront/cart_serializer_decorator.rb
1427
1435
  - app/serializers/spree/v2/storefront/customer_notification_serializer.rb
@@ -1452,8 +1460,10 @@ files:
1452
1460
  - app/serializers/spree/v2/tenant/address_serializer.rb
1453
1461
  - app/serializers/spree/v2/tenant/asset_serializer.rb
1454
1462
  - app/serializers/spree/v2/tenant/base_serializer.rb
1463
+ - app/serializers/spree/v2/tenant/booking_card_class_serializer.rb
1455
1464
  - app/serializers/spree/v2/tenant/customer_notification_serializer.rb
1456
1465
  - app/serializers/spree/v2/tenant/digital_link_serializer.rb
1466
+ - app/serializers/spree/v2/tenant/guest_card_class_serializer.rb
1457
1467
  - app/serializers/spree/v2/tenant/guest_serializer.rb
1458
1468
  - app/serializers/spree/v2/tenant/homepage_section_relatable_serializer.rb
1459
1469
  - app/serializers/spree/v2/tenant/homepage_section_serializer.rb
@@ -1575,6 +1585,11 @@ files:
1575
1585
  - app/services/spree_cm_commissioner/webhooks/subscribers/handle_request_decorator.rb
1576
1586
  - app/services/spree_cm_commissioner/webhooks/subscribers/make_request.rb
1577
1587
  - app/services/spree_cm_commissioner/webhooks/subscribers/queue_requests_decorator.rb
1588
+ - app/views/blazer/queries/_content.html.erb
1589
+ - app/views/blazer/queries/embed/_content.html.erb
1590
+ - app/views/blazer/queries/embed/_download_button.html.erb
1591
+ - app/views/blazer/queries/show.html.erb
1592
+ - app/views/layouts/blazer/application.html.erb
1578
1593
  - app/views/shared/_asset_field.html.erb
1579
1594
  - app/views/shared/_calendar.html.erb
1580
1595
  - app/views/shared/_kind_field.html.erb
@@ -2279,11 +2294,18 @@ files:
2279
2294
  - db/migrate/20250307073003_add_tenant_id_to_cm_customer_notifications.rb
2280
2295
  - db/migrate/20250307083809_remove_tenant_id_from_cm_notifications.rb
2281
2296
  - db/migrate/20250314013434_add_available_on_to_spree_taxons.rb
2297
+ - db/migrate/20250321041406_create_trip_connections.rb
2298
+ - db/migrate/20250327074327_add_hide_video_banner_to_spree_taxon.rb
2299
+ - db/migrate/20250327094626_create_spree_cm_commissioner_taxon_blazer_query.rb
2300
+ - db/migrate/20250328072717_add_description_to_spree_roles.rb
2301
+ - db/migrate/20250328072841_add_vendor_id_to_spree_roles.rb
2302
+ - db/migrate/20250328072947_remove_unique_constraint_from_name_in_spree_roles.rb
2282
2303
  - docker-compose.yml
2283
2304
  - docs/option_types/attr_types.md
2284
2305
  - docs/private_key.pem
2285
2306
  - docs/public_key.pem
2286
2307
  - docs/spree_core/add_new_promotion.md
2308
+ - docs/sql/events/active_homepage_events.sql
2287
2309
  - docs/sql/subscriptions/remaining_subscriptions.sql
2288
2310
  - docs/webhook/sqs.rb
2289
2311
  - docs/webhook/sqs/params_job_complete.json