From 7728262f294bd4069a42f350477a728bffa45b1d Mon Sep 17 00:00:00 2001 From: GotPPay Date: Mon, 21 May 2018 17:21:23 +0200 Subject: [PATCH] Show validation errors on eligibility check --- .../Shared/ValidationErrorsInfoDialog.js | 103 +++++++++--------- 1 file changed, 50 insertions(+), 53 deletions(-) diff --git a/src/components/Shared/ValidationErrorsInfoDialog.js b/src/components/Shared/ValidationErrorsInfoDialog.js index f0efe0c..262092f 100644 --- a/src/components/Shared/ValidationErrorsInfoDialog.js +++ b/src/components/Shared/ValidationErrorsInfoDialog.js @@ -3,60 +3,57 @@ import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; export class ValidationErrorsInfoDialog extends React.Component { - constructor(props) { - super(props) - this.props = props; - this.state = { + + state = { open: this.props.open, } + + componentWillReceiveProps(newProps){ + this.setState({open: newProps.open}); + } + + handleOpen = () => { + this.setState({ open: true }); + }; + + handleClose = () => { + this.setState({ open: false }); + this.props.onDismiss(); + }; + + render() { + + const actions = [ + , + ]; + + return ( +
+ + {this.props.errorMessages.map(errorMessage => { + return ( +
+ {errorMessage.message} +
+
+ ); + })} +
+
+ ); + } } - componentWillReceiveProps(newProps) { - this.setState({ open: newProps.open }); - } - - handleOpen = () => { - this.setState({ open: true }); - }; - - handleClose = () => { - this.setState({ open: false }); - this.props.onDismiss(); - }; - - render() { - - const actions = [ - , - ]; - - return ( -
- - {this.props.errorMessages.map(errorMessage => { - return ( - - ); - })} - -
- ); - } -} - -module.exports = ValidationErrorsInfoDialog; \ No newline at end of file + module.exports = ValidationErrorsInfoDialog;