import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import { Button } from "antd";
import SalaryStatisticsDetailShareDialog from "./salaryStatisticsDetailShareDialog";
import SalaryStatisticsDetailShareRecord from "./salaryStatisticsDetailShareRecord";

const { getLabel } = WeaLocaleProvider;

class TopBtns extends Component {
  constructor(props) {
    super(props);
    this.state = {
      shareDialog: {
        visible: false
      },
      shareRecordDialog: {
        visible: false
      }
    };
  }

  handleShare = () => {
    this.setState({
      shareDialog: { visible: true }
    });
  };
  handleShareRecord = () => {
    this.setState({
      shareRecordDialog: { visible: true }
    });
  };

  render() {
    const { shareDialog, shareRecordDialog } = this.state;
    return [
      <Button type="ghost" style={{ marginRight: 10 }} onClick={this.handleShare}>{getLabel(111, "分享报表")}</Button>,
      <Button type="ghost" onClick={this.handleShareRecord}>{getLabel(111, "分享记录")}</Button>,
      <SalaryStatisticsDetailShareDialog
        {...shareDialog}
        onCancel={() => this.setState({
          shareDialog: { visible: false }
        })}
      />,
      <SalaryStatisticsDetailShareRecord
        {...shareRecordDialog}
        onClose={() => this.setState({
          shareRecordDialog: { visible: false }
        })}
      />
    ];
  }
}

export default TopBtns;
