import React from 'react';
import { EnvironmentOutlined, UserOutlined } from '@ant-design/icons';
import { locales } from '@pisell/utils';
import { PREFIX } from "../constants";
var BookingMeta = function BookingMeta(_ref) {
  var booking = _ref.booking;
  var holderOptions = booking.holderOptions,
    holder_id = booking.holder_id;
  var _holderLabels = holder_id.map(function (id) {
    var _holderOptions$find;
    return ((_holderOptions$find = holderOptions.find(function (option) {
      return option.id === id;
    })) === null || _holderOptions$find === void 0 ? void 0 : _holderOptions$find.label) || '-';
  });
  return /*#__PURE__*/React.createElement("div", {
    className: "".concat(PREFIX, "__booking-meta")
  }, /*#__PURE__*/React.createElement("div", {
    className: "".concat(PREFIX, "__booking-for")
  }, /*#__PURE__*/React.createElement("div", {
    className: "".concat(PREFIX, "__booking-for-label")
  }, /*#__PURE__*/React.createElement(UserOutlined, null), /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.sale-cart.line-item.booking-for'))), /*#__PURE__*/React.createElement("div", {
    className: "".concat(PREFIX, "__booking-for-value")
  }, _holderLabels.length ? _holderLabels.join(', ') : locales.getText('pisell2.sale-cart.line-item.booking-guests')(booking.bookingNumber))), booking.resources.length ? /*#__PURE__*/React.createElement("div", {
    className: "".concat(PREFIX, "__booking-resources")
  }, booking.resources.map(function (resource, index) {
    return /*#__PURE__*/React.createElement("div", {
      className: "".concat(PREFIX, "__booking-resource"),
      key: "".concat(resource.id, "-").concat(index)
    }, /*#__PURE__*/React.createElement("span", {
      className: "".concat(PREFIX, "__booking-resource-form")
    }, resource.formName), /*#__PURE__*/React.createElement("span", {
      className: "".concat(PREFIX, "__booking-resource-name")
    }, resource.resourceName));
  })) : /*#__PURE__*/React.createElement("div", {
    className: "".concat(PREFIX, "__booking-meta-item ").concat(PREFIX, "__booking-meta-item--muted")
  }, /*#__PURE__*/React.createElement(EnvironmentOutlined, null), /*#__PURE__*/React.createElement("span", null, locales.getText('pisell2.sale-cart.line-item.no-resource'))));
};
export default BookingMeta;