spree_cm_commissioner 1.8.0 → 1.8.2

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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/.tool-versions +1 -0
  3. data/Gemfile.lock +1 -1
  4. data/app/assets/images/mailer/bookme-plus_light.svg +1 -0
  5. data/app/controllers/spree/admin/taxons_controller_decorator.rb +5 -0
  6. data/app/controllers/spree/api/v2/organizer/invites_controller.rb +35 -0
  7. data/app/controllers/spree/api/v2/tenant/customer_notifications_controller.rb +20 -0
  8. data/app/controllers/spree/api/v2/tenant/line_items_controller.rb +56 -0
  9. data/app/controllers/spree/api/v2/tenant/notifications_controller.rb +55 -0
  10. data/app/controllers/spree/api/v2/tenant/profile_images_controller.rb +52 -0
  11. data/app/controllers/spree/api/v2/tenant/s3_signed_urls_controller.rb +29 -0
  12. data/app/interactors/spree_cm_commissioner/crew_inviter.rb +63 -0
  13. data/app/interactors/spree_cm_commissioner/customer_notification_sender.rb +10 -5
  14. data/app/interactors/spree_cm_commissioner/profile_image_destroyer.rb +16 -0
  15. data/app/mailers/spree_cm_commissioner/crew_invite_mailer.rb +13 -0
  16. data/app/models/concerns/spree_cm_commissioner/option_type_attr_type.rb +6 -1
  17. data/app/models/spree_cm_commissioner/crew_invite.rb +7 -0
  18. data/app/models/spree_cm_commissioner/invite.rb +22 -0
  19. data/app/models/spree_cm_commissioner/invite_user_event.rb +5 -0
  20. data/app/models/spree_cm_commissioner/invite_user_taxon.rb +11 -0
  21. data/app/models/spree_cm_commissioner/line_item_decorator.rb +1 -1
  22. data/app/models/spree_cm_commissioner/order_decorator.rb +1 -1
  23. data/app/models/spree_cm_commissioner/place.rb +2 -0
  24. data/app/models/spree_cm_commissioner/product_decorator.rb +4 -0
  25. data/app/models/spree_cm_commissioner/taxon_decorator.rb +5 -0
  26. data/app/models/spree_cm_commissioner/taxon_video_banner.rb +4 -0
  27. data/app/models/spree_cm_commissioner/user_decorator.rb +4 -0
  28. data/app/models/spree_cm_commissioner/variant_options.rb +23 -0
  29. data/app/models/spree_cm_commissioner/video.rb +15 -0
  30. data/app/overrides/spree/admin/taxons/_form/assets_form.html.erb.deface +19 -0
  31. data/app/overrides/spree/admin/taxons/_form/available_on.html.erb.deface +18 -0
  32. data/app/serializers/spree/v2/organizer/asset_serializer.rb +11 -0
  33. data/app/serializers/spree/v2/organizer/invite_serializer.rb +11 -0
  34. data/app/serializers/spree/v2/organizer/taxon_serializer.rb +10 -0
  35. data/app/serializers/spree/v2/organizer/user_serializer.rb +9 -0
  36. data/app/serializers/spree/v2/storefront/taxon_serializer_decorator.rb +2 -1
  37. data/app/serializers/spree/v2/tenant/customer_notification_serializer.rb +11 -0
  38. data/app/serializers/spree/v2/tenant/digital_link_serializer.rb +9 -0
  39. data/app/serializers/spree/v2/tenant/image_serializer.rb +11 -0
  40. data/app/serializers/spree/v2/tenant/line_item_serializer.rb +35 -0
  41. data/app/serializers/spree/v2/tenant/notification_serializer.rb +11 -0
  42. data/app/serializers/spree/v2/tenant/option_type_serializer.rb +12 -0
  43. data/app/serializers/spree/v2/tenant/option_value_serializer.rb +17 -0
  44. data/app/serializers/spree/v2/tenant/order_serializer.rb +8 -0
  45. data/app/serializers/spree/v2/tenant/s3_signed_url_serializer.rb +9 -0
  46. data/app/serializers/spree/v2/tenant/stock_item_serializer.rb +11 -0
  47. data/app/serializers/spree/v2/tenant/stock_location_serializer.rb +11 -0
  48. data/app/serializers/spree/v2/tenant/user_profile_serializer.rb +8 -0
  49. data/app/serializers/spree/v2/tenant/variant_serializer.rb +46 -0
  50. data/app/serializers/spree_cm_commissioner/v2/storefront/video_serializer.rb +9 -0
  51. data/app/views/spree/admin/customer_notifications/_form.html.erb +8 -0
  52. data/app/views/spree_cm_commissioner/crew_invite_mailer/_mailer_stylesheets.html.erb +82 -0
  53. data/app/views/spree_cm_commissioner/crew_invite_mailer/send_crew_invite_email.html.erb +33 -0
  54. data/app/views/spree_cm_commissioner/layouts/crew_invite_mailer.html.erb +15 -0
  55. data/config/initializers/spree_permitted_attributes.rb +1 -0
  56. data/config/locales/en.yml +10 -1
  57. data/config/locales/km.yml +10 -1
  58. data/config/routes.rb +15 -0
  59. data/db/migrate/20250304101907_create_spree_cm_commissioner_invite.rb +12 -0
  60. data/db/migrate/20250304101946_create_spree_cm_commissioner_invite_user_taxon.rb +11 -0
  61. data/db/migrate/20250307013422_add_parent_id_to_cm_place.rb +9 -0
  62. data/db/migrate/20250307073003_add_tenant_id_to_cm_customer_notifications.rb +6 -0
  63. data/db/migrate/20250307083809_remove_tenant_id_from_cm_notifications.rb +6 -0
  64. data/db/migrate/20250314013434_add_available_on_to_spree_taxons.rb +5 -0
  65. data/lib/spree_cm_commissioner/test_helper/factories/invite_factory.rb +7 -0
  66. data/lib/spree_cm_commissioner/test_helper/factories/invite_user_event_factory.rb +5 -0
  67. data/lib/spree_cm_commissioner/test_helper/factories/option_type_factory.rb +30 -0
  68. data/lib/spree_cm_commissioner/test_helper/factories/user_event_factory.rb +6 -0
  69. data/lib/spree_cm_commissioner/version.rb +1 -1
  70. metadata +50 -2
