import React from "react";
import { WeaLocaleProvider, WeaSelect, WeaTools } from "ecCom";
import { Button } from "antd";
import AdvanceInputBtn from "./components/advanceInputBtn";

const getKey = WeaTools.getKey;
const getLabel = WeaLocaleProvider.getLabel;

export const tabWelfarePlanList = [
  { key: "SOCIAL_SECURITY", title: "社保", lanId: 538967 },
  { key: "ACCUMULATION_FUND", title: "公积金", lanId: 538969 },
  { key: "OTHER", title: "企业年金及其他福利", lanId: 542717 },
  { key: "CUSTOM", title: "自定义福利", lanId: 543151 }
];
export const welfarePlanCustomTipList = [
  { lanId: 544345, title: "1、可以为社保、公积金、企业年金及其他福利新增自定义的福利项，如：残疾保险等" },
  {
    lanId: 544346,
    title: "2、新增自定义福利默认启用，社保福利方案中的自定义福利项均未开启缴纳，当前页面的自定义福利项才可以停用；停用后再新增方案时没有该福利项"
  },
  { lanId: 544347, title: "3、自定义福利若要缴纳，需要在方案里填写缴纳相关数据" }
];
/*
 * Author: 黎永顺
 * Description: 社保福利方案-头部操作
 * Params:
 * Date: 2024/2/2
 */
export const renderDropMenuDatas = (selectedKey, showOperateBtn) => {
  return [{
    key: "log",
    icon: <i className="iconfont icon-caozuorizhi32"/>,
    content: getLabel(545781, "操作日志")
  }];
};
export const renderReqBtns = (selectedKey, onSalaryOpts, showOperateBtn, customQuery) => {
  let reqBtns = [
    <Button type="primary" onClick={() => onSalaryOpts("ADD")}>{getLabel(365, "新建")}</Button>,
    <AdvanceInputBtn onOpenAdvanceSearch={() => onSalaryOpts("OPEN")} onAdvanceSearch={() => onSalaryOpts("SEARCH")}/>
  ];
  switch (selectedKey) {
    case "CUSTOM":
      reqBtns[reqBtns.length - 1] = <WeaSelect style={{ width: 220 }} onChange={v => onSalaryOpts("SEARCH", v)}
                                               value={customQuery}
                                               options={[
                                                 { key: "", showname: getLabel(332, "全部"), selected: true },
                                                 { key: "SOCIAL_SECURITY", showname: getLabel(538967, "社保") },
                                                 { key: "ACCUMULATION_FUND", showname: getLabel(538969, "公积金") },
                                                 { key: "OTHER", showname: getLabel(542717, "企业年金及其他福利") }
                                               ]}
      />;
      break;
    default:
      break;
  }
  !showOperateBtn && reqBtns.shift();
  return reqBtns;
};
export const searchConditons = [
  {
    items: [
      {
        colSpan: 2,
        conditionType: "INPUT",
        domkey: ["schemeName"],
        fieldcol: 16,
        isQuickSearch: true,
        label: getLabel(33162, "方案名称"),
        lanId: 33162,
        labelcol: 8,
        value: "",
        viewAttr: 2
      },
      {
        colSpan: 2,
        conditionType: "SELECT",
        domkey: ["paymentTypeEnum"],
        fieldcol: 16,
        isQuickSearch: true,
        label: getLabel(543163, "缴纳类型"),
        lanId: 543163,
        labelcol: 8,
        value: "",
        options: [
          { key: "SCHEME_TOWN", showname: getLabel(19702, "城镇"), lanId: 19702 },
          { key: "SCHEME_VILLAGE", showname: getLabel(19703, "农村"), lanId: 19703 }
        ],
        viewAttr: 2
      }
    ],
    title: getLabel(82743, "基础信息"),
    lanId: 82743,
    defaultshow: true
  }
];
export const welfarePlanCopyConditions = {
  SOCIAL_SECURITY: [
    {
      items: [
        {
          conditionType: "INPUT",
          domkey: ["SOCIAL_SECURITY_schemeName"],
          fieldcol: 16,
          label: getLabel(111, "社保名称"),
          lanId: 111,
          labelcol: 8,
          value: "",
          rules: "required|string",
          viewAttr: 3
        }
      ],
      defaultshow: true,
      title: "",
      col: 1
    }
  ],
  ACCUMULATION_FUND: [
    {
      items: [
        {
          conditionType: "INPUT",
          domkey: ["ACCUMULATION_FUND_schemeName"],
          fieldcol: 16,
          label: getLabel(111, "公积金名称"),
          lanId: 111,
          labelcol: 8,
          value: "",
          rules: "required|string",
          viewAttr: 3
        }
      ],
      defaultshow: true,
      title: "",
      col: 1
    }
  ],
  OTHER: [
    {
      items: [
        {
          conditionType: "INPUT",
          domkey: ["OTHER_schemeName"],
          fieldcol: 16,
          label: getLabel(111, "企业年金及其他福利名称"),
          lanId: 111,
          labelcol: 8,
          value: "",
          rules: "required|string",
          viewAttr: 3
        }
      ],
      defaultshow: true,
      title: "",
      col: 1
    }
  ]
};
export const planConditons = [
  {
    items: [
      {
        conditionType: "SELECT",
        domkey: ["paymentType"],
        fieldcol: 14,
        label: getLabel(543163, "缴纳类型"),
        lanId: 543163,
        labelcol: 6,
        options: [
          { key: "SCHEME_TOWN", showname: getLabel(19702, "城镇"), lanId: 19702 },
          { key: "SCHEME_VILLAGE", showname: getLabel(19703, "农村"), lanId: 19703 }
        ],
        value: "SCHEME_TOWN",
        rules: "required|string",
        viewAttr: 3
      },
      {
        conditionType: "INPUT",
        domkey: ["schemeName"],
        fieldcol: 14,
        label: getLabel(33162, "方案名称"),
        lanId: 33162,
        labelcol: 6,
        value: "",
        rules: "required|string",
        viewAttr: 3
      },
      {
        conditionType: "SELECT",
        domkey: ["sharedType"],
        fieldcol: 14,
        label: getLabel(543164, "可见性"),
        lanId: 543164,
        labelcol: 6,
        options: [
          { key: "0", showname: getLabel(111, "公共"), lanId: 111 },
          { key: "1", showname: getLabel(111, "私有"), lanId: 111 }
        ],
        value: "0",
        rules: "required|string",
        viewAttr: 3
      },
      {
        conditionType: "SELECT",
        domkey: ["taxAgentIds"],
        fieldcol: 14,
        label: getLabel(543165, "可见性范围"),
        lanId: 543165,
        labelcol: 6,
        multiple: true,
        options: [],
        value: "",
        hide: true,
        viewAttr: 2
      },
      {
        conditionType: "TEXTAREA",
        domkey: ["remarks"],
        fieldcol: 14,
        label: getLabel(536726, "备注"),
        lanId: 536726,
        labelcol: 6,
        value: "",
        viewAttr: 2
      }
    ],
    title: getLabel(82743, "基础信息"),
    lanId: 82743,
    defaultshow: true
  }
];
export const customPlanConditons = [
  {
    items: [
      {
        conditionType: "INPUT",
        domkey: ["insuranceName"],
        fieldcol: 14,
        label: getLabel(111, "福利名称"),
        labelcol: 8,
        value: "",
        rules: "required|string",
        viewAttr: 3
      },
      {
        conditionType: "SELECT",
        domkey: ["welfareType"],
        fieldcol: 14,
        label: getLabel(500401, "类型"),
        labelcol: 8,
        options: [
          { key: "SOCIAL_SECURITY", showname: getLabel(538967, "社保") },
          { key: "ACCUMULATION_FUND", showname: getLabel(538969, "公积金") },
          { key: "OTHER", showname: getLabel(542717, "企业年金及其他福利") }
        ],
        value: "SOCIAL_SECURITY",
        detailtype: 3,
        rules: "required|string",
        viewAttr: 3
      },
      {
        conditionType: "SELECT",
        domkey: ["paymentScope"],
        fieldcol: 16,
        label: getLabel(543169, "缴纳对象"),
        labelcol: 8,
        options: [
          { key: "SCOPE_COMPANY", showname: getLabel(1851, "公司") },
          { key: "SCOPE_PERSON", showname: getLabel(500201, "个人") }
        ],
        detailtype: 2,
        rules: "required|string",
        viewAttr: 3
      }
    ],
    title: "",
    defaultshow: true
  }
];


