passo_mobile_app/lib/model/profile/work_history.dart

76 lines
2.4 KiB
Dart
Raw Normal View History

2023-02-07 01:29:38 +00:00
// To parse this JSON data, do
//
// final workHistory = workHistoryFromJson(jsonString);
import 'dart:convert';
2023-02-20 07:48:24 +00:00
import '../utils/agency.dart';
import '../utils/category.dart';
import '../utils/industry_class.dart';
import '../utils/position.dart';
import 'attachment.dart';
2023-02-20 07:48:24 +00:00
2023-02-07 01:29:38 +00:00
WorkHistory workHistoryFromJson(String str) => WorkHistory.fromJson(json.decode(str));
String workHistoryToJson(WorkHistory data) => json.encode(data.toJson());
class WorkHistory {
WorkHistory({
this.id,
this.agency,
this.sgStep,
this.toDate,
this.position,
this.fromDate,
this.attachments,
2023-02-07 01:29:38 +00:00
this.salaryGrade,
this.monthlySalary,
this.appointmentStatus,
});
final int? id;
final Agency? agency;
final int? sgStep;
final DateTime? toDate;
final PositionTitle? position;
2023-02-07 01:29:38 +00:00
final DateTime? fromDate;
2023-08-07 06:33:38 +00:00
List<Attachment>? attachments;
2023-02-07 01:29:38 +00:00
final int? salaryGrade;
final double? monthlySalary;
2023-02-07 01:29:38 +00:00
final String? appointmentStatus;
factory WorkHistory.fromJson(Map<String, dynamic> json) => WorkHistory(
id: json["id"],
agency: json["agency"] == null ? null : Agency.fromJson(json["agency"]),
sgStep: json["sg_step"],
toDate: json["to_date"] == null ? null : DateTime.parse(json["to_date"]),
position: json["position"] == null ? null : PositionTitle.fromJson(json["position"]),
2023-02-07 01:29:38 +00:00
fromDate: json["from_date"] == null ? null : DateTime.parse(json["from_date"]),
attachments: json['attachments'] ==null?null: List<Attachment>.from(json["attachments"].map((x) => Attachment.fromJson(x))),
2023-02-07 01:29:38 +00:00
salaryGrade: json["salary_grade"],
monthlySalary: json["monthly_salary"],
appointmentStatus: json["appointment_status"],
);
Map<String, dynamic> toJson() => {
"id": id,
"agency": agency?.toJson(),
"sg_step": sgStep,
"to_date": "${toDate!.year.toString().padLeft(4, '0')}-${toDate!.month.toString().padLeft(2, '0')}-${toDate!.day.toString().padLeft(2, '0')}",
"position": position?.toJson(),
"from_date": "${fromDate!.year.toString().padLeft(4, '0')}-${fromDate!.month.toString().padLeft(2, '0')}-${fromDate!.day.toString().padLeft(2, '0')}",
// "attachments": attachments,
"salary_grade": salaryGrade,
"monthly_salary": monthlySalary,
"appointment_status": appointmentStatus,
};
}