mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Allow to set and view the owner of a part lot
This commit is contained in:
parent
5f5541ca12
commit
447b54fa4b
4 changed files with 37 additions and 9 deletions
|
@ -27,6 +27,7 @@ use App\Entity\Parts\PartLot;
|
||||||
use App\Entity\Parts\Storelocation;
|
use App\Entity\Parts\Storelocation;
|
||||||
use App\Form\Type\SIUnitType;
|
use App\Form\Type\SIUnitType;
|
||||||
use App\Form\Type\StructuralEntityType;
|
use App\Form\Type\StructuralEntityType;
|
||||||
|
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\DateType;
|
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||||
|
@ -98,6 +99,12 @@ class PartLotType extends AbstractType
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$builder->add('owner', UserSelectType::class, [
|
||||||
|
'label' => 'part_lot.owner',
|
||||||
|
'required' => false,
|
||||||
|
'help' => 'part_lot.owner.help',
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver): void
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
|
|
@ -159,11 +159,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if user is not null %}
|
{% if user is not null %}
|
||||||
{% if user.fullName is not empty %}
|
({{ _self.user_icon_link(user) }})
|
||||||
({{ _self.user_icon(user) }} <a href="{{ path('user_info', {"id": user.id}) }}" title="@{{ user.name }}">{{ user.fullName }}</a>)
|
|
||||||
{% else %}
|
|
||||||
({{ _self.user_icon(user) }} <a href="{{ path('user_info', {"id": user.id}) }}" title="@{{ user.name }}">@{{ user.name }}</a>)
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
@ -180,6 +176,14 @@
|
||||||
<img src="{{ avatar_helper.avatarSmURL(user) }}" class="avatar-xs" alt="User avatar" {{ stimulus_controller('elements/hoverpic') }} data-thumbnail="{{ avatar_helper.avatarMdURL(user) }}">
|
<img src="{{ avatar_helper.avatarSmURL(user) }}" class="avatar-xs" alt="User avatar" {{ stimulus_controller('elements/hoverpic') }} data-thumbnail="{{ avatar_helper.avatarMdURL(user) }}">
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro user_icon_link(user) %}
|
||||||
|
{% if user.fullName is not empty %}
|
||||||
|
{{ _self.user_icon(user) }} <a href="{{ path('user_info', {"id": user.id}) }}" title="@{{ user.name }}">{{ user.fullName }}</a>
|
||||||
|
{% else %}
|
||||||
|
{{ _self.user_icon(user) }} <a href="{{ path('user_info', {"id": user.id}) }}" title="@{{ user.name }}">@{{ user.name }}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro entity_preview_sm(entity) %}
|
{% macro entity_preview_sm(entity) %}
|
||||||
{# @var entity \App\Entity\Contracts\HasMasterAttachmentInterface #}
|
{# @var entity \App\Entity\Contracts\HasMasterAttachmentInterface #}
|
||||||
{% if entity.masterPictureAttachment and entity.masterPictureAttachment.picture and attachment_manager.fileExisting(entity.masterPictureAttachment) %}
|
{% if entity.masterPictureAttachment and entity.masterPictureAttachment.picture and attachment_manager.fileExisting(entity.masterPictureAttachment) %}
|
||||||
|
|
|
@ -41,21 +41,26 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<h6>
|
<h6>
|
||||||
|
{% if lot.owner %}
|
||||||
|
<span class="badge bg-light mb-1" title="{% trans %}part_lot.owner{% endtrans %}">
|
||||||
|
{{ helper.user_icon_link(lot.owner) }}
|
||||||
|
</span><br>
|
||||||
|
{% endif %}
|
||||||
{% if lot.expirationDate %}
|
{% if lot.expirationDate %}
|
||||||
<span class="badge bg-info" title="{% trans %}part_lots.expiration_date{% endtrans %}">
|
<span class="badge bg-info mb-1" title="{% trans %}part_lots.expiration_date{% endtrans %}">
|
||||||
<i class="fas fa-calendar-alt fa-fw"></i> {{ lot.expirationDate | format_date() }}
|
<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>
|
<br>
|
||||||
<span class="badge bg-warning">
|
<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>
|
<br>
|
||||||
<span class="badge bg-warning">
|
<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>
|
||||||
|
|
|
@ -11217,5 +11217,17 @@ Element 3</target>
|
||||||
<target>Part Lot owner must match storage location owner</target>
|
<target>Part Lot owner must match storage location owner</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
|
<unit id="sddE1L." name="part_lot.owner">
|
||||||
|
<segment>
|
||||||
|
<source>part_lot.owner</source>
|
||||||
|
<target>Owner</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="XKIMr8j" name="part_lot.owner.help">
|
||||||
|
<segment>
|
||||||
|
<source>part_lot.owner.help</source>
|
||||||
|
<target>Only the owner can withdraw or add stock to this lot.</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue