|
29 | 29 | use App\Entity\Attachments\Attachment; |
30 | 30 | use App\Entity\Parts\Part; |
31 | 31 | use App\Entity\ProjectSystem\ProjectBOMEntry; |
| 32 | +use App\Services\ElementTypeNameGenerator; |
32 | 33 | use App\Services\EntityURLGenerator; |
33 | 34 | use App\Services\Formatters\AmountFormatter; |
34 | 35 | use Doctrine\ORM\QueryBuilder; |
|
41 | 42 |
|
42 | 43 | class ProjectBomEntriesDataTable implements DataTableTypeInterface |
43 | 44 | { |
44 | | - public function __construct(protected TranslatorInterface $translator, protected PartDataTableHelper $partDataTableHelper, protected EntityURLGenerator $entityURLGenerator, protected AmountFormatter $amountFormatter) |
| 45 | + public function __construct(protected TranslatorInterface $translator, protected PartDataTableHelper $partDataTableHelper, |
| 46 | + protected EntityURLGenerator $entityURLGenerator, protected AmountFormatter $amountFormatter, private readonly ElementTypeNameGenerator $elementTypeNameGenerator) |
45 | 47 | { |
46 | 48 | } |
47 | 49 |
|
@@ -79,7 +81,14 @@ public function configure(DataTable $dataTable, array $options): void |
79 | 81 | return htmlspecialchars($this->amountFormatter->format($context->getQuantity(), $context->getPart()->getPartUnit())); |
80 | 82 | }, |
81 | 83 | ]) |
82 | | - |
| 84 | + ->add('partId', TextColumn::class, [ |
| 85 | + 'label' => $this->translator->trans('project.bom.part_id'), |
| 86 | + 'visible' => true, |
| 87 | + 'orderField' => 'part.id', |
| 88 | + 'render' => function ($value, ProjectBOMEntry $context) { |
| 89 | + return $context->getPart() instanceof Part ? (string) $context->getPart()->getId() : ''; |
| 90 | + }, |
| 91 | + ]) |
83 | 92 | ->add('name', TextColumn::class, [ |
84 | 93 | 'label' => $this->translator->trans('part.table.name'), |
85 | 94 | 'orderField' => 'NATSORT(part.name)', |
|
0 commit comments