@extends('layouts.app') @section('admin_title', 'Bulk Upload Students') @section('content')
@if ($errors->any())
@endif @if(request('validation_errors')) @php $ve = json_decode(request('validation_errors'), true); @endphp @if(is_array($ve))
@endif @endif {{-- ================= UPLOAD RESULT REPORT ================= --}} @if(session('bulk_upload_report')) @php $report = session('bulk_upload_report'); @endphp

Bulk Upload Report

Processed {{ number_format($report['total_rows']) }} row(s) in {{ $report['duration_sec'] }}s.

@if(!empty($report['issues'])) @endif
{{ number_format($report['total_rows']) }}
Total Rows
Read from CSV
{{ number_format($report['uploaded_count']) }}
Uploaded
Saved to database
{{ number_format($report['duplicate_count']) }}
Duplicates
Skipped automatically
{{ number_format($report['not_uploaded_count']) }}
Not Uploaded
{{ number_format($report['invalid_count']) }} invalid + {{ number_format($report['duplicate_count']) }} dup
@if(!empty($report['issues']))
Skipped Rows Breakdown
@if(!empty($report['truncated']))

Showing first 500 skipped rows.

@endif
@foreach($report['issues'] as $iss) @endforeach
Row # Name Regno Email Phone Status Reason
{{ $iss['row'] }} {{ $iss['name'] ?: '—' }} {{ $iss['regno'] ?: '—' }} {{ $iss['email'] ?: '—' }} {{ $iss['phone'] ?: '—' }} @if($iss['category'] === 'duplicate') Duplicate @else Invalid @endif {{ $iss['reason'] }}
@endif
@endif {{-- ================= UPLOAD FORM ================= --}}
@csrf @php $selection = session('student_selection'); $selectedDepartment = !empty($dept) ? \App\Models\Department::find($dept) : ($selection ? \App\Models\Department::find($selection['dept']) : null); $selectedBatch = !empty($batch) ? \App\Models\Batch::find($batch) : ($selection ? \App\Models\Batch::find($selection['batch']) : null); @endphp

Bulk Upload Students @if($selectedDepartment && $selectedBatch) — {{ $selectedDepartment->dept }} / {{ $selectedBatch->batch }} @endif

High-speed chunked importer with automatic DB & CSV duplicate checking (up to 20MB).

Sample CSV Back to Students
Required columns: name, regno, email, phone, yoj (10-digit phone, 4-digit YOJ). Max size: 20MB.
@endsection