mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
añadiro recoger en taller en direcciones presupuesto cliente
This commit is contained in:
@ -14,6 +14,8 @@ class Direcciones {
|
||||
this.validatorStepper = validatorStepper;
|
||||
this.allowNext = true;
|
||||
|
||||
this.recogidaTaller = this.domItem.find('#recogerEnTaller');
|
||||
|
||||
this.unidadesAdd = this.domItem.find('#unidadesEnvio');
|
||||
this.btnAdd = this.domItem.find('#insertarDireccion');
|
||||
this.btnNew = this.domItem.find('#nuevaDireccion');
|
||||
@ -39,6 +41,20 @@ class Direcciones {
|
||||
|
||||
$("#clienteId").on('change', this.handleChangeCliente.bind(this));
|
||||
|
||||
this.recogidaTaller.on('change', () => {
|
||||
|
||||
if (this.recogidaTaller.is(':checked')) {
|
||||
|
||||
this.divDirecciones.empty();
|
||||
this.direcciones = [];
|
||||
$('.div-direcciones').addClass('d-none');
|
||||
}
|
||||
else{
|
||||
$('.div-direcciones').removeClass('d-none');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.direccionesCliente.init();
|
||||
this.btnAdd.on('click', this.#insertDireccion.bind(this));
|
||||
this.btnNew.on('click', this.#nuevaDireccion.bind(this));
|
||||
@ -70,44 +86,52 @@ class Direcciones {
|
||||
});
|
||||
}, 0);
|
||||
|
||||
setTimeout(function () {
|
||||
$(`#containerTiradasEnvios .tirada-envio input[tirada="${datosGenerales.tirada}"]`).trigger('click');
|
||||
}, 0);
|
||||
if (datos.entrega_taller == 1) {
|
||||
this.recogidaTaller.prop('checked', true);
|
||||
}
|
||||
else {
|
||||
|
||||
this.recogidaTaller.prop('checked', false);
|
||||
|
||||
setTimeout(function () {
|
||||
$(`#containerTiradasEnvios .tirada-envio input[tirada="${datosGenerales.tirada}"]`).trigger('click');
|
||||
}, 0);
|
||||
|
||||
|
||||
for (let i = 0; i < datos.length; i++) {
|
||||
for (let i = 0; i < datos.length; i++) {
|
||||
|
||||
let id = datos[i].id;
|
||||
let unidades = datos[i].unidades;
|
||||
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);
|
||||
let id = datos[i].id;
|
||||
let unidades = datos[i].unidades;
|
||||
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)
|
||||
return;
|
||||
if (unidades == null || unidades <= 0 || unidades == undefined)
|
||||
return;
|
||||
|
||||
let peticion = new Ajax('/misdirecciones/getDireccionPresupuesto/' + id, {}, {},
|
||||
(response) => {
|
||||
let tarjeta = new tarjetaDireccion(this.divDirecciones, divId, response.data[0]);
|
||||
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);
|
||||
},
|
||||
() => {
|
||||
console.error('Error getting address');
|
||||
});
|
||||
|
||||
peticion.get();
|
||||
}
|
||||
|
||||
if (id == null || id <= 0 || id == undefined)
|
||||
return;
|
||||
if (unidades == null || unidades <= 0 || unidades == undefined)
|
||||
return;
|
||||
|
||||
let peticion = new Ajax('/misdirecciones/getDireccionPresupuesto/' + id, {}, {},
|
||||
(response) => {
|
||||
let tarjeta = new tarjetaDireccion(this.divDirecciones, divId, response.data[0]);
|
||||
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);
|
||||
},
|
||||
() => {
|
||||
console.error('Error getting address');
|
||||
});
|
||||
|
||||
peticion.get();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
||||
@ -45,7 +45,7 @@ class PresupuestoCliente {
|
||||
this.datos = {};
|
||||
this.ajax_calcular = new Ajax('/presupuestocliente/calcular',
|
||||
this.datos,
|
||||
{},
|
||||
{},
|
||||
this.#procesarPresupuesto.bind(this),
|
||||
() => { $('#loader').modal('hide'); });
|
||||
|
||||
@ -157,7 +157,7 @@ class PresupuestoCliente {
|
||||
return !(noPOD && siPOD);
|
||||
}
|
||||
|
||||
calcularSolapas(){
|
||||
calcularSolapas() {
|
||||
|
||||
/* Solapas Max */
|
||||
this.#getDatos(false, true);
|
||||
@ -175,7 +175,7 @@ class PresupuestoCliente {
|
||||
this.disenioCubierta.textoSolapasCubierta.text("Entre 60 y " + response + " mm");
|
||||
this.disenioCubierta.textoSolapasSobrecubierta.text("Entre 60 y " + response + " mm");
|
||||
},
|
||||
() => { }
|
||||
() => { }
|
||||
).post();
|
||||
}
|
||||
}
|
||||
@ -188,7 +188,7 @@ class PresupuestoCliente {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (this.calcularPresupuesto) {
|
||||
|
||||
if (event.target.id === 'divDirecciones') {
|
||||
@ -686,13 +686,16 @@ class PresupuestoCliente {
|
||||
this.datos.cubierta.solapas = 0;
|
||||
}
|
||||
|
||||
if (this.direcciones.direcciones.length > 0) {
|
||||
this.datos.direcciones = [];
|
||||
for (let i = 0; i < this.direcciones.direcciones.length; i++) {
|
||||
this.datos.direcciones.push(this.direcciones.direcciones[i].getFormData());
|
||||
};
|
||||
}
|
||||
this.datos.entrega_taller = this.direcciones.recogidaTaller.is(':checked') ? 1 : 0;
|
||||
|
||||
if (!this.direcciones.recogidaTaller.is(':checked')) {
|
||||
if (this.direcciones.direcciones.length > 0) {
|
||||
this.datos.direcciones = [];
|
||||
for (let i = 0; i < this.direcciones.direcciones.length; i++) {
|
||||
this.datos.direcciones.push(this.direcciones.direcciones[i].getFormData());
|
||||
};
|
||||
}
|
||||
}
|
||||
if (save) {
|
||||
this.datos.datosCabecera = {
|
||||
titulo: this.datosGenerales.titulo.val(),
|
||||
|
||||
Reference in New Issue
Block a user