From 3c1ef699bf4ca41c9a9996d30cbb499763561122 Mon Sep 17 00:00:00 2001 From: amazuecos Date: Sun, 16 Feb 2025 19:38:30 +0000 Subject: [PATCH] fix toast --- .../js/safekat/components/alerts/sweetAlert.js | 6 ++---- .../pages/presupuestoAdmin/sections/resumen.js | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/httpdocs/assets/js/safekat/components/alerts/sweetAlert.js b/httpdocs/assets/js/safekat/components/alerts/sweetAlert.js index b8ee5400..f34692b0 100644 --- a/httpdocs/assets/js/safekat/components/alerts/sweetAlert.js +++ b/httpdocs/assets/js/safekat/components/alerts/sweetAlert.js @@ -48,14 +48,12 @@ export const toastPresupuestoSummary = (value, target = 'body') => { position: 'bottom-end', html: `
-
-

Total presupuesto :

${value} -
+

Total presupuesto

+ ${value}
`, customClass: { popup: 'bg-primary text-white', }, - background: '#a5dc86', target: target, allowEscapeKey: false, showConfirmButton: false, diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js index aa90ef7b..58a2d142 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/resumen.js @@ -297,7 +297,7 @@ class Resumen { $('#totalAntesDescuento').text((this.addSeparatorsNF(totalAntesDescuento.toFixed(2), ".", ",", ".")) + "€") $('#descuentoTotal').text((this.addSeparatorsNF(totalDescuento.toFixed(2), ".", ",", ".")) + "€") - $('#totalDespuesDecuento').text((this.addSeparatorsNF(totalPresupuesto.toFixed(2), ".", ",", ".")) + "€").trigger("change") + $('#totalDespuesDecuento').text((this.addSeparatorsNF(totalPresupuesto.toFixed(2), ".", ",", ".")) + "€") $('#precioUnidadPresupuesto').text((this.addSeparatorsNF(precioUnidad.toFixed(4), ".", ",", ".")) + "€") $('#totalAntesDescuento').attr('val', (totalAntesDescuento).toFixed(2)) $('#descuentoTotal').attr('val', (totalDescuento).toFixed(2)) @@ -310,7 +310,6 @@ class Resumen { $('#factor_ponderado').text(this.addSeparatorsNF(((totalPresupuesto - totalEnvios - margenEnvios) / sumForFactorPonderado).toFixed(2), ".", ",", ".")) $('#factor_ponderado').attr('val', ((totalPresupuesto - totalEnvios - margenEnvios) / sumForFactorPonderado).toFixed(2)) - this.updateToastSummary() } @@ -362,8 +361,18 @@ class Resumen { this.toastPresupuestoTotal.close() } - this.toastPresupuestoTotal = toastPresupuestoSummary($("#totalDespuesDecuento").text()) - this.toastPresupuestoTotal.fire(); + this.toastPresupuestoTotal = toastPresupuestoSummary($("#totalDespuesDecuento").text() ?? 0) + this.toastPresupuestoTotal.fire().then((result) => { + if(result.isDismissed){ + this.updateToastSummary() + $('html, body').animate( + { + scrollTop: $("#totalDespuesDecuento").offset().top + }, + 1000) + } + }) + } }