From 2ca61dc95ff13f70e4c6f46c803c9c91c473c8d0 Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Mon, 21 Oct 2019 16:43:57 -0400 Subject: [PATCH 1/4] Convert building unit info to textbox --- src/components/Questionnaire/BuildingInfo.js | 14 ++++---------- .../Questionnaire/BuildingUnitDropdown.js | 12 +++--------- src/containers/Questionnaire/index.js | 4 ++-- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/components/Questionnaire/BuildingInfo.js b/src/components/Questionnaire/BuildingInfo.js index 79565e13..dc9adbb8 100644 --- a/src/components/Questionnaire/BuildingInfo.js +++ b/src/components/Questionnaire/BuildingInfo.js @@ -70,6 +70,8 @@ class BuildingInfo extends Component { } handleInputChangeSubComponent = (name, val) => { + console.log(name); + console.log(val); const unitInfo = {}; Object.entries(this.state.form.unitInfo).forEach(entry => { if (entry[0] === name) { @@ -302,19 +304,11 @@ class BuildingInfo extends Component {
this.handleOtherInputChange(e)} - > - - - - - - - - + />
diff --git a/src/components/Questionnaire/BuildingUnitDropdown.js b/src/components/Questionnaire/BuildingUnitDropdown.js index b0f236f7..e40951ec 100644 --- a/src/components/Questionnaire/BuildingUnitDropdown.js +++ b/src/components/Questionnaire/BuildingUnitDropdown.js @@ -33,18 +33,12 @@ class BuildingUnitDropdown extends Component {
this.handleInputChange(e)} - > - - - - - - - + />
); diff --git a/src/containers/Questionnaire/index.js b/src/containers/Questionnaire/index.js index c13d449c..0137ebf2 100644 --- a/src/containers/Questionnaire/index.js +++ b/src/containers/Questionnaire/index.js @@ -125,10 +125,12 @@ class Questionnaire extends Component { const validPhone = /^$|^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/; Object.entries(data).forEach(formData => { + if (['buildingInfo', 'remoteSurvey', 'financialInitials'].includes(formData[0])) { Object.entries(formData[1]).forEach(fieldData => { if (fieldData[0] !== 'other' && fieldData[0] !== 'address' && + fieldData[0] !== 'buildingId' && fieldData[1].toString().replace(/^\s+|\s+$/g, '') === '') { emptyFields.push(this.nameMapping[fieldData[0]]); } @@ -147,7 +149,6 @@ class Questionnaire extends Component { }); } }); - if (emptyFields.length > 0) { errorMessage.push(`Please fill in:\n${emptyFields.join('\n')}\nfield(s)`); alert(errorMessage); @@ -158,7 +159,6 @@ class Questionnaire extends Component { alert(errorMessage); return false; } - return true; } -- GitLab From de74541976bfc6b234ee03747ddd8453a25dbbb8 Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Tue, 22 Oct 2019 13:50:37 -0400 Subject: [PATCH 2/4] Make Phone number optional --- src/containers/Questionnaire/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/containers/Questionnaire/index.js b/src/containers/Questionnaire/index.js index 0137ebf2..b7a08801 100644 --- a/src/containers/Questionnaire/index.js +++ b/src/containers/Questionnaire/index.js @@ -131,6 +131,7 @@ class Questionnaire extends Component { if (fieldData[0] !== 'other' && fieldData[0] !== 'address' && fieldData[0] !== 'buildingId' && + fieldData[0] !== 'phone' && fieldData[1].toString().replace(/^\s+|\s+$/g, '') === '') { emptyFields.push(this.nameMapping[fieldData[0]]); } -- GitLab From 7771a533f77d5194fc17118beb4c895ee634042b Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Tue, 22 Oct 2019 13:54:25 -0400 Subject: [PATCH 3/4] Add Optional label --- src/components/Questionnaire/BuildingInfo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Questionnaire/BuildingInfo.js b/src/components/Questionnaire/BuildingInfo.js index dc9adbb8..854b612d 100644 --- a/src/components/Questionnaire/BuildingInfo.js +++ b/src/components/Questionnaire/BuildingInfo.js @@ -168,7 +168,7 @@ class BuildingInfo extends Component { - Phone No. + Phone No. (Optional) Date: Thu, 31 Oct 2019 16:43:24 -0400 Subject: [PATCH 4/4] remove console logs --- src/components/Questionnaire/BuildingInfo.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/Questionnaire/BuildingInfo.js b/src/components/Questionnaire/BuildingInfo.js index 854b612d..4d1e8bf2 100644 --- a/src/components/Questionnaire/BuildingInfo.js +++ b/src/components/Questionnaire/BuildingInfo.js @@ -70,8 +70,6 @@ class BuildingInfo extends Component { } handleInputChangeSubComponent = (name, val) => { - console.log(name); - console.log(val); const unitInfo = {}; Object.entries(this.state.form.unitInfo).forEach(entry => { if (entry[0] === name) { -- GitLab