spree_cm_commissioner 2.1.5.pre.pre1 → 2.1.5.pre.pre3
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/api/v2/tenant/base_controller.rb +0 -12
- data/app/controllers/spree/api/v2/tenant/cart_controller.rb +1 -1
- data/app/controllers/spree/api/v2/tenant/checkout_controller.rb +1 -1
- data/app/controllers/spree/api/v2/tenant/guests_controller.rb +10 -29
- data/app/models/spree_cm_commissioner/guest.rb +10 -10
- data/app/models/spree_cm_commissioner/guest_dynamic_field.rb +0 -4
- data/app/models/spree_cm_commissioner/line_item_decorator.rb +8 -1
- data/app/models/spree_cm_commissioner/taxon_decorator.rb +0 -4
- data/app/models/spree_cm_commissioner/trip.rb +0 -1
- data/app/models/spree_cm_commissioner/vehicle.rb +0 -1
- data/app/serializers/spree/v2/tenant/cart_serializer.rb +1 -24
- data/app/serializers/spree/v2/tenant/guest_serializer.rb +0 -2
- data/app/serializers/spree/v2/tenant/product_serializer.rb +0 -3
- data/config/initializers/spree_permitted_attributes.rb +4 -2
- data/config/locales/en.yml +35 -30
- data/config/locales/km.yml +24 -19
- data/config/routes.rb +0 -4
- data/lib/spree_cm_commissioner/version.rb +1 -1
- metadata +2 -10
- data/app/controllers/spree/api/v2/tenant/dynamic_field_options_controller.rb +0 -32
- data/app/controllers/spree/api/v2/tenant/dynamic_fields_controller.rb +0 -38
- data/app/controllers/spree/api/v2/tenant/product_dynamic_fields_controller.rb +0 -41
- data/app/interactors/spree_cm_commissioner/guest_dynamic_fields_manager.rb +0 -33
- data/app/serializers/spree/v2/tenant/dynamic_field_option_serializer.rb +0 -9
- data/app/serializers/spree/v2/tenant/dynamic_field_serializer.rb +0 -11
- data/app/serializers/spree/v2/tenant/guest_dynamic_field_serializer.rb +0 -12
- data/app/serializers/spree/v2/tenant/product_dynamic_field_serializer.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06e22965144e75388dd801148c7d38580aee08856973332edc2c40ad31f6772a
|
4
|
+
data.tar.gz: 1b33b7d645b36c9ccf42444dfa09aa7826a43d9c8e2a3dd0aaaa6d1668f6643d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 781da351e0880acf7f46fbbc060844a31f26b322d781fc17ad1da51ac4a3e7d0a9c991d2fb4921ec1cc1e89a255c2abf9457c3bf7c163108838b199cb9865054
|
7
|
+
data.tar.gz: 6322d9ef0cca35c6d225cb91917cb3e49a6a96221b60025103f09f607658eaf0c797d0d37f6ad44b3c183a5f7c8d6a64afd0326de016047cf005dfb8ae200b4b
|
data/Gemfile.lock
CHANGED
@@ -4,8 +4,6 @@ module Spree
|
|
4
4
|
module Tenant
|
5
5
|
class BaseController < ::Spree::Api::V2::ResourceController
|
6
6
|
include Spree::Api::V2::CollectionOptionsHelpers
|
7
|
-
rescue_from ActiveRecord::RecordInvalid, with: :handle_record_invalid
|
8
|
-
rescue_from ActiveRecord::RecordNotFound, with: :handle_record_not_found
|
9
7
|
|
10
8
|
set_current_tenant_through_filter
|
11
9
|
before_action :require_tenant
|
@@ -26,16 +24,6 @@ module Spree
|
|
26
24
|
def scope
|
27
25
|
raise 'scope should be implemented in a sub-class'
|
28
26
|
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def handle_record_invalid(exception)
|
33
|
-
render_error_payload(exception.record.errors, 422)
|
34
|
-
end
|
35
|
-
|
36
|
-
def handle_record_not_found(exception)
|
37
|
-
render_error_payload({ base: [exception.message] }, 404)
|
38
|
-
end
|
39
27
|
end
|
40
28
|
end
|
41
29
|
end
|
@@ -27,28 +27,23 @@ module Spree
|
|
27
27
|
def create
|
28
28
|
spree_authorize! :update, spree_current_order, order_token
|
29
29
|
|
30
|
-
resource = scope.new(guest_params
|
30
|
+
resource = scope.new(guest_params)
|
31
31
|
|
32
|
-
|
33
|
-
resource
|
34
|
-
|
35
|
-
resource.
|
32
|
+
if resource.save
|
33
|
+
render_serialized_payload(201) { serialize_resource(resource) }
|
34
|
+
else
|
35
|
+
render_error_payload(resource.errors, 400)
|
36
36
|
end
|
37
|
-
|
38
|
-
render_serialized_payload(201) { serialize_resource(resource) }
|
39
37
|
end
|
40
38
|
|
41
39
|
def update
|
42
40
|
spree_authorize! :update, spree_current_order, order_token
|
43
41
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
resource
|
48
|
-
resource.save_and_move_to_next_stage
|
42
|
+
if resource.update(guest_params)
|
43
|
+
render_serialized_payload { serialize_resource(resource) }
|
44
|
+
else
|
45
|
+
render_error_payload(resource, 400)
|
49
46
|
end
|
50
|
-
|
51
|
-
render_serialized_payload { serialize_resource(resource) }
|
52
47
|
end
|
53
48
|
|
54
49
|
private
|
@@ -83,21 +78,7 @@ module Spree
|
|
83
78
|
:address,
|
84
79
|
:other_organization,
|
85
80
|
:expectation,
|
86
|
-
:upload_later
|
87
|
-
guest_dynamic_fields_attributes: %i[
|
88
|
-
id
|
89
|
-
dynamic_field_id
|
90
|
-
dynamic_field_option_id
|
91
|
-
value
|
92
|
-
_destroy
|
93
|
-
]
|
94
|
-
)
|
95
|
-
end
|
96
|
-
|
97
|
-
def run_dynamic_fields(resource)
|
98
|
-
SpreeCmCommissioner::GuestDynamicFieldsManager.call(
|
99
|
-
resource: resource,
|
100
|
-
dynamic_fields_attributes: guest_params[:guest_dynamic_fields_attributes]
|
81
|
+
:upload_later
|
101
82
|
)
|
102
83
|
end
|
103
84
|
end
|
@@ -40,7 +40,7 @@ module SpreeCmCommissioner
|
|
40
40
|
|
41
41
|
has_many :state_changes, as: :stateful, class_name: 'Spree::StateChange'
|
42
42
|
has_many :guest_dynamic_fields, dependent: :destroy, class_name: 'SpreeCmCommissioner::GuestDynamicField'
|
43
|
-
accepts_nested_attributes_for :guest_dynamic_fields, allow_destroy: true
|
43
|
+
accepts_nested_attributes_for :guest_dynamic_fields, allow_destroy: true
|
44
44
|
|
45
45
|
belongs_to :event, class_name: 'Spree::Taxon'
|
46
46
|
|
@@ -51,7 +51,8 @@ module SpreeCmCommissioner
|
|
51
51
|
preference :telegram_user_verified_at, :string
|
52
52
|
|
53
53
|
before_validation :set_event_id
|
54
|
-
before_validation :
|
54
|
+
before_validation :assign_seat_number_with_bib, if: -> { bib_number.present? }
|
55
|
+
before_validation :assign_seat_number_with_block, if: -> { will_save_change_to_block_id? }
|
55
56
|
|
56
57
|
before_create :generate_bib, if: -> { line_item.reload && variant.bib_pre_generation_on_create? }
|
57
58
|
|
@@ -147,13 +148,17 @@ module SpreeCmCommissioner
|
|
147
148
|
self.event_id ||= line_item&.event_id
|
148
149
|
end
|
149
150
|
|
150
|
-
def
|
151
|
+
def assign_seat_number_with_block
|
152
|
+
self.seat_number = block.present? ? block.label : nil
|
153
|
+
end
|
154
|
+
|
155
|
+
def assign_seat_number_with_bib
|
151
156
|
return if seat_number.present? # avoid reassign seat to guest
|
152
157
|
|
153
|
-
|
158
|
+
assign_seat_number_with_bib!
|
154
159
|
end
|
155
160
|
|
156
|
-
def
|
161
|
+
def assign_seat_number_with_bib!
|
157
162
|
index = bib_number - 1
|
158
163
|
positions = line_item.variant.seat_number_positions || []
|
159
164
|
|
@@ -397,11 +402,6 @@ module SpreeCmCommissioner
|
|
397
402
|
|
398
403
|
required_fields.reject { |field| filled_ids.include?(field.id) }
|
399
404
|
end
|
400
|
-
|
401
|
-
def reject_guest_dynamic_field?(attributes)
|
402
|
-
# Reject if dynamic_field_id is blank or if _destroy is true
|
403
|
-
attributes[:dynamic_field_id].blank? || ActiveModel::Type::Boolean.new.cast(attributes[:_destroy])
|
404
|
-
end
|
405
405
|
end
|
406
406
|
end
|
407
407
|
# rubocop:enable Metrics/ClassLength
|
@@ -46,10 +46,6 @@ module SpreeCmCommissioner
|
|
46
46
|
return if dynamic_field.blank? || dynamic_field_option.blank?
|
47
47
|
return if dynamic_field_option.dynamic_field_id == dynamic_field_id
|
48
48
|
|
49
|
-
# Only validate if both dynamic_field and dynamic_field_option are persisted
|
50
|
-
# This prevents validation errors during creation when associations might not be fully loaded
|
51
|
-
return if dynamic_field.new_record? || dynamic_field_option.new_record?
|
52
|
-
|
53
49
|
errors.add(:dynamic_field_option, 'must belong to the same dynamic field')
|
54
50
|
end
|
55
51
|
|
@@ -29,6 +29,7 @@ module SpreeCmCommissioner
|
|
29
29
|
base.before_create :add_due_date, if: :subscription?
|
30
30
|
|
31
31
|
base.validate :ensure_not_exceed_max_quantity_per_order, if: -> { variant&.max_quantity_per_order.present? }
|
32
|
+
base.validate :ensure_all_guests_have_blocks, if: -> { variant&.blocks&.any? }
|
32
33
|
|
33
34
|
base.whitelisted_ransackable_associations |= %w[guests order]
|
34
35
|
base.whitelisted_ransackable_attributes |= %w[number to_date from_date vendor_id]
|
@@ -217,7 +218,13 @@ module SpreeCmCommissioner
|
|
217
218
|
private
|
218
219
|
|
219
220
|
def ensure_not_exceed_max_quantity_per_order
|
220
|
-
errors.add(:quantity, 'exceeded_max_quantity_per_order') if quantity > variant.max_quantity_per_order
|
221
|
+
errors.add(:quantity, I18n.t('line_item.validation.exceeded_max_quantity_per_order')) if quantity > variant.max_quantity_per_order
|
222
|
+
end
|
223
|
+
|
224
|
+
def ensure_all_guests_have_blocks
|
225
|
+
return if number_of_guests == guests.map(&:block_id).compact.uniq.size
|
226
|
+
|
227
|
+
errors.add(:base, I18n.t('line_item.validation.seats_are_required'))
|
221
228
|
end
|
222
229
|
|
223
230
|
def update_vendor_id
|
@@ -1,30 +1,7 @@
|
|
1
1
|
module Spree
|
2
2
|
module V2
|
3
3
|
module Tenant
|
4
|
-
class CartSerializer <
|
5
|
-
attributes :number, :item_total, :total, :ship_total, :adjustment_total, :created_at,
|
6
|
-
:updated_at, :completed_at, :included_tax_total, :additional_tax_total, :display_additional_tax_total,
|
7
|
-
:display_included_tax_total, :tax_total, :currency, :state, :token, :email,
|
8
|
-
:display_item_total, :display_ship_total, :display_adjustment_total, :display_tax_total,
|
9
|
-
:promo_total, :display_promo_total, :item_count, :special_instructions, :display_total,
|
10
|
-
:pre_tax_item_amount, :display_pre_tax_item_amount, :pre_tax_total, :display_pre_tax_total,
|
11
|
-
:shipment_state, :payment_state, :public_metadata,
|
12
|
-
:phone_number, :intel_phone_number, :country_code, :request_state, :channel
|
13
|
-
|
14
|
-
belongs_to :user, serializer: Spree::V2::Tenant::UserSerializer
|
15
|
-
belongs_to :billing_address,
|
16
|
-
id_method_name: :bill_address_id,
|
17
|
-
serializer: :address,
|
18
|
-
record_type: :address
|
19
|
-
|
20
|
-
has_many :promotions, object_method_name: :valid_promotions, id_method_name: :valid_promotion_ids,
|
21
|
-
serializer: Spree::V2::Storefront::PromotionSerializer
|
22
|
-
|
23
|
-
has_many :variants, serializer: Spree::V2::Tenant::VariantSerializer
|
24
|
-
has_many :products, serializer: Spree::V2::Tenant::ProductSerializer
|
25
|
-
has_many :line_items, serializer: Spree::V2::Tenant::LineItemSerializer
|
26
|
-
has_many :payments, serializer: Spree::V2::Storefront::PaymentSerializer
|
27
|
-
has_many :guests, serializer: Spree::V2::Tenant::GuestSerializer
|
4
|
+
class CartSerializer < Spree::V2::Storefront::CartSerializer
|
28
5
|
end
|
29
6
|
end
|
30
7
|
end
|
@@ -13,9 +13,7 @@ module Spree
|
|
13
13
|
|
14
14
|
belongs_to :occupation, serializer: Spree::V2::Tenant::TaxonSerializer
|
15
15
|
belongs_to :nationality, serializer: Spree::V2::Tenant::TaxonSerializer
|
16
|
-
belongs_to :line_item, serializer: Spree::V2::Tenant::LineItemSerializer
|
17
16
|
has_one :id_card, serializer: Spree::V2::Tenant::IdCardSerializer
|
18
|
-
has_many :guest_dynamic_fields, serializer: Spree::V2::Tenant::GuestDynamicFieldSerializer
|
19
17
|
|
20
18
|
# allowed_checkout updates frequently
|
21
19
|
cache_options store: nil
|
@@ -5,9 +5,6 @@ module Spree
|
|
5
5
|
# This serializer extends the Storefront ProductSerializer
|
6
6
|
# to include any additional attributes or relationships needed
|
7
7
|
# for the Tenant context.
|
8
|
-
|
9
|
-
# Overrided dynamic fields relationship of the parent serializer(Storefront).
|
10
|
-
has_many :dynamic_fields, serializer: Spree::V2::Tenant::DynamicFieldSerializer
|
11
8
|
end
|
12
9
|
end
|
13
10
|
end
|
@@ -2,11 +2,13 @@ module Spree
|
|
2
2
|
module PermittedAttributes
|
3
3
|
@@vendor_attributes << :logo
|
4
4
|
|
5
|
+
# Permitted all guest attributes for now as permitting only some guest attributes is not working by design
|
6
|
+
# of spree add_item service, if we want to only permit some guest attributes,
|
7
|
+
# we need to override most part of add_item service.
|
5
8
|
@@line_item_attributes += %i[
|
6
9
|
from_date
|
7
10
|
to_date
|
8
|
-
|
9
|
-
date
|
11
|
+
guests_attributes
|
10
12
|
]
|
11
13
|
|
12
14
|
@@user_attributes += %i[
|
data/config/locales/en.yml
CHANGED
@@ -49,16 +49,16 @@ en:
|
|
49
49
|
empty_info: "No vendor information available."
|
50
50
|
|
51
51
|
telegram_bot:
|
52
|
-
|
52
|
+
empty_info: "No <b>Telegram Bot</b> found"
|
53
53
|
|
54
54
|
guest_card_classes:
|
55
55
|
empty_info: "No guest card classes information available."
|
56
56
|
background_image: "Background Image"
|
57
57
|
guest_dynamic_field:
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
errors:
|
59
|
+
pre_registration_required: "is required before ticket issuance"
|
60
|
+
post_registration_required: "must be completed after purchase"
|
61
|
+
during_check_in_required: "is required during check-in"
|
62
62
|
google_wallet:
|
63
63
|
note: "Click <b>Create</b> or <b> Update</b> to connect to Google Wallet after filled all information "
|
64
64
|
google_wallet_class_created: "Google Wallet class created successfully."
|
@@ -105,6 +105,12 @@ en:
|
|
105
105
|
out_of_stock: "%{variant_name} is out of stock"
|
106
106
|
product_kind_option_types:
|
107
107
|
empty_info: "<b>Note:</b> Set service option types to service first. To edit, go to <b>Details</b> tab > <b>Option Types</b>"
|
108
|
+
|
109
|
+
line_item:
|
110
|
+
validation:
|
111
|
+
exceeded_max_quantity_per_order: "Exceeded maximum quantity per order"
|
112
|
+
seats_are_required: "Seats are required for all guests"
|
113
|
+
|
108
114
|
vectors:
|
109
115
|
icons:
|
110
116
|
info_rules: 'Only allow <b>%{allow_extensions}</b> files. Icons are stored inside "images/" folder, eg. app/assets/images/backend-adjust.svg.'
|
@@ -152,8 +158,8 @@ en:
|
|
152
158
|
orders:
|
153
159
|
total: "Total: %{orders_count} invoices"
|
154
160
|
update_order_status:
|
155
|
-
success:
|
156
|
-
fail:
|
161
|
+
success: "Order Status update successfully"
|
162
|
+
fail: "Order Status fail to update "
|
157
163
|
|
158
164
|
account_deletion:
|
159
165
|
title:
|
@@ -193,7 +199,7 @@ en:
|
|
193
199
|
send_failed_or_method_not_support: "Send failed or method not support"
|
194
200
|
subscribe: "Use Service"
|
195
201
|
full_name: "name"
|
196
|
-
store_credits:
|
202
|
+
store_credits: "Credits"
|
197
203
|
address: "Address"
|
198
204
|
billing_address: "Billing Address"
|
199
205
|
shipping_address: "Shipping Address"
|
@@ -280,9 +286,9 @@ en:
|
|
280
286
|
match_any: "Some line items must from selected age group"
|
281
287
|
match_all: "All line items must from selected age group"
|
282
288
|
billing:
|
283
|
-
six_month_discount:
|
289
|
+
six_month_discount: "6 Months discount"
|
284
290
|
twelve_month_discount: "12 Months discount"
|
285
|
-
penalty_rate:
|
291
|
+
penalty_rate: "Penalty Rate in %"
|
286
292
|
penalty_label: "Penalty Label"
|
287
293
|
customer_id: "Customer ID"
|
288
294
|
subscription:
|
@@ -343,11 +349,11 @@ en:
|
|
343
349
|
fails: "Invoice for this month is already exist "
|
344
350
|
customers: "Customers"
|
345
351
|
apply_promotion:
|
346
|
-
|
347
|
-
|
352
|
+
success: "Promotion Created"
|
353
|
+
fails: "Promotion Creation Failed"
|
348
354
|
delete_promotion:
|
349
|
-
|
350
|
-
|
355
|
+
success: "Promotion deleted"
|
356
|
+
fails: "Promotion Deletion Failed"
|
351
357
|
service_start_date: "Service Start Date"
|
352
358
|
export: "Export"
|
353
359
|
select_year: "Select Year"
|
@@ -602,30 +608,29 @@ en:
|
|
602
608
|
|
603
609
|
variant_availability:
|
604
610
|
item_available_instock: Only 1 item available in stock.
|
605
|
-
items_available_instock:
|
606
|
-
items_out_of_stock:
|
611
|
+
items_available_instock: Only %{available_quantity} items available in stock.
|
612
|
+
items_out_of_stock: Item out of Stock.
|
607
613
|
|
608
614
|
account_link:
|
609
615
|
failure: "Failed to link your %{identity_type} account: %{reason}"
|
610
616
|
s3:
|
611
617
|
image:
|
612
618
|
upload:
|
613
|
-
fail:
|
614
|
-
not_found:
|
619
|
+
fail: "Failed to fetch the image"
|
620
|
+
not_found: "Image not found"
|
615
621
|
amenity:
|
616
622
|
update_success: Option Type updated successfully.
|
617
623
|
user_roles_assigner:
|
618
|
-
user_not_found:
|
619
|
-
roles_empty:
|
620
|
-
roles_required:
|
621
|
-
user_already_assigned:
|
624
|
+
user_not_found: "User not found"
|
625
|
+
roles_empty: "Roles are empty"
|
626
|
+
roles_required: "Roles are required"
|
627
|
+
user_already_assigned: "User already assigned to this vendor"
|
622
628
|
invite:
|
623
|
-
url_not_found:
|
624
|
-
accept_fail:
|
625
|
-
url_expired:
|
626
|
-
already_invited:
|
627
|
-
update_fail:
|
629
|
+
url_not_found: "Invite link not found or have been expired"
|
630
|
+
accept_fail: "Failed to accept invite"
|
631
|
+
url_expired: "Invitation link is expired"
|
632
|
+
already_invited: "Failed: User already invited to event"
|
633
|
+
update_fail: "Failed: to Update invite user"
|
628
634
|
event_blazer_queries:
|
629
|
-
success:
|
630
|
-
fail:
|
631
|
-
|
635
|
+
success: "Event saved Successfully"
|
636
|
+
fail: "Event already saved"
|
data/config/locales/km.yml
CHANGED
@@ -55,7 +55,7 @@ km:
|
|
55
55
|
empty_info: "មិនមានព័ត៌មានអំពីអ្នកលក់ទេ"
|
56
56
|
|
57
57
|
telegram_bot:
|
58
|
-
|
58
|
+
empty_info: "No <b>Telegram Bot</b> found"
|
59
59
|
|
60
60
|
guest_card_classes:
|
61
61
|
empty_info: "មិនមានព័ត៌មានអំពីកាតភ្ញៀវទេ"
|
@@ -97,6 +97,11 @@ km:
|
|
97
97
|
product_kind_option_types:
|
98
98
|
empty_info: "<b>ចំណាំ:</b> កំណត់ប្រភេទសម្រាប់ផលិតផល. ដើម្បីកែប្រែ, សូមចូលទៅ <b>លម្អិត</b> tab > <b>ប្រភេទ</b>"
|
99
99
|
|
100
|
+
line_item:
|
101
|
+
validation:
|
102
|
+
exceeded_max_quantity_per_order: "លើសពីបរិមាណអតិបរមាក្នុងមួយការបញ្ជាទិញ"
|
103
|
+
seats_are_required: "ត្រូវការលេខកៅអីសម្រាប់ភ្ញៀវទាំងអស់"
|
104
|
+
|
100
105
|
subscription:
|
101
106
|
validation:
|
102
107
|
out_of_range: "Subscription date is out of range."
|
@@ -174,7 +179,7 @@ km:
|
|
174
179
|
send_failed_or_method_not_support: "Send failed or method not support"
|
175
180
|
subscribe: "ប្រើសេវាកម្ម"
|
176
181
|
full_name: "ឈ្មោះពេញ"
|
177
|
-
store_credits:
|
182
|
+
store_credits: "Credits"
|
178
183
|
address: "អាសយដ្ឋាន"
|
179
184
|
billing_address: "អាសយដ្ឋានទូទាត់"
|
180
185
|
shipping_address: "អាសយដ្ឋានប្រើប្រាស់"
|
@@ -252,9 +257,9 @@ km:
|
|
252
257
|
match_any: "Some line items must from selected age group"
|
253
258
|
match_all: "All line items must from selected age group"
|
254
259
|
billing:
|
255
|
-
six_month_discount:
|
260
|
+
six_month_discount: "Six Month discount"
|
256
261
|
twelve_month_discount: "Twelve Month discount"
|
257
|
-
penalty_rate:
|
262
|
+
penalty_rate: "ការផាកពិន័យគិតជាភាគរយ"
|
258
263
|
code: "code"
|
259
264
|
name: "name"
|
260
265
|
logo: "logo"
|
@@ -400,29 +405,29 @@ km:
|
|
400
405
|
|
401
406
|
variant_availability:
|
402
407
|
item_available_instock: ទំនិញក្នុងស្តុកមានតែ 1 ប៉ុណ្ណោះ
|
403
|
-
items_available_instock:
|
404
|
-
items_out_of_stock:
|
408
|
+
items_available_instock: ទំនិញក្នុងស្តុកមានតែ %{available_quantity} ប៉ុណ្ណោះ
|
409
|
+
items_out_of_stock: ទំនិញអស់ពីស្តុក
|
405
410
|
|
406
411
|
account_link:
|
407
412
|
failure: "បរាជ័យក្នុងការភ្ជាប់គណនី %{identity_type}: %{reason}"
|
408
413
|
s3:
|
409
414
|
image:
|
410
415
|
upload:
|
411
|
-
fail:
|
412
|
-
not_found:
|
416
|
+
fail: "បានបរាជ័យក្នុងការទាញយករូបភាព"
|
417
|
+
not_found: "រកមិនឃើញរូបភាព"
|
413
418
|
user_roles_assigner:
|
414
|
-
user_not_found:
|
415
|
-
roles_empty:
|
416
|
-
roles_required:
|
417
|
-
user_already_assigned:
|
419
|
+
user_not_found: "រកមិនឃើញអ្នកប្រើប្រាស់"
|
420
|
+
roles_empty: "តួនាទីគឺទទេ"
|
421
|
+
roles_required: "តួនាទីត្រូវបានទាមទារ"
|
422
|
+
user_already_assigned: "អ្នកប្រើប្រាស់បានបង្កើតតួនាទីរួចហើយ"
|
418
423
|
|
419
424
|
invite:
|
420
|
-
url_not_found:
|
421
|
-
accept_fail:
|
422
|
-
url_expired:
|
423
|
-
already_invited:
|
424
|
-
update_fail:
|
425
|
+
url_not_found: "រកមិនឃើញតំណអញ្ជើញ ឬផុតកំណត់ហើយ"
|
426
|
+
accept_fail: "បរាជ័យក្នុងការទទួលយកការអញ្ជើញ"
|
427
|
+
url_expired: "តំណអញ្ជើញបានផុតកំណត់"
|
428
|
+
already_invited: "បរាជ័យ៖ អ្នកប្រើប្រាស់បានអញ្ជើញចូលរួមព្រឹត្តិការណ៍រួចហើយ"
|
429
|
+
update_fail: "បរាជ័យ៖ ធ្វើបច្ចុប្បន្នភាពអ្នកប្រើប្រាស់អញ្ជើញ"
|
425
430
|
|
426
431
|
event_blazer_queries:
|
427
|
-
success:
|
428
|
-
fail:
|
432
|
+
success: "បានរក្សាទុកព្រឹត្តិការណ៍ដោយជោគជ័យ"
|
433
|
+
fail: "បានរក្សាទុកព្រឹត្តិការណ៍រួចហើយs"
|
data/config/routes.rb
CHANGED
@@ -507,10 +507,6 @@ Spree::Core::Engine.add_routes do
|
|
507
507
|
resources :id_cards, only: %i[create update destroy]
|
508
508
|
end
|
509
509
|
|
510
|
-
resources :dynamic_fields, only: :index
|
511
|
-
resources :product_dynamic_fields, only: :index
|
512
|
-
resources :dynamic_field_options, only: :index
|
513
|
-
|
514
510
|
resource :checkout, controller: :checkout, only: %i[update] do
|
515
511
|
patch :next
|
516
512
|
patch :advance
|
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.1.5.pre.
|
4
|
+
version: 2.1.5.pre.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- You
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-09-
|
11
|
+
date: 2025-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree
|
@@ -976,8 +976,6 @@ files:
|
|
976
976
|
- app/controllers/spree/api/v2/tenant/checkout_controller.rb
|
977
977
|
- app/controllers/spree/api/v2/tenant/cms_pages_controller.rb
|
978
978
|
- app/controllers/spree/api/v2/tenant/customer_notifications_controller.rb
|
979
|
-
- app/controllers/spree/api/v2/tenant/dynamic_field_options_controller.rb
|
980
|
-
- app/controllers/spree/api/v2/tenant/dynamic_fields_controller.rb
|
981
979
|
- app/controllers/spree/api/v2/tenant/guests_controller.rb
|
982
980
|
- app/controllers/spree/api/v2/tenant/homepage_sections_controller.rb
|
983
981
|
- app/controllers/spree/api/v2/tenant/id_cards_controller.rb
|
@@ -986,7 +984,6 @@ files:
|
|
986
984
|
- app/controllers/spree/api/v2/tenant/order_histories_controller.rb
|
987
985
|
- app/controllers/spree/api/v2/tenant/pin_code_checkers_controller.rb
|
988
986
|
- app/controllers/spree/api/v2/tenant/pin_code_generators_controller.rb
|
989
|
-
- app/controllers/spree/api/v2/tenant/product_dynamic_fields_controller.rb
|
990
987
|
- app/controllers/spree/api/v2/tenant/products_controller.rb
|
991
988
|
- app/controllers/spree/api/v2/tenant/profile_images_controller.rb
|
992
989
|
- app/controllers/spree/api/v2/tenant/reset_passwords_controller.rb
|
@@ -1145,7 +1142,6 @@ files:
|
|
1145
1142
|
- app/interactors/spree_cm_commissioner/firebase_email_fetcher_cron_executor.rb
|
1146
1143
|
- app/interactors/spree_cm_commissioner/firebase_id_token_provider.rb
|
1147
1144
|
- app/interactors/spree_cm_commissioner/google_places_fetcher.rb
|
1148
|
-
- app/interactors/spree_cm_commissioner/guest_dynamic_fields_manager.rb
|
1149
1145
|
- app/interactors/spree_cm_commissioner/guest_id_card_manager.rb
|
1150
1146
|
- app/interactors/spree_cm_commissioner/guest_seat_updater.rb
|
1151
1147
|
- app/interactors/spree_cm_commissioner/host_matcher.rb
|
@@ -1745,10 +1741,7 @@ files:
|
|
1745
1741
|
- app/serializers/spree/v2/tenant/cart_serializer.rb
|
1746
1742
|
- app/serializers/spree/v2/tenant/customer_notification_serializer.rb
|
1747
1743
|
- app/serializers/spree/v2/tenant/digital_link_serializer.rb
|
1748
|
-
- app/serializers/spree/v2/tenant/dynamic_field_option_serializer.rb
|
1749
|
-
- app/serializers/spree/v2/tenant/dynamic_field_serializer.rb
|
1750
1744
|
- app/serializers/spree/v2/tenant/guest_card_class_serializer.rb
|
1751
|
-
- app/serializers/spree/v2/tenant/guest_dynamic_field_serializer.rb
|
1752
1745
|
- app/serializers/spree/v2/tenant/guest_serializer.rb
|
1753
1746
|
- app/serializers/spree/v2/tenant/homepage_section_relatable_serializer.rb
|
1754
1747
|
- app/serializers/spree/v2/tenant/homepage_section_serializer.rb
|
@@ -1761,7 +1754,6 @@ files:
|
|
1761
1754
|
- app/serializers/spree/v2/tenant/order_serializer.rb
|
1762
1755
|
- app/serializers/spree/v2/tenant/payment_method_group_serializer.rb
|
1763
1756
|
- app/serializers/spree/v2/tenant/payment_method_serializer.rb
|
1764
|
-
- app/serializers/spree/v2/tenant/product_dynamic_field_serializer.rb
|
1765
1757
|
- app/serializers/spree/v2/tenant/product_serializer.rb
|
1766
1758
|
- app/serializers/spree/v2/tenant/reset_password_serializer.rb
|
1767
1759
|
- app/serializers/spree/v2/tenant/role_serializer.rb
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module Api
|
3
|
-
module V2
|
4
|
-
module Tenant
|
5
|
-
class DynamicFieldOptionsController < BaseController
|
6
|
-
# override
|
7
|
-
def collection
|
8
|
-
return @collection if defined?(@collection)
|
9
|
-
return SpreeCmCommissioner::DynamicFieldOption.none if params[:dynamic_field_id].blank?
|
10
|
-
|
11
|
-
@collection = SpreeCmCommissioner::DynamicFieldOption
|
12
|
-
.where(dynamic_field_id: params[:dynamic_field_id])
|
13
|
-
.active
|
14
|
-
.order(position: :asc)
|
15
|
-
|
16
|
-
@collection = @collection.where('value LIKE ?', "%#{params[:query]}%") if params[:query].present?
|
17
|
-
@collection
|
18
|
-
end
|
19
|
-
|
20
|
-
# override
|
21
|
-
def collection_serializer
|
22
|
-
Spree::V2::Tenant::DynamicFieldOptionSerializer
|
23
|
-
end
|
24
|
-
|
25
|
-
def model_class
|
26
|
-
SpreeCmCommissioner::DynamicFieldOption
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module Api
|
3
|
-
module V2
|
4
|
-
module Tenant
|
5
|
-
class DynamicFieldsController < BaseController
|
6
|
-
before_action :load_product, only: :index
|
7
|
-
|
8
|
-
# override
|
9
|
-
def collection
|
10
|
-
return @collection if defined?(@collection)
|
11
|
-
|
12
|
-
dynamic_fields = @product.dynamic_fields.includes(:dynamic_field_options)
|
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
|
-
Spree::V2::Tenant::DynamicFieldSerializer
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module Api
|
3
|
-
module V2
|
4
|
-
module Tenant
|
5
|
-
class ProductDynamicFieldsController < BaseController
|
6
|
-
before_action :load_product, only: :index
|
7
|
-
|
8
|
-
# override
|
9
|
-
def collection
|
10
|
-
return @collection if defined?(@collection)
|
11
|
-
|
12
|
-
product_dynamic_fields = @product.product_dynamic_fields.includes(dynamic_field: :dynamic_field_options)
|
13
|
-
|
14
|
-
if params[:phase].present?
|
15
|
-
requested_phase = params[:phase].to_s
|
16
|
-
if SpreeCmCommissioner::DynamicField.data_fill_stages.key?(requested_phase)
|
17
|
-
product_dynamic_fields = product_dynamic_fields.joins(:dynamic_field)
|
18
|
-
.where(dynamic_field: { data_fill_stage: requested_phase })
|
19
|
-
.order(:position)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
@collection = product_dynamic_fields.order(:section)
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def load_product
|
29
|
-
return render_error_payload({ error: 'product_id is required' }, 400) if params[:product_id].blank?
|
30
|
-
|
31
|
-
@product ||= Spree::Product.find(params[:product_id])
|
32
|
-
end
|
33
|
-
|
34
|
-
def collection_serializer
|
35
|
-
Spree::V2::Tenant::ProductDynamicFieldSerializer
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module SpreeCmCommissioner
|
2
|
-
class GuestDynamicFieldsManager < BaseInteractor
|
3
|
-
delegate :resource, :dynamic_fields_attributes, to: :context
|
4
|
-
|
5
|
-
def call
|
6
|
-
return if dynamic_fields_attributes.blank?
|
7
|
-
|
8
|
-
dynamic_fields_attributes.each { |attr| upsert_or_destroy_field(attr) }
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def upsert_or_destroy_field(attr)
|
14
|
-
if attr[:_destroy] == '1' && attr[:id].present?
|
15
|
-
resource.guest_dynamic_fields.find_by(id: attr[:id])&.destroy!
|
16
|
-
return
|
17
|
-
end
|
18
|
-
|
19
|
-
return if attr[:dynamic_field_id].blank?
|
20
|
-
|
21
|
-
field = attr[:id].present? ? resource.guest_dynamic_fields.find(attr[:id]) : resource.guest_dynamic_fields.build
|
22
|
-
field.assign_attributes(attr.except(:id, :_destroy))
|
23
|
-
associate_dynamic_field_option(field)
|
24
|
-
field.save!
|
25
|
-
end
|
26
|
-
|
27
|
-
def associate_dynamic_field_option(field)
|
28
|
-
return unless field.value.to_s.match?(/\A\d+\z/)
|
29
|
-
|
30
|
-
field.dynamic_field_option = field.dynamic_field.dynamic_field_options.find_by(id: field.value.to_i)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module V2
|
3
|
-
module Tenant
|
4
|
-
class DynamicFieldSerializer < BaseSerializer
|
5
|
-
attributes :id, :label, :data_type, :vendor_id, :multiple_select, :position, :data_fill_stage
|
6
|
-
|
7
|
-
has_many :dynamic_field_options, serializer: Spree::V2::Tenant::DynamicFieldOptionSerializer
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module V2
|
3
|
-
module Tenant
|
4
|
-
class GuestDynamicFieldSerializer < BaseSerializer
|
5
|
-
attributes :id, :value, :guest_id, :dynamic_field_id, :dynamic_field_option_id, :created_at, :updated_at
|
6
|
-
|
7
|
-
belongs_to :dynamic_field, serializer: Spree::V2::Tenant::DynamicFieldSerializer
|
8
|
-
belongs_to :dynamic_field_option, serializer: Spree::V2::Tenant::DynamicFieldOptionSerializer
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module V2
|
3
|
-
module Tenant
|
4
|
-
class ProductDynamicFieldSerializer < BaseSerializer
|
5
|
-
attributes :id, :product_id, :dynamic_field_id, :section
|
6
|
-
|
7
|
-
belongs_to :dynamic_field, serializer: Spree::V2::Tenant::DynamicFieldSerializer
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|