Allow to filter by the lot owner

This commit is contained in:
Jan Böhmer 2023-04-08 00:44:34 +02:00
parent f91b719542
commit d32e902d17
4 changed files with 32 additions and 8 deletions

View file

@ -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;
}
}

View file

@ -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
*/

View file

@ -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) }}
</div>

View file

@ -11277,5 +11277,11 @@ Element 3</target>
<target><![CDATA[In stock less than desired (total amount < min. amount)]]></target>
</segment>
</unit>
<unit id="lHTN.a1" name="part.filter.lotOwner">
<segment>
<source>part.filter.lotOwner</source>
<target>Lot owner</target>
</segment>
</unit>
</file>
</xliff>