Display attachments in ticket messages with view and download options

This commit is contained in:
2025-12-07 06:48:24 -05:00
parent 16c61494c8
commit eb44e03340

View File

@@ -29,6 +29,46 @@
'soft_break' => "<br>" 'soft_break' => "<br>"
] ]
]) !!}</div> ]) !!}</div>
{{-- Display Attachments --}}
@if($message->attachments && count($message->attachments) > 0)
<div class="mt-4 pt-4 border-t border-gray-200 dark:border-gray-700">
<p class="text-sm font-medium text-gray-500 dark:text-gray-400 mb-3 flex items-center gap-2">
<x-heroicon-o-paper-clip class="w-4 h-4" />
Attachments ({{ count($message->attachments) }})
</p>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
@foreach($message->attachments as $attachment)
<div class="flex items-center gap-3 p-3 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700">
{{-- Thumbnail --}}
<div class="flex-shrink-0 w-16 h-16 rounded-md overflow-hidden bg-gray-100 dark:bg-gray-700">
<img src="{{ $attachment['url'] }}" alt="{{ $attachment['name'] }}" class="w-full h-full object-cover">
</div>
{{-- File Info & Actions --}}
<div class="flex-1 min-w-0">
<p class="text-sm font-medium text-gray-900 dark:text-gray-100 truncate" title="{{ $attachment['name'] }}">
{{ $attachment['name'] }}
</p>
<div class="mt-2 flex items-center gap-2">
<a href="{{ $attachment['url'] }}" target="_blank"
class="inline-flex items-center gap-1 text-xs font-medium text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300">
<x-heroicon-o-eye class="w-4 h-4" />
View
</a>
<span class="text-gray-300 dark:text-gray-600">|</span>
<a href="{{ $attachment['url'] }}" download="{{ $attachment['name'] }}"
class="inline-flex items-center gap-1 text-xs font-medium text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300">
<x-heroicon-o-arrow-down-tray class="w-4 h-4" />
Download
</a>
</div>
</div>
</div>
@endforeach
</div>
</div>
@endif
</div> </div>
@endforeach @endforeach
</div> </div>