function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import React from 'react';
import { Tooltip } from 'antd';
import { PisellTags } from '@pisell/materials';
import { getCustomerSelectOptions, getChannelSelectOptions, getPaymentSelectOptions, getLogisticsSelectOptions, getLocationSelectOptions, getTagSelectOptions } from "./serve";

/**
 * 获取配送方式映射
 * @param locales - 多语言对象
 */
var getDeliveryTypeMap = function getDeliveryTypeMap(locales) {
  return {
    nil: locales.getText('pisell2.orderList.deliveryType.nil'),
    shipping: locales.getText('pisell2.orderList.deliveryType.shipping'),
    local_delivery: locales.getText('pisell2.orderList.deliveryType.local_delivery'),
    pickup: locales.getText('pisell2.orderList.deliveryType.pickup'),
    shop_service: locales.getText('pisell2.orderList.deliveryType.shop_service')
  };
};

/**
 * 获取到店服务类型映射
 * @param locales - 多语言对象
 */
var getShopServiceTypeMap = function getShopServiceTypeMap(locales) {
  return {
    'dine-in': locales.getText('pisell2.orderList.shopServiceType.dine-in'),
    takeaway: locales.getText('pisell2.orderList.shopServiceType.takeaway')
  };
};

// 下单渠道
var PLATFORM_MAP = {
  online_store: '在线店铺',
  wholesalebusiness: '批发业务',
  'table-order': '扫码点餐',
  mobile_order: '移动点餐',
  kiosk: 'Kiosk',
  pos: '终端'
};
// 获取下单渠道映射
var getPlatformMap = function getPlatformMap(locales) {
  return {
    online_store: locales.getText('pisell2.orderList.platform.online_store'),
    wholesalebusiness: locales.getText('pisell2.orderList.platform.wholesalebusiness'),
    'table-order': locales.getText('pisell2.orderList.platform.table-order'),
    mobile_order: locales.getText('pisell2.orderList.platform.mobile_order'),
    kiosk: locales.getText('pisell2.orderList.platform.kiosk'),
    pos: locales.getText('pisell2.orderList.platform.pos')
  };
};
/**
 * 获取订单状态映射
 * @param locales - 多语言对象
 */
var getOrderStatusMap = function getOrderStatusMap(locales) {
  return {
    open: locales.getText('pisell2.orderList.orderStatus.open'),
    completed: locales.getText('pisell2.orderList.orderStatus.completed'),
    cancelled: locales.getText('pisell2.orderList.orderStatus.cancelled')
  };
};

// 订单状态颜色映射（来自 Figma 设计稿 - 带边框样式）
var ORDER_STATUS_COLOR_MAP = {
  open: {
    borderColor: '#1570EF',
    // Blue/600
    textColor: '#175CD3' // Blue/700
  },
  completed: {
    borderColor: '#079455',
    // Success/600
    textColor: '#067647' // Success/700
  },
  cancelled: {
    borderColor: '#D92D20',
    // Error/600
    textColor: '#B42318' // Error/700
  }
};

/**
 * 获取处理状态映射
 * @param locales - 多语言对象
 */
var getShippingStatusMap = function getShippingStatusMap(locales) {
  return {
    fulfilled: locales.getText('pisell2.orderList.shippingStatus.falseulfilled'),
    unfulfilled: locales.getText('pisell2.orderList.shippingStatus.unfulfilled'),
    fulfilling: locales.getText('pisell2.orderList.shippingStatus.fulfilling'),
    partial_fulfilled: locales.getText('pisell2.orderList.shippingStatus.partial_fulfilled')
  };
};

