<?= $this->include("themes/_commonPartialsBs/datatables") ?>
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>

<?= $this->section("content") ?>
<div class="row">
    <div class="col-12">
        <div class="card card-info">
            <div class="card-header">
                <h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
            </div><!--//.card-header -->
            
            <form id="clientePlantillaPreciosForm" method="post" class="card-body" action="<?= $formAction ?>">

                <?= csrf_field() ?>
                <?= view("themes/_commonPartialsBs/_alertBoxes") ?>
                <?= view("themes/vuexy/form/presupuestos/cliente/loader") ?>

                <?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
                <?= view("themes/vuexy/form/clientes/plantillaprecios/_ClienteplantillapreciosFormItems") ?>
                <div class="pt-4">
                    <input type="submit" class="btn btn-primary float-start me-sm-3 me-1" name="save"
                        value="<?= lang("Basic.global.Save") ?>" />
                    <?= anchor(route_to("clienteplantillapreciosList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary"]) ?>

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


<?php if (str_contains($formAction, 'edit')): ?>

    <div class="accordion mt-3" id="accordionPreciosLineas">

        <div class="card accordion-item active">
            <h2 class="accordion-header" id="headingOne">
                <button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1"
                    aria-expanded="false" aria-controls="accordionTip1">
                    <h3><?= lang("MaquinasTarifasImpresions.moduleTitle") ?></h3>
                </button>
            </h2>

            <div id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordionPreciosLineas">
                <div class="accordion-body">

                    <button id="btnApply" type="button" class="btn btn-primary d-none">
                        Guardar y aplicar a clientes
                    </button>
                    <button id="btnUndo" type="button" class="btn btn-secondary d-none">
                        Descartar cambios
                    </button>
                    
                    <table id="tableOfPlantillasPreciosLineas" class="table table-striped table-hover" style="width: 100%;">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th><?= lang('ClientePrecios.tipo') ?></th>
                                <th><?= lang('ClientePrecios.tipo_maquina') ?></th>
                                <th><?= lang('ClientePrecios.tipo_impresion') ?></th>
                                <th><?= lang('ClientePrecios.tiempo_min') ?></th>
                                <th><?= lang('ClientePrecios.tiempo_max') ?></th>
                                <th class="noFilter"><?= lang('ClientePrecios.precio_hora') ?></th>
                                <th class="noFilter"><?= lang('ClientePrecios.margen') ?></th>
                                <th class="noFilter"><?= lang('ClientePrecios.total_precio_hora') ?></th>
                                <th><?= lang('ClientePrecios.user_updated_id') ?></th>
                                <th class="noFilter"><?= lang('ClientePrecios.updated_at') ?></th>
                                <th class="text-nowrap noFilter" style="min-width:100px"><?= lang('Basic.global.Action') ?>
                                </th>
                            </tr>
                        </thead>
                        <tbody>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div> <!-- //.accordion -->
<?php endif; ?>


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

<?= $this->section('css') ?>
    <link rel="stylesheet"
        href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.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/css/presupuestoCliente.css') ?>">
<?= $this->endSection() ?>

<?= $this->section('additionalExternalJs') ?>
    <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
        src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
    <?php if (str_contains($formAction, 'edit')): ?>
        <script type="module"
            src="<?= site_url('assets/js/safekat/pages/plantillasTarifasCliente/edit.js') ?>"></script>
    <?php endif; ?>
<?= $this->endSection() ?>