mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-29 21:14:29 +02:00
Added more filters
This commit is contained in:
parent
c9151c65ba
commit
ff5b59e25d
4 changed files with 253 additions and 12 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue