<?php $__env->startSection('title', 'Elenco Utenti'); ?>

<?php $__env->startSection('content'); ?>
    <div class="container-fluid py-2">
        <div class="row">
            <div class="col-12">
                <div class="card my-4">
                    <div class="card-header p-0 position-relative mt-n4 mx-3 z-index-2">
                        <div
                            class="bg-gradient-dark shadow-dark border-radius-lg pt-4 pb-3 d-flex justify-content-between align-items-center">
                            <h6 class="text-white text-capitalize ps-3 mb-0">Utenti</h6>
                            <a href="<?php echo e(route('users.create')); ?>" class="btn btn-primary me-3">+ Nuovo Utente</a>
                        </div>
                    </div>

                    <div class="card-body px-0 pb-2">
                        <div class="table-responsive p-0">
                            <?php if($utenti->isEmpty()): ?>
                                <div class="alert alert-info m-3">Non ci sono utenti. Crea il primo!</div>
                            <?php else: ?>
                                <table class="table align-items-center mb-0">
                                    <thead>
                                        <tr>
                                            <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">
                                                #</th>
                                            <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">
                                                Nome</th>
                                            <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">
                                                Cognome</th>
                                            <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">
                                                Email</th>
                                            <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">
                                                Azienda</th>
                                            <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">
                                                Status</th>
                                            <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">
                                                Ruolo</th>
                                            <th
                                                class="text-end text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">
                                                Azioni</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $__currentLoopData = $utenti; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $utente): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <tr>
                                                <td class="text-sm"><?php echo e($utente->id); ?></td>
                                                <td class="text-sm"><b><?php echo e($utente->name); ?></b></td>
                                                <td class="text-sm"><b><?php echo e($utente->surname); ?></b></td>
                                                <td class="text-sm">
                                                    <a href="mailto:<?php echo e($utente->email); ?>"><?php echo e($utente->email); ?></a>
                                                </td>
                                                <td class="text-sm">
                                                    <span
                                                        class="badge badge-sm bg-gradient-primary"><?php echo e($utente->azienda?->nome ?? 'Amazon'); ?></span>
                                                </td>
                                                <td class="text-sm">
                                                    <?php if($utente->status == 'Non attivo'): ?>
                                                        <span
                                                            class="badge badge-sm bg-gradient-danger"><?php echo e($utente->status); ?></span>
                                                    <?php else: ?>
                                                        <span
                                                            class="badge badge-sm bg-gradient-success"><?php echo e($utente->status); ?></span>
                                                    <?php endif; ?>
                                                </td>
                                                <td class="text-sm">
                                                    <span class="badge badge-sm bg-gradient-info"><?php echo e($utente->role); ?></span>
                                                </td>
                                                <td class="text-end">

                                                    <a href="<?php echo e(route('users.edit', $utente)); ?>"
                                                        class="btn btn-sm btn-outline-primary">Modifica</a>
                                                    <form action="<?php echo e(route('users.destroy', $utente)); ?>" method="POST"
                                                        class="d-inline"
                                                        onsubmit="return confirm('Sei sicuro di voler eliminare questo utente?');">
                                                        <?php echo csrf_field(); ?>
                                                        <?php echo method_field('DELETE'); ?>
                                                        <button type="submit"
                                                            class="btn btn-sm btn-outline-danger">Elimina</button>
                                                    </form>
                                                </td>
                                            </tr>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                </table>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.appback', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Users/giuseppepesce/Desktop/lavori_pesce/Ebinconf/resources/views/backend/users/index.blade.php ENDPATH**/ ?>