@@ -0,0 +1,11 @@
1
+ module Spree
2
+ module V2
3
+ module Organizer
4
+ class AssetSerializer < BaseSerializer
5
+ include ::Spree::Api::V2::ImageTransformationConcern
6
+
7
+ attributes :alt, :original_url, :position, :styles
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Spree
2
+ module V2
3
+ module Organizer
4
+ class InviteSerializer < BaseSerializer
5
+ attributes :token, :expires_at
6
+ belongs_to :taxon, serializer: Spree::V2::Organizer::TaxonSerializer
7
+ belongs_to :inviter, serializer: Spree::V2::Organizer::UserSerializer
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ module Spree
2
+ module V2
3
+ module Organizer
4
+ class TaxonSerializer < BaseSerializer
5
+ attributes :name
6
+ has_one :app_banner, serializer: Spree::V2::Organizer::AssetSerializer
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module Spree
2
+ module V2
3
+ module Organizer
4
+ class UserSerializer < BaseSerializer
5
+ attributes :first_name, :last_name, :email
6
+ end
7
+ end
8
+ end
9
+ end
@@ -10,10 +10,11 @@ module Spree
10
10
  base.has_one :app_banner, serializer: ::SpreeCmCommissioner::V2::Storefront::AssetSerializer
11
11
  base.has_one :web_banner, serializer: ::SpreeCmCommissioner::V2::Storefront::AssetSerializer
