last
This commit is contained in:
@@ -0,0 +1,158 @@
|
||||
<?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 class="card-tools">
|
||||
<button type="button" class="btn btn-danger btn-sm" onclick="deleteLogs()">
|
||||
<i class="fas fa-trash mr-1"></i> Cancella Log
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="GET" class="mb-3" id="filter-form">
|
||||
<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 $__env->startSection('scripts'); ?>
|
||||
<script>
|
||||
function deleteLogs() {
|
||||
var filterForm = document.getElementById('filter-form');
|
||||
var params = new URLSearchParams(new FormData(filterForm));
|
||||
var filterDescription = [];
|
||||
|
||||
var userFilter = params.get('user_id');
|
||||
var moduleFilter = params.get('module');
|
||||
var actionFilter = params.get('action');
|
||||
var fromFilter = params.get('from');
|
||||
var toFilter = params.get('to');
|
||||
|
||||
if (userFilter) filterDescription.push('utente=' + userFilter);
|
||||
if (moduleFilter) filterDescription.push('modulo=' + moduleFilter);
|
||||
if (actionFilter) filterDescription.push('azione=' + actionFilter);
|
||||
if (fromFilter) filterDescription.push('dal=' + fromFilter);
|
||||
if (toFilter) filterDescription.push('al=' + toFilter);
|
||||
|
||||
var message = filterDescription.length > 0
|
||||
? 'Eliminare i log filtrati? (' + filterDescription.join(', ') + ')'
|
||||
: 'Eliminare TUTTI i log?';
|
||||
|
||||
if (!confirm(message)) return;
|
||||
|
||||
var form = document.createElement('form');
|
||||
form.method = 'POST';
|
||||
form.action = '/admin/activity-logs';
|
||||
form.style.display = 'none';
|
||||
|
||||
var csrf = document.createElement('input');
|
||||
csrf.name = '_token';
|
||||
csrf.value = '<?php echo e(csrf_token()); ?>';
|
||||
form.appendChild(csrf);
|
||||
|
||||
var method = document.createElement('input');
|
||||
method.name = '_method';
|
||||
method.value = 'DELETE';
|
||||
form.appendChild(method);
|
||||
|
||||
filterForm.querySelectorAll('select, input').forEach(function(el) {
|
||||
if (el.name && el.value) {
|
||||
var input = document.createElement('input');
|
||||
input.name = el.name;
|
||||
input.value = el.value;
|
||||
form.appendChild(input);
|
||||
}
|
||||
});
|
||||
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
}
|
||||
</script>
|
||||
<?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**/ ?>
|
||||
Reference in New Issue
Block a user