@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/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { PlusOutlined, FilterOutlined, BankOutlined, SafetyOutlined, AuditOutlined, ExperimentOutlined, UploadOutlined, UserOutlined, MinusCircleOutlined, StarOutlined, ToolOutlined, EyeOutlined, SearchOutlined, EllipsisOutlined, EditOutlined, DeleteOutlined, FileAddOutlined, CheckCircleOutlined, ExclamationCircleOutlined, BookOutlined, CaretDownOutlined, EyeInvisibleOutlined, GlobalOutlined, FlagOutlined, LineChartOutlined, LikeOutlined, DislikeOutlined, PlusCircleOutlined, LockFilled } from '@ant-design/icons';
1
+ import { PlusOutlined, FilterOutlined, BankOutlined, SafetyOutlined, AuditOutlined, ExperimentOutlined, UploadOutlined, UserOutlined, MinusCircleOutlined, StarOutlined, ToolOutlined, EyeOutlined, SearchOutlined, EllipsisOutlined, EditOutlined, DeleteOutlined, FileAddOutlined, CheckCircleOutlined, ExclamationCircleOutlined, BookOutlined, CaretDownOutlined, EyeInvisibleOutlined, GlobalOutlined, FlagOutlined, LineChartOutlined, LikeOutlined, DislikeOutlined, PlusCircleOutlined, LockFilled, CloseCircleOutlined } from '@ant-design/icons';
2
2
  import { Input, Radio, Space, Row, Col, Button, Dropdown, Table, Empty, message, Form, Steps, Upload, Tooltip, Select, Modal, Alert, Skeleton, Card, Tag, Checkbox, DatePicker, InputNumber, Popover, List, Typography, Spin, Tabs, Progress, Collapse } from 'antd';
3
3
  import React, { useState, useEffect, useRef } from 'react';
4
4
  import { DateTime } from 'luxon';
@@ -7,7 +7,7 @@ import PhoneInput, { formatPhoneNumberIntl, formatPhoneNumber } from 'react-phon
7
7
  import validator from 'validator';
8
8
  import { plainToClass } from 'class-transformer';
9
9
  import * as Icon from 'react-bootstrap-icons';
10
- import { InfoCircle, Lock, PersonDash, PlayCircle, PauseCircle, CircleFill, Clipboard2Pulse, HandThumbsUp, XCircle, ClockHistory, BoxArrowInRight, ShieldX, BoxArrowRight, ShieldCheck, Gem, ShieldExclamation } from 'react-bootstrap-icons';
10
+ import { InfoCircle, Lock, PersonDash, PlayCircle, PauseCircle, CircleFill, Clipboard2Pulse, HandThumbsUp, XCircle, ClockHistory, BoxArrowInRight, ShieldX, BoxArrowRight, ShieldCheck, Gem, ShieldExclamation, ClipboardCheck } from 'react-bootstrap-icons';
11
11
  import 'react-phone-number-input/style.css';
12
12
  import mapboxgl from 'mapbox-gl';
13
13
  import 'mapbox-gl/dist/mapbox-gl.css';
@@ -5265,7 +5265,7 @@ var CompanyRoleIcon = function (props) {
5265
5265
  role === 'ProgrammeDeveloper' ? React.createElement("div", null, 'Developer') : React.createElement("div", null, role)));
5266
5266
  };
5267
5267
 
5268
- var TextArea$1 = Input.TextArea;
5268
+ var TextArea$2 = Input.TextArea;
5269
5269
  var UserActionConfirmationModel = function (props) {
5270
5270
  var t = props.t, actionInfo = props.actionInfo, onActionConfirmed = props.onActionConfirmed, onActionCanceled = props.onActionCanceled, openModal = props.openModal, errorMsg = props.errorMsg, loading = props.loading;
5271
5271
  var _a = useState(""), comment = _a[0], setComment = _a[1];
@@ -5280,7 +5280,7 @@ var UserActionConfirmationModel = function (props) {
5280
5280
  onActionConfirmed(comment);
5281
5281
  } },
5282
5282
  React.createElement(Form.Item, { className: "mg-bottom-0", label: t("userProfile:remarks"), name: "remarks", required: actionInfo.type === "danger" },
5283
- React.createElement(TextArea$1, { defaultValue: comment, rows: 2, onChange: function (v) { return setComment(v.target.value); } })),
5283
+ React.createElement(TextArea$2, { defaultValue: comment, rows: 2, onChange: function (v) { return setComment(v.target.value); } })),
5284
5284
  errorMsg ? (React.createElement(Alert, { className: "mg-top-1", message: errorMsg, type: "error", showIcon: true })) : (""),
5285
5285
  React.createElement("div", { className: "mg-top-1 ant-modal-footer padding-bottom-0" },
5286
5286
  React.createElement(Button, { htmlType: "button", onClick: function () {
@@ -24186,7 +24186,7 @@ var ProgrammeTransferForm = function (props) {
24186
24186
  React.createElement(Button, { className: "mg-left-2", type: "primary", htmlType: "submit", loading: loading }, actionBtnText)))));
24187
24187
  };
24188
24188
 
24189
- var TextArea = Input.TextArea;
24189
+ var TextArea$1 = Input.TextArea;
24190
24190
  var RejectDocumentationConfirmationModel = function (props) {
24191
24191
  var actionInfo = props.actionInfo, onActionConfirmed = props.onActionConfirmed, onActionCanceled = props.onActionCanceled, openModal = props.openModal, errorMsg = props.errorMsg, loading = props.loading, translator = props.translator;
24192
24192
  var t = translator.t;
@@ -24207,7 +24207,7 @@ var RejectDocumentationConfirmationModel = function (props) {
24207
24207
  message: "".concat(t("programme:remarks")) + " " + "".concat(t("common:isRequired")),
24208
24208
  },
24209
24209
  ] },
24210
- React.createElement(TextArea, { defaultValue: comment, rows: 2, onChange: function (v) { return setComment(v.target.value); } })),
24210
+ React.createElement(TextArea$1, { defaultValue: comment, rows: 2, onChange: function (v) { return setComment(v.target.value); } })),
24211
24211
  errorMsg ? (React.createElement(Alert, { className: "mg-top-1", message: errorMsg, type: "error", showIcon: true })) : (""),
24212
24212
  React.createElement("div", { className: "mg-top-1 ant-modal-footer padding-bottom-0" },
24213
24213
  React.createElement(Button, { htmlType: "button", onClick: function () {
@@ -24996,7 +24996,7 @@ var TimelineBody = function (props) {
24996
24996
  React.createElement("div", { className: "remark-body" }, remark)))));
24997
24997
  };
24998
24998
 
24999
- 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: 25%; }\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 .mg-left-1 {\n margin-left: 1rem; }\n";
24999
+ 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";
25000
25000
  styleInject(css_248z$1);
25001
25001
 
25002
25002
  var EmissionTypes = { co2: 'CO2', ch4: 'CH4', n2o: 'N2O', co2eq: 'CO2-eq' };
@@ -25068,168 +25068,113 @@ var formFields = {
25068
25068
  other: ['indirectN2oEmissions', 'other'],
25069
25069
  };
25070
25070
 