12
12
  base.has_one :home_banner, serializer: ::SpreeCmCommissioner::V2::Storefront::AssetSerializer
13
+ base.has_one :video_banner, serializer: ::SpreeCmCommissioner::V2::Storefront::VideoSerializer
13
14
 
14
15
  base.attributes :custom_redirect_url, :kind, :subtitle, :from_date, :to_date,
15
16
  :background_color, :foreground_color, :show_badge_status,
16
- :purchasable_on, :vendor_id
17
+ :purchasable_on, :vendor_id, :available_on
17
18
 
18
19
  base.attribute :purchasable_on_app do |taxon|
19
20
  taxon.purchasable_on == 'app' || taxon.purchasable_on == 'both'
@@ -0,0 +1,11 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class CustomerNotificationSerializer < BaseSerializer
5
+ attributes :title, :payload, :body, :url, :started_at, :sent_at, :notification_type, :action_label
6
+
7
+ has_many :feature_images, serializer: Spree::V2::Tenant::AssetSerializer
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class DigitalLinkSerializer < BaseSerializer
5
+ attribute :token
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class ImageSerializer < BaseSerializer
5
+ set_type :image
6
+
7
+ attributes :styles, :position, :alt, :created_at, :updated_at, :original_url
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,35 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class LineItemSerializer < BaseSerializer
5
+ attributes :name, :quantity, :price, :slug, :options_text, :currency,
6
+ :display_price, :total, :display_total, :adjustment_total,
7
+ :display_adjustment_total, :additional_tax_total, :discounted_amount,
8
+ :display_discounted_amount, :display_additional_tax_total, :promo_total,
9
+ :display_promo_total, :included_tax_total, :display_included_tax_total,
10
+ :from_date, :to_date, :need_confirmation, :product_type, :event_status, :amount,
11
+ :display_amount, :number, :qr_data, :kyc, :kyc_fields, :remaining_total_guests, :number_of_guests,
12
+ :completion_steps, :available_social_contact_platforms, :allow_anonymous_booking,
13
+ :discontinue_on, :high_demand, :jwt_token, :pre_tax_amount, :display_pre_tax_amount, :public_metadata
14
+
15
+ attribute :required_self_check_in_location, &:required_self_check_in_location?
16
+ attribute :allowed_self_check_in, &:allowed_self_check_in?
17
+ attribute :allowed_upload_later, &:allowed_upload_later?
18
+ attribute :delivery_required, &:delivery_required?
19
+ attribute :sufficient_stock, &:sufficient_stock?
20
+
21
+ has_one :vendor, serializer: Spree::V2::Tenant::VendorSerializer
22
+ has_one :product, serializer: Spree::V2::Storefront::ProductSerializer
23
+
24
+ belongs_to :variant, serializer: Spree::V2::Tenant::VariantSerializer
25
+ belongs_to :order, serializer: Spree::V2::Tenant::OrderSerializer
26
+
27
+ has_many :digital_links, serializer: Spree::V2::Tenant::DigitalLinkSerializer
28
+ has_many :guests, serializer: Spree::V2::Tenant::GuestSerializer
29
+
30
+ # completion_steps updates frequently
31
+ cache_options store: nil
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,11 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class NotificationSerializer < BaseSerializer
5
+ set_type :notification
6
+
7
+ attributes :read_at, :created_at, :params, :type
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class OptionTypeSerializer < BaseSerializer
5
+ attributes :name, :presentation, :position, :public_metadata,
6
+ :kind, :attr_type, :promoted, :hidden
7
+
8
+ has_many :option_values, serializer: Tenant::OptionValueSerializer
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class OptionValueSerializer < BaseSerializer
5
+ attributes :name, :presentation, :position, :public_metadata
6
+
7
+ attribute :display_icon do |option_value|
8
+ ActionController::Base.helpers.image_url(option_value.display_icon)
9
+ rescue StandardError
10
+ nil
11
+ end
12
+
13
+ belongs_to :option_type, serializer: Spree::V2::Tenant::OptionTypeSerializer
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class OrderSerializer < Spree::V2::Storefront::CartSerializer
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class S3SignedUrlSerializer < BaseSerializer
5
+ attribute :host, :fields, :url
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class StockItemSerializer < BaseSerializer
5
+ # add this because some frontend UI need total room/product for user to select.
6
+ # but for this, total stock will publicly shown.
7
+ attributes :count_on_hand
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class StockLocationSerializer < BaseSerializer
5
+ set_type :stock_location
6
+
7
+ attributes :name
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class UserProfileSerializer < Spree::V2::Tenant::AssetSerializer
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,46 @@
1
+ module Spree
2
+ module V2
3
+ module Tenant
4
+ class VariantSerializer < BaseSerializer
5
+ include Spree::Api::V2::DisplayMoneyHelper
6
+ attributes :sku, :barcode, :weight, :height, :width, :depth, :is_master, :options_text, :public_metadata
7
+ attribute :purchasable, &:purchasable?
8
+ attribute :in_stock, &:in_stock?
9
+ attribute :backorderable, &:backorderable?
10
+
11
+ attribute :currency do |_product, params|
12
+ params[:currency]
13
+ end
14
+
15
+ attribute :price do |product, params|
16
+ price(product, params[:currency])
17
+ end
18
+
19
+ attribute :display_price do |product, params|
20
+ display_price(product, params[:currency])
21
+ end
22
+
23
+ attribute :compare_at_price do |product, params|
24
+ compare_at_price(product, params[:currency])
25
+ end
26
+
27
+ attribute :display_compare_at_price do |product, params|
28
+ display_compare_at_price(product, params[:currency])
29
+ end
30
+
31
+ attributes :need_confirmation, :product_type, :kyc, :allow_anonymous_booking,
32
+ :reminder_in_hours, :start_time, :delivery_option,
33
+ :number_of_guests, :max_quantity_per_order, :discontinue_on, :high_demand
34
+
35
+ attribute :delivery_required, &:delivery_required?
36
+
37
+ belongs_to :product, serializer: Spree::V2::Storefront::ProductSerializer
38
+
39
+ has_many :images, serializer: Spree::V2::Tenant::ImageSerializer
40
+ has_many :option_values, serializer: Spree::V2::Tenant::OptionValueSerializer
41
+ has_many :stock_locations, serializer: Spree::V2::Tenant::StockLocationSerializer
42
+ has_many :stock_items, serializer: Spree::V2::Tenant::StockItemSerializer
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,9 @@
1
+ module SpreeCmCommissioner
2
+ module V2
3
+ module Storefront
4
+ class VideoSerializer < BaseSerializer
5
+ attributes :alt, :original_url
6
+ end
7
+ end
8
+ end
9
+ end
@@ -74,5 +74,13 @@
74
74
  <%= f.error_message_on :taxon_ids %>
