From 9a0cad079c16e8611d170d7f73069eb08867ea2a Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sun, 27 Jun 2021 18:32:22 +0200 Subject: [PATCH] Fixed undoing consume/open from notification on /stockentries (fixes #1524) --- changelog/62_UNRELEASED_xxxx-xx-xx.md | 1 + public/viewjs/stockentries.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog/62_UNRELEASED_xxxx-xx-xx.md b/changelog/62_UNRELEASED_xxxx-xx-xx.md index 1fafea78..ef848dbf 100644 --- a/changelog/62_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/62_UNRELEASED_xxxx-xx-xx.md @@ -29,6 +29,7 @@ - Fixed that consuming with Scan Mode was not possible - Fixed that the current stock total value (header of the stock overview page) didn't include decimal amounts (thanks @Ape) - Fixed that the transfer page was not fully populated when opening it from the stock entries page +- Fixed that undoing a consume/open action from the success notification on the stock entries page was not possible ### Shopping list improvements/fixes - The amount now defaults to `1` for adding items quicker diff --git a/public/viewjs/stockentries.js b/public/viewjs/stockentries.js index 5a3aedfe..05fe09b7 100644 --- a/public/viewjs/stockentries.js +++ b/public/viewjs/stockentries.js @@ -60,7 +60,7 @@ $(document).on('click', '.stock-consume-button', function(e) Grocy.Api.Get('stock/products/' + productId, function(result) { - var toastMessage = __t('Removed %1$s of %2$s from stock', parseFloat(consumeAmount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }) + " " + __n(consumeAmount, result.quantity_unit_stock.name, result.quantity_unit_stock.name_plural), result.product.name) + '
' + __t("Undo") + ''; + var toastMessage = __t('Removed %1$s of %2$s from stock', parseFloat(consumeAmount).toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }) + " " + __n(consumeAmount, result.quantity_unit_stock.name, result.quantity_unit_stock.name_plural), result.product.name) + '
' + __t("Undo") + ''; if (wasSpoiled) { toastMessage += " (" + __t("Spoiled") + ")"; @@ -107,7 +107,7 @@ $(document).on('click', '.product-open-button', function(e) { button.addClass("disabled"); Grocy.FrontendHelpers.EndUiBusy(); - toastr.success(__t('Marked %1$s of %2$s as opened', 1 + " " + productQuName, productName) + '
' + __t("Undo") + ''); + toastr.success(__t('Marked %1$s of %2$s as opened', 1 + " " + productQuName, productName) + '
' + __t("Undo") + ''); RefreshStockEntryRow(stockRowId); }, function(xhr)