25071
- // import React from 'react';
25071
+ Input.TextArea;
25072
+ var DiscardChangesConfirmationModel = function (props) {
25073
+ var t = props.t, actionInfo = props.actionInfo, onActionConfirmed = props.onActionConfirmed, onActionCanceled = props.onActionCanceled, openModal = props.openModal; props.errorMsg; var loading = props.loading;
25074
+ var _a = useState(""); _a[0]; var setComment = _a[1];
25075
+ useEffect(function () {
25076
+ setComment("");
25077
+ }, [openModal]);
25078
+ return (React.createElement(Modal, { title: React.createElement("div", { className: "popup-header" },
25079
+ React.createElement("div", { className: "icon" }, actionInfo.icon),
25080
+ 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 },
25081
+ React.createElement("p", { style: { whiteSpace: "pre-line" } }, actionInfo.text),
25082
+ React.createElement(Form, { layout: "vertical", onFinish: function () {
25083
+ onActionConfirmed();
25084
+ } },
25085
+ React.createElement("div", { className: "mg-top-1 ant-modal-footer padding-bottom-0" },
25086
+ React.createElement(Button, { htmlType: "button", onClick: function () {
25087
+ onActionCanceled();
25088
+ } }, t("userProfile:cancel")),
25089
+ React.createElement(Button, { className: "mg-left-2", type: "primary", htmlType: "submit", loading: loading }, actionInfo.action)))));
25090
+ };
25091
+
25092
+ var GHGRecordState;
25093
+ (function (GHGRecordState) {
25094
+ GHGRecordState["SAVED"] = "SAVED";
25095
+ GHGRecordState["FINALIZED"] = "FINALIZED";
25096
+ })(GHGRecordState || (GHGRecordState = {}));
25097
+
25098
+ var TextArea = Input.TextArea;
25099
+ var GHGUserActionConfirmationModel = function (props) {
25100
+ var t = props.t, actionInfo = props.actionInfo, onActionConfirmed = props.onActionConfirmed, onActionCanceled = props.onActionCanceled, openModal = props.openModal, errorMsg = props.errorMsg, loading = props.loading;
25101
+ var _a = useState(""), comment = _a[0], setComment = _a[1];
25102
+ useEffect(function () {
25103
+ setComment("");
25104
+ }, [openModal]);
25105
+ return (React.createElement(Modal, { title: React.createElement("div", { className: "popup-header" },
25106
+ React.createElement("div", { className: "icon" }, actionInfo.icon),
25107
+ 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 },
25108
+ React.createElement("p", { style: { whiteSpace: "pre-line" } }, actionInfo.text),
25109
+ React.createElement(Form, { layout: "vertical", onFinish: function () {
25110
+ var status = actionInfo.action === "submit" ? GHGRecordState.SAVED : GHGRecordState.FINALIZED;
25111
+ onActionConfirmed(comment, status);
25112
+ } },
25113
+ React.createElement(Form.Item, { className: "mg-bottom-0", label: t("userProfile:remarks"), name: "remarks", required: actionInfo.type === "danger" },
25114
+ React.createElement(TextArea, { defaultValue: comment, rows: 2, onChange: function (v) { return setComment(v.target.value); } })),
25115
+ errorMsg ? (React.createElement(Alert, { className: "mg-top-1", message: errorMsg, type: "error", showIcon: true })) : (""),
25116
+ React.createElement("div", { className: "mg-top-1 ant-modal-footer padding-bottom-0" },
25117
+ React.createElement(Button, { htmlType: "button", onClick: function () {
25118
+ onActionCanceled();
25119
+ } }, t("userProfile:cancel")),
25120
+ React.createElement(Button, { className: "mg-left-2", type: "primary", htmlType: "submit", loading: loading, disabled: actionInfo.type === "danger" && comment === "" }, actionInfo.action)))));
25121
+ };
25122
+
25072
25123
  var GHGEmissionsComponent = function (props) {
25073
25124
  var t = props.t, useUserContext = props.useUserContext, useConnection = props.useConnection;
25074
25125
  var userInfoState = useUserContext().userInfoState;
25075
- var data = [
25076
- {
25077
- id: 1,
25078
- country: 'NG',
25079
- year: 2023,
25080
- energyEmissions: {
25081
- fuelCombustionActivities: {
25082
- energyIndustries: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25083
- manufacturingIndustriesConstruction: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25084
- transport: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25085
- otherSectors: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25086
- nonSpecified: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25087
- },
25088
- fugitiveEmissionsFromFuels: {
25089
- solidFuels: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25090
- oilNaturalGas: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25091
- otherEmissionsEnergyProduction: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25092
- },
25093
- carbonDioxideTransportStorage: {
25094
- transportOfCo2: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25095
- injectionStorage: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25096
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25097
- },
25098
- },
25099
- industrialProcessesProductUse: {
25100
- mineralIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25101
- chemicalIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25102
- metalIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25103
- nonEnergyProductsFuelsSolventUse: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25104
- electronicsIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25105
- productUsesSubstOzoneDepletingSubs: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25106
- otherProductManufactureUse: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25107
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25108
- },
25109
- agricultureForestryOtherLandUse: {
25110
- livestock: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25111
- land: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25112
- aggregateNonCo2SourcesLand: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25113
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25114
- },
25115
- waste: {
25116
- solidWasteDisposal: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25117
- biologicalTreatmentSolidWaste: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25118
- incinerationOpenBurningWaste: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25119
- wastewaterTreatmentDischarge: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25120
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25121
- },
25122
- other: {
25123
- indirectN2oEmissions: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25124
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25125
- },
25126
- totalCo2WithoutLand: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25127
- totalCo2WithLand: { co2: 30, ch4: 15, n2o: 33, co2eq: 41 },
25128
- state: 'SAVED',
25129
- version: 2,
25130
- created_at: 1698644100397,
25131
- },
25132
- {
25133
- id: 2,
25134
- country: 'NG',
25135
- year: 2022,
25136
- energyEmissions: {
25137
- fuelCombustionActivities: {
25138
- energyIndustries: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25139
- manufacturingIndustriesConstruction: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25140
- transport: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25141
- otherSectors: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25142
- nonSpecified: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25143
- },
25144
- fugitiveEmissionsFromFuels: {
25145
- solidFuels: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25146
- oilNaturalGas: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25147
- otherEmissionsEnergyProduction: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25148
- },
25149
- carbonDioxideTransportStorage: {
25150
- transportOfCo2: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25151
- injectionStorage: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25152
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25153
- },
25154
- },
25155
- industrialProcessesProductUse: {
25156
- mineralIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25157
- chemicalIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25158
- metalIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25159
- nonEnergyProductsFuelsSolventUse: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25160
- electronicsIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25161
- productUsesSubstOzoneDepletingSubs: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25162
- otherProductManufactureUse: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25163
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25164
- },
25165
- agricultureForestryOtherLandUse: {
25166
- livestock: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25167
- land: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25168
- aggregateNonCo2SourcesLand: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25169
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25170
- },
25171
- waste: {
25172
- solidWasteDisposal: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25173
- biologicalTreatmentSolidWaste: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25174
- incinerationOpenBurningWaste: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25175
- wastewaterTreatmentDischarge: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25176
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25177
- },
25178
- other: {
25179
- indirectN2oEmissions: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25180
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25181
- },
25182
- totalCo2WithoutLand: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25183
- totalCo2WithLand: { co2: 30, ch4: 15, n2o: 33, co2eq: 41 },
25184
- state: 'FINALIZED',
25185
- version: 1,
25186
- created_at: 1698644100397,
25187
- },
25188
- ];
25189
- var _a = useConnection(); _a.put; _a.get; var post = _a.post;
25190
- var _b = useState(false), loading = _b[0], setLoading = _b[1];
25191
- var _c = useState(false), isPendingFinalization = _c[0], setIsPendingFinalization = _c[1];
25192
- var _d = useState(null); _d[0]; var setSelectedYear = _d[1];
25193
- var _e = useState(''), uploadedFileName = _e[0], setUploadedFileName = _e[1];
25194
- var _f = useState([]), disabledYears = _f[0], setDisabledYears = _f[1];
25195
- var _g = useState(); _g[0]; var setChangedValues = _g[1];
25196
- var _h = useState(0), totalNationalCo2 = _h[0], setTotalNationalCo2 = _h[1];
25197
- var _j = useState(0), totalNationalCh4 = _j[0], setTotalNationalCh4 = _j[1];
25198
- var _k = useState(0), totalNationalN2o = _k[0], setTotalNationalN2o = _k[1];
25199
- var _l = useState(0), totalNationalCo2Eq = _l[0], setTotalNationalCo2Eq = _l[1];
25200
- var _m = useState(0), energyEmissionsCo2 = _m[0], setEnergyEmissionsCo2 = _m[1];
25201
- var _o = useState(0), energyEmissionsCh4 = _o[0], setEnergyEmissionsCh4 = _o[1];
25202
- var _p = useState(0), energyEmissionsN2o = _p[0], setEnergyEmissionsN2o = _p[1];
25203
- var _q = useState(0), energyEmissionsCo2Eq = _q[0], setEnergyEmissionsCo2Eq = _q[1];
25204
- var _r = useState(0), fuelCombustionActivitiesCo2 = _r[0], setFuelCombustionActivitiesCo2 = _r[1];
25205
- var _s = useState(0), fuelCombustionActivitiesCh4 = _s[0], setFuelCombustionActivitiesCh4 = _s[1];
25206
- var _t = useState(0), fuelCombustionActivitiesN2o = _t[0], setFuelCombustionActivitiesN2o = _t[1];
25207
- var _u = useState(0), fuelCombustionActivitiesCo2Eq = _u[0], setFuelCombustionActivitiesCo2Eq = _u[1];
25208
- var _v = useState(0), fugitiveEmissionsFromFuelsCo2 = _v[0], setFugitiveEmissionsFromFuelsCo2 = _v[1];
25209
- var _w = useState(0), fugitiveEmissionsFromFuelsCh4 = _w[0], setFugitiveEmissionsFromFuelsCh4 = _w[1];
25210
- var _x = useState(0), fugitiveEmissionsFromFuelsN2o = _x[0], setFugitiveEmissionsFromFuelsN2o = _x[1];
25211
- var _y = useState(0), fugitiveEmissionsFromFuelsCo2Eq = _y[0], setFugitiveEmissionsFromFuelsCo2Eq = _y[1];
25212
- var _z = useState(0), carbonDioxideTransportStorageCo2 = _z[0], setCarbonDioxideTransportStorageCo2 = _z[1];
25213
- var _0 = useState(0), carbonDioxideTransportStorageCh4 = _0[0], setCarbonDioxideTransportStorageCh4 = _0[1];
25214
- var _1 = useState(0), carbonDioxideTransportStorageN2o = _1[0], setCarbonDioxideTransportStorageN2o = _1[1];
25215
- var _2 = useState(0), carbonDioxideTransportStorageCo2Eq = _2[0], setCarbonDioxideTransportStorageCo2Eq = _2[1];
25216
- var _3 = useState(0), industrialProcessesProductUseCo2 = _3[0], setIndustrialProcessesProductUseCo2 = _3[1];
25217
- var _4 = useState(0), industrialProcessesProductUseCh4 = _4[0], setIndustrialProcessesProductUseCh4 = _4[1];
25218
- var _5 = useState(0), industrialProcessesProductUseN2o = _5[0], setIndustrialProcessesProductUseN2o = _5[1];
25219
- var _6 = useState(0), industrialProcessesProductUseCo2Eq = _6[0], setIndustrialProcessesProductUseCo2Eq = _6[1];
25220
- var _7 = useState(0), agricultureForestryOtherLandUseCo2 = _7[0], setAgricultureForestryOtherLandUseCo2 = _7[1];
25221
- var _8 = useState(0), agricultureForestryOtherLandUseCh4 = _8[0], setAgricultureForestryOtherLandUseCh4 = _8[1];
25222
- var _9 = useState(0), agricultureForestryOtherLandUseN2o = _9[0], setAgricultureForestryOtherLandUseN2o = _9[1];
25223
- var _10 = useState(0), agricultureForestryOtherLandUseCo2Eq = _10[0], setAgricultureForestryOtherLandUseCo2Eq = _10[1];
25224
- var _11 = useState(0), wasteCo2 = _11[0], setWasteCo2 = _11[1];
25225
- var _12 = useState(0), wasteCh4 = _12[0], setWasteCh4 = _12[1];
25226
- var _13 = useState(0), wasteN2o = _13[0], setWasteN2o = _13[1];
25227
- var _14 = useState(0), wasteCo2Eq = _14[0], setWasteCo2Eq = _14[1];
25228
- var _15 = useState(0), otherCo2 = _15[0], setOtherCo2 = _15[1];
25229
- var _16 = useState(0), otherCh4 = _16[0], setOtherCh4 = _16[1];
25230
- var _17 = useState(0), otherN2o = _17[0], setOtherN2o = _17[1];
25231
- var _18 = useState(0), otherCo2Eq = _18[0], setOtherCo2Eq = _18[1];
25232
- var _19 = useState(false), isSavedFormDataSet = _19[0], setIsSavedFormDataSet = _19[1];
25126
+ var _a = useState([]), data = _a[0], setData = _a[1];
25127
+ var _b = useConnection(), get = _b.get, post = _b.post;
25128
+ var _c = useState(false), loading = _c[0], setLoading = _c[1];
25129
+ var _d = useState(false), isPendingFinalization = _d[0], setIsPendingFinalization = _d[1];
25130
+ var _e = useState(null); _e[0]; var setSelectedYear = _e[1];
25131
+ var _f = useState(''), uploadedFileName = _f[0], setUploadedFileName = _f[1];
25132
+ var _g = useState([]), disabledYears = _g[0], setDisabledYears = _g[1];
25133
+ var _h = useState(); _h[0]; _h[1];
25134
+ var _j = useState(0), totalNationalCo2 = _j[0], setTotalNationalCo2 = _j[1];
25135
+ var _k = useState(0), totalNationalCh4 = _k[0], setTotalNationalCh4 = _k[1];
25136
+ var _l = useState(0), totalNationalN2o = _l[0], setTotalNationalN2o = _l[1];
25137
+ var _m = useState(0), totalNationalCo2Eq = _m[0], setTotalNationalCo2Eq = _m[1];
25138
+ var _o = useState(0), energyEmissionsCo2 = _o[0], setEnergyEmissionsCo2 = _o[1];
25139
+ var _p = useState(0), energyEmissionsCh4 = _p[0], setEnergyEmissionsCh4 = _p[1];
25140
+ var _q = useState(0), energyEmissionsN2o = _q[0], setEnergyEmissionsN2o = _q[1];
25141
+ var _r = useState(0), energyEmissionsCo2Eq = _r[0], setEnergyEmissionsCo2Eq = _r[1];
25142
+ var _s = useState(0), fuelCombustionActivitiesCo2 = _s[0], setFuelCombustionActivitiesCo2 = _s[1];
25143
+ var _t = useState(0), fuelCombustionActivitiesCh4 = _t[0], setFuelCombustionActivitiesCh4 = _t[1];
25144
+ var _u = useState(0), fuelCombustionActivitiesN2o = _u[0], setFuelCombustionActivitiesN2o = _u[1];
25145
+ var _v = useState(0), fuelCombustionActivitiesCo2Eq = _v[0], setFuelCombustionActivitiesCo2Eq = _v[1];
25146
+ var _w = useState(0), fugitiveEmissionsFromFuelsCo2 = _w[0], setFugitiveEmissionsFromFuelsCo2 = _w[1];
25147
+ var _x = useState(0), fugitiveEmissionsFromFuelsCh4 = _x[0], setFugitiveEmissionsFromFuelsCh4 = _x[1];
25148
+ var _y = useState(0), fugitiveEmissionsFromFuelsN2o = _y[0], setFugitiveEmissionsFromFuelsN2o = _y[1];
25149
+ var _z = useState(0), fugitiveEmissionsFromFuelsCo2Eq = _z[0], setFugitiveEmissionsFromFuelsCo2Eq = _z[1];
25150
+ var _0 = useState(0), carbonDioxideTransportStorageCo2 = _0[0], setCarbonDioxideTransportStorageCo2 = _0[1];
25151
+ var _1 = useState(0), carbonDioxideTransportStorageCh4 = _1[0], setCarbonDioxideTransportStorageCh4 = _1[1];
25152
+ var _2 = useState(0), carbonDioxideTransportStorageN2o = _2[0], setCarbonDioxideTransportStorageN2o = _2[1];
25153
+ var _3 = useState(0), carbonDioxideTransportStorageCo2Eq = _3[0], setCarbonDioxideTransportStorageCo2Eq = _3[1];
25154
+ var _4 = useState(0), industrialProcessesProductUseCo2 = _4[0], setIndustrialProcessesProductUseCo2 = _4[1];
25155
+ var _5 = useState(0), industrialProcessesProductUseCh4 = _5[0], setIndustrialProcessesProductUseCh4 = _5[1];
25156
+ var _6 = useState(0), industrialProcessesProductUseN2o = _6[0], setIndustrialProcessesProductUseN2o = _6[1];
25157
+ var _7 = useState(0), industrialProcessesProductUseCo2Eq = _7[0], setIndustrialProcessesProductUseCo2Eq = _7[1];
25158
+ var _8 = useState(0), agricultureForestryOtherLandUseCo2 = _8[0], setAgricultureForestryOtherLandUseCo2 = _8[1];
25159
+ var _9 = useState(0), agricultureForestryOtherLandUseCh4 = _9[0], setAgricultureForestryOtherLandUseCh4 = _9[1];
25160
+ var _10 = useState(0), agricultureForestryOtherLandUseN2o = _10[0], setAgricultureForestryOtherLandUseN2o = _10[1];
25161
+ var _11 = useState(0), agricultureForestryOtherLandUseCo2Eq = _11[0], setAgricultureForestryOtherLandUseCo2Eq = _11[1];
25162
+ var _12 = useState(0), wasteCo2 = _12[0], setWasteCo2 = _12[1];
25163
+ var _13 = useState(0), wasteCh4 = _13[0], setWasteCh4 = _13[1];
25164
+ var _14 = useState(0), wasteN2o = _14[0], setWasteN2o = _14[1];
25165
+ var _15 = useState(0), wasteCo2Eq = _15[0], setWasteCo2Eq = _15[1];
25166
+ var _16 = useState(0), otherCo2 = _16[0], setOtherCo2 = _16[1];
25167
+ var _17 = useState(0), otherCh4 = _17[0], setOtherCh4 = _17[1];
25168
+ var _18 = useState(0), otherN2o = _18[0], setOtherN2o = _18[1];
25169
+ var _19 = useState(0), otherCo2Eq = _19[0], setOtherCo2Eq = _19[1];
25170
+ var _20 = useState(false), isSavedFormDataSet = _20[0], setIsSavedFormDataSet = _20[1];
25171
+ var _21 = useState(1), formDataVersion = _21[0], setFormDataVersion = _21[1];
25172
+ var _22 = useState(false), isFormChanged = _22[0], setIsFormChanged = _22[1];
25173
+ var _23 = useState(false), openSaveFormModal = _23[0], setOpenSaveFormModal = _23[1];
25174
+ var _24 = useState(false), openFinalizeFormModal = _24[0], setOpenFinalizeFormModal = _24[1];
25175
+ var _25 = useState(false), openResetFormModal = _25[0], setOpenResetFormModal = _25[1];
25176
+ var _26 = useState(''), errorMsg = _26[0], setErrorMsg = _26[1];
25177
+ var _27 = useState({}), actionInfo = _27[0], setActionInfo = _27[1];
25233
25178
  var Panel = Collapse.Panel;
25234
25179
  var form = Form.useForm()[0];
25235
25180
  var createSetFieldObject = function (obj, objName) {
@@ -25327,16 +25272,7 @@ var GHGEmissionsComponent = function (props) {
25327
25272
  };
25328
25273
  useEffect(function () {
25329
25274
  var hasSaveState = data.some(function (item) { return item.state === 'SAVED'; });
25330
- var years = data.map(function (item) { return !(item.state === 'SAVED') && item.year; });
25331
- console.log(uploadedFileName);
25332
25275
  setIsPendingFinalization(hasSaveState);
25333
- // Update 'disabledYears' only if 'years' array has changed
25334
- setDisabledYears(function (prevYears) {
25335
- if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
25336
- return years;
25337
- }
25338
- return prevYears;
25339
- });
25340
25276
  }, [data, uploadedFileName]);
25341
25277
  var handleYearChange = function (date, dateString) {
25342
25278
  setSelectedYear(dateString);
@@ -25355,9 +25291,16 @@ var GHGEmissionsComponent = function (props) {
25355
25291
  }
25356
25292
  return sum;
25357
25293
  }
25358
- var onValuesChange = function (changedValues2, allValues) {
25294
+ var onValuesChange = function (changedValues, allValues) {
25359
25295
  // Track the changed values
25360
- setChangedValues(function (prevChangedValues) { return (__assign(__assign({}, prevChangedValues), changedValues2)); });
25296
+ var initialValues = null;
25297
+ if (isPendingFinalization) {
25298
+ var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
25299
+ initialValues = savedData[0];
25300
+ }
25301
+ var currentValues = form.getFieldsValue(true);
25302
+ var isChanged = !(JSON.stringify(currentValues) === JSON.stringify(initialValues));
25303
+ setIsFormChanged(isChanged);
25361
25304
  };
25362
25305
  var getBase64 = function (file) {
25363
25306
  return new Promise(function (resolve, reject) {
@@ -25367,7 +25310,7 @@ var GHGEmissionsComponent = function (props) {
25367
25310
  reader.onerror = function (error) { return reject(error); };
25368
25311
  });
25369
25312
  };
25370
- var createSaveRequestPayload = function (fields) { return __awaiter(void 0, void 0, void 0, function () {
25313
+ var createSaveRequestPayload = function (fields, remarks, status) { return __awaiter(void 0, void 0, void 0, function () {
25371
25314
  var requestBody, savedEmission, emissionImportBase64;
25372
25315
  var _a;
25373
25316
  return __generator(this, function (_b) {
@@ -25584,7 +25527,9 @@ var GHGEmissionsComponent = function (props) {
25584
25527
  n2o: fields === null || fields === void 0 ? void 0 : fields.totalCo2WithLand_n2o,
25585
25528
  co2eq: fields === null || fields === void 0 ? void 0 : fields.totalCo2WithLand_co2eq,
25586
25529
  },
25587
- state: 'SAVED',
25530
+ state: status,
25531
+ remarks: remarks,
25532
+ version: formDataVersion,
25588
25533
  };
25589
25534
  requestBody = savedEmission;
25590
25535
  if (!(fields === null || fields === void 0 ? void 0 : fields.emissionsDocument)) return [3 /*break*/, 2];
@@ -25599,49 +25544,226 @@ var GHGEmissionsComponent = function (props) {
25599
25544
  }
25600
25545
  });
25601
25546
  }); };
25602
- var onSubmitForm = function (values) { return __awaiter(void 0, void 0, void 0, function () {
25603
- var fields, payload, response, error_1;
25547
+ var clearForm = function () {
25548
+ form.resetFields();
25549
+ setFuelCombustionActivitiesCo2(0);
25550
+ setFuelCombustionActivitiesCh4(0);
25551
+ setFuelCombustionActivitiesN2o(0);
25552
+ setFuelCombustionActivitiesCo2Eq(0);
25553
+ setFugitiveEmissionsFromFuelsCo2(0);
25554
+ setFugitiveEmissionsFromFuelsCh4(0);
25555
+ setFugitiveEmissionsFromFuelsN2o(0);
25556
+ setFugitiveEmissionsFromFuelsCo2Eq(0);
25557
+ setCarbonDioxideTransportStorageCo2(0);
25558
+ setCarbonDioxideTransportStorageCh4(0);
25559
+ setCarbonDioxideTransportStorageN2o(0);
25560
+ setCarbonDioxideTransportStorageCo2Eq(0);
25561
+ setIndustrialProcessesProductUseCo2(0);
25562
+ setIndustrialProcessesProductUseCh4(0);
25563
+ setIndustrialProcessesProductUseN2o(0);
25564
+ setIndustrialProcessesProductUseCo2Eq(0);
25565
+ setAgricultureForestryOtherLandUseCo2(0);
25566
+ setAgricultureForestryOtherLandUseCh4(0);
25567
+ setAgricultureForestryOtherLandUseN2o(0);
25568
+ setAgricultureForestryOtherLandUseCo2Eq(0);
25569
+ setWasteCo2(0);
25570
+ setWasteCh4(0);
25571
+ setWasteN2o(0);
25572
+ setWasteCo2Eq(0);
25573
+ setOtherCo2(0);
25574
+ setOtherCh4(0);
25575
+ setOtherN2o(0);
25576
+ setOtherCo2Eq(0);
25577
+ };
25578
+ var resetForm = function () { return __awaiter(void 0, void 0, void 0, function () {
25579
+ return __generator(this, function (_a) {
25580
+ switch (_a.label) {
25581
+ case 0:
25582
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
25583
+ return [4 /*yield*/, getEmissionData()];
25584
+ case 1:
25585
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
25586
+ _a.sent();
25587
+ setOpenResetFormModal(false);
25588
+ setIsSavedFormDataSet(false);
25589
+ clearUploadDoc();
25590
+ if (!isPendingFinalization) {
25591
+ clearForm();
25592
+ }
25593
+ message.open({
25594
+ type: 'success',
25595
+ content: t('ghgInventory:formCancelledSuccess'),
25596
+ duration: 4,
25597
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25598
+ });
25599
+ return [2 /*return*/];
25600
+ }
25601
+ });
25602
+ }); };
25603
+ var onResetFormCanceled = function () {
25604
+ setOpenResetFormModal(false);
25605
+ };
25606
+ var onOpenResetFormModel = function () {
25607
+ setActionInfo({
25608
+ action: "".concat(t('ghgInventory:proceed')),
25609
+ headerText: "".concat(t('ghgInventory:discardHeaderText')),
25610
+ type: 'danger',
25611
+ icon: React.createElement(CloseCircleOutlined, null),
25612
+ });
25613
+ setErrorMsg('');
25614
+ setOpenResetFormModal(true);
25615
+ };
25616
+ var onSaveFormCanceled = function () {
25617
+ setOpenSaveFormModal(false);
25618
+ };
25619
+ var onOpenSaveFormModel = function () {
25620
+ if (!isFormChanged) {
25621
+ message.open({
25622
+ type: 'error',
25623
+ content: t('ghgInventory:formNotChanged'),
25624
+ duration: 4,
25625
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25626
+ });
25627
+ }
25628
+ else {
25629
+ setActionInfo({
25630
+ action: "".concat(t("ghgInventory:submit")),
25631
+ headerText: "".concat(t("ghgInventory:submitModelHeader")),
25632
+ type: "primary",
25633
+ icon: React.createElement(CheckCircleOutlined, null),
25634
+ });
25635
+ setErrorMsg('');
25636
+ setOpenSaveFormModal(true);
25637
+ }
25638
+ };
25639
+ var onFinalizeFormCanceled = function () {
25640
+ setOpenFinalizeFormModal(false);
25641
+ };
25642
+ var onOpenFinalizeFormModel = function () {
25643
+ setActionInfo({
25644
+ action: "".concat(t("ghgInventory:finalize")),
25645
+ headerText: "".concat(t("ghgInventory:finalizeModelHeader")),
25646
+ type: "primary",
25647
+ icon: React.createElement(ClipboardCheck, null),
25648
+ });
25649
+ setErrorMsg('');
25650
+ setOpenFinalizeFormModal(true);
25651
+ };
25652
+ var onSubmitForm = function (remarks, status) { return __awaiter(void 0, void 0, void 0, function () {
25653
+ var fields, payload, response, messageContent, error_1;
25604
25654
  return __generator(this, function (_a) {
25605
25655
  switch (_a.label) {
25606
25656
  case 0:
25607
25657
  fields = form.getFieldsValue(true);
25608
- return [4 /*yield*/, createSaveRequestPayload(fields)];
25658
+ return [4 /*yield*/, createSaveRequestPayload(fields, remarks, status)];
25609
25659
  case 1:
25610
25660
  payload = _a.sent();
25611
25661
  setLoading(true);
25612
25662
  _a.label = 2;
25613
25663
  case 2:
25614
- _a.trys.push([2, 4, 5, 6]);
25664
+ _a.trys.push([2, 6, 9, 10]);
25615
25665
  return [4 /*yield*/, post('national/emissions', payload)];
25616
25666
  case 3:
25617
25667
  response = _a.sent();
25618
25668
  console.log('Emission creation -> ', response);
25619
- if ((response === null || response === void 0 ? void 0 : response.statusText) === 'SUCCESS') {
25620
- message.open({
25621
- type: 'success',
25622
- content: (response === null || response === void 0 ? void 0 : response.status) == HttpStatusCode.Created ? t('ghgInventory:emissionCreationSuccess') : t('ghgInventory:emissionUpdateSuccess'),
25623
- duration: 4,
25624
- style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25625
- });
25669
+ if (!((response === null || response === void 0 ? void 0 : response.statusText) === 'SUCCESS')) return [3 /*break*/, 5];
25670
+ setOpenSaveFormModal(false);
25671
+ messageContent = (response === null || response === void 0 ? void 0 : response.status) == HttpStatusCode.Created ?
25672
+ t('ghgInventory:emissionCreationSuccess')
25673
+ : t('ghgInventory:emissionUpdateSuccess');
25674
+ if (status === GHGRecordState.FINALIZED) {
25675
+ clearUploadDoc();
25676
+ clearForm();
25677
+ messageContent = t('ghgInventory:emissionFinalizedSuccess');
25626
25678
  }
25627
- return [3 /*break*/, 6];
25679
+ setOpenFinalizeFormModal(false);
25680
+ message.open({
25681
+ type: 'success',
25682
+ content: messageContent,
25683
+ duration: 4,
25684
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25685
+ });
25686
+ clearUploadDoc();
25687
+ return [4 /*yield*/, getEmissionData()];
25628
25688
  case 4:
25689
+ _a.sent();
25690
+ _a.label = 5;
25691
+ case 5: return [3 /*break*/, 10];
25692
+ case 6:
25629
25693
  error_1 = _a.sent();
25630
25694
  console.log('Error in emission creation - ', error_1);
25695
+ setOpenSaveFormModal(false);
25696
+ setOpenFinalizeFormModal(false);
25631
25697
  message.open({
25632
25698
  type: 'error',
25633
25699
  content: error_1 === null || error_1 === void 0 ? void 0 : error_1.message,
25634
25700
  duration: 4,
25635
25701
  style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25636
25702
  });
25637
- return [3 /*break*/, 6];
25638
- case 5:
25703
+ if (!(error_1.statusCode == HttpStatusCode.Conflict)) return [3 /*break*/, 8];
25704
+ return [4 /*yield*/, getEmissionData()];
25705
+ case 7:
25706
+ _a.sent();
25707
+ clearUploadDoc();
25708
+ _a.label = 8;
25709
+ case 8: return [3 /*break*/, 10];
25710
+ case 9:
25711
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
25712
+ setIsFormChanged(false);
25639
25713
  setLoading(false);
25640
25714
  return [7 /*endfinally*/];
25641
- case 6: return [2 /*return*/];
25715
+ case 10: return [2 /*return*/];
25642
25716
  }
25643
25717
  });
25644
25718
  }); };
25719
+ var getEmissionData = function () { return __awaiter(void 0, void 0, void 0, function () {
25720
+ var response, error_2;
25721
+ return __generator(this, function (_a) {
25722
+ switch (_a.label) {
25723
+ case 0:
25724
+ setLoading(true);
25725
+ _a.label = 1;
25726
+ case 1:
25727
+ _a.trys.push([1, 3, 4, 5]);
25728
+ return [4 /*yield*/, get('national/emissions')];
25729
+ case 2:
25730
+ response = _a.sent();
25731
+ console.log('Emissions GET -> ', response);
25732
+ if (response === null || response === void 0 ? void 0 : response.data) {
25733
+ setData(response.data);
25734
+ }
25735
+ return [3 /*break*/, 5];
25736
+ case 3:
25737
+ error_2 = _a.sent();
25738
+ console.log('Error in emission fetch - ', error_2);
25739
+ message.open({
25740
+ type: 'error',
25741
+ content: error_2 === null || error_2 === void 0 ? void 0 : error_2.message,
25742
+ duration: 4,
25743
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25744
+ });
25745
+ return [3 /*break*/, 5];
25746
+ case 4:
25747
+ setIsFormChanged(false);
25748
+ setLoading(false);
25749
+ return [7 /*endfinally*/];
25750
+ case 5: return [2 /*return*/];
25751
+ }
25752
+ });
25753
+ }); };
25754
+ useEffect(function () {
25755
+ var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {
25756
+ return __generator(this, function (_a) {
25757
+ switch (_a.label) {
25758
+ case 0: return [4 /*yield*/, getEmissionData()];
25759
+ case 1:
25760
+ _a.sent();
25761
+ return [2 /*return*/];
25762
+ }
25763
+ });
25764
+ }); };
25765
+ fetchData();
25766
+ }, []);
25645
25767
  var setFormValues = function (emissionObject) {
25646
25768
  if (emissionObject.year) {
25647
25769
  form.setFieldsValue({ year: moment(emissionObject.year, 'YYYY') });
@@ -25694,12 +25816,26 @@ var GHGEmissionsComponent = function (props) {
25694
25816
  setIsSavedFormDataSet(true);
25695
25817
  };
25696
25818
  useEffect(function () {
25697
- if (isPendingFinalization) {
25698
- if (!isSavedFormDataSet) {
25699
- var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
25819
+ var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
25820
+ if (!isSavedFormDataSet) {
25821
+ if (savedData && savedData.length > 0) {
25700
25822
  setFormValues(savedData[0]);
25701
25823
  }
25702
25824
  }
25825
+ if (savedData && savedData.length > 0) {
25826
+ setFormDataVersion(savedData[0].version);
25827
+ }
25828
+ console.log("data changed - version updated2? = ", formDataVersion);
25829
+ var years = data
25830
+ .filter(function (item) { return !(item.state === 'SAVED' && item.year); }) // Filter out items where state is not 'SAVED'
25831
+ .map(function (item) { return parseInt(item.year); });
25832
+ // Update 'disabledYears' only if 'years' array has changed
25833
+ setDisabledYears(function (prevYears) {
25834
+ if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
25835
+ return years;
25836
+ }
25837
+ return prevYears;
25838
+ });
25703
25839
  }, [data]);
25704
25840
  var checkFile = function (file) {
25705
25841
  var isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
@@ -25715,6 +25851,12 @@ var GHGEmissionsComponent = function (props) {
25715
25851
  }
25716
25852
  return e === null || e === void 0 ? void 0 : e.fileList;
25717
25853
  };
25854
+ var clearUploadDoc = function () {
25855
+ setUploadedFileName('');
25856
+ form.setFieldsValue({
25857
+ emissionsDocument: null,
25858
+ });
25859
+ };
25718
25860
  var isYearDisabled = function (current) {
25719
25861
  return disabledYears.includes(current.year());
25720
25862
  };
@@ -26174,25 +26316,26 @@ var GHGEmissionsComponent = function (props) {
26174
26316
  React.createElement("div", { className: "body-sub-title" }, t("ghgInventory:totalNationalEmissionSubTitle")))),
26175
26317
  React.createElement("div", { className: "content-card add-emission" },
26176
26318
  React.createElement(Tabs, { defaultActiveKey: "Add New", centered: true },
26177
- ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT || (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY) && (React.createElement(Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
26319
+ ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT ||
26320
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY) && (React.createElement(Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
26178
26321
  React.createElement("div", null,
26179
- React.createElement(Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, name: "add-emission", className: "programme-details-form", layout: "vertical", requiredMark: true, form: form, onValuesChange: onValuesChange, onFinish: onSubmitForm },
26322
+ React.createElement(Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, name: "add-emission", className: "programme-details-form", layout: "vertical", requiredMark: true, form: form, onValuesChange: onValuesChange, onFinish: onOpenSaveFormModel },
26180
26323
  React.createElement(Row, null,
26181
26324
  React.createElement(Col, { xl: 12, md: 12, className: "add-new-year-picker-col" },
26182
26325
  React.createElement("div", null,
26183
- React.createElement(Form.Item, { label: t("ghgInventory:year"), name: "year", rules: [
26326
+ React.createElement(Form.Item, { label: t('ghgInventory:year'), name: "year", rules: [
26184
26327
  {
26185
26328
  required: true,
26186
- message: "",
26329
+ message: '',
26187
26330
  },
26188
26331
  {
26189
26332
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
26190
26333
  return __generator(this, function (_a) {
26191
- if (String(value).trim() === "" ||
26334
+ if (String(value).trim() === '' ||
26192
26335
  String(value).trim() === undefined ||
26193
26336
  value === null ||
26194
26337
  value === undefined) {
26195
- throw new Error("".concat(t("ghgInventory:year"), " ").concat(t("isRequired")));
26338
+ throw new Error("".concat(t('ghgInventory:year'), " ").concat(t('isRequired')));
26196
26339
  }
26197
26340
  return [2 /*return*/];
26198
26341
  });
@@ -26256,7 +26399,7 @@ var GHGEmissionsComponent = function (props) {
26256
26399
  } },
26257
26400
  React.createElement(Button, { icon: React.createElement(UploadOutlined, null) }, t("ghgInventory:upload"))))),
26258
26401
  React.createElement(Col, { xl: 16, md: 16, className: "add-new-upload-file-name-input" },
26259
- React.createElement(Input, { value: uploadedFileName, readOnly: true }))))),
26402
+ React.createElement(Input, { value: uploadedFileName, readOnly: true, suffix: uploadedFileName && (React.createElement(Button, { onClick: clearUploadDoc, icon: React.createElement(DeleteOutlined, null), style: { marginRight: '-10px', padding: '0px 6px' } })) }))))),
26260
26403
  React.createElement(Row, { gutter: 16 },
26261
26404
  React.createElement(Col, { span: 9, offset: 12 },
26262
26405
  React.createElement(Row, { gutter: 16, className: "table-heading-row" },
@@ -26340,10 +26483,10 @@ var GHGEmissionsComponent = function (props) {
26340
26483
  React.createElement(Form.Item, { name: "totalCo2WithLand_co2eq" },
26341
26484
  React.createElement(InputNumber, null)))))),
26342
26485
  React.createElement("div", { className: "steps-actions" },
26343
- React.createElement(Button, { type: "primary", htmlType: "submit", loading: loading }, "Submit"),
26344
- React.createElement(Button, { className: "back-btn",
26345
- // onClick={() => prevOne()}
26346
- loading: loading }, "Cancel")))))),
26486
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
26487
+ (React.createElement(Button, { className: "finalize-btn", type: "primary", loading: loading, onClick: onOpenFinalizeFormModel }, "Finalize")),
26488
+ React.createElement(Button, { className: "submit-btn", type: "primary", htmlType: "submit", loading: loading }, "Submit"),
26489
+ React.createElement(Button, { className: "back-btn", onClick: onOpenResetFormModel, loading: loading }, "Cancel")))))),
26347
26490
  data.map(function (tabData) {
26348
26491
  return tabData.state === 'FINALIZED' && (React.createElement(Tabs.TabPane, { key: tabData.id.toString(), tab: React.createElement("span", null,
26349
26492
  tabData.year,
@@ -26353,11 +26496,7 @@ var GHGEmissionsComponent = function (props) {
26353
26496
  React.createElement(Col, { xl: 12, md: 12, className: "add-new-year-picker-col" },
26354
26497
  React.createElement("div", null,
26355
26498
  React.createElement(Row, { className: "add-new-upload-file-label" }, "Year"),
26356
- React.createElement(DatePicker
26357
- // onChange={handleYearChange}
26358
- , {
26359
- // onChange={handleYearChange}
26360
- picker: "year", disabledDate: isYearDisabled, defaultValue: moment(tabData.year, 'YYYY'), disabled: true, size: "large" }))),
26499
+ React.createElement(DatePicker, { picker: "year", disabledDate: isYearDisabled, defaultValue: moment(tabData.year, 'YYYY'), disabled: true, size: "large" }))),
26361
26500
  React.createElement(Col, { xl: 12, md: 12, className: "add-new-upload-file-col" },
26362
26501
  React.createElement(Row, { className: "add-new-upload-file-label" }, t("ghgInventory:emissionRemovalDocument")),
26363
26502
  React.createElement(Row, null,
@@ -26454,10 +26593,13 @@ var GHGEmissionsComponent = function (props) {
26454
26593
  })));
26455
26594
  })));
26456
26595
  })))));
26457
- }))))));
26596
+ })))),
26597
+ React.createElement(GHGUserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onSubmitForm, onActionCanceled: onSaveFormCanceled, openModal: openSaveFormModal, errorMsg: errorMsg, loading: loading }),
26598
+ React.createElement(GHGUserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onSubmitForm, onActionCanceled: onFinalizeFormCanceled, openModal: openFinalizeFormModal, errorMsg: errorMsg, loading: loading }),
26599
+ React.createElement(DiscardChangesConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: resetForm, onActionCanceled: onResetFormCanceled, openModal: openResetFormModal, errorMsg: errorMsg, loading: loading })));
26458
26600
  };