75
75
  </div>
76
76
  </div>
77
+
78
+ <div class="col-lg-12 col-sm-12">
79
+ <div class="form-group">
80
+ <%= f.label :tenant_id, raw(Spree.t(:tenant) + ' (optional)') %>
81
+ <%= f.collection_select :tenant_id, SpreeCmCommissioner::Tenant.all, :id, :name, { prompt: Spree.t(:select_tenant) }, { class: 'form-control select2' } %>
82
+ <%= f.error_message_on :tenant_id %>
83
+ </div>
84
+ </div>
77
85
  </div>
78
86
  </div>
@@ -0,0 +1,82 @@
1
+ <style>
2
+ body, table, td {
3
+ font-family: 'Poppins', Arial, sans-serif;
4
+ margin: 0;
5
+ padding: 0;
6
+ }
7
+
8
+ .content-wrapper {
9
+ max-width: 500px;
10
+ margin: 0 auto;
11
+ border: 1px solid grey;
12
+ border-top: none;
13
+ }
14
+
15
+ .main-content{
16
+ padding-top: 10px;
17
+ padding-bottom: 25px;
18
+ }
19
+
20
+ .logo {
21
+ display: block;
22
+ width: 150px;
23
+ margin-top: 10px;
24
+ margin-bottom: 20px;
25
+ }
26
+
27
+ .heading-1 {
28
+ font-size: 24px;
29
+ text-align: center;
30
+ line-height: 1.4;
31
+ margin-bottom: 15px;
32
+ }
33
+
34
+ .bar-large {
35
+ height: 10px;
36
+ background-color: #5D54D9;
37
+ margin-bottom: 20px;
38
+
39
+ }
40
+
41
+ .bar-thin {
42
+ height: 3px;
43
+ height: 1px;
44
+ background-color: grey;
45
+ width: 100%;
46
+ margin: 20px auto;
47
+ }
48
+
49
+ .heading-2 {
50
+ font-size: 16px;
51
+ text-align: center;
52
+ line-height: 1.5;
53
+ }
54
+
55
+ .title-bold {
56
+ font-weight: bold;
57
+ color: #000;
58
+ }
59
+
60
+ .action-button {
61
+ display: inline-block;
62
+ background-color: #5D54D9;
63
+ border-radius: 24px;
64
+ font-size: 14px;
65
+ width: 222px;
66
+ height: 50px;
67
+ text-align: center;
68
+ line-height: 50px;
69
+ text-decoration: none;
70
+ cursor: pointer;
71
+ margin: 15px 0;
72
+ color: white !important;
73
+ text-decoration: none;
74
+ }
75
+
76
+ .heading-3 {
77
+ font-size: 12px;
78
+ text-align: center;
79
+ color: #888;
80
+ }
81
+ </style>
82
+
@@ -0,0 +1,33 @@
1
+ <table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" width="100%">
2
+ <tr>
3
+ <td align="center">
4
+ <div class="content-wrapper">
5
+ <div class="bar-large"></div>
6
+ <div class="main-content">
7
+ <div class="content">
8
+ <div><%= image_tag "mailer/bookme-plus_light.svg", class: "logo" %></div>
9
+ <div class="heading-1">
10
+ Become a part of the <br> event <strong> <%= @invite_user_event.invite.taxon.name %> </strong>
11
+ </div>
12
+ <div class="bar-thin"></div>
13
+ <div class="heading-2">
14
+ <%= @invite_user_event.invite.inviter.full_name.presence || @invite_user_event.inviter.email %> invites you to join the <br>
15
+ <span class="title-bold">Check-in Crew</span> for the event <br>
16
+ <%= @invite_user_event.invite.taxon.name %>
17
+ </div>
18
+ <div style="text-align: center;">
19
+ <a href="<%= @invite_user_event.invite.invite_url %>" class="action-button">
20
+ Get Started
21
+ </a>
22
+ </div>
23
+ <div class="heading-3">
24
+ Please note that this invitation will expire<br>
25
+ in <%= ((@invite_user_event.invite.expires_at - Time.current) / 1.hour).round %> hours.
26
+ </div>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </td>
31
+ </tr>
32
+ </table>
33
+
@@ -0,0 +1,15 @@
1
+
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
+ <meta name="x-apple-disable-message-reformatting"/>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
8
+ <link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
9
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
10
+ <%= render partial: 'spree_cm_commissioner/crew_invite_mailer/mailer_stylesheets' %>
11
+ </head>
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
@@ -33,6 +33,7 @@ module Spree
33
33
  preferred_foreground_color
