Added basic label generation dialog.

This commit is contained in:
Jan Böhmer 2020-04-16 19:56:30 +02:00
parent ea0d72bfbb
commit a4e1a17b4a
12 changed files with 230 additions and 5 deletions

View file

@ -24,14 +24,16 @@ namespace App\Services\LabelSystem;
use App\Entity\Contracts\NamedElementInterface;
use App\Entity\LabelSystem\LabelOptions;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Services\ElementTypeNameGenerator;
use Dompdf\Dompdf;
use Twig\Environment;
class LabelGenerator
{
protected const CLASS_SUPPORT_MAPPING = [
public const CLASS_SUPPORT_MAPPING = [
'part' => Part::class,
'part_lot' => PartLot::class,
];
public const MM_TO_POINTS_FACTOR = 2.83465;

View file

@ -40,7 +40,7 @@ class LabelHTMLGenerator
public function getLabelHTML(LabelOptions $options, object $element): string
{
return $this->twig->render('labels/base_label.html.twig', [
return $this->twig->render('LabelSystem/labels/base_label.html.twig', [
'meta_title' => $this->getPDFTitle($options, $element),
'lines' => $this->replacer->replace($options->getLines(), $element),
]);

View file

@ -104,6 +104,7 @@ class ToolsTreeBuilder
$item->tag(['tree_tools', 'groups', $this->keyGenerator->generateKey()]);
$tree = [];
$tree[] = new TreeViewNode($this->translator->trans('tree.tools.tools'), null, $this->getToolsNode());
$tree[] = new TreeViewNode($this->translator->trans('tree.tools.edit'), null, $this->getEditNodes());
$tree[] = new TreeViewNode($this->translator->trans('tree.tools.show'), null, $this->getShowNodes());
$tree[] = new TreeViewNode($this->translator->trans('tree.tools.system'), null, $this->getSystemNodes());
@ -112,6 +113,18 @@ class ToolsTreeBuilder
});
}
protected function getToolsNode(): array
{
$nodes = [];
$nodes[] = new TreeViewNode(
$this->translator->trans('tree.tools.tools.label_dialog'),
$this->urlGenerator->generate('label_dialog')
);
return $nodes;
}
/**
* This functions creates a tree entries for the "edit" node of the tool's tree.
*