diff --git a/src/DataTables/Filters/PartFilter.php b/src/DataTables/Filters/PartFilter.php index 9ce90cd6..14ab1a9c 100644 --- a/src/DataTables/Filters/PartFilter.php +++ b/src/DataTables/Filters/PartFilter.php @@ -37,6 +37,8 @@ use App\Entity\Parts\Manufacturer; use App\Entity\Parts\MeasurementUnit; use App\Entity\Parts\Storelocation; use App\Entity\Parts\Supplier; +use App\Entity\UserSystem\User; +use App\Form\Filters\Constraints\UserEntityConstraintType; use App\Services\Trees\NodesListBuilder; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\QueryBuilder; @@ -71,17 +73,12 @@ class PartFilter implements FilterInterface protected IntConstraint $amountSum; protected LessThanDesiredConstraint $lessThanDesired; - /** - * @return LessThanDesiredConstraint - */ - public function getLessThanDesired(): LessThanDesiredConstraint - { - return $this->lessThanDesired; - } protected BooleanConstraint $lotNeedsRefill; protected TextConstraint $lotDescription; protected BooleanConstraint $lotUnknownAmount; protected DateTimeConstraint $lotExpirationDate; + protected EntityConstraint $lotOwner; + protected EntityConstraint $measurementUnit; protected TextConstraint $manufacturer_product_url; protected TextConstraint $manufacturer_product_number; @@ -125,6 +122,7 @@ class PartFilter implements FilterInterface $this->lotUnknownAmount = new BooleanConstraint('partLots.instock_unknown'); $this->lotExpirationDate = new DateTimeConstraint('partLots.expiration_date'); $this->lotDescription = new TextConstraint('partLots.description'); + $this->lotOwner = new EntityConstraint($nodesListBuilder, User::class, 'partLots.owner'); $this->manufacturer = new EntityConstraint($nodesListBuilder, Manufacturer::class, 'part.manufacturer'); $this->manufacturer_product_number = new TextConstraint('part.manufacturer_product_number'); @@ -291,6 +289,14 @@ class PartFilter implements FilterInterface return $this->lotCount; } + /** + * @return EntityConstraint + */ + public function getLotOwner(): EntityConstraint + { + return $this->lotOwner; + } + /** * @return TagsConstraint */ @@ -394,7 +400,13 @@ class PartFilter implements FilterInterface return $this->obsolete; } - + /** + * @return LessThanDesiredConstraint + */ + public function getLessThanDesired(): LessThanDesiredConstraint + { + return $this->lessThanDesired; + } } diff --git a/src/Form/Filters/PartFilterType.php b/src/Form/Filters/PartFilterType.php index 668ea5ec..249b0c1c 100644 --- a/src/Form/Filters/PartFilterType.php +++ b/src/Form/Filters/PartFilterType.php @@ -36,6 +36,7 @@ use App\Form\Filters\Constraints\ParameterConstraintType; use App\Form\Filters\Constraints\StructuralEntityConstraintType; use App\Form\Filters\Constraints\TagsConstraintType; use App\Form\Filters\Constraints\TextConstraintType; +use App\Form\Filters\Constraints\UserEntityConstraintType; use Svg\Tag\Text; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CollectionType; @@ -227,6 +228,10 @@ class PartFilterType extends AbstractType 'label' => 'part.filter.lotDescription', ]); + $builder->add('lotOwner', UserEntityConstraintType::class, [ + 'label' => 'part.filter.lotOwner', + ]); + /** * Attachments count */ diff --git a/templates/parts/lists/_filter.html.twig b/templates/parts/lists/_filter.html.twig index 4c40cd09..b2a2d712 100644 --- a/templates/parts/lists/_filter.html.twig +++ b/templates/parts/lists/_filter.html.twig @@ -66,6 +66,7 @@ {{ form_row(filterForm.lotCount) }} {{ form_row(filterForm.lotExpirationDate) }} {{ form_row(filterForm.lotDescription) }} + {{ form_row(filterForm.lotOwner) }} {{ form_row(filterForm.lotNeedsRefill) }} {{ form_row(filterForm.lotUnknownAmount) }} diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index f436a5e1..c92e8a6f 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -11277,5 +11277,11 @@ Element 3 + + + part.filter.lotOwner + Lot owner + +