@undp/carbon-library 1.0.175-CARBON-363.58 → 1.0.175-CARBON-363.72

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/index.js CHANGED
@@ -26141,7 +26141,7 @@ var EditableCell = function (_a) {
26141
26141
  ] }, inputNode)) : (children)));
26142
26142
  };
26143
26143
 
26144
- var css_248z$4 = ".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-table-expanded-row .ant-table-cell {\n padding-left: 33px; }\n\n.ndc-details .ant-input-number-input-wrap {\n margin-right: 10px; }\n";
26144
+ var css_248z$4 = ".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";
26145
26145
  styleInject(css_248z$4);
26146
26146
 
26147
26147
  var NdcDetailsActionType;
@@ -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]);
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,30 @@ 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*/, 10];
26308
+ case 9:
26309
+ exception_2 = _a.sent();
26310
+ setEditingKey(-1);
26311
+ message.open({
26312
+ type: "error",
26313
+ content: exception_2.message,
26314
+ duration: 3,
26315
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26316
+ });
26317
+ return [3 /*break*/, 10];
26318
+ case 10: return [2 /*return*/];
26304
26319
  }
26305
26320
  });
26306
26321
  }); };
@@ -26351,7 +26366,7 @@ var NdcDetailsComponent = function (props) {
26351
26366
  dataIndex: "nationalPlanObjective",
26352
26367
  key: "nationalPlanObjective",
26353
26368
  align: "left",
26354
- width: 300,
26369
+ width: 400,
26355
26370
  editable: true,
26356
26371
  render: function (_, record) { return (React.createElement(Space, { size: "middle" }, record.nationalPlanObjective ? (React.createElement("span", null, record.nationalPlanObjective)) : (React.createElement(Input, { placeholder: "Enter National Plan Objective" })))); },
26357
26372
  },
