refactor: split ui into modules (resources, domains, infra, costs, modals)

This commit is contained in:
ecki
2026-03-22 15:42:45 +01:00
parent 67106ac1a1
commit 0559cc4cd1
9 changed files with 393 additions and 611 deletions
+38
View File
@@ -0,0 +1,38 @@
window.loadCosts = async function(){
const resources = window.resources || []
const domains = await api(API + "/domains")
let month = 0
let year = 0
let domainYear = 0
resources.forEach(r => {
if(r.kosten_monat){
month += parseFloat(r.kosten_monat)
}
if(r.kosten_jahr){
year += parseFloat(r.kosten_jahr)
}
})
domains.forEach(d => {
if(d.yearly_cost){
domainYear += parseFloat(d.yearly_cost)
}
})
document.getElementById("costMonth").innerText = month.toFixed(2)
document.getElementById("costYear").innerText = year.toFixed(2)
document.getElementById("costDomain").innerText = domainYear.toFixed(2)
const total = year + domainYear
document.getElementById("costTotal").innerText = total.toFixed(2)
}