mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en añadir tiradas alternativas
This commit is contained in:
@ -104,7 +104,7 @@ class Direcciones {
|
||||
for (let i = 0; i < datos.length; i++) {
|
||||
|
||||
let id = datos[i].id;
|
||||
let unidades = datos[i].unidades;
|
||||
let unidades = datos[i].cantidad;
|
||||
let entregaPalets = datos[i].palets;
|
||||
|
||||
|
||||
@ -113,7 +113,22 @@ class Direcciones {
|
||||
if (unidades == null || unidades <= 0 || unidades == undefined)
|
||||
return;
|
||||
|
||||
let peticion = new Ajax('/misdirecciones/getDireccionPresupuesto/' + id, {}, {},
|
||||
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, datos[i]);
|
||||
tarjeta.setUnidades(unidades);
|
||||
tarjeta.setEntregaPalets(entregaPalets);
|
||||
tarjeta.card.find('.direccion-editar').on('click', this.#editUnits.bind(self));
|
||||
tarjeta.card.find('.direccion-eliminar').on('click', this.#deleteDireccion.bind(self));
|
||||
this.divDirecciones.append(tarjeta.card);
|
||||
this.direcciones.push(tarjeta);
|
||||
|
||||
/*let peticion = new Ajax('/misdirecciones/getDireccionPresupuesto/' + id, {}, {},
|
||||
(response) => {
|
||||
let divId = "dirEnvio-1";
|
||||
let direccionesActuales = this.divDirecciones.find('.direccion-cliente');
|
||||
@ -134,7 +149,7 @@ class Direcciones {
|
||||
console.error('Error getting address');
|
||||
});
|
||||
|
||||
peticion.get();
|
||||
peticion.get();*/
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -226,7 +241,7 @@ class Direcciones {
|
||||
let direcciones = [];
|
||||
this.direcciones.forEach(direccion => {
|
||||
let dir = {
|
||||
id: direccion.getId(),
|
||||
direccion: direccion.getDireccion(),
|
||||
unidades: direccion.getUnidades(),
|
||||
entregaPalets: direccion.getEntregaPalets()
|
||||
};
|
||||
@ -306,12 +321,23 @@ class Direcciones {
|
||||
total_unidades += parseInt(this.direcciones[i].getUnidades());
|
||||
}
|
||||
|
||||
|
||||
if (this.getSelectedTirada() == null) {
|
||||
popErrorAlert("Tiene que seleccionar una tirada para insertar una dirección");
|
||||
return;
|
||||
}
|
||||
|
||||
if (total_unidades + parseInt(unidades) > this.getSelectedTirada()) {
|
||||
popErrorAlert("El total de unidades enviadas tiene que ser menor que " + this.getSelectedTirada());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.getSelectedTirada() == null) {
|
||||
popErrorAlert("Tiene que seleccionar una tirada para insertar una dirección");
|
||||
return;
|
||||
}
|
||||
|
||||
if (unidades > this.getSelectedTirada()) {
|
||||
popErrorAlert("El total de unidades enviadas tiene que ser menor que " + this.getSelectedTirada());
|
||||
return;
|
||||
|
||||
@ -569,6 +569,9 @@ class PresupuestoCliente {
|
||||
popAlert2Hide();
|
||||
|
||||
for (let i = 0; i < response.tiradas.length; i++) {
|
||||
if(i==0){
|
||||
$('#eb').val(response.eb[i]);
|
||||
}
|
||||
new tarjetaTiradasPrecio(
|
||||
this.divTiradasPrecios,
|
||||
('precio-tiradas-' + response.tiradas[i]),
|
||||
@ -677,6 +680,10 @@ class PresupuestoCliente {
|
||||
},
|
||||
}
|
||||
|
||||
if(this.direcciones.getSelectedTirada() != null && this.direcciones.getSelectedTirada() != undefined && this.direcciones.getSelectedTirada() > 0){
|
||||
this.datos.selectedTirada = this.direcciones.getSelectedTirada();
|
||||
}
|
||||
|
||||
this.datos.guardas = this.disenioCubierta.getGuardas();
|
||||
|
||||
if (calcularSolapas) {
|
||||
@ -692,6 +699,7 @@ class PresupuestoCliente {
|
||||
this.datos.retractilado = this.datosGenerales.retractilado.is(':checked') ? 1 : 0;
|
||||
this.datos.retractilado5 = this.datosGenerales.retractilado5.is(':checked') ? 1 : 0;
|
||||
|
||||
this.datos.eb = $('#eb').val();
|
||||
|
||||
this.datos.cubierta = {
|
||||
tipoCubierta: this.disenioCubierta.disenioCubierta.filter('.selected').attr('id'),
|
||||
@ -758,6 +766,7 @@ class PresupuestoCliente {
|
||||
referenciaCliente: this.datosGenerales.referenciaCliente.val(),
|
||||
}
|
||||
this.datos.selectedTirada = this.direcciones.getSelectedTirada();
|
||||
this.datos
|
||||
}
|
||||
|
||||
if (window.location.href.includes("edit")) {
|
||||
|
||||
Reference in New Issue
Block a user