@undp/carbon-library 1.0.292-CARBON-369.2 → 1.0.292-CARBON-423.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/index.js CHANGED
@@ -27607,7 +27607,7 @@ var EditableCell = function (_a) {
27607
27607
  React.createElement(Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:kpiPlaceHolder") }))) : (children)));
27608
27608
  };
27609
27609
 
27610
- var css_248z$7 = ".ndc-steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n justify-content: center; }\n .ndc-steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .ndc-steps-actions .back-btn {\n border: 1px solid rgba(140, 140, 140, 0.7);\n color: rgba(140, 140, 140, 0.7);\n margin-right: 1rem; }\n .ndc-steps-actions .mg-left-1 {\n margin-left: 1rem; }\n\n.ndc-details .ant-input-number-input-wrap {\n margin-right: 10px; }\n\n.ndc-details tbody {\n vertical-align: top; }\n\n.ndc-details td .ant-space-item {\n margin-top: 5px; }\n\n.ndc-details .btn-danger {\n color: #ff4d4f !important;\n border-color: #ff8183 !important; }\n";
27610
+ var css_248z$7 = ".ndc-steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n justify-content: center; }\n .ndc-steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .ndc-steps-actions .back-btn {\n border: 1px solid rgba(140, 140, 140, 0.7);\n color: rgba(140, 140, 140, 0.7);\n margin-right: 1rem; }\n .ndc-steps-actions .mg-left-1 {\n margin-left: 1rem; }\n\n.ndc-details .ant-input-number-input-wrap {\n margin-right: 10px; }\n\n.ndc-details tbody {\n vertical-align: top; }\n\n.ndc-details td .ant-space-item {\n margin-top: 5px; }\n\n.ndc-details .ant-table-pagination.ant-pagination {\n margin-top: 16px;\n margin-right: 0px;\n margin-left: 24px;\n margin-bottom: 0px; }\n\n.ndc-details .ndc-button-row {\n margin-top: 16px; }\n\n.ndc-details .btn-danger {\n color: #ff4d4f !important;\n border-color: #ff8183 !important; }\n";
27611
27611
  styleInject(css_248z$7);
27612
27612
 
27613
27613
  var NdcDetailsActionType;
@@ -28043,7 +28043,7 @@ var NdcDetailsComponent = function (props) {
28043
28043
  }
28044
28044
  else {
28045
28045
  setActionInfo({
28046
- action: "Finalize",
28046
+ action: "Finalise",
28047
28047
  headerText: t("ndc:finalizeApproveTitle"),
28048
28048
  text: t("ndc:finalizeApproveSubTitle"),
28049
28049
  type: "primary",
@@ -28114,7 +28114,7 @@ var NdcDetailsComponent = function (props) {
28114
28114
  !selectedPeriod.finalized && (React.createElement(Row, { justify: "center" },
28115
28115
  React.createElement(Button, { className: "btnAddNewMainAct", disabled: isMainActionInEditMode(), onClick: onClickedAddNewNdcDetail, type: "default" }, t("ndc:addNdcAction"))));
28116
28116
  } })))),
