@extends('crm.layouts.app') @section('title', 'Health Questionnaire Details') @section('content')

{{ $healthQuestionnaire->title }}

@if($healthQuestionnaire->description)

{{ $healthQuestionnaire->description }}

@endif
@if(session('success'))

{{ session('success') }}

@endif
Total Questions
{{ count($healthQuestionnaire->questions) }}
Total Responses
{{ $responseStats['total'] }}
Pending Reviews
{{ $responseStats['pending'] }}
Approved
{{ $responseStats['approved'] }}

Status & Settings

Status: @if($healthQuestionnaire->is_active) Active @else Inactive @endif
Created: {{ $healthQuestionnaire->created_at->format('M j, Y g:i A') }}
Last Updated: {{ $healthQuestionnaire->updated_at->format('M j, Y g:i A') }}

Risk Level Distribution

{{ $responseStats['low_risk'] }}
Low Risk
{{ $responseStats['medium_risk'] }}
Medium Risk
{{ $responseStats['high_risk'] }}
High Risk
{{ $responseStats['very_high_risk'] }}
Very High Risk

Questions Preview

{{ count($healthQuestionnaire->questions) }} Questions
@forelse($healthQuestionnaire->questions as $index => $question)

Question {{ $index + 1 }} @if($question['required'] ?? false) * @endif

{{ ucfirst(str_replace('_', ' ', $question['type'])) }} @if(isset($question['risk_weight']) && $question['risk_weight'] > 0) Risk: {{ $question['risk_weight'] }} @endif

{{ $question['question'] }}

@if($question['type'] === 'multiple_choice' && isset($question['options']))
Options:
    @foreach($question['options'] as $option)
  • {{ $option }}
  • @endforeach
@elseif($question['type'] === 'rating_scale')
Rating scale: 1-10
@elseif($question['type'] === 'yes_no')
Yes/No response
@endif
@empty

No questions found

This questionnaire doesn't have any questions yet.

@endforelse
@if($healthQuestionnaire->responses->count() > 0)

Recent Responses

View All Responses
@foreach($healthQuestionnaire->responses->take(5) as $response) @endforeach
Client Health Score Risk Level Status Submitted
{{ $response->client->name ?? 'Unknown Client' }} @if($response->health_score) {{ number_format($response->health_score, 1) }} @else — @endif @php $riskLevel = $response->getHealthRisk(); $riskBadge = match($riskLevel) { 'low' => 'bg-green-50 text-green-700 ring-green-600/20', 'medium' => 'bg-yellow-50 text-yellow-800 ring-yellow-600/20', 'high' => 'bg-orange-50 text-orange-700 ring-orange-600/20', 'very_high' => 'bg-red-50 text-red-700 ring-red-600/20', default => 'bg-gray-50 text-gray-600 ring-gray-500/10' }; @endphp {{ $response->getHealthRiskLabel() }} @php $status = $response->getStatus(); $statusBadge = match($status) { 'approved' => 'bg-green-50 text-green-700 ring-green-600/20', 'rejected' => 'bg-red-50 text-red-700 ring-red-600/20', 'pending' => 'bg-yellow-50 text-yellow-800 ring-yellow-600/20', 'incomplete' => 'bg-gray-50 text-gray-600 ring-gray-500/10', default => 'bg-gray-50 text-gray-600 ring-gray-500/10' }; @endphp {{ ucfirst($status) }} {{ $response->completed_at ? $response->completed_at->format('M j, Y') : $response->created_at->format('M j, Y') }}
@endif

Actions

Edit Questionnaire View All Responses @if($healthQuestionnaire->is_active) @else @endif @if($healthQuestionnaire->responses->count() === 0)
@csrf @method('DELETE')
@endif
@endsection