@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/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,7 +27084,7 @@ 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
27089
  if (ndcMainDetailsForPeriod.length === 0) {
27088
27090
  antd.message.open({
@@ -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) {
@@ -27345,6 +27356,8 @@ var NdcDetailsComponent = function (props) {
27345
27356
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
27346
27357
  });
27347
27358
  fetchNdcDetailPeriods();
27359
+ setTableKey(function (key) { return key + 1; });
27360
+ setEditingKey(null);
27348
27361
  }
27349
27362
  else if (actionInfo.action === "Approve") {
27350
27363
  antd.message.open({