@if($question->TYPE == 'SELECT' || $question->TYPE == 'MULTIPLE_SELECT')
@php
$selectedOptionIds = [];
if (isset($test['answers'][$question->ID])) {
if (!empty($test['answers'][$question->ID]->OPTION_ID)) {
$selectedOptionIds = is_array($test['answers'][$question->ID]->OPTION_ID) ?
$test['answers'][$question->ID]->OPTION_ID :
json_decode($test['answers'][$question->ID]->OPTION_ID, true) ?? [];
} elseif (!empty($test['answers'][$question->ID]->ANSWER)) {
$selectedOptionIds = explode(',', $test['answers'][$question->ID]->ANSWER);
}
}
@endphp
@foreach($question->options->chunk(3) as $optionChunk)
@elseif($question->TYPE == 'FILE')
@elseif($question->TYPE == 'DOWNLOAD_FILE')
@if(!empty($question->FILE_PATH))
@php
$fileUrl = 'https://s3.eu-west-1.amazonaws.com/blazma.com' . $question->FILE_PATH;
$fileExt = strtolower(pathinfo($question->FILE_PATH, PATHINFO_EXTENSION));
@endphp
@if(in_array($fileExt, ['jpg', 'jpeg', 'png', 'gif']))
@foreach($optionChunk as $option)
@php
$isSelected = in_array($option->ID, $selectedOptionIds)
|| in_array($option->NAME_EN, $selectedOptionIds);
@endphp
@endforeach
{{ isset($lang) && $lang === 'ar' ? ($option->NAME_AR ?: $option->NAME_EN) : $option->NAME_EN }}
@endforeach
No file available
@endif
@else
@if(isset($test['answers'][$question->ID]) && !empty($test['answers'][$question->ID]->ANSWER))
{{ $test['answers'][$question->ID]->ANSWER }}
@else
@endif
@endif
|
@php
// Increment count
$count++;
// If it's a wide question, start a new row after it
if ($isWideQuestion) {
$count = $count % 2 == 0 ? $count : $count + 1;
echo '@endif |