@undp/carbon-library 1.0.274-CARBON-363.29 → 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,9 +27064,9 @@ 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
- if (subNdcActionsForPeriod.length === 0) {
27069
+ if (ndcMainDetailsForPeriod.length === 0) {
27068
27070
  message.open({
27069
27071
  type: "error",
27070
27072
  content: t("ndc:finalizeNdcEmptyErrorText"),
@@ -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) {
@@ -27184,8 +27195,11 @@ var NdcDetailsComponent = function (props) {
27184
27195
  return __generator(this, function (_a) {
27185
27196
  switch (_a.label) {
27186
27197
  case 0:
27187
- _a.trys.push([0, 3, , 4]);
27188
- if (!(selectedDateRangeRef && selectedDateRangeRef.current)) return [3 /*break*/, 2];
27198
+ _a.trys.push([0, 4, , 5]);
27199
+ if (!(selectedDateRangeRef &&
27200
+ selectedDateRangeRef.current &&
27201
+ selectedDateRangeRef.current.startYear &&
27202
+ selectedDateRangeRef.current.endYear)) return [3 /*break*/, 3];
27189
27203
  periodItem_1 = {
27190
27204
  startYear: selectedDateRangeRef.current.startYear,
27191
27205
  endYear: selectedDateRangeRef.current.endYear,
@@ -27205,9 +27219,17 @@ var NdcDetailsComponent = function (props) {
27205
27219
  setPeriodItems(function (items) { return __spreadArray(__spreadArray([], items, true), [updatedPeriodItem_1], false); });
27206
27220
  setSelectedPeriod(updatedPeriodItem_1);
27207
27221
  }
27208
- _a.label = 2;
27209
- case 2: return [3 /*break*/, 4];
27210
- case 3:
27222
+ return [3 /*break*/, 3];
27223
+ case 2:
27224
+ message.open({
27225
+ type: "error",
27226
+ content: t("ndc:rangeAlreadyExists"),
27227
+ duration: 3,
27228
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27229
+ });
27230
+ _a.label = 3;
27231
+ case 3: return [3 /*break*/, 5];
27232
+ case 4:
27211
27233
  exception_3 = _a.sent();
27212
27234
  message.open({
27213
27235
  type: "error",
@@ -27215,8 +27237,8 @@ var NdcDetailsComponent = function (props) {
27215
27237
  duration: 3,
27216
27238
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27217
27239
  });
27218
- return [3 /*break*/, 4];
27219
- case 4: return [2 /*return*/];
27240
+ return [3 /*break*/, 5];
27241
+ case 5: return [2 /*return*/];
27220
27242
  }
27221
27243
  });
27222
27244
  }); };
@@ -27314,6 +27336,8 @@ var NdcDetailsComponent = function (props) {
27314
27336
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27315
27337
  });
27316
27338
  fetchNdcDetailPeriods();
27339
+ setTableKey(function (key) { return key + 1; });
27340
+ setEditingKey(null);
27317
27341
  }
27318
27342
  else if (actionInfo.action === "Approve") {
27319
27343
  message.open({