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

@ -79,12 +79,49 @@ class PresupuestoCliente {
}
$(".calcular-presupuesto").on('change', this.checkForm.bind(this));
}
#checkTiradas() {
let tiradas = [parseInt(this.datosGenerales.tirada1.val())];
if (this.datosGenerales.tirada2.val().length > 0 &&
Number.isInteger(parseInt(this.datosGenerales.tirada2.val())) &&
parseInt(this.datosGenerales.tirada2.val()) > 0 &&
this.datosGenerales.tirada2.val() != "") {
tiradas.push(parseInt(this.datosGenerales.tirada2.val()));
}
if (this.datosGenerales.tirada3.val().length > 0 &&
Number.isInteger(parseInt(this.datosGenerales.tirada3.val())) &&
parseInt(this.datosGenerales.tirada3.val()) > 0 &&
this.datosGenerales.tirada3.val() != "") {
tiradas.push(parseInt(this.datosGenerales.tirada3.val()));
}
if (this.datosGenerales.tirada4.val().length > 0 &&
Number.isInteger(parseInt(this.datosGenerales.tirada4.val())) &&
parseInt(this.datosGenerales.tirada4.val()) > 0 &&
this.datosGenerales.tirada4.val() != "") {
tiradas.push(parseInt(this.datosGenerales.tirada4.val()));
}
const noPOD = (tiradas.some(tirada => parseInt(tirada) > 30));
const siPOD = (tiradas.some(tirada => parseInt(tirada) <= 30));
this.datosGenerales.formValidation.validateField('tirada');
return !(noPOD && siPOD);
}
checkForm(event) {
if (!this.#checkTiradas()) {
return;
}
if (this.calcularPresupuesto) {
if (event.target.id === 'divDirecciones') {
@ -273,7 +310,7 @@ class PresupuestoCliente {
$('#loader').modal('hide');
if(response === null || response === undefined || response === ""){
if (response === null || response === undefined || response === "") {
popErrorAlert("No se ha podido calcular el presupuesto para los datos proporcionados. Por favor, póngase en contacto con el departamento comercial."
, "sk-alert-2", false);
return;
@ -285,9 +322,9 @@ class PresupuestoCliente {
return;
}
}
else {
popAlert2Hide();
}
popAlert2Hide();
if (response.tiradas && response.tiradas.length) {
@ -466,11 +503,6 @@ class PresupuestoCliente {
this.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
setTimeout(() => {
//this.checkForm({ target: { id: 'tirada' } });
/*this.validationStepper.next();
this.validationStepper.next();
this.validationStepper.next();
this.validationStepper.next();*/
$('#loader').modal('hide');
this.calcularPresupuesto = true;
this.checkForm({ target: { id: 'tirada' } });