Update gas refill issue fixed

pull/2/head
zaid_daoud 3 years ago
parent c24fe473ff
commit 08841c7859

@ -142,19 +142,19 @@ class GasRefillProvider extends ChangeNotifier {
@required GasRefillModel oldModel, @required GasRefillModel oldModel,
@required GasRefillModel newModel, @required GasRefillModel newModel,
}) async { }) async {
print("${oldModel?.id} assigned EEEEE ${oldModel?.assignedEmployee?.toJson()}");
Map<String, dynamic> body = { Map<String, dynamic> body = {
"id": newModel.id, "id": newModel.id,
"gazRefillNo": newModel.title ?? "", "gazRefillNo": newModel.title ?? "",
"status": newModel.status.toMap(), "status": newModel.status.toMap(),
"expectedDate": oldModel.expectedDate?.toIso8601String(),
"expectedTime": oldModel.expectedDate?.toIso8601String(),
"startDate": startDate?.toIso8601String(), "startDate": startDate?.toIso8601String(),
"startTime": startDate?.toIso8601String(), "startTime": startDate?.toIso8601String(),
"endDate": endDate?.toIso8601String(), "endDate": endDate?.toIso8601String(),
"endTime": endDate?.toIso8601String(), "endTime": endDate?.toIso8601String(),
// "workingHours": 0, "workingHours": ((endDate?.difference(startDate)?.inMinutes ?? 0) / 60),
// "assignedEmployee": { "assignedEmployee": oldModel?.assignedEmployee?.toJson(),
// "id": "string",
// "name": "string"
// },
"site": hospital?.toMap(), "site": hospital?.toMap(),
"building": building?.toJson(includeFloors: false), "building": building?.toJson(includeFloors: false),
"floor": floor?.toJson(includeDepartments: false), "floor": floor?.toJson(includeDepartments: false),

@ -13,6 +13,7 @@ class GasRefillModel {
Lookup floor; Lookup floor;
Department department; Department department;
List<GasRefillDetails> details; List<GasRefillDetails> details;
AssignedEmployee assignedEmployee;
DateTime startDate, endDate, expectedDate; DateTime startDate, endDate, expectedDate;
GasRefillModel({ GasRefillModel({
@ -28,6 +29,7 @@ class GasRefillModel {
this.endDate, this.endDate,
this.expectedDate, this.expectedDate,
this.department, this.department,
this.assignedEmployee,
}); });
bool validate() { bool validate() {
@ -55,6 +57,7 @@ class GasRefillModel {
startDate = model.startDate; startDate = model.startDate;
endDate = model.endDate; endDate = model.endDate;
expectedDate = model.expectedDate; expectedDate = model.expectedDate;
assignedEmployee = model.assignedEmployee;
} }
factory GasRefillModel.fromJson(Map<String, dynamic> parsedJson) { factory GasRefillModel.fromJson(Map<String, dynamic> parsedJson) {
@ -63,6 +66,7 @@ class GasRefillModel {
List list = parsedJson["gazRefillDetails"]; List list = parsedJson["gazRefillDetails"];
details = list.map((e) => GasRefillDetails.fromJson(e)).toList(); details = list.map((e) => GasRefillDetails.fromJson(e)).toList();
} }
print("${parsedJson['assignedEmployee']}ddddd");
return GasRefillModel( return GasRefillModel(
id: parsedJson["id"], id: parsedJson["id"],
//userId: parsedJson["uid"], //userId: parsedJson["uid"],
@ -76,6 +80,7 @@ class GasRefillModel {
startDate: DateTime.tryParse(parsedJson['startDate'] ?? ""), startDate: DateTime.tryParse(parsedJson['startDate'] ?? ""),
endDate: DateTime.tryParse(parsedJson['endDate'] ?? ""), endDate: DateTime.tryParse(parsedJson['endDate'] ?? ""),
expectedDate: DateTime.tryParse(parsedJson['expectedDate'] ?? ""), expectedDate: DateTime.tryParse(parsedJson['expectedDate'] ?? ""),
assignedEmployee: AssignedEmployee.fromJson(parsedJson['assignedEmployee'] ?? {}),
); );
} }
} }

Loading…
Cancel
Save