terminado

This commit is contained in:
2025-02-20 19:01:16 +01:00
parent cf74749889
commit 91796e993c
4 changed files with 28 additions and 13 deletions

View File

@ -404,7 +404,9 @@ class PresupuestoAdminEdit {
}
// Funciones para detectar cambios en el formulario
this.#checkChangesPresupuesto();
setTimeout(() => {
this.#checkChangesPresupuesto();
}, 500);
$('#bc-save').on("click", function () {
showBreadCrumbSaveButton(false);
$('#saveForm').trigger('click');
@ -530,45 +532,57 @@ class PresupuestoAdminEdit {
#checkChangesPresupuesto() {
const self = this;
// Detectar cambios en inputs de texto
$('input[type="text"]').on('change', function () {
showBreadCrumbSaveButton(true);
if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
});
// Detectar cambios en inputs de texto
$('input[type="number"]').on('change', function () {
showBreadCrumbSaveButton(true);
if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
});
// Detectar cambios en select
$('select').on('change', function () {
showBreadCrumbSaveButton(true);
if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
});
$('.select2bs').on('change', function (e) {
showBreadCrumbSaveButton(true);
if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
});
// Detectar cambios en checkboxes
$('input[type="checkbox"]').change(function () {
showBreadCrumbSaveButton(true);
if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
});
// Detectar cambios en textareas
$('textarea').on('input', function () {
showBreadCrumbSaveButton(true);
if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
});
// Detectar cambios en otros tipos de input
$('input[type="radio"]').change(function () {
showBreadCrumbSaveButton(true);
if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
});
// Detectar cambios en otros tipos de input
$('input:not([type])').on('input', function () {
showBreadCrumbSaveButton(true);
if (!self.cargandoPresupuesto)
showBreadCrumbSaveButton(true);
});
}
downloadPreviewImage() {
$(document).on("click", ".download-shape", (event) => {
let parentDiv = $(event.currentTarget).parent().parent();

View File

@ -104,6 +104,7 @@ class Resumen {
let sumForFactorPonderado = 0.0;
let costeMaquinaHoras = 0.0;
let margenPorHoras = 0.0;
if (updateLP) {
@ -122,7 +123,7 @@ class Resumen {
}
if (rowData.check_impresion_total) {
totalImpresion += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
costeMaquinaHoras += parseFloat($('#' + rowData.row_id + '_precioImpresion').val())
margenPorHoras += parseFloat($('#' + rowData.row_id + '_margenImpresion').val())
totalImpresion += parseFloat($('#' + rowData.row_id + '_totalClicks').val())
margenImpresion += parseFloat($('#' + rowData.row_id + '_margenClicks').val())
@ -148,7 +149,7 @@ class Resumen {
totalImpresion -= parseFloat(margenImpresion);
totalPapel -= parseFloat(margenPapel);
margenImpresion += parseFloat(margenPorHoras);
margenImpresion += parseFloat(margenPorHoras) + parseFloat(costeMaquinaHoras);
let porcentajeMargenPapel = isNaN(margenPapel / (totalPapel) * 100.0) ? 0 : margenPapel / (totalPapel) * 100.0
$('#porcentajeMargenPapel').text(porcentajeMargenPapel.toFixed(0) + '%')