From 537e0cdb1f133b9748ba8d707c263aea46853714 Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Thu, 8 Aug 2019 17:31:12 -0400 Subject: [PATCH 01/35] ASHP testing --- .../AshpBuildingInfo/AshpBuildingInfo.js | 16 ++++++++++++ .../AshpFinanceInfo/AshpFinanceInfo.js | 16 ++++++++++++ .../AshpHeatingInfo/AshpHeatingInfo.js | 16 ++++++++++++ src/components/SideBarDetail/index.js | 4 +-- src/containers/AshpQuestionaire/index.js | 25 +++++++++++++++++++ src/routes.js | 6 +++-- 6 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 src/components/AshpBuildingInfo/AshpBuildingInfo.js create mode 100644 src/components/AshpFinanceInfo/AshpFinanceInfo.js create mode 100644 src/components/AshpHeatingInfo/AshpHeatingInfo.js create mode 100644 src/containers/AshpQuestionaire/index.js diff --git a/src/components/AshpBuildingInfo/AshpBuildingInfo.js b/src/components/AshpBuildingInfo/AshpBuildingInfo.js new file mode 100644 index 00000000..6e134c6a --- /dev/null +++ b/src/components/AshpBuildingInfo/AshpBuildingInfo.js @@ -0,0 +1,16 @@ +import React, { Component } from 'react'; + +class AshpBuildingInfo extends Component { + state = { + } + + render() { + return ( +
+ BUIDLING COMPONENT +
+ ); + } +} + +export default AshpBuildingInfo; \ No newline at end of file diff --git a/src/components/AshpFinanceInfo/AshpFinanceInfo.js b/src/components/AshpFinanceInfo/AshpFinanceInfo.js new file mode 100644 index 00000000..ded51293 --- /dev/null +++ b/src/components/AshpFinanceInfo/AshpFinanceInfo.js @@ -0,0 +1,16 @@ +import React, { Component } from 'react'; + +class AshpFinanaceInfo extends Component { + state = { + } + + render() { + return ( +
+ FINANCE COMPONENT +
+ ); + } +} + +export default AshpFinanaceInfo; \ No newline at end of file diff --git a/src/components/AshpHeatingInfo/AshpHeatingInfo.js b/src/components/AshpHeatingInfo/AshpHeatingInfo.js new file mode 100644 index 00000000..177387c8 --- /dev/null +++ b/src/components/AshpHeatingInfo/AshpHeatingInfo.js @@ -0,0 +1,16 @@ +import React, { Component } from 'react'; + +class AshpHeatingInfo extends Component { + state = { + } + + render() { + return ( +
+ HEATING COMPONENT +
+ ); + } +} + +export default AshpHeatingInfo; \ No newline at end of file diff --git a/src/components/SideBarDetail/index.js b/src/components/SideBarDetail/index.js index ee470758..f2eef4d5 100644 --- a/src/components/SideBarDetail/index.js +++ b/src/components/SideBarDetail/index.js @@ -188,9 +188,9 @@ export default function SideBarDetail({ building, children, contacts, user }) { className={isActive(`${rootURL}/dimensions/`)} style={{ display: user.permissions['view::dimensions'] ? 'block' : 'none' }} > - + {dimensionSVG} - Dimensions + ASHP Questionaires
  • diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js new file mode 100644 index 00000000..1d418960 --- /dev/null +++ b/src/containers/AshpQuestionaire/index.js @@ -0,0 +1,25 @@ +import React, { Component } from 'react'; +import AshpBuildingInfo from '../../components/AshpBuildingInfo'; +import AshpFinanceInfo from '../../components/AshpFinanceInfo'; +import AshpHeatingInfo from '../../components/AshpHeatingInfo'; + + +class AshpQuestionaire extends Component { + render() { + return ( +
    +
    + +
    +
    + +
    +
    + +
    +
    + ); + } +} + +export default AshpQuestionaire; diff --git a/src/routes.js b/src/routes.js index 63ea9d48..2249fe1f 100644 --- a/src/routes.js +++ b/src/routes.js @@ -15,7 +15,7 @@ import AuditPage from './screens/AuditPage'; import DetailPage from './screens/DetailPage'; import ProjectDetailPage from './screens/ProjectDetailPage'; import BuildingOverview from './components/BuildingOverview'; -import Dimensions from './containers/Dimensions'; +// import Dimensions from './containers/Dimensions'; import ReportsHome from './screens/ReportsHome'; import Utilities from './components/Utilities'; import Envelope from './containers/Envelope'; @@ -32,6 +32,7 @@ import Wrapper from './containers/Wrapper'; import { BGroupOverview, BGroup } from './containers/BGroup'; import NavOnly from './screens/NavOnly/NavOnly'; import Admin from './containers/Admin/Admin'; +import AshpQuestionaire from './containers/AshpQuestionaire'; const auth = new Auth(); @@ -52,7 +53,8 @@ export default ( - + {/* */} + -- GitLab From 0ccc0d22f5e17bfb059136fbc2463ea59f8b150e Mon Sep 17 00:00:00 2001 From: bontiveros Date: Fri, 9 Aug 2019 15:11:44 -0400 Subject: [PATCH 02/35] Rename component files to index.js. --- .../AshpBuildingInfo/{AshpBuildingInfo.js => index.js} | 0 src/components/AshpFinanceInfo/{AshpFinanceInfo.js => index.js} | 0 src/components/AshpHeatingInfo/{AshpHeatingInfo.js => index.js} | 0 src/components/LinkBarDetail/index.js | 2 +- 4 files changed, 1 insertion(+), 1 deletion(-) rename src/components/AshpBuildingInfo/{AshpBuildingInfo.js => index.js} (100%) rename src/components/AshpFinanceInfo/{AshpFinanceInfo.js => index.js} (100%) rename src/components/AshpHeatingInfo/{AshpHeatingInfo.js => index.js} (100%) diff --git a/src/components/AshpBuildingInfo/AshpBuildingInfo.js b/src/components/AshpBuildingInfo/index.js similarity index 100% rename from src/components/AshpBuildingInfo/AshpBuildingInfo.js rename to src/components/AshpBuildingInfo/index.js diff --git a/src/components/AshpFinanceInfo/AshpFinanceInfo.js b/src/components/AshpFinanceInfo/index.js similarity index 100% rename from src/components/AshpFinanceInfo/AshpFinanceInfo.js rename to src/components/AshpFinanceInfo/index.js diff --git a/src/components/AshpHeatingInfo/AshpHeatingInfo.js b/src/components/AshpHeatingInfo/index.js similarity index 100% rename from src/components/AshpHeatingInfo/AshpHeatingInfo.js rename to src/components/AshpHeatingInfo/index.js diff --git a/src/components/LinkBarDetail/index.js b/src/components/LinkBarDetail/index.js index 6a8224d5..85055303 100644 --- a/src/components/LinkBarDetail/index.js +++ b/src/components/LinkBarDetail/index.js @@ -36,7 +36,7 @@ const generateLinks = (rootURL, links) => { key={val.name} href={val.url} className={`pill persist ${val.tags}`} - target="_blank" + // target="_blank" > {val.name} -- GitLab From b8b95f17df7aea403c4dcc0a03e8a4c4e62fdadf Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Fri, 9 Aug 2019 15:29:27 -0400 Subject: [PATCH 03/35] fix stateless component issue, indentation issue --- src/components/AshpBuildingInfo/index.js | 19 +++++++++---------- src/components/AshpFinanceInfo/index.js | 15 +++++++-------- src/components/AshpHeatingInfo/index.js | 15 +++++++-------- src/containers/AshpQuestionaire/index.js | 7 +++++++ 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/components/AshpBuildingInfo/index.js b/src/components/AshpBuildingInfo/index.js index 6e134c6a..6326a782 100644 --- a/src/components/AshpBuildingInfo/index.js +++ b/src/components/AshpBuildingInfo/index.js @@ -1,16 +1,15 @@ import React, { Component } from 'react'; class AshpBuildingInfo extends Component { - state = { - } + state = {} - render() { - return ( -
    - BUIDLING COMPONENT -
    - ); - } + render() { + return ( +
    + BUIDLING COMPONENT +
    + ); + } } -export default AshpBuildingInfo; \ No newline at end of file +export default AshpBuildingInfo; diff --git a/src/components/AshpFinanceInfo/index.js b/src/components/AshpFinanceInfo/index.js index ded51293..110973e8 100644 --- a/src/components/AshpFinanceInfo/index.js +++ b/src/components/AshpFinanceInfo/index.js @@ -1,16 +1,15 @@ import React, { Component } from 'react'; class AshpFinanaceInfo extends Component { - state = { - } + state = {} render() { - return ( -
    - FINANCE COMPONENT -
    - ); + return ( +
    + FINANCE COMPONENT +
    + ); } } -export default AshpFinanaceInfo; \ No newline at end of file +export default AshpFinanaceInfo; diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/AshpHeatingInfo/index.js index 177387c8..022292cb 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/AshpHeatingInfo/index.js @@ -1,16 +1,15 @@ import React, { Component } from 'react'; class AshpHeatingInfo extends Component { - state = { - } + state = {} render() { - return ( -
    - HEATING COMPONENT -
    - ); + return ( +
    + HEATING COMPONENT +
    + ); } } -export default AshpHeatingInfo; \ No newline at end of file +export default AshpHeatingInfo; diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js index 1d418960..c3a4ab5d 100644 --- a/src/containers/AshpQuestionaire/index.js +++ b/src/containers/AshpQuestionaire/index.js @@ -5,6 +5,13 @@ import AshpHeatingInfo from '../../components/AshpHeatingInfo'; class AshpQuestionaire extends Component { + constructor(props) { + super(props); + this.state = { + test: '', + }; + } + render() { return (
    -- GitLab From 6d0fac36bf166583a2cf11064f201cac105636ec Mon Sep 17 00:00:00 2001 From: bontiveros Date: Sat, 10 Aug 2019 13:38:59 -0400 Subject: [PATCH 04/35] ASHP Form progress --- src/components/AshpBuildingInfo/index.js | 32 ++++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/components/AshpBuildingInfo/index.js b/src/components/AshpBuildingInfo/index.js index 6326a782..10dbade7 100644 --- a/src/components/AshpBuildingInfo/index.js +++ b/src/components/AshpBuildingInfo/index.js @@ -1,15 +1,31 @@ import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { Link } from 'react-router'; +import './styles.css'; class AshpBuildingInfo extends Component { - state = {} - - render() { - return ( -
    - BUIDLING COMPONENT -
    - ); + constructor(props){ + super(props); + + + this.state = { + + + } } + + + console.log() + +render() { + return ( +
    + BUIDLING COMPONENT +
    + ); +} + + } export default AshpBuildingInfo; -- GitLab From 45e46c132f8a786eec4758e77702c9fe807b92cc Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Sat, 10 Aug 2019 16:24:36 -0400 Subject: [PATCH 05/35] Add front-end components --- .../AshpBuildingInfo/ApartmentTypeDropdown.js | 37 ++ .../AshpBuildingInfo/ApartmentTypeInput.js | 45 +++ src/components/AshpBuildingInfo/index.js | 153 +++++++-- src/components/AshpHeatingInfo/index.js | 315 +++++++++++++++++- src/containers/AshpQuestionaire/index.js | 46 ++- 5 files changed, 560 insertions(+), 36 deletions(-) create mode 100644 src/components/AshpBuildingInfo/ApartmentTypeDropdown.js create mode 100644 src/components/AshpBuildingInfo/ApartmentTypeInput.js diff --git a/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js b/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js new file mode 100644 index 00000000..c277f6d8 --- /dev/null +++ b/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js @@ -0,0 +1,37 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { + Input, +} from 'reactstrap'; + + +const ApartmentTypeDropdown = (props) => { + return ( +
    +
    + this.handleInputChange(e)} + value={props.numOfApartment} + > + + + + + + + + +
    +
    + ); +}; + +ApartmentTypeDropdown.propTypes = { + name: PropTypes.string, + typeOfApartment: PropTypes.string, + numOfApartment: PropTypes.number, +}; + +export default ApartmentTypeDropdown; diff --git a/src/components/AshpBuildingInfo/ApartmentTypeInput.js b/src/components/AshpBuildingInfo/ApartmentTypeInput.js new file mode 100644 index 00000000..f5bb307f --- /dev/null +++ b/src/components/AshpBuildingInfo/ApartmentTypeInput.js @@ -0,0 +1,45 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { + Input, +} from 'reactstrap'; + + +const ApartmentTypeInput = (props) => { + return ( +
    +
    + this.handleInputChange(e)} + placeholder={props.placeholder} + /> +
    +
    + this.handleInputChange(e)} + value={props.numOfApartment} + > + + + + + + + + +
    +
    + ); +}; + +ApartmentTypeInput.propTypes = { + name: PropTypes.string, + typeOfApartment: PropTypes.string, + numOfApartment: PropTypes.number, + placeholder: PropTypes.string, +}; + +export default ApartmentTypeInput; diff --git a/src/components/AshpBuildingInfo/index.js b/src/components/AshpBuildingInfo/index.js index 10dbade7..97797b44 100644 --- a/src/components/AshpBuildingInfo/index.js +++ b/src/components/AshpBuildingInfo/index.js @@ -1,31 +1,146 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { Link } from 'react-router'; -import './styles.css'; +import { Table, Input } from 'reactstrap'; +import ApartmentTypeDropdown from './ApartmentTypeDropdown'; +import ApartmentTypeInput from './ApartmentTypeInput'; + class AshpBuildingInfo extends Component { - constructor(props){ + constructor(props) { super(props); - - - this.state = { - - - } + this.state = {}; } + render() { + const tableHeader = { + paddingBottom: '20px', + borderTop: '1px solid #CCCCCC', + background: '#EEEEEE', + fontWeight: 'bold', + paddingTop: '20px', + }; - console.log() - -render() { - return ( -
    - BUIDLING COMPONENT -
    - ); + return ( +
    + + + + + + + +
    + Building Information +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Full Name + + + + +
    + Email + + +
    + Phone No. + + +
    + Address + + {this.props.address[0]} {', '} + {this.props.borough} +
    + Apartment Types Breakdown + + + + +
    + {' '} + + + + +
    + {' '} + + + + +
    +
    +
    +
    + ); + } } - -} +AshpBuildingInfo.propTypes = { + address: PropTypes.string, + borough: PropTypes.string, +}; export default AshpBuildingInfo; diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/AshpHeatingInfo/index.js index 022292cb..b984bb24 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/AshpHeatingInfo/index.js @@ -1,15 +1,312 @@ import React, { Component } from 'react'; +// import PropTypes from 'prop-types'; +import { Table, Input } from 'reactstrap'; + class AshpHeatingInfo extends Component { - state = {} - - render() { - return ( -
    - HEATING COMPONENT -
    - ); - } + constructor(props) { + super(props); + this.state = {}; + } + + render() { + const tableHeader = { + paddingBottom: '20px', + borderTop: '1px solid #CCCCCC', + background: '#EEEEEE', + fontWeight: 'bold', + paddingTop: '20px', + }; + + return ( +
    + + + + + + + +
    + Remote Survey +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Heating System + + this.handleInputChange(e)} + value={-1} + > + + + + + + + + Heating Fuel Source + + this.handleInputChange(e)} + value={-1} + > + + + + + + +
    + Is Domestic Hot Water (DHW) and heat prepared by the same boiler? + + this.handleInputChange(e)} + value={-1} + > + + + + + + + Age of heat generating system? + + this.handleInputChange(e)} + value={-1} + > + + + + + + +
    + When do you plan to replace the heating system? + + this.handleInputChange(e)} + value={-1} + > + + + + + +
    + Are the Following Building Areas Heated? + +
    +
    + this.handleInputChange(e)} + value={-1} + > + + + + + +
    +
    +
    +
    +
    + this.handleInputChange(e)} + value={-1} + > + + + + +
    +
    +
    + {' '} + +
    +
    + this.handleInputChange(e)} + value={-1} + > + + + + +
    +
    +
    + {' '} +
    + Is the roof flat and easily accessible by a stairwell? + + this.handleInputChange(e)} + value={-1} + > + + + + + + + Is the back facade of your building attached to + an adjacent building or structure? + + this.handleInputChange(e)} + value={-1} + > + + + + + +
    + Are the exterior walls of your building attached to + an adjacent building or structure? + + this.handleInputChange(e)} + value={-1} + > + + + + + + + + Any tenant complaints about comfort issues? (Temperature) + + this.handleInputChange(e)} + value={-1} + > + + + + + + +
    + Any tenant complaints about drafty windows? + + this.handleInputChange(e)} + value={-1} + > + + + + + + + + Is the building direct metered for electricity + (tenants pay ConEd bills)? + + this.handleInputChange(e)} + value={-1} + > + + + + + + + + +
    +
    +
    +
    + ); + } } +// AshpHeatingInfo.propTypes = { +// address: PropTypes.string, +// borough: PropTypes.string, +// }; + export default AshpHeatingInfo; diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js index c3a4ab5d..df6af8ea 100644 --- a/src/containers/AshpQuestionaire/index.js +++ b/src/containers/AshpQuestionaire/index.js @@ -1,4 +1,6 @@ import React, { Component } from 'react'; +import buildingDetailPropTypes from '../../containers/Building/propTypes'; +import LinkBarDetail from '../../components/LinkBarDetail'; import AshpBuildingInfo from '../../components/AshpBuildingInfo'; import AshpFinanceInfo from '../../components/AshpFinanceInfo'; import AshpHeatingInfo from '../../components/AshpHeatingInfo'; @@ -7,26 +9,54 @@ import AshpHeatingInfo from '../../components/AshpHeatingInfo'; class AshpQuestionaire extends Component { constructor(props) { super(props); + console.log(props.building); // eslint-disable-line this.state = { test: '', }; } render() { - return ( -
    -
    - + const mainContent = ( +
    +
    +
    + +
    -
    - +
    +
    + +
    -
    - +
    +
    + +
    ); + + return ( +
    + + {mainContent} +
    + ); } } +AshpQuestionaire.propTypes = { + building: buildingDetailPropTypes, +}; + export default AshpQuestionaire; -- GitLab From 6d3d36f512eab980cce9d8a593cbb43227b244b8 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Sat, 10 Aug 2019 16:48:17 -0400 Subject: [PATCH 06/35] Add submit button and financial component --- src/components/AshpFinanceInfo/index.js | 143 +++++++++++++++++++++-- src/containers/AshpQuestionaire/index.js | 8 ++ 2 files changed, 142 insertions(+), 9 deletions(-) diff --git a/src/components/AshpFinanceInfo/index.js b/src/components/AshpFinanceInfo/index.js index 110973e8..850593fd 100644 --- a/src/components/AshpFinanceInfo/index.js +++ b/src/components/AshpFinanceInfo/index.js @@ -1,15 +1,140 @@ import React, { Component } from 'react'; +// import PropTypes from 'prop-types'; +import { Table, Input } from 'reactstrap'; + class AshpFinanaceInfo extends Component { - state = {} - - render() { - return ( -
    - FINANCE COMPONENT -
    - ); - } + constructor(props) { + super(props); + this.state = {}; + } + + render() { + const tableHeader = { + paddingBottom: '20px', + borderTop: '1px solid #CCCCCC', + background: '#EEEEEE', + fontWeight: 'bold', + paddingTop: '20px', + }; + + return ( +
    + + + + + + + +
    + Financial Initial Go/NoGo +
    +
    + + + + + + + + + + + + + + + + + +
    + Any bankruptcy in the past three years? + + this.handleInputChange(e)} + value={-1} + > + + + + + + + Current on energy bills? + + this.handleInputChange(e)} + value={-1} + > + + + + + + + + +
    + What is the current outstanding balance of the mortgage? + + this.handleInputChange(e)} + value={-1} + > + + + + + + + Is your building currently profitable? + + this.handleInputChange(e)} + value={-1} + > + + + + + +
    + What is your current budget for a down payment? + + this.handleInputChange(e)} + value={-1} + > + + + + + + +
    +
    +
    +
    + ); + } } +// AshpHeatingInfo.propTypes = { +// address: PropTypes.string, +// borough: PropTypes.string, +// }; + export default AshpFinanaceInfo; diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js index df6af8ea..e3545ca9 100644 --- a/src/containers/AshpQuestionaire/index.js +++ b/src/containers/AshpQuestionaire/index.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import { Button } from 'reactstrap'; import buildingDetailPropTypes from '../../containers/Building/propTypes'; import LinkBarDetail from '../../components/LinkBarDetail'; import AshpBuildingInfo from '../../components/AshpBuildingInfo'; @@ -36,6 +37,13 @@ class AshpQuestionaire extends Component {
    +
    +
    + +
    +
    ); -- GitLab From 858d45febac008b03a0e9c19692a6b57bab54b9d Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Sat, 10 Aug 2019 17:02:05 -0400 Subject: [PATCH 07/35] Add missing options to dropdowns --- src/components/AshpHeatingInfo/index.js | 47 +++++++++++++++++-------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/AshpHeatingInfo/index.js index b984bb24..acdf72b4 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/AshpHeatingInfo/index.js @@ -48,6 +48,7 @@ class AshpHeatingInfo extends Component { + @@ -65,6 +66,7 @@ class AshpHeatingInfo extends Component { + @@ -100,6 +102,7 @@ class AshpHeatingInfo extends Component { + @@ -110,14 +113,15 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > - - - + + + + @@ -154,6 +158,7 @@ class AshpHeatingInfo extends Component { +
    @@ -175,12 +180,27 @@ class AshpHeatingInfo extends Component { + - {' '} +
    +
    + this.handleInputChange(e)} + value={-1} + > + + + + + +
    +
    @@ -190,7 +210,7 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -243,7 +263,7 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -262,7 +282,7 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -280,17 +300,14 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > - - - - - - + + + -- GitLab From 760a881dbb73d005eb292e8d20700042b9f458c5 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Sat, 10 Aug 2019 17:10:01 -0400 Subject: [PATCH 08/35] updated options for current budget for down payment --- src/components/AshpFinanceInfo/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/AshpFinanceInfo/index.js b/src/components/AshpFinanceInfo/index.js index 850593fd..d75ddb28 100644 --- a/src/components/AshpFinanceInfo/index.js +++ b/src/components/AshpFinanceInfo/index.js @@ -81,9 +81,11 @@ class AshpFinanaceInfo extends Component { value={-1} > - - - + + + + + -- GitLab From 7aee596bbb9f52eecf404377fd20a6d20d0ac4a8 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Sat, 10 Aug 2019 17:12:39 -0400 Subject: [PATCH 09/35] updated options for current budget for down payment --- src/components/AshpFinanceInfo/index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/AshpFinanceInfo/index.js b/src/components/AshpFinanceInfo/index.js index d75ddb28..2de7b94d 100644 --- a/src/components/AshpFinanceInfo/index.js +++ b/src/components/AshpFinanceInfo/index.js @@ -112,15 +112,13 @@ class AshpFinanaceInfo extends Component { this.handleInputChange(e)} value={-1} > - - - - + + -- GitLab From f01a4c1cf1c5400ff7a5868988e97c53e4d7c605 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Sat, 10 Aug 2019 17:25:13 -0400 Subject: [PATCH 10/35] Add calculate and generate report buttons --- .../AshpBuildingInfo/ApartmentTypeDropdown.js | 1 - .../AshpBuildingInfo/ApartmentTypeInput.js | 3 +-- src/components/AshpFinanceInfo/index.js | 5 ----- src/components/AshpHeatingInfo/index.js | 17 +---------------- src/containers/AshpQuestionaire/index.js | 8 ++++++++ 5 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js b/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js index c277f6d8..77b6959e 100644 --- a/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js +++ b/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js @@ -12,7 +12,6 @@ const ApartmentTypeDropdown = (props) => { this.handleInputChange(e)} value={props.numOfApartment} > diff --git a/src/components/AshpBuildingInfo/ApartmentTypeInput.js b/src/components/AshpBuildingInfo/ApartmentTypeInput.js index f5bb307f..6edfa293 100644 --- a/src/components/AshpBuildingInfo/ApartmentTypeInput.js +++ b/src/components/AshpBuildingInfo/ApartmentTypeInput.js @@ -11,7 +11,7 @@ const ApartmentTypeInput = (props) => {
    this.handleInputChange(e)} + // onChange={e => this.handleInputChange(e)} placeholder={props.placeholder} />
    @@ -19,7 +19,6 @@ const ApartmentTypeInput = (props) => { this.handleInputChange(e)} value={props.numOfApartment} > diff --git a/src/components/AshpFinanceInfo/index.js b/src/components/AshpFinanceInfo/index.js index 2de7b94d..d844e6ea 100644 --- a/src/components/AshpFinanceInfo/index.js +++ b/src/components/AshpFinanceInfo/index.js @@ -40,7 +40,6 @@ class AshpFinanaceInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -56,7 +55,6 @@ class AshpFinanaceInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -77,7 +75,6 @@ class AshpFinanaceInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -95,7 +92,6 @@ class AshpFinanaceInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -113,7 +109,6 @@ class AshpFinanaceInfo extends Component { this.handleInputChange(e)} value={-1} > diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/AshpHeatingInfo/index.js index acdf72b4..78b033ff 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/AshpHeatingInfo/index.js @@ -40,7 +40,6 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -58,7 +57,6 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -78,7 +76,6 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -94,7 +91,6 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -114,7 +110,6 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -135,7 +130,6 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -152,7 +146,6 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -174,7 +167,6 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -191,7 +183,6 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -211,7 +202,6 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -228,7 +218,6 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -247,7 +236,6 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -264,7 +252,6 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -283,7 +270,6 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} value={-1} > @@ -294,14 +280,13 @@ class AshpHeatingInfo extends Component { - Is the building direct metered for electricity + Is the building directly metered for electricity (tenants pay ConEd bills)? this.handleInputChange(e)} value={-1} > diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js index e3545ca9..81c50166 100644 --- a/src/containers/AshpQuestionaire/index.js +++ b/src/containers/AshpQuestionaire/index.js @@ -42,6 +42,14 @@ class AshpQuestionaire extends Component { + {' '} + + {' '} + -- GitLab From d0771249b19af2f3ccd391983b4972ca73c6c091 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Sun, 11 Aug 2019 17:08:58 -0400 Subject: [PATCH 11/35] Update table row format --- src/components/AshpBuildingInfo/index.js | 8 ++++---- src/components/AshpFinanceInfo/index.js | 6 ++++++ src/components/AshpHeatingInfo/index.js | 12 ++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/components/AshpBuildingInfo/index.js b/src/components/AshpBuildingInfo/index.js index 97797b44..4b207fa7 100644 --- a/src/components/AshpBuildingInfo/index.js +++ b/src/components/AshpBuildingInfo/index.js @@ -49,16 +49,16 @@ class AshpBuildingInfo extends Component { Email - - + + Phone No. - - + + diff --git a/src/components/AshpFinanceInfo/index.js b/src/components/AshpFinanceInfo/index.js index d844e6ea..79db5d6f 100644 --- a/src/components/AshpFinanceInfo/index.js +++ b/src/components/AshpFinanceInfo/index.js @@ -116,6 +116,12 @@ class AshpFinanaceInfo extends Component { + + {' '} + + + {' '} + diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/AshpHeatingInfo/index.js index 78b033ff..d5058a6f 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/AshpHeatingInfo/index.js @@ -119,6 +119,12 @@ class AshpHeatingInfo extends Component { + + {' '} + + + {' '} + @@ -156,6 +162,9 @@ class AshpHeatingInfo extends Component { + + {' '} + @@ -193,6 +202,9 @@ class AshpHeatingInfo extends Component { + + {' '} + -- GitLab From 9f95202ae7314b6abd1704839e92a062e14ce36d Mon Sep 17 00:00:00 2001 From: bontiveros Date: Sun, 11 Aug 2019 18:53:33 -0400 Subject: [PATCH 12/35] UI and Dropdown edits --- src/components/AshpHeatingInfo/index.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/AshpHeatingInfo/index.js index d5058a6f..5e5e1aa2 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/AshpHeatingInfo/index.js @@ -128,7 +128,7 @@ class AshpHeatingInfo extends Component { - Are the Following Building Areas Heated? + Are the following building areas heated?
    @@ -251,9 +251,9 @@ class AshpHeatingInfo extends Component { value={-1} > - - - + + + @@ -267,10 +267,10 @@ class AshpHeatingInfo extends Component { value={-1} > - - - - + + + + @@ -285,10 +285,10 @@ class AshpHeatingInfo extends Component { value={-1} > - - - - + + + + -- GitLab From 5ba555476863ffa88f0307854a1039e63ed74c0d Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Sun, 11 Aug 2019 20:26:15 -0400 Subject: [PATCH 13/35] Add properties to components --- .../AshpBuildingInfo/ApartmentTypeDropdown.js | 18 +++++++- src/components/AshpBuildingInfo/index.js | 45 ++++++++++++++++++- src/components/AshpFinanceInfo/index.js | 21 +++++---- src/components/AshpHeatingInfo/index.js | 34 +++++++++----- src/containers/AshpQuestionaire/index.js | 37 ++++++++++++++- 5 files changed, 130 insertions(+), 25 deletions(-) diff --git a/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js b/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js index 77b6959e..0cb3b850 100644 --- a/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js +++ b/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js @@ -6,13 +6,29 @@ import { const ApartmentTypeDropdown = (props) => { + + handleInputChange = (event) => { + const val = event.target.value; + const name = event.target.name; + this.setState({ + form: { + ...this.state.form, + [name]: val, + }, + }, () => { + this.props.onChangeEvent(this.state.form); + console.log('changed!'); // eslint-disable-line + }); + } + return (
    this.handleInputChange(e)} > diff --git a/src/components/AshpBuildingInfo/index.js b/src/components/AshpBuildingInfo/index.js index 4b207fa7..960076b2 100644 --- a/src/components/AshpBuildingInfo/index.js +++ b/src/components/AshpBuildingInfo/index.js @@ -8,7 +8,36 @@ import ApartmentTypeInput from './ApartmentTypeInput'; class AshpBuildingInfo extends Component { constructor(props) { super(props); - this.state = {}; + this.state = { + form: { + id: props.id, + firstName: props.firstName, + lastName: props.lastName, + email: props.email, + phone: props.phone, + studio: props.studio, + oneBedroom: props.oneBedroom, + twoBedroom: props.twoBedroom, + threeBedroom: props.threeBedroom, + fourBedroom: props.fourBedroom, + other: props.other, + numberOfOther: props.numberOfOther, + }, + }; + } + + handleInputChange = (event) => { + const val = event.target.value; + const name = event.target.name; + this.setState({ + form: { + ...this.state.form, + [name]: val, + }, + }, () => { + // this.props.onChangeEvent(this.state.form); + console.log('changed!'); // eslint-disable-line + }); } render() { @@ -122,7 +151,7 @@ class AshpBuildingInfo extends Component { @@ -141,6 +170,18 @@ class AshpBuildingInfo extends Component { AshpBuildingInfo.propTypes = { address: PropTypes.string, borough: PropTypes.string, + id: PropTypes.number, + firstName: PropTypes.string, + lastName: PropTypes.string, + email: PropTypes.string, + phone: PropTypes.string, + studio: PropTypes.number, + oneBedroom: PropTypes.number, + twoBedroom: PropTypes.number, + threeBedroom: PropTypes.number, + fourBedroom: PropTypes.number, + other: PropTypes.string, + numberOfOther: PropTypes.number, }; export default AshpBuildingInfo; diff --git a/src/components/AshpFinanceInfo/index.js b/src/components/AshpFinanceInfo/index.js index 79db5d6f..a574009a 100644 --- a/src/components/AshpFinanceInfo/index.js +++ b/src/components/AshpFinanceInfo/index.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -// import PropTypes from 'prop-types'; +import PropTypes from 'prop-types'; import { Table, Input } from 'reactstrap'; @@ -39,7 +39,7 @@ class AshpFinanaceInfo extends Component { @@ -54,7 +54,7 @@ class AshpFinanaceInfo extends Component { @@ -74,7 +74,7 @@ class AshpFinanaceInfo extends Component { @@ -91,7 +91,7 @@ class AshpFinanaceInfo extends Component { @@ -133,9 +133,12 @@ class AshpFinanaceInfo extends Component { } } -// AshpHeatingInfo.propTypes = { -// address: PropTypes.string, -// borough: PropTypes.string, -// }; +AshpFinanaceInfo.propTypes = { + bankruptyPast: PropTypes.number, + currentOnEnergyBills: PropTypes.number, + currentMortgageBalance: PropTypes.number, + profitable: PropTypes.number, + budgetForDownPayment: PropTypes.number, +}; export default AshpFinanaceInfo; diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/AshpHeatingInfo/index.js index d5058a6f..7f62b832 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/AshpHeatingInfo/index.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -// import PropTypes from 'prop-types'; +import PropTypes from 'prop-types'; import { Table, Input } from 'reactstrap'; @@ -75,7 +75,7 @@ class AshpHeatingInfo extends Component { @@ -90,7 +90,7 @@ class AshpHeatingInfo extends Component { @@ -135,7 +135,7 @@ class AshpHeatingInfo extends Component {
    @@ -151,7 +151,7 @@ class AshpHeatingInfo extends Component {
    @@ -175,7 +175,7 @@ class AshpHeatingInfo extends Component {
    @@ -191,7 +191,7 @@ class AshpHeatingInfo extends Component {
    @@ -318,9 +318,21 @@ class AshpHeatingInfo extends Component { } } -// AshpHeatingInfo.propTypes = { -// address: PropTypes.string, -// borough: PropTypes.string, -// }; +AshpHeatingInfo.propTypes = { + heatingSystem: PropTypes.number, + heatingFuelSource: PropTypes.number, + DHWSameBoiler: PropTypes.number, + planToReplaceHS: PropTypes.number, + hallwaysHeated: PropTypes.number, + basementHeated: PropTypes.number, + stairwellsHeated: PropTypes.number, + floorsHeated: PropTypes.number, + accessibleByStairwell: PropTypes.number, + backFacadeAttached: PropTypes.number, + exteriorWallsAttached: PropTypes.number, + tenantComplaintsWindows: PropTypes.number, + tenantComplaintsComfort: PropTypes.number, + meteredForElectricity: PropTypes.number, +}; export default AshpHeatingInfo; diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js index 81c50166..cae53cf1 100644 --- a/src/containers/AshpQuestionaire/index.js +++ b/src/containers/AshpQuestionaire/index.js @@ -24,17 +24,50 @@ class AshpQuestionaire extends Component {
    - +
    - +
    -- GitLab From 6e144a67218e54dd3807fd67234cb353a2b16cd8 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Sun, 11 Aug 2019 20:38:41 -0400 Subject: [PATCH 14/35] Add properties to components --- .../AshpBuildingInfo/ApartmentTypeDropdown.js | 4 +-- src/components/AshpFinanceInfo/index.js | 10 +++--- src/components/AshpHeatingInfo/index.js | 33 ++++++++++--------- src/containers/AshpQuestionaire/index.js | 2 +- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js b/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js index 0cb3b850..83436786 100644 --- a/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js +++ b/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js @@ -19,7 +19,7 @@ const ApartmentTypeDropdown = (props) => { this.props.onChangeEvent(this.state.form); console.log('changed!'); // eslint-disable-line }); - } + }; return (
    @@ -28,7 +28,7 @@ const ApartmentTypeDropdown = (props) => { type="select" name={props.typeOfApartment} value={this.state.form[numOfApartment]} - onChange={e => this.handleInputChange(e)} + // onChange={e => this.handleInputChange(e)} > diff --git a/src/components/AshpFinanceInfo/index.js b/src/components/AshpFinanceInfo/index.js index a574009a..57f33a60 100644 --- a/src/components/AshpFinanceInfo/index.js +++ b/src/components/AshpFinanceInfo/index.js @@ -40,7 +40,7 @@ class AshpFinanaceInfo extends Component { @@ -55,7 +55,7 @@ class AshpFinanaceInfo extends Component { @@ -75,7 +75,7 @@ class AshpFinanaceInfo extends Component { @@ -92,7 +92,7 @@ class AshpFinanaceInfo extends Component { @@ -109,7 +109,7 @@ class AshpFinanaceInfo extends Component { diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/AshpHeatingInfo/index.js index 72ef2e5e..623820ca 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/AshpHeatingInfo/index.js @@ -40,7 +40,7 @@ class AshpHeatingInfo extends Component { @@ -57,7 +57,7 @@ class AshpHeatingInfo extends Component { @@ -76,7 +76,7 @@ class AshpHeatingInfo extends Component { @@ -90,8 +90,8 @@ class AshpHeatingInfo extends Component { @@ -110,7 +110,7 @@ class AshpHeatingInfo extends Component { @@ -136,7 +136,7 @@ class AshpHeatingInfo extends Component { @@ -152,7 +152,7 @@ class AshpHeatingInfo extends Component { @@ -176,7 +176,7 @@ class AshpHeatingInfo extends Component { @@ -192,7 +192,7 @@ class AshpHeatingInfo extends Component { @@ -214,7 +214,7 @@ class AshpHeatingInfo extends Component { @@ -230,7 +230,7 @@ class AshpHeatingInfo extends Component { @@ -248,7 +248,7 @@ class AshpHeatingInfo extends Component { @@ -264,7 +264,7 @@ class AshpHeatingInfo extends Component { @@ -282,7 +282,7 @@ class AshpHeatingInfo extends Component { @@ -299,7 +299,7 @@ class AshpHeatingInfo extends Component { @@ -333,6 +333,7 @@ AshpHeatingInfo.propTypes = { tenantComplaintsWindows: PropTypes.number, tenantComplaintsComfort: PropTypes.number, meteredForElectricity: PropTypes.number, + AgeOfHeatGenerateSystem: PropTypes.number, }; export default AshpHeatingInfo; diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js index cae53cf1..4ed22d42 100644 --- a/src/containers/AshpQuestionaire/index.js +++ b/src/containers/AshpQuestionaire/index.js @@ -44,7 +44,7 @@ class AshpQuestionaire extends Component { heatingSystem={' '} heatingFuelSource={' '} DHWSameBoiler={' '} - heatGenerateSystem={' '} + AgeOfHeatGenerateSystem={' '} planToReplaceHS={' '} hallwaysHeated={' '} basementHeated={' '} -- GitLab From 8bbe1da0a78e88c0206b96ca219a79e88788739a Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Mon, 12 Aug 2019 10:24:21 -0400 Subject: [PATCH 15/35] Fix not loading issue/PNA --- .../AshpBuildingInfo/ApartmentTypeDropdown.js | 28 +++++++++---------- src/containers/AshpQuestionaire/index.js | 4 +-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js b/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js index 83436786..0e5182e2 100644 --- a/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js +++ b/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js @@ -7,19 +7,19 @@ import { const ApartmentTypeDropdown = (props) => { - handleInputChange = (event) => { - const val = event.target.value; - const name = event.target.name; - this.setState({ - form: { - ...this.state.form, - [name]: val, - }, - }, () => { - this.props.onChangeEvent(this.state.form); - console.log('changed!'); // eslint-disable-line - }); - }; + // handleInputChange = (event) => { + // const val = event.target.value; + // const name = event.target.name; + // this.setState({ + // form: { + // ...this.state.form, + // [name]: val, + // }, + // }, () => { + // this.props.onChangeEvent(this.state.form); + // console.log('changed!'); // eslint-disable-line + // }); + // }; return (
    @@ -27,7 +27,7 @@ const ApartmentTypeDropdown = (props) => { this.handleInputChange(e)} > diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js index 4ed22d42..c6a3ce25 100644 --- a/src/containers/AshpQuestionaire/index.js +++ b/src/containers/AshpQuestionaire/index.js @@ -76,13 +76,13 @@ class AshpQuestionaire extends Component { Submit {' '} - {' '} + */}
    -- GitLab From 5220e3cd9c876ad6d63f62300bc8b9783bc32abc Mon Sep 17 00:00:00 2001 From: bontiveros Date: Mon, 12 Aug 2019 10:46:45 -0400 Subject: [PATCH 16/35] Further improvements of UI --- src/components/AshpBuildingInfo/index.js | 2 +- src/components/AshpHeatingInfo/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/AshpBuildingInfo/index.js b/src/components/AshpBuildingInfo/index.js index 960076b2..bfa3c117 100644 --- a/src/components/AshpBuildingInfo/index.js +++ b/src/components/AshpBuildingInfo/index.js @@ -56,7 +56,7 @@ class AshpBuildingInfo extends Component { - Building Information + Building Intake Fields diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/AshpHeatingInfo/index.js index 623820ca..324dc420 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/AshpHeatingInfo/index.js @@ -25,7 +25,7 @@ class AshpHeatingInfo extends Component { - Remote Survey + Remote Survey Fields -- GitLab From 735e742ad111281724633bfd3dce622664a83854 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Mon, 12 Aug 2019 11:31:28 -0400 Subject: [PATCH 17/35] Update table format, removed not needed border, fix dropdown options --- .../AshpBuildingInfo/ApartmentTypeDropdown.js | 2 - src/components/AshpBuildingInfo/index.js | 75 ++++++++++++------ src/components/AshpFinanceInfo/index.js | 11 +-- src/components/AshpHeatingInfo/index.js | 36 +++++---- src/containers/AshpQuestionaire/index.js | 79 ++++++++++++------- 5 files changed, 123 insertions(+), 80 deletions(-) diff --git a/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js b/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js index 0e5182e2..13943078 100644 --- a/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js +++ b/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js @@ -30,7 +30,6 @@ const ApartmentTypeDropdown = (props) => { value={props.numOfApartment} // onChange={e => this.handleInputChange(e)} > - @@ -44,7 +43,6 @@ const ApartmentTypeDropdown = (props) => { }; ApartmentTypeDropdown.propTypes = { - name: PropTypes.string, typeOfApartment: PropTypes.string, numOfApartment: PropTypes.number, }; diff --git a/src/components/AshpBuildingInfo/index.js b/src/components/AshpBuildingInfo/index.js index bfa3c117..12827c6f 100644 --- a/src/components/AshpBuildingInfo/index.js +++ b/src/components/AshpBuildingInfo/index.js @@ -41,21 +41,11 @@ class AshpBuildingInfo extends Component { } render() { - const tableHeader = { - paddingBottom: '20px', - borderTop: '1px solid #CCCCCC', - background: '#EEEEEE', - fontWeight: 'bold', - paddingTop: '20px', - }; - return (
    - @@ -68,10 +58,18 @@ class AshpBuildingInfo extends Component { Full Name @@ -79,7 +77,12 @@ class AshpBuildingInfo extends Component { Email @@ -87,7 +90,12 @@ class AshpBuildingInfo extends Component { Phone No. @@ -99,41 +107,53 @@ class AshpBuildingInfo extends Component { {this.props.borough} - + - + @@ -142,18 +162,23 @@ class AshpBuildingInfo extends Component { {' '} @@ -168,6 +193,8 @@ class AshpBuildingInfo extends Component { } AshpBuildingInfo.propTypes = { + tableHeader: PropTypes.objectOf, + labelStyle: PropTypes.objectOf, address: PropTypes.string, borough: PropTypes.string, id: PropTypes.number, diff --git a/src/components/AshpFinanceInfo/index.js b/src/components/AshpFinanceInfo/index.js index 57f33a60..5d009a84 100644 --- a/src/components/AshpFinanceInfo/index.js +++ b/src/components/AshpFinanceInfo/index.js @@ -10,20 +10,12 @@ class AshpFinanaceInfo extends Component { } render() { - const tableHeader = { - paddingBottom: '20px', - borderTop: '1px solid #CCCCCC', - background: '#EEEEEE', - fontWeight: 'bold', - paddingTop: '20px', - }; - return (
    + Building Intake Fields
    - + - +
    - +
    - +
    Apartment Types Breakdown +
    + Number of Studio +
    +
    + Number of One Bedroom Apartment +
    {' '} +
    + Number of Two Bedroom Apartment +
    +
    + Number of Three Bedroom Apartment +
    +
    + Number of Four Bedroom Apartment +
    +
    + Other +
    @@ -134,6 +126,7 @@ class AshpFinanaceInfo extends Component { } AshpFinanaceInfo.propTypes = { + tableHeader: PropTypes.objectOf, bankruptyPast: PropTypes.number, currentOnEnergyBills: PropTypes.number, currentMortgageBalance: PropTypes.number, diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/AshpHeatingInfo/index.js index 324dc420..57a93e9b 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/AshpHeatingInfo/index.js @@ -10,21 +10,11 @@ class AshpHeatingInfo extends Component { } render() { - const tableHeader = { - paddingBottom: '20px', - borderTop: '1px solid #CCCCCC', - background: '#EEEEEE', - fontWeight: 'bold', - paddingTop: '20px', - }; - return (
    Financial Initial Go/NoGo
    - @@ -126,11 +116,14 @@ class AshpHeatingInfo extends Component { {' '} - + @@ -126,6 +126,7 @@ BuildingInfo.propTypes = { tableHeader: PropTypes.objectOf, title: PropTypes.string, data: PropTypes.objectOf, + upperFirstLetter: PropTypes.func, }; export default BuildingInfo; diff --git a/src/components/Ashp/ReviewAnswers/FinancialInitial.js b/src/components/Ashp/ReviewAnswers/FinancialInitial.js index 379d2f5f..70bab548 100644 --- a/src/components/Ashp/ReviewAnswers/FinancialInitial.js +++ b/src/components/Ashp/ReviewAnswers/FinancialInitial.js @@ -23,7 +23,7 @@ const FinancialInitial = (props) => { Any bankruptcy in the past three years?
    - {props.data.bankruptyPast} + {props.upperFirstLetter(props.data.bankruptyPast)}
    @@ -33,7 +33,7 @@ const FinancialInitial = (props) => { Current on energy bills?
    - {props.data.currentOnEnergyBills} + {props.upperFirstLetter(props.data.currentOnEnergyBills)}
    @@ -43,7 +43,7 @@ const FinancialInitial = (props) => { What is the current outstanding balance of the mortgage?
    - {props.data.currentMortgageBalance} + {props.upperFirstLetter(props.data.currentMortgageBalance)}
    @@ -53,7 +53,7 @@ const FinancialInitial = (props) => { Is your building currently profitable?
    - {props.data.profitable} + {props.upperFirstLetter(props.data.profitable)}
    @@ -63,7 +63,7 @@ const FinancialInitial = (props) => { What is your current budget for a down payment?
    - {props.data.budgetForDownPayment} + {props.upperFirstLetter(props.data.budgetForDownPayment)}
    @@ -76,6 +76,7 @@ FinancialInitial.propTypes = { tableHeader: PropTypes.objectOf, title: PropTypes.string, data: PropTypes.objectOf, + upperFirstLetter: PropTypes.func, }; export default FinancialInitial; diff --git a/src/components/Ashp/ReviewAnswers/RemoteSurvey.js b/src/components/Ashp/ReviewAnswers/RemoteSurvey.js index 66035ec8..c7bc75c8 100644 --- a/src/components/Ashp/ReviewAnswers/RemoteSurvey.js +++ b/src/components/Ashp/ReviewAnswers/RemoteSurvey.js @@ -23,7 +23,7 @@ const RemoteSurvey = (props) => { Heating System
    - {props.data.heatingSystem} + {props.upperFirstLetter(props.data.heatingSystem)}
    @@ -41,7 +41,7 @@ const RemoteSurvey = (props) => { Is Domestic Hot Water (DHW) and heat prepared by the same boiler?
    - {props.data.DHWSameBoiler} + {props.upperFirstLetter(props.data.DHWSameBoiler)}
    @@ -51,7 +51,7 @@ const RemoteSurvey = (props) => { Age of heat generating system?
    - {props.data.AgeOfHeatGenerateSystem} + {props.upperFirstLetter(props.data.AgeOfHeatGenerateSystem)}
    @@ -61,7 +61,7 @@ const RemoteSurvey = (props) => { When do you plan to replace the heating system?
    - {props.data.planToReplaceHS} + {props.upperFirstLetter(props.data.planToReplaceHS)}
    @@ -71,7 +71,7 @@ const RemoteSurvey = (props) => { Hallways heated?
    - {props.data.hallwaysHeated} + {props.upperFirstLetter(props.data.hallwaysHeated)}
    @@ -89,7 +89,7 @@ const RemoteSurvey = (props) => { Stairwells heated?
    - {props.data.stairwellsHeated} + {props.upperFirstLetter(props.data.stairwellsHeated)}
    @@ -107,7 +107,7 @@ const RemoteSurvey = (props) => { Is the roof flat and easily accessible by a stairwell?
    - {props.data.accessibleByStairwell} + {props.upperFirstLetter(props.data.accessibleByStairwell)}
    @@ -117,7 +117,7 @@ const RemoteSurvey = (props) => { Is the back facade of your building attached to an adjacent building or structure?
    - {props.data.backFacadeAttached} + {props.upperFirstLetter(props.data.backFacadeAttached)}
    @@ -127,7 +127,7 @@ const RemoteSurvey = (props) => { Are the exterior walls of your building attached to an adjacent building or structure?
    - {props.data.exteriorWallsAttached} + {props.upperFirstLetter(props.data.exteriorWallsAttached)}
    @@ -137,7 +137,7 @@ const RemoteSurvey = (props) => { Any tenant complaints about comfort issues? (Temperature)
    - {props.data.tenantComplaintsComfort} + {props.upperFirstLetter(props.data.tenantComplaintsComfort)}
    @@ -147,7 +147,7 @@ const RemoteSurvey = (props) => { Any tenant complaints about drafty windows?
    - {props.data.tenantComplaintsWindows} + {props.upperFirstLetter(props.data.tenantComplaintsWindows)}
    @@ -157,7 +157,7 @@ const RemoteSurvey = (props) => { Is the building directly metered for electricity (tenants pay ConEd bills)?
    - {props.data.meteredForElectricity} + {props.upperFirstLetter(props.data.meteredForElectricity)}
    @@ -170,6 +170,7 @@ RemoteSurvey.propTypes = { tableHeader: PropTypes.objectOf, title: PropTypes.string, data: PropTypes.objectOf, + upperFirstLetter: PropTypes.func, }; export default RemoteSurvey; diff --git a/src/components/Ashp/ReviewAnswers/index.js b/src/components/Ashp/ReviewAnswers/index.js index 0e516cc8..034b60b3 100644 --- a/src/components/Ashp/ReviewAnswers/index.js +++ b/src/components/Ashp/ReviewAnswers/index.js @@ -6,6 +6,10 @@ import FinancialInitial from './FinancialInitial'; const ReviewAnswers = (props) => { + const upperFirstLetter = (str) => { + return str.charAt(0).toUpperCase() + str.slice(1); + }; + return (
    @@ -14,6 +18,7 @@ const ReviewAnswers = (props) => { tableHeader={props.tableHeader} title={'Building Info'} data={props.buildingInfo} + upperFirstLetter={upperFirstLetter} />
    @@ -21,6 +26,7 @@ const ReviewAnswers = (props) => { tableHeader={props.tableHeader} title={'Remote Survey'} data={props.remoteSurvey} + upperFirstLetter={upperFirstLetter} />
    @@ -28,6 +34,7 @@ const ReviewAnswers = (props) => { tableHeader={props.tableHeader} title={'Financial Initial Go/NoGo'} data={props.financialInitials} + upperFirstLetter={upperFirstLetter} />
    -- GitLab From aa826a1a0adc086a77d9783cd68d9ced1b3660cc Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Tue, 13 Aug 2019 16:41:30 -0400 Subject: [PATCH 32/35] Fix apartment number bug --- src/components/Ashp/ReviewAnswers/BuildingInfo.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Ashp/ReviewAnswers/BuildingInfo.js b/src/components/Ashp/ReviewAnswers/BuildingInfo.js index 1b785ea7..03a8e43a 100644 --- a/src/components/Ashp/ReviewAnswers/BuildingInfo.js +++ b/src/components/Ashp/ReviewAnswers/BuildingInfo.js @@ -87,7 +87,7 @@ const BuildingInfo = (props) => { Number of Two Bedroom Apartment
    - {props.data.numOfStudio} + {props.data.numOfTwoBedroom}
    -- GitLab From ec4df2e12ca14d099098ea9f4fcbc1b1829fe6d1 Mon Sep 17 00:00:00 2001 From: bontiveros Date: Wed, 14 Aug 2019 14:15:03 -0400 Subject: [PATCH 33/35] fixed sidebar typo --- src/components/SideBarDetail/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SideBarDetail/index.js b/src/components/SideBarDetail/index.js index f2eef4d5..d09842af 100644 --- a/src/components/SideBarDetail/index.js +++ b/src/components/SideBarDetail/index.js @@ -190,7 +190,7 @@ export default function SideBarDetail({ building, children, contacts, user }) { > {dimensionSVG} - ASHP Questionaires + ASHP Questionnaires
  • -- GitLab From 74696f77ae7462c14a0d5aaef8adda935fd6c9a4 Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Wed, 14 Aug 2019 15:34:09 -0400 Subject: [PATCH 34/35] Building name not showing up --- src/components/Ashp/BuildingInfo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Ashp/BuildingInfo.js b/src/components/Ashp/BuildingInfo.js index 428492f3..14ac63e5 100644 --- a/src/components/Ashp/BuildingInfo.js +++ b/src/components/Ashp/BuildingInfo.js @@ -3,7 +3,6 @@ import PropTypes from 'prop-types'; import { Table, Input } from 'reactstrap'; import ApartmentTypeDropdown from './ApartmentTypeDropdown'; - class BuildingInfo extends Component { constructor(props) { super(props); @@ -20,6 +19,7 @@ class BuildingInfo extends Component { numOfFourBedroom: props.numOfFourBedroom, other: props.other, numOfOther: props.numOfOther, + address: props.address, }, }; } -- GitLab From a27cd3af6a21247aa265d3e836bb410c4877668f Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Thu, 15 Aug 2019 11:20:19 -0400 Subject: [PATCH 35/35] Rename component and fix multiple address issue --- src/components/Ashp/BuildingInfo.js | 13 +++++++++---- src/components/Ashp/RemoteSurvey.js | 2 +- src/components/Ashp/ReviewAnswers/BuildingInfo.js | 9 ++++++++- src/components/SideBarDetail/index.js | 4 ++-- .../actions.js | 0 .../constants.js | 0 .../{AshpQuestionnaire => Questionnaire}/index.js | 14 ++++++++------ .../reducer.js | 0 .../{AshpQuestionnaire => Questionnaire}/sagas.js | 0 src/reducers.js | 2 +- src/routes.js | 4 ++-- src/sagas.js | 2 +- 12 files changed, 32 insertions(+), 18 deletions(-) rename src/containers/{AshpQuestionnaire => Questionnaire}/actions.js (100%) rename src/containers/{AshpQuestionnaire => Questionnaire}/constants.js (100%) rename src/containers/{AshpQuestionnaire => Questionnaire}/index.js (96%) rename src/containers/{AshpQuestionnaire => Questionnaire}/reducer.js (100%) rename src/containers/{AshpQuestionnaire => Questionnaire}/sagas.js (100%) diff --git a/src/components/Ashp/BuildingInfo.js b/src/components/Ashp/BuildingInfo.js index 14ac63e5..7651e7f6 100644 --- a/src/components/Ashp/BuildingInfo.js +++ b/src/components/Ashp/BuildingInfo.js @@ -51,6 +51,13 @@ class BuildingInfo extends Component { } render() { + const address = this.props.address.map(addressItem => { + return ( +
    + {addressItem} +
    + ); + }); return (
  • + Remote Survey Fields
    Are the following building areas heated? +
    + Hallways +
    - + @@ -147,6 +140,9 @@ class AshpHeatingInfo extends Component {
    +
    + Basement +
    - + @@ -171,6 +167,9 @@ class AshpHeatingInfo extends Component { {' '}
    +
    + Stairwells +
    - + @@ -187,6 +186,9 @@ class AshpHeatingInfo extends Component {
    +
    + Floors +
    - + @@ -319,6 +321,8 @@ class AshpHeatingInfo extends Component { } AshpHeatingInfo.propTypes = { + tableHeader: PropTypes.objectOf, + labelStyle: PropTypes.objectOf, heatingSystem: PropTypes.number, heatingFuelSource: PropTypes.number, DHWSameBoiler: PropTypes.number, diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js index c6a3ce25..98d6e3b2 100644 --- a/src/containers/AshpQuestionaire/index.js +++ b/src/containers/AshpQuestionaire/index.js @@ -17,23 +17,40 @@ class AshpQuestionaire extends Component { } render() { + const tableHeader = { + paddingBottom: '20px', + borderTop: '1px solid #CCCCCC', + background: '#EEEEEE', + fontWeight: 'bold', + paddingTop: '20px', + }; + + const labelStyle = { + marginBottom: '0.7em', + fontWeight: 'bold', + fontSize: '12px', + color: '#999999', + }; + const mainContent = (
    @@ -41,32 +58,36 @@ class AshpQuestionaire extends Component {
    -- GitLab From 1c27d48186a8e2b0486af485266d5b2675f2ccc3 Mon Sep 17 00:00:00 2001 From: bontiveros Date: Mon, 12 Aug 2019 11:34:38 -0400 Subject: [PATCH 18/35] Fix table headers --- src/components/AshpBuildingInfo/index.js | 2 +- src/components/AshpHeatingInfo/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/AshpBuildingInfo/index.js b/src/components/AshpBuildingInfo/index.js index 12827c6f..2baf41fd 100644 --- a/src/components/AshpBuildingInfo/index.js +++ b/src/components/AshpBuildingInfo/index.js @@ -46,7 +46,7 @@ class AshpBuildingInfo extends Component { diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/AshpHeatingInfo/index.js index 57a93e9b..59e531dd 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/AshpHeatingInfo/index.js @@ -15,7 +15,7 @@ class AshpHeatingInfo extends Component {
    - Building Intake Fields + Building Intake
    -- GitLab From d6ae93daafd02b608a26b4389f04617a36914203 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Mon, 12 Aug 2019 11:42:17 -0400 Subject: [PATCH 19/35] Update dropdown values --- src/components/AshpHeatingInfo/index.js | 68 ++++++++++++------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/AshpHeatingInfo/index.js index 59e531dd..81708c76 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/AshpHeatingInfo/index.js @@ -33,11 +33,11 @@ class AshpHeatingInfo extends Component { value={this.props.heatingSystem} > - - - - - + + + + + @@ -69,9 +69,9 @@ class AshpHeatingInfo extends Component { value={this.props.DHWSameBoiler} > - - - + + + @@ -103,10 +103,10 @@ class AshpHeatingInfo extends Component { value={this.props.planToReplaceHS} > - - - - + + + + @@ -70,11 +70,11 @@ class AshpFinanaceInfo extends Component { value={this.props.currentMortgageBalance} > - - - - - + + + + + @@ -104,8 +104,8 @@ class AshpFinanaceInfo extends Component { value={this.props.budgetForDownPayment} > - - + + @@ -253,10 +253,10 @@ class AshpHeatingInfo extends Component { value={this.props.exteriorWallsAttached} > - - - - + + + + @@ -287,10 +287,10 @@ class AshpHeatingInfo extends Component { value={this.props.tenantComplaintsWindows} > - - - - + + + + -- GitLab From 27dc4cfb98224eb00b288ded1c6c343310211d58 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Mon, 12 Aug 2019 12:54:22 -0400 Subject: [PATCH 21/35] Add onchange event to components --- src/components/AshpBuildingInfo/index.js | 33 ++++--- src/components/AshpFinanceInfo/index.js | 40 ++++++-- src/components/AshpHeatingInfo/index.js | 110 ++++++++++++++++------ src/containers/AshpQuestionaire/index.js | 114 ++++++++++++++++------- 4 files changed, 217 insertions(+), 80 deletions(-) diff --git a/src/components/AshpBuildingInfo/index.js b/src/components/AshpBuildingInfo/index.js index 2baf41fd..033b274a 100644 --- a/src/components/AshpBuildingInfo/index.js +++ b/src/components/AshpBuildingInfo/index.js @@ -35,7 +35,7 @@ class AshpBuildingInfo extends Component { [name]: val, }, }, () => { - // this.props.onChangeEvent(this.state.form); + this.props.onChangeEvent('buildingInfo', this.state.form); console.log('changed!'); // eslint-disable-line }); } @@ -61,14 +61,16 @@ class AshpBuildingInfo extends Component { this.handleInputChange(e)} /> @@ -81,7 +83,8 @@ class AshpBuildingInfo extends Component { name="email" placeholder="Email" style={{ width: '50%' }} - value={this.props.email} + value={this.state.form.email} + onChange={e => this.handleInputChange(e)} /> @@ -94,7 +97,8 @@ class AshpBuildingInfo extends Component { name="phone" placeholder="Phone Number" style={{ width: '50%' }} - value={this.props.phone} + value={this.state.form.phone} + onChange={e => this.handleInputChange(e)} /> @@ -118,7 +122,8 @@ class AshpBuildingInfo extends Component { this.handleInputChange(e)} /> @@ -143,7 +149,8 @@ class AshpBuildingInfo extends Component { this.handleInputChange(e)} /> @@ -168,7 +176,8 @@ class AshpBuildingInfo extends Component { this.handleInputChange(e)} /> @@ -209,6 +219,7 @@ AshpBuildingInfo.propTypes = { fourBedroom: PropTypes.number, other: PropTypes.string, numberOfOther: PropTypes.number, + onChangeEvent: PropTypes.func, }; export default AshpBuildingInfo; diff --git a/src/components/AshpFinanceInfo/index.js b/src/components/AshpFinanceInfo/index.js index b9e20f31..1631721a 100644 --- a/src/components/AshpFinanceInfo/index.js +++ b/src/components/AshpFinanceInfo/index.js @@ -6,7 +6,29 @@ import { Table, Input } from 'reactstrap'; class AshpFinanaceInfo extends Component { constructor(props) { super(props); - this.state = {}; + this.state = { + form: { + bankruptyPast: props.bankruptyPast, + currentOnEnergyBills: props.currentOnEnergyBills, + currentMortgageBalance: props.currentMortgageBalance, + profitable: props.profitable, + budgetForDownPayment: props.budgetForDownPayment, + }, + }; + } + + handleInputChange = (event) => { + const val = event.target.value; + const name = event.target.name; + this.setState({ + form: { + ...this.state.form, + [name]: val, + }, + }, () => { + this.props.onChangeEvent('financialInitials', this.state.form); + console.log('changed!'); // eslint-disable-line + }); } render() { @@ -32,7 +54,8 @@ class AshpFinanaceInfo extends Component { this.handleInputChange(e)} > @@ -47,7 +70,8 @@ class AshpFinanaceInfo extends Component { this.handleInputChange(e)} > @@ -67,7 +91,8 @@ class AshpFinanaceInfo extends Component { this.handleInputChange(e)} > @@ -84,7 +109,8 @@ class AshpFinanaceInfo extends Component { this.handleInputChange(e)} > @@ -101,7 +127,8 @@ class AshpFinanaceInfo extends Component { this.handleInputChange(e)} > @@ -132,6 +159,7 @@ AshpFinanaceInfo.propTypes = { currentMortgageBalance: PropTypes.number, profitable: PropTypes.number, budgetForDownPayment: PropTypes.number, + onChangeEvent: PropTypes.func, }; export default AshpFinanaceInfo; diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/AshpHeatingInfo/index.js index 30d3c6ba..63c4701a 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/AshpHeatingInfo/index.js @@ -6,7 +6,39 @@ import { Table, Input } from 'reactstrap'; class AshpHeatingInfo extends Component { constructor(props) { super(props); - this.state = {}; + this.state = { + form: { + heatingSystem: props.heatingSystem, + heatingFuelSource: props.heatingFuelSource, + DHWSameBoiler: props.DHWSameBoiler, + AgeOfHeatGenerateSystem: props.AgeOfHeatGenerateSystem, + planToReplaceHS: props.planToReplaceHS, + hallwaysHeated: props.hallwaysHeated, + basementHeated: props.basementHeated, + stairwellsHeated: props.stairwellsHeated, + floorsHeated: props.floorsHeated, + accessibleByStairwell: props.accessibleByStairwell, + backFacadeAttached: props.backFacadeAttached, + exteriorWallsAttached: props.exteriorWallsAttached, + tenantComplaintsComfort: props.tenantComplaintsComfort, + tenantComplaintsWindows: props.tenantComplaintsWindows, + meteredForElectricity: props.meteredForElectricity, + }, + }; + } + + handleInputChange = (event) => { + const val = event.target.value; + const name = event.target.name; + this.setState({ + form: { + ...this.state.form, + [name]: val, + }, + }, () => { + this.props.onChangeEvent('remoteSurvey', this.state.form); + console.log('changed!'); // eslint-disable-line + }); } render() { @@ -30,7 +62,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -47,7 +80,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -66,7 +100,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -81,7 +116,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -100,7 +136,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -129,7 +166,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -148,7 +186,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -175,7 +214,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -194,7 +234,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -216,7 +257,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -232,7 +274,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -250,7 +293,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -266,7 +310,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -284,7 +329,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -301,7 +347,8 @@ class AshpHeatingInfo extends Component { this.handleInputChange(e)} > @@ -323,21 +370,22 @@ class AshpHeatingInfo extends Component { AshpHeatingInfo.propTypes = { tableHeader: PropTypes.objectOf, labelStyle: PropTypes.objectOf, - heatingSystem: PropTypes.number, - heatingFuelSource: PropTypes.number, - DHWSameBoiler: PropTypes.number, - planToReplaceHS: PropTypes.number, - hallwaysHeated: PropTypes.number, - basementHeated: PropTypes.number, - stairwellsHeated: PropTypes.number, - floorsHeated: PropTypes.number, - accessibleByStairwell: PropTypes.number, - backFacadeAttached: PropTypes.number, - exteriorWallsAttached: PropTypes.number, - tenantComplaintsWindows: PropTypes.number, - tenantComplaintsComfort: PropTypes.number, - meteredForElectricity: PropTypes.number, - AgeOfHeatGenerateSystem: PropTypes.number, + heatingSystem: PropTypes.string, + heatingFuelSource: PropTypes.string, + DHWSameBoiler: PropTypes.string, + planToReplaceHS: PropTypes.string, + hallwaysHeated: PropTypes.string, + basementHeated: PropTypes.string, + stairwellsHeated: PropTypes.string, + floorsHeated: PropTypes.string, + accessibleByStairwell: PropTypes.string, + backFacadeAttached: PropTypes.string, + exteriorWallsAttached: PropTypes.string, + tenantComplaintsWindows: PropTypes.string, + tenantComplaintsComfort: PropTypes.string, + meteredForElectricity: PropTypes.string, + AgeOfHeatGenerateSystem: PropTypes.string, + onChangeEvent: PropTypes.func, }; export default AshpHeatingInfo; diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js index 98d6e3b2..43edd4b7 100644 --- a/src/containers/AshpQuestionaire/index.js +++ b/src/containers/AshpQuestionaire/index.js @@ -12,10 +12,17 @@ class AshpQuestionaire extends Component { super(props); console.log(props.building); // eslint-disable-line this.state = { - test: '', + buildingInfo: {}, + remoteSurvey: {}, + financialInitials: {}, }; } + onChangeEvent = (formType, formData) => { + console.log(formType); // eslint-disable-line + console.log(formData); // eslint-disable-line + } + render() { const tableHeader = { paddingBottom: '20px', @@ -32,6 +39,46 @@ class AshpQuestionaire extends Component { color: '#999999', }; + const buildingInfo = { + firstName: 'Bryan', + lastName: 'Ontiveros', + email: 'bryan@blocpower.io', + phone: '911-911-9911', + studio: 1, + oneBedroom: 3, + twoBedroom: 2, + threeBedroom: 1, + fourBedroom: 0, + other: ' ', + numberOfOther: 0, + }; + + const remoteSurvey = { + heatingSystem: 'steam', + heatingFuelSource: 'heating oil', + DHWSameBoiler: 'yes', + AgeOfHeatGenerateSystem: '0-3 years', + planToReplaceHS: 'asap', + hallwaysHeated: 'yes', + basementHeated: 'yes', + stairwellsHeated: 'yes', + floorsHeated: 'yes', + accessibleByStairwell: 'yes', + backFacadeAttached: 'yes', + exteriorWallsAttached: 'no', + tenantComplaintsComfort: 'no', + tenantComplaintsWindows: 'no', + meteredForElectricity: 'no', + }; + + const financialInitials = { + bankruptyPast: 'yes', + currentOnEnergyBills: 'current', + currentMortgageBalance: '0%', + profitable: 'always', + budgetForDownPayment: 'no cash', + }; + const mainContent = (
    @@ -41,17 +88,18 @@ class AshpQuestionaire extends Component { labelStyle={labelStyle} address={this.props.building.street_address} borough={this.props.building.borough} - firstName={'Bryan'} - lastName={'Ontiveros'} - email={'bryan@blocpower.io'} - phone={'911-911-9911'} - studio={1} - oneBedroom={3} - twoBedroom={2} - threeBedroom={1} - fourBedroom={0} - other={' '} - numberOfOther={0} + firstName={buildingInfo.firstName} + lastName={buildingInfo.lastName} + email={buildingInfo.email} + phone={buildingInfo.phone} + studio={buildingInfo.studio} + oneBedroom={buildingInfo.oneBedroom} + twoBedroom={buildingInfo.twoBedroom} + threeBedroom={buildingInfo.threeBedroom} + fourBedroom={buildingInfo.fourBedroom} + other={buildingInfo.other} + numberOfOther={buildingInfo.numberOfOther} + onChangeEvent={this.onChangeEvent} />
    @@ -60,21 +108,22 @@ class AshpQuestionaire extends Component { @@ -83,11 +132,12 @@ class AshpQuestionaire extends Component { -- GitLab From e4e1b820500750c6e326d3ca7c5767aa991efdd6 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Mon, 12 Aug 2019 14:39:19 -0400 Subject: [PATCH 22/35] Fix input dropdown issues --- .../AshpBuildingInfo/ApartmentTypeDropdown.js | 76 +++++++------ .../AshpBuildingInfo/ApartmentTypeInput.js | 44 -------- src/components/AshpBuildingInfo/index.js | 101 +++++++++++------- src/components/AshpFinanceInfo/index.js | 10 +- src/containers/AshpQuestionaire/index.js | 24 ++--- 5 files changed, 123 insertions(+), 132 deletions(-) delete mode 100644 src/components/AshpBuildingInfo/ApartmentTypeInput.js diff --git a/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js b/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js index 13943078..564bc513 100644 --- a/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js +++ b/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js @@ -1,50 +1,56 @@ -import React from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Input, } from 'reactstrap'; -const ApartmentTypeDropdown = (props) => { +class ApartmentTypeDropdown extends Component { + constructor(props) { + super(props); + this.state = { + numOfApartment: props.numOfApartment, + }; + } - // handleInputChange = (event) => { - // const val = event.target.value; - // const name = event.target.name; - // this.setState({ - // form: { - // ...this.state.form, - // [name]: val, - // }, - // }, () => { - // this.props.onChangeEvent(this.state.form); - // console.log('changed!'); // eslint-disable-line - // }); - // }; + handleInputChange = (event) => { + const val = event.target.value; + // const name = event.target.name; + this.setState({ + numOfApartment: val, + }, () => { + this.props.onChange(this.props.inputName, this.state.numOfApartment); + console.log('changed!'); // eslint-disable-line + }); + } - return ( -
    -
    - this.handleInputChange(e)} - > - - - - - - - + render() { + return ( +
    +
    + this.handleInputChange(e)} + > + + + + + + + +
    -
    - ); -}; + ); + } +} ApartmentTypeDropdown.propTypes = { - typeOfApartment: PropTypes.string, + inputName: PropTypes.string, numOfApartment: PropTypes.number, + onChange: PropTypes.func, }; export default ApartmentTypeDropdown; diff --git a/src/components/AshpBuildingInfo/ApartmentTypeInput.js b/src/components/AshpBuildingInfo/ApartmentTypeInput.js deleted file mode 100644 index 6edfa293..00000000 --- a/src/components/AshpBuildingInfo/ApartmentTypeInput.js +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { - Input, -} from 'reactstrap'; - - -const ApartmentTypeInput = (props) => { - return ( -
    -
    - this.handleInputChange(e)} - placeholder={props.placeholder} - /> -
    -
    - - - - - - - - - -
    -
    - ); -}; - -ApartmentTypeInput.propTypes = { - name: PropTypes.string, - typeOfApartment: PropTypes.string, - numOfApartment: PropTypes.number, - placeholder: PropTypes.string, -}; - -export default ApartmentTypeInput; diff --git a/src/components/AshpBuildingInfo/index.js b/src/components/AshpBuildingInfo/index.js index 033b274a..d4520de9 100644 --- a/src/components/AshpBuildingInfo/index.js +++ b/src/components/AshpBuildingInfo/index.js @@ -2,7 +2,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Table, Input } from 'reactstrap'; import ApartmentTypeDropdown from './ApartmentTypeDropdown'; -import ApartmentTypeInput from './ApartmentTypeInput'; class AshpBuildingInfo extends Component { @@ -10,18 +9,17 @@ class AshpBuildingInfo extends Component { super(props); this.state = { form: { - id: props.id, firstName: props.firstName, lastName: props.lastName, email: props.email, phone: props.phone, - studio: props.studio, - oneBedroom: props.oneBedroom, - twoBedroom: props.twoBedroom, - threeBedroom: props.threeBedroom, - fourBedroom: props.fourBedroom, + numOfStudio: props.numOfStudio, + numOfOneBedroom: props.numOfOneBedroom, + numOfTwoBedroom: props.numOfTwoBedroom, + numOfThreeBedroom: props.numOfThreeBedroom, + numOfFourBedroom: props.numOfFourBedroom, other: props.other, - numberOfOther: props.numberOfOther, + numOfOther: props.numOfOther, }, }; } @@ -40,6 +38,18 @@ class AshpBuildingInfo extends Component { }); } + handleInputChangeSubComponent = (name, val) => { + this.setState({ + form: { + ...this.state.form, + [name]: val, + }, + }, () => { + this.props.onChangeEvent('buildingInfo', this.state.form); + console.log('changed!'); // eslint-disable-line + }); + } + render() { return (
    @@ -121,9 +131,9 @@ class AshpBuildingInfo extends Component {
    this.handleInputChange(e)} + inputName={'numOfStudio'} + numOfApartment={this.state.form.numOfStudio} + onChange={this.handleInputChangeSubComponent} />
    @@ -148,9 +158,9 @@ class AshpBuildingInfo extends Component { this.handleInputChange(e)} + inputName={'numOfTwoBedroom'} + numOfApartment={this.state.form.numOfTwoBedroom} + onChange={this.handleInputChangeSubComponent} /> @@ -175,21 +185,41 @@ class AshpBuildingInfo extends Component { this.handleInputChange(e)} + inputName={'numOfFourBedroom'} + numOfApartment={this.state.form.numOfFourBedroom} + onChange={this.handleInputChangeSubComponent} />
    - Remote Survey Fields + Remote Survey
    @@ -50,11 +50,11 @@ class AshpHeatingInfo extends Component { value={this.props.heatingFuelSource} > - - - - - + + + + +
    @@ -84,11 +84,11 @@ class AshpHeatingInfo extends Component { value={this.props.AgeOfHeatGenerateSystem} > - - - - - + + + + +
    @@ -132,9 +132,9 @@ class AshpHeatingInfo extends Component { value={this.props.hallwaysHeated} > - - - + + + @@ -151,9 +151,9 @@ class AshpHeatingInfo extends Component { value={this.props.basementHeated} > - - - + + + @@ -178,9 +178,9 @@ class AshpHeatingInfo extends Component { value={this.props.stairwellsHeated} > - - - + + + @@ -197,9 +197,9 @@ class AshpHeatingInfo extends Component { value={this.props.floorsHeated} > - - - + + + -- GitLab From 6b0d2a3e085e65bf61925edf236f58933970ccc4 Mon Sep 17 00:00:00 2001 From: bontiveros Date: Mon, 12 Aug 2019 11:53:56 -0400 Subject: [PATCH 20/35] Progress on dropdowns --- src/components/AshpFinanceInfo/index.js | 38 +++++++++++----------- src/components/AshpHeatingInfo/index.js | 42 ++++++++++++------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/components/AshpFinanceInfo/index.js b/src/components/AshpFinanceInfo/index.js index 5d009a84..b9e20f31 100644 --- a/src/components/AshpFinanceInfo/index.js +++ b/src/components/AshpFinanceInfo/index.js @@ -35,9 +35,9 @@ class AshpFinanaceInfo extends Component { value={this.props.bankruptyPast} > - - - + + + @@ -50,12 +50,12 @@ class AshpFinanaceInfo extends Component { value={this.props.currentOnEnergyBills} > - - - - - - + + + + + +
    @@ -87,9 +87,9 @@ class AshpFinanaceInfo extends Component { value={this.props.profitable} > - - - + + +
    diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/AshpHeatingInfo/index.js index 81708c76..30d3c6ba 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/AshpHeatingInfo/index.js @@ -219,9 +219,9 @@ class AshpHeatingInfo extends Component { value={this.props.accessibleByStairwell} > - - - + + + @@ -235,9 +235,9 @@ class AshpHeatingInfo extends Component { value={this.props.backFacadeAttached} > - - - + + +
    @@ -269,10 +269,10 @@ class AshpHeatingInfo extends Component { value={this.props.tenantComplaintsComfort} > - - - - + + + +
    @@ -304,9 +304,9 @@ class AshpHeatingInfo extends Component { value={this.props.meteredForElectricity} > - - - + + +
    this.handleInputChange(e)} />
    @@ -128,7 +133,8 @@ class AshpBuildingInfo extends Component { this.handleInputChange(e)} />
    @@ -153,7 +160,8 @@ class AshpBuildingInfo extends Component { this.handleInputChange(e)} />
    @@ -178,7 +187,8 @@ class AshpBuildingInfo extends Component { this.handleInputChange(e)} />
    @@ -132,9 +142,9 @@ class AshpBuildingInfo extends Component { this.handleInputChange(e)} + inputName={'numOfOneBedroom'} + numOfApartment={this.state.form.numOfOneBedroom} + onChange={this.handleInputChangeSubComponent} />
    @@ -159,9 +169,9 @@ class AshpBuildingInfo extends Component { this.handleInputChange(e)} + inputName={'numOfThreeBedroom'} + numOfApartment={this.state.form.numOfThreeBedroom} + onChange={this.handleInputChangeSubComponent} />
    Other
    - this.handleInputChange(e)} - /> +
    +
    + this.handleInputChange(e)} + /> +
    +
    + this.handleInputChange(e)} + > + + + + + + + + +
    +
    @@ -207,18 +237,17 @@ AshpBuildingInfo.propTypes = { labelStyle: PropTypes.objectOf, address: PropTypes.string, borough: PropTypes.string, - id: PropTypes.number, firstName: PropTypes.string, lastName: PropTypes.string, email: PropTypes.string, phone: PropTypes.string, - studio: PropTypes.number, - oneBedroom: PropTypes.number, - twoBedroom: PropTypes.number, - threeBedroom: PropTypes.number, - fourBedroom: PropTypes.number, + numOfStudio: PropTypes.number, + numOfOneBedroom: PropTypes.number, + numOfTwoBedroom: PropTypes.number, + numOfThreeBedroom: PropTypes.number, + numOfFourBedroom: PropTypes.number, other: PropTypes.string, - numberOfOther: PropTypes.number, + numOfOther: PropTypes.number, onChangeEvent: PropTypes.func, }; diff --git a/src/components/AshpFinanceInfo/index.js b/src/components/AshpFinanceInfo/index.js index 1631721a..ff0dc3cd 100644 --- a/src/components/AshpFinanceInfo/index.js +++ b/src/components/AshpFinanceInfo/index.js @@ -154,11 +154,11 @@ class AshpFinanaceInfo extends Component { AshpFinanaceInfo.propTypes = { tableHeader: PropTypes.objectOf, - bankruptyPast: PropTypes.number, - currentOnEnergyBills: PropTypes.number, - currentMortgageBalance: PropTypes.number, - profitable: PropTypes.number, - budgetForDownPayment: PropTypes.number, + bankruptyPast: PropTypes.string, + currentOnEnergyBills: PropTypes.string, + currentMortgageBalance: PropTypes.string, + profitable: PropTypes.string, + budgetForDownPayment: PropTypes.string, onChangeEvent: PropTypes.func, }; diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js index 43edd4b7..997577ca 100644 --- a/src/containers/AshpQuestionaire/index.js +++ b/src/containers/AshpQuestionaire/index.js @@ -44,13 +44,13 @@ class AshpQuestionaire extends Component { lastName: 'Ontiveros', email: 'bryan@blocpower.io', phone: '911-911-9911', - studio: 1, - oneBedroom: 3, - twoBedroom: 2, - threeBedroom: 1, - fourBedroom: 0, + numOfStudio: 1, + numOfOneBedroom: 3, + numOfTwoBedroom: 2, + numOfThreeBedroom: 1, + numOfFourBedroom: 0, other: ' ', - numberOfOther: 0, + numOfOther: 0, }; const remoteSurvey = { @@ -92,13 +92,13 @@ class AshpQuestionaire extends Component { lastName={buildingInfo.lastName} email={buildingInfo.email} phone={buildingInfo.phone} - studio={buildingInfo.studio} - oneBedroom={buildingInfo.oneBedroom} - twoBedroom={buildingInfo.twoBedroom} - threeBedroom={buildingInfo.threeBedroom} - fourBedroom={buildingInfo.fourBedroom} + numOfStudio={buildingInfo.numOfStudio} + numOfOneBedroom={buildingInfo.numOfOneBedroom} + numOfTwoBedroom={buildingInfo.numOfTwoBedroom} + numOfThreeBedroom={buildingInfo.numOfThreeBedroom} + numOfFourBedroom={buildingInfo.numOfFourBedroom} other={buildingInfo.other} - numberOfOther={buildingInfo.numberOfOther} + numOfOther={buildingInfo.numOfOther} onChangeEvent={this.onChangeEvent} />
    -- GitLab From 2f04d973325a4fbb81847431ed041677d45f6dac Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Mon, 12 Aug 2019 14:59:21 -0400 Subject: [PATCH 23/35] Move variables to state --- src/containers/AshpQuestionaire/index.js | 151 +++++++++++------------ 1 file changed, 74 insertions(+), 77 deletions(-) diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js index 997577ca..e492a1a5 100644 --- a/src/containers/AshpQuestionaire/index.js +++ b/src/containers/AshpQuestionaire/index.js @@ -10,17 +10,54 @@ import AshpHeatingInfo from '../../components/AshpHeatingInfo'; class AshpQuestionaire extends Component { constructor(props) { super(props); - console.log(props.building); // eslint-disable-line this.state = { - buildingInfo: {}, - remoteSurvey: {}, - financialInitials: {}, + buildingInfo: { + firstName: 'Bryan', + lastName: 'Ontiveros', + email: 'bryan@blocpower.io', + phone: '911-911-9911', + numOfStudio: 1, + numOfOneBedroom: 3, + numOfTwoBedroom: 2, + numOfThreeBedroom: 1, + numOfFourBedroom: 0, + other: ' ', + numOfOther: 0, + }, + remoteSurvey: { + heatingSystem: 'steam', + heatingFuelSource: 'heating oil', + DHWSameBoiler: 'yes', + AgeOfHeatGenerateSystem: '0-3 years', + planToReplaceHS: 'asap', + hallwaysHeated: 'yes', + basementHeated: 'yes', + stairwellsHeated: 'yes', + floorsHeated: 'yes', + accessibleByStairwell: 'yes', + backFacadeAttached: 'yes', + exteriorWallsAttached: 'no', + tenantComplaintsComfort: 'no', + tenantComplaintsWindows: 'no', + meteredForElectricity: 'no', + }, + financialInitials: { + bankruptyPast: 'yes', + currentOnEnergyBills: 'current', + currentMortgageBalance: '0%', + profitable: 'always', + budgetForDownPayment: 'no cash', + }, }; } onChangeEvent = (formType, formData) => { - console.log(formType); // eslint-disable-line - console.log(formData); // eslint-disable-line + this.setState({ + ...this.state, + [formType]: formData, + }, () => { + console.log(this.state[formType]); // eslint-disable-line + }); } render() { @@ -39,46 +76,6 @@ class AshpQuestionaire extends Component { color: '#999999', }; - const buildingInfo = { - firstName: 'Bryan', - lastName: 'Ontiveros', - email: 'bryan@blocpower.io', - phone: '911-911-9911', - numOfStudio: 1, - numOfOneBedroom: 3, - numOfTwoBedroom: 2, - numOfThreeBedroom: 1, - numOfFourBedroom: 0, - other: ' ', - numOfOther: 0, - }; - - const remoteSurvey = { - heatingSystem: 'steam', - heatingFuelSource: 'heating oil', - DHWSameBoiler: 'yes', - AgeOfHeatGenerateSystem: '0-3 years', - planToReplaceHS: 'asap', - hallwaysHeated: 'yes', - basementHeated: 'yes', - stairwellsHeated: 'yes', - floorsHeated: 'yes', - accessibleByStairwell: 'yes', - backFacadeAttached: 'yes', - exteriorWallsAttached: 'no', - tenantComplaintsComfort: 'no', - tenantComplaintsWindows: 'no', - meteredForElectricity: 'no', - }; - - const financialInitials = { - bankruptyPast: 'yes', - currentOnEnergyBills: 'current', - currentMortgageBalance: '0%', - profitable: 'always', - budgetForDownPayment: 'no cash', - }; - const mainContent = (
    @@ -88,17 +85,17 @@ class AshpQuestionaire extends Component { labelStyle={labelStyle} address={this.props.building.street_address} borough={this.props.building.borough} - firstName={buildingInfo.firstName} - lastName={buildingInfo.lastName} - email={buildingInfo.email} - phone={buildingInfo.phone} - numOfStudio={buildingInfo.numOfStudio} - numOfOneBedroom={buildingInfo.numOfOneBedroom} - numOfTwoBedroom={buildingInfo.numOfTwoBedroom} - numOfThreeBedroom={buildingInfo.numOfThreeBedroom} - numOfFourBedroom={buildingInfo.numOfFourBedroom} - other={buildingInfo.other} - numOfOther={buildingInfo.numOfOther} + firstName={this.state.buildingInfo.firstName} + lastName={this.state.buildingInfo.lastName} + email={this.state.buildingInfo.email} + phone={this.state.buildingInfo.phone} + numOfStudio={this.state.buildingInfo.numOfStudio} + numOfOneBedroom={this.state.buildingInfo.numOfOneBedroom} + numOfTwoBedroom={this.state.buildingInfo.numOfTwoBedroom} + numOfThreeBedroom={this.state.buildingInfo.numOfThreeBedroom} + numOfFourBedroom={this.state.buildingInfo.numOfFourBedroom} + other={this.state.buildingInfo.other} + numOfOther={this.state.buildingInfo.numOfOther} onChangeEvent={this.onChangeEvent} />
    @@ -108,21 +105,21 @@ class AshpQuestionaire extends Component {
    @@ -132,11 +129,11 @@ class AshpQuestionaire extends Component {
    -- GitLab From 1512c20bd717baed2ec1b08ee9360271939c8c12 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Mon, 12 Aug 2019 15:41:25 -0400 Subject: [PATCH 24/35] Add validation for form inputs --- src/containers/AshpQuestionaire/index.js | 33 +++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js index e492a1a5..3511fc83 100644 --- a/src/containers/AshpQuestionaire/index.js +++ b/src/containers/AshpQuestionaire/index.js @@ -10,6 +10,10 @@ import AshpHeatingInfo from '../../components/AshpHeatingInfo'; class AshpQuestionaire extends Component { constructor(props) { super(props); + this.nameMapping = { + heatingSystem: 'heating System', + heatingFuelSource: 'heating Fuel Source', + }; this.state = { buildingInfo: { firstName: 'Bryan', @@ -60,6 +64,30 @@ class AshpQuestionaire extends Component { }); } + submitQuestionnaire = () => { + if (this.validateInputs()) { + console.log('Saving answers!'); // eslint-disable-line + } + return false; + } + + validateInputs() { + const emptyFields = []; + Object.entries(this.state).forEach(formData => { + Object.entries(formData[1]).forEach(fieldData => { + if (fieldData[1] === '-1') { + emptyFields.push(this.nameMapping[fieldData[0]]); + } + }); + }); + + if (emptyFields.length > 0) { + alert(`Please fill in ${emptyFields.join(', ')} field(s)`); + return false; + } + return true; + } + render() { const tableHeader = { paddingBottom: '20px', @@ -140,7 +168,10 @@ class AshpQuestionaire extends Component {
    - {' '} -- GitLab From 307e98e406cdf17758cff226a75aeb9d63b6bf3a Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Mon, 12 Aug 2019 16:09:30 -0400 Subject: [PATCH 25/35] Add button events --- src/containers/AshpQuestionaire/index.js | 81 ++++++++++++++++++++---- 1 file changed, 67 insertions(+), 14 deletions(-) diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js index 3511fc83..80930cab 100644 --- a/src/containers/AshpQuestionaire/index.js +++ b/src/containers/AshpQuestionaire/index.js @@ -52,6 +52,8 @@ class AshpQuestionaire extends Component { profitable: 'always', budgetForDownPayment: 'no cash', }, + submitted: false, + calculated: false, }; } @@ -66,19 +68,42 @@ class AshpQuestionaire extends Component { submitQuestionnaire = () => { if (this.validateInputs()) { - console.log('Saving answers!'); // eslint-disable-line + this.setState({ + submitted: true, + }, () => { + console.log('Saving answers!'); // eslint-disable-line + }); } return false; } + calculate = () => { + this.setState({ + submitted: false, + calculated: true, + }, () => { + console.log('Calculated!'); // eslint-disable-line + }); + } + + downloadReport = () => { + this.setState({ + calculated: false, + }, () => { + console.log('Dowmloaded!'); // eslint-disable-line + }); + } + validateInputs() { const emptyFields = []; Object.entries(this.state).forEach(formData => { - Object.entries(formData[1]).forEach(fieldData => { - if (fieldData[1] === '-1') { - emptyFields.push(this.nameMapping[fieldData[0]]); - } - }); + if (['buildingInfo', 'remoteSurvey', 'financialInitials'].includes(formData[0])) { + Object.entries(formData[1]).forEach(fieldData => { + if (fieldData[1] === '-1') { + emptyFields.push(this.nameMapping[fieldData[0]]); + } + }); + } }); if (emptyFields.length > 0) { @@ -104,6 +129,40 @@ class AshpQuestionaire extends Component { color: '#999999', }; + let calculateButton = null; + if (this.state.submitted === true) { + calculateButton = ( + + {' '} + + + ); + } else { + calculateButton = null; + } + + let downloadButton = null; + if (this.state.calculated === true) { + downloadButton = ( + + {' '} + + + ); + } else { + downloadButton = null; + } + const mainContent = (
    @@ -174,14 +233,8 @@ class AshpQuestionaire extends Component { > Submit - {' '} - {/* - {' '} - */} + {calculateButton} + {downloadButton}
    -- GitLab From 70be31e42a812613fbd6896a85c051f3e1fa1a4a Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Mon, 12 Aug 2019 16:32:14 -0400 Subject: [PATCH 26/35] Add validation mappings --- src/containers/AshpQuestionaire/index.js | 29 ++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js index 80930cab..77445e82 100644 --- a/src/containers/AshpQuestionaire/index.js +++ b/src/containers/AshpQuestionaire/index.js @@ -11,8 +11,30 @@ class AshpQuestionaire extends Component { constructor(props) { super(props); this.nameMapping = { - heatingSystem: 'heating System', - heatingFuelSource: 'heating Fuel Source', + firstName: 'First name', + lastName: 'Last name', + email: 'Email', + phone: 'Phone number', + heatingSystem: 'Heating System', + heatingFuelSource: 'Heating Fuel Source', + DHWSameBoiler: 'Domestic Hot Water', + AgeOfHeatGenerateSystem: 'Age of heat generating system', + planToReplaceHS: 'Plan to replace the heating system', + hallwaysHeated: 'Heated hallways', + basementHeated: 'Heated basement', + stairwellsHeated: 'Heated stairwells', + floorsHeated: 'Heated floors', + accessibleByStairwell: 'Stairwell accessibility', + backFacadeAttached: 'Back facade', + exteriorWallsAttached: 'Attached exterior walls', + tenantComplaintsComfort: 'Tenant temperature complaints', + tenantComplaintsWindows: 'Tenant window draft complaints', + meteredForElectricity: 'ConEd Electricity Meter', + bankruptyPast: 'Past bankruptcy', + currentOnEnergyBills: 'Energy bills status', + currentMortgageBalance: 'Outstanding mortgage balance', + profitable: 'Building profit', + budgetForDownPayment: 'Down payment budget', }; this.state = { buildingInfo: { @@ -99,6 +121,9 @@ class AshpQuestionaire extends Component { Object.entries(this.state).forEach(formData => { if (['buildingInfo', 'remoteSurvey', 'financialInitials'].includes(formData[0])) { Object.entries(formData[1]).forEach(fieldData => { + if (fieldData[0] !== 'other' && fieldData[1].toString().replace(/^\s+|\s+$/g, '') === '') { + emptyFields.push(this.nameMapping[fieldData[0]]); + } if (fieldData[1] === '-1') { emptyFields.push(this.nameMapping[fieldData[0]]); } -- GitLab From e8e665649c2e61ca4f44bc915df474d88de77716 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Mon, 12 Aug 2019 17:59:54 -0400 Subject: [PATCH 27/35] Add redux code --- src/components/AshpBuildingInfo/index.js | 2 +- src/containers/AshpQuestionaire/index.js | 288 ----------------------- src/reducers.js | 2 + src/routes.js | 2 +- src/sagas.js | 2 + 5 files changed, 6 insertions(+), 290 deletions(-) delete mode 100644 src/containers/AshpQuestionaire/index.js diff --git a/src/components/AshpBuildingInfo/index.js b/src/components/AshpBuildingInfo/index.js index d4520de9..6a792532 100644 --- a/src/components/AshpBuildingInfo/index.js +++ b/src/components/AshpBuildingInfo/index.js @@ -205,7 +205,7 @@ class AshpBuildingInfo extends Component {
    this.handleInputChange(e)} diff --git a/src/containers/AshpQuestionaire/index.js b/src/containers/AshpQuestionaire/index.js deleted file mode 100644 index 77445e82..00000000 --- a/src/containers/AshpQuestionaire/index.js +++ /dev/null @@ -1,288 +0,0 @@ -import React, { Component } from 'react'; -import { Button } from 'reactstrap'; -import buildingDetailPropTypes from '../../containers/Building/propTypes'; -import LinkBarDetail from '../../components/LinkBarDetail'; -import AshpBuildingInfo from '../../components/AshpBuildingInfo'; -import AshpFinanceInfo from '../../components/AshpFinanceInfo'; -import AshpHeatingInfo from '../../components/AshpHeatingInfo'; - - -class AshpQuestionaire extends Component { - constructor(props) { - super(props); - this.nameMapping = { - firstName: 'First name', - lastName: 'Last name', - email: 'Email', - phone: 'Phone number', - heatingSystem: 'Heating System', - heatingFuelSource: 'Heating Fuel Source', - DHWSameBoiler: 'Domestic Hot Water', - AgeOfHeatGenerateSystem: 'Age of heat generating system', - planToReplaceHS: 'Plan to replace the heating system', - hallwaysHeated: 'Heated hallways', - basementHeated: 'Heated basement', - stairwellsHeated: 'Heated stairwells', - floorsHeated: 'Heated floors', - accessibleByStairwell: 'Stairwell accessibility', - backFacadeAttached: 'Back facade', - exteriorWallsAttached: 'Attached exterior walls', - tenantComplaintsComfort: 'Tenant temperature complaints', - tenantComplaintsWindows: 'Tenant window draft complaints', - meteredForElectricity: 'ConEd Electricity Meter', - bankruptyPast: 'Past bankruptcy', - currentOnEnergyBills: 'Energy bills status', - currentMortgageBalance: 'Outstanding mortgage balance', - profitable: 'Building profit', - budgetForDownPayment: 'Down payment budget', - }; - this.state = { - buildingInfo: { - firstName: 'Bryan', - lastName: 'Ontiveros', - email: 'bryan@blocpower.io', - phone: '911-911-9911', - numOfStudio: 1, - numOfOneBedroom: 3, - numOfTwoBedroom: 2, - numOfThreeBedroom: 1, - numOfFourBedroom: 0, - other: ' ', - numOfOther: 0, - }, - remoteSurvey: { - heatingSystem: 'steam', - heatingFuelSource: 'heating oil', - DHWSameBoiler: 'yes', - AgeOfHeatGenerateSystem: '0-3 years', - planToReplaceHS: 'asap', - hallwaysHeated: 'yes', - basementHeated: 'yes', - stairwellsHeated: 'yes', - floorsHeated: 'yes', - accessibleByStairwell: 'yes', - backFacadeAttached: 'yes', - exteriorWallsAttached: 'no', - tenantComplaintsComfort: 'no', - tenantComplaintsWindows: 'no', - meteredForElectricity: 'no', - }, - financialInitials: { - bankruptyPast: 'yes', - currentOnEnergyBills: 'current', - currentMortgageBalance: '0%', - profitable: 'always', - budgetForDownPayment: 'no cash', - }, - submitted: false, - calculated: false, - }; - } - - onChangeEvent = (formType, formData) => { - this.setState({ - ...this.state, - [formType]: formData, - }, () => { - console.log(this.state[formType]); // eslint-disable-line - }); - } - - submitQuestionnaire = () => { - if (this.validateInputs()) { - this.setState({ - submitted: true, - }, () => { - console.log('Saving answers!'); // eslint-disable-line - }); - } - return false; - } - - calculate = () => { - this.setState({ - submitted: false, - calculated: true, - }, () => { - console.log('Calculated!'); // eslint-disable-line - }); - } - - downloadReport = () => { - this.setState({ - calculated: false, - }, () => { - console.log('Dowmloaded!'); // eslint-disable-line - }); - } - - validateInputs() { - const emptyFields = []; - Object.entries(this.state).forEach(formData => { - if (['buildingInfo', 'remoteSurvey', 'financialInitials'].includes(formData[0])) { - Object.entries(formData[1]).forEach(fieldData => { - if (fieldData[0] !== 'other' && fieldData[1].toString().replace(/^\s+|\s+$/g, '') === '') { - emptyFields.push(this.nameMapping[fieldData[0]]); - } - if (fieldData[1] === '-1') { - emptyFields.push(this.nameMapping[fieldData[0]]); - } - }); - } - }); - - if (emptyFields.length > 0) { - alert(`Please fill in ${emptyFields.join(', ')} field(s)`); - return false; - } - return true; - } - - render() { - const tableHeader = { - paddingBottom: '20px', - borderTop: '1px solid #CCCCCC', - background: '#EEEEEE', - fontWeight: 'bold', - paddingTop: '20px', - }; - - const labelStyle = { - marginBottom: '0.7em', - fontWeight: 'bold', - fontSize: '12px', - color: '#999999', - }; - - let calculateButton = null; - if (this.state.submitted === true) { - calculateButton = ( - - {' '} - - - ); - } else { - calculateButton = null; - } - - let downloadButton = null; - if (this.state.calculated === true) { - downloadButton = ( - - {' '} - - - ); - } else { - downloadButton = null; - } - - const mainContent = ( -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - - {calculateButton} - {downloadButton} -
    -
    -
    - ); - - return ( -
    - - {mainContent} -
    - ); - } -} - -AshpQuestionaire.propTypes = { - building: buildingDetailPropTypes, -}; - -export default AshpQuestionaire; diff --git a/src/reducers.js b/src/reducers.js index 0044eac8..653b6a09 100644 --- a/src/reducers.js +++ b/src/reducers.js @@ -18,6 +18,7 @@ import weather from './containers/Weather/reducer'; import events from './containers/Event/reducer'; import blocnote from './containers/Blocnote/reducer'; import bloclink from './containers/Performance/reducer'; +import questionnaire from './containers/AshpQuestionnaire/reducer'; export default combineReducers({ @@ -39,4 +40,5 @@ export default combineReducers({ events, blocnote, bloclink, + questionnaire, }); diff --git a/src/routes.js b/src/routes.js index 2249fe1f..8da27851 100644 --- a/src/routes.js +++ b/src/routes.js @@ -32,7 +32,7 @@ import Wrapper from './containers/Wrapper'; import { BGroupOverview, BGroup } from './containers/BGroup'; import NavOnly from './screens/NavOnly/NavOnly'; import Admin from './containers/Admin/Admin'; -import AshpQuestionaire from './containers/AshpQuestionaire'; +import AshpQuestionaire from './containers/AshpQuestionnaire'; const auth = new Auth(); diff --git a/src/sagas.js b/src/sagas.js index 7d7ea267..c860241e 100644 --- a/src/sagas.js +++ b/src/sagas.js @@ -15,6 +15,7 @@ import weatherSaga from './containers/Weather/sagas'; import eventsSaga from './containers/Event/sagas'; import blocnoteSaga from './containers/Blocnote/sagas'; import performanceSaga from './containers/Performance/sagas'; +import questionnaireSaga from './containers/AshpQuestionnaire/sagas'; export default function* rootSaga() { @@ -36,5 +37,6 @@ export default function* rootSaga() { eventsSaga(), blocnoteSaga(), performanceSaga(), + questionnaireSaga(), ]; } -- GitLab From 2c03ce8e5a5a5fee8df78b5440370bad9eaddae3 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Mon, 12 Aug 2019 18:00:43 -0400 Subject: [PATCH 28/35] Update folder name --- src/containers/AshpQuestionnaire/actions.js | 33 ++ src/containers/AshpQuestionnaire/constants.js | 15 + src/containers/AshpQuestionnaire/index.js | 319 ++++++++++++++++++ src/containers/AshpQuestionnaire/reducer.js | 156 +++++++++ src/containers/AshpQuestionnaire/sagas.js | 70 ++++ 5 files changed, 593 insertions(+) create mode 100644 src/containers/AshpQuestionnaire/actions.js create mode 100644 src/containers/AshpQuestionnaire/constants.js create mode 100644 src/containers/AshpQuestionnaire/index.js create mode 100644 src/containers/AshpQuestionnaire/reducer.js create mode 100644 src/containers/AshpQuestionnaire/sagas.js diff --git a/src/containers/AshpQuestionnaire/actions.js b/src/containers/AshpQuestionnaire/actions.js new file mode 100644 index 00000000..85d322bc --- /dev/null +++ b/src/containers/AshpQuestionnaire/actions.js @@ -0,0 +1,33 @@ +import { + LOAD_QUESTIONNAIRE_REQUESTED, + LOAD_QUESTIONNAIRE_SUCCEEDED, + LOAD_QUESTIONNAIRE_FAILED, + SUBMIT_QUESTIONNAIRE_REQUESTED, + SUBMIT_QUESTIONNAIRE_SUCCEEDED, + SUBMIT_QUESTIONNAIRE_FAILED, + CALCULATE_COST_REQUESTED, + CALCULATE_COST_SUCCEEDED, + CALCULATE_COST_FAILED, + DOWNLOAD_REPORT_REQUESTED, + DOWNLOAD_REPORT_SUCCEEDED, + DOWNLOAD_REPORT_FAILED, +} from './constants'; + +import { makeActionCreator } from '../../utils/reduxHelpers'; + + +export const loadQuestionnaire = makeActionCreator(LOAD_QUESTIONNAIRE_REQUESTED, 'buildingId'); +export const loadQuestionnaireSucceeded = makeActionCreator(LOAD_QUESTIONNAIRE_SUCCEEDED, 'questionnaire'); +export const loadQuestionnaireLFailed = makeActionCreator(LOAD_QUESTIONNAIRE_FAILED, 'error'); + +export const submitQuestionnaire = makeActionCreator(SUBMIT_QUESTIONNAIRE_REQUESTED, 'buildingId'); +export const submitQuestionnaireSucceeded = makeActionCreator(SUBMIT_QUESTIONNAIRE_SUCCEEDED, 'questionnaire'); +export const submitQuestionnaireFailed = makeActionCreator(SUBMIT_QUESTIONNAIRE_FAILED, 'error'); + +export const calculateCost = makeActionCreator(CALCULATE_COST_REQUESTED, 'buildingId', 'id'); +export const calculateCostSucceeded = makeActionCreator(CALCULATE_COST_SUCCEEDED, 'id'); +export const calculateCostFailed = makeActionCreator(CALCULATE_COST_FAILED, 'id', 'error'); + +export const downloadReport = makeActionCreator(DOWNLOAD_REPORT_REQUESTED, 'buildingId'); +export const downloadReportSucceeded = makeActionCreator(DOWNLOAD_REPORT_SUCCEEDED, 'payload'); +export const downloadReportFailed = makeActionCreator(DOWNLOAD_REPORT_FAILED, 'error'); diff --git a/src/containers/AshpQuestionnaire/constants.js b/src/containers/AshpQuestionnaire/constants.js new file mode 100644 index 00000000..1f1286de --- /dev/null +++ b/src/containers/AshpQuestionnaire/constants.js @@ -0,0 +1,15 @@ +export const LOAD_QUESTIONNAIRE_REQUESTED = 'LOAD_QUESTIONNAIRE_REQUESTED'; +export const LOAD_QUESTIONNAIRE_SUCCEEDED = 'LOAD_QUESTIONNAIRE_SUCCEEDED'; +export const LOAD_QUESTIONNAIRE_FAILED = 'LOAD_QUESTIONNAIRE_FAILED'; + +export const SUBMIT_QUESTIONNAIRE_REQUESTED = 'SUBMIT_QUESTIONNAIRE_REQUESTED'; +export const SUBMIT_QUESTIONNAIRE_SUCCEEDED = 'SUBMIT_QUESTIONNAIRE_SUCCEEDED'; +export const SUBMIT_QUESTIONNAIRE_FAILED = 'SUBMIT_QUESTIONNAIRE_FAILED'; + +export const CALCULATE_COST_REQUESTED = 'CALCULATE_COST_REQUESTED'; +export const CALCULATE_COST_SUCCEEDED = 'CALCULATE_COST_SUCCEEDED'; +export const CALCULATE_COST_FAILED = 'CALCULATE_COST_FAILED'; + +export const DOWNLOAD_REPORT_REQUESTED = 'DOWNLOAD_REPORT_REQUESTED'; +export const DOWNLOAD_REPORT_SUCCEEDED = 'DOWNLOAD_REPORT_SUCCEEDED'; +export const DOWNLOAD_REPORT_FAILED = 'DOWNLOAD_REPORT_FAILED'; diff --git a/src/containers/AshpQuestionnaire/index.js b/src/containers/AshpQuestionnaire/index.js new file mode 100644 index 00000000..17fd4dad --- /dev/null +++ b/src/containers/AshpQuestionnaire/index.js @@ -0,0 +1,319 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { connect } from 'react-redux'; +import { bindActionCreators } from 'redux'; +import { Button } from 'reactstrap'; +// import Loading from '../../components/Loading'; +import buildingDetailPropTypes from '../Building/propTypes'; +import { + loadQuestionnaire, + submitQuestionnaire, + calculateCost, + downloadReport, +} from './actions'; +import LinkBarDetail from '../../components/LinkBarDetail'; +import AshpBuildingInfo from '../../components/AshpBuildingInfo'; +import AshpFinanceInfo from '../../components/AshpFinanceInfo'; +import AshpHeatingInfo from '../../components/AshpHeatingInfo'; + + +class AshpQuestionaire extends Component { + constructor(props) { + super(props); + this.nameMapping = { + firstName: 'First name', + lastName: 'Last name', + email: 'Email', + phone: 'Phone number', + heatingSystem: 'Heating System', + heatingFuelSource: 'Heating Fuel Source', + DHWSameBoiler: 'Domestic Hot Water', + AgeOfHeatGenerateSystem: 'Age of heat generating system', + planToReplaceHS: 'Plan to replace the heating system', + hallwaysHeated: 'Heated hallways', + basementHeated: 'Heated basement', + stairwellsHeated: 'Heated stairwells', + floorsHeated: 'Heated floors', + accessibleByStairwell: 'Stairwell accessibility', + backFacadeAttached: 'Back facade', + exteriorWallsAttached: 'Attached exterior walls', + tenantComplaintsComfort: 'Tenant temperature complaints', + tenantComplaintsWindows: 'Tenant window draft complaints', + meteredForElectricity: 'ConEd Electricity Meter', + bankruptyPast: 'Past bankruptcy', + currentOnEnergyBills: 'Energy bills status', + currentMortgageBalance: 'Outstanding mortgage balance', + profitable: 'Building profit', + budgetForDownPayment: 'Down payment budget', + }; + this.state = { + buildingInfo: { + firstName: 'Bryan', + lastName: 'Ontiveros', + email: 'bryan@blocpower.io', + phone: '911-911-9911', + numOfStudio: 1, + numOfOneBedroom: 3, + numOfTwoBedroom: 2, + numOfThreeBedroom: 1, + numOfFourBedroom: 0, + other: ' ', + numOfOther: 0, + }, + remoteSurvey: { + heatingSystem: 'steam', + heatingFuelSource: 'heating oil', + DHWSameBoiler: 'yes', + AgeOfHeatGenerateSystem: '0-3 years', + planToReplaceHS: 'asap', + hallwaysHeated: 'yes', + basementHeated: 'yes', + stairwellsHeated: 'yes', + floorsHeated: 'yes', + accessibleByStairwell: 'yes', + backFacadeAttached: 'yes', + exteriorWallsAttached: 'no', + tenantComplaintsComfort: 'no', + tenantComplaintsWindows: 'no', + meteredForElectricity: 'no', + }, + financialInitials: { + bankruptyPast: 'yes', + currentOnEnergyBills: 'current', + currentMortgageBalance: '0%', + profitable: 'always', + budgetForDownPayment: 'no cash', + }, + submitted: false, + calculated: false, + }; + } + + componentDidMount() { + const buildingId = this.props.building.building_id; + this.props.loadQuestionnaire(buildingId); + } + + onChangeEvent = (formType, formData) => { + this.setState({ + ...this.state, + [formType]: formData, + }, () => { + console.log(this.state[formType]); // eslint-disable-line + }); + } + + submitQuestionnaire = () => { + if (this.validateInputs()) { + this.setState({ + submitted: true, + }, () => { + console.log('Saving answers!'); // eslint-disable-line + }); + } + return false; + } + + calculate = () => { + this.setState({ + submitted: false, + calculated: true, + }, () => { + console.log('Calculated!'); // eslint-disable-line + }); + } + + downloadReport = () => { + this.setState({ + calculated: false, + }, () => { + console.log('Dowmloaded!'); // eslint-disable-line + }); + } + + validateInputs() { + const emptyFields = []; + Object.entries(this.state).forEach(formData => { + if (['buildingInfo', 'remoteSurvey', 'financialInitials'].includes(formData[0])) { + Object.entries(formData[1]).forEach(fieldData => { + if (fieldData[0] !== 'other' && fieldData[1].toString().replace(/^\s+|\s+$/g, '') === '') { + emptyFields.push(this.nameMapping[fieldData[0]]); + } + if (fieldData[1] === '-1') { + emptyFields.push(this.nameMapping[fieldData[0]]); + } + }); + } + }); + + if (emptyFields.length > 0) { + alert(`Please fill in ${emptyFields.join(', ')} field(s)`); + return false; + } + return true; + } + + render() { + const tableHeader = { + paddingBottom: '20px', + borderTop: '1px solid #CCCCCC', + background: '#EEEEEE', + fontWeight: 'bold', + paddingTop: '20px', + }; + + const labelStyle = { + marginBottom: '0.7em', + fontWeight: 'bold', + fontSize: '12px', + color: '#999999', + }; + + let calculateButton = null; + if (this.state.submitted === true) { + calculateButton = ( + + {' '} + + + ); + } else { + calculateButton = null; + } + + let downloadButton = null; + if (this.state.calculated === true) { + downloadButton = ( + + {' '} + + + ); + } else { + downloadButton = null; + } + + const mainContent = ( +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + + {calculateButton} + {downloadButton} +
    +
    +
    + ); + + return ( +
    + + {mainContent} +
    + ); + } +} + +AshpQuestionaire.propTypes = { + building: buildingDetailPropTypes, + loadQuestionnaire: PropTypes.func, +}; + +const mapDispatchToProps = dispatch => ( + bindActionCreators({ + loadQuestionnaire, + submitQuestionnaire, + calculateCost, + downloadReport, + }, dispatch) +); + +const mapStateToProps = state => ({ + buildingInfo: state.buildingInfo, + user: state.user, + eng: state.eng, +}); + +export default connect(mapStateToProps, mapDispatchToProps)(AshpQuestionaire); diff --git a/src/containers/AshpQuestionnaire/reducer.js b/src/containers/AshpQuestionnaire/reducer.js new file mode 100644 index 00000000..b932745a --- /dev/null +++ b/src/containers/AshpQuestionnaire/reducer.js @@ -0,0 +1,156 @@ +import { + LOAD_QUESTIONNAIRE_REQUESTED, + LOAD_QUESTIONNAIRE_SUCCEEDED, + LOAD_QUESTIONNAIRE_FAILED, + SUBMIT_QUESTIONNAIRE_REQUESTED, + SUBMIT_QUESTIONNAIRE_SUCCEEDED, + SUBMIT_QUESTIONNAIRE_FAILED, + CALCULATE_COST_REQUESTED, + CALCULATE_COST_SUCCEEDED, + CALCULATE_COST_FAILED, + DOWNLOAD_REPORT_REQUESTED, + DOWNLOAD_REPORT_SUCCEEDED, + DOWNLOAD_REPORT_FAILED, +} from './constants'; + + +const questionnaireInitialState = { + buildingInfo: { + loading: false, + error: false, + data: null, + }, + remoteSurvey: { + loading: false, + error: false, + data: null, + }, + financialInitials: { + loading: false, + error: false, + data: null, + }, +}; + +export default function (state = questionnaireInitialState, action) { + switch (action.type) { + case LOAD_QUESTIONNAIRE_REQUESTED: + return { + ...state, + buildingInfo: { + ...state.buildingInfo, + loading: true, + error: false, + }, + }; + + case LOAD_QUESTIONNAIRE_SUCCEEDED: + return { + ...state, + buildingInfo: { + data: action.instance, + loading: false, + error: false, + }, + }; + + case LOAD_QUESTIONNAIRE_FAILED: + return { + ...state, + buildingInfo: { + loading: false, + error: action.error, + }, + }; + + case SUBMIT_QUESTIONNAIRE_REQUESTED: + return { + ...state, + remoteSurvey: { + ...state.remoteSurvey, + loading: true, + error: false, + }, + }; + + case SUBMIT_QUESTIONNAIRE_SUCCEEDED: + return { + ...state, + remoteSurvey: { + data: action.instance, + loading: false, + error: false, + }, + }; + + case SUBMIT_QUESTIONNAIRE_FAILED: + return { + ...state, + remoteSurvey: { + loading: false, + error: action.error, + }, + }; + + case CALCULATE_COST_REQUESTED: + return { + ...state, + financialInitials: { + ...state.financialInitials, + loading: true, + error: false, + }, + }; + + case CALCULATE_COST_SUCCEEDED: + return { + ...state, + financialInitials: { + data: action.instance, + loading: false, + error: false, + }, + }; + + case CALCULATE_COST_FAILED: + return { + ...state, + financialInitials: { + loading: false, + error: action.error, + }, + }; + + case DOWNLOAD_REPORT_REQUESTED: + return { + ...state, + financialInitials: { + ...state.financialInitials, + loading: true, + error: false, + }, + }; + + case DOWNLOAD_REPORT_SUCCEEDED: + return { + ...state, + financialInitials: { + data: action.instance, + loading: false, + error: false, + }, + }; + + case DOWNLOAD_REPORT_FAILED: + return { + ...state, + financialInitials: { + loading: false, + error: action.error, + }, + }; + + default: + return state; + } +} diff --git a/src/containers/AshpQuestionnaire/sagas.js b/src/containers/AshpQuestionnaire/sagas.js new file mode 100644 index 00000000..da8db336 --- /dev/null +++ b/src/containers/AshpQuestionnaire/sagas.js @@ -0,0 +1,70 @@ +import { takeEvery, put, call } from 'redux-saga/effects'; +import { getHeaders } from '../../utils/restServices'; +import request from '../../utils/request'; + +import { + LOAD_QUESTIONNAIRE_REQUESTED, + SUBMIT_QUESTIONNAIRE_REQUESTED, + CALCULATE_COST_REQUESTED, + DOWNLOAD_REPORT_REQUESTED, +} from './constants'; + +import { + loadQuestionnaireSucceeded, + loadQuestionnaireLFailed, + submitQuestionnaireSucceeded, + submitQuestionnaireFailed, + calculateCostSucceeded, + calculateCostFailed, + downloadReportSucceeded, + downloadReportFailed, +} from './actions'; + +import SagaRequests from '../../utils/sagaRequests'; + + +function* loadQuestionnaire(action) { + const url = `${process.env.REACT_APP_BLOCLINK_URL}/buildings/${action.buildingId}/questionnaire/`; + yield SagaRequests.get(action, url, loadQuestionnaireSucceeded, loadQuestionnaireLFailed); +} + +function* submitQuestionnaire(action) { + const formData = new FormData(); + Object.keys(action.payload).map(key => formData.append(key, action.payload[key])); + const url = `${process.env.REACT_APP_BLOCLINK_URL}/buildings/${action.buildingId}/questionnaire/`; + + const res = yield call( + request, + SagaRequests.generateURL(url, action), + { + method: 'POST', + headers: getHeaders(), + body: formData, + } + ); + + if (!res.err) { + yield put(submitQuestionnaireSucceeded(res)); + } else { + yield put(submitQuestionnaireFailed(res.err)); + } +} + +function* calculateCost(action) { + const url = `${process.env.REACT_APP_BLOCLINK_URL}/buildings/${action.buildingId}/calculate-cost/`; + yield SagaRequests.get(action, url, calculateCostSucceeded, calculateCostFailed); +} + +function* downloadReport(action) { + const url = `${process.env.REACT_APP_BLOCLINK_URL}/buildings/${action.buildingId}/download-report/`; + yield SagaRequests.get(action, url, downloadReportSucceeded, downloadReportFailed); +} + +function* engWatcher() { + yield takeEvery(LOAD_QUESTIONNAIRE_REQUESTED, loadQuestionnaire); + yield takeEvery(SUBMIT_QUESTIONNAIRE_REQUESTED, submitQuestionnaire); + yield takeEvery(CALCULATE_COST_REQUESTED, calculateCost); + yield takeEvery(DOWNLOAD_REPORT_REQUESTED, downloadReport); +} + +export default engWatcher; -- GitLab From 799857a2c4951ecb54705cae46b8200e4801339e Mon Sep 17 00:00:00 2001 From: bontiveros Date: Tue, 13 Aug 2019 15:43:24 -0400 Subject: [PATCH 29/35] Validation of Inputs updated --- src/containers/AshpQuestionnaire/index.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/containers/AshpQuestionnaire/index.js b/src/containers/AshpQuestionnaire/index.js index 17fd4dad..5b8a7281 100644 --- a/src/containers/AshpQuestionnaire/index.js +++ b/src/containers/AshpQuestionnaire/index.js @@ -133,21 +133,37 @@ class AshpQuestionaire extends Component { validateInputs() { const emptyFields = []; + const invalidFields = []; + const errorMessage = []; + const validEmail = /^$|^[a-zA-Z0-9]+@[a-zA-Z0-9]+\.[A-Za-z]+$/; + const validPhone = /^$|^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/; + Object.entries(this.state).forEach(formData => { if (['buildingInfo', 'remoteSurvey', 'financialInitials'].includes(formData[0])) { Object.entries(formData[1]).forEach(fieldData => { if (fieldData[0] !== 'other' && fieldData[1].toString().replace(/^\s+|\s+$/g, '') === '') { emptyFields.push(this.nameMapping[fieldData[0]]); } + if (fieldData[0] === 'phone' && !(validPhone.test(fieldData[1]))) { + invalidFields.push(this.nameMapping[fieldData[0]]); + } + if (fieldData[0] === 'email' && !(validEmail.test(fieldData[1]))) { + invalidFields.push(this.nameMapping[fieldData[0]]); + } if (fieldData[1] === '-1') { emptyFields.push(this.nameMapping[fieldData[0]]); } }); } }); - - if (emptyFields.length > 0) { - alert(`Please fill in ${emptyFields.join(', ')} field(s)`); + if (emptyFields.length > 0 || invalidFields.length > 0) { + if (emptyFields.length > 0) { + errorMessage.push(`Please fill in ${emptyFields.join(', ')} field(s)`); + } + if (invalidFields.length > 0) { + errorMessage.push(`\nInvalid input in ${invalidFields.join(', ')} field(s)`); + } + alert(errorMessage); return false; } return true; -- GitLab From ddd8c4b62d2d19ec5707e117b8640e32519321f2 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Tue, 13 Aug 2019 16:18:10 -0400 Subject: [PATCH 30/35] Refactor folder structure and add review answers components --- .../ApartmentTypeDropdown.js | 0 .../index.js => Ashp/BuildingInfo.js} | 6 +- .../index.js => Ashp/FinancialInitial.js} | 6 +- .../index.js => Ashp/RemoteSurvey.js} | 6 +- .../Ashp/ReviewAnswers/BuildingInfo.js | 131 +++++++++++ .../Ashp/ReviewAnswers/FinancialInitial.js | 81 +++++++ .../Ashp/ReviewAnswers/RemoteSurvey.js | 175 ++++++++++++++ src/components/Ashp/ReviewAnswers/index.js | 45 ++++ src/containers/AshpQuestionnaire/index.js | 221 ++++++++++++------ 9 files changed, 586 insertions(+), 85 deletions(-) rename src/components/{AshpBuildingInfo => Ashp}/ApartmentTypeDropdown.js (100%) rename src/components/{AshpBuildingInfo/index.js => Ashp/BuildingInfo.js} (98%) rename src/components/{AshpFinanceInfo/index.js => Ashp/FinancialInitial.js} (98%) rename src/components/{AshpHeatingInfo/index.js => Ashp/RemoteSurvey.js} (99%) create mode 100644 src/components/Ashp/ReviewAnswers/BuildingInfo.js create mode 100644 src/components/Ashp/ReviewAnswers/FinancialInitial.js create mode 100644 src/components/Ashp/ReviewAnswers/RemoteSurvey.js create mode 100644 src/components/Ashp/ReviewAnswers/index.js diff --git a/src/components/AshpBuildingInfo/ApartmentTypeDropdown.js b/src/components/Ashp/ApartmentTypeDropdown.js similarity index 100% rename from src/components/AshpBuildingInfo/ApartmentTypeDropdown.js rename to src/components/Ashp/ApartmentTypeDropdown.js diff --git a/src/components/AshpBuildingInfo/index.js b/src/components/Ashp/BuildingInfo.js similarity index 98% rename from src/components/AshpBuildingInfo/index.js rename to src/components/Ashp/BuildingInfo.js index 6a792532..428492f3 100644 --- a/src/components/AshpBuildingInfo/index.js +++ b/src/components/Ashp/BuildingInfo.js @@ -4,7 +4,7 @@ import { Table, Input } from 'reactstrap'; import ApartmentTypeDropdown from './ApartmentTypeDropdown'; -class AshpBuildingInfo extends Component { +class BuildingInfo extends Component { constructor(props) { super(props); this.state = { @@ -232,7 +232,7 @@ class AshpBuildingInfo extends Component { } } -AshpBuildingInfo.propTypes = { +BuildingInfo.propTypes = { tableHeader: PropTypes.objectOf, labelStyle: PropTypes.objectOf, address: PropTypes.string, @@ -251,4 +251,4 @@ AshpBuildingInfo.propTypes = { onChangeEvent: PropTypes.func, }; -export default AshpBuildingInfo; +export default BuildingInfo; diff --git a/src/components/AshpFinanceInfo/index.js b/src/components/Ashp/FinancialInitial.js similarity index 98% rename from src/components/AshpFinanceInfo/index.js rename to src/components/Ashp/FinancialInitial.js index ff0dc3cd..4fc5b3a5 100644 --- a/src/components/AshpFinanceInfo/index.js +++ b/src/components/Ashp/FinancialInitial.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { Table, Input } from 'reactstrap'; -class AshpFinanaceInfo extends Component { +class FinanacialInitial extends Component { constructor(props) { super(props); this.state = { @@ -152,7 +152,7 @@ class AshpFinanaceInfo extends Component { } } -AshpFinanaceInfo.propTypes = { +FinanacialInitial.propTypes = { tableHeader: PropTypes.objectOf, bankruptyPast: PropTypes.string, currentOnEnergyBills: PropTypes.string, @@ -162,4 +162,4 @@ AshpFinanaceInfo.propTypes = { onChangeEvent: PropTypes.func, }; -export default AshpFinanaceInfo; +export default FinanacialInitial; diff --git a/src/components/AshpHeatingInfo/index.js b/src/components/Ashp/RemoteSurvey.js similarity index 99% rename from src/components/AshpHeatingInfo/index.js rename to src/components/Ashp/RemoteSurvey.js index 63c4701a..5983ac41 100644 --- a/src/components/AshpHeatingInfo/index.js +++ b/src/components/Ashp/RemoteSurvey.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { Table, Input } from 'reactstrap'; -class AshpHeatingInfo extends Component { +class RemoteSurvey extends Component { constructor(props) { super(props); this.state = { @@ -367,7 +367,7 @@ class AshpHeatingInfo extends Component { } } -AshpHeatingInfo.propTypes = { +RemoteSurvey.propTypes = { tableHeader: PropTypes.objectOf, labelStyle: PropTypes.objectOf, heatingSystem: PropTypes.string, @@ -388,4 +388,4 @@ AshpHeatingInfo.propTypes = { onChangeEvent: PropTypes.func, }; -export default AshpHeatingInfo; +export default RemoteSurvey; diff --git a/src/components/Ashp/ReviewAnswers/BuildingInfo.js b/src/components/Ashp/ReviewAnswers/BuildingInfo.js new file mode 100644 index 00000000..1f1dc4e0 --- /dev/null +++ b/src/components/Ashp/ReviewAnswers/BuildingInfo.js @@ -0,0 +1,131 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { Table } from 'reactstrap'; + + +const BuildingInfo = (props) => { + const cellStyle = { + fontSize: '0.8em', + fontWeight: 'bold', + color: '#CCCCCC', + }; + return ( +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + {props.title} +
    +
    + First Name +
    +
    + {props.data.firstName} +
    +
    +
    + Last Name +
    +
    + {props.data.lastName} +
    +
    +
    + Email +
    +
    + {props.data.email} +
    +
    +
    + Phone +
    +
    + {props.data.phone} +
    +
    +
    + Address +
    +
    + {props.data.address} +
    +
    +
    + Number of Studio +
    +
    + {props.data.numOfStudio} +
    +
    +
    + Number of One Bedroom Apartment +
    +
    + {props.data.numOfOneBedroom} +
    +
    +
    + Number of Two Bedroom Apartment +
    +
    + {props.data.numOfStudio} +
    +
    +
    + Number of Three Bedroom Apartment +
    +
    + {props.data.numOfOneBedroom} +
    +
    +
    + Number of Four Bedroom Apartment +
    +
    + {props.data.numOfFourBedroom} +
    +
    +
    + Other Apartment +
    +
    + {props.data.other} {props.data.numOfOther} +
    +
    +
    + ); +}; + +BuildingInfo.propTypes = { + tableHeader: PropTypes.objectOf, + title: PropTypes.string, + data: PropTypes.objectOf, +}; + +export default BuildingInfo; diff --git a/src/components/Ashp/ReviewAnswers/FinancialInitial.js b/src/components/Ashp/ReviewAnswers/FinancialInitial.js new file mode 100644 index 00000000..379d2f5f --- /dev/null +++ b/src/components/Ashp/ReviewAnswers/FinancialInitial.js @@ -0,0 +1,81 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { Table } from 'reactstrap'; + + +const FinancialInitial = (props) => { + const cellStyle = { + fontSize: '0.8em', + fontWeight: 'bold', + color: '#BBBBBB', + }; + return ( +
    + + + + + + + + + + + + + + + + + + + +
    + {props.title} +
    +
    + Any bankruptcy in the past three years? +
    +
    + {props.data.bankruptyPast} +
    +
    +
    + Current on energy bills? +
    +
    + {props.data.currentOnEnergyBills} +
    +
    +
    + What is the current outstanding balance of the mortgage? +
    +
    + {props.data.currentMortgageBalance} +
    +
    +
    + Is your building currently profitable? +
    +
    + {props.data.profitable} +
    +
    +
    + What is your current budget for a down payment? +
    +
    + {props.data.budgetForDownPayment} +
    +
    +
    + ); +}; + +FinancialInitial.propTypes = { + tableHeader: PropTypes.objectOf, + title: PropTypes.string, + data: PropTypes.objectOf, +}; + +export default FinancialInitial; diff --git a/src/components/Ashp/ReviewAnswers/RemoteSurvey.js b/src/components/Ashp/ReviewAnswers/RemoteSurvey.js new file mode 100644 index 00000000..66035ec8 --- /dev/null +++ b/src/components/Ashp/ReviewAnswers/RemoteSurvey.js @@ -0,0 +1,175 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { Table } from 'reactstrap'; + + +const RemoteSurvey = (props) => { + const cellStyle = { + fontSize: '0.8em', + fontWeight: 'bold', + color: '#BBBBBB', + }; + return ( +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + {props.title} +
    +
    + Heating System +
    +
    + {props.data.heatingSystem} +
    +
    +
    + Heating Fuel Source +
    +
    + {props.data.heatingFuelSource} +
    +
    +
    + Is Domestic Hot Water (DHW) and heat prepared by the same boiler? +
    +
    + {props.data.DHWSameBoiler} +
    +
    +
    + Age of heat generating system? +
    +
    + {props.data.AgeOfHeatGenerateSystem} +
    +
    +
    + When do you plan to replace the heating system? +
    +
    + {props.data.planToReplaceHS} +
    +
    +
    + Hallways heated? +
    +
    + {props.data.hallwaysHeated} +
    +
    +
    + Basement heated? +
    +
    + {props.data.basementHeated} +
    +
    +
    + Stairwells heated? +
    +
    + {props.data.stairwellsHeated} +
    +
    +
    + Floors heated? +
    +
    + {props.data.floorsHeated} +
    +
    +
    + Is the roof flat and easily accessible by a stairwell? +
    +
    + {props.data.accessibleByStairwell} +
    +
    +
    + Is the back facade of your building attached to an adjacent building or structure? +
    +
    + {props.data.backFacadeAttached} +
    +
    +
    + Are the exterior walls of your building attached to an adjacent building or structure? +
    +
    + {props.data.exteriorWallsAttached} +
    +
    +
    + Any tenant complaints about comfort issues? (Temperature) +
    +
    + {props.data.tenantComplaintsComfort} +
    +
    +
    + Any tenant complaints about drafty windows? +
    +
    + {props.data.tenantComplaintsWindows} +
    +
    +
    + Is the building directly metered for electricity (tenants pay ConEd bills)? +
    +
    + {props.data.meteredForElectricity} +
    +
    +
    + ); +}; + +RemoteSurvey.propTypes = { + tableHeader: PropTypes.objectOf, + title: PropTypes.string, + data: PropTypes.objectOf, +}; + +export default RemoteSurvey; diff --git a/src/components/Ashp/ReviewAnswers/index.js b/src/components/Ashp/ReviewAnswers/index.js new file mode 100644 index 00000000..0e516cc8 --- /dev/null +++ b/src/components/Ashp/ReviewAnswers/index.js @@ -0,0 +1,45 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import BuildingInfo from './BuildingInfo'; +import RemoteSurvey from './RemoteSurvey'; +import FinancialInitial from './FinancialInitial'; + + +const ReviewAnswers = (props) => { + return ( +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + ); +}; + +ReviewAnswers.propTypes = { + tableHeader: PropTypes.objectOf, + buildingInfo: PropTypes.objectOf, + remoteSurvey: PropTypes.objectOf, + financialInitials: PropTypes.objectOf, +}; + +export default ReviewAnswers; diff --git a/src/containers/AshpQuestionnaire/index.js b/src/containers/AshpQuestionnaire/index.js index 5b8a7281..3118eb78 100644 --- a/src/containers/AshpQuestionnaire/index.js +++ b/src/containers/AshpQuestionnaire/index.js @@ -12,9 +12,10 @@ import { downloadReport, } from './actions'; import LinkBarDetail from '../../components/LinkBarDetail'; -import AshpBuildingInfo from '../../components/AshpBuildingInfo'; -import AshpFinanceInfo from '../../components/AshpFinanceInfo'; -import AshpHeatingInfo from '../../components/AshpHeatingInfo'; +import BuildingInfo from '../../components/Ashp/BuildingInfo'; +import FinancialInitial from '../../components/Ashp/FinancialInitial'; +import RemoteSurvey from '../../components/Ashp/RemoteSurvey'; +import ReviewAnswers from '../../components/Ashp/ReviewAnswers'; class AshpQuestionaire extends Component { @@ -52,6 +53,7 @@ class AshpQuestionaire extends Component { lastName: 'Ontiveros', email: 'bryan@blocpower.io', phone: '911-911-9911', + address: props.building.street_address, numOfStudio: 1, numOfOneBedroom: 3, numOfTwoBedroom: 2, @@ -84,6 +86,7 @@ class AshpQuestionaire extends Component { profitable: 'always', budgetForDownPayment: 'no cash', }, + showReviewAnswers: false, submitted: false, calculated: false, }; @@ -107,6 +110,7 @@ class AshpQuestionaire extends Component { if (this.validateInputs()) { this.setState({ submitted: true, + showReviewAnswers: true, }, () => { console.log('Saving answers!'); // eslint-disable-line }); @@ -131,6 +135,14 @@ class AshpQuestionaire extends Component { }); } + editForm = () => { + this.setState({ + showReviewAnswers: false, + submitted: false, + calculated: false, + }); + } + validateInputs() { const emptyFields = []; const invalidFields = []; @@ -185,7 +197,102 @@ class AshpQuestionaire extends Component { color: '#999999', }; - let calculateButton = null; + const successMsgStyle = { + padding: '15px 50px 15px 50px', + border: '2px solid #CCCCCC', + marginBottom: '20px', + background: '#B8DFC2', + }; + + const editStyle = { + marginLeft: '15px', + cursor: 'pointer', + textDecoration: 'underline', + }; + + let forms = ''; + if (this.state.showReviewAnswers === false) { + forms = ( +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    + ); + } + + let message = ''; + let editLink = ''; + let submitButton = ''; + if (this.state.showReviewAnswers === false) { + submitButton = ( + + ); + } + + let calculateButton = ''; if (this.state.submitted === true) { calculateButton = ( @@ -198,11 +305,14 @@ class AshpQuestionaire extends Component { ); - } else { - calculateButton = null; + message = ( +
    + Successfully submitted. +
    + ); } - let downloadButton = null; + let downloadButton = ''; if (this.state.calculated === true) { downloadButton = ( @@ -215,84 +325,43 @@ class AshpQuestionaire extends Component { ); - } else { - downloadButton = null; + message = ( +
    + Calculation completed. +
    + ); + } + + let reviewAnswers = null; + if (this.state.showReviewAnswers === true) { + reviewAnswers = ( + + ); + editLink = ( + + Edit answers + + ); } const mainContent = (
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    + {forms} +
    - + {message} + {submitButton} {calculateButton} {downloadButton} + {editLink}
    + {reviewAnswers}
    ); -- GitLab From dee056fa0d505974d93f95501d5c8df003dadec8 Mon Sep 17 00:00:00 2001 From: Aizizi Yigaimu Date: Tue, 13 Aug 2019 16:34:27 -0400 Subject: [PATCH 31/35] Captialize first letter in review answers --- .../Ashp/ReviewAnswers/BuildingInfo.js | 5 +-- .../Ashp/ReviewAnswers/FinancialInitial.js | 11 ++++--- .../Ashp/ReviewAnswers/RemoteSurvey.js | 31 ++++++++++--------- src/components/Ashp/ReviewAnswers/index.js | 7 +++++ 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/components/Ashp/ReviewAnswers/BuildingInfo.js b/src/components/Ashp/ReviewAnswers/BuildingInfo.js index 1f1dc4e0..1b785ea7 100644 --- a/src/components/Ashp/ReviewAnswers/BuildingInfo.js +++ b/src/components/Ashp/ReviewAnswers/BuildingInfo.js @@ -23,7 +23,7 @@ const BuildingInfo = (props) => { First Name
    - {props.data.firstName} + {props.upperFirstLetter(props.data.firstName)}
    @@ -31,7 +31,7 @@ const BuildingInfo = (props) => { Last Name
    - {props.data.lastName} + {props.upperFirstLetter(props.data.lastName)}
    @@ -31,7 +31,7 @@ const RemoteSurvey = (props) => { Heating Fuel Source
    - {props.data.heatingFuelSource} + {props.upperFirstLetter(props.data.heatingFuelSource)}
    @@ -79,7 +79,7 @@ const RemoteSurvey = (props) => { Basement heated?
    - {props.data.basementHeated} + {props.upperFirstLetter(props.data.basementHeated)}
    @@ -97,7 +97,7 @@ const RemoteSurvey = (props) => { Floors heated?
    - {props.data.floorsHeated} + {props.upperFirstLetter(props.data.floorsHeated)}
    @@ -95,7 +95,7 @@ const BuildingInfo = (props) => { Number of Three Bedroom Apartment
    - {props.data.numOfOneBedroom} + {props.data.numOfThreeBedroom}
    @@ -117,8 +124,7 @@ class BuildingInfo extends Component { Address @@ -235,8 +241,7 @@ class BuildingInfo extends Component { BuildingInfo.propTypes = { tableHeader: PropTypes.objectOf, labelStyle: PropTypes.objectOf, - address: PropTypes.string, - borough: PropTypes.string, + address: PropTypes.arrayOf, firstName: PropTypes.string, lastName: PropTypes.string, email: PropTypes.string, diff --git a/src/components/Ashp/RemoteSurvey.js b/src/components/Ashp/RemoteSurvey.js index 5983ac41..dadcdc3b 100644 --- a/src/components/Ashp/RemoteSurvey.js +++ b/src/components/Ashp/RemoteSurvey.js @@ -68,7 +68,7 @@ class RemoteSurvey extends Component { - + diff --git a/src/components/Ashp/ReviewAnswers/BuildingInfo.js b/src/components/Ashp/ReviewAnswers/BuildingInfo.js index 03a8e43a..3c8efa1d 100644 --- a/src/components/Ashp/ReviewAnswers/BuildingInfo.js +++ b/src/components/Ashp/ReviewAnswers/BuildingInfo.js @@ -9,6 +9,13 @@ const BuildingInfo = (props) => { fontWeight: 'bold', color: '#CCCCCC', }; + const address = props.data.address.map(addressItem => { + return ( +
    + {addressItem} +
    + ); + }); return (
    - {this.props.address[0]} {', '} - {this.props.borough} + {address}
    @@ -59,7 +66,7 @@ const BuildingInfo = (props) => { Address
    - {props.data.address} + {address}
    diff --git a/src/components/SideBarDetail/index.js b/src/components/SideBarDetail/index.js index d09842af..067653d9 100644 --- a/src/components/SideBarDetail/index.js +++ b/src/components/SideBarDetail/index.js @@ -188,9 +188,9 @@ export default function SideBarDetail({ building, children, contacts, user }) { className={isActive(`${rootURL}/dimensions/`)} style={{ display: user.permissions['view::dimensions'] ? 'block' : 'none' }} > - + {dimensionSVG} - ASHP Questionnaires + Questionnaire
  • diff --git a/src/containers/AshpQuestionnaire/actions.js b/src/containers/Questionnaire/actions.js similarity index 100% rename from src/containers/AshpQuestionnaire/actions.js rename to src/containers/Questionnaire/actions.js diff --git a/src/containers/AshpQuestionnaire/constants.js b/src/containers/Questionnaire/constants.js similarity index 100% rename from src/containers/AshpQuestionnaire/constants.js rename to src/containers/Questionnaire/constants.js diff --git a/src/containers/AshpQuestionnaire/index.js b/src/containers/Questionnaire/index.js similarity index 96% rename from src/containers/AshpQuestionnaire/index.js rename to src/containers/Questionnaire/index.js index 3118eb78..e2e23f17 100644 --- a/src/containers/AshpQuestionnaire/index.js +++ b/src/containers/Questionnaire/index.js @@ -18,7 +18,7 @@ import RemoteSurvey from '../../components/Ashp/RemoteSurvey'; import ReviewAnswers from '../../components/Ashp/ReviewAnswers'; -class AshpQuestionaire extends Component { +class Questionnaire extends Component { constructor(props) { super(props); this.nameMapping = { @@ -53,7 +53,9 @@ class AshpQuestionaire extends Component { lastName: 'Ontiveros', email: 'bryan@blocpower.io', phone: '911-911-9911', - address: props.building.street_address, + address: this.props.building.street_address.map(addressItem => { + return `${addressItem}, ${this.props.building.borough}`; + }), numOfStudio: 1, numOfOneBedroom: 3, numOfTwoBedroom: 2, @@ -219,7 +221,7 @@ class AshpQuestionaire extends Component { @@ -381,7 +383,7 @@ class AshpQuestionaire extends Component { } } -AshpQuestionaire.propTypes = { +Questionnaire.propTypes = { building: buildingDetailPropTypes, loadQuestionnaire: PropTypes.func, }; @@ -401,4 +403,4 @@ const mapStateToProps = state => ({ eng: state.eng, }); -export default connect(mapStateToProps, mapDispatchToProps)(AshpQuestionaire); +export default connect(mapStateToProps, mapDispatchToProps)(Questionnaire); diff --git a/src/containers/AshpQuestionnaire/reducer.js b/src/containers/Questionnaire/reducer.js similarity index 100% rename from src/containers/AshpQuestionnaire/reducer.js rename to src/containers/Questionnaire/reducer.js diff --git a/src/containers/AshpQuestionnaire/sagas.js b/src/containers/Questionnaire/sagas.js similarity index 100% rename from src/containers/AshpQuestionnaire/sagas.js rename to src/containers/Questionnaire/sagas.js diff --git a/src/reducers.js b/src/reducers.js index 653b6a09..1cf26cca 100644 --- a/src/reducers.js +++ b/src/reducers.js @@ -18,7 +18,7 @@ import weather from './containers/Weather/reducer'; import events from './containers/Event/reducer'; import blocnote from './containers/Blocnote/reducer'; import bloclink from './containers/Performance/reducer'; -import questionnaire from './containers/AshpQuestionnaire/reducer'; +import questionnaire from './containers/Questionnaire/reducer'; export default combineReducers({ diff --git a/src/routes.js b/src/routes.js index 8da27851..68d48e2a 100644 --- a/src/routes.js +++ b/src/routes.js @@ -32,7 +32,7 @@ import Wrapper from './containers/Wrapper'; import { BGroupOverview, BGroup } from './containers/BGroup'; import NavOnly from './screens/NavOnly/NavOnly'; import Admin from './containers/Admin/Admin'; -import AshpQuestionaire from './containers/AshpQuestionnaire'; +import Questionnaire from './containers/Questionnaire'; const auth = new Auth(); @@ -54,7 +54,7 @@ export default ( {/* */} - + diff --git a/src/sagas.js b/src/sagas.js index c860241e..364d621a 100644 --- a/src/sagas.js +++ b/src/sagas.js @@ -15,7 +15,7 @@ import weatherSaga from './containers/Weather/sagas'; import eventsSaga from './containers/Event/sagas'; import blocnoteSaga from './containers/Blocnote/sagas'; import performanceSaga from './containers/Performance/sagas'; -import questionnaireSaga from './containers/AshpQuestionnaire/sagas'; +import questionnaireSaga from './containers/Questionnaire/sagas'; export default function* rootSaga() { -- GitLab