import React, { Component } from 'react';
import PropTypes from 'prop-types';

/**
 *
 *
 * @class AddDevicePanelHead
 * @extends {Component}
 */
class AddDevicePanelHead extends Component {
  constructor(props){
    super(props);
    this.state = {

    };
  }
  componentWillMount() {

  }

  componentDidMount(){

  }

  componentWillReceiveProps(nextProps) {

  }

  componentWillUnmount() {

  }

  onBackAction = () => {
    let { resourceFlag,device,pageConfig } = this.props;
    this.props.updateMainView({ flag: resourceFlag,device,pageConfig });
  }


  render() {
    let { enable } = this.props;
    return (
      <div className='add-device-panel-head-root'>
        {/*<div className='add-device-panel-head-help'>
          <img src={require('./../../../assets/iot/deviceManage/help.png')} alt='' />
    </div>*/}
        {enable ? <div className='add-device-panel-head-save'>
          <img src={require('./../../../assets/iot/deviceManage/save.png')} onClick={this.props.saveEquipmentAction} alt='' />
        </div> : ''}
        <div className='add-device-panel-head-back' onClick={this.onBackAction}>
          <img src={require('./../../../assets/iot/deviceManage/back.png')} alt='' />
        </div>
      </div>
    );
  }
}

AddDevicePanelHead.propTypes = {
  updateMainView: PropTypes.func,
  device: PropTypes.object,
  resourceFlag: PropTypes.string,
  saveEquipmentAction: PropTypes.func,
  enable: PropTypes.bool,
  pageConfig: PropTypes.func
};

export default AddDevicePanelHead;
