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

Response Details

{{ $healthQuestionnaire->title }}

Response from {{ $response->client->name ?? 'Unknown Client' }}

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

Client Information

Name: {{ $response->client->name ?? 'Unknown' }}
@if($response->client->email)
Email: {{ $response->client->email }}
@endif @if($response->client->phone)
Phone: {{ $response->client->phone }}
@endif

Health Assessment

Health Score: @if($response->health_score)
{{ number_format($response->health_score, 1) }}
out of 10
@else Not calculated @endif
Risk Level: @php $riskLevel = $response->getHealthRisk(); $riskColor = match($riskLevel) { 'low' => 'badge-success', 'medium' => 'badge-warning', 'high' => 'badge-danger', 'very_high' => 'badge-danger', default => 'badge-light' }; @endphp {{ $response->getHealthRiskLabel() }}
Status: @php $status = $response->getStatus(); $statusColor = match($status) { 'approved' => 'badge-success', 'rejected' => 'badge-danger', 'pending' => 'badge-warning', 'incomplete' => 'badge-light', default => 'badge-light' }; @endphp {{ ucfirst($status) }}

Timeline

Submitted:
{{ $response->completed_at ? $response->completed_at->format('M j, Y') : $response->created_at->format('M j, Y') }}
{{ $response->completed_at ? $response->completed_at->format('g:i A') : $response->created_at->format('g:i A') }}
@if($response->approved_at)
Reviewed:
{{ $response->approved_at->format('M j, Y') }}
{{ $response->approved_at->format('g:i A') }}
@endif @if($response->approvedBy)
Reviewed by: {{ $response->approvedBy->name }}
@endif
@if($response->health_notes || $response->approval_notes)

Notes

@if($response->health_notes)

Health Notes:

{{ $response->health_notes }}

@endif @if($response->approval_notes)

Review Notes:

{{ $response->approval_notes }}

@endif
@endif

Response Details

@php $formattedResponses = $response->getFormattedResponses(); @endphp @forelse($healthQuestionnaire->questions as $index => $question) @php $questionId = $question['id'] ?? $index; $userResponse = $response->responses[$questionId] ?? null; @endphp

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

{{ $question['question'] }}

{{ ucfirst(str_replace('_', ' ', $question['type'])) }} @if(isset($question['risk_weight']) && $question['risk_weight'] > 0) Risk: {{ $question['risk_weight'] }} @endif
Response: @if($userResponse)
@if($question['type'] === 'multiple_choice') {{ $userResponse }} @elseif($question['type'] === 'yes_no') @php $yesNoColor = strtolower($userResponse) === 'yes' ? 'badge-success' : 'badge-danger'; @endphp {{ ucfirst($userResponse) }} @elseif($question['type'] === 'rating_scale')
{{ $userResponse }} / 10
@else

{{ $userResponse }}

@endif
@else No response @endif
@empty

No questions found

This questionnaire doesn't have any questions.

@endforelse

Actions

@if($response->getStatus() !== 'approved')
@csrf @method('PATCH')
@endif @if($response->getStatus() !== 'rejected') @endif Back to Responses
@endsection