import {
    inject,
    observer
} from 'mobx-react'
import {
    WeaTab
} from 'ecCom'

@inject('hrmRecruitInfo') //todo
@observer
export default class MainTab extends React.Component {
    constructor(props) {
        super(props);
    }

    componentDidMount() {
        this.props.hrmRecruitInfo.getSearchCondition();
    }

    render() {
        const {
            hrmRecruitInfo
        } = this.props, {
            mainTab,
            buttonsAd,
            changePanelStatus,
            searchsAd,
            handleSearch,
            setSearchsBaseValue
        } = hrmRecruitInfo, {
            isPanelShow,
            conditionCount,
            form,
            baseValue,
        } = mainTab;

        return (
            <WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@e1lkiq`}
                searchType={['base','advanced']}
                showSearchAd={isPanelShow}
                hasMask={false}
                advanceHeight={Math.ceil(conditionCount / 2)*52+20}
                buttonsAd={buttonsAd}
                searchsBaseValue={baseValue}
                setShowSearchAd={  b => changePanelStatus(b)}
                hideSearchAd={ () => changePanelStatus(false)}
                searchsAd= {searchsAd}
                onSearch={() => handleSearch()}
                onSearchChange={val => setSearchsBaseValue(val)}
            />
        )

    }
}