

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

<?php $__env->startSection('page_content'); ?>
    <style>
        .glass-card {
            background: rgba(255, 255, 255, 0.03);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 15px;
        }

        .custom-table {
            color: white !important;
        }

        .custom-table td {
            border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
            vertical-align: middle;
        }

        .user-avatar {
            width: 40px;
            height: 40px;
            object-fit: cover;
            border-radius: 50%;
            border: 2px solid rgba(99, 102, 241, 0.5);
        }

        .avatar-placeholder {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.1);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #6366f1;
            font-weight: bold;
        }

        .btn-action {
            padding: 5px 10px;
            font-size: 0.85rem;
            border-radius: 6px;
        }
    </style>

    <div class="container-fluid px-4 py-5">
        <div class="row">
            <div class="col-12">

                
                <div
                    class="d-flex flex-column flex-md-row justify-content-between align-items-start align-items-md-center mb-4 gap-3">
                    <div>
                        <h2 class="fw-bold mb-1">System Users</h2>
                        <p class="text-secondary mb-0">Manage and monitor all registered accounts and roles.</p>
                    </div>
                    <div>
                        <a href="<?php echo e(route('admin.users.create')); ?>" class="btn btn-primary px-4 py-2 rounded-3 shadow-sm"
                            style="background: #6366f1; border: none;">
                            <i class="bi bi-plus-lg"></i> Add New User
                        </a>
                    </div>
                </div>

                <?php if(session('success')): ?>
                    <div
                        class="alert alert-success bg-success bg-opacity-10 text-success border-success border-opacity-25 glass-card mb-4">
                        <?php echo e(session('success')); ?>

                    </div>
                <?php endif; ?>

                
                <div class="glass-card shadow-lg p-3 p-md-4">
                    <div class="table-responsive">
                        <table class="table custom-table mb-0">
                            <thead>
                                <tr>
                                    <th style="width: 80px;">Photo</th>
                                    <th>Name</th>
                                    <th>Email</th>
                                    <th>Mobile</th>
                                    <th>Role</th>
                                    <th>Joined Date</th>
                                    <th class="text-end">Actions</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__empty_1 = true; $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr>
                                        
                                        <td>
                                            <?php if($user->photo && file_exists(public_path('uploads/users/' . $user->photo))): ?>
                                                <img src="<?php echo e(asset('uploads/users/' . $user->photo)); ?>" class="user-avatar"
                                                    alt="<?php echo e($user->name); ?>">
                                            <?php else: ?>
                                                <div class="avatar-placeholder">
                                                    <?php echo e(strtoupper(substr($user->name, 0, 1))); ?>

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

                                        
                                        <td class="fw-semibold"><?php echo e($user->name); ?></td>
                                        <td class="text-secondary"><?php echo e($user->email); ?></td>
                                        <td class="text-secondary"><?php echo e($user->mobile_number ?? 'N/A'); ?></td>

                                        
                                        <td>
                                            <?php if($user->role == 'Admin'): ?>
                                                <span
                                                    class="badge bg-danger bg-opacity-10 text-danger border border-danger border-opacity-25 px-2 py-1">Admin</span>
                                            <?php elseif($user->role == 'Editor'): ?>
                                                <span
                                                    class="badge bg-warning bg-opacity-10 text-warning border border-warning border-opacity-25 px-2 py-1">Editor</span>
                                            <?php elseif($user->role == 'Staff'): ?>
                                                <span
                                                    class="badge bg-info bg-opacity-10 text-info border border-info border-opacity-25 px-2 py-1">Staff</span>
                                            <?php else: ?>
                                                <span
                                                    class="badge bg-secondary bg-opacity-10 text-secondary border border-secondary border-opacity-25 px-2 py-1">User</span>
                                            <?php endif; ?>
                                        </td>

                                        
                                        <td class="text-secondary small"><?php echo e($user->created_at->format('d M, Y')); ?></td>

                                        
                                        <td class="text-end">
                                            
                                            <a href="<?php echo e(route('permissions.edit', $user->id)); ?>"
                                                class="btn btn-outline-warning btn-action me-1 border-opacity-25"
                                                title="Manage Permissions">
                                                <i class="bi bi-shield-lock"></i> Permissions
                                            </a>

                                            <button class="btn btn-outline-light btn-action me-1 border-opacity-25"
                                                title="Edit User">
                                                <i class="bi bi-pencil-square"></i>
                                            </button>

                                            <form action="<?php echo e(route('admin.users.destroy', $user->id)); ?>" method="POST"
                                                onsubmit="return confirm('Are you sure you want to delete this user?');"
                                                style="display:inline-block;">
                                                <?php echo csrf_field(); ?>
                                                <?php echo method_field('DELETE'); ?>
                                                <button type="submit" class="btn btn-danger btn-sm">Delete</button>
                                            </form>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="7" class="text-center text-secondary py-4">
                                            No accounts found in the system.
                                        </td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </div>

                    
                    <?php if($users->hasPages()): ?>
                        <div class="mt-4 d-flex justify-content-center custom-pagination">
                            <?php echo $users->links('pagination::bootstrap-5'); ?>

                        </div>
                    <?php endif; ?>

                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('dashboard', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\User\Herd\dcfood_management\resources\views\pages\users\index.blade.php ENDPATH**/ ?>