mirror of
https://github.com/grocy/grocy.git
synced 2025-08-17 03:04:36 +00:00
Fixed stock entry page consume amount handling (fixes #2397)
This commit is contained in:
@@ -17,6 +17,8 @@
|
|||||||
- Fixed that the location dropdown on the consume page contained the same location multiple times if there are currently stock entries at multiple locations of the corresponding product
|
- Fixed that the location dropdown on the consume page contained the same location multiple times if there are currently stock entries at multiple locations of the corresponding product
|
||||||
- Fixed that the status filter "n products are overdue" on the stock overview page also counted/included stock entries due today or tomorrow
|
- Fixed that the status filter "n products are overdue" on the stock overview page also counted/included stock entries due today or tomorrow
|
||||||
- Fixed that the stock report "Spendings" did not take products without an assigned product group into account (thanks @Torqu3Wr3nch for the initial work on this)
|
- Fixed that the stock report "Spendings" did not take products without an assigned product group into account (thanks @Torqu3Wr3nch for the initial work on this)
|
||||||
|
- Fixed that the success message after opening a stock entry on the stock entries page displayed always an amount of `1` instead of the actual amount opened
|
||||||
|
- Fixed that the "Consume this stock entry as spoiled" context menu action on the stock entries page consumed alway `1` instead of the whole stock entry
|
||||||
|
|
||||||
### Shopping list
|
### Shopping list
|
||||||
|
|
||||||
|
@@ -79,11 +79,12 @@ $(document).on('click', '.stock-consume-button', function(e)
|
|||||||
Grocy.Api.Get('stock/products/' + productId,
|
Grocy.Api.Get('stock/products/' + productId,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
var toastMessage = __t('Removed %1$s of %2$s from stock', consumeAmount.toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }) + " " + __n(consumeAmount, result.quantity_unit_stock.name, result.quantity_unit_stock.name_plural, true), result.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBookingEntry(' + bookingResponse[0].id + ',' + stockRowId + ')"><i class="fa-solid fa-undo"></i> ' + __t("Undo") + '</a>';
|
var toastMessage = __t('Removed %1$s of %2$s from stock', consumeAmount.toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }) + " " + __n(consumeAmount, result.quantity_unit_stock.name, result.quantity_unit_stock.name_plural, true), result.product.name);
|
||||||
if (wasSpoiled)
|
if (wasSpoiled)
|
||||||
{
|
{
|
||||||
toastMessage += " (" + __t("Spoiled") + ")";
|
toastMessage += "<br>(" + __t("Spoiled") + ")";
|
||||||
}
|
}
|
||||||
|
toastMessage += '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBookingEntry(' + bookingResponse[0].id + ',' + stockRowId + ')"><i class="fa-solid fa-undo"></i> ' + __t("Undo") + '</a>';
|
||||||
|
|
||||||
Grocy.FrontendHelpers.EndUiBusy();
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
RefreshStockEntryRow(stockRowId);
|
RefreshStockEntryRow(stockRowId);
|
||||||
@@ -113,8 +114,6 @@ $(document).on('click', '.product-open-button', function(e)
|
|||||||
Grocy.FrontendHelpers.BeginUiBusy();
|
Grocy.FrontendHelpers.BeginUiBusy();
|
||||||
|
|
||||||
var productId = $(e.currentTarget).attr('data-product-id');
|
var productId = $(e.currentTarget).attr('data-product-id');
|
||||||
var productName = $(e.currentTarget).attr('data-product-name');
|
|
||||||
var productQuName = $(e.currentTarget).attr('data-product-qu-name');
|
|
||||||
var specificStockEntryId = $(e.currentTarget).attr('data-stock-id');
|
var specificStockEntryId = $(e.currentTarget).attr('data-stock-id');
|
||||||
var stockRowId = $(e.currentTarget).attr('data-stockrow-id');
|
var stockRowId = $(e.currentTarget).attr('data-stockrow-id');
|
||||||
var openAmount = Number.parseFloat($(e.currentTarget).attr('data-open-amount'));
|
var openAmount = Number.parseFloat($(e.currentTarget).attr('data-open-amount'));
|
||||||
@@ -128,7 +127,7 @@ $(document).on('click', '.product-open-button', function(e)
|
|||||||
{
|
{
|
||||||
button.addClass("disabled");
|
button.addClass("disabled");
|
||||||
Grocy.FrontendHelpers.EndUiBusy();
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
toastr.success(__t('Marked %1$s of %2$s as opened', 1 + " " + productQuName, productName) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBookingEntry(' + bookingResponse[0].id + ',' + stockRowId + ')"><i class="fa-solid fa-undo"></i> ' + __t("Undo") + '</a>');
|
toastr.success(__t('Marked %1$s of %2$s as opened', openAmount.toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }) + " " + __n(openAmount, result.quantity_unit_stock.name, result.quantity_unit_stock.name_plural, true), result.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBookingEntry(' + bookingResponse[0].id + ',' + stockRowId + ')"><i class="fa-solid fa-undo"></i> ' + __t("Undo") + '</a>');
|
||||||
|
|
||||||
if (result.product.move_on_open == 1 && result.default_consume_location != null)
|
if (result.product.move_on_open == 1 && result.default_consume_location != null)
|
||||||
{
|
{
|
||||||
|
@@ -188,7 +188,7 @@
|
|||||||
data-stock-id="{{ $stockEntry->stock_id }}"
|
data-stock-id="{{ $stockEntry->stock_id }}"
|
||||||
data-stockrow-id="{{ $stockEntry->id }}"
|
data-stockrow-id="{{ $stockEntry->id }}"
|
||||||
data-location-id="{{ $stockEntry->location_id }}"
|
data-location-id="{{ $stockEntry->location_id }}"
|
||||||
data-consume-amount="1">
|
data-consume-amount="{{ $stockEntry->amount }}">
|
||||||
{{ $__t('Consume this stock entry as spoiled', '1 ' . FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name) }}
|
{{ $__t('Consume this stock entry as spoiled', '1 ' . FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name) }}
|
||||||
</a>
|
</a>
|
||||||
@if(GROCY_FEATURE_FLAG_RECIPES)
|
@if(GROCY_FEATURE_FLAG_RECIPES)
|
||||||
|
Reference in New Issue
Block a user