diff --git a/src/DataTables/Helpers/PartDataTableHelper.php b/src/DataTables/Helpers/PartDataTableHelper.php index 37737052..90255835 100644 --- a/src/DataTables/Helpers/PartDataTableHelper.php +++ b/src/DataTables/Helpers/PartDataTableHelper.php @@ -57,6 +57,10 @@ class PartDataTableHelper if ($context->isNeedsReview()) { $icon = sprintf('', $this->translator->trans('part.needs_review.badge')); } + if ($context->getBuiltProject() !== null) { + $icon = sprintf('', + $this->translator->trans('part.info.projectBuildPart.hint') . ': ' . $context->getBuiltProject()->getName()); + } return sprintf( diff --git a/src/Services/Attachments/PartPreviewGenerator.php b/src/Services/Attachments/PartPreviewGenerator.php index d47e873c..39d1c65c 100644 --- a/src/Services/Attachments/PartPreviewGenerator.php +++ b/src/Services/Attachments/PartPreviewGenerator.php @@ -62,6 +62,13 @@ class PartPreviewGenerator } } + if (null !== $part->getBuiltProject()) { + $attachment = $part->getBuiltProject()->getMasterPictureAttachment(); + if ($this->isAttachmentValidPicture($attachment)) { + $list[] = $attachment; + } + } + if (null !== $part->getCategory()) { $attachment = $part->getCategory()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { @@ -109,7 +116,7 @@ class PartPreviewGenerator return $attachment; } - //Otherwise check if the part has a footprint with a valid masterattachment + //Otherwise check if the part has a footprint with a valid master attachment if (null !== $part->getFootprint()) { $attachment = $part->getFootprint()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { @@ -117,6 +124,14 @@ class PartPreviewGenerator } } + //With lowest priority use the master attachment of the project this part represents (when existing) + if (null !== $part->getBuiltProject()) { + $attachment = $part->getBuiltProject()->getMasterPictureAttachment(); + if ($this->isAttachmentValidPicture($attachment)) { + return $attachment; + } + } + //If nothing is available return null return null; } diff --git a/templates/Parts/info/_extended_infos.html.twig b/templates/Parts/info/_extended_infos.html.twig index fec3d5c9..e0bb01d7 100644 --- a/templates/Parts/info/_extended_infos.html.twig +++ b/templates/Parts/info/_extended_infos.html.twig @@ -37,14 +37,20 @@