finalizado nuevo presupuesto cliente a falta de confirmar

This commit is contained in:
2024-10-22 23:34:21 +02:00
parent 33496d81ee
commit 9919496397
11 changed files with 9498 additions and 128 deletions

View File

@ -111,7 +111,37 @@ class DatosGenerales {
message: window.translations["validation"].integer_greatherThan_0,
callback: function (input) {
const value = $("#tirada").val();
return value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0;
const value2 = $("#tirada2").val();
const value3 = $("#tirada3").val();
const value4 = $("#tirada4").val();
let tiradas = [value];
if(!(value.length > 0 && Number.isInteger(parseInt(value)) && parseInt(value) > 0)){
return {
valid: false,
message: window.translations["validation"].integer_greatherThan_0,
};
}
if(value2.length > 0 && Number.isInteger(parseInt(value2)) && parseInt(value2) > 0){
tiradas.push(value2);
}
if(value3.length > 0 && Number.isInteger(parseInt(value3)) && parseInt(value3) > 0){
tiradas.push(value3);
}
if(value4.length > 0 && Number.isInteger(parseInt(value4)) && parseInt(value4) > 0){
tiradas.push(value4);
}
// comprobar si hay valores > 30
const noPOD = (tiradas.some(tirada => parseInt(tirada) > 30));
const siPOD = (tiradas.some(tirada => parseInt(tirada) <= 30));
if(noPOD && siPOD){
return {
valid: false,
message: "No se pueden mezclar tiradas <30 con >30",
}
}
return true;
},
}
}