mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Added additional projects related filters to part table views
This commit is contained in:
parent
04d1e84596
commit
fad8f26eaa
3 changed files with 34 additions and 6 deletions
|
@ -91,7 +91,14 @@ class PartFilter implements FilterInterface
|
||||||
public readonly ArrayCollection $parameters;
|
public readonly ArrayCollection $parameters;
|
||||||
public readonly IntConstraint $parametersCount;
|
public readonly IntConstraint $parametersCount;
|
||||||
|
|
||||||
|
/*************************************************
|
||||||
|
* Project tab
|
||||||
|
*************************************************/
|
||||||
|
|
||||||
public readonly EntityConstraint $project;
|
public readonly EntityConstraint $project;
|
||||||
|
public readonly NumberConstraint $bomQuantity;
|
||||||
|
public readonly TextConstraint $bomName;
|
||||||
|
public readonly TextConstraint $bomComment;
|
||||||
|
|
||||||
public function __construct(NodesListBuilder $nodesListBuilder)
|
public function __construct(NodesListBuilder $nodesListBuilder)
|
||||||
{
|
{
|
||||||
|
@ -145,6 +152,10 @@ class PartFilter implements FilterInterface
|
||||||
$this->parametersCount = new IntConstraint('COUNT(_parameters)');
|
$this->parametersCount = new IntConstraint('COUNT(_parameters)');
|
||||||
|
|
||||||
$this->project = new EntityConstraint($nodesListBuilder, Project::class, '_projectBomEntries.project');
|
$this->project = new EntityConstraint($nodesListBuilder, Project::class, '_projectBomEntries.project');
|
||||||
|
$this->bomQuantity = new NumberConstraint('_projectBomEntries.quantity');
|
||||||
|
$this->bomName = new TextConstraint('_projectBomEntries.name');
|
||||||
|
$this->bomComment = new TextConstraint('_projectBomEntries.comment');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function apply(QueryBuilder $queryBuilder): void
|
public function apply(QueryBuilder $queryBuilder): void
|
||||||
|
|
|
@ -184,8 +184,8 @@ class PartFilterType extends AbstractType
|
||||||
|
|
||||||
$builder->add('orderdetailsCount', NumberConstraintType::class, [
|
$builder->add('orderdetailsCount', NumberConstraintType::class, [
|
||||||
'label' => 'part.filter.orderdetails_count',
|
'label' => 'part.filter.orderdetails_count',
|
||||||
'step' => 1,
|
'step' => 1,
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('obsolete', BooleanConstraintType::class, [
|
$builder->add('obsolete', BooleanConstraintType::class, [
|
||||||
|
@ -281,10 +281,24 @@ class PartFilterType extends AbstractType
|
||||||
* Project tab
|
* Project tab
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
if ($this->security->isGranted('read', Project::class)) {
|
if ($this->security->isGranted('read', Project::class)) {
|
||||||
$builder->add('project', StructuralEntityConstraintType::class, [
|
$builder
|
||||||
'label' => 'project.label',
|
->add('project', StructuralEntityConstraintType::class, [
|
||||||
'entity_class' => Project::class
|
'label' => 'project.label',
|
||||||
]);
|
'entity_class' => Project::class
|
||||||
|
])
|
||||||
|
->add('bomQuantity', NumberConstraintType::class, [
|
||||||
|
'label' => 'project.bom.quantity',
|
||||||
|
'min' => 0,
|
||||||
|
'step' => "any",
|
||||||
|
])
|
||||||
|
->add('bomName', TextConstraintType::class, [
|
||||||
|
'label' => 'project.bom.name',
|
||||||
|
])
|
||||||
|
->add('bomComment', TextConstraintType::class, [
|
||||||
|
'label' => 'project.bom.comment',
|
||||||
|
])
|
||||||
|
;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,9 @@
|
||||||
{% if filterForm.project is defined %}
|
{% if filterForm.project is defined %}
|
||||||
<div class="tab-pane pt-3" id="filter-projects" role="tabpanel" aria-labelledby="filter-projects-tab" tabindex="0">
|
<div class="tab-pane pt-3" id="filter-projects" role="tabpanel" aria-labelledby="filter-projects-tab" tabindex="0">
|
||||||
{{ form_row(filterForm.project) }}
|
{{ form_row(filterForm.project) }}
|
||||||
|
{{ form_row(filterForm.bomQuantity) }}
|
||||||
|
{{ form_row(filterForm.bomName) }}
|
||||||
|
{{ form_row(filterForm.bomComment) }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue