@php
$allStatusNames = ['Initial Contact', 'Proposal Sent', 'Contract Signed'];
$statusIcons = [
'Initial Contact' => 'ri-phone-line',
'Proposal Sent' => 'ri-mail-send-line',
'Contract Signed' => 'ri-contract-line',
];
$statusColors = [
'Initial Contact' => 'primary',
'Proposal Sent' => 'info',
'Contract Signed' => 'success',
];
@endphp
@foreach($allStatusNames as $statusName)
{{-- @php
$count = $historiesForUser
->filter(fn($item) => $item->status->name === $statusName)
->count();
$icon = $statusIcons[$statusName] ?? 'ri-bar-chart-line';
$color = $statusColors[$statusName] ?? 'secondary';
@endphp --}}
@php
$actualCount = $historiesForUser
->filter(fn($item) => $item->status->name === $statusName)
->count();
$statusId = $statuses->firstWhere('name', $statusName)?->id;
$targetCount = $plannerTargets
->where('crm_progress_status_id', $statusId)
->first()
->target_count ?? 0;
$icon = $statusIcons[$statusName] ?? 'ri-bar-chart-line';
$color = $statusColors[$statusName] ?? 'secondary';
@endphp
Status Progress
@php
$progress = $targetCount > 0 ? min(100, round(($actualCount / $targetCount) * 100)) : 0;
$barColor = $progress < 100 ? 'bg-warning' : 'bg-success';
@endphp
Target: {{ $targetCount }}
Achieved: {{ $actualCount }}
Remaining:
{{ max(0, $targetCount - $actualCount) }}
@endforeach
| # |
Contact Info |
Status |
Changed At |
@foreach($historiesForUser as $index => $history)
| {{ $index + 1 }} |
{{ $history->contact->name }}
{{ $history->contact->email }}
{{ $history->contact->phone }}
|
{{ $history->status->name }} |
{{ \Carbon\Carbon::parse($history->created_at)->format('d M Y H:i') }} |
@endforeach