<div class="card">
    <div class="card-header d-flex flex-column flex-md-row gap-2 align-items-md-center justify-content-md-between">
        <h5 class="card-title mb-0">Staff Members</h5>
        <form action="<?php echo e(route('staff.index')); ?>" method="GET" class="d-flex gap-2">
            <input type="hidden" name="tab" value="staff">
            <input type="search" name="search" class="form-control form-control-sm" placeholder="Search staff..."
                   value="<?php echo e(request('search')); ?>">
            <button type="submit" class="btn btn-outline-secondary btn-sm">Search</button>
        </form>
    </div>
    <div class="card-body p-0">
        <div class="table-responsive">
            <table class="table table-hover mb-0">
                <thead class="table-light">
                    <tr>
                        <th>Name</th>
                        <th>Email</th>
                        <th class="d-none d-md-table-cell">Phone</th>
                        <th class="d-none d-lg-table-cell">Role</th>
                        <th>Status</th>
                        <th class="text-end">Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $staff ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $member): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td>
                                <div class="d-flex flex-wrap align-items-center gap-1">
                                    <span><?php echo e($member->name); ?></span>
                                    <?php if($member->is_primary_admin): ?>
                                        <span class="badge bg-primary" title="Created during installation">
                                            <i class="bi bi-shield-lock me-1"></i>Primary Admin
                                        </span>
                                    <?php endif; ?>
                                </div>
                            </td>
                            <td><?php echo e($member->email); ?></td>
                            <td class="d-none d-md-table-cell"><?php echo e($member->phone ?? '—'); ?></td>
                            <td class="d-none d-lg-table-cell"><?php echo e($member->roles->pluck('name')->join(', ') ?: '—'); ?></td>
                            <td>
                                <?php
                                    $status = $member->status ?? null;
                                    $statusValue = $status instanceof \App\Enums\UserStatus
                                        ? $status->value
                                        : (string) ($status ?? 'active');
                                ?>
                                <span class="badge bg-<?php echo e($statusValue === 'active' ? 'success' : 'secondary'); ?>">
                                    <?php echo e($status instanceof \App\Enums\UserStatus ? $status->label() : ucfirst($statusValue)); ?>

                                </span>
                            </td>
                            <td class="text-end">
                                <div class="d-inline-flex gap-1">
                                    <a href="<?php echo e(route('staff.edit', $member)); ?>" class="btn btn-sm btn-outline-primary"
                                       title="Edit staff">
                                        <i class="bi bi-pencil"></i>
                                    </a>
                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('delete', $member)): ?>
                                        <?php if (! ($member->is_primary_admin)): ?>
                                            <form action="<?php echo e(route('staff.destroy', $member)); ?>" method="POST"
                                                  onsubmit="return confirm('Delete <?php echo e($member->name); ?>?');">
                                                <?php echo csrf_field(); ?>
                                                <?php echo method_field('DELETE'); ?>
                                                <button type="submit" class="btn btn-sm btn-outline-danger" title="Delete staff">
                                                    <i class="bi bi-trash"></i>
                                                </button>
                                            </form>
                                        <?php endif; ?>
                                    <?php endif; ?>
                                </div>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="6" class="text-center text-muted py-4">No staff members found</td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
    <?php if(isset($staff) && method_exists($staff, 'links')): ?>
        <div class="card-footer">
            <?php echo e($staff->withQueryString()->links()); ?>

        </div>
    <?php endif; ?>
</div>
<?php /**PATH D:\RABI\rabi\module-laravel-platform\apps\admin\resources\views/staff/partials/staff-list.blade.php ENDPATH**/ ?>