diff --git a/controllers/StockController.php b/controllers/StockController.php index d42d9a36..3907c132 100644 --- a/controllers/StockController.php +++ b/controllers/StockController.php @@ -460,9 +460,11 @@ class StockController extends BaseController public function StockEntryGrocycodeImage(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args) { + $size = $request->getQueryParam('size', null); + $stockEntry = $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch(); $gc = new Grocycode(Grocycode::PRODUCT, $stockEntry->product_id, [$stockEntry->stock_id]); - $png = (new DatamatrixFactory())->setCode((string) $gc)->getDatamatrixPngData(); + $png = (new DatamatrixFactory())->setCode((string) $gc)->setSize($size)->getDatamatrixPngData(); $isDownload = $request->getQueryParam('download', false); @@ -485,6 +487,15 @@ class StockController extends BaseController return $response; } + public function StockEntryGrocycodeLabel(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args) + { + $stockEntry = $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch(); + return $this->renderPage($response, 'stockentrylabel', [ + 'stockEntry' => $stockEntry, + 'product' => $this->getDatabase()->products($stockEntry->product_id), + ]); + } + public function StockSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args) { return $this->renderPage($response, 'stocksettings', [ diff --git a/localization/de/strings.po b/localization/de/strings.po index 048556dd..35cd5934 100644 --- a/localization/de/strings.po +++ b/localization/de/strings.po @@ -2388,4 +2388,10 @@ msgid "Download product grocycode" msgstr "Produkt-Grocycode herunterladen" msgid "Grocycode is a unique referer to this product in your grocy instance. Print it onto a label and scan it like any other barcode!" -msgstr "Grocycode ist eine eindeutige Referenz zu diesem Produkt in dieser Grocy-Instanz. Ausgedruckt kann es wie jeder andere Barcode gescannt werden!" \ No newline at end of file +msgstr "Grocycode ist eine eindeutige Referenz zu diesem Produkt in dieser Grocy-Instanz. Ausgedruckt kann es wie jeder andere Barcode gescannt werden!" + +msgid "Open print label in new Window" +msgstr "Druck-Label in neuem Fenster öffnen" + +msgid "DD" +msgstr "MHD" \ No newline at end of file diff --git a/localization/strings.pot b/localization/strings.pot index b32ec66d..a49d2312 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -2100,3 +2100,9 @@ msgstr "" msgid "Grocycode is a unique referer to this product in your grocy instance. Print it onto a label and scan it like any other barcode!" msgstr "" + +msgid "Open print label in new Window" +msgstr "" + +msgid "DD" +msgstr "" diff --git a/routes.php b/routes.php index 5a146491..0f2c4739 100644 --- a/routes.php +++ b/routes.php @@ -61,6 +61,7 @@ $app->group('', function (RouteCollectorProxy $group) { $group->get('/stockjournal/summary', '\Grocy\Controllers\StockController:JournalSummary'); $group->get('/productbarcodes/{productBarcodeId}', '\Grocy\Controllers\StockController:ProductBarcodesEditForm'); $group->get('/stockentry/{entryId}/grocycode', '\Grocy\Controllers\StockController:StockEntryGrocycodeImage'); + $group->get('/stockentry/{entryId}/label', '\Grocy\Controllers\StockController:StockEntryGrocycodeLabel'); } // Stock price tracking diff --git a/views/stockentries.blade.php b/views/stockentries.blade.php index 0ea08182..13fcaad8 100644 --- a/views/stockentries.blade.php +++ b/views/stockentries.blade.php @@ -190,6 +190,12 @@ href="{{ $U('/stockentry/' . $stockEntry->id . '/grocycode?download=true') }}"> {{ $__t('Download stock entry grocycode') }} + + {{ $__t('Open print label in new Window') }} + diff --git a/views/stockentrylabel.blade.php b/views/stockentrylabel.blade.php new file mode 100644 index 00000000..cf126361 --- /dev/null +++ b/views/stockentrylabel.blade.php @@ -0,0 +1,40 @@ + + + + {{ $product->name }} + + + + + +

+ + + {{ $product->name }}
+ @if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING) + {{ $__t('DD') }}: {{ $stockEntry->best_before_date }} + @endif +

+ + + \ No newline at end of file