Update index.html
- calculate total invested and total net for a fund.
This commit is contained in:
parent
6c3d63d4b0
commit
bb8155940d
26
index.html
26
index.html
@ -10163,7 +10163,7 @@ Bitcoin.Util = {
|
|||||||
fundBlock.querySelector('.end-date').textContent = endDate
|
fundBlock.querySelector('.end-date').textContent = endDate
|
||||||
fundBlock.querySelector('.base-usd').textContent = `₹${baseUsd}`
|
fundBlock.querySelector('.base-usd').textContent = `₹${baseUsd}`
|
||||||
fundBlock.querySelector('.base-btc').textContent = `$${baseBtc}`
|
fundBlock.querySelector('.base-btc').textContent = `$${baseBtc}`
|
||||||
fundBlock.querySelector('.total-investment').textContent = `$${totalInvestment}`
|
fundBlock.querySelector('.total-investment').textContent = `₹${totalInvestment}`
|
||||||
|
|
||||||
const tapoutsFrag = document.createDocumentFragment()
|
const tapoutsFrag = document.createDocumentFragment()
|
||||||
for(tapout in tapouts){
|
for(tapout in tapouts){
|
||||||
@ -10760,7 +10760,6 @@ Bitcoin.Util = {
|
|||||||
endDate: dateFormat(dateAdder(startDate, term["maxPeriod"])),
|
endDate: dateFormat(dateAdder(startDate, term["maxPeriod"])),
|
||||||
baseUsd: f.USD_base,
|
baseUsd: f.USD_base,
|
||||||
baseBtc: f.BTC_base,
|
baseBtc: f.BTC_base,
|
||||||
totalInvestment: f.totalInvestment,
|
|
||||||
tapouts,
|
tapouts,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10775,11 +10774,8 @@ Bitcoin.Util = {
|
|||||||
smOption.setAttribute('value', funds[k][0].txid)
|
smOption.setAttribute('value', funds[k][0].txid)
|
||||||
fundsFrag.append(smOption)
|
fundsFrag.append(smOption)
|
||||||
|
|
||||||
const fundBlock = render.fundBlock(fundObj).firstElementChild
|
|
||||||
const fundList = fundBlock.querySelector('.investors-group-list')
|
|
||||||
|
|
||||||
const investorsFrag = document.createDocumentFragment()
|
const investorsFrag = document.createDocumentFragment()
|
||||||
|
let total_invested = total_net = 0;
|
||||||
for (let i in f.amounts) {
|
for (let i in f.amounts) {
|
||||||
const investorGroup = document.createElement('li')
|
const investorGroup = document.createElement('li')
|
||||||
investorGroup.classList.add('investor-group')
|
investorGroup.classList.add('investor-group')
|
||||||
@ -10788,8 +10784,7 @@ Bitcoin.Util = {
|
|||||||
<a class="fund-link justify-right" href="https://livenet.flocha.in/tx/${funds[k][i].txid}" target="_blank">See transaction</a>
|
<a class="fund-link justify-right" href="https://livenet.flocha.in/tx/${funds[k][i].txid}" target="_blank">See transaction</a>
|
||||||
</header>
|
</header>
|
||||||
<ul class="investor-group__list"></ul>
|
<ul class="investor-group__list"></ul>
|
||||||
`
|
`;
|
||||||
|
|
||||||
f.amounts[i].forEach(a => {
|
f.amounts[i].forEach(a => {
|
||||||
let investor = a[0],
|
let investor = a[0],
|
||||||
amount = a[1],
|
amount = a[1],
|
||||||
@ -10806,13 +10801,24 @@ Bitcoin.Util = {
|
|||||||
usd: (netVal / USD_current).toFixed(2),
|
usd: (netVal / USD_current).toFixed(2),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
total_invested += amount;
|
||||||
|
total_net += netVal;
|
||||||
const investorCard = document.createElement('fund-investor')
|
const investorCard = document.createElement('fund-investor')
|
||||||
investorCard.data = obj
|
investorCard.data = obj
|
||||||
investorGroup.querySelector('.investor-group__list').append(investorCard)
|
investorGroup.querySelector('.investor-group__list').append(investorCard)
|
||||||
});
|
});
|
||||||
investorsFrag.append(investorGroup)
|
investorsFrag.append(investorGroup)
|
||||||
// *** txid for these investors: funds[k][i].txid
|
|
||||||
}
|
}
|
||||||
|
fundObj.totalInvestment = {
|
||||||
|
inr: total_invested.toFixed(2),
|
||||||
|
usd: (total_invested / f.USD_base).toFixed(2)
|
||||||
|
}
|
||||||
|
fundObj.totalNet = {
|
||||||
|
inr: total_net.toFixed(2),
|
||||||
|
usd: (total_net / USD_current).toFixed(2)
|
||||||
|
}
|
||||||
|
const fundBlock = render.fundBlock(fundObj).firstElementChild
|
||||||
|
const fundList = fundBlock.querySelector('.investors-group-list')
|
||||||
fundList.append(investorsFrag)
|
fundList.append(investorsFrag)
|
||||||
removeElementIfExist(k);
|
removeElementIfExist(k);
|
||||||
fundBlock.id = k;
|
fundBlock.id = k;
|
||||||
@ -10847,7 +10853,6 @@ Bitcoin.Util = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let funds = {};
|
let funds = {};
|
||||||
funds["totalInvestment"] = 0;
|
|
||||||
data.forEach(fd => {
|
data.forEach(fd => {
|
||||||
let cont = /continue: [a-z0-9]{64}\|/.test(fd);
|
let cont = /continue: [a-z0-9]{64}\|/.test(fd);
|
||||||
fd.data.split("|").forEach(d => {
|
fd.data.split("|").forEach(d => {
|
||||||
@ -10868,7 +10873,6 @@ Bitcoin.Util = {
|
|||||||
d[1].split(";").forEach(a => {
|
d[1].split(";").forEach(a => {
|
||||||
a = a.split("-");
|
a = a.split("-");
|
||||||
tmp.push([a[0], parseNumber(a[1])]);
|
tmp.push([a[0], parseNumber(a[1])]);
|
||||||
funds["totalInvestment"] += parseNumber(a[1]);
|
|
||||||
});
|
});
|
||||||
funds["amounts"].push(tmp)
|
funds["amounts"].push(tmp)
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user