@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/cjs/index.js CHANGED
@@ -27879,7 +27879,7 @@ var EditableCell = function (_a) {
27879
27879
  React.createElement(antd.Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:kpiPlaceHolder") }))) : (children)));
27880
27880
  };
27881
27881
 
27882
- 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";
27882
+ 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";
27883
27883
  styleInject(css_248z$7);
27884
27884
 
27885
27885
  var NdcDetailsActionType;
@@ -28315,7 +28315,7 @@ var NdcDetailsComponent = function (props) {
28315
28315
  }
28316
28316
  else {
28317
28317
  setActionInfo({
28318
- action: "Finalize",
28318
+ action: "Finalise",
28319
28319
  headerText: t("ndc:finalizeApproveTitle"),
28320
28320
  text: t("ndc:finalizeApproveSubTitle"),
28321
28321
  type: "primary",
@@ -28386,7 +28386,7 @@ var NdcDetailsComponent = function (props) {
28386
28386
  !selectedPeriod.finalized && (React.createElement(antd.Row, { justify: "center" },
28387
28387
  React.createElement(antd.Button, { className: "btnAddNewMainAct", disabled: isMainActionInEditMode(), onClick: onClickedAddNewNdcDetail, type: "default" }, t("ndc:addNdcAction"))));
28388
28388
  } })))),
28389
- isGovernmentUser && selectedPeriod && !selectedPeriod.finalized ? (React.createElement(antd.Row, { justify: "end" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
28389
+ isGovernmentUser && selectedPeriod && !selectedPeriod.finalized ? (React.createElement(antd.Row, { justify: "end", className: "ndc-button-row" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
28390
28390
  React.createElement(antd.Button, { className: "mg-left-1", disabled: true }, t("ndc:delete")),
28391
28391
  React.createElement(antd.Button, { className: "mg-left-1", disabled: true }, t("ndc:finalize")))) : (React.createElement(React.Fragment, null,
28392
28392
  React.createElement(antd.Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", loading: loading }, t("ndc:delete")),
@@ -28416,11 +28416,21 @@ var NdcDetailsComponent = function (props) {
28416
28416
  return __generator(this, function (_a) {
28417
28417
  switch (_a.label) {
28418
28418
  case 0:
28419
- _a.trys.push([0, 4, , 5]);
28420
- if (!(selectedDateRangeRef &&
28421
- selectedDateRangeRef.current &&
28422
- selectedDateRangeRef.current.startYear &&
28423
- selectedDateRangeRef.current.endYear)) return [3 /*break*/, 3];
28419
+ if (!selectedDateRangeRef ||
28420
+ !selectedDateRangeRef.current ||
28421
+ !selectedDateRangeRef.current.startYear ||
28422
+ !selectedDateRangeRef.current.endYear) {
28423
+ antd.message.open({
28424
+ type: "error",
28425
+ content: t("ndc:invalidYearsSelected"),
28426
+ duration: 3,
28427
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
28428
+ });
28429
+ return [2 /*return*/];
28430
+ }
28431
+ _a.label = 1;
28432
+ case 1:
28433
+ _a.trys.push([1, 5, , 6]);
28424
28434
  periodItem_1 = {
28425
28435
  startYear: selectedDateRangeRef.current.startYear,
28426
28436
  endYear: selectedDateRangeRef.current.endYear,
@@ -28430,27 +28440,28 @@ var NdcDetailsComponent = function (props) {
28430
28440
  return inRange(periodItem_1.startYear, item.startYear, item.endYear) ||
28431
28441
  inRange(periodItem_1.endYear, item.startYear, item.endYear);
28432
28442
  });
28433
- if (!(existingIndex === -1)) return [3 /*break*/, 2];
28443
+ if (!(existingIndex === -1)) return [3 /*break*/, 3];
28434
28444
  return [4 /*yield*/, post("national/programme/addNdcDetailsPeriod", __assign({}, periodItem_1))];
28435
- case 1:
28445
+ case 2:
28436
28446
  response = _a.sent();
28437
28447
  if (response && response.data) {
28438
28448
  addedPeriodItem = response.data;
28439
28449
  updatedPeriodItem_1 = __assign(__assign({}, addedPeriodItem), { key: addedPeriodItem.id, label: "".concat(addedPeriodItem.startYear, "-").concat(addedPeriodItem.endYear) });
28440
28450
  setPeriodItems(function (items) { return __spreadArray(__spreadArray([], items, true), [updatedPeriodItem_1], false); });
28441
28451
  setSelectedPeriod(updatedPeriodItem_1);
28452
+ selectedDateRangeRef.current = null;
28442
28453
  }
28443
- return [3 /*break*/, 3];
28444
- case 2:
28454
+ return [3 /*break*/, 4];
28455
+ case 3:
28445
28456
  antd.message.open({
28446
28457
  type: "error",
28447
28458
  content: t("ndc:rangeAlreadyExists"),
28448
28459
  duration: 3,
28449
28460
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
28450
28461
  });
28451
- _a.label = 3;
28452
- case 3: return [3 /*break*/, 5];
28453
- case 4:
28462
+ _a.label = 4;
28463
+ case 4: return [3 /*break*/, 6];
28464
+ case 5:
28454
28465
  exception_3 = _a.sent();
28455
28466
  antd.message.open({
28456
28467
  type: "error",
@@ -28458,8 +28469,8 @@ var NdcDetailsComponent = function (props) {
28458
28469
  duration: 3,
28459
28470
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
28460
28471
  });
28461
- return [3 /*break*/, 5];
28462
- case 5: return [2 /*return*/];
28472
+ return [3 /*break*/, 6];
28473
+ case 6: return [2 /*return*/];
28463
28474
  }
28464
28475
  });
28465
28476
  }); };
@@ -28481,6 +28492,12 @@ var NdcDetailsComponent = function (props) {
28481
28492
  selectedDateRangeRef.current = period;
28482
28493
  }
28483
28494
  }
28495
+ else {
28496
+ selectedDateRangeRef.current = {
28497
+ startYear: range,
28498
+ endYear: range,
28499
+ };
28500
+ }
28484
28501
  };
28485
28502
  var onTabChange = function (key) {
28486
28503
  var selectedPeriod = periodItems.find(function (item) { return item.key === key; });
@@ -28513,7 +28530,7 @@ var NdcDetailsComponent = function (props) {
28513
28530
  actionResponse = _a.sent();
28514
28531
  return [3 /*break*/, 9];
28515
28532
  case 5:
28516
- if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 7];
28533
+ if (!(actionInfo.action === "Finalise")) return [3 /*break*/, 7];
28517
28534
  return [4 /*yield*/, post("national/programme/finalizeNdcDetailsPeriod", {
28518
28535
  id: selectedPeriod.key,
28519
28536
  })];
@@ -28549,7 +28566,7 @@ var NdcDetailsComponent = function (props) {
28549
28566
  });
28550
28567
  fetchNdcDetailPeriods();
28551
28568
  }
28552
- else if (actionInfo.action === "Finalize") {
28569
+ else if (actionInfo.action === "Finalise") {
28553
28570
  antd.message.open({
28554
28571
  type: "success",
28555
28572
  content: t("ndc:finalizeSuccessMsg"),