<?php $__env->startSection('content'); ?>
    <div class="container">
        <div>
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><?php echo e($structure->nom); ?></li>
                <li class="breadcrumb-item active" aria-current="page">Alertes</li>
            </ol>
            <h2 class="pb-2">Alertes
                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('add_parametre')): ?>
                    <a class="btn btn-outline-success float-right mb-4" href="<?php echo e(route('alertes.create')); ?>">Ajouter</a>
                <?php endif; ?>
            </h2>
        </div>

        <?php echo $__env->make('layouts.commons.errors', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
        <?php echo $__env->make('layouts.commons.success', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

        <?php if(sizeof($alertes) > 0): ?>
            <table class="table table-striped table-bordered">
                <thead>
                <tr>
                    <th>Utilisateur</th>
                    <th>Rôle</th>
                    <th>Critère</th>
                    <th>Formule</th>
                    <th>Indicateur ou Critère</th>
                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->any(array('edit_parametre', 'delete_parametre'))): ?>
                        <th>Actions</th>
                    <?php endif; ?>
                </tr>
                </thead>
                <tbody>
                    <?php $__currentLoopData = $alertes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $a): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td><?php echo e($a->user->nom_complet()); ?></td>
                            <td><?php echo e($a->user->nom_role(true)); ?></td>
                            <td><?php echo e(TEXT::FORMATTED_TEXT[$a->critere]); ?></td>
                            <td><?php echo e($a->formule); ?></td>
                            <?php if($a->est_valeur): ?>
                                <?php if($a->critere === TEXT::GAINS_NOTIFIES || $a->critere === TEXT::GAINS_CIBLE): ?>
                                    <td><?php echo e($a->indicateur); ?> %</td>
                                <?php else: ?>
                                    <td><?php echo e($a->indicateur); ?> €</td>
                                <?php endif; ?>
                            <?php else: ?>
                                <td><?php echo e(TEXT::FORMATTED_TEXT[$a->indicateur_critere]); ?></td>
                            <?php endif; ?>
                            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->any(array('edit_parametre', 'delete_parametre'))): ?>
                                <td style="width: 10%">
                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('edit_parametre')): ?>
                                        <a class="btn btn-outline-primary" href="<?php echo e(route('alertes.edit', $a->id)); ?>"
                                            data-toggle="tooltip" data-placement="top" title="Editer">
                                            <i class="fas fa-pencil-alt"></i>
                                        </a>
                                    <?php endif; ?>
                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('delete_parametre')): ?>
                                        <form class="inline-form-table" action="<?php echo e(route('alertes.destroy', $a->id)); ?>" method="POST">
                                            <?php echo csrf_field(); ?>
                                            <?php echo e(method_field('DELETE')); ?>

                                            <button type="submit" class="btn btn-outline-danger"
                                                data-toggle="tooltip" data-placement="top" title="Supprimer">
                                                <i class="fas fa-trash-alt"></i>
                                            </button>
                                        </form>
                                    <?php endif; ?>
                                </td>
                            <?php endif; ?>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>

            <?php echo e($alertes->links("pagination::bootstrap-4")); ?>

        <?php else: ?>
            <div class="pt-2">
                <h4>Pas de données disponible.</h4>
            </div>
        <?php endif; ?>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/resources/views/parametres/alertes/index.blade.php ENDPATH**/ ?>