@undp/carbon-library 1.0.79 → 1.0.80

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cjs/index.js CHANGED
@@ -20186,21 +20186,21 @@ styleInject(css_248z$2);
20186
20186
  var NdcActionViewComponent = function (props) {
20187
20187
  var _a;
20188
20188
  var _b, _c;
20189
- var useUserContext = props.useUserContext, linkDocVisible = props.linkDocVisible, uploadDocUserPermission = props.uploadDocUserPermission, useConnection = props.useConnection, useLocation = props.useLocation, onNavigateToNdcManagementView = props.onNavigateToNdcManagementView, translator = props.translator, sdgGoalImages = props.sdgGoalImages;
20189
+ var useUserContext = props.useUserContext; props.linkDocVisible; props.uploadDocUserPermission; var useConnection = props.useConnection, useLocation = props.useLocation, onNavigateToNdcManagementView = props.onNavigateToNdcManagementView, translator = props.translator, sdgGoalImages = props.sdgGoalImages;
20190
20190
  translator.setDefaultNamespace("ndcAction");
20191
20191
  var t = translator.t;
20192
- var userInfoState = useUserContext().userInfoState;
20192
+ useUserContext().userInfoState;
20193
20193
  var post = useConnection().post;
20194
20194
  var state = useLocation().state;
20195
- var _d = React.useState({}), ndcActionReportDetails = _d[0], setNdcActionReportDetails = _d[1];
20195
+ var _d = React.useState({}), ndcActionReportDetails = _d[0]; _d[1];
20196
20196
  var _e = React.useState(false), isLoading = _e[0], setIsLoading = _e[1];
20197
20197
  var _f = React.useState(), ndcActionDetails = _f[0], setNdcActionDetails = _f[1];
20198
20198
  var _g = React.useState(); _g[0]; var setCoBenifitsComponentnDetails = _g[1];
20199
20199
  var _h = React.useState(0), emissionsReductionExpected = _h[0], setEmissionsReductionExpected = _h[1];
20200
20200
  var _j = React.useState(0), emissionsReductionAchieved = _j[0], setEmissionsReductionAchieved = _j[1];
20201
- var _k = React.useState([]), programmeOwnerId = _k[0], setProgrammeOwnerId = _k[1];
20202
- var _l = React.useState(false), canUploadMonitorReport = _l[0], setCanUploadMonitorReport = _l[1];
20203
- var _m = React.useState(false), monitoringReportAccepted = _m[0], setMonitoringReportAccepted = _m[1];
20201
+ var _k = React.useState([]); _k[0]; var setProgrammeOwnerId = _k[1];
20202
+ var _l = React.useState(false); _l[0]; var setCanUploadMonitorReport = _l[1];
20203
+ var _m = React.useState(false); _m[0]; _m[1];
20204
20204
  var getProgrammeById = function (programmeId) { return __awaiter(void 0, void 0, void 0, function () {
20205
20205
  var response, error_1;
20206
20206
  var _a, _b, _c;
@@ -20243,92 +20243,11 @@ var NdcActionViewComponent = function (props) {
20243
20243
  }
20244
20244
  });
20245
20245
  }); };
