marco.pms.mobile/lib/model/attendance_model.dart
Vaibhav Surve 753bfcad8a feat: Implement API service for project and employee management
- 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.
2025-04-21 17:45:54 +05:30

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,
);
}
}