mirror of
https://github.com/grocy/grocy.git
synced 2026-04-05 12:26:15 +02:00
Grocycode: Stockentry Label view
This commit is contained in:
parent
9e73349bfb
commit
3bcb0e696a
|
|
@ -460,9 +460,11 @@ class StockController extends BaseController
|
||||||
|
|
||||||
public function StockEntryGrocycodeImage(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
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();
|
$stockEntry = $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch();
|
||||||
$gc = new Grocycode(Grocycode::PRODUCT, $stockEntry->product_id, [$stockEntry->stock_id]);
|
$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);
|
$isDownload = $request->getQueryParam('download', false);
|
||||||
|
|
||||||
|
|
@ -485,6 +487,15 @@ class StockController extends BaseController
|
||||||
return $response;
|
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)
|
public function StockSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->renderPage($response, 'stocksettings', [
|
return $this->renderPage($response, 'stocksettings', [
|
||||||
|
|
|
||||||
|
|
@ -2388,4 +2388,10 @@ msgid "Download product grocycode"
|
||||||
msgstr "Produkt-Grocycode herunterladen"
|
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!"
|
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!"
|
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"
|
||||||
|
|
@ -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!"
|
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 ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Open print label in new Window"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "DD"
|
||||||
|
msgstr ""
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ $app->group('', function (RouteCollectorProxy $group) {
|
||||||
$group->get('/stockjournal/summary', '\Grocy\Controllers\StockController:JournalSummary');
|
$group->get('/stockjournal/summary', '\Grocy\Controllers\StockController:JournalSummary');
|
||||||
$group->get('/productbarcodes/{productBarcodeId}', '\Grocy\Controllers\StockController:ProductBarcodesEditForm');
|
$group->get('/productbarcodes/{productBarcodeId}', '\Grocy\Controllers\StockController:ProductBarcodesEditForm');
|
||||||
$group->get('/stockentry/{entryId}/grocycode', '\Grocy\Controllers\StockController:StockEntryGrocycodeImage');
|
$group->get('/stockentry/{entryId}/grocycode', '\Grocy\Controllers\StockController:StockEntryGrocycodeImage');
|
||||||
|
$group->get('/stockentry/{entryId}/label', '\Grocy\Controllers\StockController:StockEntryGrocycodeLabel');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stock price tracking
|
// Stock price tracking
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,12 @@
|
||||||
href="{{ $U('/stockentry/' . $stockEntry->id . '/grocycode?download=true') }}">
|
href="{{ $U('/stockentry/' . $stockEntry->id . '/grocycode?download=true') }}">
|
||||||
{{ $__t('Download stock entry grocycode') }}
|
{{ $__t('Download stock entry grocycode') }}
|
||||||
</a>
|
</a>
|
||||||
|
<a class="dropdown-item stockentry-label-link"
|
||||||
|
type="button"
|
||||||
|
target="_blank"
|
||||||
|
href="{{ $U('/stockentry/' . $stockEntry->id . '/label') }}">
|
||||||
|
{{ $__t('Open print label in new Window') }}
|
||||||
|
</a>
|
||||||
<a class="dropdown-item show-as-dialog-link"
|
<a class="dropdown-item show-as-dialog-link"
|
||||||
type="button"
|
type="button"
|
||||||
href="{{ $U('/stockjournal?embedded&product=') }}{{ $stockEntry->product_id }}">
|
href="{{ $U('/stockjournal?embedded&product=') }}{{ $stockEntry->product_id }}">
|
||||||
|
|
|
||||||
40
views/stockentrylabel.blade.php
Normal file
40
views/stockentrylabel.blade.php
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>{{ $product->name }}</title>
|
||||||
|
<link href="{{ $U('/components_unmanaged/noto-sans-v11-latin/noto-sans-v11-latin.min.css?v=', true) }}{{ $version }}"
|
||||||
|
rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: 'Noto Sans', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
float: left;
|
||||||
|
margin-right: .5rem;
|
||||||
|
max-height: 25px;
|
||||||
|
width: auto;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.productname {
|
||||||
|
font-size: 20px;
|
||||||
|
display: inline-block;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
<!-- Size gets determined by CSS, so printing works better (more pixels = sharper printed image).
|
||||||
|
Unfortunately, this also means the code is blurred on screen. -->
|
||||||
|
<img src="{{ $U('/stockentry/'. $stockEntry->id . '/grocycode?size=100') }}">
|
||||||
|
<span class="productname">{{ $product->name }}</span><br>
|
||||||
|
@if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
|
||||||
|
<span>{{ $__t('DD') }}: {{ $stockEntry->best_before_date }}</span>
|
||||||
|
@endif
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue
Block a user