mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'mod/historico_catalogo' into 'main'
Mod/historico catalogo See merge request jjimenez/safekat!847
This commit is contained in:
@ -251,13 +251,12 @@ class CatalogoLibros extends BaseResourceController
|
||||
->setSearchableColumns([
|
||||
't1.id',
|
||||
't1.created_at',
|
||||
't1.titulo',
|
||||
't1.paginas',
|
||||
't1.tirada',
|
||||
't1.total',
|
||||
't1.estado'
|
||||
])
|
||||
->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)))
|
||||
->add('actionBtns', function ($row) {
|
||||
return '<div class="btn-group btn-group-sm">
|
||||
|
||||
@ -63,6 +63,10 @@ return [
|
||||
'createdAt' => 'Fecha de Creación',
|
||||
'updatedAt' => 'Fecha de Actualización',
|
||||
'deletedAt' => 'Fecha de Eliminación',
|
||||
'tirada' => 'Tirada',
|
||||
'precioUd' => 'Precio Ud.',
|
||||
'total' => 'Total',
|
||||
'estado' => 'Estado',
|
||||
|
||||
'catalogoLibro' => 'Libro',
|
||||
'catalogoLibroList' => 'Lista de Libros',
|
||||
|
||||
@ -132,7 +132,16 @@ class ImportadorModel extends \App\Models\BaseModel
|
||||
$db = \Config\Database::connect($this->DBGroup);
|
||||
|
||||
$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) {
|
||||
$builder->where('t1.catalogo_id', $catalogoId);
|
||||
|
||||
@ -22,9 +22,8 @@
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Fecha</th>
|
||||
<th>Título</th>
|
||||
<th>Nº Páginas</th>
|
||||
<th>Tirada</th>
|
||||
<th>Precio ud.</th>
|
||||
<th>Total</th>
|
||||
<th>Estado</th>
|
||||
<th>Acciones</th>
|
||||
@ -34,25 +33,26 @@
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="col-12 mb-4">
|
||||
<h5>Pedidos - Antiguo ERP</h5>
|
||||
<table id="tablaPedidosAntiguos" class="table table-striped table-hover" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Fecha</th>
|
||||
<th>Título</th>
|
||||
<th>Nº Páginas</th>
|
||||
<th>Tirada</th>
|
||||
<th>Total</th>
|
||||
<th>Estado</th>
|
||||
<th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-12 mb-4 table-responsive">
|
||||
<h5>Pedidos - Antiguo ERP</h5>
|
||||
<table id="tablaPedidosAntiguos" class="table table-striped table-hover w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('Catalogo.id') ?></th>
|
||||
<th><?= lang('Catalogo.createdAt') ?></th>
|
||||
<th><?= lang('Catalogo.tirada') ?></th>
|
||||
<th><?= lang('Catalogo.precioUd') ?></th>
|
||||
<th><?= lang('Catalogo.total') ?></th>
|
||||
<th><?= lang('Catalogo.estado') ?></th>
|
||||
<th class="text-nowrap" style="min-width: 85px;"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -297,6 +297,11 @@ class Catalogo {
|
||||
|
||||
this.initPedidosTable();
|
||||
|
||||
// Ajustar al ancho de contenendor la tabla de historizo de pedidos
|
||||
$('#collapsePedidos').on('shown.bs.collapse', function () {
|
||||
$('#tablaPedidosAntiguos').DataTable().columns.adjust().responsive.recalc();
|
||||
});
|
||||
|
||||
// Al cargar la página
|
||||
this.toggleSobrecubiertaFields();
|
||||
|
||||
@ -343,14 +348,7 @@ class Catalogo {
|
||||
lengthMenu: [5, 10, 25, 50, 75, 100],
|
||||
pageLength: 10,
|
||||
lengthChange: true,
|
||||
dom: 'lfBrtip',
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'print', {
|
||||
extend: 'pdfHtml5',
|
||||
orientation: 'landscape',
|
||||
pageSize: 'A4'
|
||||
}
|
||||
],
|
||||
dom: 'lfrtip',
|
||||
order: [[1, 'desc']],
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
@ -372,9 +370,8 @@ class Catalogo {
|
||||
columns: [
|
||||
{ data: 'id' },
|
||||
{ data: 'created_at' },
|
||||
{ data: 'titulo' },
|
||||
{ data: 'paginas' },
|
||||
{ data: 'tirada' },
|
||||
{ data: 'precio_ud' , searchable: false, orderable: false },
|
||||
{ data: 'total' },
|
||||
{ data: 'estado' },
|
||||
{ data: 'actionBtns' }
|
||||
|
||||
Reference in New Issue
Block a user