diff --git a/httpdocs/assets/js/safekat/components/tarjetaDireccionPresupuesto.js b/httpdocs/assets/js/safekat/components/tarjetaDireccionPresupuesto.js
index 4dc7af88..f7140387 100644
--- a/httpdocs/assets/js/safekat/components/tarjetaDireccionPresupuesto.js
+++ b/httpdocs/assets/js/safekat/components/tarjetaDireccionPresupuesto.js
@@ -4,7 +4,7 @@ class tarjetaDireccion {
this.container = container;
this.id = id;
- this.direccionId = direccion.direccionId;
+ this.direccionId = direccion.id;
this.card = this.#generateHTML(id, direccion);
this.deleteBtn = this.card.find('.direccion-eliminar');
this.editBtn = this.card.find('.direccion-editar');
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioCubierta.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioCubierta.js
index 5b80c2eb..f06dee7a 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioCubierta.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioCubierta.js
@@ -134,6 +134,10 @@ class DisenioCubierta {
this.gramaje = null;
this.cargando = true;
+
+ this.presupuestoConfirmado = false;
+ this.papelForResumen = "";
+ this.gramajeForResumen = "";
}
@@ -487,6 +491,9 @@ class DisenioCubierta {
getPapel(forResumen = false) {
try {
+ if (this.presupuestoConfirmado)
+ return this.papelForResumen;
+
let checkedPapel = $('.custom-selector-papel-cubierta input[type="radio"]:checked');
if (this.papelCubierta != null && checkedPapel != null && checkedPapel.length > 0) {
if (forResumen) {
@@ -523,9 +530,12 @@ class DisenioCubierta {
try {
- if (checkedGramaje.length == 0)
- return null;
- return checkedGramaje[0].id.split('_')[1];
+ if (this.presupuestoConfirmado)
+ return this.gramajeForResumen;
+
+ if (checkedGramaje.length == 0)
+ return null;
+ return checkedGramaje[0].id.split('_')[1];
} catch (e) {
return null;
}
@@ -535,7 +545,7 @@ class DisenioCubierta {
try {
let acabado;
if (forResumen) {
- acabado = 'Acabado: ' + this.acabadoCubierta.getText();
+ acabado = this.acabadoCubierta.getText();
}
else {
acabado = this.acabadoCubierta.getVal();
@@ -605,7 +615,7 @@ class DisenioCubierta {
sobrecubierta.papel = papel.split(' ')[0] + ' ' + papel.split(' ')[1];
sobrecubierta.gramaje = papel.split(' ')[2];
sobrecubierta.solapas = this.domItem.find("#solapasSobrecubierta").val();
- sobrecubierta.acabado = 'Acabado: ' + this.acabadoSobrecubierta.getText();
+ sobrecubierta.acabado = this.acabadoSobrecubierta.getText();
return sobrecubierta;
}
else {
@@ -873,20 +883,20 @@ class DisenioCubierta {
const element = $(event.target);
const papel = element[0].id.split('_')[1];
this.papelCubierta = papel;
-
+
$('#' + papel).prop('checked', true);
if (element[0].id == 'papelEspecialCubierta') {
- if(!this.cargando)
+ if (!this.cargando)
this.gramaje = null;
this.divGramajeCubierta.empty();
this.divPapelEspecial.removeClass("d-none");
$('#papelEspecialCubiertaSel').off("change");
this.papelEspecial.empty();
$('#papelEspecialCubiertaSel').on("change", this.#handlePapelCubiertaEspecial.bind(this));
-
+
}
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js
index 61c0a0cb..dc37f0ae 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/disenioInterior.js
@@ -79,9 +79,13 @@ class DisenioInterior {
this.cargando = true;
+ this.presupuestoConfirmado = false;
+ this.papelNegroForResumen = "";
+ this.gramajeNegroForResumen = "";
+ this.papelColorForResumen = "";
+ this.gramajeColorForResumen = "";
this.initValidation();
-
}
@@ -350,7 +354,7 @@ class DisenioInterior {
this.gramaje = datos.negro.gramaje;
}
}
- if(datos.paginasColorConsecutivas)
+ if (datos.paginasColorConsecutivas)
this.updatePapeles();
else
this.updatePapeles('negro');
@@ -666,6 +670,21 @@ class DisenioInterior {
getPapel(forResumen = false) {
try {
+ if (this.presupuestoConfirmado) {
+ if (this.papelColorForResumen.length > 0 && this.papelNegroForResumen.length > 0)
+ return {
+ negro: this.papelNegroForResumen,
+ color: this.papelColorForResumen
+ }
+
+ else if (this.papelColorForResumen.length > 0) {
+ return this.papelColorForResumen;
+ }
+ else {
+ return this.papelNegroForResumen;
+ }
+ }
+
let checkedPapel = $('.custom-selector-papel input[type="radio"]:checked');
if (this.papelInterior != null && checkedPapel != null && checkedPapel.length > 0) {
@@ -748,6 +767,22 @@ class DisenioInterior {
getGramaje() {
try {
+
+ if (this.presupuestoConfirmado) {
+ if (this.gramajeColorForResumen.length > 0 && this.gramajeNegroForResumen.length > 0)
+ return {
+ negro: this.gramajeNegroForResumen,
+ color: this.gramajeColorForResumen
+ }
+
+ else if (this.gramajeColorForResumen.length > 0) {
+ return this.gramajeColorForResumen;
+ }
+ else {
+ return this.gramajeNegroForResumen;
+ }
+ }
+
let checkedGramaje = $('.custom-selector-gramaje input[type="radio"]:checked');
if (this.interiorColor.filter('.d-none').length == 0) {
@@ -830,14 +865,14 @@ class DisenioInterior {
const element = $(event.target);
const papel = element[0].id.split('_')[1];
this.papelInterior = papel;
-
+
$('#' + papel).prop('checked', true);
let tipo = this.getTipoImpresion();
if (element[0].id == 'papelEspecialInterior') {
- if(!this.cargando)
+ if (!this.cargando)
this.gramaje = null;
this.divGramajeInterior.empty();
this.divPapelEspecialInterior.removeClass("d-none");
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js
index 5a9f2565..674176cf 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js
@@ -415,13 +415,17 @@ class PresupuestoCliente {
#confirmPresupuesto() {
let total_unidades = 0;
- this.direcciones.direcciones.forEach(element => {
- total_unidades += parseInt(element.tirada.val());
- });
+ if (!this.direcciones.recogidaTaller.is(':checked')) {
- if (total_unidades != parseInt(this.direcciones.getSelectedTirada())) {
- popErrorAlert("No se puede confirmar el presupuesto. La suma de las unidades enviadas no coincide con la tirada seleccionada.");
- return;
+ this.direcciones.direcciones.forEach(element => {
+ total_unidades += parseInt(element.getUnidades());
+ });
+
+
+ if (total_unidades != parseInt(this.direcciones.getSelectedTirada())) {
+ popErrorAlert("No se puede confirmar el presupuesto. La suma de las unidades enviadas no coincide con la tirada seleccionada.");
+ return;
+ }
}
this.#solicitudGuardarPresupuesto(true);
@@ -715,6 +719,8 @@ class PresupuestoCliente {
#cargarPresupuesto() {
+ const self = this;
+
$('#loader').modal('show');
let id = window.location.href.split("/").pop()
new Ajax('/presupuestocliente/cargar/' + id,
@@ -724,18 +730,18 @@ class PresupuestoCliente {
if (response.status === 1) {
- this.lc.val(parseFloat(response.data.lc).toFixed(2));
- this.lsc.val(parseFloat(response.data.lsc).toFixed(2));
+ self.lc.val(parseFloat(response.data.lc).toFixed(2));
+ self.lsc.val(parseFloat(response.data.lsc).toFixed(2));
- this.calcularPresupuesto = false;
+ self.calcularPresupuesto = false;
- this.datosGenerales.cargarDatos(response.data.datosGenerales);
- this.direcciones.handleChangeCliente();
+ self.datosGenerales.cargarDatos(response.data.datosGenerales);
+ self.direcciones.handleChangeCliente();
- this.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
+ self.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales);
- this.disenioInterior.cargarDatos(response.data.interior, response.data.datosGenerales.papelInteriorDiferente);
- this.disenioCubierta.cargarDatos(response.data.cubierta, response.data.guardas, response.data.sobrecubierta);
+ self.disenioInterior.cargarDatos(response.data.interior, response.data.datosGenerales.papelInteriorDiferente);
+ self.disenioCubierta.cargarDatos(response.data.cubierta, response.data.guardas, response.data.sobrecubierta);
setTimeout(() => {
@@ -744,14 +750,28 @@ class PresupuestoCliente {
if (response.data.state != 2) {
- this.calcularPresupuesto = true;
- this.checkForm({ target: { id: 'tirada' } });
+ self.calcularPresupuesto = true;
+ self.checkForm({ target: { id: 'tirada' } });
}
else {
+ self.disenioInterior.presupuestoConfirmado = true;
+ if (response.data.interior.negro) {
+ self.disenioInterior.papelNegroForResumen = response.data.interior.negro.papel.nombre;
+ self.disenioInterior.gramajeNegroForResumen = response.data.interior.negro.gramaje;
+ }
+ if (response.data.interior.color) {
+ self.disenioInterior.papelColorForResumen = response.data.interior.color.nombre;
+ self.disenioInterior.gramajeColorForResumen = response.data.interior.color.gramaje;
+ }
+
+ self.disenioCubierta.presupuestoConfirmado = true;
+ self.disenioCubierta.papelForResumen = response.data.cubierta.papel.nombre;
+ self.disenioCubierta.gramajeForResumen = response.data.cubierta.gramaje;
+
$('#menu_resumen_button').trigger('click');
setTimeout(() => {
- this.resumen.init_dropzone();
- this.resumen.generate_total(response.data.resumen.base, response.data.resumen.precio_unidad);
+ self.resumen.init_dropzone();
+ self.resumen.generate_total(response.data.resumen.base, response.data.resumen.precio_unidad);
}, 0);
}
}, 0);
diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/resumen.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/resumen.js
index a808cc5f..31d89107 100644
--- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/resumen.js
+++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/resumen.js
@@ -290,7 +290,7 @@ class Resumen {
this.papelSobrecubierta.text(sobrecubierta.papel);
this.gramajeSobrecubierta.text(sobrecubierta.gramaje);
this.solapasSobrecubierta.text(sobrecubierta.solapas);
- this.plastificadoSobrecubierta.text(sobrecubierta.plastificado);
+ this.plastificadoSobrecubierta.text(sobrecubierta.acabado);
}
else {
this.divSobrecubierta.addClass('d-none');