<?php $__env->startSection('title', 'Dashboard Admin - MagangTime'); ?>
<?php $__env->startSection('page-title', 'Dashboard'); ?>

<?php $__env->startSection('content'); ?>

<?php if($isHolidayToday): ?>
<div class="alert alert-info text-center mb-4">
    <i class="fas fa-calendar-alt fa-lg me-2"></i>
    <strong>Hari ini adalah hari libur!</strong> Presensi tidak dapat dilakukan.
</div>
<?php endif; ?>

<div class="row g-3 g-md-4 mb-4">
    <div class="col-6 col-md-3">
        <div class="card text-white" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);">
            <div class="card-body text-center py-3">
                <i class="fas fa-user-graduate fa-lg fa-md-2x mb-2 mb-md-3"></i>
                <h4 class="h5 h3-md fw-bold"><?php echo e($totalSiswa); ?></h4>
                <p class="mb-0 small">Total Siswa Magang</p>
            </div>
        </div>
    </div>
    <div class="col-6 col-md-3">
        <div class="card text-white" style="background: linear-gradient(135deg, #28a745 0%, #20c997 100%);">
            <div class="card-body text-center py-3">
                <i class="fas fa-sign-in-alt fa-lg fa-md-2x mb-2 mb-md-3"></i>
                <h4 class="h5 h3-md fw-bold"><?php echo e($sudahMasuk); ?></h4>
                <p class="mb-0 small">Sudah Masuk</p>
            </div>
        </div>
    </div>
    <div class="col-6 col-md-3">
        <div class="card text-white" style="background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);">
            <div class="card-body text-center py-3">
                <i class="fas fa-sign-out-alt fa-lg fa-md-2x mb-2 mb-md-3"></i>
                <h4 class="h5 h3-md fw-bold"><?php echo e($sudahPulang); ?></h4>
                <p class="mb-0 small">Sudah Pulang</p>
            </div>
        </div>
    </div>
    <div class="col-6 col-md-3">
        <div class="card text-white" style="background: linear-gradient(135deg, #dc3545 0%, #e83e8c 100%);">
            <div class="card-body text-center py-3">
                <i class="fas fa-times-circle fa-lg fa-md-2x mb-2 mb-md-3"></i>
                <h4 class="h5 h3-md fw-bold"><?php echo e($tidakHadir); ?></h4>
                <p class="mb-0 small">Tidak Hadir</p>
            </div>
        </div>
    </div>
</div>

<div class="row g-3 g-md-4">
    <div class="col-12 col-lg-8">
        <div class="card">
            <div class="card-header bg-primary text-white">
                <h5 class="mb-0"><i class="fas fa-clock me-2"></i>Presensi Hari Ini</h5>
            </div>
            <div class="card-body p-2 p-md-3">
                <?php if($recentAttendance->count() > 0): ?>
                    <div class="table-responsive">
                        <table class="table table-hover mb-0 table-sm">
                            <thead class="table-light">
                                <tr>
                                    <th class="small">Nama</th>
                                    <th class="small">Status</th>
                                    <th class="small d-none d-sm-table-cell">Jam Masuk</th>
                                    <th class="small d-none d-sm-table-cell">Jam Pulang</th>
                                    <th class="small d-sm-none">Waktu</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__currentLoopData = $recentAttendance; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $att): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td class="small">
                                        <strong><?php echo e($att->user->name); ?></strong>
                                        <?php if($att->user->siswa): ?>
                                            <br><small class="text-muted d-none d-md-inline"><?php echo e($att->user->siswa->sekolah->nama_sekolah); ?></small>
                                        <?php endif; ?>
                                    </td>
                                    <td>
                                        <span class="badge bg-<?php echo e($att->status_badge); ?> small">
                                            <?php echo e(ucfirst($att->status)); ?>

                                        </span>
                                    </td>
                                    <td class="small d-none d-sm-table-cell"><?php echo e($att->check_in_time ? $att->check_in_time->format('H:i') : '–'); ?></td>
                                    <td class="small d-none d-sm-table-cell"><?php echo e($att->check_out_time ? $att->check_out_time->format('H:i') : '–'); ?></td>
                                    <td class="small d-sm-none">
                                        <?php if($att->check_in_time): ?>
                                            <div>Masuk: <?php echo e($att->check_in_time->format('H:i')); ?></div>
                                        <?php endif; ?>
                                        <?php if($att->check_out_time): ?>
                                            <div>Pulang: <?php echo e($att->check_out_time->format('H:i')); ?></div>
                                        <?php endif; ?>
                                    </td>
                                </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>
                    </div>
                <?php else: ?>
                    <div class="text-center text-muted py-4">
                        <i class="fas fa-clock fa-2x fa-md-3x mb-3"></i>
                        <p class="small">Belum ada presensi hari ini</p>
                    </div>
                <?php endif; ?>
            </div>
        </div>
    </div>
    
    <div class="col-12 col-lg-4">
        <div class="card">
            <div class="card-header bg-success text-white">
                <h5 class="mb-0"><i class="fas fa-bolt me-2"></i>Menu Cepat</h5>
            </div>
            <div class="card-body">
                <div class="d-grid gap-2 gap-md-3">
                    <a href="<?php echo e(route('admin.siswa')); ?>" class="btn btn-primary">
                        <i class="fas fa-user-graduate me-2"></i>Kelola Siswa
                    </a>
                    <a href="<?php echo e(route('admin.rekap')); ?>" class="btn btn-info">
                        <i class="fas fa-chart-bar me-2"></i>Lihat Rekap
                    </a>
                    <form method="POST" action="<?php echo e(route('admin.auto-alfa')); ?>" class="d-inline">
                        <?php echo csrf_field(); ?>
                        <button type="submit" class="btn btn-warning w-100">
                            <i class="fas fa-robot me-2"></i>Auto Alfa
                        </button>
                    </form>
                    
                    <?php if($upcomingHoliday): ?>
                    <div class="alert alert-info mb-0 py-2">
                        <div class="d-flex align-items-center justify-content-between">
                            <div>
                                <i class="fas fa-calendar-alt me-1"></i>
                                <small class="fw-bold"><?php echo e($upcomingHoliday->date->isoFormat('D MMM')); ?></small>
                                <?php if($upcomingHoliday->date->isToday()): ?>
                                    <span class="badge bg-warning text-dark ms-1" style="font-size: 0.65em;">Hari Ini</span>
                                <?php endif; ?>
                            </div>
                        </div>
                        <small class="text-muted"><?php echo e(Str::limit($upcomingHoliday->description, 30)); ?></small>
                    </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\presensi-magang\resources\views/admin/dashboard.blade.php ENDPATH**/ ?>