mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 02:09:03 +02:00
Show storelocations in part table.
This commit is contained in:
parent
1e48c552dc
commit
7a9bc224a7
1 changed files with 20 additions and 3 deletions
|
@ -35,6 +35,7 @@ use App\Entity\Parts\Category;
|
||||||
use App\Entity\Parts\Footprint;
|
use App\Entity\Parts\Footprint;
|
||||||
use App\Entity\Parts\Manufacturer;
|
use App\Entity\Parts\Manufacturer;
|
||||||
use App\Entity\Parts\Part;
|
use App\Entity\Parts\Part;
|
||||||
|
use App\Entity\Parts\PartLot;
|
||||||
use App\Entity\Parts\Storelocation;
|
use App\Entity\Parts\Storelocation;
|
||||||
use App\Entity\Parts\Supplier;
|
use App\Entity\Parts\Supplier;
|
||||||
use App\Services\EntityURLGenerator;
|
use App\Services\EntityURLGenerator;
|
||||||
|
@ -173,9 +174,25 @@ class PartsDataTable implements DataTableTypeInterface
|
||||||
'property' => 'manufacturer',
|
'property' => 'manufacturer',
|
||||||
'label' => $this->translator->trans('part.table.manufacturer')
|
'label' => $this->translator->trans('part.table.manufacturer')
|
||||||
])
|
])
|
||||||
//->add('footprint', TextColumn::class, ['field' => 'footprint.name'])
|
->add('storelocation', TextColumn::class, [
|
||||||
//->add('manufacturer', TextColumn::class, ['field' => 'manufacturer.name' ])
|
'label' => $this->translator->trans('part.table.storeLocations'),
|
||||||
//->add('amountSum', TextColumn::class, ['label' => 'instock.label_short'])
|
'render' => function ($value, Part $context) {
|
||||||
|
$tmp = array();
|
||||||
|
foreach ($context->getPartLots() as $lot) {
|
||||||
|
//Ignore lots without storelocation
|
||||||
|
if ($lot->getStorageLocation() === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$tmp[] = sprintf(
|
||||||
|
'<a href="%s">%s</a>',
|
||||||
|
$this->urlGenerator->listPartsURL($lot->getStorageLocation()),
|
||||||
|
$lot->getStorageLocation()->getName()
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
return implode('<br>', $tmp);
|
||||||
|
}
|
||||||
|
])
|
||||||
->add('amount', TextColumn::class, [
|
->add('amount', TextColumn::class, [
|
||||||
'label' => $this->translator->trans('part.table.amount'),
|
'label' => $this->translator->trans('part.table.amount'),
|
||||||
'propertyPath' => 'amountSum'
|
'propertyPath' => 'amountSum'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue