<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>

<script>
$(document).ready(function () {

    oTable = $('#FelData').dataTable({
        "aaSorting": [[1, "desc"]],
        "aLengthMenu": [[10, 25, 50, 100, -1],
                        [10, 25, 50, 100, "<?= lang('all') ?>"]],
        "iDisplayLength": <?= $Settings->rows_per_page ?>,

        'bProcessing': true,
        'bServerSide': true,

        'sAjaxSource': '<?= site_url('admin/fel/getFelInvoices') ?>',

        'fnServerData': function (sSource, aoData, fnCallback) {
            aoData.push({
                "name": "<?= $this->security->get_csrf_token_name() ?>",
                "value": "<?= $this->security->get_csrf_hash() ?>"
            });

            $.ajax({
                'dataType': 'json',
                'type': 'POST',
                'url': sSource,
                'data': aoData,
                'success': fnCallback
            });
        },

        "aoColumns": [
            null,  // id
            null,  // issued_at
            null,  // ticket_id
            null,  // client_nit
            null,  // receptor_nombre
            null,  // serie
            null,  // numero
            { "mRender": currencyFormat }, // grand_total
            { "bSortable": false }, // checkbox
            { "bSortable": false }  // Actions
        ]
    });

});
</script>



<?php if ($Owner || $GP['bulk_actions']) {
    echo admin_form_open('fel/actions', 'id="action-form"');
} ?>


<div class="box">

<div class="box-header">
    <h2 class="blue">
        <i class="fa-fw fa fa-file-text"></i>
        Facturas Electrónicas FEL
    </h2>
</div>


<div class="box-content">
<div class="row">
<div class="col-lg-12">

<p class="introtext">Listado de facturas certificadas</p>

<div class="table-responsive">

<table id="SLData"
       class="table table-bordered table-hover table-striped">

<thead>
<tr>

<th style="width:30px;text-align:center">
<input class="checkbox checkft" type="checkbox"/>
</th>

<th>Fecha</th>
<th>Ticket</th>
<th>NIT</th>
<th>Cliente</th>
<th>Serie</th>
<th>Número</th>
<th>Total</th>
<th style="width:80px;text-align:center">Acciones</th>

</tr>
</thead>

<tbody>
<tr>
<td colspan="8" class="dataTables_empty">
<?= lang('loading_data'); ?>
</td>
</tr>
</tbody>


<tfoot class="dtFilter">
<tr class="active">

<th style="width:30px;text-align:center">
<input class="checkbox checkft" type="checkbox"/>
</th>

<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>


</tr>
</tfoot>

</table>

</div>
</div>
</div>
</div>
</div>


<?php if ($Owner || $GP['bulk_actions']) { ?>

<div style="display:none;">
<input type="hidden" name="form_action" id="form_action"/>
<?= form_submit('performAction','performAction','id="action-form-submit"') ?>
</div>

<?= form_close() ?>

<?php } ?>
