import React, {Component} from 'react';
import {observer} from 'mobx-react';
import * as mobx from 'mobx';
import {WeaAlertPage, WeaLocaleProvider} from 'ecCom';
import ConditionBar from './ConditionBar';
import Calendar from './Calendar';
const getLabel = WeaLocaleProvider.getLabel;

@observer
export default class Left extends Component{
    getErrorMsg = () => {
        const {store: {hrmName}} = this.props;
        const errorMsg = getLabel('386500',"您无权查看 {params} 的排班数据！").replace('{params}', `<span class='hasRight'>${hrmName || getLabel('130758',"我")}</span>`);
        return errorMsg;
    }

    render(){
        const {store} = this.props;
        const {hasRight} = store;

        return (
            <div className='right'>
                <ConditionBar ecId={`${this && this.props && this.props.ecId || ''}_ConditionBar@wu7ftb`} store={store} />
                {
                    hasRight 
                    ? 
                    <Calendar ecId={`${this && this.props && this.props.ecId || ''}_Calendar@2yhgqt`} store={store} /> 
                    : 
                    <div className='calendar'>
                        <WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@uisr6a`}>
                            <div dangerouslySetInnerHTML={{__html: this.getErrorMsg()}}></div>
                        </WeaAlertPage>
                    </div>
                }
            </div>
        )
    }
}