Liferay.Loader.define("portal-workflow-metrics-web@2.0.46/js/components/instance-list-page/modal/reassign/single/SingleReassignModalTable.es", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/icon', '@frontend-taglib-clay$clayui/table', '@frontend-taglib-clay$clayui/tooltip', 'frontend-js-react-web$react', '../../../../../shared/components/autocomplete/Autocomplete.es', '../../../../../shared/hooks/useFetch.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    function _typeof(obj) {
      "@babel/helpers - typeof";
      if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
        _typeof = function _typeof(obj) {
          return typeof obj;
        };
      } else {
        _typeof = function _typeof(obj) {
          return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
        };
      }return _typeof(obj);
    }

    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.Table = void 0;

    var _icon = _interopRequireDefault(require("@frontend-taglib-clay$clayui/icon"));

    var _table = _interopRequireDefault(require("@frontend-taglib-clay$clayui/table"));

    var _tooltip = require("@frontend-taglib-clay$clayui/tooltip");

    var _react = _interopRequireWildcard(require("frontend-js-react-web$react"));

    var _Autocomplete = require("../../../../../shared/components/autocomplete/Autocomplete.es");

    var _useFetch2 = require("../../../../../shared/hooks/useFetch.es");

    function _getRequireWildcardCache() {
      if (typeof WeakMap !== "function") return null;var cache = new WeakMap();_getRequireWildcardCache = function _getRequireWildcardCache() {
        return cache;
      };return cache;
    }

    function _interopRequireWildcard(obj) {
      if (obj && obj.__esModule) {
        return obj;
      }if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
        return { default: obj };
      }var cache = _getRequireWildcardCache();if (cache && cache.has(obj)) {
        return cache.get(obj);
      }var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {
        if (Object.prototype.hasOwnProperty.call(obj, key)) {
          var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {
            Object.defineProperty(newObj, key, desc);
          } else {
            newObj[key] = obj[key];
          }
        }
      }newObj.default = obj;if (cache) {
        cache.set(obj, newObj);
      }return newObj;
    }

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

    function _extends() {
      _extends = Object.assign || function (target) {
        for (var i = 1; i < arguments.length; i++) {
          var source = arguments[i];for (var key in source) {
            if (Object.prototype.hasOwnProperty.call(source, key)) {
              target[key] = source[key];
            }
          }
        }return target;
      };return _extends.apply(this, arguments);
    }

    var AssigneeInput = function AssigneeInput(_ref) {
      var setAssigneeId = _ref.setAssigneeId,
          taskId = _ref.taskId;

      var _useFetch = (0, _useFetch2.useFetch)({
        admin: true,
        params: {
          page: -1,
          pageSize: -1
        },
        url: "/workflow-tasks/".concat(taskId, "/assignable-users")
      }),
          data = _useFetch.data,
          fetchData = _useFetch.fetchData;

      var handleSelect = (0, _react.useCallback)(function (newAssignee) {
        var assigneeId = newAssignee ? newAssignee.id : undefined;
        setAssigneeId(assigneeId);
      }, [setAssigneeId]);
      var promises = (0, _react.useMemo)(function () {
        return [fetchData()];
      }, [fetchData]);
      return (/*#__PURE__*/_react.default.createElement(_Autocomplete.Autocomplete, {
          items: data.items,
          onSelect: handleSelect,
          promises: promises
        })
      );
    };

    var Item = function Item(_ref2) {
      var _ref2$assigneePerson = _ref2.assigneePerson,
          assigneePerson = _ref2$assigneePerson === void 0 ? {
        name: Liferay.Language.get('unassigned')
      } : _ref2$assigneePerson,
          id = _ref2.id,
          _ref2$objectReviewed = _ref2.objectReviewed,
          assetTitle = _ref2$objectReviewed.assetTitle,
          assetType = _ref2$objectReviewed.assetType,
          setAssigneeId = _ref2.setAssigneeId,
          label = _ref2.label,
          workflowInstanceId = _ref2.workflowInstanceId;
      return (/*#__PURE__*/_react.default.createElement(_table.default.Row, null, /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          style: {
            fontWeight: 'bold'
          }
        }, workflowInstanceId), /*#__PURE__*/_react.default.createElement(_table.default.Cell, null, "".concat(assetType, ": ").concat(assetTitle), " "), /*#__PURE__*/_react.default.createElement(_table.default.Cell, null, label), /*#__PURE__*/_react.default.createElement(_table.default.Cell, null, assigneePerson.name), /*#__PURE__*/_react.default.createElement(_table.default.Cell, null, /*#__PURE__*/_react.default.createElement(Table.AssigneeInput, {
          setAssigneeId: setAssigneeId,
          taskId: id
        })))
      );
    };

    var Table = function Table(_ref3) {
      var items = _ref3.items,
          setAssigneeId = _ref3.setAssigneeId;
      return (/*#__PURE__*/_react.default.createElement(_table.default, null, /*#__PURE__*/_react.default.createElement(_table.default.Head, null, /*#__PURE__*/_react.default.createElement(_table.default.Row, null, /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          headingCell: true,
          style: {
            color: 'inherit',
            fontWeight: 'bold',
            width: '10%'
          }
        }, Liferay.Language.get('id')), /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          headingCell: true,
          style: {
            color: 'inherit',
            fontWeight: 'bold',
            width: '25%'
          }
        }, Liferay.Language.get('item-subject')), /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          headingCell: true,
          style: {
            color: 'inherit',
            fontWeight: 'bold',
            width: '20%'
          }
        }, Liferay.Language.get('process-step')), /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          style: {
            color: 'inherit',
            fontWeight: 'bold',
            width: '20%'
          }
        }, Liferay.Language.get('current-assignee')), /*#__PURE__*/_react.default.createElement(_table.default.Cell, {
          style: {
            color: 'inherit',
            fontWeight: 'bold',
            width: '25%'
          }
        }, "".concat(Liferay.Language.get('new-assignee')), ' ', /*#__PURE__*/_react.default.createElement(_tooltip.ClayTooltipProvider, null, /*#__PURE__*/_react.default.createElement(_icon.default, {
          "data-tooltip-align": "top",
          style: {
            color: '#6B6C7E'
          },
          symbol: "question-circle-full",
          title: Liferay.Language.get('possible-assignees-must-have-permissions-to-be-assigned-to-the-corresponding-step')
        }))))), /*#__PURE__*/_react.default.createElement(_table.default.Body, null, items && items.length > 0 && items.map(function (item, index) {
          return (/*#__PURE__*/_react.default.createElement(Table.Item, _extends({}, item, {
              key: index,
              setAssigneeId: setAssigneeId
            }))
          );
        })))
      );
    };

    exports.Table = Table;
    Table.AssigneeInput = AssigneeInput;
    Table.Item = Item;
    //# sourceMappingURL=SingleReassignModalTable.es.js.map
  }
});
//# sourceMappingURL=SingleReassignModalTable.es.js.map