mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Added some more constraints for part lots.
This commit is contained in:
parent
5402d3b031
commit
22eb6601e8
5 changed files with 76 additions and 3 deletions
|
@ -77,6 +77,15 @@ class PartFilter implements FilterInterface
|
|||
/** @var IntConstraint */
|
||||
protected $lotCount;
|
||||
|
||||
/** @var BooleanConstraint */
|
||||
protected $lotNeedsRefill;
|
||||
|
||||
/** @var BooleanConstraint */
|
||||
protected $lotUnknownAmount;
|
||||
|
||||
/** @var DateTimeConstraint */
|
||||
protected $lotExpirationDate;
|
||||
|
||||
/** @var EntityConstraint */
|
||||
protected $measurementUnit;
|
||||
|
||||
|
@ -107,7 +116,11 @@ class PartFilter implements FilterInterface
|
|||
$this->lastModified = new DateTimeConstraint('part.lastModified');
|
||||
|
||||
$this->minAmount = new NumberConstraint('part.minAmount');
|
||||
$this->lotCount = new IntConstraint('COUNT(partLots)');
|
||||
$this->supplier = new EntityConstraint($nodesListBuilder, Supplier::class, 'orderdetails.supplier');
|
||||
$this->lotNeedsRefill = new BooleanConstraint('partLots.needs_refill');
|
||||
$this->lotUnknownAmount = new BooleanConstraint('partLots.instock_unknown');
|
||||
$this->lotExpirationDate = new DateTimeConstraint('partLots.expiration_date');
|
||||
|
||||
$this->manufacturer = new EntityConstraint($nodesListBuilder, Manufacturer::class, 'part.manufacturer');
|
||||
$this->manufacturer_product_number = new TextConstraint('part.manufacturer_product_number');
|
||||
|
@ -115,7 +128,6 @@ class PartFilter implements FilterInterface
|
|||
|
||||
$this->storelocation = new EntityConstraint($nodesListBuilder, Storelocation::class, 'partLots.storage_location');
|
||||
|
||||
$this->lotCount = new IntConstraint('COUNT(partLots)');
|
||||
$this->attachmentsCount = new IntConstraint('COUNT(attachments)');
|
||||
$this->orderdetailsCount = new IntConstraint('COUNT(orderdetails)');
|
||||
}
|
||||
|
@ -287,5 +299,30 @@ class PartFilter implements FilterInterface
|
|||
return $this->attachmentsCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BooleanConstraint
|
||||
*/
|
||||
public function getLotNeedsRefill(): BooleanConstraint
|
||||
{
|
||||
return $this->lotNeedsRefill;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BooleanConstraint
|
||||
*/
|
||||
public function getLotUnknownAmount(): BooleanConstraint
|
||||
{
|
||||
return $this->lotUnknownAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DateTimeConstraint
|
||||
*/
|
||||
public function getLotExpirationDate(): DateTimeConstraint
|
||||
{
|
||||
return $this->lotExpirationDate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ class DateTimeConstraintType extends AbstractType
|
|||
|
||||
'value1_options' => [], // Options for the first value input
|
||||
'value2_options' => [], // Options for the second value input
|
||||
'input_type' => DateTimeType::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -40,7 +41,7 @@ class DateTimeConstraintType extends AbstractType
|
|||
'filter.number_constraint.value.operator.BETWEEN' => 'BETWEEN',
|
||||
];
|
||||
|
||||
$builder->add('value1', DateTimeType::class, array_merge_recursive([
|
||||
$builder->add('value1', $options['input_type'], array_merge_recursive([
|
||||
'label' => 'filter.datetime_constraint.value1',
|
||||
'attr' => [
|
||||
'placeholder' => 'filter.datetime_constraint.value1',
|
||||
|
@ -50,7 +51,7 @@ class DateTimeConstraintType extends AbstractType
|
|||
'widget' => 'single_text',
|
||||
], $options['value1_options']));
|
||||
|
||||
$builder->add('value2', DateTimeType::class, array_merge_recursive([
|
||||
$builder->add('value2', $options['input_type'], array_merge_recursive([
|
||||
'label' => 'filter.datetime_constraint.value2',
|
||||
'attr' => [
|
||||
'placeholder' => 'filter.datetime_constraint.value2',
|
||||
|
|
|
@ -17,6 +17,7 @@ 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\DateType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ResetType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
@ -156,6 +157,19 @@ class PartFilterType extends AbstractType
|
|||
'step' => 1,
|
||||
]);
|
||||
|
||||
$builder->add('lotNeedsRefill', BooleanConstraintType::class, [
|
||||
'label' => 'part.filter.lotNeedsRefill'
|
||||
]);
|
||||
|
||||
$builder->add('lotUnknownAmount', BooleanConstraintType::class, [
|
||||
'label' => 'part.filter.lotUnknwonAmount'
|
||||
]);
|
||||
|
||||
$builder->add('lotExpirationDate', DateTimeConstraintType::class, [
|
||||
'label' => 'part.filter.lotExpirationDate',
|
||||
'input_type' => DateType::class,
|
||||
]);
|
||||
|
||||
/**
|
||||
* Attachments count
|
||||
*/
|
||||
|
|
|
@ -54,6 +54,9 @@
|
|||
{{ form_row(filterForm.storelocation) }}
|
||||
{{ form_row(filterForm.minAmount) }}
|
||||
{{ form_row(filterForm.lotCount) }}
|
||||
{{ form_row(filterForm.lotExpirationDate) }}
|
||||
{{ form_row(filterForm.lotNeedsRefill) }}
|
||||
{{ form_row(filterForm.lotUnknownAmount) }}
|
||||
</div>
|
||||
|
||||
<div class="tab-pane pt-3" id="filter-attachments" role="tabpanel" aria-labelledby="filter-attachments-tab" tabindex="0">
|
||||
|
|
|
@ -9477,5 +9477,23 @@ Element 3</target>
|
|||
<target>Number of orderdetails</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="QnS490v" name="part.filter.lotExpirationDate">
|
||||
<segment>
|
||||
<source>part.filter.lotExpirationDate</source>
|
||||
<target>Lot expiration date</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="fIZmzas" name="part.filter.lotNeedsRefill">
|
||||
<segment>
|
||||
<source>part.filter.lotNeedsRefill</source>
|
||||
<target>Any lot needs refill</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="_ERegGt" name="part.filter.lotUnknwonAmount">
|
||||
<segment>
|
||||
<source>part.filter.lotUnknwonAmount</source>
|
||||
<target>Any lot has unknown amount</target>
|
||||
</segment>
|
||||
</unit>
|
||||
</file>
|
||||
</xliff>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue