@extends('layouts.app')
@section('title', 'Ticket #' . $ticket->reference)
@push('styles')
@endpush
@section('content')
{{-- Header --}}
{{-- Messages --}}
@forelse($ticket->messages as $message)
@php
$isSent = !$message->is_admin && $message->user_id === auth()->id();
$senderName = $message->is_admin ? ($message->user->name ?? 'Support') : ($message->user->name ?? 'You');
$initial = strtoupper(substr($senderName, 0, 1));
$isImage = $message->attachment && preg_match('/\.(jpg|jpeg|png|gif|webp)$/i', $message->attachment);
@endphp
{{ $initial }}
{{ $isSent ? 'You' : $senderName }}
@if($message->is_admin)
Support
@endif
{{ $message->created_at->format('M d, g:i A') }}
@empty
No messages yet. Start the conversation below.
@endforelse
{{-- Typing indicator --}}
{{-- Reply form or closed bar --}}
@if(in_array($ticket->status, ['resolved', 'closed']))
This ticket is {{ $ticket->status }}. You can no longer reply.
@else
@endif
@endsection
@push('scripts')
@endpush