@extends('layouts.app') @section('content')
{{-- Header --}}

πŸ“‹ My Assignments

Track your progress and payments in one place

@php $assignments = Auth::user()->assignments()->with(['classRoom', 'center'])->get(); @endphp @if($assignments->isEmpty())
No assignments available yet

Once you’re assigned a class, it will appear here.

@else {{-- Desktop Table View --}}
@foreach($assignments as $a) @php $today = now(); $statusClass = $a->amount_due == 0 ? 'bg-success' : ($a->amount_paid > 0 ? 'bg-warning text-dark' : 'bg-secondary'); $statusText = $a->amount_due == 0 ? 'Completed' : ($a->amount_paid > 0 ? 'Partial' : 'Pending'); @endphp @endforeach
Class Center Duration Days Total Paid Due Status
{{ $a->classRoom->class_number ?? 'β€”' }} {{ $a->center->name ?? 'β€”' }} {{ \Carbon\Carbon::parse($a->start_date)->format('d M') }} - {{ \Carbon\Carbon::parse($a->end_date)->format('d M Y') }} {{ $a->number_of_days }} Ksh {{ number_format($a->total_amount, 2) }} Ksh {{ number_format($a->amount_paid ?? 0, 2) }} Ksh {{ number_format($a->amount_due ?? 0, 2) }} {{ $statusText }}
{{-- Mobile Card View --}}
@foreach($assignments as $a) @php $today = now(); $statusClass = $a->amount_due == 0 ? 'bg-success' : ($a->amount_paid > 0 ? 'bg-warning text-dark' : 'bg-secondary'); $statusText = $a->amount_due == 0 ? 'Completed' : ($a->amount_paid > 0 ? 'Partial' : 'Pending'); @endphp
Class {{ $a->classRoom->class_number ?? 'β€”' }}
{{ $statusText }}

{{ $a->center->name ?? 'β€”' }}

Duration: {{ \Carbon\Carbon::parse($a->start_date)->format('d M') }} - {{ \Carbon\Carbon::parse($a->end_date)->format('d M Y') }}

Days: {{ $a->number_of_days }}


Total: Ksh {{ number_format($a->total_amount, 2) }}

Paid: Ksh {{ number_format($a->amount_paid ?? 0, 2) }}

Due: Ksh {{ number_format($a->amount_due ?? 0, 2) }}

@endforeach
@endif
{{-- Styles --}} @endsection