@undp/carbon-library 1.0.17-CARBON-363.35 → 1.0.17-CARBON-363.97

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,13 +9,14 @@ interface EditableRowProps {
9
9
  index: number;
10
10
  }
11
11
  export declare const EditableRow: React.FC<EditableRowProps>;
12
- interface EditableCellProps {
13
- title: React.ReactNode;
14
- editable: boolean;
15
- children: React.ReactNode;
16
- dataIndex: keyof Item;
12
+ interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
13
+ editing: boolean;
14
+ dataIndex: string;
15
+ title: any;
16
+ inputType: "number" | "text";
17
17
  record: Item;
18
- handleSave: (record: Item) => void;
18
+ index: number;
19
+ children: React.ReactNode;
19
20
  }
20
21
  export declare const EditableCell: React.FC<EditableCellProps>;
21
22
  export {};
@@ -7,10 +7,10 @@ export type Period = {
7
7
  deleted: boolean;
8
8
  };
9
9
  export type NdcDetail = {
10
- id?: number;
10
+ id: number;
11
11
  actionType: NdcDetailsActionType;
12
12
  nationalPlanObjective: string;
13
- kpi: number;
13
+ kpi: number | string;
14
14
  ministryName: string;
15
15
  periodId?: number;
16
16
  status: NdcDetailsActionStatus;
@@ -25,6 +25,7 @@ export declare enum NdcDetailsActionType {
25
25
  SubAction = "SubAction"
26
26
  }
27
27
  export declare enum NdcDetailsActionStatus {
28
+ New = "New",
28
29
  Pending = "Pending",
29
30
  Approved = "Approved",
30
31
  Rejected = "Rejected"
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PlusOutlined, FilterOutlined, BankOutlined, SafetyOutlined, AuditOutlined, ExperimentOutlined, UploadOutlined, UserOutlined, MinusCircleOutlined, StarOutlined, ToolOutlined, EyeOutlined, SearchOutlined, EllipsisOutlined, EditOutlined, DeleteOutlined, FileAddOutlined, CheckCircleOutlined, ExclamationCircleOutlined, BookOutlined, CaretDownOutlined, LockOutlined, EyeInvisibleOutlined, GlobalOutlined, FlagOutlined, LineChartOutlined, LikeOutlined, DislikeOutlined } from '@ant-design/icons';
2
2
  import { Input, Radio, Space, Row, Col, Button, Dropdown, Table, Empty, message, Form, Steps, Upload, InputNumber, Tooltip, Select, Modal, Alert, Skeleton, Card, Tag, Checkbox, DatePicker, Popover, List, Typography, Spin, Tabs, Progress } from 'antd';
3
- import React, { useState, useEffect, useRef, useContext } from 'react';
3
+ import React, { useState, useEffect, useRef } from 'react';
4
4
  import { DateTime } from 'luxon';
5
5
  import { Buffer } from 'buffer';
6
6
  import PhoneInput, { formatPhoneNumberIntl, formatPhoneNumber } from 'react-phone-number-input';
@@ -26123,55 +26123,22 @@ var RegistryDashboardComponent = function (props) {
26123
26123
  lastUpdateTransferLocations))))))))) : ("")));
26124
26124
  };
26125
26125
 
