

<?php $__env->startSection('title', 'Dashboard Guru'); ?>

<?php $__env->startSection('content'); ?>
    <div class="card">
        <div class="card-body" style="background-color: #f686e5ff; border: none;">
            <h2 class="card-title"><i class="bi bi-person-badge me-1"></i> Halo, <?php echo e(optional(auth()->user())->name ?? 'Guru'); ?></h2>
            <?php
                try {
                    $userId = optional(auth()->user())->id;
                    $classes = \App\Models\Kelas::where('walikelas_id', $userId)->get();
                } catch (\Throwable $e) {
                    $classes = collect();
                }

                $classNames = $classes->pluck('nama')->filter()->values();
                $totalPeserta = 0;
                try {
                    if (class_exists(\App\Models\DidikPokok::class) && $classNames->isNotEmpty()) {
                        $totalPeserta = \App\Models\DidikPokok::whereIn('kelas', $classNames->toArray())->count();
                    }
                } catch (\Throwable $e) {
                    $totalPeserta = 0;
                }
            ?>

            <?php if($classNames->isNotEmpty()): ?>
                <p class="text-muted card-text">Walikelas <?php echo e($classNames->implode(', ')); ?> dengan jumlah peserta didik <?php echo e($totalPeserta); ?></p>
            <?php else: ?>
                <p class="text-muted card-text">Daftar diri anda pada admin sebagai guru walikelas</p>
            <?php endif; ?>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('guru.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\App\laravel\laravel\resources\views/guru/dashboard.blade.php ENDPATH**/ ?>