mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-19 01:19:31 +00:00
First order details draft
This commit is contained in:
parent
1a0fab0615
commit
62754bdbf3
13 changed files with 170 additions and 7 deletions
|
|
@ -48,9 +48,9 @@ class LessThanDesiredConstraint extends BooleanConstraint
|
|||
|
||||
//If value is true, we want to filter for parts with stock < desired stock
|
||||
if ($this->value) {
|
||||
$queryBuilder->andHaving( $this->property . ' < part.minamount');
|
||||
$queryBuilder->andHaving($this->property . ' + part.orderamount < part.minamount');
|
||||
} else {
|
||||
$queryBuilder->andHaving($this->property . ' >= part.minamount');
|
||||
$queryBuilder->andHaving($this->property . ' + part.orderamount >= part.minamount');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ class PartFilter implements FilterInterface
|
|||
public readonly TextConstraint $comment;
|
||||
public readonly TagsConstraint $tags;
|
||||
public readonly NumberConstraint $minAmount;
|
||||
public readonly NumberConstraint $orderAmount;
|
||||
public readonly DateTimeConstraint $orderDelivery;
|
||||
public readonly BooleanConstraint $favorite;
|
||||
public readonly BooleanConstraint $needsReview;
|
||||
public readonly NumberConstraint $mass;
|
||||
|
|
@ -124,6 +126,8 @@ class PartFilter implements FilterInterface
|
|||
$this->lastModified = new DateTimeConstraint('part.lastModified');
|
||||
|
||||
$this->minAmount = new NumberConstraint('part.minamount');
|
||||
$this->orderAmount = new NumberConstraint('part.orderamount');
|
||||
$this->orderDelivery = new DateTimeConstraint('part.orderDelivery');
|
||||
/* We have to use an IntConstraint here because otherwise we get just an empty result list when applying the filter
|
||||
This seems to be related to the fact, that PDO does not have an float parameter type and using string type does not work in this situation (at least in SQLite)
|
||||
TODO: Find a better solution here
|
||||
|
|
|
|||
|
|
@ -155,6 +155,15 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
'render' => fn($value, Part $context): string => htmlspecialchars($this->amountFormatter->format($value,
|
||||
$context->getPartUnit())),
|
||||
])
|
||||
->add('orderamount', TextColumn::class, [
|
||||
'label' => $this->translator->trans('part.table.orderamount'),
|
||||
'render' => fn($value, Part $context): string => htmlspecialchars($this->amountFormatter->format($value,
|
||||
$context->getPartUnit())),
|
||||
])
|
||||
->add('orderDelivery', LocaleDateTimeColumn::class, [
|
||||
'label' => $this->translator->trans('part.table.orderDelivery'),
|
||||
'timeFormat' => 'none',
|
||||
])
|
||||
->add('partUnit', TextColumn::class, [
|
||||
'label' => $this->translator->trans('part.table.partUnit'),
|
||||
'orderField' => 'NATSORT(_partUnit.name)',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue