ts-tat/lib/data/models/plan.dart
2025-06-11 17:41:07 +05:30

68 lines
2.0 KiB
Dart

class Plan {
final String planId;
final String? employeeCode;
final String tripTitle;
final String tripType;
final String status;
final String approver_status;
final String costCenter;
final String functionalDepartment;
final String purposeOfTravel;
final String soNumber;
final String description;
final String isBillable;
final String userName;
final String travellerName;
final String statusValue;
final String createdOn;
final String? approverId;
final String? delegaterId;
Plan({
required this.planId,
this.employeeCode,
required this.tripTitle,
required this.approver_status,
required this.tripType,
required this.status,
required this.costCenter,
required this.functionalDepartment,
required this.purposeOfTravel,
required this.soNumber,
required this.description,
required this.isBillable,
required this.userName,
required this.travellerName,
required this.statusValue,
required this.createdOn,
this.approverId,
this.delegaterId,
});
factory Plan.fromJson(Map<String, dynamic> json) {
print('Parsing Plan from JSON: $json');
return Plan(
planId: json['plan_id'],
employeeCode: json['employee_code'],
tripTitle: json['trip_title'],
tripType: json['trip_type_value'],
approver_status: json['approver_status'],
status: json['status'] == "0" ? "Inactive" : "Active",
costCenter: json['cost_center_value'] ?? '',
functionalDepartment: json['functional_department_value'] ?? '',
purposeOfTravel: json['purpose_of_travel_value'] ?? '',
soNumber: json['so_number'] ?? '',
description: json['description'] ?? '',
isBillable: json['is_billable_value'] ?? '',
userName: json["user_name"] ?? '',
travellerName: json["traveller_name"] ?? '',
statusValue: json["status_value"] ?? '',
createdOn: json["created_on"] ?? '',
approverId: json['approver_id'],
delegaterId: json['delegater_id'],
);
}
}