Implement Asia/Manila Time Zone

Handled saving of Relievers
This commit is contained in:
2026-02-11 20:12:48 +08:00
parent 747edbdd8c
commit 678a73a696
20 changed files with 551 additions and 168 deletions
+17 -4
View File
@@ -1,3 +1,5 @@
import '../utils/app_time.dart';
class DutySchedule {
DutySchedule({
required this.id,
@@ -9,6 +11,7 @@ class DutySchedule {
required this.createdAt,
required this.checkInAt,
required this.checkInLocation,
required this.relieverIds,
});
final String id;
@@ -20,20 +23,30 @@ class DutySchedule {
final DateTime createdAt;
final DateTime? checkInAt;
final Object? checkInLocation;
final List<String> relieverIds;
factory DutySchedule.fromMap(Map<String, dynamic> map) {
final relieversRaw = map['reliever_ids'];
final relievers = relieversRaw is List
? relieversRaw
.where((e) => e != null)
.map((entry) => entry.toString())
.where((s) => s.isNotEmpty)
.toList()
: <String>[];
return DutySchedule(
id: map['id'] as String,
userId: map['user_id'] as String,
shiftType: map['shift_type'] as String? ?? 'normal',
startTime: DateTime.parse(map['start_time'] as String),
endTime: DateTime.parse(map['end_time'] as String),
startTime: AppTime.parse(map['start_time'] as String),
endTime: AppTime.parse(map['end_time'] as String),
status: map['status'] as String? ?? 'scheduled',
createdAt: DateTime.parse(map['created_at'] as String),
createdAt: AppTime.parse(map['created_at'] as String),
checkInAt: map['check_in_at'] == null
? null
: DateTime.parse(map['check_in_at'] as String),
: AppTime.parse(map['check_in_at'] as String),
checkInLocation: map['check_in_location'],
relieverIds: relievers,
);
}
}