mirror of
https://github.com/grocy/grocy.git
synced 2026-05-27 06:35:05 +02:00
Fixed status filter (master data/products) after page reload (Chrome/Edge only problem) (fixes #2782)
This commit is contained in:
parent
8b705b53a9
commit
274c842e7b
|
|
@ -10,10 +10,11 @@
|
|||
|
||||
### Stock
|
||||
|
||||
- The product picker now searches product names accent insensitive
|
||||
- Fixed that changing the location on the purchase page re-initialized the due date based on product defaults (if any)
|
||||
- Fixed that when undoing a product consume or transfer transaction, the store of the corresponding stock entry wasn't restored
|
||||
- This will only apply to new consume / transfer transactions, not when undoing transactions made before using this release
|
||||
- The product picker now searches product names accent insensitive
|
||||
- Fixed that the status filter on the master data products page always displayed "All" after selection (only affected Chrome/Edge)
|
||||
|
||||
### Shopping list
|
||||
|
||||
|
|
|
|||
|
|
@ -289,13 +289,16 @@ class StockController extends BaseController
|
|||
$products = $products->where('active = 1');
|
||||
}
|
||||
|
||||
if (isset($request->getQueryParams()['only_in_stock']))
|
||||
if (isset($request->getQueryParams()['filter']))
|
||||
{
|
||||
$products = $products->where('id IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)');
|
||||
}
|
||||
if (isset($request->getQueryParams()['only_out_of_stock']))
|
||||
{
|
||||
$products = $products->where('id NOT IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)');
|
||||
if ($request->getQueryParams()['filter'] == 'only_in_stock')
|
||||
{
|
||||
$products = $products->where('id IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)');
|
||||
}
|
||||
elseif ($request->getQueryParams()['filter'] == 'only_out_of_stock')
|
||||
{
|
||||
$products = $products->where('id NOT IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)');
|
||||
}
|
||||
}
|
||||
|
||||
$products = $products->orderBy('name', 'COLLATE NOCASE');
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
$('#products-table tbody').removeClass("d-none");
|
||||
productsTable.columns.adjust().draw();
|
||||
|
||||
$("#search").on("keyup", Delay(function()
|
||||
$("#search").on("keyup", Delay(function ()
|
||||
{
|
||||
var value = $(this).val();
|
||||
if (value === "all")
|
||||
|
|
@ -23,7 +23,7 @@ $("#search").on("keyup", Delay(function()
|
|||
productsTable.search(value).draw();
|
||||
}, Grocy.FormFocusDelay));
|
||||
|
||||
$("#product-group-filter").on("change", function()
|
||||
$("#product-group-filter").on("change", function ()
|
||||
{
|
||||
var value = $("#product-group-filter option:selected").text();
|
||||
if (value === __t("All"))
|
||||
|
|
@ -37,7 +37,7 @@ $("#product-group-filter").on("change", function()
|
|||
|
||||
});
|
||||
|
||||
$("#clear-filter-button").on("click", function()
|
||||
$("#clear-filter-button").on("click", function ()
|
||||
{
|
||||
$("#search").val("");
|
||||
$("#product-group-filter").val("all");
|
||||
|
|
@ -65,7 +65,7 @@ if (typeof GetUriParam("product-group") !== "undefined")
|
|||
$("#product-group-filter").trigger("change");
|
||||
}
|
||||
|
||||
$(document).on('click', '.product-delete-button', function(e)
|
||||
$(document).on('click', '.product-delete-button', function (e)
|
||||
{
|
||||
var objectName = $(e.currentTarget).attr('data-product-name');
|
||||
var objectId = $(e.currentTarget).attr('data-product-id');
|
||||
|
|
@ -83,18 +83,18 @@ $(document).on('click', '.product-delete-button', function(e)
|
|||
className: 'btn-danger'
|
||||
}
|
||||
},
|
||||
callback: function(result)
|
||||
callback: function (result)
|
||||
{
|
||||
if (result === true)
|
||||
{
|
||||
jsonData = {};
|
||||
jsonData.active = 0;
|
||||
Grocy.Api.Delete('objects/products/' + objectId, {},
|
||||
function(result)
|
||||
function (result)
|
||||
{
|
||||
window.location.href = U('/products');
|
||||
},
|
||||
function(xhr)
|
||||
function (xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ $(document).on('click', '.product-delete-button', function(e)
|
|||
});
|
||||
});
|
||||
|
||||
$("#show-disabled").change(function()
|
||||
$("#show-disabled").change(function ()
|
||||
{
|
||||
if (this.checked)
|
||||
{
|
||||
|
|
@ -118,25 +118,17 @@ $("#show-disabled").change(function()
|
|||
window.location.reload();
|
||||
});
|
||||
|
||||
$("#status-filter").change(function()
|
||||
$("#status-filter").change(function ()
|
||||
{
|
||||
var value = $(this).val();
|
||||
|
||||
if (value == "all")
|
||||
if (value != "all")
|
||||
{
|
||||
UpdateUriParam("only_in_stock", "true");
|
||||
RemoveUriParam("only_in_stock");
|
||||
RemoveUriParam("only_out_of_stock");
|
||||
UpdateUriParam("filter", value);
|
||||
}
|
||||
else if (value == "out-of-stock")
|
||||
else
|
||||
{
|
||||
RemoveUriParam("only_in_stock");
|
||||
UpdateUriParam("only_out_of_stock", "true");
|
||||
}
|
||||
else if (value == "in-stock")
|
||||
{
|
||||
RemoveUriParam("only_out_of_stock");
|
||||
UpdateUriParam("only_in_stock", "true");
|
||||
RemoveUriParam("filter");
|
||||
}
|
||||
|
||||
window.location.reload();
|
||||
|
|
@ -147,8 +139,12 @@ if (GetUriParam('include_disabled'))
|
|||
$("#show-disabled").prop('checked', true);
|
||||
}
|
||||
|
||||
if (GetUriParam("filter"))
|
||||
{
|
||||
$("#status-filter").val(GetUriParam("filter"));
|
||||
}
|
||||
|
||||
$(".merge-products-button").on("click", function(e)
|
||||
$(".merge-products-button").on("click", function (e)
|
||||
{
|
||||
var productId = $(e.currentTarget).attr("data-product-id");
|
||||
$("#merge-products-keep").val(productId);
|
||||
|
|
@ -156,7 +152,7 @@ $(".merge-products-button").on("click", function(e)
|
|||
$("#merge-products-modal").modal("show");
|
||||
});
|
||||
|
||||
$("#merge-products-save-button").on("click", function(e)
|
||||
$("#merge-products-save-button").on("click", function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
|
|
@ -169,11 +165,11 @@ $("#merge-products-save-button").on("click", function(e)
|
|||
var productIdToRemove = $("#merge-products-remove").val();
|
||||
|
||||
Grocy.Api.Post("stock/products/" + productIdToKeep.toString() + "/merge/" + productIdToRemove.toString(), {},
|
||||
function(result)
|
||||
function (result)
|
||||
{
|
||||
window.location.href = U('/products');
|
||||
},
|
||||
function(xhr)
|
||||
function (xhr)
|
||||
{
|
||||
Grocy.FrontendHelpers.ShowGenericError('Error while merging', xhr.response);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@
|
|||
<select class="custom-control custom-select"
|
||||
id="status-filter">
|
||||
<option value="all">{{ $__t('All') }}</option>
|
||||
<option value="in-stock">{{ $__t('In stock products') }}</option>
|
||||
<option value="out-of-stock">{{ $__t('Out of stock products') }}</option>
|
||||
<option value="only_in_stock">{{ $__t('In stock products') }}</option>
|
||||
<option value="only_out_of_stock">{{ $__t('Out of stock products') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user