All files / src/containers/PatientBrowser/components/ProProgress/Baseline ProProgressRowChip.js

0% Statements 0/19
0% Branches 0/4
0% Functions 0/3
0% Lines 0/19
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                                                                                                       
import React, { PureComponent } from 'react';
import Chip from '@material-ui/core/Chip';
import Tooltip from '@material-ui/core/Tooltip';
 
class ProProgressRowChip extends PureComponent {
    constructor(props) {
        super(props);
        this.state = {
            tooltipMsg: ''
        };
    }
 
    changeColor = progressStatus => {
        switch (progressStatus) {
            case 1:
                this.setState({
                    tooltipMsg: 'Not Started'
                });
                break;
            case 2:
                this.setState({
                    tooltipMsg: 'In Progress'
                });
                break;
            case 3:
                this.setState({
                    tooltipMsg: 'Completed'
                });
                break;
            default:
                console.log('unknown category');
                break;
        }
    };
 
    render() {
        const { tooltipMsg } = this.state;
        const { rowdata } = this.props;
 
        this.changeColor(rowdata.QuestionnaireStatus);
 
        return (
            <div className="questinnaie-chip">
                <Tooltip title={tooltipMsg}>
                    <Chip label={rowdata.QuestionnaireDisplayName}  className={"QuestionnaireStatus"+rowdata.QuestionnaireStatus}/>
                </Tooltip>
            </div>
        );
    }
}
export default ProProgressRowChip;