const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../CustomerCard/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let _pisell_utils = require("@pisell/utils");
let _pisell_materials = require("@pisell/materials");
let _pisell_icon_es_PlusCircle = require("@pisell/icon/es/PlusCircle");
_pisell_icon_es_PlusCircle = require_runtime.__toESM(_pisell_icon_es_PlusCircle);
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
let _pisell_icon_es_CheckCircle = require("@pisell/icon/es/CheckCircle");
_pisell_icon_es_CheckCircle = require_runtime.__toESM(_pisell_icon_es_CheckCircle);
require("./index.less");
//#region src/components/pisellSelectCustomerModal/RightPanel/List/index.tsx
const CustomerList = (props) => {
	const { value, onChange, phone, customerOrigin, onLoadMore, loading, setPage } = props;
	const list = (0, react.useMemo)(() => {
		return (customerOrigin === null || customerOrigin === void 0 ? void 0 : customerOrigin.list) || [];
	}, [customerOrigin, phone]);
	return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, list.length ? /* @__PURE__ */ react.default.createElement("div", { className: "select-customer-right-panel-list" }, list.map((item) => {
		const active = item.id === (value === null || value === void 0 ? void 0 : value.id);
		return /* @__PURE__ */ react.default.createElement(require_index.default, {
			key: item.id,
			className: (0, classnames.default)("select-customer-right-panel-item", { "select-customer-right-panel-item-active": active }),
			customer: item,
			showIcon: active,
			customIcon: /* @__PURE__ */ react.default.createElement(_pisell_icon_es_CheckCircle.default, { style: {
				fontSize: 28,
				color: "#079455"
			} }),
			onClickItem: () => {
				onChange(item);
			}
		});
	}), customerOrigin.list.length < customerOrigin.count ? /* @__PURE__ */ react.default.createElement("div", { className: "select-customer-right-panel-load-more" }, /* @__PURE__ */ react.default.createElement(antd.Button, {
		onClick: onLoadMore,
		loading
	}, _pisell_utils.locales.getText("pisell2.text.load-more"))) : null) : !loading ? /* @__PURE__ */ react.default.createElement(_pisell_materials.PisellEmpty, {
		description: _pisell_utils.locales.getText("pisell2.text.no-results-found"),
		imageStyle: { height: "auto" },
		extraDescription: /* @__PURE__ */ react.default.createElement("div", {
			className: "select-customer-right-panel-add",
			onClick: () => {
				setPage("create");
			}
		}, /* @__PURE__ */ react.default.createElement(_pisell_icon_es_PlusCircle.default, { className: "select-customer-right-panel-header-icon" }), /* @__PURE__ */ react.default.createElement("span", null, _pisell_utils.locales.getText("pisell2.text.create-new-client")))
	}) : /* @__PURE__ */ react.default.createElement(antd.Skeleton, {
		round: true,
		active: true
	}));
};
//#endregion
exports.default = CustomerList;
