falta ordenar por paginas y revisar la busqueda de los selects

This commit is contained in:
2025-10-11 18:16:55 +02:00
parent a1359f37b0
commit 62dcff8869
11 changed files with 287 additions and 70 deletions

View File

@ -288,6 +288,7 @@ presupuesto.add.cancel=Cancelar
presupuesto.add.select-client=Seleccione cliente
presupuesto.add.error.options=Debe seleccionar una opción
presupuesto.add.error.options-client=Debe seleccionar un cliente
presupuesto.add.error.save.title=Error al guardar
presupuesto.error.save-internal-error=No se puede guardar: error interno.
presupuesto.exito.guardado=Presupuesto guardado con éxito.
presupuesto.exito.guardado-actualizado=Presupuesto actualizado con éxito.

View File

@ -0,0 +1,9 @@
import PresupuestoWizard from './wizard.js';
const app = new PresupuestoWizard({
mode: 'private',
readonly: false,
canSave: true,
useSessionCache: false,
});
app.init();

View File

@ -29,8 +29,8 @@ export default class PresupuestoWizard {
ancho: 148,
alto: 218,
formatoPersonalizado: false,
paginasNegro: 0,
paginasColor: 32,
paginasNegro: 32,
paginasColor: 0,
posicionPaginasColor: '',
tipoEncuadernacion: 'fresado',
},
@ -245,7 +245,7 @@ export default class PresupuestoWizard {
});
if (this.opts.canSave) {
$('#btn-guardar').on('click', async () => {
$('.guardar-presupuesto').on('click', async () => {
const alert = $('#form-errors');
const servicios = [];
@ -263,6 +263,7 @@ export default class PresupuestoWizard {
mode: this.opts.mode,
presupuesto: this.#getPresupuestoData(),
servicios: servicios,
cliente_id: $('#cliente_id').val() || null,
};
try {
alert.addClass('d-none').find('ul').empty();
@ -274,7 +275,7 @@ export default class PresupuestoWizard {
}).then((data) => {
Swal.fire({
icon: 'success',
title: window.languageBundle?.get('common.guardado') || 'Guardado',
title: window.languageBundle?.get('presupuesto.exito.guardado') || 'Guardado',
timer: 1800,
buttonsStyling: false,
customClass: {
@ -307,7 +308,7 @@ export default class PresupuestoWizard {
} catch (e) {
Swal.fire({
icon: 'error',
title: 'Error al guardar',
title: window.languageBundle?.get('presupuesto.add.error.save.title') || 'Error',
text: e?.message || '',
buttonsStyling: false,
customClass: {

View File

@ -138,9 +138,9 @@ import { preguntarTipoPresupuesto } from './presupuesto-utils.js';
if (!res) return;
if (res.tipo === 'anonimo') {
console.log('Crear presupuesto ANÓNIMO');
window.location.href = '/presupuesto/add/public';
} else {
console.log('Crear presupuesto de CLIENTE:', res.clienteId, res.clienteText);
window.location.href = '/presupuesto/add/private/' + res.clienteId;
}
});

View File

@ -3,7 +3,7 @@
th:if="${appMode == 'add' or appMode == 'edit'}"
class="order-3 order-md-2 mx-md-auto d-flex">
<button id="btn-guardar" type="button"
class="btn btn-success d-flex align-items-center">
class="btn btn-success d-flex align-items-center guardar-presupuesto">
<i class="ri-save-3-line me-2"></i>
<span th:text="#{presupuesto.guardar}">Guardar</span>
</button>

View File

@ -132,7 +132,7 @@
<label for="paginas-negro" class="form-label" th:text="#{presupuesto.paginas-negro}">Páginas
Negro</label>
<input type="number" step="2" class="form-control paginas datos-generales-data"
id="paginas-negro" name="paginas-negro" value="0">
id="paginas-negro" name="paginas-negro" value="32">
<div class="form-text" th:text="#{presupuesto.siempre-pares}">
Siempre deben ser pares</div>
</div>
@ -145,7 +145,7 @@
<label for="paginas-color" class="form-label" th:text="#{presupuesto.paginas-color}">Páginas
Color</label>
<input type="number" step="2" class="form-control paginas datos-generales-data"
id="paginas-color" name="paginas-color" value="32">
id="paginas-color" name="paginas-color" value="0">
<div class="form-text" th:text="#{presupuesto.siempre-pares}">
Siempre deben ser pares</div>
</div>
@ -253,8 +253,6 @@
<div class="d-flex align-items-center justify-content-center gap-3 mt-3">
<div th:replace="~{imprimelibros/presupuestos/presupuestador-items/_buttons :: buttons(${appMode})}"></div>
<button type="button" id="next-datos-generales" class="btn btn-secondary d-flex align-items-center ms-auto order-2 order-md-3">
<span th:text="#{presupuesto.continuar-interior}">Continuar a diseño interior</span>
<i class="ri-arrow-right-circle-line fs-16 ms-2"></i>

View File

@ -28,9 +28,12 @@
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/"><i class="ri-home-5-fill"></i></a></li>
<li class="breadcrumb-item"><a href="/presupuesto" th:text="#{presupuesto.title}"></a></li>
<li class="breadcrumb-item active" aria-current="page" th:text="#{presupuesto.editar.title}">
Editar presupuesto
</li>
<li class="breadcrumb-item active" aria-current="page" th:if="${appMode == 'add'}" th:text="#{presupuesto.add}">
Nuevo presupuesto
</li>
<li class="breadcrumb-item active" aria-current="page" th:text="#{presupuesto.editar.title}" th:if="${appMode == 'edit'}">
Editar presupuesto
</li>
</ol>
</nav>
</div>
@ -59,7 +62,12 @@
<script type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestador/wizard-publicos.js}"></script>
</div>
<div th:if="${appMode} == 'add'">
<script type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestador/wizard-publicos-add.js}"></script>
<div th:if="${mode} == 'public'">
<script type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestador/wizard-publicos-add.js}"></script>
</div>
<div th:if="${mode} != 'public'">
<script type="module" th:src="@{/assets/js/pages/imprimelibros/presupuestador/wizard-privado.js}"></script>
</div>
</div>
</th:block>
</body>

View File

@ -1,5 +1,5 @@
<div th:fragment="tabla-cliente">
<table id="presupuesto-clientes-datatable" class="table table-striped table-nowrap responsive w-100">
<table id="presupuestos-clientes-datatable" class="table table-striped table-nowrap responsive w-100">
<thead>
<tr>
<th scope="col" th:text="#{presupuesto.tabla.id}">ID</th>
@ -16,7 +16,52 @@
<th scope="col" th:text="#{presupuesto.tabla.acciones}">Acciones</th>
</tr>
<tr>
<th><input type="text" class="form-control form-control-sm presupuesto-filter" data-col="id" /></th>
<th><input type="text" class="form-control form-control-sm presupuesto-filter" data-col="titulo" /></th>
<th><input type="text" class="form-control form-control-sm presupuesto-filter" data-col="user" />
</th>
<th>
<select class="form-select form-select-sm presupuesto-select-filter" data-col="tipoEncuadernacion">
<option value="" th:text="#{margenes-presupuesto.todos}">Todos</option>
<option value="fresado" th:text="#{presupuesto.fresado}">Fresado</option>
<option value="cosido" th:text="#{presupuesto.cosido}">Cosido</option>
<option value="espiral" th:text="#{presupuesto.espiral}">Espiral</option>
<option value="wireo" th:text="#{presupuesto.wireo}">Wireo</option>
<option value="grapado" th:text="#{presupuesto.grapado}">Grapado</option>
</select>
</th>
<th>
<select class="form-select form-select-sm presupuesto-select-filter" data-col="tipoCubierta">
<option value="" th:text="#{margenes-presupuesto.todos}">Todos</option>
<option value="tapaBlanda" th:text="#{presupuesto.tapa-blanda}">Tapa blanda</option>
<option value="tapaDura" th:text="#{presupuesto.tapa-dura}">Tapa dura</option>
<option value="tapaDuraLomoRedondo" th:text="#{presupuesto.tapa-dura-lomo-redondo}">Tapa dura
lomo redondo</option>
</select>
</th>
<th>
<select class="form-select form-select-sm presupuesto-select-filter" data-col="tipoImpresion">
<option value="" th:text="#{margenes-presupuesto.todos}">Todos</option>
<option value="negro" th:text="#{presupuesto.blanco-negro}">B/N</option>
<option value="negrohq" th:text="#{presupuesto.blanco-negro-premium}">B/N HQ</option>
<option value="color" th:text="#{presupuesto.color}">Color</option>
<option value="colorhq" th:text="#{presupuesto.color-premium}">Color HQ</option>
</select>
</th>
<th><input type="text" class="form-control form-control-sm presupuesto-filter" data-col="selectedTirada" /></th>
<th><input type="text" class="form-control form-control-sm presupuesto-filter" data-col="paginas" />
</th>
<th>
<select class="form-select form-select-sm presupuesto-select-filter" data-col="estado">
<option value="" th:text="#{margenes-presupuesto.todos}">Todos</option>
<option value="borrador" th:text="#{presupuesto.estado.borrador}">Borrador</option>
<option value="aceptado" th:text="#{presupuesto.estado.aceptado}">Aceptado</option>
<option value="modificado" th:text="#{presupuesto.estado.modificado}">Modificado</option>
</select>
</th>
<th></th> <!-- Total con IVA (sin filtro) -->
<th></th> <!-- Actualizado el (sin filtro) -->
<th></th> <!-- Acciones (sin filtro) -->
</tr>
</thead>
<tbody>