
<div class="col-md-12">
    <div class="form-group row">
        <div class='col-md-12'>
            <label for="liste" class="col-sm-3 control-label">Liste des mouvements</label>
        </div>
        <div class='col-md-12'>
            <table id="table_e" class="table table-striped table-condensed table-bordered" name="table_e" width="100%">
                <thead style="background-color:lightgrey">
                    <tr style="">
                        <th>Compte</th>
                        <th>Compte Auxiliaire</th>
                        <th width="20%">Libellé Opération</th>
                        <th width="10%">Débit</th>
                        <th width="10%">Crédit</th>
                        <th width="1%">Action</th>
                    </tr>
                </thead>

                <tbody>
            

                @if(count($ecritures)>1)
                    @php $total_debit=0;$total_credit=0;$chrono_ligne=0; @endphp
                    @foreach ($ecritures as $ecriture)
                        @php
                            $chrono_ligne++;
                            $total_debit+=$ecriture->debit;
                            $total_credit+=$ecriture->credit;
                            $compte=$ecriture->compte;
                            $compte_text=$ecriture->compte." ".$ecriture->compte_label;
                            $compte_aux=$ecriture->compte_aux;
                            $compte_aux_text=$ecriture->compte_aux." ".$ecriture->compte_aux_label;
                            $libelle=$ecriture->designation;
                            $debit=$ecriture->debit;
                            $credit=$ecriture->credit;
                            $td_val=$compte.";".$compte_aux.";".$libelle.";".$debit.";".$credit;
                        @endphp

                    <tr id='tr_"+chrono_ligne+"' class='tr_'>
                    <td align=''><input id='compte_{{ $chrono_ligne }}' type='text' name='compte_{{ $chrono_ligne }}' class='td_compte form-control' disabled value='{{ $compte_text }}'/></td>
                    <td align=''><input id='compte_aux_{{ $chrono_ligne }}' type='text' name='compte_aux_{{ $chrono_ligne }}' class='td_compte_aux form-control' disabled value='{{ $compte_aux_text }}'/></td>
                    <td align=''><input id='libelle_aux_{{ $chrono_ligne }}' type='text' name='libelle_aux_{{ $chrono_ligne }}' class='td_libelle form-control' disabled value='{{ $libelle }}'/></td>
                    <td align='right'><input id='debit_{{ $chrono_ligne }}' type='text' name='debit_{{ $chrono_ligne }}' class='td_debit form-control' disabled value='{{ $debit }}'/></td>
                    <td align='right'><input id='credit_{{ $chrono_ligne }}' type='text' name='credit_{{ $chrono_ligne }}' class='td_credit form-control' disabled value='{{ $credit }}'/></td>
                    <td nowrap align='center' >
                        @if(1==0)<a href='#' id='btn_edit_{{ $chrono_ligne }}' class='btn_edit btn btn-sm bg-info'/><i class='fas fa-pencil'></i></a>&nbsp;&nbsp;@endif
                        <a href='#' id='btn_delete_{{ $chrono_ligne }}' class='btn_delete btn btn-sm bg-danger'/><i class='fas fa-trash'></i></a>
                    </td>
                   <input id='lg_{{ $chrono_ligne }}' type='hidden' class='td_data' value='{{ $td_val }}'/>
                   </tr>


                    @endforeach
                @endif
                </tbody>

                <tfoot class="bg-info">
                    <tr>
                        <td>
                            {!! html()->select('sel_compte')->options(null,'')->placeholder('Compte')->attributes(['id'=>'sel_compte','class' => 'select2 form-control','style' => 'padding:2px'])  !!}
                        </td>
                        <td>
                            {!! html()->select('sel_compte_aux')->options(null,'')->placeholder('Compte Aux.')->attributes(['id'=>'sel_compte_aux','class' => 'select2 form-control','style' => 'padding:2px'])  !!}
                        </td>
                        <td>
                            {!! html()->text('libelle','')->placeholder('Libellé')->attributes(['id'=>'libelle','class' => 'form-control','style' => 'padding:2px'])  !!}
                        </td>
                        <td>
                            {!! html()->text('debit','')->placeholder('Débit')->attributes(['id'=>'debit','class' => 'form-control','style' => 'padding:2px'])  !!}
                        </td>
                        <td>
                            {!! html()->text('credit','')->placeholder('Crédit')->attributes(['id'=>'credit','class' => 'form-control','style' => 'padding:2px'])  !!}
                        </td>
                        <td>
                            <a href="#" id='bt_ajouter' style="text-decoration:none;color:white" class='btn bg-success form-control'>Ajouter</a>
                        </td>
                    </tr>
                </tfoot>
            </table>
        </td>
    </div>
</div>




