@undp/carbon-library 1.0.302-CARBON-369.0 → 1.0.302-CARBON-423.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/index.js CHANGED
@@ -27858,7 +27858,7 @@ var EditableCell = function (_a) {
27858
27858
  React.createElement(Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:kpiPlaceHolder") }))) : (children)));
27859
27859
  };
27860
27860
 
27861
- 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";
27861
+ 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";
27862
27862
  styleInject(css_248z$7);
27863
27863
 
27864
27864
  var NdcDetailsActionType;
@@ -28294,7 +28294,7 @@ var NdcDetailsComponent = function (props) {
28294
28294
  }
28295
28295
  else {
28296
28296
  setActionInfo({
28297
- action: "Finalize",
28297
+ action: "Finalise",
28298
28298
  headerText: t("ndc:finalizeApproveTitle"),
28299
28299
  text: t("ndc:finalizeApproveSubTitle"),
28300
28300
  type: "primary",
@@ -28365,7 +28365,7 @@ var NdcDetailsComponent = function (props) {
28365
28365
  !selectedPeriod.finalized && (React.createElement(Row, { justify: "center" },
28366
28366
  React.createElement(Button, { className: "btnAddNewMainAct", disabled: isMainActionInEditMode(), onClick: onClickedAddNewNdcDetail, type: "default" }, t("ndc:addNdcAction"))));
28367
28367
  } })))),
28368
- isGovernmentUser && selectedPeriod && !selectedPeriod.finalized ? (React.createElement(Row, { justify: "end" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
28368
+ isGovernmentUser && selectedPeriod && !selectedPeriod.finalized ? (React.createElement(Row, { justify: "end", className: "ndc-button-row" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
28369
28369
  React.createElement(Button, { className: "mg-left-1", disabled: true }, t("ndc:delete")),
28370
28370
  React.createElement(Button, { className: "mg-left-1", disabled: true }, t("ndc:finalize")))) : (React.createElement(React.Fragment, null,
28371
28371
  React.createElement(Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", loading: loading }, t("ndc:delete")),
@@ -28395,11 +28395,21 @@ var NdcDetailsComponent = function (props) {
28395
28395
  return __generator(this, function (_a) {
28396
28396
  switch (_a.label) {
28397
28397
  case 0:
28398
- _a.trys.push([0, 4, , 5]);
28399
- if (!(selectedDateRangeRef &&
28400
- selectedDateRangeRef.current &&
28401
- selectedDateRangeRef.current.startYear &&
28402
- selectedDateRangeRef.current.endYear)) return [3 /*break*/, 3];
28398
+ if (!selectedDateRangeRef ||
28399
+ !selectedDateRangeRef.current ||
28400
+ !selectedDateRangeRef.current.startYear ||
28401
+ !selectedDateRangeRef.current.endYear) {
28402
+ message.open({
28403
+ type: "error",
28404
+ content: t("ndc:invalidYearsSelected"),
28405
+ duration: 3,
28406
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
28407
+ });
28408
+ return [2 /*return*/];
28409
+ }
28410
+ _a.label = 1;
28411
+ case 1:
28412
+ _a.trys.push([1, 5, , 6]);
28403
28413
  periodItem_1 = {
28404
28414
  startYear: selectedDateRangeRef.current.startYear,
28405
28415
  endYear: selectedDateRangeRef.current.endYear,
@@ -28409,27 +28419,28 @@ var NdcDetailsComponent = function (props) {
28409
28419
  return inRange(periodItem_1.startYear, item.startYear, item.endYear) ||
28410
28420
  inRange(periodItem_1.endYear, item.startYear, item.endYear);
28411
28421
  });
28412
- if (!(existingIndex === -1)) return [3 /*break*/, 2];
28422
+ if (!(existingIndex === -1)) return [3 /*break*/, 3];
28413
28423
  return [4 /*yield*/, post("national/programme/addNdcDetailsPeriod", __assign({}, periodItem_1))];
28414
- case 1:
28424
+ case 2:
28415
28425
  response = _a.sent();
28416
28426
  if (response && response.data) {
28417
28427
  addedPeriodItem = response.data;
28418
28428
  updatedPeriodItem_1 = __assign(__assign({}, addedPeriodItem), { key: addedPeriodItem.id, label: "".concat(addedPeriodItem.startYear, "-").concat(addedPeriodItem.endYear) });
28419
28429
  setPeriodItems(function (items) { return __spreadArray(__spreadArray([], items, true), [updatedPeriodItem_1], false); });
28420
28430
  setSelectedPeriod(updatedPeriodItem_1);
28431
+ selectedDateRangeRef.current = null;
28421
28432
  }
28422
- return [3 /*break*/, 3];
28423
- case 2:
28433
+ return [3 /*break*/, 4];
28434
+ case 3:
28424
28435
  message.open({
28425
28436
  type: "error",
28426
28437
  content: t("ndc:rangeAlreadyExists"),
28427
28438
  duration: 3,
28428
28439
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
28429
28440
  });
28430
- _a.label = 3;
28431
- case 3: return [3 /*break*/, 5];
28432
- case 4:
28441
+ _a.label = 4;
28442
+ case 4: return [3 /*break*/, 6];
28443
+ case 5:
28433
28444
  exception_3 = _a.sent();
28434
28445
  message.open({
28435
28446
  type: "error",
@@ -28437,8 +28448,8 @@ var NdcDetailsComponent = function (props) {
28437
28448
  duration: 3,
28438
28449
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
28439
28450
  });
28440
- return [3 /*break*/, 5];
28441
- case 5: return [2 /*return*/];
28451
+ return [3 /*break*/, 6];
28452
+ case 6: return [2 /*return*/];
28442
28453
  }
28443
28454
  });
28444
28455
  }); };
@@ -28460,6 +28471,12 @@ var NdcDetailsComponent = function (props) {
28460
28471
  selectedDateRangeRef.current = period;
28461
28472
  }
28462
28473
  }
28474
+ else {
28475
+ selectedDateRangeRef.current = {
28476
+ startYear: range,
28477
+ endYear: range,
28478
+ };
28479
+ }
28463
28480
  };
28464
28481
  var onTabChange = function (key) {
28465
28482
  var selectedPeriod = periodItems.find(function (item) { return item.key === key; });
@@ -28492,7 +28509,7 @@ var NdcDetailsComponent = function (props) {
28492
28509
  actionResponse = _a.sent();
28493
28510
  return [3 /*break*/, 9];
28494
28511
  case 5:
28495
- if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 7];
28512
+ if (!(actionInfo.action === "Finalise")) return [3 /*break*/, 7];
28496
28513
  return [4 /*yield*/, post("national/programme/finalizeNdcDetailsPeriod", {
28497
28514
  id: selectedPeriod.key,
28498
28515
  })];
@@ -28528,7 +28545,7 @@ var NdcDetailsComponent = function (props) {
28528
28545
  });
28529
28546
  fetchNdcDetailPeriods();
28530
28547
  }
28531
- else if (actionInfo.action === "Finalize") {
28548
+ else if (actionInfo.action === "Finalise") {
28532
28549
  message.open({
28533
28550
  type: "success",
28534
28551
  content: t("ndc:finalizeSuccessMsg"),