listado de pedidos admin hecho

This commit is contained in:
2025-11-17 10:35:04 +01:00
parent 73676f60b9
commit 6ff5250d1b
12 changed files with 3307 additions and 2646 deletions

View File

@ -0,0 +1,37 @@
databaseChangeLog:
- changeSet:
id: 0016-fix-enum-estado-pedidos-lineas
author: jjo
changes:
# 1) Convertir valores existentes "maquetación" → "maquetacion"
- update:
tableName: pedidos_lineas
columns:
- column:
name: estado
value: "maquetacion"
where: "estado = 'maquetación'"
# 2) Cambiar ENUM quitando tilde
- modifyDataType:
tableName: pedidos_lineas
columnName: estado
newDataType: "ENUM('aprobado','maquetacion','haciendo_ferro','producción','terminado','cancelado')"
rollback:
# 1) Volver a convertir "maquetacion" → "maquetación"
- update:
tableName: pedidos_lineas
columns:
- column:
name: estado
value: "maquetación"
where: "estado = 'maquetacion'"
# 2) Restaurar ENUM original
- modifyDataType:
tableName: pedidos_lineas
columnName: estado
newDataType: "ENUM('aprobado','maquetación','haciendo_ferro','producción','terminado','cancelado')"

View File

@ -28,4 +28,6 @@ databaseChangeLog:
- include:
file: db/changelog/changesets/0014-create-pedidos-direcciones.yml
- include:
file: db/changelog/changesets/0015-alter-pedidos-lineas-and-presupuesto-estados.yml
file: db/changelog/changesets/0015-alter-pedidos-lineas-and-presupuesto-estados.yml
- include:
file: db/changelog/changesets/0016-fix-enum-estado-pedidos-lineas.yml

View File

@ -1,3 +1,5 @@
import { normalizeNumericFilter } from '../utils.js';
$(() => {
const csrfToken = document.querySelector('meta[name="_csrf"]')?.getAttribute('content');
@ -12,7 +14,7 @@ $(() => {
const language = document.documentElement.lang || 'es-ES';
const tablePedidos = $('#table-pedidos').DataTable({
const tablePedidos = $('#pedidos-datatable').DataTable({
processing: true,
serverSide: true,
orderCellsTop: true,
@ -41,14 +43,31 @@ $(() => {
url: '/pedidos/datatable',
method: 'GET',
},
order: [[0, 'desc']],
order: [[0, 'desc']],
columns: [
{ data: 'id', name: 'id', orderable: true },
{ data: 'cliente', name: 'cliente', orderable: true },
{ data: 'created_at', name: 'created_at', orderable: true },
{ data: 'cliente', name: 'createdBy.fullName', orderable: true },
{ data: 'created_at', name: 'createdAt', orderable: true },
{ data: 'total', name: 'total', orderable: true },
{ data: 'estado', name: 'estado', orderable: true },
{ data: 'actions', name: 'actions', orderable: false, searchable: false }
],
});
tablePedidos.on("keyup change", ".input-filter", function () {
const colName = $(this).data("col");
const colIndex = tablePedidos.settings()[0].aoColumns.findIndex(c => c.name === colName);
if (colIndex >= 0) {
tablePedidos
.column(colIndex)
.search(normalizeNumericFilter(this.value))
.draw();
}
});
$('.btn-view').on('click', function () {
});
})

View File

@ -32,20 +32,32 @@
<div class="container-fluid">
<table id="pagos-redsys-datatable" class="table table-striped table-nowrap responsive w-100">
<table id="pedidos-datatable" class="table table-striped table-nowrap responsive w-100">
<thead>
<tr>
<th scope="col" th:text="#{pedido.table.id}">Num. Pedido</th>
<th scope="col" th:text="#{pedido.table.cliente}">Cliente</th>
<th scope="col" th:text="#{pedido.table.fecha}">Fecha</th>
<th scope="col" th:text="#{pedido.table.importe}">Importe</th>
<th scope="col" th:text="#{pedido.table.acciones}">Acciones</th>
<th class="text-start" scope="col" th:text="#{pedido.table.id}">Num. Pedido</th>
<th class="text-start" scope="col" th:text="#{pedido.table.cliente}">Cliente</th>
<th class="text-start" scope="col" th:text="#{pedido.table.fecha}">Fecha</th>
<th class="text-start" scope="col" th:text="#{pedido.table.importe}">Importe</th>
<th class="text-start" scope="col" th:text="#{pedido.table.estado}">Estado</th>
<th class="text-start" scope="col" th:text="#{pedido.table.acciones}">Acciones</th>
</tr>
<tr>
<th><input type="text" class="form-control form-control-sm input-filter" /></th>
<th><input type="text" class="form-control form-control-sm input-filter" /></th>
<th><input type="text" class="form-control form-control-sm input-filter" data-col="id" /></th>
<th><input type="text" class="form-control form-control-sm input-filter" data-col="createdBy.fullName" /></th>
<th></th>
<th></th>
<th>
<select class="form-select form-select-sm input-filter" data-col="estado">
<option value=""></option>
<option th:text="#{pedido.estado.aprobado}" value="aprobado"></option>
<option th:text="#{pedido.estado.maquetacion}" value="maquetacion"></option>
<option th:text="#{pedido.estado.haciendo_ferro}" value="haciendo_ferro"></option>
<option th:text="#{pedido.estado.produccion}" value="produccion"></option>
<option th:text="#{pedido.estado.terminado}" value="terminado"></option>
<option th:text="#{pedido.estado.cancelado}" value="cancelado"></option>
</select>
</th>
<th></th> <!-- Acciones (sin filtro) -->
</tr>
</thead>