añadidos entidades y modelos. Hecha lista de todos

This commit is contained in:
2024-06-11 08:53:20 +02:00
parent bc85572610
commit 2143660cf6
14 changed files with 484 additions and 31 deletions

View File

@ -0,0 +1,147 @@
<?=$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('Pedidos.pedidosList') ?></h3>
</div><!--//.card-header -->
<div class="card-body">
<?= view('themes/_commonPartialsBs/_alertBoxes'); ?>
<table id="tableOfPedidos" class="table table-striped table-hover" style="width: 100%;">
<thead>
<tr>
<th><?= lang('Pedidos.id') ?></th>
<th><?= lang('Pedidos.fecha') ?></th>
<th><?= lang('Pedidos.fecha_entrega') ?></th>
<th><?= lang('Pedidos.cliente') ?></th>
<th><?= lang('Pedidos.comercial') ?></th>
<th><?= lang('Pedidos.titulo') ?></th>
<th><?= lang('Pedidos.ubicacion') ?></th>
<th><?= lang('Pedidos.inc_rei') ?></th>
<th><?= lang('Pedidos.num_paginas') ?></th>
<th><?= lang('Pedidos.tiradas') ?></th>
<th><?= lang('Pedidos.total_presupuesto') ?></th>
<th><?= lang('Pedidos.estado') ?></th>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></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') ?>
const lastColNr = $('#tableOfPedidos').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a>
</div>
</td>`;
};
theTable = $('#tableOfPedidos').DataTable({
processing: true,
serverSide: true,
autoWidth: true,
responsive: true,
scrollX: true,
lengthMenu: [ 5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500 ],
pageLength: 50,
lengthChange: true,
"dom": 'lfBrtip',
"buttons": [
'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'A4'
}
],
stateSave: true,
order: [[0, 'asc']],
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfPedidos') ?>',
method: 'POST',
data: {
estado: "<?= $estadoPedidos ?>",
},
headers: {'X-Requested-With': 'XMLHttpRequest'},
async: true,
}),
columnDefs: [
{
orderable: false,
searchable: false,
targets: [lastColNr]
}
],
columns : [
{ 'data': 'id' },
{ 'data': 'fecha' },
{ 'data': 'fecha_entrega' },
{ 'data': 'cliente' },
{ 'data': 'comercial' },
{ 'data': 'titulo' },
{ 'data': 'ubicacion' },
{ 'data': 'inc_rei' },
{ 'data': 'num_paginas' },
{ 'data': 'tiradas' },
{ 'data': 'total_presupuesto' },
{ 'data': 'estado' },
{ 'data': actionBtns }
]
});
theTable.on( 'draw.dt', function () {
const boolCols = [];
for (let coln of boolCols) {
theTable.column(coln, { page: 'current' }).nodes().each( function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
});
}
});
$(document).on('click', '.btn-edit', function(e) {
window.location.href = `/pedidos/edit/${$(this).attr('data-id')}`;
});
<?=$this->endSection() ?>
<?=$this->section('css') ?>
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.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>
<?=$this->endSection() ?>

View File

@ -117,10 +117,10 @@
</a>
</li>
<?php endif; ?>
<?php if (count(getArrayItem($temp, 'methods', 'manuales', true)) > 0): ?>
<?php if (count(getArrayItem($temp, 'methods', 'todos', true)) > 0): ?>
<li class="menu-item">
<a href="<?= site_url("pedidos/pedido/manuales") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_pedidos_manuales") ?>"><?= lang("App.menu_pedidos_manuales") ?></div>
<a href="<?= site_url("pedidos/pedido/todos") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_pedidos_todos") ?>"><?= lang("App.menu_pedidos_todos") ?></div>
</a>
</li>
<?php endif; ?>

View File

@ -138,10 +138,10 @@
</a>
</li>
<?php endif; ?>
<?php if (count(getArrayItem($temp, 'methods', 'manuales', true)) > 0): ?>
<?php if (count(getArrayItem($temp, 'methods', 'todos', true)) > 0): ?>
<li class="menu-item">
<a href="<?= site_url("pedidos/pedido/manuales") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_pedidos_manuales") ?>"><?= lang("App.menu_pedidos_manuales") ?></div>
<a href="<?= site_url("pedidos/pedido/todos") ?>" class="menu-link">
<div data-i18n="<?= lang("App.menu_pedidos_todos") ?>"><?= lang("App.menu_pedidos_todos") ?></div>
</a>
</li>
<?php endif; ?>

View File

@ -27,8 +27,8 @@ if (auth()->user()->inGroup('beta')) {
</a>
</li>
<li class="menu-item">
<a href="<?= site_url("pedidos/pedido/manuales") ?>" class="menu-link">
<?= lang("App.menu_pedidos_manuales") ?>
<a href="<?= site_url("pedidos/pedido/todos") ?>" class="menu-link">
<?= lang("App.menu_pedidos_todos") ?>
</a>
</li>
</ul>