|
|
|
|
@ -2,6 +2,7 @@ import 'dart:convert';
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
import 'dart:typed_data';
|
|
|
|
|
|
|
|
|
|
import 'package:fluttertoast/fluttertoast.dart';
|
|
|
|
|
import 'package:test_sa/controllers/api_routes/urls.dart';
|
|
|
|
|
import 'package:test_sa/models/lookup.dart';
|
|
|
|
|
import 'package:test_sa/models/pantry/calibration_tools.dart';
|
|
|
|
|
@ -45,12 +46,28 @@ class Pentry {
|
|
|
|
|
this.localNurseSignature,
|
|
|
|
|
this.localEngineerSignature});
|
|
|
|
|
|
|
|
|
|
bool validate() {
|
|
|
|
|
if (actualVisitDate == null) return false;
|
|
|
|
|
if (expectedVisitDate == null) return false;
|
|
|
|
|
if (timer == null && timer.endAt != null) return false;
|
|
|
|
|
Future<bool> validate() async {
|
|
|
|
|
if (actualVisitDate == null) {
|
|
|
|
|
await Fluttertoast.showToast(msg: "Actual visit date is Required");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (expectedVisitDate == null) {
|
|
|
|
|
await Fluttertoast.showToast(msg: "expected visit date is Required");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (timer?.startAt == null) {
|
|
|
|
|
await Fluttertoast.showToast(msg: "Working Hours Required");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (timer?.endAt == null) {
|
|
|
|
|
await Fluttertoast.showToast(msg: "Please Stop The Timer");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (ppmVisitStatus == null) return false;
|
|
|
|
|
//if(status == null) return false;
|
|
|
|
|
if (status?.id == null) {
|
|
|
|
|
await Fluttertoast.showToast(msg: "Device Status is Required");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@ -121,7 +138,6 @@ class Pentry {
|
|
|
|
|
startAt: DateTime.tryParse(map["startDate"] ?? ""),
|
|
|
|
|
endAt: DateTime.tryParse(map["endDate"] ?? ""),
|
|
|
|
|
durationInSecond: (int.tryParse(map["workingHours"] ?? "") ?? 0) * 60 * 60,
|
|
|
|
|
stopped: map["workingHours"] == null ? null : true,
|
|
|
|
|
),
|
|
|
|
|
// contacts: contacts,
|
|
|
|
|
ppmCheckLists: ppmCheckLists,
|
|
|
|
|
|