@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/cjs/index.js CHANGED
@@ -25017,7 +25017,7 @@ var TimelineBody = function (props) {
25017
25017
  React.createElement("div", { className: "remark-body" }, remark)))));
25018
25018
  };
25019
25019
 
25020
- var css_248z$1 = ".ant-tabs-tab-btn {\n padding: 5px 30px;\n text-align: center;\n font-weight: 600;\n color: rgba(58, 53, 65, 0.5); }\n\n.emission-tab-container .add-emission {\n display: flex;\n flex-direction: column;\n background-color: #ffffff;\n margin: 1rem 0 1rem 0;\n border-radius: 10px;\n padding: 0 1.5rem 2.5rem 1.5rem; }\n .emission-tab-container .add-emission .add-new-year-picker-col {\n padding-left: 5%; }\n .emission-tab-container .add-emission .ant-picker {\n border-radius: 5px !important;\n height: 50px !important;\n width: 80%; }\n .emission-tab-container .add-emission .add-new-upload-file-label {\n color: rgba(58, 53, 65, 0.5);\n padding: 0 0 8px;\n line-height: 1.5715;\n white-space: initial;\n text-align: left; }\n .emission-tab-container .add-emission .add-new-upload-file-name-input input {\n height: 50px; }\n .emission-tab-container .add-emission .add-new-upload-file-inner-col button {\n height: 50px;\n font-size: 11px;\n width: 120px; }\n .emission-tab-container .add-emission .table-heading-row {\n padding-top: 20px;\n padding-bottom: 25px;\n margin-left: 10px !important; }\n .emission-tab-container .add-emission .table-heading-row .table-heading-col {\n text-align: center;\n font-size: 18px;\n font-weight: 600;\n color: #28282899; }\n .emission-tab-container .add-emission .total-emission-row {\n padding: 12px 16px;\n margin-left: 30px !important; }\n .emission-tab-container .add-emission .total-emission-row span {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .total-emission-row .total-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .panel-header-col {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .panel-header-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .sub-panel .panel-header-emission-value-col {\n border-bottom: none !important;\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .sub-panel-heading {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n margin-top: 35px; }\n .emission-tab-container .add-emission .sub-panel-heading .panel-header-col {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .ant-collapse-ghost > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box {\n padding-top: 0px;\n padding-bottom: 12px;\n margin-left: 25px; }\n .emission-tab-container .add-emission .ant-collapse-expand-icon {\n margin-top: 5px; }\n .emission-tab-container .add-emission .ant-collapse-expand-icon svg {\n font-size: 20px;\n color: #976ED7; }\n .emission-tab-container .add-emission .ant-collapse {\n margin-left: 10px; }\n .emission-tab-container .add-emission .co2-total-pill {\n border-radius: 20px;\n background-color: rgba(145, 85, 253, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .ch4-total-pill {\n border-radius: 20px;\n background-color: rgba(217, 217, 217, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .n2o-total-pill {\n border-radius: 20px;\n background-color: rgba(185, 226, 244, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .co2eq-total-pill {\n border-radius: 20px;\n background-color: rgba(255, 166, 166, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .panel-content-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n height: 68px;\n align-items: center; }\n .emission-tab-container .add-emission .panel-content-row .panel-content-title {\n font-size: 16px;\n font-weight: 500;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .panel-content-input-box-row {\n margin-top: 14px; }\n .emission-tab-container .add-emission .panel-content-input-box-row .ant-input-number {\n height: 40px;\n width: 50px;\n margin-left: 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";
25020
+ var css_248z$1 = ".ant-tabs-tab-btn {\n padding: 5px 30px;\n text-align: center;\n font-weight: 600;\n color: rgba(58, 53, 65, 0.5); }\n\n.ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner {\n width: 65px !important;\n height: 32px !important;\n text-align: center !important;\n border-radius: 50px !important;\n background: #16b1ff !important;\n line-height: 30px !important; }\n\n.ant-picker-cell-disabled::before {\n width: 65px !important;\n height: 32px !important;\n text-align: center !important;\n border-radius: 50px !important;\n line-height: 30px !important; }\n\n.ant-picker-cell::before {\n left: 11px; }\n\n.ant-input-suffix {\n display: flex;\n flex: none;\n align-items: center;\n height: 50px; }\n .ant-input-suffix button {\n border: none;\n color: #8C8C8C; }\n\n.ant-input-affix-wrapper {\n padding: 0 11px;\n border-radius: 5px; }\n\n.emission-tab-container .add-emission {\n display: flex;\n flex-direction: column;\n background-color: #ffffff;\n margin: 1rem 0 1rem 0;\n border-radius: 10px;\n padding: 0 1.5rem 2.5rem 1.5rem; }\n .emission-tab-container .add-emission .add-new-year-picker-col {\n padding-left: 5%; }\n .emission-tab-container .add-emission .ant-picker {\n border-radius: 5px !important;\n height: 50px !important;\n width: 80%; }\n .emission-tab-container .add-emission .add-new-upload-file-label {\n color: rgba(58, 53, 65, 0.5);\n padding: 0 0 8px;\n line-height: 1.5715;\n white-space: initial;\n text-align: left; }\n .emission-tab-container .add-emission .add-new-upload-file-name-input input {\n height: 50px;\n color: #16b1ff; }\n .emission-tab-container .add-emission .add-new-upload-file-inner-col button {\n height: 50px;\n font-size: 11px;\n width: 120px; }\n .emission-tab-container .add-emission .table-heading-row {\n padding-top: 20px;\n padding-bottom: 25px;\n margin-left: 10px !important; }\n .emission-tab-container .add-emission .table-heading-row .table-heading-col {\n text-align: center;\n font-size: 18px;\n font-weight: 600;\n color: #28282899; }\n .emission-tab-container .add-emission .total-emission-row {\n padding: 12px 16px;\n margin-left: 30px !important; }\n .emission-tab-container .add-emission .total-emission-row span {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .total-emission-row .total-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .panel-header-col {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .panel-header-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .sub-panel .panel-header-emission-value-col {\n border-bottom: none !important;\n padding-bottom: 10px; }\n .emission-tab-container .add-emission .sub-panel-heading {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n margin-top: 35px; }\n .emission-tab-container .add-emission .sub-panel-heading .panel-header-col {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .ant-collapse-ghost > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box {\n padding-top: 0px;\n padding-bottom: 12px;\n margin-left: 25px; }\n .emission-tab-container .add-emission .ant-collapse-expand-icon {\n margin-top: 5px; }\n .emission-tab-container .add-emission .ant-collapse-expand-icon svg {\n font-size: 20px;\n color: #976ED7; }\n .emission-tab-container .add-emission .ant-collapse {\n margin-left: 10px; }\n .emission-tab-container .add-emission .co2-total-pill {\n border-radius: 20px;\n background-color: rgba(145, 85, 253, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .ch4-total-pill {\n border-radius: 20px;\n background-color: rgba(217, 217, 217, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .n2o-total-pill {\n border-radius: 20px;\n background-color: rgba(185, 226, 244, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .co2eq-total-pill {\n border-radius: 20px;\n background-color: rgba(255, 166, 166, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .emission-tab-container .add-emission .panel-content-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n height: 68px;\n align-items: center; }\n .emission-tab-container .add-emission .panel-content-row .panel-content-title {\n font-size: 16px;\n font-weight: 500;\n color: #3A3541CC; }\n .emission-tab-container .add-emission .panel-content-input-box-row {\n margin-top: 14px; }\n .emission-tab-container .add-emission .panel-content-input-box-row .ant-input-number {\n height: 40px;\n width: 50px;\n margin-left: 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";
25021
25021
  styleInject(css_248z$1);
25022
25022
 
25023
25023
  var EmissionTypes = { co2: 'CO2', ch4: 'CH4', n2o: 'N2O', co2eq: 'CO2-eq' };
@@ -25089,168 +25089,79 @@ var formFields = {
25089
25089
  other: ['indirectN2oEmissions', 'other'],
25090
25090
  };
25091
25091
 
25092
+ antd.Input.TextArea;
25093
+ var DiscardChangesConfirmationModel = function (props) {
25094
+ var t = props.t, actionInfo = props.actionInfo, onActionConfirmed = props.onActionConfirmed, onActionCanceled = props.onActionCanceled, openModal = props.openModal; props.errorMsg; var loading = props.loading;
25095
+ var _a = React.useState(""); _a[0]; var setComment = _a[1];
25096
+ React.useEffect(function () {
25097
+ setComment("");
25098
+ }, [openModal]);
25099
+ return (React.createElement(antd.Modal, { title: React.createElement("div", { className: "popup-header" },
25100
+ React.createElement("div", { className: "icon" }, actionInfo.icon),
25101
+ React.createElement("div", null, actionInfo.headerText)), className: "popup-" + actionInfo.type, open: openModal, width: Math.min(400, window.innerWidth), centered: true, onCancel: onActionCanceled, destroyOnClose: true, footer: null },
25102
+ React.createElement("p", { style: { whiteSpace: "pre-line" } }, actionInfo.text),
25103
+ React.createElement(antd.Form, { layout: "vertical", onFinish: function () {
25104
+ onActionConfirmed();
25105
+ } },
25106
+ React.createElement("div", { className: "mg-top-1 ant-modal-footer padding-bottom-0" },
25107
+ React.createElement(antd.Button, { htmlType: "button", onClick: function () {
25108
+ onActionCanceled();
25109
+ } }, t("userProfile:cancel")),
25110
+ React.createElement(antd.Button, { className: "mg-left-2", type: "primary", htmlType: "submit", loading: loading }, actionInfo.action)))));
25111
+ };
25112
+
25092
25113
  // import React from 'react';
