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

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { PlusOutlined, FilterOutlined, BankOutlined, SafetyOutlined, AuditOutlined, ExperimentOutlined, UploadOutlined, UserOutlined, MinusCircleOutlined, StarOutlined, ToolOutlined, EyeOutlined, SearchOutlined, EllipsisOutlined, EditOutlined, DeleteOutlined, FileAddOutlined, CheckCircleOutlined, ExclamationCircleOutlined, BookOutlined, CaretDownOutlined, EyeInvisibleOutlined, GlobalOutlined, FlagOutlined, LineChartOutlined, LikeOutlined, DislikeOutlined, PlusCircleOutlined, LockFilled } from '@ant-design/icons';
1
+ import { PlusOutlined, FilterOutlined, BankOutlined, SafetyOutlined, AuditOutlined, ExperimentOutlined, UploadOutlined, UserOutlined, MinusCircleOutlined, StarOutlined, ToolOutlined, EyeOutlined, SearchOutlined, EllipsisOutlined, EditOutlined, DeleteOutlined, FileAddOutlined, CheckCircleOutlined, ExclamationCircleOutlined, BookOutlined, CaretDownOutlined, EyeInvisibleOutlined, GlobalOutlined, FlagOutlined, LineChartOutlined, LikeOutlined, DislikeOutlined, PlusCircleOutlined, LockFilled, CloseCircleOutlined } from '@ant-design/icons';
2
2
  import { Input, Radio, Space, Row, Col, Button, Dropdown, Table, Empty, message, Form, Steps, Upload, Tooltip, Select, Modal, Alert, Skeleton, Card, Tag, Checkbox, DatePicker, InputNumber, Popover, List, Typography, Spin, Tabs, Progress, Collapse } from 'antd';
3
3
  import React, { useState, useEffect, useRef } from 'react';
4
4
  import { DateTime } from 'luxon';
@@ -24996,7 +24996,7 @@ var TimelineBody = function (props) {
24996
24996
  React.createElement("div", { className: "remark-body" }, remark)))));
24997
24997
  };
24998
24998
 
24999
- var css_248z$1 = ".ant-tabs-tab-btn {\n padding: 5px 30px;\n text-align: center;\n font-weight: 600;\n color: rgba(58, 53, 65, 0.5); }\n\n.emission-tab-container .add-emission {\n display: flex;\n flex-direction: column;\n background-color: #ffffff;\n margin: 1rem 0 1rem 0;\n border-radius: 10px;\n padding: 0 1.5rem 2.5rem 1.5rem; }\n .emission-tab-container .add-emission .add-new-year-picker-col {\n padding-left: 5%; }\n .emission-tab-container .add-emission .ant-picker {\n border-radius: 5px !important;\n height: 50px !important;\n width: 80%; }\n .emission-tab-container .add-emission .add-new-upload-file-label {\n color: rgba(58, 53, 65, 0.5);\n padding: 0 0 8px;\n line-height: 1.5715;\n white-space: initial;\n text-align: left; }\n .emission-tab-container .add-emission .add-new-upload-file-name-input input {\n height: 50px; }\n .emission-tab-container .add-emission .add-new-upload-file-inner-col button {\n height: 50px;\n font-size: 11px;\n width: 120px; }\n .emission-tab-container .add-emission .table-heading-row {\n padding-top: 20px;\n padding-bottom: 25px;\n margin-left: 10px !important; }\n .emission-tab-container .add-emission .table-heading-row .table-heading-col {\n text-align: center;\n font-size: 18px;\n font-weight: 600;\n color: #28282899; }\n .emission-tab-container .add-emission .total-emission-row {\n padding: 12px 16px;\n margin-left: 30px !important; }\n .emission-tab-container .add-emission .total-emission-row span {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .total-emission-row .total-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .panel-header-col {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .panel-header-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .sub-panel .panel-header-emission-value-col {\n border-bottom: none !important;\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .sub-panel-heading {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n margin-top: 35px; }\n .emission-tab-container .add-emission .sub-panel-heading .panel-header-col {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .ant-collapse-ghost > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box {\n padding-top: 0px;\n padding-bottom: 12px;\n margin-left: 25px; }\n .emission-tab-container .add-emission .ant-collapse-expand-icon {\n margin-top: 5px; }\n .emission-tab-container .add-emission .ant-collapse-expand-icon svg {\n font-size: 20px;\n color: #976ED7; }\n .emission-tab-container .add-emission .ant-collapse {\n margin-left: 10px; }\n .emission-tab-container .add-emission .co2-total-pill {\n border-radius: 20px;\n background-color: rgba(145, 85, 253, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .ch4-total-pill {\n border-radius: 20px;\n background-color: rgba(217, 217, 217, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .n2o-total-pill {\n border-radius: 20px;\n background-color: rgba(185, 226, 244, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .co2eq-total-pill {\n border-radius: 20px;\n background-color: rgba(255, 166, 166, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .panel-content-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n height: 68px;\n align-items: center; }\n .emission-tab-container .add-emission .panel-content-row .panel-content-title {\n font-size: 16px;\n font-weight: 500;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .panel-content-input-box-row {\n margin-top: 14px; }\n .emission-tab-container .add-emission .panel-content-input-box-row .ant-input-number {\n height: 40px;\n width: 50px;\n margin-left: 25%; }\n .emission-tab-container .add-emission .total-co2-without-land-row {\n margin-left: 40px !important;\n align-items: center;\n margin-top: 50px; }\n .emission-tab-container .add-emission .total-co2-without-land-row .total-co2-without-land-title {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .total-co2-without-land-row .panel-content-input-box-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6); }\n .emission-tab-container .add-emission .total-co2-with-land-row {\n margin-left: 40px !important;\n align-items: center; }\n .emission-tab-container .add-emission .total-co2-with-land-row .total-co2-with-land-title {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .total-co2-with-land-row .panel-content-input-box-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6); }\n .emission-tab-container .add-emission .steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n margin-top: 3rem; }\n .emission-tab-container .add-emission .steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .emission-tab-container .add-emission .steps-actions .back-btn {\n border: 1px solid rgba(140, 140, 140, 0.7);\n color: rgba(140, 140, 140, 0.7);\n margin-right: 1rem; }\n .emission-tab-container .add-emission .steps-actions .mg-left-1 {\n margin-left: 1rem; }\n";
24999
+ var css_248z$1 = ".ant-tabs-tab-btn {\n padding: 5px 30px;\n text-align: center;\n font-weight: 600;\n color: rgba(58, 53, 65, 0.5); }\n\n.ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner {\n width: 65px !important;\n height: 32px !important;\n text-align: center !important;\n border-radius: 50px !important;\n background: #16b1ff !important;\n line-height: 30px !important; }\n\n.ant-picker-cell-disabled::before {\n width: 65px !important;\n height: 32px !important;\n text-align: center !important;\n border-radius: 50px !important;\n line-height: 30px !important; }\n\n.ant-picker-cell::before {\n left: 11px; }\n\n.ant-input-suffix {\n display: flex;\n flex: none;\n align-items: center;\n height: 50px; }\n .ant-input-suffix button {\n border: none;\n color: #8C8C8C; }\n\n.ant-input-affix-wrapper {\n padding: 0 11px;\n border-radius: 5px; }\n\n.emission-tab-container .add-emission {\n display: flex;\n flex-direction: column;\n background-color: #ffffff;\n margin: 1rem 0 1rem 0;\n border-radius: 10px;\n padding: 0 1.5rem 2.5rem 1.5rem; }\n .emission-tab-container .add-emission .add-new-year-picker-col {\n padding-left: 5%; }\n .emission-tab-container .add-emission .ant-picker {\n border-radius: 5px !important;\n height: 50px !important;\n width: 80%; }\n .emission-tab-container .add-emission .add-new-upload-file-label {\n color: rgba(58, 53, 65, 0.5);\n padding: 0 0 8px;\n line-height: 1.5715;\n white-space: initial;\n text-align: left; }\n .emission-tab-container .add-emission .add-new-upload-file-name-input input {\n height: 50px;\n color: #16b1ff; }\n .emission-tab-container .add-emission .add-new-upload-file-inner-col button {\n height: 50px;\n font-size: 11px;\n width: 120px; }\n .emission-tab-container .add-emission .table-heading-row {\n padding-top: 20px;\n padding-bottom: 25px;\n margin-left: 10px !important; }\n .emission-tab-container .add-emission .table-heading-row .table-heading-col {\n text-align: center;\n font-size: 18px;\n font-weight: 600;\n color: #28282899; }\n .emission-tab-container .add-emission .total-emission-row {\n padding: 12px 16px;\n margin-left: 30px !important; }\n .emission-tab-container .add-emission .total-emission-row span {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .total-emission-row .total-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .panel-header-col {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .panel-header-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .sub-panel .panel-header-emission-value-col {\n border-bottom: none !important;\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .sub-panel-heading {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n margin-top: 35px; }\n .emission-tab-container .add-emission .sub-panel-heading .panel-header-col {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .ant-collapse-ghost > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box {\n padding-top: 0px;\n padding-bottom: 12px;\n margin-left: 25px; }\n .emission-tab-container .add-emission .ant-collapse-expand-icon {\n margin-top: 5px; }\n .emission-tab-container .add-emission .ant-collapse-expand-icon svg {\n font-size: 20px;\n color: #976ED7; }\n .emission-tab-container .add-emission .ant-collapse {\n margin-left: 10px; }\n .emission-tab-container .add-emission .co2-total-pill {\n border-radius: 20px;\n background-color: rgba(145, 85, 253, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .ch4-total-pill {\n border-radius: 20px;\n background-color: rgba(217, 217, 217, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .n2o-total-pill {\n border-radius: 20px;\n background-color: rgba(185, 226, 244, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .co2eq-total-pill {\n border-radius: 20px;\n background-color: rgba(255, 166, 166, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .panel-content-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n height: 68px;\n align-items: center; }\n .emission-tab-container .add-emission .panel-content-row .panel-content-title {\n font-size: 16px;\n font-weight: 500;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .panel-content-input-box-row {\n margin-top: 14px; }\n .emission-tab-container .add-emission .panel-content-input-box-row .ant-input-number {\n height: 40px;\n width: 50px;\n margin-left: 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";
25000
25000
  styleInject(css_248z$1);
