// this script sets the fields that are not yet set by the general script
let elAssetsHoldingBody = $('#assetsHoldings tbody')
let elAssetValuesBody = $('#assetValues tbody')
let assetNames = js_vars.assetNames
let assetsHolding = js_vars.assetsHolding
// set endowment table
$(document).ready(function () {
// for uninformed traders assetValues is undefined (for js) in stages before the result but should be visible in results
elAssetsHoldingBody.html(Object.entries(assetsHolding).map(e => `
| ${e[1]} | of ${assetNames[e[0] - 1]} |
`).join(''))
if (typeof js_vars.assetValues !== 'undefined' && js_vars.assetValues !== null) {
let assetValues = js_vars.assetValues
elAssetValuesBody.html(Object.entries(assetValues).map(e => `| ${assetNames[e[0] - 1]} is worth | ${cu(e[1])} |
`).join(''))
}
if (typeof js_vars.allowShort !== 'undefined' && js_vars.allowShort === true) {
let elCapShortBody = $('#capShort tbody')
let capShort = js_vars.capShort
elCapShortBody.html(Object.entries(capShort).map(e => `| ${e[1]} | of ${assetNames[e[0] - 1]} |
`).join(''))
}
if (typeof $('#initialEndowment') !== 'undefined') {
let elInitialEndowment = $('#initialEndowment')
let elEndEndowment = $('#endEndowment')
let elTradingProfits = $('#tradingProfits')
elInitialEndowment.html(cu(elInitialEndowment.html()))
elEndEndowment.html(cu(elEndEndowment.html()))
elTradingProfits.html(cu(elTradingProfits.html()))
}
$('#assetsValues tbody tr').filter(function() {
return isNaN($(this).children('td').eq(1).attr('value'));
}).html(` | `);
})