import React from 'react';
import { Badge, Row, Col, Button } from 'react-bootstrap';
import CaseComments from './case-comments';
import { Card, Fa, FormDialog } from '../../components';
import { server } from '../../commons/server';
const fschema = {
title: __('cases.comorbidities'),
controls: [
{
property: 'alcoholExcessiveUse',
type: 'yesNo',
label: __('TbCase.alcoholExcessiveUse'),
defaultValue: false,
size: { md: 12 }
},
{
property: 'tobaccoUseWithin',
type: 'yesNo',
label: __('TbCase.tobaccoUseWithin'),
defaultValue: false,
size: { md: 12 }
},
{
property: 'aids',
type: 'yesNo',
label: __('TbCase.aids'),
defaultValue: false,
size: { md: 12 }
},
{
property: 'diabetes',
type: 'yesNo',
label: __('TbCase.diabetes'),
defaultValue: false,
size: { md: 12 }
},
{
property: 'anaemia',
type: 'yesNo',
label: __('TbCase.anaemia'),
defaultValue: false,
size: { md: 12 }
},
{
property: 'malnutrition',
type: 'yesNo',
label: __('TbCase.malnutrition'),
defaultValue: false,
size: { md: 12 }
}
]
};
export default class CaseComorbidities extends React.Component {
constructor(props) {
super(props);
this.save = this.save.bind(this);
this.showForm = this.showForm.bind(this);
this.headerRender = this.headerRender.bind(this);
this.state = { showForm: false };
}
componentWillMount() {
const tbcase = this.props.tbcase;
// create data for UI controlling
const trueOnes = !tbcase || !tbcase.comorbidities ? [] : fschema.controls.filter(item => tbcase.comorbidities[item.property]);
// create doc
const doc = {};
trueOnes.forEach(item => { doc[item.property] = true; });
this.setState({ uidata: trueOnes, doc: doc });
}
headerRender() {
let size = 12;
const hasPerm = true;
let btn;
if (hasPerm && this.state.showForm === false) {
btn = ;
size = 10;
}
else {
btn = null;
}
return (