@@ -26369,10 +26384,10 @@ var NdcDetailsComponent = function (props) {
26369
26384
  dataIndex: "ministryName",
26370
26385
  key: "ministryName",
26371
26386
  align: "left",
26372
- width: 200,
26387
+ width: 300,
26373
26388
  editable: false,
26374
26389
  render: function (_, record) { return (React.createElement(React.Fragment, null,
26375
- React.createElement(Select, { disabled: !(isSubNdcActionsEditable(record) && isEditing(record)), defaultValue: record.ministryName ? record.ministryName : loginMinistry, style: { width: 320 }, onChange: function (value, option) {
26390
+ React.createElement(Select, { disabled: !(isSubNdcActionsEditable(record) && isEditing(record)), defaultValue: record.ministryName ? record.ministryName : loginMinistry, style: { width: 220 }, onChange: function (value, option) {
26376
26391
  record.ministryName = option.label;
26377
26392
  handleSave(record);
26378
26393
  }, options: ministryOrgList }))); },
@@ -26382,7 +26397,7 @@ var NdcDetailsComponent = function (props) {
26382
26397
  dataIndex: "status",
26383
26398
  key: "status",
26384
26399
  align: "left",
26385
- width: "15%",
26400
+ width: 200,
26386
26401
  editable: false,
26387
26402
  render: function (_, record) {
26388
26403
  var menu = actionMenu(record);
@@ -26514,12 +26529,11 @@ var NdcDetailsComponent = function (props) {
26514
26529
  React.createElement(Row, null,
26515
26530
  React.createElement(Col, { span: 24 },
26516
26531
  React.createElement(Form, { form: form, component: false },
26517
- React.createElement(Table, { key: tableKey, rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, loading: loading, dataSource: ndcMainDetailsForPeriod, columns: columns, expandedRowKeys: expandedRowKeys, onExpand: onMainTableRowExpand, expandable: {
26532
+ React.createElement(Table, { tableLayout: "fixed", key: tableKey, rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, loading: loading, dataSource: ndcMainDetailsForPeriod, columns: columns, expandedRowKeys: expandedRowKeys, onExpand: onMainTableRowExpand, expandable: {
26518
26533
  expandedRowRender: function (record) {
26519
26534
  return subNdcActionTableContent();
26520
26535
  },
26521
- indentSize: 30,
26522
- columnWidth: 30,
26536
+ columnWidth: 40
26523
26537
  }, onRow: function (record, rowIndex) {
26524
26538
  return {
26525
26539
  onClick: function (event) {
@@ -26549,7 +26563,7 @@ var NdcDetailsComponent = function (props) {
26549
26563
  React.createElement(Button, { className: "mg-left-1", type: "primary", onClick: onClickedFinalizePeriod, htmlType: "submit", loading: loading }, t("ndc:finalize")))) : ("")));
26550
26564
  }
26551
26565
  function subNdcActionTableContent(record) {
26552
- return (React.createElement(Table, { rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: subNdcActionsForPeriod, loading: loading, onRow: function (record, rowIndex) {
26566
+ return (React.createElement(Table, { tableLayout: "fixed", rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: subNdcActionsForPeriod, loading: loading, onRow: function (record, rowIndex) {
26553
26567
  return {
26554
26568
  onClick: function (event) {
26555
26569
  if (record.id &&
@@ -26568,10 +26582,11 @@ var NdcDetailsComponent = function (props) {
26568
26582
  }, columns: columns, showHeader: false, pagination: false }));
26569
26583
  }
26570
26584
  var onAddNewPeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
26571
- var periodItem_1, existingIndex, response, addedPeriodItem, updatedPeriodItem_1;
26585
+ var periodItem_1, existingIndex, response, addedPeriodItem, updatedPeriodItem_1, exception_3;
26572
26586
  return __generator(this, function (_a) {
26573
26587
  switch (_a.label) {
26574
26588
  case 0:
26589
+ _a.trys.push([0, 4, , 5]);
26575
26590
  if (!(selectedDateRangeRef && selectedDateRangeRef.current)) return [3 /*break*/, 3];
26576
26591
  periodItem_1 = {
26577
26592
  startYear: selectedDateRangeRef.current.startYear,
@@ -26601,7 +26616,17 @@ var NdcDetailsComponent = function (props) {
26601
26616
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26602
26617
  });
26603
26618
  _a.label = 3;
26604
- case 3: return [2 /*return*/];
26619
+ case 3: return [3 /*break*/, 5];
26620
+ case 4:
26621
+ exception_3 = _a.sent();
26622
+ message.open({
26623
+ type: "error",
26624
+ content: exception_3.message,
26625
+ duration: 3,
26626
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26627
+ });
26628
+ return [3 /*break*/, 5];
26629
+ case 5: return [2 /*return*/];
26605
26630
  }
26606
26631
  });
26607
26632
  }); };
@@ -26619,43 +26644,56 @@ var NdcDetailsComponent = function (props) {
26619
26644
  }
26620
26645
  };
26621
26646
  var onActionConfirmed = function () { return __awaiter(void 0, void 0, void 0, function () {
26622
- var actionResponse;
26647
+ var actionResponse, exception_4;
26623
26648
  return __generator(this, function (_a) {
26624
26649
  switch (_a.label) {
26625
26650
  case 0:
26626
26651
  setLoading(true);
26627
- if (!(actionInfo.action === "Approve")) return [3 /*break*/, 2];
26652
+ _a.label = 1;
26653
+ case 1:
26654
+ _a.trys.push([1, 10, , 11]);
26655
+ if (!(actionInfo.action === "Approve")) return [3 /*break*/, 3];
26628
26656
  return [4 /*yield*/, post("national/programme/approveNdcDetailsAction", {
26629
26657
  id: actionInfo.recordId,
26630
26658
  })];
26631
- case 1:
26632
- actionResponse = _a.sent();
26633
- return [3 /*break*/, 8];
26634
26659
  case 2:
26635
- if (!(actionInfo.action === "Reject")) return [3 /*break*/, 4];
26660
+ actionResponse = _a.sent();
26661
+ return [3 /*break*/, 9];
26662
+ case 3:
26663
+ if (!(actionInfo.action === "Reject")) return [3 /*break*/, 5];
26636
26664
  return [4 /*yield*/, post("national/programme/rejectNdcDetailsAction", {
26637
26665
  id: actionInfo.recordId,
26638
26666
  })];
26639
- case 3:
26640
- actionResponse = _a.sent();
26641
- return [3 /*break*/, 8];
26642
26667
  case 4:
26643
- if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 6];
26668
+ actionResponse = _a.sent();
26669
+ return [3 /*break*/, 9];
26670
+ case 5:
26671
+ if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 7];
26644
26672
  return [4 /*yield*/, post("national/programme/finalizeNdcDetailsPeriod", {
26645
26673
  id: selectedPeriod.key,
26646
26674
  })];
26647
- case 5:
26648
- actionResponse = _a.sent();
26649
- return [3 /*break*/, 8];
26650
26675
  case 6:
26651
- if (!(actionInfo.action === "Delete")) return [3 /*break*/, 8];
26676
+ actionResponse = _a.sent();
26677
+ return [3 /*break*/, 9];
26678
+ case 7:
26679
+ if (!(actionInfo.action === "Delete")) return [3 /*break*/, 9];
26652
26680
  return [4 /*yield*/, post("national/programme/deleteNdcDetailsPeriod", {
26653
26681
  id: selectedPeriod.key,
26654
26682
  })];
26655
- case 7:
26656
- actionResponse = _a.sent();
26657
- _a.label = 8;
26658
26683
  case 8:
26684
+ actionResponse = _a.sent();
26685
+ _a.label = 9;
26686
+ case 9: return [3 /*break*/, 11];
26687
+ case 10:
26688
+ exception_4 = _a.sent();
26689
+ message.open({
26690
+ type: "error",
26691
+ content: exception_4.message,
26692
+ duration: 3,
26693
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26694
+ });
26695
+ return [3 /*break*/, 11];
26696
+ case 11:
26659
26697
  if (actionResponse &&
26660
26698
  (actionInfo.action === "Delete" || actionInfo.action === "Finalize")) {
26661
26699
  fetchNdcDetailPeriods();
@@ -26674,11 +26712,14 @@ var NdcDetailsComponent = function (props) {
26674
26712
  setOpenConfirmationModal(false);
26675
26713
  };
26676
26714
  var fetchNdcDetailPeriods = function () { return __awaiter(void 0, void 0, void 0, function () {
26677
- var periods, addNewTab, response;
26715
+ var periods, addNewTab, response, exception_5;
26678
26716
  return __generator(this, function (_a) {
26679
26717
  switch (_a.label) {
26680
26718
  case 0:
26681
26719
  setLoading(true);
26720
+ _a.label = 1;
26721
+ case 1:
26722
+ _a.trys.push([1, 3, 4, 5]);
26682
26723
  periods = [];
26683
26724
  addNewTab = {
26684
26725
  key: "add_new",
@@ -26689,7 +26730,7 @@ var NdcDetailsComponent = function (props) {
26689
26730
  deleted: false,
26690
26731
  };
26691
26732
  return [4 /*yield*/, get("national/programme/queryNdcDetailsPeriod")];
26692
- case 1:
26733
+ case 2:
26693
26734
  response = _a.sent();
26694
26735
  if (response && response.data) {
26695
26736
  periods = response.data.map(function (period) {
@@ -26713,18 +26754,34 @@ var NdcDetailsComponent = function (props) {
26713
26754
  setSelectedPeriod(periods[0]);
26714
26755
  }
26715
26756
  setLoading(false);
26716
- return [2 /*return*/];
26757
+ return [3 /*break*/, 5];
26758
+ case 3:
26759
+ exception_5 = _a.sent();
26760
+ message.open({
26761
+ type: "error",
26762
+ content: exception_5.message,
26763
+ duration: 3,
26764
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26765
+ });
26766
+ return [3 /*break*/, 5];
26767
+ case 4:
26768
+ setLoading(false);
26769
+ return [7 /*endfinally*/];
26770
+ case 5: return [2 /*return*/];
26717
26771
  }
26718
26772
  });
26719
26773
  }); };
26720
26774
  var fetchNdcDetailActions = function () { return __awaiter(void 0, void 0, void 0, function () {
26721
- var response, maxActionId;
26775
+ var response, maxActionId, exception_6;
26722
26776
  return __generator(this, function (_a) {
26723
26777
  switch (_a.label) {
26724
26778
  case 0:
26725
26779
  setLoading(true);
26726
- return [4 /*yield*/, get("national/programme/queryNdcDetailsAction")];
26780
+ _a.label = 1;
26727
26781
  case 1:
26782
+ _a.trys.push([1, 3, 4, 5]);
26783
+ return [4 /*yield*/, get("national/programme/queryNdcDetailsAction")];
26784
+ case 2:
26728
26785
  response = _a.sent();
26729
26786
  if (response && response.data) {
26730
26787
  maxActionId = Math.max.apply(Math, response.data.map(function (item) { return item.id; }));
@@ -26732,18 +26789,34 @@ var NdcDetailsComponent = function (props) {
26732
26789
  setNdcActionsList(response.data);
26733
26790
  }
26734
26791
  setLoading(false);
26735
- return [2 /*return*/];
26792
+ return [3 /*break*/, 5];
26793
+ case 3:
26794
+ exception_6 = _a.sent();
26795
+ message.open({
26796
+ type: "error",
26797
+ content: exception_6.message,
26798
+ duration: 3,
26799
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26800
+ });
26801
+ return [3 /*break*/, 5];
26802
+ case 4:
26803
+ setLoading(false);
26804
+ return [7 /*endfinally*/];
26805
+ case 5: return [2 /*return*/];
26736
26806
  }
26737
26807
  });
26738
26808
  }); };
26739
26809
  var fetchMinistries = function () { return __awaiter(void 0, void 0, void 0, function () {
26740
- var response, ministryOrgDetails;
26810
+ var response, ministryOrgDetails, exception_7;
26741
26811
  return __generator(this, function (_a) {
26742
26812
  switch (_a.label) {
26743
26813
  case 0:
26744
26814
  setLoading(true);
26745
- return [4 /*yield*/, get("national/organisation/getMinistries")];
26815
+ _a.label = 1;
26746
26816
  case 1:
26817
+ _a.trys.push([1, 3, 4, 5]);
26818
+ return [4 /*yield*/, get("national/organisation/getMinistries")];
26819
+ case 2:
26747
26820
  response = _a.sent();
26748
26821
  if (response && response.data) {
26749
26822
  ministryOrgDetails = response.data.map(function (value) {
@@ -26755,7 +26828,20 @@ var NdcDetailsComponent = function (props) {
26755
26828
  setMinistryOrgList(ministryOrgDetails);
26756
26829
  }
26757
26830
  setLoading(false);
26758
- return [2 /*return*/];
26831
+ return [3 /*break*/, 5];
26832
+ case 3:
26833
+ exception_7 = _a.sent();
26834
+ message.open({
26835
+ type: "error",
26836
+ content: exception_7.message,
26837
+ duration: 3,
26838
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26839
+ });
26840
+ return [3 /*break*/, 5];
26841
+ case 4:
26842
+ setLoading(false);
26843
+ return [7 /*endfinally*/];
26844
+ case 5: return [2 /*return*/];
26759
26845
  }
26760
26846
  });
26761
26847
  }); };