All files / src/containers/PatientDetails/components/PatientDetailsHeader PatientDetailsHeader.js

0% Statements 0/16
0% Branches 0/30
0% Functions 0/2
0% Lines 0/16
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140                                                                                                                                                                                                                                                                                       
import React, { PureComponent } from 'react';
import Button from '@material-ui/core/Button';
import { Grid, Typography, Paper } from '@material-ui/core';
// import i18next from 'i18next';
import { withRouter } from 'react-router-dom';
import { faChevronLeft } from '@fortawesome/pro-light-svg-icons';
import { connect } from 'react-redux';
import moment from 'moment';
import i18next from '../../../../common/i18next';
import PatientDetailsHeaderButton from './PatientDetailsHeaderButton';
import { Link } from 'react-router-dom';
import Loader from '../../../../components/Loader';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faBirthdayCake, faVenusMars, faEnvelope } from '@fortawesome/pro-light-svg-icons';
 
class PatientDetailsHeader extends PureComponent {
    render() {
        const { generateQRCode, headerData, handleButtonClick } = this.props;
        // if(headerData && headerData[0]) {
        //     const item = headerData.data.getPatientVisits[0];
        //     console.log('headerData', item);
        //     // const patientDetails = {
 
        //     // }
        // }
        return (
            <Grid container className='patient-detailsProfile-header'>
                <Grid container>
                    <Grid item className='patientDetail-back page-title__container'>
                        <Link to='/' className='back-btn'>
                            <FontAwesomeIcon icon={faChevronLeft} />
                        </Link>
                        <Typography component='h2' variant='h6'>
                            {i18next.t('patientProfile.title')}
                        </Typography>
                    </Grid>
                </Grid>
 
                {headerData && headerData[0] ? (
                    <Grid container className='patientHeader'>
                        {/* <Grid container> */}
                        <Grid item xs sm={12} md={8} className='patientDetail-title'>
                            <Grid container className='patient-info--container'>
                                <Grid item xs className='patient-info--row'>
                                    <Grid item className='patient-info patient-info-group-1'>
                                    <Typography variant='subheading' className='patient-info__text '>
                                    <span className='patient-info__text-title header-name'>
                                        {headerData && headerData[0] && (headerData[0].firstname || headerData[0].lastname)
                                            ? headerData[0].firstname + ' ' + headerData[0].lastname
                                            : ''}
                                        </span>
                                    </Typography>
                                    </Grid>
                                    <Grid item className='patient-info patient-info-group-2'>
                                    <Typography
                                        variant='subheading'
                                        className='patient-info__text'
                                    >
                                        <span className='patient-info__text-title'>
                                            <FontAwesomeIcon icon={faVenusMars} className='patient-info__text-icon'/>
                                            {i18next.t('patientProfile.gender')}: 
                                        </span>
                                        <span className='patient-info__text-content'>&nbsp;
                                            {headerData && headerData[0] && headerData[0].gender
                                                ? headerData[0].gender
                                                : ''}
                                        </span>
                                    </Typography>
                                    </Grid>
                                    <Grid item className='patient-info patient-info-group-3'>
                                    <Typography
                                        variant='subheading'
                                        className='patient-info__text'
                                    >
                                        <span className='patient-info__text-title'>
                                            <FontAwesomeIcon icon={faEnvelope} className='patient-info__text-icon'/>
                                            {i18next.t('patientProfile.email')}: 
                                        </span>
                                        <span className='patient-info__text-content'>&nbsp;
                                            {headerData && headerData[0] && headerData[0].emailid
                                                ? headerData[0].emailid
                                                : ''}
                                        </span>
                                    </Typography>
                                    </Grid>
 
                                </Grid>
                                <Grid item xs className='patient-info--row'>
                                    <Grid item className='patient-info patient-info-group-1'>
                                    <Typography variant='subheading' className='patient-info__text'>
                                    <span className='patient-info__text-title'>
                                    {i18next.t('patientProfile.mrn')}: 
                                    </span>
                                        <span className='patient-info__text-content'>&nbsp;
                                         {headerData && headerData[0] && headerData[0].mrn
                                            ? headerData[0].mrn
                                            : ''}
                                        </span>
                                    </Typography>
                                    </Grid>
                                    <Grid item className='patient-info patient-info-group-2'>
                                    <Typography
                                        variant='subheading'
                                        className='patient-info__text'
                                    >
                                        <span className='patient-info__text-title'>
                                            <FontAwesomeIcon icon={faBirthdayCake} className='patient-info__text-icon'/>
                                            {i18next.t('patientProfile.dob')}: 
                                        </span>
                                        <span className='patient-info__text-content'>&nbsp;
                                            {headerData && headerData[0] && headerData[0].dob
                                                ? moment(headerData[0].dob).format('MM/DD/YYYY')
                                                : ''}
                                        </span>
                                    </Typography>
                                    </Grid>
                                </Grid>
                            </Grid>
                        </Grid>
                        
 
                        <Grid item xs className='patientDetailHeader-btn'>
                            <PatientDetailsHeaderButton generateQRCode={generateQRCode} />
                        </Grid>
                    </Grid>
                ) : (
                        <Loader />
                    )}
            </Grid>
        );
    }
}
const mapStateToProps = ({ questionnarieReducer }) => {
    return {
        headerData: questionnarieReducer.patientProfileInfolist.data
    };
};
 
export default connect(mapStateToProps)(PatientDetailsHeader);