@undp/carbon-library 1.0.285-CARBON-406.0 → 1.0.285-CARBON-287.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -26775,21 +26775,7 @@ var EditableCell = function (_a) {
26775
26775
  }); },
26776
26776
  },
26777
26777
  ] },
26778
- React.createElement(antd.Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:nationalPlanObjectivePlaceHolder") }))) : editing && dataIndex === "kpiUnit" ? (React.createElement(antd.Form.Item, { name: dataIndex, style: { margin: 0 }, rules: [
26779
- {
26780
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
26781
- var trimValue;
26782
- return __generator(this, function (_a) {
26783
- trimValue = typeof value === "string" ? value.trim() : value;
26784
- if (!trimValue) {
26785
- throw new Error("".concat(title, " ").concat(t("ndc:isRequired")));
26786
- }
26787
- return [2 /*return*/];
26788
- });
26789
- }); },
26790
- },
26791
- ] },
26792
- React.createElement(antd.Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:kpiUnitPlaceHolder") }))) : editing && dataIndex === "kpi" ? (React.createElement(antd.Form.Item, { name: dataIndex, style: { margin: 0 }, rules: [
26778
+ React.createElement(antd.Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:nationalPlanObjectivePlaceHolder") }))) : editing && dataIndex === "kpi" ? (React.createElement(antd.Form.Item, { name: dataIndex, style: { margin: 0 }, rules: [
26793
26779
  {
26794
26780
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
26795
26781
  var trimValue;
@@ -26896,13 +26882,11 @@ var NdcDetailsComponent = function (props) {
26896
26882
  : undefined;
26897
26883
  var isGovernmentUser = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT &&
26898
26884
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== exports.Role.ViewOnly;
26899
- var isMainNdcActionsEditable = selectedPeriod &&
26900
- !selectedPeriod.finalized &&
26885
+ var isMainNdcActionsEditable = !selectedPeriod.finalized &&
26901
26886
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT &&
26902
26887
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== exports.Role.ViewOnly;
26903
26888
  var isSubNdcActionsEditable = function (record) {
26904
- return (selectedPeriod &&
26905
- !selectedPeriod.finalized &&
26889
+ return (!selectedPeriod.finalized &&
26906
26890
  record.status !== NdcDetailsActionStatus.Approved &&
26907
26891
  ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT ||
26908
26892
  ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.MINISTRY &&
@@ -26910,8 +26894,7 @@ var NdcDetailsComponent = function (props) {
26910
26894
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== exports.Role.ViewOnly);
26911
26895
  };
26912
26896
  var checkSubNdcActionCreatePermission = function () {
26913
- return (selectedPeriod &&
26914
- !selectedPeriod.finalized &&
26897
+ return (!selectedPeriod.finalized &&
26915
26898
  ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT ||
26916
26899
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.MINISTRY) &&
26917
26900
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== exports.Role.ViewOnly);
@@ -26924,7 +26907,7 @@ var NdcDetailsComponent = function (props) {
26924
26907
  return isSubNdcActionsEditable(record);
26925
26908
  }
26926
26909
  };
26927
- var ndcMainDetailsForPeriod = selectedPeriod && selectedPeriod.key !== "add_new"
26910
+ var ndcMainDetailsForPeriod = selectedPeriod.key !== "add_new"
26928
26911
  ? ndcActionsList.filter(function (ndcDetail) {
26929
26912
  return (ndcDetail.periodId === parseInt(selectedPeriod.key) &&
26930
26913
  ndcDetail.actionType === NdcDetailsActionType.MainAction);
@@ -26940,7 +26923,6 @@ var NdcDetailsComponent = function (props) {
26940
26923
  actionType: NdcDetailsActionType.SubAction,
26941
26924
  nationalPlanObjective: "",
26942
26925
  kpi: "",
26943
- kpiUnit: "",
26944
26926
  ministryName: loginMinistry,
26945
26927
  status: NdcDetailsActionStatus.New,
26946
26928
  parentActionId: mainActionId,
@@ -26952,7 +26934,6 @@ var NdcDetailsComponent = function (props) {
26952
26934
  form.setFieldsValue({
26953
26935
  nationalPlanObjective: "",
26954
26936
  kpi: "",
26955
- kpiUnit: "",
26956
26937
  });
26957
26938
  }
26958
26939
  setSubNdcActionsForPeriod(subNdcDetails);
@@ -26994,7 +26975,6 @@ var NdcDetailsComponent = function (props) {
26994
26975
  return [2 /*return*/];
26995
26976
  }
26996
26977
  else if (updatedFields.kpi === row.kpi &&
26997
- updatedFields.kpiUnit === row.kpiUnit &&
26998
26978
  updatedFields.nationalPlanObjective === row.nationalPlanObjective) {
26999
26979
  ClearEditMode();
27000
26980
  return [2 /*return*/];
@@ -27008,13 +26988,13 @@ var NdcDetailsComponent = function (props) {
27008
26988
  else {
27009
26989
  updatedItem.status = NdcDetailsActionStatus.Pending;
27010
26990
  }
27011
- return [4 /*yield*/, post("national/programme/addNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseFloat(updatedItem.kpi.toString()) }))];
26991
+ return [4 /*yield*/, post("national/programme/addNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi.toString()) }))];
27012
26992
  case 5:
27013
26993
  _a.sent();
27014
26994
  return [3 /*break*/, 8];
27015
26995
  case 6:
27016
26996
  updatedItem.status = NdcDetailsActionStatus.Pending;
27017
- return [4 /*yield*/, put("national/programme/updateNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseFloat(updatedItem.kpi.toString()) }))];
26997
+ return [4 /*yield*/, put("national/programme/updateNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi.toString()) }))];
27018
26998
  case 7:
27019
26999
  _a.sent();
27020
27000
  _a.label = 8;
@@ -27039,7 +27019,6 @@ var NdcDetailsComponent = function (props) {
27039
27019
  var actionMenu = function (record) {
27040
27020
  if (record.status === NdcDetailsActionStatus.Pending &&
27041
27021
  isGovernmentUser &&
27042
- selectedPeriod &&
27043
27022
  !selectedPeriod.finalized) {
27044
27023
  return (React.createElement(antd.List, { className: "action-menu", size: "small", dataSource: [
27045
27024
  {
@@ -27099,17 +27078,7 @@ var NdcDetailsComponent = function (props) {
27099
27078
  width: 100,
27100
27079
  editable: true,
27101
27080
  render: function (_, record) { return (React.createElement(antd.Space, { size: "middle" }, record.kpi ? (React.createElement(antd.Tooltip, { title: isNdcActionEditable(record) ? "" : t("ndc:ndcUnauthorisedMsg") },
27102
- React.createElement("span", null, record.kpi))) : (React.createElement(antd.Input, { placeholder: t("ndc:kpiPlaceHolder") })))); },
27103
- },
27104
- {
27105
- title: t("ndc:ndcColumnsKpiUnit"),
27106
- dataIndex: "kpiUnit",
27107
- key: "kpiUnit",
27108
- align: "left",
27109
- width: 100,
27110
- editable: true,
27111
- render: function (_, record) { return (React.createElement(antd.Space, { size: "middle" }, record.kpiUnit ? (React.createElement(antd.Tooltip, { title: isNdcActionEditable(record) ? "" : t("ndc:ndcUnauthorisedMsg") },
27112
- React.createElement("span", null, record.kpiUnit))) : (React.createElement(antd.Input, { placeholder: t("ndc:kpiUnitPlaceHolder") })))); },
27081
+ React.createElement("span", null, record.kpi))) : (React.createElement(antd.Input, { placeholder: "Enter Kpi" })))); },
27113
27082
  },
27114
27083
  {
27115
27084
  title: t("ndc:ndcColumnsMinistry"),
@@ -27173,7 +27142,6 @@ var NdcDetailsComponent = function (props) {
27173
27142
  form.setFieldsValue({
27174
27143
  nationalPlanObjective: "",
27175
27144
  kpi: "",
27176
- kpiUnit: "",
27177
27145
  });
27178
27146
  periodId = parseInt(selectedPeriod.key);
27179
27147
  newData_1 = {
@@ -27181,7 +27149,6 @@ var NdcDetailsComponent = function (props) {
27181
27149
  actionType: NdcDetailsActionType.MainAction,
27182
27150
  nationalPlanObjective: "",
27183
27151
  kpi: "",
27184
- kpiUnit: "",
27185
27152
  ministryName: loginMinistry,
27186
27153
  periodId: periodId,
27187
27154
  status: NdcDetailsActionStatus.New,
@@ -27320,11 +27287,10 @@ var NdcDetailsComponent = function (props) {
27320
27287
  };
27321
27288
  }, footer: function () {
27322
27289
  return isGovernmentUser &&
27323
- selectedPeriod &&
27324
27290
  !selectedPeriod.finalized && (React.createElement(antd.Row, { justify: "center" },
27325
27291
  React.createElement(antd.Button, { className: "btnAddNewMainAct", disabled: isMainActionInEditMode(), onClick: onClickedAddNewNdcDetail, type: "default" }, t("ndc:addNdcAction"))));
27326
27292
  } })))),
27327
- isGovernmentUser && selectedPeriod && !selectedPeriod.finalized ? (React.createElement(antd.Row, { justify: "end" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
27293
+ isGovernmentUser && !selectedPeriod.finalized ? (React.createElement(antd.Row, { justify: "end" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
27328
27294
  React.createElement(antd.Button, { className: "mg-left-1", disabled: true }, t("ndc:delete")),
27329
27295
  React.createElement(antd.Button, { className: "mg-left-1", disabled: true }, t("ndc:finalize")))) : (React.createElement(React.Fragment, null,
27330
27296
  React.createElement(antd.Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", loading: loading }, t("ndc:delete")),
@@ -27672,12 +27638,10 @@ var NdcDetailsComponent = function (props) {
27672
27638
  React.createElement("div", { className: "body-title" }, t("ndc:ndcTitle")),
27673
27639
  React.createElement("div", { className: "body-sub-title" }, t("ndc:ndcSubTitle"))))),
27674
27640
  React.createElement("div", null,
27675
- React.createElement(antd.Tabs, { centered: false, defaultActiveKey: "1", items: periodItems, activeKey: selectedPeriod ? selectedPeriod.key : "1", onChange: onTabChange })),
27676
- React.createElement("div", null, selectedPeriod
27677
- ? selectedPeriod.key === "add_new"
27678
- ? addNewPeriodContent()
27679
- : mainNdcActionTableContent()
27680
- : ""),
27641
+ React.createElement(antd.Tabs, { centered: false, defaultActiveKey: "1", items: periodItems, activeKey: selectedPeriod.key, onChange: onTabChange })),
27642
+ React.createElement("div", null, selectedPeriod.key === "add_new"
27643
+ ? addNewPeriodContent()
27644
+ : mainNdcActionTableContent()),
27681
27645
  React.createElement(UserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onActionConfirmed, onActionCanceled: onActionCanceled, openModal: openConfirmationModal, errorMsg: "", loading: loading })));
27682
27646
  };
27683
27647