@undp/carbon-library 1.0.135-ghg-inventory.1 → 1.0.135-ghg-inventory.3

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, CloseCircleOutlined } 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, DownloadOutlined, 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.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: 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 color: #8C8C8C;\n border-radius: 4px; }\n .emission-tab-container .add-emission .view-download-file-name-input input {\n height: 50px;\n color: #16b1ff; }\n .emission-tab-container .add-emission .view-download-file-inner-col button {\n height: 50px;\n font-size: 12px;\n font-weight: 400;\n width: 135px;\n margin-left: 5px;\n color: #8C8C8C;\n border-radius: 4px; }\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 .view-data-panel .panel-content-input-box-row {\n padding-bottom: 24px; }\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' };
@@ -25067,6 +25067,238 @@ var formFields = {
25067
25067
  ],
25068
25068
  other: ['indirectN2oEmissions', 'other'],
25069
25069
  };
25070
+ var emissionCsvFieldMap = {
25071
+ "year": "Year",
25072
+ "energyEmissions_fuelCombustionActivities_transport_ch4": "Transport - CH4",
25073
+ "energyEmissions_fuelCombustionActivities_transport_co2": "Transport - CO2",
25074
+ "energyEmissions_fuelCombustionActivities_transport_n2o": "Transport - N2O",
25075
+ "energyEmissions_fuelCombustionActivities_transport_co2eq": "Transport - CO2-eq",
25076
+ "energyEmissions_fuelCombustionActivities_nonSpecified_ch4": "Non-Specified - CH4",
25077
+ "energyEmissions_fuelCombustionActivities_nonSpecified_co2": "Non-Specified - CO2",
25078
+ "energyEmissions_fuelCombustionActivities_nonSpecified_n2o": "Non-Specified - N2O",
25079
+ "energyEmissions_fuelCombustionActivities_nonSpecified_co2eq": "Non-Specified - CO2-eq",
25080
+ "energyEmissions_fuelCombustionActivities_otherSectors_ch4": "Other Sectors - CH4",
25081
+ "energyEmissions_fuelCombustionActivities_otherSectors_co2": "Other Sectors - CO2",
25082
+ "energyEmissions_fuelCombustionActivities_otherSectors_n2o": "Other Sectors - N2O",
25083
+ "energyEmissions_fuelCombustionActivities_otherSectors_co2eq": "Other Sectors - CO2-eq",
25084
+ "energyEmissions_fuelCombustionActivities_energyIndustries_ch4": "Energy Industries - CH4",
25085
+ "energyEmissions_fuelCombustionActivities_energyIndustries_co2": "Energy Industries - CO2",
25086
+ "energyEmissions_fuelCombustionActivities_energyIndustries_n2o": "Energy Industries - N2O",
25087
+ "energyEmissions_fuelCombustionActivities_energyIndustries_co2eq": "Energy Industries - CO2-eq",
25088
+ "energyEmissions_fuelCombustionActivities_manufacturingIndustriesConstruction_ch4": "Manufacturing Industries and Construction - CH4",
25089
+ "energyEmissions_fuelCombustionActivities_manufacturingIndustriesConstruction_co2": "Manufacturing Industries and Construction - CO2",
25090
+ "energyEmissions_fuelCombustionActivities_manufacturingIndustriesConstruction_n2o": "Manufacturing Industries and Construction - N2O",
25091
+ "energyEmissions_fuelCombustionActivities_manufacturingIndustriesConstruction_co2eq": "Manufacturing Industries and Construction - CO2-eq",
25092
+ "energyEmissions_fugitiveEmissionsFromFuels_solidFuels_ch4": "Solid Fuels - CH4",
25093
+ "energyEmissions_fugitiveEmissionsFromFuels_solidFuels_co2": "Solid Fuels - CO2",
25094
+ "energyEmissions_fugitiveEmissionsFromFuels_solidFuels_n2o": "Solid Fuels - N2O",
25095
+ "energyEmissions_fugitiveEmissionsFromFuels_solidFuels_co2eq": "Solid Fuels - CO2-eq",
25096
+ "energyEmissions_fugitiveEmissionsFromFuels_oilNaturalGas_ch4": "Oil and Natural Gas - CH4",
25097
+ "energyEmissions_fugitiveEmissionsFromFuels_oilNaturalGas_co2": "Oil and Natural Gas - CO2",
25098
+ "energyEmissions_fugitiveEmissionsFromFuels_oilNaturalGas_n2o": "Oil and Natural Gas - N2O",
25099
+ "energyEmissions_fugitiveEmissionsFromFuels_oilNaturalGas_co2eq": "Oil and Natural Gas - CO2-eq",
25100
+ "energyEmissions_fugitiveEmissionsFromFuels_otherEmissionsEnergyProduction_ch4": "Other emissions from Energy Production - CH4",
25101
+ "energyEmissions_fugitiveEmissionsFromFuels_otherEmissionsEnergyProduction_co2": "Other emissions from Energy Production - CO2",
25102
+ "energyEmissions_fugitiveEmissionsFromFuels_otherEmissionsEnergyProduction_n2o": "Other emissions from Energy Production - N2O",
25103
+ "energyEmissions_fugitiveEmissionsFromFuels_otherEmissionsEnergyProduction_co2eq": "Other emissions from Energy Production - CO2-eq",
25104
+ "energyEmissions_carbonDioxideTransportStorage_other_ch4": "Other (Carbon dioxide Transport and Storage) - CH4",
25105
+ "energyEmissions_carbonDioxideTransportStorage_other_co2": "Other (Carbon dioxide Transport and Storage) - CO2",
25106
+ "energyEmissions_carbonDioxideTransportStorage_other_n2o": "Other (Carbon dioxide Transport and Storage) - N2O",
25107
+ "energyEmissions_carbonDioxideTransportStorage_other_co2eq": "Other (Carbon dioxide Transport and Storage) - CO2-eq",
25108
+ "energyEmissions_carbonDioxideTransportStorage_transportOfCo2_ch4": "Transport of CO2 - CH4",
25109
+ "energyEmissions_carbonDioxideTransportStorage_transportOfCo2_co2": "Transport of CO2 - CO2",
25110
+ "energyEmissions_carbonDioxideTransportStorage_transportOfCo2_n2o": "Transport of CO2 - N2O",
25111
+ "energyEmissions_carbonDioxideTransportStorage_transportOfCo2_co2eq": "Transport of CO2 - CO2-eq",
25112
+ "energyEmissions_carbonDioxideTransportStorage_injectionStorage_ch4": "Injection and Storage - CH4",
25113
+ "energyEmissions_carbonDioxideTransportStorage_injectionStorage_co2": "Injection and Storage - CO2",
25114
+ "energyEmissions_carbonDioxideTransportStorage_injectionStorage_n2o": "Injection and Storage - N2O",
25115
+ "energyEmissions_carbonDioxideTransportStorage_injectionStorage_co2eq": "Injection and Storage - CO2-eq",
25116
+ "industrialProcessesProductUse_other_ch4": "Other (Industrial Processes & Product Use) - CH4",
25117
+ "industrialProcessesProductUse_other_co2": "Other (Industrial Processes & Product Use) - CO2",
25118
+ "industrialProcessesProductUse_other_n2o": "Other (Industrial Processes & Product Use) - N2O",
25119
+ "industrialProcessesProductUse_other_co2eq": "Other (Industrial Processes & Product Use) - CO2-eq",
25120
+ "industrialProcessesProductUse_metalIndustry_ch4": "Metal Industry - CH4",
25121
+ "industrialProcessesProductUse_metalIndustry_co2": "Metal Industry - CO2",
25122
+ "industrialProcessesProductUse_metalIndustry_n2o": "Metal Industry - N2O",
25123
+ "industrialProcessesProductUse_metalIndustry_co2eq": "Metal Industry - CO2-eq",
25124
+ "industrialProcessesProductUse_mineralIndustry_ch4": "Mineral Industry - CH4",
25125
+ "industrialProcessesProductUse_mineralIndustry_co2": "Mineral Industry - CO2",
25126
+ "industrialProcessesProductUse_mineralIndustry_n2o": "Mineral Industry - N2O",
25127
+ "industrialProcessesProductUse_mineralIndustry_co2eq": "Mineral Industry - CO2-eq",
25128
+ "industrialProcessesProductUse_chemicalIndustry_ch4": "Chemical Industry - CH4",
25129
+ "industrialProcessesProductUse_chemicalIndustry_co2": "Chemical Industry - CO2",
25130
+ "industrialProcessesProductUse_chemicalIndustry_n2o": "Chemical Industry - N2O",
25131
+ "industrialProcessesProductUse_chemicalIndustry_co2eq": "Chemical Industry - CO2-eq",
25132
+ "industrialProcessesProductUse_electronicsIndustry_ch4": "Electronics Industry - CH4",
25133
+ "industrialProcessesProductUse_electronicsIndustry_co2": "Electronics Industry - CO2",
25134
+ "industrialProcessesProductUse_electronicsIndustry_n2o": "Electronics Industry - N2O",
25135
+ "industrialProcessesProductUse_electronicsIndustry_co2eq": "Electronics Industry - CO2-eq",
25136
+ "industrialProcessesProductUse_otherProductManufactureUse_ch4": "Other Product Manufacture and Use - CH4",
25137
+ "industrialProcessesProductUse_otherProductManufactureUse_co2": "Other Product Manufacture and Use - CO2",
25138
+ "industrialProcessesProductUse_otherProductManufactureUse_n2o": "Other Product Manufacture and Use - N2O",
25139
+ "industrialProcessesProductUse_otherProductManufactureUse_co2eq": "Other Product Manufacture and Use - CO2-eq",
25140
+ "industrialProcessesProductUse_nonEnergyProductsFuelsSolventUse_ch4": "Non-Energy Products from Fuels and Solvent Use - CH4",
25141
+ "industrialProcessesProductUse_nonEnergyProductsFuelsSolventUse_co2": "Non-Energy Products from Fuels and Solvent Use - CO2",
25142
+ "industrialProcessesProductUse_nonEnergyProductsFuelsSolventUse_n2o": "Non-Energy Products from Fuels and Solvent Use - N2O",
25143
+ "industrialProcessesProductUse_nonEnergyProductsFuelsSolventUse_co2eq": "Non-Energy Products from Fuels and Solvent Use - CO2-eq",
25144
+ "industrialProcessesProductUse_productUsesSubstOzoneDepletingSubs_ch4": "Product Uses as Substitutes for Ozone Depleting Substances - CH4",
25145
+ "industrialProcessesProductUse_productUsesSubstOzoneDepletingSubs_co2": "Product Uses as Substitutes for Ozone Depleting Substances - CO2",
25146
+ "industrialProcessesProductUse_productUsesSubstOzoneDepletingSubs_n2o": "Product Uses as Substitutes for Ozone Depleting Substances - N2O",
25147
+ "industrialProcessesProductUse_productUsesSubstOzoneDepletingSubs_co2eq": "Product Uses as Substitutes for Ozone Depleting Substances - CO2-eq",
25148
+ "agricultureForestryOtherLandUse_land_ch4": "Land - CH4",
25149
+ "agricultureForestryOtherLandUse_land_co2": "Land - CO2",
25150
+ "agricultureForestryOtherLandUse_land_n2o": "Land - N2O",
25151
+ "agricultureForestryOtherLandUse_land_co2eq": "Land - CO2-eq",
25152
+ "agricultureForestryOtherLandUse_other_ch4": "Other (Agriculture, Forestry, and Other Land Use) - CH4",
25153
+ "agricultureForestryOtherLandUse_other_co2": "Other (Agriculture, Forestry, and Other Land Use) - CO2",
25154
+ "agricultureForestryOtherLandUse_other_n2o": "Other (Agriculture, Forestry, and Other Land Use) - N2O",
25155
+ "agricultureForestryOtherLandUse_other_co2eq": "Other (Agriculture, Forestry, and Other Land Use) - CO2-eq",
25156
+ "agricultureForestryOtherLandUse_livestock_ch4": "Livestock - CH4",
25157
+ "agricultureForestryOtherLandUse_livestock_co2": "Livestock - CO2",
25158
+ "agricultureForestryOtherLandUse_livestock_n2o": "Livestock - N2O",
25159
+ "agricultureForestryOtherLandUse_livestock_co2eq": "Livestock - CO2-eq",
25160
+ "agricultureForestryOtherLandUse_aggregateNonCo2SourcesLand_ch4": "Aggregate sources and non-CO2 emissions sources on land - CH4",
25161
+ "agricultureForestryOtherLandUse_aggregateNonCo2SourcesLand_co2": "Aggregate sources and non-CO2 emissions sources on land - CO2",
25162
+ "agricultureForestryOtherLandUse_aggregateNonCo2SourcesLand_n2o": "Aggregate sources and non-CO2 emissions sources on land - N2O",
25163
+ "agricultureForestryOtherLandUse_aggregateNonCo2SourcesLand_co2eq": "Aggregate sources and non-CO2 emissions sources on land - CO2-eq",
25164
+ "waste_other_ch4": "Other (Waste) - CH4",
25165
+ "waste_other_co2": "Other (Waste) - CO2",
25166
+ "waste_other_n2o": "Other (Waste) - N2O",
25167
+ "waste_other_co2eq": "Other (Waste) - CO2-eq",
25168
+ "waste_solidWasteDisposal_ch4": "Solid Waste Disposal - CH4",
25169
+ "waste_solidWasteDisposal_co2": "Solid Waste Disposal - CO2",
25170
+ "waste_solidWasteDisposal_n2o": "Solid Waste Disposal - N2O",
25171
+ "waste_solidWasteDisposal_co2eq": "Solid Waste Disposal - CO2-eq",
25172
+ "waste_incinerationOpenBurningWaste_ch4": "Incineration and Open Burning of Waste - CH4",
25173
+ "waste_incinerationOpenBurningWaste_co2": "Incineration and Open Burning of Waste - CO2",
25174
+ "waste_incinerationOpenBurningWaste_n2o": "Incineration and Open Burning of Waste - N2O",
25175
+ "waste_incinerationOpenBurningWaste_co2eq": "Incineration and Open Burning of Waste - CO2-eq",
25176
+ "waste_wastewaterTreatmentDischarge_ch4": "Wastewater Treatment and Discharge - CH4",
25177
+ "waste_wastewaterTreatmentDischarge_co2": "Wastewater Treatment and Discharge - CO2",
25178
+ "waste_wastewaterTreatmentDischarge_n2o": "Wastewater Treatment and Discharge - N2O",
25179
+ "waste_wastewaterTreatmentDischarge_co2eq": "Wastewater Treatment and Discharge - CO2-eq",
25180
+ "waste_biologicalTreatmentSolidWaste_ch4": "Biological Treatment of Solid Waste - CH4",
25181
+ "waste_biologicalTreatmentSolidWaste_co2": "Biological Treatment of Solid Waste - CO2",
25182
+ "waste_biologicalTreatmentSolidWaste_n2o": "Biological Treatment of Solid Waste - N2O",
25183
+ "waste_biologicalTreatmentSolidWaste_co2eq": "Biological Treatment of Solid Waste - CO2-eq",
25184
+ "other_other_ch4": "Other - CH4",
25185
+ "other_other_co2": "Other - CO2",
25186
+ "other_other_n2o": "Other - N2O",
25187
+ "other_other_co2eq": "Other - CO2-eq",
25188
+ "other_indirectN2oEmissions_ch4": "Indirect N2O emissions from the atmospheric deposition of nitrogen in NOx and NH3 - CH4",
25189
+ "other_indirectN2oEmissions_co2": "Indirect N2O emissions from the atmospheric deposition of nitrogen in NOx and NH3 - CO2",
25190
+ "other_indirectN2oEmissions_n2o": "Indirect N2O emissions from the atmospheric deposition of nitrogen in NOx and NH3 - N2O",
25191
+ "other_indirectN2oEmissions_co2eq": "Indirect N2O emissions from the atmospheric deposition of nitrogen in NOx and NH3 - CO2-eq",
25192
+ "totalCo2WithoutLand_ch4": "Total CO2 equivalent emissions without land use, land-use change and forestry - CH4",
25193
+ "totalCo2WithoutLand_co2": "Total CO2 equivalent emissions without land use, land-use change and forestry - CO2",
25194
+ "totalCo2WithoutLand_n2o": "Total CO2 equivalent emissions without land use, land-use change and forestry - N2O",
25195
+ "totalCo2WithoutLand_co2eq": "Total CO2 equivalent emissions without land use, land-use change and forestry - CO2-eq",
25196
+ "totalCo2WithLand_ch4": "Total CO2 equivalent emissions with land use, land-use change and forestry - CH4",
25197
+ "totalCo2WithLand_co2": "Total CO2 equivalent emissions with land use, land-use change and forestry - CO2",
25198
+ "totalCo2WithLand_n2o": "Total CO2 equivalent emissions with land use, land-use change and forestry - N2O",
25199
+ "totalCo2WithLand_co2eq": "Total CO2 equivalent emissions with land use, land-use change and forestry - CO2-eq",
25200
+ // "state": "Status"
25201
+ };
25202
+ var projectionsCsvFieldMap = {
25203
+ "year": "Year",
25204
+ "energyEmissions_fuelCombustionActivities_transport_bau": "Transport - BAU",
25205
+ "energyEmissions_fuelCombustionActivities_transport_conditionalNdc": "Transport - Conditional NDC",
25206
+ "energyEmissions_fuelCombustionActivities_transport_unconditionalNdc": "Transport - Unconditional NDC",
25207
+ "energyEmissions_fuelCombustionActivities_nonSpecified_bau": "Non-Specified - BAU",
25208
+ "energyEmissions_fuelCombustionActivities_nonSpecified_conditionalNdc": "Non-Specified - Conditional NDC",
25209
+ "energyEmissions_fuelCombustionActivities_nonSpecified_unconditionalNdc": "Non-Specified - Unconditional NDC",
25210
+ "energyEmissions_fuelCombustionActivities_otherSectors_bau": "Other Sectors - BAU",
25211
+ "energyEmissions_fuelCombustionActivities_otherSectors_conditionalNdc": "Other Sectors - Conditional NDC",
25212
+ "energyEmissions_fuelCombustionActivities_otherSectors_unconditionalNdc": "Other Sectors - Unconditional NDC",
25213
+ "energyEmissions_fuelCombustionActivities_energyIndustries_bau": "Energy Industries - BAU",
25214
+ "energyEmissions_fuelCombustionActivities_energyIndustries_conditionalNdc": "Energy Industries - Conditional NDC",
25215
+ "energyEmissions_fuelCombustionActivities_energyIndustries_unconditionalNdc": "Energy Industries - Unconditional NDC",
25216
+ "energyEmissions_fuelCombustionActivities_manufacturingIndustriesConstruction_bau": "Manufacturing Industries and Construction - BAU",
25217
+ "energyEmissions_fuelCombustionActivities_manufacturingIndustriesConstruction_conditionalNdc": "Manufacturing Industries and Construction - Conditional NDC",
25218
+ "energyEmissions_fuelCombustionActivities_manufacturingIndustriesConstruction_unconditionalNdc": "Manufacturing Industries and Construction - Unconditional NDC",
25219
+ "energyEmissions_fugitiveEmissionsFromFuels_solidFuels_bau": "Solid Fuels - BAU",
25220
+ "energyEmissions_fugitiveEmissionsFromFuels_solidFuels_conditionalNdc": "Solid Fuels - Conditional NDC",
25221
+ "energyEmissions_fugitiveEmissionsFromFuels_solidFuels_unconditionalNdc": "Solid Fuels - Unconditional NDC",
25222
+ "energyEmissions_fugitiveEmissionsFromFuels_oilNaturalGas_bau": "Oil and Natural Gas - BAU",
25223
+ "energyEmissions_fugitiveEmissionsFromFuels_oilNaturalGas_conditionalNdc": "Oil and Natural Gas - Conditional NDC",
25224
+ "energyEmissions_fugitiveEmissionsFromFuels_oilNaturalGas_unconditionalNdc": "Oil and Natural Gas - Unconditional NDC",
25225
+ "energyEmissions_fugitiveEmissionsFromFuels_otherEmissionsEnergyProduction_bau": "Other emissions from Energy Production - BAU",
25226
+ "energyEmissions_fugitiveEmissionsFromFuels_otherEmissionsEnergyProduction_conditionalNdc": "Other emissions from Energy Production - Conditional NDC",
25227
+ "energyEmissions_fugitiveEmissionsFromFuels_otherEmissionsEnergyProduction_unconditionalNdc": "Other emissions from Energy Production - Unconditional NDC",
25228
+ "energyEmissions_carbonDioxideTransportStorage_other_bau": "Other (Carbon dioxide Transport and Storage) - BAU",
25229
+ "energyEmissions_carbonDioxideTransportStorage_other_conditionalNdc": "Other (Carbon dioxide Transport and Storage) - Conditional NDC",
25230
+ "energyEmissions_carbonDioxideTransportStorage_other_unconditionalNdc": "Other (Carbon dioxide Transport and Storage) - Unconditional NDC",
25231
+ "energyEmissions_carbonDioxideTransportStorage_transportOfCo2_bau": "Transport of CO2 - BAU",
25232
+ "energyEmissions_carbonDioxideTransportStorage_transportOfCo2_conditionalNdc": "Transport of CO2 - Conditional NDC",
25233
+ "energyEmissions_carbonDioxideTransportStorage_transportOfCo2_unconditionalNdc": "Transport of CO2 - Unconditional NDC",
25234
+ "energyEmissions_carbonDioxideTransportStorage_injectionStorage_bau": "Injection and Storage - BAU",
25235
+ "energyEmissions_carbonDioxideTransportStorage_injectionStorage_conditionalNdc": "Injection and Storage - Conditional NDC",
25236
+ "energyEmissions_carbonDioxideTransportStorage_injectionStorage_unconditionalNdc": "Injection and Storage - Unconditional NDC",
25237
+ "industrialProcessesProductUse_other_bau": "Other (Industrial Processes & Product Use) - BAU",
25238
+ "industrialProcessesProductUse_other_conditionalNdc": "Other (Industrial Processes & Product Use) - Conditional NDC",
25239
+ "industrialProcessesProductUse_other_unconditionalNdc": "Other (Industrial Processes & Product Use) - Unconditional NDC",
25240
+ "industrialProcessesProductUse_metalIndustry_bau": "Metal Industry - BAU",
25241
+ "industrialProcessesProductUse_metalIndustry_conditionalNdc": "Metal Industry - Conditional NDC",
25242
+ "industrialProcessesProductUse_metalIndustry_unconditionalNdc": "Metal Industry - Unconditional NDC",
25243
+ "industrialProcessesProductUse_mineralIndustry_bau": "Mineral Industry - BAU",
25244
+ "industrialProcessesProductUse_mineralIndustry_conditionalNdc": "Mineral Industry - Conditional NDC",
25245
+ "industrialProcessesProductUse_mineralIndustry_unconditionalNdc": "Mineral Industry - Unconditional NDC",
25246
+ "industrialProcessesProductUse_chemicalIndustry_bau": "Chemical Industry - BAU",
25247
+ "industrialProcessesProductUse_chemicalIndustry_conditionalNdc": "Chemical Industry - Conditional NDC",
25248
+ "industrialProcessesProductUse_chemicalIndustry_unconditionalNdc": "Chemical Industry - Unconditional NDC",
25249
+ "industrialProcessesProductUse_electronicsIndustry_bau": "Electronics Industry - BAU",
25250
+ "industrialProcessesProductUse_electronicsIndustry_conditionalNdc": "Electronics Industry - Conditional NDC",
25251
+ "industrialProcessesProductUse_electronicsIndustry_unconditionalNdc": "Electronics Industry - Unconditional NDC",
25252
+ "industrialProcessesProductUse_otherProductManufactureUse_bau": "Other Product Manufacture and Use - BAU",
25253
+ "industrialProcessesProductUse_otherProductManufactureUse_conditionalNdc": "Other Product Manufacture and Use - Conditional NDC",
25254
+ "industrialProcessesProductUse_otherProductManufactureUse_unconditionalNdc": "Other Product Manufacture and Use - Unconditional NDC",
25255
+ "industrialProcessesProductUse_nonEnergyProductsFuelsSolventUse_bau": "Non-Energy Products from Fuels and Solvent Use - BAU",
25256
+ "industrialProcessesProductUse_nonEnergyProductsFuelsSolventUse_conditionalNdc": "Non-Energy Products from Fuels and Solvent Use - Conditional NDC",
25257
+ "industrialProcessesProductUse_nonEnergyProductsFuelsSolventUse_unconditionalNdc": "Non-Energy Products from Fuels and Solvent Use - Unconditional NDC",
25258
+ "industrialProcessesProductUse_productUsesSubstOzoneDepletingSubs_bau": "Product Uses as Substitutes for Ozone Depleting Substances - BAU",
25259
+ "industrialProcessesProductUse_productUsesSubstOzoneDepletingSubs_conditionalNdc": "Product Uses as Substitutes for Ozone Depleting Substances - Conditional NDC",
25260
+ "industrialProcessesProductUse_productUsesSubstOzoneDepletingSubs_unconditionalNdc": "Product Uses as Substitutes for Ozone Depleting Substances - Unconditional NDC",
25261
+ "agricultureForestryOtherLandUse_land_bau": "Land - BAU",
25262
+ "agricultureForestryOtherLandUse_land_conditionalNdc": "Land - Conditional NDC",
25263
+ "agricultureForestryOtherLandUse_land_unconditionalNdc": "Land - Unconditional NDC",
25264
+ "agricultureForestryOtherLandUse_other_bau": "Other (Agriculture, Forestry, and Other Land Use) - BAU",
25265
+ "agricultureForestryOtherLandUse_other_conditionalNdc": "Other (Agriculture, Forestry, and Other Land Use) - Conditional NDC",
25266
+ "agricultureForestryOtherLandUse_other_unconditionalNdc": "Other (Agriculture, Forestry, and Other Land Use) - Unconditional NDC",
25267
+ "agricultureForestryOtherLandUse_livestock_bau": "Livestock - BAU",
25268
+ "agricultureForestryOtherLandUse_livestock_conditionalNdc": "Livestock - Conditional NDC",
25269
+ "agricultureForestryOtherLandUse_livestock_unconditionalNdc": "Livestock - Unconditional NDC",
25270
+ "agricultureForestryOtherLandUse_aggregateNonCo2SourcesLand_bau": "Aggregate sources and non-CO2 emissions sources on land - BAU",
25271
+ "agricultureForestryOtherLandUse_aggregateNonCo2SourcesLand_conditionalNdc": "Aggregate sources and non-CO2 emissions sources on land - Conditional NDC",
25272
+ "agricultureForestryOtherLandUse_aggregateNonCo2SourcesLand_unconditionalNdc": "Aggregate sources and non-CO2 emissions sources on land - Unconditional NDC",
25273
+ "waste_other_bau": "Other (Waste) - BAU",
25274
+ "waste_other_conditionalNdc": "Other (Waste) - Conditional NDC",
25275
+ "waste_other_unconditionalNdc": "Other (Waste) - Unconditional NDC",
25276
+ "waste_solidWasteDisposal_bau": "Solid Waste Disposal - BAU",
25277
+ "waste_solidWasteDisposal_conditionalNdc": "Solid Waste Disposal - Conditional NDC",
25278
+ "waste_solidWasteDisposal_unconditionalNdc": "Solid Waste Disposal - Unconditional NDC",
25279
+ "waste_incinerationOpenBurningWaste_bau": "Incineration and Open Burning of Waste - BAU",
25280
+ "waste_incinerationOpenBurningWaste_conditionalNdc": "Incineration and Open Burning of Waste - Conditional NDC",
25281
+ "waste_incinerationOpenBurningWaste_unconditionalNdc": "Incineration and Open Burning of Waste - Unconditional NDC",
25282
+ "waste_wastewaterTreatmentDischarge_bau": "Wastewater Treatment and Discharge - BAU",
25283
+ "waste_wastewaterTreatmentDischarge_conditionalNdc": "Wastewater Treatment and Discharge - Conditional NDC",
25284
+ "waste_wastewaterTreatmentDischarge_unconditionalNdc": "Wastewater Treatment and Discharge - Unconditional NDC",
25285
+ "waste_biologicalTreatmentSolidWaste_bau": "Biological Treatment of Solid Waste - BAU",
25286
+ "waste_biologicalTreatmentSolidWaste_conditionalNdc": "Biological Treatment of Solid Waste - Conditional NDC",
25287
+ "waste_biologicalTreatmentSolidWaste_unconditionalNdc": "Biological Treatment of Solid Waste - Unconditional NDC",
25288
+ "other_other_bau": "Other - BAU",
25289
+ "other_other_conditionalNdc": "Other - Conditional NDC",
25290
+ "other_other_unconditionalNdc": "Other - Unconditional NDC",
25291
+ "other_indirectN2oEmissions_bau": "Indirect N2O emissions from the atmospheric deposition of nitrogen in NOx and NH3 - BAU",
25292
+ "other_indirectN2oEmissions_conditionalNdc": "Indirect N2O emissions from the atmospheric deposition of nitrogen in NOx and NH3 - Conditional NDC",
25293
+ "other_indirectN2oEmissions_unconditionalNdc": "Indirect N2O emissions from the atmospheric deposition of nitrogen in NOx and NH3 - Unconditional NDC",
25294
+ "totalCo2WithoutLand_bau": "Total CO2 equivalent emissions without land use, land-use change and forestry - BAU",
25295
+ "totalCo2WithoutLand_conditionalNdc": "Total CO2 equivalent emissions without land use, land-use change and forestry - Conditional NDC",
25296
+ "totalCo2WithoutLand_unconditionalNdc": "Total CO2 equivalent emissions without land use, land-use change and forestry - Unconditional NDC",
25297
+ "totalCo2WithLand_bau": "Total CO2 equivalent emissions with land use, land-use change and forestry - BAU",
25298
+ "totalCo2WithLand_conditionalNdc": "Total CO2 equivalent emissions with land use, land-use change and forestry - Conditional NDC",
25299
+ "totalCo2WithLand_unconditionalNdc": "Total CO2 equivalent emissions with land use, land-use change and forestry - Unconditional NDC",
25300
+ // "state": "Status"
25301
+ };
25070
25302
 
