<?php $__env->startSection('title', 'Fee Balance'); ?>
<?php $__env->startSection('page-title', 'Fee Balance'); ?>
<?php $__env->startSection('sidebar-nav'); ?>
<div class="nav-item"><a href="<?php echo e(route('student.dashboard')); ?>"><i class="bi bi-grid"></i> Dashboard</a></div>
<div class="nav-item"><a href="<?php echo e(route('student.results')); ?>"><i class="bi bi-bar-chart"></i> My Results</a></div>
<div class="nav-item"><a href="<?php echo e(route('student.fees')); ?>"><i class="bi bi-cash"></i> Fee Balance</a></div>
<div class="nav-item"><a href="<?php echo e(route('student.attendance')); ?>"><i class="bi bi-calendar-check"></i> Attendance</a></div>
<div class="nav-item"><a href="<?php echo e(route('student.assignments')); ?>"><i class="bi bi-file-earmark-text"></i> Assignments</a></div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="page-header"><div><h1>Fee Balance</h1></div></div>

<?php $__empty_1 = true; $__currentLoopData = $invoices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $invoice): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
<div class="card" style="margin-bottom:16px;">
    <div class="card-header">
        <h5><?php echo e($invoice->term->name); ?></h5>
        <span class="badge <?php echo e($invoice->status === 'paid' ? 'badge-success' : ($invoice->status === 'partial' ? 'badge-warning' : 'badge-danger')); ?>">
            <?php echo e(ucfirst($invoice->status)); ?>

        </span>
    </div>
    <div class="card-body">
        <div class="grid grid-3">
            <div><div style="font-size:12px;color:var(--gray);">Total Fee</div><div style="font-size:20px;font-weight:700;">KES <?php echo e(number_format($invoice->total_amount)); ?></div></div>
            <div><div style="font-size:12px;color:var(--gray);">Amount Paid</div><div style="font-size:20px;font-weight:700;color:var(--success);">KES <?php echo e(number_format($invoice->amount_paid)); ?></div></div>
            <div><div style="font-size:12px;color:var(--gray);">Balance</div><div style="font-size:20px;font-weight:700;color:<?php echo e($invoice->balance > 0 ? 'var(--danger)' : 'var(--success)'); ?>;">KES <?php echo e(number_format($invoice->balance)); ?></div></div>
        </div>
        <?php if($invoice->payments->count()): ?>
        <div style="margin-top:16px;">
            <div style="font-size:13px;font-weight:600;margin-bottom:8px;">Payment History</div>
            <?php $__currentLoopData = $invoice->payments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $payment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <div style="display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px solid var(--border);font-size:13px;">
                <span><?php echo e($payment->payment_date->format('d M Y')); ?> &bull; <?php echo e(strtoupper($payment->method)); ?></span>
                <span style="font-weight:600;">KES <?php echo e(number_format($payment->amount)); ?></span>
            </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
        <?php endif; ?>
    </div>
</div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
<div class="card"><div class="card-body" style="text-align:center;padding:40px;color:var(--gray);">No fee invoices found</div></div>
<?php endif; ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\cbe\resources\views\student\fees.blade.php ENDPATH**/ ?>