You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.9 KiB
Dart
67 lines
1.9 KiB
Dart
|
3 years ago
|
import 'package:test_sa/models/status.dart';
|
||
|
|
import 'package:test_sa/models/timer_model.dart';
|
||
|
|
|
||
|
|
class Visit{
|
||
|
|
String id;
|
||
|
|
String serialNumber;
|
||
|
|
String expectDate;
|
||
|
|
String actualDate;
|
||
|
|
String hospitalId;
|
||
|
|
String hospitalName;
|
||
|
|
String deviceId;
|
||
|
|
String deviceSerialNumber;
|
||
|
|
String deviceArabicName;
|
||
|
|
String deviceEnglishName;
|
||
|
|
String employId;
|
||
|
|
String employName;
|
||
|
|
String modelAndBrand;
|
||
|
|
String contactStatus;
|
||
|
|
Status status;
|
||
|
|
String assignTo;
|
||
|
|
List<String> images;
|
||
|
|
|
||
|
|
Visit({
|
||
|
|
this.id,
|
||
|
|
this.serialNumber,
|
||
|
|
this.hospitalId,
|
||
|
|
this.hospitalName,
|
||
|
|
this.deviceId,
|
||
|
|
this.deviceSerialNumber,
|
||
|
|
this.deviceArabicName,
|
||
|
|
this.deviceEnglishName,
|
||
|
|
this.employId,
|
||
|
|
this.employName,
|
||
|
|
this.expectDate,
|
||
|
|
this.actualDate,
|
||
|
|
this.status,
|
||
|
|
this.modelAndBrand,
|
||
|
|
this.contactStatus,
|
||
|
|
this.images,
|
||
|
|
this.assignTo,
|
||
|
|
});
|
||
|
|
|
||
|
|
factory Visit.fromJson(Map<String,dynamic> parsedJson){
|
||
|
|
return Visit(
|
||
|
|
id: parsedJson["nid"],
|
||
|
|
serialNumber: parsedJson["title"],
|
||
|
|
hospitalId: parsedJson["client"],
|
||
|
|
hospitalName: parsedJson["client_name"],
|
||
|
|
deviceId: parsedJson["medical_equipment_nid"],
|
||
|
|
deviceSerialNumber: parsedJson["medical_equipment"],
|
||
|
|
deviceEnglishName: parsedJson["equipment_english_name"],
|
||
|
|
deviceArabicName: parsedJson["equipment_arabic_name"],
|
||
|
|
employId: parsedJson["assigned_employee"],
|
||
|
|
employName: parsedJson["assigned_employee_name"],
|
||
|
|
expectDate: parsedJson["expected_date"],
|
||
|
|
actualDate: parsedJson["actual_date"],
|
||
|
|
modelAndBrand: parsedJson["mode_brand"],
|
||
|
|
contactStatus: parsedJson["contactStatus"],
|
||
|
|
images: List<String>.from(parsedJson["images"] ?? []),
|
||
|
|
status: Status(
|
||
|
|
id: int.tryParse(parsedJson["status"] ?? "-1"), // actual value (0,1,2)
|
||
|
|
label: parsedJson["status_value"] // text value
|
||
|
|
),
|
||
|
|
assignTo: parsedJson["assigned_to"],
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|