25093
25114
  var GHGEmissionsComponent = function (props) {
25094
25115
  var t = props.t, useUserContext = props.useUserContext, useConnection = props.useConnection;
25095
25116
  var userInfoState = useUserContext().userInfoState;
25096
- var data = [
25097
- {
25098
- id: 1,
25099
- country: 'NG',
25100
- year: 2023,
25101
- energyEmissions: {
25102
- fuelCombustionActivities: {
25103
- energyIndustries: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25104
- manufacturingIndustriesConstruction: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25105
- transport: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25106
- otherSectors: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25107
- nonSpecified: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25108
- },
25109
- fugitiveEmissionsFromFuels: {
25110
- solidFuels: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25111
- oilNaturalGas: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25112
- otherEmissionsEnergyProduction: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25113
- },
25114
- carbonDioxideTransportStorage: {
25115
- transportOfCo2: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25116
- injectionStorage: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25117
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25118
- },
25119
- },
25120
- industrialProcessesProductUse: {
25121
- mineralIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25122
- chemicalIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25123
- metalIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25124
- nonEnergyProductsFuelsSolventUse: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25125
- electronicsIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25126
- productUsesSubstOzoneDepletingSubs: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25127
- otherProductManufactureUse: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25128
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25129
- },
25130
- agricultureForestryOtherLandUse: {
25131
- livestock: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25132
- land: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25133
- aggregateNonCo2SourcesLand: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25134
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25135
- },
25136
- waste: {
25137
- solidWasteDisposal: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25138
- biologicalTreatmentSolidWaste: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25139
- incinerationOpenBurningWaste: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25140
- wastewaterTreatmentDischarge: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25141
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25142
- },
25143
- other: {
25144
- indirectN2oEmissions: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25145
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25146
- },
25147
- totalCo2WithoutLand: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25148
- totalCo2WithLand: { co2: 30, ch4: 15, n2o: 33, co2eq: 41 },
25149
- state: 'SAVED',
25150
- version: 2,
25151
- created_at: 1698644100397,
25152
- },
25153
- {
25154
- id: 2,
25155
- country: 'NG',
25156
- year: 2022,
25157
- energyEmissions: {
25158
- fuelCombustionActivities: {
25159
- energyIndustries: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25160
- manufacturingIndustriesConstruction: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25161
- transport: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25162
- otherSectors: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25163
- nonSpecified: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25164
- },
25165
- fugitiveEmissionsFromFuels: {
25166
- solidFuels: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25167
- oilNaturalGas: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25168
- otherEmissionsEnergyProduction: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25169
- },
25170
- carbonDioxideTransportStorage: {
25171
- transportOfCo2: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25172
- injectionStorage: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25173
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25174
- },
25175
- },
25176
- industrialProcessesProductUse: {
25177
- mineralIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25178
- chemicalIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25179
- metalIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25180
- nonEnergyProductsFuelsSolventUse: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25181
- electronicsIndustry: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25182
- productUsesSubstOzoneDepletingSubs: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25183
- otherProductManufactureUse: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25184
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25185
- },
25186
- agricultureForestryOtherLandUse: {
25187
- livestock: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25188
- land: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25189
- aggregateNonCo2SourcesLand: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25190
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25191
- },
25192
- waste: {
25193
- solidWasteDisposal: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25194
- biologicalTreatmentSolidWaste: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25195
- incinerationOpenBurningWaste: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25196
- wastewaterTreatmentDischarge: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25197
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25198
- },
25199
- other: {
25200
- indirectN2oEmissions: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25201
- other: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25202
- },
25203
- totalCo2WithoutLand: { co2: 20, ch4: 15, n2o: 33, co2eq: 41 },
25204
- totalCo2WithLand: { co2: 30, ch4: 15, n2o: 33, co2eq: 41 },
25205
- state: 'FINALIZED',
25206
- version: 1,
25207
- created_at: 1698644100397,
25208
- },
25209
- ];
25210
- var _a = useConnection(); _a.put; _a.get; var post = _a.post;
25211
- var _b = React.useState(false), loading = _b[0], setLoading = _b[1];
25212
- var _c = React.useState(false), isPendingFinalization = _c[0], setIsPendingFinalization = _c[1];
25213
- var _d = React.useState(null); _d[0]; var setSelectedYear = _d[1];
25214
- var _e = React.useState(''), uploadedFileName = _e[0], setUploadedFileName = _e[1];
25215
- var _f = React.useState([]), disabledYears = _f[0], setDisabledYears = _f[1];
25216
- var _g = React.useState(); _g[0]; var setChangedValues = _g[1];
25217
- var _h = React.useState(0), totalNationalCo2 = _h[0], setTotalNationalCo2 = _h[1];
25218
- var _j = React.useState(0), totalNationalCh4 = _j[0], setTotalNationalCh4 = _j[1];
25219
- var _k = React.useState(0), totalNationalN2o = _k[0], setTotalNationalN2o = _k[1];
25220
- var _l = React.useState(0), totalNationalCo2Eq = _l[0], setTotalNationalCo2Eq = _l[1];
25221
- var _m = React.useState(0), energyEmissionsCo2 = _m[0], setEnergyEmissionsCo2 = _m[1];
25222
- var _o = React.useState(0), energyEmissionsCh4 = _o[0], setEnergyEmissionsCh4 = _o[1];
25223
- var _p = React.useState(0), energyEmissionsN2o = _p[0], setEnergyEmissionsN2o = _p[1];
25224
- var _q = React.useState(0), energyEmissionsCo2Eq = _q[0], setEnergyEmissionsCo2Eq = _q[1];
25225
- var _r = React.useState(0), fuelCombustionActivitiesCo2 = _r[0], setFuelCombustionActivitiesCo2 = _r[1];
25226
- var _s = React.useState(0), fuelCombustionActivitiesCh4 = _s[0], setFuelCombustionActivitiesCh4 = _s[1];
25227
- var _t = React.useState(0), fuelCombustionActivitiesN2o = _t[0], setFuelCombustionActivitiesN2o = _t[1];
25228
- var _u = React.useState(0), fuelCombustionActivitiesCo2Eq = _u[0], setFuelCombustionActivitiesCo2Eq = _u[1];
25229
- var _v = React.useState(0), fugitiveEmissionsFromFuelsCo2 = _v[0], setFugitiveEmissionsFromFuelsCo2 = _v[1];
25230
- var _w = React.useState(0), fugitiveEmissionsFromFuelsCh4 = _w[0], setFugitiveEmissionsFromFuelsCh4 = _w[1];
25231
- var _x = React.useState(0), fugitiveEmissionsFromFuelsN2o = _x[0], setFugitiveEmissionsFromFuelsN2o = _x[1];
25232
- var _y = React.useState(0), fugitiveEmissionsFromFuelsCo2Eq = _y[0], setFugitiveEmissionsFromFuelsCo2Eq = _y[1];
25233
- var _z = React.useState(0), carbonDioxideTransportStorageCo2 = _z[0], setCarbonDioxideTransportStorageCo2 = _z[1];
25234
- var _0 = React.useState(0), carbonDioxideTransportStorageCh4 = _0[0], setCarbonDioxideTransportStorageCh4 = _0[1];
25235
- var _1 = React.useState(0), carbonDioxideTransportStorageN2o = _1[0], setCarbonDioxideTransportStorageN2o = _1[1];
25236
- var _2 = React.useState(0), carbonDioxideTransportStorageCo2Eq = _2[0], setCarbonDioxideTransportStorageCo2Eq = _2[1];
25237
- var _3 = React.useState(0), industrialProcessesProductUseCo2 = _3[0], setIndustrialProcessesProductUseCo2 = _3[1];
25238
- var _4 = React.useState(0), industrialProcessesProductUseCh4 = _4[0], setIndustrialProcessesProductUseCh4 = _4[1];
25239
- var _5 = React.useState(0), industrialProcessesProductUseN2o = _5[0], setIndustrialProcessesProductUseN2o = _5[1];
25240
- var _6 = React.useState(0), industrialProcessesProductUseCo2Eq = _6[0], setIndustrialProcessesProductUseCo2Eq = _6[1];
25241
- var _7 = React.useState(0), agricultureForestryOtherLandUseCo2 = _7[0], setAgricultureForestryOtherLandUseCo2 = _7[1];
25242
- var _8 = React.useState(0), agricultureForestryOtherLandUseCh4 = _8[0], setAgricultureForestryOtherLandUseCh4 = _8[1];
25243
- var _9 = React.useState(0), agricultureForestryOtherLandUseN2o = _9[0], setAgricultureForestryOtherLandUseN2o = _9[1];
25244
- var _10 = React.useState(0), agricultureForestryOtherLandUseCo2Eq = _10[0], setAgricultureForestryOtherLandUseCo2Eq = _10[1];
25245
- var _11 = React.useState(0), wasteCo2 = _11[0], setWasteCo2 = _11[1];
25246
- var _12 = React.useState(0), wasteCh4 = _12[0], setWasteCh4 = _12[1];
25247
- var _13 = React.useState(0), wasteN2o = _13[0], setWasteN2o = _13[1];
25248
- var _14 = React.useState(0), wasteCo2Eq = _14[0], setWasteCo2Eq = _14[1];
25249
- var _15 = React.useState(0), otherCo2 = _15[0], setOtherCo2 = _15[1];
25250
- var _16 = React.useState(0), otherCh4 = _16[0], setOtherCh4 = _16[1];
25251
- var _17 = React.useState(0), otherN2o = _17[0], setOtherN2o = _17[1];
25252
- var _18 = React.useState(0), otherCo2Eq = _18[0], setOtherCo2Eq = _18[1];
25253
- var _19 = React.useState(false), isSavedFormDataSet = _19[0], setIsSavedFormDataSet = _19[1];
25117
+ var _a = React.useState([]), data = _a[0], setData = _a[1];
25118
+ var _b = useConnection(), get = _b.get, post = _b.post;
25119
+ var _c = React.useState(false), loading = _c[0], setLoading = _c[1];
25120
+ var _d = React.useState(false), isPendingFinalization = _d[0], setIsPendingFinalization = _d[1];
25121
+ var _e = React.useState(null); _e[0]; var setSelectedYear = _e[1];
25122
+ var _f = React.useState(''), uploadedFileName = _f[0], setUploadedFileName = _f[1];
25123
+ var _g = React.useState([]), disabledYears = _g[0], setDisabledYears = _g[1];
25124
+ var _h = React.useState(); _h[0]; var setChangedValues = _h[1];
25125
+ var _j = React.useState(0), totalNationalCo2 = _j[0], setTotalNationalCo2 = _j[1];
25126
+ var _k = React.useState(0), totalNationalCh4 = _k[0], setTotalNationalCh4 = _k[1];
25127
+ var _l = React.useState(0), totalNationalN2o = _l[0], setTotalNationalN2o = _l[1];
25128
+ var _m = React.useState(0), totalNationalCo2Eq = _m[0], setTotalNationalCo2Eq = _m[1];
25129
+ var _o = React.useState(0), energyEmissionsCo2 = _o[0], setEnergyEmissionsCo2 = _o[1];
25130
+ var _p = React.useState(0), energyEmissionsCh4 = _p[0], setEnergyEmissionsCh4 = _p[1];
25131
+ var _q = React.useState(0), energyEmissionsN2o = _q[0], setEnergyEmissionsN2o = _q[1];
25132
+ var _r = React.useState(0), energyEmissionsCo2Eq = _r[0], setEnergyEmissionsCo2Eq = _r[1];
25133
+ var _s = React.useState(0), fuelCombustionActivitiesCo2 = _s[0], setFuelCombustionActivitiesCo2 = _s[1];
25134
+ var _t = React.useState(0), fuelCombustionActivitiesCh4 = _t[0], setFuelCombustionActivitiesCh4 = _t[1];
25135
+ var _u = React.useState(0), fuelCombustionActivitiesN2o = _u[0], setFuelCombustionActivitiesN2o = _u[1];
25136
+ var _v = React.useState(0), fuelCombustionActivitiesCo2Eq = _v[0], setFuelCombustionActivitiesCo2Eq = _v[1];
25137
+ var _w = React.useState(0), fugitiveEmissionsFromFuelsCo2 = _w[0], setFugitiveEmissionsFromFuelsCo2 = _w[1];
25138
+ var _x = React.useState(0), fugitiveEmissionsFromFuelsCh4 = _x[0], setFugitiveEmissionsFromFuelsCh4 = _x[1];
25139
+ var _y = React.useState(0), fugitiveEmissionsFromFuelsN2o = _y[0], setFugitiveEmissionsFromFuelsN2o = _y[1];
25140
+ var _z = React.useState(0), fugitiveEmissionsFromFuelsCo2Eq = _z[0], setFugitiveEmissionsFromFuelsCo2Eq = _z[1];
25141
+ var _0 = React.useState(0), carbonDioxideTransportStorageCo2 = _0[0], setCarbonDioxideTransportStorageCo2 = _0[1];
25142
+ var _1 = React.useState(0), carbonDioxideTransportStorageCh4 = _1[0], setCarbonDioxideTransportStorageCh4 = _1[1];
25143
+ var _2 = React.useState(0), carbonDioxideTransportStorageN2o = _2[0], setCarbonDioxideTransportStorageN2o = _2[1];
25144
+ var _3 = React.useState(0), carbonDioxideTransportStorageCo2Eq = _3[0], setCarbonDioxideTransportStorageCo2Eq = _3[1];
25145
+ var _4 = React.useState(0), industrialProcessesProductUseCo2 = _4[0], setIndustrialProcessesProductUseCo2 = _4[1];
25146
+ var _5 = React.useState(0), industrialProcessesProductUseCh4 = _5[0], setIndustrialProcessesProductUseCh4 = _5[1];
25147
+ var _6 = React.useState(0), industrialProcessesProductUseN2o = _6[0], setIndustrialProcessesProductUseN2o = _6[1];
25148
+ var _7 = React.useState(0), industrialProcessesProductUseCo2Eq = _7[0], setIndustrialProcessesProductUseCo2Eq = _7[1];
25149
+ var _8 = React.useState(0), agricultureForestryOtherLandUseCo2 = _8[0], setAgricultureForestryOtherLandUseCo2 = _8[1];
25150
+ var _9 = React.useState(0), agricultureForestryOtherLandUseCh4 = _9[0], setAgricultureForestryOtherLandUseCh4 = _9[1];
25151
+ var _10 = React.useState(0), agricultureForestryOtherLandUseN2o = _10[0], setAgricultureForestryOtherLandUseN2o = _10[1];
25152
+ var _11 = React.useState(0), agricultureForestryOtherLandUseCo2Eq = _11[0], setAgricultureForestryOtherLandUseCo2Eq = _11[1];
25153
+ var _12 = React.useState(0), wasteCo2 = _12[0], setWasteCo2 = _12[1];
25154
+ var _13 = React.useState(0), wasteCh4 = _13[0], setWasteCh4 = _13[1];
25155
+ var _14 = React.useState(0), wasteN2o = _14[0], setWasteN2o = _14[1];
25156
+ var _15 = React.useState(0), wasteCo2Eq = _15[0], setWasteCo2Eq = _15[1];
25157
+ var _16 = React.useState(0), otherCo2 = _16[0], setOtherCo2 = _16[1];
25158
+ var _17 = React.useState(0), otherCh4 = _17[0], setOtherCh4 = _17[1];
25159
+ var _18 = React.useState(0), otherN2o = _18[0], setOtherN2o = _18[1];
25160
+ var _19 = React.useState(0), otherCo2Eq = _19[0], setOtherCo2Eq = _19[1];
25161
+ var _20 = React.useState(false), isSavedFormDataSet = _20[0], setIsSavedFormDataSet = _20[1];
25162
+ var _21 = React.useState(false), openResetFormModal = _21[0], setOpenResetFormModal = _21[1];
25163
+ var _22 = React.useState(''), errorMsg = _22[0], setErrorMsg = _22[1];
25164
+ var _23 = React.useState({}), actionInfo = _23[0], setActionInfo = _23[1];
25254
25165
  var Panel = antd.Collapse.Panel;
25255
25166
  var form = antd.Form.useForm()[0];
25256
25167
  var createSetFieldObject = function (obj, objName) {
@@ -25347,17 +25258,20 @@ var GHGEmissionsComponent = function (props) {
25347
25258
  setFormValues(upData);
25348
25259
  };
25349
25260
  React.useEffect(function () {
25261
+ console.log('++++++++++++++data', data);
25350
25262
  var hasSaveState = data.some(function (item) { return item.state === 'SAVED'; });
25351
- var years = data.map(function (item) { return !(item.state === 'SAVED') && item.year; });
25263
+ console.log('++++++++++++++hasSaveState', hasSaveState);
25264
+ // const years = data.map((item: any) => !(item.state === 'SAVED') && item.year);
25265
+ // console.log('++++++++++++++data, years', data, years);
25352
25266
  console.log(uploadedFileName);
25353
25267
  setIsPendingFinalization(hasSaveState);
25354
25268
  // Update 'disabledYears' only if 'years' array has changed
25355
- setDisabledYears(function (prevYears) {
25356
- if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
25357
- return years;
25358
- }
25359
- return prevYears;
25360
- });
25269
+ // setDisabledYears((prevYears) => {
25270
+ // if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
25271
+ // return years;
25272
+ // }
25273
+ // return prevYears;
25274
+ // });
25361
25275
  }, [data, uploadedFileName]);
25362
25276
  var handleYearChange = function (date, dateString) {
25363
25277
  setSelectedYear(dateString);
@@ -25620,6 +25534,66 @@ var GHGEmissionsComponent = function (props) {
25620
25534
  }
25621
25535
  });
