@include('admin.common.meta') @include('admin.common.scripts')

{{ trans(' WhatsApp Hourly Report') }}

@include('admin.loader') @php $getUserRoleData = userRoleData(); $LeadSources = explode(",",$getUserRoleData->LeadSources); @endphp
@if( count((array) $errors) > 0) @foreach($errors->all() as $error) @endforeach @endif @if(session()->has('message'))

{{ trans('labels.Successlabel') }}

{{ session()->get('message') }}
@endif @if(session()->has('error'))

{{ trans('labels.WarningLabel') }}

{{ session()->get('error') }}
@endif
{{-- Search By: Date Range --}}
{!! Form::select('search_admin[]', $result['search_admin'], $search_admin ?? [], [ 'class' => 'form-control', 'id' => 'search_admin', 'multiple' => 'multiple' ]) !!}
{{ is_array($search_admin ?? []) ? count($search_admin ?? []) : 0 }}
{{-- --}}
{{-- Loop through mergedUniqueChatsPerHour to show the unique chat counts and user names --}} @foreach ($mergedUniqueChatsPerHour as $timeInterval => $uniqueChatData) {{-- Display the unique chat count --}} {{-- Display total messages received for this time interval --}} {{-- Display total messages sent for this time interval --}} {{-- Display agent names (users) for sent messages --}} {{-- Show the list of unique users and their chat counts below the Unique Chat Count --}} @endforeach {{-- Handle time intervals that are only in mergedReceivedMessages --}} @foreach ($mergedReceivedMessages as $timeInterval => $receivedData) @if (!isset($mergedUniqueChatsPerHour[$timeInterval])) {{-- Display received messages count --}} {{-- Display sent messages count --}} {{-- Display agent names (users) for sent messages --}} @endif @endforeach {{-- Handle time intervals that are only in groupedSentMessages --}} @foreach ($groupedSentMessages as $timeInterval => $sentData) @if (!isset($mergedReceivedMessages[$timeInterval]) && !isset($mergedUniqueChatsPerHour[$timeInterval])) {{-- Display sent messages count --}} {{-- Display agent names (users) for sent messages --}} @endif @endforeach
All Products
Time Interval Unique Chat Count Total Messages Received Total Messages Sent Sent Agent Name Unique Chat Agent Name
{{ $timeInterval }}{{ $uniqueChatData['count'] }} @if (isset($mergedReceivedMessages[$timeInterval]) && is_array($mergedReceivedMessages[$timeInterval])) {{ $mergedReceivedMessages[$timeInterval]['count'] }} @else {{ $mergedReceivedMessages[$timeInterval] ?? 0 }} @endif @if (isset($groupedSentMessages[$timeInterval]) && is_array($groupedSentMessages[$timeInterval])) {{ $groupedSentMessages[$timeInterval]['count'] }} @else {{ $groupedSentMessages[$timeInterval] ?? 0 }} @endif @if (isset($groupedSentMessages[$timeInterval]) && isset($groupedSentMessages[$timeInterval]['users'])) {{ implode(', ', $groupedSentMessages[$timeInterval]['users']) }} @else 'N/A' @endif @if (isset($uniqueChatData['users']) && !empty($uniqueChatData['users'])) {{ implode(', ', $uniqueChatData['users']) }} @else 'N/A' @endif
{{ $timeInterval }} 0 @if (is_array($receivedData)) {{ $receivedData['count'] }} @else {{ $receivedData ?? 0 }} @endif @if (isset($groupedSentMessages[$timeInterval]) && is_array($groupedSentMessages[$timeInterval])) {{ $groupedSentMessages[$timeInterval]['count'] }} @else {{ $groupedSentMessages[$timeInterval] ?? 0 }} @endif @if (isset($groupedSentMessages[$timeInterval]) && isset($groupedSentMessages[$timeInterval]['users'])) {{ implode(', ', $groupedSentMessages[$timeInterval]['users']) }} @else 'N/A' @endif
{{ $timeInterval }} 0 0 @if (is_array($sentData)) {{ $sentData['count'] }} @else {{ $sentData ?? 0 }} @endif @if (isset($sentData['users'])) {{ implode(', ', $sentData['users']) }} @else 'N/A' @endif
@php // Collect and merge all unique time intervals for Guru IPTV $guruTimeIntervals = collect($uniqueChatsPerTimeInterval['guru'] ?? []) ->keys() ->merge(array_keys($finalData['guru'] ?? [])) ->merge(array_keys($finalSenderData['guru'] ?? [])) ->unique() ->sort() ->values(); @endphp @foreach ($guruTimeIntervals as $timeInterval) @endforeach
Guru IPTV
Time Interval Unique Chat Count Total Messages Received Total Messages Sent Send Agent Name Unique Agent Name
{{ $timeInterval }} {{ $uniqueChatsPerTimeInterval['guru'][$timeInterval]['count'] ?? 0 }} {{ $finalData['guru'][$timeInterval] ?? 0 }} {{ $finalSenderData['guru'][$timeInterval][0] ?? 0 }} @php $raw = $finalSenderData['guru'][$timeInterval][1] ?? ''; $items = $raw ? explode(',', $raw) : []; @endphp @if (!empty($items)) @foreach ($items as $item) {{ $item }} @endforeach @else N/A @endif @if (isset($uniqueChatsPerTimeInterval['guru'][$timeInterval]['users'] )) {{ implode(', ', $uniqueChatsPerTimeInterval['guru'][$timeInterval]['users'] ) }} @else 'N/A' @endif
@php $tashanTimeIntervals = collect($uniqueChatsPerTimeInterval['tashan'] ?? []) ->keys() ->merge(array_keys($finalData['tashan'] ?? [])) ->merge(array_keys($finalSenderData['tashan'] ?? [])) ->unique() ->sort() ->values(); @endphp @foreach ($tashanTimeIntervals as $timeInterval) {{-- --}} {{-- --}} {{-- --}} @endforeach
Tashan IPTV
Time Interval Unique Chat Count Total Messages Received Total Messages Sent Send Agent Name Unique Agent Name
{{ $timeInterval }} {{ $uniqueChatsPerTimeInterval['tashan'][$timeInterval]['count'] ?? 0 }}{{ $uniqueChatsPerTimeInterval['tashan'][$timeInterval] ?? 0 }}{{ $finalData['tashan'][$timeInterval] ?? 0 }} {{ $finalSenderData['tashan'][$timeInterval][0] ?? 0 }}{{ $finalSenderData['tashan'][$timeInterval][1] ?? 'N/A' }} @php $raw = $finalSenderData['tashan'][$timeInterval][1] ?? ''; $items = $raw ? explode(',', $raw) : []; @endphp @if (!empty($items)) @foreach ($items as $item) {{ $item }} @endforeach @else N/A @endif {{ $uniqueChatsPerTimeInterval['tashan'][$timeInterval]['users'] ?? 0 }} @if (isset($uniqueChatsPerTimeInterval['tashan'][$timeInterval]['users'] )) {{ implode(', ', $uniqueChatsPerTimeInterval['tashan'][$timeInterval]['users'] ) }} @else 'N/A' @endif
@foreach ($uniqueChatsPerTimeInterval['boss'] as $timeInterval => $uniqueChatCount) {{-- --}} {{-- --}} {{-- --}} @endforeach @foreach ($finalData['boss'] as $timeInterval => $sentCount) @if (!isset($uniqueChatsPerTimeInterval['boss'][$timeInterval])) @endif @endforeach @foreach ($finalSenderData['boss'] as $timeInterval => $receivedCount) @if (!isset($finalData['boss'][$timeInterval]) && !isset($uniqueChatsPerTimeInterval['boss'][$timeInterval])) @endif @endforeach
Boss IPTV
Time Interval Unique Chat Count Total Messages Received Total Messages Sent Send Agent Name UniqueAgent Name
{{ $timeInterval }} {{ $uniqueChatsPerTimeInterval['boss'][$timeInterval]['count'] ?? 0 }}{{ $uniqueChatCount }}{{ isset($finalData['boss'][$timeInterval]) ? $finalData['boss'][$timeInterval] : 0 }} {{ isset($finalSenderData['boss'][$timeInterval]) ? $finalSenderData['boss'][$timeInterval][0] : 0 }}{{ isset($finalSenderData['boss'][$timeInterval]) ? $finalSenderData['boss'][$timeInterval][1] : 'N/A' }} @php $raw = $finalSenderData['boss'][$timeInterval][1] ?? ''; $items = $raw ? explode(',', $raw) : []; @endphp @if (!empty($items)) @foreach ($items as $item) {{ $item }} @endforeach @else N/A @endif {{ $uniqueChatsPerTimeInterval['boss'][$timeInterval]['users'] ?? 0 }} @if (isset($uniqueChatsPerTimeInterval['boss'][$timeInterval]['users'] )) {{ implode(', ', $uniqueChatsPerTimeInterval['boss'][$timeInterval]['users'] ) }} @else 'N/A' @endif
{{ $timeInterval }} 0 {{ $sentCount }} {{ isset($finalSenderData['boss'][$timeInterval]) ? $finalSenderData['boss'][$timeInterval][0] : 0 }} {{ isset($finalSenderData['boss'][$timeInterval]) ? $finalSenderData['boss'][$timeInterval][1] : 'N/A' }} 0
{{ $timeInterval }} 0 0 {{ isset($finalSenderData['boss'][$timeInterval]) ? $finalSenderData['boss'][$timeInterval][0] : 0 }} {{ isset($finalSenderData['boss'][$timeInterval]) ? $finalSenderData['boss'][$timeInterval][1] : 'N/A' }} 0
@php $voiceTimeIntervals = collect($uniqueChatsPerTimeInterval['voice'] ?? []) ->keys() ->merge(array_keys($finalData['voice'] ?? [])) ->merge(array_keys($finalSenderData['voice'] ?? [])) ->unique() ->sort() ->values(); @endphp @foreach ($voiceTimeIntervals as $timeInterval) {{-- --}} {{-- --}} {{-- --}} @endforeach
Vois IPTV
Time Interval Unique Chat Count Total Messages Received Total Messages Sent Send Agent Name UniqueAgent Name
{{ $timeInterval }} {{ $uniqueChatsPerTimeInterval['voice'][$timeInterval]['count'] ?? 0 }}{{ $uniqueChatsPerTimeInterval['voice'][$timeInterval] ?? 0 }}{{ $finalData['voice'][$timeInterval] ?? 0 }} {{ $finalSenderData['voice'][$timeInterval][0] ?? 0 }}{{ $finalSenderData['voice'][$timeInterval][1] ?? 'N/A' }} @php $raw = $finalSenderData['voice'][$timeInterval][1] ?? ''; $items = $raw ? explode(',', $raw) : []; @endphp @if (!empty($items)) @foreach ($items as $item) {{ $item }} @endforeach @else N/A @endif {{ $uniqueChatsPerTimeInterval['voice'][$timeInterval]['users'] ?? 0 }} @if (isset($uniqueChatsPerTimeInterval['voice'][$timeInterval]['users'] )) {{ implode(', ', $uniqueChatsPerTimeInterval['voice'][$timeInterval]['users'] ) }} @else 'N/A' @endif
@foreach ($uniqueChatsPerTimeInterval['brampton'] as $timeInterval => $uniqueChatCount) {{-- --}} @endforeach @foreach ($finalData['brampton'] as $timeInterval => $sentCount) @if (!isset($uniqueChatsPerTimeInterval['brampton'][$timeInterval])) @endif @endforeach @foreach ($finalSenderData['brampton'] as $timeInterval => $receivedCount) @if (!isset($finalData['brampton'][$timeInterval]) && !isset($uniqueChatsPerTimeInterval['brampton'][$timeInterval])) @endif @endforeach
Brampton IPTV
Time Interval Unique Chat Count Total Messages Received Total Messages Sent
{{ $timeInterval }} {{ $uniqueChatCount }} {{ isset($finalData['brampton'][$timeInterval]) ? $finalData['brampton'][$timeInterval] : 0 }} {{ isset($finalSenderData['brampton'][$timeInterval]) ? $finalSenderData['brampton'][$timeInterval][0] : 0 }}{{ isset($finalSenderData['brampton'][$timeInterval]) ? $finalSenderData['brampton'][$timeInterval][1] : 'N/A' }} @php $raw = $finalSenderData['brampton'][$timeInterval][1] ?? ''; $items = $raw ? explode(',', $raw) : []; @endphp @if (!empty($items)) @foreach ($items as $item) {{ $item }} @endforeach @else N/A @endif
{{ $timeInterval }} 0 {{ $sentCount }} {{ isset($finalSenderData['brampton'][$timeInterval]) ? $finalSenderData['brampton'][$timeInterval][0] : 0 }} {{ isset($finalSenderData['brampton'][$timeInterval]) ? $finalSenderData['brampton'][$timeInterval][1] : 'N/A' }}
{{ $timeInterval }} 0 0 {{ isset($finalSenderData['brampton'][$timeInterval]) ? $finalSenderData['brampton'][$timeInterval][0] : 0 }} {{ isset($finalSenderData['brampton'][$timeInterval]) ? $finalSenderData['brampton'][$timeInterval][1] : 'N/A' }}
@php $indianTimeIntervals = collect($uniqueChatsPerTimeInterval['indian'] ?? []) ->keys() ->merge(array_keys($finalData['indian'] ?? [])) ->merge(array_keys($finalSenderData['indian'] ?? [])) ->unique() ->sort() ->values(); @endphp @foreach ($indianTimeIntervals as $timeInterval) {{-- @dd($finalSenderData['indian']); --}} {{-- --}} {{-- --}} @endforeach
Indian IPTV
Time Interval Unique Chat Count Total Messages Received Total Messages Sent Send message agent name Unique message agent name
{{ $timeInterval }} {{ $uniqueChatsPerTimeInterval['indian'][$timeInterval]['count'] ?? 0 }}{{ $uniqueChatsPerTimeInterval['indian'][$timeInterval] ?? 0 }}{{ $finalData['indian'][$timeInterval] ?? 0 }} {{ $finalSenderData['indian'][$timeInterval][0] ?? 0 }}{{ $finalSenderData['indian'][$timeInterval][1] ?? 'N/A' }} @php $raw = $finalSenderData['indian'][$timeInterval][1] ?? ''; $items = $raw ? explode(',', $raw) : []; @endphp @if (!empty($items)) @foreach ($items as $item) {{ $item }} @endforeach @else N/A @endif @if (isset($uniqueChatsPerTimeInterval['indian'][$timeInterval]['users'] )) {{ implode(', ', $uniqueChatsPerTimeInterval['indian'][$timeInterval]['users'] ) }} @else 'N/A' @endif