@undp/carbon-library 1.0.151 → 1.0.152-CARBON-343.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,21 +1,20 @@
1
- import React from 'react';
2
- interface Item {
1
+ import React from "react";
2
+ type NdcDetail = {
3
3
  key: string;
4
- name: string;
5
- age: string;
6
- address: string;
7
- }
8
- interface EditableRowProps {
4
+ startDate: Date;
5
+ endDate: Date;
6
+ nationalPlanObj: string;
7
+ kpi: number;
8
+ subNdcDetails?: [];
9
+ };
10
+ interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
11
+ editing: boolean;
12
+ dataIndex: string;
13
+ title: any;
14
+ inputType: "number" | "text";
15
+ record: NdcDetail;
9
16
  index: number;
10
- }
11
- export declare const EditableRow: React.FC<EditableRowProps>;
12
- interface EditableCellProps {
13
- title: React.ReactNode;
14
- editable: boolean;
15
17
  children: React.ReactNode;
16
- dataIndex: keyof Item;
17
- record: Item;
18
- handleSave: (record: Item) => void;
19
18
  }
20
19
  export declare const EditableCell: React.FC<EditableCellProps>;
21
20
  export {};
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, EyeInvisibleOutlined, GlobalOutlined, FlagOutlined, LineChartOutlined, LikeOutlined, DislikeOutlined } from '@ant-design/icons';
2
- import { Input, Radio, Space, Row, Col, Button, Dropdown, Table, Empty, message, Form, Steps, Upload, Tooltip, Select, Modal, Alert, Skeleton, Card, Tag, Checkbox, DatePicker, InputNumber, Popover, List, Typography, Spin, Tabs, Progress } from 'antd';
3
- import React, { useState, useEffect, useRef, useContext } from 'react';
2
+ import { Input, Radio, Space, Row, Col, Button, Dropdown, Table, Empty, message, Form, Steps, Upload, Tooltip, Select, Modal, Alert, Skeleton, Card, Tag, Checkbox, DatePicker, InputNumber, Popover, List, Typography, Spin, Tabs, Progress, Popconfirm } from 'antd';
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';
@@ -24435,65 +24435,26 @@ var RegistryDashboardComponent = function (props) {
24435
24435
  lastUpdateTransferLocations))))))))) : ("")));
24436
24436
  };
24437
24437
 
