@foreach ($attachments as $index => $attachment)
@php
$isImage = str_starts_with($attachment->mime_type ?? '', 'image/');
$thumbUrl = $isImage ? asset('storage/' . $attachment->file_path) : null;
$fileUrl = $isImage ? $thumbUrl : route('attachments.download', $attachment);
@endphp
@if ($isImage)

@else
{{ strtoupper(pathinfo($attachment->file_name, PATHINFO_EXTENSION) ?: 'FILE') }}
@endif
@if (! empty($deletePermission) && auth()->user()?->can($deletePermission))
@endif
@endforeach