@foreach($surveyResponse->answers as $i => $answer)
{{ $i+1 }}
{{ $surveyResponse->language === 'bn' && $answer->question->question_text_bn ? $answer->question->question_text_bn : $answer->question->question_text }}
@php $hasAnswer = ($answer->answer_text && trim($answer->answer_text) !== '') || (!empty($answer->answer_options)); @endphp
@if(!$hasAnswer)
No answer provided
@elseif($answer->answer_text)
{{ $answer->answer_text }}
@elseif($answer->answer_options)
@php $opts = $answer->answer_options; @endphp
@if(is_array($opts))
@foreach($opts as $opt)
@php
$label = $opt;
$qOpts = $answer->question->options;
if (is_array($qOpts)) {
foreach ($qOpts as $qo) {
if (($qo['value'] ?? null) === $opt) {
$label = $surveyResponse->language === 'bn' && isset($qo['label_bn']) ? $qo['label_bn'] : ($qo['label'] ?? $opt);
}
}
}
@endphp
{{ $label }}
@endforeach
@else
{{ $opts }}
@endif
@endif
@endforeach