import 'dart:typed_data'; import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/service_request/spare_parts.dart'; import 'package:test_sa/models/service_request/supp_engineer_work_orders.dart'; import 'package:test_sa/models/service_request/supplier_details.dart'; import 'package:test_sa/models/service_request/wo_call_request.dart'; import 'package:test_sa/models/service_request/wo_parent.dart'; import '../../attachment.dart'; import '../device/asset.dart'; import '../fault_description.dart'; import '../new_models/assigned_employee.dart'; import '../new_models/assistant_employee.dart'; import 'contact_person_work_order.dart'; class ServiceReport { ServiceReport({ this.id, this.parentWOId, this.workOrderNo, this.workOrderYear, this.workOrderSequennce, this.callRequest, this.assetType, this.assignedEmployee, this.visitDate, this.assistantEmployees, this.supplier, this.vendorTicketNumber, this.mrNumber, this.contactPersonWorkOrders, this.calllastSituation, this.currentSituation, this.repairLocation, this.reason, this.startofWorkTime, this.endofWorkTime, this.workingHours, this.travelingHours, this.travelingExpenses, this.faultDescription, this.sparePartsWorkOrders, this.reviewComment, this.comment, this.attachmentsWorkOrder, this.equipmentStatus, this.suppEngineerWorkOrders, this.engSignature, this.nurseSignature, this.woParentDto, this.loanAvailablity, this.assetLoan, }); ServiceReport.fromJson(dynamic json) { id = json['id']; parentWOId = json['parentWOId']; workOrderNo = json['workOrderNo']; workOrderYear = json['workOrderYear']; workOrderSequennce = json['workOrderSequennce']; callRequest = json['callRequest'] != null ? CallRequest.fromJson(json['callRequest']) : null; assetType = json['assetType'] != null ? Lookup.fromJson(json['assetType']) : null; assignedEmployee = json['assignedEmployee'] != null ? AssignedEmployee.fromJson(json['assignedEmployee']) : null; visitDate = json['visitDate']; if (json['assistantEmployees'] != null) { assistantEmployees = []; json['assistantEmployees'].forEach((v) { assistantEmployees.add(AssistantEmployees.fromJson(v)); }); } supplier = json['supplier'] != null ? SupplierDetails.fromJson(json['supplier']) : null; vendorTicketNumber = json['vendorTicketNumber']; mrNumber = json['mrNumber']; if (json['contactPersonWorkOrders'] != null) { contactPersonWorkOrders = []; json['contactPersonWorkOrders'].forEach((v) { contactPersonWorkOrders.add(ContactPersonWorkOrder.fromJson(v)); }); } calllastSituation = json['calllastSituation'] != null ? Lookup.fromJson(json['calllastSituation']) : null; currentSituation = json['currentSituation'] != null ? Lookup.fromJson(json['currentSituation']) : null; repairLocation = json['repairLocation'] != null ? Lookup.fromJson(json['repairLocation']) : null; reason = json['reason'] != null ? Lookup.fromJson(json['reason']) : null; startofWorkTime = json['startofWorkTime']; endofWorkTime = json['endofWorkTime']; workingHours = json['workingHours']; travelingHours = json['travelingHours']; travelingExpenses = json['travelingExpenses']; faultDescription = json['faultDescription'] != null ? FaultDescription.fromJson(json['faultDescription']) : null; if (json['sparePartsWorkOrders'] != null) { sparePartsWorkOrders = []; json['sparePartsWorkOrders'].forEach((v) { sparePartsWorkOrders.add(SparePartsWorkOrders.fromJson(v)); }); } reviewComment = json['reviewComment']; comment = json['comment']; if (json['attachmentsWorkOrder'] != null) { attachmentsWorkOrder = []; json['attachmentsWorkOrder'].forEach((v) { attachmentsWorkOrder.add(Attachment.fromJson(v)); }); } equipmentStatus = json['equipmentStatus'] != null ? Lookup.fromJson(json['equipmentStatus']) : null; if (json['suppEngineerWorkOrders'] != null) { suppEngineerWorkOrders = []; json['suppEngineerWorkOrders'].forEach((v) { suppEngineerWorkOrders.add(SuppEngineerWorkOrders.fromJson(v)); }); } engSignature = json['engSignature']; nurseSignature = json['nurseSignature']; woParentDto = json['woParentDto'] != null ? WoParent.fromJson(json['woParentDto']) : null; loanAvailablity = json['loanAvailablity'] != null ? Lookup.fromJson(json['loanAvailablity']) : null; assetLoan = json['assetLoan'] != null ? AssetInfo.fromJson(json['assetLoan']) : null; } num id; num parentWOId; String workOrderNo; num workOrderYear; num workOrderSequennce; CallRequest callRequest; Lookup assetType; AssignedEmployee assignedEmployee; String visitDate; List assistantEmployees; SupplierDetails supplier; String vendorTicketNumber; String mrNumber; List contactPersonWorkOrders; Lookup calllastSituation; Lookup currentSituation; Lookup repairLocation; Lookup reason; String startofWorkTime; String endofWorkTime; num workingHours; num travelingHours; num travelingExpenses; FaultDescription faultDescription; List sparePartsWorkOrders; String reviewComment; String comment; List attachmentsWorkOrder; Lookup equipmentStatus; List suppEngineerWorkOrders; String engSignature; Uint8List localEngSignature; String nurseSignature; Uint8List localNurseSignature; WoParent woParentDto; Lookup loanAvailablity; AssetInfo assetLoan; ServiceReport copyWith({ num id, num parentWOId, String workOrderNo, num workOrderYear, num workOrderSequennce, CallRequest callRequest, Lookup assetType, AssignedEmployee assignedEmployee, String visitDate, List assistantEmployees, SupplierDetails supplier, String vendorTicketNumber, String mrNumber, List contactPersonWorkOrders, Lookup calllastSituation, Lookup currentSituation, Lookup repairLocation, Lookup reason, String startofWorkTime, String endofWorkTime, num workingHours, num travelingHours, num travelingExpenses, FaultDescription faultDescription, List sparePartsWorkOrders, String reviewComment, String comment, List attachmentsWorkOrder, Lookup equipmentStatus, List suppEngineerWorkOrders, String engSignature, String nurseSignature, WoParent woParentDto, Lookup loanAvailablity, AssetInfo assetLoan, }) => ServiceReport( id: id ?? this.id, parentWOId: parentWOId ?? this.parentWOId, workOrderNo: workOrderNo ?? this.workOrderNo, workOrderYear: workOrderYear ?? this.workOrderYear, workOrderSequennce: workOrderSequennce ?? this.workOrderSequennce, callRequest: callRequest ?? this.callRequest, assetType: assetType ?? this.assetType, assignedEmployee: assignedEmployee ?? this.assignedEmployee, visitDate: visitDate ?? this.visitDate, assistantEmployees: assistantEmployees ?? this.assistantEmployees, supplier: supplier ?? this.supplier, vendorTicketNumber: vendorTicketNumber ?? this.vendorTicketNumber, mrNumber: mrNumber ?? this.mrNumber, contactPersonWorkOrders: contactPersonWorkOrders ?? this.contactPersonWorkOrders, calllastSituation: calllastSituation ?? this.calllastSituation, currentSituation: currentSituation ?? this.currentSituation, repairLocation: repairLocation ?? this.repairLocation, reason: reason ?? this.reason, startofWorkTime: startofWorkTime ?? this.startofWorkTime, endofWorkTime: endofWorkTime ?? this.endofWorkTime, workingHours: workingHours ?? this.workingHours, travelingHours: travelingHours ?? this.travelingHours, travelingExpenses: travelingExpenses ?? this.travelingExpenses, faultDescription: faultDescription ?? this.faultDescription, sparePartsWorkOrders: sparePartsWorkOrders ?? this.sparePartsWorkOrders, reviewComment: reviewComment ?? this.reviewComment, comment: comment ?? this.comment, attachmentsWorkOrder: attachmentsWorkOrder ?? this.attachmentsWorkOrder, equipmentStatus: equipmentStatus ?? this.equipmentStatus, suppEngineerWorkOrders: suppEngineerWorkOrders ?? this.suppEngineerWorkOrders, engSignature: engSignature ?? this.engSignature, nurseSignature: nurseSignature ?? this.nurseSignature, woParentDto: woParentDto ?? this.woParentDto, loanAvailablity: loanAvailablity ?? this.loanAvailablity, assetLoan: assetLoan ?? this.assetLoan, ); Map toJson() { final map = {}; map['id'] = id ?? 0; map['parentWOId'] = parentWOId; map['workOrderNo'] = workOrderNo; map['workOrderYear'] = workOrderYear; map['workOrderSequennce'] = workOrderSequennce; if (callRequest != null) { map['callRequest'] = callRequest.toJson(); } if (assetType != null) { map['assetType'] = assetType.toJson(); } if (assignedEmployee != null) { map['assignedEmployee'] = assignedEmployee.toJson(); } map['visitDate'] = visitDate; if (assistantEmployees != null) { map['assistantEmployees'] = assistantEmployees.map((v) => v.toJson()).toList(); } if (supplier != null) { map['supplier'] = supplier.toJson(); } map['vendorTicketNumber'] = vendorTicketNumber; map['mrNumber'] = mrNumber; if (contactPersonWorkOrders != null) { map['contactPersonWorkOrders'] = contactPersonWorkOrders.map((v) => v.toJson()).toList(); } if (calllastSituation != null) { map['calllastSituation'] = calllastSituation.toJson(); } if (currentSituation != null) { map['currentSituation'] = currentSituation.toJson(); } if (repairLocation != null) { map['repairLocation'] = repairLocation.toJson(); } if (reason != null) { map['reason'] = reason.toJson(); } map['startofWorkTime'] = startofWorkTime; map['endofWorkTime'] = endofWorkTime; map['workingHours'] = workingHours; map['travelingHours'] = travelingHours; map['travelingExpenses'] = travelingExpenses; if (faultDescription != null) { map['faultDescription'] = faultDescription.toJson(); } if (sparePartsWorkOrders != null) { map['sparePartsWorkOrders'] = sparePartsWorkOrders.map((v) => v.toJson()).toList(); } map['reviewComment'] = reviewComment; map['comment'] = comment; if (attachmentsWorkOrder != null) { map['attachmentsWorkOrder'] = attachmentsWorkOrder.map((v) => v.toJson()).toList(); } if (equipmentStatus != null) { map['equipmentStatus'] = equipmentStatus.toJson(); } if (suppEngineerWorkOrders != null) { map['suppEngineerWorkOrders'] = suppEngineerWorkOrders.map((v) => v.toJson()).toList(); } map['engSignature'] = engSignature; map['nurseSignature'] = nurseSignature; if (woParentDto != null) { map['woParentDto'] = woParentDto.toJson(); } if (loanAvailablity != null) { map['loanAvailablity'] = loanAvailablity.toJson(); } if (assetLoan != null) { map['assetLoan'] = assetLoan.toJson(); } return map; } Future validate() async { return true; } }