@if ($ticket)
#{{ $ticket->ticket_id }} {{ $ticket->subject }}

{{ t('Created') }} {{ $ticket->created_at->diffForHumans() }} {{ t('by') }} @if ($ticket->tenantStaff) {{ $ticket->tenantStaff->firstname . ' ' . $ticket->tenantStaff->lastname }} @if ($ticket->tenant) {{ t('on behalf of') }} {{ $ticket->tenant->company_name }} @endif @elseif ($ticket->tenant && $ticket->tenant->adminUser) {{ $ticket->tenant->adminUser->firstname . ' ' . $ticket->tenant->adminUser->lastname }} {{ t('on_behalf_of') }} {{ $ticket->tenant->company_name }} @elseif($ticket->tenant) {{ $ticket->tenant->company_name }} @else {{ t('unknown_tenant') }} @endif

{!! $this->getStatusBadge($ticket->status) !!} {!! $this->getPriorityBadge($ticket->priority) !!}
{!! nl2br(e($ticket->body)) !!}
@if ($ticket->attachments && count($ticket->attachments) > 0)
{{ t('attachments') }}
@foreach ($ticket->attachments as $attachment)
@if (is_array($attachment)) {{-- New format: array with filename, path, size --}} {{ $attachment['filename'] }} ({{ number_format($attachment['size'] / 1024, 1) }} KB) @else {{-- Legacy format: just filename string --}} {{ $attachment }} {{ t('file') }} @endif
@endforeach
@endif
@if ($ticket->replies && count($ticket->replies) > 0)
{{ t('replies') }} ({{ count($ticket->replies) }})
@foreach ($ticket->replies as $reply)
@if ($reply->user_type === 'admin')
{{ $reply->user->name ?? 'Admin' }}
@elseif($reply->user_type === 'system')
{{ t('system') }}
@else
{{ $reply->user->name ?? 'Tenant' }}
@endif @if ($reply->user_type === 'system') {{ t('system') }} @endif
{{ $reply->created_at->diffForHumans() }} @if (Auth::user()->is_admin && Auth::user()->user_type === 'admin' && $reply->user_type === 'admin' && $reply->created_at->diffInMinutes(now()) <= \Modules\Tickets\Models\TicketReply::DELETION_WINDOW && $ticket->status !== 'closed') @endif
{!! nl2br(e($reply->content)) !!}
@if ($reply->attachments && count($reply->attachments) > 0)
{{ t('attachments') }}
@foreach ($reply->attachments as $attachment)
@if (is_array($attachment)) {{-- New format: array with filename, path, size --}} {{ $attachment['filename'] }} ({{ number_format($attachment['size'] / 1024, 1) }} KB) @else {{ $attachment }} @endif
@endforeach
@endif
@endforeach
@endif @if ($ticket->status !== 'closed')
{{ t('add_reply') }}
@error('replyContent')

{{ $message }}

@enderror

{{ t('upload_files') }}

{{ t('click_to_browse') }}

{{ t('maximum_5_files') }}

{{ t('file_validation_errors') }}

@error('attachments.*')

{{ $message }}

@enderror

{{ t('selected_files') }} ()

@if ($ticket->status === 'closed')

{{ t('file_uploads_disabled') }}

@endif
status === 'closed' ? 'disabled' : '' }} checked>
@if ($ticket->status === 'closed')

{{ t('ticket_closed') }}

{{ t('ticket_is_closed_message') }}

@endif
@else

{{ t('ticket_closed_reopen') }}

@endif
@else
{{ t('ticket_not_found') }}
@endif