@undp/carbon-library 1.0.274-CARBON-363.2 → 1.0.274-CARBON-406.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +541 -704
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/Components/Common/AntComponents/antTableComponents.d.ts +6 -9
- package/dist/esm/index.js +543 -706
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/Components/Common/AntComponents/antTableComponents.d.ts +6 -9
- package/dist/locales/i18n/ndc/en.json +2 -22
- package/package.json +1 -1
- package/dist/cjs/types/Definitions/Definitions/ndcDetails.definitions.d.ts +0 -42
- package/dist/esm/types/Definitions/Definitions/ndcDetails.definitions.d.ts +0 -42
package/dist/esm/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { PlusOutlined, FilterOutlined, BankOutlined, SafetyOutlined, AuditOutlined, ExperimentOutlined, UploadOutlined, UserOutlined, MinusCircleOutlined, StarOutlined, ToolOutlined, EyeOutlined, SearchOutlined, EllipsisOutlined, EditOutlined, DeleteOutlined, FileAddOutlined, CheckCircleOutlined, ExclamationCircleOutlined, BookOutlined, CaretDownOutlined,
|
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
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 } from 'react';
|
3
|
+
import React, { useState, useEffect, useRef, useContext } 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';
|
@@ -2027,7 +2027,7 @@ var NdcActionStatus;
|
|
2027
2027
|
NdcActionStatus["PENDING"] = "Pending";
|
2028
2028
|
NdcActionStatus["APPROVED"] = "Approved";
|
2029
2029
|
})(NdcActionStatus || (NdcActionStatus = {}));
|
2030
|
-
var getNdcActionStatusEnumVal
|
2030
|
+
var getNdcActionStatusEnumVal = function (value) {
|
2031
2031
|
var index = Object.keys(NdcActionStatus).indexOf(value);
|
2032
2032
|
if (index < 0) {
|
2033
2033
|
return value;
|
@@ -2035,7 +2035,7 @@ var getNdcActionStatusEnumVal$1 = function (value) {
|
|
2035
2035
|
return Object.values(NdcActionStatus)[index];
|
2036
2036
|
};
|
2037
2037
|
var getNdcStatusTagType = function (status) {
|
2038
|
-
switch (getNdcActionStatusEnumVal
|
2038
|
+
switch (getNdcActionStatusEnumVal(status)) {
|
2039
2039
|
case NdcActionStatus.PENDING:
|
2040
2040
|
return "processing";
|
2041
2041
|
case NdcActionStatus.APPROVED:
|
@@ -26655,785 +26655,622 @@ var RegistryDashboardComponent = function (props) {
|
|
26655
26655
|
lastUpdateTransferLocations))))))))) : ("")));
|
26656
26656
|
};
|
26657
26657
|
|
26658
|
-
React.createContext(null);
|
26658
|
+
var EditableContext = React.createContext(null);
|
26659
|
+
var EditableRow = function (_a) {
|
26660
|
+
_a.index; var props = __rest(_a, ["index"]);
|
26661
|
+
var form = Form.useForm()[0];
|
26662
|
+
return (React.createElement(Form, { form: form, component: false },
|
26663
|
+
React.createElement(EditableContext.Provider, { value: form },
|
26664
|
+
React.createElement("tr", __assign({}, props)))));
|
26665
|
+
};
|
26659
26666
|
var EditableCell = function (_a) {
|
26660
|
-
var
|
26661
|
-
var
|
26662
|
-
|
26663
|
-
|
26664
|
-
|
26665
|
-
|
26666
|
-
|
26667
|
+
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"]);
|
26668
|
+
var _b = useState(false), editing = _b[0], setEditing = _b[1];
|
26669
|
+
var inputRef = useRef(null);
|
26670
|
+
var form = useContext(EditableContext);
|
26671
|
+
useEffect(function () {
|
26672
|
+
if (editing) {
|
26673
|
+
inputRef.current.focus();
|
26674
|
+
}
|
26675
|
+
}, [editing]);
|
26676
|
+
var toggleEdit = function () {
|
26677
|
+
var _a;
|
26678
|
+
setEditing(!editing);
|
26679
|
+
form.setFieldsValue((_a = {}, _a[dataIndex] = record[dataIndex], _a));
|
26680
|
+
};
|
26681
|
+
var save = function () { return __awaiter(void 0, void 0, void 0, function () {
|
26682
|
+
var values, errInfo_1;
|
26683
|
+
return __generator(this, function (_a) {
|
26684
|
+
switch (_a.label) {
|
26685
|
+
case 0:
|
26686
|
+
_a.trys.push([0, 2, , 3]);
|
26687
|
+
return [4 /*yield*/, form.validateFields()];
|
26688
|
+
case 1:
|
26689
|
+
values = _a.sent();
|
26690
|
+
toggleEdit();
|
26691
|
+
handleSave(__assign(__assign({}, record), values));
|
26692
|
+
return [3 /*break*/, 3];
|
26693
|
+
case 2:
|
26694
|
+
errInfo_1 = _a.sent();
|
26695
|
+
console.log("Save failed:", errInfo_1);
|
26696
|
+
return [3 /*break*/, 3];
|
26697
|
+
case 3: return [2 /*return*/];
|
26698
|
+
}
|
26699
|
+
});
|
26700
|
+
}); };
|
26701
|
+
var childNode = children;
|
26702
|
+
if (editable) {
|
26703
|
+
childNode = editing ? (React.createElement(Form.Item, { style: { margin: 0 }, name: dataIndex, rules: [
|
26704
|
+
{
|
26705
|
+
required: true,
|
26706
|
+
message: "".concat(title, " is required."),
|
26707
|
+
},
|
26708
|
+
] },
|
26709
|
+
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));
|
26667
26710
|
}
|
26668
|
-
return
|
26669
|
-
{
|
26670
|
-
required: true,
|
26671
|
-
message: "".concat(title, " ").concat(t("ndc:isRequired")),
|
26672
|
-
},
|
26673
|
-
] }, inputNode)) : (children)));
|
26711
|
+
return React.createElement("td", __assign({}, restProps), childNode);
|
26674
26712
|
};
|
26675
26713
|
|
26676
|
-
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
|
26714
|
+
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";
|
26677
26715
|
styleInject(css_248z$4);
|
26678
26716
|
|
26679
|
-
var
|
26680
|
-
(function (
|
26681
|
-
|
26682
|
-
|
26683
|
-
})(
|
26684
|
-
var NdcDetailsActionStatus;
|
26685
|
-
(function (NdcDetailsActionStatus) {
|
26686
|
-
NdcDetailsActionStatus["New"] = "New";
|
26687
|
-
NdcDetailsActionStatus["Pending"] = "Pending";
|
26688
|
-
NdcDetailsActionStatus["Approved"] = "Approved";
|
26689
|
-
NdcDetailsActionStatus["Rejected"] = "Rejected";
|
26690
|
-
})(NdcDetailsActionStatus || (NdcDetailsActionStatus = {}));
|
26691
|
-
var getNdcActionStatusEnumVal = function (value) {
|
26692
|
-
var index = Object.keys(NdcDetailsActionStatus).indexOf(value);
|
26693
|
-
if (index < 0) {
|
26694
|
-
return value;
|
26695
|
-
}
|
26696
|
-
return Object.values(NdcDetailsActionStatus)[index];
|
26697
|
-
};
|
26698
|
-
var getNdcActionStatusTagType = function (status) {
|
26699
|
-
switch (getNdcActionStatusEnumVal(status)) {
|
26700
|
-
case NdcDetailsActionStatus.Rejected:
|
26701
|
-
return "error";
|
26702
|
-
case NdcDetailsActionStatus.Pending:
|
26703
|
-
return "processing";
|
26704
|
-
case NdcDetailsActionStatus.Approved:
|
26705
|
-
return "success";
|
26706
|
-
default:
|
26707
|
-
return "default";
|
26708
|
-
}
|
26709
|
-
};
|
26710
|
-
|
26717
|
+
var NdcActionType;
|
26718
|
+
(function (NdcActionType) {
|
26719
|
+
NdcActionType[NdcActionType["main"] = 0] = "main";
|
26720
|
+
NdcActionType[NdcActionType["sub"] = 1] = "sub";
|
26721
|
+
})(NdcActionType || (NdcActionType = {}));
|
26711
26722
|
var NdcDetailsComponent = function (props) {
|
26712
|
-
var t = props.t
|
26723
|
+
var t = props.t; props.useConnection; var useUserContext = props.useUserContext;
|
26713
26724
|
var RangePicker = DatePicker.RangePicker;
|
26714
|
-
var _a = useState([]),
|
26715
|
-
var _b = useState(false), loading = _b[0]
|
26725
|
+
var _a = useState([]), ndcDetailsData = _a[0], setNdcDetailsData = _a[1];
|
26726
|
+
var _b = useState(false), loading = _b[0]; _b[1];
|
26727
|
+
var periodItemsRef = useRef([]);
|
26716
26728
|
var _c = useState([]), periodItems = _c[0], setPeriodItems = _c[1];
|
26717
|
-
var _d = useState(
|
26718
|
-
var
|
26729
|
+
var _d = useState("add_new"), selectedTab = _d[0], setSelectedTab = _d[1];
|
26730
|
+
var selectedPeriod = useRef({});
|
26731
|
+
var addedNdcDetailId = useRef(0);
|
26732
|
+
var selectedNdcDetail = useRef({});
|
26719
26733
|
var _e = useState(0), tableKey = _e[0], setTableKey = _e[1];
|
26720
|
-
var _f = useConnection(), get = _f.get, post = _f.post, put = _f.put;
|
26721
|
-
var _g = useState([]), ministryOrgList = _g[0], setMinistryOrgList = _g[1];
|
26722
|
-
var _h = useState({}), actionInfo = _h[0], setActionInfo = _h[1];
|
26723
|
-
var _j = useState(false), openConfirmationModal = _j[0], setOpenConfirmationModal = _j[1];
|
26724
|
-
var form = Form.useForm()[0];
|
26725
|
-
var _k = useState(-1), editingKey = _k[0], setEditingKey = _k[1];
|
26726
|
-
var _l = useState(0), nextAvailableActionId = _l[0], setNextAvailableActionId = _l[1];
|
26727
|
-
var _m = useState([]), expandedRowKeys = _m[0], setExpandedRowKeys = _m[1];
|
26728
|
-
var _o = useState([]), subNdcActionsForPeriod = _o[0], setSubNdcActionsForPeriod = _o[1];
|
26729
|
-
var isEditing = function (record) { return record.id === editingKey; };
|
26730
26734
|
var userInfoState = useUserContext().userInfoState;
|
26731
|
-
|
26732
|
-
|
26733
|
-
|
26734
|
-
setNdcSubActionsForMainAction(expandedKey);
|
26735
|
-
}
|
26736
|
-
}, ndcActionsList);
|
26737
|
-
var loginMinistry = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT
|
26738
|
-
? process.env.REACT_APP_GOVERNMENT_MINISTRY
|
26739
|
-
? process.env.REACT_APP_GOVERNMENT_MINISTRY
|
26740
|
-
: "Ministry Of Environment"
|
26741
|
-
: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY
|
26742
|
-
? userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyName
|
26743
|
-
: undefined;
|
26744
|
-
var isGovernmentUser = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
|
26745
|
-
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly;
|
26746
|
-
var isMainNdcActionsEditable = !selectedPeriod.finalized &&
|
26747
|
-
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
|
26748
|
-
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly;
|
26749
|
-
var isSubNdcActionsEditable = function (record) {
|
26750
|
-
return (!selectedPeriod.finalized &&
|
26751
|
-
record.status !== NdcDetailsActionStatus.Approved &&
|
26752
|
-
((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT ||
|
26753
|
-
((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY &&
|
26754
|
-
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyName) === record.ministryName)) &&
|
26735
|
+
var isAddRangeVisible = function () {
|
26736
|
+
return (((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY ||
|
26737
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT) &&
|
26755
26738
|
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly);
|
26756
26739
|
};
|
26757
|
-
var
|
26758
|
-
|
26759
|
-
|
26760
|
-
}
|
26761
|
-
else if (record.actionType === NdcDetailsActionType.SubAction) {
|
26762
|
-
return isSubNdcActionsEditable(record);
|
26763
|
-
}
|
26764
|
-
};
|
26765
|
-
var ndcMainDetailsForPeriod = selectedPeriod.key !== "add_new"
|
26766
|
-
? ndcActionsList.filter(function (ndcDetail) {
|
26767
|
-
return (ndcDetail.periodId === parseInt(selectedPeriod.key) &&
|
26768
|
-
ndcDetail.actionType === NdcDetailsActionType.MainAction);
|
26769
|
-
})
|
26770
|
-
: [];
|
26771
|
-
var setNdcSubActionsForMainAction = function (mainActionId) {
|
26772
|
-
var subNdcDetails = ndcActionsList.filter(function (ndcDetail) {
|
26773
|
-
return (ndcDetail.parentActionId === mainActionId &&
|
26774
|
-
ndcDetail.actionType === NdcDetailsActionType.SubAction);
|
26775
|
-
});
|
26776
|
-
var emptySubNdcRow = {
|
26777
|
-
id: nextAvailableActionId,
|
26778
|
-
actionType: NdcDetailsActionType.SubAction,
|
26779
|
-
nationalPlanObjective: "",
|
26780
|
-
kpi: "",
|
26781
|
-
ministryName: loginMinistry,
|
26782
|
-
status: NdcDetailsActionStatus.New,
|
26783
|
-
parentActionId: mainActionId,
|
26784
|
-
};
|
26785
|
-
if (!selectedPeriod.finalized) {
|
26786
|
-
subNdcDetails = __spreadArray(__spreadArray([], subNdcDetails, true), [emptySubNdcRow], false);
|
26787
|
-
setEditingKey(nextAvailableActionId);
|
26788
|
-
setNextAvailableActionId(function (value) { return value + 1; });
|
26789
|
-
form.setFieldsValue({
|
26790
|
-
nationalPlanObjective: "",
|
26791
|
-
kpi: "",
|
26792
|
-
});
|
26793
|
-
}
|
26794
|
-
setSubNdcActionsForPeriod(subNdcDetails);
|
26740
|
+
var isAddNdcActionVisible = function () {
|
26741
|
+
return ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
|
26742
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly);
|
26795
26743
|
};
|
26796
26744
|
var inRange = function (num, min, max) {
|
26797
26745
|
return num >= min && num <= max;
|
26798
26746
|
};
|
26799
|
-
|
26800
|
-
var
|
26801
|
-
|
26802
|
-
|
26803
|
-
|
26804
|
-
|
26805
|
-
|
26806
|
-
|
26807
|
-
|
26808
|
-
|
26809
|
-
|
26810
|
-
|
26811
|
-
|
26812
|
-
|
26813
|
-
|
26814
|
-
|
26815
|
-
|
26816
|
-
|
26817
|
-
|
26818
|
-
|
26819
|
-
|
26820
|
-
|
26821
|
-
|
26747
|
+
function onAddNewSubNdcDetail() {
|
26748
|
+
var range = selectedTab.split("-");
|
26749
|
+
var ndcDetail = ndcDetailsData.find(function (item) { return item.key === selectedNdcDetail.current.key; });
|
26750
|
+
var ndcDetailItemIndex = ndcDetailsData.findIndex(function (item) { return item.key === selectedNdcDetail.current.key; });
|
26751
|
+
if (ndcDetail) {
|
26752
|
+
addedNdcDetailId.current = addedNdcDetailId.current + 1;
|
26753
|
+
var newData = {
|
26754
|
+
key: addedNdcDetailId.current,
|
26755
|
+
startDate: new Date("".concat(Number(range[0]), "-01-24 23:12:00")),
|
26756
|
+
endDate: new Date("".concat(Number(range[0]), "-12-24 23:12:00")),
|
26757
|
+
ndcActionId: ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.key,
|
26758
|
+
nationalPlanObj: "",
|
26759
|
+
kpi: "",
|
26760
|
+
ministry: "",
|
26761
|
+
};
|
26762
|
+
if (!ndcDetail.subNdcDetails) {
|
26763
|
+
ndcDetail.subNdcDetails = [];
|
26764
|
+
}
|
26765
|
+
ndcDetail.subNdcDetails.push(newData);
|
26766
|
+
}
|
26767
|
+
ndcDetailsData[ndcDetailItemIndex] = ndcDetail;
|
26768
|
+
setNdcDetailsData(ndcDetailsData);
|
26769
|
+
setTableKey(function (key) { return key + 1; });
|
26770
|
+
}
|
26771
|
+
var handleSave = function (row) {
|
26772
|
+
setNdcDetailsData(function (prevData) {
|
26773
|
+
var newData = JSON.parse(JSON.stringify(prevData));
|
26774
|
+
if (row.type === NdcActionType.main) {
|
26775
|
+
var index = newData.findIndex(function (item) { return row.key === item.key; });
|
26776
|
+
if (index !== -1) {
|
26777
|
+
newData[index] = __assign(__assign({}, newData[index]), row);
|
26778
|
+
}
|
26779
|
+
}
|
26780
|
+
else {
|
26781
|
+
var parentIndex = newData.findIndex(function (item) { return row.ndcActionId === item.key; });
|
26782
|
+
var parentItem = newData[parentIndex];
|
26783
|
+
if (parentItem) {
|
26784
|
+
if (parentItem.subNdcDetails) {
|
26785
|
+
var itemIndex = parentItem.subNdcDetails.findIndex(function (item) { return row.key === item.key; });
|
26786
|
+
if (itemIndex === -1) {
|
26787
|
+
parentItem.subNdcDetails.push(row);
|
26788
|
+
}
|
26789
|
+
else {
|
26790
|
+
parentItem.subNdcDetails[itemIndex] = __assign({}, row);
|
26791
|
+
}
|
26822
26792
|
}
|
26823
26793
|
else {
|
26824
|
-
|
26794
|
+
parentItem.subNdcDetails = [row];
|
26825
26795
|
}
|
26826
|
-
|
26827
|
-
|
26828
|
-
|
26829
|
-
return [3 /*break*/, 8];
|
26830
|
-
case 6:
|
26831
|
-
updatedItem.status = NdcDetailsActionStatus.Pending;
|
26832
|
-
return [4 /*yield*/, put("national/programme/updateNdcDetailsAction", __assign(__assign({}, updatedItem), { kpi: parseInt(updatedItem.kpi.toString()) }))];
|
26833
|
-
case 7:
|
26834
|
-
_a.sent();
|
26835
|
-
_a.label = 8;
|
26836
|
-
case 8:
|
26837
|
-
fetchNdcDetailActions();
|
26838
|
-
setEditingKey(-1);
|
26839
|
-
return [3 /*break*/, 10];
|
26840
|
-
case 9:
|
26841
|
-
exception_2 = _a.sent();
|
26842
|
-
setEditingKey(-1);
|
26843
|
-
message.open({
|
26844
|
-
type: "error",
|
26845
|
-
content: exception_2.message,
|
26846
|
-
duration: 3,
|
26847
|
-
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
26848
|
-
});
|
26849
|
-
return [3 /*break*/, 10];
|
26850
|
-
case 10: return [2 /*return*/];
|
26796
|
+
}
|
26797
|
+
newData[parentIndex] = __assign({}, parentItem);
|
26798
|
+
setTableKey(function (key) { return key + 1; });
|
26851
26799
|
}
|
26800
|
+
return newData;
|
26852
26801
|
});
|
26853
|
-
}
|
26854
|
-
var
|
26855
|
-
|
26856
|
-
|
26857
|
-
|
26858
|
-
|
26859
|
-
|
26860
|
-
|
26861
|
-
|
26862
|
-
|
26863
|
-
|
26864
|
-
|
26865
|
-
|
26866
|
-
|
26867
|
-
|
26868
|
-
|
26869
|
-
|
26870
|
-
|
26871
|
-
|
26872
|
-
|
26873
|
-
|
26874
|
-
|
26875
|
-
|
26876
|
-
|
26877
|
-
|
26878
|
-
|
26879
|
-
headerText: t("ndc:rejectApproveTitle"),
|
26880
|
-
type: "danger",
|
26881
|
-
icon: React.createElement(Icon.BoxArrowInDown, null),
|
26882
|
-
recordId: record.id,
|
26883
|
-
});
|
26884
|
-
setOpenConfirmationModal(true);
|
26885
|
-
},
|
26886
|
-
},
|
26887
|
-
], renderItem: function (item) { return (React.createElement(List.Item, { onClick: item.click },
|
26888
|
-
React.createElement(Typography.Text, { className: "action-icon color-error" }, item.icon),
|
26889
|
-
React.createElement("span", null, item.text))); } }));
|
26802
|
+
};
|
26803
|
+
var getNdcDetailsForPeriod = function () {
|
26804
|
+
var range = selectedTab.split("-");
|
26805
|
+
if (range.length > 1) {
|
26806
|
+
var filteredData = ndcDetailsData.filter(function (item) {
|
26807
|
+
return inRange(Number(moment(item.startDate).year()), Number(range[0]), Number(range[1]));
|
26808
|
+
});
|
26809
|
+
return filteredData;
|
26810
|
+
}
|
26811
|
+
else {
|
26812
|
+
return [];
|
26813
|
+
}
|
26814
|
+
};
|
26815
|
+
var getSubNdcDetails = function (key) {
|
26816
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
26817
|
+
var ndcDetail = ndcDetailsData.find(function (item) { return item.key === key; });
|
26818
|
+
if (ndcDetail) {
|
26819
|
+
if (((_b = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails[((_a = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails) === null || _a === void 0 ? void 0 : _a.length) - 1]) === null || _b === void 0 ? void 0 : _b.ministry.trim()) !== "" &&
|
26820
|
+
((_d = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails[((_c = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails) === null || _c === void 0 ? void 0 : _c.length) - 1]) === null || _d === void 0 ? void 0 : _d.ministry) &&
|
26821
|
+
((_f = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails[((_e = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails) === null || _e === void 0 ? void 0 : _e.length) - 1]) === null || _f === void 0 ? void 0 : _f.nationalPlanObj.trim()) !== "" &&
|
26822
|
+
((_h = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails[((_g = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails) === null || _g === void 0 ? void 0 : _g.length) - 1]) === null || _h === void 0 ? void 0 : _h.nationalPlanObj) &&
|
26823
|
+
String((_k = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails[((_j = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails) === null || _j === void 0 ? void 0 : _j.length) - 1]) === null || _k === void 0 ? void 0 : _k.kpi).trim() !== "" &&
|
26824
|
+
String((_m = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails[((_l = ndcDetail === null || ndcDetail === void 0 ? void 0 : ndcDetail.subNdcDetails) === null || _l === void 0 ? void 0 : _l.length) - 1]) === null || _m === void 0 ? void 0 : _m.kpi)) {
|
26825
|
+
onAddNewSubNdcDetail();
|
26826
|
+
}
|
26827
|
+
return ndcDetail.subNdcDetails;
|
26890
26828
|
}
|
26891
26829
|
else {
|
26892
|
-
return
|
26830
|
+
return [];
|
26893
26831
|
}
|
26894
26832
|
};
|
26895
26833
|
var defaultColumns = [
|
26896
26834
|
{
|
26897
26835
|
title: t("ndc:ndcColumnsNationalPlanObj"),
|
26898
|
-
dataIndex: "
|
26899
|
-
key: "
|
26836
|
+
dataIndex: "nationalPlanObj",
|
26837
|
+
key: "nationalPlanObj",
|
26900
26838
|
align: "left",
|
26901
|
-
width: 400,
|
26902
26839
|
editable: true,
|
26903
|
-
|
26840
|
+
width: "50%",
|
26841
|
+
render: function (_, record) { return (React.createElement(React.Fragment, null, record.nationalPlanObj ? (React.createElement(Space, { size: "middle" },
|
26842
|
+
React.createElement("span", null, record.nationalPlanObj))) : (React.createElement("input", { placeholder: "Please add Programmes", className: "ant-input", type: "text" })))); },
|
26904
26843
|
},
|
26905
26844
|
{
|
26906
26845
|
title: t("ndc:ndcColumnsKpi"),
|
26907
26846
|
dataIndex: "kpi",
|
26908
26847
|
key: "kpi",
|
26909
26848
|
align: "left",
|
26910
|
-
width: 100,
|
26911
26849
|
editable: true,
|
26912
|
-
|
26850
|
+
width: "10%",
|
26851
|
+
render: function (_, record) { return (React.createElement(React.Fragment, null, record.nationalPlanObj ? (React.createElement(Space, { size: "middle" },
|
26852
|
+
React.createElement("span", null, record.kpi))) : (React.createElement("input", { placeholder: "Enter Kpi", className: "ant-input", type: "text" })))); },
|
26913
26853
|
},
|
26914
26854
|
{
|
26915
|
-
title:
|
26916
|
-
dataIndex: "
|
26917
|
-
key: "
|
26918
|
-
align: "left",
|
26919
|
-
width: 300,
|
26920
|
-
editable: false,
|
26921
|
-
render: function (_, record) { return (React.createElement(React.Fragment, null,
|
26922
|
-
React.createElement(Select, { disabled: !(isSubNdcActionsEditable(record) && isEditing(record)), defaultValue: record.ministryName ? record.ministryName : loginMinistry, style: { width: 220 }, onChange: function (value, option) {
|
26923
|
-
record.ministryName = option.label;
|
26924
|
-
handleSave(record);
|
26925
|
-
}, options: ministryOrgList }))); },
|
26926
|
-
},
|
26927
|
-
{
|
26928
|
-
title: t("ndc:ndcColumnsStatus"),
|
26929
|
-
dataIndex: "status",
|
26930
|
-
key: "status",
|
26855
|
+
title: "Government Department",
|
26856
|
+
dataIndex: "ministry",
|
26857
|
+
key: "ministry",
|
26931
26858
|
align: "left",
|
26932
|
-
|
26933
|
-
|
26934
|
-
render: function (_, record) {
|
26935
|
-
|
26936
|
-
return (React.createElement("div", { onClick: function (event) { return event.stopPropagation(); } },
|
26937
|
-
record.actionType === NdcDetailsActionType.SubAction &&
|
26938
|
-
record.status !== NdcDetailsActionStatus.New ? (React.createElement(Tooltip, { title: record.status, color: TooltipColor, key: TooltipColor },
|
26939
|
-
React.createElement(Tag, { className: "clickable", color: getNdcActionStatusTagType(record.status) }, addSpaces(record.status)))) : (""),
|
26940
|
-
record.actionType === NdcDetailsActionType.SubAction && menu ? (React.createElement(Popover, { placement: "bottomRight", content: menu, trigger: "click" },
|
26941
|
-
React.createElement(EllipsisOutlined, { rotate: 90, style: {
|
26942
|
-
fontWeight: 600,
|
26943
|
-
fontSize: "1rem",
|
26944
|
-
cursor: "pointer",
|
26945
|
-
} }))) : (React.createElement("span", null))));
|
26946
|
-
},
|
26859
|
+
editable: true,
|
26860
|
+
width: "40%",
|
26861
|
+
render: function (_, record) { return (React.createElement(React.Fragment, null, record.nationalPlanObj ? (React.createElement(Space, { size: "middle" },
|
26862
|
+
React.createElement("span", null, record.ministry))) : (React.createElement("input", { placeholder: "Please add the Government Department", className: "ant-input", type: "text" })))); },
|
26947
26863
|
},
|
26948
26864
|
];
|
26949
26865
|
var columns = defaultColumns.map(function (col) {
|
26950
26866
|
if (!col.editable) {
|
26951
26867
|
return col;
|
26952
26868
|
}
|
26953
|
-
return __assign(__assign({}, col), { onCell: function (record) {
|
26954
|
-
|
26955
|
-
|
26956
|
-
|
26957
|
-
|
26958
|
-
|
26959
|
-
|
26960
|
-
if (isEditing(record)) {
|
26961
|
-
handleSave(record);
|
26962
|
-
}
|
26963
|
-
},
|
26964
|
-
t: t,
|
26965
|
-
};
|
26966
|
-
} });
|
26869
|
+
return __assign(__assign({}, col), { onCell: function (record) { return ({
|
26870
|
+
record: record,
|
26871
|
+
editable: col.editable,
|
26872
|
+
dataIndex: col.dataIndex,
|
26873
|
+
title: col.title,
|
26874
|
+
handleSave: handleSave,
|
26875
|
+
}); } });
|
26967
26876
|
});
|
26968
|
-
function
|
26969
|
-
|
26970
|
-
|
26971
|
-
|
26972
|
-
|
26973
|
-
|
26974
|
-
|
26975
|
-
|
26976
|
-
|
26977
|
-
|
26978
|
-
|
26979
|
-
|
26980
|
-
|
26981
|
-
|
26982
|
-
|
26983
|
-
|
26984
|
-
|
26985
|
-
|
26986
|
-
|
26987
|
-
|
26988
|
-
|
26989
|
-
|
26990
|
-
|
26991
|
-
|
26992
|
-
|
26993
|
-
}
|
26994
|
-
return [2 /*return*/];
|
26995
|
-
});
|
26996
|
-
});
|
26877
|
+
function onAddNewNdcDetail() {
|
26878
|
+
var range = selectedTab.split("-");
|
26879
|
+
var ndcActionId = ++addedNdcDetailId.current;
|
26880
|
+
var newData = {
|
26881
|
+
key: ndcActionId,
|
26882
|
+
type: NdcActionType.main,
|
26883
|
+
startDate: new Date("".concat(Number(range[0]), "-01-24 23:12:00")),
|
26884
|
+
endDate: new Date("".concat(Number(range[0]), "-12-24 23:12:00")),
|
26885
|
+
nationalPlanObj: "",
|
26886
|
+
kpi: "",
|
26887
|
+
ministry: "",
|
26888
|
+
subNdcDetails: [
|
26889
|
+
{
|
26890
|
+
key: ++addedNdcDetailId.current,
|
26891
|
+
ndcActionId: ndcActionId,
|
26892
|
+
type: NdcActionType.sub,
|
26893
|
+
startDate: new Date("2019-03-25"),
|
26894
|
+
endDate: new Date("2020-03-25"),
|
26895
|
+
nationalPlanObj: "",
|
26896
|
+
kpi: "",
|
26897
|
+
ministry: "",
|
26898
|
+
},
|
26899
|
+
],
|
26900
|
+
};
|
26901
|
+
setNdcDetailsData(__spreadArray(__spreadArray([], ndcDetailsData, true), [newData], false));
|
26997
26902
|
}
|
26998
26903
|
var components = {
|
26999
26904
|
body: {
|
26905
|
+
row: EditableRow,
|
27000
26906
|
cell: EditableCell,
|
27001
26907
|
},
|
27002
26908
|
};
|
27003
|
-
|
27004
|
-
|
27005
|
-
|
27006
|
-
|
27007
|
-
|
27008
|
-
|
27009
|
-
|
27010
|
-
|
26909
|
+
//commented because rendering issue
|
26910
|
+
function ndcDetailsTableContent() {
|
26911
|
+
return (React.createElement("div", null)
|
26912
|
+
// <div>
|
26913
|
+
// <Button
|
26914
|
+
// onClick={onAddNewNdcDetail}
|
26915
|
+
// type="primary"
|
26916
|
+
// style={{
|
26917
|
+
// marginBottom: 16,
|
26918
|
+
// }}
|
26919
|
+
// >
|
26920
|
+
// Add a row
|
26921
|
+
// </Button>
|
26922
|
+
// <Table
|
26923
|
+
// components={components}
|
26924
|
+
// rowClassName={() => 'editable-row'}
|
26925
|
+
// bordered
|
26926
|
+
// dataSource={ndcDetailsData}
|
26927
|
+
// columns={columns}
|
26928
|
+
// />
|
26929
|
+
// </div>
|
26930
|
+
);
|
26931
|
+
}
|
26932
|
+
var onCancelPeriod = function () { };
|
26933
|
+
var onAddNewPeriod = function () {
|
26934
|
+
if (selectedPeriod &&
|
26935
|
+
selectedPeriod.current &&
|
26936
|
+
selectedPeriod.current.start &&
|
26937
|
+
selectedPeriod.current.end) {
|
26938
|
+
var newPeriodItem_1 = {
|
26939
|
+
key: "".concat(selectedPeriod.current.start, "-").concat(selectedPeriod.current.end),
|
26940
|
+
label: "".concat(selectedPeriod.current.start, "-").concat(selectedPeriod.current.end),
|
26941
|
+
start: selectedPeriod.current.start,
|
26942
|
+
end: selectedPeriod.current.end,
|
26943
|
+
children: ndcDetailsTableContent(),
|
26944
|
+
};
|
26945
|
+
var existingIndex = periodItemsRef.current.findIndex(function (item) {
|
26946
|
+
return inRange(newPeriodItem_1.start, item.start, item.end) ||
|
26947
|
+
inRange(newPeriodItem_1.end, item.start, item.end);
|
27011
26948
|
});
|
27012
|
-
|
27013
|
-
|
27014
|
-
|
27015
|
-
}); };
|
27016
|
-
var onClickedFinalizePeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
|
27017
|
-
var pendingActions;
|
27018
|
-
return __generator(this, function (_a) {
|
27019
|
-
if (subNdcActionsForPeriod.length === 0) {
|
27020
|
-
message.open({
|
27021
|
-
type: "error",
|
27022
|
-
content: t("ndc:finalizeNdcEmptyErrorText"),
|
27023
|
-
duration: 3,
|
27024
|
-
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
27025
|
-
});
|
27026
|
-
return [2 /*return*/];
|
26949
|
+
if (existingIndex === -1) {
|
26950
|
+
setPeriodItems(function (items) { return __spreadArray(__spreadArray([], items, true), [newPeriodItem_1], false); });
|
26951
|
+
periodItemsRef.current = __spreadArray(__spreadArray([], periodItemsRef.current, true), [newPeriodItem_1], false);
|
27027
26952
|
}
|
27028
|
-
|
27029
|
-
return action.status === NdcDetailsActionStatus.Pending;
|
27030
|
-
});
|
27031
|
-
if (pendingActions && pendingActions.length > 0) {
|
26953
|
+
else {
|
27032
26954
|
message.open({
|
27033
26955
|
type: "error",
|
27034
|
-
content: t("ndc:
|
26956
|
+
content: t("ndc:rangeAlreadyExists"),
|
27035
26957
|
duration: 3,
|
27036
26958
|
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
27037
26959
|
});
|
27038
26960
|
}
|
27039
|
-
else {
|
27040
|
-
setActionInfo({
|
27041
|
-
action: "Finalize",
|
27042
|
-
headerText: t("ndc:finalizeApproveTitle"),
|
27043
|
-
text: t("ndc:finalizeApproveSubTitle"),
|
27044
|
-
type: "primary",
|
27045
|
-
icon: React.createElement(Icon.Clipboard2Check, null),
|
27046
|
-
recordId: selectedPeriod.key,
|
27047
|
-
});
|
27048
|
-
setOpenConfirmationModal(true);
|
27049
|
-
}
|
27050
|
-
return [2 /*return*/];
|
27051
|
-
});
|
27052
|
-
}); };
|
27053
|
-
var onMainTableRowExpand = function (expanded, record) {
|
27054
|
-
var keys = [];
|
27055
|
-
if (expanded) {
|
27056
|
-
keys.push(record.id);
|
27057
26961
|
}
|
27058
|
-
setExpandedRowKeys(keys);
|
27059
|
-
setNdcSubActionsForMainAction(record.id);
|
27060
26962
|
};
|
27061
|
-
function
|
27062
|
-
|
27063
|
-
|
27064
|
-
|
27065
|
-
|
27066
|
-
React.createElement(Col, { flex: "auto" },
|
27067
|
-
React.createElement(Button, { type: "primary", onClick: onAddNewPeriod, htmlType: "submit", loading: loading }, t("ndc:submit"))))));
|
27068
|
-
}
|
27069
|
-
function mainNdcActionTableContent() {
|
27070
|
-
return (React.createElement("div", null,
|
27071
|
-
React.createElement(Row, null,
|
27072
|
-
React.createElement(Col, { span: 24 },
|
27073
|
-
React.createElement(Form, { form: form, component: false },
|
27074
|
-
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: {
|
27075
|
-
expandedRowRender: function (record) {
|
27076
|
-
return subNdcActionTableContent();
|
27077
|
-
},
|
27078
|
-
columnWidth: 40,
|
27079
|
-
}, onRow: function (record, rowIndex) {
|
27080
|
-
return {
|
27081
|
-
onClick: function (event) {
|
27082
|
-
if (record.id &&
|
27083
|
-
isNdcActionEditable(record) &&
|
27084
|
-
!isEditing(record)) {
|
27085
|
-
form.setFieldsValue(__assign({}, record));
|
27086
|
-
setEditingKey(record.id);
|
27087
|
-
}
|
27088
|
-
},
|
27089
|
-
onMouseLeave: function () {
|
27090
|
-
if (isEditing(record)) {
|
27091
|
-
handleSave(record);
|
27092
|
-
}
|
27093
|
-
},
|
27094
|
-
};
|
27095
|
-
}, footer: function () {
|
27096
|
-
return isGovernmentUser &&
|
27097
|
-
!selectedPeriod.finalized && (React.createElement(Row, { justify: "center" },
|
27098
|
-
React.createElement(Button, { onClick: onClickedAddNewNdcDetail, type: "default", style: {
|
27099
|
-
marginBottom: 16,
|
27100
|
-
width: "100%",
|
27101
|
-
} }, t("ndc:addNdcAction"))));
|
27102
|
-
} })))),
|
27103
|
-
isGovernmentUser && !selectedPeriod.finalized ? (React.createElement(Row, { justify: "end" },
|
27104
|
-
React.createElement(Button, { className: "mg-left-1", type: "primary", onClick: onClickedDeletePeriod, htmlType: "submit", loading: loading }, t("ndc:delete")),
|
27105
|
-
React.createElement(Button, { className: "mg-left-1", type: "primary", onClick: onClickedFinalizePeriod, htmlType: "submit", loading: loading }, t("ndc:finalize")))) : ("")));
|
27106
|
-
}
|
27107
|
-
function subNdcActionTableContent(record) {
|
27108
|
-
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) {
|
27109
|
-
return {
|
27110
|
-
onClick: function (event) {
|
27111
|
-
if (record.id &&
|
27112
|
-
isNdcActionEditable(record) &&
|
27113
|
-
!isEditing(record)) {
|
27114
|
-
form.setFieldsValue(__assign({}, record));
|
27115
|
-
setEditingKey(record.id);
|
27116
|
-
}
|
27117
|
-
},
|
27118
|
-
onMouseLeave: function () {
|
27119
|
-
if (isEditing(record)) {
|
27120
|
-
handleSave(record);
|
27121
|
-
}
|
27122
|
-
},
|
27123
|
-
};
|
27124
|
-
}, columns: columns, showHeader: false, pagination: false }));
|
27125
|
-
}
|
27126
|
-
var onAddNewPeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
|
27127
|
-
var periodItem_1, existingIndex, response, addedPeriodItem, updatedPeriodItem_1, exception_3;
|
27128
|
-
return __generator(this, function (_a) {
|
27129
|
-
switch (_a.label) {
|
27130
|
-
case 0:
|
27131
|
-
_a.trys.push([0, 4, , 5]);
|
27132
|
-
if (!(selectedDateRangeRef && selectedDateRangeRef.current)) return [3 /*break*/, 3];
|
27133
|
-
periodItem_1 = {
|
27134
|
-
startYear: selectedDateRangeRef.current.startYear,
|
27135
|
-
endYear: selectedDateRangeRef.current.endYear,
|
27136
|
-
finalized: false,
|
27137
|
-
};
|
27138
|
-
existingIndex = periodItems.findIndex(function (item) {
|
27139
|
-
return inRange(periodItem_1.startYear, item.startYear, item.endYear) ||
|
27140
|
-
inRange(periodItem_1.endYear, item.startYear, item.endYear);
|
27141
|
-
});
|
27142
|
-
if (!(existingIndex === -1)) return [3 /*break*/, 2];
|
27143
|
-
return [4 /*yield*/, post("national/programme/addNdcDetailsPeriod", __assign({}, periodItem_1))];
|
27144
|
-
case 1:
|
27145
|
-
response = _a.sent();
|
27146
|
-
if (response && response.data) {
|
27147
|
-
addedPeriodItem = response.data;
|
27148
|
-
updatedPeriodItem_1 = __assign(__assign({}, addedPeriodItem), { key: addedPeriodItem.id, label: "".concat(addedPeriodItem.startYear, "-").concat(addedPeriodItem.endYear) });
|
27149
|
-
setPeriodItems(function (items) { return __spreadArray(__spreadArray([], items, true), [updatedPeriodItem_1], false); });
|
27150
|
-
setSelectedPeriod(updatedPeriodItem_1);
|
27151
|
-
}
|
27152
|
-
return [3 /*break*/, 3];
|
27153
|
-
case 2:
|
27154
|
-
message.open({
|
27155
|
-
type: "error",
|
27156
|
-
content: t("ndc:rangeAlreadyExists"),
|
27157
|
-
duration: 3,
|
27158
|
-
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
27159
|
-
});
|
27160
|
-
_a.label = 3;
|
27161
|
-
case 3: return [3 /*break*/, 5];
|
27162
|
-
case 4:
|
27163
|
-
exception_3 = _a.sent();
|
27164
|
-
message.open({
|
27165
|
-
type: "error",
|
27166
|
-
content: exception_3.message,
|
27167
|
-
duration: 3,
|
27168
|
-
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
27169
|
-
});
|
27170
|
-
return [3 /*break*/, 5];
|
27171
|
-
case 5: return [2 /*return*/];
|
27172
|
-
}
|
27173
|
-
});
|
27174
|
-
}); };
|
26963
|
+
useEffect(function () {
|
26964
|
+
if (periodItems && periodItems.length > 3) {
|
26965
|
+
setSelectedTab(periodItems[periodItems.length - 1].key);
|
26966
|
+
}
|
26967
|
+
}, [periodItems]);
|
27175
26968
|
var onDateRangeChanged = function (range) {
|
27176
26969
|
var period = {
|
27177
|
-
|
27178
|
-
|
26970
|
+
start: Number(moment(range[0]).year()),
|
26971
|
+
end: Number(moment(range[1]).year()),
|
27179
26972
|
};
|
27180
|
-
|
26973
|
+
selectedPeriod.current = period;
|
27181
26974
|
};
|
26975
|
+
function addNewPeriodContent() {
|
26976
|
+
return (React.createElement("div", null,
|
26977
|
+
React.createElement(Row, null,
|
26978
|
+
React.createElement(RangePicker, { onChange: onDateRangeChanged, picker: "year" })),
|
26979
|
+
React.createElement(Row, { className: "mg-top-1" },
|
26980
|
+
React.createElement("div", { className: "ndc-steps-actions" },
|
26981
|
+
React.createElement(Button, { type: "primary", onClick: onAddNewPeriod, htmlType: "submit", loading: loading }, t("ndc:submit")),
|
26982
|
+
React.createElement(Button, { className: "back-btn", onClick: onCancelPeriod, loading: loading }, t("ndc:back"))))));
|
26983
|
+
}
|
26984
|
+
function getSubNdcActionContent(record) {
|
26985
|
+
selectedNdcDetail.current = record;
|
26986
|
+
return (React.createElement(Table, { components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getSubNdcDetails(record.key), columns: columns, showHeader: false, pagination: false }));
|
26987
|
+
}
|
27182
26988
|
var onTabChange = function (key) {
|
27183
|
-
|
27184
|
-
if (selectedPeriod) {
|
27185
|
-
setSelectedPeriod(selectedPeriod);
|
27186
|
-
}
|
27187
|
-
};
|
27188
|
-
var onActionConfirmed = function () { return __awaiter(void 0, void 0, void 0, function () {
|
27189
|
-
var actionResponse, exception_4;
|
27190
|
-
return __generator(this, function (_a) {
|
27191
|
-
switch (_a.label) {
|
27192
|
-
case 0:
|
27193
|
-
setLoading(true);
|
27194
|
-
_a.label = 1;
|
27195
|
-
case 1:
|
27196
|
-
_a.trys.push([1, 10, , 11]);
|
27197
|
-
if (!(actionInfo.action === "Approve")) return [3 /*break*/, 3];
|
27198
|
-
return [4 /*yield*/, post("national/programme/approveNdcDetailsAction", {
|
27199
|
-
id: actionInfo.recordId,
|
27200
|
-
})];
|
27201
|
-
case 2:
|
27202
|
-
actionResponse = _a.sent();
|
27203
|
-
return [3 /*break*/, 9];
|
27204
|
-
case 3:
|
27205
|
-
if (!(actionInfo.action === "Reject")) return [3 /*break*/, 5];
|
27206
|
-
return [4 /*yield*/, post("national/programme/rejectNdcDetailsAction", {
|
27207
|
-
id: actionInfo.recordId,
|
27208
|
-
})];
|
27209
|
-
case 4:
|
27210
|
-
actionResponse = _a.sent();
|
27211
|
-
return [3 /*break*/, 9];
|
27212
|
-
case 5:
|
27213
|
-
if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 7];
|
27214
|
-
return [4 /*yield*/, post("national/programme/finalizeNdcDetailsPeriod", {
|
27215
|
-
id: selectedPeriod.key,
|
27216
|
-
})];
|
27217
|
-
case 6:
|
27218
|
-
actionResponse = _a.sent();
|
27219
|
-
return [3 /*break*/, 9];
|
27220
|
-
case 7:
|
27221
|
-
if (!(actionInfo.action === "Delete")) return [3 /*break*/, 9];
|
27222
|
-
return [4 /*yield*/, post("national/programme/deleteNdcDetailsPeriod", {
|
27223
|
-
id: selectedPeriod.key,
|
27224
|
-
})];
|
27225
|
-
case 8:
|
27226
|
-
actionResponse = _a.sent();
|
27227
|
-
_a.label = 9;
|
27228
|
-
case 9: return [3 /*break*/, 11];
|
27229
|
-
case 10:
|
27230
|
-
exception_4 = _a.sent();
|
27231
|
-
message.open({
|
27232
|
-
type: "error",
|
27233
|
-
content: exception_4.message,
|
27234
|
-
duration: 3,
|
27235
|
-
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
27236
|
-
});
|
27237
|
-
return [3 /*break*/, 11];
|
27238
|
-
case 11:
|
27239
|
-
if (actionResponse) {
|
27240
|
-
if (actionInfo.action === "Delete") {
|
27241
|
-
message.open({
|
27242
|
-
type: "success",
|
27243
|
-
content: t("ndc:deletePeriodSuccessMsg"),
|
27244
|
-
duration: 3,
|
27245
|
-
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
27246
|
-
});
|
27247
|
-
fetchNdcDetailPeriods();
|
27248
|
-
}
|
27249
|
-
else if (actionInfo.action === "Finalize") {
|
27250
|
-
message.open({
|
27251
|
-
type: "success",
|
27252
|
-
content: t("ndc:finalizeSuccessMsg"),
|
27253
|
-
duration: 3,
|
27254
|
-
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
27255
|
-
});
|
27256
|
-
fetchNdcDetailPeriods();
|
27257
|
-
}
|
27258
|
-
else if (actionInfo.action === "Approve") {
|
27259
|
-
message.open({
|
27260
|
-
type: "success",
|
27261
|
-
content: t("ndc:approveSuccessMsg"),
|
27262
|
-
duration: 3,
|
27263
|
-
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
27264
|
-
});
|
27265
|
-
fetchNdcDetailActions();
|
27266
|
-
}
|
27267
|
-
else if (actionInfo.action === "Reject") {
|
27268
|
-
message.open({
|
27269
|
-
type: "success",
|
27270
|
-
content: t("ndc:rejectSuccessMsg"),
|
27271
|
-
duration: 3,
|
27272
|
-
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
27273
|
-
});
|
27274
|
-
fetchNdcDetailActions();
|
27275
|
-
}
|
27276
|
-
}
|
27277
|
-
setOpenConfirmationModal(false);
|
27278
|
-
setLoading(false);
|
27279
|
-
return [2 /*return*/];
|
27280
|
-
}
|
27281
|
-
});
|
27282
|
-
}); };
|
27283
|
-
var onActionCanceled = function () {
|
27284
|
-
setOpenConfirmationModal(false);
|
26989
|
+
setSelectedTab(key);
|
27285
26990
|
};
|
27286
|
-
var fetchNdcDetailPeriods = function () { return __awaiter(void 0, void 0, void 0, function () {
|
27287
|
-
var periods, addNewTab, response, exception_5;
|
27288
|
-
return __generator(this, function (_a) {
|
27289
|
-
switch (_a.label) {
|
27290
|
-
case 0:
|
27291
|
-
setLoading(true);
|
27292
|
-
_a.label = 1;
|
27293
|
-
case 1:
|
27294
|
-
_a.trys.push([1, 3, 4, 5]);
|
27295
|
-
periods = [];
|
27296
|
-
addNewTab = {
|
27297
|
-
key: "add_new",
|
27298
|
-
label: "Add New",
|
27299
|
-
startYear: 0,
|
27300
|
-
endYear: 0,
|
27301
|
-
finalized: false,
|
27302
|
-
deleted: false,
|
27303
|
-
};
|
27304
|
-
return [4 /*yield*/, get("national/programme/queryNdcDetailsPeriod")];
|
27305
|
-
case 2:
|
27306
|
-
response = _a.sent();
|
27307
|
-
if (response && response.data) {
|
27308
|
-
periods = response.data.map(function (period) {
|
27309
|
-
return __assign(__assign({}, period), { key: period.id, label: period.finalized ? (React.createElement("span", null,
|
27310
|
-
React.createElement(LockOutlined, null),
|
27311
|
-
" ",
|
27312
|
-
period.startYear,
|
27313
|
-
"-",
|
27314
|
-
period.endYear,
|
27315
|
-
" ")) : ("".concat(period.startYear, "-").concat(period.endYear)) });
|
27316
|
-
});
|
27317
|
-
}
|
27318
|
-
if (isGovernmentUser) {
|
27319
|
-
periods.unshift(addNewTab);
|
27320
|
-
}
|
27321
|
-
setPeriodItems(periods);
|
27322
|
-
if (isGovernmentUser) {
|
27323
|
-
setSelectedPeriod(addNewTab);
|
27324
|
-
}
|
27325
|
-
else {
|
27326
|
-
setSelectedPeriod(periods[0]);
|
27327
|
-
}
|
27328
|
-
setLoading(false);
|
27329
|
-
return [3 /*break*/, 5];
|
27330
|
-
case 3:
|
27331
|
-
exception_5 = _a.sent();
|
27332
|
-
message.open({
|
27333
|
-
type: "error",
|
27334
|
-
content: exception_5.message,
|
27335
|
-
duration: 3,
|
27336
|
-
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
27337
|
-
});
|
27338
|
-
return [3 /*break*/, 5];
|
27339
|
-
case 4:
|
27340
|
-
setLoading(false);
|
27341
|
-
return [7 /*endfinally*/];
|
27342
|
-
case 5: return [2 /*return*/];
|
27343
|
-
}
|
27344
|
-
});
|
27345
|
-
}); };
|
27346
|
-
var fetchNdcDetailActions = function () { return __awaiter(void 0, void 0, void 0, function () {
|
27347
|
-
var response, maxActionId, exception_6;
|
27348
|
-
return __generator(this, function (_a) {
|
27349
|
-
switch (_a.label) {
|
27350
|
-
case 0:
|
27351
|
-
setLoading(true);
|
27352
|
-
_a.label = 1;
|
27353
|
-
case 1:
|
27354
|
-
_a.trys.push([1, 3, 4, 5]);
|
27355
|
-
return [4 /*yield*/, get("national/programme/queryNdcDetailsAction")];
|
27356
|
-
case 2:
|
27357
|
-
response = _a.sent();
|
27358
|
-
if (response && response.data) {
|
27359
|
-
maxActionId = Math.max.apply(Math, response.data.map(function (item) { return item.id; }));
|
27360
|
-
setNextAvailableActionId(maxActionId + 1);
|
27361
|
-
setNdcActionsList(response.data);
|
27362
|
-
}
|
27363
|
-
setLoading(false);
|
27364
|
-
return [3 /*break*/, 5];
|
27365
|
-
case 3:
|
27366
|
-
exception_6 = _a.sent();
|
27367
|
-
message.open({
|
27368
|
-
type: "error",
|
27369
|
-
content: exception_6.message,
|
27370
|
-
duration: 3,
|
27371
|
-
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
27372
|
-
});
|
27373
|
-
return [3 /*break*/, 5];
|
27374
|
-
case 4:
|
27375
|
-
setLoading(false);
|
27376
|
-
return [7 /*endfinally*/];
|
27377
|
-
case 5: return [2 /*return*/];
|
27378
|
-
}
|
27379
|
-
});
|
27380
|
-
}); };
|
27381
|
-
var fetchMinistries = function () { return __awaiter(void 0, void 0, void 0, function () {
|
27382
|
-
var response, ministryOrgDetails, exception_7;
|
27383
|
-
return __generator(this, function (_a) {
|
27384
|
-
switch (_a.label) {
|
27385
|
-
case 0:
|
27386
|
-
setLoading(true);
|
27387
|
-
_a.label = 1;
|
27388
|
-
case 1:
|
27389
|
-
_a.trys.push([1, 3, 4, 5]);
|
27390
|
-
return [4 /*yield*/, get("national/organisation/getMinistries")];
|
27391
|
-
case 2:
|
27392
|
-
response = _a.sent();
|
27393
|
-
if (response && response.data) {
|
27394
|
-
ministryOrgDetails = response.data.map(function (value) {
|
27395
|
-
return {
|
27396
|
-
value: value.company_companyId,
|
27397
|
-
label: value.company_name,
|
27398
|
-
};
|
27399
|
-
});
|
27400
|
-
setMinistryOrgList(ministryOrgDetails);
|
27401
|
-
}
|
27402
|
-
setLoading(false);
|
27403
|
-
return [3 /*break*/, 5];
|
27404
|
-
case 3:
|
27405
|
-
exception_7 = _a.sent();
|
27406
|
-
message.open({
|
27407
|
-
type: "error",
|
27408
|
-
content: exception_7.message,
|
27409
|
-
duration: 3,
|
27410
|
-
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
27411
|
-
});
|
27412
|
-
return [3 /*break*/, 5];
|
27413
|
-
case 4:
|
27414
|
-
setLoading(false);
|
27415
|
-
return [7 /*endfinally*/];
|
27416
|
-
case 5: return [2 /*return*/];
|
27417
|
-
}
|
27418
|
-
});
|
27419
|
-
}); };
|
27420
26991
|
useEffect(function () {
|
27421
|
-
|
27422
|
-
|
27423
|
-
|
26992
|
+
var defaultNdcDetails = [
|
26993
|
+
{
|
26994
|
+
key: 1,
|
26995
|
+
type: NdcActionType.main,
|
26996
|
+
startDate: new Date("2019-03-25"),
|
26997
|
+
endDate: new Date("2020-03-25"),
|
26998
|
+
nationalPlanObj: "Enhance value addition in key growth opportunities",
|
26999
|
+
kpi: 25,
|
27000
|
+
ministry: "Ministry of Environment",
|
27001
|
+
subNdcDetails: [
|
27002
|
+
{
|
27003
|
+
key: 6,
|
27004
|
+
ndcActionId: 1,
|
27005
|
+
type: NdcActionType.sub,
|
27006
|
+
startDate: new Date("2019-03-25"),
|
27007
|
+
endDate: new Date("2020-03-25"),
|
27008
|
+
nationalPlanObj: "Enhance value addition in key growth opportunities sub details",
|
27009
|
+
kpi: 25,
|
27010
|
+
ministry: "Ministry of Agriculture, Water and Forestry (MAWF)",
|
27011
|
+
},
|
27012
|
+
{
|
27013
|
+
key: 7,
|
27014
|
+
ndcActionId: 1,
|
27015
|
+
type: NdcActionType.sub,
|
27016
|
+
startDate: new Date("2019-03-25"),
|
27017
|
+
endDate: new Date("2020-03-25"),
|
27018
|
+
nationalPlanObj: "",
|
27019
|
+
kpi: "",
|
27020
|
+
ministry: "",
|
27021
|
+
},
|
27022
|
+
],
|
27023
|
+
},
|
27024
|
+
{
|
27025
|
+
key: 2,
|
27026
|
+
type: NdcActionType.main,
|
27027
|
+
startDate: new Date("2019-03-25"),
|
27028
|
+
endDate: new Date("2019-08-25"),
|
27029
|
+
nationalPlanObj: "Strengthen the private sector to create 10,000 jobs",
|
27030
|
+
kpi: 10500,
|
27031
|
+
ministry: "Ministry of Environment",
|
27032
|
+
subNdcDetails: [
|
27033
|
+
{
|
27034
|
+
key: 8,
|
27035
|
+
ndcActionId: 2,
|
27036
|
+
type: NdcActionType.sub,
|
27037
|
+
startDate: new Date("2019-03-25"),
|
27038
|
+
endDate: new Date("2020-03-25"),
|
27039
|
+
nationalPlanObj: "",
|
27040
|
+
kpi: "",
|
27041
|
+
ministry: "",
|
27042
|
+
},
|
27043
|
+
],
|
27044
|
+
},
|
27045
|
+
{
|
27046
|
+
key: 12,
|
27047
|
+
type: NdcActionType.main,
|
27048
|
+
startDate: new Date("2019-03-25"),
|
27049
|
+
endDate: new Date("2019-08-25"),
|
27050
|
+
nationalPlanObj: "Other",
|
27051
|
+
kpi: 10500,
|
27052
|
+
ministry: "Ministry of Environment",
|
27053
|
+
subNdcDetails: [
|
27054
|
+
{
|
27055
|
+
key: 8,
|
27056
|
+
ndcActionId: 12,
|
27057
|
+
type: NdcActionType.sub,
|
27058
|
+
startDate: new Date("2019-03-25"),
|
27059
|
+
endDate: new Date("2020-03-25"),
|
27060
|
+
nationalPlanObj: "",
|
27061
|
+
kpi: "",
|
27062
|
+
ministry: "",
|
27063
|
+
},
|
27064
|
+
],
|
27065
|
+
},
|
27066
|
+
{
|
27067
|
+
key: 3,
|
27068
|
+
type: NdcActionType.main,
|
27069
|
+
startDate: new Date("2021-03-25"),
|
27070
|
+
endDate: new Date("2022-03-25"),
|
27071
|
+
nationalPlanObj: "Consolidate and increase the stock and quality of productive infrastructure by 50%",
|
27072
|
+
kpi: 48,
|
27073
|
+
ministry: "Ministry of Environment",
|
27074
|
+
subNdcDetails: [
|
27075
|
+
{
|
27076
|
+
key: 9,
|
27077
|
+
ndcActionId: 3,
|
27078
|
+
type: NdcActionType.sub,
|
27079
|
+
startDate: new Date("2019-03-25"),
|
27080
|
+
endDate: new Date("2020-03-25"),
|
27081
|
+
nationalPlanObj: "",
|
27082
|
+
kpi: "",
|
27083
|
+
ministry: "",
|
27084
|
+
},
|
27085
|
+
],
|
27086
|
+
},
|
27087
|
+
{
|
27088
|
+
key: 4,
|
27089
|
+
type: NdcActionType.main,
|
27090
|
+
startDate: new Date("2022-03-25"),
|
27091
|
+
endDate: new Date("2022-05-25"),
|
27092
|
+
nationalPlanObj: "Enhance the productivity and social wellbeing of the population",
|
27093
|
+
kpi: 20,
|
27094
|
+
ministry: "Ministry of Environment",
|
27095
|
+
subNdcDetails: [
|
27096
|
+
{
|
27097
|
+
key: 10,
|
27098
|
+
ndcActionId: 4,
|
27099
|
+
type: NdcActionType.sub,
|
27100
|
+
startDate: new Date("2019-03-25"),
|
27101
|
+
endDate: new Date("2020-03-25"),
|
27102
|
+
nationalPlanObj: "",
|
27103
|
+
kpi: "",
|
27104
|
+
ministry: "",
|
27105
|
+
},
|
27106
|
+
],
|
27107
|
+
},
|
27108
|
+
{
|
27109
|
+
key: 5,
|
27110
|
+
type: NdcActionType.main,
|
27111
|
+
startDate: new Date("2022-03-25"),
|
27112
|
+
endDate: new Date("2023-03-25"),
|
27113
|
+
nationalPlanObj: "Strengthen the role of the state in guiding and facilitating development",
|
27114
|
+
kpi: 10,
|
27115
|
+
ministry: "Ministry of Environment",
|
27116
|
+
subNdcDetails: [
|
27117
|
+
{
|
27118
|
+
key: 11,
|
27119
|
+
ndcActionId: 5,
|
27120
|
+
type: NdcActionType.sub,
|
27121
|
+
startDate: new Date("2019-03-25"),
|
27122
|
+
endDate: new Date("2020-03-25"),
|
27123
|
+
nationalPlanObj: "",
|
27124
|
+
kpi: "",
|
27125
|
+
ministry: "",
|
27126
|
+
},
|
27127
|
+
],
|
27128
|
+
},
|
27129
|
+
{
|
27130
|
+
key: 13,
|
27131
|
+
type: NdcActionType.main,
|
27132
|
+
startDate: new Date("2022-03-25"),
|
27133
|
+
endDate: new Date("2023-03-25"),
|
27134
|
+
nationalPlanObj: "Convert to solar energy",
|
27135
|
+
kpi: 50000,
|
27136
|
+
ministry: "Ministry of Environment",
|
27137
|
+
subNdcDetails: [
|
27138
|
+
{
|
27139
|
+
key: 11,
|
27140
|
+
ndcActionId: 13,
|
27141
|
+
type: NdcActionType.sub,
|
27142
|
+
startDate: new Date("2019-03-25"),
|
27143
|
+
endDate: new Date("2020-03-25"),
|
27144
|
+
nationalPlanObj: "Convert to solar energy",
|
27145
|
+
kpi: "3000",
|
27146
|
+
ministry: "Ministry of Agriculture, Water and Forestry (MAWF)",
|
27147
|
+
},
|
27148
|
+
{
|
27149
|
+
key: 14,
|
27150
|
+
ndcActionId: 13,
|
27151
|
+
type: NdcActionType.sub,
|
27152
|
+
startDate: new Date("2019-03-25"),
|
27153
|
+
endDate: new Date("2020-03-25"),
|
27154
|
+
nationalPlanObj: "",
|
27155
|
+
kpi: "",
|
27156
|
+
ministry: "",
|
27157
|
+
},
|
27158
|
+
],
|
27159
|
+
},
|
27160
|
+
{
|
27161
|
+
key: 15,
|
27162
|
+
type: NdcActionType.main,
|
27163
|
+
startDate: new Date("2022-03-25"),
|
27164
|
+
endDate: new Date("2023-03-25"),
|
27165
|
+
nationalPlanObj: "Strengthen the private sector to create jobs",
|
27166
|
+
kpi: 10000,
|
27167
|
+
ministry: "Ministry of Environment",
|
27168
|
+
subNdcDetails: [
|
27169
|
+
{
|
27170
|
+
key: 16,
|
27171
|
+
ndcActionId: 15,
|
27172
|
+
type: NdcActionType.sub,
|
27173
|
+
startDate: new Date("2019-03-25"),
|
27174
|
+
endDate: new Date("2020-03-25"),
|
27175
|
+
nationalPlanObj: "Strengthen the private sector to create jobs",
|
27176
|
+
kpi: "7200",
|
27177
|
+
ministry: "Ministry of Tourism (MoT)",
|
27178
|
+
},
|
27179
|
+
{
|
27180
|
+
key: 17,
|
27181
|
+
ndcActionId: 15,
|
27182
|
+
type: NdcActionType.sub,
|
27183
|
+
startDate: new Date("2019-03-25"),
|
27184
|
+
endDate: new Date("2020-03-25"),
|
27185
|
+
nationalPlanObj: "",
|
27186
|
+
kpi: "",
|
27187
|
+
ministry: "",
|
27188
|
+
},
|
27189
|
+
],
|
27190
|
+
},
|
27191
|
+
{
|
27192
|
+
key: 18,
|
27193
|
+
type: NdcActionType.main,
|
27194
|
+
startDate: new Date("2022-03-25"),
|
27195
|
+
endDate: new Date("2023-03-25"),
|
27196
|
+
nationalPlanObj: "Other",
|
27197
|
+
kpi: "",
|
27198
|
+
ministry: "Ministry of Environment",
|
27199
|
+
subNdcDetails: [
|
27200
|
+
{
|
27201
|
+
key: 19,
|
27202
|
+
ndcActionId: 18,
|
27203
|
+
type: NdcActionType.sub,
|
27204
|
+
startDate: new Date("2019-03-25"),
|
27205
|
+
endDate: new Date("2020-03-25"),
|
27206
|
+
nationalPlanObj: "Strengthen the private sector to create jobs",
|
27207
|
+
kpi: "",
|
27208
|
+
ministry: "Ministry of Agriculture, Water and Forestry (MAWF)",
|
27209
|
+
},
|
27210
|
+
{
|
27211
|
+
key: 20,
|
27212
|
+
ndcActionId: 18,
|
27213
|
+
type: NdcActionType.sub,
|
27214
|
+
startDate: new Date("2019-03-25"),
|
27215
|
+
endDate: new Date("2020-03-25"),
|
27216
|
+
nationalPlanObj: "",
|
27217
|
+
kpi: "",
|
27218
|
+
ministry: "",
|
27219
|
+
},
|
27220
|
+
],
|
27221
|
+
},
|
27222
|
+
];
|
27223
|
+
var initialPeriods = [
|
27224
|
+
{
|
27225
|
+
key: "2019-2020",
|
27226
|
+
label: "2019-2020",
|
27227
|
+
start: 2019,
|
27228
|
+
end: 2020,
|
27229
|
+
children: ndcDetailsTableContent(),
|
27230
|
+
},
|
27231
|
+
{
|
27232
|
+
key: "2021-2023",
|
27233
|
+
label: "2021-2023",
|
27234
|
+
start: 2021,
|
27235
|
+
end: 2021,
|
27236
|
+
children: ndcDetailsTableContent(),
|
27237
|
+
},
|
27238
|
+
];
|
27239
|
+
if (isAddRangeVisible()) {
|
27240
|
+
initialPeriods.unshift({
|
27241
|
+
key: "add_new",
|
27242
|
+
label: "Add New",
|
27243
|
+
start: 0,
|
27244
|
+
end: 0,
|
27245
|
+
children: addNewPeriodContent(),
|
27246
|
+
});
|
27247
|
+
}
|
27248
|
+
addedNdcDetailId.current = 20;
|
27249
|
+
setPeriodItems(initialPeriods);
|
27250
|
+
periodItemsRef.current = initialPeriods;
|
27251
|
+
setNdcDetailsData(defaultNdcDetails);
|
27424
27252
|
}, []);
|
27425
|
-
return (React.createElement("div", { className: "ndc-
|
27253
|
+
return (React.createElement("div", { className: "ndc-management content-container" },
|
27426
27254
|
React.createElement("div", { className: "title-bar" },
|
27427
27255
|
React.createElement(Row, { justify: "space-between", align: "middle" },
|
27428
27256
|
React.createElement(Col, { span: 20 },
|
27429
27257
|
React.createElement("div", { className: "body-title" }, t("ndc:ndcTitle")),
|
27430
27258
|
React.createElement("div", { className: "body-sub-title" }, t("ndc:ndcSubTitle"))))),
|
27431
27259
|
React.createElement("div", null,
|
27432
|
-
React.createElement(Tabs, { centered: false, defaultActiveKey: "1", items: periodItems, activeKey:
|
27433
|
-
React.createElement("div", null,
|
27434
|
-
|
27435
|
-
|
27436
|
-
|
27260
|
+
React.createElement(Tabs, { centered: false, defaultActiveKey: "1", items: periodItems, activeKey: selectedTab, onChange: onTabChange })),
|
27261
|
+
selectedTab !== "add_new" && (React.createElement("div", null,
|
27262
|
+
React.createElement("div", null,
|
27263
|
+
React.createElement(Table, { key: tableKey, components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getNdcDetailsForPeriod(), columns: columns, expandable: {
|
27264
|
+
expandedRowRender: function (record) { return getSubNdcActionContent(record); },
|
27265
|
+
indentSize: 0,
|
27266
|
+
defaultExpandedRowKeys: [selectedNdcDetail.current.key],
|
27267
|
+
}, footer: function () {
|
27268
|
+
return isAddNdcActionVisible() && (React.createElement(Row, { justify: "center" },
|
27269
|
+
React.createElement(Button, { onClick: onAddNewNdcDetail, type: "default", style: {
|
27270
|
+
marginBottom: 16,
|
27271
|
+
width: "100%",
|
27272
|
+
} }, t("ndc:addNdcAction"))));
|
27273
|
+
} }))))));
|
27437
27274
|
};
|
27438
27275
|
|
27439
27276
|
var ImgWithFallback = function (_a) {
|
@@ -29143,5 +28980,5 @@ var TimelineBody = function (props) {
|
|
29143
28980
|
React.createElement("div", { className: "remark-body" }, remark)))));
|
29144
28981
|
};
|
29145
28982
|
|
29146
|
-
export { Action, AddNdcActionComponent, AddNewCompanyComponent, AddNewUserComponent, AdminBGColor, AdminColor, BaseEntity, CarbonSystemType, CertBGColor, CertColor, CoBenifitsComponent, Company, CompanyManagementColumns, CompanyManagementComponent, CompanyProfileComponent, CompanyRole, CompanyState, ConfigurationSettingsType, CreditTransferComponent, CreditTransferStage, DevBGColor, DevColor, DocType, DocumentStatus, ESGType, EnergyGenerationUnits, FormElementType, GovBGColor, GovColor, ImgWithFallback, InfoView, Instrument, InvestmentBGColor, InvestmentBody, InvestmentColor, InvestmentCreationComponent, InvestmentCreationType, InvestmentLevel, InvestmentManagementComponent, InvestmentStatus, InvestmentStream, InvestmentType, LandAreaUnits, LegendItem, Loading, ManagerBGColor, ManagerColor, MapComponent, MapTypes, MapboxComponent, MinBGColor, MinColor, MitigationSubTypes, MitigationTypes, MrvDashboardComponent, MrvStatsCardsTypes, NdcActionBody, NdcActionManagementComponent, NdcActionStatus, NdcActionTypes, NdcActionViewComponent, NdcDetailsComponent, OrganisationStatus, ProfileIcon, ProgrammeCertify, ProgrammeCreationComponent, ProgrammeDocuments, ProgrammeEntity, ProgrammeIssueForm, ProgrammeManagementColumns, ProgrammeManagementComponent, ProgrammeRetireForm, ProgrammeRevokeForm, ProgrammeStageLegend, ProgrammeStageMRV, ProgrammeStageR, ProgrammeStageUnified, ProgrammeTransfer, ProgrammeTransferForm, RadioButtonStatus, RadioButtonStatus2, RegistryDashboardComponent, RejectDocumentationConfirmationModel, RetireType, Role, RoleIcon, RootBGColor, RootColor, SdgGoals$1 as SdgGoals, Sector, SectoralScope, StasticCard, StatsCardsTypes, SubTypeOfMitigation, SupportCreationComponent, SupportManagementComponent, SystemNames, TimelineBody, Titles, TooltipColor, TransferActionModel, TxType, TypeOfMitigation, UnitField, User, UserManagementColumns, UserManagementComponent, UserProfileComponent, UserRoleIcon, ViewBGColor, ViewColor, WidgetType, addCommSep, addCommSepRound, addNdcDesc, addRoundNumber, addSpaces, consumerGroupList, creditUnit, dateFormat, dateTimeFormat, energyGenerationUnitList, getBase64, getCompanyBgColor, getCreditStageVal, getFinancialFields, getGeneralFields, getInvestmentStatusEnumVal, getNdcActionStatusEnumVal
|
28983
|
+
export { Action, AddNdcActionComponent, AddNewCompanyComponent, AddNewUserComponent, AdminBGColor, AdminColor, BaseEntity, CarbonSystemType, CertBGColor, CertColor, CoBenifitsComponent, Company, CompanyManagementColumns, CompanyManagementComponent, CompanyProfileComponent, CompanyRole, CompanyState, ConfigurationSettingsType, CreditTransferComponent, CreditTransferStage, DevBGColor, DevColor, DocType, DocumentStatus, ESGType, EnergyGenerationUnits, FormElementType, GovBGColor, GovColor, ImgWithFallback, InfoView, Instrument, InvestmentBGColor, InvestmentBody, InvestmentColor, InvestmentCreationComponent, InvestmentCreationType, InvestmentLevel, InvestmentManagementComponent, InvestmentStatus, InvestmentStream, InvestmentType, LandAreaUnits, LegendItem, Loading, ManagerBGColor, ManagerColor, MapComponent, MapTypes, MapboxComponent, MinBGColor, MinColor, MitigationSubTypes, MitigationTypes, MrvDashboardComponent, MrvStatsCardsTypes, NdcActionBody, NdcActionManagementComponent, NdcActionStatus, NdcActionTypes, NdcActionViewComponent, NdcDetailsComponent, OrganisationStatus, ProfileIcon, ProgrammeCertify, ProgrammeCreationComponent, ProgrammeDocuments, ProgrammeEntity, ProgrammeIssueForm, ProgrammeManagementColumns, ProgrammeManagementComponent, ProgrammeRetireForm, ProgrammeRevokeForm, ProgrammeStageLegend, ProgrammeStageMRV, ProgrammeStageR, ProgrammeStageUnified, ProgrammeTransfer, ProgrammeTransferForm, RadioButtonStatus, RadioButtonStatus2, RegistryDashboardComponent, RejectDocumentationConfirmationModel, RetireType, Role, RoleIcon, RootBGColor, RootColor, SdgGoals$1 as SdgGoals, Sector, SectoralScope, StasticCard, StatsCardsTypes, SubTypeOfMitigation, SupportCreationComponent, SupportManagementComponent, SystemNames, TimelineBody, Titles, TooltipColor, TransferActionModel, TxType, TypeOfMitigation, UnitField, User, UserManagementColumns, UserManagementComponent, UserProfileComponent, UserRoleIcon, ViewBGColor, ViewColor, WidgetType, addCommSep, addCommSepRound, addNdcDesc, addRoundNumber, addSpaces, consumerGroupList, creditUnit, dateFormat, dateTimeFormat, energyGenerationUnitList, getBase64, getCompanyBgColor, getCreditStageVal, getFinancialFields, getGeneralFields, getInvestmentStatusEnumVal, getNdcActionStatusEnumVal, getNdcStatusTagType, getRetirementTypeString, getStageEnumVal, getStageTagType, getStageTagTypeMRV, getStageTransferEnumVal, getStatusTagType, getTransferStageTagType, getValidNdcActions, isBase64, landAreaUnitList, methodologyOptions, mitigationSubTypeList, mitigationSubTypesListMapped, mitigationTypeList, ndcActionTypeList, sectorMitigationTypesListMapped, sumArray, titleList };
|
29147
28984
|
//# sourceMappingURL=index.js.map
|