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.
cloudsolutions-atoms/lib/modules/demo_module/models/demo_form_model.dart

130 lines
4.0 KiB
Dart

10 months ago
import 'package:test_sa/models/lookup.dart';
9 months ago
import 'package:test_sa/models/new_models/building.dart';
import 'package:test_sa/models/new_models/floor.dart';
import 'package:test_sa/models/new_models/room_model.dart';
10 months ago
import 'package:test_sa/models/new_models/site.dart';
10 months ago
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/modules/demo_module/models/demo_attachment_model.dart';
10 months ago
import 'package:test_sa/modules/loan_module/models/medical_department_model.dart';
9 months ago
import '../../../models/new_models/department.dart';
10 months ago
class DemoFormModel {
String? docName;
10 months ago
int? id;
10 months ago
String? docNumber;
String? docEmail;
String? itemDescription;
String? requestDescription;
String? model;
10 months ago
String? assetName;
10 months ago
String? manufacturer;
10 months ago
Lookup? demoPeriod;
10 months ago
String? vendorRepresentativeName;
String? vendorName;
String? vendorContactNumber;
10 months ago
String? vendorEmail;
Site? site;
9 months ago
Building? building; // Now nullable
Floor? floor; // Now nullable
Department? department; // Now nullable
Rooms? room;
10 months ago
SuppEngineerWorkOrders? supEngineer;
SupplierDetails? vendor;
10 months ago
List<DemoAttachments>? demoAttachment;
bool demoEaluationAcknowledge;
bool acknowledgeNotEquipment;
10 months ago
DemoFormModel({
10 months ago
this.id,
10 months ago
this.docName,
this.docNumber,
this.docEmail,
this.itemDescription,
this.requestDescription,
this.model,
10 months ago
this.assetName,
10 months ago
this.manufacturer,
10 months ago
this.demoPeriod,
10 months ago
this.vendorRepresentativeName,
this.vendorName,
this.vendorContactNumber,
10 months ago
this.vendorEmail,
this.demoAttachment,
this.site,
10 months ago
this.vendor,
this.supEngineer,
10 months ago
this.department,
this.demoEaluationAcknowledge = false,
this.acknowledgeNotEquipment = false,
10 months ago
});
Map<String, dynamic> toJson() {
return {
9 months ago
"id": id ?? 0,
10 months ago
'siteId': site?.id,
'departmentId': department?.id,
9 months ago
"buildingId": building?.id,
"floorId": floor?.id,
10 months ago
"assetName": assetName,
"isSubmit": true,
10 months ago
"doctorName": docName,
10 months ago
"doctorContactNumber": docNumber,
"doctorContactEmail": docEmail,
10 months ago
"itemDescription": itemDescription,
"requestDescription": requestDescription,
"model": model,
"vendorName": vendorName,
"vendorContactNumber": vendorContactNumber,
"vendorEmail": vendorEmail,
"vendorRepresentativeName": vendorRepresentativeName,
10 months ago
"manufacturer": manufacturer,
10 months ago
"demoPeriodId": demoPeriod?.id,
"supplierId": vendor?.id,
"suppPersonId": supEngineer?.id,
"demoEaluationAcknowledge": demoEaluationAcknowledge,
"acknowledgeNotEquipment": acknowledgeNotEquipment,
9 months ago
"demoAttachments":
// [
// {
// "id": 3,
// // "documentType": {
// // "id": 7748,
// // "name": "February",
// // "value": 2
// // },
// "documentTypeId": 7748,
// "attachmentName": "6c9f50b0-1c92-4ae9-ae64-7c284c61ea72.jpg",
// "originalName": "scaled_d245df97-1289-4d0c-92a0-569abedfb0db8154518103327960943.jpg",
// "demoRequestId": 3
// },
// {
// "id": 4,
// // "documentType": {
// // "id": 7748,
// // "name": "February",
// // "value": 2
// // },
// "documentTypeId": 7748,
// "attachmentName": "346e04f6-0f9b-4004-ad85-4cdbf8318f7c.jpg",
// "originalName": "scaled_85790b6c-7b16-46e6-891c-11c316d5897a2973693360957767376.jpg",
// "demoRequestId": 3
// }
// ]
9 months ago
demoAttachment != null ? demoAttachment!.map((v) => v.toJson()).toList() : [],
10 months ago
};
}
10 months ago
Map<String, dynamic> toUpdateJson() {
return {
"id": id,
"supplierId": vendor?.id,
"suppPersonId": supEngineer?.id,
"demoAttachments": demoAttachment != null ? demoAttachment!.map((v) => v.toJson()).toList() : [],
};
10 months ago
}
}