mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-13 21:59:34 +00:00
Assemblies einführen
This commit is contained in:
parent
e1418dfdc1
commit
f0748a2123
107 changed files with 14096 additions and 98 deletions
|
|
@ -25,7 +25,9 @@ namespace App\DataTables;
|
|||
use App\DataTables\Column\EntityColumn;
|
||||
use App\DataTables\Column\LocaleDateTimeColumn;
|
||||
use App\DataTables\Column\MarkdownColumn;
|
||||
use App\DataTables\Helpers\AssemblyDataTableHelper;
|
||||
use App\DataTables\Helpers\PartDataTableHelper;
|
||||
use App\Entity\AssemblySystem\Assembly;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\ProjectSystem\ProjectBOMEntry;
|
||||
|
|
@ -41,11 +43,15 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||
|
||||
class ProjectBomEntriesDataTable implements DataTableTypeInterface
|
||||
{
|
||||
public function __construct(protected TranslatorInterface $translator, protected PartDataTableHelper $partDataTableHelper, protected EntityURLGenerator $entityURLGenerator, protected AmountFormatter $amountFormatter)
|
||||
{
|
||||
public function __construct(
|
||||
protected TranslatorInterface $translator,
|
||||
protected PartDataTableHelper $partDataTableHelper,
|
||||
protected AssemblyDataTableHelper $assemblyDataTableHelper,
|
||||
protected EntityURLGenerator $entityURLGenerator,
|
||||
protected AmountFormatter $amountFormatter
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
public function configure(DataTable $dataTable, array $options): void
|
||||
{
|
||||
$dataTable
|
||||
|
|
@ -84,16 +90,26 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface
|
|||
'label' => $this->translator->trans('part.table.name'),
|
||||
'orderField' => 'NATSORT(part.name)',
|
||||
'render' => function ($value, ProjectBOMEntry $context) {
|
||||
if(!$context->getPart() instanceof Part) {
|
||||
if(!$context->getPart() instanceof Part && !$context->getAssembly() instanceof Assembly) {
|
||||
return htmlspecialchars((string) $context->getName());
|
||||
}
|
||||
|
||||
//Part exists if we reach this point
|
||||
if ($context->getPart() !== null) {
|
||||
$tmp = $this->partDataTableHelper->renderName($context->getPart());
|
||||
$tmp = $this->translator->trans('part.table.name.value.for_part', ['%value%' => $tmp]);
|
||||
|
||||
$tmp = $this->partDataTableHelper->renderName($context->getPart());
|
||||
if($context->getName() !== null && $context->getName() !== '') {
|
||||
$tmp .= '<br><b>'.htmlspecialchars($context->getName()).'</b>';
|
||||
if($context->getName() !== null && $context->getName() !== '') {
|
||||
$tmp .= '<br><b>'.htmlspecialchars($context->getName()).'</b>';
|
||||
}
|
||||
} elseif ($context->getAssembly() !== null) {
|
||||
$tmp = $this->assemblyDataTableHelper->renderName($context->getAssembly());
|
||||
$tmp = $this->translator->trans('part.table.name.value.for_assembly', ['%value%' => $tmp]);
|
||||
|
||||
if($context->getName() !== null && $context->getName() !== '') {
|
||||
$tmp .= '<br><b>'.htmlspecialchars($context->getName()).'</b>';
|
||||
}
|
||||
}
|
||||
|
||||
return $tmp;
|
||||
},
|
||||
])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue