"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = exports.Schedule = void 0;

var _react = _interopRequireDefault(require("react"));

var _moment = _interopRequireDefault(require("moment"));

var _openData = require("../../../../../utils/open-data");

require("./index.css");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var prefix = "titaui-dynamic-summary-schedule";

var Schedule = function Schedule(_ref) {
  var value = _ref.value,
      oldValue = _ref.oldValue;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: prefix
  }, (value === null || value === void 0 ? void 0 : value.length) !== 0 && /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefix, "__content")
  }, value === null || value === void 0 ? void 0 : value.map(function (val) {
    if (!val.EntityId) return /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(prefix, "__content-richContent")
    }, /*#__PURE__*/_react["default"].createElement("span", {
      dangerouslySetInnerHTML: {
        __html: val === null || val === void 0 ? void 0 : val.RichContent
      }
    }));
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(prefix, "__content-text")
    }, /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(prefix, "__content-title")
    }, (0, _moment["default"])((val === null || val === void 0 ? void 0 : val.startDate) || '').format('YYYY/MM/DD') === (0, _moment["default"])((val === null || val === void 0 ? void 0 : val.endDate) || '').format('YYYY/MM/DD') && /*#__PURE__*/_react["default"].createElement("span", null, (0, _moment["default"])(val === null || val === void 0 ? void 0 : val.startDate).format('YYYY/MM/DD')), (0, _moment["default"])(val === null || val === void 0 ? void 0 : val.startDate).format('YYYY/MM/DD') !== (0, _moment["default"])(val === null || val === void 0 ? void 0 : val.endDate).format('YYYY/MM/DD') && /*#__PURE__*/_react["default"].createElement("span", null, (0, _moment["default"])((val === null || val === void 0 ? void 0 : val.startDate) || '').format('YYYY/MM/DD'), " - ", (0, _moment["default"])((val === null || val === void 0 ? void 0 : val.endDate) || '').format('YYYY/MM/DD')), "\xA0", /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_openData.OpenUserName, {
      id: val.UserId,
      name: val === null || val === void 0 ? void 0 : val.UserName
    }))), /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(prefix, "__content-richContent")
    }, /*#__PURE__*/_react["default"].createElement("span", {
      dangerouslySetInnerHTML: {
        __html: val === null || val === void 0 ? void 0 : val.RichContent
      }
    })));
  })), (!value || (value === null || value === void 0 ? void 0 : value.length) === 0) && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, oldValue ? /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefix, "__content-richContent")
  }, /*#__PURE__*/_react["default"].createElement("span", {
    dangerouslySetInnerHTML: {
      __html: oldValue
    }
  })) : /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefix, "__no-progress")
  }, "-")));
};

exports.Schedule = Schedule;
var _default = Schedule;
exports["default"] = _default;