diff --git a/src/containers/Blocnote/PreliminaryFinance/index.js b/src/containers/Blocnote/PreliminaryFinance/index.js index dfd32a3686f4589e63b2e0193d5f50ca802d86c1..b08ee120d7b8dd70f7438c6b2f2a45d214b21b1a 100644 --- a/src/containers/Blocnote/PreliminaryFinance/index.js +++ b/src/containers/Blocnote/PreliminaryFinance/index.js @@ -38,110 +38,126 @@ class PreliminaryFinance extends Component { mainContent = ; if (scenario.data !== null) { - const tables = scenario.data.instance.instance.tables; - const budgets = Object.keys(tables).map(tableName => tables[tableName][0].slice(1)); + if (scenario.data.instance.feasible !== undefined && + scenario.data.instance.feasible === false) { + mainContent = ( +
+
+ {scenario.data.instance.name} is not feasible! +
+
+ ); + } else { + const tables = scenario.data.instance.instance.tables; + const budgets = Object.keys(tables).map(tableName => tables[tableName][0].slice(1)); + const projectEconomicsContent = [[]]; + Object.keys(scenario.data.instance.economics_overview).forEach((key) => { + const temp = []; + temp.push(key); + temp.push(scenario.data.instance.economics_overview[key]); + projectEconomicsContent.push(temp); + }); + const savings = { + gas: { + estimated_savings: 0, + used_before_retrofit: false, + used_after_retrofit: false, + utility_type: 'gas', + }, + electric: { + estimated_savings: 0, + used_before_retrofit: false, + used_after_retrofit: false, + utility_type: 'electric', + }, + oil: { + estimated_savings: 0, + used_before_retrofit: false, + used_after_retrofit: false, + utility_type: 'oil', + }, + water: { + estimated_savings: 0, + used_before_retrofit: false, + used_after_retrofit: false, + utility_type: 'water', + }, + }; - const projectEconomicsContent = [[]]; - Object.keys(scenario.data.instance.economics_overview).forEach((key) => { - const temp = []; - temp.push(key); - temp.push(scenario.data.instance.economics_overview[key]); - projectEconomicsContent.push(temp); - }); - const savings = { - gas: { - estimated_savings: 0, - used_before_retrofit: false, - used_after_retrofit: false, - utility_type: 'gas', - }, - electric: { - estimated_savings: 0, - used_before_retrofit: false, - used_after_retrofit: false, - utility_type: 'electric', - }, - oil: { - estimated_savings: 0, - used_before_retrofit: false, - used_after_retrofit: false, - utility_type: 'oil', - }, - water: { - estimated_savings: 0, - used_before_retrofit: false, - used_after_retrofit: false, - utility_type: 'water', - }, - }; + Object.keys(scenario.data.instance.savings).forEach(utilityType => { + if (Object.keys(savings).includes(utilityType)) { + savings[utilityType] = scenario.data.instance.savings[utilityType]; + } + }); - Object.keys(scenario.data.instance.savings).forEach(utilityType => { - if (Object.keys(savings).includes(utilityType)) { - savings[utilityType] = scenario.data.instance.savings[utilityType]; - } - }); - - mainContent = ( -
- - - - - - - - - - - -
- ); + mainContent = ( +
+ + + + + + + + + + + +
+ ); + } } return (