26459
26601
 
26460
- 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: 25%; }\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 .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";
26602
+ 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";
26461
26603
  styleInject(css_248z);
26462
26604
 
26463
26605
  var ProjectionTypes = {
@@ -26469,403 +26611,49 @@ var ProjectionTypes = {
26469
26611
  var GHGProjectionsComponent = function (props) {
26470
26612
  var t = props.t, useUserContext = props.useUserContext, useConnection = props.useConnection;
26471
26613
  var userInfoState = useUserContext().userInfoState;
26472
- var data = [
26473
- {
26474
- id: 1,
26475
- country: 'NG',
26476
- year: 2023,
26477
- energyEmissions: {
26478
- fuelCombustionActivities: {
26479
- energyIndustries: {
26480
- bau: 20,
26481
- conditionalNdc: 15,
26482
- unconditionalNdc: 332,
26483
- },
26484
- manufacturingIndustriesConstruction: {
26485
- bau: 20,
26486
- conditionalNdc: 15,
26487
- unconditionalNdc: 33,
26488
- },
26489
- transport: {
26490
- bau: 20,
26491
- conditionalNdc: 15,
26492
- unconditionalNdc: 33,
26493
- },
26494
- otherSectors: {
26495
- bau: 20,
26496
- conditionalNdc: 15,
26497
- unconditionalNdc: 33,
26498
- },
26499
- nonSpecified: {
26500
- bau: 20,
26501
- conditionalNdc: 15,
26502
- unconditionalNdc: 33,
26503
- },
26504
- },
26505
- fugitiveEmissionsFromFuels: {
26506
- solidFuels: {
26507
- bau: 20,
26508
- conditionalNdc: 15,
26509
- unconditionalNdc: 33,
26510
- },
26511
- oilNaturalGas: {
26512
- bau: 20,
26513
- conditionalNdc: 15,
26514
- unconditionalNdc: 33,
26515
- },
26516
- otherEmissionsEnergyProduction: {
26517
- bau: 20,
26518
- conditionalNdc: 15,
26519
- unconditionalNdc: 33,
26520
- },
26521
- },
26522
- carbonDioxideTransportStorage: {
26523
- transportOfCo2: {
26524
- bau: 20,
26525
- conditionalNdc: 15,
26526
- unconditionalNdc: 33,
26527
- },
26528
- injectionStorage: {
26529
- bau: 20,
26530
- conditionalNdc: 15,
26531
- unconditionalNdc: 33,
26532
- },
26533
- other: {
26534
- bau: 20,
26535
- conditionalNdc: 15,
26536
- unconditionalNdc: 33,
26537
- },
26538
- },
26539
- },
26540
- industrialProcessesProductUse: {
26541
- mineralIndustry: {
26542
- bau: 20,
26543
- conditionalNdc: 15,
26544
- unconditionalNdc: 33,
26545
- },
26546
- chemicalIndustry: {
26547
- bau: 20,
26548
- conditionalNdc: 15,
26549
- unconditionalNdc: 33,
26550
- },
26551
- metalIndustry: {
26552
- bau: 20,
26553
- conditionalNdc: 15,
26554
- unconditionalNdc: 33,
26555
- },
26556
- nonEnergyProductsFuelsSolventUse: {
26557
- bau: 20,
26558
- conditionalNdc: 15,
26559
- unconditionalNdc: 33,
26560
- },
26561
- electronicsIndustry: {
26562
- bau: 20,
26563
- conditionalNdc: 15,
26564
- unconditionalNdc: 33,
26565
- },
26566
- productUsesSubstOzoneDepletingSubs: {
26567
- bau: 20,
26568
- conditionalNdc: 15,
26569
- unconditionalNdc: 33,
26570
- },
26571
- otherProductManufactureUse: {
26572
- bau: 20,
26573
- conditionalNdc: 15,
26574
- unconditionalNdc: 33,
26575
- },
26576
- other: {
26577
- bau: 20,
26578
- conditionalNdc: 15,
26579
- unconditionalNdc: 33,
26580
- },
26581
- },
26582
- agricultureForestryOtherLandUse: {
26583
- livestock: { bau: 20, conditionalNdc: 15, unconditionalNdc: 33 },
26584
- land: {
26585
- bau: 20,
26586
- conditionalNdc: 15,
26587
- unconditionalNdc: 33,
26588
- },
26589
- aggregateNonCo2SourcesLand: {
26590
- bau: 20,
26591
- conditionalNdc: 15,
26592
- unconditionalNdc: 33,
26593
- },
26594
- other: {
26595
- bau: 20,
26596
- conditionalNdc: 15,
26597
- unconditionalNdc: 33,
26598
- },
26599
- },
26600
- waste: {
26601
- solidWasteDisposal: {
26602
- bau: 20,
26603
- conditionalNdc: 15,
26604
- unconditionalNdc: 33,
26605
- },
26606
- biologicalTreatmentSolidWaste: {
26607
- bau: 20,
26608
- conditionalNdc: 15,
26609
- unconditionalNdc: 33,
26610
- },
26611
- incinerationOpenBurningWaste: {
26612
- bau: 20,
26613
- conditionalNdc: 15,
26614
- unconditionalNdc: 33,
26615
- },
26616
- wastewaterTreatmentDischarge: {
26617
- bau: 20,
26618
- conditionalNdc: 15,
26619
- unconditionalNdc: 33,
26620
- },
26621
- other: {
26622
- bau: 20,
26623
- conditionalNdc: 15,
26624
- unconditionalNdc: 33,
26625
- },
26626
- },
26627
- other: {
26628
- indirectN2oEmissions: {
26629
- bau: 20,
26630
- conditionalNdc: 15,
26631
- unconditionalNdc: 33,
26632
- },
26633
- other: {
26634
- bau: 20,
26635
- conditionalNdc: 15,
26636
- unconditionalNdc: 33,
26637
- },
26638
- },
26639
- totalCo2WithoutLand: {
26640
- bau: 20,
26641
- conditionalNdc: 15,
26642
- unconditionalNdc: 33,
26643
- },
26644
- totalCo2WithLand: {
26645
- bau: 20,
26646
- conditionalNdc: 15,
26647
- unconditionalNdc: 33,
26648
- },
26649
- state: 'FINALIZED',
26650
- version: 1,
26651
- created_at: 1698644100397,
26652
- },
26653
- {
26654
- id: 2,
26655
- country: 'NG',
26656
- year: 2022,
26657
- energyEmissions: {
26658
- fuelCombustionActivities: {
26659
- energyIndustries: {
26660
- bau: 20,
26661
- conditionalNdc: 15,
26662
- unconditionalNdc: 33,
26663
- },
26664
- manufacturingIndustriesConstruction: {
26665
- bau: 20,
26666
- conditionalNdc: 15,
26667
- unconditionalNdc: 33,
26668
- },
26669
- transport: {
26670
- bau: 20,
26671
- conditionalNdc: 15,
26672
- unconditionalNdc: 33,
26673
- },
26674
- otherSectors: {
26675
- bau: 20,
26676
- conditionalNdc: 15,
26677
- unconditionalNdc: 33,
26678
- },
26679
- nonSpecified: {
26680
- bau: 20,
26681
- conditionalNdc: 15,
26682
- unconditionalNdc: 33,
26683
- },
26684
- },
26685
- fugitiveEmissionsFromFuels: {
26686
- solidFuels: {
26687
- bau: 20,
26688
- conditionalNdc: 15,
26689
- unconditionalNdc: 33,
26690
- },
26691
- oilNaturalGas: {
26692
- bau: 20,
26693
- conditionalNdc: 15,
26694
- unconditionalNdc: 33,
26695
- },
26696
- otherEmissionsEnergyProduction: {
26697
- bau: 20,
26698
- conditionalNdc: 15,
26699
- unconditionalNdc: 33,
26700
- },
26701
- },
26702
- carbonDioxideTransportStorage: {
26703
- transportOfCo2: {
26704
- bau: 20,
26705
- conditionalNdc: 15,
26706
- unconditionalNdc: 33,
26707
- },
26708
- injectionStorage: {
26709
- bau: 20,
26710
- conditionalNdc: 15,
26711
- unconditionalNdc: 33,
26712
- },
26713
- other: {
26714
- bau: 20,
26715
- conditionalNdc: 15,
26716
- unconditionalNdc: 33,
26717
- },
26718
- },
26719
- },
26720
- industrialProcessesProductUse: {
26721
- mineralIndustry: {
26722
- bau: 20,
26723
- conditionalNdc: 15,
26724
- unconditionalNdc: 33,
26725
- },
26726
- chemicalIndustry: {
26727
- bau: 20,
26728
- conditionalNdc: 15,
26729
- unconditionalNdc: 33,
26730
- },
26731
- metalIndustry: {
26732
- bau: 20,
26733
- conditionalNdc: 15,
26734
- unconditionalNdc: 33,
26735
- },
26736
- nonEnergyProductsFuelsSolventUse: {
26737
- bau: 20,
26738
- conditionalNdc: 15,
26739
- unconditionalNdc: 33,
26740
- },
26741
- electronicsIndustry: {
26742
- bau: 20,
26743
- conditionalNdc: 15,
26744
- unconditionalNdc: 33,
26745
- },
26746
- productUsesSubstOzoneDepletingSubs: {
26747
- bau: 20,
26748
- conditionalNdc: 15,
26749
- unconditionalNdc: 33,
26750
- },
26751
- otherProductManufactureUse: {
26752
- bau: 20,
26753
- conditionalNdc: 15,
26754
- unconditionalNdc: 33,
26755
- },
26756
- other: {
26757
- bau: 20,
26758
- conditionalNdc: 15,
26759
- unconditionalNdc: 33,
26760
- },
26761
- },
26762
- agricultureForestryOtherLandUse: {
26763
- livestock: { bau: 20, conditionalNdc: 15, unconditionalNdc: 33 },
26764
- land: {
26765
- bau: 20,
26766
- conditionalNdc: 15,
26767
- unconditionalNdc: 33,
26768
- },
26769
- aggregateNonCo2SourcesLand: {
26770
- bau: 20,
26771
- conditionalNdc: 15,
26772
- unconditionalNdc: 33,
26773
- },
26774
- other: {
26775
- bau: 20,
26776
- conditionalNdc: 15,
26777
- unconditionalNdc: 33,
26778
- },
26779
- },
26780
- waste: {
26781
- solidWasteDisposal: {
26782
- bau: 20,
26783
- conditionalNdc: 15,
26784
- unconditionalNdc: 33,
26785
- },
26786
- biologicalTreatmentSolidWaste: {
26787
- bau: 20,
26788
- conditionalNdc: 15,
26789
- unconditionalNdc: 33,
26790
- },
26791
- incinerationOpenBurningWaste: {
26792
- bau: 20,
26793
- conditionalNdc: 15,
26794
- unconditionalNdc: 33,
26795
- },
26796
- wastewaterTreatmentDischarge: {
26797
- bau: 20,
26798
- conditionalNdc: 15,
26799
- unconditionalNdc: 33,
26800
- },
26801
- other: {
26802
- bau: 20,
26803
- conditionalNdc: 15,
26804
- unconditionalNdc: 33,
26805
- },
26806
- },
26807
- other: {
26808
- indirectN2oEmissions: {
26809
- bau: 20,
26810
- conditionalNdc: 15,
26811
- unconditionalNdc: 33,
26812
- },
26813
- other: {
26814
- bau: 20,
26815
- conditionalNdc: 15,
26816
- unconditionalNdc: 33,
26817
- },
26818
- },
26819
- totalCo2WithoutLand: {
26820
- bau: 20,
26821
- conditionalNdc: 15,
26822
- unconditionalNdc: 33,
26823
- },
26824
- totalCo2WithLand: {
26825
- bau: 20,
26826
- conditionalNdc: 15,
26827
- unconditionalNdc: 33,
26828
- },
26829
- state: 'FINALIZED',
26830
- version: 1,
26831
- created_at: 1698644100397,
26832
- },
26833
- ];
26834
- var _a = useConnection(); _a.put; _a.get; var post = _a.post;
26835
- var _b = useState(false), loading = _b[0], setLoading = _b[1];
26836
- var _c = useState(false), isPendingFinalization = _c[0], setIsPendingFinalization = _c[1];
26837
- var _d = useState(null); _d[0]; var setSelectedYear = _d[1];
26838
- var _e = useState(''), uploadedFileName = _e[0], setUploadedFileName = _e[1];
26839
- var _f = useState([]), disabledYears = _f[0], setDisabledYears = _f[1];
26840
- var _g = useState(); _g[0]; var setChangedValues = _g[1];
26841
- var _h = useState(0), totalNationalBau = _h[0], setTotalNationalBau = _h[1];
26842
- var _j = useState(0), totalNationalConditionalNdc = _j[0], setTotalNationalConditionalNdc = _j[1];
26843
- var _k = useState(0), totalNationalUnconditionalNdc = _k[0], setTotalNationalUnconditionalNdc = _k[1];
26844
- var _l = useState(0), energyEmissionsBau = _l[0], setEnergyEmissionsBau = _l[1];
26845
- var _m = useState(0), energyEmissionsConditionalNdc = _m[0], setEnergyEmissionsConditionalNdc = _m[1];
26846
- var _o = useState(0), energyEmissionsUnconditionalNdc = _o[0], setEnergyEmissionsUnconditionalNdc = _o[1];
26847
- var _p = useState(0), fuelCombustionActivitiesBau = _p[0], setFuelCombustionActivitiesBau = _p[1];
26848
- var _q = useState(0), fuelCombustionActivitiesConditionalNdc = _q[0], setFuelCombustionActivitiesConditionalNdc = _q[1];
26849
- var _r = useState(0), fuelCombustionActivitiesUnconditionalNdc = _r[0], setFuelCombustionActivitiesUnconditionalNdc = _r[1];
26850
- var _s = useState(0), fugitiveEmissionsFromFuelsBau = _s[0], setFugitiveEmissionsFromFuelsBau = _s[1];
26851
- var _t = useState(0), fugitiveEmissionsFromFuelsConditionalNdc = _t[0], setFugitiveEmissionsFromFuelsConditionalNdc = _t[1];
26852
- var _u = useState(0), fugitiveEmissionsFromFuelsUnconditionalNdc = _u[0], setFugitiveEmissionsFromFuelsUnconditionalNdc = _u[1];
26853
- var _v = useState(0), carbonDioxideTransportStorageBau = _v[0], setCarbonDioxideTransportStorageBau = _v[1];
26854
- var _w = useState(0), carbonDioxideTransportStorageConditionalNdc = _w[0], setCarbonDioxideTransportStorageConditionalNdc = _w[1];
26855
- var _x = useState(0), carbonDioxideTransportStorageUnconditionalNdc = _x[0], setCarbonDioxideTransportStorageUnconditionalNdc = _x[1];
26856
- var _y = useState(0), industrialProcessesProductUseBau = _y[0], setIndustrialProcessesProductUseBau = _y[1];
26857
- var _z = useState(0), industrialProcessesProductUseConditionalNdc = _z[0], setIndustrialProcessesProductUseConditionalNdc = _z[1];
26858
- var _0 = useState(0), industrialProcessesProductUseUnconditionalNdc = _0[0], setIndustrialProcessesProductUseUnconditionalNdc = _0[1];
26859
- var _1 = useState(0), agricultureForestryOtherLandUseBau = _1[0], setAgricultureForestryOtherLandUseBau = _1[1];
26860
- var _2 = useState(0), agricultureForestryOtherLandUseConditionalNdc = _2[0], setAgricultureForestryOtherLandUseConditionalNdc = _2[1];
26861
- var _3 = useState(0), agricultureForestryOtherLandUseUnconditionalNdc = _3[0], setAgricultureForestryOtherLandUseUnconditionalNdc = _3[1];
26862
- var _4 = useState(0), wasteBau = _4[0], setWasteBau = _4[1];
26863
- var _5 = useState(0), wasteConditionalNdc = _5[0], setWasteConditionalNdc = _5[1];
26864
- var _6 = useState(0), wasteUnconditionalNdc = _6[0], setWasteUnconditionalNdc = _6[1];
26865
- var _7 = useState(0), otherBau = _7[0], setOtherBau = _7[1];
26866
- var _8 = useState(0), otherConditionalNdc = _8[0], setOtherConditionalNdc = _8[1];
26867
- var _9 = useState(0), otherUnconditionalNdc = _9[0], setOtherUnconditionalNdc = _9[1];
26868
- var _10 = useState(false), isSavedFormDataSet = _10[0], setIsSavedFormDataSet = _10[1];
26614
+ var _a = useState([]), data = _a[0], setData = _a[1];
26615
+ var _b = useConnection(); _b.put; var get = _b.get, post = _b.post;
26616
+ var _c = useState(false), loading = _c[0], setLoading = _c[1];
26617
+ var _d = useState(false), isPendingFinalization = _d[0], setIsPendingFinalization = _d[1];
26618
+ var _e = useState(null); _e[0]; var setSelectedYear = _e[1];
26619
+ var _f = useState(''), uploadedFileName = _f[0], setUploadedFileName = _f[1];
26620
+ var _g = useState([]), disabledYears = _g[0], setDisabledYears = _g[1];
26621
+ var _h = useState(); _h[0]; _h[1];
26622
+ var _j = useState(0), totalNationalBau = _j[0], setTotalNationalBau = _j[1];
26623
+ var _k = useState(0), totalNationalConditionalNdc = _k[0], setTotalNationalConditionalNdc = _k[1];
26624
+ var _l = useState(0), totalNationalUnconditionalNdc = _l[0], setTotalNationalUnconditionalNdc = _l[1];
26625
+ var _m = useState(0), energyEmissionsBau = _m[0], setEnergyEmissionsBau = _m[1];
26626
+ var _o = useState(0), energyEmissionsConditionalNdc = _o[0], setEnergyEmissionsConditionalNdc = _o[1];
26627
+ var _p = useState(0), energyEmissionsUnconditionalNdc = _p[0], setEnergyEmissionsUnconditionalNdc = _p[1];
26628
+ var _q = useState(0), fuelCombustionActivitiesBau = _q[0], setFuelCombustionActivitiesBau = _q[1];
26629
+ var _r = useState(0), fuelCombustionActivitiesConditionalNdc = _r[0], setFuelCombustionActivitiesConditionalNdc = _r[1];
26630
+ var _s = useState(0), fuelCombustionActivitiesUnconditionalNdc = _s[0], setFuelCombustionActivitiesUnconditionalNdc = _s[1];
26631
+ var _t = useState(0), fugitiveEmissionsFromFuelsBau = _t[0], setFugitiveEmissionsFromFuelsBau = _t[1];
26632
+ var _u = useState(0), fugitiveEmissionsFromFuelsConditionalNdc = _u[0], setFugitiveEmissionsFromFuelsConditionalNdc = _u[1];
26633
+ var _v = useState(0), fugitiveEmissionsFromFuelsUnconditionalNdc = _v[0], setFugitiveEmissionsFromFuelsUnconditionalNdc = _v[1];
26634
+ var _w = useState(0), carbonDioxideTransportStorageBau = _w[0], setCarbonDioxideTransportStorageBau = _w[1];
26635
+ var _x = useState(0), carbonDioxideTransportStorageConditionalNdc = _x[0], setCarbonDioxideTransportStorageConditionalNdc = _x[1];
26636
+ var _y = useState(0), carbonDioxideTransportStorageUnconditionalNdc = _y[0], setCarbonDioxideTransportStorageUnconditionalNdc = _y[1];
26637
+ var _z = useState(0), industrialProcessesProductUseBau = _z[0], setIndustrialProcessesProductUseBau = _z[1];
26638
+ var _0 = useState(0), industrialProcessesProductUseConditionalNdc = _0[0], setIndustrialProcessesProductUseConditionalNdc = _0[1];
26639
+ var _1 = useState(0), industrialProcessesProductUseUnconditionalNdc = _1[0], setIndustrialProcessesProductUseUnconditionalNdc = _1[1];
26640
+ var _2 = useState(0), agricultureForestryOtherLandUseBau = _2[0], setAgricultureForestryOtherLandUseBau = _2[1];
26641
+ var _3 = useState(0), agricultureForestryOtherLandUseConditionalNdc = _3[0], setAgricultureForestryOtherLandUseConditionalNdc = _3[1];
26642
+ var _4 = useState(0), agricultureForestryOtherLandUseUnconditionalNdc = _4[0], setAgricultureForestryOtherLandUseUnconditionalNdc = _4[1];
26643
+ var _5 = useState(0), wasteBau = _5[0], setWasteBau = _5[1];
26644
+ var _6 = useState(0), wasteConditionalNdc = _6[0], setWasteConditionalNdc = _6[1];
26645
+ var _7 = useState(0), wasteUnconditionalNdc = _7[0], setWasteUnconditionalNdc = _7[1];
26646
+ var _8 = useState(0), otherBau = _8[0], setOtherBau = _8[1];
26647
+ var _9 = useState(0), otherConditionalNdc = _9[0], setOtherConditionalNdc = _9[1];
26648
+ var _10 = useState(0), otherUnconditionalNdc = _10[0], setOtherUnconditionalNdc = _10[1];
26649
+ var _11 = useState(false), isSavedFormDataSet = _11[0], setIsSavedFormDataSet = _11[1];
26650
+ var _12 = useState(1), formDataVersion = _12[0], setFormDataVersion = _12[1];
26651
+ var _13 = useState(false), isFormChanged = _13[0], setIsFormChanged = _13[1];
26652
+ var _14 = useState(false), openSaveFormModal = _14[0], setOpenSaveFormModal = _14[1];
26653
+ var _15 = useState(false), openFinalizeFormModal = _15[0], setOpenFinalizeFormModal = _15[1];
26654
+ var _16 = useState(false), openResetFormModal = _16[0], setOpenResetFormModal = _16[1];
26655
+ var _17 = useState(''), errorMsg = _17[0], setErrorMsg = _17[1];
26656
+ var _18 = useState({}), actionInfo = _18[0], setActionInfo = _18[1];
26869
26657
  var Panel = Collapse.Panel;
26870
26658
  var form = Form.useForm()[0];
26871
26659
  var createSetFieldObject = function (obj, objName) {
@@ -26966,16 +26754,7 @@ var GHGProjectionsComponent = function (props) {
26966
26754
  };
26967
26755
  useEffect(function () {
26968
26756
  var hasSaveState = data.some(function (item) { return item.state === 'SAVED'; });
26969
- var years = data.map(function (item) { return !(item.state === 'SAVED') && item.year; });
26970
- console.log(uploadedFileName);
26971
26757
  setIsPendingFinalization(hasSaveState);
26972
- // Update 'disabledYears' only if 'years' array has changed
26973
- setDisabledYears(function (prevYears) {
26974
- if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
26975
- return years;
26976
- }
26977
- return prevYears;
26978
- });
26979
26758
  }, [data, uploadedFileName]);
26980
26759
  function calculateSumEmissionView(obj, conditionType) {
26981
26760
  var sum = 0;
@@ -26991,10 +26770,15 @@ var GHGProjectionsComponent = function (props) {
26991
26770
  }
26992
26771
  return sum;
26993
26772
  }
26994
- var onValuesChange = function (changedValues2, allValues) {
26995
- // Track the changed values
26996
- console.log('=================onValuesChange changedValues, allValues', changedValues2, allValues);
26997
- setChangedValues(function (prevChangedValues) { return (__assign(__assign({}, prevChangedValues), changedValues2)); });
26773
+ var onValuesChange = function (changedValues, allValues) {
26774
+ var initialValues = null;
26775
+ if (isPendingFinalization) {
26776
+ var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
26777
+ initialValues = savedData[0];
26778
+ }
26779
+ var currentValues = form.getFieldsValue(true);
26780
+ var isChanged = !(JSON.stringify(currentValues) === JSON.stringify(initialValues));
26781
+ setIsFormChanged(isChanged);
26998
26782
  };
26999
26783
  var getBase64 = function (file) {
27000
26784
  return new Promise(function (resolve, reject) {
@@ -27004,7 +26788,7 @@ var GHGProjectionsComponent = function (props) {
27004
26788
  reader.onerror = function (error) { return reject(error); };
27005
26789
  });
27006
26790
  };
27007
- var createSaveRequestPayload = function (fields) { return __awaiter(void 0, void 0, void 0, function () {
26791
+ var createSaveRequestPayload = function (fields, remarks, status) { return __awaiter(void 0, void 0, void 0, function () {
27008
26792
  var requestBody, savedEmission, emissionImportBase64;
27009
26793
  var _a;
27010
26794
  return __generator(this, function (_b) {
@@ -27189,7 +26973,9 @@ var GHGProjectionsComponent = function (props) {
27189
26973
  conditionalNdc: fields === null || fields === void 0 ? void 0 : fields.totalCo2WithLand_conditionalNdc,
27190
26974
  unconditionalNdc: fields === null || fields === void 0 ? void 0 : fields.totalCo2WithLand_unconditionalNdc,
27191
26975
  },
27192
- state: 'SAVED',
26976
+ state: status,
26977
+ remarks: remarks,
26978
+ version: formDataVersion,
27193
26979
  };
27194
26980
  requestBody = savedEmission;
27195
26981
  if (!(fields === null || fields === void 0 ? void 0 : fields.emissionsDocument)) return [3 /*break*/, 2];
@@ -27204,46 +26990,216 @@ var GHGProjectionsComponent = function (props) {
27204
26990
  }
27205
26991
  });
27206
26992
  }); };
27207
- var onSubmitForm = function (values) { return __awaiter(void 0, void 0, void 0, function () {
27208
- var fields, payload, response, error_1;
26993
+ var clearForm = function () {
26994
+ form.resetFields();
26995
+ setFuelCombustionActivitiesBau(0);
26996
+ setFuelCombustionActivitiesConditionalNdc(0);
26997
+ setFuelCombustionActivitiesUnconditionalNdc(0);
26998
+ setFugitiveEmissionsFromFuelsBau(0);
26999
+ setFugitiveEmissionsFromFuelsConditionalNdc(0);
27000
+ setFugitiveEmissionsFromFuelsUnconditionalNdc(0);
27001
+ setCarbonDioxideTransportStorageBau(0);
27002
+ setCarbonDioxideTransportStorageConditionalNdc(0);
27003
+ setCarbonDioxideTransportStorageUnconditionalNdc(0);
27004
+ setIndustrialProcessesProductUseBau(0);
27005
+ setIndustrialProcessesProductUseConditionalNdc(0);
27006
+ setIndustrialProcessesProductUseUnconditionalNdc(0);
27007
+ setAgricultureForestryOtherLandUseBau(0);
27008
+ setAgricultureForestryOtherLandUseConditionalNdc(0);
27009
+ setAgricultureForestryOtherLandUseUnconditionalNdc(0);
27010
+ setWasteBau(0);
27011
+ setWasteConditionalNdc(0);
27012
+ setWasteUnconditionalNdc(0);
27013
+ setOtherBau(0);
27014
+ setOtherConditionalNdc(0);
27015
+ setOtherUnconditionalNdc(0);
27016
+ };
27017
+ var resetForm = function () { return __awaiter(void 0, void 0, void 0, function () {
27018
+ return __generator(this, function (_a) {
27019
+ switch (_a.label) {
27020
+ case 0:
27021
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
27022
+ return [4 /*yield*/, getProjectionData()];
27023
+ case 1:
27024
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
27025
+ _a.sent();
27026
+ setOpenResetFormModal(false);
27027
+ setIsSavedFormDataSet(false);
27028
+ clearUploadDoc();
27029
+ if (!isPendingFinalization) {
27030
+ clearForm();
27031
+ }
27032
+ message.open({
27033
+ type: 'success',
27034
+ content: t('ghgInventory:formCancelledSuccess'),
27035
+ duration: 4,
27036
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
27037
+ });
27038
+ return [2 /*return*/];
27039
+ }
27040
+ });
27041
+ }); };
27042
+ var onResetFormCanceled = function () {
27043
+ setOpenResetFormModal(false);
27044
+ };
27045
+ var onOpenResetFormModel = function () {
27046
+ setActionInfo({
27047
+ action: "".concat(t('ghgInventory:proceed')),
27048
+ headerText: "".concat(t('ghgInventory:discardHeaderText')),
27049
+ type: 'danger',
27050
+ icon: React.createElement(CloseCircleOutlined, null),
27051
+ });
27052
+ setErrorMsg('');
27053
+ setOpenResetFormModal(true);
27054
+ };
27055
+ var onSaveFormCanceled = function () {
27056
+ setOpenSaveFormModal(false);
27057
+ };
27058
+ var onOpenSaveFormModel = function () {
27059
+ if (!isFormChanged) {
27060
+ message.open({
27061
+ type: 'error',
27062
+ content: t('ghgInventory:formNotChanged'),
27063
+ duration: 4,
27064
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
27065
+ });
27066
+ }
27067
+ else {
27068
+ setActionInfo({
27069
+ action: "".concat(t("ghgInventory:submit")),
27070
+ headerText: "".concat(t("ghgInventory:submitModelHeader")),
27071
+ type: "primary",
27072
+ icon: React.createElement(CheckCircleOutlined, null),
27073
+ });
27074
+ setErrorMsg('');
27075
+ setOpenSaveFormModal(true);
27076
+ }
27077
+ };
27078
+ var onFinalizeFormCanceled = function () {
27079
+ setOpenFinalizeFormModal(false);
27080
+ };
27081
+ var onOpenFinalizeFormModel = function () {
27082
+ setActionInfo({
27083
+ action: "".concat(t("ghgInventory:finalize")),
27084
+ headerText: "".concat(t("ghgInventory:finalizeModelHeader")),
27085
+ type: "primary",
27086
+ icon: React.createElement(ClipboardCheck, null),
27087
+ });
27088
+ setErrorMsg('');
27089
+ setOpenFinalizeFormModal(true);
27090
+ };
27091
+ var getProjectionData = function () { return __awaiter(void 0, void 0, void 0, function () {
27092
+ var response, error_1;
27093
+ return __generator(this, function (_a) {
27094
+ switch (_a.label) {
27095
+ case 0:
27096
+ setLoading(true);
27097
+ _a.label = 1;
27098
+ case 1:
27099
+ _a.trys.push([1, 3, 4, 5]);
27100
+ return [4 /*yield*/, get('national/projections')];
27101
+ case 2:
27102
+ response = _a.sent();
27103
+ console.log('Projection GET -> ', response);
27104
+ if (response === null || response === void 0 ? void 0 : response.data) {
27105
+ setData(response.data);
27106
+ }
27107
+ return [3 /*break*/, 5];
27108
+ case 3:
27109
+ error_1 = _a.sent();
27110
+ console.log('Error in projection fetch - ', error_1);
27111
+ message.open({
27112
+ type: 'error',
27113
+ content: error_1 === null || error_1 === void 0 ? void 0 : error_1.message,
27114
+ duration: 4,
27115
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
27116
+ });
27117
+ return [3 /*break*/, 5];
27118
+ case 4:
27119
+ setIsFormChanged(false);
27120
+ setLoading(false);
27121
+ return [7 /*endfinally*/];
27122
+ case 5: return [2 /*return*/];
27123
+ }
27124
+ });
27125
+ }); };
27126
+ useEffect(function () {
27127
+ var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {
27128
+ return __generator(this, function (_a) {
27129
+ switch (_a.label) {
27130
+ case 0: return [4 /*yield*/, getProjectionData()];
27131
+ case 1:
27132
+ _a.sent();
27133
+ return [2 /*return*/];
27134
+ }
27135
+ });
27136
+ }); };
27137
+ fetchData();
27138
+ }, []);
27139
+ var onSubmitForm = function (remarks, status) { return __awaiter(void 0, void 0, void 0, function () {
27140
+ var fields, payload, response, messageContent, error_2;
27209
27141
  return __generator(this, function (_a) {
27210
27142
  switch (_a.label) {
27211
27143
  case 0:
27212
27144
  fields = form.getFieldsValue(true);
27213
- return [4 /*yield*/, createSaveRequestPayload(fields)];
27145
+ return [4 /*yield*/, createSaveRequestPayload(fields, remarks, status)];
27214
27146
  case 1:
27215
27147
  payload = _a.sent();
27216
27148
  setLoading(true);
27217
27149
  _a.label = 2;
27218
27150
  case 2:
27219
- _a.trys.push([2, 4, 5, 6]);
27151
+ _a.trys.push([2, 6, 9, 10]);
27220
27152
  return [4 /*yield*/, post('national/projections', payload)];
27221
27153
  case 3:
27222
27154
  response = _a.sent();
27223
27155
  console.log('Projections creation -> ', response);
27224
- if ((response === null || response === void 0 ? void 0 : response.statusText) === 'SUCCESS') {
27225
- message.open({
27226
- type: 'success',
27227
- content: (response === null || response === void 0 ? void 0 : response.status) == HttpStatusCode.Created ? t('ghgInventory:projectionCreationSuccess') : t('ghgInventory:projectionUpdateSuccess'),
27228
- duration: 4,
27229
- style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
27230
- });
27156
+ if (!((response === null || response === void 0 ? void 0 : response.statusText) === 'SUCCESS')) return [3 /*break*/, 5];
27157
+ setOpenSaveFormModal(false);
27158
+ messageContent = (response === null || response === void 0 ? void 0 : response.status) == HttpStatusCode.Created ?
27159
+ t('ghgInventory:projectionCreationSuccess')
27160
+ : t('ghgInventory:projectionUpdateSuccess');
27161
+ if (status === GHGRecordState.FINALIZED) {
27162
+ clearUploadDoc();
27163
+ clearForm();
27164
+ messageContent = t('ghgInventory:projectionFinalizedSuccess');
27231
27165
  }
27232
- return [3 /*break*/, 6];
27166
+ setOpenFinalizeFormModal(false);
27167
+ message.open({
27168
+ type: 'success',
27169
+ content: messageContent,
27170
+ duration: 4,
27171
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
27172
+ });
27173
+ clearUploadDoc();
27174
+ return [4 /*yield*/, getProjectionData()];
27233
27175
  case 4:
27234
- error_1 = _a.sent();
27235
- console.log('Error in projection creation - ', error_1);
27176
+ _a.sent();
27177
+ _a.label = 5;
27178
+ case 5: return [3 /*break*/, 10];
27179
+ case 6:
27180
+ error_2 = _a.sent();
27181
+ console.log('Error in projection creation - ', error_2);
27182
+ setOpenSaveFormModal(false);
27183
+ setOpenFinalizeFormModal(false);
27236
27184
  message.open({
27237
27185
  type: 'error',
27238
- content: error_1 === null || error_1 === void 0 ? void 0 : error_1.message,
27186
+ content: error_2 === null || error_2 === void 0 ? void 0 : error_2.message,
27239
27187
  duration: 4,
27240
27188
  style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
27241
27189
  });
27242
- return [3 /*break*/, 6];
27243
- case 5:
27190
+ if (!(error_2.statusCode == HttpStatusCode.Conflict)) return [3 /*break*/, 8];
27191
+ return [4 /*yield*/, getProjectionData()];
27192
+ case 7:
27193
+ _a.sent();
27194
+ clearUploadDoc();
27195
+ _a.label = 8;
27196
+ case 8: return [3 /*break*/, 10];
27197
+ case 9:
27198
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
27199
+ setIsFormChanged(false);
27244
27200
  setLoading(false);
27245
27201
  return [7 /*endfinally*/];
27246
- case 6: return [2 /*return*/];
27202
+ case 10: return [2 /*return*/];
27247
27203
  }
27248
27204
  });
27249
27205
  }); };
@@ -27290,12 +27246,25 @@ var GHGProjectionsComponent = function (props) {
27290
27246
  setIsSavedFormDataSet(true);
27291
27247
  };
27292
27248
  useEffect(function () {
27293
- if (isPendingFinalization) {
27294
- if (!isSavedFormDataSet) {
27295
- var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
27249
+ var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
27250
+ if (!isSavedFormDataSet) {
27251
+ if (savedData && savedData.length > 0) {
27296
27252
  setFormValues(savedData[0]);
27297
27253
  }
27298
27254
  }
27255
+ if (savedData && savedData.length > 0) {
27256
+ setFormDataVersion(savedData[0].version);
27257
+ }
27258
+ var years = data
27259
+ .filter(function (item) { return !(item.state === 'SAVED' && item.year); }) // Filter out items where state is not 'SAVED'
27260
+ .map(function (item) { return parseInt(item.year); });
27261
+ // Update 'disabledYears' only if 'years' array has changed
27262
+ setDisabledYears(function (prevYears) {
27263
+ if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
27264
+ return years;
27265
+ }
27266
+ return prevYears;
27267
+ });
27299
27268
  }, [data]);
27300
27269
  var checkFile = function (file) {
27301
27270
  var isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
@@ -27311,6 +27280,12 @@ var GHGProjectionsComponent = function (props) {
27311
27280
  }
27312
27281
  return e === null || e === void 0 ? void 0 : e.fileList;
27313
27282
  };
27283
+ var clearUploadDoc = function () {
27284
+ setUploadedFileName('');
27285
+ form.setFieldsValue({
27286
+ emissionsDocument: null,
27287
+ });
27288
+ };
27314
27289
  var handleYearChange = function (date, dateString) {
27315
27290
  setSelectedYear(dateString);
27316
27291
  };
@@ -27682,9 +27657,10 @@ var GHGProjectionsComponent = function (props) {
27682
27657
  React.createElement("div", { className: "body-sub-title" }, t("ghgInventory:totalNationalEmissionSubTitle")))),
27683
27658
  React.createElement("div", { className: "content-card add-projection" },
27684
27659
  React.createElement(Tabs, { defaultActiveKey: "Add New", centered: true },
27685
- ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT || (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY) && (React.createElement(Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
27660
+ ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT ||
27661
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY) && (React.createElement(Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
27686
27662
  React.createElement("div", null,
27687
- React.createElement(Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, name: "add-projection", className: "programme-details-form", layout: "vertical", requiredMark: true, form: form, onValuesChange: onValuesChange, onFinish: onSubmitForm },
27663
+ React.createElement(Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, name: "add-projection", className: "programme-details-form", layout: "vertical", requiredMark: true, form: form, onValuesChange: onValuesChange, onFinish: onOpenSaveFormModel },
27688
27664
  React.createElement(Row, null,
27689
27665
  React.createElement(Col, { xl: 12, md: 12, className: "add-new-year-picker-col" },
27690
27666
  React.createElement("div", null,
@@ -27763,7 +27739,7 @@ var GHGProjectionsComponent = function (props) {
27763
27739
  } },
27764
27740
  React.createElement(Button, { icon: React.createElement(UploadOutlined, null) }, t("ghgInventory:upload"))))),
27765
27741
  React.createElement(Col, { xl: 16, md: 16, className: "add-new-upload-file-name-input" },
27766
- React.createElement(Input, { value: uploadedFileName, readOnly: true }))))),
27742
+ React.createElement(Input, { value: uploadedFileName, readOnly: true, suffix: uploadedFileName && (React.createElement(Button, { onClick: clearUploadDoc, icon: React.createElement(DeleteOutlined, null), style: { marginRight: '-10px', padding: '0px 6px' } })) }))))),
27767
27743
  React.createElement(Row, { gutter: 16 },
27768
27744
  React.createElement(Col, { span: 9, offset: 12 },
27769
27745
  React.createElement(Row, { gutter: 16, className: "table-heading-row" },
@@ -27830,10 +27806,10 @@ var GHGProjectionsComponent = function (props) {
27830
27806
  React.createElement(Form.Item, { name: "totalCo2WithLand_unconditionalNdc" },
27831
27807
  React.createElement(InputNumber, null)))))),
27832
27808
  React.createElement("div", { className: "steps-actions" },
27833
- React.createElement(Button, { type: "primary", htmlType: "submit", loading: loading }, "Submit"),
27834
- React.createElement(Button, { className: "back-btn",
27835
- // onClick={() => prevOne()}
27836
- loading: loading }, "Cancel")))))),
27809
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
27810
+ (React.createElement(Button, { className: "finalize-btn", type: "primary", loading: loading, onClick: onOpenFinalizeFormModel }, "Finalize")),
27811
+ React.createElement(Button, { className: "submit-btn", type: "primary", htmlType: "submit", loading: loading }, "Submit"),
27812
+ React.createElement(Button, { className: "back-btn", onClick: onOpenResetFormModel, loading: loading }, "Cancel")))))),
27837
27813
  data.map(function (tabData) {
27838
27814
  return tabData.state === 'FINALIZED' && (React.createElement(Tabs.TabPane, { key: tabData.id.toString(), tab: React.createElement("span", null,
27839
27815
  tabData.year,
@@ -27931,7 +27907,10 @@ var GHGProjectionsComponent = function (props) {
27931
27907
  })));
27932
27908
  })));
