- Added `ApiService` class for handling API requests related to projects and employees. - Implemented methods to fetch projects and employees by project ID with JWT authentication. - Enhanced `AuthService` to store JWT and refresh tokens upon user login. - Updated `LocalStorage` to manage JWT and refresh tokens. - Created models for `AttendanceModel`, `EmployeeModel`, and `ProjectModel` to structure data. - Introduced `AttendanceScreen` for displaying attendance data with a new UI layout. - Removed deprecated `attendance_screen.dart` and replaced it with `attendanceScreen.dart`. - Updated routing to reflect the new attendance screen structure. - Integrated geolocation and permission handling plugins for enhanced functionality. - Updated dependencies in `pubspec.yaml` and `pubspec.lock` for new packages.
38 lines
1.1 KiB
Dart
38 lines
1.1 KiB
Dart
class AttendanceModel {
|
|
final int id;
|
|
final String name;
|
|
final String projectAddress;
|
|
final String contactPerson;
|
|
final DateTime startDate;
|
|
final DateTime endDate;
|
|
final int teamSize;
|
|
final int completedWork;
|
|
final int plannedWork;
|
|
|
|
AttendanceModel({
|
|
required this.id,
|
|
required this.name,
|
|
required this.projectAddress,
|
|
required this.contactPerson,
|
|
required this.startDate,
|
|
required this.endDate,
|
|
required this.teamSize,
|
|
required this.completedWork,
|
|
required this.plannedWork,
|
|
});
|
|
|
|
factory AttendanceModel.fromJson(Map<String, dynamic> json) {
|
|
return AttendanceModel(
|
|
id: int.tryParse(json['id'].toString()) ?? 0,
|
|
name: json['name'] ?? '',
|
|
projectAddress: json['projectAddress'] ?? '',
|
|
contactPerson: json['contactPerson'] ?? '',
|
|
startDate: DateTime.tryParse(json['startDate'].toString()) ?? DateTime.now(),
|
|
endDate: DateTime.tryParse(json['endDate'].toString()) ?? DateTime.now(),
|
|
teamSize: int.tryParse(json['teamSize'].toString()) ?? 0,
|
|
completedWork: int.tryParse(json['completedWork'].toString()) ?? 0,
|
|
plannedWork: int.tryParse(json['plannedWork'].toString()) ?? 0,
|
|
);
|
|
}
|
|
}
|