diff --git a/ci4/app/Language/es/Presupuestos.php b/ci4/app/Language/es/Presupuestos.php index 5e79ec10..d9217b5f 100755 --- a/ci4/app/Language/es/Presupuestos.php +++ b/ci4/app/Language/es/Presupuestos.php @@ -360,6 +360,7 @@ return [ 'tipo_cubierta' => 'Seleccione tipo de cubierta', 'opcion_solapas' => 'Seleccione la opción para las solapas', 'paginas_cosido' => 'El número de páginas para cosido debe ser múltiplo de 4', + 'paginas_pares' => 'El número de páginas debe ser par', ], 'errores' => [ diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js index fd6083f6..d6196f52 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/datosGenerales.js @@ -191,19 +191,39 @@ class DatosGenerales { callback: function (input) { // Get the selected options const value = $("#paginasColor").val(); - return value.length >= 0 && Number.isInteger(parseInt(value)) && parseInt(value) >= 0; + if (value.length >= 0 && Number.isInteger(parseInt(value)) && parseInt(value) >= 0) { + + if (parseInt(value) % 2 != 0) { + return { + valid: false, + message: window.translations["validation"].paginas_pares + }; + } + return true; + } + return false; }, } } }, paginasNegro: { - validators: { - callback: { + validators: { + callback: { message: window.translations["validation"].integer_greatherThan_0, callback: function (input) { // Get the selected options const value = $("#paginasNegro").val(); - return value.length >= 0 && Number.isInteger(parseInt(value)) && parseInt(value) >= 0; + if (value.length >= 0 && Number.isInteger(parseInt(value)) && parseInt(value) >= 0) { + + if (parseInt(value) % 2 != 0) { + return { + valid: false, + message: window.translations["validation"].paginas_pares + }; + } + return true; + } + return false; }, } } @@ -228,9 +248,9 @@ class DatosGenerales { divTipoLibro.find('.fv-plugins-message-container').remove(); if ($('.tipo-libro.selected').length > 0) { - if($('#cosido').hasClass('selected')){ + if ($('#cosido').hasClass('selected')) { const value = parseInt($("#paginas").val()); - if(value % 4 != 0){ + if (value % 4 != 0) { divTipoLibro.append(`
@@ -329,10 +349,10 @@ class DatosGenerales { element.closest('.tipo-libro').toggleClass('selected'); element.closest('.image-presupuesto').toggleClass('selected'); - if(this.fresado.hasClass('selected') || this.cosido.hasClass('selected')){ + if (this.fresado.hasClass('selected') || this.cosido.hasClass('selected')) { $('#tapaDuraLomoRedondo').removeClass('d-none'); } - else{ + else { $('#tapaDuraLomoRedondo').addClass('d-none'); $('#tapaDuraLomoRedondo').removeClass('selected'); } @@ -388,8 +408,8 @@ class DatosGenerales { this.pagColorConsecutivas.prop('checked', false); } else { - if(this.papelDiferente.is(":checked")) - this.#handleInteriorLayout('mixto'); + if (this.papelDiferente.is(":checked")) + this.#handleInteriorLayout('mixto'); else this.#handleInteriorLayout('color'); this.divPaginasColorConsecutivas.removeClass('d-none'); @@ -410,7 +430,7 @@ class DatosGenerales { #handlePapelDiferente() { - if (this.papelDiferente.is(':checked')){ + if (this.papelDiferente.is(':checked')) { $(".interior-color").removeClass('d-none'); this.#handleInteriorLayout('mixto'); } diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js index 60d23789..5ccb9069 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js @@ -353,11 +353,9 @@ class DisenioInterior { if ($('#fresado').hasClass('selected')) { if (this.estucadoMate.hasClass('selected') || this.estucadoMate_color.hasClass('selected')) { $('#tapaDuraLomoRedondo').addClass('d-none'); - $('#tapaDura').removeClass('d-none'); } else { $('#tapaDuraLomoRedondo').removeClass('d-none'); - $('#tapaDura').addClass('d-none'); } } } diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js index 2161510e..07c8c969 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js @@ -40,7 +40,7 @@ class PresupuestoCliente { this.disenioInterior.init(); this.disenioCubierta.init(); - //this.RELLENAR_PRESUPUESTO(); + this.RELLENAR_PRESUPUESTO(); } @@ -51,7 +51,7 @@ class PresupuestoCliente { $("#titulo").trigger('change'); const clienteId = $("#clienteId"); - const newOption = new Option("Cliente 1", "1", true, true); + const newOption = new Option("Cliente Potencial", "1", true, true); clienteId.append(newOption).trigger('change'); const papelFormatoId = $("#papelFormatoId");