25001
25001
 
25002
25002
  var EmissionTypes = { co2: 'CO2', ch4: 'CH4', n2o: 'N2O', co2eq: 'CO2-eq' };
@@ -25068,168 +25068,79 @@ var formFields = {
25068
25068
  other: ['indirectN2oEmissions', 'other'],
25069
25069
  };
25070
25070
 
25071
+ Input.TextArea;
25072
+ var DiscardChangesConfirmationModel = function (props) {
25073
+ var t = props.t, actionInfo = props.actionInfo, onActionConfirmed = props.onActionConfirmed, onActionCanceled = props.onActionCanceled, openModal = props.openModal; props.errorMsg; var loading = props.loading;
25074
+ var _a = useState(""); _a[0]; var setComment = _a[1];
25075
+ useEffect(function () {
25076
+ setComment("");
25077
+ }, [openModal]);
25078
+ return (React.createElement(Modal, { title: React.createElement("div", { className: "popup-header" },
25079
+ React.createElement("div", { className: "icon" }, actionInfo.icon),
25080
+ React.createElement("div", null, actionInfo.headerText)), className: "popup-" + actionInfo.type, open: openModal, width: Math.min(400, window.innerWidth), centered: true, onCancel: onActionCanceled, destroyOnClose: true, footer: null },
25081
+ React.createElement("p", { style: { whiteSpace: "pre-line" } }, actionInfo.text),
25082
+ React.createElement(Form, { layout: "vertical", onFinish: function () {
25083
+ onActionConfirmed();
25084
+ } },
25085
+ React.createElement("div", { className: "mg-top-1 ant-modal-footer padding-bottom-0" },
25086
+ React.createElement(Button, { htmlType: "button", onClick: function () {
25087
+ onActionCanceled();
25088
+ } }, t("userProfile:cancel")),
25089
+ React.createElement(Button, { className: "mg-left-2", type: "primary", htmlType: "submit", loading: loading }, actionInfo.action)))));
25090
+ };
25091
+
25071
25092
  // import React from 'react';
