<?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 style="background-color:rgba(46,139,87,.2);"  
    class="col-lg-max col-lg-offset-1 container-fluid">

    <div style="padding-left:0px" class="col-lg-max">
         <div class="row" style="">   
            <div class="col-xs-1" style="padding-left:0px;">
               <?php echo Html::image("img/creancier.png", 
                    "Mandatements", array( 'width'=>'100%',
                        "style"=>"padding:4px" )); ?> 
            </div>
            <div class="col-xs-10" style="padding-left:0px;">
                <h1 style="margin-top:2px;">
                    Créanciers
                </h1>
            </div>
        </div>

        <div class="row col-xs-2">
            <?php echo Form::label('annes', 'Années du mandat :' ); ?>

            <?php echo Form::select('exercice',$exercices,$exercice,
                [
                    'id' => 'exercice_id','class' => 'form-control selectpicker',
                    'data-width' => "100%",'style' => 'font-weight:bold;'
                ]
            ); ?>

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

      
             
    <div class='col-lg-max' style="padding-top:5px">
        <div class="">
            <table id="_table" style="background-color:white" 
                class="table table-striped table-bordered table-hover" width="100%">
                <thead>
                    <tr>
                        <th width='1%' nowrap>Id</th>
                        <th width='1%' nowrap>N°Creancier</th>
                        <th >Nom</th>
                        <th width='1%'>Date de naissance</th>
                        <th width='1%'>banque</th>
                        <th width='1%'>Compte</th>
                        <th width='1%'>Montant</th>
                        <th width='1%'>IdMandat</th>
                        <th width='1%'>DateMandat</th>
                        <!-- <th width='1%'>Observations</th> -->
                        <th width='1%'>TypePmt</th>
                        <th width='1%'>IdImputation</th>
                        <th width='1%'></th>
                    </tr>
                </thead>
     
                <tbody>
                    <?php $__currentLoopData = $creanciers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $creancier): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php
                        $imputation=App\Models\Imputation::find($creancier->id);
                        $mandat=App\Models\Mandat::find($creancier->idmandat);
                    ?>
                    <tr class="clickable-row" data-href="<?php echo url('tiers/creanciers/'.$creancier->id); ?>">
                        <td style='color:lightgrey;'><?php echo str_pad($creancier->id,5,'0',STR_PAD_LEFT); ?></td>
                        <td><?php echo str_pad($creancier->num_creancier,5,'0',STR_PAD_LEFT); ?></td>
                        <td>
                            <?php if($user->can("CRE_VISU") || $user->HasRole("ADMINISTRATEUR")): ?>
                                <a href="<?php echo url('tiers/creanciers/'.$creancier->id); ?>" 
                                    class="" style="margin-right: 3px;">
                            <?php endif; ?>
                            <?php echo $creancier->nomcomplet; ?>

                            <?php if($user->can("CRE_VISU") || $user->HasRole("ADMINISTRATEUR")): ?>
                                </a>
                            <?php endif; ?> 
                        </td>
                        <td align="center"><?php echo $creancier->datenaiss; ?></td>
                        <td><?php echo $creancier->bqcle_creancier; ?></td>
                        <td><?php echo $creancier->compte; ?></td>
                        <td><?php echo $creancier->montant; ?></td>
                        <td>
                            <?php if($user->can("MDT_VISU") || $user->HasRole("ADMINISTRATEUR")): ?>
                            <a href="<?php echo url('mandatements/mandats/'.$creancier->idmandat); ?>" 
                                class="various fancybox.iframe " style="margin-right: 3px;">
                                <?php echo str_pad($creancier->idmandat,6,'0',STR_PAD_LEFT); ?>

                            </a>
                            <?php endif; ?> 
                        </td>
                        <td><?php echo $mandat->date_sai; ?></td>
                        <!-- <td><?php echo $creancier->obs; ?></td> -->
                        <td><?php echo $creancier->typepmt; ?></td>
                        <td align="center">
                            <?php if($user->can("IMP_VISU") || $user->HasRole("ADMINISTRATEUR")): ?>
                            <a href="<?php echo url('mandatements/imputations/'.$creancier->idimp_mdt); ?>" 
                                class="various fancybox.iframe " style="margin-right: 3px;">
                                <?php echo str_pad($creancier->idimp_mdt,6,'0',STR_PAD_LEFT); ?>

                            </a>
                            <?php endif; ?> 
                        <td>
                        <?php if($user->can("CRE_MAJ") || $user->HasRole("ADMINISTRATEUR")): ?>
                            <a href="<?php echo url('tiers/creanciers/'.$creancier->id.'/edit'); ?>" class="btn btn-info pull-left" style="margin-right: 3px;">Modifier</a>
                        <?php endif; ?> 
                        <?php if($user->can("CRE_SUP")|| $user->HasRole("ADMINISTRATEUR")): ?>      
                            <?php echo Form::open(['url' => '/tiers/creanciers/' . $creancier->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>
            <?php if($user->can("CRE_VISU") || $user->HasRole("ADMINISTRATEUR")): ?>
                <script>
                //jQuery(document).ready(function($) {
                //    $(".clickable-row").click(function() {
                //        window.document.location = $(this).data("href");
                //    });
                //});
                </script>
            <?php endif; ?>
        </div>

    </div>
</div>

</body></html>

<script type="text/javascript">
    $(".various").fancybox({
        //maxWidth    : 800,
        //maxHeight   : 600,
        fitToView   : true,
        width       : '85%',
        height      : '70%',
        //autoSize    : true,
        //autoScale   : true,
        closeClick  : true,
        openEffect  : 'fade',
        closeEffect : 'fade',
    });
</script>

<?php echo $__env->make('forms.fdatatables_script', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\SYSINFO\cpswf\sipre\resources\views/tiers/creanciers/index.blade.php ENDPATH**/ ?>