@extends('layouts.app') @section('title', 'Dashboard') @section('page-specific-style') @endsection @section('content')

Overview

New Lead

{{ formatNumberShort($totalLeadCount) }}

Activities Created

{{ formatNumberShort($totalActivitiesCreated) }}

Activities Finished

{{ formatNumberShort($totalActivitiesFinished) }}

New Policy

{{ formatNumberShort($policiesCount) }}

CPA

${{ formatNumberShort($cpa) }}

@can('View commission setting')
Estimated Commission

${{ formatNumberShort($estimatedCommission ) }}

@endcan {{--
Monthly Premium

${{ formatNumberShort($totalPremium) }}

Annualized Premium

${{ formatNumberShort($actualPremium) }}

--}}

Leads

@forelse($summary as $source => $counts) @empty @endforelse @if(count($summary) > 0) @if (($totals['new'] - array_sum(array_column($summary, 'new'))) > 0 || ($totals['open'] - array_sum(array_column($summary, 'open'))) > 0 || ($totals['won'] - array_sum(array_column($summary, 'won'))) > 0 || ($totals['closed'] - array_sum(array_column($summary, 'closed'))) > 0) @endif @endif @if(count($summary) > 0) @endif
Source New Open Won Closed
{{ $source == '' || $source == null ? 'Null' : $source }} {{ $counts['new'] }} {{ $counts['open'] }} {{ $counts['won'] }} {{ $counts['closed'] }}
Data not found!
Null {!! $totals['new'] - array_sum(array_column($summary, 'new')) > 0 ? $totals['new'] - array_sum(array_column($summary, 'new')) : 0 !!} {!! $totals['open'] - array_sum(array_column($summary, 'open')) > 0 ? $totals['open'] - array_sum(array_column($summary, 'open')) : 0 !!} {!! $totals['won'] - array_sum(array_column($summary, 'won')) > 0 ? $totals['won'] - array_sum(array_column($summary, 'won')) : 0 !!} {!! $totals['closed'] - array_sum(array_column($summary, 'closed')) > 0 ? $totals['closed'] - array_sum(array_column($summary, 'closed')) : 0 !!}
Total {{ $totals['new'] }} {{ $totals['open'] }} {{ $totals['won'] }} {{ $totals['closed'] }}
@php $hasData = false; @endphp @forelse($assignedToUsers as $user) @php $new = $agentSummary[$user->id]['new'] ?? 0; $open = $agentSummary[$user->id]['open'] ?? 0; $won = $agentSummary[$user->id]['won'] ?? 0; $closed = $agentSummary[$user->id]['closed'] ?? 0; @endphp @if($new != 0 || $open != 0 || $won != 0 || $closed != 0) @php $hasData = true; @endphp @endif @empty @endforelse @if ($hasData) @php $agentTotals = [ 'new' => array_sum(array_column($agentSummary, 'new')), 'open' => array_sum(array_column($agentSummary, 'open')), 'won' => array_sum(array_column($agentSummary, 'won')), 'closed' => array_sum(array_column($agentSummary, 'closed')) ]; @endphp @if (($totals['new'] - $agentTotals['new']) > 0 || ($totals['open'] - $agentTotals['open']) > 0 || ($totals['won'] - $agentTotals['won']) > 0 || ($totals['closed'] - $agentTotals['closed']) > 0) @endif @endif @if($hasData) @else @endif
Agent New Open Won Closed
{{ $user->name }} {{ $new }} {{ $open }} {{ $won }} {{ $closed }}
No agents found
Null {{-- sum of new from the able and minus $$totalLeadCount --}} {!! $totals['new'] - $agentTotals['new'] > 0 ? $totals['new'] - $agentTotals['new'] : 0 !!} {!! $totals['open'] - $agentTotals['open'] > 0 ? $totals['open'] - $agentTotals['open'] : 0 !!} {!! $totals['won'] - $agentTotals['won'] > 0 ? $totals['won'] - $agentTotals['won'] : 0 !!} {!! $totals['closed'] - $agentTotals['closed'] > 0 ? $totals['closed'] - $agentTotals['closed'] : 0 !!}
Total {{ $totals['new'] }} {{ $totals['open'] }} {{ $totals['won'] }} {{ $totals['closed'] }}
No data found

Activities

@php $totalOverdue = 0; $totalPending = 0; $totalDone = 0; $totalDeleted = 0; $hasData = false; @endphp @forelse($activitySummary as $summary) @php $totalOverdue += $summary['overdue']; $totalPending += $summary['pending']; $totalDone += $summary['done']; $totalDeleted += $summary['deleted']; if ($summary['overdue'] != 0 || $summary['pending'] != 0 || $summary['done'] != 0 || $summary['deleted'] != 0) { $hasData = true; @endphp @php } @endphp @empty @endforelse {{-- @php $totalOverdue = 0; $totalPending = 0; $totalDone = 0; $totalDeleted = 0; $hasData = false; @endphp @forelse($assignedToUsers as $user) @php $overdue = $activitySummary[$user->id]['overdue'] ?? 0; $pending = $activitySummary[$user->id]['pending'] ?? 0; $done = $activitySummary[$user->id]['done'] ?? 0; $deleted = $activitySummary[$user->id]['deleted'] ?? 0; // Only display the row if any of the values are not 0 if ($overdue != 0 || $pending != 0 || $done != 0 || $deleted != 0) { $hasData = true; $totalOverdue += $overdue; $totalPending += $pending; $totalDone += $done; $totalDeleted += $deleted; @endphp @php } @endphp @empty @endforelse --}} @if($hasData) @else {{-- --}} @endif
Agent Overdue Pending Done Deleted
{{ $summary['agent'] }} {{ $summary['overdue'] }} {{ $summary['pending'] }} {{ $summary['done'] }} {{ $summary['deleted'] }}
{{ $user->name }} {{ $overdue }} {{ $pending }} {{ $done }} {{ $deleted }}
No Data Found
Total {{ $totalOverdue }} {{ $totalPending }} {{ $totalDone }} {{ $totalDeleted }}
No Data Found
@php $totalOverdue = 0; $totalPending = 0; $totalDone = 0; $totalDeleted = 0; $hasData = false; @endphp @forelse($activityTypeSummary as $activityType => $counts) @php $pending = $counts['pending'] ?? 0; $done = $counts['done'] ?? 0; $deleted = $counts['deleted'] ?? 0; $overdue = $counts['overdue'] ?? 0; if ($overdue != 0 || $pending != 0 || $done != 0 || $deleted != 0) { $hasData = true; $totalOverdue += $overdue; $totalPending += $pending; $totalDone += $done; $totalDeleted += $deleted; @endphp @php } @endphp @empty @endforelse {{-- @forelse($activityTypeSummary as $activityType => $counts) @php $pending = $counts['pending'] ?? 0; $done = $counts['done'] ?? 0; $deleted = $counts['deleted'] ?? 0; $overdue = $counts['overdue'] ?? 0; if ($overdue != 0 || $pending != 0 || $done != 0 || $deleted != 0) { $hasData = true; $totalOverdue += $overdue; $totalPending += $pending; $totalDone += $done; $totalDeleted += $deleted; @endphp @php } @endphp @empty @endforelse --}}
Activity Type Overdue Pending Done Deleted
{{ $activityType }} {{ $overdue }} {{ $pending }} {{ $done }} {{ $deleted }}
Data not found
{{ $activityType }} {{ $overdue }} {{ $pending }} {{ $done }} {{ $deleted }}
Data not found
Total {{ $activityTotals['overdue'] }} {{ $activityTotals['pending'] }} {{ $activityTotals['done'] }} {{ $activityTotals['deleted'] }}

Policies

@can('View commission setting') @endcan @php $hasData = false; @endphp @forelse($policiesSummary as $userId => $summary) @php $new = $summary['new'] ?? 0; $policiesCPA = $summary['cpa'] ?? 0; $earnedCommission = $summary['earned_commission'] ?? 0; @endphp @if($new != 0 || $policiesCPA != 0 || $earnedCommission != 0) @php $hasData = true; @endphp @can('View commission setting') @endcan @endif @empty @can('View commission setting') @else @endcan @endforelse @if($hasData) @php $totalNew = array_sum(array_column($policiesSummary, 'new')); $totalCPA = $cpa; // $totalEstimatedCommission = array_sum(array_column($policiesSummary, 'earned_commission')); $totalEstimatedCommission = $estimatedCommission; $unassignedNew = max($totalLeadCount - $totalNew, 0); $unassignedCPA = max($totalCPA - array_sum(array_column($policiesSummary, 'cpa')), 0); $unassignedCommission = max($totalEstimatedCommission - array_sum(array_column($policiesSummary, 'estimated_commission')), 0); @endphp @if ($unassignedNew > 0 || $unassignedCPA > 0 || $unassignedCommission > 0) @can('View commission setting') @endcan @endif @endif @if($hasData) @can('View commission setting') @endcan @endif
Agent New CPAEstimated Commission
{{ $assignedToUsers->firstWhere('id', $userId)->name ?? 'N/A' }} {{ $new }} ${{ number_format($policiesCPA, 2) }}${{ number_format($earnedCommission, 2) }}
No data availableNo data available
Null {{ $unassignedNew }} ${{ number_format($unassignedCPA, 2) }} {!! $totalEstimatedCommission - array_sum(array_column($policiesSummary, 'estimated_commission')) > 0 ? '$' . number_format($totalEstimatedCommission - array_sum(array_column($policiesSummary, 'estimated_commission')), 2) : '$'. $totalEstimatedCommission - array_sum(array_column($policiesSummary, 'earned_commission')) !!}
Total {{ $totalNew }} ${{ number_format($totalCPA, 2) }}${{ number_format($totalEstimatedCommission, 2) }}
@can('View commission setting') @endcan @php $hasData = false; @endphp @forelse($policiesProductSummary as $productId => $summary) @php $new = $summary['new'] ?? 0; $productCPA = $summary['cpa'] ?? 0; $ProductEstimatedCommission = $summary['estimated_commission'] ?? 0; @endphp @if($new != 0 || $productCPA != 0 || $ProductEstimatedCommission != 0) @php $hasData = true; @endphp @can('View commission setting') @endcan @endif @empty @can('View commission setting') @else @endcan @endforelse @if ($hasData) @php $productTotalCPA = $cpa; $totalEstimatedCommission = $estimatedCommission; @endphp @if (($productTotalCPA - array_sum(array_column($policiesProductSummary, 'cpa'))) > 0 || ($totalEstimatedCommission - array_sum(array_column($policiesProductSummary, 'estimated_commission'))) > 0) @can('View commission setting') @endif @endif @if($hasData) @can('View commission setting') @endcan @else @can('View commission setting') @else @endcan @endif
Product New CPAEstimated Commission
{{ $summary['name'] }} {{ $new }} ${{ number_format($productCPA, 2) }}${{ number_format($ProductEstimatedCommission, 2) }}
No data availableNo data available
Null {!! $totalLeadCount - array_sum(array_column($policiesProductSummary, 'new')) > 0 ? $totalLeadCount - array_sum(array_column($policiesProductSummary, 'new')) : 0 !!} {!! $productTotalCPA - array_sum(array_column($policiesProductSummary, 'cpa')) > 0 ? '$' . number_format($productTotalCPA - array_sum(array_column($policiesProductSummary, 'cpa')), 2) : 0 !!}{!! $totalEstimatedCommission - array_sum(array_column($policiesProductSummary, 'estimated_commission')) > 0 ? '$' . number_format($totalEstimatedCommission - array_sum(array_column($policiesProductSummary, 'estimated_commission')), 2) : '$'. $totalEstimatedCommission - array_sum(array_column($policiesProductSummary, 'estimated_commission')) !!} @endcan
Total {{ array_sum(array_column($policiesProductSummary, 'new')) }} ${{ number_format($productTotalCPA, 2) }}${{ number_format($totalEstimatedCommission, 2) }}
No data availableNo data available
@can('View commission setting') @endcan @php $hasData = false; @endphp @forelse($stateSummary as $productId => $summary) @php $stateNew = $summary['new'] ?? 0; $stateCPA = $summary['cpa'] ?? 0; $stateEstimatedCommission = $summary['estimated_commission'] ?? 0; @endphp @if($stateNew != 0 || $stateCPA != 0 || $stateEstimatedCommission != 0) @php $hasData = true; @endphp @can('View commission setting') @endcan @endif @empty @can('View commission setting') @else @endcan @endforelse @if ($hasData) @php $stateTotalCPA = $cpa; $stateTotalEstimatedCommission = $estimatedCommission; @endphp @if (($stateTotalCPA - array_sum(array_column($policiesProductSummary, 'cpa'))) > 0 || ($stateTotalEstimatedCommission - array_sum(array_column($policiesProductSummary, 'estimated_commission'))) > 0) @can('View commission setting') @endcan @endif @endif @if($hasData) @can('View commission setting') @endcan @else @can('View commission setting') @else @endcan @endif
State New CPAEstimated Commission
{{ $summary['name'] }} {{ $stateNew }} ${{ number_format($stateCPA, 2) }}${{ number_format($stateEstimatedCommission, 2) }}
No data availableNo data available
Null {!! $totalLeadCount - array_sum(array_column($policiesProductSummary, 'new')) > 0 ? $totalLeadCount - array_sum(array_column($policiesProductSummary, 'new')) : 0 !!} {!! $stateTotalCPA - array_sum(array_column($policiesProductSummary, 'cpa')) > 0 ? '$' . number_format($stateTotalCPA - array_sum(array_column($policiesProductSummary, 'cpa')), 2) : 0 !!} {!! $stateTotalEstimatedCommission - array_sum(array_column($policiesProductSummary, 'estimated_commission')) > 0 ? '$' . number_format($stateTotalEstimatedCommission - array_sum(array_column($policiesProductSummary, 'estimated_commission')), 2) : '$'. $stateTotalEstimatedCommission - array_sum(array_column($policiesProductSummary, 'estimated_commission')) !!}
Total {{ array_sum(array_column($policiesProductSummary, 'new')) }} ${{ number_format($stateTotalCPA, 2) }}${{ number_format($stateTotalEstimatedCommission, 2) }}
No data availableNo data available
@endsection @section('page-specific-script') @endsection