Merge branch 'main' into 'feat/soporte'

create migration to add check_presupuesto_cliente column to tarifas tables...

See merge request jjimenez/safekat!554
This commit is contained in:
2025-02-20 08:59:47 +00:00
45 changed files with 384 additions and 63 deletions

View File

@ -1,37 +1,37 @@
export const alertConfirmationDelete = (title,type="primary") => {
return Swal.fire({
title: '¿Está seguro?',
text: "Esta acción es irreversible.",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sí',
cancelButtonText: 'Cancelar',
customClass: {
confirmButton: 'btn btn-danger me-1',
cancelButton: 'btn btn-label-secondary'
},
buttonsStyling: false
})
}
export const alertSuccessMessage = (title,type="primary") => {
return Swal.fire({
showCancelButton: false,
showConfirmButton : false,
title: title,
text: title,
icon: "success",
timer : 2000
export const alertConfirmationDelete = (title, type = "primary") => {
return Swal.fire({
title: '¿Está seguro?',
text: "Esta acción es irreversible.",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Sí',
cancelButtonText: 'Cancelar',
customClass: {
confirmButton: 'btn btn-danger me-1',
cancelButton: 'btn btn-label-secondary'
},
buttonsStyling: false
})
}
export const alertWarningMessage = (title,message,type="primary") => {
return Swal.fire({
export const alertSuccessMessage = (title, type = "primary") => {
return Swal.fire({
showCancelButton: false,
showConfirmButton: false,
title: title,
text: title,
icon: "success",
timer: 2000
})
}
export const alertWarningMessage = (title, message, type = "primary") => {
return Swal.fire({
title: title,
text: message,
icon: "warning",
@ -40,4 +40,28 @@ export const alertWarningMessage = (title,message,type="primary") => {
},
buttonsStyling: false
})
}
export const toastPresupuestoSummary = (value, target = 'body') => {
return Swal.mixin({
toast: true,
position: 'bottom-end',
html: `
<div class="d-flex flex-column p-0 m-0">
<p class="m-0">Total presupuesto</p>
<span class="badge badge-label-primary fs-small">${value}</span>
</div>`,
customClass: {
popup: 'bg-primary text-white',
},
target: target,
height : "100px",
width : "200px",
padding : '1px',
allowEscapeKey: false,
showConfirmButton: false,
timer: 0,
timerProgressBar: false,
stopKeydownPropagation: false,
})
}

View File

@ -1,3 +1,5 @@
import { toastPresupuestoSummary } from "../../../components/alerts/sweetAlert.js";
class Resumen {
constructor() {
@ -7,7 +9,7 @@ class Resumen {
init() {
const self = this;
this.toastPresupuestoTotal = null
$(".update-totales").on("change", function () {
self.updateTotales(true, true, true)
});
@ -16,6 +18,7 @@ class Resumen {
await self.updateTotales();
$(document).trigger('update-totales-completed');
});
$("#totalDespuesDecuento").on('change',this.updateToastSummary.bind(this))
}
cargar(resumen) {
@ -44,7 +47,7 @@ class Resumen {
$("#totalAntesDescuento").text(resumen.total_antes_descuento + "€" || "0€");
$("#total_descuentoPercent").val(resumen.total_descuentoPercent || "0");
$("#descuentoTotal").text(resumen.total_descuento + "€" || "0€");
$("#totalDespuesDecuento").text(resumen.total_presupuesto + "€" || "0€");
$("#totalDespuesDecuento").text(resumen.total_presupuesto + "€" || "0€").trigger("change")
$("#precioUnidadPresupuesto").text(resumen.total_precio_unidad + "€" || "0€");
$("#factor").text(resumen.total_factor || "0");
$("#factor_ponderado").text(resumen.total_factor_ponderado || "0");
@ -52,7 +55,7 @@ class Resumen {
if (resumen.total_aceptado !== undefined) {
$("#totalAceptado").val(resumen.total_aceptado + "€" || "0€");
}
}
update() {
@ -352,6 +355,25 @@ class Resumen {
roundToTwoDecimals(num) {
return parseFloat(num.toFixed(2));
}
updateToastSummary()
{
if(this.toastPresupuestoTotal){
this.toastPresupuestoTotal.close()
}
this.toastPresupuestoTotal = toastPresupuestoSummary($("#totalDespuesDecuento").text() ?? 0)
this.toastPresupuestoTotal.fire().then((result) => {
if(result.isDismissed){
this.updateToastSummary()
$('html, body').animate(
{
scrollTop: $("#totalDespuesDecuento").offset().top
},
1000)
}
})
}
}
export default Resumen;