<?php $__env->startSection('title', 'Log Attività'); ?>
<?php $__env->startSection('page_title', 'Log Attività'); ?>

<?php $__env->startSection('breadcrumbs'); ?>
    <li class="breadcrumb-item active">Admin</li>
    <li class="breadcrumb-item active">Log Attività</li>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="row">
    <div class="col-12">
        <div class="card">
            <div class="card-header">
                <h3 class="card-title">Attività di Sistema</h3>
            </div>
            <div class="card-body">
                <form method="GET" class="mb-3">
                    <div class="row">
                        <div class="col-md-2">
                            <select name="user_id" class="form-control">
                                <option value="">Tutti gli utenti</option>
                                <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $u): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($u->id); ?>" <?php echo e(request('user_id') == $u->id ? 'selected' : ''); ?>><?php echo e($u->name); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>
                        <div class="col-md-2">
                            <select name="module" class="form-control">
                                <option value="">Tutti i moduli</option>
                                <?php $__currentLoopData = $modules; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $module): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($module); ?>" <?php echo e(request('module') == $module ? 'selected' : ''); ?>><?php echo e($module); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>
                        <div class="col-md-2">
                            <select name="action" class="form-control">
                                <option value="">Tutte le azioni</option>
                                <option value="create" <?php echo e(request('action') == 'create' ? 'selected' : ''); ?>>Create</option>
                                <option value="update" <?php echo e(request('action') == 'update' ? 'selected' : ''); ?>>Update</option>
                                <option value="delete" <?php echo e(request('action') == 'delete' ? 'selected' : ''); ?>>Delete</option>
                                <option value="login" <?php echo e(request('action') == 'login' ? 'selected' : ''); ?>>Login</option>
                            </select>
                        </div>
                        <div class="col-md-2">
                            <input type="date" name="from" class="form-control" value="<?php echo e(request('from')); ?>" placeholder="Da">
                        </div>
                        <div class="col-md-2">
                            <input type="date" name="to" class="form-control" value="<?php echo e(request('to')); ?>" placeholder="A">
                        </div>
                        <div class="col-md-2">
                            <button type="submit" class="btn btn-primary">Filtra</button>
                            <a href="/admin/activity-logs" class="btn btn-secondary">Reset</a>
                        </div>
                    </div>
                </form>

                <table class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th>Data/Ora</th>
                            <th>Utente</th>
                            <th>Azione</th>
                            <th>Modulo</th>
                            <th>Descrizione</th>
                            <th>IP</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__empty_1 = true; $__currentLoopData = $logs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $log): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td><small><?php echo e($log->created_at->format('d/m/Y H:i:s')); ?></small></td>
                            <td><?php echo e($log->user->name ?? 'Sistema'); ?></td>
                            <td>
                                <span class="badge badge-<?php echo e($log->action == 'delete' ? 'danger' : ($log->action == 'create' ? 'success' : ($log->action == 'login' ? 'info' : 'warning'))); ?>">
                                    <?php echo e($log->action); ?>

                                </span>
                            </td>
                            <td><?php echo e($log->module); ?></td>
                            <td><?php echo e($log->description); ?></td>
                            <td><small><?php echo e($log->ip_address); ?></small></td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="6" class="text-center">Nessun log presente</td>
                        </tr>
                        <?php endif; ?>
                    </tbody>
                </table>

                <?php echo e($logs->links()); ?>

            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/admin/activity-logs/index.blade.php ENDPATH**/ ?>