<?php echo $__env->make('forms.fbncheader', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php echo $__env->make('forms.fdatatables', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>



<div class="col-lg-max col-lg-offset-1">
    <h1><i class="fa fa-employeurs"></i>Controles</h1>

    <div class='form-group ' style="padding-bottom:20px">
        <div class="col-xs-4">
            <?php echo Form::select('employeur_id',["0"=>""]+$liste_employeur,$employeur_id,
                [
                    'id' => 'employeur_id2','class' => 'form-control selectpicker',
                    'data-width' => "100%",'style' => 'font-weight:bold;'
                ]
            ); ?>

            <script>
                $(document).ready(function() {
                    $('#employeur_id2').on('change', function() {
                        location.href="<?php echo url('/recouvrement/controle_annee/'); ?>/"
                            +$('#employeur_id2').val();
                    });
                });
            </script>
        </div>


    </div>

 
<br/><br/>

<?php if($employeur_id): ?>

        <div class="table-responsive col-lg-10 ">
            <table id="_table" class="table table-condensed table-striped table-bordered">
                <thead>
                    <tr>
                        <th width='1%'>N°</th>
                        <th width='1%'>Contrôle</th>
                        <th width='10%'>Agent1</th>
                        <th width='10%'>Agent2</th> 
                        <th width='10%'>Validation</th>
                        <th width='10%'>Observations</th>
                        <th width='10%'>Pièces</th>
                        <th width='200px'>&nbsp</th>
                    </tr>
                </thead>
     
                <tbody>
                <?php $__currentLoopData = $controles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $controle): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr>
                    <td style="color:grey"><?php echo $controle->id; ?></td>
                    <td align="center"><?php echo $controle->date_cont; ?></td>
                    <td align="left"><?php echo $controle->agent1; ?></td>
                    <td align="left"><?php echo $controle->agent2; ?></td>
                    <td align="center"><?php echo $controle->date_valid; ?></td>
                    <td align="left"><?php echo $controle->observations; ?></td>
                    <td nowrap align="left" style='font-size:10px'><?php echo $controle->pj; ?>

                        <?php if($user->can("COT_MAJ") || $user->HasRole("ADMINISTRATEUR")): ?>   
                            <a href="<?php echo url('recouvrement/controles/addpiece/'.$controle->id); ?>" 
                                class="addpiece fancybox.iframe" 
                                style="margin-right: 3px;">
                            <span class='glyphicon glyphicon-plus'></span>
                            </a>
                        <?php endif; ?>
                    </td>
                    <td nowrap>
                        <?php if($user->can("COT_VISU") || $user->HasRole("ADMINISTRATEUR")): ?>
                            <a href="<?php echo url('recouvrement/controles/'.$controle->id ); ?>"
                                 class="btn btn-warning pull-left" style="margin-right: 3px;">Consulter</a>
                        <?php endif; ?> 
                        <?php if($user->can("COT_MAJ") || $user->HasRole("ADMINISTRATEUR")): ?>
                            <a href="<?php echo url('recouvrement/controles/'.$controle->id .'/edit'); ?>"
                                 class="btn btn-info pull-left" style="margin-right: 3px;">Modifier</a>
                        <?php endif; ?> 
                        <?php if($user->can("COT_SUP") || $user->HasRole("ADMINISTRATEUR")): ?>   
                            <?php echo Form::open(['url' => 'recouvrement/controles/' . $controle->id, 'method' => 'DELETE']); ?>

                            <?php echo Form::submit('Supprimer', ['class' => 'btn btn-danger']); ?>

                            <?php echo Form::close(); ?>

                        <?php endif; ?>

                    </td>
                </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
     
            </table>
        </div>

        <?php if($user->can("COT_AJO") || $user->HasRole("ADMINISTRATEUR")): ?>
             <div  class="col-lg-10">
                <h4><a href="<?php echo url('recouvrement/controles/create'."/".$employeur_id); ?>" 
                    class="btn btn-success">Ajouter un controle</a></h4>
            </div> 
        <?php endif; ?>

<?php endif; ?>
</div>

</body></html>

<script>
$(document).ready(function() {
    $('#_table').dataTable( {
        "bAutoWidth": false,
        "bPaginate": false,
        "bInfo": true,
        "bFilter": true,
        "oLanguage": {
            "sZeroRecords": "Aucune ligne",
            "sInfo": "Affichage de _START_ &agrave; _END_ sur _TOTAL_ lignes",
            "sInfoEmpty": "Showing 0 to 0 of 0 records",
            "sInfoFiltered": "(sur un total de _MAX_ lignes)",
             "sSearch":"Chercher",
            },

        "order": [[ 0, "desc" ]]

        } );

      $(".addpiece").fancybox({
                //maxWidth    : 800,
                //maxHeight   : 600,
                fitToView   : false,
                width       : '80%',
                height      : '40%',
                autoSize    : true,
                autoScale   : true,
                closeClick  : false,
                openEffect  : 'none',
                closeEffect : 'none',
                       afterClose  : function() { 
            window.location.reload();
        }
            });
 } );
</script>
<?php /**PATH C:\xampp\htdocs\SYSINFO\cpswf\sipre\resources\views/recouvrement/controles/index.blade.php ENDPATH**/ ?>