calcular y guardar presupuestos adaptados a los nuevos acabados. Migracion en la bbdd

This commit is contained in:
2024-12-14 13:23:16 +01:00
parent b4de7978cc
commit 271ec8c807
6 changed files with 87 additions and 102 deletions

View File

@ -216,9 +216,8 @@ class DisenioCubierta {
$(`#divGramajeCubierta .gramaje-cubierta input[data-value="${datosCubierta.gramaje}"]`).trigger('click');
}, 0);
// JJO this.cubiertaPlastificado.val(datosCubierta.plastificado).trigger('change');
//this.cubiertaBarniz.val(datosCubierta.barniz).trigger('change');
//this.cubiertaEstampado.val(datosCubierta.estampado).trigger('change');
this.acabadoCubierta.setOption(datosCubierta.acabado.id, datosCubierta.acabado.text);
if (datosCubierta.retractilado) {
setTimeout(() => {
this.cubiertaRetractilado.trigger('click');
@ -229,7 +228,7 @@ class DisenioCubierta {
this.sobrecubierta.trigger('click');
this.papelSobrecubierta.val(datosSobrecubierta.papel.code + "_" + datosSobrecubierta.gramaje).trigger('change');
this.solapasSobrecubierta.val(datosSobrecubierta.solapas_ancho);
// JJO this.plastificadoSobrecubierta.val(datosSobrecubierta.plastificado).trigger('change');
this.acabadoSobrecubierta.setOption(datosSobrecubierta.acabado.id, datosSobrecubierta.acabado.text);
}
}
@ -411,7 +410,7 @@ class DisenioCubierta {
if (papel != null && gramaje != null) {
this.rl_papel_cubierta.text(papel + " " + gramaje + " gr");
this.rl_acabado_cubierta.text(this.domItem.find("#plastificado").children("option:selected").text());
this.rl_acabado_cubierta.text("Acabado: " + this.acabadoCubierta.getText());
this.rl_papel_cubierta.removeClass('d-none');
this.rl_acabado_cubierta.removeClass('d-none');
@ -454,10 +453,7 @@ class DisenioCubierta {
const sobrecubierta = this.getSobrecubierta(true);
this.rl_papel_sobrecubierta.text(sobrecubierta.papel + " " + sobrecubierta.gramaje + " gr")
this.rl_tamanio_sobrecubierta.text("Solapas: " + sobrecubierta.solapas + " mm")
let acabado_text = sobrecubierta.plastificado;
if (acabado_text.includes("Sin plastificar"))
acabado_text = "Sin plastificar";
this.rl_acabado_sobrecubierta.text(acabado_text);
this.rl_acabado_sobrecubierta.text("Acabado: " + this.acabadoSobrecubierta.getText());
}
}
else {
@ -537,21 +533,14 @@ class DisenioCubierta {
getAcabados(forResumen = false) {
try {
let acabados = {};
let acabado;
if (forResumen) {
acabados = 'Plastificado ' + this.domItem.find("#plastificado").children("option:selected").text();
if (this.domItem.find("#barniz").children("option:selected").val() != 'NONE')
acabados += ", Barniz UVI " + this.domItem.find("#barniz").children("option:selected").text();
if (this.domItem.find("#estampado").children("option:selected").val() != 'NONE')
acabados += ", Estampado " + this.domItem.find("#estampado").children("option:selected").text();
return acabados;
acabado = 'Acabado: ' + this.acabadoCubierta.getText();
}
else {
acabados.plastificado = this.domItem.find("#plastificado ").children("option:selected").val();
acabados.barniz = this.domItem.find("#barniz").children("option:selected").val();
acabados.estampado = this.domItem.find("#estampado").children("option:selected").val();
acabado = this.acabadoCubierta.getVal();
}
return acabados;
return acabado;
} catch (e) {
return null;
}
@ -616,7 +605,7 @@ class DisenioCubierta {
sobrecubierta.papel = papel.split(' ')[0] + ' ' + papel.split(' ')[1];
sobrecubierta.gramaje = papel.split(' ')[2];
sobrecubierta.solapas = this.domItem.find("#solapasSobrecubierta").val();
sobrecubierta.plastificado = 'Plastificado ' + this.domItem.find("#plastificadoSobrecubierta").children("option:selected").text();
sobrecubierta.acabado = 'Acabado: ' + this.acabadoSobrecubierta.getText();
return sobrecubierta;
}
else {
@ -625,7 +614,7 @@ class DisenioCubierta {
sobrecubierta.papel = papel.split('_')[0];
sobrecubierta.gramaje = papel.split('_')[1];
sobrecubierta.solapas = this.domItem.find("#solapasSobrecubierta").val();
sobrecubierta.plastificado = this.domItem.find("#plastificadoSobrecubierta").children("option:selected").val();
sobrecubierta.acabado = this.acabadoSobrecubierta.getVal();
return sobrecubierta;
}
}

View File

@ -71,6 +71,7 @@ class PresupuestoCliente {
this.disenioInterior.init();
this.disenioCubierta.init();
this.direcciones.init();
if (window.location.href.includes("edit")) {
this.resumen.init(window.location.href.split("/").pop());
}
@ -588,17 +589,11 @@ class PresupuestoCliente {
if (datos_to_check.posPaginasColor == "" || datos_to_check.posPaginasColor == null) {
delete datos_to_check.posPaginasColor;
}
if (datos_to_check.cubierta.acabados.barniz == undefined) {
delete datos_to_check.cubierta.acabados.barniz;
if (datos_to_check.cubierta.acabado == 0) {
delete datos_to_check.cubierta.acabado;
}
if (datos_to_check.cubierta.acabados.plastificado == undefined) {
delete datos_to_check.cubierta.acabados.plastificado;
}
if (datos_to_check.cubierta.acabados.estampado == undefined) {
delete datos_to_check.cubierta.acabados.estampado;
}
if (datos_to_check.sobrecubierta.plastificado == undefined) {
delete datos_to_check.sobrecubierta.plastificado;
if (datos_to_check.sobrecubierta.acabado == 0) {
delete datos_to_check.sobrecubierta.acabado;
}
return datos_to_check;
@ -650,7 +645,7 @@ class PresupuestoCliente {
papelCubierta: this.disenioCubierta.getPapel(),
gramajeCubierta: this.disenioCubierta.getGramaje(),
cabezada: this.disenioCubierta.getCabezada(),
acabados: this.disenioCubierta.getAcabados(),
acabado: this.disenioCubierta.getAcabados(),
carasImpresion: this.disenioCubierta.carasCubierta.val(),
};