25072
25093
  var GHGEmissionsComponent = function (props) {
25073
25094
  var t = props.t, useUserContext = props.useUserContext, useConnection = props.useConnection;
25074
25095
  var userInfoState = useUserContext().userInfoState;
25075
- var data = [
25076
- {
25077
- id: 1,
25078
- country: 'NG',
25079
- year: 2023,
25080
- energyEmissions: {
25081
- fuelCombustionActivities: {
25082
- energyIndustries: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25083
- manufacturingIndustriesConstruction: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25084
- transport: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25085
- otherSectors: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25086
- nonSpecified: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25087
- },
25088
- fugitiveEmissionsFromFuels: {
25089
- solidFuels: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25090
- oilNaturalGas: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25091
- otherEmissionsEnergyProduction: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25092
- },
25093
- carbonDioxideTransportStorage: {
25094
- transportOfCo2: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25095
- injectionStorage: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25096
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25097
- },
25098
- },
25099
- industrialProcessesProductUse: {
25100
- mineralIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25101
- chemicalIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25102
- metalIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25103
- nonEnergyProductsFuelsSolventUse: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25104
- electronicsIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25105
- productUsesSubstOzoneDepletingSubs: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25106
- otherProductManufactureUse: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25107
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25108
- },
25109
- agricultureForestryOtherLandUse: {
25110
- livestock: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25111
- land: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25112
- aggregateNonCo2SourcesLand: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25113
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25114
- },
25115
- waste: {
25116
- solidWasteDisposal: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25117
- biologicalTreatmentSolidWaste: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25118
- incinerationOpenBurningWaste: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25119
- wastewaterTreatmentDischarge: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25120
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25121
- },
25122
- other: {
25123
- indirectN2oEmissions: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25124
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25125
- },
25126
- totalCo2WithoutLand: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25127
- totalCo2WithLand: { co2: 30, ch4: 15, n2o: 33, co2eq: 41 },
25128
- state: 'SAVED',
25129
- version: 2,
25130
- created_at: 1698644100397,
25131
- },
25132
- {
25133
- id: 2,
25134
- country: 'NG',
25135
- year: 2022,
25136
- energyEmissions: {
25137
- fuelCombustionActivities: {
25138
- energyIndustries: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25139
- manufacturingIndustriesConstruction: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25140
- transport: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25141
- otherSectors: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25142
- nonSpecified: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25143
- },
25144
- fugitiveEmissionsFromFuels: {
25145
- solidFuels: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25146
- oilNaturalGas: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25147
- otherEmissionsEnergyProduction: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25148
- },
25149
- carbonDioxideTransportStorage: {
25150
- transportOfCo2: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25151
- injectionStorage: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25152
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25153
- },
25154
- },
25155
- industrialProcessesProductUse: {
25156
- mineralIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25157
- chemicalIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25158
- metalIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25159
- nonEnergyProductsFuelsSolventUse: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25160
- electronicsIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25161
- productUsesSubstOzoneDepletingSubs: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25162
- otherProductManufactureUse: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25163
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25164
- },
25165
- agricultureForestryOtherLandUse: {
25166
- livestock: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25167
- land: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25168
- aggregateNonCo2SourcesLand: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25169
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25170
- },
25171
- waste: {
25172
- solidWasteDisposal: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25173
- biologicalTreatmentSolidWaste: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25174
- incinerationOpenBurningWaste: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25175
- wastewaterTreatmentDischarge: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25176
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25177
- },
25178
- other: {
25179
- indirectN2oEmissions: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25180
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25181
- },
25182
- totalCo2WithoutLand: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25183
- totalCo2WithLand: { co2: 30, ch4: 15, n2o: 33, co2eq: 41 },
25184
- state: 'FINALIZED',
25185
- version: 1,
25186
- created_at: 1698644100397,
25187
- },
25188
- ];
25189
- var _a = useConnection(); _a.put; _a.get; var post = _a.post;
25190
- var _b = useState(false), loading = _b[0], setLoading = _b[1];
25191
- var _c = useState(false), isPendingFinalization = _c[0], setIsPendingFinalization = _c[1];
25192
- var _d = useState(null); _d[0]; var setSelectedYear = _d[1];
25193
- var _e = useState(''), uploadedFileName = _e[0], setUploadedFileName = _e[1];
25194
- var _f = useState([]), disabledYears = _f[0], setDisabledYears = _f[1];
25195
- var _g = useState(); _g[0]; var setChangedValues = _g[1];
25196
- var _h = useState(0), totalNationalCo2 = _h[0], setTotalNationalCo2 = _h[1];
25197
- var _j = useState(0), totalNationalCh4 = _j[0], setTotalNationalCh4 = _j[1];
25198
- var _k = useState(0), totalNationalN2o = _k[0], setTotalNationalN2o = _k[1];
25199
- var _l = useState(0), totalNationalCo2Eq = _l[0], setTotalNationalCo2Eq = _l[1];
25200
- var _m = useState(0), energyEmissionsCo2 = _m[0], setEnergyEmissionsCo2 = _m[1];
25201
- var _o = useState(0), energyEmissionsCh4 = _o[0], setEnergyEmissionsCh4 = _o[1];
25202
- var _p = useState(0), energyEmissionsN2o = _p[0], setEnergyEmissionsN2o = _p[1];
25203
- var _q = useState(0), energyEmissionsCo2Eq = _q[0], setEnergyEmissionsCo2Eq = _q[1];
25204
- var _r = useState(0), fuelCombustionActivitiesCo2 = _r[0], setFuelCombustionActivitiesCo2 = _r[1];
25205
- var _s = useState(0), fuelCombustionActivitiesCh4 = _s[0], setFuelCombustionActivitiesCh4 = _s[1];
25206
- var _t = useState(0), fuelCombustionActivitiesN2o = _t[0], setFuelCombustionActivitiesN2o = _t[1];
25207
- var _u = useState(0), fuelCombustionActivitiesCo2Eq = _u[0], setFuelCombustionActivitiesCo2Eq = _u[1];
25208
- var _v = useState(0), fugitiveEmissionsFromFuelsCo2 = _v[0], setFugitiveEmissionsFromFuelsCo2 = _v[1];
25209
- var _w = useState(0), fugitiveEmissionsFromFuelsCh4 = _w[0], setFugitiveEmissionsFromFuelsCh4 = _w[1];
25210
- var _x = useState(0), fugitiveEmissionsFromFuelsN2o = _x[0], setFugitiveEmissionsFromFuelsN2o = _x[1];
25211
- var _y = useState(0), fugitiveEmissionsFromFuelsCo2Eq = _y[0], setFugitiveEmissionsFromFuelsCo2Eq = _y[1];
25212
- var _z = useState(0), carbonDioxideTransportStorageCo2 = _z[0], setCarbonDioxideTransportStorageCo2 = _z[1];
25213
- var _0 = useState(0), carbonDioxideTransportStorageCh4 = _0[0], setCarbonDioxideTransportStorageCh4 = _0[1];
25214
- var _1 = useState(0), carbonDioxideTransportStorageN2o = _1[0], setCarbonDioxideTransportStorageN2o = _1[1];
25215
- var _2 = useState(0), carbonDioxideTransportStorageCo2Eq = _2[0], setCarbonDioxideTransportStorageCo2Eq = _2[1];
25216
- var _3 = useState(0), industrialProcessesProductUseCo2 = _3[0], setIndustrialProcessesProductUseCo2 = _3[1];
25217
- var _4 = useState(0), industrialProcessesProductUseCh4 = _4[0], setIndustrialProcessesProductUseCh4 = _4[1];
25218
- var _5 = useState(0), industrialProcessesProductUseN2o = _5[0], setIndustrialProcessesProductUseN2o = _5[1];
25219
- var _6 = useState(0), industrialProcessesProductUseCo2Eq = _6[0], setIndustrialProcessesProductUseCo2Eq = _6[1];
25220
- var _7 = useState(0), agricultureForestryOtherLandUseCo2 = _7[0], setAgricultureForestryOtherLandUseCo2 = _7[1];
25221
- var _8 = useState(0), agricultureForestryOtherLandUseCh4 = _8[0], setAgricultureForestryOtherLandUseCh4 = _8[1];
25222
- var _9 = useState(0), agricultureForestryOtherLandUseN2o = _9[0], setAgricultureForestryOtherLandUseN2o = _9[1];
25223
- var _10 = useState(0), agricultureForestryOtherLandUseCo2Eq = _10[0], setAgricultureForestryOtherLandUseCo2Eq = _10[1];
25224
- var _11 = useState(0), wasteCo2 = _11[0], setWasteCo2 = _11[1];
25225
- var _12 = useState(0), wasteCh4 = _12[0], setWasteCh4 = _12[1];
25226
- var _13 = useState(0), wasteN2o = _13[0], setWasteN2o = _13[1];
25227
- var _14 = useState(0), wasteCo2Eq = _14[0], setWasteCo2Eq = _14[1];
25228
- var _15 = useState(0), otherCo2 = _15[0], setOtherCo2 = _15[1];
25229
- var _16 = useState(0), otherCh4 = _16[0], setOtherCh4 = _16[1];
25230
- var _17 = useState(0), otherN2o = _17[0], setOtherN2o = _17[1];
25231
- var _18 = useState(0), otherCo2Eq = _18[0], setOtherCo2Eq = _18[1];
25232
- var _19 = useState(false), isSavedFormDataSet = _19[0], setIsSavedFormDataSet = _19[1];
25096
+ var _a = useState([]), data = _a[0], setData = _a[1];
25097
+ var _b = useConnection(), get = _b.get, post = _b.post;
25098
+ var _c = useState(false), loading = _c[0], setLoading = _c[1];
25099
+ var _d = useState(false), isPendingFinalization = _d[0], setIsPendingFinalization = _d[1];
25100
+ var _e = useState(null); _e[0]; var setSelectedYear = _e[1];
25101
+ var _f = useState(''), uploadedFileName = _f[0], setUploadedFileName = _f[1];
25102
+ var _g = useState([]), disabledYears = _g[0], setDisabledYears = _g[1];
25103
+ var _h = useState(); _h[0]; var setChangedValues = _h[1];
25104
+ var _j = useState(0), totalNationalCo2 = _j[0], setTotalNationalCo2 = _j[1];
25105
+ var _k = useState(0), totalNationalCh4 = _k[0], setTotalNationalCh4 = _k[1];
25106
+ var _l = useState(0), totalNationalN2o = _l[0], setTotalNationalN2o = _l[1];
25107
+ var _m = useState(0), totalNationalCo2Eq = _m[0], setTotalNationalCo2Eq = _m[1];
25108
+ var _o = useState(0), energyEmissionsCo2 = _o[0], setEnergyEmissionsCo2 = _o[1];
25109
+ var _p = useState(0), energyEmissionsCh4 = _p[0], setEnergyEmissionsCh4 = _p[1];
25110
+ var _q = useState(0), energyEmissionsN2o = _q[0], setEnergyEmissionsN2o = _q[1];
25111
+ var _r = useState(0), energyEmissionsCo2Eq = _r[0], setEnergyEmissionsCo2Eq = _r[1];
25112
+ var _s = useState(0), fuelCombustionActivitiesCo2 = _s[0], setFuelCombustionActivitiesCo2 = _s[1];
25113
+ var _t = useState(0), fuelCombustionActivitiesCh4 = _t[0], setFuelCombustionActivitiesCh4 = _t[1];
25114
+ var _u = useState(0), fuelCombustionActivitiesN2o = _u[0], setFuelCombustionActivitiesN2o = _u[1];
25115
+ var _v = useState(0), fuelCombustionActivitiesCo2Eq = _v[0], setFuelCombustionActivitiesCo2Eq = _v[1];
25116
+ var _w = useState(0), fugitiveEmissionsFromFuelsCo2 = _w[0], setFugitiveEmissionsFromFuelsCo2 = _w[1];
25117
+ var _x = useState(0), fugitiveEmissionsFromFuelsCh4 = _x[0], setFugitiveEmissionsFromFuelsCh4 = _x[1];
25118
+ var _y = useState(0), fugitiveEmissionsFromFuelsN2o = _y[0], setFugitiveEmissionsFromFuelsN2o = _y[1];
25119
+ var _z = useState(0), fugitiveEmissionsFromFuelsCo2Eq = _z[0], setFugitiveEmissionsFromFuelsCo2Eq = _z[1];
25120
+ var _0 = useState(0), carbonDioxideTransportStorageCo2 = _0[0], setCarbonDioxideTransportStorageCo2 = _0[1];
25121
+ var _1 = useState(0), carbonDioxideTransportStorageCh4 = _1[0], setCarbonDioxideTransportStorageCh4 = _1[1];
25122
+ var _2 = useState(0), carbonDioxideTransportStorageN2o = _2[0], setCarbonDioxideTransportStorageN2o = _2[1];
25123
+ var _3 = useState(0), carbonDioxideTransportStorageCo2Eq = _3[0], setCarbonDioxideTransportStorageCo2Eq = _3[1];
25124
+ var _4 = useState(0), industrialProcessesProductUseCo2 = _4[0], setIndustrialProcessesProductUseCo2 = _4[1];
25125
+ var _5 = useState(0), industrialProcessesProductUseCh4 = _5[0], setIndustrialProcessesProductUseCh4 = _5[1];
25126
+ var _6 = useState(0), industrialProcessesProductUseN2o = _6[0], setIndustrialProcessesProductUseN2o = _6[1];
25127
+ var _7 = useState(0), industrialProcessesProductUseCo2Eq = _7[0], setIndustrialProcessesProductUseCo2Eq = _7[1];
25128
+ var _8 = useState(0), agricultureForestryOtherLandUseCo2 = _8[0], setAgricultureForestryOtherLandUseCo2 = _8[1];
25129
+ var _9 = useState(0), agricultureForestryOtherLandUseCh4 = _9[0], setAgricultureForestryOtherLandUseCh4 = _9[1];
25130
+ var _10 = useState(0), agricultureForestryOtherLandUseN2o = _10[0], setAgricultureForestryOtherLandUseN2o = _10[1];
25131
+ var _11 = useState(0), agricultureForestryOtherLandUseCo2Eq = _11[0], setAgricultureForestryOtherLandUseCo2Eq = _11[1];
25132
+ var _12 = useState(0), wasteCo2 = _12[0], setWasteCo2 = _12[1];
25133
+ var _13 = useState(0), wasteCh4 = _13[0], setWasteCh4 = _13[1];
25134
+ var _14 = useState(0), wasteN2o = _14[0], setWasteN2o = _14[1];
25135
+ var _15 = useState(0), wasteCo2Eq = _15[0], setWasteCo2Eq = _15[1];
25136
+ var _16 = useState(0), otherCo2 = _16[0], setOtherCo2 = _16[1];
25137
+ var _17 = useState(0), otherCh4 = _17[0], setOtherCh4 = _17[1];
25138
+ var _18 = useState(0), otherN2o = _18[0], setOtherN2o = _18[1];
25139
+ var _19 = useState(0), otherCo2Eq = _19[0], setOtherCo2Eq = _19[1];
25140
+ 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];
25233
25144
  var Panel = Collapse.Panel;
25234
25145
  var form = Form.useForm()[0];
25235
25146
  var createSetFieldObject = function (obj, objName) {
@@ -25326,17 +25237,20 @@ var GHGEmissionsComponent = function (props) {
25326
25237
  setFormValues(upData);
25327
25238
  };
25328
25239
  useEffect(function () {
25240
+ console.log('++++++++++++++data', data);
25329
25241
  var hasSaveState = data.some(function (item) { return item.state === 'SAVED'; });
25330
- var years = data.map(function (item) { return !(item.state === 'SAVED') && item.year; });
25242
+ console.log('++++++++++++++hasSaveState', hasSaveState);
25243
+ // const years = data.map((item: any) => !(item.state === 'SAVED') && item.year);
25244
+ // console.log('++++++++++++++data, years', data, years);
25331
25245
  console.log(uploadedFileName);
25332
25246
  setIsPendingFinalization(hasSaveState);
25333
25247
  // Update 'disabledYears' only if 'years' array has changed
25334
- setDisabledYears(function (prevYears) {
25335
- if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
25336
- return years;
25337
- }
25338
- return prevYears;
25339
- });
25248
+ // setDisabledYears((prevYears) => {
25249
+ // if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
25250
+ // return years;
25251
+ // }
25252
+ // return prevYears;
25253
+ // });
25340
25254
  }, [data, uploadedFileName]);
25341
25255
  var handleYearChange = function (date, dateString) {
25342
25256
  setSelectedYear(dateString);
@@ -25599,6 +25513,66 @@ var GHGEmissionsComponent = function (props) {
25599
25513
  }
25600
25514
  });
25601
25515
  }); };
