@undp/carbon-library 1.0.135-ghg-inventory.0 → 1.0.135-ghg-inventory.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +633 -654
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/Components/Common/Models/discardChangesConfirmationModel.d.ts +13 -0
- package/dist/cjs/types/Components/Common/Models/ghgUserActionConfirmationModel.d.ts +13 -0
- package/dist/esm/index.js +635 -656
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/Components/Common/Models/discardChangesConfirmationModel.d.ts +13 -0
- package/dist/esm/types/Components/Common/Models/ghgUserActionConfirmationModel.d.ts +13 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
@@ -5286,7 +5286,7 @@ var CompanyRoleIcon = function (props) {
|
|
5286
5286
|
role === 'ProgrammeDeveloper' ? React.createElement("div", null, 'Developer') : React.createElement("div", null, role)));
|
5287
5287
|
};
|
5288
5288
|
|
5289
|
-
var TextArea$
|
5289
|
+
var TextArea$2 = antd.Input.TextArea;
|
5290
5290
|
var UserActionConfirmationModel = function (props) {
|
5291
5291
|
var t = props.t, actionInfo = props.actionInfo, onActionConfirmed = props.onActionConfirmed, onActionCanceled = props.onActionCanceled, openModal = props.openModal, errorMsg = props.errorMsg, loading = props.loading;
|
5292
5292
|
var _a = React.useState(""), comment = _a[0], setComment = _a[1];
|
@@ -5301,7 +5301,7 @@ var UserActionConfirmationModel = function (props) {
|
|
5301
5301
|
onActionConfirmed(comment);
|
5302
5302
|
} },
|
5303
5303
|
React.createElement(antd.Form.Item, { className: "mg-bottom-0", label: t("userProfile:remarks"), name: "remarks", required: actionInfo.type === "danger" },
|
5304
|
-
React.createElement(TextArea$
|
5304
|
+
React.createElement(TextArea$2, { defaultValue: comment, rows: 2, onChange: function (v) { return setComment(v.target.value); } })),
|
5305
5305
|
errorMsg ? (React.createElement(antd.Alert, { className: "mg-top-1", message: errorMsg, type: "error", showIcon: true })) : (""),
|
5306
5306
|
React.createElement("div", { className: "mg-top-1 ant-modal-footer padding-bottom-0" },
|
5307
5307
|
React.createElement(antd.Button, { htmlType: "button", onClick: function () {
|
@@ -24207,7 +24207,7 @@ var ProgrammeTransferForm = function (props) {
|
|
24207
24207
|
React.createElement(antd.Button, { className: "mg-left-2", type: "primary", htmlType: "submit", loading: loading }, actionBtnText)))));
|
24208
24208
|
};
|
24209
24209
|
|
24210
|
-
var TextArea = antd.Input.TextArea;
|
24210
|
+
var TextArea$1 = antd.Input.TextArea;
|
24211
24211
|
var RejectDocumentationConfirmationModel = function (props) {
|
24212
24212
|
var actionInfo = props.actionInfo, onActionConfirmed = props.onActionConfirmed, onActionCanceled = props.onActionCanceled, openModal = props.openModal, errorMsg = props.errorMsg, loading = props.loading, translator = props.translator;
|
24213
24213
|
var t = translator.t;
|
@@ -24228,7 +24228,7 @@ var RejectDocumentationConfirmationModel = function (props) {
|
|
24228
24228
|
message: "".concat(t("programme:remarks")) + " " + "".concat(t("common:isRequired")),
|
24229
24229
|
},
|
24230
24230
|
] },
|
24231
|
-
React.createElement(TextArea, { defaultValue: comment, rows: 2, onChange: function (v) { return setComment(v.target.value); } })),
|
24231
|
+
React.createElement(TextArea$1, { defaultValue: comment, rows: 2, onChange: function (v) { return setComment(v.target.value); } })),
|
24232
24232
|
errorMsg ? (React.createElement(antd.Alert, { className: "mg-top-1", message: errorMsg, type: "error", showIcon: true })) : (""),
|
24233
24233
|
React.createElement("div", { className: "mg-top-1 ant-modal-footer padding-bottom-0" },
|
24234
24234
|
React.createElement(antd.Button, { htmlType: "button", onClick: function () {
|
@@ -25017,7 +25017,7 @@ var TimelineBody = function (props) {
|
|
25017
25017
|
React.createElement("div", { className: "remark-body" }, remark)))));
|
25018
25018
|
};
|
25019
25019
|
|
25020
|
-
var css_248z$1 = ".ant-tabs-tab-btn {\n padding: 5px 30px;\n text-align: center;\n font-weight: 600;\n color: rgba(58, 53, 65, 0.5); }\n\n.emission-tab-container .add-emission {\n display: flex;\n flex-direction: column;\n background-color: #ffffff;\n margin: 1rem 0 1rem 0;\n border-radius: 10px;\n padding: 0 1.5rem 2.5rem 1.5rem; }\n .emission-tab-container .add-emission .add-new-year-picker-col {\n padding-left: 5%; }\n .emission-tab-container .add-emission .ant-picker {\n border-radius: 5px !important;\n height: 50px !important;\n width: 80%; }\n .emission-tab-container .add-emission .add-new-upload-file-label {\n color: rgba(58, 53, 65, 0.5);\n padding: 0 0 8px;\n line-height: 1.5715;\n white-space: initial;\n text-align: left; }\n .emission-tab-container .add-emission .add-new-upload-file-name-input input {\n height: 50px; }\n .emission-tab-container .add-emission .add-new-upload-file-inner-col button {\n height: 50px;\n font-size: 11px;\n width: 120px; }\n .emission-tab-container .add-emission .table-heading-row {\n padding-top: 20px;\n padding-bottom: 25px;\n margin-left: 10px !important; }\n .emission-tab-container .add-emission .table-heading-row .table-heading-col {\n text-align: center;\n font-size: 18px;\n font-weight: 600;\n color: #28282899; }\n .emission-tab-container .add-emission .total-emission-row {\n padding: 12px 16px;\n margin-left: 30px !important; }\n .emission-tab-container .add-emission .total-emission-row span {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .total-emission-row .total-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .panel-header-col {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .panel-header-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .sub-panel .panel-header-emission-value-col {\n border-bottom: none !important;\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .sub-panel-heading {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n margin-top: 35px; }\n .emission-tab-container .add-emission .sub-panel-heading .panel-header-col {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .ant-collapse-ghost > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box {\n padding-top: 0px;\n padding-bottom: 12px;\n margin-left: 25px; }\n .emission-tab-container .add-emission .ant-collapse-expand-icon {\n margin-top: 5px; }\n .emission-tab-container .add-emission .ant-collapse-expand-icon svg {\n font-size: 20px;\n color: #976ED7; }\n .emission-tab-container .add-emission .ant-collapse {\n margin-left: 10px; }\n .emission-tab-container .add-emission .co2-total-pill {\n border-radius: 20px;\n background-color: rgba(145, 85, 253, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .ch4-total-pill {\n border-radius: 20px;\n background-color: rgba(217, 217, 217, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .n2o-total-pill {\n border-radius: 20px;\n background-color: rgba(185, 226, 244, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .co2eq-total-pill {\n border-radius: 20px;\n background-color: rgba(255, 166, 166, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .panel-content-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n height: 68px;\n align-items: center; }\n .emission-tab-container .add-emission .panel-content-row .panel-content-title {\n font-size: 16px;\n font-weight: 500;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .panel-content-input-box-row {\n margin-top: 14px; }\n .emission-tab-container .add-emission .panel-content-input-box-row .ant-input-number {\n height: 40px;\n width: 50px;\n margin-left:
|
25020
|
+
var css_248z$1 = ".ant-tabs-tab-btn {\n padding: 5px 30px;\n text-align: center;\n font-weight: 600;\n color: rgba(58, 53, 65, 0.5); }\n\n.ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner {\n width: 65px !important;\n height: 32px !important;\n text-align: center !important;\n border-radius: 50px !important;\n background: #16b1ff !important;\n line-height: 30px !important; }\n\n.ant-picker-cell-disabled::before {\n width: 65px !important;\n height: 32px !important;\n text-align: center !important;\n border-radius: 50px !important;\n line-height: 30px !important; }\n\n.ant-picker-cell::before {\n left: 11px; }\n\n.ant-input-suffix {\n display: flex;\n flex: none;\n align-items: center;\n height: 50px; }\n .ant-input-suffix button {\n border: none;\n color: #8C8C8C; }\n\n.ant-input-affix-wrapper {\n padding: 0 11px;\n border-radius: 5px; }\n\n.emission-tab-container .add-emission {\n display: flex;\n flex-direction: column;\n background-color: #ffffff;\n margin: 1rem 0 1rem 0;\n border-radius: 10px;\n padding: 0 1.5rem 2.5rem 1.5rem; }\n .emission-tab-container .add-emission .add-new-year-picker-col {\n padding-left: 5%; }\n .emission-tab-container .add-emission .ant-picker {\n border-radius: 5px !important;\n height: 50px !important;\n width: 80%; }\n .emission-tab-container .add-emission .add-new-upload-file-label {\n color: rgba(58, 53, 65, 0.5);\n padding: 0 0 8px;\n line-height: 1.5715;\n white-space: initial;\n text-align: left; }\n .emission-tab-container .add-emission .add-new-upload-file-name-input input {\n height: 50px;\n color: #16b1ff; }\n .emission-tab-container .add-emission .add-new-upload-file-inner-col button {\n height: 50px;\n font-size: 11px;\n width: 120px; }\n .emission-tab-container .add-emission .table-heading-row {\n padding-top: 20px;\n padding-bottom: 25px;\n margin-left: 10px !important; }\n .emission-tab-container .add-emission .table-heading-row .table-heading-col {\n text-align: center;\n font-size: 18px;\n font-weight: 600;\n color: #28282899; }\n .emission-tab-container .add-emission .total-emission-row {\n padding: 12px 16px;\n margin-left: 30px !important; }\n .emission-tab-container .add-emission .total-emission-row span {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .total-emission-row .total-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .panel-header-col {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .panel-header-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .sub-panel .panel-header-emission-value-col {\n border-bottom: none !important;\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .sub-panel-heading {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n margin-top: 35px; }\n .emission-tab-container .add-emission .sub-panel-heading .panel-header-col {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .ant-collapse-ghost > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box {\n padding-top: 0px;\n padding-bottom: 12px;\n margin-left: 25px; }\n .emission-tab-container .add-emission .ant-collapse-expand-icon {\n margin-top: 5px; }\n .emission-tab-container .add-emission .ant-collapse-expand-icon svg {\n font-size: 20px;\n color: #976ED7; }\n .emission-tab-container .add-emission .ant-collapse {\n margin-left: 10px; }\n .emission-tab-container .add-emission .co2-total-pill {\n border-radius: 20px;\n background-color: rgba(145, 85, 253, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .ch4-total-pill {\n border-radius: 20px;\n background-color: rgba(217, 217, 217, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .n2o-total-pill {\n border-radius: 20px;\n background-color: rgba(185, 226, 244, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .co2eq-total-pill {\n border-radius: 20px;\n background-color: rgba(255, 166, 166, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .panel-content-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n height: 68px;\n align-items: center; }\n .emission-tab-container .add-emission .panel-content-row .panel-content-title {\n font-size: 16px;\n font-weight: 500;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .panel-content-input-box-row {\n margin-top: 14px; }\n .emission-tab-container .add-emission .panel-content-input-box-row .ant-input-number {\n height: 40px;\n width: 50px;\n margin-left: 33%; }\n .emission-tab-container .add-emission .total-co2-without-land-row {\n margin-left: 40px !important;\n align-items: center;\n margin-top: 50px; }\n .emission-tab-container .add-emission .total-co2-without-land-row .total-co2-without-land-title {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .total-co2-without-land-row .panel-content-input-box-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6); }\n .emission-tab-container .add-emission .total-co2-with-land-row {\n margin-left: 40px !important;\n align-items: center; }\n .emission-tab-container .add-emission .total-co2-with-land-row .total-co2-with-land-title {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .total-co2-with-land-row .panel-content-input-box-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6); }\n .emission-tab-container .add-emission .steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n margin-top: 3rem; }\n .emission-tab-container .add-emission .steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .emission-tab-container .add-emission .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 .emission-tab-container .add-emission .steps-actions .submit-btn {\n margin-right: 1rem; }\n .emission-tab-container .add-emission .steps-actions .mg-left-1 {\n margin-left: 1rem; }\n @media only screen and (max-width: 1600px) {\n .emission-tab-container .add-emission .panel-content-input-box-row .ant-input-number {\n margin-left: 25%; } }\n";
|
25021
25021
|
styleInject(css_248z$1);
|
25022
25022
|
|
25023
25023
|
var EmissionTypes = { co2: 'CO2', ch4: 'CH4', n2o: 'N2O', co2eq: 'CO2-eq' };
|
@@ -25089,168 +25089,113 @@ var formFields = {
|
|
25089
25089
|
other: ['indirectN2oEmissions', 'other'],
|
25090
25090
|
};
|
25091
25091
|
|
25092
|
-
|
25092
|
+
antd.Input.TextArea;
|
25093
|
+
var DiscardChangesConfirmationModel = function (props) {
|
25094
|
+
var t = props.t, actionInfo = props.actionInfo, onActionConfirmed = props.onActionConfirmed, onActionCanceled = props.onActionCanceled, openModal = props.openModal; props.errorMsg; var loading = props.loading;
|
25095
|
+
var _a = React.useState(""); _a[0]; var setComment = _a[1];
|
25096
|
+
React.useEffect(function () {
|
25097
|
+
setComment("");
|
25098
|
+
}, [openModal]);
|
25099
|
+
return (React.createElement(antd.Modal, { title: React.createElement("div", { className: "popup-header" },
|
25100
|
+
React.createElement("div", { className: "icon" }, actionInfo.icon),
|
25101
|
+
React.createElement("div", null, actionInfo.headerText)), className: "popup-" + actionInfo.type, open: openModal, width: Math.min(400, window.innerWidth), centered: true, onCancel: onActionCanceled, destroyOnClose: true, footer: null },
|
25102
|
+
React.createElement("p", { style: { whiteSpace: "pre-line" } }, actionInfo.text),
|
25103
|
+
React.createElement(antd.Form, { layout: "vertical", onFinish: function () {
|
25104
|
+
onActionConfirmed();
|
25105
|
+
} },
|
25106
|
+
React.createElement("div", { className: "mg-top-1 ant-modal-footer padding-bottom-0" },
|
25107
|
+
React.createElement(antd.Button, { htmlType: "button", onClick: function () {
|
25108
|
+
onActionCanceled();
|
25109
|
+
} }, t("userProfile:cancel")),
|
25110
|
+
React.createElement(antd.Button, { className: "mg-left-2", type: "primary", htmlType: "submit", loading: loading }, actionInfo.action)))));
|
25111
|
+
};
|
25112
|
+
|
25113
|
+
var GHGRecordState;
|
25114
|
+
(function (GHGRecordState) {
|
25115
|
+
GHGRecordState["SAVED"] = "SAVED";
|
25116
|
+
GHGRecordState["FINALIZED"] = "FINALIZED";
|
25117
|
+
})(GHGRecordState || (GHGRecordState = {}));
|
25118
|
+
|
25119
|
+
var TextArea = antd.Input.TextArea;
|
25120
|
+
var GHGUserActionConfirmationModel = function (props) {
|
25121
|
+
var t = props.t, actionInfo = props.actionInfo, onActionConfirmed = props.onActionConfirmed, onActionCanceled = props.onActionCanceled, openModal = props.openModal, errorMsg = props.errorMsg, loading = props.loading;
|
25122
|
+
var _a = React.useState(""), comment = _a[0], setComment = _a[1];
|
25123
|
+
React.useEffect(function () {
|
25124
|
+
setComment("");
|
25125
|
+
}, [openModal]);
|
25126
|
+
return (React.createElement(antd.Modal, { title: React.createElement("div", { className: "popup-header" },
|
25127
|
+
React.createElement("div", { className: "icon" }, actionInfo.icon),
|
25128
|
+
React.createElement("div", null, actionInfo.headerText)), className: "popup-" + actionInfo.type, open: openModal, width: Math.min(400, window.innerWidth), centered: true, onCancel: onActionCanceled, destroyOnClose: true, footer: null },
|
25129
|
+
React.createElement("p", { style: { whiteSpace: "pre-line" } }, actionInfo.text),
|
25130
|
+
React.createElement(antd.Form, { layout: "vertical", onFinish: function () {
|
25131
|
+
var status = actionInfo.action === "submit" ? GHGRecordState.SAVED : GHGRecordState.FINALIZED;
|
25132
|
+
onActionConfirmed(comment, status);
|
25133
|
+
} },
|
25134
|
+
React.createElement(antd.Form.Item, { className: "mg-bottom-0", label: t("userProfile:remarks"), name: "remarks", required: actionInfo.type === "danger" },
|
25135
|
+
React.createElement(TextArea, { defaultValue: comment, rows: 2, onChange: function (v) { return setComment(v.target.value); } })),
|
25136
|
+
errorMsg ? (React.createElement(antd.Alert, { className: "mg-top-1", message: errorMsg, type: "error", showIcon: true })) : (""),
|
25137
|
+
React.createElement("div", { className: "mg-top-1 ant-modal-footer padding-bottom-0" },
|
25138
|
+
React.createElement(antd.Button, { htmlType: "button", onClick: function () {
|
25139
|
+
onActionCanceled();
|
25140
|
+
} }, t("userProfile:cancel")),
|
25141
|
+
React.createElement(antd.Button, { className: "mg-left-2", type: "primary", htmlType: "submit", loading: loading, disabled: actionInfo.type === "danger" && comment === "" }, actionInfo.action)))));
|
25142
|
+
};
|
25143
|
+
|
25093
25144
|
var GHGEmissionsComponent = function (props) {
|
25094
25145
|
var t = props.t, useUserContext = props.useUserContext, useConnection = props.useConnection;
|
25095
25146
|
var userInfoState = useUserContext().userInfoState;
|
25096
|
-
var data = [
|
25097
|
-
|
25098
|
-
|
25099
|
-
|
25100
|
-
|
25101
|
-
|
25102
|
-
|
25103
|
-
|
25104
|
-
|
25105
|
-
|
25106
|
-
|
25107
|
-
|
25108
|
-
|
25109
|
-
|
25110
|
-
|
25111
|
-
|
25112
|
-
|
25113
|
-
|
25114
|
-
|
25115
|
-
|
25116
|
-
|
25117
|
-
|
25118
|
-
|
25119
|
-
|
25120
|
-
|
25121
|
-
|
25122
|
-
|
25123
|
-
|
25124
|
-
|
25125
|
-
|
25126
|
-
|
25127
|
-
|
25128
|
-
|
25129
|
-
|
25130
|
-
|
25131
|
-
|
25132
|
-
|
25133
|
-
|
25134
|
-
|
25135
|
-
|
25136
|
-
|
25137
|
-
|
25138
|
-
|
25139
|
-
|
25140
|
-
|
25141
|
-
|
25142
|
-
|
25143
|
-
|
25144
|
-
|
25145
|
-
|
25146
|
-
|
25147
|
-
|
25148
|
-
totalCo2WithLand: { co2: 30, ch4: 15, n2o: 33, co2eq: 41 },
|
25149
|
-
state: 'SAVED',
|
25150
|
-
version: 2,
|
25151
|
-
created_at: 1698644100397,
|
25152
|
-
},
|
25153
|
-
{
|
25154
|
-
id: 2,
|
25155
|
-
country: 'NG',
|
25156
|
-
year: 2022,
|
25157
|
-
energyEmissions: {
|
25158
|
-
fuelCombustionActivities: {
|
25159
|
-
energyIndustries: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25160
|
-
manufacturingIndustriesConstruction: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25161
|
-
transport: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25162
|
-
otherSectors: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25163
|
-
nonSpecified: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25164
|
-
},
|
25165
|
-
fugitiveEmissionsFromFuels: {
|
25166
|
-
solidFuels: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25167
|
-
oilNaturalGas: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25168
|
-
otherEmissionsEnergyProduction: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25169
|
-
},
|
25170
|
-
carbonDioxideTransportStorage: {
|
25171
|
-
transportOfCo2: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25172
|
-
injectionStorage: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25173
|
-
other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25174
|
-
},
|
25175
|
-
},
|
25176
|
-
industrialProcessesProductUse: {
|
25177
|
-
mineralIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25178
|
-
chemicalIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25179
|
-
metalIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25180
|
-
nonEnergyProductsFuelsSolventUse: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25181
|
-
electronicsIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25182
|
-
productUsesSubstOzoneDepletingSubs: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25183
|
-
otherProductManufactureUse: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25184
|
-
other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25185
|
-
},
|
25186
|
-
agricultureForestryOtherLandUse: {
|
25187
|
-
livestock: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25188
|
-
land: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25189
|
-
aggregateNonCo2SourcesLand: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25190
|
-
other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25191
|
-
},
|
25192
|
-
waste: {
|
25193
|
-
solidWasteDisposal: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25194
|
-
biologicalTreatmentSolidWaste: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25195
|
-
incinerationOpenBurningWaste: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25196
|
-
wastewaterTreatmentDischarge: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25197
|
-
other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25198
|
-
},
|
25199
|
-
other: {
|
25200
|
-
indirectN2oEmissions: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25201
|
-
other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25202
|
-
},
|
25203
|
-
totalCo2WithoutLand: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
|
25204
|
-
totalCo2WithLand: { co2: 30, ch4: 15, n2o: 33, co2eq: 41 },
|
25205
|
-
state: 'FINALIZED',
|
25206
|
-
version: 1,
|
25207
|
-
created_at: 1698644100397,
|
25208
|
-
},
|
25209
|
-
];
|
25210
|
-
var _a = useConnection(); _a.put; _a.get; var post = _a.post;
|
25211
|
-
var _b = React.useState(false), loading = _b[0], setLoading = _b[1];
|
25212
|
-
var _c = React.useState(false), isPendingFinalization = _c[0], setIsPendingFinalization = _c[1];
|
25213
|
-
var _d = React.useState(null); _d[0]; var setSelectedYear = _d[1];
|
25214
|
-
var _e = React.useState(''), uploadedFileName = _e[0], setUploadedFileName = _e[1];
|
25215
|
-
var _f = React.useState([]), disabledYears = _f[0], setDisabledYears = _f[1];
|
25216
|
-
var _g = React.useState(); _g[0]; var setChangedValues = _g[1];
|
25217
|
-
var _h = React.useState(0), totalNationalCo2 = _h[0], setTotalNationalCo2 = _h[1];
|
25218
|
-
var _j = React.useState(0), totalNationalCh4 = _j[0], setTotalNationalCh4 = _j[1];
|
25219
|
-
var _k = React.useState(0), totalNationalN2o = _k[0], setTotalNationalN2o = _k[1];
|
25220
|
-
var _l = React.useState(0), totalNationalCo2Eq = _l[0], setTotalNationalCo2Eq = _l[1];
|
25221
|
-
var _m = React.useState(0), energyEmissionsCo2 = _m[0], setEnergyEmissionsCo2 = _m[1];
|
25222
|
-
var _o = React.useState(0), energyEmissionsCh4 = _o[0], setEnergyEmissionsCh4 = _o[1];
|
25223
|
-
var _p = React.useState(0), energyEmissionsN2o = _p[0], setEnergyEmissionsN2o = _p[1];
|
25224
|
-
var _q = React.useState(0), energyEmissionsCo2Eq = _q[0], setEnergyEmissionsCo2Eq = _q[1];
|
25225
|
-
var _r = React.useState(0), fuelCombustionActivitiesCo2 = _r[0], setFuelCombustionActivitiesCo2 = _r[1];
|
25226
|
-
var _s = React.useState(0), fuelCombustionActivitiesCh4 = _s[0], setFuelCombustionActivitiesCh4 = _s[1];
|
25227
|
-
var _t = React.useState(0), fuelCombustionActivitiesN2o = _t[0], setFuelCombustionActivitiesN2o = _t[1];
|
25228
|
-
var _u = React.useState(0), fuelCombustionActivitiesCo2Eq = _u[0], setFuelCombustionActivitiesCo2Eq = _u[1];
|
25229
|
-
var _v = React.useState(0), fugitiveEmissionsFromFuelsCo2 = _v[0], setFugitiveEmissionsFromFuelsCo2 = _v[1];
|
25230
|
-
var _w = React.useState(0), fugitiveEmissionsFromFuelsCh4 = _w[0], setFugitiveEmissionsFromFuelsCh4 = _w[1];
|
25231
|
-
var _x = React.useState(0), fugitiveEmissionsFromFuelsN2o = _x[0], setFugitiveEmissionsFromFuelsN2o = _x[1];
|
25232
|
-
var _y = React.useState(0), fugitiveEmissionsFromFuelsCo2Eq = _y[0], setFugitiveEmissionsFromFuelsCo2Eq = _y[1];
|
25233
|
-
var _z = React.useState(0), carbonDioxideTransportStorageCo2 = _z[0], setCarbonDioxideTransportStorageCo2 = _z[1];
|
25234
|
-
var _0 = React.useState(0), carbonDioxideTransportStorageCh4 = _0[0], setCarbonDioxideTransportStorageCh4 = _0[1];
|
25235
|
-
var _1 = React.useState(0), carbonDioxideTransportStorageN2o = _1[0], setCarbonDioxideTransportStorageN2o = _1[1];
|
25236
|
-
var _2 = React.useState(0), carbonDioxideTransportStorageCo2Eq = _2[0], setCarbonDioxideTransportStorageCo2Eq = _2[1];
|
25237
|
-
var _3 = React.useState(0), industrialProcessesProductUseCo2 = _3[0], setIndustrialProcessesProductUseCo2 = _3[1];
|
25238
|
-
var _4 = React.useState(0), industrialProcessesProductUseCh4 = _4[0], setIndustrialProcessesProductUseCh4 = _4[1];
|
25239
|
-
var _5 = React.useState(0), industrialProcessesProductUseN2o = _5[0], setIndustrialProcessesProductUseN2o = _5[1];
|
25240
|
-
var _6 = React.useState(0), industrialProcessesProductUseCo2Eq = _6[0], setIndustrialProcessesProductUseCo2Eq = _6[1];
|
25241
|
-
var _7 = React.useState(0), agricultureForestryOtherLandUseCo2 = _7[0], setAgricultureForestryOtherLandUseCo2 = _7[1];
|
25242
|
-
var _8 = React.useState(0), agricultureForestryOtherLandUseCh4 = _8[0], setAgricultureForestryOtherLandUseCh4 = _8[1];
|
25243
|
-
var _9 = React.useState(0), agricultureForestryOtherLandUseN2o = _9[0], setAgricultureForestryOtherLandUseN2o = _9[1];
|
25244
|
-
var _10 = React.useState(0), agricultureForestryOtherLandUseCo2Eq = _10[0], setAgricultureForestryOtherLandUseCo2Eq = _10[1];
|
25245
|
-
var _11 = React.useState(0), wasteCo2 = _11[0], setWasteCo2 = _11[1];
|
25246
|
-
var _12 = React.useState(0), wasteCh4 = _12[0], setWasteCh4 = _12[1];
|
25247
|
-
var _13 = React.useState(0), wasteN2o = _13[0], setWasteN2o = _13[1];
|
25248
|
-
var _14 = React.useState(0), wasteCo2Eq = _14[0], setWasteCo2Eq = _14[1];
|
25249
|
-
var _15 = React.useState(0), otherCo2 = _15[0], setOtherCo2 = _15[1];
|
25250
|
-
var _16 = React.useState(0), otherCh4 = _16[0], setOtherCh4 = _16[1];
|
25251
|
-
var _17 = React.useState(0), otherN2o = _17[0], setOtherN2o = _17[1];
|
25252
|
-
var _18 = React.useState(0), otherCo2Eq = _18[0], setOtherCo2Eq = _18[1];
|
25253
|
-
var _19 = React.useState(false), isSavedFormDataSet = _19[0], setIsSavedFormDataSet = _19[1];
|
25147
|
+
var _a = React.useState([]), data = _a[0], setData = _a[1];
|
25148
|
+
var _b = useConnection(), get = _b.get, post = _b.post;
|
25149
|
+
var _c = React.useState(false), loading = _c[0], setLoading = _c[1];
|
25150
|
+
var _d = React.useState(false), isPendingFinalization = _d[0], setIsPendingFinalization = _d[1];
|
25151
|
+
var _e = React.useState(null); _e[0]; var setSelectedYear = _e[1];
|
25152
|
+
var _f = React.useState(''), uploadedFileName = _f[0], setUploadedFileName = _f[1];
|
25153
|
+
var _g = React.useState([]), disabledYears = _g[0], setDisabledYears = _g[1];
|
25154
|
+
var _h = React.useState(); _h[0]; _h[1];
|
25155
|
+
var _j = React.useState(0), totalNationalCo2 = _j[0], setTotalNationalCo2 = _j[1];
|
25156
|
+
var _k = React.useState(0), totalNationalCh4 = _k[0], setTotalNationalCh4 = _k[1];
|
25157
|
+
var _l = React.useState(0), totalNationalN2o = _l[0], setTotalNationalN2o = _l[1];
|
25158
|
+
var _m = React.useState(0), totalNationalCo2Eq = _m[0], setTotalNationalCo2Eq = _m[1];
|
25159
|
+
var _o = React.useState(0), energyEmissionsCo2 = _o[0], setEnergyEmissionsCo2 = _o[1];
|
25160
|
+
var _p = React.useState(0), energyEmissionsCh4 = _p[0], setEnergyEmissionsCh4 = _p[1];
|
25161
|
+
var _q = React.useState(0), energyEmissionsN2o = _q[0], setEnergyEmissionsN2o = _q[1];
|
25162
|
+
var _r = React.useState(0), energyEmissionsCo2Eq = _r[0], setEnergyEmissionsCo2Eq = _r[1];
|
25163
|
+
var _s = React.useState(0), fuelCombustionActivitiesCo2 = _s[0], setFuelCombustionActivitiesCo2 = _s[1];
|
25164
|
+
var _t = React.useState(0), fuelCombustionActivitiesCh4 = _t[0], setFuelCombustionActivitiesCh4 = _t[1];
|
25165
|
+
var _u = React.useState(0), fuelCombustionActivitiesN2o = _u[0], setFuelCombustionActivitiesN2o = _u[1];
|
25166
|
+
var _v = React.useState(0), fuelCombustionActivitiesCo2Eq = _v[0], setFuelCombustionActivitiesCo2Eq = _v[1];
|
25167
|
+
var _w = React.useState(0), fugitiveEmissionsFromFuelsCo2 = _w[0], setFugitiveEmissionsFromFuelsCo2 = _w[1];
|
25168
|
+
var _x = React.useState(0), fugitiveEmissionsFromFuelsCh4 = _x[0], setFugitiveEmissionsFromFuelsCh4 = _x[1];
|
25169
|
+
var _y = React.useState(0), fugitiveEmissionsFromFuelsN2o = _y[0], setFugitiveEmissionsFromFuelsN2o = _y[1];
|
25170
|
+
var _z = React.useState(0), fugitiveEmissionsFromFuelsCo2Eq = _z[0], setFugitiveEmissionsFromFuelsCo2Eq = _z[1];
|
25171
|
+
var _0 = React.useState(0), carbonDioxideTransportStorageCo2 = _0[0], setCarbonDioxideTransportStorageCo2 = _0[1];
|
25172
|
+
var _1 = React.useState(0), carbonDioxideTransportStorageCh4 = _1[0], setCarbonDioxideTransportStorageCh4 = _1[1];
|
25173
|
+
var _2 = React.useState(0), carbonDioxideTransportStorageN2o = _2[0], setCarbonDioxideTransportStorageN2o = _2[1];
|
25174
|
+
var _3 = React.useState(0), carbonDioxideTransportStorageCo2Eq = _3[0], setCarbonDioxideTransportStorageCo2Eq = _3[1];
|
25175
|
+
var _4 = React.useState(0), industrialProcessesProductUseCo2 = _4[0], setIndustrialProcessesProductUseCo2 = _4[1];
|
25176
|
+
var _5 = React.useState(0), industrialProcessesProductUseCh4 = _5[0], setIndustrialProcessesProductUseCh4 = _5[1];
|
25177
|
+
var _6 = React.useState(0), industrialProcessesProductUseN2o = _6[0], setIndustrialProcessesProductUseN2o = _6[1];
|
25178
|
+
var _7 = React.useState(0), industrialProcessesProductUseCo2Eq = _7[0], setIndustrialProcessesProductUseCo2Eq = _7[1];
|
25179
|
+
var _8 = React.useState(0), agricultureForestryOtherLandUseCo2 = _8[0], setAgricultureForestryOtherLandUseCo2 = _8[1];
|
25180
|
+
var _9 = React.useState(0), agricultureForestryOtherLandUseCh4 = _9[0], setAgricultureForestryOtherLandUseCh4 = _9[1];
|
25181
|
+
var _10 = React.useState(0), agricultureForestryOtherLandUseN2o = _10[0], setAgricultureForestryOtherLandUseN2o = _10[1];
|
25182
|
+
var _11 = React.useState(0), agricultureForestryOtherLandUseCo2Eq = _11[0], setAgricultureForestryOtherLandUseCo2Eq = _11[1];
|
25183
|
+
var _12 = React.useState(0), wasteCo2 = _12[0], setWasteCo2 = _12[1];
|
25184
|
+
var _13 = React.useState(0), wasteCh4 = _13[0], setWasteCh4 = _13[1];
|
25185
|
+
var _14 = React.useState(0), wasteN2o = _14[0], setWasteN2o = _14[1];
|
25186
|
+
var _15 = React.useState(0), wasteCo2Eq = _15[0], setWasteCo2Eq = _15[1];
|
25187
|
+
var _16 = React.useState(0), otherCo2 = _16[0], setOtherCo2 = _16[1];
|
25188
|
+
var _17 = React.useState(0), otherCh4 = _17[0], setOtherCh4 = _17[1];
|
25189
|
+
var _18 = React.useState(0), otherN2o = _18[0], setOtherN2o = _18[1];
|
25190
|
+
var _19 = React.useState(0), otherCo2Eq = _19[0], setOtherCo2Eq = _19[1];
|
25191
|
+
var _20 = React.useState(false), isSavedFormDataSet = _20[0], setIsSavedFormDataSet = _20[1];
|
25192
|
+
var _21 = React.useState(1), formDataVersion = _21[0], setFormDataVersion = _21[1];
|
25193
|
+
var _22 = React.useState(false), isFormChanged = _22[0], setIsFormChanged = _22[1];
|
25194
|
+
var _23 = React.useState(false), openSaveFormModal = _23[0], setOpenSaveFormModal = _23[1];
|
25195
|
+
var _24 = React.useState(false), openFinalizeFormModal = _24[0], setOpenFinalizeFormModal = _24[1];
|
25196
|
+
var _25 = React.useState(false), openResetFormModal = _25[0], setOpenResetFormModal = _25[1];
|
25197
|
+
var _26 = React.useState(''), errorMsg = _26[0], setErrorMsg = _26[1];
|
25198
|
+
var _27 = React.useState({}), actionInfo = _27[0], setActionInfo = _27[1];
|
25254
25199
|
var Panel = antd.Collapse.Panel;
|
25255
25200
|
var form = antd.Form.useForm()[0];
|
25256
25201
|
var createSetFieldObject = function (obj, objName) {
|
@@ -25348,16 +25293,7 @@ var GHGEmissionsComponent = function (props) {
|
|
25348
25293
|
};
|
25349
25294
|
React.useEffect(function () {
|
25350
25295
|
var hasSaveState = data.some(function (item) { return item.state === 'SAVED'; });
|
25351
|
-
var years = data.map(function (item) { return !(item.state === 'SAVED') && item.year; });
|
25352
|
-
console.log(uploadedFileName);
|
25353
25296
|
setIsPendingFinalization(hasSaveState);
|
25354
|
-
// Update 'disabledYears' only if 'years' array has changed
|
25355
|
-
setDisabledYears(function (prevYears) {
|
25356
|
-
if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
|
25357
|
-
return years;
|
25358
|
-
}
|
25359
|
-
return prevYears;
|
25360
|
-
});
|
25361
25297
|
}, [data, uploadedFileName]);
|
25362
25298
|
var handleYearChange = function (date, dateString) {
|
25363
25299
|
setSelectedYear(dateString);
|
@@ -25376,9 +25312,16 @@ var GHGEmissionsComponent = function (props) {
|
|
25376
25312
|
}
|
25377
25313
|
return sum;
|
25378
25314
|
}
|
25379
|
-
var onValuesChange = function (
|
25315
|
+
var onValuesChange = function (changedValues, allValues) {
|
25380
25316
|
// Track the changed values
|
25381
|
-
|
25317
|
+
var initialValues = null;
|
25318
|
+
if (isPendingFinalization) {
|
25319
|
+
var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
|
25320
|
+
initialValues = savedData[0];
|
25321
|
+
}
|
25322
|
+
var currentValues = form.getFieldsValue(true);
|
25323
|
+
var isChanged = !(JSON.stringify(currentValues) === JSON.stringify(initialValues));
|
25324
|
+
setIsFormChanged(isChanged);
|
25382
25325
|
};
|
25383
25326
|
var getBase64 = function (file) {
|
25384
25327
|
return new Promise(function (resolve, reject) {
|
@@ -25388,7 +25331,7 @@ var GHGEmissionsComponent = function (props) {
|
|
25388
25331
|
reader.onerror = function (error) { return reject(error); };
|
25389
25332
|
});
|
25390
25333
|
};
|
25391
|
-
var createSaveRequestPayload = function (fields) { return __awaiter(void 0, void 0, void 0, function () {
|
25334
|
+
var createSaveRequestPayload = function (fields, remarks, status) { return __awaiter(void 0, void 0, void 0, function () {
|
25392
25335
|
var requestBody, savedEmission, emissionImportBase64;
|
25393
25336
|
var _a;
|
25394
25337
|
return __generator(this, function (_b) {
|
@@ -25605,7 +25548,9 @@ var GHGEmissionsComponent = function (props) {
|
|
25605
25548
|
n2o: fields === null || fields === void 0 ? void 0 : fields.totalCo2WithLand_n2o,
|
25606
25549
|
co2eq: fields === null || fields === void 0 ? void 0 : fields.totalCo2WithLand_co2eq,
|
25607
25550
|
},
|
25608
|
-
state:
|
25551
|
+
state: status,
|
25552
|
+
remarks: remarks,
|
25553
|
+
version: formDataVersion,
|
25609
25554
|
};
|
25610
25555
|
requestBody = savedEmission;
|
25611
25556
|
if (!(fields === null || fields === void 0 ? void 0 : fields.emissionsDocument)) return [3 /*break*/, 2];
|
@@ -25620,49 +25565,226 @@ var GHGEmissionsComponent = function (props) {
|
|
25620
25565
|
}
|
25621
25566
|
});
|
25622
25567
|
}); };
|
25623
|
-
var
|
25624
|
-
|
25568
|
+
var clearForm = function () {
|
25569
|
+
form.resetFields();
|
25570
|
+
setFuelCombustionActivitiesCo2(0);
|
25571
|
+
setFuelCombustionActivitiesCh4(0);
|
25572
|
+
setFuelCombustionActivitiesN2o(0);
|
25573
|
+
setFuelCombustionActivitiesCo2Eq(0);
|
25574
|
+
setFugitiveEmissionsFromFuelsCo2(0);
|
25575
|
+
setFugitiveEmissionsFromFuelsCh4(0);
|
25576
|
+
setFugitiveEmissionsFromFuelsN2o(0);
|
25577
|
+
setFugitiveEmissionsFromFuelsCo2Eq(0);
|
25578
|
+
setCarbonDioxideTransportStorageCo2(0);
|
25579
|
+
setCarbonDioxideTransportStorageCh4(0);
|
25580
|
+
setCarbonDioxideTransportStorageN2o(0);
|
25581
|
+
setCarbonDioxideTransportStorageCo2Eq(0);
|
25582
|
+
setIndustrialProcessesProductUseCo2(0);
|
25583
|
+
setIndustrialProcessesProductUseCh4(0);
|
25584
|
+
setIndustrialProcessesProductUseN2o(0);
|
25585
|
+
setIndustrialProcessesProductUseCo2Eq(0);
|
25586
|
+
setAgricultureForestryOtherLandUseCo2(0);
|
25587
|
+
setAgricultureForestryOtherLandUseCh4(0);
|
25588
|
+
setAgricultureForestryOtherLandUseN2o(0);
|
25589
|
+
setAgricultureForestryOtherLandUseCo2Eq(0);
|
25590
|
+
setWasteCo2(0);
|
25591
|
+
setWasteCh4(0);
|
25592
|
+
setWasteN2o(0);
|
25593
|
+
setWasteCo2Eq(0);
|
25594
|
+
setOtherCo2(0);
|
25595
|
+
setOtherCh4(0);
|
25596
|
+
setOtherN2o(0);
|
25597
|
+
setOtherCo2Eq(0);
|
25598
|
+
};
|
25599
|
+
var resetForm = function () { return __awaiter(void 0, void 0, void 0, function () {
|
25600
|
+
return __generator(this, function (_a) {
|
25601
|
+
switch (_a.label) {
|
25602
|
+
case 0:
|
25603
|
+
// eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
|
25604
|
+
return [4 /*yield*/, getEmissionData()];
|
25605
|
+
case 1:
|
25606
|
+
// eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
|
25607
|
+
_a.sent();
|
25608
|
+
setOpenResetFormModal(false);
|
25609
|
+
setIsSavedFormDataSet(false);
|
25610
|
+
clearUploadDoc();
|
25611
|
+
if (!isPendingFinalization) {
|
25612
|
+
clearForm();
|
25613
|
+
}
|
25614
|
+
antd.message.open({
|
25615
|
+
type: 'success',
|
25616
|
+
content: t('ghgInventory:formCancelledSuccess'),
|
25617
|
+
duration: 4,
|
25618
|
+
style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
|
25619
|
+
});
|
25620
|
+
return [2 /*return*/];
|
25621
|
+
}
|
25622
|
+
});
|
25623
|
+
}); };
|
25624
|
+
var onResetFormCanceled = function () {
|
25625
|
+
setOpenResetFormModal(false);
|
25626
|
+
};
|
25627
|
+
var onOpenResetFormModel = function () {
|
25628
|
+
setActionInfo({
|
25629
|
+
action: "".concat(t('ghgInventory:proceed')),
|
25630
|
+
headerText: "".concat(t('ghgInventory:discardHeaderText')),
|
25631
|
+
type: 'danger',
|
25632
|
+
icon: React.createElement(icons.CloseCircleOutlined, null),
|
25633
|
+
});
|
25634
|
+
setErrorMsg('');
|
25635
|
+
setOpenResetFormModal(true);
|
25636
|
+
};
|
25637
|
+
var onSaveFormCanceled = function () {
|
25638
|
+
setOpenSaveFormModal(false);
|
25639
|
+
};
|
25640
|
+
var onOpenSaveFormModel = function () {
|
25641
|
+
if (!isFormChanged) {
|
25642
|
+
antd.message.open({
|
25643
|
+
type: 'error',
|
25644
|
+
content: t('ghgInventory:formNotChanged'),
|
25645
|
+
duration: 4,
|
25646
|
+
style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
|
25647
|
+
});
|
25648
|
+
}
|
25649
|
+
else {
|
25650
|
+
setActionInfo({
|
25651
|
+
action: "".concat(t("ghgInventory:submit")),
|
25652
|
+
headerText: "".concat(t("ghgInventory:submitModelHeader")),
|
25653
|
+
type: "primary",
|
25654
|
+
icon: React.createElement(icons.CheckCircleOutlined, null),
|
25655
|
+
});
|
25656
|
+
setErrorMsg('');
|
25657
|
+
setOpenSaveFormModal(true);
|
25658
|
+
}
|
25659
|
+
};
|
25660
|
+
var onFinalizeFormCanceled = function () {
|
25661
|
+
setOpenFinalizeFormModal(false);
|
25662
|
+
};
|
25663
|
+
var onOpenFinalizeFormModel = function () {
|
25664
|
+
setActionInfo({
|
25665
|
+
action: "".concat(t("ghgInventory:finalize")),
|
25666
|
+
headerText: "".concat(t("ghgInventory:finalizeModelHeader")),
|
25667
|
+
type: "primary",
|
25668
|
+
icon: React.createElement(Icon.ClipboardCheck, null),
|
25669
|
+
});
|
25670
|
+
setErrorMsg('');
|
25671
|
+
setOpenFinalizeFormModal(true);
|
25672
|
+
};
|
25673
|
+
var onSubmitForm = function (remarks, status) { return __awaiter(void 0, void 0, void 0, function () {
|
25674
|
+
var fields, payload, response, messageContent, error_1;
|
25625
25675
|
return __generator(this, function (_a) {
|
25626
25676
|
switch (_a.label) {
|
25627
25677
|
case 0:
|
25628
25678
|
fields = form.getFieldsValue(true);
|
25629
|
-
return [4 /*yield*/, createSaveRequestPayload(fields)];
|
25679
|
+
return [4 /*yield*/, createSaveRequestPayload(fields, remarks, status)];
|
25630
25680
|
case 1:
|
25631
25681
|
payload = _a.sent();
|
25632
25682
|
setLoading(true);
|
25633
25683
|
_a.label = 2;
|
25634
25684
|
case 2:
|
25635
|
-
_a.trys.push([2,
|
25685
|
+
_a.trys.push([2, 6, 9, 10]);
|
25636
25686
|
return [4 /*yield*/, post('national/emissions', payload)];
|
25637
25687
|
case 3:
|
25638
25688
|
response = _a.sent();
|
25639
25689
|
console.log('Emission creation -> ', response);
|
25640
|
-
if ((response === null || response === void 0 ? void 0 : response.statusText) === 'SUCCESS')
|
25641
|
-
|
25642
|
-
|
25643
|
-
|
25644
|
-
|
25645
|
-
|
25646
|
-
|
25690
|
+
if (!((response === null || response === void 0 ? void 0 : response.statusText) === 'SUCCESS')) return [3 /*break*/, 5];
|
25691
|
+
setOpenSaveFormModal(false);
|
25692
|
+
messageContent = (response === null || response === void 0 ? void 0 : response.status) == axios.HttpStatusCode.Created ?
|
25693
|
+
t('ghgInventory:emissionCreationSuccess')
|
25694
|
+
: t('ghgInventory:emissionUpdateSuccess');
|
25695
|
+
if (status === GHGRecordState.FINALIZED) {
|
25696
|
+
clearUploadDoc();
|
25697
|
+
clearForm();
|
25698
|
+
messageContent = t('ghgInventory:emissionFinalizedSuccess');
|
25647
25699
|
}
|
25648
|
-
|
25700
|
+
setOpenFinalizeFormModal(false);
|
25701
|
+
antd.message.open({
|
25702
|
+
type: 'success',
|
25703
|
+
content: messageContent,
|
25704
|
+
duration: 4,
|
25705
|
+
style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
|
25706
|
+
});
|
25707
|
+
clearUploadDoc();
|
25708
|
+
return [4 /*yield*/, getEmissionData()];
|
25649
25709
|
case 4:
|
25710
|
+
_a.sent();
|
25711
|
+
_a.label = 5;
|
25712
|
+
case 5: return [3 /*break*/, 10];
|
25713
|
+
case 6:
|
25650
25714
|
error_1 = _a.sent();
|
25651
25715
|
console.log('Error in emission creation - ', error_1);
|
25716
|
+
setOpenSaveFormModal(false);
|
25717
|
+
setOpenFinalizeFormModal(false);
|
25652
25718
|
antd.message.open({
|
25653
25719
|
type: 'error',
|
25654
25720
|
content: error_1 === null || error_1 === void 0 ? void 0 : error_1.message,
|
25655
25721
|
duration: 4,
|
25656
25722
|
style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
|
25657
25723
|
});
|
25658
|
-
return [3 /*break*/,
|
25659
|
-
|
25724
|
+
if (!(error_1.statusCode == axios.HttpStatusCode.Conflict)) return [3 /*break*/, 8];
|
25725
|
+
return [4 /*yield*/, getEmissionData()];
|
25726
|
+
case 7:
|
25727
|
+
_a.sent();
|
25728
|
+
clearUploadDoc();
|
25729
|
+
_a.label = 8;
|
25730
|
+
case 8: return [3 /*break*/, 10];
|
25731
|
+
case 9:
|
25732
|
+
// eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
|
25733
|
+
setIsFormChanged(false);
|
25660
25734
|
setLoading(false);
|
25661
25735
|
return [7 /*endfinally*/];
|
25662
|
-
case
|
25736
|
+
case 10: return [2 /*return*/];
|
25663
25737
|
}
|
25664
25738
|
});
|
25665
25739
|
}); };
|
25740
|
+
var getEmissionData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
25741
|
+
var response, error_2;
|
25742
|
+
return __generator(this, function (_a) {
|
25743
|
+
switch (_a.label) {
|
25744
|
+
case 0:
|
25745
|
+
setLoading(true);
|
25746
|
+
_a.label = 1;
|
25747
|
+
case 1:
|
25748
|
+
_a.trys.push([1, 3, 4, 5]);
|
25749
|
+
return [4 /*yield*/, get('national/emissions')];
|
25750
|
+
case 2:
|
25751
|
+
response = _a.sent();
|
25752
|
+
console.log('Emissions GET -> ', response);
|
25753
|
+
if (response === null || response === void 0 ? void 0 : response.data) {
|
25754
|
+
setData(response.data);
|
25755
|
+
}
|
25756
|
+
return [3 /*break*/, 5];
|
25757
|
+
case 3:
|
25758
|
+
error_2 = _a.sent();
|
25759
|
+
console.log('Error in emission fetch - ', error_2);
|
25760
|
+
antd.message.open({
|
25761
|
+
type: 'error',
|
25762
|
+
content: error_2 === null || error_2 === void 0 ? void 0 : error_2.message,
|
25763
|
+
duration: 4,
|
25764
|
+
style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
|
25765
|
+
});
|
25766
|
+
return [3 /*break*/, 5];
|
25767
|
+
case 4:
|
25768
|
+
setIsFormChanged(false);
|
25769
|
+
setLoading(false);
|
25770
|
+
return [7 /*endfinally*/];
|
25771
|
+
case 5: return [2 /*return*/];
|
25772
|
+
}
|
25773
|
+
});
|
25774
|
+
}); };
|
25775
|
+
React.useEffect(function () {
|
25776
|
+
var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
25777
|
+
return __generator(this, function (_a) {
|
25778
|
+
switch (_a.label) {
|
25779
|
+
case 0: return [4 /*yield*/, getEmissionData()];
|
25780
|
+
case 1:
|
25781
|
+
_a.sent();
|
25782
|
+
return [2 /*return*/];
|
25783
|
+
}
|
25784
|
+
});
|
25785
|
+
}); };
|
25786
|
+
fetchData();
|
25787
|
+
}, []);
|
25666
25788
|
var setFormValues = function (emissionObject) {
|
25667
25789
|
if (emissionObject.year) {
|
25668
25790
|
form.setFieldsValue({ year: moment(emissionObject.year, 'YYYY') });
|
@@ -25715,12 +25837,26 @@ var GHGEmissionsComponent = function (props) {
|
|
25715
25837
|
setIsSavedFormDataSet(true);
|
25716
25838
|
};
|
25717
25839
|
React.useEffect(function () {
|
25718
|
-
|
25719
|
-
|
25720
|
-
|
25840
|
+
var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
|
25841
|
+
if (!isSavedFormDataSet) {
|
25842
|
+
if (savedData && savedData.length > 0) {
|
25721
25843
|
setFormValues(savedData[0]);
|
25722
25844
|
}
|
25723
25845
|
}
|
25846
|
+
if (savedData && savedData.length > 0) {
|
25847
|
+
setFormDataVersion(savedData[0].version);
|
25848
|
+
}
|
25849
|
+
console.log("data changed - version updated2? = ", formDataVersion);
|
25850
|
+
var years = data
|
25851
|
+
.filter(function (item) { return !(item.state === 'SAVED' && item.year); }) // Filter out items where state is not 'SAVED'
|
25852
|
+
.map(function (item) { return parseInt(item.year); });
|
25853
|
+
// Update 'disabledYears' only if 'years' array has changed
|
25854
|
+
setDisabledYears(function (prevYears) {
|
25855
|
+
if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
|
25856
|
+
return years;
|
25857
|
+
}
|
25858
|
+
return prevYears;
|
25859
|
+
});
|
25724
25860
|
}, [data]);
|
25725
25861
|
var checkFile = function (file) {
|
25726
25862
|
var isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
|
@@ -25736,6 +25872,12 @@ var GHGEmissionsComponent = function (props) {
|
|
25736
25872
|
}
|
25737
25873
|
return e === null || e === void 0 ? void 0 : e.fileList;
|
25738
25874
|
};
|
25875
|
+
var clearUploadDoc = function () {
|
25876
|
+
setUploadedFileName('');
|
25877
|
+
form.setFieldsValue({
|
25878
|
+
emissionsDocument: null,
|
25879
|
+
});
|
25880
|
+
};
|
25739
25881
|
var isYearDisabled = function (current) {
|
25740
25882
|
return disabledYears.includes(current.year());
|
25741
25883
|
};
|
@@ -26195,25 +26337,26 @@ var GHGEmissionsComponent = function (props) {
|
|
26195
26337
|
React.createElement("div", { className: "body-sub-title" }, t("ghgInventory:totalNationalEmissionSubTitle")))),
|
26196
26338
|
React.createElement("div", { className: "content-card add-emission" },
|
26197
26339
|
React.createElement(antd.Tabs, { defaultActiveKey: "Add New", centered: true },
|
26198
|
-
((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT ||
|
26340
|
+
((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT ||
|
26341
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.MINISTRY) && (React.createElement(antd.Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
|
26199
26342
|
React.createElement("div", null,
|
26200
|
-
React.createElement(antd.Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, name: "add-emission", className: "programme-details-form", layout: "vertical", requiredMark: true, form: form, onValuesChange: onValuesChange, onFinish:
|
26343
|
+
React.createElement(antd.Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, name: "add-emission", className: "programme-details-form", layout: "vertical", requiredMark: true, form: form, onValuesChange: onValuesChange, onFinish: onOpenSaveFormModel },
|
26201
26344
|
React.createElement(antd.Row, null,
|
26202
26345
|
React.createElement(antd.Col, { xl: 12, md: 12, className: "add-new-year-picker-col" },
|
26203
26346
|
React.createElement("div", null,
|
26204
|
-
React.createElement(antd.Form.Item, { label: t(
|
26347
|
+
React.createElement(antd.Form.Item, { label: t('ghgInventory:year'), name: "year", rules: [
|
26205
26348
|
{
|
26206
26349
|
required: true,
|
26207
|
-
message:
|
26350
|
+
message: '',
|
26208
26351
|
},
|
26209
26352
|
{
|
26210
26353
|
validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
|
26211
26354
|
return __generator(this, function (_a) {
|
26212
|
-
if (String(value).trim() ===
|
26355
|
+
if (String(value).trim() === '' ||
|
26213
26356
|
String(value).trim() === undefined ||
|
26214
26357
|
value === null ||
|
26215
26358
|
value === undefined) {
|
26216
|
-
throw new Error("".concat(t(
|
26359
|
+
throw new Error("".concat(t('ghgInventory:year'), " ").concat(t('isRequired')));
|
26217
26360
|
}
|
26218
26361
|
return [2 /*return*/];
|
26219
26362
|
});
|
@@ -26277,7 +26420,7 @@ var GHGEmissionsComponent = function (props) {
|
|
26277
26420
|
} },
|
26278
26421
|
React.createElement(antd.Button, { icon: React.createElement(icons.UploadOutlined, null) }, t("ghgInventory:upload"))))),
|
26279
26422
|
React.createElement(antd.Col, { xl: 16, md: 16, className: "add-new-upload-file-name-input" },
|
26280
|
-
React.createElement(antd.Input, { value: uploadedFileName, readOnly: true }))))),
|
26423
|
+
React.createElement(antd.Input, { value: uploadedFileName, readOnly: true, suffix: uploadedFileName && (React.createElement(antd.Button, { onClick: clearUploadDoc, icon: React.createElement(icons.DeleteOutlined, null), style: { marginRight: '-10px', padding: '0px 6px' } })) }))))),
|
26281
26424
|
React.createElement(antd.Row, { gutter: 16 },
|
26282
26425
|
React.createElement(antd.Col, { span: 9, offset: 12 },
|
26283
26426
|
React.createElement(antd.Row, { gutter: 16, className: "table-heading-row" },
|
@@ -26361,10 +26504,10 @@ var GHGEmissionsComponent = function (props) {
|
|
26361
26504
|
React.createElement(antd.Form.Item, { name: "totalCo2WithLand_co2eq" },
|
26362
26505
|
React.createElement(antd.InputNumber, null)))))),
|
26363
26506
|
React.createElement("div", { className: "steps-actions" },
|
26364
|
-
|
26365
|
-
|
26366
|
-
|
26367
|
-
|
26507
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT &&
|
26508
|
+
(React.createElement(antd.Button, { className: "finalize-btn", type: "primary", loading: loading, onClick: onOpenFinalizeFormModel }, "Finalize")),
|
26509
|
+
React.createElement(antd.Button, { className: "submit-btn", type: "primary", htmlType: "submit", loading: loading }, "Submit"),
|
26510
|
+
React.createElement(antd.Button, { className: "back-btn", onClick: onOpenResetFormModel, loading: loading }, "Cancel")))))),
|
26368
26511
|
data.map(function (tabData) {
|
26369
26512
|
return tabData.state === 'FINALIZED' && (React.createElement(antd.Tabs.TabPane, { key: tabData.id.toString(), tab: React.createElement("span", null,
|
26370
26513
|
tabData.year,
|
@@ -26374,11 +26517,7 @@ var GHGEmissionsComponent = function (props) {
|
|
26374
26517
|
React.createElement(antd.Col, { xl: 12, md: 12, className: "add-new-year-picker-col" },
|
26375
26518
|
React.createElement("div", null,
|
26376
26519
|
React.createElement(antd.Row, { className: "add-new-upload-file-label" }, "Year"),
|
26377
|
-
React.createElement(antd.DatePicker
|
26378
|
-
// onChange={handleYearChange}
|
26379
|
-
, {
|
26380
|
-
// onChange={handleYearChange}
|
26381
|
-
picker: "year", disabledDate: isYearDisabled, defaultValue: moment(tabData.year, 'YYYY'), disabled: true, size: "large" }))),
|
26520
|
+
React.createElement(antd.DatePicker, { picker: "year", disabledDate: isYearDisabled, defaultValue: moment(tabData.year, 'YYYY'), disabled: true, size: "large" }))),
|
26382
26521
|
React.createElement(antd.Col, { xl: 12, md: 12, className: "add-new-upload-file-col" },
|
26383
26522
|
React.createElement(antd.Row, { className: "add-new-upload-file-label" }, t("ghgInventory:emissionRemovalDocument")),
|
26384
26523
|
React.createElement(antd.Row, null,
|
@@ -26475,10 +26614,13 @@ var GHGEmissionsComponent = function (props) {
|
|
26475
26614
|
})));
|
26476
26615
|
})));
|
26477
26616
|
})))));
|
26478
|
-
}))))
|
26617
|
+
})))),
|
26618
|
+
React.createElement(GHGUserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onSubmitForm, onActionCanceled: onSaveFormCanceled, openModal: openSaveFormModal, errorMsg: errorMsg, loading: loading }),
|
26619
|
+
React.createElement(GHGUserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onSubmitForm, onActionCanceled: onFinalizeFormCanceled, openModal: openFinalizeFormModal, errorMsg: errorMsg, loading: loading }),
|
26620
|
+
React.createElement(DiscardChangesConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: resetForm, onActionCanceled: onResetFormCanceled, openModal: openResetFormModal, errorMsg: errorMsg, loading: loading })));
|
26479
26621
|
};
|
26480
26622
|
|
26481
|
-
var css_248z = ".ant-tabs-tab-btn {\n padding: 5px 30px;\n text-align: center;\n font-weight: 600;\n color: rgba(58, 53, 65, 0.5); }\n\n.projection-tab-container .add-projection {\n display: flex;\n flex-direction: column;\n background-color: #ffffff;\n margin: 1rem 0 1rem 0;\n border-radius: 10px;\n padding: 0 1.5rem 2.5rem 1.5rem; }\n .projection-tab-container .add-projection .add-new-year-picker-col {\n padding-left: 5%; }\n .projection-tab-container .add-projection .ant-picker {\n border-radius: 5px !important;\n height: 50px !important;\n width: 80%; }\n .projection-tab-container .add-projection .add-new-upload-file-label {\n color: rgba(58, 53, 65, 0.5);\n padding: 0 0 8px;\n line-height: 1.5715;\n white-space: initial;\n text-align: left; }\n .projection-tab-container .add-projection .add-new-upload-file-name-input input {\n height: 50px; }\n .projection-tab-container .add-projection .add-new-upload-file-inner-col button {\n height: 50px;\n font-size: 11px;\n width: 120px; }\n .projection-tab-container .add-projection .table-heading-row {\n padding-top: 20px;\n padding-bottom: 25px;\n margin-left: 10px !important; }\n .projection-tab-container .add-projection .table-heading-row .table-heading-col {\n text-align: center;\n font-size: 16px;\n font-weight: 600;\n color: #28282899; }\n .projection-tab-container .add-projection .total-emission-row {\n padding: 12px 16px;\n margin-left: 30px !important; }\n .projection-tab-container .add-projection .total-emission-row span {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .total-emission-row .total-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .projection-tab-container .add-projection .panel-header-col {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .panel-header-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .projection-tab-container .add-projection .sub-panel .panel-header-emission-value-col {\n border-bottom: none !important;\n padding-bottom: 10px; }\n .projection-tab-container .add-projection .sub-panel-heading {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n margin-top: 35px; }\n .projection-tab-container .add-projection .sub-panel-heading .panel-header-col {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .ant-collapse-ghost > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box {\n padding-top: 0px;\n padding-bottom: 12px;\n margin-left: 25px; }\n .projection-tab-container .add-projection .ant-collapse-expand-icon {\n margin-top: 5px; }\n .projection-tab-container .add-projection .ant-collapse-expand-icon svg {\n font-size: 20px;\n color: #976ED7; }\n .projection-tab-container .add-projection .ant-collapse {\n margin-left: 10px; }\n .projection-tab-container .add-projection .co2-total-pill {\n border-radius: 20px;\n background-color: rgba(145, 85, 253, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .ch4-total-pill {\n border-radius: 20px;\n background-color: rgba(217, 217, 217, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .n2o-total-pill {\n border-radius: 20px;\n background-color: rgba(185, 226, 244, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .co2eq-total-pill {\n border-radius: 20px;\n background-color: rgba(255, 166, 166, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .panel-content-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n height: 68px;\n align-items: center; }\n .projection-tab-container .add-projection .panel-content-row .panel-content-title {\n font-size: 16px;\n font-weight: 500;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .panel-content-input-box-row {\n margin-top: 14px; }\n .projection-tab-container .add-projection .panel-content-input-box-row .ant-input-number {\n height: 40px;\n width: 50px;\n margin-left:
|
26623
|
+
var css_248z = ".ant-tabs-tab-btn {\n padding: 5px 30px;\n text-align: center;\n font-weight: 600;\n color: rgba(58, 53, 65, 0.5); }\n\n.ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner {\n width: 65px !important;\n height: 32px !important;\n text-align: center !important;\n border-radius: 50px !important;\n background: #16b1ff !important;\n line-height: 30px !important; }\n\n.ant-picker-cell-disabled::before {\n width: 65px !important;\n height: 32px !important;\n text-align: center !important;\n border-radius: 50px !important;\n line-height: 30px !important; }\n\n.ant-picker-cell::before {\n left: 11px; }\n\n.ant-input-suffix {\n display: flex;\n flex: none;\n align-items: center;\n height: 50px; }\n .ant-input-suffix button {\n border: none;\n color: #8C8C8C; }\n\n.ant-input-affix-wrapper {\n padding: 0 11px;\n border-radius: 5px; }\n\n.projection-tab-container .add-projection {\n display: flex;\n flex-direction: column;\n background-color: #ffffff;\n margin: 1rem 0 1rem 0;\n border-radius: 10px;\n padding: 0 1.5rem 2.5rem 1.5rem; }\n .projection-tab-container .add-projection .add-new-year-picker-col {\n padding-left: 5%; }\n .projection-tab-container .add-projection .ant-picker {\n border-radius: 5px !important;\n height: 50px !important;\n width: 80%; }\n .projection-tab-container .add-projection .add-new-upload-file-label {\n color: rgba(58, 53, 65, 0.5);\n padding: 0 0 8px;\n line-height: 1.5715;\n white-space: initial;\n text-align: left; }\n .projection-tab-container .add-projection .add-new-upload-file-name-input input {\n height: 50px;\n color: #16b1ff; }\n .projection-tab-container .add-projection .add-new-upload-file-inner-col button {\n height: 50px;\n font-size: 11px;\n width: 120px; }\n .projection-tab-container .add-projection .table-heading-row {\n padding-top: 20px;\n padding-bottom: 25px;\n margin-left: 10px !important; }\n .projection-tab-container .add-projection .table-heading-row .table-heading-col {\n text-align: center;\n font-size: 16px;\n font-weight: 600;\n color: #28282899; }\n .projection-tab-container .add-projection .total-emission-row {\n padding: 12px 16px;\n margin-left: 30px !important; }\n .projection-tab-container .add-projection .total-emission-row span {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .total-emission-row .total-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .projection-tab-container .add-projection .panel-header-col {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .panel-header-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .projection-tab-container .add-projection .sub-panel .panel-header-emission-value-col {\n border-bottom: none !important;\n padding-bottom: 10px; }\n .projection-tab-container .add-projection .sub-panel-heading {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n margin-top: 35px; }\n .projection-tab-container .add-projection .sub-panel-heading .panel-header-col {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .ant-collapse-ghost > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box {\n padding-top: 0px;\n padding-bottom: 12px;\n margin-left: 25px; }\n .projection-tab-container .add-projection .ant-collapse-expand-icon {\n margin-top: 5px; }\n .projection-tab-container .add-projection .ant-collapse-expand-icon svg {\n font-size: 20px;\n color: #976ED7; }\n .projection-tab-container .add-projection .ant-collapse {\n margin-left: 10px; }\n .projection-tab-container .add-projection .co2-total-pill {\n border-radius: 20px;\n background-color: rgba(145, 85, 253, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .ch4-total-pill {\n border-radius: 20px;\n background-color: rgba(217, 217, 217, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .n2o-total-pill {\n border-radius: 20px;\n background-color: rgba(185, 226, 244, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .co2eq-total-pill {\n border-radius: 20px;\n background-color: rgba(255, 166, 166, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .panel-content-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n height: 68px;\n align-items: center; }\n .projection-tab-container .add-projection .panel-content-row .panel-content-title {\n font-size: 16px;\n font-weight: 500;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .panel-content-input-box-row {\n margin-top: 14px; }\n .projection-tab-container .add-projection .panel-content-input-box-row .ant-input-number {\n height: 40px;\n width: 50px;\n margin-left: 35%; }\n .projection-tab-container .add-projection .total-co2-without-land-row {\n margin-left: 40px !important;\n align-items: center;\n margin-top: 50px; }\n .projection-tab-container .add-projection .total-co2-without-land-row .total-co2-without-land-title {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .total-co2-without-land-row .panel-content-input-box-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6); }\n .projection-tab-container .add-projection .total-co2-with-land-row {\n margin-left: 40px !important;\n align-items: center; }\n .projection-tab-container .add-projection .total-co2-with-land-row .total-co2-with-land-title {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .total-co2-with-land-row .panel-content-input-box-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6); }\n .projection-tab-container .add-projection .steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n margin-top: 3rem; }\n .projection-tab-container .add-projection .steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .projection-tab-container .add-projection .steps-actions .submit-btn {\n margin-right: 1rem; }\n .projection-tab-container .add-projection .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 .projection-tab-container .add-projection .steps-actions .mg-left-1 {\n margin-left: 1rem; }\n @media only screen and (max-width: 1600px) {\n .projection-tab-container .add-projection .panel-content-input-box-row .ant-input-number {\n margin-left: 30%; } }\n";
|
26482
26624
|
styleInject(css_248z);
|
26483
26625
|
|
26484
26626
|
var ProjectionTypes = {
|
@@ -26490,403 +26632,49 @@ var ProjectionTypes = {
|
|
26490
26632
|
var GHGProjectionsComponent = function (props) {
|
26491
26633
|
var t = props.t, useUserContext = props.useUserContext, useConnection = props.useConnection;
|
26492
26634
|
var userInfoState = useUserContext().userInfoState;
|
26493
|
-
var data = [
|
26494
|
-
|
26495
|
-
|
26496
|
-
|
26497
|
-
|
26498
|
-
|
26499
|
-
|
26500
|
-
|
26501
|
-
|
26502
|
-
|
26503
|
-
|
26504
|
-
|
26505
|
-
|
26506
|
-
|
26507
|
-
|
26508
|
-
|
26509
|
-
|
26510
|
-
|
26511
|
-
|
26512
|
-
|
26513
|
-
|
26514
|
-
|
26515
|
-
|
26516
|
-
|
26517
|
-
|
26518
|
-
|
26519
|
-
|
26520
|
-
|
26521
|
-
|
26522
|
-
|
26523
|
-
|
26524
|
-
|
26525
|
-
|
26526
|
-
|
26527
|
-
|
26528
|
-
|
26529
|
-
|
26530
|
-
|
26531
|
-
|
26532
|
-
|
26533
|
-
|
26534
|
-
|
26535
|
-
|
26536
|
-
},
|
26537
|
-
otherEmissionsEnergyProduction: {
|
26538
|
-
bau: 20,
|
26539
|
-
conditionalNdc: 15,
|
26540
|
-
unconditionalNdc: 33,
|
26541
|
-
},
|
26542
|
-
},
|
26543
|
-
carbonDioxideTransportStorage: {
|
26544
|
-
transportOfCo2: {
|
26545
|
-
bau: 20,
|
26546
|
-
conditionalNdc: 15,
|
26547
|
-
unconditionalNdc: 33,
|
26548
|
-
},
|
26549
|
-
injectionStorage: {
|
26550
|
-
bau: 20,
|
26551
|
-
conditionalNdc: 15,
|
26552
|
-
unconditionalNdc: 33,
|
26553
|
-
},
|
26554
|
-
other: {
|
26555
|
-
bau: 20,
|
26556
|
-
conditionalNdc: 15,
|
26557
|
-
unconditionalNdc: 33,
|
26558
|
-
},
|
26559
|
-
},
|
26560
|
-
},
|
26561
|
-
industrialProcessesProductUse: {
|
26562
|
-
mineralIndustry: {
|
26563
|
-
bau: 20,
|
26564
|
-
conditionalNdc: 15,
|
26565
|
-
unconditionalNdc: 33,
|
26566
|
-
},
|
26567
|
-
chemicalIndustry: {
|
26568
|
-
bau: 20,
|
26569
|
-
conditionalNdc: 15,
|
26570
|
-
unconditionalNdc: 33,
|
26571
|
-
},
|
26572
|
-
metalIndustry: {
|
26573
|
-
bau: 20,
|
26574
|
-
conditionalNdc: 15,
|
26575
|
-
unconditionalNdc: 33,
|
26576
|
-
},
|
26577
|
-
nonEnergyProductsFuelsSolventUse: {
|
26578
|
-
bau: 20,
|
26579
|
-
conditionalNdc: 15,
|
26580
|
-
unconditionalNdc: 33,
|
26581
|
-
},
|
26582
|
-
electronicsIndustry: {
|
26583
|
-
bau: 20,
|
26584
|
-
conditionalNdc: 15,
|
26585
|
-
unconditionalNdc: 33,
|
26586
|
-
},
|
26587
|
-
productUsesSubstOzoneDepletingSubs: {
|
26588
|
-
bau: 20,
|
26589
|
-
conditionalNdc: 15,
|
26590
|
-
unconditionalNdc: 33,
|
26591
|
-
},
|
26592
|
-
otherProductManufactureUse: {
|
26593
|
-
bau: 20,
|
26594
|
-
conditionalNdc: 15,
|
26595
|
-
unconditionalNdc: 33,
|
26596
|
-
},
|
26597
|
-
other: {
|
26598
|
-
bau: 20,
|
26599
|
-
conditionalNdc: 15,
|
26600
|
-
unconditionalNdc: 33,
|
26601
|
-
},
|
26602
|
-
},
|
26603
|
-
agricultureForestryOtherLandUse: {
|
26604
|
-
livestock: { bau: 20, conditionalNdc: 15, unconditionalNdc: 33 },
|
26605
|
-
land: {
|
26606
|
-
bau: 20,
|
26607
|
-
conditionalNdc: 15,
|
26608
|
-
unconditionalNdc: 33,
|
26609
|
-
},
|
26610
|
-
aggregateNonCo2SourcesLand: {
|
26611
|
-
bau: 20,
|
26612
|
-
conditionalNdc: 15,
|
26613
|
-
unconditionalNdc: 33,
|
26614
|
-
},
|
26615
|
-
other: {
|
26616
|
-
bau: 20,
|
26617
|
-
conditionalNdc: 15,
|
26618
|
-
unconditionalNdc: 33,
|
26619
|
-
},
|
26620
|
-
},
|
26621
|
-
waste: {
|
26622
|
-
solidWasteDisposal: {
|
26623
|
-
bau: 20,
|
26624
|
-
conditionalNdc: 15,
|
26625
|
-
unconditionalNdc: 33,
|
26626
|
-
},
|
26627
|
-
biologicalTreatmentSolidWaste: {
|
26628
|
-
bau: 20,
|
26629
|
-
conditionalNdc: 15,
|
26630
|
-
unconditionalNdc: 33,
|
26631
|
-
},
|
26632
|
-
incinerationOpenBurningWaste: {
|
26633
|
-
bau: 20,
|
26634
|
-
conditionalNdc: 15,
|
26635
|
-
unconditionalNdc: 33,
|
26636
|
-
},
|
26637
|
-
wastewaterTreatmentDischarge: {
|
26638
|
-
bau: 20,
|
26639
|
-
conditionalNdc: 15,
|
26640
|
-
unconditionalNdc: 33,
|
26641
|
-
},
|
26642
|
-
other: {
|
26643
|
-
bau: 20,
|
26644
|
-
conditionalNdc: 15,
|
26645
|
-
unconditionalNdc: 33,
|
26646
|
-
},
|
26647
|
-
},
|
26648
|
-
other: {
|
26649
|
-
indirectN2oEmissions: {
|
26650
|
-
bau: 20,
|
26651
|
-
conditionalNdc: 15,
|
26652
|
-
unconditionalNdc: 33,
|
26653
|
-
},
|
26654
|
-
other: {
|
26655
|
-
bau: 20,
|
26656
|
-
conditionalNdc: 15,
|
26657
|
-
unconditionalNdc: 33,
|
26658
|
-
},
|
26659
|
-
},
|
26660
|
-
totalCo2WithoutLand: {
|
26661
|
-
bau: 20,
|
26662
|
-
conditionalNdc: 15,
|
26663
|
-
unconditionalNdc: 33,
|
26664
|
-
},
|
26665
|
-
totalCo2WithLand: {
|
26666
|
-
bau: 20,
|
26667
|
-
conditionalNdc: 15,
|
26668
|
-
unconditionalNdc: 33,
|
26669
|
-
},
|
26670
|
-
state: 'FINALIZED',
|
26671
|
-
version: 1,
|
26672
|
-
created_at: 1698644100397,
|
26673
|
-
},
|
26674
|
-
{
|
26675
|
-
id: 2,
|
26676
|
-
country: 'NG',
|
26677
|
-
year: 2022,
|
26678
|
-
energyEmissions: {
|
26679
|
-
fuelCombustionActivities: {
|
26680
|
-
energyIndustries: {
|
26681
|
-
bau: 20,
|
26682
|
-
conditionalNdc: 15,
|
26683
|
-
unconditionalNdc: 33,
|
26684
|
-
},
|
26685
|
-
manufacturingIndustriesConstruction: {
|
26686
|
-
bau: 20,
|
26687
|
-
conditionalNdc: 15,
|
26688
|
-
unconditionalNdc: 33,
|
26689
|
-
},
|
26690
|
-
transport: {
|
26691
|
-
bau: 20,
|
26692
|
-
conditionalNdc: 15,
|
26693
|
-
unconditionalNdc: 33,
|
26694
|
-
},
|
26695
|
-
otherSectors: {
|
26696
|
-
bau: 20,
|
26697
|
-
conditionalNdc: 15,
|
26698
|
-
unconditionalNdc: 33,
|
26699
|
-
},
|
26700
|
-
nonSpecified: {
|
26701
|
-
bau: 20,
|
26702
|
-
conditionalNdc: 15,
|
26703
|
-
unconditionalNdc: 33,
|
26704
|
-
},
|
26705
|
-
},
|
26706
|
-
fugitiveEmissionsFromFuels: {
|
26707
|
-
solidFuels: {
|
26708
|
-
bau: 20,
|
26709
|
-
conditionalNdc: 15,
|
26710
|
-
unconditionalNdc: 33,
|
26711
|
-
},
|
26712
|
-
oilNaturalGas: {
|
26713
|
-
bau: 20,
|
26714
|
-
conditionalNdc: 15,
|
26715
|
-
unconditionalNdc: 33,
|
26716
|
-
},
|
26717
|
-
otherEmissionsEnergyProduction: {
|
26718
|
-
bau: 20,
|
26719
|
-
conditionalNdc: 15,
|
26720
|
-
unconditionalNdc: 33,
|
26721
|
-
},
|
26722
|
-
},
|
26723
|
-
carbonDioxideTransportStorage: {
|
26724
|
-
transportOfCo2: {
|
26725
|
-
bau: 20,
|
26726
|
-
conditionalNdc: 15,
|
26727
|
-
unconditionalNdc: 33,
|
26728
|
-
},
|
26729
|
-
injectionStorage: {
|
26730
|
-
bau: 20,
|
26731
|
-
conditionalNdc: 15,
|
26732
|
-
unconditionalNdc: 33,
|
26733
|
-
},
|
26734
|
-
other: {
|
26735
|
-
bau: 20,
|
26736
|
-
conditionalNdc: 15,
|
26737
|
-
unconditionalNdc: 33,
|
26738
|
-
},
|
26739
|
-
},
|
26740
|
-
},
|
26741
|
-
industrialProcessesProductUse: {
|
26742
|
-
mineralIndustry: {
|
26743
|
-
bau: 20,
|
26744
|
-
conditionalNdc: 15,
|
26745
|
-
unconditionalNdc: 33,
|
26746
|
-
},
|
26747
|
-
chemicalIndustry: {
|
26748
|
-
bau: 20,
|
26749
|
-
conditionalNdc: 15,
|
26750
|
-
unconditionalNdc: 33,
|
26751
|
-
},
|
26752
|
-
metalIndustry: {
|
26753
|
-
bau: 20,
|
26754
|
-
conditionalNdc: 15,
|
26755
|
-
unconditionalNdc: 33,
|
26756
|
-
},
|
26757
|
-
nonEnergyProductsFuelsSolventUse: {
|
26758
|
-
bau: 20,
|
26759
|
-
conditionalNdc: 15,
|
26760
|
-
unconditionalNdc: 33,
|
26761
|
-
},
|
26762
|
-
electronicsIndustry: {
|
26763
|
-
bau: 20,
|
26764
|
-
conditionalNdc: 15,
|
26765
|
-
unconditionalNdc: 33,
|
26766
|
-
},
|
26767
|
-
productUsesSubstOzoneDepletingSubs: {
|
26768
|
-
bau: 20,
|
26769
|
-
conditionalNdc: 15,
|
26770
|
-
unconditionalNdc: 33,
|
26771
|
-
},
|
26772
|
-
otherProductManufactureUse: {
|
26773
|
-
bau: 20,
|
26774
|
-
conditionalNdc: 15,
|
26775
|
-
unconditionalNdc: 33,
|
26776
|
-
},
|
26777
|
-
other: {
|
26778
|
-
bau: 20,
|
26779
|
-
conditionalNdc: 15,
|
26780
|
-
unconditionalNdc: 33,
|
26781
|
-
},
|
26782
|
-
},
|
26783
|
-
agricultureForestryOtherLandUse: {
|
26784
|
-
livestock: { bau: 20, conditionalNdc: 15, unconditionalNdc: 33 },
|
26785
|
-
land: {
|
26786
|
-
bau: 20,
|
26787
|
-
conditionalNdc: 15,
|
26788
|
-
unconditionalNdc: 33,
|
26789
|
-
},
|
26790
|
-
aggregateNonCo2SourcesLand: {
|
26791
|
-
bau: 20,
|
26792
|
-
conditionalNdc: 15,
|
26793
|
-
unconditionalNdc: 33,
|
26794
|
-
},
|
26795
|
-
other: {
|
26796
|
-
bau: 20,
|
26797
|
-
conditionalNdc: 15,
|
26798
|
-
unconditionalNdc: 33,
|
26799
|
-
},
|
26800
|
-
},
|
26801
|
-
waste: {
|
26802
|
-
solidWasteDisposal: {
|
26803
|
-
bau: 20,
|
26804
|
-
conditionalNdc: 15,
|
26805
|
-
unconditionalNdc: 33,
|
26806
|
-
},
|
26807
|
-
biologicalTreatmentSolidWaste: {
|
26808
|
-
bau: 20,
|
26809
|
-
conditionalNdc: 15,
|
26810
|
-
unconditionalNdc: 33,
|
26811
|
-
},
|
26812
|
-
incinerationOpenBurningWaste: {
|
26813
|
-
bau: 20,
|
26814
|
-
conditionalNdc: 15,
|
26815
|
-
unconditionalNdc: 33,
|
26816
|
-
},
|
26817
|
-
wastewaterTreatmentDischarge: {
|
26818
|
-
bau: 20,
|
26819
|
-
conditionalNdc: 15,
|
26820
|
-
unconditionalNdc: 33,
|
26821
|
-
},
|
26822
|
-
other: {
|
26823
|
-
bau: 20,
|
26824
|
-
conditionalNdc: 15,
|
26825
|
-
unconditionalNdc: 33,
|
26826
|
-
},
|
26827
|
-
},
|
26828
|
-
other: {
|
26829
|
-
indirectN2oEmissions: {
|
26830
|
-
bau: 20,
|
26831
|
-
conditionalNdc: 15,
|
26832
|
-
unconditionalNdc: 33,
|
26833
|
-
},
|
26834
|
-
other: {
|
26835
|
-
bau: 20,
|
26836
|
-
conditionalNdc: 15,
|
26837
|
-
unconditionalNdc: 33,
|
26838
|
-
},
|
26839
|
-
},
|
26840
|
-
totalCo2WithoutLand: {
|
26841
|
-
bau: 20,
|
26842
|
-
conditionalNdc: 15,
|
26843
|
-
unconditionalNdc: 33,
|
26844
|
-
},
|
26845
|
-
totalCo2WithLand: {
|
26846
|
-
bau: 20,
|
26847
|
-
conditionalNdc: 15,
|
26848
|
-
unconditionalNdc: 33,
|
26849
|
-
},
|
26850
|
-
state: 'FINALIZED',
|
26851
|
-
version: 1,
|
26852
|
-
created_at: 1698644100397,
|
26853
|
-
},
|
26854
|
-
];
|
26855
|
-
var _a = useConnection(); _a.put; _a.get; var post = _a.post;
|
26856
|
-
var _b = React.useState(false), loading = _b[0], setLoading = _b[1];
|
26857
|
-
var _c = React.useState(false), isPendingFinalization = _c[0], setIsPendingFinalization = _c[1];
|
26858
|
-
var _d = React.useState(null); _d[0]; var setSelectedYear = _d[1];
|
26859
|
-
var _e = React.useState(''), uploadedFileName = _e[0], setUploadedFileName = _e[1];
|
26860
|
-
var _f = React.useState([]), disabledYears = _f[0], setDisabledYears = _f[1];
|
26861
|
-
var _g = React.useState(); _g[0]; var setChangedValues = _g[1];
|
26862
|
-
var _h = React.useState(0), totalNationalBau = _h[0], setTotalNationalBau = _h[1];
|
26863
|
-
var _j = React.useState(0), totalNationalConditionalNdc = _j[0], setTotalNationalConditionalNdc = _j[1];
|
26864
|
-
var _k = React.useState(0), totalNationalUnconditionalNdc = _k[0], setTotalNationalUnconditionalNdc = _k[1];
|
26865
|
-
var _l = React.useState(0), energyEmissionsBau = _l[0], setEnergyEmissionsBau = _l[1];
|
26866
|
-
var _m = React.useState(0), energyEmissionsConditionalNdc = _m[0], setEnergyEmissionsConditionalNdc = _m[1];
|
26867
|
-
var _o = React.useState(0), energyEmissionsUnconditionalNdc = _o[0], setEnergyEmissionsUnconditionalNdc = _o[1];
|
26868
|
-
var _p = React.useState(0), fuelCombustionActivitiesBau = _p[0], setFuelCombustionActivitiesBau = _p[1];
|
26869
|
-
var _q = React.useState(0), fuelCombustionActivitiesConditionalNdc = _q[0], setFuelCombustionActivitiesConditionalNdc = _q[1];
|
26870
|
-
var _r = React.useState(0), fuelCombustionActivitiesUnconditionalNdc = _r[0], setFuelCombustionActivitiesUnconditionalNdc = _r[1];
|
26871
|
-
var _s = React.useState(0), fugitiveEmissionsFromFuelsBau = _s[0], setFugitiveEmissionsFromFuelsBau = _s[1];
|
26872
|
-
var _t = React.useState(0), fugitiveEmissionsFromFuelsConditionalNdc = _t[0], setFugitiveEmissionsFromFuelsConditionalNdc = _t[1];
|
26873
|
-
var _u = React.useState(0), fugitiveEmissionsFromFuelsUnconditionalNdc = _u[0], setFugitiveEmissionsFromFuelsUnconditionalNdc = _u[1];
|
26874
|
-
var _v = React.useState(0), carbonDioxideTransportStorageBau = _v[0], setCarbonDioxideTransportStorageBau = _v[1];
|
26875
|
-
var _w = React.useState(0), carbonDioxideTransportStorageConditionalNdc = _w[0], setCarbonDioxideTransportStorageConditionalNdc = _w[1];
|
26876
|
-
var _x = React.useState(0), carbonDioxideTransportStorageUnconditionalNdc = _x[0], setCarbonDioxideTransportStorageUnconditionalNdc = _x[1];
|
26877
|
-
var _y = React.useState(0), industrialProcessesProductUseBau = _y[0], setIndustrialProcessesProductUseBau = _y[1];
|
26878
|
-
var _z = React.useState(0), industrialProcessesProductUseConditionalNdc = _z[0], setIndustrialProcessesProductUseConditionalNdc = _z[1];
|
26879
|
-
var _0 = React.useState(0), industrialProcessesProductUseUnconditionalNdc = _0[0], setIndustrialProcessesProductUseUnconditionalNdc = _0[1];
|
26880
|
-
var _1 = React.useState(0), agricultureForestryOtherLandUseBau = _1[0], setAgricultureForestryOtherLandUseBau = _1[1];
|
26881
|
-
var _2 = React.useState(0), agricultureForestryOtherLandUseConditionalNdc = _2[0], setAgricultureForestryOtherLandUseConditionalNdc = _2[1];
|
26882
|
-
var _3 = React.useState(0), agricultureForestryOtherLandUseUnconditionalNdc = _3[0], setAgricultureForestryOtherLandUseUnconditionalNdc = _3[1];
|
26883
|
-
var _4 = React.useState(0), wasteBau = _4[0], setWasteBau = _4[1];
|
26884
|
-
var _5 = React.useState(0), wasteConditionalNdc = _5[0], setWasteConditionalNdc = _5[1];
|
26885
|
-
var _6 = React.useState(0), wasteUnconditionalNdc = _6[0], setWasteUnconditionalNdc = _6[1];
|
26886
|
-
var _7 = React.useState(0), otherBau = _7[0], setOtherBau = _7[1];
|
26887
|
-
var _8 = React.useState(0), otherConditionalNdc = _8[0], setOtherConditionalNdc = _8[1];
|
26888
|
-
var _9 = React.useState(0), otherUnconditionalNdc = _9[0], setOtherUnconditionalNdc = _9[1];
|
26889
|
-
var _10 = React.useState(false), isSavedFormDataSet = _10[0], setIsSavedFormDataSet = _10[1];
|
26635
|
+
var _a = React.useState([]), data = _a[0], setData = _a[1];
|
26636
|
+
var _b = useConnection(); _b.put; var get = _b.get, post = _b.post;
|
26637
|
+
var _c = React.useState(false), loading = _c[0], setLoading = _c[1];
|
26638
|
+
var _d = React.useState(false), isPendingFinalization = _d[0], setIsPendingFinalization = _d[1];
|
26639
|
+
var _e = React.useState(null); _e[0]; var setSelectedYear = _e[1];
|
26640
|
+
var _f = React.useState(''), uploadedFileName = _f[0], setUploadedFileName = _f[1];
|
26641
|
+
var _g = React.useState([]), disabledYears = _g[0], setDisabledYears = _g[1];
|
26642
|
+
var _h = React.useState(); _h[0]; _h[1];
|
26643
|
+
var _j = React.useState(0), totalNationalBau = _j[0], setTotalNationalBau = _j[1];
|
26644
|
+
var _k = React.useState(0), totalNationalConditionalNdc = _k[0], setTotalNationalConditionalNdc = _k[1];
|
26645
|
+
var _l = React.useState(0), totalNationalUnconditionalNdc = _l[0], setTotalNationalUnconditionalNdc = _l[1];
|
26646
|
+
var _m = React.useState(0), energyEmissionsBau = _m[0], setEnergyEmissionsBau = _m[1];
|
26647
|
+
var _o = React.useState(0), energyEmissionsConditionalNdc = _o[0], setEnergyEmissionsConditionalNdc = _o[1];
|
26648
|
+
var _p = React.useState(0), energyEmissionsUnconditionalNdc = _p[0], setEnergyEmissionsUnconditionalNdc = _p[1];
|
26649
|
+
var _q = React.useState(0), fuelCombustionActivitiesBau = _q[0], setFuelCombustionActivitiesBau = _q[1];
|
26650
|
+
var _r = React.useState(0), fuelCombustionActivitiesConditionalNdc = _r[0], setFuelCombustionActivitiesConditionalNdc = _r[1];
|
26651
|
+
var _s = React.useState(0), fuelCombustionActivitiesUnconditionalNdc = _s[0], setFuelCombustionActivitiesUnconditionalNdc = _s[1];
|
26652
|
+
var _t = React.useState(0), fugitiveEmissionsFromFuelsBau = _t[0], setFugitiveEmissionsFromFuelsBau = _t[1];
|
26653
|
+
var _u = React.useState(0), fugitiveEmissionsFromFuelsConditionalNdc = _u[0], setFugitiveEmissionsFromFuelsConditionalNdc = _u[1];
|
26654
|
+
var _v = React.useState(0), fugitiveEmissionsFromFuelsUnconditionalNdc = _v[0], setFugitiveEmissionsFromFuelsUnconditionalNdc = _v[1];
|
26655
|
+
var _w = React.useState(0), carbonDioxideTransportStorageBau = _w[0], setCarbonDioxideTransportStorageBau = _w[1];
|
26656
|
+
var _x = React.useState(0), carbonDioxideTransportStorageConditionalNdc = _x[0], setCarbonDioxideTransportStorageConditionalNdc = _x[1];
|
26657
|
+
var _y = React.useState(0), carbonDioxideTransportStorageUnconditionalNdc = _y[0], setCarbonDioxideTransportStorageUnconditionalNdc = _y[1];
|
26658
|
+
var _z = React.useState(0), industrialProcessesProductUseBau = _z[0], setIndustrialProcessesProductUseBau = _z[1];
|
26659
|
+
var _0 = React.useState(0), industrialProcessesProductUseConditionalNdc = _0[0], setIndustrialProcessesProductUseConditionalNdc = _0[1];
|
26660
|
+
var _1 = React.useState(0), industrialProcessesProductUseUnconditionalNdc = _1[0], setIndustrialProcessesProductUseUnconditionalNdc = _1[1];
|
26661
|
+
var _2 = React.useState(0), agricultureForestryOtherLandUseBau = _2[0], setAgricultureForestryOtherLandUseBau = _2[1];
|
26662
|
+
var _3 = React.useState(0), agricultureForestryOtherLandUseConditionalNdc = _3[0], setAgricultureForestryOtherLandUseConditionalNdc = _3[1];
|
26663
|
+
var _4 = React.useState(0), agricultureForestryOtherLandUseUnconditionalNdc = _4[0], setAgricultureForestryOtherLandUseUnconditionalNdc = _4[1];
|
26664
|
+
var _5 = React.useState(0), wasteBau = _5[0], setWasteBau = _5[1];
|
26665
|
+
var _6 = React.useState(0), wasteConditionalNdc = _6[0], setWasteConditionalNdc = _6[1];
|
26666
|
+
var _7 = React.useState(0), wasteUnconditionalNdc = _7[0], setWasteUnconditionalNdc = _7[1];
|
26667
|
+
var _8 = React.useState(0), otherBau = _8[0], setOtherBau = _8[1];
|
26668
|
+
var _9 = React.useState(0), otherConditionalNdc = _9[0], setOtherConditionalNdc = _9[1];
|
26669
|
+
var _10 = React.useState(0), otherUnconditionalNdc = _10[0], setOtherUnconditionalNdc = _10[1];
|
26670
|
+
var _11 = React.useState(false), isSavedFormDataSet = _11[0], setIsSavedFormDataSet = _11[1];
|
26671
|
+
var _12 = React.useState(1), formDataVersion = _12[0], setFormDataVersion = _12[1];
|
26672
|
+
var _13 = React.useState(false), isFormChanged = _13[0], setIsFormChanged = _13[1];
|
26673
|
+
var _14 = React.useState(false), openSaveFormModal = _14[0], setOpenSaveFormModal = _14[1];
|
26674
|
+
var _15 = React.useState(false), openFinalizeFormModal = _15[0], setOpenFinalizeFormModal = _15[1];
|
26675
|
+
var _16 = React.useState(false), openResetFormModal = _16[0], setOpenResetFormModal = _16[1];
|
26676
|
+
var _17 = React.useState(''), errorMsg = _17[0], setErrorMsg = _17[1];
|
26677
|
+
var _18 = React.useState({}), actionInfo = _18[0], setActionInfo = _18[1];
|
26890
26678
|
var Panel = antd.Collapse.Panel;
|
26891
26679
|
var form = antd.Form.useForm()[0];
|
26892
26680
|
var createSetFieldObject = function (obj, objName) {
|
@@ -26987,16 +26775,7 @@ var GHGProjectionsComponent = function (props) {
|
|
26987
26775
|
};
|
26988
26776
|
React.useEffect(function () {
|
26989
26777
|
var hasSaveState = data.some(function (item) { return item.state === 'SAVED'; });
|
26990
|
-
var years = data.map(function (item) { return !(item.state === 'SAVED') && item.year; });
|
26991
|
-
console.log(uploadedFileName);
|
26992
26778
|
setIsPendingFinalization(hasSaveState);
|
26993
|
-
// Update 'disabledYears' only if 'years' array has changed
|
26994
|
-
setDisabledYears(function (prevYears) {
|
26995
|
-
if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
|
26996
|
-
return years;
|
26997
|
-
}
|
26998
|
-
return prevYears;
|
26999
|
-
});
|
27000
26779
|
}, [data, uploadedFileName]);
|
27001
26780
|
function calculateSumEmissionView(obj, conditionType) {
|
27002
26781
|
var sum = 0;
|
@@ -27012,10 +26791,15 @@ var GHGProjectionsComponent = function (props) {
|
|
27012
26791
|
}
|
27013
26792
|
return sum;
|
27014
26793
|
}
|
27015
|
-
var onValuesChange = function (
|
27016
|
-
|
27017
|
-
|
27018
|
-
|
26794
|
+
var onValuesChange = function (changedValues, allValues) {
|
26795
|
+
var initialValues = null;
|
26796
|
+
if (isPendingFinalization) {
|
26797
|
+
var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
|
26798
|
+
initialValues = savedData[0];
|
26799
|
+
}
|
26800
|
+
var currentValues = form.getFieldsValue(true);
|
26801
|
+
var isChanged = !(JSON.stringify(currentValues) === JSON.stringify(initialValues));
|
26802
|
+
setIsFormChanged(isChanged);
|
27019
26803
|
};
|
27020
26804
|
var getBase64 = function (file) {
|
27021
26805
|
return new Promise(function (resolve, reject) {
|
@@ -27025,7 +26809,7 @@ var GHGProjectionsComponent = function (props) {
|
|
27025
26809
|
reader.onerror = function (error) { return reject(error); };
|
27026
26810
|
});
|
27027
26811
|
};
|
27028
|
-
var createSaveRequestPayload = function (fields) { return __awaiter(void 0, void 0, void 0, function () {
|
26812
|
+
var createSaveRequestPayload = function (fields, remarks, status) { return __awaiter(void 0, void 0, void 0, function () {
|
27029
26813
|
var requestBody, savedEmission, emissionImportBase64;
|
27030
26814
|
var _a;
|
27031
26815
|
return __generator(this, function (_b) {
|
@@ -27210,7 +26994,9 @@ var GHGProjectionsComponent = function (props) {
|
|
27210
26994
|
conditionalNdc: fields === null || fields === void 0 ? void 0 : fields.totalCo2WithLand_conditionalNdc,
|
27211
26995
|
unconditionalNdc: fields === null || fields === void 0 ? void 0 : fields.totalCo2WithLand_unconditionalNdc,
|
27212
26996
|
},
|
27213
|
-
state:
|
26997
|
+
state: status,
|
26998
|
+
remarks: remarks,
|
26999
|
+
version: formDataVersion,
|
27214
27000
|
};
|
27215
27001
|
requestBody = savedEmission;
|
27216
27002
|
if (!(fields === null || fields === void 0 ? void 0 : fields.emissionsDocument)) return [3 /*break*/, 2];
|
@@ -27225,46 +27011,216 @@ var GHGProjectionsComponent = function (props) {
|
|
27225
27011
|
}
|
27226
27012
|
});
|
27227
27013
|
}); };
|
27228
|
-
var
|
27229
|
-
|
27014
|
+
var clearForm = function () {
|
27015
|
+
form.resetFields();
|
27016
|
+
setFuelCombustionActivitiesBau(0);
|
27017
|
+
setFuelCombustionActivitiesConditionalNdc(0);
|
27018
|
+
setFuelCombustionActivitiesUnconditionalNdc(0);
|
27019
|
+
setFugitiveEmissionsFromFuelsBau(0);
|
27020
|
+
setFugitiveEmissionsFromFuelsConditionalNdc(0);
|
27021
|
+
setFugitiveEmissionsFromFuelsUnconditionalNdc(0);
|
27022
|
+
setCarbonDioxideTransportStorageBau(0);
|
27023
|
+
setCarbonDioxideTransportStorageConditionalNdc(0);
|
27024
|
+
setCarbonDioxideTransportStorageUnconditionalNdc(0);
|
27025
|
+
setIndustrialProcessesProductUseBau(0);
|
27026
|
+
setIndustrialProcessesProductUseConditionalNdc(0);
|
27027
|
+
setIndustrialProcessesProductUseUnconditionalNdc(0);
|
27028
|
+
setAgricultureForestryOtherLandUseBau(0);
|
27029
|
+
setAgricultureForestryOtherLandUseConditionalNdc(0);
|
27030
|
+
setAgricultureForestryOtherLandUseUnconditionalNdc(0);
|
27031
|
+
setWasteBau(0);
|
27032
|
+
setWasteConditionalNdc(0);
|
27033
|
+
setWasteUnconditionalNdc(0);
|
27034
|
+
setOtherBau(0);
|
27035
|
+
setOtherConditionalNdc(0);
|
27036
|
+
setOtherUnconditionalNdc(0);
|
27037
|
+
};
|
27038
|
+
var resetForm = function () { return __awaiter(void 0, void 0, void 0, function () {
|
27039
|
+
return __generator(this, function (_a) {
|
27040
|
+
switch (_a.label) {
|
27041
|
+
case 0:
|
27042
|
+
// eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
|
27043
|
+
return [4 /*yield*/, getProjectionData()];
|
27044
|
+
case 1:
|
27045
|
+
// eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
|
27046
|
+
_a.sent();
|
27047
|
+
setOpenResetFormModal(false);
|
27048
|
+
setIsSavedFormDataSet(false);
|
27049
|
+
clearUploadDoc();
|
27050
|
+
if (!isPendingFinalization) {
|
27051
|
+
clearForm();
|
27052
|
+
}
|
27053
|
+
antd.message.open({
|
27054
|
+
type: 'success',
|
27055
|
+
content: t('ghgInventory:formCancelledSuccess'),
|
27056
|
+
duration: 4,
|
27057
|
+
style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
|
27058
|
+
});
|
27059
|
+
return [2 /*return*/];
|
27060
|
+
}
|
27061
|
+
});
|
27062
|
+
}); };
|
27063
|
+
var onResetFormCanceled = function () {
|
27064
|
+
setOpenResetFormModal(false);
|
27065
|
+
};
|
27066
|
+
var onOpenResetFormModel = function () {
|
27067
|
+
setActionInfo({
|
27068
|
+
action: "".concat(t('ghgInventory:proceed')),
|
27069
|
+
headerText: "".concat(t('ghgInventory:discardHeaderText')),
|
27070
|
+
type: 'danger',
|
27071
|
+
icon: React.createElement(icons.CloseCircleOutlined, null),
|
27072
|
+
});
|
27073
|
+
setErrorMsg('');
|
27074
|
+
setOpenResetFormModal(true);
|
27075
|
+
};
|
27076
|
+
var onSaveFormCanceled = function () {
|
27077
|
+
setOpenSaveFormModal(false);
|
27078
|
+
};
|
27079
|
+
var onOpenSaveFormModel = function () {
|
27080
|
+
if (!isFormChanged) {
|
27081
|
+
antd.message.open({
|
27082
|
+
type: 'error',
|
27083
|
+
content: t('ghgInventory:formNotChanged'),
|
27084
|
+
duration: 4,
|
27085
|
+
style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
|
27086
|
+
});
|
27087
|
+
}
|
27088
|
+
else {
|
27089
|
+
setActionInfo({
|
27090
|
+
action: "".concat(t("ghgInventory:submit")),
|
27091
|
+
headerText: "".concat(t("ghgInventory:submitModelHeader")),
|
27092
|
+
type: "primary",
|
27093
|
+
icon: React.createElement(icons.CheckCircleOutlined, null),
|
27094
|
+
});
|
27095
|
+
setErrorMsg('');
|
27096
|
+
setOpenSaveFormModal(true);
|
27097
|
+
}
|
27098
|
+
};
|
27099
|
+
var onFinalizeFormCanceled = function () {
|
27100
|
+
setOpenFinalizeFormModal(false);
|
27101
|
+
};
|
27102
|
+
var onOpenFinalizeFormModel = function () {
|
27103
|
+
setActionInfo({
|
27104
|
+
action: "".concat(t("ghgInventory:finalize")),
|
27105
|
+
headerText: "".concat(t("ghgInventory:finalizeModelHeader")),
|
27106
|
+
type: "primary",
|
27107
|
+
icon: React.createElement(Icon.ClipboardCheck, null),
|
27108
|
+
});
|
27109
|
+
setErrorMsg('');
|
27110
|
+
setOpenFinalizeFormModal(true);
|
27111
|
+
};
|
27112
|
+
var getProjectionData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
27113
|
+
var response, error_1;
|
27114
|
+
return __generator(this, function (_a) {
|
27115
|
+
switch (_a.label) {
|
27116
|
+
case 0:
|
27117
|
+
setLoading(true);
|
27118
|
+
_a.label = 1;
|
27119
|
+
case 1:
|
27120
|
+
_a.trys.push([1, 3, 4, 5]);
|
27121
|
+
return [4 /*yield*/, get('national/projections')];
|
27122
|
+
case 2:
|
27123
|
+
response = _a.sent();
|
27124
|
+
console.log('Projection GET -> ', response);
|
27125
|
+
if (response === null || response === void 0 ? void 0 : response.data) {
|
27126
|
+
setData(response.data);
|
27127
|
+
}
|
27128
|
+
return [3 /*break*/, 5];
|
27129
|
+
case 3:
|
27130
|
+
error_1 = _a.sent();
|
27131
|
+
console.log('Error in projection fetch - ', error_1);
|
27132
|
+
antd.message.open({
|
27133
|
+
type: 'error',
|
27134
|
+
content: error_1 === null || error_1 === void 0 ? void 0 : error_1.message,
|
27135
|
+
duration: 4,
|
27136
|
+
style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
|
27137
|
+
});
|
27138
|
+
return [3 /*break*/, 5];
|
27139
|
+
case 4:
|
27140
|
+
setIsFormChanged(false);
|
27141
|
+
setLoading(false);
|
27142
|
+
return [7 /*endfinally*/];
|
27143
|
+
case 5: return [2 /*return*/];
|
27144
|
+
}
|
27145
|
+
});
|
27146
|
+
}); };
|
27147
|
+
React.useEffect(function () {
|
27148
|
+
var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
27149
|
+
return __generator(this, function (_a) {
|
27150
|
+
switch (_a.label) {
|
27151
|
+
case 0: return [4 /*yield*/, getProjectionData()];
|
27152
|
+
case 1:
|
27153
|
+
_a.sent();
|
27154
|
+
return [2 /*return*/];
|
27155
|
+
}
|
27156
|
+
});
|
27157
|
+
}); };
|
27158
|
+
fetchData();
|
27159
|
+
}, []);
|
27160
|
+
var onSubmitForm = function (remarks, status) { return __awaiter(void 0, void 0, void 0, function () {
|
27161
|
+
var fields, payload, response, messageContent, error_2;
|
27230
27162
|
return __generator(this, function (_a) {
|
27231
27163
|
switch (_a.label) {
|
27232
27164
|
case 0:
|
27233
27165
|
fields = form.getFieldsValue(true);
|
27234
|
-
return [4 /*yield*/, createSaveRequestPayload(fields)];
|
27166
|
+
return [4 /*yield*/, createSaveRequestPayload(fields, remarks, status)];
|
27235
27167
|
case 1:
|
27236
27168
|
payload = _a.sent();
|
27237
27169
|
setLoading(true);
|
27238
27170
|
_a.label = 2;
|
27239
27171
|
case 2:
|
27240
|
-
_a.trys.push([2,
|
27172
|
+
_a.trys.push([2, 6, 9, 10]);
|
27241
27173
|
return [4 /*yield*/, post('national/projections', payload)];
|
27242
27174
|
case 3:
|
27243
27175
|
response = _a.sent();
|
27244
27176
|
console.log('Projections creation -> ', response);
|
27245
|
-
if ((response === null || response === void 0 ? void 0 : response.statusText) === 'SUCCESS')
|
27246
|
-
|
27247
|
-
|
27248
|
-
|
27249
|
-
|
27250
|
-
|
27251
|
-
|
27177
|
+
if (!((response === null || response === void 0 ? void 0 : response.statusText) === 'SUCCESS')) return [3 /*break*/, 5];
|
27178
|
+
setOpenSaveFormModal(false);
|
27179
|
+
messageContent = (response === null || response === void 0 ? void 0 : response.status) == axios.HttpStatusCode.Created ?
|
27180
|
+
t('ghgInventory:projectionCreationSuccess')
|
27181
|
+
: t('ghgInventory:projectionUpdateSuccess');
|
27182
|
+
if (status === GHGRecordState.FINALIZED) {
|
27183
|
+
clearUploadDoc();
|
27184
|
+
clearForm();
|
27185
|
+
messageContent = t('ghgInventory:projectionFinalizedSuccess');
|
27252
27186
|
}
|
27253
|
-
|
27187
|
+
setOpenFinalizeFormModal(false);
|
27188
|
+
antd.message.open({
|
27189
|
+
type: 'success',
|
27190
|
+
content: messageContent,
|
27191
|
+
duration: 4,
|
27192
|
+
style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
|
27193
|
+
});
|
27194
|
+
clearUploadDoc();
|
27195
|
+
return [4 /*yield*/, getProjectionData()];
|
27254
27196
|
case 4:
|
27255
|
-
|
27256
|
-
|
27197
|
+
_a.sent();
|
27198
|
+
_a.label = 5;
|
27199
|
+
case 5: return [3 /*break*/, 10];
|
27200
|
+
case 6:
|
27201
|
+
error_2 = _a.sent();
|
27202
|
+
console.log('Error in projection creation - ', error_2);
|
27203
|
+
setOpenSaveFormModal(false);
|
27204
|
+
setOpenFinalizeFormModal(false);
|
27257
27205
|
antd.message.open({
|
27258
27206
|
type: 'error',
|
27259
|
-
content:
|
27207
|
+
content: error_2 === null || error_2 === void 0 ? void 0 : error_2.message,
|
27260
27208
|
duration: 4,
|
27261
27209
|
style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
|
27262
27210
|
});
|
27263
|
-
return [3 /*break*/,
|
27264
|
-
|
27211
|
+
if (!(error_2.statusCode == axios.HttpStatusCode.Conflict)) return [3 /*break*/, 8];
|
27212
|
+
return [4 /*yield*/, getProjectionData()];
|
27213
|
+
case 7:
|
27214
|
+
_a.sent();
|
27215
|
+
clearUploadDoc();
|
27216
|
+
_a.label = 8;
|
27217
|
+
case 8: return [3 /*break*/, 10];
|
27218
|
+
case 9:
|
27219
|
+
// eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
|
27220
|
+
setIsFormChanged(false);
|
27265
27221
|
setLoading(false);
|
27266
27222
|
return [7 /*endfinally*/];
|
27267
|
-
case
|
27223
|
+
case 10: return [2 /*return*/];
|
27268
27224
|
}
|
27269
27225
|
});
|
27270
27226
|
}); };
|
@@ -27311,12 +27267,25 @@ var GHGProjectionsComponent = function (props) {
|
|
27311
27267
|
setIsSavedFormDataSet(true);
|
27312
27268
|
};
|
27313
27269
|
React.useEffect(function () {
|
27314
|
-
|
27315
|
-
|
27316
|
-
|
27270
|
+
var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
|
27271
|
+
if (!isSavedFormDataSet) {
|
27272
|
+
if (savedData && savedData.length > 0) {
|
27317
27273
|
setFormValues(savedData[0]);
|
27318
27274
|
}
|
27319
27275
|
}
|
27276
|
+
if (savedData && savedData.length > 0) {
|
27277
|
+
setFormDataVersion(savedData[0].version);
|
27278
|
+
}
|
27279
|
+
var years = data
|
27280
|
+
.filter(function (item) { return !(item.state === 'SAVED' && item.year); }) // Filter out items where state is not 'SAVED'
|
27281
|
+
.map(function (item) { return parseInt(item.year); });
|
27282
|
+
// Update 'disabledYears' only if 'years' array has changed
|
27283
|
+
setDisabledYears(function (prevYears) {
|
27284
|
+
if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
|
27285
|
+
return years;
|
27286
|
+
}
|
27287
|
+
return prevYears;
|
27288
|
+
});
|
27320
27289
|
}, [data]);
|
27321
27290
|
var checkFile = function (file) {
|
27322
27291
|
var isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
|
@@ -27332,6 +27301,12 @@ var GHGProjectionsComponent = function (props) {
|
|
27332
27301
|
}
|
27333
27302
|
return e === null || e === void 0 ? void 0 : e.fileList;
|
27334
27303
|
};
|
27304
|
+
var clearUploadDoc = function () {
|
27305
|
+
setUploadedFileName('');
|
27306
|
+
form.setFieldsValue({
|
27307
|
+
emissionsDocument: null,
|
27308
|
+
});
|
27309
|
+
};
|
27335
27310
|
var handleYearChange = function (date, dateString) {
|
27336
27311
|
setSelectedYear(dateString);
|
27337
27312
|
};
|
@@ -27703,9 +27678,10 @@ var GHGProjectionsComponent = function (props) {
|
|
27703
27678
|
React.createElement("div", { className: "body-sub-title" }, t("ghgInventory:totalNationalEmissionSubTitle")))),
|
27704
27679
|
React.createElement("div", { className: "content-card add-projection" },
|
27705
27680
|
React.createElement(antd.Tabs, { defaultActiveKey: "Add New", centered: true },
|
27706
|
-
((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT ||
|
27681
|
+
((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT ||
|
27682
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.MINISTRY) && (React.createElement(antd.Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
|
27707
27683
|
React.createElement("div", null,
|
27708
|
-
React.createElement(antd.Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, name: "add-projection", className: "programme-details-form", layout: "vertical", requiredMark: true, form: form, onValuesChange: onValuesChange, onFinish:
|
27684
|
+
React.createElement(antd.Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, name: "add-projection", className: "programme-details-form", layout: "vertical", requiredMark: true, form: form, onValuesChange: onValuesChange, onFinish: onOpenSaveFormModel },
|
27709
27685
|
React.createElement(antd.Row, null,
|
27710
27686
|
React.createElement(antd.Col, { xl: 12, md: 12, className: "add-new-year-picker-col" },
|
27711
27687
|
React.createElement("div", null,
|
@@ -27784,7 +27760,7 @@ var GHGProjectionsComponent = function (props) {
|
|
27784
27760
|
} },
|
27785
27761
|
React.createElement(antd.Button, { icon: React.createElement(icons.UploadOutlined, null) }, t("ghgInventory:upload"))))),
|
27786
27762
|
React.createElement(antd.Col, { xl: 16, md: 16, className: "add-new-upload-file-name-input" },
|
27787
|
-
React.createElement(antd.Input, { value: uploadedFileName, readOnly: true }))))),
|
27763
|
+
React.createElement(antd.Input, { value: uploadedFileName, readOnly: true, suffix: uploadedFileName && (React.createElement(antd.Button, { onClick: clearUploadDoc, icon: React.createElement(icons.DeleteOutlined, null), style: { marginRight: '-10px', padding: '0px 6px' } })) }))))),
|
27788
27764
|
React.createElement(antd.Row, { gutter: 16 },
|
27789
27765
|
React.createElement(antd.Col, { span: 9, offset: 12 },
|
27790
27766
|
React.createElement(antd.Row, { gutter: 16, className: "table-heading-row" },
|
@@ -27851,10 +27827,10 @@ var GHGProjectionsComponent = function (props) {
|
|
27851
27827
|
React.createElement(antd.Form.Item, { name: "totalCo2WithLand_unconditionalNdc" },
|
27852
27828
|
React.createElement(antd.InputNumber, null)))))),
|
27853
27829
|
React.createElement("div", { className: "steps-actions" },
|
27854
|
-
|
27855
|
-
|
27856
|
-
|
27857
|
-
|
27830
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT &&
|
27831
|
+
(React.createElement(antd.Button, { className: "finalize-btn", type: "primary", loading: loading, onClick: onOpenFinalizeFormModel }, "Finalize")),
|
27832
|
+
React.createElement(antd.Button, { className: "submit-btn", type: "primary", htmlType: "submit", loading: loading }, "Submit"),
|
27833
|
+
React.createElement(antd.Button, { className: "back-btn", onClick: onOpenResetFormModel, loading: loading }, "Cancel")))))),
|
27858
27834
|
data.map(function (tabData) {
|
27859
27835
|
return tabData.state === 'FINALIZED' && (React.createElement(antd.Tabs.TabPane, { key: tabData.id.toString(), tab: React.createElement("span", null,
|
27860
27836
|
tabData.year,
|
@@ -27952,7 +27928,10 @@ var GHGProjectionsComponent = function (props) {
|
|
27952
27928
|
})));
|
27953
27929
|
})));
|
27954
27930
|
})))));
|
27955
|
-
}))))
|
27931
|
+
})))),
|
27932
|
+
React.createElement(GHGUserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onSubmitForm, onActionCanceled: onSaveFormCanceled, openModal: openSaveFormModal, errorMsg: errorMsg, loading: loading }),
|
27933
|
+
React.createElement(GHGUserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onSubmitForm, onActionCanceled: onFinalizeFormCanceled, openModal: openFinalizeFormModal, errorMsg: errorMsg, loading: loading }),
|
27934
|
+
React.createElement(DiscardChangesConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: resetForm, onActionCanceled: onResetFormCanceled, openModal: openResetFormModal, errorMsg: errorMsg, loading: loading })));
|
27956
27935
|
};
|
27957
27936
|
|
27958
27937
|
exports.AddNdcActionComponent = AddNdcActionComponent;
|