mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
solucionado el error que cambiaba la tirada de envio al actualizar presupuesto
This commit is contained in:
@ -44,14 +44,14 @@ class Direcciones {
|
|||||||
$("#clienteId").on('change', this.handleChangeCliente.bind(this));
|
$("#clienteId").on('change', this.handleChangeCliente.bind(this));
|
||||||
|
|
||||||
this.recogidaTaller.on('change', () => {
|
this.recogidaTaller.on('change', () => {
|
||||||
|
|
||||||
if (this.recogidaTaller.is(':checked')) {
|
if (this.recogidaTaller.is(':checked')) {
|
||||||
|
|
||||||
this.divDirecciones.empty();
|
this.divDirecciones.empty();
|
||||||
this.direcciones = [];
|
this.direcciones = [];
|
||||||
$('.div-direcciones').addClass('d-none');
|
$('.div-direcciones').addClass('d-none');
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$('.div-direcciones').removeClass('d-none');
|
$('.div-direcciones').removeClass('d-none');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -106,13 +106,7 @@ class Direcciones {
|
|||||||
let id = datos[i].id;
|
let id = datos[i].id;
|
||||||
let unidades = datos[i].unidades;
|
let unidades = datos[i].unidades;
|
||||||
let entregaPalets = datos[i].palets;
|
let entregaPalets = datos[i].palets;
|
||||||
let divId = "dirEnvio-1";
|
|
||||||
let direccionesActuales = this.divDirecciones.find('.direccion-cliente');
|
|
||||||
if (direccionesActuales.length > 0) {
|
|
||||||
// the the lass item
|
|
||||||
let last = direccionesActuales[direccionesActuales.length - 1];
|
|
||||||
divId = "dirEnvio-" + (parseInt(last.id.split('-')[1]) + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (id == null || id <= 0 || id == undefined)
|
if (id == null || id <= 0 || id == undefined)
|
||||||
return;
|
return;
|
||||||
@ -121,6 +115,13 @@ class Direcciones {
|
|||||||
|
|
||||||
let peticion = new Ajax('/misdirecciones/getDireccionPresupuesto/' + id, {}, {},
|
let peticion = new Ajax('/misdirecciones/getDireccionPresupuesto/' + id, {}, {},
|
||||||
(response) => {
|
(response) => {
|
||||||
|
let divId = "dirEnvio-1";
|
||||||
|
let direccionesActuales = this.divDirecciones.find('.direccion-cliente');
|
||||||
|
if (direccionesActuales.length > 0) {
|
||||||
|
// the the lass item
|
||||||
|
let last = direccionesActuales[direccionesActuales.length - 1];
|
||||||
|
divId = "dirEnvio-" + (parseInt(last.id.split('-')[1]) + 1);
|
||||||
|
}
|
||||||
let tarjeta = new tarjetaDireccion(this.divDirecciones, divId, response.data[0]);
|
let tarjeta = new tarjetaDireccion(this.divDirecciones, divId, response.data[0]);
|
||||||
tarjeta.setUnidades(unidades);
|
tarjeta.setUnidades(unidades);
|
||||||
tarjeta.setEntregaPalets(entregaPalets);
|
tarjeta.setEntregaPalets(entregaPalets);
|
||||||
@ -217,7 +218,7 @@ class Direcciones {
|
|||||||
let customOption = tarjeta.card.find('.check-tirada-envio');
|
let customOption = tarjeta.card.find('.check-tirada-envio');
|
||||||
|
|
||||||
customOption.on('click', function () {
|
customOption.on('click', function () {
|
||||||
self.#handleTiradaEnvio(customOption);
|
self.#handleTiradaEnvio(customOption, self);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +259,7 @@ class Direcciones {
|
|||||||
dialog.init();
|
dialog.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
#handleTiradaEnvio(customOption) {
|
#handleTiradaEnvio(customOption, self) {
|
||||||
|
|
||||||
const el = customOption[0];
|
const el = customOption[0];
|
||||||
|
|
||||||
@ -271,6 +272,7 @@ class Direcciones {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
el.closest('.custom-option').classList.add('checked')
|
el.closest('.custom-option').classList.add('checked')
|
||||||
|
self.tiradaSeleccionada = parseInt(el.getAttribute('tirada'));
|
||||||
} else {
|
} else {
|
||||||
el.closest('.custom-option').classList.remove('checked')
|
el.closest('.custom-option').classList.remove('checked')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -550,10 +550,11 @@ class PresupuestoCliente {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lc.val(parseFloat(response.info.lomo_cubierta).toFixed(2));
|
this.lc.val(parseFloat(response.info.lomo_cubierta).toFixed(2));
|
||||||
this.lsc.val(parseFloat(response.info.lomo_sobrecubierta).toFixed(2));
|
this.lsc.val(parseFloat(response.info.lomo_sobrecubierta).toFixed(2));
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$(`#containerTiradasEnvios .tirada-envio input[tirada="${response.tiradas[0]}"]`).trigger('click');
|
$(`#containerTiradasEnvios .tirada-envio input[tirada="${this.direcciones.tiradaSeleccionada}"]`).trigger('click');
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
$('#loader').modal('hide');
|
$('#loader').modal('hide');
|
||||||
|
|||||||
Reference in New Issue
Block a user