acabando el tema de las direcciones

This commit is contained in:
2024-10-14 00:50:15 +02:00
parent 0eaac5af28
commit 7ad3133a15
7 changed files with 192 additions and 104 deletions

View File

@ -27,11 +27,13 @@ class PresupuestoCliente {
this.disenioCubierta = new DisenioCubierta($("#cubierta-libro"), this.clientePresupuestoWizard, this.validationStepper);
this.direcciones = new Direcciones($("#direcciones-libro"), this.clientePresupuestoWizard, this.validationStepper);
this.divTiradasPrecios = $("#divTiradasPrecio");
this.datos = {};
this.ajax_calcular = new Ajax('/presupuestocliente/calcular',
{}, this.datos,
this.#procesarPresupuesto,
() => { $('#loader').hide(); console.log("Error") });
this.#procesarPresupuesto.bind(this),
() => { $('#loader').hide(); });
}
@ -54,12 +56,12 @@ class PresupuestoCliente {
this.disenioCubierta.init();
this.direcciones.init();
this.RELLENAR_PRESUPUESTO();
//this.RELLENAR_PRESUPUESTO();
}
checkForm() {
checkForm(event) {
this.#getDatos();
@ -154,8 +156,24 @@ class PresupuestoCliente {
#procesarPresupuesto(response) {
$('#loader').hide();
console.log("Success");
console.log(response);
// checj if response.tiradas exists and is not empty
if (response.tiradas && response.tiradas.length) {
this.divTiradasPrecios.empty();
for (let i = 0; i < response.tiradas.length; i++) {
new tarjetaTiradasPrecio(
this.divTiradasPrecios,
('precio-tiradas-' + response.tiradas[i]),
response.tiradas[i],
(parseFloat(response.precio_u[i])*parseInt(response.tiradas[i])).toFixed(2),
response.precio_u[i]
);
}
}
// DEBUG
//console.log(response);
}
@ -228,7 +246,7 @@ class PresupuestoCliente {
excluirRotativa: this.datosGenerales.excluirRotativa.is(':checked'),
ivaReducido: this.datosGenerales.ivaReducido.find('option:selected').val(),
servicios: {
'prototipo' : this.datosGenerales.servicios.prototipo.is(':checked'),
'prototipo' : this.datosGenerales.prototipo.is(':checked'),
},
};
@ -248,6 +266,10 @@ class PresupuestoCliente {
else{
this.datos.cubierta.solapas = false;
}
if(this.direcciones.direcciones.length > 0){
this.datos.direcciones = this.direcciones.direcciones;
}
}