25622
25536
  }); };
25537
+ var resetForm = function () { return __awaiter(void 0, void 0, void 0, function () {
25538
+ return __generator(this, function (_a) {
25539
+ switch (_a.label) {
25540
+ case 0:
25541
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
25542
+ return [4 /*yield*/, getEmissionData()];
25543
+ case 1:
25544
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
25545
+ _a.sent();
25546
+ setOpenResetFormModal(false);
25547
+ setIsSavedFormDataSet(false);
25548
+ clearUploadDoc();
25549
+ if (!isPendingFinalization) {
25550
+ form.resetFields();
25551
+ setFuelCombustionActivitiesCo2(0);
25552
+ setFuelCombustionActivitiesCh4(0);
25553
+ setFuelCombustionActivitiesN2o(0);
25554
+ setFuelCombustionActivitiesCo2Eq(0);
25555
+ setFugitiveEmissionsFromFuelsCo2(0);
25556
+ setFugitiveEmissionsFromFuelsCh4(0);
25557
+ setFugitiveEmissionsFromFuelsN2o(0);
25558
+ setFugitiveEmissionsFromFuelsCo2Eq(0);
25559
+ setCarbonDioxideTransportStorageCo2(0);
25560
+ setCarbonDioxideTransportStorageCh4(0);
25561
+ setCarbonDioxideTransportStorageN2o(0);
25562
+ setCarbonDioxideTransportStorageCo2Eq(0);
25563
+ setIndustrialProcessesProductUseCo2(0);
25564
+ setIndustrialProcessesProductUseCh4(0);
25565
+ setIndustrialProcessesProductUseN2o(0);
25566
+ setIndustrialProcessesProductUseCo2Eq(0);
25567
+ setAgricultureForestryOtherLandUseCo2(0);
25568
+ setAgricultureForestryOtherLandUseCh4(0);
25569
+ setAgricultureForestryOtherLandUseN2o(0);
25570
+ setAgricultureForestryOtherLandUseCo2Eq(0);
25571
+ setWasteCo2(0);
25572
+ setWasteCh4(0);
25573
+ setWasteN2o(0);
25574
+ setWasteCo2Eq(0);
25575
+ setOtherCo2(0);
25576
+ setOtherCh4(0);
25577
+ setOtherN2o(0);
25578
+ setOtherCo2Eq(0);
25579
+ }
25580
+ return [2 /*return*/];
25581
+ }
25582
+ });
25583
+ }); };
25584
+ var onResetFormCanceled = function () {
25585
+ setOpenResetFormModal(false);
25586
+ };
25587
+ var onResetFormModel = function () {
25588
+ setActionInfo({
25589
+ action: "".concat(t('ghgInventory:proceed')),
25590
+ headerText: "".concat(t('ghgInventory:discardHeaderText')),
25591
+ type: 'danger',
25592
+ icon: React.createElement(icons.CloseCircleOutlined, null),
25593
+ });
25594
+ setErrorMsg('');
25595
+ setOpenResetFormModal(true);
25596
+ };
25623
25597
  var onSubmitForm = function (values) { return __awaiter(void 0, void 0, void 0, function () {
25624
25598
  var fields, payload, response, error_1;
25625
25599
  return __generator(this, function (_a) {
@@ -25632,7 +25606,7 @@ var GHGEmissionsComponent = function (props) {
25632
25606
  setLoading(true);
25633
25607
  _a.label = 2;
25634
25608
  case 2:
25635
- _a.trys.push([2, 4, 5, 6]);
25609
+ _a.trys.push([2, 4, 5, 7]);
25636
25610
  return [4 /*yield*/, post('national/emissions', payload)];
25637
25611
  case 3:
25638
25612
  response = _a.sent();
@@ -25640,12 +25614,16 @@ var GHGEmissionsComponent = function (props) {
25640
25614
  if ((response === null || response === void 0 ? void 0 : response.statusText) === 'SUCCESS') {
25641
25615
  antd.message.open({
25642
25616
  type: 'success',
25643
- content: (response === null || response === void 0 ? void 0 : response.status) == axios.HttpStatusCode.Created ? t('ghgInventory:emissionCreationSuccess') : t('ghgInventory:emissionUpdateSuccess'),
25617
+ content:
25618
+ // eslint-disable-next-line eqeqeq
25619
+ (response === null || response === void 0 ? void 0 : response.status) == axios.HttpStatusCode.Created
25620
+ ? t('ghgInventory:emissionCreationSuccess')
25621
+ : t('ghgInventory:emissionUpdateSuccess'),
25644
25622
  duration: 4,
25645
25623
  style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25646
25624
  });
25647
25625
  }
25648
- return [3 /*break*/, 6];
25626
+ return [3 /*break*/, 7];
25649
25627
  case 4:
25650
25628
  error_1 = _a.sent();
25651
25629
  console.log('Error in emission creation - ', error_1);
@@ -25655,14 +25633,66 @@ var GHGEmissionsComponent = function (props) {
25655
25633
  duration: 4,
25656
25634
  style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25657
25635
  });
25658
- return [3 /*break*/, 6];
25659
- case 5:
25636
+ return [3 /*break*/, 7];
25637
+ case 5:
25638
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
25639
+ return [4 /*yield*/, getEmissionData()];
25640
+ case 6:
25641
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
25642
+ _a.sent();
25660
25643
  setLoading(false);
25661
25644
  return [7 /*endfinally*/];
25662
- case 6: return [2 /*return*/];
25645
+ case 7: return [2 /*return*/];
25646
+ }
25647
+ });
25648
+ }); };
25649
+ var getEmissionData = function () { return __awaiter(void 0, void 0, void 0, function () {
25650
+ var response, error_2;
25651
+ return __generator(this, function (_a) {
25652
+ switch (_a.label) {
25653
+ case 0:
25654
+ setLoading(true);
25655
+ _a.label = 1;
25656
+ case 1:
25657
+ _a.trys.push([1, 3, 4, 5]);
25658
+ return [4 /*yield*/, get('national/emissions')];
25659
+ case 2:
25660
+ response = _a.sent();
25661
+ console.log('Emissions GET -> ', response);
25662
+ if (response === null || response === void 0 ? void 0 : response.data) {
25663
+ setData(response.data);
25664
+ }
25665
+ return [3 /*break*/, 5];
25666
+ case 3:
25667
+ error_2 = _a.sent();
25668
+ console.log('Error in emission fetch - ', error_2);
25669
+ antd.message.open({
25670
+ type: 'error',
25671
+ content: error_2 === null || error_2 === void 0 ? void 0 : error_2.message,
25672
+ duration: 4,
25673
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
25674
+ });
25675
+ return [3 /*break*/, 5];
25676
+ case 4:
25677
+ setLoading(false);
25678
+ return [7 /*endfinally*/];
25679
+ case 5: return [2 /*return*/];
25663
25680
  }
25664
25681
  });
25665
25682
  }); };
