@extends('client.layouts.dashboard') @section('title', 'Call Logs') @section('content')

Call Logs

View all call activity from your organization's users

Export Excel
{{ $stats['total'] }}
Total Calls
{{ $stats['incoming'] }}
Incoming
{{ $stats['outgoing'] }}
Outgoing
{{ $stats['missed'] }}
Missed
@forelse($callLogs as $log) @empty @endforelse
User Phone Number Type Status Note Duration Auto-Reply Time
{{ strtoupper(substr($log->user->name ?? 'U', 0, 1)) }}
{{ $log->user->name ?? 'Unknown' }}
{{ $log->phone_number }} @php $channelLogs = ($log->smsLogs ?? collect())->sortByDesc(function ($item) { return optional($item->sent_at)->timestamp ?? optional($item->created_at)->timestamp ?? 0; }); $smsChannelLog = $channelLogs->first(function ($item) { return ($item->channel ?? 'sms') === 'sms'; }); $whatsAppChannelLog = $channelLogs->first(function ($item) { return ($item->channel ?? '') === 'whatsapp'; }); $displayContactName = $log->contact_name ?: optional($smsChannelLog)->contact_name ?: optional($whatsAppChannelLog)->contact_name; @endphp @if($displayContactName)
{{ $displayContactName }} @endif
@php $normalizedCallType = strtolower((string) $log->call_type); if (in_array($normalizedCallType, ['incoming', 'answered_externally', 'wifi'], true)) { $normalizedCallType = 'incoming'; } elseif ($normalizedCallType === 'outgoing') { $normalizedCallType = 'outgoing'; } else { $normalizedCallType = 'missed'; } @endphp @if($normalizedCallType === 'incoming') Incoming @elseif($normalizedCallType === 'outgoing') Outgoing @else Missed @endif @if($log->status_label) {{ $log->status_label }} @else @endif {{ $log->status_note ?: '—' }} @if($log->call_duration) {{ gmdate('H:i:s', $log->call_duration) }} @else - @endif @if($log->sms_sent) @if($smsChannelLog) SMS {{ strtoupper((string) $smsChannelLog->status) }} @endif @if($whatsAppChannelLog) @if($smsChannelLog)
@endif WhatsApp {{ strtoupper((string) $whatsAppChannelLog->status) }} @endif @if(!$smsChannelLog && !$whatsAppChannelLog) Sent @endif @else No @endif
{{ optional($log->call_time)->format('M d, Y') ?? $log->created_at->format('M d, Y') }}
{{ optional($log->call_time)->format('h:i A') ?? $log->created_at->format('h:i A') }}

No call logs found

@if($callLogs->hasPages()) @endif
@endsection