34
34
  show_badge_status
35
35
  purchasable_on
36
+ available_on
36
37
  vendor_id
37
38
  ]
38
39
 
@@ -41,6 +41,8 @@ en:
41
41
  app_banner: App Banner (16x9)
42
42
  web_banner: Web banner (10x2)
43
43
  home_banner: Home Banner (16x9)
44
+ video_banner: Video Banner (9x16)
45
+ video_banner_require_size: Maximum size 10MB
44
46
  note: "<b>Note:</b> Subtitle is used for country code in Nationality Taxon"
45
47
 
46
48
  taxon_vendor:
@@ -564,4 +566,11 @@ en:
564
566
  update_success: Option Type updated successfully.
565
567
  user_roles_assigner:
566
568
  user_not_found: 'User not found'
567
- roles_empty: 'Roles are empty'
569
+ roles_empty: 'Roles are empty'
570
+ invite:
571
+ url_not_found: 'Invite link not found or have been expired'
572
+ accept_fail: 'Failed to accept invite'
573
+ url_expired: 'Invitation link is expired'
574
+ already_invited: 'Failed: User already invited to event'
575
+ update_fail: 'Failed: to Update invite user'
576
+
@@ -46,6 +46,8 @@ km:
46
46
  app_banner: App Banner (16x9)
