spree_cm_commissioner 2.15.6 → 2.16.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/taxon_sections_controller.rb +202 -0
- data/app/controllers/spree/admin/taxons_controller_decorator.rb +2 -0
- data/app/controllers/spree/api/v2/platform/homepage_section_relatable_options_controller.rb +15 -16
- data/app/controllers/spree/api/v2/storefront/homepage_sections_controller.rb +3 -0
- data/app/helpers/spree_cm_commissioner/admin/taxon_setting_defaults_helper.rb +13 -0
- data/app/models/concerns/spree_cm_commissioner/line_item_seat_selection.rb +2 -1
- data/app/models/concerns/spree_cm_commissioner/order_pricing_channel.rb +19 -0
- data/app/{services → models}/spree_cm_commissioner/channel_pricing/calculator.rb +10 -3
- data/app/models/spree_cm_commissioner/oauth_application_decorator.rb +1 -1
- data/app/models/spree_cm_commissioner/order_decorator.rb +1 -1
- data/app/models/spree_cm_commissioner/pricing_channel.rb +32 -0
- data/app/models/spree_cm_commissioner/taxon_decorator.rb +2 -1
- data/app/models/spree_cm_commissioner/taxon_vendor.rb +1 -1
- data/app/overrides/spree/admin/oauth_applications/_form/pricing_channel_field.html.erb.deface +1 -1
- data/app/overrides/spree/admin/taxons/_form/advanced_settings.html.erb.deface +64 -0
- data/app/overrides/spree/admin/taxons/_form/check_in_and_operator.html.erb.deface +33 -0
- data/app/overrides/spree/admin/taxons/_form/live_stock.html.erb.deface +30 -0
- data/app/queries/spree_cm_commissioner/settlement_summary_query.rb +2 -2
- data/app/services/spree_cm_commissioner/agencies/onboard.rb +76 -0
- data/app/services/spree_cm_commissioner/channel_pricing/{find_or_create_policy.rb → find_or_create_buy_policy.rb} +1 -1
- data/app/services/spree_cm_commissioner/channel_pricing/list_trip_prices.rb +49 -0
- data/app/services/spree_cm_commissioner/channel_pricing/preview_rule.rb +88 -0
- data/app/services/spree_cm_commissioner/channel_pricing/price_trip_results.rb +1 -1
- data/app/services/spree_cm_commissioner/channel_pricing/resolve.rb +1 -1
- data/app/services/spree_cm_commissioner/seats/assign_guest.rb +124 -0
- data/app/services/spree_cm_commissioner/seats/auto_assign.rb +13 -11
- data/app/services/spree_cm_commissioner/settlements/generate_entries_batch.rb +1 -1
- data/app/views/spree/admin/shared/_taxon_tabs.html.erb +8 -24
- data/app/views/spree/admin/taxon_sections/_add_modal.html.erb +38 -0
- data/app/views/spree/admin/taxon_sections/_columns.html.erb +12 -0
- data/app/views/spree/admin/taxon_sections/_delete_link.html.erb +10 -0
- data/app/views/spree/admin/taxon_sections/_hotel_picker.html.erb +26 -0
- data/app/views/spree/admin/taxon_sections/_hotels_table.html.erb +81 -0
- data/app/views/spree/admin/taxon_sections/_new_section_modal.html.erb +36 -0
- data/app/views/spree/admin/taxon_sections/_product_picker.html.erb +27 -0
- data/app/views/spree/admin/taxon_sections/_products_table.html.erb +80 -0
- data/app/views/spree/admin/taxon_sections/_section.html.erb +78 -0
- data/app/views/spree/admin/taxon_sections/index.html.erb +103 -0
- data/config/locales/en.yml +59 -0
- data/config/locales/km.yml +59 -0
- data/config/routes.rb +16 -7
- data/lib/spree_cm_commissioner/version.rb +1 -1
- metadata +25 -25
- data/app/controllers/spree/admin/classifications_controller.rb +0 -49
- data/app/controllers/spree/admin/taxon_childrens_controller.rb +0 -20
- data/app/controllers/spree/admin/taxon_vendors_controller.rb +0 -35
- data/app/models/concerns/spree_cm_commissioner/order_pricing_channel_resolver.rb +0 -67
- data/app/overrides/spree/admin/taxons/_form/background_color_and_foreground_color.html.erb.deface +0 -35
- data/app/overrides/spree/admin/taxons/_form/check_in_flows.html.erb.deface +0 -36
- data/app/overrides/spree/admin/taxons/_form/custom_redirect_url.html.erb.deface +0 -8
- data/app/overrides/spree/admin/taxons/_form/enforce_waiting_room_session.html.erb.deface +0 -10
- data/app/overrides/spree/admin/taxons/_form/hide_video_banner.html.erb.deface +0 -9
- data/app/overrides/spree/admin/taxons/_form/live_stock_window_form_date.html.erb.deface +0 -41
- data/app/overrides/spree/admin/taxons/_form/preview_checkbox.html.erb.deface +0 -11
- data/app/overrides/spree/admin/taxons/_form/show_badge_status.html.erb.deface +0 -13
- data/app/views/spree/admin/classifications/edit.html.erb +0 -58
- data/app/views/spree/admin/classifications/index.html.erb +0 -24
- data/app/views/spree/admin/classifications/new.html.erb +0 -47
- data/app/views/spree/admin/shared/_products.html.erb +0 -71
- data/app/views/spree/admin/taxon_childrens/index.html.erb +0 -34
- data/app/views/spree/admin/taxon_vendors/_form.html.erb +0 -10
- data/app/views/spree/admin/taxon_vendors/edit.html.erb +0 -24
- data/app/views/spree/admin/taxon_vendors/index.html.erb +0 -55
- data/app/views/spree/admin/taxon_vendors/new.html.erb +0 -28
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<%# Opened by the New Section page action (Bootstrap data-toggle, no custom JS beyond focusing the field). Posts to
|
|
2
|
+
TaxonSectionsController#create, which redirects back to the page like every other action here. %>
|
|
3
|
+
<div class="modal fade" id="newSectionModal" tabindex="-1" role="dialog" aria-labelledby="newSectionModalLabel" aria-hidden="true">
|
|
4
|
+
<div class="modal-dialog" role="document">
|
|
5
|
+
<div class="modal-content">
|
|
6
|
+
<div class="modal-header">
|
|
7
|
+
<h5 class="modal-title" id="newSectionModalLabel"><%= Spree.t(:new_section) %></h5>
|
|
8
|
+
<button type="button" class="close" data-dismiss="modal" aria-label="<%= Spree.t(:close) %>">
|
|
9
|
+
<span aria-hidden="true">×</span>
|
|
10
|
+
</button>
|
|
11
|
+
</div>
|
|
12
|
+
<%= form_tag spree.admin_taxonomy_taxon_taxon_sections_path(@taxonomy.id, @taxon.id), method: :post do %>
|
|
13
|
+
<div class="modal-body">
|
|
14
|
+
<div class="form-group mb-0">
|
|
15
|
+
<%= label_tag 'new_section_name', raw(Spree.t(:name) + required_span_tag) %>
|
|
16
|
+
<%= text_field_tag 'section[name]', nil,
|
|
17
|
+
id: 'new_section_name',
|
|
18
|
+
class: 'form-control',
|
|
19
|
+
placeholder: Spree.t('section_products.new_section_placeholder'),
|
|
20
|
+
autocomplete: 'off',
|
|
21
|
+
required: true %>
|
|
22
|
+
<small class="form-text text-muted"><%= Spree.t('section_products.new_section_hint') %></small>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="modal-footer">
|
|
26
|
+
<button type="button" class="btn btn-secondary" data-dismiss="modal"><%= Spree.t(:cancel) %></button>
|
|
27
|
+
<%= button_tag Spree.t('section_products.add_section'), type: 'submit', class: 'btn btn-success' %>
|
|
28
|
+
</div>
|
|
29
|
+
<% end %>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
$(document).on('shown.bs.modal', '#newSectionModal', function () { $('#new_section_name').trigger('focus'); });
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<%# :section — the products form inside the section's Add modal. %>
|
|
2
|
+
<%= form_tag spree.add_products_admin_taxonomy_taxon_taxon_section_path(@taxonomy.id, @taxon.id, section.id), method: :post do %>
|
|
3
|
+
<div class="modal-body">
|
|
4
|
+
<%= label_tag "section_#{section.id}_product_ids", Spree.t(:products) %>
|
|
5
|
+
<%# Same picker as the promotion product rule: labels options "Name (slug)", since many products share a name like "General Access".
|
|
6
|
+
Scoped to the event's tenant (see TaxonSectionsController#event_tenant_id); tenant_id=0 means tenant-less.
|
|
7
|
+
Inline width: select2 sizes itself on page load, while the modal is still hidden (0px wide). %>
|
|
8
|
+
<%= select_tag 'product_ids', nil,
|
|
9
|
+
multiple: true,
|
|
10
|
+
id: "section_#{section.id}_product_ids",
|
|
11
|
+
class: 'select2autocomplete',
|
|
12
|
+
style: 'width: 100%',
|
|
13
|
+
data: {
|
|
14
|
+
autocomplete_placeholder_value: Spree.t('section_products.search_placeholder'),
|
|
15
|
+
autocomplete_url_value: 'homepage_section_relatables_api_v2',
|
|
16
|
+
autocomplete_return_attr_value: :name_with_slug,
|
|
17
|
+
autocomplete_search_query_value: 'name_or_slug_i_cont',
|
|
18
|
+
autocomplete_min_input_value: 2,
|
|
19
|
+
autocomplete_multiple_value: true,
|
|
20
|
+
autocomplete_additional_url_params_value: "model_class=Spree::Product&tenant_id=#{event_tenant_id || 0}"
|
|
21
|
+
} %>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="modal-footer">
|
|
24
|
+
<button type="button" class="btn btn-secondary" data-dismiss="modal"><%= Spree.t(:cancel) %></button>
|
|
25
|
+
<%= button_tag Spree.t('section_products.add'), type: 'submit', class: 'btn btn-success' %>
|
|
26
|
+
</div>
|
|
27
|
+
<% end %>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<%# :section, :classifications, :titled — titled only when the section also has hotels, to tell the two lists apart. %>
|
|
2
|
+
<% reorderable = classifications.size > 1 && can?(:update, @taxon) %>
|
|
3
|
+
|
|
4
|
+
<% if titled %>
|
|
5
|
+
<h6 class="section-inset pt-3 mb-0 text-muted small text-uppercase"><%= Spree.t(:products) %></h6>
|
|
6
|
+
<% end %>
|
|
7
|
+
<div class="table-responsive">
|
|
8
|
+
<table class="table mb-0 section-items-table"
|
|
9
|
+
<%= tag.attributes(data: { section_sortable_link: spree.reorder_products_admin_taxonomy_taxon_taxon_section_path(@taxonomy.id, @taxon.id, section.id) }) if reorderable %>>
|
|
10
|
+
<%= render 'columns' %>
|
|
11
|
+
<thead class="text-muted">
|
|
12
|
+
<tr>
|
|
13
|
+
<th scope="col" class="section-handle-col"></th>
|
|
14
|
+
<th scope="col" colspan="2"><%= Spree.t(:name) %></th>
|
|
15
|
+
<th scope="col" class="text-center"><%= Spree.t(:status) %></th>
|
|
16
|
+
<th scope="col" class="text-center"><%= Spree.t(:price) %></th>
|
|
17
|
+
<th scope="col" class="text-center"><%= Spree.t('section_products.sold') %></th>
|
|
18
|
+
<th scope="col" class="text-center"><%= Spree.t(:revenue) %></th>
|
|
19
|
+
<th scope="col" class="text-center">
|
|
20
|
+
<%= Spree.t('section_products.visibility') %>
|
|
21
|
+
<span class="text-muted" title="<%= Spree.t('section_products.visibility_hint') %>">ⓘ</span>
|
|
22
|
+
</th>
|
|
23
|
+
<th scope="col"></th>
|
|
24
|
+
</tr>
|
|
25
|
+
</thead>
|
|
26
|
+
<tbody>
|
|
27
|
+
<% classifications.each do |classification| %>
|
|
28
|
+
<% product = classification.product %>
|
|
29
|
+
<% available_status = available_status(product) %>
|
|
30
|
+
<tr id="<%= spree_dom_id classification %>" data-sortable-id="<%= classification.id %>" class="<%= 'text-muted' unless classification.visible %>">
|
|
31
|
+
<%# The column is kept even when there's nothing to drag, so rows line up with the section's own grip. %>
|
|
32
|
+
<td class="section-handle-col <%= 'section-item-move-handle' if reorderable %>" title="<%= Spree.t('section_products.drag_hint') if reorderable %>">
|
|
33
|
+
<%= svg_icon(name: 'grip-vertical.svg', width: '18', height: '18') if reorderable %>
|
|
34
|
+
</td>
|
|
35
|
+
<td class="image section-thumb">
|
|
36
|
+
<%= link_to small_image(product), spree.edit_admin_product_path(product) %>
|
|
37
|
+
</td>
|
|
38
|
+
<td>
|
|
39
|
+
<%= link_to product.name, spree.edit_admin_product_path(product) %>
|
|
40
|
+
<% if product.offline? %>
|
|
41
|
+
<span class="badge badge-info ml-1">Offline</span>
|
|
42
|
+
<% end %>
|
|
43
|
+
<% if product.tenant_id != event_tenant_id %>
|
|
44
|
+
<span class="badge badge-warning ml-1" title="<%= Spree.t('section_products.other_tenant_hint') %>"><%= Spree.t('section_products.other_tenant') %></span>
|
|
45
|
+
<% end %>
|
|
46
|
+
<br />
|
|
47
|
+
<small class="text-muted"><%= product.slug %></small>
|
|
48
|
+
</td>
|
|
49
|
+
<td class="text-center"><%= active_badge(available_status == Spree.t('admin.product.active'), label: available_status) %></td>
|
|
50
|
+
<td class="text-center"><%= display_price(product) %></td>
|
|
51
|
+
<td class="text-center"><%= classification.total_count %></td>
|
|
52
|
+
<td class="text-center"><%= Spree::Money.new(classification.revenue) %></td>
|
|
53
|
+
<td class="text-center">
|
|
54
|
+
<% if can?(:update, @taxon) %>
|
|
55
|
+
<%# The switch shows the current state; flipping it submits the opposite value (the hidden field), so the
|
|
56
|
+
checkbox itself needs no name. %>
|
|
57
|
+
<%= form_tag spree.update_product_visibility_admin_taxonomy_taxon_taxon_section_path(@taxonomy.id, @taxon.id, section.id, classification.id),
|
|
58
|
+
method: :patch, class: 'd-inline-block' do %>
|
|
59
|
+
<%= hidden_field_tag :visible, !classification.visible, id: nil %>
|
|
60
|
+
<div class="custom-control custom-switch" title="<%= Spree.t(classification.visible ? 'section_products.click_to_hide' : 'section_products.click_to_show') %>">
|
|
61
|
+
<%= check_box_tag nil, '1', classification.visible, id: "listed_#{classification.id}", class: 'custom-control-input', onchange: 'this.form.submit()' %>
|
|
62
|
+
<label class="custom-control-label" for="listed_<%= classification.id %>"></label>
|
|
63
|
+
</div>
|
|
64
|
+
<% end %>
|
|
65
|
+
<% else %>
|
|
66
|
+
<%= active_badge(classification.visible) %>
|
|
67
|
+
<% end %>
|
|
68
|
+
</td>
|
|
69
|
+
<td class="actions pr-3">
|
|
70
|
+
<span class="d-flex justify-content-end">
|
|
71
|
+
<%= render 'delete_link',
|
|
72
|
+
url: spree.remove_product_admin_taxonomy_taxon_taxon_section_path(@taxonomy.id, @taxon.id, section.id, classification.id),
|
|
73
|
+
title: Spree.t('section_products.remove') if can?(:update, @taxon) %>
|
|
74
|
+
</span>
|
|
75
|
+
</td>
|
|
76
|
+
</tr>
|
|
77
|
+
<% end %>
|
|
78
|
+
</tbody>
|
|
79
|
+
</table>
|
|
80
|
+
</div>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<%# :section — a descendant of @taxon; nested sections render recursively inside their parent's card.
|
|
2
|
+
A section shows whatever it holds, like the app does (ticket cards for products, hotel cards for vendors).
|
|
3
|
+
Adding goes through the header's Add button and a modal (see _add_modal). %>
|
|
4
|
+
<% classifications = @classifications_by_section_id[section.id] || [] %>
|
|
5
|
+
<% taxon_vendors = @taxon_vendors_by_section_id[section.id] || [] %>
|
|
6
|
+
<% children = @sections_by_parent_id[section.id] || [] %>
|
|
7
|
+
<% can_edit = can?(:update, @taxon) %>
|
|
8
|
+
<% empty = classifications.empty? && taxon_vendors.empty? %>
|
|
9
|
+
<% add_modal_id = "section_#{section.id}_add_modal" %>
|
|
10
|
+
|
|
11
|
+
<div id="section_<%= section.id %>"
|
|
12
|
+
class="draggable card mb-3 section-products-card"
|
|
13
|
+
data-sortable-tree-resource-name-value="taxon"
|
|
14
|
+
data-sortable-tree-update-url-value="/api/v2/platform/taxons/<%= section.id %>/reposition">
|
|
15
|
+
<div class="card-header bg-white d-flex align-items-center py-2 pl-0 pr-3">
|
|
16
|
+
<div class="move-handle section-handle-col d-flex align-items-center justify-content-center" title="<%= Spree.t('section_products.drag_hint') %>">
|
|
17
|
+
<%= svg_icon(name: 'grip-vertical.svg', width: '18', height: '18') %>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="flex-grow-1 overflow-hidden section-cell-pad">
|
|
21
|
+
<%= link_to section.name, spree.edit_admin_taxonomy_taxon_path(@taxonomy, section.id), class: 'font-weight-bold text-body' %>
|
|
22
|
+
<% if classifications.any? %>
|
|
23
|
+
<span class="badge badge-pill badge-light ml-2"><%= Spree.t('section_products.badge', count: classifications.size) %></span>
|
|
24
|
+
<% end %>
|
|
25
|
+
<% if taxon_vendors.any? %>
|
|
26
|
+
<span class="badge badge-pill badge-light ml-2"><%= Spree.t('section_hotels.badge', count: taxon_vendors.size) %></span>
|
|
27
|
+
<% end %>
|
|
28
|
+
<% if empty %>
|
|
29
|
+
<span class="badge badge-pill badge-light text-muted ml-2"><%= Spree.t('section_products.empty_badge') %></span>
|
|
30
|
+
<% end %>
|
|
31
|
+
<% if section.hide_from_nav %>
|
|
32
|
+
<span class="badge badge-pill badge-light ml-1"><%= Spree.t('section_products.hidden_from_nav') %></span>
|
|
33
|
+
<% end %>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div class="d-flex align-items-center space-buttons">
|
|
37
|
+
<%= link_to_with_icon 'edit.svg', Spree.t(:edit), spree.edit_admin_taxonomy_taxon_path(@taxonomy, section.id),
|
|
38
|
+
no_text: true, class: 'btn btn-outline-secondary btn-sm' %>
|
|
39
|
+
<% if can?(:destroy, section) %>
|
|
40
|
+
<%= link_to_with_icon 'delete.svg', Spree.t(:delete), spree.admin_taxonomy_taxon_taxon_section_path(@taxonomy.id, @taxon.id, section.id),
|
|
41
|
+
no_text: true, class: 'btn btn-outline-danger btn-sm', method: :delete, data: { confirm: Spree.t(:are_you_sure) } %>
|
|
42
|
+
<% end %>
|
|
43
|
+
<% if can_edit %>
|
|
44
|
+
<%= link_to_with_icon 'add.svg', Spree.t('section_products.add'), "##{add_modal_id}",
|
|
45
|
+
no_text: true, class: 'btn btn-outline-success btn-sm', data: { toggle: 'modal', target: "##{add_modal_id}" } %>
|
|
46
|
+
<%# Collected and rendered after the list: a modal inside a draggable card gets caught in its stacking and drag handling. %>
|
|
47
|
+
<% content_for :section_modals do %>
|
|
48
|
+
<%= render 'add_modal', section: section, modal_id: add_modal_id, products: classifications.any? || empty, hotels: taxon_vendors.any? || empty %>
|
|
49
|
+
<% end %>
|
|
50
|
+
<% end %>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<% if classifications.any? %>
|
|
55
|
+
<%= render 'products_table', section: section, classifications: classifications, titled: taxon_vendors.any? %>
|
|
56
|
+
<% end %>
|
|
57
|
+
|
|
58
|
+
<% if taxon_vendors.any? %>
|
|
59
|
+
<%= render 'hotels_table', section: section, taxon_vendors: taxon_vendors, titled: classifications.any? %>
|
|
60
|
+
<% end %>
|
|
61
|
+
|
|
62
|
+
<% if empty %>
|
|
63
|
+
<div class="card-body py-3 section-inset text-muted small">
|
|
64
|
+
<%= Spree.t('section_products.empty') %>
|
|
65
|
+
<% if can_edit %>
|
|
66
|
+
<a href="#" data-toggle="modal" data-target="#<%= add_modal_id %>"><%= Spree.t('section_products.add_first') %></a>
|
|
67
|
+
<% end %>
|
|
68
|
+
</div>
|
|
69
|
+
<% end %>
|
|
70
|
+
|
|
71
|
+
<% if children.any? %>
|
|
72
|
+
<div class="card-body pt-3 pb-0 border-top" data-sortable-tree-parent-id-value="<%= section.id %>">
|
|
73
|
+
<% children.each do |child| %>
|
|
74
|
+
<%= render 'section', section: child %>
|
|
75
|
+
<% end %>
|
|
76
|
+
</div>
|
|
77
|
+
<% end %>
|
|
78
|
+
</div>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<% content_for :page_title do %>
|
|
2
|
+
<%= link_to Spree.t(:taxonomies), spree.admin_taxonomies_url %> /
|
|
3
|
+
<%= link_to @taxonomy.root.name, spree.edit_admin_taxonomy_url(@taxonomy) %>
|
|
4
|
+
<% unless @taxon.root? %>
|
|
5
|
+
/ <%= @taxon.name %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
<% content_for :page_actions do %>
|
|
10
|
+
<% if @taxon.event? && can?(:update, @taxon) %>
|
|
11
|
+
<%= button_link_to Spree.t(:recalculate),
|
|
12
|
+
recalculate_conversions_admin_taxonomy_taxon_taxon_sections_path(@taxonomy.id, @taxon.id),
|
|
13
|
+
method: :post,
|
|
14
|
+
class: 'btn-outline-primary',
|
|
15
|
+
title: Spree.t('section_products.recalculate_hint'),
|
|
16
|
+
id: 'admin_recalculate_link' %>
|
|
17
|
+
<% end %>
|
|
18
|
+
<% if can?(:create, Spree::Taxon) %>
|
|
19
|
+
<button type="button" class="btn btn-success" id="admin_new_taxon_children" data-toggle="modal" data-target="#newSectionModal">
|
|
20
|
+
<%= svg_icon(name: 'add.svg', width: '18', height: '18', classes: 'mr-2') %><%= Spree.t(:new_section) %>
|
|
21
|
+
</button>
|
|
22
|
+
<% end %>
|
|
23
|
+
<% end %>
|
|
24
|
+
|
|
25
|
+
<%= render partial: 'spree/admin/shared/taxon_tabs', locals: { current: :sections } %>
|
|
26
|
+
|
|
27
|
+
<% sections = @sections_by_parent_id[@taxon.id] || [] %>
|
|
28
|
+
|
|
29
|
+
<% if sections.any? %>
|
|
30
|
+
<%# sortable-tree PATCHes /api/v2/platform/taxons/:id/reposition on drop, same as the taxonomy tree. %>
|
|
31
|
+
<div id="sortableTreeArea" data-controller="sortable-tree" data-sortable-tree-handle-value=".move-handle">
|
|
32
|
+
<div data-sortable-tree-parent-id-value="<%= @taxon.id %>">
|
|
33
|
+
<% sections.each do |section| %>
|
|
34
|
+
<%= render 'section', section: section %>
|
|
35
|
+
<% end %>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
<% else %>
|
|
39
|
+
<div class="text-center no-objects-found m-5">
|
|
40
|
+
<%= Spree.t('section_products.no_sections') %>
|
|
41
|
+
</div>
|
|
42
|
+
<% end %>
|
|
43
|
+
|
|
44
|
+
<%= render 'new_section_modal' if can?(:create, Spree::Taxon) %>
|
|
45
|
+
<%= yield :section_modals %>
|
|
46
|
+
|
|
47
|
+
<%# Spree's global .sortable script only wires the first table on a page, so each section's product/hotel table gets its own Sortable.
|
|
48
|
+
Posts to ResourceController#update_positions, which sets acts_as_list positions (scoped per taxon) that the storefront lists by. %>
|
|
49
|
+
<script>
|
|
50
|
+
document.addEventListener("spree:load", function () {
|
|
51
|
+
document.querySelectorAll("table[data-section-sortable-link] tbody").forEach(function (tbody) {
|
|
52
|
+
Sortable.create(tbody, {
|
|
53
|
+
handle: ".section-item-move-handle",
|
|
54
|
+
animation: 150,
|
|
55
|
+
ghostClass: "bg-light",
|
|
56
|
+
onEnd: function (evt) {
|
|
57
|
+
if (evt.oldIndex === evt.newIndex) return;
|
|
58
|
+
|
|
59
|
+
var positions = { authenticity_token: AUTH_TOKEN };
|
|
60
|
+
tbody.querySelectorAll("tr[data-sortable-id]").forEach(function (row, index) {
|
|
61
|
+
positions["positions[" + row.dataset.sortableId + "]"] = index + 1;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
$.ajax({ type: "POST", dataType: "text", url: tbody.closest("table").dataset.sectionSortableLink, data: positions })
|
|
65
|
+
.fail(function () { show_flash("error", "This move could not be saved."); });
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<%# Product actions redirect back with #section_<id>, so flag where the admin just was. %>
|
|
73
|
+
<%# Spree backend sets .card { overflow: hidden }, which clips the header action tooltips (rendered inside the card). %>
|
|
74
|
+
<%# Grips (section and rows) share one fixed column so they line up; everything else starts on one content line after it. %>
|
|
75
|
+
<style>
|
|
76
|
+
.section-products-card { overflow: visible; }
|
|
77
|
+
/* Spree pins .select2-dropdown at 1028 (under its fixed nav bar), below Bootstrap's modal (1050); lift it only while a modal is open. */
|
|
78
|
+
body.modal-open .select2-dropdown { z-index: 1060; }
|
|
79
|
+
|
|
80
|
+
/* select2 4.0.13 sizes a multi-select's empty search input to fit its placeholder at init, while the modal is still
|
|
81
|
+
hidden (0px), so the hint never shows. Full width until the first pick (the input is the only item before that). */
|
|
82
|
+
.modal .select2-search--inline:first-child,
|
|
83
|
+
.modal .select2-search--inline:first-child .select2-search__field { width: 100% !important; }
|
|
84
|
+
.section-products-card .section-handle-col { width: 44px; min-width: 44px; padding-left: 0 !important; padding-right: 0 !important; text-align: center; color: #6c757d; }
|
|
85
|
+
.section-products-card .section-item-move-handle,
|
|
86
|
+
.section-products-card .move-handle { cursor: grab; }
|
|
87
|
+
.section-products-card .section-cell-pad { padding-left: .75rem; }
|
|
88
|
+
.section-products-card .section-inset { padding-left: calc(44px + .75rem) !important; }
|
|
89
|
+
/* Spree insets every .card-header/.card-footer by .75rem with !important; here they run edge to edge like the table rows so the grips line up. */
|
|
90
|
+
.section-products-card > .card-header,
|
|
91
|
+
.section-products-card .card-footer { margin-left: 0 !important; margin-right: 0 !important; padding-right: 1rem !important; }
|
|
92
|
+
.section-products-card .section-items-table { table-layout: fixed; min-width: 860px; }
|
|
93
|
+
.section-products-card .section-items-table td,
|
|
94
|
+
.section-products-card .section-items-table th { vertical-align: middle; padding-top: .5rem; padding-bottom: .5rem; }
|
|
95
|
+
/* Product images (small_image) and hotel logos render at different sizes; pin both to one thumbnail. */
|
|
96
|
+
.section-products-card td.section-thumb { box-sizing: content-box; width: 40px !important; min-width: 40px; padding-left: .75rem !important; padding-right: .75rem !important; }
|
|
97
|
+
.section-products-card td.section-thumb > *,
|
|
98
|
+
.section-products-card td.section-thumb a > * { display: block; width: 40px !important; height: 40px !important; }
|
|
99
|
+
.section-products-card td.section-thumb img,
|
|
100
|
+
.section-products-card .section-thumb-placeholder { width: 40px !important; height: 40px !important; min-width: 40px; max-width: none !important; max-height: none !important; object-fit: cover; border: 1px solid #dee2e6; border-radius: .25rem; }
|
|
101
|
+
.section-products-card .section-items-table thead th { border-top: 0; }
|
|
102
|
+
.section-products-card:target { box-shadow: 0 0 0 2px var(--primary, #0d6efd); }
|
|
103
|
+
</style>
|
data/config/locales/en.yml
CHANGED
|
@@ -313,6 +313,65 @@ en:
|
|
|
313
313
|
hint: "Rarely changed settings, mostly for the internal team."
|
|
314
314
|
tickets_and_check_in:
|
|
315
315
|
title: "Tickets & Check-in"
|
|
316
|
+
section_products:
|
|
317
|
+
other_tenant: "Other tenant"
|
|
318
|
+
other_tenant_hint: "belongs to a different tenant than this event's vendor."
|
|
319
|
+
new_section_placeholder: "e.g. Tickets or Where to stay"
|
|
320
|
+
new_section_hint: "Add products or hotels to it next. Description and other details are on its edit page."
|
|
321
|
+
add_section: "Add section"
|
|
322
|
+
removed: "Product removed from the section."
|
|
323
|
+
badge:
|
|
324
|
+
one: "1 product"
|
|
325
|
+
other: "%{count} products"
|
|
326
|
+
empty_badge: "Empty"
|
|
327
|
+
added:
|
|
328
|
+
one: "Added 1 product to %{section}."
|
|
329
|
+
other: "Added %{count} products to %{section}."
|
|
330
|
+
none_added: "No products added. They may already be in this section."
|
|
331
|
+
empty: "This section is empty."
|
|
332
|
+
add_first: "Add products or hotels"
|
|
333
|
+
add_products: "Add products"
|
|
334
|
+
add_products_or_hotels: "Add products or hotels"
|
|
335
|
+
in_section: "Section: %{section}"
|
|
336
|
+
no_sections: "No sections yet. Create one to start adding products or hotels."
|
|
337
|
+
add: "Add"
|
|
338
|
+
search_placeholder: "Search products by name or slug"
|
|
339
|
+
visibility: "Listed"
|
|
340
|
+
visibility_hint: "Hidden products stay in the section but aren't listed in the app or on the web."
|
|
341
|
+
click_to_hide: "Listed in the app and on the web. Click to hide."
|
|
342
|
+
click_to_show: "Not listed in the app or on the web. Click to show."
|
|
343
|
+
remove: "Remove from section"
|
|
344
|
+
sold: "Sold"
|
|
345
|
+
hidden_from_nav: "Hidden from nav"
|
|
346
|
+
drag_hint: "Drag to reorder"
|
|
347
|
+
recalculate_hint: "Recalculate sold count and revenue for every section"
|
|
348
|
+
section_hotels:
|
|
349
|
+
stars: "Stars"
|
|
350
|
+
location: "Location"
|
|
351
|
+
inactive_hint: "Not active, but the app still lists it in this section."
|
|
352
|
+
removed: "Hotel removed from the section."
|
|
353
|
+
title: "Hotels"
|
|
354
|
+
add_hotels: "Add hotels"
|
|
355
|
+
hotel: "Hotel"
|
|
356
|
+
badge:
|
|
357
|
+
one: "1 hotel"
|
|
358
|
+
other: "%{count} hotels"
|
|
359
|
+
added:
|
|
360
|
+
one: "Added 1 hotel to %{section}."
|
|
361
|
+
other: "Added %{count} hotels to %{section}."
|
|
362
|
+
none_added: "No hotels added. They may already be in this section."
|
|
363
|
+
search_placeholder: "Search hotels by name or slug"
|
|
364
|
+
remove: "Remove from section"
|
|
365
|
+
not_accommodation: "Not a hotel"
|
|
366
|
+
not_accommodation_hint: "This vendor isn't an accommodation vendor, so the app may not show it as a hotel."
|
|
367
|
+
taxon_live_stock:
|
|
368
|
+
title: "Live Stock"
|
|
369
|
+
hint: "The app gets live seat and stock updates only between these times. Leave blank to turn it off."
|
|
370
|
+
pass_designs: "Pass Designs"
|
|
371
|
+
taxon_check_in_and_operator:
|
|
372
|
+
title: "Check-in & Operator App"
|
|
373
|
+
hint: "How tickets are scanned and what operators can see."
|
|
374
|
+
group_check_in_hint: "Turn off for large or invitation-only events so every ticket is scanned on its own."
|
|
316
375
|
purchase_limits:
|
|
317
376
|
title: "Purchase Limits"
|
|
318
377
|
hint: "Caps on how many units one buyer can purchase, checked independently per scope. Leave blank to disable. Caps never reset and lowering one does not claw back past purchases."
|
data/config/locales/km.yml
CHANGED
|
@@ -271,6 +271,65 @@ km:
|
|
|
271
271
|
hint: "ការកំណត់ដែលកម្រផ្លាស់ប្តូរ ភាគច្រើនសម្រាប់ក្រុមផ្ទៃក្នុង។"
|
|
272
272
|
tickets_and_check_in:
|
|
273
273
|
title: "សំបុត្រ និងការចុះឈ្មោះចូល"
|
|
274
|
+
section_products:
|
|
275
|
+
other_tenant: "អ្នកជួលផ្សេង"
|
|
276
|
+
other_tenant_hint: "ជារបស់អ្នកជួលផ្សេងពីអ្នកលក់នៃព្រឹត្តិការណ៍នេះ។"
|
|
277
|
+
new_section_placeholder: "ឧ. សំបុត្រ ឬ កន្លែងស្នាក់នៅ"
|
|
278
|
+
new_section_hint: "បន្ទាប់មកបន្ថែមផលិតផល ឬសណ្ឋាគារ។ ការពិពណ៌នា និងព័ត៌មានផ្សេងទៀតនៅលើទំព័រកែសម្រួល។"
|
|
279
|
+
add_section: "បន្ថែមផ្នែក"
|
|
280
|
+
removed: "បានដកផលិតផលចេញពីផ្នែក។"
|
|
281
|
+
badge:
|
|
282
|
+
one: "ផលិតផល 1"
|
|
283
|
+
other: "ផលិតផល %{count}"
|
|
284
|
+
empty_badge: "ទទេ"
|
|
285
|
+
added:
|
|
286
|
+
one: "បានបន្ថែមផលិតផល 1 ទៅ %{section}។"
|
|
287
|
+
other: "បានបន្ថែមផលិតផល %{count} ទៅ %{section}។"
|
|
288
|
+
none_added: "មិនបានបន្ថែមផលិតផលទេ។ ប្រហែលជាមាននៅក្នុងផ្នែកនេះរួចហើយ។"
|
|
289
|
+
empty: "ផ្នែកនេះទទេ។"
|
|
290
|
+
add_first: "បន្ថែមផលិតផល ឬសណ្ឋាគារ"
|
|
291
|
+
add_products: "បន្ថែមផលិតផល"
|
|
292
|
+
add_products_or_hotels: "បន្ថែមផលិតផល ឬសណ្ឋាគារ"
|
|
293
|
+
in_section: "ផ្នែក៖ %{section}"
|
|
294
|
+
no_sections: "មិនទាន់មានផ្នែកទេ។ បង្កើតមួយដើម្បីចាប់ផ្តើមបន្ថែមផលិតផល ឬសណ្ឋាគារ។"
|
|
295
|
+
add: "បន្ថែម"
|
|
296
|
+
search_placeholder: "ស្វែងរកផលិតផលតាមឈ្មោះ ឬ slug"
|
|
297
|
+
visibility: "បង្ហាញ"
|
|
298
|
+
visibility_hint: "ផលិតផលដែលលាក់នៅតែស្ថិតក្នុងផ្នែក ប៉ុន្តែមិនបង្ហាញក្នុងកម្មវិធី ឬលើគេហទំព័រទេ។"
|
|
299
|
+
click_to_hide: "កំពុងបង្ហាញក្នុងកម្មវិធី។ ចុចដើម្បីលាក់។"
|
|
300
|
+
click_to_show: "កំពុងលាក់ពីកម្មវិធី។ ចុចដើម្បីបង្ហាញ។"
|
|
301
|
+
remove: "ដកចេញពីផ្នែក"
|
|
302
|
+
sold: "បានលក់"
|
|
303
|
+
hidden_from_nav: "លាក់ពីម៉ឺនុយ"
|
|
304
|
+
drag_hint: "អូសដើម្បីរៀបលំដាប់"
|
|
305
|
+
recalculate_hint: "គណនាចំនួនលក់ និងចំណូលឡើងវិញសម្រាប់គ្រប់ផ្នែក"
|
|
306
|
+
section_hotels:
|
|
307
|
+
stars: "ផ្កាយ"
|
|
308
|
+
location: "ទីតាំង"
|
|
309
|
+
inactive_hint: "មិនសកម្ម ប៉ុន្តែកម្មវិធីនៅតែបង្ហាញវាក្នុងផ្នែកនេះ។"
|
|
310
|
+
removed: "បានដកសណ្ឋាគារចេញពីផ្នែក។"
|
|
311
|
+
title: "សណ្ឋាគារ"
|
|
312
|
+
add_hotels: "បន្ថែមសណ្ឋាគារ"
|
|
313
|
+
hotel: "សណ្ឋាគារ"
|
|
314
|
+
badge:
|
|
315
|
+
one: "សណ្ឋាគារ 1"
|
|
316
|
+
other: "សណ្ឋាគារ %{count}"
|
|
317
|
+
added:
|
|
318
|
+
one: "បានបន្ថែមសណ្ឋាគារ 1 ទៅ %{section}។"
|
|
319
|
+
other: "បានបន្ថែមសណ្ឋាគារ %{count} ទៅ %{section}។"
|
|
320
|
+
none_added: "មិនបានបន្ថែមសណ្ឋាគារទេ។ ប្រហែលជាមាននៅក្នុងផ្នែកនេះរួចហើយ។"
|
|
321
|
+
search_placeholder: "ស្វែងរកសណ្ឋាគារតាមឈ្មោះ ឬ slug"
|
|
322
|
+
remove: "ដកចេញពីផ្នែក"
|
|
323
|
+
not_accommodation: "មិនមែនសណ្ឋាគារ"
|
|
324
|
+
not_accommodation_hint: "អ្នកលក់នេះមិនមែនជាប្រភេទស្នាក់នៅទេ ដូច្នេះកម្មវិធីប្រហែលមិនបង្ហាញវាជាសណ្ឋាគារ។"
|
|
325
|
+
taxon_live_stock:
|
|
326
|
+
title: "ស្តុកផ្ទាល់"
|
|
327
|
+
hint: "កម្មវិធីទទួលបានការធ្វើបច្ចុប្បន្នភាពកៅអី និងស្តុកផ្ទាល់ តែក្នុងចន្លោះពេលនេះប៉ុណ្ណោះ។ ទុកទទេដើម្បីបិទ។"
|
|
328
|
+
pass_designs: "ការរចនាប័ណ្ណ"
|
|
329
|
+
taxon_check_in_and_operator:
|
|
330
|
+
title: "ការចុះឈ្មោះចូល និងកម្មវិធីប្រតិបត្តិករ"
|
|
331
|
+
hint: "របៀបស្កេនសំបុត្រ និងអ្វីដែលប្រតិបត្តិករអាចមើលឃើញ។"
|
|
332
|
+
group_check_in_hint: "បិទសម្រាប់ព្រឹត្តិការណ៍ធំ ឬតាមការអញ្ជើញ ដើម្បីឱ្យសំបុត្រនីមួយៗត្រូវបានស្កេនដាច់ដោយឡែក។"
|
|
274
333
|
purchase_limits:
|
|
275
334
|
title: "ដែនកំណត់ការទិញ"
|
|
276
335
|
hint: "ដែនកំណត់ចំនួនដែលអ្នកទិញម្នាក់អាចទិញបាន ដោយពិនិត្យដោយឡែកតាមប្រភេទនីមួយៗ។ ទុកទទេដើម្បីបិទ។ ដែនកំណត់មិនកំណត់ឡើងវិញទេ ហើយការបន្ថយវាមិនប៉ះពាល់ការទិញកន្លងមកឡើយ។"
|
data/config/routes.rb
CHANGED
|
@@ -348,16 +348,25 @@ Spree::Core::Engine.add_routes do
|
|
|
348
348
|
|
|
349
349
|
resources :taxonomies do
|
|
350
350
|
resources :taxons do
|
|
351
|
-
|
|
352
|
-
resources :
|
|
353
|
-
|
|
351
|
+
# A top-level taxon's sections and what each holds (products, hotels).
|
|
352
|
+
resources :taxon_sections, only: %i[index create destroy] do
|
|
353
|
+
collection do
|
|
354
|
+
post :recalculate_conversions
|
|
355
|
+
end
|
|
356
|
+
|
|
354
357
|
member do
|
|
355
|
-
|
|
358
|
+
post :add_products
|
|
359
|
+
post :reorder_products
|
|
360
|
+
patch 'products/:classification_id/visibility', action: :update_product_visibility, as: :update_product_visibility
|
|
361
|
+
delete 'products/:classification_id', action: :remove_product, as: :remove_product
|
|
362
|
+
post :add_hotels
|
|
363
|
+
post :reorder_hotels
|
|
364
|
+
delete 'hotels/:taxon_vendor_id', action: :remove_hotel, as: :remove_hotel
|
|
356
365
|
end
|
|
357
366
|
end
|
|
358
|
-
resources :
|
|
359
|
-
|
|
360
|
-
|
|
367
|
+
resources :guest_card_classes do
|
|
368
|
+
member do
|
|
369
|
+
delete :remove_background_image
|
|
361
370
|
end
|
|
362
371
|
end
|
|
363
372
|
|