{{ isset($lang) && $lang === 'ar' ? ($test->NAME_AR ?: $test->NAME_EN) : $test->NAME_EN }} Generated: {{ date('Y-m-d H:i:s') }}
@if(isset($questionsByCategory) && $questionsByCategory->isNotEmpty()) @foreach($questionsByCategory as $categoryName => $questions)
@if ($categoryName != 'General Information' && $categoryName != 'معلومات عامة')
{{ $categoryName }}
@endif
{{ $questionnaireName ?? 'Template Form' }}
@php $count = 0; @endphp @foreach($questions as $key => $question) @php // Check if this is a question with many options $isWideQuestion = false; if ($question->TYPE == 'SELECT' || $question->TYPE == 'MULTIPLE_SELECT') { $optionsCount = $question->options->count(); $isWideQuestion = ($optionsCount > 2); } // Start a new row if needed if ($count % 2 == 0 || $isWideQuestion) { echo ''; } @endphp @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 ''; } elseif ($count % 2 == 0) { // Otherwise close the row when we have two elements echo ''; } @endphp @endforeach @if($count % 2 != 0) @endif
{{$key + 1}} {{ isset($lang) && $lang === 'ar' ? ($question->NAME_AR ?: $question->NAME_EN) : $question->NAME_EN }}
@if($question->TYPE == 'SELECT' || $question->TYPE == 'MULTIPLE_SELECT') @if($question->options->count() > 0)
@foreach($question->options->chunk(3) as $optionChunk)
@foreach($optionChunk as $option)
{{ isset($lang) && $lang === 'ar' ? ($option->NAME_AR ?: $option->NAME_EN) : $option->NAME_EN }}
@endforeach
@endforeach
@else
No options available
@endif @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'])) File @else Download @endif @else
No file available
@endif @else
@endif
@endforeach @else {{-- Fallback to original structure if questionsByCategory is not available --}}
@if (!empty($categoryName) && $categoryName != 'General Information' && $categoryName != 'معلومات عامة')
{{ $categoryName }}
@endif
{{ $questionnaireName ?? 'Template Form' }}
@php $count = 0; @endphp @foreach($questions as $key => $question) @php // Check if this is a question with many options $isWideQuestion = false; if ($question->TYPE == 'SELECT' || $question->TYPE == 'MULTIPLE_SELECT') { $optionsCount = $question->options->count(); $isWideQuestion = ($optionsCount > 2); } // Start a new row if needed if ($count % 2 == 0 || $isWideQuestion) { echo ''; } @endphp @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 ''; } elseif ($count % 2 == 0) { // Otherwise close the row when we have two elements echo ''; } @endphp @endforeach @if($count % 2 != 0) @endif
{{$loop->iteration}} {{ isset($lang) && $lang === 'ar' ? ($question->NAME_AR ?: $question->NAME_EN) : $question->NAME_EN }}
@if($question->TYPE == 'SELECT' || $question->TYPE == 'MULTIPLE_SELECT') @if($question->options->count() > 0)
@foreach($question->options->chunk(3) as $optionChunk)
@foreach($optionChunk as $option)
{{ isset($lang) && $lang === 'ar' ? ($option->NAME_AR ?: $option->NAME_EN) : $option->NAME_EN }}
@endforeach
@endforeach
@else
No options available
@endif @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'])) File @else Download @endif @else
No file available
@endif @else
@endif
@endif