var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/table/Actions/component/ExportImport/components/ImportLog/Detail.tsx
var Detail_exports = {};
__export(Detail_exports, {
  default: () => Detail_default
});
module.exports = __toCommonJS(Detail_exports);
var import_antd = require("antd");
var import_react = __toESM(require("react"));
var import_locales = require("../../../../../../../locales/index");
var import_date = require("../../utils/date");
var import_file = require("../../utils/file");
var import_index = require("./index.less");
var Detail = (props, ref) => {
  const [list, setList] = (0, import_react.useState)([]);
  const [open, setOpen] = (0, import_react.useState)(false);
  const columns = [
    {
      title: (0, import_locales.getText)("table-action-export-import-log-name"),
      dataIndex: "file_name"
    },
    {
      title: (0, import_locales.getText)("table-action-export-import-log-result"),
      dataIndex: "result",
      render: (text) => {
        return /* @__PURE__ */ import_react.default.createElement("div", null, (0, import_locales.getText)("table-action-export-import-log-ok")((text == null ? void 0 : text.success) || 0), (text == null ? void 0 : text.fail) ? (0, import_locales.getText)("table-action-export-import-log-err")((text == null ? void 0 : text.fail) || 0) : null);
      }
    },
    {
      title: (0, import_locales.getText)("table-action-export-import-file-account"),
      dataIndex: "account",
      render: (text) => {
        return text ? /* @__PURE__ */ import_react.default.createElement("div", null, `${(text == null ? void 0 : text.first_name) || ""} ${(text == null ? void 0 : text.last_name) || ""}`) : null;
      }
    },
    {
      title: (0, import_locales.getText)("table-action-export-import-file-created"),
      dataIndex: "created_at",
      render: (text) => (0, import_date.formatDate)(text)
    }
  ];
  const modalContent = (0, import_react.useMemo)(() => {
    var _a, _b, _c;
    return /* @__PURE__ */ import_react.default.createElement("div", { className: "export-history-content" }, /* @__PURE__ */ import_react.default.createElement(
      import_antd.Table,
      {
        rowClassName: "antd-table-row",
        columns,
        dataSource: list,
        pagination: false,
        rowKey: (record) => record.id,
        scroll: { x: true }
      }
    ), /* @__PURE__ */ import_react.default.createElement("div", { className: "error-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "header" }, /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_locales.getText)("table-action-export-import-log-err-log")), /* @__PURE__ */ import_react.default.createElement(
      "a",
      {
        onClick: () => {
          var _a2, _b2, _c2;
          let text = ((_c2 = (_b2 = (_a2 = list == null ? void 0 : list[0]) == null ? void 0 : _a2.result) == null ? void 0 : _b2.fail_msg) == null ? void 0 : _c2.join(",")) || "";
          (0, import_file.copyText)(text);
        }
      },
      (0, import_locales.getText)("table-action-export-import-log-copy")
    )), /* @__PURE__ */ import_react.default.createElement("div", { className: "box" }, (_c = (_b = (_a = list == null ? void 0 : list[0]) == null ? void 0 : _a.result) == null ? void 0 : _b.fail_msg) == null ? void 0 : _c.map((i, index) => {
      return /* @__PURE__ */ import_react.default.createElement("div", { key: index }, i);
    }))));
  }, [list]);
  (0, import_react.useImperativeHandle)(ref, () => {
    return {
      open: (params) => {
        setList((params == null ? void 0 : params.list) || []);
        setOpen(true);
      }
    };
  });
  return /* @__PURE__ */ import_react.default.createElement(
    import_antd.Modal,
    {
      open,
      title: (0, import_locales.getText)("table-action-export-import-log-detail-title"),
      width: 900,
      footer: null,
      destroyOnClose: true,
      onCancel: () => setOpen(false),
      className: "antd-modal-detail-modal"
    },
    modalContent
  );
};
var Detail_default = (0, import_react.forwardRef)(Detail);