25683
+ React.useEffect(function () {
25684
+ var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {
25685
+ return __generator(this, function (_a) {
25686
+ switch (_a.label) {
25687
+ case 0: return [4 /*yield*/, getEmissionData()];
25688
+ case 1:
25689
+ _a.sent();
25690
+ return [2 /*return*/];
25691
+ }
25692
+ });
25693
+ }); };
25694
+ fetchData();
25695
+ }, []);
25666
25696
  var setFormValues = function (emissionObject) {
25667
25697
  if (emissionObject.year) {
25668
25698
  form.setFieldsValue({ year: moment(emissionObject.year, 'YYYY') });
@@ -25715,12 +25745,23 @@ var GHGEmissionsComponent = function (props) {
25715
25745
  setIsSavedFormDataSet(true);
25716
25746
  };
25717
25747
  React.useEffect(function () {
25718
- if (isPendingFinalization) {
25719
- if (!isSavedFormDataSet) {
25720
- var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
25748
+ // if (isPendingFinalization) {
25749
+ if (!isSavedFormDataSet) {
25750
+ var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
25751
+ if (savedData && savedData.length > 0) {
25721
25752
  setFormValues(savedData[0]);
25722
25753
  }
25723
25754
  }
25755
+ var years = data
25756
+ .filter(function (item) { return !(item.state === 'SAVED' && item.year); }) // Filter out items where state is not 'SAVED'
25757
+ .map(function (item) { return parseInt(item.year); });
25758
+ // Update 'disabledYears' only if 'years' array has changed
25759
+ setDisabledYears(function (prevYears) {
25760
+ if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
25761
+ return years;
25762
+ }
25763
+ return prevYears;
25764
+ });
25724
25765
  }, [data]);
25725
25766
  var checkFile = function (file) {
25726
25767
  var isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
@@ -25736,6 +25777,12 @@ var GHGEmissionsComponent = function (props) {
25736
25777
  }
25737
25778
  return e === null || e === void 0 ? void 0 : e.fileList;
25738
25779
  };
25780
+ var clearUploadDoc = function () {
25781
+ setUploadedFileName('');
25782
+ form.setFieldsValue({
25783
+ emissionsDocument: null,
25784
+ });
25785
+ };
25739
25786
  var isYearDisabled = function (current) {
25740
25787
  return disabledYears.includes(current.year());
25741
25788
  };
@@ -26195,25 +26242,26 @@ var GHGEmissionsComponent = function (props) {
26195
26242
  React.createElement("div", { className: "body-sub-title" }, t("ghgInventory:totalNationalEmissionSubTitle")))),
26196
26243
  React.createElement("div", { className: "content-card add-emission" },
26197
26244
  React.createElement(antd.Tabs, { defaultActiveKey: "Add New", centered: true },
26198
- ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT || (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.MINISTRY) && (React.createElement(antd.Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
26245
+ ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT ||
26246
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.MINISTRY) && (React.createElement(antd.Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
26199
26247
  React.createElement("div", null,
26200
26248
  React.createElement(antd.Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, name: "add-emission", className: "programme-details-form", layout: "vertical", requiredMark: true, form: form, onValuesChange: onValuesChange, onFinish: onSubmitForm },
26201
26249
  React.createElement(antd.Row, null,
26202
26250
  React.createElement(antd.Col, { xl: 12, md: 12, className: "add-new-year-picker-col" },
26203
26251
  React.createElement("div", null,
26204
- React.createElement(antd.Form.Item, { label: t("ghgInventory:year"), name: "year", rules: [
26252
+ React.createElement(antd.Form.Item, { label: t('ghgInventory:year'), name: "year", rules: [
26205
26253
  {
26206
26254
  required: true,
26207
- message: "",
26255
+ message: '',
26208
26256
  },
26209
26257
  {
26210
26258
  validator: function (rule, value) { return __awaiter(void 0, void 0, void 0, function () {
26211
26259
  return __generator(this, function (_a) {
26212
- if (String(value).trim() === "" ||
26260
+ if (String(value).trim() === '' ||
26213
26261
  String(value).trim() === undefined ||
26214
26262
  value === null ||
26215
26263
  value === undefined) {
26216
- throw new Error("".concat(t("ghgInventory:year"), " ").concat(t("isRequired")));
26264
+ throw new Error("".concat(t('ghgInventory:year'), " ").concat(t('isRequired')));
26217
26265
  }
26218
26266
  return [2 /*return*/];
26219
26267
  });
@@ -26277,7 +26325,7 @@ var GHGEmissionsComponent = function (props) {
26277
26325
  } },
26278
26326
  React.createElement(antd.Button, { icon: React.createElement(icons.UploadOutlined, null) }, t("ghgInventory:upload"))))),
26279
26327
  React.createElement(antd.Col, { xl: 16, md: 16, className: "add-new-upload-file-name-input" },
26280
- React.createElement(antd.Input, { value: uploadedFileName, readOnly: true }))))),
26328
+ React.createElement(antd.Input, { value: uploadedFileName, readOnly: true, suffix: uploadedFileName && (React.createElement(antd.Button, { onClick: clearUploadDoc, icon: React.createElement(icons.DeleteOutlined, null), style: { marginRight: '-10px', padding: '0px 6px' } })) }))))),
26281
26329
  React.createElement(antd.Row, { gutter: 16 },
26282
26330
  React.createElement(antd.Col, { span: 9, offset: 12 },
26283
26331
  React.createElement(antd.Row, { gutter: 16, className: "table-heading-row" },
@@ -26362,9 +26410,7 @@ var GHGEmissionsComponent = function (props) {
26362
26410
  React.createElement(antd.InputNumber, null)))))),
26363
26411
  React.createElement("div", { className: "steps-actions" },
26364
26412
  React.createElement(antd.Button, { type: "primary", htmlType: "submit", loading: loading }, "Submit"),
26365
- React.createElement(antd.Button, { className: "back-btn",
26366
- // onClick={() => prevOne()}
26367
- loading: loading }, "Cancel")))))),
26413
+ React.createElement(antd.Button, { className: "back-btn", onClick: onResetFormModel, loading: loading }, "Cancel")))))),
26368
26414
  data.map(function (tabData) {
26369
26415
  return tabData.state === 'FINALIZED' && (React.createElement(antd.Tabs.TabPane, { key: tabData.id.toString(), tab: React.createElement("span", null,
26370
26416
  tabData.year,
@@ -26475,10 +26521,11 @@ var GHGEmissionsComponent = function (props) {
26475
26521
  })));
26476
26522
  })));
