@extends('layouts.app') @section('title', _lang('Support Chat')) @section('content') @php $rowTime = fn ($c) => optional($c->last_message_at)->format('d M, H:i') ?: '—'; $rowMsg = fn ($c) => \Illuminate\Support\Str::limit(optional($c->latestMessage)->body, 60) ?: '—'; @endphp
@include('partials.alerts')

{{ _lang('Support Chat') }}

{{ _lang('Reply to messages from organization owners & staff.') }}

@if ($unreadTotal > 0) {{ $unreadTotal }} {{ _lang('unread') }} @endif
{{-- ===== Needs reply (blinking) ===== --}} @if ($needsReply->isNotEmpty())
{{ _lang('Awaiting your reply') }} ({{ $needsReply->count() }})
@foreach ($needsReply as $c) @endforeach
{{ _lang('User') }}{{ _lang('Organization') }} {{ _lang('Last message') }}{{ _lang('Unread') }} {{ _lang('Updated') }}
@endif {{-- ===== All conversations ===== --}}
{{ _lang('All conversations') }}
@forelse ($conversations as $c) @empty @endforelse
{{ _lang('User') }}{{ _lang('Organization') }} {{ _lang('Last message') }}{{ _lang('Unread') }} {{ _lang('Updated') }}
{{ $c->user->name ?? _lang('User') }} {{ $c->user->phone ?? $c->user->email ?? '' }} {{ $c->organization->name ?? '—' }} {{ $rowMsg($c) }} @if ($c->unread_admin_count > 0){{ $c->unread_admin_count }}@else0@endif {{ $rowTime($c) }} {{ _lang('Open chat') }}
{{ _lang('No conversations yet.') }}
@if ($conversations->hasPages())
{{ $conversations->withQueryString()->links() }}
@endif
@endsection