<?= $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="pedidoForm" method="post" class="card-body" action="<?= $formAction ?>">
                <?= csrf_field() ?>
                <div class="card-body pt-0">
                    <?= view("themes/_commonPartialsBs/_alertBoxes") ?>
                    <?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
                    <?php if (isset($orden_id)): ?>
                        <div class="row mt-1 justify-content-end">
                            <div class="col-auto">
                                <div class="btn mt-3 btn-warning waves-effect waves-light ml-2"
                                    onclick="window.location.href='<?= route_to("viewOrdenTrabajoEdit", $orden_id) ?>'" >
                                    <span class="align-middle d-sm-inline-block d-none me-sm-1">Orden</span>
                                    <i class="ti ti-building-factory-2 ti-xs"></i>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>
                    <?= view("themes/vuexy/form/pedidos/_cabeceraItems") ?>
                    <?= view("themes/vuexy/form/pedidos/_lineasItems") ?>
                    <?= view("themes/vuexy/form/pedidos/_facturasItems") ?>
                    <?= view("themes/vuexy/components/chat_internal_pedido", data: ["modelId" => $pedidoEntity->id, "type" => "pedido"]) ?>
                </div><!-- /.card-body -->

            </form>
            <div class="row">
                <div class="col-md-12 d-flex justify-content-between">
                    <div class="pt-4">
                        <?= anchor(route_to("listaPedidos"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
                    </div><!-- /.card-footer -->
                </div>
            </div>
            <div class="container-fluid d-flex flex-md-row flex-column justify-content-between align-items-md-center gap-1 container-p-x py-3">
                <div class="col-md-6">
                    <p>
                        <strong><?= lang("Presupuestos.created_by_at") ?></strong>
                        <span id="created_by"><?= $pedidoEntity->created_by ?></span>, 
                        <span id="created_at"><?= $pedidoEntity->created_at_footer ?></span>
                    </p>
                </div>
                <div class="col-md-6">
                    <p>
                        <strong><?= lang("Presupuestos.updated_by_at") ?></strong>
                        <span id="updated_by"><?= $pedidoEntity->updated_by ?></span>, 
                        <span id="updated_at_footer"><?= $pedidoEntity->updated_at_footer ?></span>
                    </p>
                </div>
            </div>
        </div><!-- //.card -->
    </div>
    <!--//.col -->
</div>
<!--//.row -->
<?= view("themes/_commonPartialsBs/_modalConfirmDialog") ?>

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


<?= $this->section('css') ?>
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/flatpickr/flatpickr.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/sk-datatables.css') ?>">
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.css') ?>" />
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/pedidos.css') ?>">

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

<?= $this->section('additionalExternalJs') ?>
<script src="<?= site_url('themes/vuexy/vendor/libs/sweetalert2/sweetalert2.js') ?>"></script>
<script type="module" src="<?= site_url("assets/js/safekat/pages/produccion/to_prod.js") ?>"></script>
<script src="<?= site_url("/themes/vuexy/vendor/libs/flatpickr/flatpickr.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/select/dataTables.select.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/pedidos/pedidos.js") ?>"></script>
<?= $this->endSection() ?>