<?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(255,165,0,.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/mandat.png", 
                    "Mandatements", array( 'width'=>'100%',
                        "style"=>"padding:4px" )); ?> 
            </div>
            <div class="col-xs-10" style="padding-left:0px;">
                <h1 style="margin-top:2px;">
                    Mandats
                </h1>
            </div>
        </div>

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

            <?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('/mandatements/mandats_annee/'); ?>/"
                            +$('#exercice_id').val();
                    });
                });
            </script>
        </div>
    </div>
    <br/>
    <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>N°</th>
                        <th width='1%'>Exe.</th>
                        <th width='1%'>Date</th>
                        <th width='1%'>Statut</th>
                        <th width='1%'>Statut<br/>Transfert</th>
                        <th width='1%'>Date de validation</th>
                        <th>Créanciers</th>
                        <th>Imputations</th>
                        <th width='1%'>Total</th>
                        <th width='155px'></th>
                    </tr>
                </thead>
     
                <tbody>
                    <?php $__currentLoopData = $mandats; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $mandat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php
                        $imputation=App\Models\Imputation::find($mandat->id);
                        $class_type="";
                        if($mandat->type=='A') $class_type='bg-danger';
                    ?>
                    <tr>
                        <td align="center">
                            <?php if($user->can("MDT_VISU") || $user->HasRole("ADMINISTRATEUR")): ?>
                                <a href="<?php echo url('mandatements/mandats/'.$mandat->id); ?>" 
                                    class="" style="margin-right: 3px;">
                            <?php endif; ?>

                            <?php echo str_pad($mandat->id,6,'0',STR_PAD_LEFT); ?>


                            <?php if($user->can("MDT_VISU") || $user->HasRole("ADMINISTRATEUR")): ?>
                                </a>
                            <?php endif; ?> 
                        </td>
                        <td><?php echo $mandat->exercice; ?></td>
                        <td><?php echo $mandat->date_sai; ?></td>
                        <td><?php echo $mandat->statut_mdt; ?></td>
                        <td>
                            <?php echo $mandat->StatutTransfertLibelle; ?>

                            <?php if($mandat->statut_transfert=="TRA"): ?>
                                <br/><?php echo $mandat->DateTransfert; ?>

                            <?php endif; ?>
                        </td>
                        <td><?php echo $mandat->date_valid; ?></td>
                        <td style='font-size:12px'><?php echo $mandat->getListeCreancierHTML(); ?></td>
                        <td style='font-size:12px'><?php echo $mandat->getListeImputationsHTML(); ?></td>
                        <td class='<?php echo $class_type; ?>' nowrap align="right" style="color:darkblue;"><?php echo $mandat->montant; ?></td>
                        <td>
                        <?php if($user->can("MDT_MAJ") || $user->HasRole("ADMINISTRATEUR")): ?>
                                <a href="<?php echo url('mandatements/mandats/'.$mandat->id.'/edit'); ?>" class="btn btn-sm btn-info pull-left" style="margin-right: 3px;margin-bottom: 3px;">Modifier
                                </a>
                        <?php endif; ?> 
                        <?php if($user->can("MDT_TRF") || $user->HasRole("ADMINISTRATEUR")): ?>
                                <?php if($mandat->statut_transfert==""): ?>
                                <a href="<?php echo url('mandatements_settransfert/'.$mandat->id.'/'.$exercice); ?>" class="btn btn-sm btn-primary pull-left" style="margin-right: 3px;margin-bottom: 3px;">A Transférer
                                </a>
                                <?php endif; ?> 
                                <?php if($mandat->statut_transfert=="ATR"): ?>
                                <a href="<?php echo url('mandatements_unsettransfert/'.$mandat->id.'/'.$exercice); ?>" class="btn btn-sm btn-warning pull-left" style="margin-right: 3px;margin-bottom: 3px;">Ne pas Transférer
                                </a>
                                <?php endif; ?> 
                        <?php endif; ?> 
                        <?php if(($user->can("MDT_SUP")|| $user->HasRole("ADMINISTRATEUR"))   
                            && ($mandat->statut_mdt=="ANN")): ?>  
                            <span style=""> 
                            <?php echo Form::open(['url' => '/mandatements/mandats/' . $mandat->id, 'method' => 'DELETE']); ?>

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

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

                            </span> 
                        <?php endif; ?> 
                        </td>
                    </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
        </div>
    <?php if($user->can("MDT_AJO") || $user->HasRole("ADMINISTRATEUR")): ?>
         <div>
            <h4><a href="<?php echo url('mandatements/mandats/create'); ?>" class="btn btn-success">Ajouter un Mandat</a></h4>
        </div> 
    <?php endif; ?>
    </div>
</div>

</body></html>


<?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/mandatements/mandats/index.blade.php ENDPATH**/ ?>