<?php $__env->startSection('title','Users & Roles'); ?> <?php $__env->startSection('page_title','Users & Roles'); ?>
<?php $__env->startSection('content'); ?>
<div class="page-header"><div><h1>Users & Roles</h1><p class="muted">Control access by role and branch.</p></div><div class="actions"><?php if(auth()->user()->hasPermission('roles.create')): ?><a class="btn btn-secondary" href="<?php echo e(route('roles.create')); ?>">New Role</a><?php endif; ?> <?php if(auth()->user()->hasPermission('users.create')): ?><a class="btn btn-primary" href="<?php echo e(route('users.create')); ?>">New User</a><?php endif; ?></div></div>
<div class="grid grid-3" style="margin-bottom:20px"><?php $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><div class="card"><div class="card-body"><div class="flex-between"><div><strong><?php echo e($role->name); ?></strong><div class="muted"><?php echo e($role->users_count); ?> user(s)</div></div><?php if(auth()->user()->hasPermission('roles.edit_draft')): ?><a class="btn btn-secondary btn-sm" href="<?php echo e(route('roles.edit',$role)); ?>">Permissions</a><?php endif; ?></div></div></div><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></div>
<div class="card"><div class="card-header"><form class="filter-bar" method="get"><input class="control" name="search" value="<?php echo e(request('search')); ?>" placeholder="Search user or email"><button class="btn btn-secondary">Search</button></form></div><div class="table-wrap"><table><thead><tr><th>User</th><th>Branch</th><th>Roles</th><th>Last Login</th><th>Status</th><th></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><strong><?php echo e($user->name); ?></strong><div class="muted"><?php echo e($user->email); ?></div></td><td><?php echo e($user->branch?->name ?? 'All branches'); ?></td><td><?php $__currentLoopData = $user->roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><span class="badge"><?php echo e($role->name); ?></span><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></td><td><?php echo e($user->last_login_at?->format('d M Y H:i') ?? 'Never'); ?></td><td><span class="badge <?php echo e($user->is_active?'badge-success':'badge-danger'); ?>"><?php echo e($user->is_active?'Active':'Inactive'); ?></span></td><td class="text-right"><?php if(auth()->user()->hasPermission('users.edit_draft')): ?><a class="btn btn-secondary btn-sm" href="<?php echo e(route('users.edit',$user)); ?>">Edit</a><?php endif; ?></td></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="6" class="empty">No users found.</td></tr><?php endif; ?></tbody></table></div><div class="card-footer"><?php echo e($users->links()); ?></div></div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/cbo/public_html/resources/views/admin/users/index.blade.php ENDPATH**/ ?>