@extends('layouts.admin') @section('content')

Student Answer Sheet

@if($result->user && $result->user->violations()->where('exam_id', $exam->id)->exists()) View Violations @endif Student Profile

Exam

{{ $exam->title }}

Student

{{ $result->user->name }}

Semester

{{ $result->user->semester ?? 'N/A' }}

Registration No

{{ $result->user->registration_no ?? 'N/A' }}

Total Questions

{{ $totalQuestions }}

Answered

{{ $attempted }}

Not Answered

{{ $notAnswered }}

Correct

{{ $result->correct ?? 0 }}

Wrong

{{ $result->wrong ?? 0 }}

Pass Mark

@php $passPercentage = (float) ($exam->pass_percentage ?? 40); @endphp

{{ number_format($passPercentage, 2) }}%

Obtained

{{ $result->obtained_marks }} / {{ $result->total_marks }}

Percentage

{{ number_format((float) $result->percentage, 2) }}%

Status

{{ $result->status }}

Submitted

{{ optional($result->submitted_at ?? $result->created_at)->format('d M Y, h:i A') }}

@foreach($questions as $index => $q) @php $response = $responses->get($q->id); $selectedOption = $response?->option; $correctOption = $q->options->firstWhere('is_correct', 1); $isAnswered = !is_null($response?->option_id); $isCorrect = (bool) ($response?->is_correct); $status = !$isAnswered ? 'Not Answered' : ($isCorrect ? 'Correct' : 'Wrong'); @endphp

Q{{ $index + 1 }}. {{ $q->question_text }}

Selected Option:

{{ $selectedOption?->option_text ?? 'Not Answered' }}

Correct Option:

{{ $correctOption?->option_text ?? 'N/A' }}

Status:

{{ $status }}

Marks Obtained:

{{ (int) ($response->marks_obtained ?? 0) }}

@endforeach
@endsection