@undp/carbon-library 1.0.17-CARBON-363.20 → 1.0.17-CARBON-363.35
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +201 -55
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/Definitions/Definitions/ndcDetails.definitions.d.ts +17 -6
- package/dist/esm/index.js +202 -56
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/Definitions/Definitions/ndcDetails.definitions.d.ts +17 -6
- package/package.json +1 -1
@@ -8,7 +8,7 @@ export type Period = {
|
|
8
8
|
};
|
9
9
|
export type NdcDetail = {
|
10
10
|
id?: number;
|
11
|
-
actionType:
|
11
|
+
actionType: NdcDetailsActionType;
|
12
12
|
nationalPlanObjective: string;
|
13
13
|
kpi: number;
|
14
14
|
ministryName: string;
|
@@ -20,11 +20,22 @@ export type DateRange = {
|
|
20
20
|
startYear: number;
|
21
21
|
endYear: number;
|
22
22
|
};
|
23
|
-
export declare enum
|
24
|
-
|
25
|
-
|
23
|
+
export declare enum NdcDetailsActionType {
|
24
|
+
MainAction = "MainAction",
|
25
|
+
SubAction = "SubAction"
|
26
26
|
}
|
27
27
|
export declare enum NdcDetailsActionStatus {
|
28
|
-
|
29
|
-
|
28
|
+
Pending = "Pending",
|
29
|
+
Approved = "Approved",
|
30
|
+
Rejected = "Rejected"
|
30
31
|
}
|
32
|
+
export declare const getNdcActionStatusEnumVal: (value: string) => string;
|
33
|
+
export declare const getNdcActionStatusTagType: (status: NdcDetailsActionStatus) => "error" | "processing" | "default" | "success";
|
34
|
+
export type PopupInfo = {
|
35
|
+
title: string;
|
36
|
+
icon: any;
|
37
|
+
actionBtnText: string;
|
38
|
+
okAction: any;
|
39
|
+
type: "primary" | "danger";
|
40
|
+
remarkRequired: boolean;
|
41
|
+
};
|
package/dist/esm/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
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';
|
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
3
|
import React, { useState, useEffect, useRef, useContext } from 'react';
|
4
4
|
import { DateTime } from 'luxon';
|
@@ -2027,7 +2027,7 @@ var NdcActionStatus;
|
|
2027
2027
|
NdcActionStatus["PENDING"] = "Pending";
|
2028
2028
|
NdcActionStatus["APPROVED"] = "Approved";
|
2029
2029
|
})(NdcActionStatus || (NdcActionStatus = {}));
|
2030
|
-
var getNdcActionStatusEnumVal = function (value) {
|
2030
|
+
var getNdcActionStatusEnumVal$1 = 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 = function (value) {
|
|
2035
2035
|
return Object.values(NdcActionStatus)[index];
|
2036
2036
|
};
|
2037
2037
|
var getNdcStatusTagType = function (status) {
|
2038
|
-
switch (getNdcActionStatusEnumVal(status)) {
|
2038
|
+
switch (getNdcActionStatusEnumVal$1(status)) {
|
2039
2039
|
case NdcActionStatus.PENDING:
|
2040
2040
|
return "processing";
|
2041
2041
|
case NdcActionStatus.APPROVED:
|
@@ -26177,16 +26177,36 @@ var EditableCell = function (_a) {
|
|
26177
26177
|
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";
|
26178
26178
|
styleInject(css_248z$4);
|
26179
26179
|
|
26180
|
-
var
|
26181
|
-
(function (
|
26182
|
-
|
26183
|
-
|
26184
|
-
})(
|
26180
|
+
var NdcDetailsActionType;
|
26181
|
+
(function (NdcDetailsActionType) {
|
26182
|
+
NdcDetailsActionType["MainAction"] = "MainAction";
|
26183
|
+
NdcDetailsActionType["SubAction"] = "SubAction";
|
26184
|
+
})(NdcDetailsActionType || (NdcDetailsActionType = {}));
|
26185
26185
|
var NdcDetailsActionStatus;
|
26186
26186
|
(function (NdcDetailsActionStatus) {
|
26187
|
-
NdcDetailsActionStatus[
|
26188
|
-
NdcDetailsActionStatus[
|
26187
|
+
NdcDetailsActionStatus["Pending"] = "Pending";
|
26188
|
+
NdcDetailsActionStatus["Approved"] = "Approved";
|
26189
|
+
NdcDetailsActionStatus["Rejected"] = "Rejected";
|
26189
26190
|
})(NdcDetailsActionStatus || (NdcDetailsActionStatus = {}));
|
26191
|
+
var getNdcActionStatusEnumVal = function (value) {
|
26192
|
+
var index = Object.keys(NdcDetailsActionStatus).indexOf(value);
|
26193
|
+
if (index < 0) {
|
26194
|
+
return value;
|
26195
|
+
}
|
26196
|
+
return Object.values(NdcDetailsActionStatus)[index];
|
26197
|
+
};
|
26198
|
+
var getNdcActionStatusTagType = function (status) {
|
26199
|
+
switch (getNdcActionStatusEnumVal(status)) {
|
26200
|
+
case NdcDetailsActionStatus.Rejected:
|
26201
|
+
return "error";
|
26202
|
+
case NdcDetailsActionStatus.Pending:
|
26203
|
+
return "processing";
|
26204
|
+
case NdcDetailsActionStatus.Approved:
|
26205
|
+
return "success";
|
26206
|
+
default:
|
26207
|
+
return "default";
|
26208
|
+
}
|
26209
|
+
};
|
26190
26210
|
|
26191
26211
|
var NdcDetailsComponent = function (props) {
|
26192
26212
|
var t = props.t, useConnection = props.useConnection, useUserContext = props.useUserContext;
|
@@ -26200,6 +26220,8 @@ var NdcDetailsComponent = function (props) {
|
|
26200
26220
|
var _e = useState(0), tableKey = _e[0], setTableKey = _e[1];
|
26201
26221
|
var _f = useConnection(), get = _f.get, post = _f.post, put = _f.put;
|
26202
26222
|
var _g = useState([]), ministryOrgList = _g[0], setMinistryOrgList = _g[1];
|
26223
|
+
var _h = useState({}), actionInfo = _h[0], setActionInfo = _h[1];
|
26224
|
+
var _j = useState(false), openConfirmationModal = _j[0], setOpenConfirmationModal = _j[1];
|
26203
26225
|
var userInfoState = useUserContext().userInfoState;
|
26204
26226
|
var loginMinistry = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT
|
26205
26227
|
? process.env.REACT_APP_GOVERNMENT_MINISTRY
|
@@ -26208,13 +26230,12 @@ var NdcDetailsComponent = function (props) {
|
|
26208
26230
|
: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY
|
26209
26231
|
? userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyName
|
26210
26232
|
: undefined;
|
26211
|
-
var
|
26212
|
-
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT) &&
|
26233
|
+
var isGovernmentUser = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
|
26213
26234
|
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly;
|
26214
26235
|
var ndcMainDetailsForPeriod = selectedPeriod.key !== "add_new"
|
26215
26236
|
? ndcDetailsData.filter(function (ndcDetail) {
|
26216
26237
|
return (ndcDetail.periodId === parseInt(selectedPeriod.key) &&
|
26217
|
-
ndcDetail.actionType ===
|
26238
|
+
ndcDetail.actionType === NdcDetailsActionType.MainAction);
|
26218
26239
|
})
|
26219
26240
|
: [];
|
26220
26241
|
var isMainNdcActionsEditable = !selectedPeriod.finalized &&
|
@@ -26222,6 +26243,7 @@ var NdcDetailsComponent = function (props) {
|
|
26222
26243
|
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly;
|
26223
26244
|
var isSubNdcActionsEditable = function (record) {
|
26224
26245
|
return (!selectedPeriod.finalized &&
|
26246
|
+
record.status !== NdcDetailsActionStatus.Approved &&
|
26225
26247
|
((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT ||
|
26226
26248
|
((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY &&
|
26227
26249
|
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyName) === record.ministryName)) &&
|
@@ -26230,22 +26252,18 @@ var NdcDetailsComponent = function (props) {
|
|
26230
26252
|
var getSubNdcDetailsForPeriod = function (id) {
|
26231
26253
|
var subNdcDetails = ndcDetailsData.filter(function (ndcDetail) {
|
26232
26254
|
return (ndcDetail.parentActionId === id &&
|
26233
|
-
ndcDetail.actionType ===
|
26255
|
+
ndcDetail.actionType === NdcDetailsActionType.SubAction);
|
26234
26256
|
});
|
26235
26257
|
var emptySubNdcRow = {
|
26236
|
-
actionType:
|
26258
|
+
actionType: NdcDetailsActionType.SubAction,
|
26237
26259
|
nationalPlanObjective: "",
|
26238
26260
|
kpi: 0,
|
26239
26261
|
ministryName: loginMinistry,
|
26240
|
-
status: NdcDetailsActionStatus.
|
26262
|
+
status: NdcDetailsActionStatus.Pending,
|
26241
26263
|
parentActionId: id,
|
26242
26264
|
};
|
26243
26265
|
return __spreadArray(__spreadArray([], subNdcDetails, true), [emptySubNdcRow], false);
|
26244
26266
|
};
|
26245
|
-
var isAddNdcActionVisible = function () {
|
26246
|
-
return ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
|
26247
|
-
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly);
|
26248
|
-
};
|
26249
26267
|
var inRange = function (num, min, max) {
|
26250
26268
|
return num >= min && num <= max;
|
26251
26269
|
};
|
@@ -26270,13 +26288,52 @@ var NdcDetailsComponent = function (props) {
|
|
26270
26288
|
}
|
26271
26289
|
});
|
26272
26290
|
}); };
|
26291
|
+
var actionMenu = function (record) {
|
26292
|
+
if (record.status === NdcDetailsActionStatus.Pending && isGovernmentUser) {
|
26293
|
+
return (React.createElement(List, { className: "action-menu", size: "small", dataSource: [
|
26294
|
+
{
|
26295
|
+
text: t("ndc:approve"),
|
26296
|
+
icon: React.createElement(Icon.BoxArrowInDown, null),
|
26297
|
+
click: function () {
|
26298
|
+
setActionInfo({
|
26299
|
+
action: "Approve",
|
26300
|
+
headerText: t("ndc:actionApproveTitle"),
|
26301
|
+
type: "primary",
|
26302
|
+
icon: React.createElement(Icon.BoxArrowInDown, null),
|
26303
|
+
recordId: record.id,
|
26304
|
+
});
|
26305
|
+
setOpenConfirmationModal(true);
|
26306
|
+
},
|
26307
|
+
},
|
26308
|
+
{
|
26309
|
+
text: t("ndc:reject"),
|
26310
|
+
icon: React.createElement(Icon.XOctagon, null),
|
26311
|
+
click: function () {
|
26312
|
+
setActionInfo({
|
26313
|
+
action: "Reject",
|
26314
|
+
headerText: t("ndc:rejectApproveTitle"),
|
26315
|
+
type: "danger",
|
26316
|
+
icon: React.createElement(Icon.BoxArrowInDown, null),
|
26317
|
+
recordId: record.id,
|
26318
|
+
});
|
26319
|
+
setOpenConfirmationModal(true);
|
26320
|
+
},
|
26321
|
+
},
|
26322
|
+
], renderItem: function (item) { return (React.createElement(List.Item, { onClick: item.click },
|
26323
|
+
React.createElement(Typography.Text, { className: "action-icon color-error" }, item.icon),
|
26324
|
+
React.createElement("span", null, item.text))); } }));
|
26325
|
+
}
|
26326
|
+
else {
|
26327
|
+
return null;
|
26328
|
+
}
|
26329
|
+
};
|
26273
26330
|
var defaultColumns = [
|
26274
26331
|
{
|
26275
26332
|
title: t("ndc:ndcColumnsNationalPlanObj"),
|
26276
26333
|
dataIndex: "nationalPlanObjective",
|
26277
26334
|
key: "nationalPlanObjective",
|
26278
26335
|
align: "left",
|
26279
|
-
width: "
|
26336
|
+
width: "40%",
|
26280
26337
|
editable: true,
|
26281
26338
|
render: function (_, record) { return (React.createElement(React.Fragment, null, record.nationalPlanObjective ? (React.createElement(Space, { size: "middle" },
|
26282
26339
|
React.createElement("span", null, record.nationalPlanObjective))) : (React.createElement("input", { placeholder: "Please add the National Plan Objective", className: "ant-input", type: "text" })))); },
|
@@ -26286,31 +26343,50 @@ var NdcDetailsComponent = function (props) {
|
|
26286
26343
|
dataIndex: "kpi",
|
26287
26344
|
key: "kpi",
|
26288
26345
|
align: "left",
|
26289
|
-
width: "
|
26346
|
+
width: "15%",
|
26290
26347
|
editable: true,
|
26291
26348
|
render: function (_, record) { return (React.createElement(React.Fragment, null, record.kpi ? (React.createElement(Space, { size: "middle" },
|
26292
26349
|
React.createElement("span", null, record.kpi))) : (React.createElement("input", { placeholder: "Enter Kpi", className: "ant-input", type: "text" })))); },
|
26293
26350
|
},
|
26294
26351
|
{
|
26295
|
-
title: "
|
26352
|
+
title: t("ndc:ndcColumnsMinistry"),
|
26296
26353
|
dataIndex: "ministryName",
|
26297
26354
|
key: "ministryName",
|
26298
26355
|
align: "left",
|
26299
|
-
width: "
|
26356
|
+
width: "30%",
|
26300
26357
|
editable: false,
|
26301
26358
|
render: function (_, record) { return (React.createElement(React.Fragment, null,
|
26302
26359
|
React.createElement(Select, { disabled: !isSubNdcActionsEditable(record), defaultValue: record.ministryName ? record.ministryName : loginMinistry, style: { width: 320 }, onChange: function () { }, options: ministryOrgList }))); },
|
26303
26360
|
},
|
26361
|
+
{
|
26362
|
+
title: t("ndc:ndcColumnsStatus"),
|
26363
|
+
dataIndex: "status",
|
26364
|
+
key: "status",
|
26365
|
+
align: "left",
|
26366
|
+
width: "15%",
|
26367
|
+
editable: false,
|
26368
|
+
render: function (_, record) {
|
26369
|
+
var menu = actionMenu(record);
|
26370
|
+
return (React.createElement(React.Fragment, null,
|
26371
|
+
record.actionType === NdcDetailsActionType.SubAction ? (React.createElement(Tooltip, { title: record.status, color: TooltipColor, key: TooltipColor },
|
26372
|
+
React.createElement(Tag, { className: "clickable", color: getNdcActionStatusTagType(record.status) }, addSpaces(record.status)))) : (""),
|
26373
|
+
record.actionType === NdcDetailsActionType.SubAction && menu ? (React.createElement(Popover, { placement: "bottomRight", content: menu, trigger: "click" },
|
26374
|
+
React.createElement(EllipsisOutlined, { rotate: 90, style: {
|
26375
|
+
fontWeight: 600,
|
26376
|
+
fontSize: "1rem",
|
26377
|
+
cursor: "pointer",
|
26378
|
+
} }))) : (React.createElement("span", null))));
|
26379
|
+
},
|
26380
|
+
},
|
26304
26381
|
];
|
26305
26382
|
var columns = defaultColumns.map(function (col) {
|
26306
26383
|
if (!col.editable) {
|
26307
26384
|
return col;
|
26308
26385
|
}
|
26309
26386
|
return __assign(__assign({}, col), { onCell: function (record) {
|
26310
|
-
console.log("record", record);
|
26311
26387
|
return {
|
26312
26388
|
record: record,
|
26313
|
-
editable: record.actionType ===
|
26389
|
+
editable: record.actionType === NdcDetailsActionType.MainAction
|
26314
26390
|
? isMainNdcActionsEditable
|
26315
26391
|
: isSubNdcActionsEditable(record),
|
26316
26392
|
dataIndex: col.dataIndex,
|
@@ -26328,12 +26404,12 @@ var NdcDetailsComponent = function (props) {
|
|
26328
26404
|
if (!(selectedPeriod.key !== "add_new")) return [3 /*break*/, 2];
|
26329
26405
|
periodId = parseInt(selectedPeriod.key);
|
26330
26406
|
newData = {
|
26331
|
-
actionType:
|
26407
|
+
actionType: NdcDetailsActionType.MainAction,
|
26332
26408
|
nationalPlanObjective: "",
|
26333
26409
|
kpi: 0,
|
26334
26410
|
ministryName: loginMinistry,
|
26335
26411
|
periodId: periodId,
|
26336
|
-
status: NdcDetailsActionStatus.
|
26412
|
+
status: NdcDetailsActionStatus.Pending,
|
26337
26413
|
};
|
26338
26414
|
return [4 /*yield*/, post("national/programme/addNdcDetailsAction", __assign({}, newData))];
|
26339
26415
|
case 1:
|
@@ -26357,25 +26433,33 @@ var NdcDetailsComponent = function (props) {
|
|
26357
26433
|
cell: EditableCell,
|
26358
26434
|
},
|
26359
26435
|
};
|
26360
|
-
var
|
26361
|
-
var result;
|
26436
|
+
var onClickedDeletePeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
|
26362
26437
|
return __generator(this, function (_a) {
|
26363
|
-
|
26364
|
-
|
26365
|
-
|
26366
|
-
|
26367
|
-
|
26368
|
-
|
26369
|
-
|
26370
|
-
|
26371
|
-
|
26372
|
-
|
26373
|
-
|
26438
|
+
setActionInfo({
|
26439
|
+
action: "Delete",
|
26440
|
+
headerText: t("ndc:periodDeleteConfirmTitle"),
|
26441
|
+
type: "danger",
|
26442
|
+
icon: React.createElement(Icon.XCircle, null),
|
26443
|
+
recordId: selectedPeriod.key,
|
26444
|
+
});
|
26445
|
+
setOpenConfirmationModal(true);
|
26446
|
+
return [2 /*return*/];
|
26447
|
+
});
|
26448
|
+
}); };
|
26449
|
+
var onClickedFinalizePeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
|
26450
|
+
return __generator(this, function (_a) {
|
26451
|
+
setActionInfo({
|
26452
|
+
action: "Finalize",
|
26453
|
+
headerText: t("ndc:finalizeApproveTitle"),
|
26454
|
+
text: t("ndc:finalizeApproveSubTitle"),
|
26455
|
+
type: "primary",
|
26456
|
+
icon: React.createElement(Icon.Clipboard2Check, null),
|
26457
|
+
recordId: selectedPeriod.key,
|
26458
|
+
});
|
26459
|
+
setOpenConfirmationModal(true);
|
26460
|
+
return [2 /*return*/];
|
26374
26461
|
});
|
26375
26462
|
}); };
|
26376
|
-
var onFinalizePeriod = function () {
|
26377
|
-
//
|
26378
|
-
};
|
26379
26463
|
function ndcDetailsTableContent() {
|
26380
26464
|
return (React.createElement("div", null,
|
26381
26465
|
React.createElement(Row, null,
|
@@ -26385,15 +26469,16 @@ var NdcDetailsComponent = function (props) {
|
|
26385
26469
|
indentSize: 0,
|
26386
26470
|
//defaultExpandedRowKeys: [parseInt(selectedNdcDetail.current.id)],
|
26387
26471
|
}, footer: function () {
|
26388
|
-
return
|
26472
|
+
return isGovernmentUser &&
|
26473
|
+
!selectedPeriod.finalized && (React.createElement(Row, { justify: "center" },
|
26389
26474
|
React.createElement(Button, { onClick: onClickedAddNewNdcDetail, type: "default", style: {
|
26390
26475
|
marginBottom: 16,
|
26391
26476
|
width: "100%",
|
26392
26477
|
} }, t("ndc:addNdcAction"))));
|
26393
26478
|
} }))),
|
26394
|
-
React.createElement(Row, { justify: "end" },
|
26395
|
-
React.createElement(Button, { className: "mg-left-1", type: "primary", onClick:
|
26396
|
-
React.createElement(Button, { className: "mg-left-1", type: "primary", onClick:
|
26479
|
+
isGovernmentUser && !selectedPeriod.finalized ? (React.createElement(Row, { justify: "end" },
|
26480
|
+
React.createElement(Button, { className: "mg-left-1", type: "primary", onClick: onClickedDeletePeriod, htmlType: "submit", loading: loading }, t("ndc:delete")),
|
26481
|
+
React.createElement(Button, { className: "mg-left-1", type: "primary", onClick: onClickedFinalizePeriod, htmlType: "submit", loading: loading }, t("ndc:finalize")))) : ("")));
|
26397
26482
|
}
|
26398
26483
|
var onAddNewPeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
|
26399
26484
|
var periodItem_1, existingIndex, response, addedPeriodItem, updatedPeriodItem_1;
|
@@ -26458,6 +26543,60 @@ var NdcDetailsComponent = function (props) {
|
|
26458
26543
|
setSelectedPeriod(selectedPeriod);
|
26459
26544
|
}
|
26460
26545
|
};
|
26546
|
+
var onActionConfirmed = function () { return __awaiter(void 0, void 0, void 0, function () {
|
26547
|
+
var response, response, response, result;
|
26548
|
+
return __generator(this, function (_a) {
|
26549
|
+
switch (_a.label) {
|
26550
|
+
case 0:
|
26551
|
+
if (!(actionInfo.action === "Approve")) return [3 /*break*/, 2];
|
26552
|
+
return [4 /*yield*/, get("national/programme/approveNdcDetailsAction", {
|
26553
|
+
id: actionInfo.recordId,
|
26554
|
+
})];
|
26555
|
+
case 1:
|
26556
|
+
response = _a.sent();
|
26557
|
+
console.log("response", response);
|
26558
|
+
return [3 /*break*/, 8];
|
26559
|
+
case 2:
|
26560
|
+
if (!(actionInfo.action === "Reject")) return [3 /*break*/, 4];
|
26561
|
+
return [4 /*yield*/, get("national/programme/rejectNdcDetailsAction", {
|
26562
|
+
id: actionInfo.recordId,
|
26563
|
+
})];
|
26564
|
+
case 3:
|
26565
|
+
response = _a.sent();
|
26566
|
+
console.log("response", response);
|
26567
|
+
return [3 /*break*/, 8];
|
26568
|
+
case 4:
|
26569
|
+
if (!(actionInfo.action === "Finalize")) return [3 /*break*/, 6];
|
26570
|
+
return [4 /*yield*/, post("national/programme/finalizeNdcDetailsPeriod", {
|
26571
|
+
id: selectedPeriod.key,
|
26572
|
+
})];
|
26573
|
+
case 5:
|
26574
|
+
response = _a.sent();
|
26575
|
+
console.log("response", response);
|
26576
|
+
if (response) {
|
26577
|
+
fetchNdcDetailPeriods();
|
26578
|
+
}
|
26579
|
+
return [3 /*break*/, 8];
|
26580
|
+
case 6:
|
26581
|
+
if (!(actionInfo.action === "Delete")) return [3 /*break*/, 8];
|
26582
|
+
return [4 /*yield*/, post("national/programme/deleteNdcDetailsPeriod", {
|
26583
|
+
id: selectedPeriod.key,
|
26584
|
+
})];
|
26585
|
+
case 7:
|
26586
|
+
result = _a.sent();
|
26587
|
+
if (result) {
|
26588
|
+
fetchNdcDetailPeriods();
|
26589
|
+
}
|
26590
|
+
_a.label = 8;
|
26591
|
+
case 8:
|
26592
|
+
setOpenConfirmationModal(false);
|
26593
|
+
return [2 /*return*/];
|
26594
|
+
}
|
26595
|
+
});
|
26596
|
+
}); };
|
26597
|
+
var onActionCanceled = function () {
|
26598
|
+
setOpenConfirmationModal(false);
|
26599
|
+
};
|
26461
26600
|
var fetchNdcDetailPeriods = function () { return __awaiter(void 0, void 0, void 0, function () {
|
26462
26601
|
var periods, addNewTab, response;
|
26463
26602
|
return __generator(this, function (_a) {
|
@@ -26477,10 +26616,16 @@ var NdcDetailsComponent = function (props) {
|
|
26477
26616
|
response = _a.sent();
|
26478
26617
|
if (response && response.data) {
|
26479
26618
|
periods = response.data.map(function (period) {
|
26480
|
-
return __assign(__assign({}, period), { key: period.id, label:
|
26619
|
+
return __assign(__assign({}, period), { key: period.id, label: period.finalized ? (React.createElement("span", null,
|
26620
|
+
React.createElement(LockOutlined, null),
|
26621
|
+
" ",
|
26622
|
+
period.startYear,
|
26623
|
+
"-",
|
26624
|
+
period.endYear,
|
26625
|
+
" ")) : ("".concat(period.startYear, "-").concat(period.endYear)) });
|
26481
26626
|
});
|
26482
26627
|
}
|
26483
|
-
if (
|
26628
|
+
if (isGovernmentUser) {
|
26484
26629
|
periods.unshift(addNewTab);
|
26485
26630
|
}
|
26486
26631
|
setPeriodItems(periods);
|
@@ -26507,15 +26652,15 @@ var NdcDetailsComponent = function (props) {
|
|
26507
26652
|
var response, ministryOrgDetails;
|
26508
26653
|
return __generator(this, function (_a) {
|
26509
26654
|
switch (_a.label) {
|
26510
|
-
case 0: return [4 /*yield*/, get("national/
|
26655
|
+
case 0: return [4 /*yield*/, get("national/organisation/getMinistries")];
|
26511
26656
|
case 1:
|
26512
26657
|
response = _a.sent();
|
26513
|
-
console.log(
|
26658
|
+
console.log("fetchMinistries", response);
|
26514
26659
|
if (response && response.data) {
|
26515
26660
|
ministryOrgDetails = response.data.map(function (value) {
|
26516
26661
|
return {
|
26517
|
-
value: value.
|
26518
|
-
label: value.
|
26662
|
+
value: value.company_companyId,
|
26663
|
+
label: value.company_name,
|
26519
26664
|
};
|
26520
26665
|
});
|
26521
26666
|
setMinistryOrgList(ministryOrgDetails);
|
@@ -26539,7 +26684,8 @@ var NdcDetailsComponent = function (props) {
|
|
26539
26684
|
React.createElement(Tabs, { centered: false, defaultActiveKey: "1", items: periodItems, activeKey: selectedPeriod.key, onChange: onTabChange })),
|
26540
26685
|
React.createElement("div", null, selectedPeriod.key === "add_new"
|
26541
26686
|
? addNewPeriodContent()
|
26542
|
-
: ndcDetailsTableContent())
|
26687
|
+
: ndcDetailsTableContent()),
|
26688
|
+
React.createElement(UserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onActionConfirmed, onActionCanceled: onActionCanceled, openModal: openConfirmationModal, errorMsg: "", loading: false })));
|
26543
26689
|
};
|
26544
26690
|
|
26545
26691
|
var ImgWithFallback = function (_a) {
|
@@ -28140,5 +28286,5 @@ var TimelineBody = function (props) {
|
|
28140
28286
|
React.createElement("div", { className: "remark-body" }, remark)))));
|
28141
28287
|
};
|
28142
28288
|
|
28143
|
-
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 };
|
28289
|
+
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$1 as getNdcActionStatusEnumVal, getNdcStatusTagType, getRetirementTypeString, getStageEnumVal, getStageTagType, getStageTagTypeMRV, getStageTransferEnumVal, getStatusTagType, getTransferStageTagType, getValidNdcActions, isBase64, landAreaUnitList, methodologyOptions, mitigationSubTypeList, mitigationSubTypesListMapped, mitigationTypeList, ndcActionTypeList, sectorMitigationTypesListMapped, sumArray, titleList };
|
28144
28290
|
//# sourceMappingURL=index.js.map
|