mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'feat/add-check-cliente-tarifa-extra' into 'main'
create migration to add check_presupuesto_cliente column to tarifas tables... See merge request jjimenez/safekat!552
This commit is contained in:
@ -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,25 @@ 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 class="fs-big">Total presupuesto</p>
|
||||
<span class="badge badge-label-primary fs-large">${value}</span>
|
||||
</div>`,
|
||||
customClass: {
|
||||
popup: 'bg-primary text-white',
|
||||
},
|
||||
target: target,
|
||||
allowEscapeKey: false,
|
||||
showConfirmButton: false,
|
||||
timer: 0,
|
||||
timerProgressBar: false,
|
||||
stopKeydownPropagation: false,
|
||||
})
|
||||
}
|
||||
@ -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;
|
||||
Reference in New Issue
Block a user