1
|
|
|
import React, { Fragment, useEffect, useState, useContext } from 'react'; |
2
|
|
|
import { |
3
|
|
|
Breadcrumb, |
4
|
|
|
BreadcrumbItem, |
5
|
|
|
Row, |
6
|
|
|
Col, |
7
|
|
|
Card, |
8
|
|
|
CardBody, |
9
|
|
|
Button, |
10
|
|
|
ButtonGroup, |
11
|
|
|
Form, |
12
|
|
|
FormGroup, |
13
|
|
|
Input, |
14
|
|
|
Label, |
15
|
|
|
CustomInput, |
16
|
|
|
Spinner |
17
|
|
|
} from 'reactstrap'; |
18
|
|
|
import CountUp from 'react-countup'; |
19
|
|
|
import moment from 'moment'; |
20
|
|
|
import loadable from '@loadable/component'; |
21
|
|
|
import Cascader from 'rc-cascader'; |
22
|
|
|
import CardSummary from '../common/CardSummary'; |
23
|
|
|
import MultiTrendChart from '../common/MultiTrendChart'; |
24
|
|
|
import LineChart from '../common/LineChart'; |
25
|
|
|
import SharePie from '../common/SharePie'; |
26
|
|
|
import { getCookieValue, createCookie } from '../../../helpers/utils'; |
27
|
|
|
import withRedirect from '../../../hoc/withRedirect'; |
28
|
|
|
import { withTranslation } from 'react-i18next'; |
29
|
|
|
import { toast } from 'react-toastify'; |
30
|
|
|
import ButtonIcon from '../../common/ButtonIcon'; |
31
|
|
|
import { APIBaseURL } from '../../../config'; |
32
|
|
|
import { periodTypeOptions } from '../common/PeriodTypeOptions'; |
33
|
|
|
import { comparisonTypeOptions } from '../common/ComparisonTypeOptions'; |
34
|
|
|
import DateRangePickerWrapper from '../common/DateRangePickerWrapper'; |
35
|
|
|
import { endOfDay} from 'date-fns'; |
36
|
|
|
import AppContext from '../../../context/Context'; |
37
|
|
|
|
38
|
|
|
const ChildSpacesTable = loadable(() => import('../common/ChildSpacesTable')); |
39
|
|
|
const DetailedDataTable = loadable(() => import('../common/DetailedDataTable')); |
40
|
|
|
|
41
|
|
|
const SpaceIncome = ({ setRedirect, setRedirectUrl, t }) => { |
42
|
|
|
let current_moment = moment(); |
43
|
|
|
useEffect(() => { |
44
|
|
|
let is_logged_in = getCookieValue('is_logged_in'); |
45
|
|
|
let user_name = getCookieValue('user_name'); |
46
|
|
|
let user_display_name = getCookieValue('user_display_name'); |
47
|
|
|
let user_uuid = getCookieValue('user_uuid'); |
48
|
|
|
let token = getCookieValue('token'); |
49
|
|
|
if (is_logged_in === null || !is_logged_in) { |
50
|
|
|
setRedirectUrl(`/authentication/basic/login`); |
51
|
|
|
setRedirect(true); |
52
|
|
|
} else { |
53
|
|
|
//update expires time of cookies |
54
|
|
|
createCookie('is_logged_in', true, 1000 * 60 * 60 * 8); |
55
|
|
|
createCookie('user_name', user_name, 1000 * 60 * 60 * 8); |
56
|
|
|
createCookie('user_display_name', user_display_name, 1000 * 60 * 60 * 8); |
57
|
|
|
createCookie('user_uuid', user_uuid, 1000 * 60 * 60 * 8); |
58
|
|
|
createCookie('token', token, 1000 * 60 * 60 * 8); |
59
|
|
|
} |
60
|
|
|
}); |
61
|
|
|
// State |
62
|
|
|
// Query Parameters |
63
|
|
|
const [selectedSpaceName, setSelectedSpaceName] = useState(undefined); |
64
|
|
|
const [selectedSpaceID, setSelectedSpaceID] = useState(undefined); |
65
|
|
|
const [comparisonType, setComparisonType] = useState('month-on-month'); |
66
|
|
|
const [periodType, setPeriodType] = useState('daily'); |
67
|
|
|
const [cascaderOptions, setCascaderOptions] = useState(undefined); |
68
|
|
|
const [basePeriodDateRange, setBasePeriodDateRange] = useState([current_moment.clone().subtract(1, 'months').startOf('month').toDate(), current_moment.clone().subtract(1, 'months').toDate()]); |
69
|
|
|
const [basePeriodDateRangePickerDisabled, setBasePeriodDateRangePickerDisabled] = useState(true); |
70
|
|
|
const [reportingPeriodDateRange, setReportingPeriodDateRange] = useState([current_moment.clone().startOf('month').toDate(), current_moment.toDate()]); |
71
|
|
|
const dateRangePickerLocale = { |
72
|
|
|
sunday: t('sunday'), |
73
|
|
|
monday: t('monday'), |
74
|
|
|
tuesday: t('tuesday'), |
75
|
|
|
wednesday: t('wednesday'), |
76
|
|
|
thursday: t('thursday'), |
77
|
|
|
friday: t('friday'), |
78
|
|
|
saturday: t('saturday'), |
79
|
|
|
ok: t('ok'), |
80
|
|
|
today: t('today'), |
81
|
|
|
yesterday: t('yesterday'), |
82
|
|
|
hours: t('hours'), |
83
|
|
|
minutes: t('minutes'), |
84
|
|
|
seconds: t('seconds'), |
85
|
|
|
last7Days: t('last7Days'), |
86
|
|
|
formattedMonthPattern: 'yyyy-MM-dd' |
87
|
|
|
}; |
88
|
|
|
const dateRangePickerStyle = { display: 'block', zIndex: 10}; |
89
|
|
|
const { language } = useContext(AppContext); |
90
|
|
|
|
91
|
|
|
// buttons |
92
|
|
|
const [submitButtonDisabled, setSubmitButtonDisabled] = useState(true); |
93
|
|
|
const [spinnerHidden, setSpinnerHidden] = useState(true); |
94
|
|
|
const [exportButtonHidden, setExportButtonHidden] = useState(true); |
95
|
|
|
|
96
|
|
|
//Results |
97
|
|
|
const [incomeShareData, setIncomeShareData] = useState([]); |
98
|
|
|
|
99
|
|
|
const [cardSummaryList, setCardSummaryList] = useState([]); |
100
|
|
|
|
101
|
|
|
const [spaceBaseAndReportingNames, setSpaceBaseAndReportingNames] = useState({"a0":""}); |
102
|
|
|
const [spaceBaseAndReportingUnits, setSpaceBaseAndReportingUnits] = useState({"a0":"()"}); |
103
|
|
|
|
104
|
|
|
const [spaceBaseLabels, setSpaceBaseLabels] = useState({"a0": []}); |
105
|
|
|
const [spaceBaseData, setSpaceBaseData] = useState({"a0": []}); |
106
|
|
|
const [spaceBaseSubtotals, setSpaceBaseSubtotals] = useState({"a0": (0).toFixed(2)}); |
107
|
|
|
|
108
|
|
|
const [spaceReportingLabels, setSpaceReportingLabels] = useState({"a0": []}); |
109
|
|
|
const [spaceReportingData, setSpaceReportingData] = useState({"a0": []}); |
110
|
|
|
const [spaceReportingSubtotals, setSpaceReportingSubtotals] = useState({"a0": (0).toFixed(2)}); |
111
|
|
|
|
112
|
|
|
const [spaceReportingRates, setSpaceReportingRates] = useState({"a0": []}); |
113
|
|
|
const [spaceReportingOptions, setSpaceReportingOptions] = useState([]); |
114
|
|
|
|
115
|
|
|
const [parameterLineChartLabels, setParameterLineChartLabels] = useState([]); |
116
|
|
|
const [parameterLineChartData, setParameterLineChartData] = useState({}); |
117
|
|
|
const [parameterLineChartOptions, setParameterLineChartOptions] = useState([]); |
118
|
|
|
|
119
|
|
|
const [detailedDataTableData, setDetailedDataTableData] = useState([]); |
120
|
|
|
const [detailedDataTableColumns, setDetailedDataTableColumns] = useState([{dataField: 'startdatetime', text: t('Datetime'), sort: true}]); |
121
|
|
|
|
122
|
|
|
const [childSpacesTableData, setChildSpacesTableData] = useState([]); |
123
|
|
|
const [childSpacesTableColumns, setChildSpacesTableColumns] = useState([{dataField: 'name', text: t('Child Spaces'), sort: true }]); |
124
|
|
|
const [excelBytesBase64, setExcelBytesBase64] = useState(undefined); |
125
|
|
|
|
126
|
|
|
useEffect(() => { |
127
|
|
|
let isResponseOK = false; |
128
|
|
|
fetch(APIBaseURL + '/spaces/tree', { |
129
|
|
|
method: 'GET', |
130
|
|
|
headers: { |
131
|
|
|
"Content-type": "application/json", |
132
|
|
|
"User-UUID": getCookieValue('user_uuid'), |
133
|
|
|
"Token": getCookieValue('token') |
134
|
|
|
}, |
135
|
|
|
body: null, |
136
|
|
|
|
137
|
|
|
}).then(response => { |
138
|
|
|
console.log(response); |
139
|
|
|
if (response.ok) { |
140
|
|
|
isResponseOK = true; |
141
|
|
|
// enable submit button |
142
|
|
|
setSubmitButtonDisabled(false); |
143
|
|
|
} |
144
|
|
|
return response.json(); |
145
|
|
|
}).then(json => { |
146
|
|
|
console.log(json); |
147
|
|
|
if (isResponseOK) { |
148
|
|
|
// rename keys |
149
|
|
|
json = JSON.parse(JSON.stringify([json]).split('"id":').join('"value":').split('"name":').join('"label":')); |
150
|
|
|
setCascaderOptions(json); |
151
|
|
|
setSelectedSpaceName([json[0]].map(o => o.label)); |
152
|
|
|
setSelectedSpaceID([json[0]].map(o => o.value)); |
153
|
|
|
} else { |
154
|
|
|
toast.error(t(json.description)); |
155
|
|
|
} |
156
|
|
|
}).catch(err => { |
157
|
|
|
console.log(err); |
158
|
|
|
}); |
159
|
|
|
|
160
|
|
|
}, []); |
161
|
|
|
|
162
|
|
|
const labelClasses = 'ls text-uppercase text-600 font-weight-semi-bold mb-0'; |
163
|
|
|
|
164
|
|
|
let onSpaceCascaderChange = (value, selectedOptions) => { |
165
|
|
|
console.log(value, selectedOptions); |
166
|
|
|
setSelectedSpaceName(selectedOptions.map(o => o.label).join('/')); |
167
|
|
|
setSelectedSpaceID(value[value.length - 1]); |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
let onComparisonTypeChange = ({ target }) => { |
171
|
|
|
console.log(target.value); |
172
|
|
|
setComparisonType(target.value); |
173
|
|
|
if (target.value === 'year-over-year') { |
174
|
|
|
setBasePeriodDateRangePickerDisabled(true); |
175
|
|
|
setBasePeriodDateRange([moment(reportingPeriodDateRange[0]).subtract(1, 'years').toDate(), |
176
|
|
|
moment(reportingPeriodDateRange[1]).subtract(1, 'years').toDate()]); |
177
|
|
|
} else if (target.value === 'month-on-month') { |
178
|
|
|
setBasePeriodDateRangePickerDisabled(true); |
179
|
|
|
setBasePeriodDateRange([moment(reportingPeriodDateRange[0]).subtract(1, 'months').toDate(), |
180
|
|
|
moment(reportingPeriodDateRange[1]).subtract(1, 'months').toDate()]); |
181
|
|
|
} else if (target.value === 'free-comparison') { |
182
|
|
|
setBasePeriodDateRangePickerDisabled(false); |
183
|
|
|
} else if (target.value === 'none-comparison') { |
184
|
|
|
setBasePeriodDateRange([null, null]); |
185
|
|
|
setBasePeriodDateRangePickerDisabled(true); |
186
|
|
|
} |
187
|
|
|
}; |
188
|
|
|
|
189
|
|
|
// Callback fired when value changed |
190
|
|
|
let onBasePeriodChange = (DateRange) => { |
191
|
|
|
if(DateRange == null) { |
192
|
|
|
setBasePeriodDateRange([null, null]); |
193
|
|
|
} else { |
194
|
|
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') { |
195
|
|
|
// if the user did not change time value, set the default time to the end of day |
196
|
|
|
DateRange[1] = endOfDay(DateRange[1]); |
197
|
|
|
} |
198
|
|
|
setBasePeriodDateRange([DateRange[0], DateRange[1]]); |
199
|
|
|
} |
200
|
|
|
}; |
201
|
|
|
|
202
|
|
|
// Callback fired when value changed |
203
|
|
|
let onReportingPeriodChange = (DateRange) => { |
204
|
|
|
if(DateRange == null) { |
205
|
|
|
setReportingPeriodDateRange([null, null]); |
206
|
|
|
} else { |
207
|
|
|
if (moment(DateRange[1]).format('HH:mm:ss') == '00:00:00') { |
208
|
|
|
// if the user did not change time value, set the default time to the end of day |
209
|
|
|
DateRange[1] = endOfDay(DateRange[1]); |
210
|
|
|
} |
211
|
|
|
setReportingPeriodDateRange([DateRange[0], DateRange[1]]); |
212
|
|
|
if (comparisonType === 'year-over-year') { |
213
|
|
|
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'years').toDate(), moment(DateRange[1]).clone().subtract(1, 'years').toDate()]); |
214
|
|
|
} else if (comparisonType === 'month-on-month') { |
215
|
|
|
setBasePeriodDateRange([moment(DateRange[0]).clone().subtract(1, 'months').toDate(), moment(DateRange[1]).clone().subtract(1, 'months').toDate()]); |
216
|
|
|
} |
217
|
|
|
} |
218
|
|
|
}; |
219
|
|
|
|
220
|
|
|
// Callback fired when value clean |
221
|
|
|
let onBasePeriodClean = event => { |
222
|
|
|
setBasePeriodDateRange([null, null]); |
223
|
|
|
}; |
224
|
|
|
|
225
|
|
|
// Callback fired when value clean |
226
|
|
|
let onReportingPeriodClean = event => { |
227
|
|
|
setReportingPeriodDateRange([null, null]); |
228
|
|
|
}; |
229
|
|
|
|
230
|
|
|
const isBasePeriodTimestampExists = (base_period_data) => { |
231
|
|
|
const timestamps = base_period_data['timestamps']; |
232
|
|
|
|
233
|
|
|
if (timestamps.length === 0) { |
234
|
|
|
return false; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
for (let i = 0; i < timestamps.length; i++) { |
238
|
|
|
if (timestamps[i].length > 0) { |
239
|
|
|
return true; |
240
|
|
|
} |
241
|
|
|
} |
242
|
|
|
return false |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
// Handler |
246
|
|
|
const handleSubmit = e => { |
247
|
|
|
e.preventDefault(); |
248
|
|
|
console.log('handleSubmit'); |
249
|
|
|
console.log(selectedSpaceID); |
250
|
|
|
console.log(comparisonType); |
251
|
|
|
console.log(periodType); |
252
|
|
|
console.log(basePeriodDateRange[0] != null ? moment(basePeriodDateRange[0]).format('YYYY-MM-DDTHH:mm:ss') : null) |
253
|
|
|
console.log(basePeriodDateRange[1] != null ? moment(basePeriodDateRange[1]).format('YYYY-MM-DDTHH:mm:ss') : null) |
254
|
|
|
console.log(moment(reportingPeriodDateRange[0]).format('YYYY-MM-DDTHH:mm:ss')) |
255
|
|
|
console.log(moment(reportingPeriodDateRange[1]).format('YYYY-MM-DDTHH:mm:ss')); |
256
|
|
|
|
257
|
|
|
// disable submit button |
258
|
|
|
setSubmitButtonDisabled(true); |
259
|
|
|
// show spinner |
260
|
|
|
setSpinnerHidden(false); |
261
|
|
|
// hide export button |
262
|
|
|
setExportButtonHidden(true) |
263
|
|
|
|
264
|
|
|
// Reinitialize tables |
265
|
|
|
setDetailedDataTableData([]); |
266
|
|
|
setChildSpacesTableData([]); |
267
|
|
|
|
268
|
|
|
let isResponseOK = false; |
269
|
|
|
fetch(APIBaseURL + '/reports/spaceincome?' + |
270
|
|
|
'spaceid=' + selectedSpaceID + |
271
|
|
|
'&periodtype=' + periodType + |
272
|
|
|
'&baseperiodstartdatetime=' + (basePeriodDateRange[0] != null ? moment(basePeriodDateRange[0]).format('YYYY-MM-DDTHH:mm:ss') : '') + |
273
|
|
|
'&baseperiodenddatetime=' + (basePeriodDateRange[1] != null ? moment(basePeriodDateRange[1]).format('YYYY-MM-DDTHH:mm:ss') : '') + |
274
|
|
|
'&reportingperiodstartdatetime=' + moment(reportingPeriodDateRange[0]).format('YYYY-MM-DDTHH:mm:ss') + |
275
|
|
|
'&reportingperiodenddatetime=' + moment(reportingPeriodDateRange[1]).format('YYYY-MM-DDTHH:mm:ss') + |
276
|
|
|
'&language=' + language, { |
277
|
|
|
method: 'GET', |
278
|
|
|
headers: { |
279
|
|
|
"Content-type": "application/json", |
280
|
|
|
"User-UUID": getCookieValue('user_uuid'), |
281
|
|
|
"Token": getCookieValue('token') |
282
|
|
|
}, |
283
|
|
|
body: null, |
284
|
|
|
|
285
|
|
|
}).then(response => { |
286
|
|
|
if (response.ok) { |
287
|
|
|
isResponseOK = true; |
288
|
|
|
} |
289
|
|
|
return response.json(); |
290
|
|
|
}).then(json => { |
291
|
|
|
if (isResponseOK) { |
292
|
|
|
console.log(json) |
293
|
|
|
|
294
|
|
|
let cardSummaryArray = [] |
295
|
|
|
json['reporting_period']['names'].forEach((currentValue, index) => { |
296
|
|
|
let cardSummaryItem = {} |
297
|
|
|
cardSummaryItem['name'] = json['reporting_period']['names'][index]; |
298
|
|
|
cardSummaryItem['unit'] = json['reporting_period']['units'][index]; |
299
|
|
|
cardSummaryItem['subtotal'] = json['reporting_period']['subtotals'][index]; |
300
|
|
|
cardSummaryItem['increment_rate'] = parseFloat(json['reporting_period']['increment_rates'][index] * 100).toFixed(2) + "%"; |
301
|
|
|
cardSummaryItem['subtotal_per_unit_area'] = json['reporting_period']['subtotals_per_unit_area'][index]; |
302
|
|
|
cardSummaryArray.push(cardSummaryItem); |
303
|
|
|
}); |
304
|
|
|
let cardSummaryItem = {} |
305
|
|
|
cardSummaryItem['name'] = t('Total'); |
306
|
|
|
cardSummaryItem['unit'] = json['reporting_period']['total_unit']; |
307
|
|
|
cardSummaryItem['subtotal'] = json['reporting_period']['total']; |
308
|
|
|
cardSummaryItem['increment_rate'] = parseFloat(json['reporting_period']['total_increment_rate'] * 100).toFixed(2) + "%"; |
309
|
|
|
cardSummaryItem['subtotal_per_unit_area'] = json['reporting_period']['total_per_unit_area']; |
310
|
|
|
cardSummaryArray.push(cardSummaryItem); |
311
|
|
|
setCardSummaryList(cardSummaryArray); |
312
|
|
|
|
313
|
|
|
let incomeDataArray = []; |
314
|
|
|
json['reporting_period']['names'].forEach((currentValue, index) => { |
315
|
|
|
let incomeDataItem = {} |
316
|
|
|
incomeDataItem['id'] = index; |
317
|
|
|
incomeDataItem['name'] = currentValue; |
318
|
|
|
incomeDataItem['value'] = json['reporting_period']['subtotals'][index]; |
319
|
|
|
incomeDataItem['color'] = "#"+((1<<24)*Math.random()|0).toString(16); |
320
|
|
|
incomeDataArray.push(incomeDataItem); |
321
|
|
|
}); |
322
|
|
|
setIncomeShareData(incomeDataArray); |
323
|
|
|
|
324
|
|
|
let base_timestamps = {} |
325
|
|
|
json['base_period']['timestamps'].forEach((currentValue, index) => { |
326
|
|
|
base_timestamps['a' + index] = currentValue; |
327
|
|
|
}); |
328
|
|
|
setSpaceBaseLabels(base_timestamps) |
329
|
|
|
|
330
|
|
|
let base_values = {} |
331
|
|
|
json['base_period']['values'].forEach((currentValue, index) => { |
332
|
|
|
base_values['a' + index] = currentValue; |
333
|
|
|
}); |
334
|
|
|
setSpaceBaseData(base_values) |
335
|
|
|
|
336
|
|
|
/* |
337
|
|
|
* Tip: |
338
|
|
|
* base_names === reporting_names |
339
|
|
|
* base_units === reporting_units |
340
|
|
|
* */ |
341
|
|
|
|
342
|
|
|
let base_and_reporting_names = {} |
343
|
|
|
json['reporting_period']['names'].forEach((currentValue, index) => { |
344
|
|
|
base_and_reporting_names['a' + index] = currentValue; |
345
|
|
|
}); |
346
|
|
|
setSpaceBaseAndReportingNames(base_and_reporting_names) |
347
|
|
|
|
348
|
|
|
let base_and_reporting_units = {} |
349
|
|
|
json['reporting_period']['units'].forEach((currentValue, index) => { |
350
|
|
|
base_and_reporting_units['a' + index] = "("+currentValue+")"; |
351
|
|
|
}); |
352
|
|
|
setSpaceBaseAndReportingUnits(base_and_reporting_units) |
353
|
|
|
|
354
|
|
|
let base_subtotals = {} |
355
|
|
|
json['base_period']['subtotals'].forEach((currentValue, index) => { |
356
|
|
|
base_subtotals['a' + index] = currentValue.toFixed(2); |
357
|
|
|
}); |
358
|
|
|
setSpaceBaseSubtotals(base_subtotals) |
359
|
|
|
|
360
|
|
|
let reporting_timestamps = {} |
361
|
|
|
json['reporting_period']['timestamps'].forEach((currentValue, index) => { |
362
|
|
|
reporting_timestamps['a' + index] = currentValue; |
363
|
|
|
}); |
364
|
|
|
setSpaceReportingLabels(reporting_timestamps); |
365
|
|
|
|
366
|
|
|
let reporting_values = {} |
367
|
|
|
json['reporting_period']['values'].forEach((currentValue, index) => { |
368
|
|
|
reporting_values['a' + index] = currentValue; |
369
|
|
|
}); |
370
|
|
|
setSpaceReportingData(reporting_values); |
371
|
|
|
|
372
|
|
|
let reporting_subtotals = {} |
373
|
|
|
json['reporting_period']['subtotals'].forEach((currentValue, index) => { |
374
|
|
|
reporting_subtotals['a' + index] = currentValue.toFixed(2); |
375
|
|
|
}); |
376
|
|
|
setSpaceReportingSubtotals(reporting_subtotals); |
377
|
|
|
|
378
|
|
|
let rates = {} |
379
|
|
|
json['reporting_period']['rates'].forEach((currentValue, index) => { |
380
|
|
|
let currentRate = Array(); |
381
|
|
|
currentValue.forEach((rate) => { |
382
|
|
|
currentRate.push(rate ? parseFloat(rate * 100).toFixed(2) : '0.00'); |
383
|
|
|
}); |
384
|
|
|
rates['a' + index] = currentRate; |
385
|
|
|
}); |
386
|
|
|
setSpaceReportingRates(rates) |
387
|
|
|
|
388
|
|
|
let options = Array(); |
389
|
|
|
json['reporting_period']['names'].forEach((currentValue, index) => { |
390
|
|
|
let unit = json['reporting_period']['units'][index]; |
391
|
|
|
options.push({ 'value': 'a' + index, 'label': currentValue + ' (' + unit + ')'}); |
392
|
|
|
}); |
393
|
|
|
setSpaceReportingOptions(options); |
394
|
|
|
|
395
|
|
|
let timestamps = {} |
396
|
|
|
json['parameters']['timestamps'].forEach((currentValue, index) => { |
397
|
|
|
timestamps['a' + index] = currentValue; |
398
|
|
|
}); |
399
|
|
|
setParameterLineChartLabels(timestamps); |
400
|
|
|
|
401
|
|
|
let values = {} |
402
|
|
|
json['parameters']['values'].forEach((currentValue, index) => { |
403
|
|
|
values['a' + index] = currentValue; |
404
|
|
|
}); |
405
|
|
|
setParameterLineChartData(values); |
406
|
|
|
|
407
|
|
|
let names = Array(); |
408
|
|
|
json['parameters']['names'].forEach((currentValue, index) => { |
409
|
|
|
|
410
|
|
|
names.push({ 'value': 'a' + index, 'label': currentValue }); |
411
|
|
|
}); |
412
|
|
|
setParameterLineChartOptions(names); |
413
|
|
|
|
414
|
|
|
if(!isBasePeriodTimestampExists(json['base_period'])) { |
415
|
|
|
let detailed_value_list = []; |
416
|
|
|
if (json['reporting_period']['timestamps'].length > 0) { |
417
|
|
|
json['reporting_period']['timestamps'][0].forEach((currentTimestamp, timestampIndex) => { |
418
|
|
|
let detailed_value = {}; |
419
|
|
|
detailed_value['id'] = timestampIndex; |
420
|
|
|
detailed_value['startdatetime'] = currentTimestamp; |
421
|
|
|
let total_current_timstamp = 0.0; |
422
|
|
|
json['reporting_period']['values'].forEach((currentValue, energyCategoryIndex) => { |
423
|
|
|
detailed_value['a' + energyCategoryIndex] = json['reporting_period']['values'][energyCategoryIndex][timestampIndex]; |
424
|
|
|
total_current_timstamp += json['reporting_period']['values'][energyCategoryIndex][timestampIndex]; |
425
|
|
|
}); |
426
|
|
|
detailed_value['total'] = total_current_timstamp; |
427
|
|
|
detailed_value_list.push(detailed_value); |
428
|
|
|
}); |
429
|
|
|
} |
430
|
|
|
; |
431
|
|
|
|
432
|
|
|
let detailed_value = {}; |
433
|
|
|
detailed_value['id'] = detailed_value_list.length; |
434
|
|
|
detailed_value['startdatetime'] = t('Subtotal'); |
435
|
|
|
let total_of_subtotals = 0.0; |
436
|
|
|
json['reporting_period']['subtotals'].forEach((currentValue, index) => { |
437
|
|
|
detailed_value['a' + index] = currentValue; |
438
|
|
|
total_of_subtotals += currentValue |
439
|
|
|
}); |
440
|
|
|
detailed_value['total'] = total_of_subtotals; |
441
|
|
|
detailed_value_list.push(detailed_value); |
442
|
|
|
setTimeout(() => { |
443
|
|
|
setDetailedDataTableData(detailed_value_list); |
444
|
|
|
}, 0) |
445
|
|
|
|
446
|
|
|
let detailed_column_list = []; |
447
|
|
|
detailed_column_list.push({ |
448
|
|
|
dataField: 'startdatetime', |
449
|
|
|
text: t('Datetime'), |
450
|
|
|
sort: true |
451
|
|
|
}); |
452
|
|
|
json['reporting_period']['names'].forEach((currentValue, index) => { |
453
|
|
|
let unit = json['reporting_period']['units'][index]; |
454
|
|
|
detailed_column_list.push({ |
455
|
|
|
dataField: 'a' + index, |
456
|
|
|
text: currentValue + ' (' + unit + ')', |
457
|
|
|
sort: true, |
458
|
|
|
formatter: function (decimalValue) { |
459
|
|
|
if (typeof decimalValue === 'number') { |
460
|
|
|
return decimalValue.toFixed(2); |
461
|
|
|
} else { |
462
|
|
|
return null; |
463
|
|
|
} |
464
|
|
|
} |
465
|
|
|
}); |
466
|
|
|
}); |
467
|
|
|
detailed_column_list.push({ |
468
|
|
|
dataField: 'total', |
469
|
|
|
text: t('Total') + ' (' + json['reporting_period']['total_unit'] + ')', |
470
|
|
|
sort: true, |
471
|
|
|
formatter: function (decimalValue) { |
472
|
|
|
if (typeof decimalValue === 'number') { |
473
|
|
|
return decimalValue.toFixed(2); |
474
|
|
|
} else { |
475
|
|
|
return null; |
476
|
|
|
} |
477
|
|
|
} |
478
|
|
|
}); |
479
|
|
|
setDetailedDataTableColumns(detailed_column_list); |
480
|
|
|
} else { |
481
|
|
|
/* |
482
|
|
|
* Tip: |
483
|
|
|
* json['base_period']['names'] === json['reporting_period']['names'] |
484
|
|
|
* json['base_period']['units'] === json['reporting_period']['units'] |
485
|
|
|
* */ |
486
|
|
|
let detailed_column_list = []; |
487
|
|
|
detailed_column_list.push({ |
488
|
|
|
dataField: 'basePeriodDatetime', |
489
|
|
|
text: t('Base Period') + ' - ' + t('Datetime'), |
490
|
|
|
sort: true |
491
|
|
|
}) |
492
|
|
|
|
493
|
|
|
json['base_period']['names'].forEach((currentValue, index) => { |
494
|
|
|
let unit = json['base_period']['units'][index]; |
495
|
|
|
detailed_column_list.push({ |
496
|
|
|
dataField: 'a' + index, |
497
|
|
|
text: t('Base Period') + ' - ' + currentValue + ' (' + unit + ')', |
498
|
|
|
sort: true, |
499
|
|
|
formatter: function (decimalValue) { |
500
|
|
|
if (typeof decimalValue === 'number') { |
501
|
|
|
return decimalValue.toFixed(2); |
502
|
|
|
} else { |
503
|
|
|
return null; |
504
|
|
|
} |
505
|
|
|
} |
506
|
|
|
}) |
507
|
|
|
}); |
508
|
|
|
|
509
|
|
|
detailed_column_list.push({ |
510
|
|
|
dataField: 'basePeriodTotal', |
511
|
|
|
text: t('Base Period') + ' - ' + t('Total') + ' (' + json['reporting_period']['total_unit'] + ')', |
512
|
|
|
sort: true, |
513
|
|
|
formatter: function (decimalValue) { |
514
|
|
|
if (typeof decimalValue === 'number') { |
515
|
|
|
return decimalValue.toFixed(2); |
516
|
|
|
} else { |
517
|
|
|
return null; |
518
|
|
|
} |
519
|
|
|
} |
520
|
|
|
}) |
521
|
|
|
|
522
|
|
|
detailed_column_list.push({ |
523
|
|
|
dataField: 'reportingPeriodDatetime', |
524
|
|
|
text: t('Reporting Period') + ' - ' + t('Datetime'), |
525
|
|
|
sort: true |
526
|
|
|
}) |
527
|
|
|
|
528
|
|
|
json['reporting_period']['names'].forEach((currentValue, index) => { |
529
|
|
|
let unit = json['reporting_period']['units'][index]; |
530
|
|
|
detailed_column_list.push({ |
531
|
|
|
dataField: 'b' + index, |
532
|
|
|
text: t('Reporting Period') + ' - ' + currentValue + ' (' + unit + ')', |
533
|
|
|
sort: true, |
534
|
|
|
formatter: function (decimalValue) { |
535
|
|
|
if (typeof decimalValue === 'number') { |
536
|
|
|
return decimalValue.toFixed(2); |
537
|
|
|
} else { |
538
|
|
|
return null; |
539
|
|
|
} |
540
|
|
|
} |
541
|
|
|
}) |
542
|
|
|
}); |
543
|
|
|
|
544
|
|
|
detailed_column_list.push({ |
545
|
|
|
dataField: 'reportingPeriodTotal', |
546
|
|
|
text: t('Reporting Period') + ' - ' + t('Total') + ' (' + json['reporting_period']['total_unit'] + ')', |
547
|
|
|
sort: true, |
548
|
|
|
formatter: function (decimalValue) { |
549
|
|
|
if (typeof decimalValue === 'number') { |
550
|
|
|
return decimalValue.toFixed(2); |
551
|
|
|
} else { |
552
|
|
|
return null; |
553
|
|
|
} |
554
|
|
|
} |
555
|
|
|
}) |
556
|
|
|
|
557
|
|
|
setDetailedDataTableColumns(detailed_column_list); |
558
|
|
|
|
559
|
|
|
let detailed_value_list = []; |
560
|
|
|
if (json['base_period']['timestamps'].length > 0 || json['reporting_period']['timestamps'].length > 0) { |
561
|
|
|
const max_timestamps_length = json['base_period']['timestamps'][0].length >= json['reporting_period']['timestamps'][0].length? |
562
|
|
|
json['base_period']['timestamps'][0].length : json['reporting_period']['timestamps'][0].length; |
563
|
|
|
for (let index = 0; index < max_timestamps_length; index++) { |
564
|
|
|
let detailed_value = {}; |
565
|
|
|
detailed_value['id'] = index; |
566
|
|
|
detailed_value['basePeriodDatetime'] = index < json['base_period']['timestamps'][0].length? json['base_period']['timestamps'][0][index] : null; |
567
|
|
|
detailed_value['basePeriodTotal'] = 0.0; |
568
|
|
|
if (detailed_value['basePeriodDatetime'] == null) { |
569
|
|
|
detailed_value['basePeriodTotal'] = null; |
570
|
|
|
} |
571
|
|
|
json['base_period']['values'].forEach((currentValue, energyCategoryIndex) => { |
572
|
|
|
detailed_value['a' + energyCategoryIndex] = index < json['base_period']['values'][energyCategoryIndex].length? json['base_period']['values'][energyCategoryIndex][index] : null; |
573
|
|
|
if(detailed_value['a' + energyCategoryIndex] != null) { |
574
|
|
|
detailed_value['basePeriodTotal'] += detailed_value['a' + energyCategoryIndex]; |
575
|
|
|
} |
576
|
|
|
}); |
577
|
|
|
detailed_value['reportingPeriodDatetime'] = index < json['reporting_period']['timestamps'][0].length? json['reporting_period']['timestamps'][0][index] : null; |
578
|
|
|
detailed_value['reportingPeriodTotal'] = 0.0; |
579
|
|
|
if (detailed_value['reportingPeriodDatetime'] == null) { |
580
|
|
|
detailed_value['reportingPeriodTotal'] = null; |
581
|
|
|
} |
582
|
|
|
json['reporting_period']['values'].forEach((currentValue, energyCategoryIndex) => { |
583
|
|
|
detailed_value['b' + energyCategoryIndex] = index < json['reporting_period']['values'][energyCategoryIndex].length? json['reporting_period']['values'][energyCategoryIndex][index] : null; |
584
|
|
|
if(detailed_value['b' + energyCategoryIndex] != null) { |
585
|
|
|
detailed_value['reportingPeriodTotal'] += detailed_value['b' + energyCategoryIndex]; |
586
|
|
|
} |
587
|
|
|
}); |
588
|
|
|
detailed_value_list.push(detailed_value); |
589
|
|
|
} |
590
|
|
|
|
591
|
|
|
let detailed_value = {}; |
592
|
|
|
detailed_value['id'] = detailed_value_list.length; |
593
|
|
|
detailed_value['basePeriodDatetime'] = t('Subtotal'); |
594
|
|
|
let total_of_subtotals_from_base_period = 0.0 |
595
|
|
|
json['base_period']['subtotals'].forEach((currentValue, index) => { |
596
|
|
|
detailed_value['a' + index] = currentValue; |
597
|
|
|
total_of_subtotals_from_base_period += detailed_value['a' + index]; |
598
|
|
|
}); |
599
|
|
|
detailed_value['basePeriodTotal'] = total_of_subtotals_from_base_period; |
600
|
|
|
|
601
|
|
|
let total_of_subtotals_from_reporting_period = 0.0 |
602
|
|
|
detailed_value['reportingPeriodDatetime'] = t('Subtotal'); |
603
|
|
|
json['reporting_period']['subtotals'].forEach((currentValue, index) => { |
604
|
|
|
detailed_value['b' + index] = currentValue; |
605
|
|
|
total_of_subtotals_from_reporting_period += detailed_value['b' + index]; |
606
|
|
|
}); |
607
|
|
|
detailed_value['reportingPeriodTotal'] = total_of_subtotals_from_reporting_period; |
608
|
|
|
detailed_value_list.push(detailed_value); |
609
|
|
|
setTimeout( () => { |
610
|
|
|
setDetailedDataTableData(detailed_value_list); |
611
|
|
|
}, 0) |
612
|
|
|
} |
613
|
|
|
} |
614
|
|
|
|
615
|
|
|
let child_space_value_list = []; |
616
|
|
|
if (json['child_space']['child_space_names_array'].length > 0) { |
617
|
|
|
json['child_space']['child_space_names_array'][0].forEach((currentSpaceName, spaceIndex) => { |
618
|
|
|
let child_space_value = {}; |
619
|
|
|
child_space_value['id'] = spaceIndex; |
620
|
|
|
child_space_value['name'] = currentSpaceName; |
621
|
|
|
let total = 0.0; |
622
|
|
|
json['child_space']['energy_category_names'].forEach((currentValue, energyCategoryIndex) => { |
623
|
|
|
child_space_value['a' + energyCategoryIndex] = json['child_space']['subtotals_array'][energyCategoryIndex][spaceIndex]; |
624
|
|
|
total += json['child_space']['subtotals_array'][energyCategoryIndex][spaceIndex] |
625
|
|
|
}); |
626
|
|
|
child_space_value['total'] = total; |
627
|
|
|
child_space_value_list.push(child_space_value); |
628
|
|
|
}); |
629
|
|
|
}; |
630
|
|
|
|
631
|
|
|
setChildSpacesTableData(child_space_value_list); |
632
|
|
|
|
633
|
|
|
let child_space_column_list = []; |
634
|
|
|
child_space_column_list.push({ |
635
|
|
|
dataField: 'name', |
636
|
|
|
text: t('Child Spaces'), |
637
|
|
|
sort: true |
638
|
|
|
}); |
639
|
|
|
json['child_space']['energy_category_names'].forEach((currentValue, index) => { |
640
|
|
|
let unit = json['child_space']['units'][index]; |
641
|
|
|
child_space_column_list.push({ |
642
|
|
|
dataField: 'a' + index, |
643
|
|
|
text: currentValue + ' (' + unit + ')', |
644
|
|
|
sort: true, |
645
|
|
|
formatter: function (decimalValue) { |
646
|
|
|
if (typeof decimalValue === 'number') { |
647
|
|
|
return decimalValue.toFixed(2); |
648
|
|
|
} else { |
649
|
|
|
return null; |
650
|
|
|
} |
651
|
|
|
} |
652
|
|
|
}); |
653
|
|
|
}); |
654
|
|
|
child_space_column_list.push({ |
655
|
|
|
dataField: 'total', |
656
|
|
|
text: t('Total') + ' (' + json['child_space']['total_unit'] + ')', |
657
|
|
|
sort: true, |
658
|
|
|
formatter: function (decimalValue) { |
659
|
|
|
if (typeof decimalValue === 'number') { |
660
|
|
|
return decimalValue.toFixed(2); |
661
|
|
|
} else { |
662
|
|
|
return null; |
663
|
|
|
} |
664
|
|
|
} |
665
|
|
|
}); |
666
|
|
|
|
667
|
|
|
setChildSpacesTableColumns(child_space_column_list); |
668
|
|
|
|
669
|
|
|
setExcelBytesBase64(json['excel_bytes_base64']); |
670
|
|
|
|
671
|
|
|
// enable submit button |
672
|
|
|
setSubmitButtonDisabled(false); |
673
|
|
|
// hide spinner |
674
|
|
|
setSpinnerHidden(true); |
675
|
|
|
// show export button |
676
|
|
|
setExportButtonHidden(false) |
677
|
|
|
|
678
|
|
|
} else { |
679
|
|
|
toast.error(t(json.description)) |
680
|
|
|
} |
681
|
|
|
}).catch(err => { |
682
|
|
|
console.log(err); |
683
|
|
|
}); |
684
|
|
|
}; |
685
|
|
|
|
686
|
|
|
const handleExport = e => { |
687
|
|
|
e.preventDefault(); |
688
|
|
|
const mimeType='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
689
|
|
|
const fileName = 'spaceincome.xlsx' |
690
|
|
|
var fileUrl = "data:" + mimeType + ";base64," + excelBytesBase64; |
691
|
|
|
fetch(fileUrl) |
692
|
|
|
.then(response => response.blob()) |
693
|
|
|
.then(blob => { |
694
|
|
|
var link = window.document.createElement("a"); |
695
|
|
|
link.href = window.URL.createObjectURL(blob, { type: mimeType }); |
696
|
|
|
link.download = fileName; |
697
|
|
|
document.body.appendChild(link); |
698
|
|
|
link.click(); |
699
|
|
|
document.body.removeChild(link); |
700
|
|
|
}); |
701
|
|
|
}; |
702
|
|
|
|
703
|
|
|
|
704
|
|
|
return ( |
705
|
|
|
<Fragment> |
706
|
|
|
<div> |
707
|
|
|
<Breadcrumb> |
708
|
|
|
<BreadcrumbItem>{t('Space Data')}</BreadcrumbItem><BreadcrumbItem active>{t('Income')}</BreadcrumbItem> |
709
|
|
|
</Breadcrumb> |
710
|
|
|
</div> |
711
|
|
|
<Card className="bg-light mb-3"> |
712
|
|
|
<CardBody className="p-3"> |
713
|
|
|
<Form onSubmit={handleSubmit}> |
714
|
|
|
<Row form> |
715
|
|
|
<Col xs={6} sm={3}> |
716
|
|
|
<FormGroup className="form-group"> |
717
|
|
|
<Label className={labelClasses} for="space"> |
718
|
|
|
{t('Space')} |
719
|
|
|
</Label> |
720
|
|
|
<br /> |
721
|
|
|
<Cascader options={cascaderOptions} |
722
|
|
|
onChange={onSpaceCascaderChange} |
723
|
|
|
changeOnSelect |
724
|
|
|
expandTrigger="hover"> |
725
|
|
|
<Input value={selectedSpaceName || ''} readOnly /> |
726
|
|
|
</Cascader> |
727
|
|
|
</FormGroup> |
728
|
|
|
</Col> |
729
|
|
|
<Col xs="auto"> |
730
|
|
|
<FormGroup> |
731
|
|
|
<Label className={labelClasses} for="comparisonType"> |
732
|
|
|
{t('Comparison Types')} |
733
|
|
|
</Label> |
734
|
|
|
<CustomInput type="select" id="comparisonType" name="comparisonType" |
735
|
|
|
defaultValue="month-on-month" |
736
|
|
|
onChange={onComparisonTypeChange} |
737
|
|
|
> |
738
|
|
|
{comparisonTypeOptions.map((comparisonType, index) => ( |
739
|
|
|
<option value={comparisonType.value} key={comparisonType.value} > |
740
|
|
|
{t(comparisonType.label)} |
741
|
|
|
</option> |
742
|
|
|
))} |
743
|
|
|
</CustomInput> |
744
|
|
|
</FormGroup> |
745
|
|
|
</Col> |
746
|
|
|
<Col xs="auto"> |
747
|
|
|
<FormGroup> |
748
|
|
|
<Label className={labelClasses} for="periodType"> |
749
|
|
|
{t('Period Types')} |
750
|
|
|
</Label> |
751
|
|
|
<CustomInput type="select" id="periodType" name="periodType" defaultValue="daily" onChange={({ target }) => setPeriodType(target.value)} |
752
|
|
|
> |
753
|
|
|
{periodTypeOptions.map((periodType, index) => ( |
754
|
|
|
<option value={periodType.value} key={periodType.value} > |
755
|
|
|
{t(periodType.label)} |
756
|
|
|
</option> |
757
|
|
|
))} |
758
|
|
|
</CustomInput> |
759
|
|
|
</FormGroup> |
760
|
|
|
</Col> |
761
|
|
|
<Col xs={6} sm={3}> |
762
|
|
|
<FormGroup className="form-group"> |
763
|
|
|
<Label className={labelClasses} for="basePeriodDateRangePicker">{t('Base Period')}{t('(Optional)')}</Label> |
764
|
|
|
<DateRangePickerWrapper |
765
|
|
|
id='basePeriodDateRangePicker' |
766
|
|
|
disabled={basePeriodDateRangePickerDisabled} |
767
|
|
|
format="yyyy-MM-dd HH:mm:ss" |
768
|
|
|
value={basePeriodDateRange} |
769
|
|
|
onChange={onBasePeriodChange} |
770
|
|
|
size="md" |
771
|
|
|
style={dateRangePickerStyle} |
772
|
|
|
onClean={onBasePeriodClean} |
773
|
|
|
locale={dateRangePickerLocale} |
774
|
|
|
placeholder={t("Select Date Range")} |
775
|
|
|
/> |
776
|
|
|
</FormGroup> |
777
|
|
|
</Col> |
778
|
|
|
<Col xs={6} sm={3}> |
779
|
|
|
<FormGroup className="form-group"> |
780
|
|
|
<Label className={labelClasses} for="reportingPeriodDateRangePicker">{t('Reporting Period')}</Label> |
781
|
|
|
<br/> |
782
|
|
|
<DateRangePickerWrapper |
783
|
|
|
id='reportingPeriodDateRangePicker' |
784
|
|
|
format="yyyy-MM-dd HH:mm:ss" |
785
|
|
|
value={reportingPeriodDateRange} |
786
|
|
|
onChange={onReportingPeriodChange} |
787
|
|
|
size="md" |
788
|
|
|
style={dateRangePickerStyle} |
789
|
|
|
onClean={onReportingPeriodClean} |
790
|
|
|
locale={dateRangePickerLocale} |
791
|
|
|
placeholder={t("Select Date Range")} |
792
|
|
|
/> |
793
|
|
|
</FormGroup> |
794
|
|
|
</Col> |
795
|
|
|
<Col xs="auto"> |
796
|
|
|
<FormGroup> |
797
|
|
|
<br></br> |
798
|
|
|
<ButtonGroup id="submit"> |
799
|
|
|
<Button color="success" disabled={submitButtonDisabled} >{t('Submit')}</Button> |
800
|
|
|
</ButtonGroup> |
801
|
|
|
</FormGroup> |
802
|
|
|
</Col> |
803
|
|
|
<Col xs="auto"> |
804
|
|
|
<FormGroup> |
805
|
|
|
<br></br> |
806
|
|
|
<Spinner color="primary" hidden={spinnerHidden} /> |
807
|
|
|
</FormGroup> |
808
|
|
|
</Col> |
809
|
|
|
<Col xs="auto"> |
810
|
|
|
<br></br> |
811
|
|
|
<ButtonIcon icon="external-link-alt" transform="shrink-3 down-2" color="falcon-default" |
812
|
|
|
hidden={exportButtonHidden} |
813
|
|
|
onClick={handleExport} > |
814
|
|
|
{t('Export')} |
815
|
|
|
</ButtonIcon> |
816
|
|
|
</Col> |
817
|
|
|
</Row> |
818
|
|
|
</Form> |
819
|
|
|
</CardBody> |
820
|
|
|
</Card> |
821
|
|
|
<div className="card-deck"> |
822
|
|
|
{cardSummaryList.map(cardSummaryItem => ( |
823
|
|
|
<CardSummary key={cardSummaryItem['name']} |
824
|
|
|
rate={cardSummaryItem['increment_rate']} |
825
|
|
|
title={t('Reporting Period Income CATEGORY UNIT', { 'CATEGORY': cardSummaryItem['name'], 'UNIT': '(' + cardSummaryItem['unit'] + ')' })} |
826
|
|
|
color="success" |
827
|
|
|
footnote={t('Per Unit Area')} |
828
|
|
|
footvalue={cardSummaryItem['subtotal_per_unit_area']} |
829
|
|
|
footunit={"(" + cardSummaryItem['unit'] + "/M²)"} > |
830
|
|
|
{cardSummaryItem['subtotal'] && <CountUp end={cardSummaryItem['subtotal']} duration={2} prefix="" separator="," decimal="." decimals={2} />} |
831
|
|
|
</CardSummary> |
832
|
|
|
))} |
833
|
|
|
</div> |
834
|
|
|
<Row noGutters> |
835
|
|
|
<Col className="mb-3 pr-lg-2 mb-3"> |
836
|
|
|
<SharePie data={incomeShareData} title={t('Incomes by Energy Category')} /> |
837
|
|
|
</Col> |
838
|
|
|
</Row> |
839
|
|
|
|
840
|
|
|
<MultiTrendChart reportingTitle = {{"name": "Reporting Period Income CATEGORY VALUE UNIT", "substitute": ["CATEGORY", "VALUE", "UNIT"], "CATEGORY": spaceBaseAndReportingNames, "VALUE": spaceReportingSubtotals, "UNIT": spaceBaseAndReportingUnits}} |
841
|
|
|
baseTitle = {{"name": "Base Period Income CATEGORY VALUE UNIT", "substitute": ["CATEGORY", "VALUE", "UNIT"], "CATEGORY": spaceBaseAndReportingNames, "VALUE": spaceBaseSubtotals, "UNIT": spaceBaseAndReportingUnits}} |
842
|
|
|
reportingTooltipTitle = {{"name": "Reporting Period Income CATEGORY VALUE UNIT", "substitute": ["CATEGORY", "VALUE", "UNIT"], "CATEGORY": spaceBaseAndReportingNames, "VALUE": null, "UNIT": spaceBaseAndReportingUnits}} |
843
|
|
|
baseTooltipTitle = {{"name": "Base Period Income CATEGORY VALUE UNIT", "substitute": ["CATEGORY", "VALUE", "UNIT"], "CATEGORY": spaceBaseAndReportingNames, "VALUE": null, "UNIT": spaceBaseAndReportingUnits}} |
844
|
|
|
reportingLabels={spaceReportingLabels} |
845
|
|
|
reportingData={spaceReportingData} |
846
|
|
|
baseLabels={spaceBaseLabels} |
847
|
|
|
baseData={spaceBaseData} |
848
|
|
|
rates={spaceReportingRates} |
849
|
|
|
options={spaceReportingOptions}> |
850
|
|
|
</MultiTrendChart> |
851
|
|
|
|
852
|
|
|
<LineChart reportingTitle={t('Related Parameters')} |
853
|
|
|
baseTitle='' |
854
|
|
|
labels={parameterLineChartLabels} |
855
|
|
|
data={parameterLineChartData} |
856
|
|
|
options={parameterLineChartOptions}> |
857
|
|
|
</LineChart> |
858
|
|
|
<DetailedDataTable data={detailedDataTableData} title={t('Detailed Data')} columns={detailedDataTableColumns} pagesize={50} > |
859
|
|
|
</DetailedDataTable> |
860
|
|
|
<br /> |
861
|
|
|
<ChildSpacesTable data={childSpacesTableData} title={t('Child Spaces Data')} columns={childSpacesTableColumns}> |
862
|
|
|
</ChildSpacesTable> |
863
|
|
|
|
864
|
|
|
</Fragment> |
865
|
|
|
); |
866
|
|
|
}; |
867
|
|
|
|
868
|
|
|
export default withTranslation()(withRedirect(SpaceIncome)); |
869
|
|
|
|