// 处理状态颜色映射（来自 Figma 设计稿 - 带边框样式，排除"未处理"）
var SHIPPING_STATUS_COLOR_MAP = {
  fulfilling: {
    borderColor: '#DC6803',
    // Warning/600 - 处理中
    textColor: '#B54708' // Warning/700
  },
  unfulfilled: {
    borderColor: '#DC6803',
    // Success/600  --未处理
    textColor: '#B54708' // Success/700
  },
  partial_fulfilled: {
    borderColor: '#088AB2',
    // Cyan/600 - 部分处理
    textColor: '#0E7090' // Cyan/700
  },
  fulfilled: {
    borderColor: '#475467',
    // Gray/600 - 已处理
    textColor: '#344054' // Gray/700
  }
};

/**
 * 获取支付状态映射
 * @param locales - 多语言对象
 */
var getPaymentStatusMap = function getPaymentStatusMap(locales) {
  return {
    authorized: locales.getText('pisell2.orderList.paymentStatus.authorized'),
    paid: locales.getText('pisell2.orderList.paymentStatus.paid'),
    partially_refunded: locales.getText('pisell2.orderList.paymentStatus.partially_refunded'),
    payment_pending: locales.getText('pisell2.orderList.paymentStatus.payment_pending'),
    refunded: locales.getText('pisell2.orderList.paymentStatus.refunded'),
    unpaid: locales.getText('pisell2.orderList.paymentStatus.unpaid'),
    voided: locales.getText('pisell2.orderList.paymentStatus.voided'),
    payment_processing: locales.getText('pisell2.orderList.paymentStatus.payment_processing')
  };
};

// 支付状态颜色映射（来自 Figma 设计稿）
var PAYMENT_STATUS_COLOR_MAP = {
  unpaid: '#B2DDFF',
  // 未付款 - Blue/200
  payment_processing: '#FEDF89',
  // 待支付 - Warning/200
  payment_pending: '#FEDF89',
  // 等待付款 - Warning/200
  authorized: '#ABEFC6',
  // 已授权 - Success/200
  paid: '#ABEFC6',
  // 已付款 - Success/200
  refunded: '#FECDCA',
  // 已退款 - Error/200
  partially_refunded: '#FCCEEE',
  // 部分退款 - Pink/200
  voided: '#D0D5DD' // 已作废 - Gray/300
};
var renderMapValue = function renderMapValue(value, map) {
  return map[value] || '';
};

/**
 * 获取表格列配置（支持多语言）
 * @param locales - 多语言对象
 * @returns 表格列配置数组
 */
