Default numPeople to 0, hide referral cards & columns until they set people in downline

This commit is contained in:
Marty Bostick
2026-07-29 22:13:26 +00:00
parent 77d24b2657
commit 85854fcbd8
+25 -12
View File
@@ -1205,7 +1205,7 @@
<div class="controls"> <div class="controls">
<div class="control-group"> <div class="control-group">
<label>Number of people</label> <label>Number of people</label>
<input type="number" id="numPeople" value="1" min="1" max="100"> <input type="number" id="numPeople" value="0" min="0" max="100">
</div> </div>
<div class="control-group"> <div class="control-group">
<label>Your referral commission</label> <label>Your referral commission</label>
@@ -1236,7 +1236,7 @@
</div> </div>
<div class="checkbox-row"> <div class="checkbox-row">
<div class="checkbox-group"> <div class="checkbox-group">
<input type="checkbox" id="showReferral" checked> <input type="checkbox" id="showReferral">
<label for="showReferral">Show referral earnings (my 10%)</label> <label for="showReferral">Show referral earnings (my 10%)</label>
</div> </div>
<div class="checkbox-group"> <div class="checkbox-group">
@@ -1295,8 +1295,8 @@
<table><thead><tr> <table><thead><tr>
<th>Phase</th><th class="num">Cycles</th><th>Timeline</th> <th>Phase</th><th class="num">Cycles</th><th>Timeline</th>
<th class="num">Their Payout/Cycle</th> <th class="num">Their Payout/Cycle</th>
<th class="num referral-col">Your 10% Cut/Cycle</th> <th class="num referral-col" id="headerYourCut">Your 10% Cut/Cycle</th>
<th class="num">Cumulative to You</th> <th class="num" id="headerCumulative">Cumulative to You</th>
</tr></thead><tbody id="overviewBody"></tbody></table> </tr></thead><tbody id="overviewBody"></tbody></table>
</div> </div>
</div> </div>
@@ -1311,8 +1311,8 @@
<table><thead><tr> <table><thead><tr>
<th>Month</th><th>Active Phase</th> <th>Month</th><th>Active Phase</th>
<th class="num">Their Profit This Month</th> <th class="num">Their Profit This Month</th>
<th class="num referral-col">Your 10% Commission/Month</th> <th class="num referral-col" id="headerTimelineComm">Your 10% Commission/Month</th>
<th class="num">Your Cumulative</th> <th class="num" id="headerTimelineCum">Your Cumulative</th>
</tr></thead><tbody id="timelineBody"></tbody></table> </tr></thead><tbody id="timelineBody"></tbody></table>
</div> </div>
</div> </div>
@@ -1628,7 +1628,7 @@ const SCENARIOS = buildSCENARIOS();
let chart1 = null, chart2 = null, chart3 = null; let chart1 = null, chart2 = null, chart3 = null;
function updateAll() { function updateAll() {
const numPeople = parseInt(document.getElementById('numPeople').value) || 1; const numPeople = parseInt(document.getElementById('numPeople').value) || 0;
const commPct = parseFloat(document.getElementById('commissionPct').value) || 10; const commPct = parseFloat(document.getElementById('commissionPct').value) || 10;
const giftLevel = parseInt(document.getElementById('giftLevel').value); const giftLevel = parseInt(document.getElementById('giftLevel').value);
const selfLevel = parseInt(document.getElementById('selfFundLevel').value); const selfLevel = parseInt(document.getElementById('selfFundLevel').value);
@@ -1694,24 +1694,35 @@ function updateAll() {
<div class="label">Time to 3× L7</div> <div class="label">Time to 3× L7</div>
<div class="value orange" style="font-size:1.3rem">~${totalMonths} months</div> <div class="value orange" style="font-size:1.3rem">~${totalMonths} months</div>
</div> </div>
${numPeople > 0 ? `
<div class="summary-card"> <div class="summary-card">
<div class="label">Year 1 Referral Earnings</div> <div class="label">Year 1 Referral Earnings</div>
<div class="value green">$${yr1Cum.toLocaleString()}</div> <div class="value green">$${yr1Cum.toLocaleString()}</div>
<div class="sub">${numPeople > 1 ? `$${yr1PerPerson.toLocaleString()} / person` : ''}</div> <div class="sub">${numPeople > 1 ? `$${yr1PerPerson.toLocaleString()} / person` : ''}</div>
</div> </div>` : ''}
<div class="summary-card"> <div class="summary-card">
<div class="label">ROI on Gift</div> <div class="label">ROI on Gift</div>
<div class="value green">${roiText}</div> <div class="value green">${roiText}</div>
<div class="sub">${roiSub || (giftCost > 0 ? '' : 'no gift cost')}</div> <div class="sub">${roiSub || (giftCost > 0 ? '' : 'no gift cost')}</div>
</div> </div>
${numPeople > 0 ? `
<div class="summary-card"> <div class="summary-card">
<div class="label">Monthly Passive (3× L7)</div> <div class="label">Monthly Passive (3× L7)</div>
<div class="value green">$${monthlyPassive.toLocaleString()}</div> <div class="value green">$${monthlyPassive.toLocaleString()}</div>
<div class="sub">${numPeople > 1 ? `$${Math.round(monthlyPassive / numPeople).toLocaleString()} / person` : 'per month'}</div> <div class="sub">${numPeople > 1 ? `$${Math.round(monthlyPassive / numPeople).toLocaleString()} / person` : 'per month'}</div>
</div> </div>` : ''}
`; `;
document.getElementById('summaryCards').innerHTML = summaryHtml; document.getElementById('summaryCards').innerHTML = summaryHtml;
// Toggle referral columns when no people in downline
for (const id of ['headerYourCut','headerCumulative','headerTimelineComm','headerTimelineCum']) {
const el = document.getElementById(id);
if (el) el.style.display = numPeople > 0 ? '' : 'none';
}
for (const el of document.querySelectorAll('.referral-col')) {
el.style.display = numPeople > 0 ? '' : 'none';
}
let cumRunning = 0; let cumRunning = 0;
let roiHit = false; let roiHit = false;
let rows = ''; let rows = '';
@@ -1763,7 +1774,8 @@ function updateAll() {
type: 'line', type: 'line',
data: { data: {
labels: chartLabels, labels: chartLabels,
datasets: [{ datasets: [
${numPeople > 0 ? `{
label: `${numPeople > 1 ? `Total (${numPeople} people)` : 'Your'} Cumulative Referral Earnings`, label: `${numPeople > 1 ? `Total (${numPeople} people)` : 'Your'} Cumulative Referral Earnings`,
data: numPeople > 1 ? chartValues.map(v => v * numPeople) : chartValues, data: numPeople > 1 ? chartValues.map(v => v * numPeople) : chartValues,
borderColor: '#6c5ce7', borderColor: '#6c5ce7',
@@ -1772,7 +1784,8 @@ function updateAll() {
tension: 0.3, tension: 0.3,
pointRadius: 3, pointRadius: 3,
pointHoverRadius: 5, pointHoverRadius: 5,
}] },` : ''}
{
}, },
options: { options: {
responsive: true, responsive: true,
@@ -2066,7 +2079,7 @@ function updateHeroSignupBtn() {
// ─── Shareable Plan Generator ─────────────────────────────── // ─── Shareable Plan Generator ───────────────────────────────
function generatePlan() { function generatePlan() {
const numPeople = parseInt(document.getElementById('numPeople').value) || 1; const numPeople = parseInt(document.getElementById('numPeople').value) || 0;
const giftLevel = parseInt(document.getElementById('giftLevel').value); const giftLevel = parseInt(document.getElementById('giftLevel').value);
const selfLevel = parseInt(document.getElementById('selfFundLevel').value); const selfLevel = parseInt(document.getElementById('selfFundLevel').value);
const refUser = getRefFromURL() || 'cryptoteambuild'; const refUser = getRefFromURL() || 'cryptoteambuild';