@undp/carbon-library 1.0.175-CARBON-363.57 → 1.0.175-CARBON-363.59

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/index.js CHANGED
@@ -26265,16 +26265,25 @@ var NdcDetailsComponent = function (props) {
26265
26265
  return num >= min && num <= max;
26266
26266
  };
26267
26267
  var handleSave = function (row) { return __awaiter(void 0, void 0, void 0, function () {
26268
- var updatedFields, updatedItem, exception_1;
26268
+ var updatedFields, updatedItem, exception_2;
26269
26269
  return __generator(this, function (_a) {
26270
26270
  switch (_a.label) {
26271
26271
  case 0:
26272
- _a.trys.push([0, 6, , 7]);
26273
- return [4 /*yield*/, form.validateFields()];
26272
+ _a.trys.push([0, 9, 10, 11]);
26273
+ updatedFields = void 0;
26274
+ _a.label = 1;
26274
26275
  case 1:
26276
+ _a.trys.push([1, 3, , 4]);
26277
+ return [4 /*yield*/, form.validateFields()];
26278
+ case 2:
26275
26279
  updatedFields = (_a.sent());
26280
+ return [3 /*break*/, 4];
26281
+ case 3:
26282
+ _a.sent();
26283
+ return [2 /*return*/];
26284
+ case 4:
26276
26285
  updatedItem = __assign(__assign({}, row), updatedFields);
26277
- if (!(updatedItem.status === NdcDetailsActionStatus.New)) return [3 /*break*/, 3];
26286
+ if (!(updatedItem.status === NdcDetailsActionStatus.New)) return [3 /*break*/, 6];
26278
26287
  if (isGovernmentUser &&
26279
26288
  updatedItem.actionType === NdcDetailsActionType.SubAction) {
26280
26289
  updatedItem.status = NdcDetailsActionStatus.Approved;
@@ -26283,24 +26292,32 @@ var NdcDetailsComponent = function (props) {
26283
26292
  updatedItem.status = NdcDetailsActionStatus.Pending;
26284
26293
  }
26285
26294
  return [4 /*yield*/, post("national/programme/addNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi.toString()) }))];
26286
- case 2:
26295
+ case 5:
26287
26296
  _a.sent();
26288
- return [3 /*break*/, 5];
26289
- case 3:
26297
+ return [3 /*break*/, 8];
26298
+ case 6:
26290
26299
  updatedItem.status = NdcDetailsActionStatus.Pending;
26291
26300
  return [4 /*yield*/, put("national/programme/updateNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi.toString()) }))];
26292
- case 4:
26301
+ case 7:
26293
26302
  _a.sent();
26294
- _a.label = 5;
26295
- case 5:
26303
+ _a.label = 8;
26304
+ case 8:
26296
26305
  fetchNdcDetailActions();
26297
26306
  setEditingKey(-1);
26298
- return [3 /*break*/, 7];
26299
- case 6:
26300
- exception_1 = _a.sent();
26301
- console.log("error", exception_1);
26302
- return [3 /*break*/, 7];
26303
- case 7: return [2 /*return*/];
26307
+ return [3 /*break*/, 11];
26308
+ case 9:
26309
+ exception_2 = _a.sent();
26310
+ message.open({
26311
+ type: "error",
26312
+ content: exception_2.message,
26313
+ duration: 3,
26314
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26315
+ });
26316
+ return [3 /*break*/, 11];
26317
+ case 10:
26318
+ setEditingKey(-1);
26319
+ return [7 /*endfinally*/];
26320
+ case 11: return [2 /*return*/];
26304
26321
  }
26305
26322
  });
26306
26323
  }); };
@@ -26568,10 +26585,11 @@ var NdcDetailsComponent = function (props) {
26568
26585
  }, columns: columns, showHeader: false, pagination: false }));
26569
26586
  }
26570
26587
  var onAddNewPeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
26571
- var periodItem_1, existingIndex, response, addedPeriodItem, updatedPeriodItem_1;
26588
+ var periodItem_1, existingIndex, response, addedPeriodItem, updatedPeriodItem_1, exception_3;
26572
26589
  return __generator(this, function (_a) {
26573
26590
  switch (_a.label) {
26574
26591
  case 0:
26592
+ _a.trys.push([0, 4, , 5]);
26575
26593
  if (!(selectedDateRangeRef && selectedDateRangeRef.current)) return [3 /*break*/, 3];
26576
26594
  periodItem_1 = {
26577
26595
  startYear: selectedDateRangeRef.current.startYear,
@@ -26601,7 +26619,17 @@ var NdcDetailsComponent = function (props) {
26601
26619
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26602
26620
  });
26603
26621
  _a.label = 3;
26604
- case 3: return [2 /*return*/];
26622
+ case 3: return [3 /*break*/, 5];
26623
+ case 4:
26624
+ exception_3 = _a.sent();
26625
+ message.open({
26626
+ type: "error",
26627
+ content: exception_3.message,
26628
+ duration: 3,
26629
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26630
+ });
26631
+ return [3 /*break*/, 5];
26632
+ case 5: return [2 /*return*/];
26605
26633
  }
26606
26634
  });
26607
26635
  }); };