20246
- var getProjectReportActions = function (reportData) {
20247
- return (React.createElement(antd.Row, null,
20248
- React.createElement("div", { className: "icon" },
20249
- (reportData === null || reportData === void 0 ? void 0 : reportData.status) === exports.DocumentStatus.ACCEPTED && (React.createElement(icons.CheckCircleOutlined, { className: "common-progress-icon", style: { color: "#5DC380" } })),
20250
- (reportData === null || reportData === void 0 ? void 0 : reportData.status) === exports.DocumentStatus.REJECTED && (React.createElement(icons.ExclamationCircleOutlined, { className: "common-progress-icon", style: { color: "#FD6F70" } }))),
20251
- React.createElement("div", { className: "link mg-left-1" }, (reportData === null || reportData === void 0 ? void 0 : reportData.url) && linkDocVisible(reportData === null || reportData === void 0 ? void 0 : reportData.status) && (React.createElement("a", { href: reportData === null || reportData === void 0 ? void 0 : reportData.url, target: "_blank", rel: "noopener noreferrer", download: true },
20252
- React.createElement(icons.LinkOutlined, { className: "common-progress-icon margin-right-1", style: { color: "#3F3A47" } }))))));
20253
- };
20254
- var getProjectReports = function () { return __awaiter(void 0, void 0, void 0, function () {
20255
- var reportDetails, response, exception_1;
20256
- var _a;
20257
- var _b;
20258
- return __generator(this, function (_c) {
20259
- switch (_c.label) {
20260
- case 0:
20261
- setIsLoading(true);
20262
- reportDetails = (_a = {},
20263
- _a[t("ndcAction:viewMoniteringReport")] = (React.createElement(antd.Tooltip, { arrowPointAtCenter: true, placement: "top", trigger: "hover", title: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === exports.Role.ViewOnly
20264
- ? t("programme:notAuthToUploadDoc")
20265
- : uploadDocUserPermission(userInfoState, exports.DocType.MONITORING_REPORT, programmeOwnerId)
20266
- ? !canUploadMonitorReport && t("programme:programmeNotAuth")
20267
- : t("programme:orgNotAuth"), overlayClassName: "custom-tooltip" },
20268
- React.createElement(icons.FileAddOutlined, null))),
20269
- _a[t("ndcAction:viewVerificationReport")] = (React.createElement(antd.Tooltip, { arrowPointAtCenter: true, placement: "top", trigger: "hover", title: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === exports.Role.ViewOnly
20270
- ? t("programme:notAuthToUploadDoc")
20271
- : uploadDocUserPermission(userInfoState, exports.DocType.VERIFICATION_REPORT, programmeOwnerId)
20272
- ? !monitoringReportAccepted &&
20273
- t("programme:monitoringRepNotApproved")
20274
- : t("programme:notAuthToUploadDoc"), overlayClassName: "custom-tooltip" },
20275
- React.createElement(icons.FileAddOutlined, null))),
20276
- _a);
20277
- _c.label = 1;
20278
- case 1:
20279
- _c.trys.push([1, 3, 4, 5]);
20280
- return [4 /*yield*/, post("national/programme/queryDocs", {
20281
- page: 1,
20282
- size: 100,
20283
- filterAnd: [
20284
- {
20285
- key: "actionId",
20286
- operation: "=",
20287
- value: ndcActionDetails === null || ndcActionDetails === void 0 ? void 0 : ndcActionDetails.id,
20288
- },
20289
- ],
20290
- })];
20291
- case 2:
20292
- response = _c.sent();
20293
- if (((_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.length) > 0) {
20294
- response.data.map(function (item) {
20295
- var _a, _b;
20296
- if ((_a = item === null || item === void 0 ? void 0 : item.url) === null || _a === void 0 ? void 0 : _a.includes("MONITORING_REPORT")) {
20297
- if ((item === null || item === void 0 ? void 0 : item.status) === exports.DocumentStatus.ACCEPTED) {
20298
- setMonitoringReportAccepted(true);
20299
- }
20300
- reportDetails[t("ndcAction:viewMoniteringReport")] =
20301
- getProjectReportActions(item);
20302
- }
20303
- else if ((_b = item === null || item === void 0 ? void 0 : item.url) === null || _b === void 0 ? void 0 : _b.includes("VERIFICATION_REPORT")) {
20304
- reportDetails[t("ndcAction:viewVerificationReport")] =
20305
- getProjectReportActions(item);
20306
- }
20307
- });
20308
- }
20309
- return [3 /*break*/, 5];
20310
- case 3:
20311
- exception_1 = _c.sent();
20312
- antd.message.open({
20313
- type: "error",
20314
- content: exception_1.message,
20315
- duration: 3,
20316
- style: { textAlign: "right", marginRight: 15, marginTop: 10 },
20317
- });
20318
- return [3 /*break*/, 5];
20319
- case 4:
20320
- setNdcActionReportDetails(reportDetails);
20321
- setIsLoading(false);
20322
- return [7 /*endfinally*/];
20323
- case 5: return [2 /*return*/];
20324
- }
20325
- });
20326
- }); };
20327
- React.useEffect(function () {
20328
- if (ndcActionDetails === null || ndcActionDetails === void 0 ? void 0 : ndcActionDetails.id) {
20329
- getProjectReports();
20330
- }
20331
- }, [ndcActionDetails === null || ndcActionDetails === void 0 ? void 0 : ndcActionDetails.id, programmeOwnerId]);
20246
+ // useEffect(() => {
20247
+ // if (ndcActionDetails?.id) {
20248
+ // getProjectReports();
20249
+ // }
20250
+ // }, [ndcActionDetails?.id, programmeOwnerId]);
20332
20251
  React.useEffect(function () {
20333
20252
  var _a, _b, _c, _d, _e, _f, _g, _h;
20334
20253
  if (!state) {