feat: add download button to partner document infolist for images

This commit is contained in:
Yoga Pangestu 2026-04-09 12:58:30 +07:00
parent 029d92e4a6
commit 2bd0b200e3

View File

@ -111,15 +111,28 @@ public static function configure(Schema $schema): Schema
$url = $media->getUrl(); $url = $media->getUrl();
$mime = $media->mime_type; $mime = $media->mime_type;
$downloadLink = '<a href="'.$url.'" download target="_blank" class="mt-2 flex items-center gap-1 text-sm font-medium text-primary-600 transition hover:text-primary-500">
<svg class="h-4 w-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3" />
</svg>
Unduh Dokumen
</a>';
if (str_contains($mime, 'image')) { if (str_contains($mime, 'image')) {
return '<img src="'.$url.'" alt="Dokumen NIK Direktur" style="max-width: 100%; height: auto; border-radius: 0.5rem;" />'; return '<div class="flex flex-col">'.
'<img src="'.$url.'" alt="Dokumen NIK Direktur" style="max-width: 100%; height: auto; border-radius: 0.5rem;" />'.
$downloadLink.
'</div>';
} }
if (str_contains($mime, 'pdf')) { if (str_contains($mime, 'pdf')) {
return '<iframe src="'.$url.'" style="width: 100%; height: 500px; border: none;"></iframe>'; return '<div class="flex flex-col">'.
'<iframe src="'.$url.'" style="width: 100%; height: 500px; border: none; border-radius: 0.5rem;"></iframe>'.
$downloadLink.
'</div>';
} }
return '<a href="'.$url.'" target="_blank" class="text-primary-600 hover:text-primary-500 underline">Unduh Dokumen</a>'; return $downloadLink;
}), }),
]), ]),