25516
+ var resetForm = function () { return __awaiter(void 0, void 0, void 0, function () {
25517
+ return __generator(this, function (_a) {
25518
+ switch (_a.label) {
25519
+ case 0:
25520
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
25521
+ return [4 /*yield*/, getEmissionData()];
25522
+ case 1:
25523
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
25524
+ _a.sent();
25525
+ setOpenResetFormModal(false);
25526
+ setIsSavedFormDataSet(false);
25527
+ clearUploadDoc();
25528
+ 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);
25558
+ }
25559
+ return [2 /*return*/];
25560
+ }
25561
+ });
25562
+ }); };
25563
+ var onResetFormCanceled = function () {
25564
+ setOpenResetFormModal(false);
25565
+ };
25566
+ var onResetFormModel = function () {
25567
+ setActionInfo({
25568
+ action: "".concat(t('ghgInventory:proceed')),
25569
+ headerText: "".concat(t('ghgInventory:discardHeaderText')),
25570
+ type: 'danger',
25571
+ icon: React.createElement(CloseCircleOutlined, null),
25572
+ });
25573
+ setErrorMsg('');
25574
+ setOpenResetFormModal(true);
25575
+ };
25602
25576
  var onSubmitForm = function (values) { return __awaiter(void 0, void 0, void 0, function () {
25603
25577
  var fields, payload, response, error_1;
25604
25578
  return __generator(this, function (_a) {
@@ -25611,7 +25585,7 @@ var GHGEmissionsComponent = function (props) {
25611
25585
  setLoading(true);
25612
25586
  _a.label = 2;
25613
25587
  case 2:
25614
- _a.trys.push([2, 4, 5, 6]);
25588
+ _a.trys.push([2, 4, 5, 7]);
25615
25589
  return [4 /*yield*/, post('national/emissions', payload)];
25616
25590
  case 3:
25617
25591
  response = _a.sent();
@@ -25619,12 +25593,16 @@ var GHGEmissionsComponent = function (props) {
25619
25593
  if ((response === null || response === void 0 ? void 0 : response.statusText) === 'SUCCESS') {
25620
25594
  message.open({
25621
25595
  type: 'success',
25622
- content: (response === null || response === void 0 ? void 0 : response.status) == HttpStatusCode.Created ? t('ghgInventory:emissionCreationSuccess') : t('ghgInventory:emissionUpdateSuccess'),
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'),
25623
25601
  duration: 4,
25624
25602
  style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25625
25603
  });
25626
25604
  }
25627
- return [3 /*break*/, 6];
25605
+ return [3 /*break*/, 7];
25628
25606
  case 4:
25629
25607
  error_1 = _a.sent();
25630
25608
  console.log('Error in emission creation - ', error_1);
@@ -25634,14 +25612,66 @@ var GHGEmissionsComponent = function (props) {
25634
25612
  duration: 4,
25635
25613
  style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25636
25614
  });
25637
- return [3 /*break*/, 6];
25638
- case 5:
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
25621
+ _a.sent();
25639
25622
  setLoading(false);
25640
25623
  return [7 /*endfinally*/];
25641
- case 6: return [2 /*return*/];
25624
+ case 7: return [2 /*return*/];
25625
+ }
25626
+ });
25627
+ }); };
25628
+ var getEmissionData = function () { return __awaiter(void 0, void 0, void 0, function () {
25629
+ var response, error_2;
25630
+ return __generator(this, function (_a) {
25631
+ switch (_a.label) {
25632
+ case 0:
25633
+ setLoading(true);
25634
+ _a.label = 1;
25635
+ case 1:
25636
+ _a.trys.push([1, 3, 4, 5]);
25637
+ return [4 /*yield*/, get('national/emissions')];
25638
+ case 2:
25639
+ response = _a.sent();
25640
+ console.log('Emissions GET -> ', response);
25641
+ if (response === null || response === void 0 ? void 0 : response.data) {
25642
+ setData(response.data);
25643
+ }
25644
+ return [3 /*break*/, 5];
25645
+ case 3:
25646
+ error_2 = _a.sent();
25647
+ console.log('Error in emission fetch - ', error_2);
25648
+ message.open({
25649
+ type: 'error',
25650
+ content: error_2 === null || error_2 === void 0 ? void 0 : error_2.message,
25651
+ duration: 4,
25652
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25653
+ });
25654
+ return [3 /*break*/, 5];
25655
+ case 4:
25656
+ setLoading(false);
25657
+ return [7 /*endfinally*/];
25658
+ case 5: return [2 /*return*/];
25642
25659
  }
25643
25660
  });
25644
25661
  }); };
25662
+ useEffect(function () {
25663
+ var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {
25664
+ return __generator(this, function (_a) {
25665
+ switch (_a.label) {
25666
+ case 0: return [4 /*yield*/, getEmissionData()];
25667
+ case 1:
25668
+ _a.sent();
25669
+ return [2 /*return*/];
25670
+ }
25671
+ });
25672
+ }); };
25673
+ fetchData();
25674
+ }, []);
25645
25675
  var setFormValues = function (emissionObject) {
25646
25676
  if (emissionObject.year) {
25647
25677
  form.setFieldsValue({ year: moment(emissionObject.year, 'YYYY') });
@@ -25694,12 +25724,23 @@ var GHGEmissionsComponent = function (props) {
25694
25724
  setIsSavedFormDataSet(true);
25695
25725
  };
25696
25726
  useEffect(function () {
25697
- if (isPendingFinalization) {
25698
- if (!isSavedFormDataSet) {
25699
- var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
25727
+ // if (isPendingFinalization) {
25728
+ if (!isSavedFormDataSet) {
25729
+ var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
25730
+ if (savedData && savedData.length > 0) {
25700
25731
  setFormValues(savedData[0]);
25701
25732
  }
25702
25733
  }
25734
+ var years = data
25735
+ .filter(function (item) { return !(item.state === 'SAVED' && item.year); }) // Filter out items where state is not 'SAVED'
25736
+ .map(function (item) { return parseInt(item.year); });
25737
+ // Update 'disabledYears' only if 'years' array has changed
25738
+ setDisabledYears(function (prevYears) {
25739
+ if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
25740
+ return years;
25741
+ }
25742
+ return prevYears;
25743
+ });
25703
25744
  }, [data]);
25704
25745
  var checkFile = function (file) {
25705
25746
  var isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
@@ -25715,6 +25756,12 @@ var GHGEmissionsComponent = function (props) {
25715
25756
  }
25716
25757
  return e === null || e === void 0 ? void 0 : e.fileList;
25717
25758
  };
25759
+ var clearUploadDoc = function () {
25760
+ setUploadedFileName('');
25761
+ form.setFieldsValue({
25762
+ emissionsDocument: null,
25763
+ });
25764
+ };
25718
25765
  var isYearDisabled = function (current) {
25719
25766
  return disabledYears.includes(current.year());
25720
25767
  };
@@ -26174,25 +26221,26 @@ var GHGEmissionsComponent = function (props) {
26174
26221
  React.createElement("div", { className: "body-sub-title" }, t("ghgInventory:totalNationalEmissionSubTitle")))),
26175
26222
  React.createElement("div", { className: "content-card add-emission" },
26176
26223
  React.createElement(Tabs, { defaultActiveKey: "Add New", centered: true },
26177
- ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT || (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY) && (React.createElement(Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
26224
+ ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT ||
26225
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY) && (React.createElement(Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
26178
26226
  React.createElement("div", null,
26179
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 },
26180
26228
  React.createElement(Row, null,
26181
26229
  React.createElement(Col, { xl: 12, md: 12, className: "add-new-year-picker-col" },
26182
26230
  React.createElement("div", null,
26183
- React.createElement(Form.Item, { label: t("ghgInventory:year"), name: "year", rules: [
26231
+ React.createElement(Form.Item, { label: t('ghgInventory:year'), name: "year", rules: [
26184
26232
  {
26185
26233
  required: true,
26186
- message: "",
26234
+ message: '',
26187
26235
  },
26188
26236
  {
26189
26237
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
26190
26238
  return __generator(this, function (_a) {
26191
- if (String(value).trim() === "" ||
26239
+ if (String(value).trim() === '' ||
26192
26240
  String(value).trim() === undefined ||
26193
26241
  value === null ||
26194
26242
  value === undefined) {
26195
- throw new Error("".concat(t("ghgInventory:year"), " ").concat(t("isRequired")));
26243
+ throw new Error("".concat(t('ghgInventory:year'), " ").concat(t('isRequired')));
26196
26244
  }
26197
26245
  return [2 /*return*/];
26198
26246
  });
@@ -26256,7 +26304,7 @@ var GHGEmissionsComponent = function (props) {
26256
26304
  } },
26257
26305
  React.createElement(Button, { icon: React.createElement(UploadOutlined, null) }, t("ghgInventory:upload"))))),
26258
26306
  React.createElement(Col, { xl: 16, md: 16, className: "add-new-upload-file-name-input" },
26259
- React.createElement(Input, { value: uploadedFileName, readOnly: true }))))),
26307
+ React.createElement(Input, { value: uploadedFileName, readOnly: true, suffix: uploadedFileName && (React.createElement(Button, { onClick: clearUploadDoc, icon: React.createElement(DeleteOutlined, null), style: { marginRight: '-10px', padding: '0px 6px' } })) }))))),
26260
26308
  React.createElement(Row, { gutter: 16 },
26261
26309
  React.createElement(Col, { span: 9, offset: 12 },
26262
26310
  React.createElement(Row, { gutter: 16, className: "table-heading-row" },
@@ -26341,9 +26389,7 @@ var GHGEmissionsComponent = function (props) {
26341
26389
  React.createElement(InputNumber, null)))))),
26342
26390
  React.createElement("div", { className: "steps-actions" },
26343
26391
  React.createElement(Button, { type: "primary", htmlType: "submit", loading: loading }, "Submit"),
26344
- React.createElement(Button, { className: "back-btn",
26345
- // onClick={() => prevOne()}
26346
- loading: loading }, "Cancel")))))),
26392
+ React.createElement(Button, { className: "back-btn", onClick: onResetFormModel, loading: loading }, "Cancel")))))),
26347
26393
  data.map(function (tabData) {
26348
26394
  return tabData.state === 'FINALIZED' && (React.createElement(Tabs.TabPane, { key: tabData.id.toString(), tab: React.createElement("span", null,
26349
26395
  tabData.year,
@@ -26454,10 +26500,11 @@ var GHGEmissionsComponent = function (props) {
26454
26500
  })));
26455
26501
  })));
