var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/plus/pisellSalesManagement/config/booking.ts
var booking_exports = {};
__export(booking_exports, {
  BOOKING_STATUS_COLOR_MAP: () => BOOKING_STATUS_COLOR_MAP,
  defaultPaymentStatusKeys: () => defaultPaymentStatusKeys,
  getBookingHeaderLabels: () => getBookingHeaderLabels,
  getBookingPlatformMap: () => getBookingPlatformMap,
  getBookingStatusMap: () => getBookingStatusMap,
  getFilterButtonList: () => getFilterButtonList,
  getSortList: () => getSortList
});
module.exports = __toCommonJS(booking_exports);
var import_utils = require("@pisell/utils");
var import_serve = require("./../../orderList/serve");
var import_order = require("./order");
var import_ResourceSelector = __toESM(require("../components/ResourceSelector"));
var getBookingStatusMap = () => ({
  new: import_utils.locales.getText("pisell2.salesManagement.booking.status.new"),
  confirmed: import_utils.locales.getText(
    "pisell2.salesManagement.booking.status.confirmed"
  ),
  arrived: import_utils.locales.getText("pisell2.salesManagement.booking.status.arrived"),
  started: import_utils.locales.getText("pisell2.salesManagement.booking.status.started"),
  cancelled: import_utils.locales.getText(
    "pisell2.salesManagement.booking.status.cancelled"
  ),
  no_show: import_utils.locales.getText("pisell2.salesManagement.booking.status.no_show"),
  completed: import_utils.locales.getText(
    "pisell2.salesManagement.booking.status.completed"
  )
});
var BOOKING_STATUS_COLOR_MAP = {
  new: "#91caff",
  confirmed: "#b7eb8f",
  arrived: "#d3adf7",
  started: "#fffb8f",
  cancelled: "#bfbfbf",
  no_show: "#ffa39e",
  completed: "#ffd591"
};
var getBookingPlatformMap = () => ({
  online_store: import_utils.locales.getText(
    "pisell2.salesManagement.booking.platform.online_store"
  ),
  wholesalebusiness: import_utils.locales.getText(
    "pisell2.salesManagement.booking.platform.wholesalebusiness"
  ),
  "table-order": import_utils.locales.getText(
    "pisell2.salesManagement.booking.platform.table-order"
  ),
  mobile_order: import_utils.locales.getText(
    "pisell2.salesManagement.booking.platform.mobile_order"
  ),
  kiosk: import_utils.locales.getText("pisell2.salesManagement.booking.platform.kiosk"),
  pos: import_utils.locales.getText("pisell2.salesManagement.booking.platform.pos")
});
var getBookingHeaderLabels = () => ({
  bookingBrief: import_utils.locales.getText(
    "pisell2.salesManagement.booking.column.bookingBrief"
  ),
  serviceTime: import_utils.locales.getText(
    "pisell2.salesManagement.booking.column.serviceTime"
  ),
  customer: import_utils.locales.getText("pisell2.salesManagement.booking.column.customer"),
  contact: import_utils.locales.getText("pisell2.salesManagement.booking.column.contact"),
  holder: import_utils.locales.getText("pisell2.salesManagement.booking.column.holder"),
  services: import_utils.locales.getText("pisell2.salesManagement.booking.column.services"),
  pax: import_utils.locales.getText("pisell2.salesManagement.booking.column.pax"),
  resource: import_utils.locales.getText("pisell2.salesManagement.booking.column.resource"),
  forms: import_utils.locales.getText("pisell2.salesManagement.booking.column.forms"),
  orderInfo: import_utils.locales.getText(
    "pisell2.salesManagement.booking.column.orderInfo"
  ),
  bookingId: import_utils.locales.getText(
    "pisell2.salesManagement.booking.column.bookingId"
  ),
  orderOrigin: import_utils.locales.getText(
    "pisell2.salesManagement.booking.column.orderOrigin"
  ),
  updated: import_utils.locales.getText("pisell2.salesManagement.booking.column.updated"),
  orderNote: import_utils.locales.getText(
    "pisell2.salesManagement.booking.common.orderNote"
  ),
  internalNote: import_utils.locales.getText(
    "pisell2.salesManagement.booking.common.internalNote"
  ),
  more: import_utils.locales.getText("pisell2.salesManagement.booking.common.more"),
  createdBy: import_utils.locales.getText(
    "pisell2.salesManagement.booking.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",
  "partially_paid",
  "paid",
  "partially_refunded",
  "refunded"
];
var getFilterButtonList = () => {
  const BOOKING_STATUS_MAP = getBookingStatusMap();
  const ORDER_STATUS_MAP = (0, import_order.getOrderStatusMap)();
  const PAYMENT_STATUS_MAP = (0, import_order.getPaymentStatusMap)();
  return [
    {
      name: "appointment_status",
      type: "single",
      key: "appointmentStatus",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.booking.filter.bookingStatus.label"
      ),
      other: {
        allowClear: true,
        mode: "multiple",
        maxTagCount: "responsive",
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.booking.filter.bookingStatus.placeholder"
        ),
        options: Object.entries(BOOKING_STATUS_MAP).map(([key, value]) => ({
          label: value,
          value: key
        }))
      }
    },
    // {
    //   name: 'holder',
    //   type: 'input',
    //   key: 'holder',
    //   label: locales.getText(
    //     'pisell2.salesManagement.booking.filter.holder.label',
    //   ),
    //   other: {
    //     placeholder: locales.getText(
    //       'pisell2.salesManagement.booking.filter.holder.placeholder',
    //     ),
    //   },
    // },
    {
      name: "number_between",
      type: "numberRange",
      key: "number_between",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.booking.filter.paxRange.label"
      ),
      other: {
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.booking.filter.paxRange.placeholder"
        ),
        minInputNumberProps: {
          min: 0,
          precision: 0
        },
        maxInputNumberProps: {
          min: 0,
          precision: 0
        }
      }
    },
    {
      name: "form_record_ids",
      type: "custom",
      key: "formRecordIds",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.booking.filter.resource.label"
      ),
      sort: true,
      localFilter: false,
      other: {
        allowClear: true,
        mode: "multiple",
        maxTagCount: "responsive",
        component: import_ResourceSelector.default
      }
    },
    {
      name: "order_sales_channel",
      type: "single",
      key: "orderSalesChannel",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.booking.filter.salesChannel.label"
      ),
      other: {
        allowClear: true,
        mode: "multiple",
        maxTagCount: "responsive",
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.booking.filter.salesChannel.placeholder"
        ),
        options: () => (0, import_serve.getChannelSelectOptions)().then(
          (res) => res.map((item) => ({
            label: item.name,
            value: item.code
          }))
        )
      }
    },
    {
      name: "total_amount_between",
      type: "numberRange",
      key: "total_amount_between",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.booking.filter.orderAmount.label"
      ),
      other: {
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.booking.filter.orderAmount.placeholder"
        )
      }
    },
    {
      name: "order_status",
      type: "single",
      key: "order_status",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.booking.filter.orderStatus.label"
      ),
      other: {
        allowClear: true,
        mode: "multiple",
        maxTagCount: "responsive",
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.booking.filter.orderStatus.placeholder"
        ),
        options: Object.entries(ORDER_STATUS_MAP).map(([key, value]) => ({
          label: value,
          value: key
        }))
      }
    },
    {
      name: "order_payment_status",
      type: "single",
      key: "orderPaymentStatus",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.booking.filter.paymentStatus.label"
      ),
      other: {
        allowClear: true,
        mode: "multiple",
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.booking.filter.paymentStatus.placeholder"
        ),
        options: Object.entries(PAYMENT_STATUS_MAP).map(([key, value]) => ({
          label: value,
          value: key
        })),
        maxTagCount: "responsive"
      }
    },
    {
      name: "customer_id",
      type: "single",
      key: "customer_id",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.booking.filter.customer.label"
      ),
      other: {
        allowClear: true,
        isSearchServer: true,
        showSearch: true,
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.booking.filter.customer.placeholder"
        ),
        options: (params) => (0, import_serve.getCustomerSelectOptions)(params).then(
          (res) => res.map((item) => ({
            label: item.display_name,
            value: item.id
          }))
        )
      }
    },
    // todo:
    // {
    //   name: 'products',
    //   type: 'input',
    //   key: 'products',
    //   label: locales.getText(
    //     'pisell2.salesManagement.booking.filter.includeItems.label',
    //   ),
    //   other: {
    //     placeholder: locales.getText(
    //       'pisell2.salesManagement.booking.filter.includeItems.placeholder',
    //     ),
    //   },
    // },
    {
      name: "payment_method",
      type: "single",
      key: "payment_method",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.booking.filter.paymentMethod.label"
      ),
      other: {
        allowClear: true,
        mode: "multiple",
        maxTagCount: "responsive",
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.booking.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: "created_at_between",
      type: "rangePicker",
      key: "createdAtBetween",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.booking.filter.orderDate.label"
      ),
      other: {
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.booking.filter.orderDate.placeholder"
        ),
        showTime: true
      }
    },
    {
      name: "updated_at_between",
      type: "rangePicker",
      key: "updatedAtBetween",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.booking.filter.updatedDate.label"
      ),
      other: {
        placeholder: import_utils.locales.getText(
          "pisell2.salesManagement.booking.filter.updatedDate.placeholder"
        ),
        showTime: true
      }
    }
  ];
};
var getSortList = () => {
  return [
    {
      type: "time",
      isCustom: true,
      name: "after_execution_time",
      label: import_utils.locales.getText(
        "pisell2.salesManagement.booking.sort.afterExecutionTime"
      ),
      getSortItems: () => {
        return [
          {
            key: "after_execution_time:asc",
            label: import_utils.locales.getText("pisell2.salesManagement.sort.oldestFirst")
          }
        ];
      }
    },
    {
      type: "time",
      isCustom: true,
      name: "start_at",
      label: import_utils.locales.getText("pisell2.salesManagement.booking.sort.startAt"),
      getSortItems: () => {
        return [
          {
            key: "start_at:asc",
            label: import_utils.locales.getText("pisell2.salesManagement.sort.oldestFirst")
          },
          {
            key: "start_at:desc",
            label: import_utils.locales.getText("pisell2.salesManagement.sort.latestFirst")
          }
        ];
      }
    },
    {
      type: "time",
      isCustom: true,
      name: "end_at",
      label: import_utils.locales.getText("pisell2.salesManagement.booking.sort.endAt"),
      getSortItems: () => {
        return [
          {
            key: "end_at:asc",
            label: import_utils.locales.getText("pisell2.salesManagement.sort.oldestFirst")
          },
          {
            key: "end_at:desc",
            label: import_utils.locales.getText("pisell2.salesManagement.sort.latestFirst")
          }
        ];
      }
    },
    {
      type: "time",
      isCustom: true,
      name: "created_at",
      label: import_utils.locales.getText("pisell2.salesManagement.booking.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.booking.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")
          }
        ];
      },
      other: {
        style: { width: "100%" }
      }
    }
    // {
    //   type: 'number',
    //   isCustom: false,
    //   name: 'total_amount',
    //   label: locales.getText('pisell2.salesManagement.booking.sort.totalAmount'),
    // },
    // {
    //   type: 'number',
    //   isCustom: false,
    //   name: 'amount_gap',
    //   label: locales.getText('pisell2.salesManagement.sort.balanceDue'),
    // },
    // {
    //   type: 'number',
    //   isCustom: false,
    //   name: 'total_refund_amount',
    //   label: locales.getText(
    //     'pisell2.salesManagement.booking.sort.refundedAmount',
    //   ),
    // },
    // {
    //   type: 'string',
    //   isCustom: false,
    //   name: 'customer_name',
    //   label: locales.getText('pisell2.salesManagement.booking.sort.customerName'),
    // },
  ];
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  BOOKING_STATUS_COLOR_MAP,
  defaultPaymentStatusKeys,
  getBookingHeaderLabels,
  getBookingPlatformMap,
  getBookingStatusMap,
  getFilterButtonList,
  getSortList
});
