@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/cjs/index.js CHANGED
@@ -26161,7 +26161,7 @@ var EditableCell = function (_a) {
26161
26161
  ] }, inputNode)) : (children)));
26162
26162
  };
26163
26163
 
26164
- 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";
26164
+ 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";
26165
26165
  styleInject(css_248z$4);
26166
26166
 
26167
26167
  var NdcDetailsActionType;
@@ -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]);
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,30 @@ 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*/, 10];
26328
+ case 9:
26329
+ exception_2 = _a.sent();
26330
+ setEditingKey(-1);
26331
+ antd.message.open({
26332
+ type: "error",
26333
+ content: exception_2.message,
26334
+ duration: 3,
26335
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26336
+ });
26337
+ return [3 /*break*/, 10];
26338
+ case 10: return [2 /*return*/];
26324
26339
  }
26325
26340
  });
26326
26341
  }); };
@@ -26371,7 +26386,7 @@ var NdcDetailsComponent = function (props) {
26371
26386
  dataIndex: "nationalPlanObjective",
26372
26387
  key: "nationalPlanObjective",
26373
26388
  align: "left",
26374
- width: 300,
26389
+ width: 400,
26375
26390
  editable: true,
26376
26391
  render: function (_, record) { return (React.createElement(antd.Space, { size: "middle" }, record.nationalPlanObjective ? (React.createElement("span", null, record.nationalPlanObjective)) : (React.createElement(antd.Input, { placeholder: "Enter National Plan Objective" })))); },
26377
26392
  },
