/**
 * Confirm Popup handler
 *
 * @author Rai Icasiano <ricasiano at cambridge dot org>
 */
window.ConfirmModal = React.createClass({
    getInitialState: function () {
        return {
            confirmModal: this.props.getConfirmModal,
            confirmModalAction: this.props.getConfirmModalAction,
            confirmModalErrorMessage: this.props.getConfirmModalErrorMessage
        }
    },

    closeModal: function () {
        this.props.setConfirmModal(false);
    },

    render: function () {
        return (
            <div className="konakartOverlayConfirmModal" style={{display: true === this.state.confirmModal() ? 'block' : 'none' }}>
                <div className="konakartOverlayConfirmModalText">{this.state.confirmModalErrorMessage()}
                <br /><br />
                    <input className="button" type="button" value="Yes" onClick={this.state.confirmModalAction()}/>&nbsp;&nbsp;
                    <input className="button" type="button" value="No" onClick={this.closeModal} />
                </div>
            </div>
        );
    }
});