|
|
|
|
@ -42,7 +42,7 @@ class GasRefillModel {
|
|
|
|
|
|
|
|
|
|
GasRefillModel.fromJson(dynamic json) {
|
|
|
|
|
id = json['id'];
|
|
|
|
|
gazRefillNo = json['gazRefillNo'];
|
|
|
|
|
gazRefillNo = json['gasRefillNo'];
|
|
|
|
|
expectedDate = json['expectedDate'];
|
|
|
|
|
expectedTime = json['expectedTime'];
|
|
|
|
|
startDate = json['startDate'];
|
|
|
|
|
@ -80,9 +80,9 @@ class GasRefillModel {
|
|
|
|
|
department = json['department'] != null ? Department.fromJson(json['department']) : null;
|
|
|
|
|
assignedEmployee = json['assignedEmployee'] != null ? AssignedEmployee.fromJson(json['assignedEmployee']) : null;
|
|
|
|
|
status = json['status'] != null ? Lookup.fromJson(json['status']) : null;
|
|
|
|
|
if (json['gazRefillDetails'] != null) {
|
|
|
|
|
if (json['gasRefillDetails'] != null) {
|
|
|
|
|
gazRefillDetails = [];
|
|
|
|
|
json['gazRefillDetails'].forEach((v) {
|
|
|
|
|
json['gasRefillDetails'].forEach((v) {
|
|
|
|
|
gazRefillDetails!.add(GasRefillDetails.fromJson(v)); // Use '!' since gazRefillDetails is initialized here
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -167,7 +167,7 @@ class GasRefillModel {
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
final map = <String, dynamic>{};
|
|
|
|
|
map['id'] = id ?? 0;
|
|
|
|
|
map['gazRefillNo'] = "GR-${DateTime.now().toString().split(" ").first}";
|
|
|
|
|
map['gasRefillNo'] = "GR-${DateTime.now().toString().split(" ").first}";
|
|
|
|
|
map['expectedDate'] = expectedDate;
|
|
|
|
|
map['expectedTime'] = expectedTime;
|
|
|
|
|
map['startDate'] = startDate;
|
|
|
|
|
@ -201,7 +201,7 @@ class GasRefillModel {
|
|
|
|
|
map['status'] = status?.toJson(); // Use '?.' for null safety
|
|
|
|
|
}
|
|
|
|
|
if (gazRefillDetails != null) {
|
|
|
|
|
map['gazRefillDetails'] = gazRefillDetails!.map((v) => v.toJson()).toList(); // Use '!' since gazRefillDetails could be null
|
|
|
|
|
map['gasRefillDetails'] = gazRefillDetails!.map((v) => v.toJson()).toList(); // Use '!' since gazRefillDetails could be null
|
|
|
|
|
}
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|