spree_cm_commissioner 2.5.5 → 2.5.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de2ded7a346184d8d61336778882795e5b3129f7057eb9b6626042245f580d0c
4
- data.tar.gz: e6719bc0d87300189d1c02eca3fc3400985379fdce0c7800c813cbe5d24861ba
3
+ metadata.gz: d077884a4c72aea34ebabce75fcc9ad8c032d20eb6ee2cad7c753bb544d28b1c
4
+ data.tar.gz: d89d2c942374c0342b6fc5447220eee3d72773c0578afc0b45a08b390b51a624
5
5
  SHA512:
6
- metadata.gz: 44c71677f45daa6d92ec91afa436a7bc88798b6931d9a7a75afc40ad5e7691dd7a7ef8c6b7404bcbe3f1875a2a9d321ad918423dda064716bb208f0b0495aa11
7
- data.tar.gz: d6bdae499df0757db662bade286df901abf2b3f59d7daecef9140ad8cdf2775a17b35c72159b46f5d813c7ec555b3dc97297b6684f4ddee411e96f74d71961ce
6
+ metadata.gz: 41dbb774e8f9d97dee38db2e23ed4741f2888b73a41660c77c968bedb7c26d9de747587cc8779a3ac93e16ef88a11e0f1ce276bc562252776218218423d47538
7
+ data.tar.gz: e95ac81f757dcdabafd539957ad2945dda624348a72e06f2490e24fabfdc8bc5b53fdee24a62b66dd807349996152a2dad334ecea387cfe37c73c58707b58237
data/Gemfile.lock CHANGED
@@ -34,7 +34,7 @@ GIT
34
34
  PATH
35
35
  remote: .
36
36
  specs:
37
- spree_cm_commissioner (2.5.5)
37
+ spree_cm_commissioner (2.5.6)
38
38
  activerecord-multi-tenant
39
39
  activerecord_json_validator (~> 2.1, >= 2.1.3)
40
40
  aws-sdk-cloudfront
@@ -3,22 +3,22 @@ module Spree
3
3
  class InventoryItemsController < StockManagementsController
4
4
  before_action :load_parent
5
5
 
6
- # GET /products/:slug/inventory_items/prices?inventory_ids=1,2,3
6
+ # GET /products/:slug/inventory_items/prices?inventory_item_ids=1,2,3
7
7
  def prices
8
- inventory_ids = params[:inventory_ids].to_s.split(',').map(&:to_i)
9
- @inventory_items = @product.inventory_items.where(id: inventory_ids)
8
+ inventory_item_ids = params[:inventory_item_ids]
9
+ @inventory_items = @product.inventory_items.where(id: inventory_item_ids)
10
10
  end
11
11
 
12
- # GET /products/:slug/inventory_items/stocks?inventory_ids=1,2,3
12
+ # GET /products/:slug/inventory_items/stocks?inventory_item_ids=1,2,3
13
13
  def stocks
14
- inventory_ids = params[:inventory_ids].to_s.split(',').map(&:to_i)
15
- @inventory_items = @product.inventory_items.where(id: inventory_ids)
14
+ inventory_item_ids = params[:inventory_item_ids]
15
+ @inventory_items = @product.inventory_items.where(id: inventory_item_ids)
16
16
  end
17
17
 
18
18
  # PATCH /products/:slug/inventory_items/bulk_update_prices
19
19
  def bulk_update_prices # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
20
- inventory_ids = params[:inventory_ids].to_s.split(',').map(&:to_i)
21
- inventory_items = @product.inventory_items.where(id: inventory_ids)
20
+ inventory_item_ids = params[:inventory_item_ids]
21
+ inventory_items = @product.inventory_items.where(id: inventory_item_ids)
22
22
 
23
23
  inventory_items.each do |inventory_item|
24
24
  params[:prices]&.values&.each do |price_params|
@@ -38,8 +38,8 @@ module Spree
38
38
 
39
39
  # PATCH /products/:slug/inventory_items/bulk_update_stocks
40
40
  def bulk_update_stocks
41
- inventory_ids = params[:inventory_ids].to_s.split(',').map(&:to_i)
42
- inventory_items = @product.inventory_items.where(id: inventory_ids)
41
+ inventory_item_ids = params[:inventory_item_ids]
42
+ inventory_items = @product.inventory_items.where(id: inventory_item_ids)
43
43
  target_quantity = params[:quantity].to_i
44
44
 
45
45
  if target_quantity.zero?
@@ -59,10 +59,10 @@ module Spree
59
59
  redirect_back fallback_location: admin_product_stock_managements_path(@product)
60
60
  end
61
61
 
62
- # PATCH /products/:slug/inventory_items/bulk_reset?inventory_ids=1,2,3
62
+ # PATCH /products/:slug/inventory_items/bulk_reset?inventory_item_ids=1,2,3
63
63
  def bulk_reset
64
- inventory_ids = params[:inventory_ids].to_s.split(',').map(&:to_i)
65
- inventory_items = @product.inventory_items.where(id: inventory_ids)
64
+ inventory_item_ids = params[:inventory_item_ids]
65
+ inventory_items = @product.inventory_items.where(id: inventory_item_ids)
66
66
 
67
67
  errors = []
68
68
  inventory_items.each do |inventory_item|
@@ -11,9 +11,7 @@
11
11
  <p class="mb-0 text-white position-relative"><%= @inventory_items.count %> items selected</p>
12
12
  </div>
13
13
 
14
- <%= form_with url: bulk_update_prices_admin_product_inventory_items_path(@product), method: :patch, local: true, html: { class: 'bulk-inventory-items-form' } do |form| %>
15
- <%= form.hidden_field :inventory_ids, value: params[:inventory_ids] %>
16
-
14
+ <%= form_with url: bulk_update_prices_admin_product_inventory_items_path(@product, inventory_item_ids: params[:inventory_item_ids]), method: :patch, local: true, html: { class: 'bulk-inventory-items-form' } do |form| %>
17
15
  <table class="table">
18
16
  <tbody>
19
17
  <% supported_currencies_for_all_stores.each do |currency| %>
@@ -11,9 +11,7 @@
11
11
  <p class="mb-0 text-white position-relative"><%= @inventory_items.count %> items selected</p>
12
12
  </div>
13
13
 
14
- <%= form_with url: bulk_update_stocks_admin_product_inventory_items_path(@product), method: :patch, local: true, html: { class: 'bulk-inventory-items-form' } do |form| %>
15
- <%= form.hidden_field :inventory_ids, value: params[:inventory_ids] %>
16
-
14
+ <%= form_with url: bulk_update_stocks_admin_product_inventory_items_path(@product, inventory_item_ids: params[:inventory_item_ids]), method: :patch, local: true, html: { class: 'bulk-inventory-items-form' } do |form| %>
17
15
  <div class="form-group">
18
16
  <%= form.label :quantity, "Available Quantity", class: 'form-label' %>
19
17
  <%= form.number_field :quantity,
@@ -2,22 +2,22 @@
2
2
  <div class="flex-wrap gap-3 mt-4 d-flex align-items-center justify-content-between">
3
3
  <%= form_with url: admin_product_stock_managements_path, method: :get, class: "d-flex flex-wrap align-items-center gap-2" do |f| %>
4
4
  <%= select_year(params[:year]&.to_i || @year, { start_year: 2025, end_year: @year + 3 }, { class: 'form-control', style: "width: auto;", name: "year", onchange: "this.form.submit()" }) %>
5
- <%= f.select :selected_variant_id,
5
+ <%= f.select :selected_variant_id,
6
6
  options_for_select([["All Variants", ""]] + @variants.map { |v| [v.options_text.presence || "N/A", v.id] }, params[:selected_variant_id]), {},
7
7
  { class: "form-control", style: "width: auto;", onchange: "this.form.submit()" } %>
8
8
  <% end %>
9
9
 
10
10
  <div id="bulkActionsBar" class="flex-wrap gap-2 align-items-center" style="display:none;">
11
- <button class="btn btn-primary"
11
+ <button class="btn btn-primary"
12
12
  onclick="setModalUrl('prices')"
13
- data-toggle="modal"
13
+ data-toggle="modal"
14
14
  data-target="#inventoryItemModal">
15
15
  <%= svg_icon name: "money.svg", width: '18', height: '18' %>
16
16
  <span class="ml-1">Bulk Update Prices</span>
17
17
  </button>
18
- <button class="btn btn-success"
18
+ <button class="btn btn-success"
19
19
  onclick="setModalUrl('stocks')"
20
- data-toggle="modal"
20
+ data-toggle="modal"
21
21
  data-target="#inventoryItemModal">
22
22
  <%= svg_icon name: "box-seam.svg", width: '18', height: '18' %>
23
23
  <span class="ml-1">Bulk Update Stocks</span>
@@ -32,11 +32,11 @@
32
32
  .gap-2 {
33
33
  gap: 0.5rem;
34
34
  }
35
-
35
+
36
36
  .gap-3 {
37
37
  gap: 1rem;
38
38
  }
39
-
39
+
40
40
  .day-selected {
41
41
  background-color: #e3f2fd !important;
42
42
  border: 2px solid #2196F3 !important;
@@ -137,10 +137,15 @@
137
137
  }
138
138
 
139
139
  function setModalUrl(type) {
140
- const ids = Array.from(selectedInventoryIds).join(',');
141
- const url = type === 'prices'
142
- ? '<%= prices_admin_product_inventory_items_path(@product) %>?inventory_ids=' + ids
143
- : '<%= stocks_admin_product_inventory_items_path(@product) %>?inventory_ids=' + ids;
140
+ const params = new URLSearchParams();
141
+ Array.from(selectedInventoryIds).forEach(id =>
142
+ params.append('inventory_item_ids[]', id)
143
+ );
144
+
145
+ const url = type === 'prices'
146
+ ? `<%= prices_admin_product_inventory_items_path(@product) %>?${params.toString()}`
147
+ : `<%= stocks_admin_product_inventory_items_path(@product) %>?${params.toString()}`;
148
+
144
149
  let frame = document.getElementById('inventory_item');
145
150
  frame.innerHTML = `<div class="mt-2 spinner-border" role="status"></div>`;
146
151
  frame.setAttribute('src', url);
@@ -65,7 +65,7 @@
65
65
  <% end %>
66
66
  </span>
67
67
 
68
- <%= link_to_with_icon('arrow-counterclockwise.svg', "Reset Inventory Item", bulk_reset_admin_product_inventory_items_path(@product.slug, inventory_item_ids: [inventory_item.id]),
68
+ <%= link_to_with_icon('arrow-counterclockwise.svg', "Reset Inventory Item", bulk_reset_admin_product_inventory_items_path(@product, inventory_item_ids: [inventory_item.id]),
69
69
  method: :patch,
70
70
  remote: false,
71
71
  class: 'icon_link btn btn-sm outline text-dark',
@@ -1,5 +1,5 @@
1
1
  module SpreeCmCommissioner
2
- VERSION = '2.5.5'.freeze
2
+ VERSION = '2.5.6'.freeze
3
3
 
4
4
  module_function
5
5
 
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.5.5
4
+ version: 2.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - You