/*
 * Author: 黎永顺
 * name: 薪资账套-编辑薪资项目项
 * Description:
 * Date: 2023/07/19
 */
import React, { Component } from "react";
import { WeaLocaleProvider, WeaSlideModal } from "ecCom";
import SlideModalTitle from "../../../components/slideModalTitle";
import SalaryItemForm from "../../salaryItem/salaryItemForm";
import "./index.less";

const getLabel = WeaLocaleProvider.getLabel;

class LedgerSalaryItemEditSlide extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  handleChange = (params) => {
    const request = { ...this.props.request, ...params };
    const key = Object.keys(params)[0];
    this.props.onUpdateRequest(request, key);
  };
  handleShowFormal = (salaryItemName) => this.props.onEditFormnul(salaryItemName);

  render() {
    return (
      <WeaSlideModal
        {...this.props}
        className="salaryItemEditWrapper"
        top={0} width={80} height={100}
        direction="right" measure="%"
        title={
          <SlideModalTitle
            subtitle={getLabel(111, "编辑薪资项目")} showOperateBtn
            loading={this.props.loading} editable onSave={this.props.onSave}
          />
        }
        content={
          <div style={{ padding: 16 }}>
            {
              this.props.visible &&
              <SalaryItemForm
                {...this.props} editable
                onChangeFieldsItem={this.handleChange} onShowFormal={this.handleShowFormal}
              />
            }
          </div>
        }
      />
    );
  }
}

export default LedgerSalaryItemEditSlide;
