push garage door records

This commit is contained in:
ashrafzarkanisala
2024-10-07 01:12:35 +03:00
parent 9733295dca
commit 00277742d0
4 changed files with 47 additions and 28 deletions

View File

@ -13,6 +13,7 @@ class ReportsTable extends StatelessWidget {
final VoidCallback onClose;
bool? hideValueShowDescription;
bool? mainDoorSensor;
bool? garageDoorSensor;
ReportsTable({
super.key,
@ -23,6 +24,7 @@ class ReportsTable extends StatelessWidget {
this.thirdColumnDescription,
this.hideValueShowDescription,
this.mainDoorSensor,
this.garageDoorSensor,
});
@override
@ -53,30 +55,31 @@ class ReportsTable extends StatelessWidget {
DeviceEvent data = entry.value;
// Parse eventTime into Date and Time
DateTime eventDateTime =
DateTime.fromMillisecondsSinceEpoch(data.eventTime!);
DateTime eventDateTime = DateTime.fromMillisecondsSinceEpoch(data.eventTime!);
String date = DateFormat('dd/MM/yyyy').format(eventDateTime);
String time = DateFormat('HH:mm').format(eventDateTime);
String value;
if (hideValueShowDescription == true) {
if (mainDoorSensor != null && mainDoorSensor == true) {
value = data.value == 'true' ? 'Open' : 'Close';
} else if (garageDoorSensor != null && garageDoorSensor == true) {
value = data.value == 'true' ? 'Opened' : 'Closed';
} else {
value = '${data.value!} ${thirdColumnDescription ?? ''}';
}
} else {
value = '${data.value!} ${thirdColumnDescription ?? ''}';
}
return TableRow(
children: [
TableCellWidget(value: date),
TableCellWidget(value: time),
hideValueShowDescription == true
? TableCellWidget(
value: (mainDoorSensor != null &&
mainDoorSensor == true)
? data.value == 'true'
? 'Open'
: 'Close'
: thirdColumnDescription ?? '',
onTap: () => onRowTap(index),
)
: TableCellWidget(
value:
'${data.value!} ${thirdColumnDescription ?? ''}',
onTap: () => onRowTap(index),
),
TableCellWidget(
value: value,
onTap: () => onRowTap(index),
),
],
);
}),