<?php $__env->startSection('title', 'Viste Report'); ?>
<?php $__env->startSection('page_title', 'Viste e Report Salvati'); ?>

<?php $__env->startSection('content'); ?>
<div class="card">
    <div class="card-header">
        <h3 class="card-title"><i class="fas fa-table mr-2"></i>Le Tue Viste</h3>
    </div>
    <div class="card-body p-0">
        <?php if($viste->count() > 0): ?>
        <table class="table table-bordered table-hover table-striped mb-0">
            <thead class="thead-light">
                <tr>
                    <th>Nome</th>
                    <th style="width: 120px;">Tipo</th>
                    <th style="width: 100px;">Colonne</th>
                    <th style="width: 150px;">Creata il</th>
                    <th style="width: 120px;">Azioni</th>
                </tr>
            </thead>
            <tbody>
                <?php $__currentLoopData = $viste; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $vista): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr>
                    <td>
                        <?php if($vista->is_default): ?>
                        <i class="fas fa-star text-warning mr-1" title="Predefinita"></i>
                        <?php else: ?>
                        <i class="fas fa-file-alt text-primary mr-1"></i>
                        <?php endif; ?>
                        <?php echo e($vista->nome); ?>

                    </td>
                    <td>
                        <span class="badge badge-<?php echo e($vista->tipo === 'individui' ? 'info' : ($vista->tipo === 'gruppi' ? 'warning' : ($vista->tipo === 'documenti' ? 'success' : 'primary'))); ?>">
                            <?php echo e(ucfirst($vista->tipo)); ?>

                        </span>
                    </td>
                    <td>
                        <?php if($vista->colonne_visibili): ?>
                        <span class="badge badge-secondary"><?php echo e(count($vista->colonne_visibili)); ?></span>
                        <?php else: ?>
                        <span class="text-muted">Tutte</span>
                        <?php endif; ?>
                    </td>
                    <td><?php echo e($vista->created_at->format('d/m/Y H:i')); ?></td>
                    <td>
                        <a href="<?php echo e(url('/' . $vista->tipo . '?vista_id=' . $vista->id)); ?>" class="btn btn-xs btn-primary" title="Applica">
                            <i class="fas fa-play"></i>
                        </a>
                        <?php if(!$vista->is_default): ?>
                        <form action="<?php echo e(url('/viste/' . $vista->id . '/default')); ?>" method="POST" class="d-inline">
                            <?php echo csrf_field(); ?> <?php echo method_field('PATCH'); ?>
                            <button type="submit" class="btn btn-xs btn-warning" title="Imposta predefinita">
                                <i class="fas fa-star"></i>
                            </button>
                        </form>
                        <?php else: ?>
                        <span class="btn btn-xs btn-secondary" title="Predefinita">
                            <i class="fas fa-check"></i>
                        </span>
                        <?php endif; ?>
                        <form action="<?php echo e(url('/viste/' . $vista->id)); ?>" method="POST" class="d-inline">
                            <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                            <button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Eliminare questa vista?')" title="Elimina">
                                <i class="fas fa-trash"></i>
                            </button>
                        </form>
                    </td>
                </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </tbody>
        </table>
        <?php else: ?>
        <div class="text-center text-muted py-4">
            <i class="fas fa-table fa-2x mb-2"></i>
            <p class="mb-0">Nessuna vista salvata.<br>Configura una tabella e salva la vista.</p>
        </div>
        <?php endif; ?>
    </div>
</div>

<div class="mt-3 text-muted small">
    <i class="fas fa-info-circle mr-1"></i>
    Per salvare una vista, configura le colonne, i filtri e l'ordinamento in una delle pagine elenco (Individui, Gruppi, Documenti, Eventi) e clicca su "Salva Vista".
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/viste/index.blade.php ENDPATH**/ ?>