const require_runtime = require("../../../../../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../../../../../../locales/index.js");
const require_date = require("../../utils/date.js");
const require_file = require("../../utils/file.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
require("./index.less");
//#region src/components/table/Actions/component/ExportImport/components/ImportLog/Detail.tsx
const Detail = (props, ref) => {
	const [list, setList] = (0, react.useState)([]);
	const [open, setOpen] = (0, react.useState)(false);
	const columns = [
		{
			title: require_index.getText("table-action-export-import-log-name"),
			dataIndex: "file_name"
		},
		{
			title: require_index.getText("table-action-export-import-log-result"),
			dataIndex: "result",
			render: (text) => {
				return /* @__PURE__ */ react.default.createElement("div", null, require_index.getText("table-action-export-import-log-ok")((text === null || text === void 0 ? void 0 : text.success) || 0), (text === null || text === void 0 ? void 0 : text.fail) ? require_index.getText("table-action-export-import-log-err")((text === null || text === void 0 ? void 0 : text.fail) || 0) : null);
			}
		},
		{
			title: require_index.getText("table-action-export-import-file-account"),
			dataIndex: "account",
			render: (text) => {
				return text ? /* @__PURE__ */ react.default.createElement("div", null, `${(text === null || text === void 0 ? void 0 : text.first_name) || ""} ${(text === null || text === void 0 ? void 0 : text.last_name) || ""}`) : null;
			}
		},
		{
			title: require_index.getText("table-action-export-import-file-created"),
			dataIndex: "created_at",
			render: (text) => require_date.formatDate(text)
		}
	];
	const modalContent = (0, react.useMemo)(() => {
		var _list$2;
		return /* @__PURE__ */ react.default.createElement("div", { className: "export-history-content" }, /* @__PURE__ */ react.default.createElement(antd.Table, {
			rowClassName: "antd-table-row",
			columns,
			dataSource: list,
			pagination: false,
			rowKey: (record) => record.id,
			scroll: { x: true }
		}), /* @__PURE__ */ react.default.createElement("div", { className: "error-content" }, /* @__PURE__ */ react.default.createElement("div", { className: "header" }, /* @__PURE__ */ react.default.createElement("span", null, require_index.getText("table-action-export-import-log-err-log")), /* @__PURE__ */ react.default.createElement("a", { onClick: () => {
			var _list$;
			require_file.copyText((list === null || list === void 0 || (_list$ = list[0]) === null || _list$ === void 0 || (_list$ = _list$.result) === null || _list$ === void 0 || (_list$ = _list$.fail_msg) === null || _list$ === void 0 ? void 0 : _list$.join(",")) || "");
		} }, require_index.getText("table-action-export-import-log-copy"))), /* @__PURE__ */ react.default.createElement("div", { className: "box" }, list === null || list === void 0 || (_list$2 = list[0]) === null || _list$2 === void 0 || (_list$2 = _list$2.result) === null || _list$2 === void 0 || (_list$2 = _list$2.fail_msg) === null || _list$2 === void 0 ? void 0 : _list$2.map((i, index) => {
			return /* @__PURE__ */ react.default.createElement("div", { key: index }, i);
		}))));
	}, [list]);
	(0, react.useImperativeHandle)(ref, () => {
		return { open: (params) => {
			setList((params === null || params === void 0 ? void 0 : params.list) || []);
			setOpen(true);
		} };
	});
	return /* @__PURE__ */ react.default.createElement(antd.Modal, {
		open,
		title: require_index.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, react.forwardRef)(Detail);
//#endregion
exports.default = Detail_default;
