Liferay.Loader.define("portal-workflow-metrics-web@2.0.59/js/components/process-metrics/workload-by-step-card/WorkloadByStepCardItem.es", ['module', 'exports', 'require', 'frontend-js-react-web$react', '../../../shared/components/filter/util/filterConstants.es', '../../../shared/components/router/ChildLink.es', '../../AppContext.es', '../../filter/ProcessStatusFilter.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.Item = void 0;

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

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

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

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

    var _ProcessStatusFilter = require("../../filter/ProcessStatusFilter.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 _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 instanceCount = _ref.instanceCount,
          _ref$node = _ref.node,
          label = _ref$node.label,
          name = _ref$node.name,
          onTimeInstanceCount = _ref.onTimeInstanceCount,
          overdueInstanceCount = _ref.overdueInstanceCount,
          processId = _ref.processId;

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

      var getFiltersQuery = function getFiltersQuery(slaStatusFilter) {
        var _ref2;

        return _ref2 = {}, _defineProperty(_ref2, _filterConstants.default.processStatus.key, [_ProcessStatusFilter.processStatusConstants.pending]), _defineProperty(_ref2, _filterConstants.default.processStep.key, [name]), _defineProperty(_ref2, _filterConstants.default.slaStatus.key, [slaStatusFilter]), _ref2;
      };

      var instancesListPath = "/instance/".concat(processId, "/").concat(defaultDelta, "/1");
      return (/*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
          className: "lfr-title-column table-cell-expand table-cell-minw-200 table-title"
        }, label), /*#__PURE__*/_react.default.createElement("td", {
          className: "text-right"
        }, /*#__PURE__*/_react.default.createElement(_ChildLink.default, {
          className: "workload-by-step-link",
          query: {
            filters: getFiltersQuery('Overdue')
          },
          to: instancesListPath
        }, overdueInstanceCount)), /*#__PURE__*/_react.default.createElement("td", {
          className: "text-right"
        }, /*#__PURE__*/_react.default.createElement(_ChildLink.default, {
          className: "workload-by-step-link",
          query: {
            filters: getFiltersQuery('OnTime')
          },
          to: instancesListPath
        }, onTimeInstanceCount)), /*#__PURE__*/_react.default.createElement("td", {
          className: "text-right"
        }, /*#__PURE__*/_react.default.createElement(_ChildLink.default, {
          className: "workload-by-step-link",
          query: {
            filters: getFiltersQuery()
          },
          to: instancesListPath
        }, instanceCount)))
      );
    };

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