spree_cm_commissioner 2.12.9 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/controllers/spree/admin/orders/customer_details_controller_decorator.rb +6 -4
- data/app/controllers/spree/api/v2/platform/resource_controller_decorator.rb +48 -0
- data/app/models/spree_cm_commissioner/line_item_decorator.rb +1 -1
- data/app/overrides/spree/admin/orders/_order_actions/actions.html.erb.deface +4 -4
- data/app/overrides/spree/admin/orders/_search/taxon_search_field.html.erb.deface +8 -0
- data/app/overrides/spree/admin/orders/customer_details/edit/reassign_customer_search.html.erb.deface +4 -5
- data/app/overrides/spree/admin/taxons/_form/preview_checkbox.html.erb.deface +4 -0
- data/app/overrides/spree/admin/taxons/_form/vendor.html.erb.deface +10 -2
- data/app/overrides/spree/admin/users/_tabs/tabs.html.erb.deface +1 -1
- data/app/views/spree/admin/shared/_taxon_tabs.html.erb +1 -1
- data/app/views/spree/admin/user_events/_new_user.html.erb +2 -1
- data/app/views/spree/admin/user_events/_users.html.erb +1 -1
- data/config/locales/en.yml +5 -2
- data/config/locales/km.yml +5 -2
- data/lib/spree_cm_commissioner/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b168ef103cb6aec0e7865fc4a752cc2367d526180fd6855bf21f6fba1cc72412
|
|
4
|
+
data.tar.gz: 05a6401d8ea20de2661c421471a16e0e8e1ace6882178a4f3f1cef0e9825d9b4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6cc975658385143deea2b8f1f8e7ac7b4d9ccfa2ce96054c1968a99fe4a6f3793a09585341bf389d2d9939f1097b4d9e867f62734a1d6aafaef0429628d2c875
|
|
7
|
+
data.tar.gz: 1baa1785ad8c59d5d3ae287518b19c4e680db6a796678096b31c9e18c7e5c1f856984e18ca19407e478e332a465ed4f0d86f0f3c269378e37e9567bb9e91e46b
|
data/Gemfile.lock
CHANGED
|
@@ -15,11 +15,13 @@ module Spree
|
|
|
15
15
|
def assign_customer
|
|
16
16
|
user = tenant_user_scope.find_by(id: params[:user_id])
|
|
17
17
|
|
|
18
|
-
if user
|
|
19
|
-
@order.associate_user!(user)
|
|
20
|
-
flash[:success] = Spree.t('admin.orders.customer_details.customer_assigned', email: user.email)
|
|
21
|
-
else
|
|
18
|
+
if user.nil?
|
|
22
19
|
flash[:error] = Spree.t(:user_not_found)
|
|
20
|
+
elsif user.id == @order.user_id
|
|
21
|
+
flash[:notice] = Spree.t('admin.orders.customer_details.user_already_assigned', email: user.email)
|
|
22
|
+
else
|
|
23
|
+
@order.associate_user!(user)
|
|
24
|
+
flash[:success] = Spree.t('admin.orders.customer_details.user_assigned', email: user.email)
|
|
23
25
|
end
|
|
24
26
|
|
|
25
27
|
redirect_to spree.edit_admin_order_customer_path(@order)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V2
|
|
4
|
+
module Platform
|
|
5
|
+
# Single reusable entry point for tenant-scoping any Platform API resource: pass
|
|
6
|
+
# `?tenant_id=X` on the request and the collection is narrowed to that tenant, without each
|
|
7
|
+
# controller having to wire up its own filter/param handling.
|
|
8
|
+
#
|
|
9
|
+
# Tri-state on the param itself:
|
|
10
|
+
# - absent: no scoping applied, collection flows through unrestricted (existing callers,
|
|
11
|
+
# eg. the products/users pickers in checkouts and private sales, are unaffected).
|
|
12
|
+
# - "0": scope to records with no tenant (tenant_id IS NULL) - most vendors today aren't
|
|
13
|
+
# attached to a tenant, so this is the common case for tenant-scoped search.
|
|
14
|
+
# - any other value: scope to that exact tenant_id.
|
|
15
|
+
#
|
|
16
|
+
# Default assumes the model owns a `tenant_id` column directly (true for Spree::User,
|
|
17
|
+
# Spree::Vendor, SpreeCmCommissioner::HomepageSection - see their `multi_tenant :tenant`
|
|
18
|
+
# declarations). A model related to tenant only indirectly should override
|
|
19
|
+
# `scope_by_tenant` in its own controller decorator.
|
|
20
|
+
module ResourceControllerDecorator
|
|
21
|
+
def scope
|
|
22
|
+
base_scope = super
|
|
23
|
+
|
|
24
|
+
# Keep the existing behavior when no tenant_id param is passed,
|
|
25
|
+
# so that existing controllers are unaffected.
|
|
26
|
+
return base_scope if params[:tenant_id].nil?
|
|
27
|
+
|
|
28
|
+
scope_by_tenant(base_scope, params[:tenant_id])
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def scope_by_tenant(scope, tenant_id)
|
|
34
|
+
return scope unless scope.klass.column_names.include?('tenant_id')
|
|
35
|
+
|
|
36
|
+
if tenant_id.to_s == '0'
|
|
37
|
+
scope.where(tenant_id: nil)
|
|
38
|
+
else
|
|
39
|
+
scope.where(tenant_id: tenant_id)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
Spree::Api::V2::Platform::ResourceController.prepend(Spree::Api::V2::Platform::ResourceControllerDecorator)
|
|
@@ -37,7 +37,7 @@ module SpreeCmCommissioner
|
|
|
37
37
|
base.validate :ensure_all_guests_have_blocks, if: :required_seat_selection?
|
|
38
38
|
|
|
39
39
|
base.whitelisted_ransackable_associations |= %w[guests order]
|
|
40
|
-
base.whitelisted_ransackable_attributes |= %w[number to_date from_date vendor_id]
|
|
40
|
+
base.whitelisted_ransackable_attributes |= %w[number to_date from_date vendor_id event_id]
|
|
41
41
|
|
|
42
42
|
base.delegate :delivery_required?, :high_demand,
|
|
43
43
|
to: :variant
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<% end %>
|
|
14
14
|
|
|
15
15
|
<% if can?(:fire, order) && order.can_cancel? %>
|
|
16
|
-
<% cancel_label = Spree.t(:cancel
|
|
16
|
+
<% cancel_label = Spree.t(:cancel) %>
|
|
17
17
|
<%= button_link_to cancel_label,
|
|
18
18
|
'#',
|
|
19
19
|
icon: 'cancel.svg',
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<div class="modal-dialog" role="document">
|
|
25
25
|
<div class="modal-content">
|
|
26
26
|
<div class="modal-header">
|
|
27
|
-
<h5 class="modal-title
|
|
27
|
+
<h5 class="mr-auto modal-title" id="cancelModalLabel-<%= order.number %>"><%= Spree.t(:order_sure_want_to, event: cancel_label) %></h5>
|
|
28
28
|
<button type="button" class="close" data-dismiss="modal" aria-label="<%= Spree.t(:close) %>">
|
|
29
29
|
<span aria-hidden="true">×</span>
|
|
30
30
|
</button>
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
|
|
33
33
|
<%= form_with model: order, url: spree.cancel_admin_order_url(order), method: :put do |f| %>
|
|
34
34
|
<div class="modal-body">
|
|
35
|
-
<div class="form-group text-
|
|
35
|
+
<div class="text-left form-group text-start">
|
|
36
36
|
<%= f.label :internal_note, raw(Spree.t(:reason) + required_span_tag), class: 'd-block text-left text-start' %>
|
|
37
37
|
<%= f.text_area :internal_note, rows: 3, class: 'form-control', placeholder: Spree.t(:enter_internal_note, default: 'Enter reason here...'), required: true %>
|
|
38
38
|
</div>
|
|
39
39
|
</div>
|
|
40
|
-
<div class="modal-footer d-flex
|
|
40
|
+
<div class="justify-end modal-footer d-flex">
|
|
41
41
|
<button type="button" class="btn btn-primary" data-dismiss="modal"><%= Spree.t(:close) %></button>
|
|
42
42
|
<%= f.submit Spree.t(:confirm), class: 'btn btn-danger' %>
|
|
43
43
|
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<!-- insert_before "[data-hook='admin_orders_index_search'] .row:nth-child(5) .col-12.col-lg-4:nth-child(3)" -->
|
|
2
|
+
|
|
3
|
+
<div class="col-12 col-lg-4">
|
|
4
|
+
<div class="form-group">
|
|
5
|
+
<%= label_tag :q_line_items_event_id_eq, "Event" %>
|
|
6
|
+
<%= f.select :line_items_event_id_eq, Spree::Taxon.events.pluck(:name, :id), { include_blank: true }, class: 'select2-clear js-filterable' %>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
data/app/overrides/spree/admin/orders/customer_details/edit/reassign_customer_search.html.erb.deface
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<!-- replace "#select-customer" -->
|
|
2
2
|
|
|
3
|
-
<% unless @order.completed? && @order.user.present? %>
|
|
4
3
|
<%= turbo_frame_tag 'customer_reassign' do %>
|
|
5
4
|
<div class="mb-3 card" data-hook>
|
|
6
5
|
<div class="card-header">
|
|
@@ -28,14 +27,15 @@
|
|
|
28
27
|
|
|
29
28
|
<% if @customer_search_query.present? %>
|
|
30
29
|
<% if @customer_search_result %>
|
|
30
|
+
<% replacing_user = @order.user.present? %>
|
|
31
31
|
<div class="flex-wrap gap-2 mt-2 mb-0 alert alert-success d-flex justify-content-between align-items-center">
|
|
32
32
|
<span><%= Spree.t('admin.orders.customer_details.customer_found', email: @customer_search_result.email) %></span>
|
|
33
|
-
<%= button_to Spree.t('admin.orders.customer_details.
|
|
33
|
+
<%= button_to replacing_user ? Spree.t('admin.orders.customer_details.replace_user') : Spree.t('admin.orders.customer_details.assign_user'),
|
|
34
34
|
spree.assign_customer_admin_order_customer_path(@order),
|
|
35
35
|
method: :patch,
|
|
36
36
|
params: { user_id: @customer_search_result.id },
|
|
37
|
-
class:
|
|
38
|
-
form: { data: { turbo_frame: '_top' } } %>
|
|
37
|
+
class: "btn btn-sm #{replacing_user ? 'btn-danger' : 'btn-primary'}",
|
|
38
|
+
form: { data: { turbo_frame: '_top', turbo_confirm: (Spree.t('admin.orders.customer_details.replace_user_confirm', email: @order.user.email) if replacing_user) } } %>
|
|
39
39
|
</div>
|
|
40
40
|
<% else %>
|
|
41
41
|
<div class="mt-2 mb-0 alert alert-warning">
|
|
@@ -46,4 +46,3 @@
|
|
|
46
46
|
</div>
|
|
47
47
|
</div>
|
|
48
48
|
<% end %>
|
|
49
|
-
<% end %>
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
<!-- insert_before "erb[loud]:contains('field_container :hide_from_nav')" -->
|
|
2
2
|
|
|
3
|
+
<% if @taxon.depth == 1 %>
|
|
4
|
+
|
|
3
5
|
<%= f.field_container :preview, class: ['custom-control', 'custom-checkbox', 'my-4'] do %>
|
|
4
6
|
<%= f.check_box :preview, class: 'custom-control-input' %>
|
|
5
7
|
<%= f.label :preview, 'Preview (internal team only)', class: 'custom-control-label' %>
|
|
6
8
|
<%= f.error_message_on :preview %>
|
|
7
9
|
<% end %>
|
|
10
|
+
|
|
11
|
+
<% end %>
|
|
@@ -3,11 +3,19 @@
|
|
|
3
3
|
<% if @taxon.depth == 1 %>
|
|
4
4
|
<div>
|
|
5
5
|
<%= f.field_container :vendor_id do %>
|
|
6
|
-
|
|
6
|
+
<label class="d-flex">
|
|
7
|
+
<span class="mr-2"><%= Spree.t(:vendor) %></span>
|
|
8
|
+
<% if f.object.vendor_id.present? %>
|
|
9
|
+
<%= link_to_with_icon 'arrow-right-circle.svg', Spree.t(' '), spree.edit_admin_vendor_path(f.object.vendor_id), class: "d-flex align-items-center" do %>
|
|
10
|
+
<i class="bi bi-arrow-right-circle me-1"></i>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% else %>
|
|
13
|
+
<span class="text-muted"><%= Spree.t(:no_vendor_assigned) %></span>
|
|
14
|
+
<% end %>
|
|
15
|
+
</label>
|
|
7
16
|
<%= f.select :vendor_id, Spree::Vendor.order(:name).pluck(:name, :id),
|
|
8
17
|
{ include_blank: true }, { class: 'select2-clear js-filterable' } %>
|
|
9
18
|
<%= f.error_message_on :vendor_id, class: 'error-message' %>
|
|
10
19
|
<% end %>
|
|
11
20
|
</div>
|
|
12
21
|
<% end %>
|
|
13
|
-
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<%# user event only show for event %>
|
|
34
34
|
<%= content_tag :li, class: 'nav-item' do %>
|
|
35
35
|
<%= link_to_with_icon 'user.svg',
|
|
36
|
-
Spree.t(:
|
|
36
|
+
Spree.t(:crews),
|
|
37
37
|
admin_user_events_path(params: {taxon_id: @taxon.id, taxonomy_id: @taxonomy}),
|
|
38
38
|
class: "nav-link #{'active' if current == :user_events}" %>
|
|
39
39
|
<% end if can?(:manage, SpreeCmCommissioner::UserTaxon) && @taxon.event? && @taxon.depth == 1 %>
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
{ include_hidden: true },
|
|
20
20
|
data: { autocomplete_url_value: 'users_api_v2',
|
|
21
21
|
autocomplete_return_attr_value: 'email',
|
|
22
|
-
autocomplete_search_query_value: '
|
|
22
|
+
autocomplete_search_query_value: 'email_or_normalized_login_or_phone_number_i_cont',
|
|
23
|
+
autocomplete_additional_url_params_value: "tenant_id=#{@taxon.vendor&.tenant_id || 0}",
|
|
23
24
|
minimum_input_length: 3 } %>
|
|
24
25
|
<%= f.error_message_on :user_id %>
|
|
25
26
|
<% end %>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<% end %>
|
|
12
12
|
|
|
13
13
|
<% content_for :page_actions do %>
|
|
14
|
-
<%= button_link_to Spree.t(:
|
|
14
|
+
<%= button_link_to Spree.t(:add_new_crews), new_admin_user_event_path(params: {taxon_id: @taxon.id}), class: "btn-success", icon: 'add.svg', id: 'admin_new_user_events_link' %>
|
|
15
15
|
<% end if can? :create, SpreeCmCommissioner::UserTaxon %>
|
|
16
16
|
|
|
17
17
|
<%= render partial: 'spree/admin/shared/taxon_tabs', locals: { current: :user_events } %>
|
data/config/locales/en.yml
CHANGED
|
@@ -660,8 +660,11 @@ en:
|
|
|
660
660
|
customer_found: "Found %{email}."
|
|
661
661
|
customer_not_found: 'No customer found for "%{query}" in this tenant.'
|
|
662
662
|
clear_search: "Clear search"
|
|
663
|
-
|
|
664
|
-
|
|
663
|
+
assign_user: "Assign User"
|
|
664
|
+
replace_user: "Replace User"
|
|
665
|
+
replace_user_confirm: "This order is currently assigned to %{email}. Replace them with the user found above?"
|
|
666
|
+
user_assigned: "Order reassigned to %{email}."
|
|
667
|
+
user_already_assigned: "This order is already assigned to %{email}."
|
|
665
668
|
event:
|
|
666
669
|
check_in:
|
|
667
670
|
success: "Guest check-in in successfully"
|
data/config/locales/km.yml
CHANGED
|
@@ -433,8 +433,11 @@ km:
|
|
|
433
433
|
customer_found: "រកឃើញ %{email}។"
|
|
434
434
|
customer_not_found: 'រកមិនឃើញអតិថិជនសម្រាប់ "%{query}" ក្នុង tenant នេះទេ។'
|
|
435
435
|
clear_search: "សម្អាតការស្វែងរក"
|
|
436
|
-
|
|
437
|
-
|
|
436
|
+
assign_user: "ផ្តល់ជូនអ្នកប្រើប្រាស់"
|
|
437
|
+
replace_user: "ជំនួសអ្នកប្រើប្រាស់"
|
|
438
|
+
replace_user_confirm: "លំដាប់នេះកំពុងភ្ជាប់ជាមួយ %{email} រួចហើយ។ តើជំនួសដោយអ្នកប្រើប្រាស់ដែលរកឃើញខាងលើមែនទេ?"
|
|
439
|
+
user_assigned: "លំដាប់នេះត្រូវបានផ្លាស់ប្តូរទៅ %{email}។"
|
|
440
|
+
user_already_assigned: "លំដាប់នេះបានភ្ជាប់ជាមួយ %{email} រួចហើយ។"
|
|
438
441
|
event:
|
|
439
442
|
check_in:
|
|
440
443
|
success: "Guest check-in in successfully"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_cm_commissioner
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- You
|
|
@@ -961,6 +961,7 @@ files:
|
|
|
961
961
|
- app/controllers/spree/api/v2/platform/homepage_section_relatable_options_controller.rb
|
|
962
962
|
- app/controllers/spree/api/v2/platform/option_types_controller_decorator.rb
|
|
963
963
|
- app/controllers/spree/api/v2/platform/places_controller.rb
|
|
964
|
+
- app/controllers/spree/api/v2/platform/resource_controller_decorator.rb
|
|
964
965
|
- app/controllers/spree/api/v2/platform/seat_number_layouts_controller.rb
|
|
965
966
|
- app/controllers/spree/api/v2/platform/taxons_controller_decorator.rb
|
|
966
967
|
- app/controllers/spree/api/v2/resource_controller_decorator.rb
|
|
@@ -1833,6 +1834,7 @@ files:
|
|
|
1833
1834
|
- app/overrides/spree/admin/orders/_search/line_item_number_search_field.html.erb.deface
|
|
1834
1835
|
- app/overrides/spree/admin/orders/_search/payment_method_search_field.html.erb.deface
|
|
1835
1836
|
- app/overrides/spree/admin/orders/_search/payment_number_search_field.html.erb.deface
|
|
1837
|
+
- app/overrides/spree/admin/orders/_search/taxon_search_field.html.erb.deface
|
|
1836
1838
|
- app/overrides/spree/admin/orders/_search/vendor_search_field.html.erb.deface
|
|
1837
1839
|
- app/overrides/spree/admin/orders/customer_details/_form/phone_number_field.html.erb.deface
|
|
1838
1840
|
- app/overrides/spree/admin/orders/customer_details/_form/view_profile_link.html.erb.deface
|