@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/cjs/index.js CHANGED
@@ -26285,16 +26285,25 @@ var NdcDetailsComponent = function (props) {
26285
26285
  return num >= min && num <= max;
26286
26286
  };
26287
26287
  var handleSave = function (row) { return __awaiter(void 0, void 0, void 0, function () {
26288
- var updatedFields, updatedItem, exception_1;
26288
+ var updatedFields, updatedItem, exception_2;
26289
26289
  return __generator(this, function (_a) {
26290
26290
  switch (_a.label) {
26291
26291
  case 0:
26292
- _a.trys.push([0, 6, , 7]);
26293
- return [4 /*yield*/, form.validateFields()];
26292
+ _a.trys.push([0, 9, 10, 11]);
26293
+ updatedFields = void 0;
26294
+ _a.label = 1;
26294
26295
  case 1:
26296
+ _a.trys.push([1, 3, , 4]);
26297
+ return [4 /*yield*/, form.validateFields()];
26298
+ case 2:
26295
26299
  updatedFields = (_a.sent());
26300
+ return [3 /*break*/, 4];
26301
+ case 3:
26302
+ _a.sent();
26303
+ return [2 /*return*/];
26304
+ case 4:
26296
26305
  updatedItem = __assign(__assign({}, row), updatedFields);
26297
- if (!(updatedItem.status === NdcDetailsActionStatus.New)) return [3 /*break*/, 3];
26306
+ if (!(updatedItem.status === NdcDetailsActionStatus.New)) return [3 /*break*/, 6];
26298
26307
  if (isGovernmentUser &&
26299
26308
  updatedItem.actionType === NdcDetailsActionType.SubAction) {
26300
26309
  updatedItem.status = NdcDetailsActionStatus.Approved;
@@ -26303,24 +26312,32 @@ var NdcDetailsComponent = function (props) {
26303
26312
  updatedItem.status = NdcDetailsActionStatus.Pending;
26304
26313
  }
26305
26314
  return [4 /*yield*/, post("national/programme/addNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi.toString()) }))];
26306
- case 2:
26315
+ case 5:
26307
26316
  _a.sent();
26308
- return [3 /*break*/, 5];
26309
- case 3:
26317
+ return [3 /*break*/, 8];
26318
+ case 6:
26310
26319
  updatedItem.status = NdcDetailsActionStatus.Pending;
26311
26320
  return [4 /*yield*/, put("national/programme/updateNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi.toString()) }))];
26312
- case 4:
26321
+ case 7:
26313
26322
  _a.sent();
26314
- _a.label = 5;
26315
- case 5:
26323
+ _a.label = 8;
26324
+ case 8:
26316
26325
  fetchNdcDetailActions();
26317
26326
  setEditingKey(-1);
26318
- return [3 /*break*/, 7];
26319
- case 6:
26320
- exception_1 = _a.sent();
26321
- console.log("error", exception_1);
26322
- return [3 /*break*/, 7];
26323
- case 7: return [2 /*return*/];
26327
+ return [3 /*break*/, 11];
26328
+ case 9:
26329
+ exception_2 = _a.sent();
26330
+ antd.message.open({
26331
+ type: "error",
26332
+ content: exception_2.message,
26333
+ duration: 3,
26334
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26335
+ });
26336
+ return [3 /*break*/, 11];
26337
+ case 10:
26338
+ setEditingKey(-1);
26339
+ return [7 /*endfinally*/];
26340
+ case 11: return [2 /*return*/];
26324
26341
  }
26325
26342
  });
26326
26343
  }); };
@@ -26588,10 +26605,11 @@ var NdcDetailsComponent = function (props) {
26588
26605
  }, columns: columns, showHeader: false, pagination: false }));
26589
26606
  }
26590
26607
  var onAddNewPeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
26591
- var periodItem_1, existingIndex, response, addedPeriodItem, updatedPeriodItem_1;
26608
+ var periodItem_1, existingIndex, response, addedPeriodItem, updatedPeriodItem_1, exception_3;
26592
26609
  return __generator(this, function (_a) {
26593
26610
  switch (_a.label) {
26594
26611
  case 0:
26612
+ _a.trys.push([0, 4, , 5]);
26595
26613
  if (!(selectedDateRangeRef && selectedDateRangeRef.current)) return [3 /*break*/, 3];
26596
26614
  periodItem_1 = {
26597
26615
  startYear: selectedDateRangeRef.current.startYear,
@@ -26621,7 +26639,17 @@ var NdcDetailsComponent = function (props) {
26621
26639
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26622
26640
  });
26623
26641
  _a.label = 3;
26624
- case 3: return [2 /*return*/];
26642
+ case 3: return [3 /*break*/, 5];
26643
+ case 4:
26644
+ exception_3 = _a.sent();
26645
+ antd.message.open({
26646
+ type: "error",
26647
+ content: exception_3.message,
26648
+ duration: 3,
26649
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26650
+ });
26651
+ return [3 /*break*/, 5];
26652
+ case 5: return [2 /*return*/];
26625
26653
  }
26626
26654
  });
26627
26655
  }); };