47
47
  web_banner: Web banner (10x2)
48
48
  home_banner: Home Banner (16x9)
49
+ video_banner: Video Banner (9x16)
50
+ video_banner_require_size: Maximum size 10MB
49
51
 
50
52
  taxon_vendor:
51
53
  empty_info: "មិនមានព័ត៌មានអំពីអ្នកលក់ទេ"
@@ -408,4 +410,11 @@ km:
408
410
  not_found: 'រកមិនឃើញរូបភាព'
409
411
  user_roles_assigner:
410
412
  user_not_found: 'រកមិនឃើញអ្នកប្រើប្រាស់'
411
- roles_empty: 'តួនាទីគឺទទេ'
413
+ roles_empty: 'តួនាទីគឺទទេ'
414
+
415
+ invite:
416
+ url_not_found: 'រកមិនឃើញតំណអញ្ជើញ ឬផុតកំណត់ហើយ'
417
+ accept_fail: 'បរាជ័យក្នុងការទទួលយកការអញ្ជើញ'
418
+ url_expired: 'តំណ​អញ្ជើញ​បាន​ផុត​កំណត់'
419
+ already_invited: 'បរាជ័យ៖ អ្នកប្រើប្រាស់បានអញ្ជើញចូលរួមព្រឹត្តិការណ៍រួចហើយ'
420
+ update_fail: 'បរាជ័យ៖ ធ្វើបច្ចុប្បន្នភាពអ្នកប្រើប្រាស់អញ្ជើញ'
data/config/routes.rb CHANGED
@@ -173,6 +173,7 @@ Spree::Core::Engine.add_routes do
173
173
  delete :remove_app_banner
174
174
  delete :remove_web_banner
175
175
  delete :remove_home_banner
176
+ delete :remove_video_banner
176
177
  end
177
178
  end
178
179
  end
@@ -441,6 +442,7 @@ Spree::Core::Engine.add_routes do
441
442
  end
442
443
  resources :images
443
444
  resource :s3_signed_urls
445
+ resources :invites
444
446
  end
445
447
 
446
448
  namespace :tenant do
@@ -479,7 +481,20 @@ Spree::Core::Engine.add_routes do
479
481
  patch :complete
480
482
  end
481
483
 
484
+ resources :customer_notifications, only: [:show]
485
+ resources :notifications do
486
+ collection do
487
+ patch :mark_all_as_read
488
+ end
489
+ member do
490
+ patch :mark_as_read
491
+ end
492
+ end
493
+
482
494
  resources :user_account_linkages, only: %i[index create destroy]
495
+ resource :s3_signed_urls
496
+ resource :profile_images, only: %i[update destroy]
497
+ resources :line_items, only: %i[index show]
483
498
  end
484
499
 
485
500
  namespace :storefront do
