<?php $__env->startSection('title'); ?>
Catégories
<?php $__env->stopSection(); ?>


<?php $__env->startSection('content'); ?>
<!-- Blank Header -->
<div class="content-header">
    <div class="header-section">
        <h1>
            <i class="gi gi-list"></i> Catégories<br>
            <small>Listing</small>
        </h1>
    </div>
</div>
<!-- END Blank Header -->
<ul class="breadcrumb breadcrumb-top">
    <li><a href="<?php echo route('admin'); ?>">Admin</a></li>
    <li>Catégories</li>
</ul>

<?php echo $__env->make('includes.notification', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

<p>
    <a class="btn btn-default" href="<?php echo route($_ENV['admin-url'].'.categories.create'); ?>"><i class="fa fa-plus"></i> Ajouter une nouvelle catégorie</a>
</p>
<?php if($categories->isEmpty()): ?>
<p>
    <em>Pas de catégorie</em>
</p>
<?php else: ?>
<div class="block full">
    <div class="block-content-full">
        <div class="table-responsive">
            <table id="categories" class="table table-vcenter table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th class="text-center">#</th>
                        <th>Nom</th>
                        <th>Position</th>
                        <th>Description</th>
                        <th>Mots Clés</th>
                        <th class="text-right">Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach($categories as $category): ?>
                    <tr>
                        <td class="text-center"><?php echo $category->id; ?></td>
                        <td><?php echo $category->name; ?></td>
                        <td><?php echo $category->position; ?></td>
                        <td><?php echo $category->description; ?></td>
                        <td><?php echo $category->keywords; ?></td>
                        <td class="text-right">
                            <div class="btn-group btn-group-sm">
                                <a href="<?php echo route($_ENV['admin-url'].'.categories.edit', array($category->id)); ?>" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="Modifier"><i class="gi gi-pencil"></i></a>
                                <a onclick="return confirm('Etes-vous sur?')" href="<?php echo route($_ENV['admin-url'].'.categories.destroy', array($category->id)); ?>" class="btn btn-danger" data-toggle="tooltip" data-original-title="Supprimer"><i class="gi gi-remove_2"></i></a>
                            </div>
                        </td>
                    </tr>
                    	<?php foreach($category->children as $ch): ?>
                    	<tr>
	                        <td class="text-center"><?php echo $ch->id; ?></td>
	                        <td style="padding-left: 40px;"><?php echo $ch->name; ?></td>
	                        <td><?php echo $ch->position; ?></td>
	                        <td><?php echo $ch->description; ?></td>
	                        <td><?php echo $ch->keywords; ?></td>
	                        <td class="text-right">
	                            <div class="btn-group btn-group-sm">
	                                <a href="<?php echo route($_ENV['admin-url'].'.categories.edit', array($ch->id)); ?>" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="Modifier"><i class="gi gi-pencil"></i></a>
	                                <a onclick="return confirm('Etes-vous sur?')" href="<?php echo route($_ENV['admin-url'].'.categories.destroy', array($ch->id)); ?>" class="btn btn-danger" data-toggle="tooltip" data-original-title="Supprimer"><i class="gi gi-remove_2"></i></a>
	                            </div>
	                        </td>
	                    </tr>
	                    	<?php foreach($ch->children as $ch2): ?>
	                    	<tr>
		                        <td class="text-center"><?php echo $ch2->id; ?></td>
		                        <td style="padding-left: 80px;"><?php echo $ch2->name; ?></td>
		                        <td><?php echo $ch2->position; ?></td>
		                        <td><?php echo $ch2->description; ?></td>
		                        <td><?php echo $ch2->keywords; ?></td>
		                        <td class="text-right">
		                            <div class="btn-group btn-group-sm">
		                                <a href="<?php echo route($_ENV['admin-url'].'.categories.edit', array($ch2->id)); ?>" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="Modifier"><i class="gi gi-pencil"></i></a>
		                                <a onclick="return confirm('Etes-vous sur?')" href="<?php echo route($_ENV['admin-url'].'.categories.destroy', array($ch2->id)); ?>" class="btn btn-danger" data-toggle="tooltip" data-original-title="Supprimer"><i class="gi gi-remove_2"></i></a>
		                            </div>
		                        </td>
		                    </tr>
	                    	<?php endforeach; ?>
                    	<?php endforeach; ?>
                    <?php endforeach; ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
<?php endif; ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
@parent
<!-- Load and execute javascript code used only in this page -->
<script>
$(function(){
    App.datatables();

    /* Initialize Datatables */
    $('#categories').dataTable({
        "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 5 ] } ],
        "iDisplayLength": 50,
        "aLengthMenu": [[50, 100, -1], [50, 100, "All"]],
        "aaSorting": []
    });

    /* Add Bootstrap classes to select and input elements added by datatables above the table */
    $('.dataTables_filter input').addClass('form-control').attr('placeholder', 'Rechercher');
    $('.dataTables_length select').addClass('form-control');
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make($_ENV['admin-url'].'.layouts.main', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>