mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Added some more filter possibilities.
This commit is contained in:
parent
96cd746f60
commit
28c09eb51d
5 changed files with 68 additions and 4 deletions
|
@ -21,6 +21,7 @@ use App\Entity\Parts\Supplier;
|
|||
use App\Services\Trees\NodesListBuilder;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Svg\Tag\Text;
|
||||
|
||||
class PartFilter implements FilterInterface
|
||||
{
|
||||
|
@ -78,6 +79,9 @@ class PartFilter implements FilterInterface
|
|||
/** @var IntConstraint */
|
||||
protected $orderdetailsCount;
|
||||
|
||||
/** @var BooleanConstraint */
|
||||
protected $obsolete;
|
||||
|
||||
/** @var EntityConstraint */
|
||||
protected $storelocation;
|
||||
|
||||
|
@ -90,6 +94,9 @@ class PartFilter implements FilterInterface
|
|||
/** @var BooleanConstraint */
|
||||
protected $lotNeedsRefill;
|
||||
|
||||
/** @var TextConstraint */
|
||||
protected $lotDescription;
|
||||
|
||||
/** @var BooleanConstraint */
|
||||
protected $lotUnknownAmount;
|
||||
|
||||
|
@ -117,6 +124,9 @@ class PartFilter implements FilterInterface
|
|||
/** @var ArrayCollection<int, ParameterConstraint> */
|
||||
protected $parameters;
|
||||
|
||||
/** @var IntConstraint */
|
||||
protected $parametersCount;
|
||||
|
||||
public function __construct(NodesListBuilder $nodesListBuilder)
|
||||
{
|
||||
$this->name = new TextConstraint('part.name');
|
||||
|
@ -141,25 +151,28 @@ class PartFilter implements FilterInterface
|
|||
*/
|
||||
$this->amountSum = new IntConstraint('amountSum');
|
||||
$this->lotCount = new IntConstraint('COUNT(partLots)');
|
||||
$this->supplier = new EntityConstraint($nodesListBuilder, Supplier::class, 'orderdetails.supplier');
|
||||
|
||||
$this->storelocation = new EntityConstraint($nodesListBuilder, Storelocation::class, 'partLots.storage_location');
|
||||
$this->lotNeedsRefill = new BooleanConstraint('partLots.needs_refill');
|
||||
$this->lotUnknownAmount = new BooleanConstraint('partLots.instock_unknown');
|
||||
$this->lotExpirationDate = new DateTimeConstraint('partLots.expiration_date');
|
||||
$this->lotDescription = new TextConstraint('partLots.description');
|
||||
|
||||
$this->manufacturer = new EntityConstraint($nodesListBuilder, Manufacturer::class, 'part.manufacturer');
|
||||
$this->manufacturer_product_number = new TextConstraint('part.manufacturer_product_number');
|
||||
$this->manufacturer_product_url = new TextConstraint('part.manufacturer_product_url');
|
||||
$this->manufacturing_status = new ChoiceConstraint('part.manufacturing_status');
|
||||
|
||||
$this->storelocation = new EntityConstraint($nodesListBuilder, Storelocation::class, 'partLots.storage_location');
|
||||
|
||||
$this->attachmentsCount = new IntConstraint('COUNT(attachments)');
|
||||
$this->attachmentType = new EntityConstraint($nodesListBuilder, AttachmentType::class, 'attachments.attachment_type');
|
||||
$this->attachmentName = new TextConstraint('attachments.name');
|
||||
|
||||
$this->supplier = new EntityConstraint($nodesListBuilder, Supplier::class, 'orderdetails.supplier');
|
||||
$this->orderdetailsCount = new IntConstraint('COUNT(orderdetails)');
|
||||
$this->obsolete = new BooleanConstraint('orderdetails.obsolete');
|
||||
|
||||
$this->parameters = new ArrayCollection();
|
||||
$this->parametersCount = new IntConstraint('COUNT(parameters)');
|
||||
}
|
||||
|
||||
public function apply(QueryBuilder $queryBuilder): void
|
||||
|
@ -387,6 +400,28 @@ class PartFilter implements FilterInterface
|
|||
return $this->parameters;
|
||||
}
|
||||
|
||||
public function getParametersCount(): IntConstraint
|
||||
{
|
||||
return $this->parametersCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TextConstraint
|
||||
*/
|
||||
public function getLotDescription(): TextConstraint
|
||||
{
|
||||
return $this->lotDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BooleanConstraint
|
||||
*/
|
||||
public function getObsolete(): BooleanConstraint
|
||||
{
|
||||
return $this->obsolete;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -362,6 +362,7 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
->leftJoin('orderdetails.supplier', 'suppliers')
|
||||
->leftJoin('part.attachments', 'attachments')
|
||||
->leftJoin('part.partUnit', 'partUnit')
|
||||
->leftJoin('part.parameters', 'parameters')
|
||||
|
||||
->groupBy('part')
|
||||
;
|
||||
|
|
|
@ -156,6 +156,9 @@ class PartFilterType extends AbstractType
|
|||
'min' => 0,
|
||||
]);
|
||||
|
||||
$builder->add('obsolete', BooleanConstraintType::class, [
|
||||
'label' => 'orderdetails.edit.obsolete'
|
||||
]);
|
||||
|
||||
/*
|
||||
* Stocks tabs
|
||||
|
@ -194,6 +197,10 @@ class PartFilterType extends AbstractType
|
|||
'input_type' => DateType::class,
|
||||
]);
|
||||
|
||||
$builder->add('lotDescription', TextConstraintType::class, [
|
||||
'label' => 'part.filter.lotDescription',
|
||||
]);
|
||||
|
||||
/**
|
||||
* Attachments count
|
||||
*/
|
||||
|
@ -215,7 +222,7 @@ class PartFilterType extends AbstractType
|
|||
$constraint_prototype = new ParameterConstraint();
|
||||
|
||||
$builder->add('parameters', CollectionType::class, [
|
||||
'label' => 'parameter.label',
|
||||
'label' => false,
|
||||
'entry_type' => ParameterConstraintType::class,
|
||||
'allow_delete' => true,
|
||||
'allow_add' => true,
|
||||
|
@ -224,6 +231,12 @@ class PartFilterType extends AbstractType
|
|||
'empty_data' => $constraint_prototype,
|
||||
]);
|
||||
|
||||
$builder->add('parametersCount', NumberConstraintType::class, [
|
||||
'label' => 'part.filter.parameters_count',
|
||||
'step' => 1,
|
||||
'min' => 0,
|
||||
]);
|
||||
|
||||
$builder->add('submit', SubmitType::class, [
|
||||
'label' => 'filter.submit',
|
||||
]);
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
{{ form_row(filterForm.amountSum) }}
|
||||
{{ form_row(filterForm.lotCount) }}
|
||||
{{ form_row(filterForm.lotExpirationDate) }}
|
||||
{{ form_row(filterForm.lotDescription) }}
|
||||
{{ form_row(filterForm.lotNeedsRefill) }}
|
||||
{{ form_row(filterForm.lotUnknownAmount) }}
|
||||
</div>
|
||||
|
@ -73,10 +74,12 @@
|
|||
<div class="tab-pane pt-3" id="filter-orderdetails" role="tabpanel" aria-labelledby="filter-orderdetails-tab" tabindex="0">
|
||||
{{ form_row(filterForm.supplier) }}
|
||||
{{ form_row(filterForm.orderdetailsCount) }}
|
||||
{{ form_row(filterForm.obsolete) }}
|
||||
</div>
|
||||
|
||||
<div class="tab-pane pt-3" id="filter-parameters" role="tabpanel" aria-labelledby="filter-parameters-tab" tabindex="0">
|
||||
{% import 'components/collection_type.macro.html.twig' as collection %}
|
||||
{{ form_row(filterForm.parametersCount) }}
|
||||
|
||||
<div {{ collection.controller(filterForm.parameters) }}>
|
||||
<table class="table table-striped table-sm" id="lots_table" {{ collection.target() }}>
|
||||
|
|
|
@ -9669,5 +9669,17 @@ Element 3</target>
|
|||
<target>Add constraint</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id=".CuxL5L" name="part.filter.parameters_count">
|
||||
<segment>
|
||||
<source>part.filter.parameters_count</source>
|
||||
<target>Number of parameters</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="Dn0SKIi" name="part.filter.lotDescription">
|
||||
<segment>
|
||||
<source>part.filter.lotDescription</source>
|
||||
<target>Lot description</target>
|
||||
</segment>
|
||||
</unit>
|
||||
</file>
|
||||
</xliff>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue