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

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cjs/index.js CHANGED
@@ -26145,23 +26145,23 @@ var RegistryDashboardComponent = function (props) {
26145
26145
 
26146
26146
  React.createContext(null);
26147
26147
  var EditableCell = function (_a) {
26148
- var editing = _a.editing, dataIndex = _a.dataIndex, title = _a.title; _a.inputType; var record = _a.record; _a.index; var children = _a.children, onBlurHandler = _a.onBlurHandler, restProps = __rest(_a, ["editing", "dataIndex", "title", "inputType", "record", "index", "children", "onBlurHandler"]);
26148
+ var editing = _a.editing, dataIndex = _a.dataIndex, title = _a.title; _a.inputType; var record = _a.record; _a.index; var children = _a.children, onBlurHandler = _a.onBlurHandler, t = _a.t, restProps = __rest(_a, ["editing", "dataIndex", "title", "inputType", "record", "index", "children", "onBlurHandler", "t"]);
26149
26149
  var inputNode;
26150
26150
  if (dataIndex === "nationalPlanObjective") {
26151
- inputNode = (React.createElement(antd.Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: "Enter National Plan Objective" }));
26151
+ inputNode = (React.createElement(antd.Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:nationalPlanObjectivePlaceHolder") }));
26152
26152
  }
26153
26153
  else if (dataIndex === "kpi") {
26154
- inputNode = (React.createElement(antd.InputNumber, { onBlur: function () { return onBlurHandler(record); }, placeholder: "Enter Kpi" }));
26154
+ inputNode = (React.createElement(antd.InputNumber, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:kpiPlaceHolder") }));
26155
26155
  }
26156
26156
  return (React.createElement("td", __assign({}, restProps), editing ? (React.createElement(antd.Form.Item, { name: dataIndex, style: { margin: 0 }, rules: [
26157
26157
  {
26158
26158
  required: true,
26159
- message: "Please Input ".concat(title, "!"),
26159
+ message: "".concat(title, " ").concat(t("ndc:isRequired")),
26160
26160
  },
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;
@@ -26289,7 +26289,7 @@ var NdcDetailsComponent = function (props) {
26289
26289
  return __generator(this, function (_a) {
26290
26290
  switch (_a.label) {
26291
26291
  case 0:
26292
- _a.trys.push([0, 9, 10, 11]);
26292
+ _a.trys.push([0, 9, , 10]);
26293
26293
  updatedFields = void 0;
26294
26294
  _a.label = 1;
26295
26295
  case 1:
@@ -26324,20 +26324,18 @@ var NdcDetailsComponent = function (props) {
26324
26324
  case 8:
26325
26325
  fetchNdcDetailActions();
26326
26326
  setEditingKey(-1);
26327
- return [3 /*break*/, 11];
26327
+ return [3 /*break*/, 10];
26328
26328
  case 9:
26329
26329
  exception_2 = _a.sent();
26330
+ setEditingKey(-1);
26330
26331
  antd.message.open({
26331
26332
  type: "error",
26332
26333
  content: exception_2.message,
26333
26334
  duration: 3,
26334
26335
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26335
26336
  });
26336
- return [3 /*break*/, 11];
26337
- case 10:
26338
- setEditingKey(-1);
26339
- return [7 /*endfinally*/];
26340
- case 11: return [2 /*return*/];
26337
+ return [3 /*break*/, 10];
26338
+ case 10: return [2 /*return*/];
26341
26339
  }
26342
26340
  });
26343
26341
  }); };
@@ -26388,7 +26386,7 @@ var NdcDetailsComponent = function (props) {
26388
26386
  dataIndex: "nationalPlanObjective",
26389
26387
  key: "nationalPlanObjective",
26390
26388
  align: "left",
26391
- width: 300,
26389
+ width: 400,
26392
26390
  editable: true,
26393
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" })))); },
26394
26392
  },
@@ -26406,10 +26404,10 @@ var NdcDetailsComponent = function (props) {
26406
26404
  dataIndex: "ministryName",
26407
26405
  key: "ministryName",
26408
26406
  align: "left",
26409
- width: 200,
26407
+ width: 300,
26410
26408
  editable: false,
26411
26409
  render: function (_, record) { return (React.createElement(React.Fragment, null,
26412
- 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) {
26413
26411
  record.ministryName = option.label;
26414
26412
  handleSave(record);
26415
26413
  }, options: ministryOrgList }))); },
@@ -26419,7 +26417,7 @@ var NdcDetailsComponent = function (props) {
26419
26417
  dataIndex: "status",
26420
26418
  key: "status",
26421
26419
  align: "left",
26422
- width: "15%",
26420
+ width: 200,
26423
26421
  editable: false,
26424
26422
  render: function (_, record) {
26425
26423
  var menu = actionMenu(record);
@@ -26451,6 +26449,7 @@ var NdcDetailsComponent = function (props) {
26451
26449
  handleSave(record);
26452
26450
  }
26453
26451
  },
26452
+ t: t,
26454
26453
  };
26455
26454
  } });
26456
26455
  });
@@ -26505,6 +26504,15 @@ var NdcDetailsComponent = function (props) {
26505
26504
  var onClickedFinalizePeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
26506
26505
  var pendingActions;
26507
26506
  return __generator(this, function (_a) {
26507
+ if (subNdcActionsForPeriod.length === 0) {
26508
+ antd.message.open({
26509
+ type: "error",
26510
+ content: t("ndc:finalizeNdcEmptyErrorText"),
26511
+ duration: 3,
26512
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26513
+ });
26514
+ return [2 /*return*/];
26515
+ }
26508
26516
  pendingActions = subNdcActionsForPeriod.filter(function (action) {
26509
26517
  return action.status === NdcDetailsActionStatus.Pending;
26510
26518
  });
@@ -26551,12 +26559,11 @@ var NdcDetailsComponent = function (props) {
26551
26559
  React.createElement(antd.Row, null,
26552
26560
  React.createElement(antd.Col, { span: 24 },
26553
26561
  React.createElement(antd.Form, { form: form, component: false },
26554
- 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: {
26562
+ 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: {
26555
26563
  expandedRowRender: function (record) {
26556
26564
  return subNdcActionTableContent();
26557
26565
  },
26558
- indentSize: 30,
26559
- columnWidth: 30,
26566
+ columnWidth: 40,
26560
26567
  }, onRow: function (record, rowIndex) {
26561
26568
  return {
26562
26569
  onClick: function (event) {
@@ -26586,7 +26593,7 @@ var NdcDetailsComponent = function (props) {
26586
26593
  React.createElement(antd.Button, { className: "mg-left-1", type: "primary", onClick: onClickedFinalizePeriod, htmlType: "submit", loading: loading }, t("ndc:finalize")))) : ("")));
26587
26594
  }
26588
26595
  function subNdcActionTableContent(record) {
26589
- return (React.createElement(antd.Table, { rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: subNdcActionsForPeriod, loading: loading, onRow: function (record, rowIndex) {
26596
+ 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) {
26590
26597
  return {
26591
26598
  onClick: function (event) {
26592
26599
  if (record.id &&
@@ -26717,13 +26724,43 @@ var NdcDetailsComponent = function (props) {
26717
26724
  });
26718
26725
  return [3 /*break*/, 11];
26719
26726
  case 11:
26720
- if (actionResponse &&
26721
- (actionInfo.action === "Delete" || actionInfo.action === "Finalize")) {
26722
- fetchNdcDetailPeriods();
26723
- }
26724
- else if (actionResponse &&
26725
- (actionInfo.action === "Approve" || actionInfo.action === "Reject")) {
26726
- fetchNdcDetailActions();
26727
+ if (actionResponse) {
26728
+ if (actionInfo.action === "Delete") {
26729
+ antd.message.open({
26730
+ type: "success",
26731
+ content: t("ndc:deletePeriodSuccessMsg"),
26732
+ duration: 3,
26733
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26734
+ });
26735
+ fetchNdcDetailPeriods();
26736
+ }
26737
+ else if (actionInfo.action === "Finalize") {
26738
+ antd.message.open({
26739
+ type: "success",
26740
+ content: t("ndc:finalizeSuccessMsg"),
26741
+ duration: 3,
26742
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26743
+ });
26744
+ fetchNdcDetailPeriods();
26745
+ }
26746
+ else if (actionInfo.action === "Approve") {
26747
+ antd.message.open({
26748
+ type: "success",
26749
+ content: t("ndc:approveSuccessMsg"),
26750
+ duration: 3,
26751
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26752
+ });
26753
+ fetchNdcDetailActions();
26754
+ }
26755
+ else if (actionInfo.action === "Reject") {
26756
+ antd.message.open({
26757
+ type: "success",
26758
+ content: t("ndc:rejectSuccessMsg"),
26759
+ duration: 3,
26760
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26761
+ });
26762
+ fetchNdcDetailActions();
26763
+ }
26727
26764
  }
26728
26765
  setOpenConfirmationModal(false);
26729
26766
  setLoading(false);