26456
26502
  })))));
26457
- }))))));
26503
+ })))),
26504
+ React.createElement(DiscardChangesConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: resetForm, onActionCanceled: onResetFormCanceled, openModal: openResetFormModal, errorMsg: errorMsg, loading: loading })));
26458
26505
  };
26459
26506
 
26460
- var css_248z = ".ant-tabs-tab-btn {\n padding: 5px 30px;\n text-align: center;\n font-weight: 600;\n color: rgba(58, 53, 65, 0.5); }\n\n.projection-tab-container .add-projection {\n display: flex;\n flex-direction: column;\n background-color: #ffffff;\n margin: 1rem 0 1rem 0;\n border-radius: 10px;\n padding: 0 1.5rem 2.5rem 1.5rem; }\n .projection-tab-container .add-projection .add-new-year-picker-col {\n padding-left: 5%; }\n .projection-tab-container .add-projection .ant-picker {\n border-radius: 5px !important;\n height: 50px !important;\n width: 80%; }\n .projection-tab-container .add-projection .add-new-upload-file-label {\n color: rgba(58, 53, 65, 0.5);\n padding: 0 0 8px;\n line-height: 1.5715;\n white-space: initial;\n text-align: left; }\n .projection-tab-container .add-projection .add-new-upload-file-name-input input {\n height: 50px; }\n .projection-tab-container .add-projection .add-new-upload-file-inner-col button {\n height: 50px;\n font-size: 11px;\n width: 120px; }\n .projection-tab-container .add-projection .table-heading-row {\n padding-top: 20px;\n padding-bottom: 25px;\n margin-left: 10px !important; }\n .projection-tab-container .add-projection .table-heading-row .table-heading-col {\n text-align: center;\n font-size: 16px;\n font-weight: 600;\n color: #28282899; }\n .projection-tab-container .add-projection .total-emission-row {\n padding: 12px 16px;\n margin-left: 30px !important; }\n .projection-tab-container .add-projection .total-emission-row span {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .total-emission-row .total-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .projection-tab-container .add-projection .panel-header-col {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .panel-header-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .projection-tab-container .add-projection .sub-panel .panel-header-emission-value-col {\n border-bottom: none !important;\n padding-bottom: 10px; }\n .projection-tab-container .add-projection .sub-panel-heading {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n margin-top: 35px; }\n .projection-tab-container .add-projection .sub-panel-heading .panel-header-col {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .ant-collapse-ghost > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box {\n padding-top: 0px;\n padding-bottom: 12px;\n margin-left: 25px; }\n .projection-tab-container .add-projection .ant-collapse-expand-icon {\n margin-top: 5px; }\n .projection-tab-container .add-projection .ant-collapse-expand-icon svg {\n font-size: 20px;\n color: #976ED7; }\n .projection-tab-container .add-projection .ant-collapse {\n margin-left: 10px; }\n .projection-tab-container .add-projection .co2-total-pill {\n border-radius: 20px;\n background-color: rgba(145, 85, 253, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .ch4-total-pill {\n border-radius: 20px;\n background-color: rgba(217, 217, 217, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .n2o-total-pill {\n border-radius: 20px;\n background-color: rgba(185, 226, 244, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .co2eq-total-pill {\n border-radius: 20px;\n background-color: rgba(255, 166, 166, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .panel-content-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n height: 68px;\n align-items: center; }\n .projection-tab-container .add-projection .panel-content-row .panel-content-title {\n font-size: 16px;\n font-weight: 500;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .panel-content-input-box-row {\n margin-top: 14px; }\n .projection-tab-container .add-projection .panel-content-input-box-row .ant-input-number {\n height: 40px;\n width: 50px;\n margin-left: 25%; }\n .projection-tab-container .add-projection .total-co2-without-land-row {\n margin-left: 40px !important;\n align-items: center;\n margin-top: 50px; }\n .projection-tab-container .add-projection .total-co2-without-land-row .total-co2-without-land-title {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .total-co2-without-land-row .panel-content-input-box-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6); }\n .projection-tab-container .add-projection .total-co2-with-land-row {\n margin-left: 40px !important;\n align-items: center; }\n .projection-tab-container .add-projection .total-co2-with-land-row .total-co2-with-land-title {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .total-co2-with-land-row .panel-content-input-box-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6); }\n .projection-tab-container .add-projection .steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n margin-top: 3rem; }\n .projection-tab-container .add-projection .steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .projection-tab-container .add-projection .steps-actions .back-btn {\n border: 1px solid rgba(140, 140, 140, 0.7);\n color: rgba(140, 140, 140, 0.7);\n margin-right: 1rem; }\n .projection-tab-container .add-projection .steps-actions .mg-left-1 {\n margin-left: 1rem; }\n";
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";
26461
26508
  styleInject(css_248z);
26462
26509
 
