diff --git a/changelog/70_UNRELEASED_xxxx.xx.xx.md b/changelog/70_UNRELEASED_xxxx.xx.xx.md
index 1591c8b3..5db17377 100644
--- a/changelog/70_UNRELEASED_xxxx.xx.xx.md
+++ b/changelog/70_UNRELEASED_xxxx.xx.xx.md
@@ -21,6 +21,8 @@
- Changed that when the ingredient option "Only check if any amount is in stock" is enabled, costs and calories are now based on the original entered amount instead of an "virtual" fixed amount of `1`
- When using the "Add as barcode to existing product" workflow on a purchase transaction, the selected quantity unit and the entered amount is now also added to the new barcode
- When using the "Add as barcode to existing product" workflow on a purchase or inventory transaction, the entered note is now also added to the new barcode
+- Added a new option "Reprint stock entry label" on the stock entry edit page (will print the correspondind stock entry label on save)
+ - This option will be automatically set when on changing the due date
- Fixed that hiding the "Purchased date" column (table options) on the stock entries page didn't work
- Fixed that sorting by the "Value" column 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
diff --git a/localization/strings.pot b/localization/strings.pot
index f3b96dbc..926c2f5c 100644
--- a/localization/strings.pot
+++ b/localization/strings.pot
@@ -2356,3 +2356,6 @@ msgstr ""
msgid "Successfully added the recipe to the meal plan"
msgstr ""
+
+msgid "Reprint stock entry label"
+msgstr ""
diff --git a/public/viewjs/stockentryform.js b/public/viewjs/stockentryform.js
index 7cd3831b..9a32560a 100644
--- a/public/viewjs/stockentryform.js
+++ b/public/viewjs/stockentryform.js
@@ -25,10 +25,14 @@
jsonData.best_before_date = Grocy.Components.DateTimePicker.GetValue();
jsonData.purchased_date = Grocy.Components.DateTimePicker2.GetValue();
jsonData.note = jsonForm.note;
+ jsonData.price = price;
+ jsonData.open = $("#open").is(":checked");
+
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
{
jsonData.shopping_location_id = Grocy.Components.ShoppingLocationPicker.GetValue();
}
+
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
{
jsonData.location_id = Grocy.Components.LocationPicker.GetValue();
@@ -37,14 +41,23 @@
{
jsonData.location_id = 1;
}
- jsonData.price = price;
-
- jsonData.open = $("#open").is(":checked");
Grocy.Api.Put("stock/entry/" + Grocy.EditObjectRowId, jsonData,
function(result)
{
Grocy.EditObjectId = result[0].transaction_id;
+
+ if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABEL_PRINTER && $("#print-label").is(":checked"))
+ {
+ Grocy.Api.Get('stock/entry/' + result[0].stock_id + '/printlabel', function(labelData)
+ {
+ if (Grocy.Webhooks.labelprinter !== undefined)
+ {
+ Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, labelData);
+ }
+ });
+ }
+
Grocy.Components.UserfieldsForm.Save(function()
{
var successMessage = __t('Stock entry successfully updated') + '
' + __t("Undo") + '';
@@ -123,6 +136,14 @@ $("#amount").on("focus", function(e)
$(this).select();
});
+Grocy.Components.DateTimePicker.GetInputElement().on('change', function(e)
+{
+ if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_LABEL_PRINTER)
+ {
+ $("#print-label").prop("checked", true);
+ }
+});
+
Grocy.Components.UserfieldsForm.Load();
setTimeout(function()
{
diff --git a/views/stockentryform.blade.php b/views/stockentryform.blade.php
index 68c73f7d..b2001b79 100644
--- a/views/stockentryform.blade.php
+++ b/views/stockentryform.blade.php
@@ -133,6 +133,7 @@
+ @if(GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING)