@extends('layouts.admin.base') @section('page-title') Survey Analytics - {{ $survey->name }} @endsection @section('content')
@include('admin.settings.layouts.sidebard')

{{ $survey->name }} Analytics

Detailed analysis of survey responses and user participation.

{{ $totalResponses }}

Total Responses

{{ $participationRate }}%

Participation Rate

{{ $totalUsers }}

Total Users

{{ $survey->questions->count() }}

Questions

Survey Details

Survey Type: @if($survey->plan) Incentive Survey
Plan: {{ $survey->plan->name }} @else Data Collection Only @endif

Duration: {{ \Carbon\Carbon::parse($survey->start_at)->format('M d, Y') }} - {{ \Carbon\Carbon::parse($survey->end_at)->format('M d, Y') }}

Status: @if(\Carbon\Carbon::now()->between($survey->start_at, $survey->end_at)) Active @else Inactive @endif

Created: {{ \Carbon\Carbon::parse($survey->created_at)->format('M d, Y H:i') }}

Question Analytics
@foreach($questionAnalytics as $index => $question)
Q{{ $index + 1 }}: {{ $question['question'] }}

Type: {{ $question['type'] }} | Total Responses: {{ $question['total_responses'] }}

@foreach($question['answers'] as $answer)
{{ $answer['answer'] }}
{{ $answer['count'] }} responses
{{ $answer['percentage'] }}%
@endforeach
@if($index < count($questionAnalytics) - 1)
@endif @endforeach
@if($dailyResponses->count() > 0)
Daily Response Trends
@endif @if($userDemographics->count() > 0)
User Demographics
@foreach($userDemographics as $demo)
{{ $demo->country ?? 'Unknown' }}

{{ $demo->count }} users

@endforeach
@endif
@endsection @section('scripts') @endsection