@php $configData = Helper::appClasses(); $statusColors = [ 'draft' => 'secondary', 'submitted' => 'primary', 'validated' => 'success', ]; $statusLabels = [ 'draft' => 'Brouillon', 'submitted' => 'Soumise', 'validated' => 'Validée', ]; // Chaîne d'ancêtres de la structure (FS → Commune → District → …) $ancestors = $survey->structure ? $survey->structure->ancestors() : []; @endphp @extends('layouts/layoutMaster') @section('title', 'Collecte #' . $survey->id) @section('content')

{{ $survey->campaign?->name }} / Collecte #{{ $survey->id }}

@can('validate', $survey) @if ($survey->status?->value === 'submitted')
@csrf
@csrf
@elseif ($survey->status?->value === 'validated')
@csrf
@endif @endcan Imprimer (HTML) Exporter le rapport (PDF)
@if (session('success')) @endif
{{ $survey->structure?->name ?? '-' }} @if ($survey->structure?->type) {{ $survey->structure->type }} @endif @php $auditLevel = $survey->audit_level?->value ?? 'Formation Sanitaire'; $auditColor = match ($auditLevel) { 'Region' => 'info', 'District' => 'warning', default => 'primary', }; @endphp Audit : {{ $auditLevel }}
@if (!empty($ancestors)) @foreach (array_reverse($ancestors) as $i => $a) @if ($i > 0) @endif {{ $a->name }} @endforeach @endif
Date collecte
{{ $survey->collected_on?->format('d/m/Y') }}
Statut
@php $s = $survey->status?->value ?? 'draft'; @endphp
{{ $statusLabels[$s] ?? $s }}
@if ($survey->validated_at) {{ $survey->validator?->name ?? 'Système' }} · {{ $survey->validated_at->format('d/m/Y H:i') }} @endif
Resp. données
{{ $survey->data_manager }}
Resp. régional
{{ $survey->regional_manager ?? '-' }}
@if ($survey->investigators->isNotEmpty())
Équipe d'évaluation
@foreach ($survey->investigators as $inv) {{ $inv->name }} @endforeach
@endif
Score global
@if ($globalScorePct !== null)
{{ $globalScorePct }}%
{{ $survey->dimensionScores->count() }} dimensions scorées @else
-
Aucun score calculé @endif
Participants {{ $survey->participants->count() }}
@foreach ($survey->participants as $p) @endforeach
Nom Fonction Contact Réponses choix Réponses précision
{{ $p->last_name }} {{ $p->first_name }} {{ $p->role ?? '-' }} {{ $p->contact ?? '-' }} {{ $p->choice_answers_count }} {{ $p->precision_answers_count }}
@if ($survey->dimensionScores->isNotEmpty())
Scores par dimension
@foreach ($survey->dimensionScores as $ds) @php $pct = $ds->max_value > 0 ? round(($ds->value / $ds->max_value) * 100) : 0; $barColor = $pct >= 80 ? 'success' : ($pct >= 50 ? 'warning' : 'danger'); @endphp @endforeach
Dimension Score Barre Recommandations
{{ $ds->dimension?->label }} {{ $ds->value }} / {{ $ds->max_value }}
{{ $ds->recommendations->count() }}
@endif @if ($survey->subCriterionScores->isNotEmpty()) @php $mdaByScId = $survey->absoluteDifferenceMeans->keyBy('sub_criterion_id'); $subsByDim = $survey->subCriterionScores->groupBy(fn($sc) => $sc->subCriterion?->dimension_id); @endphp
Notations détaillées (par sous-critère)
@foreach ($survey->dimensionScores as $ds) @php $subScores = $subsByDim->get($ds->dimension_id, collect()); $dsPct = $ds->max_value > 0 ? round(($ds->value / $ds->max_value) * 100) : 0; @endphp
{{ $ds->dimension?->label }} {{ $ds->value }} / {{ $ds->max_value }} ({{ $dsPct }}%)
@if ($subScores->isEmpty())

Aucun sous-critère scoré pour cette dimension.

@else @foreach ($subScores as $sub) @php $subPct = $sub->max_value > 0 ? round(($sub->value / $sub->max_value) * 100) : 0; $mda = $mdaByScId->get($sub->sub_criterion_id); @endphp @endforeach
Sous-critère Score % MDA (précision)
{{ $sub->subCriterion?->label ?? '-' }} {{ $sub->value }} / {{ $sub->max_value }} {{ $subPct }}% @if ($mda) {{ number_format((float) $mda->mda, 2) }}% · score {{ $mda->score }} @else - @endif
@endif
@endforeach
@endif
Recommandations
@livewire('recommendations.editor', ['survey' => $survey]) @endsection