@extends('layouts.app') @section('title', 'Survey Results - ' . $survey->survey_name) @section('content')

1.0 Engagement Survey App: Results

Survey: {{ $survey->survey_name }}

Generated on {{ date('F d, Y') }}
@if(!isset($isPdf) || !$isPdf) @endif
{{--
Total Surveys
{{ $totalSurveysCount ?? 0 }}
{{ $period === '7d' ? 'Last 7 days' : ($period === '30d' ? 'Last 30 days' : 'All Time') }}
--}}
Total Attempts
{{ $attemptsTotalCount ?? 0 }}
{{ $period === '7d' ? 'Last 7 days' : ($period === '30d' ? 'Last 30 days' : 'All') }}
Submitted
{{ $submittedAttemptsCount ?? 0 }}
{{ $period === '7d' ? 'Last 7 days' : ($period === '30d' ? 'Last 30 days' : 'All') }}
Drafts
{{ $draftAttemptsCount ?? 0 }}
{{ $period === '7d' ? 'Last 7 days' : ($period === '30d' ? 'Last 30 days' : 'All') }}
@foreach ($results as $index => $result)
Q{{ $index + 1 }}. {{ $result['question'] }}
Total Responses: {{ is_string($result['data']) ? array_sum(json_decode($result['data'], true)) : array_sum($result['data']) }}
{{-- @if(!isset($isPdf) || !$isPdf) @endif --}}
@if(isset($isPdf) && $isPdf)

Chart visualization not available in PDF format

View online for interactive charts
@else
@endif
@endforeach
Survey Summary

{{ count($results) }}

Total Questions
@php $totalResponses = array_reduce($results, function($carry, $result) { $data = is_string($result['data']) ? json_decode($result['data'], true) : $result['data']; return $carry + array_sum($data); }, 0); @endphp

{{ $attemptsTotalCount }}

Total Attempts

{{ date('M Y') }}

Survey Period

{{ $totalResponses > 0 ? round(($totalResponses / count($results)), 1) : 0 }}

Avg Response/Question
Detailed Response Breakdown
Export Data
@foreach ($results as $index => $result) @php if (is_string($result['data'])) { $result['data'] = json_decode($result['data'], true); } $total = array_sum($result['data']); @endphp @foreach ($result['data'] as $option => $count) @if ($loop->first) @endif @endforeach @endforeach
Question Response Options Count Percentage
Q{{ $index + 1 }}. {{ Str::limit($result['question'], 50) }} {{ $option }} {{ $count }}
{{ $total > 0 ? round(($count / $total) * 100, 1) : 0 }}%
@endsection @push('js') @endpush