diff --git a/src/components/Utilities/index.js b/src/components/Utilities/index.js index 36eacf7cacc98515f54d400f8f4c3f0aedbe6e5d..0dc7d2fd6c2f39a4927d333f78910caf1d03a39c 100644 --- a/src/components/Utilities/index.js +++ b/src/components/Utilities/index.js @@ -232,16 +232,15 @@ class Utilities extends Component { deleteAccountLine = (accountLineToRemove) => { const accounts = this.state.accountLines; - const accountNumberToRemove = accountLineToRemove.state.form.account_number; const accountIdToRemove = accountLineToRemove.state.account_id; - request(`${accountURL}${this.props.buildingId}?account_number=${accountNumberToRemove}&account_id=${accountIdToRemove}`, { + request(`${accountURL}${accountIdToRemove}`, { method: 'DELETE', headers: getHeaders(), }).then((res) => { if (!res.err) { const newAccounts = accounts.filter(account => ( - account.props.form.account_number !== accountNumberToRemove + account.props.account_id !== accountIdToRemove )); this.setState({ accountLines: newAccounts }); diff --git a/src/components/UtilityAccount/index.js b/src/components/UtilityAccount/index.js index ce71dc24712342e91286290f5c863f86ade4de23..469a0a3440aeecfa743045d04b60d79fc3ae2c53 100644 --- a/src/components/UtilityAccount/index.js +++ b/src/components/UtilityAccount/index.js @@ -172,7 +172,9 @@ class UtilityAccount extends Component { } renderAddAccountBtn = () => { - let isDisabled = !(this.state.form.account_number); + let isDisabled = ( + !(this.state.form.account_number) && !this.state.form.utility.startsWith('other') + ); if (this.state.form.utility === 'national_grid_gas') { isDisabled = !( this.state.form.account_number && this.state.form.access_code @@ -229,15 +231,22 @@ class UtilityAccount extends Component { } - renderFetchBtn = () => ( - - ) + renderFetchBtn = () => { + if (this.state.form.utility.startsWith('other')) { + return ( + + ); + } + return ( + + ); + } renderDeleteAccountBtn = () => ( ); } + renderUtility = () => { + // Bills with no scrapers do not need account numbers inputted + if (this.state.form.utility.startsWith('other')) { + return ; + } + return ( + + ); + } + renderNatGrid = () => { if (this.state.form.utility !== 'national_grid_gas') { return
; @@ -568,16 +595,14 @@ class UtilityAccount extends Component { + + + +- + {this.renderUtility()}
{this.renderNatGrid()}