@undp/carbon-library 1.0.284-CARBON-234.12 → 1.0.284-CARBON-406.6

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,7 +26775,21 @@ 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 === "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 === "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: [
26779
26793
  {
26780
26794
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
26781
26795
  var trimValue;
@@ -26882,11 +26896,13 @@ var NdcDetailsComponent = function (props) {
26882
26896
  : undefined;
26883
26897
  var isGovernmentUser = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT &&
26884
26898
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== exports.Role.ViewOnly;
26885
- var isMainNdcActionsEditable = !selectedPeriod.finalized &&
26899
+ var isMainNdcActionsEditable = selectedPeriod &&
26900
+ !selectedPeriod.finalized &&
26886
26901
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT &&
26887
26902
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== exports.Role.ViewOnly;
26888
26903
  var isSubNdcActionsEditable = function (record) {
26889
- return (!selectedPeriod.finalized &&
26904
+ return (selectedPeriod &&
26905
+ !selectedPeriod.finalized &&
26890
26906
  record.status !== NdcDetailsActionStatus.Approved &&
26891
26907
  ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT ||
26892
26908
  ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.MINISTRY &&
@@ -26894,7 +26910,8 @@ var NdcDetailsComponent = function (props) {
26894
26910
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== exports.Role.ViewOnly);
26895
26911
  };
26896
26912
  var checkSubNdcActionCreatePermission = function () {
26897
- return (!selectedPeriod.finalized &&
26913
+ return (selectedPeriod &&
26914
+ !selectedPeriod.finalized &&
26898
26915
  ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT ||
26899
26916
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.MINISTRY) &&
26900
26917
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== exports.Role.ViewOnly);
@@ -26923,6 +26940,7 @@ var NdcDetailsComponent = function (props) {
26923
26940
  actionType: NdcDetailsActionType.SubAction,
26924
26941
  nationalPlanObjective: "",
26925
26942
  kpi: "",
26943
+ kpiUnit: "",
26926
26944
  ministryName: loginMinistry,
26927
26945
  status: NdcDetailsActionStatus.New,
26928
26946
  parentActionId: mainActionId,
@@ -26934,6 +26952,7 @@ var NdcDetailsComponent = function (props) {
26934
26952
  form.setFieldsValue({
26935
26953
  nationalPlanObjective: "",
26936
26954
  kpi: "",
26955
+ kpiUnit: "",
26937
26956
  });
26938
26957
  }
26939
26958
  setSubNdcActionsForPeriod(subNdcDetails);
@@ -26975,6 +26994,7 @@ var NdcDetailsComponent = function (props) {
26975
26994
  return [2 /*return*/];
26976
26995
  }
26977
26996
  else if (updatedFields.kpi === row.kpi &&
26997
+ updatedFields.kpiUnit === row.kpiUnit &&
26978
26998
  updatedFields.nationalPlanObjective === row.nationalPlanObjective) {
26979
26999
  ClearEditMode();
26980
27000
  return [2 /*return*/];
@@ -26988,13 +27008,13 @@ var NdcDetailsComponent = function (props) {
26988
27008
  else {
26989
27009
  updatedItem.status = NdcDetailsActionStatus.Pending;
26990
27010
  }
26991
- return [4 /*yield*/, post("national/programme/addNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi.toString()) }))];
27011
+ return [4 /*yield*/, post("national/programme/addNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseFloat(updatedItem.kpi.toString()) }))];
26992
27012
  case 5:
26993
27013
  _a.sent();
26994
27014
  return [3 /*break*/, 8];
26995
27015
  case 6:
26996
27016
  updatedItem.status = NdcDetailsActionStatus.Pending;
26997
- return [4 /*yield*/, put("national/programme/updateNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi.toString()) }))];
27017
+ return [4 /*yield*/, put("national/programme/updateNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseFloat(updatedItem.kpi.toString()) }))];
26998
27018
  case 7:
26999
27019
  _a.sent();
27000
27020
  _a.label = 8;
@@ -27019,6 +27039,7 @@ var NdcDetailsComponent = function (props) {
27019
27039
  var actionMenu = function (record) {
27020
27040
  if (record.status === NdcDetailsActionStatus.Pending &&
27021
27041
  isGovernmentUser &&
27042
+ selectedPeriod &&
27022
27043
  !selectedPeriod.finalized) {
27023
27044
  return (React.createElement(antd.List, { className: "action-menu", size: "small", dataSource: [
27024
27045
  {
@@ -27078,7 +27099,17 @@ var NdcDetailsComponent = function (props) {
27078
27099
  width: 100,
27079
27100
  editable: true,
27080
27101
  render: function (_, record) { return (React.createElement(antd.Space, { size: "middle" }, record.kpi ? (React.createElement(antd.Tooltip, { title: isNdcActionEditable(record) ? "" : t("ndc:ndcUnauthorisedMsg") },
27081
- React.createElement("span", null, record.kpi))) : (React.createElement(antd.Input, { placeholder: "Enter Kpi" })))); },
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") })))); },
27082
27113
  },
27083
27114
  {
27084
27115
  title: t("ndc:ndcColumnsMinistry"),
@@ -27142,6 +27173,7 @@ var NdcDetailsComponent = function (props) {
27142
27173
  form.setFieldsValue({
27143
27174
  nationalPlanObjective: "",
27144
27175
  kpi: "",
27176
+ kpiUnit: "",
27145
27177
  });
27146
27178
  periodId = parseInt(selectedPeriod.key);
27147
27179
  newData_1 = {
@@ -27149,6 +27181,7 @@ var NdcDetailsComponent = function (props) {
27149
27181
  actionType: NdcDetailsActionType.MainAction,
27150
27182
  nationalPlanObjective: "",
27151
27183
  kpi: "",
27184
+ kpiUnit: "",
27152
27185
  ministryName: loginMinistry,
27153
27186
  periodId: periodId,
27154
27187
  status: NdcDetailsActionStatus.New,
@@ -27287,10 +27320,11 @@ var NdcDetailsComponent = function (props) {
27287
27320
  };
27288
27321
  }, footer: function () {
27289
27322
  return isGovernmentUser &&
27323
+ selectedPeriod &&
27290
27324
  !selectedPeriod.finalized && (React.createElement(antd.Row, { justify: "center" },
27291
27325
  React.createElement(antd.Button, { className: "btnAddNewMainAct", disabled: isMainActionInEditMode(), onClick: onClickedAddNewNdcDetail, type: "default" }, t("ndc:addNdcAction"))));
27292
27326
  } })))),
27293
- isGovernmentUser && !selectedPeriod.finalized ? (React.createElement(antd.Row, { justify: "end" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
27327
+ isGovernmentUser && selectedPeriod && !selectedPeriod.finalized ? (React.createElement(antd.Row, { justify: "end" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
27294
27328
  React.createElement(antd.Button, { className: "mg-left-1", disabled: true }, t("ndc:delete")),
27295
27329
  React.createElement(antd.Button, { className: "mg-left-1", disabled: true }, t("ndc:finalize")))) : (React.createElement(React.Fragment, null,
27296
27330
  React.createElement(antd.Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", loading: loading }, t("ndc:delete")),