26463
26510
  var ProjectionTypes = {
@@ -26469,403 +26516,45 @@ var ProjectionTypes = {
26469
26516
  var GHGProjectionsComponent = function (props) {
26470
26517
  var t = props.t, useUserContext = props.useUserContext, useConnection = props.useConnection;
26471
26518
  var userInfoState = useUserContext().userInfoState;
26472
- var data = [
26473
- {
26474
- id: 1,
26475
- country: 'NG',
26476
- year: 2023,
26477
- energyEmissions: {
26478
- fuelCombustionActivities: {
26479
- energyIndustries: {
26480
- bau: 20,
26481
- conditionalNdc: 15,
26482
- unconditionalNdc: 332,
26483
- },
26484
- manufacturingIndustriesConstruction: {
26485
- bau: 20,
26486
- conditionalNdc: 15,
26487
- unconditionalNdc: 33,
26488
- },
26489
- transport: {
26490
- bau: 20,
26491
- conditionalNdc: 15,
26492
- unconditionalNdc: 33,
26493
- },
26494
- otherSectors: {
26495
- bau: 20,
26496
- conditionalNdc: 15,
26497
- unconditionalNdc: 33,
26498
- },
26499
- nonSpecified: {
26500
- bau: 20,
26501
- conditionalNdc: 15,
26502
- unconditionalNdc: 33,
26503
- },
26504
- },
26505
- fugitiveEmissionsFromFuels: {
26506
- solidFuels: {
26507
- bau: 20,
26508
- conditionalNdc: 15,
26509
- unconditionalNdc: 33,
26510
- },
26511
- oilNaturalGas: {
26512
- bau: 20,
26513
- conditionalNdc: 15,
26514
- unconditionalNdc: 33,
26515
- },
26516
- otherEmissionsEnergyProduction: {
26517
- bau: 20,
26518
- conditionalNdc: 15,
26519
- unconditionalNdc: 33,
26520
- },
26521
- },
26522
- carbonDioxideTransportStorage: {
26523
- transportOfCo2: {
26524
- bau: 20,
26525
- conditionalNdc: 15,
26526
- unconditionalNdc: 33,
26527
- },
26528
- injectionStorage: {
26529
- bau: 20,
26530
- conditionalNdc: 15,
26531
- unconditionalNdc: 33,
26532
- },
26533
- other: {
26534
- bau: 20,
26535
- conditionalNdc: 15,
26536
- unconditionalNdc: 33,
26537
- },
26538
- },
26539
- },
26540
- industrialProcessesProductUse: {
26541
- mineralIndustry: {
26542
- bau: 20,
26543
- conditionalNdc: 15,
26544
- unconditionalNdc: 33,
26545
- },
26546
- chemicalIndustry: {
26547
- bau: 20,
26548
- conditionalNdc: 15,
26549
- unconditionalNdc: 33,
26550
- },
26551
- metalIndustry: {
26552
- bau: 20,
26553
- conditionalNdc: 15,
26554
- unconditionalNdc: 33,
26555
- },
26556
- nonEnergyProductsFuelsSolventUse: {
26557
- bau: 20,
26558
- conditionalNdc: 15,
26559
- unconditionalNdc: 33,
26560
- },
26561
- electronicsIndustry: {
26562
- bau: 20,
26563
- conditionalNdc: 15,
26564
- unconditionalNdc: 33,
26565
- },
26566
- productUsesSubstOzoneDepletingSubs: {
26567
- bau: 20,
26568
- conditionalNdc: 15,
26569
- unconditionalNdc: 33,
26570
- },
26571
- otherProductManufactureUse: {
26572
- bau: 20,
26573
- conditionalNdc: 15,
26574
- unconditionalNdc: 33,
26575
- },
26576
- other: {
26577
- bau: 20,
26578
- conditionalNdc: 15,
26579
- unconditionalNdc: 33,
26580
- },
26581
- },
26582
- agricultureForestryOtherLandUse: {
26583
- livestock: { bau: 20, conditionalNdc: 15, unconditionalNdc: 33 },
26584
- land: {
26585
- bau: 20,
26586
- conditionalNdc: 15,
26587
- unconditionalNdc: 33,
26588
- },
26589
- aggregateNonCo2SourcesLand: {
26590
- bau: 20,
26591
- conditionalNdc: 15,
26592
- unconditionalNdc: 33,
26593
- },
26594
- other: {
26595
- bau: 20,
26596
- conditionalNdc: 15,
26597
- unconditionalNdc: 33,
26598
- },
26599
- },
26600
- waste: {
26601
- solidWasteDisposal: {
26602
- bau: 20,
26603
- conditionalNdc: 15,
26604
- unconditionalNdc: 33,
26605
- },
26606
- biologicalTreatmentSolidWaste: {
26607
- bau: 20,
26608
- conditionalNdc: 15,
26609
- unconditionalNdc: 33,
26610
- },
26611
- incinerationOpenBurningWaste: {
26612
- bau: 20,
26613
- conditionalNdc: 15,
26614
- unconditionalNdc: 33,
26615
- },
26616
- wastewaterTreatmentDischarge: {
26617
- bau: 20,
26618
- conditionalNdc: 15,
26619
- unconditionalNdc: 33,
26620
- },
26621
- other: {
26622
- bau: 20,
26623
- conditionalNdc: 15,
26624
- unconditionalNdc: 33,
26625
- },
26626
- },
26627
- other: {
26628
- indirectN2oEmissions: {
26629
- bau: 20,
26630
- conditionalNdc: 15,
26631
- unconditionalNdc: 33,
26632
- },
26633
- other: {
26634
- bau: 20,
26635
- conditionalNdc: 15,
26636
- unconditionalNdc: 33,
26637
- },
26638
- },
26639
- totalCo2WithoutLand: {
26640
- bau: 20,
26641
- conditionalNdc: 15,
26642
- unconditionalNdc: 33,
26643
- },
26644
- totalCo2WithLand: {
26645
- bau: 20,
26646
- conditionalNdc: 15,
26647
- unconditionalNdc: 33,
26648
- },
26649
- state: 'FINALIZED',
26650
- version: 1,
26651
- created_at: 1698644100397,
26652
- },
26653
- {
26654
- id: 2,
26655
- country: 'NG',
26656
- year: 2022,
26657
- energyEmissions: {
26658
- fuelCombustionActivities: {
26659
- energyIndustries: {
26660
- bau: 20,
26661
- conditionalNdc: 15,
26662
- unconditionalNdc: 33,
26663
- },
26664
- manufacturingIndustriesConstruction: {
26665
- bau: 20,
26666
- conditionalNdc: 15,
26667
- unconditionalNdc: 33,
26668
- },
26669
- transport: {
26670
- bau: 20,
26671
- conditionalNdc: 15,
26672
- unconditionalNdc: 33,
26673
- },
26674
- otherSectors: {
26675
- bau: 20,
26676
- conditionalNdc: 15,
26677
- unconditionalNdc: 33,
26678
- },
26679
- nonSpecified: {
26680
- bau: 20,
26681
- conditionalNdc: 15,
26682
- unconditionalNdc: 33,
26683
- },
26684
- },
26685
- fugitiveEmissionsFromFuels: {
26686
- solidFuels: {
26687
- bau: 20,
26688
- conditionalNdc: 15,
26689
- unconditionalNdc: 33,
26690
- },
26691
- oilNaturalGas: {
26692
- bau: 20,
26693
- conditionalNdc: 15,
26694
- unconditionalNdc: 33,
26695
- },
26696
- otherEmissionsEnergyProduction: {
26697
- bau: 20,
26698
- conditionalNdc: 15,
26699
- unconditionalNdc: 33,
26700
- },
26701
- },
26702
- carbonDioxideTransportStorage: {
26703
- transportOfCo2: {
26704
- bau: 20,
26705
- conditionalNdc: 15,
26706
- unconditionalNdc: 33,
26707
- },
26708
- injectionStorage: {
26709
- bau: 20,
26710
- conditionalNdc: 15,
26711
- unconditionalNdc: 33,
26712
- },
26713
- other: {
26714
- bau: 20,
26715
- conditionalNdc: 15,
26716
- unconditionalNdc: 33,
26717
- },
26718
- },
26719
- },
26720
- industrialProcessesProductUse: {
26721
- mineralIndustry: {
26722
- bau: 20,
26723
- conditionalNdc: 15,
26724
- unconditionalNdc: 33,
26725
- },
26726
- chemicalIndustry: {
26727
- bau: 20,
26728
- conditionalNdc: 15,
26729
- unconditionalNdc: 33,
26730
- },
26731
- metalIndustry: {
26732
- bau: 20,
26733
- conditionalNdc: 15,
26734
- unconditionalNdc: 33,
26735
- },
26736
- nonEnergyProductsFuelsSolventUse: {
26737
- bau: 20,
26738
- conditionalNdc: 15,
26739
- unconditionalNdc: 33,
26740
- },
26741
- electronicsIndustry: {
26742
- bau: 20,
26743
- conditionalNdc: 15,
26744
- unconditionalNdc: 33,
26745
- },
26746
- productUsesSubstOzoneDepletingSubs: {
26747
- bau: 20,
26748
- conditionalNdc: 15,
26749
- unconditionalNdc: 33,
26750
- },
26751
- otherProductManufactureUse: {
26752
- bau: 20,
26753
- conditionalNdc: 15,
26754
- unconditionalNdc: 33,
26755
- },
26756
- other: {
26757
- bau: 20,
26758
- conditionalNdc: 15,
26759
- unconditionalNdc: 33,
26760
- },
26761
- },
26762
- agricultureForestryOtherLandUse: {
26763
- livestock: { bau: 20, conditionalNdc: 15, unconditionalNdc: 33 },
26764
- land: {
26765
- bau: 20,
26766
- conditionalNdc: 15,
26767
- unconditionalNdc: 33,
26768
- },
26769
- aggregateNonCo2SourcesLand: {
26770
- bau: 20,
26771
- conditionalNdc: 15,
26772
- unconditionalNdc: 33,
26773
- },
26774
- other: {
26775
- bau: 20,
26776
- conditionalNdc: 15,
26777
- unconditionalNdc: 33,
26778
- },
26779
- },
26780
- waste: {
26781
- solidWasteDisposal: {
26782
- bau: 20,
26783
- conditionalNdc: 15,
26784
- unconditionalNdc: 33,
26785
- },
26786
- biologicalTreatmentSolidWaste: {
26787
- bau: 20,
26788
- conditionalNdc: 15,
26789
- unconditionalNdc: 33,
26790
- },
26791
- incinerationOpenBurningWaste: {
26792
- bau: 20,
26793
- conditionalNdc: 15,
26794
- unconditionalNdc: 33,
26795
- },
26796
- wastewaterTreatmentDischarge: {
26797
- bau: 20,
26798
- conditionalNdc: 15,
26799
- unconditionalNdc: 33,
26800
- },
26801
- other: {
26802
- bau: 20,
26803
- conditionalNdc: 15,
26804
- unconditionalNdc: 33,
26805
- },
26806
- },
26807
- other: {
26808
- indirectN2oEmissions: {
26809
- bau: 20,
26810
- conditionalNdc: 15,
26811
- unconditionalNdc: 33,
26812
- },
26813
- other: {
26814
- bau: 20,
26815
- conditionalNdc: 15,
26816
- unconditionalNdc: 33,
26817
- },
26818
- },
26819
- totalCo2WithoutLand: {
26820
- bau: 20,
26821
- conditionalNdc: 15,
26822
- unconditionalNdc: 33,
26823
- },
26824
- totalCo2WithLand: {
26825
- bau: 20,
26826
- conditionalNdc: 15,
26827
- unconditionalNdc: 33,
26828
- },
26829
- state: 'FINALIZED',
26830
- version: 1,
26831
- created_at: 1698644100397,
26832
- },
26833
- ];
26834
- var _a = useConnection(); _a.put; _a.get; var post = _a.post;
26835
- var _b = useState(false), loading = _b[0], setLoading = _b[1];
26836
- var _c = useState(false), isPendingFinalization = _c[0], setIsPendingFinalization = _c[1];
26837
- var _d = useState(null); _d[0]; var setSelectedYear = _d[1];
26838
- var _e = useState(''), uploadedFileName = _e[0], setUploadedFileName = _e[1];
26839
- var _f = useState([]), disabledYears = _f[0], setDisabledYears = _f[1];
26840
- var _g = useState(); _g[0]; var setChangedValues = _g[1];
26841
- var _h = useState(0), totalNationalBau = _h[0], setTotalNationalBau = _h[1];
26842
- var _j = useState(0), totalNationalConditionalNdc = _j[0], setTotalNationalConditionalNdc = _j[1];
26843
- var _k = useState(0), totalNationalUnconditionalNdc = _k[0], setTotalNationalUnconditionalNdc = _k[1];
26844
- var _l = useState(0), energyEmissionsBau = _l[0], setEnergyEmissionsBau = _l[1];
26845
- var _m = useState(0), energyEmissionsConditionalNdc = _m[0], setEnergyEmissionsConditionalNdc = _m[1];
26846
- var _o = useState(0), energyEmissionsUnconditionalNdc = _o[0], setEnergyEmissionsUnconditionalNdc = _o[1];
26847
- var _p = useState(0), fuelCombustionActivitiesBau = _p[0], setFuelCombustionActivitiesBau = _p[1];
26848
- var _q = useState(0), fuelCombustionActivitiesConditionalNdc = _q[0], setFuelCombustionActivitiesConditionalNdc = _q[1];
26849
- var _r = useState(0), fuelCombustionActivitiesUnconditionalNdc = _r[0], setFuelCombustionActivitiesUnconditionalNdc = _r[1];
26850
- var _s = useState(0), fugitiveEmissionsFromFuelsBau = _s[0], setFugitiveEmissionsFromFuelsBau = _s[1];
26851
- var _t = useState(0), fugitiveEmissionsFromFuelsConditionalNdc = _t[0], setFugitiveEmissionsFromFuelsConditionalNdc = _t[1];
26852
- var _u = useState(0), fugitiveEmissionsFromFuelsUnconditionalNdc = _u[0], setFugitiveEmissionsFromFuelsUnconditionalNdc = _u[1];
26853
- var _v = useState(0), carbonDioxideTransportStorageBau = _v[0], setCarbonDioxideTransportStorageBau = _v[1];
26854
- var _w = useState(0), carbonDioxideTransportStorageConditionalNdc = _w[0], setCarbonDioxideTransportStorageConditionalNdc = _w[1];
26855
- var _x = useState(0), carbonDioxideTransportStorageUnconditionalNdc = _x[0], setCarbonDioxideTransportStorageUnconditionalNdc = _x[1];
26856
- var _y = useState(0), industrialProcessesProductUseBau = _y[0], setIndustrialProcessesProductUseBau = _y[1];
26857
- var _z = useState(0), industrialProcessesProductUseConditionalNdc = _z[0], setIndustrialProcessesProductUseConditionalNdc = _z[1];
26858
- var _0 = useState(0), industrialProcessesProductUseUnconditionalNdc = _0[0], setIndustrialProcessesProductUseUnconditionalNdc = _0[1];
26859
- var _1 = useState(0), agricultureForestryOtherLandUseBau = _1[0], setAgricultureForestryOtherLandUseBau = _1[1];
26860
- var _2 = useState(0), agricultureForestryOtherLandUseConditionalNdc = _2[0], setAgricultureForestryOtherLandUseConditionalNdc = _2[1];
26861
- var _3 = useState(0), agricultureForestryOtherLandUseUnconditionalNdc = _3[0], setAgricultureForestryOtherLandUseUnconditionalNdc = _3[1];
26862
- var _4 = useState(0), wasteBau = _4[0], setWasteBau = _4[1];
26863
- var _5 = useState(0), wasteConditionalNdc = _5[0], setWasteConditionalNdc = _5[1];
26864
- var _6 = useState(0), wasteUnconditionalNdc = _6[0], setWasteUnconditionalNdc = _6[1];
26865
- var _7 = useState(0), otherBau = _7[0], setOtherBau = _7[1];
26866
- var _8 = useState(0), otherConditionalNdc = _8[0], setOtherConditionalNdc = _8[1];
26867
- var _9 = useState(0), otherUnconditionalNdc = _9[0], setOtherUnconditionalNdc = _9[1];
26868
- var _10 = useState(false), isSavedFormDataSet = _10[0], setIsSavedFormDataSet = _10[1];
26519
+ var _a = useState([]), data = _a[0], setData = _a[1];
26520
+ var _b = useConnection(); _b.put; var get = _b.get, post = _b.post;
26521
+ var _c = useState(false), loading = _c[0], setLoading = _c[1];
26522
+ var _d = useState(false), isPendingFinalization = _d[0], setIsPendingFinalization = _d[1];
26523
+ var _e = useState(null); _e[0]; var setSelectedYear = _e[1];
26524
+ var _f = useState(''), uploadedFileName = _f[0], setUploadedFileName = _f[1];
26525
+ var _g = useState([]), disabledYears = _g[0], setDisabledYears = _g[1];
26526
+ var _h = useState(); _h[0]; var setChangedValues = _h[1];
26527
+ var _j = useState(0), totalNationalBau = _j[0], setTotalNationalBau = _j[1];
26528
+ var _k = useState(0), totalNationalConditionalNdc = _k[0], setTotalNationalConditionalNdc = _k[1];
26529
+ var _l = useState(0), totalNationalUnconditionalNdc = _l[0], setTotalNationalUnconditionalNdc = _l[1];
26530
+ var _m = useState(0), energyEmissionsBau = _m[0], setEnergyEmissionsBau = _m[1];
26531
+ var _o = useState(0), energyEmissionsConditionalNdc = _o[0], setEnergyEmissionsConditionalNdc = _o[1];
26532
+ var _p = useState(0), energyEmissionsUnconditionalNdc = _p[0], setEnergyEmissionsUnconditionalNdc = _p[1];
26533
+ var _q = useState(0), fuelCombustionActivitiesBau = _q[0], setFuelCombustionActivitiesBau = _q[1];
26534
+ var _r = useState(0), fuelCombustionActivitiesConditionalNdc = _r[0], setFuelCombustionActivitiesConditionalNdc = _r[1];
26535
+ var _s = useState(0), fuelCombustionActivitiesUnconditionalNdc = _s[0], setFuelCombustionActivitiesUnconditionalNdc = _s[1];
26536
+ var _t = useState(0), fugitiveEmissionsFromFuelsBau = _t[0], setFugitiveEmissionsFromFuelsBau = _t[1];
26537
+ var _u = useState(0), fugitiveEmissionsFromFuelsConditionalNdc = _u[0], setFugitiveEmissionsFromFuelsConditionalNdc = _u[1];
26538
+ var _v = useState(0), fugitiveEmissionsFromFuelsUnconditionalNdc = _v[0], setFugitiveEmissionsFromFuelsUnconditionalNdc = _v[1];
26539
+ var _w = useState(0), carbonDioxideTransportStorageBau = _w[0], setCarbonDioxideTransportStorageBau = _w[1];
26540
+ var _x = useState(0), carbonDioxideTransportStorageConditionalNdc = _x[0], setCarbonDioxideTransportStorageConditionalNdc = _x[1];
26541
+ var _y = useState(0), carbonDioxideTransportStorageUnconditionalNdc = _y[0], setCarbonDioxideTransportStorageUnconditionalNdc = _y[1];
26542
+ var _z = useState(0), industrialProcessesProductUseBau = _z[0], setIndustrialProcessesProductUseBau = _z[1];
26543
+ var _0 = useState(0), industrialProcessesProductUseConditionalNdc = _0[0], setIndustrialProcessesProductUseConditionalNdc = _0[1];
26544
+ var _1 = useState(0), industrialProcessesProductUseUnconditionalNdc = _1[0], setIndustrialProcessesProductUseUnconditionalNdc = _1[1];
26545
+ var _2 = useState(0), agricultureForestryOtherLandUseBau = _2[0], setAgricultureForestryOtherLandUseBau = _2[1];
26546
+ var _3 = useState(0), agricultureForestryOtherLandUseConditionalNdc = _3[0], setAgricultureForestryOtherLandUseConditionalNdc = _3[1];
26547
+ var _4 = useState(0), agricultureForestryOtherLandUseUnconditionalNdc = _4[0], setAgricultureForestryOtherLandUseUnconditionalNdc = _4[1];
26548
+ var _5 = useState(0), wasteBau = _5[0], setWasteBau = _5[1];
26549
+ var _6 = useState(0), wasteConditionalNdc = _6[0], setWasteConditionalNdc = _6[1];
26550
+ var _7 = useState(0), wasteUnconditionalNdc = _7[0], setWasteUnconditionalNdc = _7[1];
26551
+ var _8 = useState(0), otherBau = _8[0], setOtherBau = _8[1];
26552
+ var _9 = useState(0), otherConditionalNdc = _9[0], setOtherConditionalNdc = _9[1];
26553
+ var _10 = useState(0), otherUnconditionalNdc = _10[0], setOtherUnconditionalNdc = _10[1];
26554
+ 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];
26869
26558
  var Panel = Collapse.Panel;
26870
26559
  var form = Form.useForm()[0];
26871
26560
  var createSetFieldObject = function (obj, objName) {
@@ -26965,17 +26654,20 @@ var GHGProjectionsComponent = function (props) {
26965
26654
  setFormValues(upData);
26966
26655
  };
26967
26656
  useEffect(function () {
26657
+ console.log('++++++++++++++data', data);
26968
26658
  var hasSaveState = data.some(function (item) { return item.state === 'SAVED'; });
26969
- var years = data.map(function (item) { return !(item.state === 'SAVED') && item.year; });
26659
+ console.log('++++++++++++++hasSaveState', hasSaveState);
26660
+ // const years = data.map((item: any) => !(item.state === 'SAVED') && item.year);
26661
+ // console.log('++++++++++++++data, years', data, years);
26970
26662
  console.log(uploadedFileName);
26971
26663
  setIsPendingFinalization(hasSaveState);
26972
26664
  // Update 'disabledYears' only if 'years' array has changed
26973
- setDisabledYears(function (prevYears) {
26974
- if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
26975
- return years;
26976
- }
26977
- return prevYears;
26978
- });
26665
+ // setDisabledYears((prevYears) => {
26666
+ // if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
26667
+ // return years;
26668
+ // }
26669
+ // return prevYears;
26670
+ // });
26979
26671
  }, [data, uploadedFileName]);
26980
26672
  function calculateSumEmissionView(obj, conditionType) {
26981
26673
  var sum = 0;
@@ -27204,8 +26896,108 @@ var GHGProjectionsComponent = function (props) {
27204
26896
  }
27205
26897
  });
27206
26898
  }); };
