import React from 'react';
import {Table, Input, Checkbox, Label} from 'semantic-ui-react';

const DoItem = ({i18n, cusKey, data, onNameChange, onLogicChange, status, onDoRun}) => {

	return (
		<Table.Row>
			<Table.Cell>
				<Label content={cusKey}/>
			</Table.Cell>
			<Table.Cell width={4}>
				<Input fluid name="doname" value={data.doname || ''} onChange={(e) => {onNameChange(cusKey, e.target.value)}} />
			</Table.Cell>
			<Table.Cell>
				<Checkbox toggle={true} label={i18n&&i18n.t ? i18n.t('page.dio.form.label.logic') : ''} checked={data.dologic == 1 ? true : false } onChange={(e, d)=>{onLogicChange(cusKey, d.checked)}} />
			</Table.Cell>
			<Table.Cell>
				<Checkbox toggle={true} label={i18n&&i18n.t ? i18n.t('page.dio.form.label.do_ctrl') : ''} checked={status == 1} onChange={(e,d) => { onDoRun(cusKey, d.checked) }} />
			</Table.Cell>
		</Table.Row>
	)
}

export default DoItem;