26477
26523
  })))));
26478
- }))))));
26524
+ })))),
26525
+ React.createElement(DiscardChangesConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: resetForm, onActionCanceled: onResetFormCanceled, openModal: openResetFormModal, errorMsg: errorMsg, loading: loading })));
26479
26526
  };
26480
26527
 
26481
- var css_248z = ".ant-tabs-tab-btn {\n padding: 5px 30px;\n text-align: center;\n font-weight: 600;\n color: rgba(58, 53, 65, 0.5); }\n\n.projection-tab-container .add-projection {\n display: flex;\n flex-direction: column;\n background-color: #ffffff;\n margin: 1rem 0 1rem 0;\n border-radius: 10px;\n padding: 0 1.5rem 2.5rem 1.5rem; }\n .projection-tab-container .add-projection .add-new-year-picker-col {\n padding-left: 5%; }\n .projection-tab-container .add-projection .ant-picker {\n border-radius: 5px !important;\n height: 50px !important;\n width: 80%; }\n .projection-tab-container .add-projection .add-new-upload-file-label {\n color: rgba(58, 53, 65, 0.5);\n padding: 0 0 8px;\n line-height: 1.5715;\n white-space: initial;\n text-align: left; }\n .projection-tab-container .add-projection .add-new-upload-file-name-input input {\n height: 50px; }\n .projection-tab-container .add-projection .add-new-upload-file-inner-col button {\n height: 50px;\n font-size: 11px;\n width: 120px; }\n .projection-tab-container .add-projection .table-heading-row {\n padding-top: 20px;\n padding-bottom: 25px;\n margin-left: 10px !important; }\n .projection-tab-container .add-projection .table-heading-row .table-heading-col {\n text-align: center;\n font-size: 16px;\n font-weight: 600;\n color: #28282899; }\n .projection-tab-container .add-projection .total-emission-row {\n padding: 12px 16px;\n margin-left: 30px !important; }\n .projection-tab-container .add-projection .total-emission-row span {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .total-emission-row .total-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .projection-tab-container .add-projection .panel-header-col {\n font-size: 20px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .panel-header-emission-value-col {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px; }\n .projection-tab-container .add-projection .sub-panel .panel-header-emission-value-col {\n border-bottom: none !important;\n padding-bottom: 10px; }\n .projection-tab-container .add-projection .sub-panel-heading {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n margin-top: 35px; }\n .projection-tab-container .add-projection .sub-panel-heading .panel-header-col {\n font-size: 16px;\n font-weight: 600;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .ant-collapse-ghost > .ant-collapse-item > .ant-collapse-content > .ant-collapse-content-box {\n padding-top: 0px;\n padding-bottom: 12px;\n margin-left: 25px; }\n .projection-tab-container .add-projection .ant-collapse-expand-icon {\n margin-top: 5px; }\n .projection-tab-container .add-projection .ant-collapse-expand-icon svg {\n font-size: 20px;\n color: #976ED7; }\n .projection-tab-container .add-projection .ant-collapse {\n margin-left: 10px; }\n .projection-tab-container .add-projection .co2-total-pill {\n border-radius: 20px;\n background-color: rgba(145, 85, 253, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .ch4-total-pill {\n border-radius: 20px;\n background-color: rgba(217, 217, 217, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .n2o-total-pill {\n border-radius: 20px;\n background-color: rgba(185, 226, 244, 0.4);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .co2eq-total-pill {\n border-radius: 20px;\n background-color: rgba(255, 166, 166, 0.6);\n padding: 4px 15px;\n height: 28px;\n color: #5B5B5B;\n font-size: 12px;\n font-weight: 900;\n margin-left: auto;\n margin-right: auto;\n width: 90px;\n text-align: center; }\n .projection-tab-container .add-projection .panel-content-row {\n border-bottom: 1px solid rgba(217, 217, 217, 0.6);\n padding-bottom: 10px;\n height: 68px;\n align-items: center; }\n .projection-tab-container .add-projection .panel-content-row .panel-content-title {\n font-size: 16px;\n font-weight: 500;\n color: #3A3541CC; }\n .projection-tab-container .add-projection .panel-content-input-box-row {\n margin-top: 14px; }\n .projection-tab-container .add-projection .panel-content-input-box-row .ant-input-number {\n height: 40px;\n width: 50px;\n margin-left: 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";
26528
+ 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";
26482
26529
  styleInject(css_248z);
26483
26530
 
