mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-30 13:34:28 +02:00
Added filters for attachment types and attachment names of parts.
This commit is contained in:
parent
22eb6601e8
commit
7b3538a2c7
4 changed files with 45 additions and 0 deletions
|
@ -9,6 +9,7 @@ use App\DataTables\Filters\Constraints\IntConstraint;
|
||||||
use App\DataTables\Filters\Constraints\NumberConstraint;
|
use App\DataTables\Filters\Constraints\NumberConstraint;
|
||||||
use App\DataTables\Filters\Constraints\Part\TagsConstraint;
|
use App\DataTables\Filters\Constraints\Part\TagsConstraint;
|
||||||
use App\DataTables\Filters\Constraints\TextConstraint;
|
use App\DataTables\Filters\Constraints\TextConstraint;
|
||||||
|
use App\Entity\Attachments\AttachmentType;
|
||||||
use App\Entity\Parts\Category;
|
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;
|
||||||
|
@ -17,6 +18,7 @@ use App\Entity\Parts\Storelocation;
|
||||||
use App\Entity\Parts\Supplier;
|
use App\Entity\Parts\Supplier;
|
||||||
use App\Services\Trees\NodesListBuilder;
|
use App\Services\Trees\NodesListBuilder;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Svg\Tag\Text;
|
||||||
|
|
||||||
class PartFilter implements FilterInterface
|
class PartFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
|
@ -98,6 +100,12 @@ class PartFilter implements FilterInterface
|
||||||
/** @var IntConstraint */
|
/** @var IntConstraint */
|
||||||
protected $attachmentsCount;
|
protected $attachmentsCount;
|
||||||
|
|
||||||
|
/** @var EntityConstraint */
|
||||||
|
protected $attachmentType;
|
||||||
|
|
||||||
|
/** @var TextConstraint */
|
||||||
|
protected $attachmentName;
|
||||||
|
|
||||||
public function __construct(NodesListBuilder $nodesListBuilder)
|
public function __construct(NodesListBuilder $nodesListBuilder)
|
||||||
{
|
{
|
||||||
$this->name = new TextConstraint('part.name');
|
$this->name = new TextConstraint('part.name');
|
||||||
|
@ -129,6 +137,9 @@ class PartFilter implements FilterInterface
|
||||||
$this->storelocation = new EntityConstraint($nodesListBuilder, Storelocation::class, 'partLots.storage_location');
|
$this->storelocation = new EntityConstraint($nodesListBuilder, Storelocation::class, 'partLots.storage_location');
|
||||||
|
|
||||||
$this->attachmentsCount = new IntConstraint('COUNT(attachments)');
|
$this->attachmentsCount = new IntConstraint('COUNT(attachments)');
|
||||||
|
$this->attachmentType = new EntityConstraint($nodesListBuilder, AttachmentType::class, 'attachments.attachment_type');
|
||||||
|
$this->attachmentName = new TextConstraint('attachments.name');
|
||||||
|
|
||||||
$this->orderdetailsCount = new IntConstraint('COUNT(orderdetails)');
|
$this->orderdetailsCount = new IntConstraint('COUNT(orderdetails)');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,6 +334,22 @@ class PartFilter implements FilterInterface
|
||||||
return $this->lotExpirationDate;
|
return $this->lotExpirationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return EntityConstraint
|
||||||
|
*/
|
||||||
|
public function getAttachmentType(): EntityConstraint
|
||||||
|
{
|
||||||
|
return $this->attachmentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return TextConstraint
|
||||||
|
*/
|
||||||
|
public function getAttachmentName(): TextConstraint
|
||||||
|
{
|
||||||
|
return $this->attachmentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Form\Filters;
|
namespace App\Form\Filters;
|
||||||
|
|
||||||
use App\DataTables\Filters\PartFilter;
|
use App\DataTables\Filters\PartFilter;
|
||||||
|
use App\Entity\Attachments\AttachmentType;
|
||||||
use App\Entity\Parts\Category;
|
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;
|
||||||
|
@ -179,6 +180,15 @@ class PartFilterType extends AbstractType
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$builder->add('attachmentType', StructuralEntityConstraintType::class, [
|
||||||
|
'label' => 'attachment.attachment_type',
|
||||||
|
'entity_class' => AttachmentType::class
|
||||||
|
]);
|
||||||
|
|
||||||
|
$builder->add('attachmentName', TextConstraintType::class, [
|
||||||
|
'label' => 'part.filter.attachmentName',
|
||||||
|
]);
|
||||||
|
|
||||||
$builder->add('submit', SubmitType::class, [
|
$builder->add('submit', SubmitType::class, [
|
||||||
'label' => 'Update',
|
'label' => 'Update',
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -61,6 +61,8 @@
|
||||||
|
|
||||||
<div class="tab-pane pt-3" id="filter-attachments" role="tabpanel" aria-labelledby="filter-attachments-tab" tabindex="0">
|
<div class="tab-pane pt-3" id="filter-attachments" role="tabpanel" aria-labelledby="filter-attachments-tab" tabindex="0">
|
||||||
{{ form_row(filterForm.attachmentsCount) }}
|
{{ form_row(filterForm.attachmentsCount) }}
|
||||||
|
{{ form_row(filterForm.attachmentType) }}
|
||||||
|
{{ form_row(filterForm.attachmentName) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane pt-3" id="filter-orderdetails" role="tabpanel" aria-labelledby="filter-orderdetails-tab" tabindex="0">
|
<div class="tab-pane pt-3" id="filter-orderdetails" role="tabpanel" aria-labelledby="filter-orderdetails-tab" tabindex="0">
|
||||||
|
|
|
@ -9495,5 +9495,11 @@ Element 3</target>
|
||||||
<target>Any lot has unknown amount</target>
|
<target>Any lot has unknown amount</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
|
<unit id="lRKoTj_" name="part.filter.attachmentName">
|
||||||
|
<segment>
|
||||||
|
<source>part.filter.attachmentName</source>
|
||||||
|
<target>Attachment name</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue