marco.pms.mobile/lib/model/project_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

63 lines
2.1 KiB
Dart

class ProjectModel {
final int id; // Unique identifier for the project
final String name; // Name of the project
final String projectAddress; // Address of the project
final String contactPerson; // Contact person for the project
final DateTime startDate; // Start date of the project
final DateTime endDate; // End date of the project
final int teamSize; // Number of people in the team
final int completedWork; // Completed work percentage
final int plannedWork; // Planned work for the project
final int projectStatusId; // Status ID for the project
final int tenantId; // Tenant ID associated with the project
// Constructor
ProjectModel({
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,
required this.projectStatusId,
required this.tenantId,
});
// Factory method to create an instance of ProjectModel from a JSON object
factory ProjectModel.fromJson(Map<String, dynamic> json) {
return ProjectModel(
id: json['id'],
name: json['name'],
projectAddress: json['projectAddress'],
contactPerson: json['contactPerson'],
startDate: DateTime.parse(json['startDate']),
endDate: DateTime.parse(json['endDate']),
teamSize: json['teamSize'],
completedWork: json['completedWork'],
plannedWork: json['plannedWork'],
projectStatusId: json['projectStatusId'],
tenantId: json['tenantId'],
);
}
// Method to convert the ProjectModel instance back to a JSON object
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'projectAddress': projectAddress,
'contactPerson': contactPerson,
'startDate': startDate.toIso8601String(),
'endDate': endDate.toIso8601String(),
'teamSize': teamSize,
'completedWork': completedWork,
'plannedWork': plannedWork,
'projectStatusId': projectStatusId,
'tenantId': tenantId,
};
}
}