mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-16 14:39:37 +00:00
Allow to set stocktake date for part lots
This commit is contained in:
parent
e5231e29f2
commit
2f9601364e
6 changed files with 53 additions and 25 deletions
|
|
@ -68,6 +68,9 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
|
||||||
move:
|
move:
|
||||||
label: "perm.parts_stock.move"
|
label: "perm.parts_stock.move"
|
||||||
apiTokenRole: ROLE_API_EDIT
|
apiTokenRole: ROLE_API_EDIT
|
||||||
|
stocktake:
|
||||||
|
label: "perm.parts_stock.stocktake"
|
||||||
|
apiTokenRole: ROLE_API_EDIT
|
||||||
|
|
||||||
|
|
||||||
storelocations: &PART_CONTAINING
|
storelocations: &PART_CONTAINING
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ use App\Form\Type\StructuralEntityType;
|
||||||
use App\Form\Type\UserSelectType;
|
use App\Form\Type\UserSelectType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
@ -110,6 +111,14 @@ class PartLotType extends AbstractType
|
||||||
//Do not remove whitespace chars on the beginning and end of the string
|
//Do not remove whitespace chars on the beginning and end of the string
|
||||||
'trim' => false,
|
'trim' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$builder->add('last_stocktake_at', DateTimeType::class, [
|
||||||
|
'label' => 'part_lot.edit.last_stocktake_at',
|
||||||
|
'widget' => 'single_text',
|
||||||
|
'disabled' => !$this->security->isGranted('@parts_stock.stocktake'),
|
||||||
|
'required' => false,
|
||||||
|
'empty_data' => null,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver): void
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
|
|
||||||
|
|
@ -58,13 +58,13 @@ final class PartLotVoter extends Voter
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected const ALLOWED_PERMS = ['read', 'edit', 'create', 'delete', 'show_history', 'revert_element', 'withdraw', 'add', 'move'];
|
protected const ALLOWED_PERMS = ['read', 'edit', 'create', 'delete', 'show_history', 'revert_element', 'withdraw', 'add', 'move', 'stocktake'];
|
||||||
|
|
||||||
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token, ?Vote $vote = null): bool
|
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token, ?Vote $vote = null): bool
|
||||||
{
|
{
|
||||||
$user = $this->helper->resolveUser($token);
|
$user = $this->helper->resolveUser($token);
|
||||||
|
|
||||||
if (in_array($attribute, ['withdraw', 'add', 'move'], true))
|
if (in_array($attribute, ['withdraw', 'add', 'move', 'stocktake'], true))
|
||||||
{
|
{
|
||||||
$base_permission = $this->helper->isGranted($token, 'parts_stock', $attribute, $vote);
|
$base_permission = $this->helper->isGranted($token, 'parts_stock', $attribute, $vote);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@
|
||||||
{{ form_row(form.comment) }}
|
{{ form_row(form.comment) }}
|
||||||
{{ form_row(form.owner) }}
|
{{ form_row(form.owner) }}
|
||||||
{{ form_row(form.user_barcode) }}
|
{{ form_row(form.user_barcode) }}
|
||||||
|
{{ form_row(form.last_stocktake_at) }}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
||||||
|
|
@ -19,53 +19,56 @@
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for lot in part.partLots %}
|
{% for lot in part.partLots %}
|
||||||
|
{# @var lot App\Entity\Parts\PartLot #}
|
||||||
<tr {% if lot.id == highlightLotId %}class="table-primary row-highlight row-pulse"{% endif %}>
|
<tr {% if lot.id == highlightLotId %}class="table-primary row-highlight row-pulse"{% endif %}>
|
||||||
<td>{{ lot.description }}</td>
|
<td>{{ lot.description }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if lot.storageLocation %}
|
{% if lot.storageLocation %}
|
||||||
{{ helper.structural_entity_link(lot.storageLocation) }}
|
{{ helper.structural_entity_link(lot.storageLocation) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="badge rounded-pill bg-warning">
|
<span class="badge rounded-pill text-bg-warning">
|
||||||
<i class="fas fa-question-circle fa-fw"></i> {% trans %}part_lots.location_unknown{% endtrans %}
|
<i class="fas fa-question-circle fa-fw"></i> {% trans %}part_lots.location_unknown{% endtrans %}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if lot.instockUnknown %}
|
{% if lot.instockUnknown %}
|
||||||
<span class="badge rounded-pill bg-warning">
|
<span class="badge rounded-pill text-bg-warning">
|
||||||
<i class="fas fa-question-circle fa-fw"></i> {% trans %}part_lots.instock_unknown{% endtrans %}
|
<i class="fas fa-question-circle fa-fw"></i> {% trans %}part_lots.instock_unknown{% endtrans %}
|
||||||
</span>
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ lot.amount | format_amount(part.partUnit, {'decimals': 5}) }}
|
{{ lot.amount | format_amount(part.partUnit, {'decimals': 5}) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="d-flex flex-column align-items-start">
|
||||||
<h6>
|
{% if lot.owner %}
|
||||||
{% if lot.owner %}
|
<span class="badge text-bg-light mb-1" title="{% trans %}part_lot.owner{% endtrans %}">
|
||||||
<span class="badge bg-body-tertiary mb-1" title="{% trans %}part_lot.owner{% endtrans %}">
|
|
||||||
{{ helper.user_icon_link(lot.owner) }}
|
{{ helper.user_icon_link(lot.owner) }}
|
||||||
</span><br>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if lot.expirationDate %}
|
{% if lot.expirationDate %}
|
||||||
<span class="badge bg-info mb-1" title="{% trans %}part_lots.expiration_date{% endtrans %}">
|
<span class="badge text-bg-info mb-1" title="{% trans %}part_lots.expiration_date{% endtrans %}">
|
||||||
<i class="fas fa-calendar-alt fa-fw"></i> {{ lot.expirationDate | format_date() }}<br>
|
<i class="fas fa-calendar-alt fa-fw"></i> {{ lot.expirationDate | format_date() }}<br>
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if lot.expired %}
|
{% if lot.expired %}
|
||||||
<br>
|
<span class="badge text-bg-warning mb-1">
|
||||||
<span class="badge bg-warning mb-1">
|
|
||||||
<i class="fas fa-exclamation-circle fa-fw"></i>
|
<i class="fas fa-exclamation-circle fa-fw"></i>
|
||||||
{% trans %}part_lots.is_expired{% endtrans %}
|
{% trans %}part_lots.is_expired{% endtrans %}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if lot.needsRefill %}
|
{% if lot.needsRefill %}
|
||||||
<br>
|
<span class="badge text-bg-warning mb-1">
|
||||||
<span class="badge bg-warning mb-1">
|
<i class="fas fa-dolly fa-fw"></i>
|
||||||
<i class="fas fa-dolly fa-fw"></i>
|
{% trans %}part_lots.need_refill{% endtrans %}
|
||||||
{% trans %}part_lots.need_refill{% endtrans %}
|
</span>
|
||||||
</span>
|
{% endif %}
|
||||||
{% endif %}
|
{% if lot.lastStocktakeAt %}
|
||||||
</h6>
|
<span class="badge text-bg-secondary" title="{% trans %}part_lot.edit.last_stocktake_at{% endtrans %}">
|
||||||
|
<i class="fas fa-clipboard-check fa-fw"></i>
|
||||||
|
{{ lot.lastStocktakeAt | format_datetime("short") }}
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group" role="group">
|
<div class="btn-group" role="group">
|
||||||
|
|
|
||||||
|
|
@ -12467,5 +12467,17 @@ Buerklin-API Authentication server:
|
||||||
<target>The default value for newly created purchase infos, if prices include VAT or not.</target>
|
<target>The default value for newly created purchase infos, if prices include VAT or not.</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
|
<unit id="heWSnAH" name="part_lot.edit.last_stocktake_at">
|
||||||
|
<segment>
|
||||||
|
<source>part_lot.edit.last_stocktake_at</source>
|
||||||
|
<target>Last stocktake</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id=".LP93kG" name="perm.parts_stock.stocktake">
|
||||||
|
<segment>
|
||||||
|
<source>perm.parts_stock.stocktake</source>
|
||||||
|
<target>Stocktake</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue