import React from 'react'; import { Row, Col, Button } from 'react-bootstrap'; import { Card, RemoteForm, Fa } from '../../components'; import { app } from '../../core/app'; import { hasPerm } from '../session'; import Events from './events'; import CasePrevTbTreats from './case-prev-tb-treats'; import CaseContacts from './case-contacts'; import CaseAdvReacts from './case-adv-reacts'; import CaseComorbidities from './case-comorbidities'; import CaseComments from './case-comments'; export default class CaseData extends React.Component { onEditClick() { app.dispatch(Events.caseEditForm); } render() { const tbcase = this.props.tbcase; if (!tbcase) { return null; } const path = '/api/tbl/case/form/readonly/' + tbcase.id; const editBtn = React.createElement( Button, { onClick: this.onEditClick, bsSize: 'small' }, React.createElement(Fa, { icon: 'pencil' }), __('action.edit') ); return React.createElement( 'div', null, React.createElement( Row, null, React.createElement( Col, { sm: 12 }, React.createElement( CaseComments, { tbcase: tbcase, group: 'DATA' }, React.createElement( Card, { padding: 'combine', headerRight: editBtn }, React.createElement(RemoteForm, { remotePath: path, onLoadForm: this.props.onLoad, readOnly: true }) ) ) ) ), React.createElement( Row, null, hasPerm('ADV_EFFECTS') && React.createElement( Col, { sm: 6 }, React.createElement(CaseAdvReacts, { tbcase: this.props.tbcase }) ), hasPerm('COMIRBIDITIES') && React.createElement( Col, { sm: 6 }, React.createElement(CaseComorbidities, { tbcase: this.props.tbcase }) ) ), React.createElement( Row, null, React.createElement( Col, { sm: 6 }, React.createElement(CasePrevTbTreats, { tbcase: this.props.tbcase }) ), hasPerm('CASECONTACT') && React.createElement( Col, { sm: 6 }, React.createElement(CaseContacts, { tbcase: this.props.tbcase }) ) ) ); } } CaseData.propTypes = { tbcase: React.PropTypes.object, onLoad: React.PropTypes.any };