<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<div class="row">
    <div class="col-md-12">

        <div class="card card-info">
            <div class="card-header">
                <h3 class="card-title"><?= lang('Facturas.facturasList') ?></h3>
            </div><!--//.card-header -->
            <div class="card-body">
                <?= view('themes/_commonPartialsBs/_alertBoxes'); ?>

                <input type="hidden" id="cliente_id" value="<?= $cliente_id ?>">

                <table id="tableOfFacturas" class="table table-striped table-hover" style="width: 100%;">
                    <thead>
                        <tr>
                            <th><?= lang('Facturas.idFactura') ?></th>
                            <th><?= lang('Facturas.numeroFactura') ?></th>
                            <th><?= lang('Facturas.fechaFactura') ?></th>
                            <?php if ($cliente_id == -1): ?>
                                <th style="width: 20%;"><?= lang('Facturas.cliente') ?></th>
                            <?php endif; ?>
                            <th><?= lang('Facturas.base') ?></th>
                            <th><?= lang('Facturas.total') ?></th>
                            <th><?= lang('Facturas.pendiente') ?></th>
                            <?php if ($cliente_id == -1): ?>
                                <th><?= lang('Facturas.credito') ?></th>
                                <th><?= lang('Facturas.estado') ?></th>
                                <th><?= lang('Facturas.estadoPago') ?></th>
                                <th><?= lang('Facturas.formaPago') ?></th>
                                <th><?= lang('Facturas.vencimiento') ?></th>
                                <th><?= lang('Facturas.dias') ?></th>
                            <?php endif; ?>
                            <th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
                        </tr>
                        <tr>
                            <th></th>
                            <th><input type="text" class="form-control factura-filter" name="numero"></th>
                            <th><input id="fechaFactura" type="text" class="form-control factura-filter"
                                    name="fecha_factura_at"></th>
                            </th>
                            <?php if ($cliente_id == -1): ?>
                                <th><input type="text" class="form-control factura-filter" name="cliente"></th>
                            <?php endif; ?>
                            <th></th>
                            <th></th>
                            <th></th>
                            <?php if ($cliente_id == -1): ?>
                                <th>
                                    <select class="form-control factura-filter-select" name="creditoAsegurado">
                                        <option value=""><?= lang('Facturas.todos')?></option>
                                        <option value="0"><?=  lang('Basic.global.no') ?></option>
                                        <option value="1"><?=  lang('Basic.global.yes') ?></option>
                                    </select>
                                </th>
                                <th>
                                    <select class="form-control factura-filter-select" name="estado">
                                        <option value=""><?= lang('Facturas.todos')?></option>
                                        <option value="borrador"><?=  lang('Facturas.borrador') ?></option>
                                        <option value="validada"><?=  lang('Facturas.validada') ?></option>
                                    </select>
                                </th>
                                <th>
                                    <select class="form-control factura-filter-select" name="estado_pago">
                                        <option value=""><?= lang('Facturas.todos')?></option>
                                        <option value="pendiente"><?=  lang('Facturas.pendiente') ?></option>
                                        <option value="pagada"><?=  lang('Facturas.pagada') ?></option>
                                        <option value="insolvente"><?=  lang('Facturas.insolvente') ?></option>
                                    </select>
                                </th>
                                <th>
                                    <select class="form-control factura-filter-select" name="forma_pago">
                                        <option value=""><?= lang('Facturas.todos')?></option>
                                        <option value="cheque"><?=  lang('Facturas.cheque') ?></option>
                                        <option value="compensada"><?=  lang('Facturas.compensada') ?></option>
                                        <option value="confirming"><?=  lang('Facturas.confirming') ?></option>
                                        <option value="giroDomiciliado"><?=  lang('Facturas.giroDomiciliado') ?></option>
                                        <option value="pagare"><?=  lang('Facturas.pagare') ?></option>
                                        <option value="transferencia"><?=  lang('Facturas.transferencia') ?></option>
                                    </select>
                                </th>
                                <th></th>
                                <th></th>
                            <?php endif; ?>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>

                    </tbody>
                </table>
            </div><!--//.card-body -->
            <div class="card-footer">

            </div><!--//.card-footer -->
        </div><!--//.card -->
    </div><!--//.col -->
</div><!--//.row -->

<?= $this->endSection() ?>



<?= $this->section('additionalInlineJs') ?>


window.datepickerLang = <?= $datepickerLang; ?>;
window.datepickerLocale ='<?= $datepickerLocale; ?>';

<?= $this->endSection() ?>



<?= $this->section('css') ?>
<link rel="stylesheet"
    href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
<link rel="stylesheet"
    href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/fixedheader/fixedHeader.dataTables.min.css") ?>">
<link rel="stylesheet"
    href="<?= site_url('themes/vuexy/vendor/libs/bootstrap-daterangepicker/bootstrap-daterangepicker.css') ?>" />
<?= $this->endSection() ?>


<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url('themes/vuexy/vendor/libs/moment/moment.js') ?>"></script>
<script
    src="<?= site_url('themes/vuexy/vendor/libs/bootstrap-daterangepicker/bootstrap-daterangepicker.js') ?>"></script>
<script
    src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
<script
    src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>"
    crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>

<script type="module" src="<?= site_url("assets/js/safekat/pages/facturas/facturasList.js") ?>"></script>
<?= $this->endSection() ?>