<?php $__env->startSection('title', 'Utilisateurs BO · LineUp France'); ?>

<?php $__env->startSection('content'); ?>
    <div class="bg-body-light bo-page-top">
        <div class="content content-full bo-page-top-content">
            <div class="d-flex flex-column flex-sm-row justify-content-sm-between align-items-sm-center py-2 bo-page-head">
                <div class="flex-grow-1">
                    <h1 class="h3 fw-bold mb-1 bo-page-title">Utilisateurs BO</h1>
                    <h2 class="fs-base lh-base fw-medium text-muted mb-0 bo-page-subtitle">Gestion admin des comptes client, liner et admin.</h2>
                </div>
                <nav class="flex-shrink-0 mt-3 mt-sm-0 ms-sm-3" aria-label="breadcrumb">
                    <ol class="breadcrumb breadcrumb-alt bo-breadcrumb">
                        <li class="breadcrumb-item">LineUp France</li>
                        <li class="breadcrumb-item" aria-current="page">Utilisateurs</li>
                    </ol>
                </nav>
            </div>
            <div class="bo-hero-actions">
                <a href="<?php echo e(route('bo.dashboard')); ?>" class="btn btn-sm btn-alt-secondary">
                    <i class="si si-speedometer me-1"></i> Tableau de bord
                </a>
                <a href="<?php echo e(route('bo.missions.index')); ?>" class="btn btn-sm btn-alt-secondary">
                    <i class="si si-briefcase me-1"></i> Missions
                </a>
                <a href="<?php echo e(route('bo.kyc.index')); ?>" class="btn btn-sm btn-alt-secondary">
                    <i class="si si-shield me-1"></i> KYC
                </a>
                <a href="<?php echo e(route('bo.payouts.index')); ?>" class="btn btn-sm btn-alt-secondary">
                    <i class="si si-wallet me-1"></i> Retraits
                </a>
                <div class="ms-auto">
                    <a href="<?php echo e(route('bo.users.create')); ?>" class="btn btn-alt-primary">
                        <i class="fa fa-plus opacity-50 me-1"></i> Nouvel utilisateur
                    </a>
                </div>
            </div>
        </div>
    </div>

    <div class="content bo-page-content">
        <div class="block block-rounded">
            <div class="block-header block-header-default">
                <h3 class="block-title"><i class="si si-equalizer me-1"></i>Filtres avances</h3>
                <div class="block-options">
                    <a href="<?php echo e(route('bo.users.index')); ?>" class="btn btn-sm btn-alt-secondary">
                        <i class="fa fa-rotate-left opacity-50 me-1"></i> Reinitialiser
                    </a>
                </div>
            </div>
            <div class="block-content">
                <form method="GET" action="<?php echo e(route('bo.users.index')); ?>" class="row g-3 align-items-end bo-filter-form">
                    <div class="col-md-4">
                        <label class="form-label" for="q">Recherche</label>
                        <div class="input-group">
                            <span class="input-group-text bg-body-light border-0"><i class="fa fa-search text-muted"></i></span>
                            <input id="q" type="text" name="q" class="form-control form-control-alt" value="<?php echo e($search); ?>" placeholder="Nom, email, telephone">
                        </div>
                    </div>
                    <div class="col-md-2">
                        <label class="form-label" for="role">Role utilisateur</label>
                        <select id="role" name="role" class="form-select">
                            <option value="">Tous</option>
                            <?php $__currentLoopData = ['admin', 'client', 'liner']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $roleOption): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($roleOption); ?>" <?php if($role === $roleOption): echo 'selected'; endif; ?>><?php echo e(strtoupper($roleOption)); ?></option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </div>
                    <div class="col-md-2">
                        <label class="form-label" for="kyc">KYC</label>
                        <select id="kyc" name="kyc" class="form-select">
                            <option value="">Tous</option>
                            <option value="verified" <?php if($kyc === 'verified'): echo 'selected'; endif; ?>>Verifie</option>
                            <option value="pending" <?php if($kyc === 'pending'): echo 'selected'; endif; ?>>En attente</option>
                        </select>
                    </div>
                    <div class="col-md-2">
                        <label class="form-label" for="activity">Activite</label>
                        <select id="activity" name="activity" class="form-select">
                            <option value="">Toutes</option>
                            <option value="online" <?php if($activity === 'online'): echo 'selected'; endif; ?>>Actif (24h)</option>
                            <option value="inactive" <?php if($activity === 'inactive'): echo 'selected'; endif; ?>>Inactif (30j+)</option>
                        </select>
                    </div>
                    <div class="col-md-2 d-flex gap-2 bo-filter-actions">
                        <button type="submit" class="btn btn-alt-primary w-100">Filtrer</button>
                    </div>
                </form>
            </div>
        </div>

        <div class="block block-rounded mb-0">
            <div class="block-header block-header-default">
                <h3 class="block-title"><i class="si si-users me-1"></i>Liste utilisateurs</h3>
                <div class="block-options">
                    <span class="badge bg-primary"><?php echo e($users->total()); ?> resultat(s)</span>
                </div>
            </div>
            <div class="block-content p-0">
                <div class="table-responsive">
                    <table class="table table-striped table-hover table-vcenter fs-sm mb-0 bo-table">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>Identite</th>
                            <th>Role</th>
                            <th>KYC</th>
                            <th>Missions</th>
                            <th>Paiements</th>
                            <th>Preferences</th>
                            <th>Derniere activite</th>
                            <th style="width: 160px;">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 echo e($user->id); ?></td>
                                <td>
                                    <div class="fw-semibold"><?php echo e($user->name); ?></div>
                                    <div class="text-muted"><?php echo e($user->email); ?></div>
                                    <?php if($user->phone): ?>
                                        <small class="text-muted"><?php echo e($user->phone); ?></small>
                                    <?php endif; ?>
                                </td>
                                <td>
                                    <?php
                                        $roleBadge = match(strtolower((string) $user->role)) {
                                            'admin' => 'bg-danger',
                                            'liner' => 'bg-success',
                                            default => 'bg-info',
                                        };
                                    ?>
                                    <span class="badge <?php echo e($roleBadge); ?>"><?php echo e(strtoupper($user->role)); ?></span>
                                </td>
                                <td>
                                    <?php if(strtolower((string) $user->role) === 'admin'): ?>
                                        <span class="badge bg-secondary">SANS OBJET (ADMIN)</span>
                                    <?php else: ?>
                                        <span class="badge <?php echo e($user->is_kyc_verified ? 'bg-success' : 'bg-warning text-dark'); ?>">
                                            <?php echo e($user->is_kyc_verified ? 'VERIFIE' : 'EN ATTENTE'); ?>

                                        </span>
                                    <?php endif; ?>
                                </td>
                                <td>
                                    <div>Client: <?php echo e($user->client_missions_count); ?></div>
                                    <div>Liner: <?php echo e($user->liner_missions_count); ?></div>
                                </td>
                                <td>
                                    <div>Moyens de paiement: <?php echo e($user->payment_methods_count); ?></div>
                                    <div>Documents KYC: <?php echo e($user->kyc_documents_count); ?></div>
                                </td>
                                <td>
                                    <div><?php echo e(strtoupper((string) ($user->language ?? 'fr'))); ?> / <?php echo e(strtoupper((string) ($user->region ?? 'FR'))); ?></div>
                                    <small class="text-muted d-block">
                                        Push: <?php echo e($user->push_notifications_enabled ? 'ON' : 'OFF'); ?> ·
                                        SMS: <?php echo e($user->sms_notifications_enabled ? 'ON' : 'OFF'); ?>

                                    </small>
                                    <small class="text-muted d-block">
                                        Email mission: <?php echo e($user->email_notifications_enabled ? 'ON' : 'OFF'); ?> ·
                                        Marketing: <?php echo e($user->email_marketing_enabled ? 'ON' : 'OFF'); ?>

                                    </small>
                                </td>
                                <td><?php echo e($user->last_seen_at?->diffForHumans() ?? '-'); ?></td>
                                <td>
                                    <div class="btn-group">
                                        <a href="<?php echo e(route('bo.users.edit', $user)); ?>" class="btn btn-sm btn-alt-primary">
                                            <i class="fa fa-pen me-1"></i>Modifier
                                        </a>
                                        <form method="POST" action="<?php echo e(route('bo.users.destroy', $user)); ?>" onsubmit="return confirm('Supprimer cet utilisateur ?');">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('DELETE'); ?>
                                            <button type="submit" class="btn btn-sm btn-alt-danger">
                                                <i class="fa fa-trash me-1"></i>Supprimer
                                            </button>
                                        </form>
                                    </div>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <tr>
                                <td colspan="9" class="text-center text-muted">Aucun utilisateur.</td>
                            </tr>
                        <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="block-content">
                <?php echo e($users->links()); ?>

            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

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