modify clockin & leave

This commit is contained in:
2026-03-04 23:45:26 +08:00
parent ce706694ef
commit 0516db1690
7 changed files with 163 additions and 77 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ class ClockInApiService {
return await _apiService.fetchList<ClockInRecord>(
tableName: "hrs_ClockInRecord",
pk: "ClockInId",
queryFilter: "1^100^ClockInDateTime^*^^^ClockInUserId^$userId",
queryFilter: "1^100^ClockInDateTime^*^ClockInDateTime >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)^^ClockInUserId^$userId",
fromJson: (json) => ClockInRecord.fromJson(json),
);
}
+1 -1
View File
@@ -240,7 +240,7 @@ class _ClockInManagerState extends State<ClockInManager> {
Widget _buildHistoryTile(ClockInRecord record) {
return ListTile(
leading: Icon(Icons.access_time, color: record.typeColor),
title: Text("${record.type} - ${record.formattedTime}"),
title: Text("${record.type} - ${record.formattedDateTime}"),
subtitle: Text(record.storeId ?? ""),
);
}
+4
View File
@@ -34,6 +34,10 @@ class ClockInRecord {
String get formattedTime => dateTime != null ? DateFormat('HH:mm:ss').format(dateTime!) : '--:--';
String get formattedDate => dateTime != null ? DateFormat('yyyy-MM-dd').format(dateTime!) : 'N/A';
// 新增:滿足列表顯示「日期 + 時間」的需求
String get formattedDateTime => dateTime != null
? DateFormat('yyyy-MM-dd HH:mm').format(dateTime!)
: 'N/A';
Color get typeColor {
if (type == '上班') return Colors.blue;