Created
June 24, 2023 00:43
-
-
Save redraw/760037f18eb047d1ac611f9793a6f812 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.programPage.TOTALES = {} | |
document.programPage.__guardarTotales = function() { | |
const [ INICIAL, VIGENTE, EJECUTADO ] = $('.importe-cabecera-value').map((idx, item) => { | |
return parseFloat(item.innerText.replaceAll(".", "").replace(",", ".")) | |
}) | |
this.TOTALES = { | |
"Presupuesto Inicial": INICIAL, | |
"Presupuesto Vigente": VIGENTE, | |
"Ejecutado": EJECUTADO, | |
} | |
} | |
document.programPage.renderImporteGeneral = function (breadcrumb_div, label, importe) { | |
let importe_cabecera_key, importe_cabecera_value; | |
importe_cabecera_key = $('<div></div>').addClass("importe-cabecera-key").addClass('text-dark'); | |
importe_cabecera_key.html(label); | |
importe_cabecera_value = $('<div></div>').addClass("importe-cabecera-value").addClass('text-primary'); | |
const value = `${prettyNumber(importe)} (${(importe / this.TOTALES[label] * 100).toFixed(2)}%)`; | |
importe_cabecera_value.html(value); | |
breadcrumb_div.append(importe_cabecera_key); | |
breadcrumb_div.append(importe_cabecera_value); | |
} | |
document.programPage.generarGrafico = async function () { | |
try { | |
this.inhabilitarPaneles(); | |
this.clearTextInput(); | |
var year = $("#year-input").val(); | |
var urlWithParameters = this.url + year; | |
const arbol = await ajaxCall({url: urlWithParameters, method: 'GET'}); | |
this.datosArbol = arbol; | |
this.crearArbol(arbol); | |
this.__guardarTotales(); | |
} catch(error) { | |
console.info(error); | |
} | |
} | |
document.programPage.__guardarTotales() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment