@foreach($quizSets as $quizSet)
@php
$isAllocatedForThisDate = in_array($quizSet->quiz_name, $allocatedQuizSets ?? []);
$isAlreadyAllocatedOtherDates = in_array($quizSet->quiz_name, $alreadyAllocatedQuizSets ?? []) && !$isAllocatedForThisDate;
$isDisabled = $isAllocatedForThisDate || $isPastDate;
$allocationDate = $quizSetAllocationDates[$quizSet->quiz_name] ?? null;
$totalTime = $quizSet->total_time ?? 0;
if ($totalTime < 60) {
$timeDisplay = $totalTime . ' sec';
} else {
$minutes = floor($totalTime / 60);
$seconds = $totalTime % 60;
$timeDisplay = $minutes . ':' . str_pad($seconds, 2, '0', STR_PAD_LEFT);
}
@endphp
@if($isAllocatedForThisDate)
@endif
{{ $quizSet->quiz_name }}
@if($isAlreadyAllocatedOtherDates && !$isAllocatedForThisDate)
Allocated on {{ date('d/m', strtotime($allocationDate)) }}
@endif
{{ $quizSet->question_count }} Questions
{{ $timeDisplay }} total
@if(in_array($quizSet->quiz_name, $alreadyAllocatedQuizSets ?? []))
Allocated on: {{ \Carbon\Carbon::parse($allocationDate)->format('d/m/Y') }}
@endif
@if($isAllocatedForThisDate && !$isPastDate)
@endif
@if(isset($allQuestions[$quizSet->quiz_name]))
@foreach($allQuestions[$quizSet->quiz_name] as $question)
Q{{ $loop->iteration }}:
{{ Str::limit($question->question, 50) }}
{{ $question->question_type == 'quiz' ? 'MCQ' : 'T/F' }}
@endforeach
@else
No questions found
@endif
@if(!$isPastDate)
@if($isAlreadyAllocatedOtherDates && !$isAllocatedForThisDate)
Already allocated on other date
@endif
@else
Read-only
@endif
@endforeach