diff --git a/src/Form/Part/PartLotType.php b/src/Form/Part/PartLotType.php index 2e23c94a..2c46df1a 100644 --- a/src/Form/Part/PartLotType.php +++ b/src/Form/Part/PartLotType.php @@ -27,6 +27,7 @@ use App\Entity\Parts\PartLot; use App\Entity\Parts\Storelocation; use App\Form\Type\SIUnitType; use App\Form\Type\StructuralEntityType; +use App\Form\Type\UserSelectType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\DateType; @@ -98,6 +99,12 @@ class PartLotType extends AbstractType 'required' => false, 'empty_data' => '', ]); + + $builder->add('owner', UserSelectType::class, [ + 'label' => 'part_lot.owner', + 'required' => false, + 'help' => 'part_lot.owner.help', + ]); } public function configureOptions(OptionsResolver $resolver): void diff --git a/templates/helper.twig b/templates/helper.twig index 1957864f..137dd792 100644 --- a/templates/helper.twig +++ b/templates/helper.twig @@ -159,11 +159,7 @@ {% endif %} {% if user is not null %} - {% if user.fullName is not empty %} - ({{ _self.user_icon(user) }} {{ user.fullName }}) - {% else %} - ({{ _self.user_icon(user) }} @{{ user.name }}) - {% endif %} + ({{ _self.user_icon_link(user) }}) {% endif %} {% endif %} {% endmacro %} @@ -180,6 +176,14 @@ User avatar {% endmacro %} +{% macro user_icon_link(user) %} + {% if user.fullName is not empty %} + {{ _self.user_icon(user) }} {{ user.fullName }} + {% else %} + {{ _self.user_icon(user) }} @{{ user.name }} + {% endif %} +{% endmacro %} + {% macro entity_preview_sm(entity) %} {# @var entity \App\Entity\Contracts\HasMasterAttachmentInterface #} {% if entity.masterPictureAttachment and entity.masterPictureAttachment.picture and attachment_manager.fileExisting(entity.masterPictureAttachment) %} diff --git a/templates/parts/info/_part_lots.html.twig b/templates/parts/info/_part_lots.html.twig index e6d8637f..1d11b1a4 100644 --- a/templates/parts/info/_part_lots.html.twig +++ b/templates/parts/info/_part_lots.html.twig @@ -41,21 +41,26 @@
+ {% if lot.owner %} + + {{ helper.user_icon_link(lot.owner) }} +
+ {% endif %} {% if lot.expirationDate %} - - {{ lot.expirationDate | format_date() }} + + {{ lot.expirationDate | format_date() }}
{% endif %} {% if lot.expired %}
- + {% trans %}part_lots.is_expired{% endtrans %} {% endif %} {% if lot.needsRefill %}
- + {% trans %}part_lots.need_refill{% endtrans %} diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index 637e578a..02057ea9 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -11217,5 +11217,17 @@ Element 3 Part Lot owner must match storage location owner + + + part_lot.owner + Owner + + + + + part_lot.owner.help + Only the owner can withdraw or add stock to this lot. + +