@undp/carbon-library 1.0.274-CARBON-363.33 → 1.0.274-CARBON-363.39

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/index.js CHANGED
@@ -26944,7 +26944,8 @@ var NdcDetailsComponent = function (props) {
26944
26944
  align: "left",
26945
26945
  width: 400,
26946
26946
  editable: true,
26947
- render: function (_, record) { return (React.createElement(Space, { size: "middle" }, record.nationalPlanObjective ? (React.createElement("span", null, record.nationalPlanObjective)) : (React.createElement(Input, { placeholder: "Enter National Plan Objective" })))); },
26947
+ render: function (_, record) { return (React.createElement(Space, { size: "middle" }, record.nationalPlanObjective ? (React.createElement(Tooltip, { title: isNdcActionEditable(record) ? "" : t("ndc:ndcUnauthorisedMsg") },
26948
+ React.createElement("span", null, record.nationalPlanObjective))) : (React.createElement(Input, { placeholder: "Enter National Plan Objective" })))); },
26948
26949
  },
26949
26950
  {
26950
26951
  title: t("ndc:ndcColumnsKpi"),
@@ -26953,7 +26954,8 @@ var NdcDetailsComponent = function (props) {
26953
26954
  align: "left",
26954
26955
  width: 100,
26955
26956
  editable: true,
26956
- render: function (_, record) { return (React.createElement(Space, { size: "middle" }, record.kpi ? (React.createElement("span", null, record.kpi)) : (React.createElement(Input, { placeholder: "Enter Kpi" })))); },
26957
+ render: function (_, record) { return (React.createElement(Space, { size: "middle" }, record.kpi ? (React.createElement(Tooltip, { title: isNdcActionEditable(record) ? "" : t("ndc:ndcUnauthorisedMsg") },
26958
+ React.createElement("span", null, record.kpi))) : (React.createElement(Input, { placeholder: "Enter Kpi" })))); },
26957
26959
  },
26958
26960
  {
26959
26961
  title: t("ndc:ndcColumnsMinistry"),
@@ -26962,7 +26964,7 @@ var NdcDetailsComponent = function (props) {
26962
26964
  align: "left",
26963
26965
  width: 300,
26964
26966
  editable: false,
26965
- render: function (_, record) { return (React.createElement(React.Fragment, null,
26967
+ render: function (_, record) { return (React.createElement(Tooltip, { title: isSubNdcActionsEditable(record) ? "" : t("ndc:ndcUnauthorisedMsg") },
26966
26968
  React.createElement(Select, { disabled: !(isSubNdcActionsEditable(record) && isEditing(record)), defaultValue: record.ministryName ? record.ministryName : loginMinistry, style: { width: 220 }, onChange: function (value, option) {
26967
26969
  record.ministryName = option.label;
26968
26970
  handleSave(record);
@@ -27062,7 +27064,7 @@ var NdcDetailsComponent = function (props) {
27062
27064
  });
27063
27065
  }); };
27064
27066
  var onClickedFinalizePeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
27065
- var pendingActions;
27067
+ var isPendingActionAvailable;
27066
27068
  return __generator(this, function (_a) {
27067
27069
  if (ndcMainDetailsForPeriod.length === 0) {
27068
27070
  message.open({
@@ -27073,10 +27075,19 @@ var NdcDetailsComponent = function (props) {
27073
27075
  });
27074
27076
  return [2 /*return*/];
27075
27077
  }
27076
- pendingActions = subNdcActionsForPeriod.filter(function (action) {
27077
- return action.status === NdcDetailsActionStatus.Pending;
27078
+ isPendingActionAvailable = false;
27079
+ ndcMainDetailsForPeriod.forEach(function (mainAction) {
27080
+ var pendingActions = ndcActionsList.filter(function (action) {
27081
+ return (action.status === NdcDetailsActionStatus.Pending &&
27082
+ action.actionType === NdcDetailsActionType.SubAction &&
27083
+ action.parentActionId === mainAction.id);
27084
+ });
27085
+ if (pendingActions && pendingActions.length > 0) {
27086
+ isPendingActionAvailable = true;
27087
+ return;
27088
+ }
27078
27089
  });
27079
- if (pendingActions && pendingActions.length > 0) {
27090
+ if (isPendingActionAvailable) {
27080
27091
  message.open({
27081
27092
  type: "error",
27082
27093
  content: t("ndc:finalizeErrorText"),
@@ -27157,8 +27168,8 @@ var NdcDetailsComponent = function (props) {
27157
27168
  React.createElement(Button, { className: "btnAddNewMainAct", disabled: isMainActionInEditMode(), onClick: onClickedAddNewNdcDetail, type: "default" }, t("ndc:addNdcAction"))));
27158
27169
  } })))),
27159
27170
  isGovernmentUser && !selectedPeriod.finalized ? (React.createElement(Row, { justify: "end" },
27160
- React.createElement(Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", loading: loading }, t("ndc:delete")),
27161
- React.createElement(Button, { className: "mg-left-1", type: "primary", onClick: onClickedFinalizePeriod, htmlType: "submit", loading: loading }, t("ndc:finalize")))) : ("")));
27171
+ React.createElement(Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", disabled: isMainActionInEditMode(), loading: loading }, t("ndc:delete")),
27172
+ React.createElement(Button, { className: "mg-left-1", type: "primary", onClick: onClickedFinalizePeriod, disabled: isMainActionInEditMode(), htmlType: "submit", loading: loading }, t("ndc:finalize")))) : ("")));
27162
27173
  }
27163
27174
  function subNdcActionTableContent(record) {
27164
27175
  return (React.createElement(Table, { tableLayout: "fixed", rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, className: "common-table-class", bordered: true, dataSource: subNdcActionsForPeriod, loading: loading, onRow: function (record, rowIndex) {
@@ -27325,6 +27336,8 @@ var NdcDetailsComponent = function (props) {
27325
27336
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27326
27337
  });
27327
27338
  fetchNdcDetailPeriods();
27339
+ setTableKey(function (key) { return key + 1; });
27340
+ setEditingKey(null);
27328
27341
  }
27329
27342
  else if (actionInfo.action === "Approve") {
27330
27343
  message.open({