@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.
@@ -11,7 +11,6 @@ export type NdcDetail = {
11
11
  actionType: NdcDetailsActionType;
12
12
  nationalPlanObjective: string;
13
13
  kpi: number | string;
14
- kpiUnit: string;
15
14
  ministryName: string;
16
15
  periodId?: number;
17
16
  status: NdcDetailsActionStatus;
package/dist/esm/index.js CHANGED
@@ -26754,21 +26754,7 @@ var EditableCell = function (_a) {
26754
26754
  }); },
26755
26755
  },
26756
26756
  ] },
26757
- React.createElement(Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:nationalPlanObjectivePlaceHolder") }))) : editing && dataIndex === "kpiUnit" ? (React.createElement(Form.Item, { name: dataIndex, style: { margin: 0 }, rules: [
26758
- {
26759
- validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
26760
- var trimValue;
26761
- return __generator(this, function (_a) {
26762
- trimValue = typeof value === "string" ? value.trim() : value;
26763
- if (!trimValue) {
26764
- throw new Error("".concat(title, " ").concat(t("ndc:isRequired")));
26765
- }
26766
- return [2 /*return*/];
26767
- });
26768
- }); },
26769
- },
26770
- ] },
26771
- React.createElement(Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:kpiUnitPlaceHolder") }))) : editing && dataIndex === "kpi" ? (React.createElement(Form.Item, { name: dataIndex, style: { margin: 0 }, rules: [
26757
+ React.createElement(Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:nationalPlanObjectivePlaceHolder") }))) : editing && dataIndex === "kpi" ? (React.createElement(Form.Item, { name: dataIndex, style: { margin: 0 }, rules: [
26772
26758
  {
26773
26759
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
26774
26760
  var trimValue;
@@ -26875,13 +26861,11 @@ var NdcDetailsComponent = function (props) {
26875
26861
  : undefined;
26876
26862
  var isGovernmentUser = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
26877
26863
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly;
26878
- var isMainNdcActionsEditable = selectedPeriod &&
26879
- !selectedPeriod.finalized &&
26864
+ var isMainNdcActionsEditable = !selectedPeriod.finalized &&
26880
26865
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
26881
26866
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly;
26882
26867
  var isSubNdcActionsEditable = function (record) {
26883
- return (selectedPeriod &&
26884
- !selectedPeriod.finalized &&
26868
+ return (!selectedPeriod.finalized &&
26885
26869
  record.status !== NdcDetailsActionStatus.Approved &&
26886
26870
  ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT ||
26887
26871
  ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY &&
@@ -26889,8 +26873,7 @@ var NdcDetailsComponent = function (props) {
26889
26873
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly);
26890
26874
  };
26891
26875
  var checkSubNdcActionCreatePermission = function () {
26892
- return (selectedPeriod &&
26893
- !selectedPeriod.finalized &&
26876
+ return (!selectedPeriod.finalized &&
26894
26877
  ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT ||
26895
26878
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY) &&
26896
26879
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly);
@@ -26903,7 +26886,7 @@ var NdcDetailsComponent = function (props) {
26903
26886
  return isSubNdcActionsEditable(record);
26904
26887
  }
26905
26888
  };
26906
- var ndcMainDetailsForPeriod = selectedPeriod && selectedPeriod.key !== "add_new"
26889
+ var ndcMainDetailsForPeriod = selectedPeriod.key !== "add_new"
26907
26890
  ? ndcActionsList.filter(function (ndcDetail) {
26908
26891
  return (ndcDetail.periodId === parseInt(selectedPeriod.key) &&
26909
26892
  ndcDetail.actionType === NdcDetailsActionType.MainAction);
@@ -26919,7 +26902,6 @@ var NdcDetailsComponent = function (props) {
26919
26902
  actionType: NdcDetailsActionType.SubAction,
26920
26903
  nationalPlanObjective: "",
26921
26904
  kpi: "",
26922
- kpiUnit: "",
26923
26905
  ministryName: loginMinistry,
26924
26906
  status: NdcDetailsActionStatus.New,
26925
26907
  parentActionId: mainActionId,
@@ -26931,7 +26913,6 @@ var NdcDetailsComponent = function (props) {
26931
26913
  form.setFieldsValue({
26932
26914
  nationalPlanObjective: "",
26933
26915
  kpi: "",
26934
- kpiUnit: "",
26935
26916
  });
26936
26917
  }
26937
26918
  setSubNdcActionsForPeriod(subNdcDetails);
@@ -26973,7 +26954,6 @@ var NdcDetailsComponent = function (props) {
26973
26954
  return [2 /*return*/];
26974
26955
  }
26975
26956
  else if (updatedFields.kpi === row.kpi &&
26976
- updatedFields.kpiUnit === row.kpiUnit &&
26977
26957
  updatedFields.nationalPlanObjective === row.nationalPlanObjective) {
26978
26958
  ClearEditMode();
26979
26959
  return [2 /*return*/];
@@ -26987,13 +26967,13 @@ var NdcDetailsComponent = function (props) {
26987
26967
  else {
26988
26968
  updatedItem.status = NdcDetailsActionStatus.Pending;
26989
26969
  }
26990
- return [4 /*yield*/, post("national/programme/addNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseFloat(updatedItem.kpi.toString()) }))];
26970
+ return [4 /*yield*/, post("national/programme/addNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi.toString()) }))];
26991
26971
  case 5:
26992
26972
  _a.sent();
26993
26973
  return [3 /*break*/, 8];
26994
26974
  case 6:
26995
26975
  updatedItem.status = NdcDetailsActionStatus.Pending;
26996
- return [4 /*yield*/, put("national/programme/updateNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseFloat(updatedItem.kpi.toString()) }))];
26976
+ return [4 /*yield*/, put("national/programme/updateNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi.toString()) }))];
26997
26977
  case 7:
26998
26978
  _a.sent();
26999
26979
  _a.label = 8;
@@ -27018,7 +26998,6 @@ var NdcDetailsComponent = function (props) {
27018
26998
  var actionMenu = function (record) {
27019
26999
  if (record.status === NdcDetailsActionStatus.Pending &&
27020
27000
  isGovernmentUser &&
27021
- selectedPeriod &&
27022
27001
  !selectedPeriod.finalized) {
27023
27002
  return (React.createElement(List, { className: "action-menu", size: "small", dataSource: [
27024
27003
  {
@@ -27078,17 +27057,7 @@ var NdcDetailsComponent = function (props) {
27078
27057
  width: 100,
27079
27058
  editable: true,
27080
27059
  render: function (_, record) { return (React.createElement(Space, { size: "middle" }, record.kpi ? (React.createElement(Tooltip, { title: isNdcActionEditable(record) ? "" : t("ndc:ndcUnauthorisedMsg") },
27081
- React.createElement("span", null, record.kpi))) : (React.createElement(Input, { placeholder: t("ndc:kpiPlaceHolder") })))); },
27082
- },
27083
- {
27084
- title: t("ndc:ndcColumnsKpiUnit"),
27085
- dataIndex: "kpiUnit",
27086
- key: "kpiUnit",
27087
- align: "left",
27088
- width: 100,
27089
- editable: true,
27090
- render: function (_, record) { return (React.createElement(Space, { size: "middle" }, record.kpiUnit ? (React.createElement(Tooltip, { title: isNdcActionEditable(record) ? "" : t("ndc:ndcUnauthorisedMsg") },
27091
- React.createElement("span", null, record.kpiUnit))) : (React.createElement(Input, { placeholder: t("ndc:kpiUnitPlaceHolder") })))); },
27060
+ React.createElement("span", null, record.kpi))) : (React.createElement(Input, { placeholder: "Enter Kpi" })))); },
27092
27061
  },
27093
27062
  {
27094
27063
  title: t("ndc:ndcColumnsMinistry"),
@@ -27152,7 +27121,6 @@ var NdcDetailsComponent = function (props) {
27152
27121
  form.setFieldsValue({
27153
27122
  nationalPlanObjective: "",
27154
27123
  kpi: "",
27155
- kpiUnit: "",
27156
27124
  });
27157
27125
  periodId = parseInt(selectedPeriod.key);
27158
27126
  newData_1 = {
@@ -27160,7 +27128,6 @@ var NdcDetailsComponent = function (props) {
27160
27128
  actionType: NdcDetailsActionType.MainAction,
27161
27129
  nationalPlanObjective: "",
27162
27130
  kpi: "",
27163
- kpiUnit: "",
27164
27131
  ministryName: loginMinistry,
27165
27132
  periodId: periodId,
27166
27133
  status: NdcDetailsActionStatus.New,
@@ -27299,11 +27266,10 @@ var NdcDetailsComponent = function (props) {
27299
27266
  };
27300
27267
  }, footer: function () {
27301
27268
  return isGovernmentUser &&
27302
- selectedPeriod &&
27303
27269
  !selectedPeriod.finalized && (React.createElement(Row, { justify: "center" },
27304
27270
  React.createElement(Button, { className: "btnAddNewMainAct", disabled: isMainActionInEditMode(), onClick: onClickedAddNewNdcDetail, type: "default" }, t("ndc:addNdcAction"))));
27305
27271
  } })))),
27306
- isGovernmentUser && selectedPeriod && !selectedPeriod.finalized ? (React.createElement(Row, { justify: "end" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
27272
+ isGovernmentUser && !selectedPeriod.finalized ? (React.createElement(Row, { justify: "end" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
27307
27273
  React.createElement(Button, { className: "mg-left-1", disabled: true }, t("ndc:delete")),
27308
27274
  React.createElement(Button, { className: "mg-left-1", disabled: true }, t("ndc:finalize")))) : (React.createElement(React.Fragment, null,
27309
27275
  React.createElement(Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", loading: loading }, t("ndc:delete")),
@@ -27651,12 +27617,10 @@ var NdcDetailsComponent = function (props) {
27651
27617
  React.createElement("div", { className: "body-title" }, t("ndc:ndcTitle")),
27652
27618
  React.createElement("div", { className: "body-sub-title" }, t("ndc:ndcSubTitle"))))),
27653
27619
  React.createElement("div", null,
27654
- React.createElement(Tabs, { centered: false, defaultActiveKey: "1", items: periodItems, activeKey: selectedPeriod ? selectedPeriod.key : "1", onChange: onTabChange })),
27655
- React.createElement("div", null, selectedPeriod
27656
- ? selectedPeriod.key === "add_new"
27657
- ? addNewPeriodContent()
27658
- : mainNdcActionTableContent()
27659
- : ""),
27620
+ React.createElement(Tabs, { centered: false, defaultActiveKey: "1", items: periodItems, activeKey: selectedPeriod.key, onChange: onTabChange })),
27621
+ React.createElement("div", null, selectedPeriod.key === "add_new"
27622
+ ? addNewPeriodContent()
27623
+ : mainNdcActionTableContent()),
27660
27624
  React.createElement(UserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onActionConfirmed, onActionCanceled: onActionCanceled, openModal: openConfirmationModal, errorMsg: "", loading: loading })));
27661
27625
  };
27662
27626