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/demo_form_model.dart

158 lines
4.5 KiB
Dart

import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/new_models/building.dart';
import 'package:test_sa/models/new_models/department.dart';
import 'package:test_sa/models/new_models/floor.dart';
import 'package:test_sa/models/new_models/site.dart';
import 'package:test_sa/modules/loan_module/models/medical_department_model.dart';
class DemoFormModel {
String? docName;
String? docNumber;
String? docEmail;
String? itemDescription;
String? requestDescription;
String? model;
String? manufacturer;
Lookup? loanProvided;
String? vendorName;
String? vendorRepresentativeName;
String? vendorNumber;
String? vendorEmail;
Site? site;
MedicalDepartmentModel? department;
List<DemoAttachments>? demoAttachment;
DemoFormModel({
this.docName,
this.docNumber,
this.docEmail,
this.itemDescription,
this.requestDescription,
this.model,
this.manufacturer,
this.loanProvided,
this.vendorName,
this.vendorRepresentativeName,
this.vendorNumber,
this.vendorEmail,
this.demoAttachment,
this.site,
this.department,
});
//{
// "id": 0,
// "employeeId": "fa29a9de-1337-4729-b823-68c6ecffdd33",
// "requestorUserID": "fa29a9de-1337-4729-b823-68c6ecffdd33",
// "employeeName": "engineer-dev",
// "employeeEmail": "Engineer_Dev@yahoo.com",
// "positionName": "High",
// "requesterExtensionNumber": "7726",
// "requesterContactNumber": "72132197",
// "siteId": 1,
// "departmentId": 5,
// "loanTypeId": 6448,
// "doctorName": "Doctor A",
// "doctorContact": "0561432451",
// "doctorEmail": "doctor@test.com",
// "itemDescription": "Test item",
// "requestDescription": "Test request",
// "loanPeriodId": 6453,
// "assetId": null,
// "assetNumber": "",
// "assetName": "",
// "assetSerialNumber": "",
// "model": "Model A",
// "manufacturer": "Siemens",
// "vendorName": "Vendor A",
// "vendorRepName": "Vendor Rep A",
// "vendorContact": "0561432455",
// "vendorEmail": "vendor@test.com",
// "loanStatusId": 1,
// "loanAttachments": [],
// "submittedAt": "2025-11-13T12:11:12.673Z",
// "updatedAt": null,
// "cMWOItemId": null
// }
Map<String, dynamic> toJson() {
var abc = {
"id": 0,
"siteId": 0,
"buildingId": 0,
"floorId": 0,
"departmentId": 0,
"assetName": "string",
"model": "string",
"manufacturer": "string",
"doctorName": "string",
"doctorContactNumber": "string",
"doctorContactEmail": "string",
"itemDescription": "string",
"requestDescription": "string",
"demoPeriodId": 0,
"supplierId": 0,
"suppPersonId": 0,
"isSubmit": true,
"demoAttachments": [
{
"id": 0,
"attachmentName": "string",
"originalName": "string",
"demoRequestId": 0,
"attachmentTypeId": 0
}
]
};
return {
"doctorName": docName,
"doctorContact": docNumber,
"doctorEmail": docEmail,
"itemDescription": itemDescription,
"requestDescription": requestDescription,
"model": model,
"manufacturer": manufacturer,
"demoPeriodId": loanProvided?.id,
"vendorName": vendorName,
"vendorRepresentativeName": vendorRepresentativeName,
"vendorRepName": vendorRepresentativeName,
"vendorNumber": vendorNumber,
"vendorContact": vendorNumber,
"vendorEmail": vendorEmail,
'siteId': site?.id,
'departmentId': department?.id,
"demoAttachments": demoAttachment != null ? demoAttachment!.map((v) => v.toJson()).toList() : [],
};
}
}
class DemoAttachments {
num? id;
num? demoRequestId;
num? attachmentTypeId;
String? attachmentName;
String? originalName;
DemoAttachments({this.id, this.attachmentTypeId, this.attachmentName, this.demoRequestId, this.originalName});
DemoAttachments.fromJson(dynamic json) {
id = json['id'];
attachmentTypeId = json['attachmentTypeId'];
demoRequestId = json['demoRequestId'];
attachmentName = json['attachmentName'];
originalName = json['originalName'];
}
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['attachmentTypeId'] = attachmentTypeId;
map['attachmentName'] = attachmentName;
map['demoRequestId'] = demoRequestId;
map['originalName'] = originalName;
return map;
}
}