@extends('layouts.staff_dashboard') @section('title', 'Document Request Details') @section('content')
@if(session('success') || session('error') || $errors->any())
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif @if($errors->any())
Please fix the following errors:
    @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
@endif

{{ $document->document }} Document Request Details

{{ count($students) }} Students Document Upload Status
@php $uploadedCount = 0; $pendingCount = 0; $totalFiles = 0; foreach ($students as $stu) { $docs = $uploadedDocs[$stu->id] ?? []; $fileCount = is_countable($docs) ? count($docs) : 0; $totalFiles += $fileCount; if ($fileCount > 0) { $uploadedCount++; } else { $pendingCount++; } } @endphp {{ count($students) }} Total Students • {{ $uploadedCount }} Uploaded • {{ $pendingCount }} Pending • {{ $totalFiles }} Total Files
@forelse($students as $stu) @php $docs = $uploadedDocs[$stu->id] ?? []; // Handle both array and object cases if (is_object($docs) && !is_array($docs)) { $docs = [$docs]; // Convert single object to array } $fileCount = count($docs); $hasDocuments = $fileCount > 0; @endphp
{{ $stu->name ?? 'N/A' }}
{{ $stu->regno ?? 'N/A' }}
Files: {{ $fileCount }}
@if($hasDocuments) {{ $fileCount }} File{{ $fileCount > 1 ? 's' : '' }} Uploaded @else No Files Uploaded @endif
@empty

No Students Found

There are no students in this document request.

@endforelse
@endsection