@@ -26639,43 +26667,56 @@ var NdcDetailsComponent = function (props) {
26639
26667
  }
26640
26668
  };
26641
26669
  var onActionConfirmed = function () { return __awaiter(void 0, void 0, void 0, function () {
26642
- var actionResponse;
26670
+ var actionResponse, exception_4;
26643
26671
  return __generator(this, function (_a) {
26644
26672
  switch (_a.label) {
26645
26673
  case 0:
26646
26674
  setLoading(true);
26647
- if (!(actionInfo.action === "Approve")) return [3 /*break*/, 2];
26675
+ _a.label = 1;
26676
+ case 1:
26677
+ _a.trys.push([1, 10, , 11]);
26678
+ if (!(actionInfo.action === "Approve")) return [3 /*break*/, 3];
26648
26679
  return [4 /*yield*/, post("national/programme/approveNdcDetailsAction", {
26649
26680
  id: actionInfo.recordId,
26650
26681
  })];
26651
- case 1:
26652
- actionResponse = _a.sent();
26653
- return [3 /*break*/, 8];
26654
26682
  case 2:
26655
- if (!(actionInfo.action === "Reject")) return [3 /*break*/, 4];
26683
+ actionResponse = _a.sent();
26684
+ return [3 /*break*/, 9];
26685
+ case 3:
26686
+ if (!(actionInfo.action === "Reject")) return [3 /*break*/, 5];
26656
26687
  return [4 /*yield*/, post("national/programme/rejectNdcDetailsAction", {
26657
26688
  id: actionInfo.recordId,
26658
26689
  })];
26659
- case 3:
26660
- actionResponse = _a.sent();
26661
- return [3 /*break*/, 8];
26662
26690
  case 4:
26663
- if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 6];
26691
+ actionResponse = _a.sent();
26692
+ return [3 /*break*/, 9];
26693
+ case 5:
26694
+ if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 7];
26664
26695
  return [4 /*yield*/, post("national/programme/finalizeNdcDetailsPeriod", {
26665
26696
  id: selectedPeriod.key,
26666
26697
  })];
26667
- case 5:
26668
- actionResponse = _a.sent();
26669
- return [3 /*break*/, 8];
26670
26698
  case 6:
26671
- if (!(actionInfo.action === "Delete")) return [3 /*break*/, 8];
26699
+ actionResponse = _a.sent();
26700
+ return [3 /*break*/, 9];
26701
+ case 7:
26702
+ if (!(actionInfo.action === "Delete")) return [3 /*break*/, 9];
26672
26703
  return [4 /*yield*/, post("national/programme/deleteNdcDetailsPeriod", {
26673
26704
  id: selectedPeriod.key,
26674
26705
  })];
26675
- case 7:
26676
- actionResponse = _a.sent();
26677
- _a.label = 8;
26678
26706
  case 8:
26707
+ actionResponse = _a.sent();
26708
+ _a.label = 9;
26709
+ case 9: return [3 /*break*/, 11];
26710
+ case 10:
26711
+ exception_4 = _a.sent();
26712
+ antd.message.open({
26713
+ type: "error",
26714
+ content: exception_4.message,
26715
+ duration: 3,
26716
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26717
+ });
26718
+ return [3 /*break*/, 11];
26719
+ case 11:
26679
26720
  if (actionResponse &&
26680
26721
  (actionInfo.action === "Delete" || actionInfo.action === "Finalize")) {
26681
26722
  fetchNdcDetailPeriods();
@@ -26694,11 +26735,14 @@ var NdcDetailsComponent = function (props) {
26694
26735
  setOpenConfirmationModal(false);
26695
26736
  };
26696
26737
  var fetchNdcDetailPeriods = function () { return __awaiter(void 0, void 0, void 0, function () {
26697
- var periods, addNewTab, response;
26738
+ var periods, addNewTab, response, exception_5;
26698
26739
  return __generator(this, function (_a) {
26699
26740
  switch (_a.label) {
26700
26741
  case 0:
26701
26742
  setLoading(true);
26743
+ _a.label = 1;
26744
+ case 1:
26745
+ _a.trys.push([1, 3, 4, 5]);
26702
26746
  periods = [];
26703
26747
  addNewTab = {
26704
26748
  key: "add_new",
@@ -26709,7 +26753,7 @@ var NdcDetailsComponent = function (props) {
26709
26753
  deleted: false,
26710
26754
  };
26711
26755
  return [4 /*yield*/, get("national/programme/queryNdcDetailsPeriod")];
26712
- case 1:
26756
+ case 2:
26713
26757
  response = _a.sent();
26714
26758
  if (response && response.data) {
26715
26759
  periods = response.data.map(function (period) {
@@ -26733,18 +26777,34 @@ var NdcDetailsComponent = function (props) {
26733
26777
  setSelectedPeriod(periods[0]);
26734
26778
  }
26735
26779
  setLoading(false);
26736
- return [2 /*return*/];
26780
+ return [3 /*break*/, 5];
26781
+ case 3:
26782
+ exception_5 = _a.sent();
26783
+ antd.message.open({
26784
+ type: "error",
26785
+ content: exception_5.message,
26786
+ duration: 3,
26787
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26788
+ });
26789
+ return [3 /*break*/, 5];
26790
+ case 4:
26791
+ setLoading(false);
26792
+ return [7 /*endfinally*/];
26793
+ case 5: return [2 /*return*/];
26737
26794
  }
26738
26795
  });
26739
26796
  }); };
26740
26797
  var fetchNdcDetailActions = function () { return __awaiter(void 0, void 0, void 0, function () {
26741
- var response, maxActionId;
26798
+ var response, maxActionId, exception_6;
26742
26799
  return __generator(this, function (_a) {
26743
26800
  switch (_a.label) {
26744
26801
  case 0:
26745
26802
  setLoading(true);
26746
- return [4 /*yield*/, get("national/programme/queryNdcDetailsAction")];
26803
+ _a.label = 1;
26747
26804
  case 1:
26805
+ _a.trys.push([1, 3, 4, 5]);
26806
+ return [4 /*yield*/, get("national/programme/queryNdcDetailsAction")];
26807
+ case 2:
26748
26808
  response = _a.sent();
26749
26809
  if (response && response.data) {
26750
26810
  maxActionId = Math.max.apply(Math, response.data.map(function (item) { return item.id; }));
@@ -26752,18 +26812,34 @@ var NdcDetailsComponent = function (props) {
26752
26812
  setNdcActionsList(response.data);
26753
26813
  }
26754
26814
  setLoading(false);
26755
- return [2 /*return*/];
26815
+ return [3 /*break*/, 5];
26816
+ case 3:
26817
+ exception_6 = _a.sent();
26818
+ antd.message.open({
26819
+ type: "error",
26820
+ content: exception_6.message,
26821
+ duration: 3,
26822
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26823
+ });
26824
+ return [3 /*break*/, 5];
26825
+ case 4:
26826
+ setLoading(false);
26827
+ return [7 /*endfinally*/];
26828
+ case 5: return [2 /*return*/];
26756
26829
  }
26757
26830
  });
26758
26831
  }); };
26759
26832
  var fetchMinistries = function () { return __awaiter(void 0, void 0, void 0, function () {
26760
- var response, ministryOrgDetails;
26833
+ var response, ministryOrgDetails, exception_7;
26761
26834
  return __generator(this, function (_a) {
26762
26835
  switch (_a.label) {
26763
26836
  case 0:
26764
26837
  setLoading(true);
26765
- return [4 /*yield*/, get("national/organisation/getMinistries")];
26838
+ _a.label = 1;
26766
26839
  case 1:
26840
+ _a.trys.push([1, 3, 4, 5]);
26841
+ return [4 /*yield*/, get("national/organisation/getMinistries")];
26842
+ case 2:
26767
26843
  response = _a.sent();
26768
26844
  if (response && response.data) {
26769
26845
  ministryOrgDetails = response.data.map(function (value) {
@@ -26775,7 +26851,20 @@ var NdcDetailsComponent = function (props) {
26775
26851
  setMinistryOrgList(ministryOrgDetails);
26776
26852
  }
26777
26853
  setLoading(false);
26778
- return [2 /*return*/];
26854
+ return [3 /*break*/, 5];
26855
+ case 3:
26856
+ exception_7 = _a.sent();
26857
+ antd.message.open({
26858
+ type: "error",
26859
+ content: exception_7.message,
26860
+ duration: 3,
26861
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26862
+ });
26863
+ return [3 /*break*/, 5];
26864
+ case 4:
26865
+ setLoading(false);
26866
+ return [7 /*endfinally*/];
26867
+ case 5: return [2 /*return*/];
26779
26868
  }
26780
26869
  });
26781
26870
  }); };