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.
141 lines
4.2 KiB
Dart
141 lines
4.2 KiB
Dart
import 'package:test_sa/models/lookup.dart';
|
|
import 'package:test_sa/models/new_models/mapped_sites.dart';
|
|
import 'package:test_sa/models/new_models/site.dart';
|
|
import 'package:test_sa/modules/loan_module/models/medical_department_model.dart';
|
|
|
|
class LoanFormModel {
|
|
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<LoanAttachments>? loanAttachment;
|
|
MappedSite? mappedSite;
|
|
MappedDepartment? mappedDepartment;
|
|
|
|
LoanFormModel({
|
|
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.loanAttachment,
|
|
this.site,
|
|
this.department,
|
|
this.mappedSite,
|
|
this.mappedDepartment,
|
|
});
|
|
|
|
//{
|
|
// "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() {
|
|
return {
|
|
"doctorName": docName,
|
|
"doctorContact": docNumber,
|
|
"doctorEmail": docEmail,
|
|
"itemDescription": itemDescription,
|
|
"requestDescription": requestDescription,
|
|
"model": model,
|
|
"manufacturer": manufacturer,
|
|
"loanPeriodId": loanProvided?.id,
|
|
"vendorName": vendorName,
|
|
"vendorRepresentativeName": vendorRepresentativeName,
|
|
"vendorRepName": vendorRepresentativeName,
|
|
"vendorNumber": vendorNumber,
|
|
"vendorContact": vendorNumber,
|
|
"vendorEmail": vendorEmail,
|
|
'siteId': site?.id,
|
|
'departmentId': department?.id,
|
|
"loanAttachments": loanAttachment != null ? loanAttachment!.map((v) => v.toJson()).toList() : [],
|
|
};
|
|
}
|
|
}
|
|
|
|
class LoanAttachments {
|
|
num? id;
|
|
num? loanAttachmentTypeId;
|
|
num? loanId;
|
|
String? attachmentName;
|
|
String? attachmentDescription;
|
|
|
|
LoanAttachments({this.id, this.loanAttachmentTypeId, this.attachmentName, this.loanId, this.attachmentDescription});
|
|
|
|
LoanAttachments.fromJson(dynamic json) {
|
|
id = json['id'];
|
|
loanAttachmentTypeId = json['loanAttachmentTypeId'];
|
|
loanId = json['loanId'];
|
|
attachmentName = json['attachmentName'];
|
|
attachmentDescription = json['attachmentDescription'];
|
|
}
|
|
|
|
// LoanAttachments copyWith({
|
|
// num? id, // Parameter is now nullable
|
|
// String? name, // Parameter is now nullable
|
|
// String? originalName, // Parameter is now nullable
|
|
// }) =>
|
|
// LoanAttachments(
|
|
// id: id ?? this.id,
|
|
// name: name ?? this.name,
|
|
// originalName: originalName ?? this.originalName,
|
|
// );
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final map = <String, dynamic>{};
|
|
map['id'] = id;
|
|
map['loanAttachmentTypeId'] = loanAttachmentTypeId;
|
|
map['attachmentName'] = attachmentName;
|
|
map['loanId'] = loanId;
|
|
map['attachmentDescription'] = attachmentDescription;
|
|
return map;
|
|
}
|
|
}
|