mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
fixed report table
This commit is contained in:
@ -6,6 +6,8 @@ import 'package:syncrow_web/pages/device_managment/shared/table/table_header.dar
|
||||
|
||||
class ReportsTable extends StatelessWidget {
|
||||
final DeviceReport report;
|
||||
final String? thirdColumnTitle;
|
||||
final String? thirdColumnDescription;
|
||||
final Function(int index) onRowTap;
|
||||
final VoidCallback onClose;
|
||||
|
||||
@ -14,6 +16,8 @@ class ReportsTable extends StatelessWidget {
|
||||
required this.report,
|
||||
required this.onRowTap,
|
||||
required this.onClose,
|
||||
this.thirdColumnTitle,
|
||||
this.thirdColumnDescription,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -32,33 +36,34 @@ class ReportsTable extends StatelessWidget {
|
||||
children: [
|
||||
TableRow(
|
||||
decoration: BoxDecoration(color: Colors.grey.shade200),
|
||||
children: const [
|
||||
TableHeader(title: 'Date'),
|
||||
TableHeader(title: 'Time'),
|
||||
TableHeader(title: 'Status'),
|
||||
children: [
|
||||
const TableHeader(title: 'Date'),
|
||||
const TableHeader(title: 'Time'),
|
||||
TableHeader(title: thirdColumnTitle ?? 'Status'),
|
||||
],
|
||||
),
|
||||
...report.data!.asMap().entries.map((entry) {
|
||||
int index = entry.key;
|
||||
DeviceEvent data = entry.value;
|
||||
if (report.data != null)
|
||||
...report.data!.asMap().entries.map((entry) {
|
||||
int index = entry.key;
|
||||
DeviceEvent data = entry.value;
|
||||
|
||||
// Parse eventTime into Date and Time
|
||||
DateTime eventDateTime =
|
||||
DateTime.fromMillisecondsSinceEpoch(data.eventTime!);
|
||||
String date = DateFormat('dd/MM/yyyy').format(eventDateTime);
|
||||
String time = DateFormat('HH:mm').format(eventDateTime);
|
||||
// Parse eventTime into Date and Time
|
||||
DateTime eventDateTime =
|
||||
DateTime.fromMillisecondsSinceEpoch(data.eventTime!);
|
||||
String date = DateFormat('dd/MM/yyyy').format(eventDateTime);
|
||||
String time = DateFormat('HH:mm').format(eventDateTime);
|
||||
|
||||
return TableRow(
|
||||
children: [
|
||||
TableCellWidget(value: date),
|
||||
TableCellWidget(value: time),
|
||||
TableCellWidget(
|
||||
value: data.value!,
|
||||
onTap: () => onRowTap(index),
|
||||
),
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
return TableRow(
|
||||
children: [
|
||||
TableCellWidget(value: date),
|
||||
TableCellWidget(value: time),
|
||||
TableCellWidget(
|
||||
value: '${data.value!} $thirdColumnDescription',
|
||||
onTap: () => onRowTap(index),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
Reference in New Issue
Block a user