25071
25303
  Input.TextArea;
25072
25304
  var DiscardChangesConfirmationModel = function (props) {
@@ -25089,7 +25321,37 @@ var DiscardChangesConfirmationModel = function (props) {
25089
25321
  React.createElement(Button, { className: "mg-left-2", type: "primary", htmlType: "submit", loading: loading }, actionInfo.action)))));
25090
25322
  };
25091
25323
 
25092
- // import React from 'react';
25324
+ var GHGRecordState;
25325
+ (function (GHGRecordState) {
25326
+ GHGRecordState["SAVED"] = "SAVED";
25327
+ GHGRecordState["FINALIZED"] = "FINALIZED";
25328
+ })(GHGRecordState || (GHGRecordState = {}));
25329
+
25330
+ var TextArea = Input.TextArea;
25331
+ var GHGUserActionConfirmationModel = function (props) {
25332
+ var t = props.t, actionInfo = props.actionInfo, onActionConfirmed = props.onActionConfirmed, onActionCanceled = props.onActionCanceled, openModal = props.openModal, errorMsg = props.errorMsg, loading = props.loading;
25333
+ var _a = useState(""), comment = _a[0], setComment = _a[1];
25334
+ useEffect(function () {
25335
+ setComment("");
25336
+ }, [openModal]);
25337
+ return (React.createElement(Modal, { title: React.createElement("div", { className: "popup-header" },
25338
+ React.createElement("div", { className: "icon" }, actionInfo.icon),
25339
+ 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 },
25340
+ React.createElement("p", { style: { whiteSpace: "pre-line" } }, actionInfo.text),
25341
+ React.createElement(Form, { layout: "vertical", onFinish: function () {
25342
+ var status = actionInfo.action === "submit" ? GHGRecordState.SAVED : GHGRecordState.FINALIZED;
25343
+ onActionConfirmed(comment, status);
25344
+ } },
25345
+ React.createElement(Form.Item, { className: "mg-bottom-0", label: t("userProfile:remarks"), name: "remarks", required: actionInfo.type === "danger" },
25346
+ React.createElement(TextArea, { defaultValue: comment, rows: 2, onChange: function (v) { return setComment(v.target.value); } })),
25347
+ errorMsg ? (React.createElement(Alert, { className: "mg-top-1", message: errorMsg, type: "error", showIcon: true })) : (""),
25348
+ React.createElement("div", { className: "mg-top-1 ant-modal-footer padding-bottom-0" },
25349
+ React.createElement(Button, { htmlType: "button", onClick: function () {
25350
+ onActionCanceled();
25351
+ } }, t("userProfile:cancel")),
25352
+ React.createElement(Button, { className: "mg-left-2", type: "primary", htmlType: "submit", loading: loading, disabled: actionInfo.type === "danger" && comment === "" }, actionInfo.action)))));
25353
+ };
25354
+
25093
25355
  var GHGEmissionsComponent = function (props) {
25094
25356
  var t = props.t, useUserContext = props.useUserContext, useConnection = props.useConnection;
25095
25357
  var userInfoState = useUserContext().userInfoState;
@@ -25100,7 +25362,7 @@ var GHGEmissionsComponent = function (props) {
25100
25362
  var _e = useState(null); _e[0]; var setSelectedYear = _e[1];
25101
25363
  var _f = useState(''), uploadedFileName = _f[0], setUploadedFileName = _f[1];
25102
25364
  var _g = useState([]), disabledYears = _g[0], setDisabledYears = _g[1];
25103
- var _h = useState(); _h[0]; var setChangedValues = _h[1];
25365
+ var _h = useState(); _h[0]; _h[1];
25104
25366
  var _j = useState(0), totalNationalCo2 = _j[0], setTotalNationalCo2 = _j[1];
25105
25367
  var _k = useState(0), totalNationalCh4 = _k[0], setTotalNationalCh4 = _k[1];
25106
25368
  var _l = useState(0), totalNationalN2o = _l[0], setTotalNationalN2o = _l[1];
@@ -25138,9 +25400,13 @@ var GHGEmissionsComponent = function (props) {
25138
25400
  var _18 = useState(0), otherN2o = _18[0], setOtherN2o = _18[1];
25139
25401
  var _19 = useState(0), otherCo2Eq = _19[0], setOtherCo2Eq = _19[1];
25140
25402
  var _20 = useState(false), isSavedFormDataSet = _20[0], setIsSavedFormDataSet = _20[1];
25141
- var _21 = useState(false), openResetFormModal = _21[0], setOpenResetFormModal = _21[1];
25142
- var _22 = useState(''), errorMsg = _22[0], setErrorMsg = _22[1];
25143
- var _23 = useState({}), actionInfo = _23[0], setActionInfo = _23[1];
25403
+ var _21 = useState(1), formDataVersion = _21[0], setFormDataVersion = _21[1];
25404
+ var _22 = useState(false), isFormChanged = _22[0], setIsFormChanged = _22[1];
25405
+ var _23 = useState(false), openSaveFormModal = _23[0], setOpenSaveFormModal = _23[1];
25406
+ var _24 = useState(false), openFinalizeFormModal = _24[0], setOpenFinalizeFormModal = _24[1];
25407
+ var _25 = useState(false), openResetFormModal = _25[0], setOpenResetFormModal = _25[1];
25408
+ var _26 = useState(''), errorMsg = _26[0], setErrorMsg = _26[1];
25409
+ var _27 = useState({}), actionInfo = _27[0], setActionInfo = _27[1];
25144
25410
  var Panel = Collapse.Panel;
25145
25411
  var form = Form.useForm()[0];
25146
25412
  var createSetFieldObject = function (obj, objName) {
@@ -25237,20 +25503,8 @@ var GHGEmissionsComponent = function (props) {
25237
25503
  setFormValues(upData);
25238
25504
  };
25239
25505
  useEffect(function () {
25240
- console.log('++++++++++++++data', data);
25241
25506
  var hasSaveState = data.some(function (item) { return item.state === 'SAVED'; });
25242
- console.log('++++++++++++++hasSaveState', hasSaveState);
25243
- // const years = data.map((item: any) => !(item.state === 'SAVED') && item.year);
25244
- // console.log('++++++++++++++data, years', data, years);
25245
- console.log(uploadedFileName);
25246
25507
  setIsPendingFinalization(hasSaveState);
25247
- // Update 'disabledYears' only if 'years' array has changed
25248
- // setDisabledYears((prevYears) => {
25249
- // if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
25250
- // return years;
25251
- // }
25252
- // return prevYears;
25253
- // });
25254
25508
  }, [data, uploadedFileName]);
25255
25509
  var handleYearChange = function (date, dateString) {
25256
25510
  setSelectedYear(dateString);
@@ -25269,9 +25523,16 @@ var GHGEmissionsComponent = function (props) {
25269
25523
  }
25270
25524
  return sum;
25271
25525
  }
25272
- var onValuesChange = function (changedValues2, allValues) {
25526
+ var onValuesChange = function (changedValues, allValues) {
25273
25527
  // Track the changed values
25274
- setChangedValues(function (prevChangedValues) { return (__assign(__assign({}, prevChangedValues), changedValues2)); });
25528
+ var initialValues = null;
25529
+ if (isPendingFinalization) {
25530
+ var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
25531
+ initialValues = savedData[0];
25532
+ }
25533
+ var currentValues = form.getFieldsValue(true);
25534
+ var isChanged = !(JSON.stringify(currentValues) === JSON.stringify(initialValues));
25535
+ setIsFormChanged(isChanged);
25275
25536
  };
25276
25537
  var getBase64 = function (file) {
25277
25538
  return new Promise(function (resolve, reject) {
@@ -25281,7 +25542,7 @@ var GHGEmissionsComponent = function (props) {
25281
25542
  reader.onerror = function (error) { return reject(error); };
25282
25543
  });
25283
25544
  };
25284
- var createSaveRequestPayload = function (fields) { return __awaiter(void 0, void 0, void 0, function () {
25545
+ var createSaveRequestPayload = function (fields, remarks, status) { return __awaiter(void 0, void 0, void 0, function () {
25285
25546
  var requestBody, savedEmission, emissionImportBase64;
25286
25547
  var _a;
25287
25548
  return __generator(this, function (_b) {
@@ -25498,7 +25759,9 @@ var GHGEmissionsComponent = function (props) {
25498
25759
  n2o: fields === null || fields === void 0 ? void 0 : fields.totalCo2WithLand_n2o,
25499
25760
  co2eq: fields === null || fields === void 0 ? void 0 : fields.totalCo2WithLand_co2eq,
25500
25761
  },
25501
- state: 'SAVED',
25762
+ state: status,
25763
+ remarks: remarks,
25764
+ version: formDataVersion,
25502
25765
  };
25503
25766
  requestBody = savedEmission;
25504
25767
  if (!(fields === null || fields === void 0 ? void 0 : fields.emissionsDocument)) return [3 /*break*/, 2];
@@ -25513,6 +25776,37 @@ var GHGEmissionsComponent = function (props) {
25513
25776
  }
25514
25777
  });
25515
25778
  }); };
25779
+ var clearForm = function () {
25780
+ form.resetFields();
25781
+ setFuelCombustionActivitiesCo2(0);
25782
+ setFuelCombustionActivitiesCh4(0);
25783
+ setFuelCombustionActivitiesN2o(0);
25784
+ setFuelCombustionActivitiesCo2Eq(0);
25785
+ setFugitiveEmissionsFromFuelsCo2(0);
25786
+ setFugitiveEmissionsFromFuelsCh4(0);
25787
+ setFugitiveEmissionsFromFuelsN2o(0);
25788
+ setFugitiveEmissionsFromFuelsCo2Eq(0);
25789
+ setCarbonDioxideTransportStorageCo2(0);
25790
+ setCarbonDioxideTransportStorageCh4(0);
25791
+ setCarbonDioxideTransportStorageN2o(0);
25792
+ setCarbonDioxideTransportStorageCo2Eq(0);
25793
+ setIndustrialProcessesProductUseCo2(0);
25794
+ setIndustrialProcessesProductUseCh4(0);
25795
+ setIndustrialProcessesProductUseN2o(0);
25796
+ setIndustrialProcessesProductUseCo2Eq(0);
25797
+ setAgricultureForestryOtherLandUseCo2(0);
25798
+ setAgricultureForestryOtherLandUseCh4(0);
25799
+ setAgricultureForestryOtherLandUseN2o(0);
25800
+ setAgricultureForestryOtherLandUseCo2Eq(0);
25801
+ setWasteCo2(0);
25802
+ setWasteCh4(0);
25803
+ setWasteN2o(0);
25804
+ setWasteCo2Eq(0);
25805
+ setOtherCo2(0);
25806
+ setOtherCh4(0);
25807
+ setOtherN2o(0);
25808
+ setOtherCo2Eq(0);
25809
+ };
25516
25810
  var resetForm = function () { return __awaiter(void 0, void 0, void 0, function () {
25517
25811
  return __generator(this, function (_a) {
25518
25812
  switch (_a.label) {
@@ -25526,36 +25820,14 @@ var GHGEmissionsComponent = function (props) {
25526
25820
  setIsSavedFormDataSet(false);
25527
25821
  clearUploadDoc();
25528
25822
  if (!isPendingFinalization) {
25529
- form.resetFields();
25530
- setFuelCombustionActivitiesCo2(0);
25531
- setFuelCombustionActivitiesCh4(0);
25532
- setFuelCombustionActivitiesN2o(0);
25533
- setFuelCombustionActivitiesCo2Eq(0);
25534
- setFugitiveEmissionsFromFuelsCo2(0);
25535
- setFugitiveEmissionsFromFuelsCh4(0);
25536
- setFugitiveEmissionsFromFuelsN2o(0);
25537
- setFugitiveEmissionsFromFuelsCo2Eq(0);
25538
- setCarbonDioxideTransportStorageCo2(0);
25539
- setCarbonDioxideTransportStorageCh4(0);
25540
- setCarbonDioxideTransportStorageN2o(0);
25541
- setCarbonDioxideTransportStorageCo2Eq(0);
25542
- setIndustrialProcessesProductUseCo2(0);
25543
- setIndustrialProcessesProductUseCh4(0);
25544
- setIndustrialProcessesProductUseN2o(0);
25545
- setIndustrialProcessesProductUseCo2Eq(0);
25546
- setAgricultureForestryOtherLandUseCo2(0);
25547
- setAgricultureForestryOtherLandUseCh4(0);
25548
- setAgricultureForestryOtherLandUseN2o(0);
25549
- setAgricultureForestryOtherLandUseCo2Eq(0);
25550
- setWasteCo2(0);
25551
- setWasteCh4(0);
25552
- setWasteN2o(0);
25553
- setWasteCo2Eq(0);
25554
- setOtherCo2(0);
25555
- setOtherCh4(0);
25556
- setOtherN2o(0);
25557
- setOtherCo2Eq(0);
25823
+ clearForm();
25558
25824
  }
25825
+ message.open({
25826
+ type: 'success',
25827
+ content: t('ghgInventory:formCancelledSuccess'),
25828
+ duration: 4,
25829
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25830
+ });
25559
25831
  return [2 /*return*/];
25560
25832
  }
25561
25833
  });
@@ -25563,7 +25835,7 @@ var GHGEmissionsComponent = function (props) {
25563
25835
  var onResetFormCanceled = function () {
25564
25836
  setOpenResetFormModal(false);
25565
25837
  };
25566
- var onResetFormModel = function () {
25838
+ var onOpenResetFormModel = function () {
25567
25839
  setActionInfo({
25568
25840
  action: "".concat(t('ghgInventory:proceed')),
25569
25841
  headerText: "".concat(t('ghgInventory:discardHeaderText')),
@@ -25573,55 +25845,106 @@ var GHGEmissionsComponent = function (props) {
25573
25845
  setErrorMsg('');
25574
25846
  setOpenResetFormModal(true);
25575
25847
  };
25576
- var onSubmitForm = function (values) { return __awaiter(void 0, void 0, void 0, function () {
25577
- var fields, payload, response, error_1;
25848
+ var onSaveFormCanceled = function () {
25849
+ setOpenSaveFormModal(false);
25850
+ };
25851
+ var onOpenSaveFormModel = function () {
25852
+ if (!isFormChanged) {
25853
+ message.open({
25854
+ type: 'error',
25855
+ content: t('ghgInventory:formNotChanged'),
25856
+ duration: 4,
25857
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25858
+ });
25859
+ }
25860
+ else {
25861
+ setActionInfo({
25862
+ action: "".concat(t("ghgInventory:submit")),
25863
+ headerText: "".concat(t("ghgInventory:submitModelHeader")),
25864
+ type: "primary",
25865
+ icon: React.createElement(CheckCircleOutlined, null),
25866
+ });
25867
+ setErrorMsg('');
25868
+ setOpenSaveFormModal(true);
25869
+ }
25870
+ };
25871
+ var onFinalizeFormCanceled = function () {
25872
+ setOpenFinalizeFormModal(false);
25873
+ };
25874
+ var onOpenFinalizeFormModel = function () {
25875
+ setActionInfo({
25876
+ action: "".concat(t("ghgInventory:finalize")),
25877
+ headerText: "".concat(t("ghgInventory:finalizeModelHeader")),
25878
+ type: "primary",
25879
+ icon: React.createElement(ClipboardCheck, null),
25880
+ });
25881
+ setErrorMsg('');
25882
+ setOpenFinalizeFormModal(true);
25883
+ };
25884
+ var onSubmitForm = function (remarks, status) { return __awaiter(void 0, void 0, void 0, function () {
25885
+ var fields, payload, response, messageContent, error_1;
25578
25886
  return __generator(this, function (_a) {
25579
25887
  switch (_a.label) {
25580
25888
  case 0:
25581
25889
  fields = form.getFieldsValue(true);
25582
- return [4 /*yield*/, createSaveRequestPayload(fields)];
25890
+ return [4 /*yield*/, createSaveRequestPayload(fields, remarks, status)];
25583
25891
  case 1:
25584
25892
  payload = _a.sent();
25585
25893
  setLoading(true);
25586
25894
  _a.label = 2;
25587
25895
  case 2:
25588
- _a.trys.push([2, 4, 5, 7]);
25896
+ _a.trys.push([2, 6, 9, 10]);
25589
25897
  return [4 /*yield*/, post('national/emissions', payload)];
25590
25898
  case 3:
25591
25899
  response = _a.sent();
25592
25900
  console.log('Emission creation -> ', response);
25593
- if ((response === null || response === void 0 ? void 0 : response.statusText) === 'SUCCESS') {
25594
- message.open({
25595
- type: 'success',
25596
- content:
25597
- // eslint-disable-next-line eqeqeq
25598
- (response === null || response === void 0 ? void 0 : response.status) == HttpStatusCode.Created
25599
- ? t('ghgInventory:emissionCreationSuccess')
25600
- : t('ghgInventory:emissionUpdateSuccess'),
25601
- duration: 4,
25602
- style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25603
- });
25901
+ if (!((response === null || response === void 0 ? void 0 : response.statusText) === 'SUCCESS')) return [3 /*break*/, 5];
25902
+ setOpenSaveFormModal(false);
25903
+ messageContent = (response === null || response === void 0 ? void 0 : response.status) == HttpStatusCode.Created ?
25904
+ t('ghgInventory:emissionCreationSuccess')
25905
+ : t('ghgInventory:emissionUpdateSuccess');
25906
+ if (status === GHGRecordState.FINALIZED) {
25907
+ clearUploadDoc();
25908
+ clearForm();
25909
+ messageContent = t('ghgInventory:emissionFinalizedSuccess');
25604
25910
  }
25605
- return [3 /*break*/, 7];
25911
+ setOpenFinalizeFormModal(false);
25912
+ message.open({
25913
+ type: 'success',
25914
+ content: messageContent,
25915
+ duration: 4,
25916
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25917
+ });
25918
+ clearUploadDoc();
25919
+ return [4 /*yield*/, getEmissionData()];
25606
25920
  case 4:
25921
+ _a.sent();
25922
+ _a.label = 5;
25923
+ case 5: return [3 /*break*/, 10];
25924
+ case 6:
25607
25925
  error_1 = _a.sent();
25608
25926
  console.log('Error in emission creation - ', error_1);
25927
+ setOpenSaveFormModal(false);
25928
+ setOpenFinalizeFormModal(false);
25609
25929
  message.open({
25610
25930
  type: 'error',
25611
25931
  content: error_1 === null || error_1 === void 0 ? void 0 : error_1.message,
25612
25932
  duration: 4,
25613
25933
  style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25614
25934
  });
25615
- return [3 /*break*/, 7];
25616
- case 5:
25617
- // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
25618
- return [4 /*yield*/, getEmissionData()];
25619
- case 6:
25620
- // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
25935
+ if (!(error_1.statusCode == HttpStatusCode.Conflict)) return [3 /*break*/, 8];
25936
+ return [4 /*yield*/, getEmissionData()];
25937
+ case 7:
25621
25938
  _a.sent();
25939
+ clearUploadDoc();
25940
+ _a.label = 8;
25941
+ case 8: return [3 /*break*/, 10];
25942
+ case 9:
25943
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
25944
+ setIsFormChanged(false);
25622
25945
  setLoading(false);
25623
25946
  return [7 /*endfinally*/];
25624
- case 7: return [2 /*return*/];
25947
+ case 10: return [2 /*return*/];
25625
25948
  }
25626
25949
  });
25627
25950
  }); };
@@ -25653,6 +25976,7 @@ var GHGEmissionsComponent = function (props) {
25653
25976
  });
25654
25977
  return [3 /*break*/, 5];
25655
25978
  case 4:
25979
+ setIsFormChanged(false);
25656
25980
  setLoading(false);
25657
25981
  return [7 /*endfinally*/];
25658
25982
  case 5: return [2 /*return*/];
@@ -25724,13 +26048,16 @@ var GHGEmissionsComponent = function (props) {
25724
26048
  setIsSavedFormDataSet(true);
25725
26049
  };
25726
26050
  useEffect(function () {
25727
- // if (isPendingFinalization) {
26051
+ var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
25728
26052
  if (!isSavedFormDataSet) {
25729
- var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
25730
26053
  if (savedData && savedData.length > 0) {
25731
26054
  setFormValues(savedData[0]);
25732
26055
  }
25733
26056
  }
26057
+ if (savedData && savedData.length > 0) {
26058
+ setFormDataVersion(savedData[0].version);
26059
+ }
26060
+ console.log("data changed - version updated2? = ", formDataVersion);
25734
26061
  var years = data
25735
26062
  .filter(function (item) { return !(item.state === 'SAVED' && item.year); }) // Filter out items where state is not 'SAVED'
25736
26063
  .map(function (item) { return parseInt(item.year); });
@@ -26213,6 +26540,67 @@ var GHGEmissionsComponent = function (props) {
26213
26540
  React.createElement(Col, { xl: 6 },
26214
26541
  React.createElement(InputNumber, { value: co2eq, disabled: true }))))));
26215
26542
  };
26543
+ var objectToCSV = function (dataToDownload) {
26544
+ var flattenObject = function (obj, prefix) {
26545
+ if (prefix === void 0) { prefix = ''; }
26546
+ return Object.keys(obj).reduce(function (acc, key) {
26547
+ var pre = prefix.length ? "".concat(prefix, "_") : '';
26548
+ if (typeof obj[key] === 'object' && obj[key] !== null) {
26549
+ Object.assign(acc, flattenObject(obj[key], pre + key));
26550
+ }
26551
+ else {
26552
+ acc[pre + key] = obj[key];
26553
+ }
26554
+ return acc;
26555
+ }, {});
26556
+ };
26557
+ var headers = [];
26558
+ var contentKeys = [];
26559
+ var flattenedObj = flattenObject(dataToDownload);
26560
+ var objKeys = Object.keys(flattenedObj);
26561
+ objKeys.map(function (key) {
26562
+ if (emissionCsvFieldMap[key]) {
26563
+ headers.push(emissionCsvFieldMap[key]);
26564
+ contentKeys.push(key);
26565
+ }
26566
+ });
26567
+ var flattenedData = [dataToDownload].map(function (item) {
26568
+ var flattened = flattenObject(item);
26569
+ return contentKeys.map(function (header) { return flattened[header]; });
26570
+ });
26571
+ var csvContent = headers.map(function (header) { return "\"".concat(header, "\""); }).join(',') +
26572
+ '\n' +
26573
+ flattenedData.map(function (row) { return row.map(function (value) { return (value === undefined || value === null) ? "" : value; }).join(','); }).join('\n');
26574
+ return csvContent;
26575
+ };
26576
+ var downloadCSV = function (dataToDownload) {
26577
+ var csvContent = objectToCSV(dataToDownload);
26578
+ var encodedUri = encodeURI("data:text/csv;charset=utf-8,".concat(csvContent));
26579
+ var link = document.createElement('a');
26580
+ link.setAttribute('href', encodedUri);
26581
+ link.setAttribute('download', "GHG-Reporting Emission_".concat(dataToDownload.year, "_V").concat(dataToDownload.version, ".csv"));
26582
+ document.body.appendChild(link);
26583
+ link.click();
26584
+ };
26585
+ var isRowDataEmpty = function (emissionDataObj) {
26586
+ if (emissionDataObj == undefined || emissionDataObj == null) {
26587
+ return true;
26588
+ }
26589
+ var co2 = emissionDataObj === null || emissionDataObj === void 0 ? void 0 : emissionDataObj.co2;
26590
+ var ch4 = emissionDataObj === null || emissionDataObj === void 0 ? void 0 : emissionDataObj.ch4;
26591
+ var n2o = emissionDataObj === null || emissionDataObj === void 0 ? void 0 : emissionDataObj.n2o;
26592
+ var co2eq = emissionDataObj === null || emissionDataObj === void 0 ? void 0 : emissionDataObj.co2eq;
26593
+ if (!co2 && !ch4 && !n2o && !co2eq) {
26594
+ return true;
26595
+ }
26596
+ return false;
26597
+ };
26598
+ var isSectionDataEmpty = function (sectionTotalCo2, sectionTotalCh4, sectionTotalN2o, sectionTotalCo2eq) {
26599
+ if (!sectionTotalCo2 && !sectionTotalCh4 && !sectionTotalN2o && !sectionTotalCo2eq) {
26600
+ return true;
26601
+ }
26602
+ return false;
26603
+ };
26216
26604
  return (React.createElement("div", null,
26217
26605
  React.createElement("div", { className: "content-container emission-tab-container" },
26218
26606
  React.createElement("div", { className: "emission-title-bar" },
@@ -26224,7 +26612,7 @@ var GHGEmissionsComponent = function (props) {
26224
26612
  ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT ||
26225
26613
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY) && (React.createElement(Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
26226
26614
  React.createElement("div", null,
26227
- 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 },
26615
+ 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 },
26228
26616
  React.createElement(Row, null,
26229
26617
  React.createElement(Col, { xl: 12, md: 12, className: "add-new-year-picker-col" },
26230
26618
  React.createElement("div", null,
@@ -26388,10 +26776,13 @@ var GHGEmissionsComponent = function (props) {
26388
26776
  React.createElement(Form.Item, { name: "totalCo2WithLand_co2eq" },
26389
26777
  React.createElement(InputNumber, null)))))),
26390
26778
  React.createElement("div", { className: "steps-actions" },
26391
- React.createElement(Button, { type: "primary", htmlType: "submit", loading: loading }, "Submit"),
26392
- React.createElement(Button, { className: "back-btn", onClick: onResetFormModel, loading: loading }, "Cancel")))))),
26779
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
26780
+ (React.createElement(Button, { className: "finalize-btn", type: "primary", loading: loading, onClick: onOpenFinalizeFormModel }, "Finalize")),
26781
+ React.createElement(Button, { className: "submit-btn", type: "primary", htmlType: "submit", loading: loading }, "Submit"),
26782
+ React.createElement(Button, { className: "back-btn", onClick: onOpenResetFormModel, loading: loading }, "Cancel")))))),
26393
26783
  data.map(function (tabData) {
26394
- return tabData.state === 'FINALIZED' && (React.createElement(Tabs.TabPane, { key: tabData.id.toString(), tab: React.createElement("span", null,
26784
+ var _a, _b, _c, _d, _e, _f, _g, _h;
26785
+ return tabData.state === 'FINALIZED' && (React.createElement(Tabs.TabPane, { className: 'view-data-panel', key: tabData.id.toString(), tab: React.createElement("span", null,
26395
26786
  tabData.year,
26396
26787
  tabData.state === 'FINALIZED' && React.createElement(LockFilled, { style: { marginLeft: 5 } })) },
26397
26788
  React.createElement("div", null,
@@ -26399,47 +26790,14 @@ var GHGEmissionsComponent = function (props) {
26399
26790
  React.createElement(Col, { xl: 12, md: 12, className: "add-new-year-picker-col" },
26400
26791
  React.createElement("div", null,
26401
26792
  React.createElement(Row, { className: "add-new-upload-file-label" }, "Year"),
26402
- React.createElement(DatePicker
26403
- // onChange={handleYearChange}
26404
- , {
26405
- // onChange={handleYearChange}
26406
- picker: "year", disabledDate: isYearDisabled, defaultValue: moment(tabData.year, 'YYYY'), disabled: true, size: "large" }))),
26793
+ React.createElement(DatePicker, { picker: "year", disabledDate: isYearDisabled, defaultValue: moment(tabData.year, 'YYYY'), disabled: true, size: "large" }))),
26407
26794
  React.createElement(Col, { xl: 12, md: 12, className: "add-new-upload-file-col" },
26408
26795
  React.createElement(Row, { className: "add-new-upload-file-label" }, t("ghgInventory:emissionRemovalDocument")),
26409
26796
  React.createElement(Row, null,
26410
- React.createElement(Col, { xl: 5, md: 5, className: "add-new-upload-file-inner-col" },
26411
- React.createElement(Form.Item, null,
26412
- React.createElement(Upload, { accept: ".xlsx", customRequest: function (_a) {
26413
- _a.onSuccess; _a.onError; _a.file;
26414
- var reader = new FileReader();
26415
- reader.onload = function (e) {
26416
- if (e && e.target) {
26417
- // Check if e and e.target are defined
26418
- var xldata = e.target.result;
26419
- if (xldata) {
26420
- try {
26421
- var workbook = XLSX.read(xldata, { type: 'array' });
26422
- var sheetName = workbook.SheetNames[0];
26423
- var sheet = workbook.Sheets[sheetName];
26424
- var excelData = XLSX.utils.sheet_to_json(sheet);
26425
- // Use excelData as needed, e.g., display it in a table.
26426
- console.log(excelData);
26427
- // You can perform any further processing with the data here.
26428
- // For example, you can call a function to handle the uploaded data.
26429
- // handleFileUpload(excelData);
26430
- // onSuccess('ok', file);
26431
- }
26432
- catch (error) {
26433
- // onError(error, 'error', file);
26434
- }
26435
- }
26436
- }
26437
- };
26438
- // reader.readAsArrayBuffer(file);
26439
- } },
26440
- React.createElement(Button, { icon: React.createElement(UploadOutlined, null) }, t("ghgInventory:upload"))))),
26441
- React.createElement(Col, { xl: 16, md: 16, className: "add-new-upload-file-name-input" },
26442
- React.createElement(Input, { value: uploadedFileName, readOnly: true }))))),
26797
+ React.createElement(Col, { xl: 15, md: 15, className: "view-download-file-name-input" },
26798
+ React.createElement(Input, { value: "GHG-Reporting Emission_".concat(tabData.year, "_V").concat(tabData.version, ".csv"), disabled: true })),
26799
+ React.createElement(Col, { xl: 5, md: 5, className: "view-download-file-inner-col" },
26800
+ React.createElement(Button, { icon: React.createElement(DownloadOutlined, null), onClick: function () { downloadCSV(tabData); } }, t("ghgInventory:download")))))),
26443
26801
  React.createElement(Row, { gutter: 16 },
26444
26802
  React.createElement(Col, { span: 9, offset: 12 },
26445
26803
  React.createElement(Row, { gutter: 16, className: "table-heading-row" },
@@ -26475,36 +26833,82 @@ var GHGEmissionsComponent = function (props) {
26475
26833
  return isActive ? React.createElement(MinusCircleOutlined, null) : React.createElement(PlusCircleOutlined, null);
26476
26834
  } }, Object.entries(formFields).map(function (_a) {
26477
26835
  var panelHeading = _a[0], panelContent = _a[1];
26478
- return (React.createElement(Panel, { header: renderPanelHeaderView(panelHeading, tabData), key: panelHeading }, Array.isArray(panelContent)
26479
- ? panelContent.map(function (item, index) {
26480
- for (var key in tabData) {
26481
- if (key === panelHeading) {
26482
- var emissionsObject = tabData[key];
26483
- var emissionsData = emissionsObject[item];
26484
- return renderPanelContentView(emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.co2, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.ch4, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.n2o, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.co2eq, item, index);
26485
- }
26486
- }
26487
- })
26488
- : Object.entries(panelContent).map(function (_a) {
26489
- var subPanelHeading = _a[0], subPanelContent = _a[1];
26490
- return (React.createElement("div", { className: "sub-panel" },
26491
- React.createElement("div", { className: "sub-panel-heading" }, renderPanelHeaderView(subPanelHeading, tabData.energyEmissions)),
26492
- subPanelContent.map(function (item, index) {
26493
- for (var key in tabData.energyEmissions[subPanelHeading]) {
26494
- if (key === item) {
26495
- var emissionsObject = tabData.energyEmissions[subPanelHeading];
26496
- var emissionsData = emissionsObject[item];
26836
+ var emissionsObject = tabData[panelHeading];
26837
+ var sectionTotalCo2 = calculateSumEmissionView(emissionsObject, 'co2');
26838
+ var sectionTotalCh4 = calculateSumEmissionView(emissionsObject, 'ch4');
26839
+ var sectionTotalN2o = calculateSumEmissionView(emissionsObject, 'n2o');
26840
+ var sectionTotalCo2eq = calculateSumEmissionView(emissionsObject, 'co2eq');
26841
+ if (!isSectionDataEmpty(sectionTotalCo2, sectionTotalCh4, sectionTotalN2o, sectionTotalCo2eq)) {
26842
+ return (React.createElement(Panel, { header: renderPanelHeaderView(panelHeading, tabData), key: panelHeading }, Array.isArray(panelContent)
26843
+ ? panelContent.map(function (item, index) {
26844
+ for (var key in tabData) {
26845
+ if (key === panelHeading) {
26846
+ var emissionsObject_1 = tabData[key];
26847
+ var emissionsData = emissionsObject_1[item];
26848
+ if (!isRowDataEmpty(emissionsData)) {
26497
26849
  return renderPanelContentView(emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.co2, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.ch4, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.n2o, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.co2eq, item, index);
26498
26850
  }
26499
26851
  }
26500
- })));
26501
- })));
26502
- })))));
26852
+ }
26853
+ })
26854
+ : Object.entries(panelContent).map(function (_a) {
26855
+ var subPanelHeading = _a[0], subPanelContent = _a[1];
26856
+ var emissionsObject = tabData.energyEmissions[subPanelHeading];
26857
+ var sectionTotalCo2 = calculateSumEmissionView(emissionsObject, 'co2');
26858
+ var sectionTotalCh4 = calculateSumEmissionView(emissionsObject, 'ch4');
26859
+ var sectionTotalN2o = calculateSumEmissionView(emissionsObject, 'n2o');
26860
+ var sectionTotalCo2eq = calculateSumEmissionView(emissionsObject, 'co2eq');
26861
+ if (!isSectionDataEmpty(sectionTotalCo2, sectionTotalCh4, sectionTotalN2o, sectionTotalCo2eq)) {
26862
+ return (React.createElement("div", { className: "sub-panel" },
26863
+ React.createElement("div", { className: "sub-panel-heading" }, renderPanelHeaderView(subPanelHeading, tabData.energyEmissions)),
26864
+ subPanelContent.map(function (item, index) {
26865
+ for (var key in tabData.energyEmissions[subPanelHeading]) {
26866
+ if (key === item) {
26867
+ var emissionsObject_2 = tabData.energyEmissions[subPanelHeading];
26868
+ var emissionsData = emissionsObject_2[item];
26869
+ if (!isRowDataEmpty(emissionsData)) {
26870
+ return renderPanelContentView(emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.co2, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.ch4, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.n2o, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.co2eq, item, index);
26871
+ }
26872
+ }
26873
+ }
26874
+ })));
26875
+ }
26876
+ })));
26877
+ }
26878
+ })),
26879
+ (!isRowDataEmpty(tabData.totalCo2WithoutLand)) && (React.createElement(Row, { gutter: 16, key: 'totalCo2WithoutLand', className: "total-co2-without-land-row" },
26880
+ React.createElement(Col, { xl: 12, md: 12, className: "total-co2-without-land-title" },
26881
+ React.createElement("span", null, t("ghgInventory:totalCo2WithoutLand"))),
26882
+ React.createElement(Col, { xl: 9, md: 9 },
26883
+ React.createElement(Row, { gutter: 16, className: "panel-content-input-box-row" },
26884
+ React.createElement(Col, { xl: 6 },
26885
+ React.createElement(InputNumber, { value: (_a = tabData.totalCo2WithoutLand) === null || _a === void 0 ? void 0 : _a.co2, disabled: true })),
26886
+ React.createElement(Col, { xl: 6 },
26887
+ React.createElement(InputNumber, { value: (_b = tabData.totalCo2WithoutLand) === null || _b === void 0 ? void 0 : _b.ch4, disabled: true })),
26888
+ React.createElement(Col, { xl: 6 },
26889
+ React.createElement(InputNumber, { value: (_c = tabData.totalCo2WithoutLand) === null || _c === void 0 ? void 0 : _c.n2o, disabled: true })),
26890
+ React.createElement(Col, { xl: 6 },
26891
+ React.createElement(InputNumber, { value: (_d = tabData.totalCo2WithoutLand) === null || _d === void 0 ? void 0 : _d.co2eq, disabled: true })))))),
26892
+ (!isRowDataEmpty(tabData.totalCo2WithLand)) && (React.createElement(Row, { gutter: 16, key: 'totalCo2WithLand', className: "total-co2-with-land-row" },
26893
+ React.createElement(Col, { xl: 12, md: 12, className: "total-co2-with-land-title" },
26894
+ React.createElement("span", null, t("ghgInventory:totalCo2WithLand"))),
26895
+ React.createElement(Col, { xl: 9, md: 9 },
26896
+ React.createElement(Row, { gutter: 16, className: "panel-content-input-box-row" },
26897
+ React.createElement(Col, { xl: 6 },
26898
+ React.createElement(InputNumber, { value: (_e = tabData.totalCo2WithLand) === null || _e === void 0 ? void 0 : _e.co2, disabled: true })),
26899
+ React.createElement(Col, { xl: 6 },
26900
+ React.createElement(InputNumber, { value: (_f = tabData.totalCo2WithLand) === null || _f === void 0 ? void 0 : _f.ch4, disabled: true })),
26901
+ React.createElement(Col, { xl: 6 },
26902
+ React.createElement(InputNumber, { value: (_g = tabData.totalCo2WithLand) === null || _g === void 0 ? void 0 : _g.n2o, disabled: true })),
26903
+ React.createElement(Col, { xl: 6 },
26904
+ React.createElement(InputNumber, { value: (_h = tabData.totalCo2WithLand) === null || _h === void 0 ? void 0 : _h.co2eq, disabled: true })))))))));
26503
26905
  })))),
26906
+ React.createElement(GHGUserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onSubmitForm, onActionCanceled: onSaveFormCanceled, openModal: openSaveFormModal, errorMsg: errorMsg, loading: loading }),
26907
+ React.createElement(GHGUserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onSubmitForm, onActionCanceled: onFinalizeFormCanceled, openModal: openFinalizeFormModal, errorMsg: errorMsg, loading: loading }),
26504
26908
  React.createElement(DiscardChangesConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: resetForm, onActionCanceled: onResetFormCanceled, openModal: openResetFormModal, errorMsg: errorMsg, loading: loading })));
26505
26909
  };
26506
26910
 
26507
- 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: 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";
26911
+ 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 .view-download-file-name-input input {\n height: 50px;\n color: #16b1ff; }\n .projection-tab-container .add-projection .view-download-file-inner-col button {\n height: 50px;\n font-size: 12px;\n font-weight: 400;\n width: 135px;\n margin-left: 5px;\n color: #8C8C8C;\n border-radius: 4px; }\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 .view-data-panel .panel-content-input-box-row {\n padding-bottom: 24px; }\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";
26508
26912
  styleInject(css_248z);
26509
26913
 
26510
26914
  var ProjectionTypes = {
@@ -26523,7 +26927,7 @@ var GHGProjectionsComponent = function (props) {
26523
26927
  var _e = useState(null); _e[0]; var setSelectedYear = _e[1];
26524
26928
  var _f = useState(''), uploadedFileName = _f[0], setUploadedFileName = _f[1];
26525
26929
  var _g = useState([]), disabledYears = _g[0], setDisabledYears = _g[1];
26526
- var _h = useState(); _h[0]; var setChangedValues = _h[1];
26930
+ var _h = useState(); _h[0]; _h[1];
26527
26931
  var _j = useState(0), totalNationalBau = _j[0], setTotalNationalBau = _j[1];
26528
26932
  var _k = useState(0), totalNationalConditionalNdc = _k[0], setTotalNationalConditionalNdc = _k[1];
26529
26933
  var _l = useState(0), totalNationalUnconditionalNdc = _l[0], setTotalNationalUnconditionalNdc = _l[1];
@@ -26552,9 +26956,13 @@ var GHGProjectionsComponent = function (props) {
26552
26956
  var _9 = useState(0), otherConditionalNdc = _9[0], setOtherConditionalNdc = _9[1];
26553
26957
  var _10 = useState(0), otherUnconditionalNdc = _10[0], setOtherUnconditionalNdc = _10[1];
26554
26958
  var _11 = useState(false), isSavedFormDataSet = _11[0], setIsSavedFormDataSet = _11[1];
26555
- var _12 = useState(false), openResetFormModal = _12[0], setOpenResetFormModal = _12[1];
26556
- var _13 = useState(''), errorMsg = _13[0], setErrorMsg = _13[1];
26557
- var _14 = useState({}), actionInfo = _14[0], setActionInfo = _14[1];
26959
+ var _12 = useState(1), formDataVersion = _12[0], setFormDataVersion = _12[1];
26960
+ var _13 = useState(false), isFormChanged = _13[0], setIsFormChanged = _13[1];
26961
+ var _14 = useState(false), openSaveFormModal = _14[0], setOpenSaveFormModal = _14[1];
26962
+ var _15 = useState(false), openFinalizeFormModal = _15[0], setOpenFinalizeFormModal = _15[1];
26963
+ var _16 = useState(false), openResetFormModal = _16[0], setOpenResetFormModal = _16[1];
26964
+ var _17 = useState(''), errorMsg = _17[0], setErrorMsg = _17[1];
26965
+ var _18 = useState({}), actionInfo = _18[0], setActionInfo = _18[1];
26558
26966
  var Panel = Collapse.Panel;
26559
26967
  var form = Form.useForm()[0];
26560
26968
  var createSetFieldObject = function (obj, objName) {
@@ -26654,20 +27062,8 @@ var GHGProjectionsComponent = function (props) {
26654
27062
  setFormValues(upData);
26655
27063
  };
26656
27064
  useEffect(function () {
26657
- console.log('++++++++++++++data', data);
26658
27065
  var hasSaveState = data.some(function (item) { return item.state === 'SAVED'; });
26659
- console.log('++++++++++++++hasSaveState', hasSaveState);
26660
- // const years = data.map((item: any) => !(item.state === 'SAVED') && item.year);
26661
- // console.log('++++++++++++++data, years', data, years);
26662
- console.log(uploadedFileName);
26663
27066
  setIsPendingFinalization(hasSaveState);
26664
- // Update 'disabledYears' only if 'years' array has changed
26665
- // setDisabledYears((prevYears) => {
26666
- // if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
26667
- // return years;
26668
- // }
26669
- // return prevYears;
26670
- // });
26671
27067
  }, [data, uploadedFileName]);
26672
27068
  function calculateSumEmissionView(obj, conditionType) {
26673
27069
  var sum = 0;
@@ -26683,10 +27079,15 @@ var GHGProjectionsComponent = function (props) {
26683
27079
  }
26684
27080
  return sum;
26685
27081
  }
26686
- var onValuesChange = function (changedValues2, allValues) {
26687
- // Track the changed values
26688
- console.log('=================onValuesChange changedValues, allValues', changedValues2, allValues);
26689
- setChangedValues(function (prevChangedValues) { return (__assign(__assign({}, prevChangedValues), changedValues2)); });
27082
+ var onValuesChange = function (changedValues, allValues) {
27083
+ var initialValues = null;
27084
+ if (isPendingFinalization) {
27085
+ var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
27086
+ initialValues = savedData[0];
27087
+ }
27088
+ var currentValues = form.getFieldsValue(true);
27089
+ var isChanged = !(JSON.stringify(currentValues) === JSON.stringify(initialValues));
27090
+ setIsFormChanged(isChanged);
26690
27091
  };
26691
27092
  var getBase64 = function (file) {
26692
27093
  return new Promise(function (resolve, reject) {
@@ -26696,7 +27097,7 @@ var GHGProjectionsComponent = function (props) {
26696
27097
  reader.onerror = function (error) { return reject(error); };
26697
27098
  });
26698
27099
  };
26699
- var createSaveRequestPayload = function (fields) { return __awaiter(void 0, void 0, void 0, function () {
27100
+ var createSaveRequestPayload = function (fields, remarks, status) { return __awaiter(void 0, void 0, void 0, function () {
26700
27101
  var requestBody, savedEmission, emissionImportBase64;
26701
27102
  var _a;
26702
27103
  return __generator(this, function (_b) {
@@ -26881,7 +27282,9 @@ var GHGProjectionsComponent = function (props) {
26881
27282
  conditionalNdc: fields === null || fields === void 0 ? void 0 : fields.totalCo2WithLand_conditionalNdc,
26882
27283
  unconditionalNdc: fields === null || fields === void 0 ? void 0 : fields.totalCo2WithLand_unconditionalNdc,
26883
27284
  },
26884
- state: 'SAVED',
27285
+ state: status,
27286
+ remarks: remarks,
27287
+ version: formDataVersion,
26885
27288
  };
26886
27289
  requestBody = savedEmission;
26887
27290
  if (!(fields === null || fields === void 0 ? void 0 : fields.emissionsDocument)) return [3 /*break*/, 2];
@@ -26896,6 +27299,30 @@ var GHGProjectionsComponent = function (props) {
26896
27299
  }
26897
27300
  });
26898
27301
  }); };
27302
+ var clearForm = function () {
27303
+ form.resetFields();
27304
+ setFuelCombustionActivitiesBau(0);
27305
+ setFuelCombustionActivitiesConditionalNdc(0);
27306
+ setFuelCombustionActivitiesUnconditionalNdc(0);
27307
+ setFugitiveEmissionsFromFuelsBau(0);
27308
+ setFugitiveEmissionsFromFuelsConditionalNdc(0);
27309
+ setFugitiveEmissionsFromFuelsUnconditionalNdc(0);
27310
+ setCarbonDioxideTransportStorageBau(0);
27311
+ setCarbonDioxideTransportStorageConditionalNdc(0);
27312
+ setCarbonDioxideTransportStorageUnconditionalNdc(0);
27313
+ setIndustrialProcessesProductUseBau(0);
27314
+ setIndustrialProcessesProductUseConditionalNdc(0);
27315
+ setIndustrialProcessesProductUseUnconditionalNdc(0);
27316
+ setAgricultureForestryOtherLandUseBau(0);
27317
+ setAgricultureForestryOtherLandUseConditionalNdc(0);
27318
+ setAgricultureForestryOtherLandUseUnconditionalNdc(0);
27319
+ setWasteBau(0);
27320
+ setWasteConditionalNdc(0);
27321
+ setWasteUnconditionalNdc(0);
27322
+ setOtherBau(0);
27323
+ setOtherConditionalNdc(0);
27324
+ setOtherUnconditionalNdc(0);
27325
+ };
26899
27326
  var resetForm = function () { return __awaiter(void 0, void 0, void 0, function () {
26900
27327
  return __generator(this, function (_a) {
26901
27328
  switch (_a.label) {
@@ -26909,29 +27336,14 @@ var GHGProjectionsComponent = function (props) {
26909
27336
  setIsSavedFormDataSet(false);
26910
27337
  clearUploadDoc();
26911
27338
  if (!isPendingFinalization) {
26912
- form.resetFields();
26913
- setFuelCombustionActivitiesBau(0);
26914
- setFuelCombustionActivitiesConditionalNdc(0);
26915
- setFuelCombustionActivitiesUnconditionalNdc(0);
26916
- setFugitiveEmissionsFromFuelsBau(0);
26917
- setFugitiveEmissionsFromFuelsConditionalNdc(0);
26918
- setFugitiveEmissionsFromFuelsUnconditionalNdc(0);
26919
- setCarbonDioxideTransportStorageBau(0);
26920
- setCarbonDioxideTransportStorageConditionalNdc(0);
26921
- setCarbonDioxideTransportStorageUnconditionalNdc(0);
26922
- setIndustrialProcessesProductUseBau(0);
26923
- setIndustrialProcessesProductUseConditionalNdc(0);
26924
- setIndustrialProcessesProductUseUnconditionalNdc(0);
26925
- setAgricultureForestryOtherLandUseBau(0);
26926
- setAgricultureForestryOtherLandUseConditionalNdc(0);
26927
- setAgricultureForestryOtherLandUseUnconditionalNdc(0);
26928
- setWasteBau(0);
26929
- setWasteConditionalNdc(0);
26930
- setWasteUnconditionalNdc(0);
26931
- setOtherBau(0);
26932
- setOtherConditionalNdc(0);
26933
- setOtherUnconditionalNdc(0);
27339
+ clearForm();
26934
27340
  }
27341
+ message.open({
27342
+ type: 'success',
27343
+ content: t('ghgInventory:formCancelledSuccess'),
27344
+ duration: 4,
27345
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
27346
+ });
26935
27347
  return [2 /*return*/];
26936
27348
  }
26937
27349
  });
@@ -26939,7 +27351,7 @@ var GHGProjectionsComponent = function (props) {
26939
27351
  var onResetFormCanceled = function () {
26940
27352
  setOpenResetFormModal(false);
26941
27353
  };
26942
- var onResetFormModel = function () {
27354
+ var onOpenResetFormModel = function () {
26943
27355
  setActionInfo({
26944
27356
  action: "".concat(t('ghgInventory:proceed')),
26945
27357
  headerText: "".concat(t('ghgInventory:discardHeaderText')),
@@ -26949,6 +27361,42 @@ var GHGProjectionsComponent = function (props) {
26949
27361
  setErrorMsg('');
26950
27362
  setOpenResetFormModal(true);
26951
27363
  };
27364
+ var onSaveFormCanceled = function () {
27365
+ setOpenSaveFormModal(false);
27366
+ };
27367
+ var onOpenSaveFormModel = function () {
27368
+ if (!isFormChanged) {
27369
+ message.open({
27370
+ type: 'error',
27371
+ content: t('ghgInventory:formNotChanged'),
27372
+ duration: 4,
27373
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
27374
+ });
27375
+ }
27376
+ else {
27377
+ setActionInfo({
27378
+ action: "".concat(t("ghgInventory:submit")),
27379
+ headerText: "".concat(t("ghgInventory:submitModelHeader")),
27380
+ type: "primary",
27381
+ icon: React.createElement(CheckCircleOutlined, null),
27382
+ });
27383
+ setErrorMsg('');
27384
+ setOpenSaveFormModal(true);
27385
+ }
27386
+ };
27387
+ var onFinalizeFormCanceled = function () {
27388
+ setOpenFinalizeFormModal(false);
27389
+ };
27390
+ var onOpenFinalizeFormModel = function () {
27391
+ setActionInfo({
27392
+ action: "".concat(t("ghgInventory:finalize")),
27393
+ headerText: "".concat(t("ghgInventory:finalizeModelHeader")),
27394
+ type: "primary",
27395
+ icon: React.createElement(ClipboardCheck, null),
27396
+ });
27397
+ setErrorMsg('');
27398
+ setOpenFinalizeFormModal(true);
27399
+ };
26952
27400
  var getProjectionData = function () { return __awaiter(void 0, void 0, void 0, function () {
26953
27401
  var response, error_1;
26954
27402
  return __generator(this, function (_a) {
@@ -26977,6 +27425,7 @@ var GHGProjectionsComponent = function (props) {
26977
27425
  });
26978
27426
  return [3 /*break*/, 5];
26979
27427
  case 4:
27428
+ setIsFormChanged(false);
26980
27429
  setLoading(false);
26981
27430
  return [7 /*endfinally*/];
26982
27431
  case 5: return [2 /*return*/];
@@ -26996,47 +27445,70 @@ var GHGProjectionsComponent = function (props) {
26996
27445
  }); };
26997
27446
  fetchData();
26998
27447
  }, []);
26999
- var onSubmitForm = function (values) { return __awaiter(void 0, void 0, void 0, function () {
27000
- var fields, payload, response, error_2;
27448
+ var onSubmitForm = function (remarks, status) { return __awaiter(void 0, void 0, void 0, function () {
27449
+ var fields, payload, response, messageContent, error_2;
27001
27450
  return __generator(this, function (_a) {
27002
27451
  switch (_a.label) {
27003
27452
  case 0:
27004
27453
  fields = form.getFieldsValue(true);
27005
- return [4 /*yield*/, createSaveRequestPayload(fields)];
27454
+ return [4 /*yield*/, createSaveRequestPayload(fields, remarks, status)];
27006
27455
  case 1:
27007
27456
  payload = _a.sent();
27008
27457
  setLoading(true);
27009
27458
  _a.label = 2;
27010
27459
  case 2:
27011
- _a.trys.push([2, 4, 5, 6]);
27460
+ _a.trys.push([2, 6, 9, 10]);
27012
27461
  return [4 /*yield*/, post('national/projections', payload)];
27013
27462
  case 3:
27014
27463
  response = _a.sent();
27015
27464
  console.log('Projections creation -> ', response);
27016
- if ((response === null || response === void 0 ? void 0 : response.statusText) === 'SUCCESS') {
27017
- message.open({
27018
- type: 'success',
27019
- content: (response === null || response === void 0 ? void 0 : response.status) == HttpStatusCode.Created ? t('ghgInventory:projectionCreationSuccess') : t('ghgInventory:projectionUpdateSuccess'),
27020
- duration: 4,
27021
- style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
27022
- });
27465
+ if (!((response === null || response === void 0 ? void 0 : response.statusText) === 'SUCCESS')) return [3 /*break*/, 5];
27466
+ setOpenSaveFormModal(false);
27467
+ messageContent = (response === null || response === void 0 ? void 0 : response.status) == HttpStatusCode.Created ?
27468
+ t('ghgInventory:projectionCreationSuccess')
27469
+ : t('ghgInventory:projectionUpdateSuccess');
27470
+ if (status === GHGRecordState.FINALIZED) {
27471
+ clearUploadDoc();
27472
+ clearForm();
27473
+ messageContent = t('ghgInventory:projectionFinalizedSuccess');
27023
27474
  }
27024
- return [3 /*break*/, 6];
27475
+ setOpenFinalizeFormModal(false);
27476
+ message.open({
27477
+ type: 'success',
27478
+ content: messageContent,
27479
+ duration: 4,
27480
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
27481
+ });
27482
+ clearUploadDoc();
27483
+ return [4 /*yield*/, getProjectionData()];
27025
27484
  case 4:
27485
+ _a.sent();
27486
+ _a.label = 5;
27487
+ case 5: return [3 /*break*/, 10];
27488
+ case 6:
27026
27489
  error_2 = _a.sent();
27027
27490
  console.log('Error in projection creation - ', error_2);
27491
+ setOpenSaveFormModal(false);
27492
+ setOpenFinalizeFormModal(false);
27028
27493
  message.open({
27029
27494
  type: 'error',
27030
27495
  content: error_2 === null || error_2 === void 0 ? void 0 : error_2.message,
27031
27496
  duration: 4,
27032
27497
  style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
27033
27498
  });
27034
- return [3 /*break*/, 6];
27035
- case 5:
27036
- getProjectionData();
27499
+ if (!(error_2.statusCode == HttpStatusCode.Conflict)) return [3 /*break*/, 8];
27500
+ return [4 /*yield*/, getProjectionData()];
27501
+ case 7:
27502
+ _a.sent();
27503
+ clearUploadDoc();
27504
+ _a.label = 8;
27505
+ case 8: return [3 /*break*/, 10];
27506
+ case 9:
27507
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
27508
+ setIsFormChanged(false);
27037
27509
  setLoading(false);
27038
27510
  return [7 /*endfinally*/];
27039
- case 6: return [2 /*return*/];
27511
+ case 10: return [2 /*return*/];
27040
27512
  }
27041
27513
  });
27042
27514
  }); };
@@ -27083,13 +27555,15 @@ var GHGProjectionsComponent = function (props) {
27083
27555
  setIsSavedFormDataSet(true);
27084
27556
  };
27085
27557
  useEffect(function () {
27086
- // if (isPendingFinalization) {
27558
+ var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
27087
27559
  if (!isSavedFormDataSet) {
27088
- var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
27089
27560
  if (savedData && savedData.length > 0) {
27090
27561
  setFormValues(savedData[0]);
27091
27562
  }
27092
27563
  }
27564
+ if (savedData && savedData.length > 0) {
27565
+ setFormDataVersion(savedData[0].version);
27566
+ }
27093
27567
  var years = data
27094
27568
  .filter(function (item) { return !(item.state === 'SAVED' && item.year); }) // Filter out items where state is not 'SAVED'
27095
27569
  .map(function (item) { return parseInt(item.year); });
@@ -27484,6 +27958,66 @@ var GHGProjectionsComponent = function (props) {
27484
27958
  React.createElement(Col, { xl: 7 },
27485
27959
  React.createElement(InputNumber, { value: unconditionalNdc, disabled: true }))))));
27486
27960
  };
27961
+ var objectToCSV = function (dataToDownload) {
27962
+ var flattenObject = function (obj, prefix) {
27963
+ if (prefix === void 0) { prefix = ''; }
27964
+ return Object.keys(obj).reduce(function (acc, key) {
27965
+ var pre = prefix.length ? "".concat(prefix, "_") : '';
27966
+ if (typeof obj[key] === 'object' && obj[key] !== null) {
27967
+ Object.assign(acc, flattenObject(obj[key], pre + key));
27968
+ }
27969
+ else {
27970
+ acc[pre + key] = obj[key];
27971
+ }
27972
+ return acc;
27973
+ }, {});
27974
+ };
27975
+ var headers = [];
27976
+ var contentKeys = [];
27977
+ var flattenedObj = flattenObject(dataToDownload);
27978
+ var objKeys = Object.keys(flattenedObj);
27979
+ objKeys.map(function (key) {
27980
+ if (projectionsCsvFieldMap[key]) {
27981
+ headers.push(projectionsCsvFieldMap[key]);
27982
+ contentKeys.push(key);
27983
+ }
27984
+ });
27985
+ var flattenedData = [dataToDownload].map(function (item) {
27986
+ var flattened = flattenObject(item);
27987
+ return contentKeys.map(function (header) { return flattened[header]; });
27988
+ });
27989
+ var csvContent = headers.map(function (header) { return "\"".concat(header, "\""); }).join(',') +
27990
+ '\n' +
27991
+ flattenedData.map(function (row) { return row.map(function (value) { return (value === undefined || value === null) ? "" : value; }).join(','); }).join('\n');
27992
+ return csvContent;
27993
+ };
27994
+ var downloadCSV = function (dataToDownload) {
27995
+ var csvContent = objectToCSV(dataToDownload);
27996
+ var encodedUri = encodeURI("data:text/csv;charset=utf-8,".concat(csvContent));
27997
+ var link = document.createElement('a');
27998
+ link.setAttribute('href', encodedUri);
27999
+ link.setAttribute('download', "GHG-Reporting Projections_".concat(dataToDownload.year, "_V").concat(dataToDownload.version, ".csv"));
28000
+ document.body.appendChild(link);
28001
+ link.click();
28002
+ };
28003
+ var isRowDataEmpty = function (projectionDataObj) {
28004
+ if (projectionDataObj == undefined || projectionDataObj == null) {
28005
+ return true;
28006
+ }
28007
+ var bau = projectionDataObj === null || projectionDataObj === void 0 ? void 0 : projectionDataObj.bau;
28008
+ var conditionalNdc = projectionDataObj === null || projectionDataObj === void 0 ? void 0 : projectionDataObj.conditionalNdc;
28009
+ var unconditionalNdc = projectionDataObj === null || projectionDataObj === void 0 ? void 0 : projectionDataObj.unconditionalNdc;
28010
+ if (!bau && !conditionalNdc && !unconditionalNdc) {
28011
+ return true;
28012
+ }
28013
+ return false;
28014
+ };
28015
+ var isSectionDataEmpty = function (sectionTotalBau, sectionTotalConditionalNdc, sectionTotalUnconditionalNdc) {
28016
+ if (!sectionTotalBau && !sectionTotalConditionalNdc && !sectionTotalUnconditionalNdc) {
28017
+ return true;
28018
+ }
28019
+ return false;
28020
+ };
27487
28021
  return (React.createElement("div", null,
27488
28022
  React.createElement("div", { className: "content-container projection-tab-container" },
27489
28023
  React.createElement("div", { className: "projection-title-bar" },
@@ -27495,7 +28029,7 @@ var GHGProjectionsComponent = function (props) {
27495
28029
  ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT ||
27496
28030
  (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY) && (React.createElement(Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
27497
28031
  React.createElement("div", null,
27498
- 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 },
28032
+ 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 },
27499
28033
  React.createElement(Row, null,
27500
28034
  React.createElement(Col, { xl: 12, md: 12, className: "add-new-year-picker-col" },
27501
28035
  React.createElement("div", null,
@@ -27641,10 +28175,13 @@ var GHGProjectionsComponent = function (props) {
27641
28175
  React.createElement(Form.Item, { name: "totalCo2WithLand_unconditionalNdc" },
27642
28176
  React.createElement(InputNumber, null)))))),
27643
28177
  React.createElement("div", { className: "steps-actions" },
27644
- React.createElement(Button, { type: "primary", htmlType: "submit", loading: loading }, "Submit"),
27645
- React.createElement(Button, { className: "back-btn", onClick: onResetFormModel, loading: loading }, "Cancel")))))),
28178
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
28179
+ (React.createElement(Button, { className: "finalize-btn", type: "primary", loading: loading, onClick: onOpenFinalizeFormModel }, "Finalize")),
28180
+ React.createElement(Button, { className: "submit-btn", type: "primary", htmlType: "submit", loading: loading }, "Submit"),
28181
+ React.createElement(Button, { className: "back-btn", onClick: onOpenResetFormModel, loading: loading }, "Cancel")))))),
27646
28182
  data.map(function (tabData) {
27647
- return tabData.state === 'FINALIZED' && (React.createElement(Tabs.TabPane, { key: tabData.id.toString(), tab: React.createElement("span", null,
28183
+ var _a, _b, _c, _d, _e, _f;
28184
+ return tabData.state === 'FINALIZED' && (React.createElement(Tabs.TabPane, { className: 'view-data-panel', key: tabData.id.toString(), tab: React.createElement("span", null,
27648
28185
  tabData.year,
27649
28186
  tabData.state === 'FINALIZED' && React.createElement(LockFilled, { style: { marginLeft: 5 } })) },
27650
28187
  React.createElement("div", null,
@@ -27660,39 +28197,10 @@ var GHGProjectionsComponent = function (props) {
27660
28197
  React.createElement(Col, { xl: 12, md: 12, className: "add-new-upload-file-col" },
27661
28198
  React.createElement(Row, { className: "add-new-upload-file-label" }, t("ghgInventory:emissionRemovalDocument")),
27662
28199
  React.createElement(Row, null,
27663
- React.createElement(Col, { xl: 5, md: 5, className: "add-new-upload-file-inner-col" },
27664
- React.createElement(Form.Item, null,
27665
- React.createElement(Upload, { accept: ".xlsx", customRequest: function (_a) {
27666
- _a.onSuccess; _a.onError; _a.file;
27667
- var reader = new FileReader();
27668
- reader.onload = function (e) {
27669
- if (e && e.target) {
27670
- // Check if e and e.target are defined
27671
- var xldata = e.target.result;
27672
- if (xldata) {
27673
- try {
27674
- var workbook = XLSX.read(xldata, { type: 'array' });
27675
- var sheetName = workbook.SheetNames[0];
27676
- var sheet = workbook.Sheets[sheetName];
27677
- var excelData = XLSX.utils.sheet_to_json(sheet);
27678
- // Use excelData as needed, e.g., display it in a table.
27679
- console.log(excelData);
27680
- // You can perform any further processing with the data here.
27681
- // For example, you can call a function to handle the uploaded data.
27682
- // handleFileUpload(excelData);
27683
- // onSuccess('ok', file);
27684
- }
27685
- catch (error) {
27686
- // onError(error, 'error', file);
27687
- }
27688
- }
27689
- }
27690
- };
27691
- // reader.readAsArrayBuffer(file);
27692
- } },
27693
- React.createElement(Button, { icon: React.createElement(UploadOutlined, null) }, t("ghgInventory:upload"))))),
27694
- React.createElement(Col, { xl: 16, md: 16, className: "add-new-upload-file-name-input" },
27695
- React.createElement(Input, { value: uploadedFileName, readOnly: true }))))),
28200
+ React.createElement(Col, { xl: 15, md: 15, className: "view-download-file-name-input" },
28201
+ React.createElement(Input, { value: "GHG-Reporting Emission_".concat(tabData.year, "_V").concat(tabData.version, ".csv"), disabled: true })),
28202
+ React.createElement(Col, { xl: 5, md: 5, className: "view-download-file-inner-col" },
28203
+ React.createElement(Button, { icon: React.createElement(DownloadOutlined, null), onClick: function () { downloadCSV(tabData); } }, t("ghgInventory:download")))))),
27696
28204
  React.createElement(Row, { gutter: 16 },
27697
28205
  React.createElement(Col, { span: 9, offset: 12 },
27698
28206
  React.createElement(Row, { gutter: 16, className: "table-heading-row" },
@@ -27715,32 +28223,72 @@ var GHGProjectionsComponent = function (props) {
27715
28223
  return isActive ? React.createElement(MinusCircleOutlined, null) : React.createElement(PlusCircleOutlined, null);
27716
28224
  } }, Object.entries(formFields).map(function (_a) {
27717
28225
  var panelHeading = _a[0], panelContent = _a[1];
27718
- return (React.createElement(Panel, { header: renderPanelHeaderView(panelHeading, tabData), key: panelHeading }, Array.isArray(panelContent)
27719
- ? panelContent.map(function (item, index) {
27720
- for (var key in tabData) {
27721
- if (key === panelHeading) {
27722
- var emissionsObject = tabData[key];
27723
- var emissionsData = emissionsObject[item];
27724
- return renderPanelContentView(emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.bau, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.conditionalNdc, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.unconditionalNdc, item, index);
27725
- }
27726
- }
27727
- })
27728
- : Object.entries(panelContent).map(function (_a) {
27729
- var subPanelHeading = _a[0], subPanelContent = _a[1];
27730
- return (React.createElement("div", { className: "sub-panel" },
27731
- React.createElement("div", { className: "sub-panel-heading" }, renderPanelHeaderView(subPanelHeading, tabData.energyEmissions)),
27732
- subPanelContent.map(function (item, index) {
27733
- for (var key in tabData.energyEmissions[subPanelHeading]) {
27734
- if (key === item) {
27735
- var emissionsObject = tabData.energyEmissions[subPanelHeading];
27736
- var emissionsData = emissionsObject[item];
28226
+ var projectionsObject = tabData[panelHeading];
28227
+ var sectionTotalBau = calculateSumEmissionView(projectionsObject, 'bau');
28228
+ var sectionTotalConditionalNdc = calculateSumEmissionView(projectionsObject, 'conditionalNdc');
28229
+ var sectionTotalUnconditionalNdc = calculateSumEmissionView(projectionsObject, 'unconditionalNdc');
28230
+ if (!isSectionDataEmpty(sectionTotalBau, sectionTotalConditionalNdc, sectionTotalUnconditionalNdc)) {
28231
+ return (React.createElement(Panel, { header: renderPanelHeaderView(panelHeading, tabData), key: panelHeading }, Array.isArray(panelContent)
28232
+ ? panelContent.map(function (item, index) {
28233
+ for (var key in tabData) {
28234
+ if (key === panelHeading) {
28235
+ var emissionsObject = tabData[key];
28236
+ var emissionsData = emissionsObject[item];
28237
+ if (!isRowDataEmpty(emissionsData)) {
27737
28238
  return renderPanelContentView(emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.bau, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.conditionalNdc, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.unconditionalNdc, item, index);
27738
28239
  }
27739
28240
  }
27740
- })));
27741
- })));
27742
- })))));
28241
+ }
28242
+ })
28243
+ : Object.entries(panelContent).map(function (_a) {
28244
+ var subPanelHeading = _a[0], subPanelContent = _a[1];
28245
+ var projectionsObject = tabData.energyEmissions[subPanelHeading];
28246
+ var sectionTotalBau = calculateSumEmissionView(projectionsObject, 'bau');
28247
+ var sectionTotalConditionalNdc = calculateSumEmissionView(projectionsObject, 'conditionalNdc');
28248
+ var sectionTotalUnconditionalNdc = calculateSumEmissionView(projectionsObject, 'unconditionalNdc');
28249
+ if (!isSectionDataEmpty(sectionTotalBau, sectionTotalConditionalNdc, sectionTotalUnconditionalNdc)) {
28250
+ return (React.createElement("div", { className: "sub-panel" },
28251
+ React.createElement("div", { className: "sub-panel-heading" }, renderPanelHeaderView(subPanelHeading, tabData.energyEmissions)),
28252
+ subPanelContent.map(function (item, index) {
28253
+ for (var key in tabData.energyEmissions[subPanelHeading]) {
28254
+ if (key === item) {
28255
+ var emissionsObject = tabData.energyEmissions[subPanelHeading];
28256
+ var emissionsData = emissionsObject[item];
28257
+ if (!isRowDataEmpty(emissionsData)) {
28258
+ return renderPanelContentView(emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.bau, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.conditionalNdc, emissionsData === null || emissionsData === void 0 ? void 0 : emissionsData.unconditionalNdc, item, index);
28259
+ }
28260
+ }
28261
+ }
28262
+ })));
28263
+ }
28264
+ })));
28265
+ }
28266
+ })),
28267
+ (!isRowDataEmpty(tabData.totalCo2WithoutLand)) && (React.createElement(Row, { gutter: 16, key: 'totalCo2WithoutLand', className: "total-co2-without-land-row" },
28268
+ React.createElement(Col, { xl: 12, md: 12, className: "total-co2-without-land-title" },
28269
+ React.createElement("span", null, t("ghgInventory:totalCo2WithoutLand"))),
28270
+ React.createElement(Col, { xl: 9, md: 9 },
28271
+ React.createElement(Row, { gutter: 16, className: "panel-content-input-box-row" },
28272
+ React.createElement(Col, { xl: 7 },
28273
+ React.createElement(InputNumber, { value: (_a = tabData.totalCo2WithoutLand) === null || _a === void 0 ? void 0 : _a.bau, disabled: true })),
28274
+ React.createElement(Col, { xl: 7 },
28275
+ React.createElement(InputNumber, { value: (_b = tabData.totalCo2WithoutLand) === null || _b === void 0 ? void 0 : _b.conditionalNdc, disabled: true })),
28276
+ React.createElement(Col, { xl: 7 },
28277
+ React.createElement(InputNumber, { value: (_c = tabData.totalCo2WithoutLand) === null || _c === void 0 ? void 0 : _c.unconditionalNdc, disabled: true })))))),
28278
+ (!isRowDataEmpty(tabData.totalCo2WithLand)) && (React.createElement(Row, { gutter: 16, key: 'totalCo2WithLand', className: "total-co2-with-land-row" },
28279
+ React.createElement(Col, { xl: 12, md: 12, className: "total-co2-with-land-title" },
28280
+ React.createElement("span", null, t("ghgInventory:totalCo2WithLand"))),
28281
+ React.createElement(Col, { xl: 9, md: 9 },
28282
+ React.createElement(Row, { gutter: 16, className: "panel-content-input-box-row" },
28283
+ React.createElement(Col, { xl: 7 },
28284
+ React.createElement(InputNumber, { value: (_d = tabData.totalCo2WithLand) === null || _d === void 0 ? void 0 : _d.bau, disabled: true })),
28285
+ React.createElement(Col, { xl: 7 },
28286
+ React.createElement(InputNumber, { value: (_e = tabData.totalCo2WithLand) === null || _e === void 0 ? void 0 : _e.conditionalNdc, disabled: true })),
28287
+ React.createElement(Col, { xl: 7 },
28288
+ React.createElement(InputNumber, { value: (_f = tabData.totalCo2WithLand) === null || _f === void 0 ? void 0 : _f.unconditionalNdc, disabled: true })))))))));
27743
28289
  })))),
28290
+ React.createElement(GHGUserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onSubmitForm, onActionCanceled: onSaveFormCanceled, openModal: openSaveFormModal, errorMsg: errorMsg, loading: loading }),
28291
+ React.createElement(GHGUserActionConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: onSubmitForm, onActionCanceled: onFinalizeFormCanceled, openModal: openFinalizeFormModal, errorMsg: errorMsg, loading: loading }),
27744
28292
  React.createElement(DiscardChangesConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: resetForm, onActionCanceled: onResetFormCanceled, openModal: openResetFormModal, errorMsg: errorMsg, loading: loading })));
27745
28293
  };
27746
28294