var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/plus/pisellSalesManagement/config/order.ts
var order_exports = {};
__export(order_exports, {
  DELIVERY_TYPE_COLOR_MAP: () => DELIVERY_TYPE_COLOR_MAP,
  FULFILLMENT_STATUS_COLOR_MAP: () => FULFILLMENT_STATUS_COLOR_MAP,
  ORDER_STATUS_COLOR_MAP: () => ORDER_STATUS_COLOR_MAP,
  PAYMENT_STATUS_COLOR_MAP: () => PAYMENT_STATUS_COLOR_MAP,
  SHOP_SERVICE_TYPE_COLOR_MAP: () => SHOP_SERVICE_TYPE_COLOR_MAP,
  defaultPaymentStatusKeys: () => defaultPaymentStatusKeys,
  getDeliveryTypeMap: () => getDeliveryTypeMap,
  getFilterButtonList: () => getFilterButtonList,
  getOrderHeaderLabels: () => getOrderHeaderLabels,
  getOrderStatusMap: () => getOrderStatusMap,
  getPaymentStatusMap: () => getPaymentStatusMap,
  getPlatformMap: () => getPlatformMap,
  getShippingStatusMap: () => getShippingStatusMap,
  getShopServiceTypeMap: () => getShopServiceTypeMap,
  getSortList: () => getSortList
});
module.exports = __toCommonJS(order_exports);
var import_utils = require("@pisell/utils");
var import_serve = require("./../../orderList/serve");
var getPaymentStatusMap = () => ({
  authorized: import_utils.locales.getText(
    "pisell2.salesManagement.order.paymentStatus.authorized"
  ),
  paid: import_utils.locales.getText("pisell2.salesManagement.order.paymentStatus.paid"),
  partially_paid: import_utils.locales.getText(
    "pisell2.salesManagement.order.paymentStatus.partially_paid"
  ),
  partially_refunded: import_utils.locales.getText(
    "pisell2.salesManagement.order.paymentStatus.partially_refunded"
  ),
  refunded: import_utils.locales.getText(
    "pisell2.salesManagement.order.paymentStatus.refunded"
  ),
  unpaid: import_utils.locales.getText("pisell2.salesManagement.order.paymentStatus.unpaid"),
  voided: import_utils.locales.getText("pisell2.salesManagement.order.paymentStatus.voided"),
  payment_processing: import_utils.locales.getText(
    "pisell2.salesManagement.order.paymentStatus.payment_processing"
  )
});
var PAYMENT_STATUS_COLOR_MAP = {
  unpaid: "#B2DDFF",
  payment_processing: "#FEDF89",
  partially_paid: "#FDB022",
  authorized: "#ABEFC6",
  paid: "#ABEFC6",
  refunded: "#FECDCA",
  partially_refunded: "#FCCEEE",
  voided: "#D0D5DD"
};
var getPlatformMap = () => ({
  online_store: import_utils.locales.getText(
    "pisell2.salesManagement.order.platform.online_store"
  ),
  wholesalebusiness: import_utils.locales.getText(
    "pisell2.salesManagement.order.platform.wholesalebusiness"
  ),
  "table-order": import_utils.locales.getText(
    "pisell2.salesManagement.order.platform.table-order"
  ),
  mobile_order: import_utils.locales.getText(
    "pisell2.salesManagement.order.platform.mobile_order"
  ),
  kiosk: import_utils.locales.getText("pisell2.salesManagement.order.platform.kiosk"),
  pos: import_utils.locales.getText("pisell2.salesManagement.order.platform.pos")
});
var getOrderStatusMap = () => ({
  open: import_utils.locales.getText("pisell2.salesManagement.order.orderStatus.open"),
  completed: import_utils.locales.getText(
    "pisell2.salesManagement.order.orderStatus.completed"
  ),
  cancelled: import_utils.locales.getText(
    "pisell2.salesManagement.order.orderStatus.cancelled"
  )
});
var ORDER_STATUS_COLOR_MAP = {
  open: { borderColor: "#1570EF", textColor: "#175CD3" },
  completed: { borderColor: "#079455", textColor: "#067647" },
  cancelled: { borderColor: "#D92D20", textColor: "#B42318" }
};
var getShippingStatusMap = () => ({
  fulfilled: import_utils.locales.getText(
    "pisell2.salesManagement.order.fulfillmentStatus.fulfilled"
  ),
  unfulfilled: import_utils.locales.getText(
    "pisell2.salesManagement.order.fulfillmentStatus.unfulfilled"
  ),
  fulfilling: import_utils.locales.getText(
    "pisell2.salesManagement.order.fulfillmentStatus.fulfilling"
  ),
  partial_fulfilled: import_utils.locales.getText(
    "pisell2.salesManagement.order.fulfillmentStatus.partial_fulfilled"
  )
});
var FULFILLMENT_STATUS_COLOR_MAP = {
  fulfilling: { borderColor: "#DC6803", textColor: "#B54708" },
  unfulfilled: { borderColor: "#DC6803", textColor: "#B54708" },
  partial_fulfilled: { borderColor: "#088AB2", textColor: "#0E7090" },
  fulfilled: { borderColor: "#475467", textColor: "#344054" }
};
var getDeliveryTypeMap = () => ({
  nil: import_utils.locales.getText("pisell2.salesManagement.order.deliveryType.nil"),
  shipping: import_utils.locales.getText(
    "pisell2.salesManagement.order.deliveryType.shipping"
  ),
  local_delivery: import_utils.locales.getText(
    "pisell2.salesManagement.order.deliveryType.local_delivery"
  ),
  pickup: import_utils.locales.getText(
    "pisell2.salesManagement.order.deliveryType.pickup"
  ),
  shop_service: import_utils.locales.getText(
    "pisell2.salesManagement.order.deliveryType.shop_service"
  )
});
var getShopServiceTypeMap = () => ({
  "dine-in": import_utils.locales.getText(
    "pisell2.salesManagement.order.shopServiceType.dine-in"
  ),
  takeaway: import_utils.locales.getText(
    "pisell2.salesManagement.order.shopServiceType.takeaway"
  )
});
var DELIVERY_TYPE_COLOR_MAP = {
  shipping: "",
  local_delivery: "orange",
  pickup: "blue"
};
var SHOP_SERVICE_TYPE_COLOR_MAP = {
  "dine-in": "green",
  takeaway: "red"
};
var getOrderHeaderLabels = () => ({
  saleBrief: import_utils.locales.getText("pisell2.salesManagement.order.column.saleBrief"),
  customer: import_utils.locales.getText("pisell2.salesManagement.order.column.customer"),
  contact: import_utils.locales.getText("pisell2.salesManagement.order.column.contact"),
  paymentInfo: import_utils.locales.getText(
    "pisell2.salesManagement.order.column.paymentInfo"
  ),
  items: import_utils.locales.getText("pisell2.salesManagement.order.column.items"),
  paymentStatus: import_utils.locales.getText(
    "pisell2.salesManagement.order.column.paymentStatus"
  ),
  orderOrigin: import_utils.locales.getText(
    "pisell2.salesManagement.order.column.orderOrigin"
  ),
  shippingMethod: import_utils.locales.getText(
    "pisell2.salesManagement.order.column.shippingMethod"
  ),
  orderStatus: import_utils.locales.getText(
    "pisell2.salesManagement.order.column.orderStatus"
  ),
  fulfillmentStatus: import_utils.locales.getText(
    "pisell2.salesManagement.order.column.fulfillmentStatus"
  ),
  updated: import_utils.locales.getText("pisell2.salesManagement.order.column.updated"),
  orderId: import_utils.locales.getText("pisell2.salesManagement.order.column.orderId"),
  orderNote: import_utils.locales.getText("pisell2.salesManagement.order.common.orderNote"),
  internalNote: import_utils.locales.getText(
    "pisell2.salesManagement.order.common.internalNote"
  ),
  createdBy: import_utils.locales.getText("pisell2.salesManagement.order.common.createdBy"),
  guest: import_utils.locales.getText("pisell2.salesManagement.order.common.guest"),
  walkIn: import_utils.locales.getText("pisell2.salesManagement.order.common.walkIn")
});
var defaultPaymentStatusKeys = [
  "payment_processing",
  "paid",
  "partially_refunded",
  "refunded"
];
var getFilterButtonList = () => {
  const ORDER_STATUS_MAP = getOrderStatusMap();
  const PAYMENT_STATUS_MAP = getPaymentStatusMap();
  const SHIPPING_STATUS_MAP = getShippingStatusMap();
  const DELIVERY_TYPE_MAP = getDeliveryTypeMap();
  return [
    {
      name: "status",
      type: "single",
      key: "status",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.order.filter.orderStatus.label"
      ),
      other: {
        allowClear: true,
        mode: "multiple",
        maxTagCount: "responsive",
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.order.filter.orderStatus.placeholder"
        ),
        options: Object.entries(ORDER_STATUS_MAP).map(([key, value]) => ({
          label: value,
          value: key
        }))
      }
    },
    {
      name: "payment_status",
      type: "single",
      key: "payment_status",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.order.filter.paymentStatus.label"
      ),
      other: {
        allowClear: true,
        mode: "multiple",
        maxTagCount: "responsive",
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.order.filter.paymentStatus.placeholder"
        ),
        options: Object.entries(PAYMENT_STATUS_MAP).map(([key, value]) => ({
          label: value,
          value: key
        }))
      }
    },
    {
      name: "shipping_status",
      type: "single",
      key: "shipping_status",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.order.filter.fulfillmentStatus.label"
      ),
      other: {
        allowClear: true,
        mode: "multiple",
        maxTagCount: "responsive",
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.order.filter.fulfillmentStatus.placeholder"
        ),
        options: Object.entries(SHIPPING_STATUS_MAP).map(([key, value]) => ({
          label: value,
          value: key
        }))
      }
    },
    {
      name: "customer_id",
      type: "single",
      key: "customer_id",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.order.filter.customer.label"
      ),
      other: {
        allowClear: true,
        isSearchServer: true,
        showSearch: true,
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.order.filter.customer.placeholder"
        ),
        options: (params) => (0, import_serve.getCustomerSelectOptions)(params).then(
          (res) => res.map((item) => ({
            label: item.display_name,
            value: item.id
          }))
        )
      }
    },
    {
      name: "order_sales_channel",
      type: "single",
      key: "order_sales_channel",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.order.filter.salesChannel.label"
      ),
      other: {
        allowClear: true,
        mode: "multiple",
        maxTagCount: "responsive",
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.order.filter.salesChannel.placeholder"
        ),
        options: () => (0, import_serve.getChannelSelectOptions)().then(
          (res) => res.map((item) => ({
            label: item.name,
            value: item.code
          }))
        )
      }
    },
    {
      name: "payment_methods",
      type: "single",
      key: "payment_methods",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.order.filter.paymentMethod.label"
      ),
      other: {
        allowClear: true,
        mode: "multiple",
        maxTagCount: "responsive",
        virtual: false,
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.order.filter.paymentMethod.placeholder"
        ),
        options: () => (0, import_serve.getPaymentSelectOptions)().then((res) => {
          const map = new Map(
            res.map((item) => [
              item.code,
              { label: item.name, value: item.code }
            ])
          );
          return Array.from(map.values());
        })
      }
    },
    {
      name: "total_amount",
      //max_total_amount 分两个字段
      type: "numberRange",
      key: "total_amount",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.order.filter.totalAmount.label"
      ),
      other: {
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.order.filter.totalAmount.placeholder"
        ),
        minInputNumberProps: {
          min: 0
        },
        maxInputNumberProps: {
          min: 0
        }
      }
    },
    {
      name: "tag_ids",
      type: "single",
      key: "tag_ids",
      label: import_utils.locales.getText("pisell2.salesManagement.order.filter.tags.label"),
      other: {
        allowClear: true,
        mode: "multiple",
        maxTagCount: "responsive",
        isSearchServer: true,
        showSearch: true,
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.order.filter.tags.placeholder"
        ),
        options: (params) => (0, import_serve.getTagSelectOptions)(params).then(
          (res) => res.map((item) => ({
            label: item.name,
            value: item.id
          }))
        )
      }
    },
    {
      name: "shipping_type",
      type: "single",
      key: "shipping_type",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.order.filter.deliveryType.label"
      ),
      other: {
        allowClear: true,
        mode: "multiple",
        maxTagCount: "responsive",
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.order.filter.deliveryType.placeholder"
        ),
        options: Object.entries(DELIVERY_TYPE_MAP).filter(([key]) => !["nil", "shop_service"].includes(key)).map(([key, value]) => ({
          label: value,
          value: key
        }))
      }
    },
    {
      name: "delivery_zone_name",
      type: "text",
      key: "delivery_zone_name",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.order.filter.deliveryZone.label"
      ),
      other: {
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.order.filter.deliveryZone.placeholder"
        )
      }
    },
    {
      name: "location_id",
      type: "single",
      key: "location_id",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.order.filter.pickupLocation.label"
      ),
      other: {
        allowClear: true,
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.order.filter.pickupLocation.placeholder"
        ),
        options: () => (0, import_serve.getLocationSelectOptions)().then(
          (res) => res.map((item) => ({
            label: item.name,
            value: item.id
          }))
        )
      }
    },
    {
      name: "shipping_order_number",
      type: "text",
      key: "shipping_order_number",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.order.filter.trackingNumber.label"
      ),
      other: {
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.order.filter.trackingNumber.placeholder"
        )
      }
    },
    {
      name: "logistics_company_id",
      type: "single",
      key: "logistics_company_id",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.order.filter.logistics.label"
      ),
      other: {
        allowClear: true,
        mode: "multiple",
        maxTagCount: "responsive",
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.order.filter.logistics.placeholder"
        ),
        options: () => (0, import_serve.getLogisticsSelectOptions)().then(
          (res) => res.map((item) => ({
            label: item.name,
            value: item.id
          }))
        )
      }
    },
    {
      name: "zip",
      type: "text",
      key: "zip",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.order.filter.zipCode.label"
      ),
      other: {
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.order.filter.zipCode.placeholder"
        )
      }
    }
  ];
};
var getSortList = () => {
  return [
    {
      type: "time",
      isCustom: true,
      name: "created_at",
      label: import_utils.locales.getText("pisell2.salesManagement.order.sort.createdAt"),
      getSortItems: () => {
        return [
          {
            key: "created_at:asc",
            label: import_utils.locales.getText("pisell2.salesManagement.sort.oldestFirst")
          },
          {
            key: "created_at:desc",
            label: import_utils.locales.getText("pisell2.salesManagement.sort.newestFirst")
          }
        ];
      }
    },
    {
      type: "time",
      isCustom: true,
      name: "updated_at",
      label: import_utils.locales.getText("pisell2.salesManagement.order.sort.updatedAt"),
      getSortItems: () => {
        return [
          {
            key: "updated_at:asc",
            label: import_utils.locales.getText("pisell2.salesManagement.sort.oldestFirst")
          },
          {
            key: "updated_at:desc",
            label: import_utils.locales.getText("pisell2.salesManagement.sort.newestFirst")
          }
        ];
      }
    },
    {
      type: "number",
      isCustom: false,
      name: "total_amount",
      label: import_utils.locales.getText("pisell2.salesManagement.order.sort.totalAmount")
    },
    {
      type: "number",
      isCustom: false,
      name: "amount_gap",
      label: import_utils.locales.getText("pisell2.salesManagement.sort.balanceDue")
    },
    {
      type: "string",
      isCustom: false,
      name: "customer_name",
      label: import_utils.locales.getText("pisell2.salesManagement.order.sort.customerName")
    }
  ];
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  DELIVERY_TYPE_COLOR_MAP,
  FULFILLMENT_STATUS_COLOR_MAP,
  ORDER_STATUS_COLOR_MAP,
  PAYMENT_STATUS_COLOR_MAP,
  SHOP_SERVICE_TYPE_COLOR_MAP,
  defaultPaymentStatusKeys,
  getDeliveryTypeMap,
  getFilterButtonList,
  getOrderHeaderLabels,
  getOrderStatusMap,
  getPaymentStatusMap,
  getPlatformMap,
  getShippingStatusMap,
  getShopServiceTypeMap,
  getSortList
});
