import {
	WeaFormItem,
	WeaLocaleProvider,
} from 'ecCom';
import {
	WeaSwitch
} from 'comsMobx';
const getLabel = WeaLocaleProvider.getLabel;

class DirtyComponent extends React.Component {
	constructor(props) {
		super(props);
	}

	getChildren = () => {
		const {
			domkey,
			label,
			form,
			item,
		} = this.props;

		const stuff = (<div style={{display:'inline-block',width: 60 ,marginRight: 14}}>
						<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@s24nrm`} fieldConfig={item} form={form} formParams={form.getFormParams()} />
					  </div>);

		if (domkey === 'startTime2') {
			return (<div>
						<span style={{marginRight: 8}}>
							{`${getLabel('505600',"最后一次下班后")}`}
						</span>
						{stuff}
						<span>
							{`${getLabel('15049',"分钟")}, ${getLabel('505601',"开始计算加班")}` }
						</span> 
				   </div>)
		} else {
			return (<div>
						{stuff} 
						<span>
							{`${getLabel('15049',"分钟")}`}
						</span>
						<span style={{marginLeft: 15, color:'#999'}}>
							{`${getLabel('505602',"小于该时长则加班时长记为0")}`}
						</span>
					</div>)
		}
	}

	render() {
		const {
			label,
			form,
			item
		} = this.props;

		return (
			<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@2w4kyf`}
			    label={label}
			    labelCol={{span: 6}}
			    wrapperCol={{span: 18}}
			    error={form.getError(item)} 
	 			tipPosition='bottom'
	 			style={{width: '110%', padding:'4px 0',marginBottom: 4}}
          	>	
          		{this.getChildren()}
          	</WeaFormItem>
		)
	}
}


export default DirtyComponent