<?php $__env->startSection('title', 'Siswa Bimbingan'); ?>
<?php $__env->startSection('page-title', 'Siswa Bimbingan'); ?>

<?php $__env->startSection('content'); ?>
<div class="card">
    <div class="card-header bg-white">
        <div class="row align-items-center">
            <div class="col-12 col-md-6 mb-2 mb-md-0">
                <h5 class="mb-0"><i class="fas fa-users me-2"></i>Kelola Siswa Bimbingan</h5>
            </div>
            <div class="col-12 col-md-6 text-md-end">
                <span class="badge bg-primary fs-6"><?php echo e($siswa->total()); ?> Siswa</span>
            </div>
        </div>
        
        <div class="row mt-3">
            <div class="col-12 col-md-8">
                <form method="GET" action="<?php echo e(route('pembimbing-magang.siswa')); ?>" class="d-flex flex-column flex-sm-row">
                    <input type="text" name="search" class="form-control me-sm-2 mb-2 mb-sm-0" 
                           placeholder="Cari nama siswa..." 
                           value="<?php echo e(request('search')); ?>">
                    <div class="d-flex">
                        <button type="submit" class="btn btn-outline-primary flex-fill"><i class="fas fa-search"></i></button>
                        <?php if(request('search')): ?>
                            <a href="<?php echo e(route('pembimbing-magang.siswa')); ?>" class="btn btn-outline-secondary ms-2"><i class="fas fa-times"></i></a>
                        <?php endif; ?>
                    </div>
                </form>
            </div>
        </div>
    </div>
    
    <div class="card-body">
        
        <div class="table-responsive d-none d-md-block">
            <table class="table table-striped table-hover">
                <thead class="table-dark">
                    <tr>
                        <th width="5%" class="text-center">No</th>
                        <th>Nama Siswa</th>
                        <th width="20%" class="text-center">Sekolah</th>
                        <th width="20%" class="text-center">Periode Magang</th>
                        <th width="15%" class="text-center">Total Jurnal</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $siswa; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr>
                        <td class="text-center"><?php echo e($siswa->firstItem() + $index); ?></td>
                        <td>
                            <div class="d-flex align-items-center">
                                <div class="avatar-initial bg-primary rounded-circle me-3">
                                    <?php echo e(strtoupper(substr($s->nama_siswa, 0, 1))); ?>

                                </div>
                                <div>
                                    <strong><?php echo e($s->nama_siswa); ?></strong>
                                </div>
                            </div>
                        </td>
                        <td class="text-center"><?php echo e($s->sekolah->nama_sekolah ?? 'Tidak ada data'); ?></td>
                        <td class="text-center">
                            <small class="text-muted">
                                <?php echo e(\Carbon\Carbon::parse($s->mulai_magang)->format('d/m/Y')); ?> - 
                                <?php echo e(\Carbon\Carbon::parse($s->selesai_magang)->format('d/m/Y')); ?>

                            </small>
                        </td>
                        <td class="text-center">
                            <span class="badge bg-primary"><?php echo e($s->user->jurnal->count() ?? 0); ?> jurnal</span>
                        </td>
                    </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="5" class="text-center text-muted py-4">
                            <i class="fas fa-users fa-3x mb-3"></i>
                            <p><?php echo e(request('search') ? 'Tidak ditemukan data siswa' : 'Belum ada siswa bimbingan yang terdaftar'); ?></p>
                        </td>
                    </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>

        
        <div class="d-block d-md-none">
            <?php $__empty_1 = true; $__currentLoopData = $siswa; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <div class="card mb-3 border-start border-primary border-4">
                <div class="card-body py-3">
                    <div class="d-flex justify-content-between align-items-start mb-2">
                        <div class="d-flex align-items-center">
                            <div class="avatar-initial bg-primary rounded-circle me-3">
                                <?php echo e(strtoupper(substr($s->nama_siswa, 0, 1))); ?>

                            </div>
                            <h6 class="fw-bold mb-1"><?php echo e($s->nama_siswa); ?></h6>
                        </div>
                        <small class="text-muted">#<?php echo e($siswa->firstItem() + $index); ?></small>
                    </div>
                    <div class="row">
                        <div class="col-6">
                            <small class="text-muted">Sekolah:</small><br>
                            <small><?php echo e($s->sekolah->nama_sekolah ?? 'Tidak ada data'); ?></small>
                        </div>
                        <div class="col-6">
                            <small class="text-muted">Total Jurnal:</small><br>
                            <span class="badge bg-primary"><?php echo e($s->user->jurnal->count() ?? 0); ?> jurnal</span>
                        </div>
                    </div>
                    <div class="row mt-2">
                        <div class="col-12">
                            <small class="text-muted">Periode Magang:</small><br>
                            <small>
                                <?php echo e(\Carbon\Carbon::parse($s->mulai_magang)->format('d/m/Y')); ?> - 
                                <?php echo e(\Carbon\Carbon::parse($s->selesai_magang)->format('d/m/Y')); ?>

                            </small>
                        </div>
                    </div>
                </div>
            </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <div class="text-center text-muted py-5">
                <i class="fas fa-users fa-3x mb-3"></i>
                <p><?php echo e(request('search') ? 'Tidak ditemukan data siswa' : 'Belum ada siswa bimbingan yang terdaftar'); ?></p>
            </div>
            <?php endif; ?>
        </div>
        
        <?php if($siswa->hasPages()): ?>
            <?php echo e($siswa->appends(request()->query())->links('pagination::bootstrap-4')); ?>

        <?php endif; ?>
    </div>
</div>

<style>
.avatar-initial {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

.table th {
    border-top: none;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    vertical-align: middle;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    .avatar-initial {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }
}

/* Card hover effect */
.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    transition: box-shadow 0.15s ease-in-out;
}
</style>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.pembimbing-magang', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\presensi-magang\resources\views/pembimbing-magang/siswa/index.blade.php ENDPATH**/ ?>