@extends('layouts.portal') @section('title', $batch->course?->title ?? 'Batch') @section('subtitle', $batch->batch_code.' · '.ucfirst($batch->mode).($batch->schedule ? ' · '.$batch->schedule : '')) @section('actions') Batches Edit Attendance @if($batch->course)@endif
@csrf
@if($batch->status !== 'Completed')@endif @endsection @section('content') @php $tz = $batch->timezone ?: config('app.timezone'); $taken = $sessions->whereNotNull('taken_at')->count(); $upcoming = $sessions->where('status', 'scheduled')->where('starts_at', '>=', now())->count(); $seats = $batch->seatsTaken(); $avg = $roster->whereNotNull('percent')->avg('percent'); $rosterByUser = $roster->keyBy(fn ($r) => $r['user']->id); $min = $batch->minAttendance(); @endphp
Status{{ $batch->start_date?->format('d M Y') ?? 'No start date' }}{{ $batch->end_date ? ' to '.$batch->end_date->format('d M Y') : '' }}
Seats{{ $seats }}{{ $batch->seat_limit ? ' / '.$batch->seat_limit : '' }}{{ $batch->seat_limit ? max(0, $batch->seat_limit - $seats).' left' : 'Unlimited seats' }}
Classes{{ $sessions->count() }}{{ $upcoming }} upcoming · {{ $taken }} registers taken
Average attendance{{ $avg !== null ? rtrim(rtrim(number_format($avg, 1), '0'), '.').'%' : 'n/a' }}minimum {{ $min }}% for a certificate

Batch details

Edit
Course
{{ $batch->course?->title }}
Trainer
{{ $batch->trainer?->name ?? $batch->trainer_name ?? 'Not assigned' }}
Fee
{{ $batch->fee !== null ? money($batch->fee) : 'Course fee' }}
Platform
{{ $batch->platform ?: '—' }}
@if($batch->meeting_url)
Meeting link
{{ $batch->meeting_url }}
@endif @if($batch->location)
Venue
{{ $batch->location }}
@endif
Enrollment deadline
{{ $batch->enrollment_deadline?->format('d M Y') ?? 'None' }}
Minimum attendance
{{ $min }}%

Class sessions

Times shown in {{ $tz }}
@if($sessions->isEmpty()) @else
@foreach($sessions as $s) @php $local = $s->starts_at->copy()->setTimezone($tz); $minutes = $s->durationMinutes(); @endphp @endforeach
#Date & timeClassStatusAttendanceActions
{{ $loop->iteration }} {{ $local->format('D, d M Y') }}
{{ $local->format('g:i A') }} · {{ $minutes }} min
{{ $s->displayTitle() }}@if($s->topic)
{{ $s->topic }}
@endif @if($s->meeting_url)@endif
@if($s->taken_at){{ $s->present_count }} of {{ $roster->count() }} present@elseif($s->status === 'cancelled')n/a@elseMark attendance@endif
@unless($s->taken_at)
@csrf @method('DELETE')
@endunless
@endif

Generate classes

@unless($batch->start_date)Set a start date first@endunless
@csrf
Days of the week *
@foreach([1 => 'Mon', 2 => 'Tue', 3 => 'Wed', 4 => 'Thu', 5 => 'Fri', 6 => 'Sat', 0 => 'Sun'] as $d => $lab) @endforeach
@error('weekdays')
{{ $message }}
@enderror
Counting starts from {{ $batch->start_date?->format('d M Y') ?? 'the start date' }}. Existing times are skipped.

Learners and attendance

Full register
@if($enrollments->isEmpty()) Find a learner @else
@foreach($enrollments as $e) @php $r = $rosterByUser[$e->user_id] ?? null; $pct = $r['percent'] ?? null; @endphp @endforeach
LearnerEnrollmentPaymentAttendanceP / L / A / E
{{ $e->user?->initials() }}@if($e->user){{ $e->user->name }}@endif
{{ money($e->paid_amount) }} / {{ money($e->netFee()) }} @if($r && $pct !== null)
{{ rtrim(rtrim(number_format($pct, 1), '0'), '.') }}%
@else{{ $r ? 'No registers yet' : 'Not attending' }}@endif
@if($r){{ $r['present'] }} / {{ $r['late'] }} / {{ $r['absent'] }} / {{ $r['excused'] }}@else—@endif
@endif
@if($batch->status !== 'Completed') @endif @if($batch->course)@include('admin.courses._send-details', ['course' => $batch->course, 'batch' => $batch])@endif @push('scripts')@endpush @endsection