<?php $__env->startSection('title', 'Campus Sponsorship'); ?>

<?php $__env->startSection('content'); ?>
<div class="pg-head">
    <div>
        <h1>Campus Sponsorship</h1>
        <p>Review university applications, approve sponsored CAMPUS events, and monitor <?php echo e(config('mexco.campus.default_retention_days')); ?>-day data retention.</p>
    </div>
    <a href="<?php echo e(route('mexco.super.campus.create')); ?>" class="btn-purple">+ Record application</a>
</div>

<div class="stat-row">
    <div class="card stat-card">
        <div class="stat-label">Pending review</div>
        <div class="stat-num"><?php echo e($stats['pending']); ?></div>
    </div>
    <div class="card stat-card">
        <div class="stat-label">Active / approved</div>
        <div class="stat-num"><?php echo e($stats['approved']); ?></div>
    </div>
    <div class="card stat-card">
        <div class="stat-label">Expiring (14 days)</div>
        <div class="stat-num" style="color:var(--mexco-accent)"><?php echo e($stats['expiring_soon']); ?></div>
    </div>
    <div class="card stat-card">
        <div class="stat-label">Total in-kind value</div>
        <div class="stat-num" style="font-size:1.25rem">MYR <?php echo e(number_format($stats['total_sponsorship_value_cents'] / 100, 0)); ?></div>
    </div>
</div>

<div class="card section-card" style="margin-bottom:1rem">
    <form method="GET" class="d-flex flex-wrap gap-2 align-items-center">
        <input type="search" name="q" class="form-input" style="max-width:280px" placeholder="Reference, institution, event…" value="<?php echo e($q); ?>">
        <select name="status" class="form-input" style="max-width:200px">
            <option value="">All statuses</option>
            <option value="pending" <?php if($status === 'pending'): echo 'selected'; endif; ?>>Needs approval</option>
            <?php $__currentLoopData = \App\Models\MexcoCampusApplication::statuses(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $code => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option value="<?php echo e($code); ?>" <?php if($status === $code): echo 'selected'; endif; ?>><?php echo e($label); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
        <button type="submit" class="btn-outline btn-sm">Filter</button>
    </form>
</div>

<div class="card">
    <div class="tbl-wrap">
        <table class="data-tbl">
            <thead>
                <tr>
                    <th>Reference</th>
                    <th>Institution / event</th>
                    <th>Contact</th>
                    <th>Event date</th>
                    <th>Sponsorship</th>
                    <th>Status</th>
                    <th style="text-align:right">Actions</th>
                </tr>
            </thead>
            <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $applications; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $app): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <?php
                        $pill = match($app->status) {
                            'submitted', 'under_review' => '',
                            'rejected', 'deleted' => 'muted',
                            'active', 'event_created' => 'success',
                            'retention' => 'accent',
                            default => '',
                        };
                    ?>
                    <tr>
                        <td class="mono"><?php echo e($app->reference_no); ?></td>
                        <td>
                            <div class="cell-name"><?php echo e($app->institution); ?></div>
                            <div class="cell-sub"><?php echo e($app->event_name); ?></div>
                            <?php if($app->event_id): ?>
                                <div class="cell-sub mono"><?php echo e($app->event_id); ?></div>
                            <?php endif; ?>
                        </td>
                        <td class="cell-sub">
                            <?php echo e($app->contact_person); ?><br>
                            <?php echo e($app->contact_email); ?>

                        </td>
                        <td><?php echo e($app->event_date?->format('d M Y') ?? '-'); ?></td>
                        <td><?php echo e($app->formattedSponsorshipValue()); ?></td>
                        <td><span class="status-pill <?php echo e($pill); ?>"><?php echo e($app->statusLabel()); ?></span></td>
                        <td>
                            <div class="action-group">
                                <a href="<?php echo e(route('mexco.super.campus.show', $app)); ?>" class="btn-outline btn-sm">View</a>
                            </div>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr><td colspan="7" class="text-center cell-sub py-4">No campus applications yet.</td></tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('super-admin.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\myapp\resources\views/super-admin/campus/index.blade.php ENDPATH**/ ?>