export var getTableColumns = function getTableColumns(locales) {
  return [{
    title: locales.getText('pisell2.orderList.column.orderNumber'),
    dataIndex: 'shop_full_order_number',
    key: 'shop_full_order_number',
    width: 100,
    render: function render(value, record) {
      var _ref = record || {},
        note = _ref.note;
      return /*#__PURE__*/React.createElement("div", {
        className: "order-id-cell"
      }, /*#__PURE__*/React.createElement("span", {
        className: "order-id-link"
      }, value), note && /*#__PURE__*/React.createElement(Tooltip, {
        title: /*#__PURE__*/React.createElement("div", {
          style: {
            whiteSpace: 'pre-wrap'
          }
        }, note)
      }, /*#__PURE__*/React.createElement("span", {
        className: "order-id-link-badge cursor-pointer"
      }, locales.getText('pisell2.orderList.common.note'))));
    }
  }, {
    title: locales.getText('pisell2.orderList.column.customerInfo'),
    dataIndex: 'customer',
    key: 'customer',
    width: 200,
    render: function render(value, record) {
      var _ref2 = value || {},
        email = _ref2.email,
        phone = _ref2.phone;
      var customer_name = (value === null || value === void 0 ? void 0 : value.customer_name) || (record === null || record === void 0 ? void 0 : record.customer_name);
      var guest_code = value === null || value === void 0 ? void 0 : value.guest_code;
      if (guest_code) {
        return /*#__PURE__*/React.createElement("div", {
          className: "compound-cell"
        }, /*#__PURE__*/React.createElement("div", {
          className: "title"
        }, locales.getText('pisell2.orderList.common.guest')));
      }
      return /*#__PURE__*/React.createElement("div", {
        className: "compound-cell"
      }, /*#__PURE__*/React.createElement("div", {
        className: "title"
      }, customer_name || '-'), /*#__PURE__*/React.createElement("div", {
        className: "subtitle"
      }, phone || '-'), /*#__PURE__*/React.createElement("div", {
        className: "subtitle"
      }, email || '-'));
    }
  }, {
    title: locales.getText('pisell2.orderList.column.contactInfo'),
    dataIndex: 'contacts_info',
    key: 'contacts_info',
    width: 200,
    render: function render(value, record) {
      var _value = (value === null || value === void 0 ? void 0 : value.value) || {};
      var _ref3 = _value || {},
        first_name = _ref3.first_name,
        last_name = _ref3.last_name,
        display_name = _ref3.display_name,
        phoneInfo = _ref3.phone,
        email = _ref3.email;
      var _ref4 = phoneInfo || {},
        country_calling_code = _ref4.country_calling_code,
        country_code = _ref4.country_code,
        phone = _ref4.phone;
      var _name = display_name || "".concat(first_name || '', " ").concat(last_name || '');
      return /*#__PURE__*/React.createElement("div", {
        className: "compound-cell"
      }, /*#__PURE__*/React.createElement("div", {
        className: "title"
      }, "".concat(_name || '-')), /*#__PURE__*/React.createElement("div", {
        className: "subtitle"
      }, phone || '-'), /*#__PURE__*/React.createElement("div", {
        className: "subtitle"
      }, email || '-'));
    }
  }, {
    title: locales.getText('pisell2.orderList.column.tags'),
    dataIndex: 'tag',
    key: 'tag',
    width: 200,
    render: function render(value) {
      if (Array.isArray(value)) {
        return /*#__PURE__*/React.createElement("div", {
          className: "tags-container"
        }, value.map(function (item, index) {
          return /*#__PURE__*/React.createElement(PisellTags, {
            key: index
          }, item.name);
        }));
      }
      return '-';
    }
  }, {
    title: locales.getText('pisell2.orderList.column.deliveryMethod'),
    dataIndex: 'delivery_type',
    key: 'delivery_type',
    width: 160,
    render: function render(value, record) {
      var _ref5 = record.metadata || {},
        shop_service_type = _ref5.shop_service_type;
      var SHOP_SERVICE_TYPE_MAP = getShopServiceTypeMap(locales);
      var DELIVERY_TYPE_MAP = getDeliveryTypeMap(locales);
      var node = null;
      // 如果是店内服务，根据服务类型返回对应文本
      if (value === 'shop_service') {
        node = renderMapValue(shop_service_type === null || shop_service_type === void 0 ? void 0 : shop_service_type.server_type, SHOP_SERVICE_TYPE_MAP);
      }
      node = renderMapValue(value, DELIVERY_TYPE_MAP);
      return node ? /*#__PURE__*/React.createElement(PisellTags, {
        style: {
          whiteSpace: 'nowrap'
        }
      }, node) : '-';
    }
  }, {
    title: locales.getText('pisell2.orderList.column.paymentInfo'),
    dataIndex: 'payment_status',
    key: 'payment_status',
    width: 140,
    render: function render(value, record) {
      var _record$summary;
      var PAYMENT_STATUS_MAP = getPaymentStatusMap(locales);
      /** 部分付并入「需付款」：文案/色与 unpaid 一致 */
      var paymentKey = value === 'partially_paid' ? 'unpaid' : value;
      var total_amount = Number(record.total_amount || 0);
      var paid_amount = Number(record.paid_amount || 0);
      var total_refund_amount = Number(record.total_refund_amount || (record === null || record === void 0 || (_record$summary = record.summary) === null || _record$summary === void 0 ? void 0 : _record$summary.total_refund_amount) || 0);
      var unpaid = Number(total_amount - paid_amount).toFixed(2);

      // 根据支付状态生成 tooltip 内容
      var tooltipContent = '';

      // 1. 等待付款/待支付/未付款（含部分付）→ 显示「Total + Unpaid」
      if (['payment_pending', 'payment_processing', 'unpaid'].includes(paymentKey)) {
        tooltipContent = "".concat(locales.getText('pisell2.orderList.common.totalAmount'), ": $").concat(total_amount.toFixed(2), "\n").concat(locales.getText('pisell2.orderList.common.unpaidAmount'), ": $").concat(unpaid);
      }
      // 2. 已付款 → 显示「Total + Paid」
      else if (paymentKey === 'paid') {
        tooltipContent = "".concat(locales.getText('pisell2.orderList.common.totalAmount'), ": $").concat(total_amount.toFixed(2), "\n").concat(locales.getText('pisell2.orderList.common.paidAmount'), ": $").concat(paid_amount.toFixed(2));
      }
      // 3. 部分退款/已退款 → 显示「Total + Paid + Refunded」
      else if (['partially_refunded', 'refunded'].includes(value)) {
        tooltipContent = "".concat(locales.getText('pisell2.orderList.common.totalAmount'), ": $").concat(total_amount.toFixed(2), "\n").concat(locales.getText('pisell2.orderList.common.paidAmount'), ": $").concat(paid_amount.toFixed(2), "\n").concat(locales.getText('pisell2.orderList.common.refundedAmount'), ": $").concat(total_refund_amount.toFixed(2));
      }
      var color = PAYMENT_STATUS_COLOR_MAP[paymentKey] || '';
      if (['voided', 'authorized'].includes(value)) {
        return /*#__PURE__*/React.createElement(PisellTags, {
          className: "cursor-pointer",
          style: {
            backgroundColor: color,
            whiteSpace: 'nowrap'
          }
        }, renderMapValue(paymentKey, PAYMENT_STATUS_MAP) || '-');
      }
      return /*#__PURE__*/React.createElement(Tooltip, {
        title: /*#__PURE__*/React.createElement("div", {
          style: {
            whiteSpace: 'pre-wrap'
          }
        }, tooltipContent)
      }, /*#__PURE__*/React.createElement(PisellTags, {
        className: "cursor-pointer",
        style: {
          backgroundColor: color,
          whiteSpace: 'nowrap'
        }
      }, renderMapValue(paymentKey, PAYMENT_STATUS_MAP)));
    }
  }, {
    title: locales.getText('pisell2.orderList.column.orderChannel'),
    dataIndex: 'order_sales_channel',
    key: 'order_sales_channel',
    width: 160,
    render: function render(value) {
      var PLATFORM_MAP = getPlatformMap(locales);
      return renderMapValue(value, PLATFORM_MAP) || '-';
    }
  }, {
    title: locales.getText('pisell2.orderList.column.productQuantity'),
    dataIndex: 'product_quantity',
    key: 'product_quantity',
    width: 180,
    isShow: false,
    render: function render(value) {
      return "".concat(Number(value || 0)).concat(locales.getText('pisell2.orderList.common.itemsCount'));
    }
  },
  // {
  //   title: locales.getText('pisell2.orderList.column.business'),
  //   dataIndex: 'business_code',
  //   key: 'business_code',
  //   isShow: false,
  //   render: (value: any) => {
  //     return value;
  //   },
  // },
  {
    title: locales.getText('pisell2.orderList.column.orderStatus'),
    dataIndex: 'status',
    key: 'status',
    width: 140,
    isShow: false,
    render: function render(value) {
      var ORDER_STATUS_MAP = getOrderStatusMap(locales);
      var color = ORDER_STATUS_COLOR_MAP[value];
      var style = {};
      if (color) {
        style = {
          borderColor: color.borderColor,
          color: color.textColor,
          whiteSpace: 'nowrap'
        };
      }
      return /*#__PURE__*/React.createElement(PisellTags, {
        className: "cursor-pointer",
        style: style
      }, renderMapValue(value, ORDER_STATUS_MAP) || '-');
    }
  }, {
    title: locales.getText('pisell2.orderList.column.processStatus'),
    dataIndex: 'shipping_status',
    key: 'shipping_status',
    width: 140,
    isShow: false,
    render: function render(value) {
      var SHIPPING_STATUS_MAP = getShippingStatusMap(locales);
      var color = SHIPPING_STATUS_COLOR_MAP[value];
      var style = {};
      if (color) {
        style = {
          borderColor: color.borderColor,
          color: color.textColor,
          whiteSpace: 'nowrap'
        };
      }
      return /*#__PURE__*/React.createElement(PisellTags, {
        className: "cursor-pointer",
        style: style
      }, renderMapValue(value, SHIPPING_STATUS_MAP) || '-');
    }
  }, {
    title: locales.getText('pisell2.orderList.column.createInfo'),
    dataIndex: 'create_account',
    key: 'create_account',
    isShow: false,
    width: 180,
    render: function render(value, record) {
      var _ref6 = record || {},
        created_at = _ref6.created_at,
        create_account_id = _ref6.create_account_id;
      var _ref7 = value || {},
        first_name = _ref7.first_name,
        last_name = _ref7.last_name;
      var display_name = "".concat(first_name || '', " ").concat(last_name || '');
      if (Number(create_account_id) > 0) {
        display_name = locales.getText('pisell2.orderList.filter.customer.label');
      }
      return /*#__PURE__*/React.createElement("div", {
        className: "compound-cell"
      }, /*#__PURE__*/React.createElement("div", {
        className: "title"
      }, "".concat(display_name || '-')), /*#__PURE__*/React.createElement("div", {
        className: "subtitle"
      }, created_at || '-'));
    }
  }, {
    title: locales.getText('pisell2.orderList.column.moreInfo'),
    dataIndex: 'last_edit_account',
    key: 'last_edit_account',
    isShow: false,
    width: 180,
    render: function render(value) {
      if (value) {
        var _ref8 = value || {},
          account = _ref8.account,
          created_at = _ref8.created_at;
        var _ref9 = account || {},
          display_name = _ref9.display_name;
        return /*#__PURE__*/React.createElement("div", {
          className: "compound-cell"
        }, /*#__PURE__*/React.createElement("div", {
          className: "title"
        }, "".concat(display_name || '-')), /*#__PURE__*/React.createElement("div", {
          className: "subtitle"
        }, created_at || '-'));
      }
      return '-';
    }
  }];
};
export var getQuickFilterList = function getQuickFilterList(locales) {
  return [{
    name: 'orderDate',
    //end_time 分两个字段
    type: 'rangePicker',
    key: 'orderDate',
    label: locales.getText('pisell2.orderList.quickFilter.orderDate.label'),
    other: {
      placeholder: locales.getText('pisell2.orderList.quickFilter.orderDate.placeholder')
    }
  }, {
    name: 'keyword',
    type: 'search',
    key: 'keyword',
    other: {
      allowClear: true,
      placeholder: locales.getText('pisell2.orderList.quickFilter.keyword.placeholder'),
      trigger: ['onChange'],
      style: {
        width: '400px'
      }
    }
  }];
};
export var getFilterButtonList = function getFilterButtonList(locales) {
  var ORDER_STATUS_MAP = getOrderStatusMap(locales);
  var PAYMENT_STATUS_MAP = getPaymentStatusMap(locales);
  var SHIPPING_STATUS_MAP = getShippingStatusMap(locales);
  var DELIVERY_TYPE_MAP = getDeliveryTypeMap(locales);
  return [{
    name: 'status',
    type: 'select',
    key: 'status',
    label: locales.getText('pisell2.orderList.filter.orderStatus.label'),
    other: {
      allowClear: true,
      mode: 'multiple',
      placeholder: locales.getText('pisell2.orderList.filter.orderStatus.placeholder'),
      options: Object.entries(ORDER_STATUS_MAP).map(function (_ref10) {
        var _ref11 = _slicedToArray(_ref10, 2),
          key = _ref11[0],
          value = _ref11[1];
        return {
          label: value,
          value: key
        };
      })
    }
  }, {
    name: 'payment_status',
    type: 'select',
    key: 'payment_status',
    label: locales.getText('pisell2.orderList.filter.paymentStatus.label'),
    other: {
      allowClear: true,
      mode: 'multiple',
      placeholder: locales.getText('pisell2.orderList.filter.paymentStatus.placeholder'),
      options: Object.entries(PAYMENT_STATUS_MAP).map(function (_ref12) {
        var _ref13 = _slicedToArray(_ref12, 2),
          key = _ref13[0],
          value = _ref13[1];
        return {
          label: value,
          value: key
        };
      })
    }
  }, {
    name: 'shipping_status',
    type: 'select',
    key: 'shipping_status',
    label: locales.getText('pisell2.orderList.filter.shippingStatus.label'),
    other: {
      allowClear: true,
      mode: 'multiple',
      placeholder: locales.getText('pisell2.orderList.filter.shippingStatus.placeholder'),
      options: Object.entries(SHIPPING_STATUS_MAP).map(function (_ref14) {
        var _ref15 = _slicedToArray(_ref14, 2),
          key = _ref15[0],
          value = _ref15[1];
        return {
          label: value,
          value: key
        };
      })
    }
  },
  // {
  //   name: 'updatedDate',  //end_time 分两个字段
  //   type: 'rangePicker',
  //   key: 'updatedDate',
  //   label: '更新时间',
  //   other: {
  //     placeholder: '请选择更新时间',
  //   },
  // },
  {
    name: 'customer_id',
    type: 'select',
    key: 'customer_id',
    label: locales.getText('pisell2.orderList.filter.customer.label'),
    other: {
      allowClear: true,
      isSearchServer: true,
      showSearch: true,
      placeholder: locales.getText('pisell2.orderList.filter.customer.placeholder'),
      options: function options(params) {
        return getCustomerSelectOptions(params).then(function (res) {
          return res.map(function (item) {
            return {
              label: item.display_name,
              value: item.id
            };
          });
        });
      }
    }
  }, {
    name: 'order_sales_channel',
    type: 'select',
    key: 'order_sales_channel',
    label: locales.getText('pisell2.orderList.filter.salesChannel.label'),
    other: {
      allowClear: true,
      mode: 'multiple',
      placeholder: locales.getText('pisell2.orderList.filter.salesChannel.placeholder'),
      options: function options() {
        return getChannelSelectOptions().then(function (res) {
          return res.map(function (item) {
            return {
              label: item.name,
              value: item.code
            };
          });
        });
      }
    }
  }, {
    name: 'payment_methods',
    type: 'select',
    key: 'payment_methods',
    label: locales.getText('pisell2.orderList.filter.paymentMethod.label'),
    other: {
      allowClear: true,
      mode: 'multiple',
      placeholder: locales.getText('pisell2.orderList.filter.paymentMethod.placeholder'),
      options: function options() {
        return getPaymentSelectOptions().then(function (res) {
          var map = new Map(res.map(function (item) {
            return [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: locales.getText('pisell2.orderList.filter.totalAmount.label'),
    other: {
      placeholder: locales.getText('pisell2.orderList.filter.totalAmount.placeholder')
    }
  }, {
    name: 'tag_ids',
    type: 'select',
    key: 'tag_ids',
    label: locales.getText('pisell2.orderList.filter.tags.label'),
    other: {
      allowClear: true,
      mode: 'multiple',
      isSearchServer: true,
      showSearch: true,
      placeholder: locales.getText('pisell2.orderList.filter.tags.placeholder'),
      options: function options(params) {
        return getTagSelectOptions(params).then(function (res) {
          return res.map(function (item) {
            return {
              label: item.name,
              value: item.id
            };
          });
        });
      }
    }
  }, {
    name: 'shipping_type',
    type: 'select',
    key: 'shipping_type',
    label: locales.getText('pisell2.orderList.filter.shippingType.label'),
    other: {
      allowClear: true,
      mode: 'multiple',
      placeholder: locales.getText('pisell2.orderList.filter.shippingType.placeholder'),
      options: Object.entries(DELIVERY_TYPE_MAP).filter(function (_ref16) {
        var _ref17 = _slicedToArray(_ref16, 1),
          key = _ref17[0];
        return !['nil', 'shop_service'].includes(key);
      }).map(function (_ref18) {
        var _ref19 = _slicedToArray(_ref18, 2),
          key = _ref19[0],
          value = _ref19[1];
        return {
          label: value,
          value: key
        };
      })
    }
  }, {
    name: 'delivery_zone_name',
    type: 'text',
    key: 'delivery_zone_name',
    label: locales.getText('pisell2.orderList.filter.deliveryZone.label'),
    other: {
      placeholder: locales.getText('pisell2.orderList.filter.deliveryZone.placeholder')
    }
  }, {
    name: 'location_id',
    type: 'select',
    key: 'location_id',
    label: locales.getText('pisell2.orderList.filter.pickupLocation.label'),
    other: {
      allowClear: true,
      placeholder: locales.getText('pisell2.orderList.filter.pickupLocation.placeholder'),
      options: function options() {
        return getLocationSelectOptions().then(function (res) {
          return res.map(function (item) {
            return {
              label: item.name,
              value: item.id
            };
          });
        });
      }
    }
  }, {
    name: 'shipping_order_number',
    type: 'text',
    key: 'shipping_order_number',
    label: locales.getText('pisell2.orderList.filter.trackingNumber.label'),
    other: {
      placeholder: locales.getText('pisell2.orderList.filter.trackingNumber.placeholder')
    }
  }, {
    name: 'logistics_company_id',
    type: 'select',
    key: 'logistics_company_id',
    label: locales.getText('pisell2.orderList.filter.logistics.label'),
    other: {
      allowClear: true,
      mode: 'multiple',
      placeholder: locales.getText('pisell2.orderList.filter.logistics.placeholder'),
      options: function options() {
        return getLogisticsSelectOptions().then(function (res) {
          return res.map(function (item) {
            return {
              label: item.name,
              value: item.id
            };
          });
        });
      }
    }
  }, {
    name: 'zip',
    type: 'text',
    key: 'zip',
    label: locales.getText('pisell2.orderList.filter.zipCode.label'),
    other: {
      placeholder: locales.getText('pisell2.orderList.filter.zipCode.placeholder')
    }
  }];
};
export var getSortList = function getSortList(locales) {
  return [{
    type: 'string',
    isCustom: false,
    name: 'shop_full_order_number',
    label: locales.getText('pisell2.orderList.sort.orderNumber')
  }, {
    type: 'time',
    isCustom: false,
    name: 'created_at',
    label: locales.getText('pisell2.orderList.sort.createdAt')
  }, {
    type: 'time',
    isCustom: false,
    name: 'updated_at',
    label: locales.getText('pisell2.orderList.sort.updatedAt')
  }, {
    type: 'string',
    isCustom: false,
    name: 'customer_name',
    label: locales.getText('pisell2.orderList.sort.customerName')
  }, {
    type: 'date',
    isCustom: false,
    name: 'payment_status',
    label: locales.getText('pisell2.orderList.sort.paymentStatus')
  }, {
    type: 'date',
    isCustom: false,
    name: 'shipping_status',
    label: locales.getText('pisell2.orderList.sort.shippingStatus')
  }, {
    type: 'number',
    isCustom: false,
    name: 'total_amount',
    label: locales.getText('pisell2.orderList.sort.totalAmount')
  }, {
    type: 'time',
    isCustom: false,
    name: 'delivery_start_at',
    label: locales.getText('pisell2.orderList.sort.deliveryStartAt')
  }];
};