diff --git a/src/DataTables/Filters/PartFilter.php b/src/DataTables/Filters/PartFilter.php index 4fccbcc4..11725f6c 100644 --- a/src/DataTables/Filters/PartFilter.php +++ b/src/DataTables/Filters/PartFilter.php @@ -8,6 +8,11 @@ use App\DataTables\Filters\Constraints\EntityConstraint; use App\DataTables\Filters\Constraints\NumberConstraint; use App\DataTables\Filters\Constraints\TextConstraint; use App\Entity\Parts\Category; +use App\Entity\Parts\Footprint; +use App\Entity\Parts\Manufacturer; +use App\Entity\Parts\MeasurementUnit; +use App\Entity\Parts\Storelocation; +use App\Entity\Parts\Supplier; use App\Services\Trees\NodesListBuilder; use Doctrine\ORM\QueryBuilder; @@ -16,12 +21,21 @@ class PartFilter implements FilterInterface use CompoundFilterTrait; + /** @var NumberConstraint */ + protected $dbId; + /** @var TextConstraint */ protected $name; /** @var TextConstraint */ protected $description; + /** @var TextConstraint */ + protected $comment; + + /** @var NumberConstraint */ + protected $minAmount; + /** @var BooleanConstraint */ protected $favorite; @@ -40,17 +54,51 @@ class PartFilter implements FilterInterface /** @var EntityConstraint */ protected $category; + /** @var EntityConstraint */ + protected $footprint; + + /** @var EntityConstraint */ + protected $manufacturer; + + /** @var EntityConstraint */ + protected $supplier; + + /** @var EntityConstraint */ + protected $storelocation; + + /** @var EntityConstraint */ + protected $measurementUnit; + + /** @var TextConstraint */ + protected $manufacturer_product_url; + + /** @var TextConstraint */ + protected $manufacturer_product_number; + public function __construct(NodesListBuilder $nodesListBuilder) { - $this->favorite = - $this->needsReview = new BooleanConstraint('part.needs_review'); - $this->mass = new NumberConstraint('part.mass'); $this->name = new TextConstraint('part.name'); $this->description = new TextConstraint('part.description'); + $this->comment = new TextConstraint('part.comment'); + $this->category = new EntityConstraint($nodesListBuilder, Category::class, 'part.category'); + $this->footprint = new EntityConstraint($nodesListBuilder, Footprint::class, 'part.footprint'); + + $this->favorite = new BooleanConstraint('part.favorite'); + $this->needsReview = new BooleanConstraint('part.needs_review'); + $this->measurementUnit = new EntityConstraint($nodesListBuilder, MeasurementUnit::class, 'part.partUnit'); + $this->mass = new NumberConstraint('part.mass'); + $this->dbId = new NumberConstraint('part.id'); $this->addedDate = new DateTimeConstraint('part.addedDate'); $this->lastModified = new DateTimeConstraint('part.lastModified'); - $this->category = new EntityConstraint($nodesListBuilder, Category::class, 'part.category'); + $this->minAmount = new NumberConstraint('part.minAmount'); + $this->supplier = new EntityConstraint($nodesListBuilder, Supplier::class, 'orderdetails.supplier'); + + $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->storelocation = new EntityConstraint($nodesListBuilder, Storelocation::class, 'partLots.storage_location'); } public function apply(QueryBuilder $queryBuilder): void @@ -110,4 +158,88 @@ class PartFilter implements FilterInterface { return $this->category; } + + /** + * @return EntityConstraint + */ + public function getFootprint(): EntityConstraint + { + return $this->footprint; + } + + /** + * @return EntityConstraint + */ + public function getManufacturer(): EntityConstraint + { + return $this->manufacturer; + } + + /** + * @return EntityConstraint + */ + public function getSupplier(): EntityConstraint + { + return $this->supplier; + } + + /** + * @return EntityConstraint + */ + public function getStorelocation(): EntityConstraint + { + return $this->storelocation; + } + + /** + * @return EntityConstraint + */ + public function getMeasurementUnit(): EntityConstraint + { + return $this->measurementUnit; + } + + /** + * @return NumberConstraint + */ + public function getDbId(): NumberConstraint + { + return $this->dbId; + } + + /** + * @return TextConstraint + */ + public function getComment(): TextConstraint + { + return $this->comment; + } + + /** + * @return NumberConstraint + */ + public function getMinAmount(): NumberConstraint + { + return $this->minAmount; + } + + /** + * @return TextConstraint + */ + public function getManufacturerProductUrl(): TextConstraint + { + return $this->manufacturer_product_url; + } + + /** + * @return TextConstraint + */ + public function getManufacturerProductNumber(): TextConstraint + { + return $this->manufacturer_product_number; + } + + + + } diff --git a/src/Form/Filters/PartFilterType.php b/src/Form/Filters/PartFilterType.php index 6c63cc15..b5e4186a 100644 --- a/src/Form/Filters/PartFilterType.php +++ b/src/Form/Filters/PartFilterType.php @@ -4,11 +4,16 @@ namespace App\Form\Filters; use App\DataTables\Filters\PartFilter; use App\Entity\Parts\Category; +use App\Entity\Parts\Footprint; +use App\Entity\Parts\Manufacturer; +use App\Entity\Parts\MeasurementUnit; +use App\Entity\Parts\Storelocation; use App\Form\Filters\Constraints\BooleanConstraintType; use App\Form\Filters\Constraints\DateTimeConstraintType; use App\Form\Filters\Constraints\NumberConstraintType; use App\Form\Filters\Constraints\StructuralEntityConstraintType; use App\Form\Filters\Constraints\TextConstraintType; +use Svg\Tag\Text; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\DateTimeType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; @@ -29,11 +34,41 @@ class PartFilterType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { + /* + * Common tab + */ + + $builder->add('name', TextConstraintType::class, [ + 'label' => 'part.edit.name', + ]); + + $builder->add('description', TextConstraintType::class, [ + 'label' => 'part.edit.description', + ]); + $builder->add('category', StructuralEntityConstraintType::class, [ 'label' => 'part.edit.category', 'entity_class' => Category::class ]); + $builder->add('footprint', StructuralEntityConstraintType::class, [ + 'label' => 'part.edit.footprint', + 'entity_class' => Footprint::class + ]); + + $builder->add('comment', TextConstraintType::class, [ + 'label' => 'part.edit.comment' + ]); + + /* + * Advanced tab + */ + + $builder->add('dbId', NumberConstraintType::class, [ + 'label' => 'part.filter.dbId', + 'min' => 1, + ]); + $builder->add('favorite', BooleanConstraintType::class, [ 'label' => 'part.edit.is_favorite' ]); @@ -48,12 +83,9 @@ class PartFilterType extends AbstractType 'min' => 0, ]); - $builder->add('name', TextConstraintType::class, [ - 'label' => 'part.edit.name', - ]); - - $builder->add('description', TextConstraintType::class, [ - 'label' => 'part.edit.description', + $builder->add('measurementUnit', StructuralEntityConstraintType::class, [ + 'label' => 'part.edit.partUnit', + 'entity_class' => MeasurementUnit::class ]); $builder->add('lastModified', DateTimeConstraintType::class, [ @@ -65,6 +97,47 @@ class PartFilterType extends AbstractType ]); + /* + * Manufacturer tab + */ + + $builder->add('manufacturer', StructuralEntityConstraintType::class, [ + 'label' => 'part.edit.manufacturer.label', + 'entity_class' => Manufacturer::class + ]); + + $builder->add('manufacturer_product_url', TextConstraintType::class, [ + 'label' => 'part.edit.manufacturer_url.label' + ]); + + $builder->add('manufacturer_product_number', TextConstraintType::class, [ + 'label' => 'part.edit.mpn' + ]); + + /* + * Purchasee informations + */ + + $builder->add('supplier', StructuralEntityConstraintType::class, [ + 'label' => 'supplier.label', + 'entity_class' => Manufacturer::class + ]); + + + /* + * Stocks tabs + */ + $builder->add('storelocation', StructuralEntityConstraintType::class, [ + 'label' => 'storelocation.label', + 'entity_class' => Storelocation::class + ]); + + $builder->add('minAmount', NumberConstraintType::class, [ + 'label' => 'part.edit.mininstock', + 'min' => 0, + ]); + + $builder->add('submit', SubmitType::class, [ 'label' => 'Update', ]); diff --git a/templates/Parts/lists/_filter.html.twig b/templates/Parts/lists/_filter.html.twig index 825ab339..833c61bb 100644 --- a/templates/Parts/lists/_filter.html.twig +++ b/templates/Parts/lists/_filter.html.twig @@ -3,10 +3,19 @@
@@ -16,16 +25,37 @@
{{ form_row(filterForm.name) }} {{ form_row(filterForm.description) }} + {{ form_row(filterForm.category) }} + {{ form_row(filterForm.footprint) }} + {{ form_row(filterForm.comment) }} +
+ +
+ {{ form_row(filterForm.manufacturer) }} + {{ form_row(filterForm.manufacturer_product_number) }} + {{ form_row(filterForm.manufacturer_product_url) }}
{{ form_row(filterForm.favorite) }} {{ form_row(filterForm.needsReview) }} + {{ form_row(filterForm.measurementUnit) }} {{ form_row(filterForm.mass) }} + {{ form_row(filterForm.dbId) }} {{ form_row(filterForm.lastModified) }} {{ form_row(filterForm.addedDate) }}
+
+ {{ form_row(filterForm.storelocation) }} + {{ form_row(filterForm.minAmount) }} +
+ +
+ {{ form_row(filterForm.supplier) }} +
+ +
diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index fe581953..012f926d 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -9435,5 +9435,11 @@ Element 3 Is not (excluding children) + + + part.filter.dbId + Database ID + +