From 04f362b7235a82ae0148b83ae00d354d23e240dc Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sun, 21 May 2023 18:40:59 +0200 Subject: [PATCH] Added a product context menu on /stockjournal (the same as on /stockoverview) (closes #2239) --- changelog/70_UNRELEASED_xxxx.xx.xx.md | 3 +- public/viewjs/stockjournal.js | 21 ++++++ views/stockentries.blade.php | 2 +- views/stockjournal.blade.php | 104 +++++++++++++++++++++++++- views/stockoverview.blade.php | 1 + 5 files changed, 128 insertions(+), 3 deletions(-) diff --git a/changelog/70_UNRELEASED_xxxx.xx.xx.md b/changelog/70_UNRELEASED_xxxx.xx.xx.md index ff05c9a2..de386aae 100644 --- a/changelog/70_UNRELEASED_xxxx.xx.xx.md +++ b/changelog/70_UNRELEASED_xxxx.xx.xx.md @@ -34,8 +34,9 @@ - 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 -- When clicking the product name on the products list (master data) page, the product card will now be displayed (like on the stock overview page) +- When clicking a product name on the products list (master data) or on the stock journal page, the product card will now be displayed (like on the stock overview page) - When using/scanning a product barcode and the purchase or inventory page, the barcode's note will now also be prefilled (if any) +- Each row on the stock journal now also has a context-/more menu for quick access to product related actions (the same as on the stock overview 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 diff --git a/public/viewjs/stockjournal.js b/public/viewjs/stockjournal.js index 3b582cf3..5d36a35a 100644 --- a/public/viewjs/stockjournal.js +++ b/public/viewjs/stockjournal.js @@ -129,3 +129,24 @@ $(document).on('click', '.undo-stock-booking-button', function(e) } ); }); + +$(document).on('click', '.product-grocycode-label-print', function(e) +{ + e.preventDefault(); + document.activeElement.blur(); + + var productId = $(e.currentTarget).attr('data-product-id'); + Grocy.Api.Get('stock/products/' + productId + '/printlabel', function(labelData) + { + if (Grocy.Webhooks.labelprinter !== undefined) + { + Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, labelData); + } + }); +}); + +$(document).on("click", ".product-name-cell", function(e) +{ + Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id")); + $("#stockjournal-productcard-modal").modal("show"); +}); diff --git a/views/stockentries.blade.php b/views/stockentries.blade.php index 224bb25c..e81206a2 100644 --- a/views/stockentries.blade.php +++ b/views/stockentries.blade.php @@ -178,7 +178,6 @@ href="{{ $U('/inventory?embedded&product=' . $stockEntry->product_id ) }}"> {{ $__t('Inventory') }} - product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($products, 'id', $stockEntry->product_id)->name) }} @if(GROCY_FEATURE_FLAG_RECIPES) + diff --git a/views/stockjournal.blade.php b/views/stockjournal.blade.php index ad8af857..03bfb387 100644 --- a/views/stockjournal.blade.php +++ b/views/stockjournal.blade.php @@ -171,8 +171,93 @@ title="{{ $__t('Undo transaction') }}"> + - + {{ $stockLogEntry->product_name }} @if($stockLogEntry->undone == 1)
@@ -215,4 +300,21 @@ + + @stop diff --git a/views/stockoverview.blade.php b/views/stockoverview.blade.php index 18ffce1f..5c55dda2 100755 --- a/views/stockoverview.blade.php +++ b/views/stockoverview.blade.php @@ -271,6 +271,7 @@ {{ $__t('Inventory') }} @if(GROCY_FEATURE_FLAG_RECIPES) +