@include('manager.detailed_report.styles')
@if(empty($access_report['assignment']))
Detailed access results are not available for this company.
@if(empty($company))
Your profile does not have a configured company. Please ask an administrator to set your user company.
@endif
@else
@foreach($access_report['sections'] as $section)
@php
$rawScore = $section['score'] ?? null;
if (($rawScore === null || $rawScore === '') && !empty($section['score_column'])) {
$rawScore = $access_report['final']->{$section['score_column']} ?? null;
}
$score = '';
if ($rawScore !== null && $rawScore !== '') {
$score = (string) $rawScore;
if (!str_ends_with($score, '%') && is_numeric($score)) {
$numeric = (float) $score;
if ($numeric > 0 && $numeric <= 1) {
$numeric *= 100;
}
$score = number_format($numeric, 0) . '%';
}
}
$scoreClass = $section['score_class'] ?? 'score-na';
if (($scoreClass === 'score-na' || $scoreClass === '') && $score !== '') {
$scoreValue = rtrim($score, '%');
if (is_numeric($scoreValue)) {
$scoreNumeric = (float) $scoreValue;
if ($scoreNumeric >= 80) {
$scoreClass = 'score-green';
} elseif ($scoreNumeric >= 60) {
$scoreClass = 'score-orange';
} else {
$scoreClass = 'score-red';
}
}
}
@endphp
@component('manager.detailed_report.accordion_section', [
'label' => $section['label'] ?? '',
'score' => $score,
'score_class' => $scoreClass,
])
@slot('content')
| Metric |
Overall Score |
@foreach($access_report['calls'] as $callId => $callLabel)
Call {{ $loop->iteration }} |
@endforeach
@foreach($section['rows'] as $row)
@php
$overallColumn = $row['data_col'] ?? $row['column'];
$overallValue = $access_report['final']->{$overallColumn} ?? '';
@endphp
| {{ $row['label'] }} |
{{ $overallValue !== '' ? $overallValue : '-' }} |
@foreach($access_report['calls'] as $callId => $callLabel)
{!! $row['formatted'][$callId] ?? '' !!} |
@endforeach
@endforeach
@if(($section['label'] ?? '') === 'ACCESS SCORE')
@php
$callTotals = json_decode($access_report['final']->call_total ?? '{}', true) ?: [];
@endphp
| ACCESS SCORE |
{{ $access_report['final']->access_score ?? '-' }} |
@foreach($access_report['calls'] as $callId => $callLabel)
{{ $callTotals[$callId] ?? '-' }} |
@endforeach
@endif
@endslot
@endcomponent
@endforeach
@endif