

<?php $__env->startSection('title','Manajemen User'); ?>

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

<div class="container-fluid">

    
    <div class="d-flex justify-content-between align-items-center mb-4">

        <div>

            <h3 class="font-weight-bold mb-1">
                Manajemen User
            </h3>

            <p class="text-muted mb-0">
                Kelola seluruh akun pengguna sistem PRESGURU.
            </p>

        </div>

        <a href="<?php echo e(route('user.create')); ?>"
           class="btn btn-primary btn-modern">

            <i class="fas fa-user-plus mr-1"></i>

            Tambah User

        </a>

    </div>

    
    <div class="row mb-4">

        <div class="col-md-4">

            <div class="small-card">

                <div>

                    <small>Total User</small>

                    <h2><?php echo e($users->count()); ?></h2>

                </div>

                <div class="small-icon bg-primary">

                    <i class="fas fa-users"></i>

                </div>

            </div>

        </div>

    </div>

    
    <div class="card card-modern">

        <div class="card-header bg-white border-0">

            <h5 class="mb-0">

                <i class="fas fa-users-cog text-primary mr-2"></i>

                Data User

            </h5>

        </div>

        <div class="card-body">

            <div class="table-responsive">

                <table class="table table-modern table-hover datatable">

                    <thead>

                        <tr>

                            <th>Nama User</th>
                            <th>Email</th>
                            <th>Role</th>
                            <th width="150" class="text-center">
                                Aksi
                            </th>

                        </tr>

                    </thead>

                    <tbody>

                        <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $u): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                        <tr>

                            <td>

                                <div class="d-flex align-items-center">

                                    <img
                                        src="https://ui-avatars.com/api/?name=<?php echo e(urlencode($u->name)); ?>&background=2563eb&color=fff"
                                        class="rounded-circle mr-2"
                                        width="42">

                                    <div>

                                        <strong>

                                            <?php echo e($u->name); ?>


                                        </strong>

                                    </div>

                                </div>

                            </td>

                            <td>

                                <i class="fas fa-envelope text-muted mr-1"></i>

                                <?php echo e($u->email); ?>


                            </td>

                            <td>

                                <?php if($u->role=='admin'): ?>

                                    <span class="badge badge-danger px-3 py-2">

                                        Administrator

                                    </span>

                                <?php elseif($u->role=='guru'): ?>

                                    <span class="badge badge-success px-3 py-2">

                                        Guru

                                    </span>

                                <?php elseif($u->role=='staff'): ?>

                                    <span class="badge badge-info px-3 py-2">

                                        Staff

                                    </span>

                                <?php else: ?>

                                    <span class="badge badge-secondary">

                                        <?php echo e(ucfirst($u->role)); ?>


                                    </span>

                                <?php endif; ?>

                            </td>

                            <td class="text-center">

                                <a
                                    href="<?php echo e(route('user.edit',$u->id)); ?>"
                                    class="btn btn-warning btn-sm rounded-circle"
                                    title="Edit">

                                    <i class="fas fa-pencil-alt"></i>

                                </a>

                                <form
                                    action="<?php echo e(route('user.destroy',$u->id)); ?>"
                                    method="POST"
                                    class="d-inline">

                                    <?php echo csrf_field(); ?>
                                    <?php echo method_field('DELETE'); ?>

                                    <button
                                        class="btn btn-danger btn-sm rounded-circle"
                                        onclick="return confirm('Yakin ingin menghapus user ini?')">

                                        <i class="fas fa-trash"></i>

                                    </button>

                                </form>

                            </td>

                        </tr>

                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                    </tbody>

                </table>

            </div>

        </div>

    </div>

</div>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\laragon\www\Presguru\resources\views/user/index.blade.php ENDPATH**/ ?>