@extends('layouts.student_dashboard') @section('title', 'Practice Questions') @push('styles') @endpush @section('content') @php $courseData = \Illuminate\Support\Facades\DB::table('courses')->where('id', $course_id)->first(); $moduleData = \Illuminate\Support\Facades\DB::table('modules')->where('id', $module_id)->first(); $topicData = \Illuminate\Support\Facades\DB::table('topics')->where('id', $topic_id)->first(); $mcqTotalCount = count($mcq_questions ?? []); $codingTotalCount = count($coding_questions ?? []); $mcqSolvedIds = $completed_mcqs ?? []; $codingSolvedIds = $completed_codings ?? []; $mcqSolvedCount = 0; foreach ($mcq_questions as $m) { if (in_array($m->id, $mcqSolvedIds)) $mcqSolvedCount++; } $codingSolvedCount = 0; foreach ($coding_questions as $c) { if (in_array($c->id, $codingSolvedIds)) $codingSolvedCount++; } $totalQuestionsAll = $mcqTotalCount + $codingTotalCount; $totalSolvedAll = $mcqSolvedCount + $codingSolvedCount; $overallPct = $totalQuestionsAll > 0 ? (int) round(($totalSolvedAll / $totalQuestionsAll) * 100) : 0; @endphp
{{-- ================================================================ 1. LITTLE BUDS CODING — ANIMATED MISSION ARENA HERO ================================================================ --}}
{{-- Daytime Sun --}} {{-- Nighttime Moon & Stars --}}
@csrf

{{ $topicData->topic ?? 'Mission Practice' }}

{{ $courseData->coursename ?? 'Course' }} {{ $moduleData->module ?? 'Level' }} @if(!empty($language)) {{ strtoupper($language) }} @endif
{{-- Tappable Animated Coding Owl Buddy --}}
Quizzes Done {{ $mcqSolvedCount }}/{{ $mcqTotalCount }}
Puzzles Done {{ $codingSolvedCount }}/{{ $codingTotalCount }}
Mission Mastery {{ $overallPct }}%
{{-- ================================================================ 2. DUAL PRACTICE PANES (QUIZZES + CODING PUZZLES) ================================================================ --}}
{{-- LEFT PANE: QUICK QUIZZES (MCQs) --}}

Quick Quizzes

{{ $mcqTotalCount }} fun {{ \Illuminate\Support\Str::plural('quiz', $mcqTotalCount) }} in this mission

@if($mcqTotalCount > 0)
@csrf
@endif
@if($mcqTotalCount > 0)
@endif
@forelse($mcq_questions as $mcq) @php $lvl = strtolower((string) ($mcq->level ?? 'medium')); $lvlClass = $lvl === 'easy' ? 'easy' : ($lvl === 'medium' ? 'medium' : 'hard'); $lvlLabel = ucfirst($lvlClass); $isSolved = in_array($mcq->id, $mcqSolvedIds); @endphp
@if($isSolved) @else Q{{ $loop->iteration }} @endif

{{ strip_tags($mcq->question) }}

{{ $lvlLabel }} Solved!
@empty

No Quizzes Yet

No quizzes have been added for this mission yet.

@endforelse
{{-- RIGHT PANE: CODING PUZZLES --}}

Coding Puzzles

{{ $codingTotalCount }} coding {{ \Illuminate\Support\Str::plural('puzzle', $codingTotalCount) }} in this mission

@if($codingTotalCount > 0)
@csrf
@endif
@if($codingTotalCount > 0)
@endif
@forelse($coding_questions as $code) @php $lvl = strtolower((string) ($code->level ?? 'medium')); $lvlClass = $lvl === 'easy' ? 'easy' : ($lvl === 'medium' ? 'medium' : 'hard'); $lvlLabel = ucfirst($lvlClass); $isSolved = in_array($code->id, $codingSolvedIds); @endphp
@if($isSolved) @else C{{ $loop->iteration }} @endif

{{ $code->title }}

{{ $lvlLabel }} Solved!
@empty

No Coding Puzzles Yet

No coding puzzles have been added for this mission yet.

@endforelse
{{-- ================================================================ DUOLINGO-STYLE KIDS QUIZ MODAL ================================================================ --}}
@csrf
@endsection