26899
+ var resetForm = function () { return __awaiter(void 0, void 0, void 0, function () {
26900
+ return __generator(this, function (_a) {
26901
+ switch (_a.label) {
26902
+ case 0:
26903
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
26904
+ return [4 /*yield*/, getProjectionData()];
26905
+ case 1:
26906
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
26907
+ _a.sent();
26908
+ setOpenResetFormModal(false);
26909
+ setIsSavedFormDataSet(false);
26910
+ clearUploadDoc();
26911
+ 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);
26934
+ }
26935
+ return [2 /*return*/];
26936
+ }
26937
+ });
26938
+ }); };
26939
+ var onResetFormCanceled = function () {
26940
+ setOpenResetFormModal(false);
26941
+ };
26942
+ var onResetFormModel = function () {
26943
+ setActionInfo({
26944
+ action: "".concat(t('ghgInventory:proceed')),
26945
+ headerText: "".concat(t('ghgInventory:discardHeaderText')),
26946
+ type: 'danger',
26947
+ icon: React.createElement(CloseCircleOutlined, null),
26948
+ });
26949
+ setErrorMsg('');
26950
+ setOpenResetFormModal(true);
26951
+ };
26952
+ var getProjectionData = function () { return __awaiter(void 0, void 0, void 0, function () {
26953
+ var response, error_1;
26954
+ return __generator(this, function (_a) {
26955
+ switch (_a.label) {
26956
+ case 0:
26957
+ setLoading(true);
26958
+ _a.label = 1;
26959
+ case 1:
26960
+ _a.trys.push([1, 3, 4, 5]);
26961
+ return [4 /*yield*/, get('national/projections')];
26962
+ case 2:
26963
+ response = _a.sent();
26964
+ console.log('Projection GET -> ', response);
26965
+ if (response === null || response === void 0 ? void 0 : response.data) {
26966
+ setData(response.data);
26967
+ }
26968
+ return [3 /*break*/, 5];
26969
+ case 3:
26970
+ error_1 = _a.sent();
26971
+ console.log('Error in projection fetch - ', error_1);
26972
+ message.open({
26973
+ type: 'error',
26974
+ content: error_1 === null || error_1 === void 0 ? void 0 : error_1.message,
26975
+ duration: 4,
26976
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
26977
+ });
26978
+ return [3 /*break*/, 5];
26979
+ case 4:
26980
+ setLoading(false);
26981
+ return [7 /*endfinally*/];
26982
+ case 5: return [2 /*return*/];
26983
+ }
26984
+ });
26985
+ }); };
26986
+ useEffect(function () {
26987
+ var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {
26988
+ return __generator(this, function (_a) {
26989
+ switch (_a.label) {
26990
+ case 0: return [4 /*yield*/, getProjectionData()];
26991
+ case 1:
26992
+ _a.sent();
26993
+ return [2 /*return*/];
26994
+ }
26995
+ });
26996
+ }); };
26997
+ fetchData();
26998
+ }, []);
27207
26999
  var onSubmitForm = function (values) { return __awaiter(void 0, void 0, void 0, function () {
27208
- var fields, payload, response, error_1;
27000
+ var fields, payload, response, error_2;
27209
27001
  return __generator(this, function (_a) {
27210
27002
  switch (_a.label) {
27211
27003
  case 0:
@@ -27231,16 +27023,17 @@ var GHGProjectionsComponent = function (props) {
27231
27023
  }
27232
27024
  return [3 /*break*/, 6];
27233
27025
  case 4:
27234
- error_1 = _a.sent();
27235
- console.log('Error in projection creation - ', error_1);
27026
+ error_2 = _a.sent();
27027
+ console.log('Error in projection creation - ', error_2);
27236
27028
  message.open({
27237
27029
  type: 'error',
27238
- content: error_1 === null || error_1 === void 0 ? void 0 : error_1.message,
27030
+ content: error_2 === null || error_2 === void 0 ? void 0 : error_2.message,
27239
27031
  duration: 4,
27240
27032
  style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
27241
27033
  });
27242
27034
  return [3 /*break*/, 6];
27243
27035
  case 5:
27036
+ getProjectionData();
27244
27037
  setLoading(false);
27245
27038
  return [7 /*endfinally*/];
27246
27039
  case 6: return [2 /*return*/];
@@ -27290,12 +27083,23 @@ var GHGProjectionsComponent = function (props) {
27290
27083
  setIsSavedFormDataSet(true);
27291
27084
  };
27292
27085
  useEffect(function () {
27293
- if (isPendingFinalization) {
27294
- if (!isSavedFormDataSet) {
27295
- var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
27086
+ // if (isPendingFinalization) {
27087
+ if (!isSavedFormDataSet) {
27088
+ var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
27089
+ if (savedData && savedData.length > 0) {
27296
27090
  setFormValues(savedData[0]);
27297
27091
  }
27298
27092
  }
27093
+ var years = data
27094
+ .filter(function (item) { return !(item.state === 'SAVED' && item.year); }) // Filter out items where state is not 'SAVED'
27095
+ .map(function (item) { return parseInt(item.year); });
27096
+ // Update 'disabledYears' only if 'years' array has changed
27097
+ setDisabledYears(function (prevYears) {
27098
+ if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
27099
+ return years;
27100
+ }
27101
+ return prevYears;
27102
+ });
27299
27103
  }, [data]);
27300
27104
  var checkFile = function (file) {
27301
27105
  var isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
@@ -27311,6 +27115,12 @@ var GHGProjectionsComponent = function (props) {
27311
27115
  }
27312
27116
  return e === null || e === void 0 ? void 0 : e.fileList;
27313
27117
  };
27118
+ var clearUploadDoc = function () {
27119
+ setUploadedFileName('');
27120
+ form.setFieldsValue({
27121
+ emissionsDocument: null,
27122
+ });
27123
+ };
27314
27124
  var handleYearChange = function (date, dateString) {
27315
27125
  setSelectedYear(dateString);
27316
27126
  };
@@ -27682,7 +27492,8 @@ var GHGProjectionsComponent = function (props) {
27682
27492
  React.createElement("div", { className: "body-sub-title" }, t("ghgInventory:totalNationalEmissionSubTitle")))),
27683
27493
  React.createElement("div", { className: "content-card add-projection" },
27684
27494
  React.createElement(Tabs, { defaultActiveKey: "Add New", centered: true },
27685
- ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT || (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY) && (React.createElement(Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
27495
+ ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT ||
27496
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY) && (React.createElement(Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
27686
27497
  React.createElement("div", null,
27687
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 },
27688
27499
  React.createElement(Row, null,
@@ -27763,7 +27574,7 @@ var GHGProjectionsComponent = function (props) {
27763
27574
  } },
27764
27575
  React.createElement(Button, { icon: React.createElement(UploadOutlined, null) }, t("ghgInventory:upload"))))),
27765
27576
  React.createElement(Col, { xl: 16, md: 16, className: "add-new-upload-file-name-input" },
27766
- React.createElement(Input, { value: uploadedFileName, readOnly: true }))))),
27577
+ React.createElement(Input, { value: uploadedFileName, readOnly: true, suffix: uploadedFileName && (React.createElement(Button, { onClick: clearUploadDoc, icon: React.createElement(DeleteOutlined, null), style: { marginRight: '-10px', padding: '0px 6px' } })) }))))),
27767
27578
  React.createElement(Row, { gutter: 16 },
27768
27579
  React.createElement(Col, { span: 9, offset: 12 },
27769
27580
  React.createElement(Row, { gutter: 16, className: "table-heading-row" },
@@ -27831,9 +27642,7 @@ var GHGProjectionsComponent = function (props) {
27831
27642
  React.createElement(InputNumber, null)))))),
