mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Added a filter option to only show currently out-of-stock products on /products (closes #2192)
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
- Product barcodes are now enforced to be unique across products
|
||||
- On the stock overview page it's now also possible to search/filter by product barcodes (via the general search field)
|
||||
- The product picker on the consume and transfer page now only shows products which are currently in stock
|
||||
- Added a filter option to only show in-stock products on the stock overview and products list (master data) page
|
||||
- Added a filter option to only show currently in-stock products on the stock overview and products list (master data) page
|
||||
- Added new columns on the stock overview page (hidden by default): Product description, product default location, parent product, product picture
|
||||
- Added a new product option "Should not be frozen" (defaults to disabled and only visible when `FEATURE_FLAG_STOCK_PRODUCT_FREEZING` is enabled)
|
||||
- When enabled, on moving the product to a freezer location (so when freezing it), a corresponding warning will be shown
|
||||
|
@@ -30,6 +30,7 @@
|
||||
- This option will be automatically set on changing the entry's due date
|
||||
- The product option "Quick consume amount" (the amount used for the "quick consume/open buttons" on the stock overview page) has been split into another option "Quick open amount", to be able to set different amounts for consume and open (defaults to the "Quick consume amount" per product, so no changed behavior when not configured)
|
||||
- Changed that for the product's average and last price (and for the price history chart) stock transactions with an empty or `0` price are ignored
|
||||
- Added a filter option to only show currently out-of-stock products on the products list (master data) page
|
||||
- Fixed that hiding the "Purchased date" column (table options) on the stock entries page didn't work
|
||||
- Fixed that sorting by the "Value" and "Min. stock amount" columns on the stock overview page didn't work
|
||||
- Fixed that the consumed amount was wrong, when consuming multiple substituted subproducts at once and when multiple/different conversion factors were involved
|
||||
|
@@ -243,6 +243,10 @@ class StockController extends BaseController
|
||||
{
|
||||
$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)');
|
||||
}
|
||||
|
||||
$products = $products->orderBy('name', 'COLLATE NOCASE');
|
||||
|
||||
|
@@ -2412,3 +2412,6 @@ msgstr ""
|
||||
|
||||
msgid "Stock report"
|
||||
msgstr ""
|
||||
|
||||
msgid "Out-of-stock products"
|
||||
msgstr ""
|
||||
|
@@ -40,14 +40,20 @@ $("#clear-filter-button").on("click", function()
|
||||
$("#product-group-filter").val("all");
|
||||
productsTable.column(productsTable.colReorder.transpose(6)).search("").draw();
|
||||
productsTable.search("").draw();
|
||||
if ($("#show-disabled").is(":checked") || $("#show-only-in-stock").is(":checked"))
|
||||
|
||||
if ($("#show-disabled").is(":checked"))
|
||||
{
|
||||
$("#show-disabled").prop("checked", false);
|
||||
$("#show-only-in-stock").prop("checked", false);
|
||||
RemoveUriParam("include_disabled");
|
||||
RemoveUriParam("only_in_stock");
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
if ($("#status-filter").val() != "all")
|
||||
{
|
||||
$("#status-filter").val("all");
|
||||
$("#status-filter").trigger("change");
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof GetUriParam("product-group") !== "undefined")
|
||||
@@ -109,15 +115,25 @@ $("#show-disabled").change(function()
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
$("#show-only-in-stock").change(function()
|
||||
$("#status-filter").change(function()
|
||||
{
|
||||
if (this.checked)
|
||||
var value = $(this).val();
|
||||
|
||||
if (value == "all")
|
||||
{
|
||||
UpdateUriParam("only_in_stock", "true");
|
||||
RemoveUriParam("only_in_stock");
|
||||
RemoveUriParam("only_out_of_stock");
|
||||
}
|
||||
else
|
||||
else if (value == "out-of-stock")
|
||||
{
|
||||
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");
|
||||
}
|
||||
|
||||
window.location.reload();
|
||||
|
@@ -71,6 +71,19 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-6 col-xl-3">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa-solid fa-filter"></i> {{ $__t('Status') }}</span>
|
||||
</div>
|
||||
<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>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-6 col-xl-2">
|
||||
<div class="form-check custom-control custom-checkbox">
|
||||
<input class="form-check-input custom-control-input"
|
||||
@@ -82,17 +95,6 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-6 col-xl-2">
|
||||
<div class="form-check custom-control custom-checkbox">
|
||||
<input class="form-check-input custom-control-input"
|
||||
type="checkbox"
|
||||
id="show-only-in-stock">
|
||||
<label class="form-check-label custom-control-label"
|
||||
for="show-only-in-stock">
|
||||
{{ $__t('Show only in-stock products') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="float-right">
|
||||
<button id="clear-filter-button"
|
||||
|
Reference in New Issue
Block a user