|
|
|
|
@ -1,9 +1,11 @@
|
|
|
|
|
import 'dart:developer';
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
|
import 'package:fluttertoast/fluttertoast.dart';
|
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
|
import 'package:test_sa/models/device/asset.dart';
|
|
|
|
|
import 'package:test_sa/models/helper_data_models/spare_part/activity_spare_part_model.dart';
|
|
|
|
|
import 'package:test_sa/models/lookup.dart';
|
|
|
|
|
import 'package:test_sa/models/service_request/supplier_details.dart';
|
|
|
|
|
import 'package:test_sa/models/timer_model.dart';
|
|
|
|
|
@ -49,10 +51,20 @@ class PlanPreventiveVisit {
|
|
|
|
|
List<PreventiveVisitKits>? preventiveVisitKits;
|
|
|
|
|
List<PreventiveVisitTimers>? preventiveVisitTimers;
|
|
|
|
|
List<PreventiveVisitSuppliers>? preventiveVisitSuppliers;
|
|
|
|
|
List<PMSparePartActivityModel>? activities;
|
|
|
|
|
num? sparePartCost;
|
|
|
|
|
num? labourCost;
|
|
|
|
|
num? travelCost;
|
|
|
|
|
num? qAmount;
|
|
|
|
|
String? prNo;
|
|
|
|
|
String? poNo;
|
|
|
|
|
String? mrNo;
|
|
|
|
|
num? exchangeCost;
|
|
|
|
|
TimerModel? tbsTimer = TimerModel();
|
|
|
|
|
List<TimerModel>? timerModelList = [];
|
|
|
|
|
TimerModel? ppMTimePicker;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlanPreventiveVisit(
|
|
|
|
|
{this.id,
|
|
|
|
|
this.visitNo,
|
|
|
|
|
@ -95,6 +107,15 @@ class PlanPreventiveVisit {
|
|
|
|
|
this.preventiveVisitTimers,
|
|
|
|
|
this.timerModelList,
|
|
|
|
|
this.ppMTimePicker,
|
|
|
|
|
this.activities,
|
|
|
|
|
this.labourCost,
|
|
|
|
|
this.sparePartCost,
|
|
|
|
|
this.travelCost,
|
|
|
|
|
this.qAmount,
|
|
|
|
|
this.prNo,
|
|
|
|
|
this.poNo,
|
|
|
|
|
this.mrNo,
|
|
|
|
|
this.exchangeCost,
|
|
|
|
|
this.preventiveVisitSuppliers});
|
|
|
|
|
|
|
|
|
|
PlanPreventiveVisit.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
@ -131,6 +152,14 @@ class PlanPreventiveVisit {
|
|
|
|
|
safety = json['safety'] != null ? Lookup.fromJson(json['safety']) : null;
|
|
|
|
|
engSignature = json['engSignature'];
|
|
|
|
|
nurseSignature = json['nurseSignature'];
|
|
|
|
|
travelCost= json['travelCost'];
|
|
|
|
|
sparePartCost= json['sparePartCost'];
|
|
|
|
|
labourCost =json['laborCost'];
|
|
|
|
|
qAmount= json['qAmount'];
|
|
|
|
|
prNo= json['prNo'];
|
|
|
|
|
poNo= json['poNo'];
|
|
|
|
|
mrNo= json['mrNo'];
|
|
|
|
|
exchangeCost= json['exchangeCost'];
|
|
|
|
|
if (json['preventiveVisitAttachments'] != null) {
|
|
|
|
|
preventiveVisitAttachments = <PreventiveVisitAttachments>[];
|
|
|
|
|
json['preventiveVisitAttachments'].forEach((v) {
|
|
|
|
|
@ -167,6 +196,13 @@ class PlanPreventiveVisit {
|
|
|
|
|
preventiveVisitSuppliers!.add(PreventiveVisitSuppliers.fromJson(v));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (json['activitySparePartsPPM'] != null) {
|
|
|
|
|
log("activitySparePartsPPM: ${json['activitySparePartsPPM']}");
|
|
|
|
|
activities = <PMSparePartActivityModel>[];
|
|
|
|
|
json['activitySparePartsPPM'].forEach((v) {
|
|
|
|
|
activities!.add(PMSparePartActivityModel.fromJson(v));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson({required int status}) {
|
|
|
|
|
@ -183,50 +219,6 @@ class PlanPreventiveVisit {
|
|
|
|
|
data['safetyId'] = safety?.id;
|
|
|
|
|
data['engSignature'] = engSignature;
|
|
|
|
|
data['nurseSignature'] = nurseSignature;
|
|
|
|
|
//
|
|
|
|
|
// if (asset != null) {
|
|
|
|
|
// data['asset'] = asset!.toJson();
|
|
|
|
|
// }
|
|
|
|
|
// data['visitNo'] = visitNo;
|
|
|
|
|
// data['planNo'] = planNo;
|
|
|
|
|
// data['planName'] = planName;
|
|
|
|
|
// data['nextPMDate'] = nextPMDate;
|
|
|
|
|
// data['assetName'] = assetName;
|
|
|
|
|
// data['model'] = model;
|
|
|
|
|
// data['manufacturer'] = manufacturer;
|
|
|
|
|
// data['supplierName'] = supplierName;
|
|
|
|
|
// data['siteName'] = siteName;
|
|
|
|
|
// data['buildingName'] = buildingName;
|
|
|
|
|
// data['floorName'] = floorName;
|
|
|
|
|
// data['departmentName'] = departmentName;
|
|
|
|
|
// data['roomName'] = roomName;
|
|
|
|
|
// data['fromDate'] = fromDate;
|
|
|
|
|
// data['toDate'] = toDate;
|
|
|
|
|
// if (assignedEmployee != null) {
|
|
|
|
|
// data['assignedEmployee'] = assignedEmployee!.toJson();
|
|
|
|
|
// }
|
|
|
|
|
// data['acutalDateOfVisit'] = acutalDateOfVisit;
|
|
|
|
|
// if (typeOfService != null) {
|
|
|
|
|
// data['typeOfService'] = typeOfService!.toJson();
|
|
|
|
|
// }
|
|
|
|
|
// if (visitStatus != null) {
|
|
|
|
|
// data['visitStatus'] = visitStatus!.toJson();
|
|
|
|
|
// }
|
|
|
|
|
// data['travelingHours'] = travelingHours;
|
|
|
|
|
// data['comments'] = comments;
|
|
|
|
|
// data['executionTimeFrame'] = executionTimeFrame;
|
|
|
|
|
// if (taskStatus != null) {
|
|
|
|
|
// data['taskStatus'] = taskStatus!.toJson();
|
|
|
|
|
// }
|
|
|
|
|
// if (deviceStatus != null) {
|
|
|
|
|
// data['deviceStatus'] = deviceStatus!.toJson();
|
|
|
|
|
// }
|
|
|
|
|
// data['assetAvailability'] = assetAvailability;
|
|
|
|
|
// if (safety != null) {
|
|
|
|
|
// data['safety'] = safety!.toJson();
|
|
|
|
|
// }
|
|
|
|
|
// data['engSignature'] = engSignature;
|
|
|
|
|
// data['nurseSignature'] = nurseSignature;
|
|
|
|
|
|
|
|
|
|
if (preventiveVisitAttachments != null) {
|
|
|
|
|
data['preventiveVisitAttachments'] = preventiveVisitAttachments!.map((v) => v.toJson()).toList();
|
|
|
|
|
@ -246,12 +238,10 @@ class PlanPreventiveVisit {
|
|
|
|
|
if (preventiveVisitSuppliers != null) {
|
|
|
|
|
data['preventiveVisitSuppliers'] = preventiveVisitSuppliers!.map((v) => v.toJson()).toList();
|
|
|
|
|
}
|
|
|
|
|
return data;
|
|
|
|
|
if (activities != null) {
|
|
|
|
|
data['activitySparePartsPPM'] = activities!.map((v) => v.toJson()).toList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool _isLocalUrl(String url) {
|
|
|
|
|
if (url.isEmpty != false) return false;
|
|
|
|
|
return url.startsWith("/") || url.startsWith("file://") || url.substring(1).startsWith(':\\');
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<bool> validate(BuildContext context) async {
|
|
|
|
|
@ -290,276 +280,6 @@ class PlanPreventiveVisit {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// class PlanPreventiveVisit {
|
|
|
|
|
// String? id;
|
|
|
|
|
// String? visitNo;
|
|
|
|
|
// Asset? asset;
|
|
|
|
|
// String? planNo;
|
|
|
|
|
// String? planName;
|
|
|
|
|
// String? nextPMDate;
|
|
|
|
|
// String? assetName;
|
|
|
|
|
// String? model;
|
|
|
|
|
// String? manufacturer;
|
|
|
|
|
// String? supplierName;
|
|
|
|
|
// String? siteName;
|
|
|
|
|
// String? buildingName;
|
|
|
|
|
// String? floorName;
|
|
|
|
|
// String? departmentName;
|
|
|
|
|
// String? roomName;
|
|
|
|
|
// String? fromDate;
|
|
|
|
|
// String? toDate;
|
|
|
|
|
// AssignedEmployee? assignedEmployee;
|
|
|
|
|
// String? acutalDateOfVisit;
|
|
|
|
|
// TypeOfService? typeOfService;
|
|
|
|
|
// VisitStatus? visitStatus;
|
|
|
|
|
// String? travelingHours;
|
|
|
|
|
// String? comments;
|
|
|
|
|
// int? executionTimeFrame;
|
|
|
|
|
// Lookup? taskStatus;
|
|
|
|
|
// String? deviceStatus;
|
|
|
|
|
// Lookup? assetAvailability;
|
|
|
|
|
// Lookup? safety;
|
|
|
|
|
// String? engSignature;
|
|
|
|
|
// String? nurseSignature;
|
|
|
|
|
// List<PreventiveVisitChecklists>? preventiveVisitAttachments;
|
|
|
|
|
// List<PreventiveVisitChecklists>? preventiveVisitCalibrations;
|
|
|
|
|
// List<PreventiveVisitChecklists>? preventiveVisitChecklists;
|
|
|
|
|
// List<PreventiveVisitChecklists>? preventiveVisitKits;
|
|
|
|
|
// List<PreventiveVisitTimers>? preventiveVisitTimers;
|
|
|
|
|
// List<PreventiveVisitChecklists>? preventiveVisitSuppliers;
|
|
|
|
|
// TimerModel? tbsTimer = TimerModel();
|
|
|
|
|
//
|
|
|
|
|
// PlanPreventiveVisit(
|
|
|
|
|
// {this.id,
|
|
|
|
|
// this.visitNo,
|
|
|
|
|
// this.asset,
|
|
|
|
|
// this.planNo,
|
|
|
|
|
// this.planName,
|
|
|
|
|
// this.nextPMDate,
|
|
|
|
|
// this.assetName,
|
|
|
|
|
// this.model,
|
|
|
|
|
// this.manufacturer,
|
|
|
|
|
// this.supplierName,
|
|
|
|
|
// this.siteName,
|
|
|
|
|
// this.buildingName,
|
|
|
|
|
// this.floorName,
|
|
|
|
|
// this.departmentName,
|
|
|
|
|
// this.roomName,
|
|
|
|
|
// this.fromDate,
|
|
|
|
|
// this.toDate,
|
|
|
|
|
// this.assignedEmployee,
|
|
|
|
|
// this.acutalDateOfVisit,
|
|
|
|
|
// this.typeOfService,
|
|
|
|
|
// this.visitStatus,
|
|
|
|
|
// this.travelingHours,
|
|
|
|
|
// this.comments,
|
|
|
|
|
// this.executionTimeFrame,
|
|
|
|
|
// this.taskStatus,
|
|
|
|
|
// this.deviceStatus,
|
|
|
|
|
// this.assetAvailability,
|
|
|
|
|
// this.safety,
|
|
|
|
|
// this.engSignature,
|
|
|
|
|
// this.nurseSignature,
|
|
|
|
|
// this.preventiveVisitAttachments,
|
|
|
|
|
// this.preventiveVisitCalibrations,
|
|
|
|
|
// this.preventiveVisitChecklists,
|
|
|
|
|
// this.preventiveVisitKits,
|
|
|
|
|
// this.preventiveVisitTimers,
|
|
|
|
|
// this.preventiveVisitSuppliers});
|
|
|
|
|
//
|
|
|
|
|
// PlanPreventiveVisit.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
// id = json['id'];
|
|
|
|
|
// visitNo = json['visitNo'];
|
|
|
|
|
// asset = json['asset'] != null ? Asset.fromJson(json['asset']) : null;
|
|
|
|
|
// planNo = json['planNo'];
|
|
|
|
|
// planName = json['planName'];
|
|
|
|
|
// nextPMDate = json['nextPMDate'];
|
|
|
|
|
// assetName = json['assetName'];
|
|
|
|
|
// model = json['model'];
|
|
|
|
|
// manufacturer = json['manufacturer'];
|
|
|
|
|
// supplierName = json['supplierName'];
|
|
|
|
|
// siteName = json['siteName'];
|
|
|
|
|
// buildingName = json['buildingName'];
|
|
|
|
|
// floorName = json['floorName'];
|
|
|
|
|
// departmentName = json['departmentName'];
|
|
|
|
|
// roomName = json['roomName'];
|
|
|
|
|
// fromDate = json['fromDate'];
|
|
|
|
|
// toDate = json['toDate'];
|
|
|
|
|
// assignedEmployee = json['assignedEmployee'] != null ? AssignedEmployee.fromJson(json['assignedEmployee']) : null;
|
|
|
|
|
// acutalDateOfVisit = json['acutalDateOfVisit'];
|
|
|
|
|
// typeOfService = json['typeOfService'] != null ? TypeOfService.fromJson(json['typeOfService']) : null;
|
|
|
|
|
// visitStatus = json['visitStatus'] != null ? VisitStatus.fromJson(json['visitStatus']) : null;
|
|
|
|
|
// travelingHours = json['travelingHours'];
|
|
|
|
|
// comments = json['comments'];
|
|
|
|
|
// executionTimeFrame = json['executionTimeFrame'];
|
|
|
|
|
// taskStatus = json['taskStatus'];
|
|
|
|
|
// deviceStatus = json['deviceStatus'];
|
|
|
|
|
// assetAvailability = json['assetAvailability'];
|
|
|
|
|
// safety = json['safety'];
|
|
|
|
|
// engSignature = json['engSignature'];
|
|
|
|
|
// nurseSignature = json['nurseSignature'];
|
|
|
|
|
// if (json['preventiveVisitAttachments'] != null) {
|
|
|
|
|
// preventiveVisitAttachments = <PreventiveVisitChecklists>[];
|
|
|
|
|
// json['preventiveVisitAttachments'].forEach((v) {
|
|
|
|
|
// preventiveVisitAttachments!.add(PreventiveVisitChecklists.fromJson(v));
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// if (json['preventiveVisitCalibrations'] != null) {
|
|
|
|
|
// preventiveVisitCalibrations = <PreventiveVisitChecklists>[];
|
|
|
|
|
// json['preventiveVisitCalibrations'].forEach((v) {
|
|
|
|
|
// preventiveVisitCalibrations!.add( PreventiveVisitChecklists.fromJson(v));
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// if (json['preventiveVisitChecklists'] != null) {
|
|
|
|
|
// preventiveVisitChecklists = <PreventiveVisitChecklists>[];
|
|
|
|
|
// json['preventiveVisitChecklists'].forEach((v) {
|
|
|
|
|
// preventiveVisitChecklists!.add( PreventiveVisitChecklists.fromJson(v));
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// if (json['preventiveVisitKits'] != null) {
|
|
|
|
|
// preventiveVisitKits = <PreventiveVisitChecklists>[];
|
|
|
|
|
// json['preventiveVisitKits'].forEach((v) {
|
|
|
|
|
// preventiveVisitKits!.add( PreventiveVisitChecklists.fromJson(v));
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// if (json['preventiveVisitTimers'] != null) {
|
|
|
|
|
// preventiveVisitTimers = <PreventiveVisitTimers>[];
|
|
|
|
|
// json['preventiveVisitTimers'].forEach((v) {
|
|
|
|
|
// preventiveVisitTimers!.add( PreventiveVisitTimers.fromJson(v));
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// if (json['preventiveVisitSuppliers'] != null) {
|
|
|
|
|
// preventiveVisitSuppliers = <PreventiveVisitChecklists>[];
|
|
|
|
|
// json['preventiveVisitSuppliers'].forEach((v) {
|
|
|
|
|
// preventiveVisitSuppliers!.add( PreventiveVisitChecklists.fromJson(v));
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Map<String, dynamic> toJson() {
|
|
|
|
|
// final Map<String, dynamic> data = Map<String, dynamic>();
|
|
|
|
|
// data['id'] = this.id;
|
|
|
|
|
// data['visitNo'] = this.visitNo;
|
|
|
|
|
// if (this.asset != null) {
|
|
|
|
|
// data['asset'] = this.asset!.toJson();
|
|
|
|
|
// }
|
|
|
|
|
// data['planNo'] = this.planNo;
|
|
|
|
|
// data['planName'] = this.planName;
|
|
|
|
|
// data['nextPMDate'] = this.nextPMDate;
|
|
|
|
|
// data['assetName'] = this.assetName;
|
|
|
|
|
// data['model'] = this.model;
|
|
|
|
|
// data['manufacturer'] = this.manufacturer;
|
|
|
|
|
// data['supplierName'] = this.supplierName;
|
|
|
|
|
// data['siteName'] = this.siteName;
|
|
|
|
|
// data['buildingName'] = this.buildingName;
|
|
|
|
|
// data['floorName'] = this.floorName;
|
|
|
|
|
// data['departmentName'] = this.departmentName;
|
|
|
|
|
// data['roomName'] = this.roomName;
|
|
|
|
|
// data['fromDate'] = this.fromDate;
|
|
|
|
|
// data['toDate'] = this.toDate;
|
|
|
|
|
// if (this.assignedEmployee != null) {
|
|
|
|
|
// data['assignedEmployee'] = this.assignedEmployee!.toJson();
|
|
|
|
|
// }
|
|
|
|
|
// data['acutalDateOfVisit'] = this.acutalDateOfVisit;
|
|
|
|
|
// if (this.typeOfService != null) {
|
|
|
|
|
// data['typeOfService'] = this.typeOfService!.toJson();
|
|
|
|
|
// }
|
|
|
|
|
// if (this.visitStatus != null) {
|
|
|
|
|
// data['visitStatus'] = this.visitStatus!.toJson();
|
|
|
|
|
// }
|
|
|
|
|
// data['travelingHours'] = this.travelingHours;
|
|
|
|
|
// data['comments'] = this.comments;
|
|
|
|
|
// data['executionTimeFrame'] = this.executionTimeFrame;
|
|
|
|
|
// data['taskStatus'] = this.taskStatus;
|
|
|
|
|
// data['deviceStatus'] = this.deviceStatus;
|
|
|
|
|
// data['assetAvailability'] = this.assetAvailability;
|
|
|
|
|
// data['safety'] = this.safety;
|
|
|
|
|
// data['engSignature'] = this.engSignature;
|
|
|
|
|
// data['nurseSignature'] = this.nurseSignature;
|
|
|
|
|
// if (this.preventiveVisitAttachments != null) {
|
|
|
|
|
// data['preventiveVisitAttachments'] = this.preventiveVisitAttachments!.map((v) => v.toJson()).toList();
|
|
|
|
|
// }
|
|
|
|
|
// if (this.preventiveVisitCalibrations != null) {
|
|
|
|
|
// data['preventiveVisitCalibrations'] = this.preventiveVisitCalibrations!.map((v) => v.toJson()).toList();
|
|
|
|
|
// }
|
|
|
|
|
// if (this.preventiveVisitChecklists != null) {
|
|
|
|
|
// data['preventiveVisitChecklists'] = this.preventiveVisitChecklists!.map((v) => v.toJson()).toList();
|
|
|
|
|
// }
|
|
|
|
|
// if (this.preventiveVisitKits != null) {
|
|
|
|
|
// data['preventiveVisitKits'] = this.preventiveVisitKits!.map((v) => v.toJson()).toList();
|
|
|
|
|
// }
|
|
|
|
|
// if (this.preventiveVisitTimers != null) {
|
|
|
|
|
// data['preventiveVisitTimers'] = this.preventiveVisitTimers!.map((v) => v.toJson()).toList();
|
|
|
|
|
// }
|
|
|
|
|
// if (this.preventiveVisitSuppliers != null) {
|
|
|
|
|
// data['preventiveVisitSuppliers'] = this.preventiveVisitSuppliers!.map((v) => v.toJson()).toList();
|
|
|
|
|
// }
|
|
|
|
|
// return data;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// bool _isLocalUrl(String url) {
|
|
|
|
|
// if (url.isEmpty != false) return false;
|
|
|
|
|
// return url.startsWith("/") || url.startsWith("file://") || url.substring(1).startsWith(':\\');
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Future<bool> validate(BuildContext context) async {
|
|
|
|
|
// if (visitStatus?.id == null) {
|
|
|
|
|
// await Fluttertoast.showToast(msg: "${context.translation.youHaveToSelect} ${context.translation.status}");
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// if (acutalDateOfVisit == null) {
|
|
|
|
|
// await Fluttertoast.showToast(msg: "${context.translation.youHaveToSelect} ${context.translation.actualDate}");
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// // if (expectedDate == null) {
|
|
|
|
|
// // await Fluttertoast.showToast(msg: "${context.translation.youHaveToSelect} ${context.translation.visitDate}");
|
|
|
|
|
// // return false;
|
|
|
|
|
// // }
|
|
|
|
|
// if (tbsTimer?.startAt == null) {
|
|
|
|
|
// await Fluttertoast.showToast(msg: "Working Hours Required");
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// if (tbsTimer?.endAt == null) {
|
|
|
|
|
// await Fluttertoast.showToast(msg: "Please Stop The Timer");
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// // if (externalEngineerTimer?.startAt != null && externalEngineerTimer?.endAt == null) {
|
|
|
|
|
// // await Fluttertoast.showToast(msg: "Please Stop External Engineer Timer");
|
|
|
|
|
// // return false;
|
|
|
|
|
// // }
|
|
|
|
|
//
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// void removeEmptyObjects() {
|
|
|
|
|
// // if (vCalibrationTools?.isNotEmpty ?? false) vCalibrationTools!.removeWhere((element) => element.assetId == null && element.calibrationDateOfTesters == null);
|
|
|
|
|
// // if (vKits?.isNotEmpty ?? false) vKits!.removeWhere((element) => element.partName == null && element.partNumber == null);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// class Asset {
|
|
|
|
|
// num? id;
|
|
|
|
|
// String? assetNumber;
|
|
|
|
|
// String? assetSerialNo;
|
|
|
|
|
//
|
|
|
|
|
// Asset({this.id, this.assetNumber, this.assetSerialNo});
|
|
|
|
|
//
|
|
|
|
|
// Asset.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
// id = json['id'];
|
|
|
|
|
// assetNumber = json['assetNumber'];
|
|
|
|
|
// assetSerialNo = json['assetSerialNo'];
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Map<String, dynamic> toJson() {
|
|
|
|
|
// final Map<String, dynamic> data = Map<String, dynamic>();
|
|
|
|
|
// data['id'] = this.id;
|
|
|
|
|
// data['assetNumber'] = this.assetNumber;
|
|
|
|
|
// data['assetSerialNo'] = this.assetSerialNo;
|
|
|
|
|
// return data;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
class AssignedEmployee {
|
|
|
|
|
String? userId;
|
|
|
|
|
String? userName;
|
|
|
|
|
@ -588,50 +308,6 @@ class AssignedEmployee {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// class Lookup {
|
|
|
|
|
// int? id;
|
|
|
|
|
// String? name;
|
|
|
|
|
// int? value;
|
|
|
|
|
//
|
|
|
|
|
// Lookup({this.id, this.name, this.value});
|
|
|
|
|
//
|
|
|
|
|
// Lookup.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
// id = json['id'];
|
|
|
|
|
// name = json['name'];
|
|
|
|
|
// value = json['value'];
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Map<String, dynamic> toJson() {
|
|
|
|
|
// final Map<String, dynamic> data = Map<String, dynamic>();
|
|
|
|
|
// data['id'] = this.id;
|
|
|
|
|
// data['name'] = this.name;
|
|
|
|
|
// data['value'] = this.value;
|
|
|
|
|
// return data;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// class VisitStatus {
|
|
|
|
|
// int? id;
|
|
|
|
|
// String? name;
|
|
|
|
|
// int? value;
|
|
|
|
|
//
|
|
|
|
|
// VisitStatus({this.id, this.name, this.value});
|
|
|
|
|
//
|
|
|
|
|
// VisitStatus.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
// id = json['id'];
|
|
|
|
|
// name = json['name'];
|
|
|
|
|
// value = json['value'];
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Map<String, dynamic> toJson() {
|
|
|
|
|
// final Map<String, dynamic> data = Map<String, dynamic>();
|
|
|
|
|
// data['id'] = this.id;
|
|
|
|
|
// data['name'] = this.name;
|
|
|
|
|
// data['value'] = this.value;
|
|
|
|
|
// return data;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
class PreventiveVisitChecklists {
|
|
|
|
|
int? id;
|
|
|
|
|
Lookup? taskStatus;
|
|
|
|
|
@ -788,171 +464,6 @@ class PreventiveVisitSuppliers {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// class Supplier {
|
|
|
|
|
// int? id;
|
|
|
|
|
// String? suppliername;
|
|
|
|
|
// String? name;
|
|
|
|
|
// String? website;
|
|
|
|
|
// String? email;
|
|
|
|
|
// String? code;
|
|
|
|
|
// int? suppNo;
|
|
|
|
|
// String? suppStatusId;
|
|
|
|
|
// String? cityId;
|
|
|
|
|
// String? person;
|
|
|
|
|
// String? comment;
|
|
|
|
|
// String? zipcode;
|
|
|
|
|
// String? contact;
|
|
|
|
|
// List<String>? telephones;
|
|
|
|
|
// List<String>? faxes;
|
|
|
|
|
// List<String>? addresses;
|
|
|
|
|
// List<String>? attachments;
|
|
|
|
|
// List<SuppPersons>? suppPersons;
|
|
|
|
|
// List<String>? suppTCodes;
|
|
|
|
|
//
|
|
|
|
|
// Supplier(
|
|
|
|
|
// {this.id,
|
|
|
|
|
// this.suppliername,
|
|
|
|
|
// this.name,
|
|
|
|
|
// this.website,
|
|
|
|
|
// this.email,
|
|
|
|
|
// this.code,
|
|
|
|
|
// this.suppNo,
|
|
|
|
|
// this.suppStatusId,
|
|
|
|
|
// this.cityId,
|
|
|
|
|
// this.person,
|
|
|
|
|
// this.comment,
|
|
|
|
|
// this.zipcode,
|
|
|
|
|
// this.contact,
|
|
|
|
|
// this.telephones,
|
|
|
|
|
// this.faxes,
|
|
|
|
|
// this.addresses,
|
|
|
|
|
// this.attachments,
|
|
|
|
|
// this.suppPersons,
|
|
|
|
|
// this.suppTCodes});
|
|
|
|
|
//
|
|
|
|
|
// Supplier.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
// id = json['id'];
|
|
|
|
|
// suppliername = json['suppliername'];
|
|
|
|
|
// name = json['name'];
|
|
|
|
|
// website = json['website'];
|
|
|
|
|
// email = json['email'];
|
|
|
|
|
// code = json['code'];
|
|
|
|
|
// suppNo = json['suppNo'];
|
|
|
|
|
// suppStatusId = json['suppStatusId'];
|
|
|
|
|
// cityId = json['cityId'];
|
|
|
|
|
// person = json['person'];
|
|
|
|
|
// comment = json['comment'];
|
|
|
|
|
// zipcode = json['zipcode'];
|
|
|
|
|
// contact = json['contact'];
|
|
|
|
|
// if (json['telephones'] != null) {
|
|
|
|
|
// telephones = <String>[];
|
|
|
|
|
// json['telephones'].forEach((v) {
|
|
|
|
|
// telephones!.add(v);
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// if (json['faxes'] != null) {
|
|
|
|
|
// faxes = <String>[];
|
|
|
|
|
// json['faxes'].forEach((v) {
|
|
|
|
|
// faxes!.add(v);
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// if (json['addresses'] != null) {
|
|
|
|
|
// addresses = <String>[];
|
|
|
|
|
// json['addresses'].forEach((v) {
|
|
|
|
|
// addresses!.add(v);
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// if (json['attachments'] != null) {
|
|
|
|
|
// attachments = <String>[];
|
|
|
|
|
// json['attachments'].forEach((v) {
|
|
|
|
|
// attachments!.add(v);
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// if (json['suppPersons'] != null) {
|
|
|
|
|
// suppPersons = <SuppPersons>[];
|
|
|
|
|
// json['suppPersons'].forEach((v) {
|
|
|
|
|
// suppPersons!.add(SuppPersons.fromJson(v));
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// if (json['suppTCodes'] != null) {
|
|
|
|
|
// suppTCodes = <String>[];
|
|
|
|
|
// json['suppTCodes'].forEach((v) {
|
|
|
|
|
// suppTCodes!.add(v);
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Map<String, dynamic> toJson() {
|
|
|
|
|
// final Map<String, dynamic> data = <String, dynamic>{};
|
|
|
|
|
// data['id'] = id;
|
|
|
|
|
// data['suppliername'] = suppliername;
|
|
|
|
|
// data['name'] = name;
|
|
|
|
|
// data['website'] = website;
|
|
|
|
|
// data['email'] = email;
|
|
|
|
|
// data['code'] = code;
|
|
|
|
|
// data['suppNo'] = suppNo;
|
|
|
|
|
// data['suppStatusId'] = suppStatusId;
|
|
|
|
|
// data['cityId'] = cityId;
|
|
|
|
|
// data['person'] = person;
|
|
|
|
|
// data['comment'] = comment;
|
|
|
|
|
// data['zipcode'] = zipcode;
|
|
|
|
|
// data['contact'] = contact;
|
|
|
|
|
// if (telephones != null) {
|
|
|
|
|
// data['telephones'] = telephones!.map((v) => v).toList();
|
|
|
|
|
// }
|
|
|
|
|
// if (faxes != null) {
|
|
|
|
|
// data['faxes'] = faxes!.map((v) => v).toList();
|
|
|
|
|
// }
|
|
|
|
|
// if (addresses != null) {
|
|
|
|
|
// data['addresses'] = addresses!.map((v) => v).toList();
|
|
|
|
|
// }
|
|
|
|
|
// if (attachments != null) {
|
|
|
|
|
// data['attachments'] = attachments!.map((v) => v).toList();
|
|
|
|
|
// }
|
|
|
|
|
// if (suppPersons != null) {
|
|
|
|
|
// data['suppPersons'] = suppPersons!.map((v) => v.toJson()).toList();
|
|
|
|
|
// }
|
|
|
|
|
// if (suppTCodes != null) {
|
|
|
|
|
// data['suppTCodes'] = suppTCodes!.map((v) => v).toList();
|
|
|
|
|
// }
|
|
|
|
|
// return data;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// class SuppPersons {
|
|
|
|
|
// int? id;
|
|
|
|
|
// int? supplierId;
|
|
|
|
|
// String? personName;
|
|
|
|
|
// int? personRoleId;
|
|
|
|
|
// String? contact;
|
|
|
|
|
// String? externalEngCode;
|
|
|
|
|
// String? email;
|
|
|
|
|
//
|
|
|
|
|
// SuppPersons({this.id, this.supplierId, this.personName, this.personRoleId, this.contact, this.externalEngCode, this.email});
|
|
|
|
|
//
|
|
|
|
|
// SuppPersons.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
// id = json['id'];
|
|
|
|
|
// supplierId = json['supplierId'];
|
|
|
|
|
// personName = json['personName'];
|
|
|
|
|
// personRoleId = json['personRoleId'];
|
|
|
|
|
// contact = json['contact'];
|
|
|
|
|
// externalEngCode = json['externalEngCode'];
|
|
|
|
|
// email = json['email'];
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Map<String, dynamic> toJson() {
|
|
|
|
|
// final Map<String, dynamic> data = Map<String, dynamic>();
|
|
|
|
|
// data['id'] = this.id;
|
|
|
|
|
// data['supplierId'] = this.supplierId;
|
|
|
|
|
// data['personName'] = this.personName;
|
|
|
|
|
// data['personRoleId'] = this.personRoleId;
|
|
|
|
|
// data['contact'] = this.contact;
|
|
|
|
|
// data['externalEngCode'] = this.externalEngCode;
|
|
|
|
|
// data['email'] = this.email;
|
|
|
|
|
// return data;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
class PreventiveVisitKits {
|
|
|
|
|
int? id;
|
|
|
|
|
PartCatalogItem? partCatalogItem;
|
|
|
|
|
@ -999,3 +510,80 @@ class PartCatalogItem {
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class PMSparePartActivityModel {
|
|
|
|
|
int? id;
|
|
|
|
|
PartCatalogItem? partCatalogItem;
|
|
|
|
|
Lookup? activityStatus;
|
|
|
|
|
double? quantity;
|
|
|
|
|
double? installQty;
|
|
|
|
|
double? returnQty;
|
|
|
|
|
String? comment;
|
|
|
|
|
dynamic price;
|
|
|
|
|
|
|
|
|
|
List<SparePartAttachments> activitySparePartPPMAttachments;
|
|
|
|
|
|
|
|
|
|
PMSparePartActivityModel({
|
|
|
|
|
this.id,
|
|
|
|
|
this.partCatalogItem,
|
|
|
|
|
this.activityStatus,
|
|
|
|
|
this.quantity,
|
|
|
|
|
this.installQty,
|
|
|
|
|
this.returnQty,
|
|
|
|
|
this.comment,
|
|
|
|
|
this.price,
|
|
|
|
|
List<SparePartAttachments>? activitySparePartPPMAttachments,
|
|
|
|
|
}) : activitySparePartPPMAttachments = activitySparePartPPMAttachments ?? [];
|
|
|
|
|
|
|
|
|
|
PMSparePartActivityModel.fromJson(Map<String, dynamic> json) : activitySparePartPPMAttachments = [] {
|
|
|
|
|
id = json['id'];
|
|
|
|
|
|
|
|
|
|
partCatalogItem = json['partCatalogItem'] != null ? PartCatalogItem.fromJson(json['partCatalogItem']) : null;
|
|
|
|
|
|
|
|
|
|
activityStatus = json['activityStatus'] != null ? Lookup.fromJson(json['activityStatus']) : null;
|
|
|
|
|
|
|
|
|
|
quantity = json['quantity']?.toDouble();
|
|
|
|
|
installQty = json['installQty']?.toDouble();
|
|
|
|
|
returnQty = json['returnQty']?.toDouble();
|
|
|
|
|
|
|
|
|
|
comment = json['comment'];
|
|
|
|
|
price = json['price'];
|
|
|
|
|
|
|
|
|
|
// Handle typo in API response: "acitiySparePartPPMAttachments" instead of "activitySparePartPPMAttachments"
|
|
|
|
|
final attachmentsKey = json.containsKey('acitiySparePartPPMAttachments')
|
|
|
|
|
? 'acitiySparePartPPMAttachments'
|
|
|
|
|
: 'activitySparePartPPMAttachments';
|
|
|
|
|
|
|
|
|
|
activitySparePartPPMAttachments = json[attachmentsKey] == null
|
|
|
|
|
? []
|
|
|
|
|
: List.from(json[attachmentsKey]).map((e) => SparePartAttachments.fromJson(e)).toList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
final Map<String, dynamic> data = {};
|
|
|
|
|
|
|
|
|
|
data['id'] = id;
|
|
|
|
|
|
|
|
|
|
if (partCatalogItem != null) {
|
|
|
|
|
data['partCatalogItem'] = partCatalogItem!.toJson();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (activityStatus != null) {
|
|
|
|
|
data['activityStatus'] = activityStatus!.toJson();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data['quantity'] = quantity;
|
|
|
|
|
data['installQty'] = installQty;
|
|
|
|
|
data['returnQty'] = returnQty;
|
|
|
|
|
data['comment'] = comment;
|
|
|
|
|
data['price'] = price;
|
|
|
|
|
|
|
|
|
|
data['activitySparePartPPMAttachments'] = activitySparePartPPMAttachments
|
|
|
|
|
.map(
|
|
|
|
|
(v) => v.toJson(),
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|