<?php $__env->startSection('title'); ?>
Produits
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<!-- Blank Header -->
<div class="content-header">
    <div class="header-section">
        <h1>
            <i class="fa fa-tags"></i>Produits<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>Produits</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('admin.produits.create'); ?>"><i class="fa fa-plus"></i> Ajouter un nouveau produit</a>
</p>
<?php if($produits->isEmpty()): ?>
<p>
    <em>Aucun produit défini pour le moment.</em>
</p>
<?php else: ?>
<div class="block full">
    <div class="block-content-full">
        <div class="table-responsive">
            <table id="offres" class="table table-vcenter table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>Réf.</th>
                        <th>Détails</th>
                        <th>Catégories</th>
                        <th>Nouveauté</th>
                        <th>Promotion</th>
                        <th>Statut</th>
                        <th>Réalisations</th>
                        <th>Créé le</th>
                        <th class="text-right">Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach($produits as $o): ?>
                    <tr>
                        <td><?php echo $o->id; ?></td>
                        <td><?php echo $o->ref!='' ? $o->ref : '-'; ?></td>
                        <td><strong><?php echo $o->getAttr('name'); ?></strong><br><?php echo ucfirst('matériaux '.$o->type); ?></td>
                        <td><span class="label label-info"><?php echo $o->categories->count(); ?></span></td>
                        <td>
	                        <?php if($o->nouveaute=='1'): ?>
	                        <span class="label label-info">Oui</span>
	                        <?php else: ?>
	                        <span class="label label-warning">Non</span>
	                        <?php endif; ?>
                        </td>
                        <td>
	                        <?php if($o->promotion=='1'): ?>
	                        <span class="label label-info">Oui</span>
	                        <?php else: ?>
	                        <span class="label label-warning">Non</span>
	                        <?php endif; ?>
                        </td>
                        <td>
	                        <?php if($o->published=='1'): ?>
	                        <span class="label label-success">Publié</span>
	                        <?php else: ?>
	                        <span class="label label-danger">Désactivé</span>
	                        <?php endif; ?>
                        </td>
                        <td><span class="label label-info"><?php echo $o->realisations->count(); ?></span></td>
                        <td><?php echo $o->created_at; ?> - <strong><?php echo $o->created_at->diffForHumans(); ?></strong></td>
                        <td class="text-right">
                            <div class="btn-group btn-group-sm">
                                <a href="<?php echo route('admin.produits.show', array($o->id)); ?>" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="Details"><i class="hi hi-search"></i></a>
                                <a onclick="return confirm('Etes-vous sur?')" href="<?php echo route('admin.produits.destroy', array($o->id)); ?>" type="submit" class="btn btn-danger" data-toggle="tooltip" data-original-title="Supprimer"><i class="gi gi-remove_2"></i></a>
                            </div>
                        </td>
                    </tr>
                    <?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 */
    $('#offres').dataTable({
        "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 9 ] } ],
        "iDisplayLength": 50,
        "aLengthMenu": [[50, 100, -1], [50, 100, "All"]],
        "aaSorting": [[ 2, "asc" ]]
    });
    /* 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('admin.layouts.main', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>