26126
- var EditableContext = React.createContext(null);
26127
- var EditableRow = function (_a) {
26128
- _a.index; var props = __rest(_a, ["index"]);
26129
- var form = Form.useForm()[0];
26130
- return (React.createElement(Form, { form: form, component: false },
26131
- React.createElement(EditableContext.Provider, { value: form },
26132
- React.createElement("tr", __assign({}, props)))));
26133
- };
26126
+ React.createContext(null);
26134
26127
  var EditableCell = function (_a) {
26135
- _a.title; var editable = _a.editable, children = _a.children, dataIndex = _a.dataIndex, record = _a.record, handleSave = _a.handleSave, restProps = __rest(_a, ["title", "editable", "children", "dataIndex", "record", "handleSave"]);
26136
- var _b = useState(false), editing = _b[0], setEditing = _b[1];
26137
- var inputRef = useRef(null);
26138
- var form = useContext(EditableContext);
26139
- useEffect(function () {
26140
- if (editing) {
26141
- inputRef.current.focus();
26142
- }
26143
- }, [editing]);
26144
- var toggleEdit = function () {
26145
- var _a;
26146
- setEditing(!editing);
26147
- form.setFieldsValue((_a = {}, _a[dataIndex] = record[dataIndex], _a));
26148
- };
26149
- var save = function () { return __awaiter(void 0, void 0, void 0, function () {
26150
- var values, errInfo_1;
26151
- return __generator(this, function (_a) {
26152
- switch (_a.label) {
26153
- case 0:
26154
- _a.trys.push([0, 2, , 3]);
26155
- return [4 /*yield*/, form.validateFields()];
26156
- case 1:
26157
- values = _a.sent();
26158
- toggleEdit();
26159
- handleSave(__assign(__assign({}, record), values));
26160
- return [3 /*break*/, 3];
26161
- case 2:
26162
- errInfo_1 = _a.sent();
26163
- console.log("Save failed:", errInfo_1);
26164
- return [3 /*break*/, 3];
26165
- case 3: return [2 /*return*/];
26166
- }
26167
- });
26168
- }); };
26169
- var childNode = children;
26170
- if (editable) {
26171
- childNode = editing ? (React.createElement(Form.Item, { style: { margin: 0 }, name: dataIndex },
26172
- React.createElement(Input, { ref: inputRef, onPressEnter: save, onBlur: save }))) : (React.createElement("div", { className: "editable-cell-value-wrap", style: { paddingRight: 24, minWidth: "100px", minHeight: "20px" }, onClick: toggleEdit }, children));
26128
+ var editing = _a.editing, dataIndex = _a.dataIndex, title = _a.title; _a.inputType; _a.record; _a.index; var children = _a.children, restProps = __rest(_a, ["editing", "dataIndex", "title", "inputType", "record", "index", "children"]);
26129
+ var inputNode;
26130
+ if (dataIndex === "nationalPlanObjective") {
26131
+ inputNode = React.createElement(Input, { placeholder: "Enter National Plan Objective" });
26173
26132
  }
26174
- return React.createElement("td", __assign({}, restProps), childNode);
26133
+ else if (dataIndex === "kpi") {
26134
+ inputNode = React.createElement(InputNumber, { placeholder: "Enter Kpi" });
26135
+ }
26136
+ return (React.createElement("td", __assign({}, restProps), editing ? (React.createElement(Form.Item, { name: dataIndex, style: { margin: 0 }, rules: [
26137
+ {
26138
+ required: true,
26139
+ message: "Please Input ".concat(title, "!"),
26140
+ },
26141
+ ] }, inputNode)) : (children)));
26175
26142
  };
26176
26143
 
26177
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";
@@ -26184,6 +26151,7 @@ var NdcDetailsActionType;
26184
26151
  })(NdcDetailsActionType || (NdcDetailsActionType = {}));
26185
26152
  var NdcDetailsActionStatus;
26186
26153
  (function (NdcDetailsActionStatus) {
26154
+ NdcDetailsActionStatus["New"] = "New";
26187
26155
  NdcDetailsActionStatus["Pending"] = "Pending";
26188
26156
  NdcDetailsActionStatus["Approved"] = "Approved";
26189
26157
  NdcDetailsActionStatus["Rejected"] = "Rejected";
@@ -26222,6 +26190,12 @@ var NdcDetailsComponent = function (props) {
26222
26190
  var _g = useState([]), ministryOrgList = _g[0], setMinistryOrgList = _g[1];
26223
26191
  var _h = useState({}), actionInfo = _h[0], setActionInfo = _h[1];
26224
26192
  var _j = useState(false), openConfirmationModal = _j[0], setOpenConfirmationModal = _j[1];
26193
+ var form = Form.useForm()[0];
26194
+ var _k = useState(-1), editingKey = _k[0], setEditingKey = _k[1];
26195
+ var _l = useState(0), nextAvailableActionId = _l[0], setNextAvailableActionId = _l[1];
26196
+ var _m = useState([]), expandedRowKeys = _m[0], setExpandedRowKeys = _m[1];
26197
+ var _o = useState([]), subNdcDetailsForPeriod = _o[0], setSubNdcDetailsForPeriod = _o[1];
26198
+ var isEditing = function (record) { return record.id === editingKey; };
26225
26199
  var userInfoState = useUserContext().userInfoState;
26226
26200
  var loginMinistry = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT
26227
26201
  ? process.env.REACT_APP_GOVERNMENT_MINISTRY
@@ -26249,42 +26223,40 @@ var NdcDetailsComponent = function (props) {
26249
26223
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyName) === record.ministryName)) &&
26250
26224
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly);
26251
26225
  };
26252
- var getSubNdcDetailsForPeriod = function (id) {
26253
- var subNdcDetails = ndcDetailsData.filter(function (ndcDetail) {
26254
- return (ndcDetail.parentActionId === id &&
26255
- ndcDetail.actionType === NdcDetailsActionType.SubAction);
26256
- });
26257
- var emptySubNdcRow = {
26258
- actionType: NdcDetailsActionType.SubAction,
26259
- nationalPlanObjective: "",
26260
- kpi: 0,
26261
- ministryName: loginMinistry,
26262
- status: NdcDetailsActionStatus.Pending,
26263
- parentActionId: id,
26264
- };
26265
- return __spreadArray(__spreadArray([], subNdcDetails, true), [emptySubNdcRow], false);
26266
- };
26267
26226
  var inRange = function (num, min, max) {
26268
26227
  return num >= min && num <= max;
26269
26228
  };
26270
26229
  var handleSave = function (row) { return __awaiter(void 0, void 0, void 0, function () {
26271
- var updatedItemIndex;
26230
+ var updatedFields, updatedItem, exception_1;
26272
26231
  return __generator(this, function (_a) {
26273
26232
  switch (_a.label) {
26274
26233
  case 0:
26275
- updatedItemIndex = ndcDetailsData.findIndex(function (item) { return item.id === row.id; });
26276
- if (!(updatedItemIndex === -1)) return [3 /*break*/, 2];
26277
- return [4 /*yield*/, post("national/programme/addNdcDetailsAction", __assign(__assign({}, row), { kpi: parseInt(row.kpi) }))];
26234
+ _a.trys.push([0, 6, , 7]);
26235
+ return [4 /*yield*/, form.validateFields()];
26278
26236
  case 1:
26237
+ updatedFields = (_a.sent());
26238
+ updatedItem = __assign(__assign({}, row), updatedFields);
26239
+ if (!(updatedItem.status === NdcDetailsActionStatus.New)) return [3 /*break*/, 3];
26240
+ updatedItem.status = NdcDetailsActionStatus.Pending;
26241
+ return [4 /*yield*/, post("national/programme/addNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi) }))];
26242
+ case 2:
26279
26243
  _a.sent();
26280
- return [3 /*break*/, 4];
26281
- case 2: return [4 /*yield*/, put("national/programme/updateNdcDetailsAction", __assign(__assign({}, row), { kpi: parseInt(row.kpi) }))];
26244
+ return [3 /*break*/, 5];
26282
26245
  case 3:
26283
- _a.sent();
26284
- _a.label = 4;
26246
+ updatedItem.status = NdcDetailsActionStatus.Pending;
26247
+ return [4 /*yield*/, put("national/programme/updateNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi) }))];
26285
26248
  case 4:
26249
+ _a.sent();
26250
+ _a.label = 5;
26251
+ case 5:
26286
26252
  fetchNdcDetailActions();
26287
- return [2 /*return*/];
26253
+ setEditingKey(-1);
26254
+ return [3 /*break*/, 7];
26255
+ case 6:
26256
+ exception_1 = _a.sent();
26257
+ console.log("error", exception_1);
26258
+ return [3 /*break*/, 7];
26259
+ case 7: return [2 /*return*/];
26288
26260
  }
26289
26261
  });
26290
26262
  }); };
@@ -26335,8 +26307,6 @@ var NdcDetailsComponent = function (props) {
26335
26307
  align: "left",
26336
26308
  width: "40%",
26337
26309
  editable: true,
26338
- render: function (_, record) { return (React.createElement(React.Fragment, null, record.nationalPlanObjective ? (React.createElement(Space, { size: "middle" },
26339
- React.createElement("span", null, record.nationalPlanObjective))) : (React.createElement("input", { placeholder: "Please add the National Plan Objective", className: "ant-input", type: "text" })))); },
26340
26310
  },
26341
26311
  {
26342
26312
  title: t("ndc:ndcColumnsKpi"),
@@ -26345,8 +26315,6 @@ var NdcDetailsComponent = function (props) {
26345
26315
  align: "left",
26346
26316
  width: "15%",
26347
26317
  editable: true,
26348
- render: function (_, record) { return (React.createElement(React.Fragment, null, record.kpi ? (React.createElement(Space, { size: "middle" },
26349
- React.createElement("span", null, record.kpi))) : (React.createElement("input", { placeholder: "Enter Kpi", className: "ant-input", type: "text" })))); },
26350
26318
  },
26351
26319
  {
26352
26320
  title: t("ndc:ndcColumnsMinistry"),
@@ -26356,7 +26324,10 @@ var NdcDetailsComponent = function (props) {
26356
26324
  width: "30%",
26357
26325
  editable: false,
26358
26326
  render: function (_, record) { return (React.createElement(React.Fragment, null,
26359
- React.createElement(Select, { disabled: !isSubNdcActionsEditable(record), defaultValue: record.ministryName ? record.ministryName : loginMinistry, style: { width: 320 }, onChange: function () { }, options: ministryOrgList }))); },
26327
+ React.createElement(Select, { disabled: !(isSubNdcActionsEditable(record) && isEditing(record)), defaultValue: record.ministryName ? record.ministryName : loginMinistry, style: { width: 320 }, onChange: function (value, option) {
26328
+ record.ministryName = option.label;
26329
+ handleSave(record);
26330
+ }, options: ministryOrgList }))); },
26360
26331
  },
26361
26332
  {
26362
26333
  title: t("ndc:ndcColumnsStatus"),
@@ -26368,7 +26339,8 @@ var NdcDetailsComponent = function (props) {
26368
26339
  render: function (_, record) {
26369
26340
  var menu = actionMenu(record);
26370
26341
  return (React.createElement(React.Fragment, null,
26371
- record.actionType === NdcDetailsActionType.SubAction ? (React.createElement(Tooltip, { title: record.status, color: TooltipColor, key: TooltipColor },
26342
+ record.actionType === NdcDetailsActionType.SubAction &&
26343
+ record.status !== NdcDetailsActionStatus.New ? (React.createElement(Tooltip, { title: record.status, color: TooltipColor, key: TooltipColor },
26372
26344
  React.createElement(Tag, { className: "clickable", color: getNdcActionStatusTagType(record.status) }, addSpaces(record.status)))) : (""),
26373
26345
  record.actionType === NdcDetailsActionType.SubAction && menu ? (React.createElement(Popover, { placement: "bottomRight", content: menu, trigger: "click" },
26374
26346
  React.createElement(EllipsisOutlined, { rotate: 90, style: {
@@ -26386,50 +26358,44 @@ var NdcDetailsComponent = function (props) {
26386
26358
  return __assign(__assign({}, col), { onCell: function (record) {
26387
26359
  return {
26388
26360
  record: record,
26389
- editable: record.actionType === NdcDetailsActionType.MainAction
26390
- ? isMainNdcActionsEditable
26391
- : isSubNdcActionsEditable(record),
26361
+ editing: isEditing(record),
26392
26362
  dataIndex: col.dataIndex,
26393
26363
  title: col.title,
26394
- handleSave: handleSave,
26395
26364
  };
26396
26365
  } });
26397
26366
  });
26398
26367
  function onClickedAddNewNdcDetail() {
26399
26368
  return __awaiter(this, void 0, void 0, function () {
26400
- var periodId, newData, response, newlyCreatedNdcAction_1;
26369
+ var periodId, newData_1;
26401
26370
  return __generator(this, function (_a) {
26402
- switch (_a.label) {
26403
- case 0:
26404
- if (!(selectedPeriod.key !== "add_new")) return [3 /*break*/, 2];
26405
- periodId = parseInt(selectedPeriod.key);
26406
- newData = {
26407
- actionType: NdcDetailsActionType.MainAction,
26408
- nationalPlanObjective: "",
26409
- kpi: 0,
26410
- ministryName: loginMinistry,
26411
- periodId: periodId,
26412
- status: NdcDetailsActionStatus.Pending,
26413
- };
26414
- return [4 /*yield*/, post("national/programme/addNdcDetailsAction", __assign({}, newData))];
26415
- case 1:
26416
- response = _a.sent();
26417
- if (response && response.data) {
26418
- newlyCreatedNdcAction_1 = response.data;
26419
- setNdcDetailsData(function (ndcDetailsData) { return __spreadArray(__spreadArray([], ndcDetailsData, true), [
26420
- newlyCreatedNdcAction_1,
26421
- ], false); });
26422
- setTableKey(function (key) { return key + 1; });
26423
- }
26424
- _a.label = 2;
26425
- case 2: return [2 /*return*/];
26371
+ if (selectedPeriod.key !== "add_new") {
26372
+ form.setFieldsValue({
26373
+ nationalPlanObjective: "",
26374
+ kpi: "",
26375
+ });
26376
+ periodId = parseInt(selectedPeriod.key);
26377
+ newData_1 = {
26378
+ id: nextAvailableActionId,
26379
+ actionType: NdcDetailsActionType.MainAction,
26380
+ nationalPlanObjective: "",
26381
+ kpi: "",
26382
+ ministryName: loginMinistry,
26383
+ periodId: periodId,
26384
+ status: NdcDetailsActionStatus.New,
26385
+ };
26386
+ setEditingKey(nextAvailableActionId);
26387
+ setNextAvailableActionId(function (value) { return value + 1; });
26388
+ setNdcDetailsData(function (ndcDetailsData) { return __spreadArray(__spreadArray([], ndcDetailsData, true), [
26389
+ newData_1,
26390
+ ], false); });
26391
+ setTableKey(function (key) { return key + 1; });
26426
26392
  }
26393
+ return [2 /*return*/];
26427
26394
  });
26428
26395
  });
26429
26396
  }
26430
26397
  var components = {
26431
26398
  body: {
26432
- row: EditableRow,
26433
26399
  cell: EditableCell,
26434
26400
  },
26435
26401
  };
@@ -26460,22 +26426,64 @@ var NdcDetailsComponent = function (props) {
26460
26426
  return [2 /*return*/];
26461
26427
  });
26462
26428
  }); };
26429
+ var onMainTableRowExpand = function (expanded, record) {
26430
+ var keys = [];
26431
+ if (expanded) {
26432
+ keys.push(record.id);
26433
+ }
26434
+ setExpandedRowKeys(keys);
26435
+ var subNdcDetails = ndcDetailsData.filter(function (ndcDetail) {
26436
+ return (ndcDetail.parentActionId === record.id &&
26437
+ ndcDetail.actionType === NdcDetailsActionType.SubAction);
26438
+ });
26439
+ var emptySubNdcRow = {
26440
+ id: nextAvailableActionId,
26441
+ actionType: NdcDetailsActionType.SubAction,
26442
+ nationalPlanObjective: "",
26443
+ kpi: "",
26444
+ ministryName: loginMinistry,
26445
+ status: NdcDetailsActionStatus.New,
26446
+ parentActionId: record.id,
26447
+ };
26448
+ setEditingKey(nextAvailableActionId);
26449
+ setNextAvailableActionId(function (value) { return value + 1; });
26450
+ form.setFieldsValue({
26451
+ nationalPlanObjective: "",
26452
+ kpi: "",
26453
+ });
26454
+ setSubNdcDetailsForPeriod(__spreadArray(__spreadArray([], subNdcDetails, true), [emptySubNdcRow], false));
26455
+ };
26463
26456
  function ndcDetailsTableContent() {
26464
26457
  return (React.createElement("div", null,
26465
26458
  React.createElement(Row, null,
26466
26459
  React.createElement(Col, { span: 24 },
26467
- React.createElement(Table, { key: tableKey, rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: ndcMainDetailsForPeriod, columns: columns, expandable: {
26468
- expandedRowRender: function (record) { return getSubNdcActionContent(record); },
26469
- indentSize: 0,
26470
- //defaultExpandedRowKeys: [parseInt(selectedNdcDetail.current.id)],
26471
- }, footer: function () {
26472
- return isGovernmentUser &&
26473
- !selectedPeriod.finalized && (React.createElement(Row, { justify: "center" },
26474
- React.createElement(Button, { onClick: onClickedAddNewNdcDetail, type: "default", style: {
26475
- marginBottom: 16,
26476
- width: "100%",
26477
- } }, t("ndc:addNdcAction"))));
26478
- } }))),
26460
+ React.createElement(Form, { form: form, component: false },
26461
+ React.createElement(Table, { key: tableKey, rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: ndcMainDetailsForPeriod, columns: columns, expandedRowKeys: expandedRowKeys, onExpand: onMainTableRowExpand, expandable: {
26462
+ expandedRowRender: function (record) { return getSubNdcActionContent(record); },
26463
+ indentSize: 0,
26464
+ //defaultExpandedRowKeys: [parseInt(selectedNdcDetail.current.id)],
26465
+ }, onRow: function (record, rowIndex) {
26466
+ return {
26467
+ onClick: function () {
26468
+ if (record.id && isMainNdcActionsEditable && !isEditing(record)) {
26469
+ form.setFieldsValue(__assign({}, record));
26470
+ setEditingKey(record.id);
26471
+ }
26472
+ },
26473
+ onMouseLeave: function () {
26474
+ if (isEditing(record)) {
26475
+ handleSave(record);
26476
+ }
26477
+ },
26478
+ };
26479
+ }, footer: function () {
26480
+ return isGovernmentUser &&
26481
+ !selectedPeriod.finalized && (React.createElement(Row, { justify: "center" },
26482
+ React.createElement(Button, { onClick: onClickedAddNewNdcDetail, type: "default", style: {
26483
+ marginBottom: 16,
26484
+ width: "100%",
26485
+ } }, t("ndc:addNdcAction"))));
26486
+ } })))),
26479
26487
  isGovernmentUser && !selectedPeriod.finalized ? (React.createElement(Row, { justify: "end" },
26480
26488
  React.createElement(Button, { className: "mg-left-1", type: "primary", onClick: onClickedDeletePeriod, htmlType: "submit", loading: loading }, t("ndc:delete")),
26481
26489
  React.createElement(Button, { className: "mg-left-1", type: "primary", onClick: onClickedFinalizePeriod, htmlType: "submit", loading: loading }, t("ndc:finalize")))) : ("")));
@@ -26535,7 +26543,21 @@ var NdcDetailsComponent = function (props) {
26535
26543
  }
26536
26544
  function getSubNdcActionContent(record) {
26537
26545
  selectedNdcDetail.current = record;
26538
- return (React.createElement(Table, { rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getSubNdcDetailsForPeriod(record.id), columns: columns, showHeader: false, pagination: false }));
26546
+ return (React.createElement(Table, { rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: subNdcDetailsForPeriod, onRow: function (record, rowIndex) {
26547
+ return {
26548
+ onClick: function () {
26549
+ if (record.id && isSubNdcActionsEditable(record) && !isEditing(record)) {
26550
+ form.setFieldsValue(__assign({}, record));
26551
+ setEditingKey(record.id);
26552
+ }
26553
+ },
26554
+ onMouseLeave: function () {
26555
+ if (isEditing(record)) {
26556
+ handleSave(record);
26557
+ }
26558
+ },
26559
+ };
26560
+ }, columns: columns, showHeader: false, pagination: false }));
26539
26561
  }
26540
26562
  var onTabChange = function (key) {
26541
26563
  var selectedPeriod = periodItems.find(function (item) { return item.key === key; });
@@ -26554,7 +26576,6 @@ var NdcDetailsComponent = function (props) {
26554
26576
  })];
26555
26577
  case 1:
26556
26578
  response = _a.sent();
26557
- console.log("response", response);
26558
26579
  return [3 /*break*/, 8];
26559
26580
  case 2:
26560
26581
  if (!(actionInfo.action === "Reject")) return [3 /*break*/, 4];
@@ -26563,7 +26584,6 @@ var NdcDetailsComponent = function (props) {
26563
26584
  })];
26564
26585
  case 3:
26565
26586
  response = _a.sent();
26566
- console.log("response", response);
26567
26587
  return [3 /*break*/, 8];
26568
26588
  case 4:
26569
26589
  if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 6];
@@ -26572,7 +26592,6 @@ var NdcDetailsComponent = function (props) {
26572
26592
  })];
26573
26593
  case 5:
26574
26594
  response = _a.sent();
26575
- console.log("response", response);
26576
26595
  if (response) {
26577
26596
  fetchNdcDetailPeriods();
26578
26597
  }
@@ -26635,13 +26654,15 @@ var NdcDetailsComponent = function (props) {
26635
26654
  });
26636
26655
  }); };
26637
26656
  var fetchNdcDetailActions = function () { return __awaiter(void 0, void 0, void 0, function () {
26638
- var response;
26657
+ var response, maxActionId;
26639
26658
  return __generator(this, function (_a) {
26640
26659
  switch (_a.label) {
26641
26660
  case 0: return [4 /*yield*/, get("national/programme/queryNdcDetailsAction")];
26642
26661
  case 1:
26643
26662
  response = _a.sent();
26644
26663
  if (response && response.data) {
26664
+ maxActionId = Math.max.apply(Math, response.data.map(function (item) { return item.id; }));
26665
+ setNextAvailableActionId(maxActionId + 1);
26645
26666
  setNdcDetailsData(response.data);
26646
26667
  }
26647
26668
  return [2 /*return*/];
@@ -26655,7 +26676,6 @@ var NdcDetailsComponent = function (props) {
26655
26676
  case 0: return [4 /*yield*/, get("national/organisation/getMinistries")];
26656
26677
  case 1:
26657
26678
  response = _a.sent();
26658
- console.log("fetchMinistries", response);
26659
26679
  if (response && response.data) {
26660
26680
  ministryOrgDetails = response.data.map(function (value) {
26661
26681
  return {