corregidos errores en logica

This commit is contained in:
2024-10-08 14:07:29 +02:00
parent 4045771c2d
commit dfd915e47f
4 changed files with 34 additions and 15 deletions

View File

@ -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(`
<div class="fv-plugins-message-container invalid-feedback">
<div data-field="div_tipo_libro" data-validator="callback" style="margin-top: 50px;">
@ -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');
}

View File

@ -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');
}
}
}

View File

@ -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");