From 74baeb5cfaa4c8ab7aa01e74fc5b637750fbe33a Mon Sep 17 00:00:00 2001 From: Jaime Jimenez Date: Wed, 15 Jan 2025 09:59:27 +0100 Subject: [PATCH] corregido error al mostrar en resumen con el iva --- .../js/safekat/pages/presupuestoCliente/direcciones.js | 3 +-- .../safekat/pages/presupuestoCliente/presupuestoCliente.js | 5 ++++- .../assets/js/safekat/pages/presupuestoCliente/resumen.js | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/direcciones.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/direcciones.js index 98f5ee24..1ee81bad 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/direcciones.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/direcciones.js @@ -89,8 +89,7 @@ class Direcciones { }, 0); - if($('#tiradaEnvios-' + datosGenerales.selectedTirada).length > 0) - $('#tiradaEnvios-' + datosGenerales.selectedTirada).trigger('click'); + $('#tiradaEnvios-' + datosGenerales.selectedTirada).trigger('click'); if (datos.entrega_taller == 1) { this.recogidaTaller.prop('checked', true); diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js index ab8cb8b5..a38e54ab 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js @@ -582,6 +582,9 @@ class PresupuestoCliente { if (this.actualizarTiradasEnvio) { this.direcciones.insertTirada(response.tiradas[i]); + if(i==0){ + $('#tiradaEnvios-' + response.tiradas[i]).trigger('click'); + } } } @@ -839,7 +842,7 @@ class PresupuestoCliente { $('#menu_resumen_button').trigger('click'); setTimeout(() => { self.resumen.init_dropzone(); - self.resumen.generate_total(response.data.resumen.base, response.data.resumen.precio_unidad); + self.resumen.generate_total(response.data.resumen.base, response.data.resumen.precio_unidad, response.data.datosGenerales.ivaReducido); }, 0); } }, 0); diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/resumen.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/resumen.js index 62fae0d8..343e4392 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/resumen.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/resumen.js @@ -322,7 +322,7 @@ class Resumen { } - generate_total(base, precio_u) { + generate_total(base, precio_u, iva_reducido) { let precio_u_text = String(precio_u); precio_u_text = precio_u_text.replace('€/u', ''); @@ -330,7 +330,7 @@ class Resumen { let base_text = this.#changeDecimalFormat(String(base)); - const iva_porcentaje = this.datosGenerales.ivaReducido.find('option:selected').val() == 1 ? 0.21 : 0.04; + const iva_porcentaje = !iva_reducido? 0.21 : 0.04; const iva = (parseFloat(base) * iva_porcentaje).toFixed(2); let iva_text = this.#changeDecimalFormat(iva); @@ -339,7 +339,7 @@ class Resumen { this.precio_unidad.text(precio_u_text); this.total_base.text(base_text); - this.iva_porcentaje.text(this.datosGenerales.ivaReducido.find('option:selected').val() == 1 ? '21' : '4'); + this.iva_porcentaje.text(!iva_reducido? '21' : '4'); this.iva.text(iva_text); this.total.text(total_text); }