diff --git a/src/components/VolunteerTab/VolunteerEditModal.js b/src/components/VolunteerTab/VolunteerEditModal.js
index 0db5ff1a..246f8e51 100644
--- a/src/components/VolunteerTab/VolunteerEditModal.js
+++ b/src/components/VolunteerTab/VolunteerEditModal.js
@@ -11,7 +11,7 @@ export default class VolunteerEditModal extends React.Component {
}
initState = _ => {
- this.state = {
+ this.state = {
loading: true,
generalAnswer: null,
@@ -103,7 +103,7 @@ export default class VolunteerEditModal extends React.Component {
this.state.isButtonEnabled = true
this.state.hasChanges = false
this.setState(this.state)
- this.props.onSuccess()
+ this.props.onSuccess()
})
}
@@ -116,24 +116,52 @@ export default class VolunteerEditModal extends React.Component {
this.state.hasChanges = false
this.setState(this.state)
this.props.onSuccess()
- this.props.onHide()
+ this.props.onHide()
})
}
+ formatingUserDetails = val => {
+ return val? val: ''
+ }
+
+ renderUserDetails = _=> {
+ if (!this.props.volunteer){
+ return (
+
+ No Data
+
+ )
+ }
+ let {firstName, lastName, contactEmail, email, contactPhone, tags} = this.props.volunteer;
+
+ if (!tags || tags.length==0){ tags='No Tags'}
+ else{
+ let tagList = tags.map((tag, index) => {
+ return
{tag}
+ })
+ tags =
+ }
+
+ return (
+
+ {`${firstName} ${lastName}`}
+ {email}
+ {`${(this.formatingUserDetails(contactEmail))} , ${this.formatingUserDetails(contactPhone)}`}
+ tags: {tags}
+
+
+
+ )
+ }
+
+
render() {
- const name = this.props.volunteer ?
- `${this.props.volunteer.firstName} ${this.props.volunteer.lastName}` :
- 'No Data'
- const email = this.props.volunteer ? this.props.volunteer.userId : 'No Data'
const errorMessage = this.errorMessage();
return (
-
- {name}
- {email}
-
+ {this.renderUserDetails()}
diff --git a/src/components/VolunteerTab/VolunteerRequestPreviewModal.js b/src/components/VolunteerTab/VolunteerRequestPreviewModal.js
index f25b4698..4325dd9e 100644
--- a/src/components/VolunteerTab/VolunteerRequestPreviewModal.js
+++ b/src/components/VolunteerTab/VolunteerRequestPreviewModal.js
@@ -12,7 +12,7 @@ export default class VolunteerRequestPreviewModal extends React.Component {
}
initState = _ => {
- this.state = {
+ this.state = {
loading: true,
request: this.props.request,
status: '',
@@ -82,12 +82,12 @@ export default class VolunteerRequestPreviewModal extends React.Component {
}
return null;
}
-
- handleOptionsChange = event => {
+
+ handleOptionsChange = event => {
const field = event.target.id;
this.state[field] = event.target.value
this.setState(this.state);
- }
+ }
onHide = _ => {
//TODO: check if there are unsaved changes and show "are you sure" alert
@@ -104,7 +104,7 @@ export default class VolunteerRequestPreviewModal extends React.Component {
this.state.isButtonEnabled = true
this.state.hasChanges = false
this.setState(this.state)
- this.props.onSuccess()
+ this.props.onSuccess()
})
}
@@ -119,7 +119,7 @@ export default class VolunteerRequestPreviewModal extends React.Component {
this.state.removeEnabled = true
this.setState(this.state)
this.props.onSuccess()
- this.props.onHide()
+ this.props.onHide()
})
}
@@ -139,7 +139,7 @@ export default class VolunteerRequestPreviewModal extends React.Component {
this.state.addEnabled = true
this.setState(this.state)
this.props.onSuccess()
- this.props.onHide()
+ this.props.onHide()
})
.catch(error => {
this.state.status = error.response.data && error.response.data.error ? error.response.data.error : 'Server Error'
@@ -148,30 +148,58 @@ export default class VolunteerRequestPreviewModal extends React.Component {
});
}
+ formatingUserDetails = val => {
+ return val? val: ''
+ }
+
+ renderUserDetails = _=> {
+ if (!this.props.volunteer){
+ return (
+
+ No Data
+
+ )
+ }
+ let {firstName, lastName, contactEmail, email, contactPhone, tags} = this.props.volunteer;
+
+ if (!tags || tags.length==0){ tags='No Tags'}
+ else{
+ let tagList = tags.map((tag, index) => {
+ return {tag}
+ })
+ tags =
+ }
+
+ return (
+
+ {`${firstName} ${lastName}`}
+ {email}
+ {`${(this.formatingUserDetails(contactEmail))} , ${this.formatingUserDetails(contactPhone)}`}
+ tags: {tags}
+
+
+
+ )
+ }
+
render() {
if (!this.props.request) {
return ()
}
- const name = this.props.request ? `${this.props.request.firstName} ${this.props.request.lastName}` : 'No Data';
- const email = this.props.request ? this.props.request.userId : 'No Data';
-
const errorMessage = this.errorMessage();
return (
-
- {name}
- {email}
-
+ {this.renderUserDetails()}
{/* {this.state.hasChanges &&
} */}
-
+
{errorMessage}
@@ -200,7 +228,7 @@ export default class VolunteerRequestPreviewModal extends React.Component {
-
+
General