26484
26531
  var ProjectionTypes = {
@@ -26490,403 +26537,45 @@ var ProjectionTypes = {
26490
26537
  var GHGProjectionsComponent = function (props) {
26491
26538
  var t = props.t, useUserContext = props.useUserContext, useConnection = props.useConnection;
26492
26539
  var userInfoState = useUserContext().userInfoState;
26493
- var data = [
26494
- {
26495
- id: 1,
26496
- country: 'NG',
26497
- year: 2023,
26498
- energyEmissions: {
26499
- fuelCombustionActivities: {
26500
- energyIndustries: {
26501
- bau: 20,
26502
- conditionalNdc: 15,
26503
- unconditionalNdc: 332,
26504
- },
26505
- manufacturingIndustriesConstruction: {
26506
- bau: 20,
26507
- conditionalNdc: 15,
26508
- unconditionalNdc: 33,
26509
- },
26510
- transport: {
26511
- bau: 20,
26512
- conditionalNdc: 15,
26513
- unconditionalNdc: 33,
26514
- },
26515
- otherSectors: {
26516
- bau: 20,
26517
- conditionalNdc: 15,
26518
- unconditionalNdc: 33,
26519
- },
26520
- nonSpecified: {
26521
- bau: 20,
26522
- conditionalNdc: 15,
26523
- unconditionalNdc: 33,
26524
- },
26525
- },
26526
- fugitiveEmissionsFromFuels: {
26527
- solidFuels: {
26528
- bau: 20,
26529
- conditionalNdc: 15,
26530
- unconditionalNdc: 33,
26531
- },
26532
- oilNaturalGas: {
26533
- bau: 20,
26534
- conditionalNdc: 15,
26535
- unconditionalNdc: 33,
26536
- },
26537
- otherEmissionsEnergyProduction: {
26538
- bau: 20,
26539
- conditionalNdc: 15,
26540
- unconditionalNdc: 33,
26541
- },
26542
- },
26543
- carbonDioxideTransportStorage: {
26544
- transportOfCo2: {
26545
- bau: 20,
26546
- conditionalNdc: 15,
26547
- unconditionalNdc: 33,
26548
- },
26549
- injectionStorage: {
26550
- bau: 20,
26551
- conditionalNdc: 15,
26552
- unconditionalNdc: 33,
26553
- },
26554
- other: {
26555
- bau: 20,
26556
- conditionalNdc: 15,
26557
- unconditionalNdc: 33,
26558
- },
26559
- },
26560
- },
26561
- industrialProcessesProductUse: {
26562
- mineralIndustry: {
26563
- bau: 20,
26564
- conditionalNdc: 15,
26565
- unconditionalNdc: 33,
26566
- },
26567
- chemicalIndustry: {
26568
- bau: 20,
26569
- conditionalNdc: 15,
26570
- unconditionalNdc: 33,
26571
- },
26572
- metalIndustry: {
26573
- bau: 20,
26574
- conditionalNdc: 15,
26575
- unconditionalNdc: 33,
26576
- },
26577
- nonEnergyProductsFuelsSolventUse: {
26578
- bau: 20,
26579
- conditionalNdc: 15,
26580
- unconditionalNdc: 33,
26581
- },
26582
- electronicsIndustry: {
26583
- bau: 20,
26584
- conditionalNdc: 15,
26585
- unconditionalNdc: 33,
26586
- },
26587
- productUsesSubstOzoneDepletingSubs: {
26588
- bau: 20,
26589
- conditionalNdc: 15,
26590
- unconditionalNdc: 33,
26591
- },
26592
- otherProductManufactureUse: {
26593
- bau: 20,
26594
- conditionalNdc: 15,
26595
- unconditionalNdc: 33,
26596
- },
26597
- other: {
26598
- bau: 20,
26599
- conditionalNdc: 15,
26600
- unconditionalNdc: 33,
26601
- },
26602
- },
26603
- agricultureForestryOtherLandUse: {
26604
- livestock: { bau: 20, conditionalNdc: 15, unconditionalNdc: 33 },
26605
- land: {
26606
- bau: 20,
26607
- conditionalNdc: 15,
26608
- unconditionalNdc: 33,
26609
- },
26610
- aggregateNonCo2SourcesLand: {
26611
- bau: 20,
26612
- conditionalNdc: 15,
26613
- unconditionalNdc: 33,
26614
- },
26615
- other: {
26616
- bau: 20,
26617
- conditionalNdc: 15,
26618
- unconditionalNdc: 33,
26619
- },
26620
- },
26621
- waste: {
26622
- solidWasteDisposal: {
26623
- bau: 20,
26624
- conditionalNdc: 15,
26625
- unconditionalNdc: 33,
26626
- },
26627
- biologicalTreatmentSolidWaste: {
26628
- bau: 20,
26629
- conditionalNdc: 15,
26630
- unconditionalNdc: 33,
26631
- },
26632
- incinerationOpenBurningWaste: {
26633
- bau: 20,
26634
- conditionalNdc: 15,
26635
- unconditionalNdc: 33,
26636
- },
26637
- wastewaterTreatmentDischarge: {
26638
- bau: 20,
26639
- conditionalNdc: 15,
26640
- unconditionalNdc: 33,
26641
- },
26642
- other: {
26643
- bau: 20,
26644
- conditionalNdc: 15,
26645
- unconditionalNdc: 33,
26646
- },
26647
- },
26648
- other: {
26649
- indirectN2oEmissions: {
26650
- bau: 20,
26651
- conditionalNdc: 15,
26652
- unconditionalNdc: 33,
26653
- },
26654
- other: {
26655
- bau: 20,
26656
- conditionalNdc: 15,
26657
- unconditionalNdc: 33,
26658
- },
26659
- },
26660
- totalCo2WithoutLand: {
26661
- bau: 20,
26662
- conditionalNdc: 15,
26663
- unconditionalNdc: 33,
26664
- },
26665
- totalCo2WithLand: {
26666
- bau: 20,
26667
- conditionalNdc: 15,
26668
- unconditionalNdc: 33,
26669
- },
26670
- state: 'FINALIZED',
26671
- version: 1,
26672
- created_at: 1698644100397,
26673
- },
26674
- {
26675
- id: 2,
26676
- country: 'NG',
26677
- year: 2022,
26678
- energyEmissions: {
26679
- fuelCombustionActivities: {
26680
- energyIndustries: {
26681
- bau: 20,
26682
- conditionalNdc: 15,
26683
- unconditionalNdc: 33,
26684
- },
26685
- manufacturingIndustriesConstruction: {
26686
- bau: 20,
26687
- conditionalNdc: 15,
26688
- unconditionalNdc: 33,
26689
- },
26690
- transport: {
26691
- bau: 20,
26692
- conditionalNdc: 15,
26693
- unconditionalNdc: 33,
26694
- },
26695
- otherSectors: {
26696
- bau: 20,
26697
- conditionalNdc: 15,
26698
- unconditionalNdc: 33,
26699
- },
26700
- nonSpecified: {
26701
- bau: 20,
26702
- conditionalNdc: 15,
26703
- unconditionalNdc: 33,
26704
- },
26705
- },
26706
- fugitiveEmissionsFromFuels: {
26707
- solidFuels: {
26708
- bau: 20,
26709
- conditionalNdc: 15,
26710
- unconditionalNdc: 33,
26711
- },
26712
- oilNaturalGas: {
26713
- bau: 20,
26714
- conditionalNdc: 15,
26715
- unconditionalNdc: 33,
26716
- },
26717
- otherEmissionsEnergyProduction: {
26718
- bau: 20,
26719
- conditionalNdc: 15,
26720
- unconditionalNdc: 33,
26721
- },
26722
- },
26723
- carbonDioxideTransportStorage: {
26724
- transportOfCo2: {
26725
- bau: 20,
26726
- conditionalNdc: 15,
26727
- unconditionalNdc: 33,
26728
- },
26729
- injectionStorage: {
26730
- bau: 20,
26731
- conditionalNdc: 15,
26732
- unconditionalNdc: 33,
26733
- },
26734
- other: {
26735
- bau: 20,
26736
- conditionalNdc: 15,
26737
- unconditionalNdc: 33,
26738
- },
26739
- },
26740
- },
26741
- industrialProcessesProductUse: {
26742
- mineralIndustry: {
26743
- bau: 20,
26744
- conditionalNdc: 15,
26745
- unconditionalNdc: 33,
26746
- },
26747
- chemicalIndustry: {
26748
- bau: 20,
26749
- conditionalNdc: 15,
26750
- unconditionalNdc: 33,
26751
- },
26752
- metalIndustry: {
26753
- bau: 20,
26754
- conditionalNdc: 15,
26755
- unconditionalNdc: 33,
26756
- },
26757
- nonEnergyProductsFuelsSolventUse: {
26758
- bau: 20,
26759
- conditionalNdc: 15,
26760
- unconditionalNdc: 33,
26761
- },
26762
- electronicsIndustry: {
26763
- bau: 20,
26764
- conditionalNdc: 15,
26765
- unconditionalNdc: 33,
26766
- },
26767
- productUsesSubstOzoneDepletingSubs: {
26768
- bau: 20,
26769
- conditionalNdc: 15,
26770
- unconditionalNdc: 33,
26771
- },
26772
- otherProductManufactureUse: {
26773
- bau: 20,
26774
- conditionalNdc: 15,
26775
- unconditionalNdc: 33,
26776
- },
26777
- other: {
26778
- bau: 20,
26779
- conditionalNdc: 15,
26780
- unconditionalNdc: 33,
26781
- },
26782
- },
26783
- agricultureForestryOtherLandUse: {
26784
- livestock: { bau: 20, conditionalNdc: 15, unconditionalNdc: 33 },
26785
- land: {
26786
- bau: 20,
26787
- conditionalNdc: 15,
26788
- unconditionalNdc: 33,
26789
- },
26790
- aggregateNonCo2SourcesLand: {
26791
- bau: 20,
26792
- conditionalNdc: 15,
26793
- unconditionalNdc: 33,
26794
- },
26795
- other: {
26796
- bau: 20,
26797
- conditionalNdc: 15,
26798
- unconditionalNdc: 33,
26799
- },
26800
- },
26801
- waste: {
26802
- solidWasteDisposal: {
26803
- bau: 20,
26804
- conditionalNdc: 15,
26805
- unconditionalNdc: 33,
26806
- },
26807
- biologicalTreatmentSolidWaste: {
26808
- bau: 20,
26809
- conditionalNdc: 15,
26810
- unconditionalNdc: 33,
26811
- },
26812
- incinerationOpenBurningWaste: {
26813
- bau: 20,
26814
- conditionalNdc: 15,
26815
- unconditionalNdc: 33,
26816
- },
26817
- wastewaterTreatmentDischarge: {
26818
- bau: 20,
26819
- conditionalNdc: 15,
26820
- unconditionalNdc: 33,
26821
- },
26822
- other: {
26823
- bau: 20,
26824
- conditionalNdc: 15,
26825
- unconditionalNdc: 33,
26826
- },
26827
- },
26828
- other: {
26829
- indirectN2oEmissions: {
26830
- bau: 20,
26831
- conditionalNdc: 15,
26832
- unconditionalNdc: 33,
26833
- },
26834
- other: {
26835
- bau: 20,
26836
- conditionalNdc: 15,
26837
- unconditionalNdc: 33,
26838
- },
26839
- },
26840
- totalCo2WithoutLand: {
26841
- bau: 20,
26842
- conditionalNdc: 15,
26843
- unconditionalNdc: 33,
26844
- },
26845
- totalCo2WithLand: {
26846
- bau: 20,
26847
- conditionalNdc: 15,
26848
- unconditionalNdc: 33,
26849
- },
26850
- state: 'FINALIZED',
26851
- version: 1,
26852
- created_at: 1698644100397,
26853
- },
26854
- ];
26855
- var _a = useConnection(); _a.put; _a.get; var post = _a.post;
26856
- var _b = React.useState(false), loading = _b[0], setLoading = _b[1];
26857
- var _c = React.useState(false), isPendingFinalization = _c[0], setIsPendingFinalization = _c[1];
26858
- var _d = React.useState(null); _d[0]; var setSelectedYear = _d[1];
26859
- var _e = React.useState(''), uploadedFileName = _e[0], setUploadedFileName = _e[1];
26860
- var _f = React.useState([]), disabledYears = _f[0], setDisabledYears = _f[1];
26861
- var _g = React.useState(); _g[0]; var setChangedValues = _g[1];
26862
- var _h = React.useState(0), totalNationalBau = _h[0], setTotalNationalBau = _h[1];
26863
- var _j = React.useState(0), totalNationalConditionalNdc = _j[0], setTotalNationalConditionalNdc = _j[1];
26864
- var _k = React.useState(0), totalNationalUnconditionalNdc = _k[0], setTotalNationalUnconditionalNdc = _k[1];
26865
- var _l = React.useState(0), energyEmissionsBau = _l[0], setEnergyEmissionsBau = _l[1];
26866
- var _m = React.useState(0), energyEmissionsConditionalNdc = _m[0], setEnergyEmissionsConditionalNdc = _m[1];
26867
- var _o = React.useState(0), energyEmissionsUnconditionalNdc = _o[0], setEnergyEmissionsUnconditionalNdc = _o[1];
26868
- var _p = React.useState(0), fuelCombustionActivitiesBau = _p[0], setFuelCombustionActivitiesBau = _p[1];
26869
- var _q = React.useState(0), fuelCombustionActivitiesConditionalNdc = _q[0], setFuelCombustionActivitiesConditionalNdc = _q[1];
26870
- var _r = React.useState(0), fuelCombustionActivitiesUnconditionalNdc = _r[0], setFuelCombustionActivitiesUnconditionalNdc = _r[1];
26871
- var _s = React.useState(0), fugitiveEmissionsFromFuelsBau = _s[0], setFugitiveEmissionsFromFuelsBau = _s[1];
26872
- var _t = React.useState(0), fugitiveEmissionsFromFuelsConditionalNdc = _t[0], setFugitiveEmissionsFromFuelsConditionalNdc = _t[1];
26873
- var _u = React.useState(0), fugitiveEmissionsFromFuelsUnconditionalNdc = _u[0], setFugitiveEmissionsFromFuelsUnconditionalNdc = _u[1];
26874
- var _v = React.useState(0), carbonDioxideTransportStorageBau = _v[0], setCarbonDioxideTransportStorageBau = _v[1];
26875
- var _w = React.useState(0), carbonDioxideTransportStorageConditionalNdc = _w[0], setCarbonDioxideTransportStorageConditionalNdc = _w[1];
26876
- var _x = React.useState(0), carbonDioxideTransportStorageUnconditionalNdc = _x[0], setCarbonDioxideTransportStorageUnconditionalNdc = _x[1];
26877
- var _y = React.useState(0), industrialProcessesProductUseBau = _y[0], setIndustrialProcessesProductUseBau = _y[1];
26878
- var _z = React.useState(0), industrialProcessesProductUseConditionalNdc = _z[0], setIndustrialProcessesProductUseConditionalNdc = _z[1];
26879
- var _0 = React.useState(0), industrialProcessesProductUseUnconditionalNdc = _0[0], setIndustrialProcessesProductUseUnconditionalNdc = _0[1];
26880
- var _1 = React.useState(0), agricultureForestryOtherLandUseBau = _1[0], setAgricultureForestryOtherLandUseBau = _1[1];
26881
- var _2 = React.useState(0), agricultureForestryOtherLandUseConditionalNdc = _2[0], setAgricultureForestryOtherLandUseConditionalNdc = _2[1];
26882
- var _3 = React.useState(0), agricultureForestryOtherLandUseUnconditionalNdc = _3[0], setAgricultureForestryOtherLandUseUnconditionalNdc = _3[1];
26883
- var _4 = React.useState(0), wasteBau = _4[0], setWasteBau = _4[1];
26884
- var _5 = React.useState(0), wasteConditionalNdc = _5[0], setWasteConditionalNdc = _5[1];
26885
- var _6 = React.useState(0), wasteUnconditionalNdc = _6[0], setWasteUnconditionalNdc = _6[1];
26886
- var _7 = React.useState(0), otherBau = _7[0], setOtherBau = _7[1];
26887
- var _8 = React.useState(0), otherConditionalNdc = _8[0], setOtherConditionalNdc = _8[1];
26888
- var _9 = React.useState(0), otherUnconditionalNdc = _9[0], setOtherUnconditionalNdc = _9[1];
26889
- var _10 = React.useState(false), isSavedFormDataSet = _10[0], setIsSavedFormDataSet = _10[1];
26540
+ var _a = React.useState([]), data = _a[0], setData = _a[1];
26541
+ var _b = useConnection(); _b.put; var get = _b.get, post = _b.post;
26542
+ var _c = React.useState(false), loading = _c[0], setLoading = _c[1];
26543
+ var _d = React.useState(false), isPendingFinalization = _d[0], setIsPendingFinalization = _d[1];
26544
+ var _e = React.useState(null); _e[0]; var setSelectedYear = _e[1];
26545
+ var _f = React.useState(''), uploadedFileName = _f[0], setUploadedFileName = _f[1];
26546
+ var _g = React.useState([]), disabledYears = _g[0], setDisabledYears = _g[1];
26547
+ var _h = React.useState(); _h[0]; var setChangedValues = _h[1];
26548
+ var _j = React.useState(0), totalNationalBau = _j[0], setTotalNationalBau = _j[1];
26549
+ var _k = React.useState(0), totalNationalConditionalNdc = _k[0], setTotalNationalConditionalNdc = _k[1];
26550
+ var _l = React.useState(0), totalNationalUnconditionalNdc = _l[0], setTotalNationalUnconditionalNdc = _l[1];
26551
+ var _m = React.useState(0), energyEmissionsBau = _m[0], setEnergyEmissionsBau = _m[1];
26552
+ var _o = React.useState(0), energyEmissionsConditionalNdc = _o[0], setEnergyEmissionsConditionalNdc = _o[1];
26553
+ var _p = React.useState(0), energyEmissionsUnconditionalNdc = _p[0], setEnergyEmissionsUnconditionalNdc = _p[1];
26554
+ var _q = React.useState(0), fuelCombustionActivitiesBau = _q[0], setFuelCombustionActivitiesBau = _q[1];
26555
+ var _r = React.useState(0), fuelCombustionActivitiesConditionalNdc = _r[0], setFuelCombustionActivitiesConditionalNdc = _r[1];
26556
+ var _s = React.useState(0), fuelCombustionActivitiesUnconditionalNdc = _s[0], setFuelCombustionActivitiesUnconditionalNdc = _s[1];
26557
+ var _t = React.useState(0), fugitiveEmissionsFromFuelsBau = _t[0], setFugitiveEmissionsFromFuelsBau = _t[1];
26558
+ var _u = React.useState(0), fugitiveEmissionsFromFuelsConditionalNdc = _u[0], setFugitiveEmissionsFromFuelsConditionalNdc = _u[1];
26559
+ var _v = React.useState(0), fugitiveEmissionsFromFuelsUnconditionalNdc = _v[0], setFugitiveEmissionsFromFuelsUnconditionalNdc = _v[1];
26560
+ var _w = React.useState(0), carbonDioxideTransportStorageBau = _w[0], setCarbonDioxideTransportStorageBau = _w[1];
26561
+ var _x = React.useState(0), carbonDioxideTransportStorageConditionalNdc = _x[0], setCarbonDioxideTransportStorageConditionalNdc = _x[1];
26562
+ var _y = React.useState(0), carbonDioxideTransportStorageUnconditionalNdc = _y[0], setCarbonDioxideTransportStorageUnconditionalNdc = _y[1];
26563
+ var _z = React.useState(0), industrialProcessesProductUseBau = _z[0], setIndustrialProcessesProductUseBau = _z[1];
26564
+ var _0 = React.useState(0), industrialProcessesProductUseConditionalNdc = _0[0], setIndustrialProcessesProductUseConditionalNdc = _0[1];
26565
+ var _1 = React.useState(0), industrialProcessesProductUseUnconditionalNdc = _1[0], setIndustrialProcessesProductUseUnconditionalNdc = _1[1];
26566
+ var _2 = React.useState(0), agricultureForestryOtherLandUseBau = _2[0], setAgricultureForestryOtherLandUseBau = _2[1];
26567
+ var _3 = React.useState(0), agricultureForestryOtherLandUseConditionalNdc = _3[0], setAgricultureForestryOtherLandUseConditionalNdc = _3[1];
26568
+ var _4 = React.useState(0), agricultureForestryOtherLandUseUnconditionalNdc = _4[0], setAgricultureForestryOtherLandUseUnconditionalNdc = _4[1];
26569
+ var _5 = React.useState(0), wasteBau = _5[0], setWasteBau = _5[1];
26570
+ var _6 = React.useState(0), wasteConditionalNdc = _6[0], setWasteConditionalNdc = _6[1];
26571
+ var _7 = React.useState(0), wasteUnconditionalNdc = _7[0], setWasteUnconditionalNdc = _7[1];
26572
+ var _8 = React.useState(0), otherBau = _8[0], setOtherBau = _8[1];
26573
+ var _9 = React.useState(0), otherConditionalNdc = _9[0], setOtherConditionalNdc = _9[1];
26574
+ var _10 = React.useState(0), otherUnconditionalNdc = _10[0], setOtherUnconditionalNdc = _10[1];
26575
+ var _11 = React.useState(false), isSavedFormDataSet = _11[0], setIsSavedFormDataSet = _11[1];
26576
+ var _12 = React.useState(false), openResetFormModal = _12[0], setOpenResetFormModal = _12[1];
26577
+ var _13 = React.useState(''), errorMsg = _13[0], setErrorMsg = _13[1];
26578
+ var _14 = React.useState({}), actionInfo = _14[0], setActionInfo = _14[1];
26890
26579
  var Panel = antd.Collapse.Panel;
26891
26580
  var form = antd.Form.useForm()[0];
26892
26581
  var createSetFieldObject = function (obj, objName) {
@@ -26986,17 +26675,20 @@ var GHGProjectionsComponent = function (props) {
26986
26675
  setFormValues(upData);
26987
26676
  };
26988
26677
  React.useEffect(function () {
26678
+ console.log('++++++++++++++data', data);
26989
26679
  var hasSaveState = data.some(function (item) { return item.state === 'SAVED'; });
26990
- var years = data.map(function (item) { return !(item.state === 'SAVED') && item.year; });
26680
+ console.log('++++++++++++++hasSaveState', hasSaveState);
26681
+ // const years = data.map((item: any) => !(item.state === 'SAVED') && item.year);
26682
+ // console.log('++++++++++++++data, years', data, years);
26991
26683
  console.log(uploadedFileName);
26992
26684
  setIsPendingFinalization(hasSaveState);
26993
26685
  // Update 'disabledYears' only if 'years' array has changed
26994
- setDisabledYears(function (prevYears) {
26995
- if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
26996
- return years;
26997
- }
26998
- return prevYears;
26999
- });
26686
+ // setDisabledYears((prevYears) => {
26687
+ // if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
26688
+ // return years;
26689
+ // }
26690
+ // return prevYears;
26691
+ // });
27000
26692
  }, [data, uploadedFileName]);
27001
26693
  function calculateSumEmissionView(obj, conditionType) {
27002
26694
  var sum = 0;
@@ -27225,8 +26917,108 @@ var GHGProjectionsComponent = function (props) {
27225
26917
  }
27226
26918
  });
27227
26919
  }); };
