handleiding_nieuw:sub_spacematrix
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
handleiding_nieuw:sub_spacematrix [2025/04/15 14:48] – support | handleiding_nieuw:sub_spacematrix [2025/04/15 15:51] (current) – support | ||
---|---|---|---|
Line 1: | Line 1: | ||
< | < | ||
< | < | ||
+ | .inputrow { | ||
+ | display: flex; | ||
+ | align-items: | ||
+ | gap: 10px; | ||
+ | margin-bottom: | ||
+ | } | ||
+ | .inputrow label { | ||
+ | width: 200px; | ||
+ | } | ||
+ | .inputrow input { | ||
+ | width: 80px; | ||
+ | } | ||
+ | .resultblock { | ||
+ | margin-left: | ||
+ | font-size: 0.9em; | ||
+ | min-width: 200px; | ||
+ | text-align: right; | ||
+ | } | ||
table.rekenblok { | table.rekenblok { | ||
border-collapse: | border-collapse: | ||
- | margin-top: | + | margin-top: |
+ | font-size: 0.9em; | ||
} | } | ||
table.rekenblok td, table.rekenblok th { | table.rekenblok td, table.rekenblok th { | ||
- | padding: 6px 10px; | + | padding: |
border: 1px solid #ccc; | border: 1px solid #ccc; | ||
text-align: right; | text-align: right; | ||
Line 13: | Line 32: | ||
background-color: | background-color: | ||
} | } | ||
- | | + | |
- | width: | + | background-color: |
+ | border-top: 2px solid #666; | ||
+ | } | ||
+ | .kaartcontainer { | ||
+ | position: absolute; | ||
+ | top: 0; | ||
+ | right: 0; | ||
+ | width: | ||
+ | } | ||
+ | .kaartcontainer img { | ||
+ | width: 100%; | ||
+ | display: block; | ||
+ | } | ||
+ | .stipje { | ||
+ | position: absolute; | ||
+ | width: 14px; | ||
+ | height: 14px; | ||
+ | background: red; | ||
+ | border-radius: | ||
+ | transform: translate(-50%, | ||
+ | border: 2px solid white; | ||
} | } | ||
</ | </ | ||
- | < | + | < |
- | + | <div class="kaartcontainer"> | |
- | < | + | <img src="https://www.sumsonite.nl/ |
- | <label> | + | <div class="stipje" |
- | <label> | + | </div> |
- | <label> | + | |
- | | + | |
</ | </ | ||
- | <h3>Laadvermogen</h3> | + | <h2>Spacematrix Rekenblok</h2> |
- | <div id=" | + | |
- | <button onclick="bereken()"> | + | <div class="inputrow"> |
+ | <label for=" | ||
+ | <input id="opp" type=" | ||
+ | <div class=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input id=" | ||
+ | <div class=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input id=" | ||
+ | <div class=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input id=" | ||
+ | <div class=" | ||
+ | </div> | ||
+ | <div style=" | ||
<table class=" | <table class=" | ||
< | < | ||
<tr> | <tr> | ||
< | < | ||
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | <th>Totale | + | <th>Tot. BVO</ |
</tr> | </tr> | ||
</ | </ | ||
<tbody id=" | <tbody id=" | ||
+ | < | ||
+ | <tr class=" | ||
+ | < | ||
+ | <td id=" | ||
+ | <td id=" | ||
+ | <td id=" | ||
+ | <td id=" | ||
+ | </tr> | ||
+ | </ | ||
</ | </ | ||
+ | </ | ||
< | < | ||
Line 58: | Line 124: | ||
types.forEach((type, | types.forEach((type, | ||
const row = document.createElement(" | const row = document.createElement(" | ||
+ | if (i === 5) row.className = " | ||
row.innerHTML = ` | row.innerHTML = ` | ||
<td style=" | <td style=" | ||
- | < | + | < |
- | < | + | < |
<td id=" | <td id=" | ||
<td id=" | <td id=" | ||
Line 67: | Line 134: | ||
tbody.appendChild(row); | tbody.appendChild(row); | ||
}); | }); | ||
+ | |||
+ | function formatGetal(n) { | ||
+ | return n.toLocaleString(" | ||
+ | } | ||
+ | |||
+ | function updateStipje(fsi, | ||
+ | const stip = document.getElementById(" | ||
+ | const x = Math.min(100, | ||
+ | const y = Math.max(0, Math.min(100, | ||
+ | stip.style.left = `${x}%`; | ||
+ | stip.style.top = `${y}%`; | ||
+ | } | ||
function updateLaadvermogen() { | function updateLaadvermogen() { | ||
const opp = parseFloat(document.getElementById(" | const opp = parseFloat(document.getElementById(" | ||
const fsi = parseFloat(document.getElementById(" | const fsi = parseFloat(document.getElementById(" | ||
+ | const gsi = parseFloat(document.getElementById(" | ||
const voorzieningPerc = parseFloat(document.getElementById(" | const voorzieningPerc = parseFloat(document.getElementById(" | ||
- | const laadvermogen = opp * fsi; | + | const laadvermogen = Math.round(opp * fsi); |
- | const bvoVoorzieningen = laadvermogen * voorzieningPerc; | + | const bvoVoorzieningen = Math.round(laadvermogen * voorzieningPerc); |
const bvoWonen = laadvermogen - bvoVoorzieningen; | const bvoWonen = laadvermogen - bvoVoorzieningen; | ||
- | document.getElementById(" | + | document.getElementById(" |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | bereken(); |
- | | + | |
} | } | ||
Line 90: | Line 169: | ||
const fsi = parseFloat(document.getElementById(" | const fsi = parseFloat(document.getElementById(" | ||
const voorzieningPerc = parseFloat(document.getElementById(" | const voorzieningPerc = parseFloat(document.getElementById(" | ||
- | |||
const laadvermogen = opp * fsi; | const laadvermogen = opp * fsi; | ||
const woonBVO = laadvermogen * (1 - voorzieningPerc); | const woonBVO = laadvermogen * (1 - voorzieningPerc); | ||
Line 99: | Line 177: | ||
for (let i = 0; i < types.length; | for (let i = 0; i < types.length; | ||
- | const perc = parseFloat(document.getElementById(`perc_${i}`).value); | + | const perc = parseFloat(document.getElementById(`perc_${i}`).value) |
- | const bvo = parseFloat(document.getElementById(`bvo_${i}`).value); | + | const bvo = parseFloat(document.getElementById(`bvo_${i}`).value) |
gewogenBVO += (perc / 100) * bvo; | gewogenBVO += (perc / 100) * bvo; | ||
totalPerc += perc; | totalPerc += perc; | ||
- | details.push({ i, type: types[i], perc, bvo }); | + | details.push({ i, perc, bvo }); |
} | } | ||
- | if (totalPerc | + | if (totalPerc === 0 || gewogenBVO === 0) return; |
- | | + | |
- | | + | const totaalWoningenExact = woonBVO / gewogenBVO; |
+ | let sumWon = 0; | ||
+ | let sumBVO = 0; | ||
+ | let wonPerType = []; | ||
+ | |||
+ | let restant = Math.round(totaalWoningenExact); | ||
+ | for (let i = 0; i < details.length; i++) { | ||
+ | const { perc } = details[i]; | ||
+ | let aant = (perc / 100) * totaalWoningenExact; | ||
+ | let afgerond = Math.floor(aant); | ||
+ | | ||
+ | restant -= afgerond; | ||
} | } | ||
- | const totaalWoningen | + | const decimaalSort |
+ | i, rest: ((d.perc | ||
+ | })).sort((a, | ||
- | let outputHTML | + | |
- | | + | wonPerType[decimaalSort[j].i]++; |
+ | } | ||
- | details.forEach(({ | + | |
- | const aant = Math.round((perc / 100) * totaalWoningen); | + | const aant = wonPerType[i]; |
- | const bvoTot = aant * bvo; | + | const bvoTot = aant * details[i].bvo; |
- | document.getElementById(`aantal_${i}`).innerText = aant; | + | document.getElementById(`aantal_${i}`).innerText = formatGetal(aant); |
- | document.getElementById(`totbvo_${i}`).innerText = bvoTot; | + | document.getElementById(`totbvo_${i}`).innerText |
- | }); | + | sumWon += aant; |
+ | sumBVO += bvoTot; | ||
+ | } | ||
- | document.getElementById(" | + | |
+ | document.getElementById(" | ||
+ | document.getElementById(" | ||
+ | document.getElementById(" | ||
+ | |||
+ | | ||
+ | < | ||
+ | < | ||
+ | `; | ||
} | } | ||
- | // Initial laadvermogen-info | ||
updateLaadvermogen(); | updateLaadvermogen(); | ||
</ | </ | ||
</ | </ | ||
+ |
handleiding_nieuw/sub_spacematrix.1744728528.txt.gz · Last modified: 2025/04/15 14:48 by support