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 +4 -4
- data/Gemfile.lock +1 -1
- data/app/controllers/spree/admin/inventory_items_controller.rb +13 -13
- data/app/views/spree/admin/inventory_items/prices.html.erb +1 -3
- data/app/views/spree/admin/inventory_items/stocks.html.erb +1 -3
- data/app/views/spree/admin/stock_managements/calendar.html.erb +16 -11
- data/app/views/spree/admin/stock_managements/index.html.erb +1 -1
- data/lib/spree_cm_commissioner/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d077884a4c72aea34ebabce75fcc9ad8c032d20eb6ee2cad7c753bb544d28b1c
|
|
4
|
+
data.tar.gz: d89d2c942374c0342b6fc5447220eee3d72773c0578afc0b45a08b390b51a624
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 41dbb774e8f9d97dee38db2e23ed4741f2888b73a41660c77c968bedb7c26d9de747587cc8779a3ac93e16ef88a11e0f1ce276bc562252776218218423d47538
|
|
7
|
+
data.tar.gz: e95ac81f757dcdabafd539957ad2945dda624348a72e06f2490e24fabfdc8bc5b53fdee24a62b66dd807349996152a2dad334ecea387cfe37c73c58707b58237
|
data/Gemfile.lock
CHANGED
|
@@ -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?
|
|
6
|
+
# GET /products/:slug/inventory_items/prices?inventory_item_ids=1,2,3
|
|
7
7
|
def prices
|
|
8
|
-
|
|
9
|
-
@inventory_items = @product.inventory_items.where(id:
|
|
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?
|
|
12
|
+
# GET /products/:slug/inventory_items/stocks?inventory_item_ids=1,2,3
|
|
13
13
|
def stocks
|
|
14
|
-
|
|
15
|
-
@inventory_items = @product.inventory_items.where(id:
|
|
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
|
-
|
|
21
|
-
inventory_items = @product.inventory_items.where(id:
|
|
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
|
-
|
|
42
|
-
inventory_items = @product.inventory_items.where(id:
|
|
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?
|
|
62
|
+
# PATCH /products/:slug/inventory_items/bulk_reset?inventory_item_ids=1,2,3
|
|
63
63
|
def bulk_reset
|
|
64
|
-
|
|
65
|
-
inventory_items = @product.inventory_items.where(id:
|
|
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
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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
|
|
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',
|