import React, {Component} from 'react';
import {observer} from 'mobx-react';
import {WeaLocaleProvider, WeaDatePicker} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;

@observer
export default class ConditionBar extends Component{
    render(){
        const {store} = this.props;
        const {dateTabkey, pDate, changeDateTabHandler, changeDateHandler, getData} = store;
        return (
            <div className='conditionBar'>
                {
                    [{title:getLabel('26577',"年"),key:"1"}, {title:getLabel(6076, '月'),key:"2"}].map((item,index)=> (
                        <div style={(index == 1 && window.e9_locale.userLanguage == "8") ? {marginRight: 20} : {}} className={`dateType ${dateTabkey == item.key ? 'dateType-active' : ''}`} onClick={() => changeDateTabHandler(item.key)}>{item.title}</div>
                    ))
                }
                <div>
                    <WeaDatePicker ecId={`${this && this.props && this.props.ecId || ''}_WeaDatePicker@s8foc7`} arrow type={dateTabkey == '1' ? 'year': 'month'} date={pDate} onChange={changeDateHandler}/>
                    <i className="icon-coms-Refresh" onClick={() => getData()}/>
                </div>
            </div>
        )
    }
}