26920
+ var resetForm = function () { return __awaiter(void 0, void 0, void 0, function () {
26921
+ return __generator(this, function (_a) {
26922
+ switch (_a.label) {
26923
+ case 0:
26924
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
26925
+ return [4 /*yield*/, getProjectionData()];
26926
+ case 1:
26927
+ // eslint-disable-next-line no-use-before-define, @typescript-eslint/no-use-before-define
26928
+ _a.sent();
26929
+ setOpenResetFormModal(false);
26930
+ setIsSavedFormDataSet(false);
26931
+ clearUploadDoc();
26932
+ if (!isPendingFinalization) {
26933
+ form.resetFields();
26934
+ setFuelCombustionActivitiesBau(0);
26935
+ setFuelCombustionActivitiesConditionalNdc(0);
26936
+ setFuelCombustionActivitiesUnconditionalNdc(0);
26937
+ setFugitiveEmissionsFromFuelsBau(0);
26938
+ setFugitiveEmissionsFromFuelsConditionalNdc(0);
26939
+ setFugitiveEmissionsFromFuelsUnconditionalNdc(0);
26940
+ setCarbonDioxideTransportStorageBau(0);
26941
+ setCarbonDioxideTransportStorageConditionalNdc(0);
26942
+ setCarbonDioxideTransportStorageUnconditionalNdc(0);
26943
+ setIndustrialProcessesProductUseBau(0);
26944
+ setIndustrialProcessesProductUseConditionalNdc(0);
26945
+ setIndustrialProcessesProductUseUnconditionalNdc(0);
26946
+ setAgricultureForestryOtherLandUseBau(0);
26947
+ setAgricultureForestryOtherLandUseConditionalNdc(0);
26948
+ setAgricultureForestryOtherLandUseUnconditionalNdc(0);
26949
+ setWasteBau(0);
26950
+ setWasteConditionalNdc(0);
26951
+ setWasteUnconditionalNdc(0);
26952
+ setOtherBau(0);
26953
+ setOtherConditionalNdc(0);
26954
+ setOtherUnconditionalNdc(0);
26955
+ }
26956
+ return [2 /*return*/];
26957
+ }
26958
+ });
26959
+ }); };
26960
+ var onResetFormCanceled = function () {
26961
+ setOpenResetFormModal(false);
26962
+ };
26963
+ var onResetFormModel = function () {
26964
+ setActionInfo({
26965
+ action: "".concat(t('ghgInventory:proceed')),
26966
+ headerText: "".concat(t('ghgInventory:discardHeaderText')),
26967
+ type: 'danger',
26968
+ icon: React.createElement(icons.CloseCircleOutlined, null),
26969
+ });
26970
+ setErrorMsg('');
26971
+ setOpenResetFormModal(true);
26972
+ };
26973
+ var getProjectionData = function () { return __awaiter(void 0, void 0, void 0, function () {
26974
+ var response, error_1;
26975
+ return __generator(this, function (_a) {
26976
+ switch (_a.label) {
26977
+ case 0:
26978
+ setLoading(true);
26979
+ _a.label = 1;
26980
+ case 1:
26981
+ _a.trys.push([1, 3, 4, 5]);
26982
+ return [4 /*yield*/, get('national/projections')];
26983
+ case 2:
26984
+ response = _a.sent();
26985
+ console.log('Projection GET -> ', response);
26986
+ if (response === null || response === void 0 ? void 0 : response.data) {
26987
+ setData(response.data);
26988
+ }
26989
+ return [3 /*break*/, 5];
26990
+ case 3:
26991
+ error_1 = _a.sent();
26992
+ console.log('Error in projection fetch - ', error_1);
26993
+ antd.message.open({
26994
+ type: 'error',
26995
+ content: error_1 === null || error_1 === void 0 ? void 0 : error_1.message,
26996
+ duration: 4,
26997
+ style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
26998
+ });
26999
+ return [3 /*break*/, 5];
27000
+ case 4:
27001
+ setLoading(false);
27002
+ return [7 /*endfinally*/];
27003
+ case 5: return [2 /*return*/];
27004
+ }
27005
+ });
27006
+ }); };
27007
+ React.useEffect(function () {
27008
+ var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {
27009
+ return __generator(this, function (_a) {
27010
+ switch (_a.label) {
27011
+ case 0: return [4 /*yield*/, getProjectionData()];
27012
+ case 1:
27013
+ _a.sent();
27014
+ return [2 /*return*/];
27015
+ }
27016
+ });
27017
+ }); };
27018
+ fetchData();
27019
+ }, []);
27228
27020
  var onSubmitForm = function (values) { return __awaiter(void 0, void 0, void 0, function () {
27229
- var fields, payload, response, error_1;
27021
+ var fields, payload, response, error_2;
27230
27022
  return __generator(this, function (_a) {
27231
27023
  switch (_a.label) {
27232
27024
  case 0:
@@ -27252,16 +27044,17 @@ var GHGProjectionsComponent = function (props) {
27252
27044
  }
27253
27045
  return [3 /*break*/, 6];
27254
27046
  case 4:
27255
- error_1 = _a.sent();
27256
- console.log('Error in projection creation - ', error_1);
27047
+ error_2 = _a.sent();
27048
+ console.log('Error in projection creation - ', error_2);
27257
27049
  antd.message.open({
27258
27050
  type: 'error',
27259
- content: error_1 === null || error_1 === void 0 ? void 0 : error_1.message,
27051
+ content: error_2 === null || error_2 === void 0 ? void 0 : error_2.message,
27260
27052
  duration: 4,
27261
27053
  style: { textAlign: 'right', marginRight: 15, marginTop: 10 },
27262
27054
  });
27263
27055
  return [3 /*break*/, 6];
27264
27056
  case 5:
27057
+ getProjectionData();
27265
27058
  setLoading(false);
27266
27059
  return [7 /*endfinally*/];
27267
27060
  case 6: return [2 /*return*/];
@@ -27311,12 +27104,23 @@ var GHGProjectionsComponent = function (props) {
27311
27104
  setIsSavedFormDataSet(true);
27312
27105
  };
27313
27106
  React.useEffect(function () {
27314
- if (isPendingFinalization) {
27315
- if (!isSavedFormDataSet) {
27316
- var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
27107
+ // if (isPendingFinalization) {
27108
+ if (!isSavedFormDataSet) {
27109
+ var savedData = data.filter(function (item) { return item.state === 'SAVED'; });
27110
+ if (savedData && savedData.length > 0) {
27317
27111
  setFormValues(savedData[0]);
27318
27112
  }
27319
27113
  }
27114
+ var years = data
27115
+ .filter(function (item) { return !(item.state === 'SAVED' && item.year); }) // Filter out items where state is not 'SAVED'
27116
+ .map(function (item) { return parseInt(item.year); });
27117
+ // Update 'disabledYears' only if 'years' array has changed
27118
+ setDisabledYears(function (prevYears) {
27119
+ if (JSON.stringify(prevYears) !== JSON.stringify(years)) {
27120
+ return years;
27121
+ }
27122
+ return prevYears;
27123
+ });
27320
27124
  }, [data]);
27321
27125
  var checkFile = function (file) {
27322
27126
  var isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
@@ -27332,6 +27136,12 @@ var GHGProjectionsComponent = function (props) {
27332
27136
  }
27333
27137
  return e === null || e === void 0 ? void 0 : e.fileList;
27334
27138
  };
27139
+ var clearUploadDoc = function () {
27140
+ setUploadedFileName('');
27141
+ form.setFieldsValue({
27142
+ emissionsDocument: null,
27143
+ });
27144
+ };
27335
27145
  var handleYearChange = function (date, dateString) {
27336
27146
  setSelectedYear(dateString);
27337
27147
  };
@@ -27703,7 +27513,8 @@ var GHGProjectionsComponent = function (props) {
27703
27513
  React.createElement("div", { className: "body-sub-title" }, t("ghgInventory:totalNationalEmissionSubTitle")))),
27704
27514
  React.createElement("div", { className: "content-card add-projection" },
27705
27515
  React.createElement(antd.Tabs, { defaultActiveKey: "Add New", centered: true },
27706
- ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT || (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.MINISTRY) && (React.createElement(antd.Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
27516
+ ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT ||
27517
+ (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.MINISTRY) && (React.createElement(antd.Tabs.TabPane, { key: "Add New", tab: t("ghgInventory:addNew") },
27707
27518
  React.createElement("div", null,
27708
27519
  React.createElement(antd.Form, { labelCol: { span: 20 }, wrapperCol: { span: 24 }, name: "add-projection", className: "programme-details-form", layout: "vertical", requiredMark: true, form: form, onValuesChange: onValuesChange, onFinish: onSubmitForm },
27709
27520
  React.createElement(antd.Row, null,
@@ -27784,7 +27595,7 @@ var GHGProjectionsComponent = function (props) {
27784
27595
  } },
27785
27596
  React.createElement(antd.Button, { icon: React.createElement(icons.UploadOutlined, null) }, t("ghgInventory:upload"))))),
27786
27597
  React.createElement(antd.Col, { xl: 16, md: 16, className: "add-new-upload-file-name-input" },
27787
- React.createElement(antd.Input, { value: uploadedFileName, readOnly: true }))))),
27598
+ React.createElement(antd.Input, { value: uploadedFileName, readOnly: true, suffix: uploadedFileName && (React.createElement(antd.Button, { onClick: clearUploadDoc, icon: React.createElement(icons.DeleteOutlined, null), style: { marginRight: '-10px', padding: '0px 6px' } })) }))))),
27788
27599
  React.createElement(antd.Row, { gutter: 16 },
27789
27600
  React.createElement(antd.Col, { span: 9, offset: 12 },
27790
27601
  React.createElement(antd.Row, { gutter: 16, className: "table-heading-row" },
@@ -27852,9 +27663,7 @@ var GHGProjectionsComponent = function (props) {
27852
27663
  React.createElement(antd.InputNumber, null)))))),
27853
27664
  React.createElement("div", { className: "steps-actions" },
27854
27665
  React.createElement(antd.Button, { type: "primary", htmlType: "submit", loading: loading }, "Submit"),
27855
- React.createElement(antd.Button, { className: "back-btn",
27856
- // onClick={() => prevOne()}
27857
- loading: loading }, "Cancel")))))),
27666
+ React.createElement(antd.Button, { className: "back-btn", onClick: onResetFormModel, loading: loading }, "Cancel")))))),
27858
27667
  data.map(function (tabData) {
27859
27668
  return tabData.state === 'FINALIZED' && (React.createElement(antd.Tabs.TabPane, { key: tabData.id.toString(), tab: React.createElement("span", null,
27860
27669
  tabData.year,
@@ -27952,7 +27761,8 @@ var GHGProjectionsComponent = function (props) {
27952
27761
  })));
27953
27762
  })));
27954
27763
  })))));
27955
- }))))));
27764
+ })))),
27765
+ React.createElement(DiscardChangesConfirmationModel, { t: t, actionInfo: actionInfo, onActionConfirmed: resetForm, onActionCanceled: onResetFormCanceled, openModal: openResetFormModal, errorMsg: errorMsg, loading: loading })));
27956
27766
  };
27957
27767
 
27958
27768
  exports.AddNdcActionComponent = AddNdcActionComponent;