@@ -26619,43 +26647,56 @@ var NdcDetailsComponent = function (props) {
26619
26647
  }
26620
26648
  };
26621
26649
  var onActionConfirmed = function () { return __awaiter(void 0, void 0, void 0, function () {
26622
- var actionResponse;
26650
+ var actionResponse, exception_4;
26623
26651
  return __generator(this, function (_a) {
26624
26652
  switch (_a.label) {
26625
26653
  case 0:
26626
26654
  setLoading(true);
26627
- if (!(actionInfo.action === "Approve")) return [3 /*break*/, 2];
26655
+ _a.label = 1;
26656
+ case 1:
26657
+ _a.trys.push([1, 10, , 11]);
26658
+ if (!(actionInfo.action === "Approve")) return [3 /*break*/, 3];
26628
26659
  return [4 /*yield*/, post("national/programme/approveNdcDetailsAction", {
26629
26660
  id: actionInfo.recordId,
26630
26661
  })];
26631
- case 1:
26632
- actionResponse = _a.sent();
26633
- return [3 /*break*/, 8];
26634
26662
  case 2:
26635
- if (!(actionInfo.action === "Reject")) return [3 /*break*/, 4];
26663
+ actionResponse = _a.sent();
26664
+ return [3 /*break*/, 9];
26665
+ case 3:
26666
+ if (!(actionInfo.action === "Reject")) return [3 /*break*/, 5];
26636
26667
  return [4 /*yield*/, post("national/programme/rejectNdcDetailsAction", {
26637
26668
  id: actionInfo.recordId,
26638
26669
  })];
26639
- case 3:
26640
- actionResponse = _a.sent();
26641
- return [3 /*break*/, 8];
26642
26670
  case 4:
26643
- if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 6];
26671
+ actionResponse = _a.sent();
26672
+ return [3 /*break*/, 9];
26673
+ case 5:
26674
+ if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 7];
26644
26675
  return [4 /*yield*/, post("national/programme/finalizeNdcDetailsPeriod", {
26645
26676
  id: selectedPeriod.key,
26646
26677
  })];
26647
- case 5:
26648
- actionResponse = _a.sent();
26649
- return [3 /*break*/, 8];
26650
26678
  case 6:
26651
- if (!(actionInfo.action === "Delete")) return [3 /*break*/, 8];
26679
+ actionResponse = _a.sent();
26680
+ return [3 /*break*/, 9];
26681
+ case 7:
26682
+ if (!(actionInfo.action === "Delete")) return [3 /*break*/, 9];
26652
26683
  return [4 /*yield*/, post("national/programme/deleteNdcDetailsPeriod", {
26653
26684
  id: selectedPeriod.key,
26654
26685
  })];
26655
- case 7:
26656
- actionResponse = _a.sent();
26657
- _a.label = 8;
26658
26686
  case 8:
26687
+ actionResponse = _a.sent();
26688
+ _a.label = 9;
26689
+ case 9: return [3 /*break*/, 11];
26690
+ case 10:
26691
+ exception_4 = _a.sent();
26692
+ message.open({
26693
+ type: "error",
26694
+ content: exception_4.message,
26695
+ duration: 3,
26696
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26697
+ });
26698
+ return [3 /*break*/, 11];
26699
+ case 11:
26659
26700
  if (actionResponse &&
26660
26701
  (actionInfo.action === "Delete" || actionInfo.action === "Finalize")) {
26661
26702
  fetchNdcDetailPeriods();
@@ -26674,11 +26715,14 @@ var NdcDetailsComponent = function (props) {
26674
26715
  setOpenConfirmationModal(false);
26675
26716
  };
26676
26717
  var fetchNdcDetailPeriods = function () { return __awaiter(void 0, void 0, void 0, function () {
26677
- var periods, addNewTab, response;
26718
+ var periods, addNewTab, response, exception_5;
26678
26719
  return __generator(this, function (_a) {
26679
26720
  switch (_a.label) {
26680
26721
  case 0:
26681
26722
  setLoading(true);
26723
+ _a.label = 1;
26724
+ case 1:
26725
+ _a.trys.push([1, 3, 4, 5]);
26682
26726
  periods = [];
26683
26727
  addNewTab = {
26684
26728
  key: "add_new",
@@ -26689,7 +26733,7 @@ var NdcDetailsComponent = function (props) {
26689
26733
  deleted: false,
26690
26734
  };
26691
26735
  return [4 /*yield*/, get("national/programme/queryNdcDetailsPeriod")];
26692
- case 1:
26736
+ case 2:
26693
26737
  response = _a.sent();
26694
26738
  if (response && response.data) {
26695
26739
  periods = response.data.map(function (period) {
@@ -26713,18 +26757,34 @@ var NdcDetailsComponent = function (props) {
26713
26757
  setSelectedPeriod(periods[0]);
26714
26758
  }
26715
26759
  setLoading(false);
26716
- return [2 /*return*/];
26760
+ return [3 /*break*/, 5];
26761
+ case 3:
26762
+ exception_5 = _a.sent();
26763
+ message.open({
26764
+ type: "error",
26765
+ content: exception_5.message,
26766
+ duration: 3,
26767
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26768
+ });
26769
+ return [3 /*break*/, 5];
26770
+ case 4:
26771
+ setLoading(false);
26772
+ return [7 /*endfinally*/];
26773
+ case 5: return [2 /*return*/];
26717
26774
  }
26718
26775
  });
26719
26776
  }); };
26720
26777
  var fetchNdcDetailActions = function () { return __awaiter(void 0, void 0, void 0, function () {
26721
- var response, maxActionId;
26778
+ var response, maxActionId, exception_6;
26722
26779
  return __generator(this, function (_a) {
26723
26780
  switch (_a.label) {
26724
26781
  case 0:
26725
26782
  setLoading(true);
26726
- return [4 /*yield*/, get("national/programme/queryNdcDetailsAction")];
26783
+ _a.label = 1;
26727
26784
  case 1:
26785
+ _a.trys.push([1, 3, 4, 5]);
26786
+ return [4 /*yield*/, get("national/programme/queryNdcDetailsAction")];
26787
+ case 2:
26728
26788
  response = _a.sent();
26729
26789
  if (response && response.data) {
26730
26790
  maxActionId = Math.max.apply(Math, response.data.map(function (item) { return item.id; }));
@@ -26732,18 +26792,34 @@ var NdcDetailsComponent = function (props) {
26732
26792
  setNdcActionsList(response.data);
26733
26793
  }
26734
26794
  setLoading(false);
26735
- return [2 /*return*/];
26795
+ return [3 /*break*/, 5];
26796
+ case 3:
26797
+ exception_6 = _a.sent();
26798
+ message.open({
26799
+ type: "error",
26800
+ content: exception_6.message,
26801
+ duration: 3,
26802
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26803
+ });
26804
+ return [3 /*break*/, 5];
26805
+ case 4:
26806
+ setLoading(false);
26807
+ return [7 /*endfinally*/];
26808
+ case 5: return [2 /*return*/];
26736
26809
  }
26737
26810
  });
26738
26811
  }); };
26739
26812
  var fetchMinistries = function () { return __awaiter(void 0, void 0, void 0, function () {
26740
- var response, ministryOrgDetails;
26813
+ var response, ministryOrgDetails, exception_7;
26741
26814
  return __generator(this, function (_a) {
26742
26815
  switch (_a.label) {
26743
26816
  case 0:
26744
26817
  setLoading(true);
26745
- return [4 /*yield*/, get("national/organisation/getMinistries")];
26818
+ _a.label = 1;
26746
26819
  case 1:
26820
+ _a.trys.push([1, 3, 4, 5]);
26821
+ return [4 /*yield*/, get("national/organisation/getMinistries")];
26822
+ case 2:
26747
26823
  response = _a.sent();
26748
26824
  if (response && response.data) {
26749
26825
  ministryOrgDetails = response.data.map(function (value) {
@@ -26755,7 +26831,20 @@ var NdcDetailsComponent = function (props) {
26755
26831
  setMinistryOrgList(ministryOrgDetails);
26756
26832
  }
26757
26833
  setLoading(false);
26758
- return [2 /*return*/];
26834
+ return [3 /*break*/, 5];
26835
+ case 3:
26836
+ exception_7 = _a.sent();
26837
+ message.open({
26838
+ type: "error",
26839
+ content: exception_7.message,
26840
+ duration: 3,
26841
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26842
+ });
26843
+ return [3 /*break*/, 5];
26844
+ case 4:
26845
+ setLoading(false);
26846
+ return [7 /*endfinally*/];
26847
+ case 5: return [2 /*return*/];
26759
26848
  }
26760
26849
  });
26761
26850
  }); };