@extends('dashboard.layouts.app') @section('title', 'Détails du Sondage - ' . $sondage->titre . ' - UAC eservices') @section('page-title', 'Détails du Sondage') @section('breadcrumb') @endsection {{-- @section('page-actions') @endsection --}} @section('content')
@can('update', $sondage) Modifier @endcan @can('analyze', $sondage) Analyser @endcan @can('delete', $sondage)
@csrf @method('DELETE')
@endcan

{{ $sondage->titre }}

{{ $sondage->description }}

Informations générales
Statut : {{ ucfirst($sondage->statut) }}
Date de début : {{ $sondage->date_debut->format('d/m/Y') }}
Date de fin : {{ $sondage->date_fin->format('d/m/Y') }}
Créateur : {{ $sondage->createur->name }}
Créé le : {{ $sondage->created_at->format('d/m/Y H:i') }}
Dernière modification : {{ $sondage->updated_at->format('d/m/Y H:i') }}
Rôles cibles : @if(empty($sondage->target_roles)) Tous les utilisateurs @else @foreach($sondage->getTargetRoles() as $roleId) @php $role = \App\Models\Role::find($roleId) @endphp @if($role) {{ $role->nom }} @endif @endforeach @endif
Statistiques
Nombre de questions : {{ $sondage->questions->count() }}
Réponses totales : {{ $sondage->questions->sum(fn($q) => $q->reponses->count()) }}
État : @php $now = now(); $isActive = $sondage->statut === 'actif'; $isInPeriod = $now->between($sondage->date_debut, $sondage->date_fin); @endphp @if($isActive && $isInPeriod) Actif @elseif(!$isActive) Inactif @elseif($now->lt($sondage->date_debut)) À venir @else Terminé @endif
@if($sondage->statut === 'actif' && now()->between($sondage->date_debut, $sondage->date_fin))
Ce sondage est actuellement ouvert aux réponses.
@elseif($sondage->statut === 'inactif')
Ce sondage est inactif.
@elseif(now()->lt($sondage->date_debut))
Ce sondage n'est pas encore ouvert.
Début le {{ $sondage->date_debut->format('d/m/Y') }}
@else
Ce sondage est terminé.
Terminé le {{ $sondage->date_fin->format('d/m/Y') }}
@endif
Questions du sondage
@forelse($sondage->questions as $index => $question)
Question {{ $index + 1 }}
{{ ucfirst(str_replace('_', ' ', $question->type)) }}

{{ $question->texte }}

@if($question->type !== 'TEXTE_LIBRE')
    @foreach($question->options as $option)
  • {{ $option->texte }} @if($question->type === 'CHOIX_UNIQUE') (Réponses : {{ $question->reponses->where('option_id', $option->id)->count() }}) @endif
  • @endforeach
@endif
Réponses totales : {{ $question->reponses->count() }}
Créée le {{ $question->created_at->format('d/m/Y') }}
@empty

Aucune question n'a été définie pour ce sondage.

@endforelse
@endsection