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

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