mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-14 14:19:33 +00:00
Assembly-Filter und -Tab ergänzen
Fügt Unterstützung für Assembly-Filter in der Suche sowie ein neues Tab für Assemblies in der Filteransicht hinzu. Anpassungen beinhalten Änderungen an Datenbankabfragen, Formularen und Templates.
This commit is contained in:
parent
980657eec4
commit
07d4ffa956
7 changed files with 75 additions and 3 deletions
|
|
@ -330,7 +330,7 @@ class PartListsController extends AbstractController
|
|||
$filter->setSupplier($request->query->getBoolean('supplier'));
|
||||
$filter->setManufacturer($request->query->getBoolean('manufacturer'));
|
||||
$filter->setFootprint($request->query->getBoolean('footprint'));
|
||||
|
||||
$filter->setAssembly($request->query->getBoolean('assembly'));
|
||||
|
||||
$filter->setRegex($request->query->getBoolean('regex'));
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ use App\DataTables\Filters\Constraints\Part\LessThanDesiredConstraint;
|
|||
use App\DataTables\Filters\Constraints\Part\ParameterConstraint;
|
||||
use App\DataTables\Filters\Constraints\Part\TagsConstraint;
|
||||
use App\DataTables\Filters\Constraints\TextConstraint;
|
||||
use App\Entity\AssemblySystem\Assembly;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
|
|
@ -107,6 +108,14 @@ class PartFilter implements FilterInterface
|
|||
public readonly TextConstraint $bomName;
|
||||
public readonly TextConstraint $bomComment;
|
||||
|
||||
/*************************************************
|
||||
* Assembly
|
||||
*************************************************/
|
||||
|
||||
public readonly EntityConstraint $assembly;
|
||||
public readonly NumberConstraint $assemblyBomQuantity;
|
||||
public readonly TextConstraint $assemblyBomName;
|
||||
|
||||
/*************************************************
|
||||
* Bulk Import Job tab
|
||||
*************************************************/
|
||||
|
|
@ -180,6 +189,10 @@ class PartFilter implements FilterInterface
|
|||
$this->bomName = new TextConstraint('_projectBomEntries.name');
|
||||
$this->bomComment = new TextConstraint('_projectBomEntries.comment');
|
||||
|
||||
$this->assembly = new EntityConstraint($nodesListBuilder, Assembly::class, '_assemblyBomEntries.assembly');
|
||||
$this->assemblyBomQuantity = new NumberConstraint('_assemblyBomEntries.quantity');
|
||||
$this->assemblyBomName = new TextConstraint('_assemblyBomEntries.name');
|
||||
|
||||
// Bulk Import Job filters
|
||||
$this->inBulkImportJob = new BulkImportJobExistsConstraint();
|
||||
$this->bulkImportJobStatus = new BulkImportJobStatusConstraint();
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@ class PartSearchFilter implements FilterInterface
|
|||
/** @var bool Use Internal Part number for searching */
|
||||
protected bool $ipn = true;
|
||||
|
||||
/** @var bool Use assembly name for searching */
|
||||
protected bool $assembly = true;
|
||||
|
||||
public function __construct(
|
||||
/** @var string The string to query for */
|
||||
protected string $keyword
|
||||
|
|
@ -113,6 +116,9 @@ class PartSearchFilter implements FilterInterface
|
|||
if ($this->ipn) {
|
||||
$fields_to_search[] = 'part.ipn';
|
||||
}
|
||||
if ($this->assembly) {
|
||||
$fields_to_search[] = '_assembly.name';
|
||||
}
|
||||
|
||||
return $fields_to_search;
|
||||
}
|
||||
|
|
@ -304,5 +310,14 @@ class PartSearchFilter implements FilterInterface
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function isAssembly(): bool
|
||||
{
|
||||
return $this->assembly;
|
||||
}
|
||||
|
||||
public function setAssembly(bool $assembly): PartSearchFilter
|
||||
{
|
||||
$this->assembly = $assembly;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -474,6 +474,13 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
//Do not group by many-to-* relations, as it would restrict the COUNT having clauses to be maximum 1
|
||||
//$builder->addGroupBy('_projectBomEntries');
|
||||
}
|
||||
if (str_contains($dql, '_assembly.')) {
|
||||
$builder->leftJoin('part.assembly_bom_entries', '_assemblyBomEntries');
|
||||
$builder->leftJoin('_assemblyBomEntries.assembly', '_assembly');
|
||||
}
|
||||
if (str_contains($dql, '_assemblyBomEntries')) {
|
||||
$builder->leftJoin('part.assembly_bom_entries', '_assemblyBomEntries');
|
||||
}
|
||||
if (str_contains($dql, '_jobPart')) {
|
||||
$builder->leftJoin('part.bulkImportJobParts', '_jobPart');
|
||||
$builder->leftJoin('_jobPart.job', '_bulkImportJob');
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ namespace App\Form\Filters;
|
|||
use App\DataTables\Filters\Constraints\Part\BulkImportPartStatusConstraint;
|
||||
use App\DataTables\Filters\Constraints\Part\ParameterConstraint;
|
||||
use App\DataTables\Filters\PartFilter;
|
||||
use App\Entity\AssemblySystem\Assembly;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\InfoProviderSystem\BulkImportJobStatus;
|
||||
use App\Entity\InfoProviderSystem\BulkImportPartStatus;
|
||||
|
|
@ -313,6 +314,26 @@ class PartFilterType extends AbstractType
|
|||
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Assembly tab
|
||||
**************************************************************************/
|
||||
if ($this->security->isGranted('read', Assembly::class)) {
|
||||
$builder
|
||||
->add('assembly', StructuralEntityConstraintType::class, [
|
||||
'label' => 'assembly.label',
|
||||
'entity_class' => Assembly::class
|
||||
])
|
||||
->add('assemblyBomQuantity', NumberConstraintType::class, [
|
||||
'label' => 'assembly.bom.quantity',
|
||||
'min' => 0,
|
||||
'step' => "any",
|
||||
])
|
||||
->add('assemblyBomName', TextConstraintType::class, [
|
||||
'label' => 'assembly.bom.name',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Bulk Import Job tab
|
||||
**************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue