@if ($task->attachment)
@foreach ($task->attachment as $existingAttachment)
@php
$fileName = basename($existingAttachment);
// Extract original file name without timestamp and extension
preg_match('/^\d{14}_(.*)\.(.*)$/', $fileName, $matches);
$originalFileName = $matches[1] . '.' . $matches[2];
$fileSize = Storage::disk('public')->exists($existingAttachment) ? Storage::disk('public')->size($existingAttachment) : 0;
@endphp
{{ $originalFileName }}
{{ formatFileSize($fileSize) }}
@endforeach
@endif
@error('attachments.*')