mirror of
https://github.com/Karaka-Management/oms-Labeling.git
synced 2026-01-10 16:48:41 +00:00
update
This commit is contained in:
parent
82aacb62f0
commit
dccf1df831
|
|
@ -56,12 +56,12 @@ $image = new Image();
|
|||
$image->src = '/Modules/Labeling/Theme/icons/iso/2493.png';
|
||||
$image->x = $margin - 15;
|
||||
$image->y = 250 + $margin - 50;
|
||||
$image->x2 = $image->x + 150;
|
||||
$image->y2 = 75 + $image->y;
|
||||
$image->width = 150;
|
||||
$image->height = 150;
|
||||
$l->elements[] = $image;
|
||||
|
||||
$text = new Text();
|
||||
$text->text = '0123-4567-8910';
|
||||
$text->text = $item->number;
|
||||
$text->size = 40;
|
||||
$text->x = 150 + $margin;
|
||||
$text->y = 290 + $margin;
|
||||
|
|
@ -72,12 +72,12 @@ $image = new Image();
|
|||
$image->src = '/Modules/Labeling/Theme/icons/iso/2492.png';
|
||||
$image->x = $margin - 15;
|
||||
$image->y = 350 + $margin - 50;
|
||||
$image->x2 = $image->x + 150;
|
||||
$image->y2 = 75 + $image->y;
|
||||
$image->width = 150;
|
||||
$image->height = 150;
|
||||
$l->elements[] = $image;
|
||||
|
||||
$text = new Text();
|
||||
$text->text = '0123-4567-8910';
|
||||
$text->text = 'LOT-4567-8910';
|
||||
$text->size = 40;
|
||||
$text->x = 150 + $margin;
|
||||
$text->y = 390 + $margin;
|
||||
|
|
@ -88,12 +88,12 @@ $image = new Image();
|
|||
$image->src = '/Modules/Labeling/Theme/icons/iso/2498.png';
|
||||
$image->x = $margin - 15;
|
||||
$image->y = 450 + $margin - 50;
|
||||
$image->x2 = $image->x + 150;
|
||||
$image->y2 = 75 + $image->y;
|
||||
$image->width = 150;
|
||||
$image->height = 150;
|
||||
$l->elements[] = $image;
|
||||
|
||||
$text = new Text();
|
||||
$text->text = '0123-4567-8910';
|
||||
$text->text = 'SN-4567-8910';
|
||||
$text->size = 40;
|
||||
$text->x = 150 + $margin;
|
||||
$text->y = 490 + $margin;
|
||||
|
|
@ -104,8 +104,8 @@ $image = new Image();
|
|||
$image->src = '/Modules/Labeling/Theme/icons/iso/2497.png';
|
||||
$image->x = $margin - 15;
|
||||
$image->y = 560 + $margin - 50;
|
||||
$image->x2 = $image->x + 150;
|
||||
$image->y2 = 75 + $image->y;
|
||||
$image->width = 150;
|
||||
$image->height = 150;
|
||||
$l->elements[] = $image;
|
||||
|
||||
$text = new Text();
|
||||
|
|
@ -127,8 +127,8 @@ $image = new Image();
|
|||
$image->src = '/Modules/Labeling/Theme/icons/iso/2607.png';
|
||||
$image->x = $margin + 500;
|
||||
$image->y = 540 + $margin;
|
||||
$image->x2 = $image->x + 100;
|
||||
$image->y2 = 75 + $image->y;
|
||||
$image->width = 100;
|
||||
$image->height = 110;
|
||||
$l->elements[] = $image;
|
||||
|
||||
$text = new Text();
|
||||
|
|
@ -145,12 +145,12 @@ $image = new Image();
|
|||
$image->resource = $qr->get();
|
||||
$image->x = 1000 + $margin;
|
||||
$image->y = 280 + $margin - 50;
|
||||
$image->x2 = $image->x + 200;
|
||||
$image->y2 = 75 + $image->y;
|
||||
$image->width = 200;
|
||||
$image->height = 200;
|
||||
$l->elements[] = $image;
|
||||
|
||||
$text = new Text();
|
||||
$text->text = "(01)00000000000000\n(11)000000\n(17)000000\n(10)A000B0\n(21)0000";
|
||||
$text->text = "(01)GTIN\n(11)YYYY-MM-DD\n(17)YYYY-MM-DD\n(10)LOT-4567-8910\n(21)SN-4567-8910";
|
||||
$text->size = 40;
|
||||
$text->x = 1230 + $margin;
|
||||
$text->y = 280 + $margin;
|
||||
|
|
@ -173,8 +173,8 @@ $image = new Image();
|
|||
$image->src = '/Modules/Labeling/Theme/icons/iso/3082.png';
|
||||
$image->x = $margin - 15;
|
||||
$image->y = 660 + $margin;
|
||||
$image->x2 = $image->x + 150;
|
||||
$image->y2 = 75 + $image->y;
|
||||
$image->width = 150;
|
||||
$image->height = 150;
|
||||
$l->elements[] = $image;
|
||||
|
||||
// address
|
||||
|
|
@ -231,10 +231,10 @@ $l->elements[] = $text;
|
|||
// ce
|
||||
$image = new Image();
|
||||
$image->src = '/Modules/Labeling/Theme/icons/iso/ce_mark.png';
|
||||
$image->x = 1400 + $margin;
|
||||
$image->x = 1430 + $margin;
|
||||
$image->y = 680 + $margin;
|
||||
$image->x2 = $image->x + 200;
|
||||
$image->y2 = 200 + $image->y;
|
||||
$image->width = 150;
|
||||
$image->height = 150;
|
||||
$l->elements[] = $image;
|
||||
|
||||
$text = new Text();
|
||||
|
|
@ -251,8 +251,8 @@ $image = new Image();
|
|||
$image->resource = $qr->get();
|
||||
$image->x = 1620 + $margin;
|
||||
$image->y = 680 + $margin;
|
||||
$image->x2 = $image->x + 180;
|
||||
$image->y2 = 180 + $image->y;
|
||||
$image->width = 180;
|
||||
$image->height = 180;
|
||||
$l->elements[] = $image;
|
||||
|
||||
return $l;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,17 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'^.*/warehouse/labeling/layout\?.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Labeling\Controller\BackendController:viewLayout',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::MODULE_NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionState::LABEL,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/warehouse/labeling/layout/list.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Labeling\Controller\BackendController:viewItemLabelList',
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ namespace Modules\Labeling\Controller;
|
|||
use Modules\ItemManagement\Models\ItemMapper;
|
||||
use Modules\Labeling\Models\LabelLayoutMapper;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\DataStorage\Database\Query\Builder;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
|
|
@ -32,7 +33,7 @@ use phpOMS\Views\View;
|
|||
final class BackendController extends Controller
|
||||
{
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -63,7 +64,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -98,7 +99,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -125,7 +126,44 @@ final class BackendController extends Controller
|
|||
|
||||
$view->data['item'] = $item;
|
||||
|
||||
/** @var \Modules\Labeling\Models\LabelLayout[] $layout */
|
||||
$query = new Builder($this->app->dbPool->get());
|
||||
$results = $query->raw('SELECT labeling_layout_item_src FROM labeling_layout_item WHERE labeling_layout_item_dst = ' . ((int) $request->getData('id')))
|
||||
->execute()
|
||||
?->fetchAll(\PDO::FETCH_COLUMN);
|
||||
|
||||
/** @var \Modules\Labeling\Models\LabelLayout[] $layouts */
|
||||
$layouts = LabelLayoutMapper::getAll()
|
||||
->with('l11n')
|
||||
->with('template')
|
||||
->with('template/sources')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->where('id', $results, 'IN')
|
||||
->execute();
|
||||
|
||||
$view->data['layouts'] = $layouts;
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewLayout(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/Labeling/Theme/Backend/layout-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005701001, $request, $response);
|
||||
|
||||
/** @var \Modules\Labeling\Models\LabelLayout[] $layouts */
|
||||
$layout = LabelLayoutMapper::get()
|
||||
->with('l11n')
|
||||
->with('template')
|
||||
|
|
|
|||
3
Docs/Dev/en/SUMMARY.md
Normal file
3
Docs/Dev/en/SUMMARY.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Developer Content
|
||||
|
||||
* [Structure]({%}&page=Dev/structure)
|
||||
5
Docs/Dev/en/structure.md
Normal file
5
Docs/Dev/en/structure.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Structure
|
||||
|
||||
## ER
|
||||
|
||||

|
||||
BIN
Docs/Dev/img/er.png
Normal file
BIN
Docs/Dev/img/er.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
1
Docs/introduction.md
Normal file
1
Docs/introduction.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Introduction
|
||||
|
|
@ -133,9 +133,9 @@ class Label
|
|||
// should crop
|
||||
if ($element->x1 !== 0 || $element->x2 !== 0 || $element->y1 !== 0 || $element->y2 !== 0) {
|
||||
$cropped = \imagecrop($in, [
|
||||
'x' => $element->x1,
|
||||
'y' => $element->y1,
|
||||
'width' => $element->x2 === 0 ? $srcW - $element->x1 : $element->x2 - $element->x1,
|
||||
'x' => $element->x1,
|
||||
'y' => $element->y1,
|
||||
'width' => $element->x2 === 0 ? $srcW - $element->x1 : $element->x2 - $element->x1,
|
||||
'height' => $element->y2 === 0 ? $srcH - $element->y1 : $element->y2 - $element->y1,
|
||||
]);
|
||||
|
||||
|
|
@ -175,8 +175,21 @@ class Label
|
|||
|
||||
// should resize
|
||||
if ($element->ratio !== 0.0 || $element->width !== 0 || $element->height !== 0) {
|
||||
$ratioX = $element->ratio === 0.0 ? ($element->width - $element->x) / $srcW : $element->ratio;
|
||||
$ratioY = $element->ratio === 0.0 ? ($element->height - $element->y) / $srcH : $element->ratio;
|
||||
$ratioX = $element->ratio === 0.0 ? $element->width / $srcW : $element->ratio;
|
||||
$ratioY = $element->ratio === 0.0 ? $element->height / $srcH : $element->ratio;
|
||||
|
||||
$ratioX = \abs($ratioX);
|
||||
$ratioY = \abs($ratioY);
|
||||
|
||||
if ($ratioX === 0.0) {
|
||||
$ratioX = $ratioY;
|
||||
}
|
||||
|
||||
if ($ratioY === 0.0) {
|
||||
$ratioY = $ratioX;
|
||||
}
|
||||
|
||||
// @todo handle use original width or height but resize height or width.
|
||||
|
||||
$newW = (int) ($srcW * $ratioX);
|
||||
$newH = (int) ($srcH * $ratioY);
|
||||
|
|
|
|||
46
Models/NullLabelLayout.php
Normal file
46
Models/NullLabelLayout.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Labeling\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Labeling\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\Labeling\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullLabelLayout extends LabelLayout
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return ['id' => $this->id];
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ namespace Modules\Labeling\Models;
|
|||
use phpOMS\Stdlib\Base\Enum;
|
||||
|
||||
/**
|
||||
* Permision state enum.
|
||||
* Permission category enum.
|
||||
*
|
||||
* @package Modules\Labeling\Models
|
||||
* @license OMS License 2.0
|
||||
|
|
|
|||
|
|
@ -15,4 +15,6 @@ declare(strict_types=1);
|
|||
return ['Navigation' => [
|
||||
'Labeling' => 'Etikettierung',
|
||||
'List' => 'Liste',
|
||||
'Layouts' => 'Designs',
|
||||
'Name' => 'Name',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -15,4 +15,6 @@ declare(strict_types=1);
|
|||
return ['Navigation' => [
|
||||
'Labeling' => 'Labeling',
|
||||
'List' => 'List',
|
||||
'Layouts' => 'Layouts',
|
||||
'Name' => 'Name',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Labeling
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
/** @var \Modules\Labeling\Models\LabelLayout[] $layouts */
|
||||
$layouts = $this->data['layouts'] ?? [];
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Layouts'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||
<div class="slider">
|
||||
<table id="iSalesItemList" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>
|
||||
<td><?= $this->getHtml('ID', '0', '0'); ?>
|
||||
<label for="iSalesItemList-sort-1">
|
||||
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-1">
|
||||
<i class="sort-asc g-icon">expand_less</i>
|
||||
</label>
|
||||
<label for="iSalesItemList-sort-2">
|
||||
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-2">
|
||||
<i class="sort-desc g-icon">expand_more</i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter g-icon">filter_alt</i>
|
||||
</label>
|
||||
<td class="wf-100"><?= $this->getHtml('Name'); ?>
|
||||
<label for="iSalesItemList-sort-1">
|
||||
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-1">
|
||||
<i class="sort-asc g-icon">expand_less</i>
|
||||
</label>
|
||||
<label for="iSalesItemList-sort-2">
|
||||
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-2">
|
||||
<i class="sort-desc g-icon">expand_more</i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter g-icon">filter_alt</i>
|
||||
</label>
|
||||
<tbody>
|
||||
<?php $count = 0; foreach ($layouts as $key => $value) : ++$count;
|
||||
$url = UriFactory::build('{/base}/warehouse/labeling/layout?id=' . $value->id);
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td>
|
||||
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->l11n); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="9" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
42
Theme/Backend/layout-view.tpl.php
Normal file
42
Theme/Backend/layout-view.tpl.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\StockTaking
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
echo $this->data['nav']->render();
|
||||
|
||||
$layout = $this->data['layout'];
|
||||
|
||||
$media = $layout->template;
|
||||
$template = \reset($media->sources);
|
||||
|
||||
$layout = include_once $template->getAbsolutePath();
|
||||
|
||||
\ob_start();
|
||||
\imagepng($layout->render());
|
||||
$imageData = \ob_get_clean();
|
||||
|
||||
$imageBase64 = \base64_encode($imageData);
|
||||
// Get the image MIME type
|
||||
$imageType = 'image/png'; // Assuming JPEG format in this example
|
||||
|
||||
// Generate the data URI for the inline image
|
||||
$inlineImage = 'data:' . $imageType . ';base64,' . $imageBase64;
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="portlet">
|
||||
<img style="width: 100%" src="<?php echo $inlineImage; ?>" alt="Inline Image">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user