const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
let dayjs = require("dayjs");
dayjs = require_runtime.__toESM(dayjs);
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
//#region src/plus/orderList/components/FilterList.tsx
const { useContainerContext } = require("@pisell/materials").PisellDataSourceContainer;
const FilterList = ({ locales, valueType, setValueType }) => {
	const form = antd.Form.useFormInstance();
	const { serverActions } = useContainerContext();
	const { list } = serverActions;
	const handleTodayClick = () => {
		const today = (0, dayjs.default)();
		const params = {
			orderDate: [today.startOf("day"), today.endOf("day")],
			payment_status: void 0
		};
		form.setFieldsValue(params);
		list.onSearch(params);
		setValueType(1);
	};
	const handleTodayToPayClick = () => {
		const today = (0, dayjs.default)();
		const params = {
			orderDate: [today.startOf("day"), today.endOf("day")],
			payment_status: ["payment_processing", "unpaid"]
		};
		form.setFieldsValue(params);
		list.onSearch(params);
		setValueType(2);
	};
	const handleTodayRefundsClick = () => {
		const today = (0, dayjs.default)();
		const params = {
			orderDate: [today.startOf("day"), today.endOf("day")],
			payment_status: ["refunded", "partially_refunded"]
		};
		form.setFieldsValue(params);
		list.onSearch(params);
		setValueType(3);
	};
	const handleLast7DaysClick = () => {
		const today = (0, dayjs.default)();
		const params = {
			orderDate: [today.subtract(6, "day").startOf("day"), today.endOf("day")],
			payment_status: void 0
		};
		form.setFieldsValue(params);
		list.onSearch(params);
		setValueType(4);
	};
	return /* @__PURE__ */ react.default.createElement("div", { style: {
		display: "flex",
		gap: "8px"
	} }, /* @__PURE__ */ react.default.createElement(antd.Button, {
		type: "primary",
		ghost: valueType !== 1,
		onClick: handleTodayClick
	}, locales.getText("pisell2.orderList.filterButton.todayOrders")), /* @__PURE__ */ react.default.createElement(antd.Button, {
		type: "primary",
		ghost: valueType !== 2,
		onClick: handleTodayToPayClick
	}, locales.getText("pisell2.orderList.filterButton.todayPending")), /* @__PURE__ */ react.default.createElement(antd.Button, {
		type: "primary",
		ghost: valueType !== 3,
		onClick: handleTodayRefundsClick
	}, locales.getText("pisell2.orderList.filterButton.todayRefunds")), /* @__PURE__ */ react.default.createElement(antd.Button, {
		type: "primary",
		ghost: valueType !== 4,
		onClick: handleLast7DaysClick
	}, locales.getText("pisell2.orderList.filterButton.last7Days")));
};
//#endregion
exports.default = FilterList;
