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'>
{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'>
{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'>
{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'>
{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);
|