mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-14 17:25:50 +00:00
Compare commits
1 Commits
occupancy-
...
SP-1770-FE
Author | SHA1 | Date | |
---|---|---|---|
52b843d514 |
@ -25,8 +25,8 @@ class AnalyticsDevice {
|
|||||||
|
|
||||||
factory AnalyticsDevice.fromJson(Map<String, dynamic> json) {
|
factory AnalyticsDevice.fromJson(Map<String, dynamic> json) {
|
||||||
return AnalyticsDevice(
|
return AnalyticsDevice(
|
||||||
uuid: json['uuid'] as String? ?? '',
|
uuid: json['uuid'] as String,
|
||||||
name: json['name'] as String? ?? '',
|
name: json['name'] as String,
|
||||||
createdAt: json['createdAt'] != null
|
createdAt: json['createdAt'] != null
|
||||||
? DateTime.parse(json['createdAt'] as String)
|
? DateTime.parse(json['createdAt'] as String)
|
||||||
: null,
|
: null,
|
||||||
@ -39,8 +39,8 @@ class AnalyticsDevice {
|
|||||||
? ProductDevice.fromJson(json['productDevice'] as Map<String, dynamic>)
|
? ProductDevice.fromJson(json['productDevice'] as Map<String, dynamic>)
|
||||||
: null,
|
: null,
|
||||||
spaceUuid: json['spaceUuid'] as String?,
|
spaceUuid: json['spaceUuid'] as String?,
|
||||||
latitude: json['lat'] != null ? double.parse(json['lat'] as String? ?? '0.0') : null,
|
latitude: json['lat'] != null ? double.parse(json['lat'] as String) : null,
|
||||||
longitude: json['lon'] != null ? double.parse(json['lon'] as String? ?? '0.0') : null,
|
longitude: json['lon'] != null ? double.parse(json['lon'] as String) : null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import 'package:syncrow_web/pages/analytics/modules/air_quality/blocs/air_qualit
|
|||||||
import 'package:syncrow_web/pages/analytics/modules/air_quality/blocs/device_location/device_location_bloc.dart';
|
import 'package:syncrow_web/pages/analytics/modules/air_quality/blocs/device_location/device_location_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/air_quality/blocs/range_of_aqi/range_of_aqi_bloc.dart';
|
import 'package:syncrow_web/pages/analytics/modules/air_quality/blocs/range_of_aqi/range_of_aqi_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/air_quality/widgets/aqi_type_dropdown.dart';
|
import 'package:syncrow_web/pages/analytics/modules/air_quality/widgets/aqi_type_dropdown.dart';
|
||||||
|
import 'package:syncrow_web/pages/analytics/modules/analytics/blocs/analytics_date_picker_bloc/analytics_date_picker_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/analytics/blocs/analytics_devices/analytics_devices_bloc.dart';
|
import 'package:syncrow_web/pages/analytics/modules/analytics/blocs/analytics_devices/analytics_devices_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/modules/energy_management/blocs/realtime_device_changes/realtime_device_changes_bloc.dart';
|
import 'package:syncrow_web/pages/analytics/modules/energy_management/blocs/realtime_device_changes/realtime_device_changes_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/analytics/params/get_air_quality_distribution_param.dart';
|
import 'package:syncrow_web/pages/analytics/params/get_air_quality_distribution_param.dart';
|
||||||
@ -21,14 +22,13 @@ abstract final class FetchAirQualityDataHelper {
|
|||||||
required String spaceUuid,
|
required String spaceUuid,
|
||||||
bool shouldFetchAnalyticsDevices = true,
|
bool shouldFetchAnalyticsDevices = true,
|
||||||
}) {
|
}) {
|
||||||
|
final date = context.read<AnalyticsDatePickerBloc>().state.monthlyDate;
|
||||||
final aqiType = context.read<AirQualityDistributionBloc>().state.selectedAqiType;
|
final aqiType = context.read<AirQualityDistributionBloc>().state.selectedAqiType;
|
||||||
if (shouldFetchAnalyticsDevices) {
|
loadAnalyticsDevices(
|
||||||
loadAnalyticsDevices(
|
context,
|
||||||
context,
|
communityUuid: communityUuid,
|
||||||
communityUuid: communityUuid,
|
spaceUuid: spaceUuid,
|
||||||
spaceUuid: spaceUuid,
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
loadRangeOfAqi(
|
loadRangeOfAqi(
|
||||||
context,
|
context,
|
||||||
spaceUuid: spaceUuid,
|
spaceUuid: spaceUuid,
|
||||||
|
@ -65,7 +65,7 @@ class AqiDeviceInfo extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
final tvocValue = _getValueForStatus(
|
final tvocValue = _getValueForStatus(
|
||||||
status,
|
status,
|
||||||
'voc_value',
|
'tvoc_value',
|
||||||
formatter: (value) => (value / 100).toStringAsFixed(2),
|
formatter: (value) => (value / 100).toStringAsFixed(2),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ enum AqiType {
|
|||||||
pm25('PM2.5', 'µg/m³', 'pm25'),
|
pm25('PM2.5', 'µg/m³', 'pm25'),
|
||||||
pm10('PM10', 'µg/m³', 'pm10'),
|
pm10('PM10', 'µg/m³', 'pm10'),
|
||||||
hcho('HCHO', 'mg/m³', 'cho2'),
|
hcho('HCHO', 'mg/m³', 'cho2'),
|
||||||
tvoc('TVOC', 'mg/m³', 'voc'),
|
tvoc('TVOC', 'µg/m³', 'voc'),
|
||||||
co2('CO2', 'ppm', 'co2');
|
co2('CO2', 'ppm', 'co2');
|
||||||
|
|
||||||
const AqiType(this.value, this.unit, this.code);
|
const AqiType(this.value, this.unit, this.code);
|
||||||
|
@ -81,7 +81,7 @@ abstract final class FetchOccupancyDataHelper {
|
|||||||
param: GetAnalyticsDevicesParam(
|
param: GetAnalyticsDevicesParam(
|
||||||
communityUuid: communityUuid,
|
communityUuid: communityUuid,
|
||||||
spaceUuid: spaceUuid,
|
spaceUuid: spaceUuid,
|
||||||
deviceTypes: ['WPS', 'CPS', 'NCPS'],
|
deviceTypes: ['WPS', 'CPS'],
|
||||||
requestType: AnalyticsDeviceRequestType.occupancy,
|
requestType: AnalyticsDeviceRequestType.occupancy,
|
||||||
),
|
),
|
||||||
onSuccess: (device) {
|
onSuccess: (device) {
|
||||||
|
@ -20,7 +20,7 @@ class AnalyticsOccupancyView extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
spacing: 32,
|
spacing: 32,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: height * 0.8, child: const OccupancyEndSideBar()),
|
SizedBox(height: height * 0.46, child: const OccupancyEndSideBar()),
|
||||||
SizedBox(height: height * 0.5, child: const OccupancyChartBox()),
|
SizedBox(height: height * 0.5, child: const OccupancyChartBox()),
|
||||||
SizedBox(height: height * 0.5, child: const OccupancyHeatMapBox()),
|
SizedBox(height: height * 0.5, child: const OccupancyHeatMapBox()),
|
||||||
],
|
],
|
||||||
|
@ -26,6 +26,7 @@ class OccupancyEndSideBar extends StatelessWidget {
|
|||||||
const AnalyticsSidebarHeader(title: 'Presnce Sensor'),
|
const AnalyticsSidebarHeader(title: 'Presnce Sensor'),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
// height: MediaQuery.sizeOf(context).height * 0.2,
|
||||||
child: PowerClampEnergyStatusWidget(
|
child: PowerClampEnergyStatusWidget(
|
||||||
status: [
|
status: [
|
||||||
PowerClampEnergyStatus(
|
PowerClampEnergyStatus(
|
||||||
|
@ -289,7 +289,6 @@ class SpaceTreeBloc extends Bloc<SpaceTreeEvent, SpaceTreeState> {
|
|||||||
selectedSpaces: updatedSelectedSpaces,
|
selectedSpaces: updatedSelectedSpaces,
|
||||||
soldCheck: updatedSoldChecks,
|
soldCheck: updatedSoldChecks,
|
||||||
selectedCommunityAndSpaces: communityAndSpaces));
|
selectedCommunityAndSpaces: communityAndSpaces));
|
||||||
emit(state.copyWith(selectedSpaces: updatedSelectedSpaces));
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(const SpaceTreeErrorState('Something went wrong'));
|
emit(const SpaceTreeErrorState('Something went wrong'));
|
||||||
}
|
}
|
||||||
@ -445,10 +444,12 @@ class SpaceTreeBloc extends Bloc<SpaceTreeEvent, SpaceTreeState> {
|
|||||||
|
|
||||||
List<String> _getThePathToChild(String communityId, String selectedSpaceId) {
|
List<String> _getThePathToChild(String communityId, String selectedSpaceId) {
|
||||||
List<String> ids = [];
|
List<String> ids = [];
|
||||||
for (var community in state.communityList) {
|
final communityDataSource =
|
||||||
|
state.searchQuery.isNotEmpty ? state.filteredCommunity : state.communityList;
|
||||||
|
for (final community in communityDataSource) {
|
||||||
if (community.uuid == communityId) {
|
if (community.uuid == communityId) {
|
||||||
for (var space in community.spaces) {
|
for (final space in community.spaces) {
|
||||||
List<String> list = [];
|
final list = <String>[];
|
||||||
list.add(space.uuid!);
|
list.add(space.uuid!);
|
||||||
ids = _getAllParentsIds(space, selectedSpaceId, List.from(list));
|
ids = _getAllParentsIds(space, selectedSpaceId, List.from(list));
|
||||||
if (ids.isNotEmpty) {
|
if (ids.isNotEmpty) {
|
||||||
|
Reference in New Issue
Block a user