Arreglado precio ud en tabla

This commit is contained in:
Ignacio Martinez Navajas
2025-06-05 09:28:30 +02:00
parent 5058ae488b
commit b1cd63f665
2 changed files with 8 additions and 3 deletions

View File

@ -252,11 +252,12 @@ class CatalogoLibros extends BaseResourceController
't1.id',
't1.created_at',
't1.tirada',
'(CASE WHEN t1.tirada > 0 THEN t1.total / t1.tirada ELSE 0 END)',
'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('precio_ud', fn($row) => number_format((float) $row->precio_ud, 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">

View File

@ -299,7 +299,11 @@ class Catalogo {
// Ajustar al ancho de contenendor la tabla de historizo de pedidos
$('#collapsePedidos').on('shown.bs.collapse', function () {
$('#tablaPedidosAntiguos').DataTable().columns.adjust().responsive.recalc();
const table = $('#tablaPedidosAntiguos').DataTable();
table.columns.adjust();
if (typeof table.responsive !== 'undefined') {
table.responsive.recalc();
}
});
// Al cargar la página
@ -371,7 +375,7 @@ class Catalogo {
{ data: 'id' },
{ data: 'created_at' },
{ data: 'tirada' },
{ data: 'precio_ud' , searchable: false, orderable: false },
{ data: 'precio_ud' },
{ data: 'total' },
{ data: 'estado' },
{ data: 'actionBtns' }