Liferay.Loader.define("portal-workflow-metrics-web@2.0.46/js/components/workload-by-assignee-page/WorkloadByAssigneePageTable.es", ['module', 'exports', 'require', 'frontend-js-react-web$react', '../../shared/components/filter/util/filterConstants.es', '../../shared/components/list/ListHeadItem.es', '../../shared/components/router/ChildLink.es', '../../shared/components/user-avatar/UserAvatar.es', '../AppContext.es', '../filter/ProcessStatusFilter.es', '../filter/SLAStatusFilter.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 _react = _interopRequireWildcard(require("frontend-js-react-web$react"));

    var _filterConstants = _interopRequireDefault(require("../../shared/components/filter/util/filterConstants.es"));

    var _ListHeadItem = _interopRequireDefault(require("../../shared/components/list/ListHeadItem.es"));

    var _ChildLink = _interopRequireDefault(require("../../shared/components/router/ChildLink.es"));

    var _UserAvatar = _interopRequireDefault(require("../../shared/components/user-avatar/UserAvatar.es"));

    var _AppContext = require("../AppContext.es");

    var _ProcessStatusFilter = require("../filter/ProcessStatusFilter.es");

    var _SLAStatusFilter = require("../filter/SLAStatusFilter.es");

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

    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 _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);
    }

    function _defineProperty(obj, key, value) {
      if (key in obj) {
        Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
      } else {
        obj[key] = value;
      }return obj;
    }

    var Item = function Item(_ref) {
      var _ref$assignee = _ref.assignee,
          id = _ref$assignee.id,
          image = _ref$assignee.image,
          name = _ref$assignee.name,
          onTimeTaskCount = _ref.onTimeTaskCount,
          overdueTaskCount = _ref.overdueTaskCount,
          processId = _ref.processId,
          taskCount = _ref.taskCount,
          taskNames = _ref.taskNames;

      var _useContext = (0, _react.useContext)(_AppContext.AppContext),
          defaultDelta = _useContext.defaultDelta;

      var getFiltersQuery = (0, _react.useCallback)(function (slaStatus) {
        var _ref2;

        return _ref2 = {}, _defineProperty(_ref2, _filterConstants.default.assignee.key, [id]), _defineProperty(_ref2, _filterConstants.default.processStatus.key, [_ProcessStatusFilter.processStatusConstants.pending]), _defineProperty(_ref2, _filterConstants.default.processStep.key, taskNames), _defineProperty(_ref2, _filterConstants.default.slaStatus.key, [slaStatus]), _ref2;
      }, [id, taskNames]);
      var instancesListPath = (0, _react.useMemo)(function () {
        return "/instance/".concat(processId, "/").concat(defaultDelta, "/1");
      }, [defaultDelta, processId]);
      return (/*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
          className: "lfr-title-column table-cell-expand table-title"
        }, /*#__PURE__*/_react.default.createElement(_UserAvatar.default, {
          className: "mr-3",
          image: image
        }), /*#__PURE__*/_react.default.createElement(_ChildLink.default, {
          className: "workload-by-step-link",
          query: {
            filters: getFiltersQuery()
          },
          to: instancesListPath
        }, /*#__PURE__*/_react.default.createElement("span", null, name))), /*#__PURE__*/_react.default.createElement("td", {
          className: "table-cell-minw-75 text-right"
        }, /*#__PURE__*/_react.default.createElement(_ChildLink.default, {
          className: "workload-by-step-link",
          query: {
            filters: getFiltersQuery(_SLAStatusFilter.slaStatusConstants.overdue)
          },
          to: instancesListPath
        }, overdueTaskCount)), /*#__PURE__*/_react.default.createElement("td", {
          className: "table-cell-minw-75 text-right"
        }, /*#__PURE__*/_react.default.createElement(_ChildLink.default, {
          className: "workload-by-step-link",
          query: {
            filters: getFiltersQuery(_SLAStatusFilter.slaStatusConstants.onTime)
          },
          to: instancesListPath
        }, onTimeTaskCount)), /*#__PURE__*/_react.default.createElement("td", {
          className: "table-cell-minw-75 text-right"
        }, /*#__PURE__*/_react.default.createElement(_ChildLink.default, {
          className: "workload-by-step-link",
          query: {
            filters: getFiltersQuery()
          },
          to: instancesListPath
        }, taskCount)))
      );
    };

    var Table = function Table(_ref3) {
      var items = _ref3.items,
          processId = _ref3.processId,
          taskNames = _ref3.taskNames;
      return (/*#__PURE__*/_react.default.createElement("div", {
          className: "table-responsive workflow-process-dashboard"
        }, /*#__PURE__*/_react.default.createElement("table", {
          className: "table table-heading-nowrap table-hover table-list"
        }, /*#__PURE__*/_react.default.createElement("thead", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("th", {
          className: "table-cell-expand table-head-title",
          style: {
            width: '62%'
          }
        }, Liferay.Language.get('assignee-name')), /*#__PURE__*/_react.default.createElement("th", {
          className: "table-cell-minw-75 table-head-title text-right"
        }, /*#__PURE__*/_react.default.createElement(_ListHeadItem.default, {
          iconColor: "danger",
          iconName: "exclamation-circle",
          name: "overdueTaskCount",
          title: Liferay.Language.get('overdue')
        })), /*#__PURE__*/_react.default.createElement("th", {
          className: "table-cell-minw-75 table-head-title text-right"
        }, /*#__PURE__*/_react.default.createElement(_ListHeadItem.default, {
          iconColor: "success",
          iconName: "check-circle",
          name: "onTimeTaskCount",
          title: Liferay.Language.get('on-time')
        })), /*#__PURE__*/_react.default.createElement("th", {
          className: "table-cell-minw-75 table-head-title text-right"
        }, /*#__PURE__*/_react.default.createElement(_ListHeadItem.default, {
          name: "taskCount",
          title: Liferay.Language.get('total-pending')
        })))), /*#__PURE__*/_react.default.createElement("tbody", null, items.map(function (item, index) {
          return (/*#__PURE__*/_react.default.createElement(Table.Item, _extends({}, item, {
              key: index,
              processId: processId,
              taskNames: taskNames
            }))
          );
        }))))
      );
    };

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