fix toast

This commit is contained in:
amazuecos
2025-02-16 19:38:30 +00:00
parent 82665c778d
commit 3c1ef699bf
2 changed files with 15 additions and 8 deletions

View File

@ -48,14 +48,12 @@ export const toastPresupuestoSummary = (value, target = 'body') => {
position: 'bottom-end',
html: `
<div class="d-flex flex-column">
<div class="d-flex flex-row">
<p class="px-2 ">Total presupuesto :</p><span>${value}</span>
</div>
<p class="fs-big">Total presupuesto</p>
<span class="badge badge-label-primary fs-large">${value}</span>
</div>`,
customClass: {
popup: 'bg-primary text-white',
},
background: '#a5dc86',
target: target,
allowEscapeKey: false,
showConfirmButton: false,

View File

@ -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)
}
})
}
}