ts-tat/lib/data/models/plan.dart
2025-07-31 18:15:37 +05:30

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