<?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(0,0,139,.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/imputations.png", 
                    "Imputations", array( 'width'=>'100%',
                        "style"=>"padding:4px" )); ?> 
            </div>
            <div class="col-xs-10" style="padding-left:0px;">
                <h1 style="margin-top:2px;">
                    Imputations
                </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/imputations_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>Id</th>
                        <th width='1%' nowrap>N°Compte</th>
                        <th>Désignation</th>
                        <th width='1%'>Montant</th>
                        <th width='1%'>Type</th>
                        <th width='1%'>IdMandat</th>
                        <th>Observations</th>
                        <th></th>
                    </tr>
                </thead>
     
                <tbody>
                    <?php $__currentLoopData = $imputations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $imputation): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php
                        $imputations=App\Models\Imputation::find($imputation->idmandat);
                    ?>
                    <tr class="clickable-row" data-href="<?php echo url('mandatements/imputations/'.$imputation->id); ?>">
                        <td align="center">
                            <?php if($user->can("MDT_VISU") || $user->HasRole("ADMINISTRATEUR")): ?>
                                <a href="<?php echo url('mandatements/imputations/'.$imputation->id); ?>" 
                                    class="" style="margin-right: 3px;">
                            <?php endif; ?>

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


                            <?php if($user->can("MDT_VISU") || $user->HasRole("ADMINISTRATEUR")): ?>
                                </a>
                            <?php endif; ?> 
                        </td>
                        <td><?php echo $imputation->cpt_imp; ?></td>
                        <td><?php echo $imputation->designation; ?></td>
                        <td><?php echo $imputation->montant; ?></td>
                        <td><?php echo $imputation->type_imp; ?></td>
                        <td><?php echo $imputation->idmandat; ?></td>
                        <td><?php echo $imputation->obs; ?></td>
                        <td>
                        <?php if($user->can("IMP_MAJ") || $user->HasRole("ADMINISTRATEUR")): ?>
                            <a href="<?php echo url('mandatements/imputations/'.$imputation->id.'/edit'); ?>" class="btn btn-info pull-left" style="margin-right: 3px;">Modifier</a>
                        <?php endif; ?> 
                        <?php if($user->can("IMP_SUP")|| $user->HasRole("ADMINISTRATEUR")): ?>      
                            <?php echo Form::open(['url' => '/mandatements/imputations/' . $imputation->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("IMP_VISU") || $user->HasRole("ADMINISTRATEUR")): ?>
                <script>
                jQuery(document).ready(function($) {
                    $(".clickable-row").click(function() {
                        window.document.location = $(this).data("href");
                    });
                });
                </script>
            <?php endif; ?>
        </div>
    <?php if($user->can("IMP_AJO") || $user->HasRole("ADMINISTRATEUR")): ?>
         <div>
            <h4><a href="<?php echo url('mandatements/imputations/create'); ?>" 
                class="btn btn-success">Ajouter une Imputation</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/imputations/index.blade.php ENDPATH**/ ?>