All files / src/containers/PatientDetails/components/QuestionnarieList/baseline QuestionnaireActionButtons.js

0% Statements 0/17
0% Branches 0/4
0% Functions 0/4
0% Lines 0/17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57                                                                                                                 
import React, { PureComponent } from 'react';
import Button from '@material-ui/core/Button';
import { withRouter } from 'react-router-dom';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { connect } from 'react-redux';
import { questionnarieActions } from '../../../../../redux/questionnarie';
 
// const styles = theme => ({
//     button: {
//         margin: theme.spacing.unit,
//     },
//     leftIcon: {
//         marginRight: theme.spacing.unit,
//     },
// });
class QuestionnarieActionButtons extends PureComponent {
    handleButtonClick = () => {
        const {
            rowdata: {
                id, 
                clinicianName
            },
            SetSelectedQuestionnaireId,
            history
        } = this.props;
        const selectedId={
            id : id === null ? '' : id,
            clinicianName : clinicianName ? clinicianName : '' 
        }
        SetSelectedQuestionnaireId(selectedId);
        // window.location.href = `/pro/questionnariedetails`;
        const url = `/pro/questionnariedetails`;
        history.push(url);
    };
 
    render() {
        return (
            <div>
                <Button onClick={this.handleButtonClick}>
                    <FontAwesomeIcon icon={['fal', 'eye']} />
                </Button>
            </div>
        );
    }
}
 
const mapStateToProps = ({ questionnarieReducer }) => {
    return {
        SelectedQuestionnaireId: questionnarieReducer.SelectedQuestionnaire        
    };
};
const mapDispatchToProps = {
    
    SetSelectedQuestionnaireId: questionnarieActions.setSelectedQuestionnaire
    
}
export default connect(mapStateToProps,mapDispatchToProps)(withRouter(QuestionnarieActionButtons));