spree_cm_commissioner 2.0.3.pre.pre.pre7 → 2.0.3
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 +12 -4
- data/app/controllers/spree/api/v2/storefront/guests_controller.rb +0 -2
- data/app/controllers/spree_cm_commissioner/admin/products_controller_decorator.rb +0 -14
- data/app/interactors/spree_cm_commissioner/create_vendor.rb +1 -11
- data/app/models/concerns/spree_cm_commissioner/taxon_kind.rb +1 -1
- data/app/models/spree_cm_commissioner/guest.rb +40 -89
- data/app/models/spree_cm_commissioner/guest_dynamic_field.rb +27 -37
- data/app/models/spree_cm_commissioner/product_decorator.rb +0 -29
- data/app/models/spree_cm_commissioner/user_decorator.rb +1 -1
- data/app/serializers/spree/v2/storefront/product_serializer_decorator.rb +0 -2
- data/app/serializers/spree_cm_commissioner/v2/storefront/guest_serializer.rb +3 -1
- data/config/routes.rb +0 -1
- data/lib/spree_cm_commissioner/version.rb +1 -1
- metadata +4 -10
- data/app/controllers/spree/api/v2/storefront/dynamic_fields_controller.rb +0 -42
- data/app/overrides/spree/admin/products/_form/industry_taxons.html.erb.deface +0 -26
- data/app/overrides/spree/admin/products/_form/taxons.html.erb.deface +0 -26
- data/db/migrate/20250812015522_remove_unique_indexes_from_cm_user_identity_providers.rb +0 -8
- data/db/migrate/20250812121745_add_data_fill_stage_phase_to_cm_guests.rb +0 -5
- data/db/migrate/20250814073854_add_call_to_action_to_spree_products.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bf7248e4cc07ac469eb711e9e0762d4abf4a65c005d10c87e29d1585b801773
|
4
|
+
data.tar.gz: 8505bf10f5484deb73a279db64631f96305c451417f8d0a3d66e7095d259ab58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64b2c412be4b09ccf25b3e139712259bdf55633ff39512c2aedd69ccb182125ab741951231f159b302cd7caa4d270a1b7f43124bd45abfb0e7f5371d64cdafb6
|
7
|
+
data.tar.gz: 14c96136c77a0a02fd2780484bc0de2ce237018f4e1bc17d34e6415da6873666609acf0895e06e4179cf6b265f61bc49f52f257b87e235e1016ef3d7d06f9c15
|
data/Gemfile.lock
CHANGED
@@ -34,7 +34,7 @@ GIT
|
|
34
34
|
PATH
|
35
35
|
remote: .
|
36
36
|
specs:
|
37
|
-
spree_cm_commissioner (2.0.3
|
37
|
+
spree_cm_commissioner (2.0.3)
|
38
38
|
activerecord-multi-tenant
|
39
39
|
activerecord_json_validator (~> 2.1, >= 2.1.3)
|
40
40
|
aws-sdk-cloudfront
|
@@ -446,6 +446,7 @@ GEM
|
|
446
446
|
google-cloud-recaptcha_enterprise-v1beta1 (0.10.0)
|
447
447
|
gapic-common (>= 0.20.0, < 2.a)
|
448
448
|
google-cloud-errors (~> 1.0)
|
449
|
+
google-protobuf (3.25.8)
|
449
450
|
google-protobuf (3.25.8-x86_64-darwin)
|
450
451
|
google-protobuf (3.25.8-x86_64-linux)
|
451
452
|
googleapis-common-protos (1.4.0)
|
@@ -460,6 +461,9 @@ GEM
|
|
460
461
|
multi_json (~> 1.11)
|
461
462
|
os (>= 0.9, < 2.0)
|
462
463
|
signet (>= 0.16, < 2.a)
|
464
|
+
grpc (1.72.0)
|
465
|
+
google-protobuf (>= 3.25, < 5.0)
|
466
|
+
googleapis-common-protos-types (~> 1.0)
|
463
467
|
grpc (1.72.0-x86_64-darwin)
|
464
468
|
google-protobuf (>= 3.25, < 5.0)
|
465
469
|
googleapis-common-protos-types (~> 1.0)
|
@@ -547,6 +551,7 @@ GEM
|
|
547
551
|
method_source (1.0.0)
|
548
552
|
mini_magick (4.12.0)
|
549
553
|
mini_mime (1.1.5)
|
554
|
+
mini_portile2 (2.8.4)
|
550
555
|
minitest (5.20.0)
|
551
556
|
monetize (1.12.0)
|
552
557
|
money (~> 6.12)
|
@@ -564,9 +569,12 @@ GEM
|
|
564
569
|
net-smtp (0.4.0)
|
565
570
|
net-protocol
|
566
571
|
nio4r (2.5.9)
|
567
|
-
nokogiri (1.
|
572
|
+
nokogiri (1.15.4)
|
573
|
+
mini_portile2 (~> 2.8.2)
|
574
|
+
racc (~> 1.4)
|
575
|
+
nokogiri (1.15.4-x86_64-darwin)
|
568
576
|
racc (~> 1.4)
|
569
|
-
nokogiri (1.
|
577
|
+
nokogiri (1.15.4-x86_64-linux)
|
570
578
|
racc (~> 1.4)
|
571
579
|
noticed (1.6.3)
|
572
580
|
http (>= 4.0.0)
|
@@ -922,11 +930,11 @@ GEM
|
|
922
930
|
zeitwerk (2.6.12)
|
923
931
|
|
924
932
|
PLATFORMS
|
933
|
+
ruby
|
925
934
|
x86_64-darwin-19
|
926
935
|
x86_64-darwin-20
|
927
936
|
x86_64-darwin-21
|
928
937
|
x86_64-darwin-22
|
929
|
-
x86_64-darwin-23
|
930
938
|
x86_64-linux
|
931
939
|
|
932
940
|
DEPENDENCIES
|
@@ -29,7 +29,6 @@ module Spree
|
|
29
29
|
resource = scope.new(guest_params)
|
30
30
|
|
31
31
|
if resource.save
|
32
|
-
resource.save_and_move_to_next_stage
|
33
32
|
render_serialized_payload(201) { serialize_resource(resource) }
|
34
33
|
else
|
35
34
|
render_error_payload(resource.errors, 400)
|
@@ -55,7 +54,6 @@ module Spree
|
|
55
54
|
resource.save!
|
56
55
|
end
|
57
56
|
|
58
|
-
resource.save_and_move_to_next_stage
|
59
57
|
render_serialized_payload { serialize_resource(resource) }
|
60
58
|
rescue ActiveRecord::RecordInvalid => e
|
61
59
|
render_error_payload(e.record.errors, 400)
|
@@ -5,7 +5,6 @@ module SpreeCmCommissioner
|
|
5
5
|
# spree update user sign_in_count
|
6
6
|
base.around_action :set_writing_role, only: %i[index]
|
7
7
|
base.after_action :set_tenant_after_update, only: %i[update]
|
8
|
-
base.before_action :merge_industry_taxons_into_taxons, only: [:update]
|
9
8
|
end
|
10
9
|
|
11
10
|
# Override
|
@@ -51,19 +50,6 @@ module SpreeCmCommissioner
|
|
51
50
|
|
52
51
|
protected
|
53
52
|
|
54
|
-
def merge_industry_taxons_into_taxons
|
55
|
-
return if params[:product].blank?
|
56
|
-
|
57
|
-
industry_ids = Array(params[:product][:industry_taxon_ids]).compact_blank
|
58
|
-
taxon_ids = Array(params[:product][:taxon_ids]).compact_blank
|
59
|
-
|
60
|
-
merged_ids = (taxon_ids + industry_ids).uniq
|
61
|
-
|
62
|
-
params[:product][:taxon_ids] = merged_ids
|
63
|
-
|
64
|
-
params[:product].delete(:industry_taxon_ids)
|
65
|
-
end
|
66
|
-
|
67
53
|
def find_resource
|
68
54
|
product_scope.with_deleted.includes(vendor: :tenant).friendly.find(params[:id])
|
69
55
|
end
|
@@ -8,7 +8,6 @@ module SpreeCmCommissioner
|
|
8
8
|
ActiveRecord::Base.transaction do
|
9
9
|
create_vendor
|
10
10
|
assign_vendor_to_user
|
11
|
-
create_logo
|
12
11
|
create_role
|
13
12
|
end
|
14
13
|
end
|
@@ -31,18 +30,9 @@ module SpreeCmCommissioner
|
|
31
30
|
context.user.vendors << @vendor
|
32
31
|
end
|
33
32
|
|
34
|
-
def create_logo
|
35
|
-
return if context.logo.blank?
|
36
|
-
|
37
|
-
vendor_logo = SpreeCmCommissioner::VendorLogo.create(viewable: @vendor, attachment: context.logo)
|
38
|
-
return if vendor_logo.persisted?
|
39
|
-
|
40
|
-
context.fail!(message: vendor_logo.errors.full_messages.join(', '))
|
41
|
-
end
|
42
|
-
|
43
33
|
def create_role
|
44
34
|
role = context.user.spree_roles.create(
|
45
|
-
name: "#{@vendor.
|
35
|
+
name: "#{@vendor.name.downcase.parameterize(separator: '-')}-organizer",
|
46
36
|
vendor_id: @vendor.id,
|
47
37
|
presentation: 'Organizer'
|
48
38
|
)
|
@@ -3,7 +3,7 @@ module SpreeCmCommissioner
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
-
enum kind: { category: 0, cms: 1, event: 2, occupation: 3, nationality: 4, organization: 5, transit: 6
|
6
|
+
enum kind: { category: 0, cms: 1, event: 2, occupation: 3, nationality: 4, organization: 5, transit: 6 }
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
@@ -213,124 +213,75 @@ module SpreeCmCommissioner
|
|
213
213
|
save!
|
214
214
|
end
|
215
215
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
return nil if bib_prefix.blank?
|
220
|
-
return nil if bib_number.blank?
|
221
|
-
|
222
|
-
filled_bib_number = bib_number.to_s.rjust(line_item.variant.bib_zerofill.to_i, '0')
|
216
|
+
def missing_dynamic_fields_for_stage(stage)
|
217
|
+
required_fields = line_item.product.dynamic_fields.where(data_fill_stage: stage)
|
218
|
+
filled_ids = guest_dynamic_fields.map(&:dynamic_field_id)
|
223
219
|
|
224
|
-
|
225
|
-
"#{bib_prefix}#{filled_bib_number}"
|
226
|
-
else
|
227
|
-
filled_bib_number
|
228
|
-
end
|
220
|
+
required_fields.reject { |field| filled_ids.include?(field.id) }
|
229
221
|
end
|
230
222
|
|
231
223
|
def all_required_dynamic_fields_completed?(stage)
|
232
224
|
missing_dynamic_fields_for_stage(stage).blank?
|
233
225
|
end
|
234
226
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
state 'during_check_in', value: 'during_check_in'
|
239
|
-
state 'completed', value: 'completed'
|
240
|
-
|
241
|
-
event :complete_pre_registration do
|
242
|
-
transition 'pre_registration' => 'post_registration',
|
243
|
-
if: -> (guest) { guest.pre_registration_completed? && guest.post_registration_fields? }
|
244
|
-
transition 'pre_registration' => 'during_check_in',
|
245
|
-
if: -> (guest) { guest.pre_registration_completed? && !guest.post_registration_fields? && guest.during_check_in_fields? }
|
246
|
-
transition 'pre_registration' => 'completed',
|
247
|
-
if: -> (guest) { guest.pre_registration_completed? && !guest.post_registration_fields? && !guest.during_check_in_fields? }
|
248
|
-
end
|
249
|
-
|
250
|
-
event :complete_post_registration do
|
251
|
-
transition 'post_registration' => 'during_check_in',
|
252
|
-
if: -> (guest) { guest.post_registration_completed? && guest.during_check_in_fields? }
|
253
|
-
transition 'post_registration' => 'completed',
|
254
|
-
if: -> (guest) { guest.post_registration_completed? && !guest.during_check_in_fields? }
|
255
|
-
end
|
227
|
+
def validate_dynamic_fields_for_phase(phase)
|
228
|
+
required_fields = line_item.product.dynamic_fields.where(data_fill_stage: phase)
|
229
|
+
filled_ids = guest_dynamic_fields.map(&:dynamic_field_id)
|
256
230
|
|
257
|
-
|
258
|
-
|
259
|
-
if: -> (guest) { guest.check_in_completed? }
|
231
|
+
required_fields.each do |field|
|
232
|
+
errors.add(:base, "#{field.label} is required for #{phase} phase") unless filled_ids.include?(field.id)
|
260
233
|
end
|
261
234
|
end
|
262
235
|
|
263
|
-
def save_and_move_to_next_stage(_transition = nil)
|
264
|
-
# Trigger state machine transitions based on completion status
|
265
|
-
case data_fill_stage_phase
|
266
|
-
when 'pre_registration'
|
267
|
-
complete_pre_registration! if pre_registration_completed?
|
268
|
-
when 'post_registration'
|
269
|
-
complete_post_registration! if post_registration_completed?
|
270
|
-
when 'during_check_in'
|
271
|
-
complete_check_in! if check_in_completed?
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
def completed_phases
|
276
|
-
phases = []
|
277
|
-
phases << 'pre_registration' if pre_registration_completed?
|
278
|
-
phases << 'post_registration' if post_registration_completed?
|
279
|
-
phases << 'during_check_in' if check_in_completed?
|
280
|
-
phases
|
281
|
-
end
|
282
|
-
|
283
236
|
def pre_registration_completed?
|
284
|
-
return true unless line_item
|
237
|
+
return true unless line_item.product.dynamic_fields.pre_registration.any?
|
285
238
|
|
286
|
-
|
287
|
-
filled_fields = guest_dynamic_fields.where(dynamic_field_id: required_fields).pluck(:dynamic_field_id)
|
288
|
-
(required_fields - filled_fields).empty?
|
239
|
+
pre_registration_fields_completed?
|
289
240
|
end
|
290
241
|
|
291
242
|
def post_registration_completed?
|
292
|
-
return true unless line_item
|
243
|
+
return true unless line_item.product.dynamic_fields.post_registration.any?
|
293
244
|
|
294
|
-
|
295
|
-
filled_fields = guest_dynamic_fields.where(dynamic_field_id: required_fields).pluck(:dynamic_field_id)
|
296
|
-
(required_fields - filled_fields).empty?
|
245
|
+
post_registration_fields_completed?
|
297
246
|
end
|
298
247
|
|
299
248
|
def check_in_completed?
|
300
|
-
return true unless line_item
|
301
|
-
|
302
|
-
required_fields = line_item.product.dynamic_fields.during_check_in.pluck(:id)
|
303
|
-
filled_fields = guest_dynamic_fields.where(dynamic_field_id: required_fields).pluck(:dynamic_field_id)
|
304
|
-
(required_fields - filled_fields).empty?
|
305
|
-
end
|
249
|
+
return true unless line_item.product.dynamic_fields.during_check_in.any?
|
306
250
|
|
307
|
-
|
308
|
-
line_item&.product&.dynamic_fields&.pre_registration&.any?
|
251
|
+
check_in_fields_completed?
|
309
252
|
end
|
310
253
|
|
311
|
-
def
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
254
|
+
def current_collection_phase
|
255
|
+
if check_in.present?
|
256
|
+
:during_check_in
|
257
|
+
elsif line_item.order.completed?
|
258
|
+
:post_registration
|
259
|
+
else
|
260
|
+
:pre_registration
|
261
|
+
end
|
317
262
|
end
|
318
263
|
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
264
|
+
def phase_completion_status
|
265
|
+
{
|
266
|
+
pre_registration: pre_registration_completed?,
|
267
|
+
post_registration: post_registration_completed?,
|
268
|
+
during_check_in: check_in_completed?
|
269
|
+
}
|
323
270
|
end
|
324
271
|
|
325
|
-
|
326
|
-
|
272
|
+
# bib_number: 345, bib_prefix: 5KM, bib_zerofill: 5 => return 5KM00345
|
273
|
+
# bib_number: 345, bib_prefix: 5KM, bib_zerofill: 2 => return 5KM345
|
274
|
+
def formatted_bib_number
|
275
|
+
return nil if bib_prefix.blank?
|
276
|
+
return nil if bib_number.blank?
|
327
277
|
|
328
|
-
|
329
|
-
@product_dynamic_fields ||= line_item.product.dynamic_fields
|
330
|
-
required_fields = @product_dynamic_fields.where(data_fill_stage: stage)
|
331
|
-
filled_ids = guest_dynamic_fields&.pluck(:dynamic_field_id) || []
|
278
|
+
filled_bib_number = bib_number.to_s.rjust(line_item.variant.bib_zerofill.to_i, '0')
|
332
279
|
|
333
|
-
|
280
|
+
if bib_display_prefix?
|
281
|
+
"#{bib_prefix}#{filled_bib_number}"
|
282
|
+
else
|
283
|
+
filled_bib_number
|
284
|
+
end
|
334
285
|
end
|
335
286
|
end
|
336
287
|
end
|
@@ -4,13 +4,10 @@ module SpreeCmCommissioner
|
|
4
4
|
belongs_to :dynamic_field, class_name: 'SpreeCmCommissioner::DynamicField', optional: false
|
5
5
|
belongs_to :dynamic_field_option, class_name: 'SpreeCmCommissioner::DynamicFieldOption', optional: true
|
6
6
|
|
7
|
+
validates :value, presence: true
|
7
8
|
validate :validate_value_format, if: -> { value.present? && dynamic_field.present? }
|
8
9
|
validate :validate_option_reference, if: -> { dynamic_field_option.present? }
|
9
|
-
validate :validate_phase_sequence
|
10
10
|
validate :check_required_fields_based_on_phase
|
11
|
-
validate :reject_empty_string_for_text_fields
|
12
|
-
|
13
|
-
after_commit :sync_guest_data_fill_stage_phase
|
14
11
|
|
15
12
|
private
|
16
13
|
|
@@ -18,8 +15,6 @@ module SpreeCmCommissioner
|
|
18
15
|
return if dynamic_field.blank?
|
19
16
|
|
20
17
|
case dynamic_field.data_type.to_s
|
21
|
-
when 'text', 'textarea'
|
22
|
-
errors.add(:value, "can't be blank") if value.is_a?(String) && value.strip == ''
|
23
18
|
when 'number'
|
24
19
|
errors.add(:value, 'must be a number') unless value.to_s.match?(/\A\d+\z/)
|
25
20
|
when 'boolean'
|
@@ -45,49 +40,44 @@ module SpreeCmCommissioner
|
|
45
40
|
errors.add(:dynamic_field_option, 'must belong to the same dynamic field')
|
46
41
|
end
|
47
42
|
|
48
|
-
def
|
49
|
-
|
43
|
+
def before_checkin_phase?
|
44
|
+
guest.present? && guest.line_item.present? && guest.check_in.nil?
|
45
|
+
end
|
50
46
|
|
51
|
-
|
52
|
-
|
53
|
-
errors.add(:base, 'Must complete pre_registration fields first') unless guest.pre_registration_completed?
|
54
|
-
when :during_check_in
|
55
|
-
unless guest.post_registration_completed? || !guest.post_registration_fields?
|
56
|
-
errors.add(:base, 'Must complete post_registration fields first')
|
57
|
-
end
|
58
|
-
end
|
47
|
+
def after_purchase_phase?
|
48
|
+
guest.present? && guest.line_item.present? && guest.line_item.completed? && guest.check_in.nil?
|
59
49
|
end
|
60
50
|
|
61
|
-
def
|
62
|
-
|
51
|
+
def during_checkin_phase?
|
52
|
+
guest.present? && guest.check_in.present?
|
53
|
+
end
|
63
54
|
|
64
|
-
|
65
|
-
|
55
|
+
def pre_registration_required?
|
56
|
+
dynamic_field.data_fill_stage.to_sym == :pre_registration &&
|
66
57
|
guest.line_item.order.completed? && guest.check_in.blank?
|
67
|
-
when :during_check_in
|
68
|
-
guest.check_in.present?
|
69
|
-
else
|
70
|
-
false
|
71
|
-
end
|
72
58
|
end
|
73
59
|
|
74
|
-
def
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
errors.add(:value, I18n.t("guest_dynamic_field.errors.#{dynamic_field.data_fill_stage}_required"))
|
60
|
+
def post_registration_required?
|
61
|
+
dynamic_field.data_fill_stage.to_sym == :post_registration &&
|
62
|
+
guest.line_item.order.completed? && guest.check_in.blank?
|
79
63
|
end
|
80
64
|
|
81
|
-
def
|
82
|
-
|
65
|
+
def during_check_in_required?
|
66
|
+
dynamic_field.data_fill_stage.to_sym == :during_check_in &&
|
67
|
+
guest.check_in.present?
|
83
68
|
end
|
84
69
|
|
85
|
-
def
|
86
|
-
return if dynamic_field.blank?
|
87
|
-
return unless %w[text textarea].include?(dynamic_field.data_type.to_s)
|
88
|
-
return unless value.is_a?(String)
|
70
|
+
def check_required_fields_based_on_phase
|
71
|
+
return if dynamic_field.blank? || value.present?
|
89
72
|
|
90
|
-
|
73
|
+
case dynamic_field.data_fill_stage.to_sym
|
74
|
+
when :pre_registration
|
75
|
+
errors.add(:value, I18n.t('guest_dynamic_field.errors.pre_registration_required')) if pre_registration_required?
|
76
|
+
when :post_registration
|
77
|
+
errors.add(:value, I18n.t('guest_dynamic_field.errors.post_registration_required')) if post_registration_required?
|
78
|
+
when :during_check_in
|
79
|
+
errors.add(:value, I18n.t('guest_dynamic_field.errors.during_check_in_required')) if during_check_in_required?
|
80
|
+
end
|
91
81
|
end
|
92
82
|
end
|
93
83
|
end
|
@@ -48,9 +48,6 @@ module SpreeCmCommissioner
|
|
48
48
|
|
49
49
|
base.belongs_to :event, class_name: 'Spree::Taxon', optional: true
|
50
50
|
|
51
|
-
base.has_many :industry_classifications, -> { joins(:taxon).where(spree_taxons: { kind: :industry }) }, class_name: 'Spree::Classification'
|
52
|
-
base.has_many :industry_taxons, through: :industry_classifications, source: :taxon
|
53
|
-
|
54
51
|
base.scope :min_price, lambda { |vendor|
|
55
52
|
joins(:prices_including_master)
|
56
53
|
.where(vendor_id: vendor.id, product_type: vendor.primary_product_type)
|
@@ -78,16 +75,6 @@ module SpreeCmCommissioner
|
|
78
75
|
base.after_update :sync_event_id_to_children, if: :saved_change_to_event_id?
|
79
76
|
|
80
77
|
base.enum purchasable_on: { both: 0, web: 1, app: 2 }
|
81
|
-
base.enum call_to_action: { buy_now: 0,
|
82
|
-
book_now: 1,
|
83
|
-
reserve: 2,
|
84
|
-
register: 3,
|
85
|
-
apply: 4,
|
86
|
-
get_ticket: 5,
|
87
|
-
secure_your_seat: 6,
|
88
|
-
join_the_event: 7,
|
89
|
-
request_to_book: 8
|
90
|
-
}
|
91
78
|
|
92
79
|
base.accepts_nested_attributes_for :trip, allow_destroy: true
|
93
80
|
|
@@ -99,22 +86,6 @@ module SpreeCmCommissioner
|
|
99
86
|
"#{Spree::Store.default.formatted_url}/tickets/#{slug}"
|
100
87
|
end
|
101
88
|
|
102
|
-
def action_button
|
103
|
-
return :request_to_book if need_confirmation?
|
104
|
-
return :reserve if free?
|
105
|
-
return call_to_action.to_sym if call_to_action.present?
|
106
|
-
|
107
|
-
:buy_now
|
108
|
-
end
|
109
|
-
|
110
|
-
def free?
|
111
|
-
return false if prices_including_master.empty?
|
112
|
-
|
113
|
-
prices_including_master.all? do |master_price|
|
114
|
-
master_price.price.zero? && (master_price.compare_at_price.nil? || master_price.compare_at_price.zero?)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
89
|
def dynamic_fields_by_collection_phase
|
119
90
|
{
|
120
91
|
pre_registration: dynamic_fields.pre_registration.order(:position),
|
@@ -7,7 +7,7 @@ module SpreeCmCommissioner
|
|
7
7
|
attributes :first_name, :last_name, :dob, :gender, :kyc_fields, :other_occupation, :created_at, :updated_at,
|
8
8
|
:qr_data, :social_contact_platform, :social_contact, :available_social_contact_platforms,
|
9
9
|
:age, :emergency_contact, :other_organization, :expectation, :upload_later, :address, :formatted_bib_number, :phone_number,
|
10
|
-
:token, :country_code, :contact
|
10
|
+
:token, :country_code, :contact
|
11
11
|
|
12
12
|
# temporary, once app release after cm-app v1.9.1, we no longer need this.
|
13
13
|
attribute :seat_number do |object|
|
@@ -22,6 +22,8 @@ module SpreeCmCommissioner
|
|
22
22
|
belongs_to :nationality, serializer: Spree::V2::Storefront::TaxonSerializer
|
23
23
|
belongs_to :line_item, serializer: Spree::V2::Storefront::LineItemSerializer
|
24
24
|
|
25
|
+
has_many :guest_dynamic_fields, serializer: SpreeCmCommissioner::V2::Storefront::GuestDynamicFieldSerializer
|
26
|
+
|
25
27
|
has_one :id_card, serializer: Spree::V2::Storefront::IdCardSerializer
|
26
28
|
has_one :check_in
|
27
29
|
|
data/config/routes.rb
CHANGED
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.0.3
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- You
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-08-
|
11
|
+
date: 2025-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree
|
@@ -853,7 +853,6 @@ files:
|
|
853
853
|
- app/controllers/spree/api/v2/storefront/confirm_pin_code_checkers_controller.rb
|
854
854
|
- app/controllers/spree/api/v2/storefront/customer_notifications_controller.rb
|
855
855
|
- app/controllers/spree/api/v2/storefront/dynamic_field_options_controller.rb
|
856
|
-
- app/controllers/spree/api/v2/storefront/dynamic_fields_controller.rb
|
857
856
|
- app/controllers/spree/api/v2/storefront/events_controller.rb
|
858
857
|
- app/controllers/spree/api/v2/storefront/google_wallet_object_tokens_controller.rb
|
859
858
|
- app/controllers/spree/api/v2/storefront/guest_card_classes_controller.rb
|
@@ -1450,7 +1449,6 @@ files:
|
|
1450
1449
|
- app/overrides/spree/admin/products/_form/allow_self_check_in.html.erb.deface
|
1451
1450
|
- app/overrides/spree/admin/products/_form/available_on.html.erb.deface
|
1452
1451
|
- app/overrides/spree/admin/products/_form/discontinue_on.html.erb.deface
|
1453
|
-
- app/overrides/spree/admin/products/_form/industry_taxons.html.erb.deface
|
1454
1452
|
- app/overrides/spree/admin/products/_form/need_confirmation_checkbox.html.erb.deface
|
1455
1453
|
- app/overrides/spree/admin/products/_form/option_types.html.erb.deface
|
1456
1454
|
- app/overrides/spree/admin/products/_form/product_types.html.erb.deface
|
@@ -1459,7 +1457,6 @@ files:
|
|
1459
1457
|
- app/overrides/spree/admin/products/_form/required_self_check_in_location.html.erb.deface
|
1460
1458
|
- app/overrides/spree/admin/products/_form/reveal_description_to_user.html.erb.deface
|
1461
1459
|
- app/overrides/spree/admin/products/_form/subscribable_checkbox.html.erb.deface
|
1462
|
-
- app/overrides/spree/admin/products/_form/taxons.html.erb.deface
|
1463
1460
|
- app/overrides/spree/admin/products/_form/use_video_as_default.html.erb.deface
|
1464
1461
|
- app/overrides/spree/admin/products/edit/clear_cache_button.html.erb.deface
|
1465
1462
|
- app/overrides/spree/admin/products/index/product_vendor_link.html.erb.deface
|
@@ -2559,9 +2556,6 @@ files:
|
|
2559
2556
|
- db/migrate/20250714124323_make_cm_blazer_queryables_polymorphic.rb
|
2560
2557
|
- db/migrate/20250715103333_remove_indexes_from_cm_user_identity_providers.rb
|
2561
2558
|
- db/migrate/20250718071620_add_data_fill_stage_to_dynamic_fields.rb
|
2562
|
-
- db/migrate/20250812015522_remove_unique_indexes_from_cm_user_identity_providers.rb
|
2563
|
-
- db/migrate/20250812121745_add_data_fill_stage_phase_to_cm_guests.rb
|
2564
|
-
- db/migrate/20250814073854_add_call_to_action_to_spree_products.rb
|
2565
2559
|
- docker-compose.yml
|
2566
2560
|
- docs/option_types/attr_types.md
|
2567
2561
|
- docs/private_key.pem
|
@@ -2715,9 +2709,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
2715
2709
|
version: '2.7'
|
2716
2710
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
2717
2711
|
requirements:
|
2718
|
-
- - "
|
2712
|
+
- - ">="
|
2719
2713
|
- !ruby/object:Gem::Version
|
2720
|
-
version:
|
2714
|
+
version: '0'
|
2721
2715
|
requirements:
|
2722
2716
|
- none
|
2723
2717
|
rubygems_version: 3.4.1
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module Api
|
3
|
-
module V2
|
4
|
-
module Storefront
|
5
|
-
class DynamicFieldsController < ::Spree::Api::V2::ResourceController
|
6
|
-
before_action :load_product
|
7
|
-
|
8
|
-
# override
|
9
|
-
def collection
|
10
|
-
return @collection if defined?(@collection)
|
11
|
-
|
12
|
-
dynamic_fields = @product.dynamic_fields
|
13
|
-
if params[:phase].present?
|
14
|
-
requested_phase = params[:phase].to_s
|
15
|
-
if SpreeCmCommissioner::DynamicField.data_fill_stages.key?(requested_phase)
|
16
|
-
dynamic_fields = dynamic_fields.where(data_fill_stage: requested_phase)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
@collection = dynamic_fields.order(:position)
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def load_product
|
26
|
-
return render_error_payload({ error: 'product_id is required' }, 400) if params[:product_id].blank?
|
27
|
-
|
28
|
-
@product ||= Spree::Product.find(params[:product_id])
|
29
|
-
end
|
30
|
-
|
31
|
-
def collection_serializer
|
32
|
-
SpreeCmCommissioner::V2::Storefront::DynamicFieldSerializer
|
33
|
-
end
|
34
|
-
|
35
|
-
def model_class
|
36
|
-
SpreeCmCommissioner::DynamicField
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<!-- insert_after "[data-hook='admin_product_form_taxons']" -->
|
2
|
-
|
3
|
-
<div data-hook="admin_product_form_industry_taxons">
|
4
|
-
<%= f.field_container :industry_taxons do %>
|
5
|
-
<%= f.label :industry_taxon_ids, Spree.t(:Industries) %>
|
6
|
-
|
7
|
-
<% if can? :modify, Spree::Classification %>
|
8
|
-
<%= f.select :industry_taxon_ids, options_from_collection_for_select(@product.industry_taxons, :id, :pretty_name, @product.industry_taxon_ids),
|
9
|
-
{ include_hidden: true },
|
10
|
-
multiple: true,
|
11
|
-
data: { autocomplete_url_value: 'taxons_api_v2',
|
12
|
-
autocomplete_return_attr_value: 'pretty_name',
|
13
|
-
autocomplete_multiple_value: true,
|
14
|
-
autocomplete_additional_url_params_value: "q[kind_eq]=7" } %>
|
15
|
-
<% elsif @product.industry_taxons.any? %>
|
16
|
-
<ul class="text_list">
|
17
|
-
<% @product.industry_taxons.each do |taxon| %>
|
18
|
-
<li><%= taxon.name %></li>
|
19
|
-
<% end %>
|
20
|
-
</ul>
|
21
|
-
<% else %>
|
22
|
-
<div class="alert alert-info"><%= Spree.t(:no_resource_found, resource: :taxons) %></div>
|
23
|
-
<% end %>
|
24
|
-
|
25
|
-
<% end %>
|
26
|
-
</div>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<!-- replace "[data-hook='admin_product_form_taxons']" -->
|
2
|
-
|
3
|
-
<div data-hook="admin_product_form_taxons">
|
4
|
-
<%= f.field_container :taxons do %>
|
5
|
-
<%= f.label :taxon_ids, Spree.t(:taxons) %>
|
6
|
-
|
7
|
-
<% if can? :modify, Spree::Classification %>
|
8
|
-
<%= f.select :taxon_ids, options_from_collection_for_select(@product.taxons, :id, :pretty_name, @product.taxon_ids.reject { |id| @product.industry_taxon_ids.include?(id) }),
|
9
|
-
{ include_hidden: true },
|
10
|
-
multiple: true,
|
11
|
-
data: { autocomplete_url_value: 'taxons_api_v2',
|
12
|
-
autocomplete_return_attr_value: 'pretty_name',
|
13
|
-
autocomplete_multiple_value: true,
|
14
|
-
autocomplete_additional_url_params_value: "q[kind_not_eq]=7" } %>
|
15
|
-
<% elsif @product.taxons.any? %>
|
16
|
-
<ul class="text_list">
|
17
|
-
<% @product.taxons.each do |taxon| %>
|
18
|
-
<li><%= taxon.name %></li>
|
19
|
-
<% end %>
|
20
|
-
</ul>
|
21
|
-
<% else %>
|
22
|
-
<div class="alert alert-info"><%= Spree.t(:no_resource_found, resource: :taxons) %></div>
|
23
|
-
<% end %>
|
24
|
-
|
25
|
-
<% end %>
|
26
|
-
</div>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
class RemoveUniqueIndexesFromCmUserIdentityProviders < ActiveRecord::Migration[7.0]
|
2
|
-
def change
|
3
|
-
if index_exists?(:cm_user_identity_providers, [:identity_type, :sub], name: "index_cm_user_identity_providers_on_identity_type_and_sub")
|
4
|
-
remove_index :cm_user_identity_providers,
|
5
|
-
name: "index_cm_user_identity_providers_on_identity_type_and_sub"
|
6
|
-
end
|
7
|
-
end
|
8
|
-
end
|