From 161fe8660adf800373d8bef0269d4719516c1315 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Tue, 27 Feb 2018 09:38:51 -0500 Subject: [PATCH 1/7] Move view billl data under account credentials --- src/components/UtilityLine/UtilityLine.js | 45 +++++++++++++---------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/src/components/UtilityLine/UtilityLine.js b/src/components/UtilityLine/UtilityLine.js index 01b3fa9b..e0c0fa8f 100644 --- a/src/components/UtilityLine/UtilityLine.js +++ b/src/components/UtilityLine/UtilityLine.js @@ -496,17 +496,6 @@ class UtilityLine extends Component { } renderBillViewButtons = () => { - let billDataToggle = ( - ); - } let disaggregateDataToggle = ( + + {/* eslint-disable no-use-before-define */} + {this.props.disaggregateData.length > 0 && + } + {/* eslint-enable */} + {this.renderDownloadBtn()} {this.props.renderUploadButton('Disaggregated Bill')} @@ -434,6 +445,10 @@ const styles = { alignRight: { textAlign: 'right', }, + faIconSelected: { + color: 'blue', + cursor: 'pointer', + }, }; UtilityDisaggregation.propTypes = { @@ -456,6 +471,8 @@ UtilityDisaggregation.propTypes = { handleDisaggregateUtilityBill: PropTypes.func, loadingDisaggregate: PropTypes.bool, accountId: PropTypes.number, + toggleDisaggregateDataDisplay: PropTypes.func, + displayDisaggregateData: PropTypes.bool, }; export default UtilityDisaggregation; diff --git a/src/components/UtilityLine/UtilityLine.js b/src/components/UtilityLine/UtilityLine.js index e0c0fa8f..eca2dfe0 100644 --- a/src/components/UtilityLine/UtilityLine.js +++ b/src/components/UtilityLine/UtilityLine.js @@ -496,17 +496,9 @@ class UtilityLine extends Component { } renderBillViewButtons = () => { - let disaggregateDataToggle = ( - ); chartToggle = ( - ); - } - - return ( -
-
-
- {chartToggle} -
-
- ); - } - - renderDisaggregateChart = () => { let unit = 'kWh'; if (this.state.form.utility.endsWith('gas')) { @@ -770,9 +745,9 @@ class UtilityLine extends Component { {/* eslint-disable no-use-before-define */} {this.state.billData.length > 0 && } {/* eslint-enable */} @@ -800,6 +775,7 @@ class UtilityLine extends Component { accountId={this.state.account_id} disableDisaggregateBtn={this.disableDisaggregateBtn} disaggregateData={this.state.disaggregateData} + displayDisaggregateChart={this.state.displayDisaggregateChart} displayDisaggregateData={this.state.displayDisaggregateData} handleBillGAEvent={this.handleBillGAEvent} handleDisaggregateUtilityBill={this.handleDisaggregateUtilityBill} @@ -807,15 +783,13 @@ class UtilityLine extends Component { renderUploadButton={this.renderUploadButton} rSquared={this.state.rSquared} street_address={this.props.street_address} + toggleDisaggregateChartDisplay={this.toggleDisaggregateChartDisplay} toggleDisaggregateDataDisplay={this.toggleDisaggregateDataDisplay} utility_type={this.props.form.utility} />
{this.state.accountCreated ? 'View Data' : ''}
-
- {this.state.accountCreated && this.renderBillViewButtons()} -
-- GitLab From b3f0fe14d31b33d7e070cad94d646469ef1c618e Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Tue, 27 Feb 2018 10:14:57 -0500 Subject: [PATCH 5/7] Sort proptypes in util disaggregation component --- .../UtilityLine/UtilityDisaggregation.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/UtilityLine/UtilityDisaggregation.js b/src/components/UtilityLine/UtilityDisaggregation.js index 1e5c7421..3b324fbc 100644 --- a/src/components/UtilityLine/UtilityDisaggregation.js +++ b/src/components/UtilityLine/UtilityDisaggregation.js @@ -463,7 +463,9 @@ const styles = { }; UtilityDisaggregation.propTypes = { - street_address: PropTypes.string, + accountCreated: PropTypes.bool, + accountId: PropTypes.number, + disableDisaggregateBtn: PropTypes.func, disaggregateData: PropTypes.arrayOf( PropTypes.shape({ bill_from_date: PropTypes.string, @@ -473,19 +475,17 @@ UtilityDisaggregation.propTypes = { other: PropTypes.number, }) ), - utility_type: PropTypes.string, + displayDisaggregateChart: PropTypes.bool, + displayDisaggregateData: PropTypes.bool, handleBillGAEvent: PropTypes.func, - rSquared: PropTypes.number, - renderUploadButton: PropTypes.func, - accountCreated: PropTypes.bool, - disableDisaggregateBtn: PropTypes.func, handleDisaggregateUtilityBill: PropTypes.func, loadingDisaggregate: PropTypes.bool, - accountId: PropTypes.number, - toggleDisaggregateDataDisplay: PropTypes.func, - displayDisaggregateData: PropTypes.bool, - displayDisaggregateChart: PropTypes.bool, + renderUploadButton: PropTypes.func, + rSquared: PropTypes.number, + street_address: PropTypes.string, toggleDisaggregateChartDisplay: PropTypes.func, + toggleDisaggregateDataDisplay: PropTypes.func, + utility_type: PropTypes.string, }; export default UtilityDisaggregation; -- GitLab From dd3e7c900f61d28ca1efd51b5ca287aa012a94fd Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Tue, 27 Feb 2018 10:19:15 -0500 Subject: [PATCH 6/7] Add spacing and simplify if statement --- src/components/UtilityLine/UtilityLine.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/UtilityLine/UtilityLine.js b/src/components/UtilityLine/UtilityLine.js index fe50fad6..fa8dbfae 100644 --- a/src/components/UtilityLine/UtilityLine.js +++ b/src/components/UtilityLine/UtilityLine.js @@ -789,30 +789,36 @@ class UtilityLine extends Component { />
-
{this.state.accountCreated ? 'View Data' : ''}
+
{this.state.accountCreated && 'Account Summary'}
+ {renderBillData( this.state.billData, this.state.displayBillData, this.state.form.utility, this.state.account_id )} + {renderDisaggregateData( this.state.disaggregateData, this.state.displayDisaggregateData, this.state.account_id )} +
-
{this.state.displayDisaggregateChart ? 'Disaggregation Chart' : ''}
+
{this.state.displayDisaggregateChart && 'Disaggregation Chart'}
+ {this.renderChartDownloadButton()}
{this.renderDisaggregateChart()}
+
+
); -- GitLab From 84e16652a98e79c1654d6c7d7cd89708ea489485 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Tue, 27 Feb 2018 10:23:20 -0500 Subject: [PATCH 7/7] Add UtiliyAccountSummary boilerplate --- src/components/UtilityAccountSummary.js | 13 +++++++++++++ src/components/UtilityLine/UtilityLine.js | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 src/components/UtilityAccountSummary.js diff --git a/src/components/UtilityAccountSummary.js b/src/components/UtilityAccountSummary.js new file mode 100644 index 00000000..35345068 --- /dev/null +++ b/src/components/UtilityAccountSummary.js @@ -0,0 +1,13 @@ +import React, { Component } from 'react'; + +class UtilityAccountSummary extends Component { + state = { } + + render() { + return ( +
Coming Soon
+ ); + } +} + +export default UtilityAccountSummary; diff --git a/src/components/UtilityLine/UtilityLine.js b/src/components/UtilityLine/UtilityLine.js index fa8dbfae..d7d79448 100644 --- a/src/components/UtilityLine/UtilityLine.js +++ b/src/components/UtilityLine/UtilityLine.js @@ -10,6 +10,7 @@ import { uploadSVG } from '../bpl'; import './styles.css'; import { generateBillDownload, renderBillData, renderDisaggregateData } from './dataInteraction'; import userPropType from '../../containers/User/propTypes'; +import UtilityAccountSummary from '../UtilityAccountSummary'; class UtilityLine extends Component { @@ -790,6 +791,7 @@ class UtilityLine extends Component {
{this.state.accountCreated && 'Account Summary'}
+
-- GitLab