From ceabe810528fc10a65e0348143873d232e4361e0 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Wed, 1 Feb 2017 10:20:47 -0500 Subject: [PATCH 1/3] Add access code to utilities bill --- src/components/UtilityForm/index.js | 57 +++++++++++++++++++---------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/src/components/UtilityForm/index.js b/src/components/UtilityForm/index.js index ee6c64b0..3e162c0b 100644 --- a/src/components/UtilityForm/index.js +++ b/src/components/UtilityForm/index.js @@ -43,8 +43,42 @@ class UtilityForm extends Component { this.props.deleteAccount(this); } + renderNatGrid = () => { + if (this.state.form.utility !== 'national_grid_gas') { + return
; + } + + return ( +
+ + + +
+ ); + } + render() { - const natGrid = this.state.form.utility === 'national_grid_gas' ? '' : 'hidden'; return (
@@ -67,24 +101,7 @@ class UtilityForm extends Component { onChange={this.handleInputChange} disabled={this.state.disabled || false} /> -
- - -
+ {!this.state.disabled ||
} + + {this.renderNatGrid()}
-- GitLab From 7397837ece82204c3ed1be6066e1de0b07b8960b Mon Sep 17 00:00:00 2001 From: Jose Contreras Date: Wed, 1 Feb 2017 12:44:29 -0500 Subject: [PATCH 2/3] Add loading property to utility form. --- src/components/Utilities/index.js | 3 ++- src/components/UtilityForm/index.js | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/Utilities/index.js b/src/components/Utilities/index.js index a114657d..23e9fa02 100644 --- a/src/components/Utilities/index.js +++ b/src/components/Utilities/index.js @@ -119,7 +119,7 @@ class Utilities extends Component { }); } - addAccountLine = (form, downloadURL, disabled = false) => { + addAccountLine = (form, downloadURL, disabled = false, loading = false) => { const curr = this.state.accountLines; curr.push(); this.setState({ accountLines: curr }); diff --git a/src/components/UtilityForm/index.js b/src/components/UtilityForm/index.js index 3e162c0b..c1c73b50 100644 --- a/src/components/UtilityForm/index.js +++ b/src/components/UtilityForm/index.js @@ -7,6 +7,7 @@ class UtilityForm extends Component { this.state = { disabled: this.props.disabled, + loading: this.props.loading, form: { utility: this.props.form.utility, account_number: this.props.form.account_number, @@ -18,8 +19,10 @@ class UtilityForm extends Component { }; } + getUtilityBill = (event) => { event.preventDefault(); + this.setState({ loading: true }); this.props.getUtilityBill(this.state.form); } @@ -112,6 +115,7 @@ class UtilityForm extends Component {