27933
27909
  })))));
27934
- }))))));
27910
+ })))),
27911
+ React.createElement(GHGUserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onSubmitForm, onActionCanceled: onSaveFormCanceled, openModal: openSaveFormModal, errorMsg: errorMsg, loading: loading }),
27912
+ React.createElement(GHGUserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onSubmitForm, onActionCanceled: onFinalizeFormCanceled, openModal: openFinalizeFormModal, errorMsg: errorMsg, loading: loading }),
27913
+ React.createElement(DiscardChangesConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: resetForm, onActionCanceled: onResetFormCanceled, openModal: openResetFormModal, errorMsg: errorMsg, loading: loading })));
27935
27914
  };
27936
27915
 
27937
27916
  export { Action, AddNdcActionComponent, AddNewCompanyComponent, AddNewUserComponent, AdminBGColor, AdminColor, BaseEntity, CarbonSystemType, CertBGColor, CertColor, CoBenifitsComponent, Company, CompanyManagementColumns, CompanyManagementComponent, CompanyProfileComponent, CompanyRole, CompanyState, ConfigurationSettingsType, CreditTransferComponent, CreditTransferStage, DevBGColor, DevColor, DocType, DocumentStatus, ESGType, Emission, EnergyGenerationUnits, FormElementType, GHGEmissionsComponent, GHGProjectionsComponent, GovBGColor, GovColor, ImgWithFallback, InfoView, Instrument, InvestmentBGColor, InvestmentBody, InvestmentColor, InvestmentCreationComponent, InvestmentLevel, InvestmentManagementComponent, InvestmentStatus, InvestmentStream, InvestmentType, LandAreaUnits, LegendItem, Loading, ManagerBGColor, ManagerColor, MapComponent, MapTypes, MapboxComponent, MinBGColor, MinColor, MitigationTypes, MrvDashboardComponent, MrvStatsCardsTypes, NdcActionBody, NdcActionManagementComponent, NdcActionStatus, NdcActionTypes, NdcActionViewComponent, OrganisationStatus, ProfileIcon, ProgrammeCertify, ProgrammeCreationComponent, ProgrammeDocuments, ProgrammeEntity, ProgrammeIssueForm, ProgrammeManagementColumns, ProgrammeManagementComponent, ProgrammeRetireForm, ProgrammeRevokeForm, ProgrammeStageLegend, ProgrammeStageMRV, ProgrammeStageR, ProgrammeStageUnified, ProgrammeTransfer, ProgrammeTransferForm, Projection, RadioButtonStatus, RadioButtonStatus2, RegistryDashboardComponent, RejectDocumentationConfirmationModel, RetireType, Role, RoleIcon, RootBGColor, RootColor, SdgGoals$1 as SdgGoals, Sector, SectoralScope, StasticCard, StatsCardsTypes, SystemNames, TimelineBody, Titles, TooltipColor, TransferActionModel, TxType, TypeOfMitigation, UnitField, User, UserManagementColumns, UserManagementComponent, UserProfileComponent, UserRoleIcon, ViewBGColor, ViewColor, WidgetType, addCommSep, addCommSepRound, addRoundNumber, addSpaces, consumerGroupList, creditUnit, dateFormat, dateTimeFormat, energyGenerationUnitList, getBase64, getCompanyBgColor, getCreditStageVal, getFinancialFields, getGeneralFields, getInvestmentStatusEnumVal, getNdcActionStatusEnumVal, getNdcStatusTagType, getRetirementTypeString, getStageEnumVal, getStageTagType, getStageTagTypeMRV, getStageTransferEnumVal, getStatusTagType, getTransferStageTagType, isBase64, landAreaUnitList, mitigationTypeList, ndcActionTypeList, sectorMitigationTypesListMapped, sumArray, titleList };