COrregidos cambios JM

This commit is contained in:
Ignacio Martinez Navajas
2025-06-04 23:27:31 +02:00
parent 7f88ea7296
commit 63866b6f2f
5 changed files with 40 additions and 32 deletions

View File

@ -251,13 +251,12 @@ class CatalogoLibros extends BaseResourceController
->setSearchableColumns([ ->setSearchableColumns([
't1.id', 't1.id',
't1.created_at', 't1.created_at',
't1.titulo',
't1.paginas',
't1.tirada', 't1.tirada',
't1.total', 't1.total',
't1.estado' 't1.estado'
]) ])
->edit('total', fn($row) => number_format((float) $row->total, 2, ',', '.') . ' €') ->edit('total', fn($row) => number_format((float) $row->total, 2, ',', '.') . ' €')
->edit('precio_ud', fn($row) => number_format((float) $row->total, 2, ',', '.') . ' €')
->edit('created_at', fn($row) => date('d/m/Y', strtotime($row->created_at))) ->edit('created_at', fn($row) => date('d/m/Y', strtotime($row->created_at)))
->add('actionBtns', function ($row) { ->add('actionBtns', function ($row) {
return '<div class="btn-group btn-group-sm"> return '<div class="btn-group btn-group-sm">

View File

@ -63,6 +63,10 @@ return [
'createdAt' => 'Fecha de Creación', 'createdAt' => 'Fecha de Creación',
'updatedAt' => 'Fecha de Actualización', 'updatedAt' => 'Fecha de Actualización',
'deletedAt' => 'Fecha de Eliminación', 'deletedAt' => 'Fecha de Eliminación',
'tirada' => 'Tirada',
'precioUd' => 'Precio Ud.',
'total' => 'Total',
'estado' => 'Estado',
'catalogoLibro' => 'Libro', 'catalogoLibro' => 'Libro',
'catalogoLibroList' => 'Lista de Libros', 'catalogoLibroList' => 'Lista de Libros',

View File

@ -132,7 +132,16 @@ class ImportadorModel extends \App\Models\BaseModel
$db = \Config\Database::connect($this->DBGroup); $db = \Config\Database::connect($this->DBGroup);
$builder = $db->table('pedido_libro t1') $builder = $db->table('pedido_libro t1')
->select('t1.id, t1.created_at, t1.titulo, t1.paginas, t1.tirada, t1.total, t1.estado'); ->select(
't1.id,
t1.created_at,
t1.tirada,
(CASE
WHEN t1.tirada > 0 THEN t1.total / t1.tirada
ELSE 0
END) AS precio_ud,
t1.total,
t1.estado');
if ($catalogoId !== null) { if ($catalogoId !== null) {
$builder->where('t1.catalogo_id', $catalogoId); $builder->where('t1.catalogo_id', $catalogoId);

View File

@ -22,9 +22,8 @@
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Fecha</th> <th>Fecha</th>
<th>Título</th>
<th> Páginas</th>
<th>Tirada</th> <th>Tirada</th>
<th>Precio ud.</th>
<th>Total</th> <th>Total</th>
<th>Estado</th> <th>Estado</th>
<th>Acciones</th> <th>Acciones</th>
@ -34,25 +33,26 @@
</div> </div>
--> -->
<div class="col-12 mb-4"> <div class="col-12 mb-4 table-responsive">
<h5>Pedidos - Antiguo ERP</h5> <h5>Pedidos - Antiguo ERP</h5>
<table id="tablaPedidosAntiguos" class="table table-striped table-hover" style="width:100%"> <table id="tablaPedidosAntiguos" class="table table-striped table-hover" style="width:100%">
<thead> <thead>
<tr> <tr>
<th>ID</th> <th><?= lang('Catalogo.id') ?></th>
<th>Fecha</th> <th><?= lang('Catalogo.createdAt') ?></th>
<th>Título</th> <th><?= lang('Catalogo.tirada') ?></th>
<th> Páginas</th> <th><?= lang('Catalogo.precioUd') ?></th>
<th>Tirada</th> <th><?= lang('Catalogo.total') ?></th>
<th>Total</th> <th><?= lang('Catalogo.estado') ?></th>
<th>Estado</th> <th class="text-nowrap" style="min-width: 85px;"><?= lang('Basic.global.Action') ?></th>
<th>Acciones</th> </tr>
</tr> </thead>
</thead> <tbody>
</table> </tbody>
</div> </table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div> </div>

View File

@ -297,6 +297,10 @@ class Catalogo {
this.initPedidosTable(); this.initPedidosTable();
$('#collapsePedidos').on('shown.bs.collapse', function () {
$('#tablaPedidosAntiguos').DataTable().columns.adjust().responsive.recalc();
});
// Al cargar la página // Al cargar la página
this.toggleSobrecubiertaFields(); this.toggleSobrecubiertaFields();
@ -343,14 +347,7 @@ class Catalogo {
lengthMenu: [5, 10, 25, 50, 75, 100], lengthMenu: [5, 10, 25, 50, 75, 100],
pageLength: 10, pageLength: 10,
lengthChange: true, lengthChange: true,
dom: 'lfBrtip', dom: 'lfrtip',
buttons: [
'copy', 'csv', 'excel', 'print', {
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'A4'
}
],
order: [[1, 'desc']], order: [[1, 'desc']],
language: { language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
@ -372,9 +369,8 @@ class Catalogo {
columns: [ columns: [
{ data: 'id' }, { data: 'id' },
{ data: 'created_at' }, { data: 'created_at' },
{ data: 'titulo' },
{ data: 'paginas' },
{ data: 'tirada' }, { data: 'tirada' },
{ data: 'precio_ud' , searchable: false, orderable: false },
{ data: 'total' }, { data: 'total' },
{ data: 'estado' }, { data: 'estado' },
{ data: 'actionBtns' } { data: 'actionBtns' }