From ec49a83659e82e9d3ceb1513b2e5d4c3c01fad94 Mon Sep 17 00:00:00 2001 From: Marcel Diegelmann Date: Fri, 10 Oct 2025 14:15:18 +0200 Subject: [PATCH] =?UTF-8?q?PartCustomState:=20Darstellung=20und=20Zuordnun?= =?UTF-8?q?g=20von=20Anh=C3=A4ngen=20erg=C3=A4nzt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Die Sidebar wurde um die Anzeige des benutzerdefinierten Bauteilstatus erweitert, inklusive Vorschaubild, sofern vorhanden. --- .../Attachments/AttachmentSubmitHandler.php | 2 ++ src/Services/Attachments/PartPreviewGenerator.php | 7 ------- templates/parts/info/_sidebar.html.twig | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/Services/Attachments/AttachmentSubmitHandler.php b/src/Services/Attachments/AttachmentSubmitHandler.php index 9fbc3fe3..c7e69257 100644 --- a/src/Services/Attachments/AttachmentSubmitHandler.php +++ b/src/Services/Attachments/AttachmentSubmitHandler.php @@ -30,6 +30,7 @@ use App\Entity\Attachments\AttachmentUpload; use App\Entity\Attachments\CategoryAttachment; use App\Entity\Attachments\CurrencyAttachment; use App\Entity\Attachments\LabelAttachment; +use App\Entity\Attachments\PartCustomStateAttachment; use App\Entity\Attachments\ProjectAttachment; use App\Entity\Attachments\FootprintAttachment; use App\Entity\Attachments\GroupAttachment; @@ -80,6 +81,7 @@ class AttachmentSubmitHandler //The mapping used to determine which folder will be used for an attachment type $this->folder_mapping = [ PartAttachment::class => 'part', + PartCustomStateAttachment::class => 'part_custom_state', AttachmentTypeAttachment::class => 'attachment_type', CategoryAttachment::class => 'category', CurrencyAttachment::class => 'currency', diff --git a/src/Services/Attachments/PartPreviewGenerator.php b/src/Services/Attachments/PartPreviewGenerator.php index ef13265f..9aedba74 100644 --- a/src/Services/Attachments/PartPreviewGenerator.php +++ b/src/Services/Attachments/PartPreviewGenerator.php @@ -104,13 +104,6 @@ class PartPreviewGenerator } } - if ($part->getPartCustomState() instanceof PartCustomState) { - $attachment = $part->getPartCustomState()->getMasterPictureAttachment(); - if ($this->isAttachmentValidPicture($attachment)) { - $list[] = $attachment; - } - } - if ($part->getManufacturer() instanceof Manufacturer) { $attachment = $part->getManufacturer()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { diff --git a/templates/parts/info/_sidebar.html.twig b/templates/parts/info/_sidebar.html.twig index 28eada04..0c353d8f 100644 --- a/templates/parts/info/_sidebar.html.twig +++ b/templates/parts/info/_sidebar.html.twig @@ -36,6 +36,19 @@ {% endif %} +{% if part.partCustomState is not null %} +
+
+ {{ part.partCustomState.name }} + + {% if part.partCustomState is not null and part.partCustomState.masterPictureAttachment and attachment_manager.fileExisting(part.partCustomState.masterPictureAttachment) %} +
+ {% trans %}attachment.preview.alt{% endtrans %} + {% endif %} +
+
+{% endif %} + {# Favorite Status tag #} {% if part.favorite %}
@@ -79,4 +92,4 @@
-{% endif %} \ No newline at end of file +{% endif %}