27832
27643
  React.createElement("div", { className: "steps-actions" },
27833
27644
  React.createElement(Button, { type: "primary", htmlType: "submit", loading: loading }, "Submit"),
27834
- React.createElement(Button, { className: "back-btn",
27835
- // onClick={() => prevOne()}
27836
- loading: loading }, "Cancel")))))),
27645
+ React.createElement(Button, { className: "back-btn", onClick: onResetFormModel, loading: loading }, "Cancel")))))),
27837
27646
  data.map(function (tabData) {
27838
27647
  return tabData.state === 'FINALIZED' && (React.createElement(Tabs.TabPane, { key: tabData.id.toString(), tab: React.createElement("span", null,
27839
27648
  tabData.year,
@@ -27931,7 +27740,8 @@ var GHGProjectionsComponent = function (props) {
27931
27740
  })));
27932
27741
  })));
27933
27742
  })))));
27934
- }))))));
27743
+ })))),
27744
+ React.createElement(DiscardChangesConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: resetForm, onActionCanceled: onResetFormCanceled, openModal: openResetFormModal, errorMsg: errorMsg, loading: loading })));
27935
27745
  };
27936
27746
 
27937
27747
  export { Action, AddNdcActionComponent, AddNewCompanyComponent, AddNewUserComponent, AdminBGColor, AdminColor, BaseEntity, CarbonSystemType, CertBGColor, CertColor, CoBenifitsComponent, Company, CompanyManagementColumns, CompanyManagementComponent, CompanyProfileComponent, CompanyRole, CompanyState, ConfigurationSettingsType, CreditTransferComponent, CreditTransferStage, DevBGColor, DevColor, DocType, DocumentStatus, ESGType, Emission, EnergyGenerationUnits, FormElementType, GHGEmissionsComponent, GHGProjectionsComponent, GovBGColor, GovColor, ImgWithFallback, InfoView, Instrument, InvestmentBGColor, InvestmentBody, InvestmentColor, InvestmentCreationComponent, InvestmentLevel, InvestmentManagementComponent, InvestmentStatus, InvestmentStream, InvestmentType, LandAreaUnits, LegendItem, Loading, ManagerBGColor, ManagerColor, MapComponent, MapTypes, MapboxComponent, MinBGColor, MinColor, MitigationTypes, MrvDashboardComponent, MrvStatsCardsTypes, NdcActionBody, NdcActionManagementComponent, NdcActionStatus, NdcActionTypes, NdcActionViewComponent, OrganisationStatus, ProfileIcon, ProgrammeCertify, ProgrammeCreationComponent, ProgrammeDocuments, ProgrammeEntity, ProgrammeIssueForm, ProgrammeManagementColumns, ProgrammeManagementComponent, ProgrammeRetireForm, ProgrammeRevokeForm, ProgrammeStageLegend, ProgrammeStageMRV, ProgrammeStageR, ProgrammeStageUnified, ProgrammeTransfer, ProgrammeTransferForm, Projection, RadioButtonStatus, RadioButtonStatus2, RegistryDashboardComponent, RejectDocumentationConfirmationModel, RetireType, Role, RoleIcon, RootBGColor, RootColor, SdgGoals$1 as SdgGoals, Sector, SectoralScope, StasticCard, StatsCardsTypes, SystemNames, TimelineBody, Titles, TooltipColor, TransferActionModel, TxType, TypeOfMitigation, UnitField, User, UserManagementColumns, UserManagementComponent, UserProfileComponent, UserRoleIcon, ViewBGColor, ViewColor, WidgetType, addCommSep, addCommSepRound, addRoundNumber, addSpaces, consumerGroupList, creditUnit, dateFormat, dateTimeFormat, energyGenerationUnitList, getBase64, getCompanyBgColor, getCreditStageVal, getFinancialFields, getGeneralFields, getInvestmentStatusEnumVal, getNdcActionStatusEnumVal, getNdcStatusTagType, getRetirementTypeString, getStageEnumVal, getStageTagType, getStageTagTypeMRV, getStageTransferEnumVal, getStatusTagType, getTransferStageTagType, isBase64, landAreaUnitList, mitigationTypeList, ndcActionTypeList, sectorMitigationTypesListMapped, sumArray, titleList };