@undp/carbon-library 1.0.135-ghg-inventory.9.8 → 1.0.135-ghg-inventory.9.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +119 -305
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/Definitions/Enums/sector.enum.d.ts +4 -4
- package/dist/esm/index.js +119 -305
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/Definitions/Enums/sector.enum.d.ts +4 -4
- package/dist/index.d.ts +4 -4
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
@@ -4405,10 +4405,10 @@ exports.EmissionSector = void 0;
|
|
4405
4405
|
})(exports.EmissionSector || (exports.EmissionSector = {}));
|
4406
4406
|
exports.EmissionGas = void 0;
|
4407
4407
|
(function (EmissionGas) {
|
4408
|
-
EmissionGas["
|
4409
|
-
EmissionGas["
|
4410
|
-
EmissionGas["
|
4411
|
-
EmissionGas["
|
4408
|
+
EmissionGas["co2"] = "CO<sub>2</sub>";
|
4409
|
+
EmissionGas["ch4"] = "CH<sub>4</sub>";
|
4410
|
+
EmissionGas["n2o"] = "N<sub>2</sub>O";
|
4411
|
+
EmissionGas["co2eq"] = "CO<sub>2</sub>-eq";
|
4412
4412
|
})(exports.EmissionGas || (exports.EmissionGas = {}));
|
4413
4413
|
exports.EmissionSubSectors = void 0;
|
4414
4414
|
(function (EmissionSubSectors) {
|
@@ -28912,15 +28912,16 @@ var emissionComparisonOptionsSub = function (labels, chartColors) {
|
|
28912
28912
|
|
28913
28913
|
var RangePicker = antd.DatePicker.RangePicker;
|
28914
28914
|
var GHGDashboardComponent = function (props) {
|
28915
|
-
var t = props.t, useUserContext = props.useUserContext
|
28915
|
+
var t = props.t, useUserContext = props.useUserContext, useConnection = props.useConnection, Chart = props.Chart, ButtonGroup = props.ButtonGroup, Link = props.Link, isMultipleDashboardsVisible = props.isMultipleDashboardsVisible;
|
28916
|
+
var _a = useConnection(); _a.get; var post = _a.post; _a.delete;
|
28916
28917
|
var userInfoState = useUserContext().userInfoState;
|
28917
|
-
var
|
28918
|
-
var
|
28919
|
-
var
|
28920
|
-
var
|
28921
|
-
var
|
28922
|
-
var
|
28923
|
-
var
|
28918
|
+
var _b = React.useState(moment().year()), endYear = _b[0], setEndYear = _b[1];
|
28919
|
+
var _c = React.useState(moment().subtract('10', 'years').year()), startYear = _c[0], setStartYear = _c[1];
|
28920
|
+
var _e = React.useState(false), loadingCharts = _e[0], setLoadingCharts = _e[1];
|
28921
|
+
var _f = React.useState({}), data = _f[0], setData = _f[1];
|
28922
|
+
var _g = React.useState({}), estimateData = _g[0], setEstimateData = _g[1];
|
28923
|
+
var _h = React.useState({}), actualData = _h[0], setActualData = _h[1];
|
28924
|
+
var _j = React.useState(window.innerWidth), screenWidth = _j[0], setScreenWidth = _j[1];
|
28924
28925
|
var colors = ['#16B1FF', '#FF8183', '#7FEABF', '#FFB480', '#D8D8D8'];
|
28925
28926
|
var colorsComparison = ['#7FEABF', '#FF8183', '#16B1FF'];
|
28926
28927
|
var layout = [
|
@@ -28930,275 +28931,6 @@ var GHGDashboardComponent = function (props) {
|
|
28930
28931
|
[exports.GhgStatCardTypes.AGG_EMISSIONS_COMPARISON],
|
28931
28932
|
];
|
28932
28933
|
var TTSuffix = (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.PROGRAMME_DEVELOPER ? 'My' : '';
|
28933
|
-
var response = {
|
28934
|
-
data: {
|
28935
|
-
stats: {
|
28936
|
-
AGG_EMISSIONS_BY_SECTOR: {
|
28937
|
-
data: {
|
28938
|
-
xLabels: ['2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023'],
|
28939
|
-
agricultureForestryOtherLandUse: [500, 230, 125, 689, 255, 361, 178, 388],
|
28940
|
-
energyEmissions: [230, 548, 99, 100, 330, 105, 273, 225],
|
28941
|
-
industrialProcessesProductUse: [601, 552, 85, 63, 500, 230, 125, 689],
|
28942
|
-
other: [330, 105, 273, 225, 601, 552, 85, 63],
|
28943
|
-
waste: [255, 361, 178, 388, 330, 105, 273, 225],
|
28944
|
-
},
|
28945
|
-
last: '1700786087613',
|
28946
|
-
all: {
|
28947
|
-
statusUpdateTime: '1700786087613',
|
28948
|
-
creditUpdateTime: '1700785938783',
|
28949
|
-
},
|
28950
|
-
},
|
28951
|
-
AGG_EMISSIONS_BY_GAS: {
|
28952
|
-
data: {
|
28953
|
-
xLabels: ['2020', '2021', '2022', '2023'],
|
28954
|
-
CO2: [500, 230, 125, 689],
|
28955
|
-
CH4: [230, 548, 99, 100],
|
28956
|
-
N2O: [601, 552, 85, 63],
|
28957
|
-
CO2eq: [330, 105, 273, 225],
|
28958
|
-
},
|
28959
|
-
last: '1700786087613',
|
28960
|
-
all: {
|
28961
|
-
statusUpdateTime: '1700786087613',
|
28962
|
-
creditUpdateTime: '1700785938783',
|
28963
|
-
},
|
28964
|
-
},
|
28965
|
-
AGG_EMISSIONS_MITIGATION_POTENTIAL_BY_SECTOR: {
|
28966
|
-
data: {
|
28967
|
-
xLabels: ['2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023'],
|
28968
|
-
agricultureForestryOtherLandUse: [500, 230, 125, 689, 255, 361, 178, 388],
|
28969
|
-
energyEmissions: [230, 548, 99, 100, 330, 105, 273, 225],
|
28970
|
-
industrialProcessesProductUse: [601, 552, 85, 63, 500, 230, 125, 689],
|
28971
|
-
other: [330, 105, 273, 225, 601, 552, 85, 63],
|
28972
|
-
waste: [255, 361, 178, 388, 330, 105, 273, 225],
|
28973
|
-
},
|
28974
|
-
last: '1700786087613',
|
28975
|
-
all: {
|
28976
|
-
statusUpdateTime: '1700786087613',
|
28977
|
-
creditUpdateTime: '1700785938783',
|
28978
|
-
},
|
28979
|
-
},
|
28980
|
-
AGG_EMISSIONS_COMPARISON: {
|
28981
|
-
data: {
|
28982
|
-
xLabels: ['2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023'],
|
28983
|
-
bau: [50, 23, 25, 69, 55, 31, 18, 38],
|
28984
|
-
conditionalNdc: [23, 58, 99, 10, 30, 15, 27, 25],
|
28985
|
-
unconditionalNdc: [61, 52, 85, 63, 50, 20, 15, 68],
|
28986
|
-
actual: [25, 86, 46, 63, 57, 23, 25, 65],
|
28987
|
-
},
|
28988
|
-
last: '1700786087613',
|
28989
|
-
all: {
|
28990
|
-
statusUpdateTime: '1700786087613',
|
28991
|
-
creditUpdateTime: '1700785938783',
|
28992
|
-
},
|
28993
|
-
},
|
28994
|
-
AGG_REDUCTION_PERCENT_BAU_BY_SECTOR: {
|
28995
|
-
data: {
|
28996
|
-
estimate: {
|
28997
|
-
data: {
|
28998
|
-
xLabels: [
|
28999
|
-
['Fuel', 'Combustion', 'Activities'],
|
29000
|
-
['Fugitive', 'emissions', ' from', 'fuels'],
|
29001
|
-
['Carbon', 'dioxide', 'Transport', 'and', 'Storage'],
|
29002
|
-
['Mineral', 'Industry'],
|
29003
|
-
['Chemical', 'Industry'],
|
29004
|
-
['Metal', 'Industry'],
|
29005
|
-
['Non-Energy', 'Products', 'from', 'Fuels', 'and', 'Solvent', 'Use'],
|
29006
|
-
['Electronics', 'Industry'],
|
29007
|
-
['Product', 'Uses as', 'Substitutes', 'for', 'Ozone', 'Depleting', 'Substances'],
|
29008
|
-
['Other', 'Product', 'Manufacture', 'and', 'Use'],
|
29009
|
-
['Other', '(Other', 'Product', 'Manufacture', 'and', 'Use)'],
|
29010
|
-
'Livestock',
|
29011
|
-
'Land',
|
29012
|
-
['Aggregate', 'sources', 'and', 'non-CO2', 'emissions', 'sources', 'on land'],
|
29013
|
-
['Other', '(Agriculture,', 'Forestry,', 'and', 'Other', 'Land', 'Use)'],
|
29014
|
-
['Solid', 'Waste', 'Disposal'],
|
29015
|
-
['Biological', 'Treatment', 'of', 'Solid', 'Waste'],
|
29016
|
-
['Incineration', 'and', 'Open', 'Burning', 'of', 'Waste'],
|
29017
|
-
['Wastewater', 'Treatment', 'and', 'Discharge'],
|
29018
|
-
['Other', '(Waste)'],
|
29019
|
-
[
|
29020
|
-
'Indirect',
|
29021
|
-
'N2O',
|
29022
|
-
'emissions',
|
29023
|
-
'from',
|
29024
|
-
'the',
|
29025
|
-
'atmospheric',
|
29026
|
-
'deposition',
|
29027
|
-
'of nitrogen',
|
29028
|
-
'in NOx',
|
29029
|
-
'and NH3',
|
29030
|
-
],
|
29031
|
-
'Other',
|
29032
|
-
],
|
29033
|
-
fuelCombustionActivities: [
|
29034
|
-
23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29035
|
-
],
|
29036
|
-
fugitiveEmissionsFromFuels: [
|
29037
|
-
0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29038
|
-
],
|
29039
|
-
carbonDioxideTransportStorage: [
|
29040
|
-
0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29041
|
-
],
|
29042
|
-
mineralIndustry: [
|
29043
|
-
0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29044
|
-
],
|
29045
|
-
chemicalIndustry: [
|
29046
|
-
0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29047
|
-
],
|
29048
|
-
metalIndustry: [0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
29049
|
-
nonEnergyProductsFuelsSolventUse: [
|
29050
|
-
0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29051
|
-
],
|
29052
|
-
electronicsIndustry: [
|
29053
|
-
0, 0, 0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29054
|
-
],
|
29055
|
-
productUsesSubstOzoneDepletingSubs: [
|
29056
|
-
0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29057
|
-
],
|
29058
|
-
otherProductManufactureUse: [
|
29059
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29060
|
-
],
|
29061
|
-
otherIndustrialProcessesProductUse: [
|
29062
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29063
|
-
],
|
29064
|
-
livestock: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
29065
|
-
land: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
29066
|
-
aggregateNonCo2SourcesLand: [
|
29067
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0,
|
29068
|
-
],
|
29069
|
-
otherAgricultureForestryOtherLandUse: [
|
29070
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
|
29071
|
-
],
|
29072
|
-
solidWasteDisposal: [
|
29073
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13.5, 0, 0, 0, 0, 0, 0,
|
29074
|
-
],
|
29075
|
-
biologicalTreatmentSolidWaste: [
|
29076
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0,
|
29077
|
-
],
|
29078
|
-
incinerationOpenBurningWaste: [
|
29079
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 125, 0, 0, 0, 0,
|
29080
|
-
],
|
29081
|
-
wastewaterTreatmentDischarge: [
|
29082
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 0,
|
29083
|
-
],
|
29084
|
-
otherWaste: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0],
|
29085
|
-
indirectN2oEmissions: [
|
29086
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.25, 0,
|
29087
|
-
],
|
29088
|
-
other: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30],
|
29089
|
-
},
|
29090
|
-
last: '1700786087613',
|
29091
|
-
all: {
|
29092
|
-
statusUpdateTime: '1700786087613',
|
29093
|
-
creditUpdateTime: '1700785938783',
|
29094
|
-
},
|
29095
|
-
},
|
29096
|
-
actual: {
|
29097
|
-
data: {
|
29098
|
-
xLabels: [
|
29099
|
-
['Fuel', 'Combustion', 'Activities'],
|
29100
|
-
['Fugitive', 'emissions', ' from', 'fuels'],
|
29101
|
-
['Carbon', 'dioxide', 'Transport', 'and', 'Storage'],
|
29102
|
-
['Mineral', 'Industry'],
|
29103
|
-
['Chemical', 'Industry'],
|
29104
|
-
['Metal', 'Industry'],
|
29105
|
-
['Non-Energy', 'Products', 'from', 'Fuels', 'and', 'Solvent', 'Use'],
|
29106
|
-
['Electronics', 'Industry'],
|
29107
|
-
['Product', 'Uses as', 'Substitutes', 'for', 'Ozone', 'Depleting', 'Substances'],
|
29108
|
-
['Other', 'Product', 'Manufacture', 'and', 'Use'],
|
29109
|
-
['Other', '(Other', 'Product', 'Manufacture', 'and', 'Use)'],
|
29110
|
-
'Livestock',
|
29111
|
-
'Land',
|
29112
|
-
['Aggregate', 'sources', 'and', 'non-CO2', 'emissions', 'sources', 'on land'],
|
29113
|
-
['Other', '(Agriculture,', 'Forestry,', 'and', 'Other', 'Land', 'Use)'],
|
29114
|
-
['Solid', 'Waste', 'Disposal'],
|
29115
|
-
['Biological', 'Treatment', 'of', 'Solid', 'Waste'],
|
29116
|
-
['Incineration', 'and', 'Open', 'Burning', 'of', 'Waste'],
|
29117
|
-
['Wastewater', 'Treatment', 'and', 'Discharge'],
|
29118
|
-
['Other', '(Waste)'],
|
29119
|
-
[
|
29120
|
-
'Indirect',
|
29121
|
-
'N2O',
|
29122
|
-
'emissions',
|
29123
|
-
'from',
|
29124
|
-
'the',
|
29125
|
-
'atmospheric',
|
29126
|
-
'deposition',
|
29127
|
-
'of nitrogen',
|
29128
|
-
'in NOx',
|
29129
|
-
'and NH3',
|
29130
|
-
],
|
29131
|
-
'Other',
|
29132
|
-
],
|
29133
|
-
fuelCombustionActivities: [
|
29134
|
-
23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29135
|
-
],
|
29136
|
-
fugitiveEmissionsFromFuels: [
|
29137
|
-
0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29138
|
-
],
|
29139
|
-
carbonDioxideTransportStorage: [
|
29140
|
-
0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29141
|
-
],
|
29142
|
-
mineralIndustry: [
|
29143
|
-
0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29144
|
-
],
|
29145
|
-
chemicalIndustry: [
|
29146
|
-
0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29147
|
-
],
|
29148
|
-
metalIndustry: [0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
29149
|
-
nonEnergyProductsFuelsSolventUse: [
|
29150
|
-
0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29151
|
-
],
|
29152
|
-
electronicsIndustry: [
|
29153
|
-
0, 0, 0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29154
|
-
],
|
29155
|
-
productUsesSubstOzoneDepletingSubs: [
|
29156
|
-
0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29157
|
-
],
|
29158
|
-
otherProductManufactureUse: [
|
29159
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29160
|
-
],
|
29161
|
-
otherIndustrialProcessesProductUse: [
|
29162
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
29163
|
-
],
|
29164
|
-
livestock: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
29165
|
-
land: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
29166
|
-
aggregateNonCo2SourcesLand: [
|
29167
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0,
|
29168
|
-
],
|
29169
|
-
otherAgricultureForestryOtherLandUse: [
|
29170
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
|
29171
|
-
],
|
29172
|
-
solidWasteDisposal: [
|
29173
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13.5, 0, 0, 0, 0, 0, 0,
|
29174
|
-
],
|
29175
|
-
biologicalTreatmentSolidWaste: [
|
29176
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0,
|
29177
|
-
],
|
29178
|
-
incinerationOpenBurningWaste: [
|
29179
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 125, 0, 0, 0, 0,
|
29180
|
-
],
|
29181
|
-
wastewaterTreatmentDischarge: [
|
29182
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 0,
|
29183
|
-
],
|
29184
|
-
otherWaste: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0],
|
29185
|
-
indirectN2oEmissions: [
|
29186
|
-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.25, 0,
|
29187
|
-
],
|
29188
|
-
other: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30],
|
29189
|
-
},
|
29190
|
-
last: '1700786087613',
|
29191
|
-
all: {
|
29192
|
-
statusUpdateTime: '1700786087613',
|
29193
|
-
creditUpdateTime: '1700785938783',
|
29194
|
-
},
|
29195
|
-
},
|
29196
|
-
},
|
29197
|
-
},
|
29198
|
-
},
|
29199
|
-
lastUpdate: 1700796691,
|
29200
|
-
},
|
29201
|
-
};
|
29202
28934
|
var handleResize = function () {
|
29203
28935
|
setScreenWidth(window.innerWidth);
|
29204
28936
|
};
|
@@ -29235,6 +28967,7 @@ var GHGDashboardComponent = function (props) {
|
|
29235
28967
|
});
|
29236
28968
|
}); };
|
29237
28969
|
React.useEffect(function () {
|
28970
|
+
getData();
|
29238
28971
|
console.log('****************Date changed*******', startYear, endYear);
|
29239
28972
|
}, [startYear, endYear]);
|
29240
28973
|
var parseEmissionSectorData = function (statData) {
|
@@ -29325,7 +29058,6 @@ var GHGDashboardComponent = function (props) {
|
|
29325
29058
|
var emissionsAggByComparison = statData === null || statData === void 0 ? void 0 : statData.data;
|
29326
29059
|
projectionTypesArray === null || projectionTypesArray === void 0 ? void 0 : projectionTypesArray.map(function (projectionType) {
|
29327
29060
|
if (emissionsAggByComparison[projectionType] !== undefined) {
|
29328
|
-
console.log('------------parseEmissionComparisonData-----------------', projectionType);
|
29329
29061
|
emissionComparisonSeriesData.push({
|
29330
29062
|
name: exports.ProjectionTypes[projectionType],
|
29331
29063
|
data: emissionsAggByComparison[projectionType],
|
@@ -29411,31 +29143,113 @@ var GHGDashboardComponent = function (props) {
|
|
29411
29143
|
},
|
29412
29144
|
},
|
29413
29145
|
};
|
29414
|
-
|
29146
|
+
var genPayload = function () {
|
29147
|
+
var stats = [];
|
29148
|
+
for (var item in exports.GhgStatCardTypes) {
|
29149
|
+
stats.push({
|
29150
|
+
type: item,
|
29151
|
+
statFilter: {
|
29152
|
+
startTime: startYear !== 0 ? startYear : undefined,
|
29153
|
+
endTime: endYear !== 0 ? endYear : undefined,
|
29154
|
+
onlyMine: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.PROGRAMME_DEVELOPER,
|
29155
|
+
},
|
29156
|
+
});
|
29157
|
+
}
|
29158
|
+
return {
|
29159
|
+
system: exports.SystemNames.CARBON_TRANSPARENCY,
|
29160
|
+
stats: stats,
|
29161
|
+
};
|
29162
|
+
};
|
29163
|
+
var getData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
29164
|
+
var response_1, newd, key, obj, config, dx, error_1;
|
29415
29165
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k;
|
29416
|
-
|
29417
|
-
|
29418
|
-
|
29419
|
-
|
29420
|
-
|
29421
|
-
|
29422
|
-
|
29423
|
-
|
29424
|
-
|
29425
|
-
|
29426
|
-
|
29427
|
-
|
29428
|
-
|
29429
|
-
|
29430
|
-
|
29431
|
-
|
29432
|
-
|
29433
|
-
|
29434
|
-
|
29166
|
+
return __generator(this, function (_l) {
|
29167
|
+
switch (_l.label) {
|
29168
|
+
case 0:
|
29169
|
+
setLoadingCharts(true);
|
29170
|
+
_l.label = 1;
|
29171
|
+
case 1:
|
29172
|
+
_l.trys.push([1, 3, 4, 5]);
|
29173
|
+
return [4 /*yield*/, post("stats/ghg/agg", genPayload(), undefined,
|
29174
|
+
// process.env.REACT_APP_STAT_URL
|
29175
|
+
'http://localhost:3100')];
|
29176
|
+
case 2:
|
29177
|
+
response_1 = _l.sent();
|
29178
|
+
console.log('Response', response_1);
|
29179
|
+
newd = {};
|
29180
|
+
for (key in (_a = response_1 === null || response_1 === void 0 ? void 0 : response_1.data) === null || _a === void 0 ? void 0 : _a.stats) {
|
29181
|
+
if ((_b = response_1 === null || response_1 === void 0 ? void 0 : response_1.data) === null || _b === void 0 ? void 0 : _b.stats.hasOwnProperty(key)) {
|
29182
|
+
if (key === exports.GhgStatCardTypes.AGG_REDUCTION_PERCENT_BAU_BY_SECTOR) {
|
29183
|
+
setActualData((_f = (_e = (_c = response_1 === null || response_1 === void 0 ? void 0 : response_1.data.stats.AGG_REDUCTION_PERCENT_BAU_BY_SECTOR) === null || _c === void 0 ? void 0 : _c.data) === null || _e === void 0 ? void 0 : _e.actual) === null || _f === void 0 ? void 0 : _f.data);
|
29184
|
+
setEstimateData((_j = (_h = (_g = response_1 === null || response_1 === void 0 ? void 0 : response_1.data.stats.AGG_REDUCTION_PERCENT_BAU_BY_SECTOR) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h.estimate) === null || _j === void 0 ? void 0 : _j.data);
|
29185
|
+
}
|
29186
|
+
obj = (_k = response_1 === null || response_1 === void 0 ? void 0 : response_1.data) === null || _k === void 0 ? void 0 : _k.stats[key];
|
29187
|
+
config = supportedWidgetList[key];
|
29188
|
+
if (config) {
|
29189
|
+
dx = config.callbacks.parseData(obj, config.configs.dataLabelField, config.configs.dataValField);
|
29190
|
+
newd[key] = {
|
29191
|
+
data: dx,
|
29192
|
+
time: !obj.last || obj.last === '0' || obj.last === 0
|
29193
|
+
? '0'
|
29194
|
+
: moment(parseInt(obj.last)).fromNow(),
|
29195
|
+
};
|
29196
|
+
}
|
29197
|
+
}
|
29198
|
+
}
|
29199
|
+
console.log('newd', newd);
|
29200
|
+
setData(newd);
|
29201
|
+
return [3 /*break*/, 5];
|
29202
|
+
case 3:
|
29203
|
+
error_1 = _l.sent();
|
29204
|
+
console.log("Error in getting users", error_1);
|
29205
|
+
antd.message.open({
|
29206
|
+
type: "error",
|
29207
|
+
content: error_1.message,
|
29208
|
+
duration: 3,
|
29209
|
+
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
29210
|
+
});
|
29211
|
+
return [3 /*break*/, 5];
|
29212
|
+
case 4:
|
29213
|
+
setLoadingCharts(false);
|
29214
|
+
return [7 /*endfinally*/];
|
29215
|
+
case 5: return [2 /*return*/];
|
29435
29216
|
}
|
29436
|
-
}
|
29437
|
-
|
29438
|
-
|
29217
|
+
});
|
29218
|
+
}); };
|
29219
|
+
React.useEffect(function () {
|
29220
|
+
// console.log('Response', response);
|
29221
|
+
// const newd: any = {};
|
29222
|
+
// for (const key in response?.data?.stats) {
|
29223
|
+
// if (response?.data?.stats.hasOwnProperty(key)) {
|
29224
|
+
// if (key === GhgStatCardTypes.AGG_REDUCTION_PERCENT_BAU_BY_SECTOR) {
|
29225
|
+
// setActualData(
|
29226
|
+
// response?.data.stats.AGG_REDUCTION_PERCENT_BAU_BY_SECTOR?.data?.actual?.data
|
29227
|
+
// );
|
29228
|
+
// setEstimateData(
|
29229
|
+
// response?.data.stats.AGG_REDUCTION_PERCENT_BAU_BY_SECTOR?.data?.estimate?.data
|
29230
|
+
// );
|
29231
|
+
// }
|
29232
|
+
// const obj = response?.data?.stats[key];
|
29233
|
+
// const config = supportedWidgetList[key];
|
29234
|
+
// if (config) {
|
29235
|
+
// const dx = config.callbacks.parseData(
|
29236
|
+
// obj,
|
29237
|
+
// config.configs.dataLabelField,
|
29238
|
+
// config.configs.dataValField
|
29239
|
+
// );
|
29240
|
+
// newd[key] = {
|
29241
|
+
// data: dx,
|
29242
|
+
// time:
|
29243
|
+
// !obj.last || obj.last === '0' || obj.last === 0
|
29244
|
+
// ? '0'
|
29245
|
+
// : moment(parseInt(obj.last)).fromNow(),
|
29246
|
+
// };
|
29247
|
+
// }
|
29248
|
+
// }
|
29249
|
+
// }
|
29250
|
+
// console.log('newd', newd);
|
29251
|
+
// setData(newd);
|
29252
|
+
getData();
|
29439
29253
|
}, []);
|
29440
29254
|
var getColorsForPercentageCharts = function (percentageData) {
|
29441
29255
|
if (percentageData === undefined || percentageData === null) {
|