@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/cjs/index.js CHANGED
@@ -26964,7 +26964,8 @@ var NdcDetailsComponent = function (props) {
26964
26964
  align: "left",
26965
26965
  width: 400,
26966
26966
  editable: true,
26967
- render: function (_, record) { return (React.createElement(antd.Space, { size: "middle" }, record.nationalPlanObjective ? (React.createElement("span", null, record.nationalPlanObjective)) : (React.createElement(antd.Input, { placeholder: "Enter National Plan Objective" })))); },
26967
+ render: function (_, record) { return (React.createElement(antd.Space, { size: "middle" }, record.nationalPlanObjective ? (React.createElement(antd.Tooltip, { title: isNdcActionEditable(record) ? "" : t("ndc:ndcUnauthorisedMsg") },
26968
+ React.createElement("span", null, record.nationalPlanObjective))) : (React.createElement(antd.Input, { placeholder: "Enter National Plan Objective" })))); },
26968
26969
  },
26969
26970
  {
26970
26971
  title: t("ndc:ndcColumnsKpi"),
@@ -26973,7 +26974,8 @@ var NdcDetailsComponent = function (props) {
26973
26974
  align: "left",
26974
26975
  width: 100,
26975
26976
  editable: true,
26976
- render: function (_, record) { return (React.createElement(antd.Space, { size: "middle" }, record.kpi ? (React.createElement("span", null, record.kpi)) : (React.createElement(antd.Input, { placeholder: "Enter Kpi" })))); },
26977
+ render: function (_, record) { return (React.createElement(antd.Space, { size: "middle" }, record.kpi ? (React.createElement(antd.Tooltip, { title: isNdcActionEditable(record) ? "" : t("ndc:ndcUnauthorisedMsg") },
26978
+ React.createElement("span", null, record.kpi))) : (React.createElement(antd.Input, { placeholder: "Enter Kpi" })))); },
26977
26979
  },
26978
26980
  {
26979
26981
  title: t("ndc:ndcColumnsMinistry"),
@@ -26982,7 +26984,7 @@ var NdcDetailsComponent = function (props) {
26982
26984
  align: "left",
26983
26985
  width: 300,
26984
26986
  editable: false,
26985
- render: function (_, record) { return (React.createElement(React.Fragment, null,
26987
+ render: function (_, record) { return (React.createElement(antd.Tooltip, { title: isSubNdcActionsEditable(record) ? "" : t("ndc:ndcUnauthorisedMsg") },
26986
26988
  React.createElement(antd.Select, { disabled: !(isSubNdcActionsEditable(record) && isEditing(record)), defaultValue: record.ministryName ? record.ministryName : loginMinistry, style: { width: 220 }, onChange: function (value, option) {
26987
26989
  record.ministryName = option.label;
26988
26990
  handleSave(record);
@@ -27082,9 +27084,9 @@ var NdcDetailsComponent = function (props) {
27082
27084
  });
27083
27085
  }); };
27084
27086
  var onClickedFinalizePeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
27085
- var pendingActions;
27087
+ var isPendingActionAvailable;
27086
27088
  return __generator(this, function (_a) {
27087
- if (subNdcActionsForPeriod.length === 0) {
27089
+ if (ndcMainDetailsForPeriod.length === 0) {
27088
27090
  antd.message.open({
27089
27091
  type: "error",
27090
27092
  content: t("ndc:finalizeNdcEmptyErrorText"),
@@ -27093,10 +27095,19 @@ var NdcDetailsComponent = function (props) {
27093
27095
  });
27094
27096
  return [2 /*return*/];
27095
27097
  }
27096
- pendingActions = subNdcActionsForPeriod.filter(function (action) {
27097
- return action.status === NdcDetailsActionStatus.Pending;
27098
+ isPendingActionAvailable = false;
27099
+ ndcMainDetailsForPeriod.forEach(function (mainAction) {
27100
+ var pendingActions = ndcActionsList.filter(function (action) {
27101
+ return (action.status === NdcDetailsActionStatus.Pending &&
27102
+ action.actionType === NdcDetailsActionType.SubAction &&
27103
+ action.parentActionId === mainAction.id);
27104
+ });
27105
+ if (pendingActions && pendingActions.length > 0) {
27106
+ isPendingActionAvailable = true;
27107
+ return;
27108
+ }
27098
27109
  });
27099
- if (pendingActions && pendingActions.length > 0) {
27110
+ if (isPendingActionAvailable) {
27100
27111
  antd.message.open({
27101
27112
  type: "error",
27102
27113
  content: t("ndc:finalizeErrorText"),
@@ -27177,8 +27188,8 @@ var NdcDetailsComponent = function (props) {
27177
27188
  React.createElement(antd.Button, { className: "btnAddNewMainAct", disabled: isMainActionInEditMode(), onClick: onClickedAddNewNdcDetail, type: "default" }, t("ndc:addNdcAction"))));
27178
27189
  } })))),
27179
27190
  isGovernmentUser && !selectedPeriod.finalized ? (React.createElement(antd.Row, { justify: "end" },
27180
- React.createElement(antd.Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", loading: loading }, t("ndc:delete")),
27181
- React.createElement(antd.Button, { className: "mg-left-1", type: "primary", onClick: onClickedFinalizePeriod, htmlType: "submit", loading: loading }, t("ndc:finalize")))) : ("")));
27191
+ React.createElement(antd.Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", disabled: isMainActionInEditMode(), loading: loading }, t("ndc:delete")),
27192
+ React.createElement(antd.Button, { className: "mg-left-1", type: "primary", onClick: onClickedFinalizePeriod, disabled: isMainActionInEditMode(), htmlType: "submit", loading: loading }, t("ndc:finalize")))) : ("")));
27182
27193
  }
27183
27194
  function subNdcActionTableContent(record) {
27184
27195
  return (React.createElement(antd.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) {
@@ -27204,8 +27215,11 @@ var NdcDetailsComponent = function (props) {
27204
27215
  return __generator(this, function (_a) {
27205
27216
  switch (_a.label) {
27206
27217
  case 0:
27207
- _a.trys.push([0, 3, , 4]);
27208
- if (!(selectedDateRangeRef && selectedDateRangeRef.current)) return [3 /*break*/, 2];
27218
+ _a.trys.push([0, 4, , 5]);
27219
+ if (!(selectedDateRangeRef &&
27220
+ selectedDateRangeRef.current &&
27221
+ selectedDateRangeRef.current.startYear &&
27222
+ selectedDateRangeRef.current.endYear)) return [3 /*break*/, 3];
27209
27223
  periodItem_1 = {
27210
27224
  startYear: selectedDateRangeRef.current.startYear,
27211
27225
  endYear: selectedDateRangeRef.current.endYear,
@@ -27225,9 +27239,17 @@ var NdcDetailsComponent = function (props) {
27225
27239
  setPeriodItems(function (items) { return __spreadArray(__spreadArray([], items, true), [updatedPeriodItem_1], false); });
27226
27240
  setSelectedPeriod(updatedPeriodItem_1);
27227
27241
  }
27228
- _a.label = 2;
27229
- case 2: return [3 /*break*/, 4];
27230
- case 3:
27242
+ return [3 /*break*/, 3];
27243
+ case 2:
27244
+ antd.message.open({
27245
+ type: "error",
27246
+ content: t("ndc:rangeAlreadyExists"),
27247
+ duration: 3,
27248
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27249
+ });
27250
+ _a.label = 3;
27251
+ case 3: return [3 /*break*/, 5];
27252
+ case 4:
27231
27253
  exception_3 = _a.sent();
27232
27254
  antd.message.open({
27233
27255
  type: "error",
@@ -27235,8 +27257,8 @@ var NdcDetailsComponent = function (props) {
27235
27257
  duration: 3,
27236
27258
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27237
27259
  });
27238
- return [3 /*break*/, 4];
27239
- case 4: return [2 /*return*/];
27260
+ return [3 /*break*/, 5];
27261
+ case 5: return [2 /*return*/];
27240
27262
  }
27241
27263
  });
27242
27264
  }); };
@@ -27334,6 +27356,8 @@ var NdcDetailsComponent = function (props) {
27334
27356
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27335
27357
  });
27336
27358
  fetchNdcDetailPeriods();
27359
+ setTableKey(function (key) { return key + 1; });
27360
+ setEditingKey(null);
27337
27361
  }
27338
27362
  else if (actionInfo.action === "Approve") {
27339
27363
  antd.message.open({