@@ -0,0 +1,12 @@
1
+ class CreateSpreeCmCommissionerInvite < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :cm_invites, if_not_exists: true do |t|
4
+ t.string :token, null: false, unique: true
5
+ t.datetime :expires_at
6
+ t.string :type
7
+ t.references :inviter, null: false, foreign_key: { to_table: :spree_users }, index: true
8
+ t.references :taxon, null: false, foreign_key: { to_table: :spree_taxons }, index: true
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ class CreateSpreeCmCommissionerInviteUserTaxon < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :cm_invite_user_taxons, if_not_exists: true do |t|
4
+ t.references :invite, foreign_key: { to_table: :cm_invites }, null: true, index: true
5
+ t.references :user_taxon, foreign_key: { to_table: :cm_user_taxons }, null: true, index: true
6
+ t.string :email, index: true
7
+ t.datetime :confirmed_at
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ class AddParentIdToCmPlace < ActiveRecord::Migration[7.0]
2
+ def change
3
+ unless column_exists?(:cm_places, :parent_id)
4
+ add_column :cm_places, :parent_id, :integer, null: true
5
+ add_foreign_key :cm_places, :cm_places, column: :parent_id
6
+ add_index :cm_places, :parent_id
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ class AddTenantIdToCmCustomerNotifications < ActiveRecord::Migration[7.0]
2
+ def change
3
+ add_column :cm_customer_notifications, :tenant_id, :integer, if_not_exists: true
4
+ add_index :cm_customer_notifications, :tenant_id, if_not_exists: true
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ class RemoveTenantIdFromCmNotifications < ActiveRecord::Migration[7.0]
2
+ def change
3
+ remove_index :cm_notifications, :tenant_id, if_exists: true
4
+ remove_column :cm_notifications, :tenant_id, if_exists: true
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddAvailableOnToSpreeTaxons < ActiveRecord::Migration[7.0]
2
+ def change
3
+ add_column :spree_taxons, :available_on, :datetime, if_not_exists: true
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :invite, class: SpreeCmCommissioner::Invite do
3
+ token { SecureRandom.hex(16) }
4
+ taxon { create(:taxon) }
5
+ inviter { create(:user) }
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ FactoryBot.define do
2
+ factory :invite_user_event, class: SpreeCmCommissioner::InviteUserEvent do
3
+ invite { create(:invite) }
4
+ end
5
+ end
@@ -147,6 +147,36 @@ FactoryBot.define do
147
147
  presentation { 'seat-number-positions' }
148
148
  end
149
149
 
150
+ trait :origin do
151
+ attr_type { :origin }
152
+ name { 'origin' }
153
+ presentation { 'origin' }
154
+ end
155
+
156
+ trait :destination do
157
+ attr_type { :destination }
158
+ name { 'destination' }
159
+ presentation { 'destination' }
160
+ end
161
+
162
+ trait :departure_time do
163
+ attr_type { :time }
164
+ name { 'departure-time' }
165
+ presentation { 'departure-time' }
166
+ end
167
+
168
+ trait :vehicle do
169
+ attr_type { :vehicle_id }
170
+ name { 'vehicle' }
171
+ presentation { 'vehicle' }
172
+ end
173
+
174
+ trait :allow_seat_selection do
175
+ attr_type { :boolean }
176
+ name { 'allow-seat-selection' }
177
+ presentation { 'allow-seat-selection' }
178
+ end
179
+
150
180
  initialize_with { Spree::OptionType.where(name: name).first_or_initialize }
151
181
  end
152
182
  end
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :user_event, class: SpreeCmCommissioner::UserEvent do
3
+ taxon { create(:taxon) }
4
+ user { create(:user) }
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
1
  module SpreeCmCommissioner
2
- VERSION = '1.8.0'.freeze
2
+ VERSION = '1.8.2'.freeze
3
3
 
4
4
  module_function
5
5