24438
- var EditableContext = React.createContext(null);
24439
- var EditableRow = function (_a) {
24440
- _a.index; var props = __rest(_a, ["index"]);
24441
- var form = Form.useForm()[0];
24442
- return (React.createElement(Form, { form: form, component: false },
24443
- React.createElement(EditableContext.Provider, { value: form },
24444
- React.createElement("tr", __assign({}, props)))));
24445
- };
24438
+ React.createContext(null);
24446
24439
  var EditableCell = function (_a) {
24447
- var title = _a.title, editable = _a.editable, children = _a.children, dataIndex = _a.dataIndex, record = _a.record, handleSave = _a.handleSave, restProps = __rest(_a, ["title", "editable", "children", "dataIndex", "record", "handleSave"]);
24448
- var _b = useState(false), editing = _b[0], setEditing = _b[1];
24449
- var inputRef = useRef(null);
24450
- var form = useContext(EditableContext);
24451
- useEffect(function () {
24452
- if (editing) {
24453
- inputRef.current.focus();
24454
- }
24455
- }, [editing]);
24456
- var toggleEdit = function () {
24457
- var _a;
24458
- setEditing(!editing);
24459
- form.setFieldsValue((_a = {}, _a[dataIndex] = record[dataIndex], _a));
24460
- };
24461
- var save = function () { return __awaiter(void 0, void 0, void 0, function () {
24462
- var values, errInfo_1;
24463
- return __generator(this, function (_a) {
24464
- switch (_a.label) {
24465
- case 0:
24466
- _a.trys.push([0, 2, , 3]);
24467
- return [4 /*yield*/, form.validateFields()];
24468
- case 1:
24469
- values = _a.sent();
24470
- toggleEdit();
24471
- handleSave(__assign(__assign({}, record), values));
24472
- return [3 /*break*/, 3];
24473
- case 2:
24474
- errInfo_1 = _a.sent();
24475
- console.log('Save failed:', errInfo_1);
24476
- return [3 /*break*/, 3];
24477
- case 3: return [2 /*return*/];
24478
- }
24479
- });
24480
- }); };
24481
- var childNode = children;
24482
- if (editable) {
24483
- childNode = editing ? (React.createElement(Form.Item, { style: { margin: 0 }, name: dataIndex, rules: [
24484
- {
24485
- required: true,
24486
- message: "".concat(title, " is required."),
24487
- },
24488
- ] },
24489
- React.createElement(Input, { ref: inputRef, onPressEnter: save, onBlur: save }))) : (React.createElement("div", { className: "editable-cell-value-wrap", style: { paddingRight: 24 }, onClick: toggleEdit }, children));
24490
- }
24491
- return React.createElement("td", __assign({}, restProps), childNode);
24440
+ var editing = _a.editing, dataIndex = _a.dataIndex, title = _a.title, inputType = _a.inputType; _a.record; _a.index; var children = _a.children, restProps = __rest(_a, ["editing", "dataIndex", "title", "inputType", "record", "index", "children"]);
24441
+ var inputNode = inputType === "number" ? React.createElement(InputNumber, null) : React.createElement(Input, null);
24442
+ return (React.createElement("td", __assign({}, restProps), editing ? (React.createElement(Form.Item, { name: dataIndex, style: { margin: 0 }, rules: [
24443
+ {
24444
+ required: true,
24445
+ message: "Please Input ".concat(title, "!"),
24446
+ },
24447
+ ] }, inputNode)) : (children)));
24492
24448
  };
24493
24449
 
24494
24450
  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";
24495
24451
  styleInject(css_248z$4);
24496
24452
 
24453
+ var NdcActionType;
24454
+ (function (NdcActionType) {
24455
+ NdcActionType[NdcActionType["main"] = 0] = "main";
24456
+ NdcActionType[NdcActionType["sub"] = 1] = "sub";
24457
+ })(NdcActionType || (NdcActionType = {}));
24497
24458
  var NdcDetailsComponent = function (props) {
24498
24459
  var t = props.t; props.useConnection; var useUserContext = props.useUserContext;
24499
24460
  var RangePicker = DatePicker.RangePicker;
@@ -24506,7 +24467,17 @@ var NdcDetailsComponent = function (props) {
24506
24467
  var addedNdcDetailId = useRef(0);
24507
24468
  var selectedNdcDetail = useRef({});
24508
24469
  var _e = useState(0), tableKey = _e[0], setTableKey = _e[1];
24470
+ var form = Form.useForm()[0];
24471
+ var _f = useState(""), editingKey = _f[0], setEditingKey = _f[1];
24509
24472
  var userInfoState = useUserContext().userInfoState;
24473
+ var isEditing = function (record) { return record.key === editingKey; };
24474
+ var onEditRow = function (record) {
24475
+ form.setFieldsValue(__assign({ nationalPlanObj: "", kpi: "", ministry: "" }, record));
24476
+ setEditingKey(record.key);
24477
+ };
24478
+ var onEditCancel = function () {
24479
+ setEditingKey("");
24480
+ };
24510
24481
  var isAddRangeVisible = function () {
24511
24482
  return (((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY ||
24512
24483
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT) &&
@@ -24516,20 +24487,66 @@ var NdcDetailsComponent = function (props) {
24516
24487
  return ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
24517
24488
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly);
24518
24489
  };
24519
- var isAddSubNdcActionVisible = function () {
24520
- return ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY &&
24521
- (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly);
24522
- };
24523
24490
  var inRange = function (num, min, max) {
24524
24491
  return num >= min && num <= max;
24525
24492
  };
24526
- var handleSave = function (row) {
24527
- var newData = __spreadArray([], ndcDetailsData, true);
24528
- var index = newData.findIndex(function (item) { return row.key === item.key; });
24529
- var item = newData[index];
24530
- newData.splice(index, 1, __assign(__assign({}, item), row));
24531
- setNdcDetailsData(newData);
24532
- };
24493
+ var onHandleSave = function (record) { return __awaiter(void 0, void 0, void 0, function () {
24494
+ var updatedNdcDetails, editedData, index, parentIndex, parentItem, itemIndex, errInfo_1;
24495
+ return __generator(this, function (_a) {
24496
+ switch (_a.label) {
24497
+ case 0:
24498
+ _a.trys.push([0, 2, , 3]);
24499
+ updatedNdcDetails = __spreadArray([], ndcDetailsData, true);
24500
+ return [4 /*yield*/, form.validateFields()];
24501
+ case 1:
24502
+ editedData = (_a.sent());
24503
+ if (record) {
24504
+ if (record.type === NdcActionType.main) {
24505
+ index = updatedNdcDetails.findIndex(function (item) { return record.key === item.key; });
24506
+ updatedNdcDetails.splice(index, 1, __assign(__assign({}, record), editedData));
24507
+ setNdcDetailsData(updatedNdcDetails);
24508
+ }
24509
+ else {
24510
+ parentIndex = updatedNdcDetails.findIndex(function (item) { return record.ndcActionId === item.key; });
24511
+ parentItem = updatedNdcDetails[parentIndex];
24512
+ if (parentItem) {
24513
+ if (parentItem.subNdcDetails) {
24514
+ itemIndex = parentItem.subNdcDetails.findIndex(function (item) { return record.key === item.key; });
24515
+ if (itemIndex !== -1) {
24516
+ parentItem.subNdcDetails.splice(itemIndex, 1, __assign(__assign({}, record), editedData));
24517
+ }
24518
+ if (itemIndex + 1 === parentItem.subNdcDetails.length) {
24519
+ parentItem.subNdcDetails.push({
24520
+ key: ++addedNdcDetailId.current,
24521
+ ndcActionId: parentItem.key,
24522
+ type: NdcActionType.sub,
24523
+ startDate: new Date("2019-03-25"),
24524
+ endDate: new Date("2020-03-25"),
24525
+ nationalPlanObj: "",
24526
+ kpi: "",
24527
+ ministry: "",
24528
+ });
24529
+ }
24530
+ }
24531
+ updatedNdcDetails.splice(parentIndex, 1, __assign({}, parentItem));
24532
+ setNdcDetailsData(updatedNdcDetails);
24533
+ }
24534
+ }
24535
+ setEditingKey("");
24536
+ setTableKey(function (key) { return key + 1; });
24537
+ }
24538
+ else {
24539
+ throw new Error("Save failed");
24540
+ }
24541
+ return [3 /*break*/, 3];
24542
+ case 2:
24543
+ errInfo_1 = _a.sent();
24544
+ console.log("Validate Failed:", errInfo_1);
24545
+ return [3 /*break*/, 3];
24546
+ case 3: return [2 /*return*/];
24547
+ }
24548
+ });
24549
+ }); };
24533
24550
  var getNdcDetailsForPeriod = function () {
24534
24551
  var range = selectedTab.split("-");
24535
24552
  if (range.length > 1) {
@@ -24558,6 +24575,9 @@ var NdcDetailsComponent = function (props) {
24558
24575
  key: "nationalPlanObj",
24559
24576
  align: "left",
24560
24577
  editable: true,
24578
+ width: 800,
24579
+ render: function (_, record) { return (React.createElement(React.Fragment, null, record.nationalPlanObj ? (React.createElement(Space, { size: "middle" },
24580
+ React.createElement("span", null, record.nationalPlanObj))) : (React.createElement("input", { className: "ant-input", disabled: true, type: "text" })))); },
24561
24581
  },
24562
24582
  {
24563
24583
  title: t("ndc:ndcColumnsKpi"),
@@ -24565,6 +24585,9 @@ var NdcDetailsComponent = function (props) {
24565
24585
  key: "kpi",
24566
24586
  align: "left",
24567
24587
  editable: true,
24588
+ width: 100,
24589
+ render: function (_, record) { return (React.createElement(React.Fragment, null, record.nationalPlanObj ? (React.createElement(Space, { size: "middle" },
24590
+ React.createElement("span", null, record.kpi))) : (React.createElement("input", { className: "ant-input", disabled: true, type: "text" })))); },
24568
24591
  },
24569
24592
  {
24570
24593
  title: "Ministry",
@@ -24572,6 +24595,19 @@ var NdcDetailsComponent = function (props) {
24572
24595
  key: "ministry",
24573
24596
  align: "left",
24574
24597
  editable: true,
24598
+ render: function (_, record) { return (React.createElement(React.Fragment, null, record.nationalPlanObj ? (React.createElement(Space, { size: "middle" },
24599
+ React.createElement("span", null, record.ministry))) : (React.createElement("input", { className: "ant-input", disabled: true, type: "text" })))); },
24600
+ },
24601
+ {
24602
+ title: "operation",
24603
+ dataIndex: "operation",
24604
+ render: function (_, record) {
24605
+ var editable = isEditing(record);
24606
+ return editable ? (React.createElement("span", null,
24607
+ React.createElement(Typography.Link, { onClick: function () { return onHandleSave(record); }, style: { marginRight: 8 } }, "Save"),
24608
+ React.createElement(Popconfirm, { title: "Sure to cancel?", onConfirm: onEditCancel },
24609
+ React.createElement("a", null, "Cancel")))) : (React.createElement(Typography.Link, { disabled: editingKey !== "", onClick: function () { return onEditRow(record); } }, "Edit"));
24610
+ },
24575
24611
  },
24576
24612
  ];
24577
24613
  var columns = defaultColumns.map(function (col) {
@@ -24583,73 +24619,42 @@ var NdcDetailsComponent = function (props) {
24583
24619
  editable: col.editable,
24584
24620
  dataIndex: col.dataIndex,
24585
24621
  title: col.title,
24586
- handleSave: handleSave,
24622
+ editing: isEditing(record),
24587
24623
  }); } });
24588
24624
  });
24589
24625
  function onAddNewNdcDetail() {
24590
24626
  var range = selectedTab.split("-");
24591
- addedNdcDetailId.current = addedNdcDetailId.current + 1;
24627
+ var ndcActionId = ++addedNdcDetailId.current;
24592
24628
  var newData = {
24593
- key: addedNdcDetailId.current,
24629
+ key: ndcActionId,
24630
+ type: NdcActionType.main,
24594
24631
  startDate: new Date("".concat(Number(range[0]), "-01-24 23:12:00")),
24595
24632
  endDate: new Date("".concat(Number(range[0]), "-12-24 23:12:00")),
24596
24633
  nationalPlanObj: t("ndc:enterNewPlanTxt"),
24597
24634
  kpi: 0,
24598
24635
  ministry: "Please add the Ministry name",
24636
+ subNdcDetails: [
24637
+ {
24638
+ key: ++addedNdcDetailId.current,
24639
+ ndcActionId: ndcActionId,
24640
+ type: NdcActionType.sub,
24641
+ startDate: new Date("2019-03-25"),
24642
+ endDate: new Date("2020-03-25"),
24643
+ nationalPlanObj: "",
24644
+ kpi: "",
24645
+ ministry: "",
24646
+ },
24647
+ ],
24599
24648
  };
24600
24649
  setNdcDetailsData(__spreadArray(__spreadArray([], ndcDetailsData, true), [newData], false));
24601
24650
  }
24602
- function onAddNewSubNdcDetail() {
24603
- var range = selectedTab.split("-");
24604
- var ndcDetail = ndcDetailsData.find(function (item) { return item.key === selectedNdcDetail.current.key; });
24605
- var ndcDetailItemIndex = ndcDetailsData.findIndex(function (item) { return item.key === selectedNdcDetail.current.key; });
24606
- if (ndcDetail) {
24607
- addedNdcDetailId.current = addedNdcDetailId.current + 1;
24608
- var newData = {
24609
- key: addedNdcDetailId.current,
24610
- startDate: new Date("".concat(Number(range[0]), "-01-24 23:12:00")),
24611
- endDate: new Date("".concat(Number(range[0]), "-12-24 23:12:00")),
24612
- nationalPlanObj: t("ndc:enterNewPlanTxt"),
24613
- kpi: 0,
24614
- ministry: "Please add the Ministry name",
24615
- };
24616
- if (!ndcDetail.subNdcDetails) {
24617
- ndcDetail.subNdcDetails = [];
24618
- }
24619
- ndcDetail.subNdcDetails.push(newData);
24620
- }
24621
- ndcDetailsData[ndcDetailItemIndex] = ndcDetail;
24622
- setNdcDetailsData(ndcDetailsData);
24623
- setTableKey(function (key) { return key + 1; });
24624
- }
24625
24651
  var components = {
24626
24652
  body: {
24627
- row: EditableRow,
24628
24653
  cell: EditableCell,
24629
24654
  },
24630
24655
  };
24631
- //commented because rendering issue
24632
24656
  function ndcDetailsTableContent() {
24633
- return (React.createElement("div", null)
24634
- // <div>
24635
- // <Button
24636
- // onClick={onAddNewNdcDetail}
24637
- // type="primary"
24638
- // style={{
24639
- // marginBottom: 16,
24640
- // }}
24641
- // >
24642
- // Add a row
24643
- // </Button>
24644
- // <Table
24645
- // components={components}
24646
- // rowClassName={() => 'editable-row'}
24647
- // bordered
24648
- // dataSource={ndcDetailsData}
24649
- // columns={columns}
24650
- // />
24651
- // </div>
24652
- );
24657
+ return React.createElement("div", null);
24653
24658
  }
24654
24659
  var onCancelPeriod = function () { };
24655
24660
  var onAddNewPeriod = function () {
@@ -24702,13 +24707,7 @@ var NdcDetailsComponent = function (props) {
24702
24707
  }
24703
24708
  function getSubNdcActionContent(record) {
24704
24709
  selectedNdcDetail.current = record;
24705
- return (React.createElement(Table, { components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getSubNdcDetails(record.key), columns: columns, showHeader: false, pagination: false, footer: function () {
24706
- return isAddSubNdcActionVisible() && (React.createElement(Row, { justify: "center" },
24707
- React.createElement(Button, { onClick: onAddNewSubNdcDetail, type: "default", style: {
24708
- marginBottom: 16,
24709
- width: "100%",
24710
- } }, t("ndc:addSubNdcAction"))));
24711
- } }));
24710
+ return (React.createElement(Table, { components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getSubNdcDetails(record.key), columns: columns, showHeader: false, pagination: false }));
24712
24711
  }
24713
24712
  var onTabChange = function (key) {
24714
24713
  setSelectedTab(key);
@@ -24717,53 +24716,160 @@ var NdcDetailsComponent = function (props) {
24717
24716
  var defaultNdcDetails = [
24718
24717
  {
24719
24718
  key: 1,
24719
+ type: NdcActionType.main,
24720
24720
  startDate: new Date("2019-03-25"),
24721
24721
  endDate: new Date("2020-03-25"),
24722
24722
  nationalPlanObj: "Enhance value addition in key growth opportunities",
24723
24723
  kpi: 25,
24724
- ministry: "Ministry of Agriculture, Water and Forestry (MAWF)",
24724
+ ministry: "Ministry of Environment",
24725
24725
  subNdcDetails: [
24726
24726
  {
24727
24727
  key: 6,
24728
+ ndcActionId: 1,
24729
+ type: NdcActionType.sub,
24728
24730
  startDate: new Date("2019-03-25"),
24729
24731
  endDate: new Date("2020-03-25"),
24730
24732
  nationalPlanObj: "Enhance value addition in key growth opportunities sub details",
24731
24733
  kpi: 25,
24732
24734
  ministry: "Ministry of Agriculture, Water and Forestry (MAWF)",
24733
24735
  },
24736
+ {
24737
+ key: 7,
24738
+ ndcActionId: 1,
24739
+ type: NdcActionType.sub,
24740
+ startDate: new Date("2019-03-25"),
24741
+ endDate: new Date("2020-03-25"),
24742
+ nationalPlanObj: "",
24743
+ kpi: "",
24744
+ ministry: "",
24745
+ },
24734
24746
  ],
24735
24747
  },
24736
24748
  {
24737
24749
  key: 2,
24750
+ type: NdcActionType.main,
24738
24751
  startDate: new Date("2019-03-25"),
24739
24752
  endDate: new Date("2019-08-25"),
24740
24753
  nationalPlanObj: "Strengthen the private sector to create 10,000 jobs",
24741
24754
  kpi: 10500,
24742
- ministry: "Ministry of Tourism (MoT)",
24755
+ ministry: "Ministry of Environment",
24756
+ subNdcDetails: [
24757
+ {
24758
+ key: 8,
24759
+ ndcActionId: 2,
24760
+ type: NdcActionType.sub,
24761
+ startDate: new Date("2019-03-25"),
24762
+ endDate: new Date("2020-03-25"),
24763
+ nationalPlanObj: "",
24764
+ kpi: "",
24765
+ ministry: "",
24766
+ },
24767
+ ],
24768
+ },
24769
+ {
24770
+ key: 12,
24771
+ type: NdcActionType.main,
24772
+ startDate: new Date("2019-03-25"),
24773
+ endDate: new Date("2019-08-25"),
24774
+ nationalPlanObj: "Other",
24775
+ kpi: 10500,
24776
+ ministry: "Ministry of Environment",
24777
+ subNdcDetails: [
24778
+ {
24779
+ key: 8,
24780
+ ndcActionId: 12,
24781
+ type: NdcActionType.sub,
24782
+ startDate: new Date("2019-03-25"),
24783
+ endDate: new Date("2020-03-25"),
24784
+ nationalPlanObj: "",
24785
+ kpi: "",
24786
+ ministry: "",
24787
+ },
24788
+ ],
24743
24789
  },
24744
24790
  {
24745
24791
  key: 3,
24792
+ type: NdcActionType.main,
24746
24793
  startDate: new Date("2021-03-25"),
24747
24794
  endDate: new Date("2022-03-25"),
24748
24795
  nationalPlanObj: "Consolidate and increase the stock and quality of productive infrastructure by 50%",
24749
24796
  kpi: 48,
24750
- ministry: "Ministry of Education, Arts and Culture (MoE)",
24797
+ ministry: "Ministry of Environment",
24798
+ subNdcDetails: [
24799
+ {
24800
+ key: 9,
24801
+ ndcActionId: 3,
24802
+ type: NdcActionType.sub,
24803
+ startDate: new Date("2019-03-25"),
24804
+ endDate: new Date("2020-03-25"),
24805
+ nationalPlanObj: "",
24806
+ kpi: "",
24807
+ ministry: "",
24808
+ },
24809
+ ],
24751
24810
  },
24752
24811
  {
24753
24812
  key: 4,
24813
+ type: NdcActionType.main,
24754
24814
  startDate: new Date("2022-03-25"),
24755
24815
  endDate: new Date("2022-05-25"),
24756
24816
  nationalPlanObj: "Enhance the productivity and social wellbeing of the population",
24757
24817
  kpi: 20,
24758
- ministry: "Ministry of Environment, Forestry and Tourism (MEFT)",
24818
+ ministry: "Ministry of Environment",
24819
+ subNdcDetails: [
24820
+ {
24821
+ key: 10,
24822
+ ndcActionId: 4,
24823
+ type: NdcActionType.sub,
24824
+ startDate: new Date("2019-03-25"),
24825
+ endDate: new Date("2020-03-25"),
24826
+ nationalPlanObj: "",
24827
+ kpi: "",
24828
+ ministry: "",
24829
+ },
24830
+ ],
24759
24831
  },
24760
24832
  {
24761
24833
  key: 5,
24834
+ type: NdcActionType.main,
24762
24835
  startDate: new Date("2022-03-25"),
24763
24836
  endDate: new Date("2023-03-25"),
24764
24837
  nationalPlanObj: "Strengthen the role of the state in guiding and facilitating development",
24765
24838
  kpi: 10,
24766
- ministry: "Ministry of Tourism (MoT)",
24839
+ ministry: "Ministry of Environment",
24840
+ subNdcDetails: [
24841
+ {
24842
+ key: 11,
24843
+ ndcActionId: 5,
24844
+ type: NdcActionType.sub,
24845
+ startDate: new Date("2019-03-25"),
24846
+ endDate: new Date("2020-03-25"),
24847
+ nationalPlanObj: "",
24848
+ kpi: "",
24849
+ ministry: "",
24850
+ },
24851
+ ],
24852
+ },
24853
+ {
24854
+ key: 13,
24855
+ type: NdcActionType.main,
24856
+ startDate: new Date("2022-03-25"),
24857
+ endDate: new Date("2023-03-25"),
24858
+ nationalPlanObj: "Other",
24859
+ kpi: 10,
24860
+ ministry: "Ministry of Environment",
24861
+ subNdcDetails: [
24862
+ {
24863
+ key: 11,
24864
+ ndcActionId: 13,
24865
+ type: NdcActionType.sub,
24866
+ startDate: new Date("2019-03-25"),
24867
+ endDate: new Date("2020-03-25"),
24868
+ nationalPlanObj: "",
24869
+ kpi: "",
24870
+ ministry: "",
24871
+ },
24872
+ ],
24767
24873
  },
24768
24874
  ];
24769
24875
  var initialPeriods = [
@@ -24806,17 +24912,18 @@ var NdcDetailsComponent = function (props) {
24806
24912
  React.createElement(Tabs, { centered: false, defaultActiveKey: "1", items: periodItems, activeKey: selectedTab, onChange: onTabChange })),
24807
24913
  selectedTab !== "add_new" && (React.createElement("div", null,
24808
24914
  React.createElement("div", null,
24809
- React.createElement(Table, { key: tableKey, components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getNdcDetailsForPeriod(), columns: columns, expandable: {
24810
- expandedRowRender: function (record) { return getSubNdcActionContent(record); },
24811
- indentSize: 0,
24812
- defaultExpandedRowKeys: [selectedNdcDetail.current.key],
24813
- }, footer: function () {
24814
- return isAddNdcActionVisible() && (React.createElement(Row, { justify: "center" },
24815
- React.createElement(Button, { onClick: onAddNewNdcDetail, type: "default", style: {
24816
- marginBottom: 16,
24817
- width: "100%",
24818
- } }, t("ndc:addNdcAction"))));
24819
- } }))))));
24915
+ React.createElement(Form, { form: form, component: false },
24916
+ React.createElement(Table, { key: tableKey, components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getNdcDetailsForPeriod(), columns: columns, expandable: {
24917
+ expandedRowRender: function (record) { return getSubNdcActionContent(record); },
24918
+ indentSize: 0,
24919
+ defaultExpandedRowKeys: [selectedNdcDetail.current.key],
24920
+ }, footer: function () {
24921
+ return isAddNdcActionVisible() && (React.createElement(Row, { justify: "center" },
24922
+ React.createElement(Button, { onClick: onAddNewNdcDetail, type: "default", style: {
24923
+ marginBottom: 16,
24924
+ width: "100%",
24925
+ } }, t("ndc:addNdcAction"))));
24926
+ } })))))));
24820
24927
  };
24821
24928
 
24822
24929
  var ImgWithFallback = function (_a) {