import React from 'react'; import { Card, Fa } from '../../components'; import SessionUtils from '../session-utils'; import moment from 'moment'; export default class OtherCases extends React.Component { renderOtherCase(data, index) { if (this.props.tbcase.id === data.id) { return null; } return (
{SessionUtils.classifDisplay(data.classification.id, data.diagnosisType.id)}
{__('TbCase.registrationDate') + ': '} {moment(data.registrationDate).format('L')}
{SessionUtils.caseStateDisplay(data.state)}
); } render() { const tbcase = this.props.tbcase; // don't have other cases if (tbcase.allCases.length <= 1) { return (
{__('cases.details.othercases.noresult')}
); } return ( { tbcase.allCases.map((item, i) => this.renderOtherCase(item, i)) } ); } } OtherCases.propTypes = { tbcase: React.PropTypes.object };