@@ -26389,10 +26404,10 @@ var NdcDetailsComponent = function (props) {
26389
26404
  dataIndex: "ministryName",
26390
26405
  key: "ministryName",
26391
26406
  align: "left",
26392
- width: 200,
26407
+ width: 300,
26393
26408
  editable: false,
26394
26409
  render: function (_, record) { return (React.createElement(React.Fragment, null,
26395
- React.createElement(antd.Select, { disabled: !(isSubNdcActionsEditable(record) && isEditing(record)), defaultValue: record.ministryName ? record.ministryName : loginMinistry, style: { width: 320 }, onChange: function (value, option) {
26410
+ React.createElement(antd.Select, { disabled: !(isSubNdcActionsEditable(record) && isEditing(record)), defaultValue: record.ministryName ? record.ministryName : loginMinistry, style: { width: 220 }, onChange: function (value, option) {
26396
26411
  record.ministryName = option.label;
26397
26412
  handleSave(record);
26398
26413
  }, options: ministryOrgList }))); },
@@ -26402,7 +26417,7 @@ var NdcDetailsComponent = function (props) {
26402
26417
  dataIndex: "status",
26403
26418
  key: "status",
26404
26419
  align: "left",
26405
- width: "15%",
26420
+ width: 200,
26406
26421
  editable: false,
26407
26422
  render: function (_, record) {
26408
26423
  var menu = actionMenu(record);
@@ -26534,12 +26549,11 @@ var NdcDetailsComponent = function (props) {
26534
26549
  React.createElement(antd.Row, null,
26535
26550
  React.createElement(antd.Col, { span: 24 },
26536
26551
  React.createElement(antd.Form, { form: form, component: false },
26537
- React.createElement(antd.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: {
26552
+ React.createElement(antd.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: {
26538
26553
  expandedRowRender: function (record) {
26539
26554
  return subNdcActionTableContent();
26540
26555
  },
26541
- indentSize: 30,
26542
- columnWidth: 30,
26556
+ columnWidth: 40
26543
26557
  }, onRow: function (record, rowIndex) {
26544
26558
  return {
26545
26559
  onClick: function (event) {
@@ -26569,7 +26583,7 @@ var NdcDetailsComponent = function (props) {
26569
26583
  React.createElement(antd.Button, { className: "mg-left-1", type: "primary", onClick: onClickedFinalizePeriod, htmlType: "submit", loading: loading }, t("ndc:finalize")))) : ("")));
26570
26584
  }
26571
26585
  function subNdcActionTableContent(record) {
26572
- return (React.createElement(antd.Table, { rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: subNdcActionsForPeriod, loading: loading, onRow: function (record, rowIndex) {
26586
+ return (React.createElement(antd.Table, { tableLayout: "fixed", rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: subNdcActionsForPeriod, loading: loading, onRow: function (record, rowIndex) {
26573
26587
  return {
26574
26588
  onClick: function (event) {
26575
26589
  if (record.id &&
@@ -26588,10 +26602,11 @@ var NdcDetailsComponent = function (props) {
26588
26602
  }, columns: columns, showHeader: false, pagination: false }));
26589
26603
  }
26590
26604
  var onAddNewPeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
26591
- var periodItem_1, existingIndex, response, addedPeriodItem, updatedPeriodItem_1;
26605
+ var periodItem_1, existingIndex, response, addedPeriodItem, updatedPeriodItem_1, exception_3;
26592
26606
  return __generator(this, function (_a) {
26593
26607
  switch (_a.label) {
26594
26608
  case 0:
26609
+ _a.trys.push([0, 4, , 5]);
26595
26610
  if (!(selectedDateRangeRef && selectedDateRangeRef.current)) return [3 /*break*/, 3];
26596
26611
  periodItem_1 = {
26597
26612
  startYear: selectedDateRangeRef.current.startYear,
@@ -26621,7 +26636,17 @@ var NdcDetailsComponent = function (props) {
26621
26636
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26622
26637
  });
26623
26638
  _a.label = 3;
26624
- case 3: return [2 /*return*/];
26639
+ case 3: return [3 /*break*/, 5];
26640
+ case 4:
26641
+ exception_3 = _a.sent();
26642
+ antd.message.open({
26643
+ type: "error",
26644
+ content: exception_3.message,
26645
+ duration: 3,
26646
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26647
+ });
26648
+ return [3 /*break*/, 5];
26649
+ case 5: return [2 /*return*/];
26625
26650
  }
26626
26651
  });
26627
26652
  }); };
@@ -26639,43 +26664,56 @@ var NdcDetailsComponent = function (props) {
26639
26664
  }
26640
26665
  };
26641
26666
  var onActionConfirmed = function () { return __awaiter(void 0, void 0, void 0, function () {
26642
- var actionResponse;
26667
+ var actionResponse, exception_4;
26643
26668
  return __generator(this, function (_a) {
26644
26669
  switch (_a.label) {
26645
26670
  case 0:
26646
26671
  setLoading(true);
26647
- if (!(actionInfo.action === "Approve")) return [3 /*break*/, 2];
26672
+ _a.label = 1;
26673
+ case 1:
26674
+ _a.trys.push([1, 10, , 11]);
26675
+ if (!(actionInfo.action === "Approve")) return [3 /*break*/, 3];
26648
26676
  return [4 /*yield*/, post("national/programme/approveNdcDetailsAction", {
26649
26677
  id: actionInfo.recordId,
26650
26678
  })];
26651
- case 1:
26652
- actionResponse = _a.sent();
26653
- return [3 /*break*/, 8];
26654
26679
  case 2:
26655
- if (!(actionInfo.action === "Reject")) return [3 /*break*/, 4];
26680
+ actionResponse = _a.sent();
26681
+ return [3 /*break*/, 9];
26682
+ case 3:
26683
+ if (!(actionInfo.action === "Reject")) return [3 /*break*/, 5];
26656
26684
  return [4 /*yield*/, post("national/programme/rejectNdcDetailsAction", {
26657
26685
  id: actionInfo.recordId,
26658
26686
  })];
26659
- case 3:
26660
- actionResponse = _a.sent();
26661
- return [3 /*break*/, 8];
26662
26687
  case 4:
26663
- if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 6];
26688
+ actionResponse = _a.sent();
26689
+ return [3 /*break*/, 9];
26690
+ case 5:
26691
+ if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 7];
26664
26692
  return [4 /*yield*/, post("national/programme/finalizeNdcDetailsPeriod", {
26665
26693
  id: selectedPeriod.key,
26666
26694
  })];
26667
- case 5:
26668
- actionResponse = _a.sent();
26669
- return [3 /*break*/, 8];
26670
26695
  case 6:
26671
- if (!(actionInfo.action === "Delete")) return [3 /*break*/, 8];
26696
+ actionResponse = _a.sent();
26697
+ return [3 /*break*/, 9];
26698
+ case 7:
26699
+ if (!(actionInfo.action === "Delete")) return [3 /*break*/, 9];
26672
26700
  return [4 /*yield*/, post("national/programme/deleteNdcDetailsPeriod", {
26673
26701
  id: selectedPeriod.key,
26674
26702
  })];
26675
- case 7:
26676
- actionResponse = _a.sent();
26677
- _a.label = 8;
26678
26703
  case 8:
26704
+ actionResponse = _a.sent();
26705
+ _a.label = 9;
26706
+ case 9: return [3 /*break*/, 11];
26707
+ case 10:
26708
+ exception_4 = _a.sent();
26709
+ antd.message.open({
26710
+ type: "error",
26711
+ content: exception_4.message,
26712
+ duration: 3,
26713
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26714
+ });
26715
+ return [3 /*break*/, 11];
26716
+ case 11:
26679
26717
  if (actionResponse &&
26680
26718
  (actionInfo.action === "Delete" || actionInfo.action === "Finalize")) {
26681
26719
  fetchNdcDetailPeriods();
@@ -26694,11 +26732,14 @@ var NdcDetailsComponent = function (props) {
26694
26732
  setOpenConfirmationModal(false);
26695
26733
  };
26696
26734
  var fetchNdcDetailPeriods = function () { return __awaiter(void 0, void 0, void 0, function () {
26697
- var periods, addNewTab, response;
26735
+ var periods, addNewTab, response, exception_5;
26698
26736
  return __generator(this, function (_a) {
26699
26737
  switch (_a.label) {
26700
26738
  case 0:
26701
26739
  setLoading(true);
26740
+ _a.label = 1;
26741
+ case 1:
26742
+ _a.trys.push([1, 3, 4, 5]);
26702
26743
  periods = [];
26703
26744
  addNewTab = {
26704
26745
  key: "add_new",
@@ -26709,7 +26750,7 @@ var NdcDetailsComponent = function (props) {
26709
26750
  deleted: false,
26710
26751
  };
26711
26752
  return [4 /*yield*/, get("national/programme/queryNdcDetailsPeriod")];
26712
- case 1:
26753
+ case 2:
26713
26754
  response = _a.sent();
26714
26755
  if (response && response.data) {
26715
26756
  periods = response.data.map(function (period) {
@@ -26733,18 +26774,34 @@ var NdcDetailsComponent = function (props) {
26733
26774
  setSelectedPeriod(periods[0]);
26734
26775
  }
26735
26776
  setLoading(false);
26736
- return [2 /*return*/];
26777
+ return [3 /*break*/, 5];
26778
+ case 3:
26779
+ exception_5 = _a.sent();
26780
+ antd.message.open({
26781
+ type: "error",
26782
+ content: exception_5.message,
26783
+ duration: 3,
26784
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26785
+ });
26786
+ return [3 /*break*/, 5];
26787
+ case 4:
26788
+ setLoading(false);
26789
+ return [7 /*endfinally*/];
26790
+ case 5: return [2 /*return*/];
26737
26791
  }
26738
26792
  });
26739
26793
  }); };
26740
26794
  var fetchNdcDetailActions = function () { return __awaiter(void 0, void 0, void 0, function () {
26741
- var response, maxActionId;
26795
+ var response, maxActionId, exception_6;
26742
26796
  return __generator(this, function (_a) {
26743
26797
  switch (_a.label) {
26744
26798
  case 0:
26745
26799
  setLoading(true);
26746
- return [4 /*yield*/, get("national/programme/queryNdcDetailsAction")];
26800
+ _a.label = 1;
26747
26801
  case 1:
26802
+ _a.trys.push([1, 3, 4, 5]);
26803
+ return [4 /*yield*/, get("national/programme/queryNdcDetailsAction")];
26804
+ case 2:
26748
26805
  response = _a.sent();
26749
26806
  if (response && response.data) {
26750
26807
  maxActionId = Math.max.apply(Math, response.data.map(function (item) { return item.id; }));
@@ -26752,18 +26809,34 @@ var NdcDetailsComponent = function (props) {
26752
26809
  setNdcActionsList(response.data);
26753
26810
  }
26754
26811
  setLoading(false);
26755
- return [2 /*return*/];
26812
+ return [3 /*break*/, 5];
26813
+ case 3:
26814
+ exception_6 = _a.sent();
26815
+ antd.message.open({
26816
+ type: "error",
26817
+ content: exception_6.message,
26818
+ duration: 3,
26819
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26820
+ });
26821
+ return [3 /*break*/, 5];
26822
+ case 4:
26823
+ setLoading(false);
26824
+ return [7 /*endfinally*/];
26825
+ case 5: return [2 /*return*/];
26756
26826
  }
26757
26827
  });
26758
26828
  }); };
26759
26829
  var fetchMinistries = function () { return __awaiter(void 0, void 0, void 0, function () {
26760
- var response, ministryOrgDetails;
26830
+ var response, ministryOrgDetails, exception_7;
26761
26831
  return __generator(this, function (_a) {
26762
26832
  switch (_a.label) {
26763
26833
  case 0:
26764
26834
  setLoading(true);
26765
- return [4 /*yield*/, get("national/organisation/getMinistries")];
26835
+ _a.label = 1;
26766
26836
  case 1:
26837
+ _a.trys.push([1, 3, 4, 5]);
26838
+ return [4 /*yield*/, get("national/organisation/getMinistries")];
26839
+ case 2:
26767
26840
  response = _a.sent();
26768
26841
  if (response && response.data) {
26769
26842
  ministryOrgDetails = response.data.map(function (value) {
@@ -26775,7 +26848,20 @@ var NdcDetailsComponent = function (props) {
26775
26848
  setMinistryOrgList(ministryOrgDetails);
26776
26849
  }
26777
26850
  setLoading(false);
26778
- return [2 /*return*/];
26851
+ return [3 /*break*/, 5];
26852
+ case 3:
26853
+ exception_7 = _a.sent();
26854
+ antd.message.open({
26855
+ type: "error",
26856
+ content: exception_7.message,
26857
+ duration: 3,
26858
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26859
+ });
26860
+ return [3 /*break*/, 5];
26861
+ case 4:
26862
+ setLoading(false);
26863
+ return [7 /*endfinally*/];
26864
+ case 5: return [2 /*return*/];
26779
26865
  }
26780
26866
  });
26781
26867
  }); };