28117
- isGovernmentUser && selectedPeriod && !selectedPeriod.finalized ? (React.createElement(Row, { justify: "end" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
28117
+ isGovernmentUser && selectedPeriod && !selectedPeriod.finalized ? (React.createElement(Row, { justify: "end", className: "ndc-button-row" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
28118
28118
  React.createElement(Button, { className: "mg-left-1", disabled: true }, t("ndc:delete")),
28119
28119
  React.createElement(Button, { className: "mg-left-1", disabled: true }, t("ndc:finalize")))) : (React.createElement(React.Fragment, null,
28120
28120
  React.createElement(Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", loading: loading }, t("ndc:delete")),
@@ -28144,11 +28144,21 @@ var NdcDetailsComponent = function (props) {
28144
28144
  return __generator(this, function (_a) {
28145
28145
  switch (_a.label) {
28146
28146
  case 0:
28147
- _a.trys.push([0, 4, , 5]);
28148
- if (!(selectedDateRangeRef &&
28149
- selectedDateRangeRef.current &&
28150
- selectedDateRangeRef.current.startYear &&
28151
- selectedDateRangeRef.current.endYear)) return [3 /*break*/, 3];
28147
+ if (!selectedDateRangeRef ||
28148
+ !selectedDateRangeRef.current ||
28149
+ !selectedDateRangeRef.current.startYear ||
28150
+ !selectedDateRangeRef.current.endYear) {
28151
+ message.open({
28152
+ type: "error",
28153
+ content: t("ndc:invalidYearsSelected"),
28154
+ duration: 3,
28155
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
28156
+ });
28157
+ return [2 /*return*/];
28158
+ }
28159
+ _a.label = 1;
28160
+ case 1:
28161
+ _a.trys.push([1, 5, , 6]);
28152
28162
  periodItem_1 = {
28153
28163
  startYear: selectedDateRangeRef.current.startYear,
28154
28164
  endYear: selectedDateRangeRef.current.endYear,
@@ -28158,27 +28168,28 @@ var NdcDetailsComponent = function (props) {
28158
28168
  return inRange(periodItem_1.startYear, item.startYear, item.endYear) ||
28159
28169
  inRange(periodItem_1.endYear, item.startYear, item.endYear);
28160
28170
  });
28161
- if (!(existingIndex === -1)) return [3 /*break*/, 2];
28171
+ if (!(existingIndex === -1)) return [3 /*break*/, 3];
28162
28172
  return [4 /*yield*/, post("national/programme/addNdcDetailsPeriod", __assign({}, periodItem_1))];
28163
- case 1:
28173
+ case 2:
28164
28174
  response = _a.sent();
28165
28175
  if (response && response.data) {
28166
28176
  addedPeriodItem = response.data;
28167
28177
  updatedPeriodItem_1 = __assign(__assign({}, addedPeriodItem), { key: addedPeriodItem.id, label: "".concat(addedPeriodItem.startYear, "-").concat(addedPeriodItem.endYear) });
28168
28178
  setPeriodItems(function (items) { return __spreadArray(__spreadArray([], items, true), [updatedPeriodItem_1], false); });
28169
28179
  setSelectedPeriod(updatedPeriodItem_1);
28180
+ selectedDateRangeRef.current = null;
28170
28181
  }
28171
- return [3 /*break*/, 3];
28172
- case 2:
28182
+ return [3 /*break*/, 4];
28183
+ case 3:
28173
28184
  message.open({
28174
28185
  type: "error",
28175
28186
  content: t("ndc:rangeAlreadyExists"),
28176
28187
  duration: 3,
28177
28188
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
28178
28189
  });
28179
- _a.label = 3;
28180
- case 3: return [3 /*break*/, 5];
28181
- case 4:
28190
+ _a.label = 4;
28191
+ case 4: return [3 /*break*/, 6];
28192
+ case 5:
28182
28193
  exception_3 = _a.sent();
28183
28194
  message.open({
28184
28195
  type: "error",
@@ -28186,8 +28197,8 @@ var NdcDetailsComponent = function (props) {
28186
28197
  duration: 3,
28187
28198
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
28188
28199
  });
28189
- return [3 /*break*/, 5];
28190
- case 5: return [2 /*return*/];
28200
+ return [3 /*break*/, 6];
28201
+ case 6: return [2 /*return*/];
28191
28202
  }
28192
28203
  });
28193
28204
  }); };
@@ -28209,6 +28220,12 @@ var NdcDetailsComponent = function (props) {
28209
28220
  selectedDateRangeRef.current = period;
28210
28221
  }
28211
28222
  }
28223
+ else {
28224
+ selectedDateRangeRef.current = {
28225
+ startYear: range,
28226
+ endYear: range,
28227
+ };
28228
+ }
28212
28229
  };
28213
28230
  var onTabChange = function (key) {
28214
28231
  var selectedPeriod = periodItems.find(function (item) { return item.key === key; });
@@ -28241,7 +28258,7 @@ var NdcDetailsComponent = function (props) {
28241
28258
  actionResponse = _a.sent();
28242
28259
  return [3 /*break*/, 9];
28243
28260
  case 5:
28244
- if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 7];
28261
+ if (!(actionInfo.action === "Finalise")) return [3 /*break*/, 7];
28245
28262
  return [4 /*yield*/, post("national/programme/finalizeNdcDetailsPeriod", {
28246
28263
  id: selectedPeriod.key,
28247
28264
  })];
@@ -28277,7 +28294,7 @@ var NdcDetailsComponent = function (props) {
28277
28294
  });
28278
28295
  fetchNdcDetailPeriods();
28279
28296
  }
28280
- else if (actionInfo.action === "Finalize") {
28297
+ else if (actionInfo.action === "Finalise") {
28281
28298
  message.open({
28282
28299
  type: "success",
28283
28300
  content: t("ndc:finalizeSuccessMsg"),