<?php $__env->startSection('content'); ?>
    <div class="container">
        <div>
            <h2 class="pb-2">Structures
                <a class="btn btn-outline-success float-right mb-4" href="<?php echo e(route('structures.create')); ?>">Ajouter</a>
            </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($structures) > 0): ?>
            <table class="table table-striped table-bordered">
                <thead>
                <tr>
                    <th>Nom</th>
                    <th>Description</th>
                    <th>Adresse</th>
                    <th>Consolidation</th>
                    <th>Administrateurs</th>
                    <th>Statut</th>
                    <th>Action</th>
                </tr>
                </thead>
                <tbody>
                <?php $__currentLoopData = $structures; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td>
                            <?php echo e($s->nom); ?>

                        </td>
                        <td><?php echo e($s->description ?? '-'); ?></td>
                        <td><?php echo e($s->adresse); ?>, <?php echo e($s->cp); ?> <?php echo e($s->ville); ?></td>
                        <td><?php echo e($s->consolidation->nom ?? '-'); ?></td>
                        <td><?php echo e($s->administrateurs() ?? '-'); ?></td>
                        <td style="width: 5%">
                            <form class="inline-form-table" action="<?php echo e(route('structures.active', $s->id)); ?>" method="POST">
                                <?php echo csrf_field(); ?>
                                <?php echo e(method_field('PUT')); ?>

                                <?php if($s->active): ?>
                                    <button type="submit" class="btn btn-success" 
                                        data-toggle="tooltip" data-placement="top" title="Désactiver">
                                        <i class="fas fa-toggle-on"></i>
                                    </button>
                                <?php else: ?>
                                    <button type="submit" class="btn btn-secondary"
                                    data-toggle="tooltip" data-placement="top" title="Activer">
                                        <i class="fas fa-toggle-off"></i>
                                    </button>
                                <?php endif; ?>
                            </form>
                        </td>
                        <td style="width: 5%">
                            <a class="btn btn-outline-primary" href="<?php echo e(route('structures.edit', $s->id)); ?>"
                                data-toggle="tooltip" data-placement="top" title="Editer">
                                <i class="fas fa-pencil-alt"></i>
                            </a>
                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>

            <?php echo e($structures->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/administration/structures/index.blade.php ENDPATH**/ ?>