Change Asset & Asset Transfer models
parent
c8e3f2df48
commit
c7d6b68fd2
@ -0,0 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M12 2.8125V4.6875H10.125V2.8125H12ZM10.125 13.8281V16.5H12V13.8281H10.125ZM15.75 24V22.125H13.875V20.25H12V24H15.75ZM19.5 10.0781H13.875V11.9531H19.5V10.0781ZM19.5 13.8281H22.125V11.9531H19.5V13.8281ZM19.5 16.5V18.375H24V13.8281H22.125V16.5H19.5ZM13.875 0H12V2.8125H13.875V0ZM12 8.4375H13.875V4.6875H12V6.5625H10.125V11.9531H12V8.4375ZM0 10.0781V13.8281H1.875V11.9531H4.6875V10.0781H0ZM13.875 13.8281V11.9531H12V13.8281H13.875ZM17.625 15.7031H19.5V13.8281H17.625V15.7031ZM22.125 11.9531H24V10.0781H22.125V11.9531ZM15.75 13.8281H13.875V16.5H12V18.375H15.75V13.8281ZM10.125 20.25H12V18.375H10.125V20.25ZM15.75 18.375V20.25H19.5V18.375H15.75ZM21.375 22.125V20.25H19.5V22.125H21.375ZM24 24V22.125H21.375V24H24ZM17.625 24H19.5V22.125H17.625V24ZM8.4375 11.9531V10.0781H6.5625V11.9531H4.6875V13.8281H10.125V11.9531H8.4375ZM8.4375 8.4375H0V0H8.4375V8.4375ZM6.5625 1.875H1.875V6.5625H6.5625V1.875ZM5.15625 3.28125H3.28125V5.15625H5.15625V3.28125ZM24 0V8.4375H15.5625V0H24ZM22.125 1.875H17.4375V6.5625H22.125V1.875ZM20.7188 3.28125H18.8438V5.15625H20.7188V3.28125ZM0 15.5625H8.4375V24H0V15.5625ZM1.875 22.125H6.5625V17.4375H1.875V22.125ZM3.28125 20.7188H5.15625V18.8438H3.28125V20.7188Z" fill="#163A51"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1,411 @@
|
||||
import 'package:test_sa/models/asset/supplier.dart';
|
||||
import 'package:test_sa/models/asset/technical_guidance_book.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
import '../new_models/building.dart';
|
||||
import '../new_models/department.dart';
|
||||
import '../new_models/floor.dart';
|
||||
import '../new_models/site.dart';
|
||||
import 'model_definition.dart';
|
||||
|
||||
class Asset {
|
||||
Asset({
|
||||
this.id,
|
||||
this.assetSerialNo,
|
||||
this.systemID,
|
||||
this.assetNumber,
|
||||
this.modelDefinition,
|
||||
this.supplier,
|
||||
this.ipAddress,
|
||||
this.macAddress,
|
||||
this.portNumber,
|
||||
this.assetReplace,
|
||||
this.oldAsset,
|
||||
this.isParent,
|
||||
this.parentAsset,
|
||||
this.assetType,
|
||||
this.site,
|
||||
this.building,
|
||||
this.floor,
|
||||
this.department,
|
||||
this.room,
|
||||
this.testsDay,
|
||||
this.purchasingPrice,
|
||||
this.nbv,
|
||||
this.currency,
|
||||
this.poNo,
|
||||
this.invoiceNumber,
|
||||
this.invoiceDate,
|
||||
this.replacementDate,
|
||||
this.originDepartment,
|
||||
this.originSite,
|
||||
this.budgetYear,
|
||||
this.lastPOPrice,
|
||||
this.commissioningStatus,
|
||||
this.productionDate,
|
||||
this.edd,
|
||||
this.technicalInspectionDate,
|
||||
this.deliveryInspectionDate,
|
||||
this.endUserAcceptanceDate,
|
||||
this.receivingCommittee,
|
||||
this.siteWarrantyMonths,
|
||||
this.extendedWarrantyMonths,
|
||||
this.remainderWarrantyMonths,
|
||||
this.eomWarrantyMonthsNo,
|
||||
this.warrantyValue,
|
||||
this.warrantyEndDate,
|
||||
this.warrantyContractConditions,
|
||||
this.technicalGuidanceBooks,
|
||||
this.comment,
|
||||
this.tagCode,
|
||||
});
|
||||
|
||||
Asset.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
assetSerialNo = json['assetSerialNo'];
|
||||
systemID = json['systemID'];
|
||||
assetNumber = json['assetNumber'];
|
||||
modelDefinition = json['modelDefinition'] != null ? ModelDefinition.fromJson(json['modelDefinition']) : null;
|
||||
supplier = json['supplier'] != null ? Supplier.fromJson(json['supplier']) : null;
|
||||
ipAddress = json['ipAddress'];
|
||||
macAddress = json['macAddress'];
|
||||
portNumber = json['portNumber'];
|
||||
assetReplace = json['assetReplace'] != null ? Lookup.fromJson(json['assetReplace']) : null;
|
||||
oldAsset = json['oldAsset'] != null ? AssetInfo.fromJson(json['oldAsset']) : null;
|
||||
isParent = json['isParent'] != null ? Lookup.fromJson(json['isParent']) : null;
|
||||
parentAsset = json['parentAsset'] != null ? AssetInfo.fromJson(json['parentAsset']) : null;
|
||||
assetType = json['assetType'] != null ? Lookup.fromJson(json['assetType']) : null;
|
||||
site = json['site'] != null ? Site.fromJson(json['site']) : null;
|
||||
building = json['building'] != null ? Building.fromJson(json['building']) : null;
|
||||
floor = json['floor'] != null ? Floor.fromJson(json['floor']) : null;
|
||||
department = json['department'] != null ? Department.fromJson(json['department']) : null;
|
||||
room = json['room'];
|
||||
testsDay = json['testsDay'];
|
||||
purchasingPrice = json['purchasingPrice'];
|
||||
nbv = json['nbv'];
|
||||
currency = json['currency'] != null ? Lookup.fromJson(json['currency']) : null;
|
||||
poNo = json['poNo'];
|
||||
invoiceNumber = json['invoiceNumber'];
|
||||
invoiceDate = json['invoiceDate'];
|
||||
replacementDate = json['replacementDate'];
|
||||
originDepartment = json['originDepartment'] != null ? Department.fromJson(json['originDepartment']) : null;
|
||||
originSite = json['originSite'] != null ? Site.fromJson(json['originSite']) : null;
|
||||
budgetYear = json['budgetYear'];
|
||||
lastPOPrice = json['lastPOPrice'];
|
||||
commissioningStatus = json['commissioningStatus'] != null ? Lookup.fromJson(json['commissioningStatus']) : null;
|
||||
productionDate = json['productionDate'];
|
||||
edd = json['edd'];
|
||||
technicalInspectionDate = json['technicalInspectionDate'];
|
||||
deliveryInspectionDate = json['deliveryInspectionDate'];
|
||||
endUserAcceptanceDate = json['endUserAcceptanceDate'];
|
||||
receivingCommittee = json['receivingCommittee'];
|
||||
siteWarrantyMonths = json['siteWarrantyMonths'] != null ? Lookup.fromJson(json['siteWarrantyMonths']) : null;
|
||||
extendedWarrantyMonths = json['extendedWarrantyMonths'] != null ? Lookup.fromJson(json['extendedWarrantyMonths']) : null;
|
||||
remainderWarrantyMonths = json['remainderWarrantyMonths'] != null ? Lookup.fromJson(json['remainderWarrantyMonths']) : null;
|
||||
eomWarrantyMonthsNo = json['eomWarrantyMonthsNo'];
|
||||
warrantyValue = json['warrantyValue'];
|
||||
warrantyEndDate = json['warrantyEndDate'];
|
||||
warrantyContractConditions = json['warrantyContractConditions'];
|
||||
if (json['technicalGuidanceBooks'] != null) {
|
||||
technicalGuidanceBooks = [];
|
||||
json['technicalGuidanceBooks'].forEach((v) {
|
||||
technicalGuidanceBooks.add(TechnicalGuidanceBook.fromJson(v));
|
||||
});
|
||||
}
|
||||
comment = json['comment'];
|
||||
tagCode = json['tagCode'];
|
||||
}
|
||||
num id;
|
||||
String assetSerialNo;
|
||||
String systemID;
|
||||
String assetNumber;
|
||||
ModelDefinition modelDefinition;
|
||||
Supplier supplier;
|
||||
String ipAddress;
|
||||
String macAddress;
|
||||
String portNumber;
|
||||
Lookup assetReplace;
|
||||
AssetInfo oldAsset;
|
||||
Lookup isParent;
|
||||
AssetInfo parentAsset;
|
||||
Lookup assetType;
|
||||
Site site;
|
||||
Building building;
|
||||
Floor floor;
|
||||
Department department;
|
||||
String room;
|
||||
num testsDay;
|
||||
num purchasingPrice;
|
||||
String nbv;
|
||||
Lookup currency;
|
||||
String poNo;
|
||||
String invoiceNumber;
|
||||
String invoiceDate;
|
||||
String replacementDate;
|
||||
Department originDepartment;
|
||||
Site originSite;
|
||||
num budgetYear;
|
||||
num lastPOPrice;
|
||||
Lookup commissioningStatus;
|
||||
String productionDate;
|
||||
String edd;
|
||||
String technicalInspectionDate;
|
||||
String deliveryInspectionDate;
|
||||
String endUserAcceptanceDate;
|
||||
String receivingCommittee;
|
||||
Lookup siteWarrantyMonths;
|
||||
Lookup extendedWarrantyMonths;
|
||||
Lookup remainderWarrantyMonths;
|
||||
num eomWarrantyMonthsNo;
|
||||
num warrantyValue;
|
||||
String warrantyEndDate;
|
||||
String warrantyContractConditions;
|
||||
List<TechnicalGuidanceBook> technicalGuidanceBooks;
|
||||
String comment;
|
||||
String tagCode;
|
||||
Asset copyWith({
|
||||
num id,
|
||||
String assetSerialNo,
|
||||
String systemID,
|
||||
String assetNumber,
|
||||
ModelDefinition modelDefinition,
|
||||
Supplier supplier,
|
||||
String ipAddress,
|
||||
String macAddress,
|
||||
String portNumber,
|
||||
Lookup assetReplace,
|
||||
AssetInfo oldAsset,
|
||||
Lookup isParent,
|
||||
AssetInfo parentAsset,
|
||||
Lookup assetType,
|
||||
Site site,
|
||||
Building building,
|
||||
Floor floor,
|
||||
Department department,
|
||||
String room,
|
||||
num testsDay,
|
||||
num purchasingPrice,
|
||||
String nbv,
|
||||
Lookup currency,
|
||||
String poNo,
|
||||
String invoiceNumber,
|
||||
String invoiceDate,
|
||||
String replacementDate,
|
||||
Department originDepartment,
|
||||
Site originSite,
|
||||
num budgetYear,
|
||||
num lastPOPrice,
|
||||
Lookup commissioningStatus,
|
||||
String productionDate,
|
||||
String edd,
|
||||
String technicalInspectionDate,
|
||||
String deliveryInspectionDate,
|
||||
String endUserAcceptanceDate,
|
||||
String receivingCommittee,
|
||||
Lookup siteWarrantyMonths,
|
||||
Lookup extendedWarrantyMonths,
|
||||
Lookup remainderWarrantyMonths,
|
||||
num eomWarrantyMonthsNo,
|
||||
num warrantyValue,
|
||||
String warrantyEndDate,
|
||||
String warrantyContractConditions,
|
||||
List<TechnicalGuidanceBook> technicalGuidanceBooks,
|
||||
String comment,
|
||||
String tagCode,
|
||||
}) =>
|
||||
Asset(
|
||||
id: id ?? this.id,
|
||||
assetSerialNo: assetSerialNo ?? this.assetSerialNo,
|
||||
systemID: systemID ?? this.systemID,
|
||||
assetNumber: assetNumber ?? this.assetNumber,
|
||||
modelDefinition: modelDefinition ?? this.modelDefinition,
|
||||
supplier: supplier ?? this.supplier,
|
||||
ipAddress: ipAddress ?? this.ipAddress,
|
||||
macAddress: macAddress ?? this.macAddress,
|
||||
portNumber: portNumber ?? this.portNumber,
|
||||
assetReplace: assetReplace ?? this.assetReplace,
|
||||
oldAsset: oldAsset ?? this.oldAsset,
|
||||
isParent: isParent ?? this.isParent,
|
||||
parentAsset: parentAsset ?? this.parentAsset,
|
||||
assetType: assetType ?? this.assetType,
|
||||
site: site ?? this.site,
|
||||
building: building ?? this.building,
|
||||
floor: floor ?? this.floor,
|
||||
department: department ?? this.department,
|
||||
room: room ?? this.room,
|
||||
testsDay: testsDay ?? this.testsDay,
|
||||
purchasingPrice: purchasingPrice ?? this.purchasingPrice,
|
||||
nbv: nbv ?? this.nbv,
|
||||
currency: currency ?? this.currency,
|
||||
poNo: poNo ?? this.poNo,
|
||||
invoiceNumber: invoiceNumber ?? this.invoiceNumber,
|
||||
invoiceDate: invoiceDate ?? this.invoiceDate,
|
||||
replacementDate: replacementDate ?? this.replacementDate,
|
||||
originDepartment: originDepartment ?? this.originDepartment,
|
||||
originSite: originSite ?? this.originSite,
|
||||
budgetYear: budgetYear ?? this.budgetYear,
|
||||
lastPOPrice: lastPOPrice ?? this.lastPOPrice,
|
||||
commissioningStatus: commissioningStatus ?? this.commissioningStatus,
|
||||
productionDate: productionDate ?? this.productionDate,
|
||||
edd: edd ?? this.edd,
|
||||
technicalInspectionDate: technicalInspectionDate ?? this.technicalInspectionDate,
|
||||
deliveryInspectionDate: deliveryInspectionDate ?? this.deliveryInspectionDate,
|
||||
endUserAcceptanceDate: endUserAcceptanceDate ?? this.endUserAcceptanceDate,
|
||||
receivingCommittee: receivingCommittee ?? this.receivingCommittee,
|
||||
siteWarrantyMonths: siteWarrantyMonths ?? this.siteWarrantyMonths,
|
||||
extendedWarrantyMonths: extendedWarrantyMonths ?? this.extendedWarrantyMonths,
|
||||
remainderWarrantyMonths: remainderWarrantyMonths ?? this.remainderWarrantyMonths,
|
||||
eomWarrantyMonthsNo: eomWarrantyMonthsNo ?? this.eomWarrantyMonthsNo,
|
||||
warrantyValue: warrantyValue ?? this.warrantyValue,
|
||||
warrantyEndDate: warrantyEndDate ?? this.warrantyEndDate,
|
||||
warrantyContractConditions: warrantyContractConditions ?? this.warrantyContractConditions,
|
||||
technicalGuidanceBooks: technicalGuidanceBooks ?? this.technicalGuidanceBooks,
|
||||
comment: comment ?? this.comment,
|
||||
tagCode: tagCode ?? this.tagCode,
|
||||
);
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['id'] = id;
|
||||
map['assetSerialNo'] = assetSerialNo;
|
||||
map['systemID'] = systemID;
|
||||
map['assetNumber'] = assetNumber;
|
||||
if (modelDefinition != null) {
|
||||
map['modelDefinition'] = modelDefinition.toJson();
|
||||
}
|
||||
if (supplier != null) {
|
||||
map['supplier'] = supplier.toJson();
|
||||
}
|
||||
map['ipAddress'] = ipAddress;
|
||||
map['macAddress'] = macAddress;
|
||||
map['portNumber'] = portNumber;
|
||||
if (assetReplace != null) {
|
||||
map['assetReplace'] = assetReplace.toJson();
|
||||
}
|
||||
if (oldAsset != null) {
|
||||
map['oldAsset'] = oldAsset.toJson();
|
||||
}
|
||||
if (isParent != null) {
|
||||
map['isParent'] = isParent.toJson();
|
||||
}
|
||||
if (parentAsset != null) {
|
||||
map['parentAsset'] = parentAsset.toJson();
|
||||
}
|
||||
if (assetType != null) {
|
||||
map['assetType'] = assetType.toJson();
|
||||
}
|
||||
if (site != null) {
|
||||
map['site'] = site.toJson();
|
||||
}
|
||||
if (building != null) {
|
||||
map['building'] = building.toJson();
|
||||
}
|
||||
if (floor != null) {
|
||||
map['floor'] = floor.toJson();
|
||||
}
|
||||
if (department != null) {
|
||||
map['department'] = department.toJson();
|
||||
}
|
||||
map['room'] = room;
|
||||
map['testsDay'] = testsDay;
|
||||
map['purchasingPrice'] = purchasingPrice;
|
||||
map['nbv'] = nbv;
|
||||
if (currency != null) {
|
||||
map['currency'] = currency.toJson();
|
||||
}
|
||||
map['poNo'] = poNo;
|
||||
map['invoiceNumber'] = invoiceNumber;
|
||||
map['invoiceDate'] = invoiceDate;
|
||||
map['replacementDate'] = replacementDate;
|
||||
if (originDepartment != null) {
|
||||
map['originDepartment'] = originDepartment.toJson();
|
||||
}
|
||||
if (originSite != null) {
|
||||
map['originSite'] = originSite.toJson();
|
||||
}
|
||||
map['budgetYear'] = budgetYear;
|
||||
map['lastPOPrice'] = lastPOPrice;
|
||||
if (commissioningStatus != null) {
|
||||
map['commissioningStatus'] = commissioningStatus.toJson();
|
||||
}
|
||||
map['productionDate'] = productionDate;
|
||||
map['edd'] = edd;
|
||||
map['technicalInspectionDate'] = technicalInspectionDate;
|
||||
map['deliveryInspectionDate'] = deliveryInspectionDate;
|
||||
map['endUserAcceptanceDate'] = endUserAcceptanceDate;
|
||||
map['receivingCommittee'] = receivingCommittee;
|
||||
if (siteWarrantyMonths != null) {
|
||||
map['siteWarrantyMonths'] = siteWarrantyMonths.toJson();
|
||||
}
|
||||
if (extendedWarrantyMonths != null) {
|
||||
map['extendedWarrantyMonths'] = extendedWarrantyMonths.toJson();
|
||||
}
|
||||
if (remainderWarrantyMonths != null) {
|
||||
map['remainderWarrantyMonths'] = remainderWarrantyMonths.toJson();
|
||||
}
|
||||
map['eomWarrantyMonthsNo'] = eomWarrantyMonthsNo;
|
||||
map['warrantyValue'] = warrantyValue;
|
||||
map['warrantyEndDate'] = warrantyEndDate;
|
||||
map['warrantyContractConditions'] = warrantyContractConditions;
|
||||
if (technicalGuidanceBooks != null) {
|
||||
map['technicalGuidanceBooks'] = technicalGuidanceBooks.map((v) => v.toJson()).toList();
|
||||
}
|
||||
map['comment'] = comment;
|
||||
map['tagCode'] = tagCode;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
class AssetInfo {
|
||||
AssetInfo({
|
||||
this.id,
|
||||
this.assetSerialNo,
|
||||
this.assetNumber,
|
||||
this.tagCode,
|
||||
this.systemId,
|
||||
this.assetName,
|
||||
});
|
||||
|
||||
AssetInfo.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
assetSerialNo = json['assetSerialNo'];
|
||||
assetNumber = json['assetNumber'];
|
||||
tagCode = json['tagCode'];
|
||||
systemId = json['systemId'];
|
||||
assetName = json['assetName'];
|
||||
}
|
||||
|
||||
num id;
|
||||
String assetSerialNo;
|
||||
String assetNumber;
|
||||
String tagCode;
|
||||
String systemId;
|
||||
String assetName;
|
||||
|
||||
AssetInfo copyWith({
|
||||
num id,
|
||||
String assetSerialNo,
|
||||
String assetNumber,
|
||||
String tagCode,
|
||||
String systemId,
|
||||
String assetName,
|
||||
}) =>
|
||||
AssetInfo(
|
||||
id: id ?? this.id,
|
||||
assetSerialNo: assetSerialNo ?? this.assetSerialNo,
|
||||
assetNumber: assetNumber ?? this.assetNumber,
|
||||
tagCode: tagCode ?? this.tagCode,
|
||||
systemId: systemId ?? this.systemId,
|
||||
assetName: assetName ?? this.assetName,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['id'] = id;
|
||||
map['assetSerialNo'] = assetSerialNo;
|
||||
map['assetNumber'] = assetNumber;
|
||||
map['tagCode'] = tagCode;
|
||||
map['systemId'] = systemId;
|
||||
map['assetName'] = assetName;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,223 @@
|
||||
import 'asset_transfer_attachment.dart';
|
||||
|
||||
class AssetTransfer {
|
||||
AssetTransfer({
|
||||
this.id,
|
||||
this.transferNo,
|
||||
this.transferCode,
|
||||
this.assetId,
|
||||
this.destSiteId,
|
||||
this.destBuildingId,
|
||||
this.destFloorId,
|
||||
this.destDepartmentId,
|
||||
this.destRoom,
|
||||
this.senderSiteId,
|
||||
this.senderBuildingId,
|
||||
this.senderFloorId,
|
||||
this.senderDepartmentId,
|
||||
this.senderRoom,
|
||||
this.senderAssignedEmployeeId,
|
||||
this.senderMachineStatusId,
|
||||
this.senderComment,
|
||||
this.senderStartDate,
|
||||
this.senderEndDate,
|
||||
this.senderWorkingHours,
|
||||
this.senderTravelingHours,
|
||||
this.senderEngSignature,
|
||||
this.senderAttachments,
|
||||
this.receiverAssignedEmployeeId,
|
||||
this.receiverMachineStatusId,
|
||||
this.receiverComment,
|
||||
this.receiverStartDate,
|
||||
this.receiverEndDate,
|
||||
this.receiverWorkingHours,
|
||||
this.receiverTravelingHours,
|
||||
this.receiverEngSignature,
|
||||
this.receiverAttachments,
|
||||
});
|
||||
|
||||
AssetTransfer.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
transferNo = json['transferNo'];
|
||||
transferCode = json['transferCode'];
|
||||
assetId = json['assetId'];
|
||||
destSiteId = json['destSiteId'];
|
||||
destBuildingId = json['destBuildingId'];
|
||||
destFloorId = json['destFloorId'];
|
||||
destDepartmentId = json['destDepartmentId'];
|
||||
destRoom = json['destRoom'];
|
||||
senderSiteId = json['senderSiteId'];
|
||||
senderBuildingId = json['senderBuildingId'];
|
||||
senderFloorId = json['senderFloorId'];
|
||||
senderDepartmentId = json['senderDepartmentId'];
|
||||
senderRoom = json['senderRoom'];
|
||||
senderAssignedEmployeeId = json['senderAssignedEmployeeId'];
|
||||
senderMachineStatusId = json['senderMachineStatusId'];
|
||||
senderComment = json['senderComment'];
|
||||
senderStartDate = json['senderStartDate'];
|
||||
senderEndDate = json['senderEndDate'];
|
||||
senderWorkingHours = json['senderWorkingHours'];
|
||||
senderTravelingHours = json['senderTravelingHours'];
|
||||
senderEngSignature = json['senderEngSignature'];
|
||||
if (json['senderAttachments'] != null) {
|
||||
senderAttachments = [];
|
||||
json['senderAttachments'].forEach((v) {
|
||||
senderAttachments.add(AssetTransferAttachment.fromJson(v));
|
||||
});
|
||||
}
|
||||
receiverAssignedEmployeeId = json['receiverAssignedEmployeeId'];
|
||||
receiverMachineStatusId = json['receiverMachineStatusId'];
|
||||
receiverComment = json['receiverComment'];
|
||||
receiverStartDate = json['receiverStartDate'];
|
||||
receiverEndDate = json['receiverEndDate'];
|
||||
receiverWorkingHours = json['receiverWorkingHours'];
|
||||
receiverTravelingHours = json['receiverTravelingHours'];
|
||||
receiverEngSignature = json['receiverEngSignature'];
|
||||
if (json['receiverAttachments'] != null) {
|
||||
receiverAttachments = [];
|
||||
json['receiverAttachments'].forEach((v) {
|
||||
receiverAttachments.add(AssetTransferAttachment.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
num id;
|
||||
num transferNo;
|
||||
String transferCode;
|
||||
num assetId;
|
||||
num destSiteId;
|
||||
num destBuildingId;
|
||||
num destFloorId;
|
||||
num destDepartmentId;
|
||||
String destRoom;
|
||||
num senderSiteId;
|
||||
num senderBuildingId;
|
||||
num senderFloorId;
|
||||
num senderDepartmentId;
|
||||
String senderRoom;
|
||||
String senderAssignedEmployeeId;
|
||||
num senderMachineStatusId;
|
||||
String senderComment;
|
||||
String senderStartDate;
|
||||
String senderEndDate;
|
||||
String senderWorkingHours;
|
||||
String senderTravelingHours;
|
||||
String senderEngSignature;
|
||||
List<AssetTransferAttachment> senderAttachments;
|
||||
String receiverAssignedEmployeeId;
|
||||
num receiverMachineStatusId;
|
||||
String receiverComment;
|
||||
String receiverStartDate;
|
||||
String receiverEndDate;
|
||||
String receiverWorkingHours;
|
||||
String receiverTravelingHours;
|
||||
String receiverEngSignature;
|
||||
List<AssetTransferAttachment> receiverAttachments;
|
||||
AssetTransfer copyWith({
|
||||
num id,
|
||||
num transferNo,
|
||||
String transferCode,
|
||||
num assetId,
|
||||
num destSiteId,
|
||||
num destBuildingId,
|
||||
num destFloorId,
|
||||
num destDepartmentId,
|
||||
String destRoom,
|
||||
num senderSiteId,
|
||||
num senderBuildingId,
|
||||
num senderFloorId,
|
||||
num senderDepartmentId,
|
||||
String senderRoom,
|
||||
String senderAssignedEmployeeId,
|
||||
num senderMachineStatusId,
|
||||
String senderComment,
|
||||
String senderStartDate,
|
||||
String senderEndDate,
|
||||
String senderWorkingHours,
|
||||
String senderTravelingHours,
|
||||
String senderEngSignature,
|
||||
List<AssetTransferAttachment> senderAttachments,
|
||||
String receiverAssignedEmployeeId,
|
||||
num receiverMachineStatusId,
|
||||
String receiverComment,
|
||||
String receiverStartDate,
|
||||
String receiverEndDate,
|
||||
String receiverWorkingHours,
|
||||
String receiverTravelingHours,
|
||||
String receiverEngSignature,
|
||||
List<AssetTransferAttachment> receiverAttachments,
|
||||
}) =>
|
||||
AssetTransfer(
|
||||
id: id ?? this.id,
|
||||
transferNo: transferNo ?? this.transferNo,
|
||||
transferCode: transferCode ?? this.transferCode,
|
||||
assetId: assetId ?? this.assetId,
|
||||
destSiteId: destSiteId ?? this.destSiteId,
|
||||
destBuildingId: destBuildingId ?? this.destBuildingId,
|
||||
destFloorId: destFloorId ?? this.destFloorId,
|
||||
destDepartmentId: destDepartmentId ?? this.destDepartmentId,
|
||||
destRoom: destRoom ?? this.destRoom,
|
||||
senderSiteId: senderSiteId ?? this.senderSiteId,
|
||||
senderBuildingId: senderBuildingId ?? this.senderBuildingId,
|
||||
senderFloorId: senderFloorId ?? this.senderFloorId,
|
||||
senderDepartmentId: senderDepartmentId ?? this.senderDepartmentId,
|
||||
senderRoom: senderRoom ?? this.senderRoom,
|
||||
senderAssignedEmployeeId: senderAssignedEmployeeId ?? this.senderAssignedEmployeeId,
|
||||
senderMachineStatusId: senderMachineStatusId ?? this.senderMachineStatusId,
|
||||
senderComment: senderComment ?? this.senderComment,
|
||||
senderStartDate: senderStartDate ?? this.senderStartDate,
|
||||
senderEndDate: senderEndDate ?? this.senderEndDate,
|
||||
senderWorkingHours: senderWorkingHours ?? this.senderWorkingHours,
|
||||
senderTravelingHours: senderTravelingHours ?? this.senderTravelingHours,
|
||||
senderEngSignature: senderEngSignature ?? this.senderEngSignature,
|
||||
senderAttachments: senderAttachments ?? this.senderAttachments,
|
||||
receiverAssignedEmployeeId: receiverAssignedEmployeeId ?? this.receiverAssignedEmployeeId,
|
||||
receiverMachineStatusId: receiverMachineStatusId ?? this.receiverMachineStatusId,
|
||||
receiverComment: receiverComment ?? this.receiverComment,
|
||||
receiverStartDate: receiverStartDate ?? this.receiverStartDate,
|
||||
receiverEndDate: receiverEndDate ?? this.receiverEndDate,
|
||||
receiverWorkingHours: receiverWorkingHours ?? this.receiverWorkingHours,
|
||||
receiverTravelingHours: receiverTravelingHours ?? this.receiverTravelingHours,
|
||||
receiverEngSignature: receiverEngSignature ?? this.receiverEngSignature,
|
||||
receiverAttachments: receiverAttachments ?? this.receiverAttachments,
|
||||
);
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['id'] = id;
|
||||
map['transferNo'] = transferNo;
|
||||
map['transferCode'] = transferCode;
|
||||
map['assetId'] = assetId;
|
||||
map['destSiteId'] = destSiteId;
|
||||
map['destBuildingId'] = destBuildingId;
|
||||
map['destFloorId'] = destFloorId;
|
||||
map['destDepartmentId'] = destDepartmentId;
|
||||
map['destRoom'] = destRoom;
|
||||
map['senderSiteId'] = senderSiteId;
|
||||
map['senderBuildingId'] = senderBuildingId;
|
||||
map['senderFloorId'] = senderFloorId;
|
||||
map['senderDepartmentId'] = senderDepartmentId;
|
||||
map['senderRoom'] = senderRoom;
|
||||
map['senderAssignedEmployeeId'] = senderAssignedEmployeeId;
|
||||
map['senderMachineStatusId'] = senderMachineStatusId;
|
||||
map['senderComment'] = senderComment;
|
||||
map['senderStartDate'] = senderStartDate;
|
||||
map['senderEndDate'] = senderEndDate;
|
||||
map['senderWorkingHours'] = senderWorkingHours;
|
||||
map['senderTravelingHours'] = senderTravelingHours;
|
||||
map['senderEngSignature'] = senderEngSignature;
|
||||
if (senderAttachments != null) {
|
||||
map['senderAttachments'] = senderAttachments.map((v) => v.toJson()).toList();
|
||||
}
|
||||
map['receiverAssignedEmployeeId'] = receiverAssignedEmployeeId;
|
||||
map['receiverMachineStatusId'] = receiverMachineStatusId;
|
||||
map['receiverComment'] = receiverComment;
|
||||
map['receiverStartDate'] = receiverStartDate;
|
||||
map['receiverEndDate'] = receiverEndDate;
|
||||
map['receiverWorkingHours'] = receiverWorkingHours;
|
||||
map['receiverTravelingHours'] = receiverTravelingHours;
|
||||
map['receiverEngSignature'] = receiverEngSignature;
|
||||
if (receiverAttachments != null) {
|
||||
map['receiverAttachments'] = receiverAttachments.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
class AssetTransferAttachment {
|
||||
AssetTransferAttachment({
|
||||
this.id,
|
||||
this.attachmentName,
|
||||
});
|
||||
|
||||
AssetTransferAttachment.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
attachmentName = json['attachmentName'];
|
||||
}
|
||||
num id;
|
||||
String attachmentName;
|
||||
AssetTransferAttachment copyWith({
|
||||
num id,
|
||||
String attachmentName,
|
||||
}) =>
|
||||
AssetTransferAttachment(
|
||||
id: id ?? this.id,
|
||||
attachmentName: attachmentName ?? this.attachmentName,
|
||||
);
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['id'] = id;
|
||||
map['attachmentName'] = attachmentName;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
import 'asset.dart';
|
||||
import 'asset_transfer.dart';
|
||||
|
||||
class AssetTransferSearch extends AssetTransfer {
|
||||
Asset asset;
|
||||
int pageNumber = 10, pageSize;
|
||||
bool mostRecent;
|
||||
|
||||
Map<String, dynamic> toSearch() {
|
||||
final map = <String, dynamic>{};
|
||||
map['pageSize'] = pageSize;
|
||||
map['pageNumber'] = pageNumber;
|
||||
map['id'] = id;
|
||||
map['transferNo'] = transferNo;
|
||||
map['transferCode'] = transferCode;
|
||||
map['assetId'] = assetId;
|
||||
map['destSiteId'] = destSiteId;
|
||||
map['destBuildingId'] = destBuildingId;
|
||||
map['destFloorId'] = destFloorId;
|
||||
map['destDepartmentId'] = destDepartmentId;
|
||||
map['destRoom'] = destRoom;
|
||||
map['senderSiteId'] = senderSiteId;
|
||||
map['senderBuildingId'] = senderBuildingId;
|
||||
map['senderFloorId'] = senderFloorId;
|
||||
map['senderDepartmentId'] = senderDepartmentId;
|
||||
map['senderRoom'] = senderRoom;
|
||||
map['senderAssignedEmployeeId'] = senderAssignedEmployeeId;
|
||||
map['receiverAssignedEmployeeId'] = receiverAssignedEmployeeId;
|
||||
map['mostRecent'] = mostRecent;
|
||||
map['assetNumber'] = asset?.assetNumber;
|
||||
map['assetSerialNo'] = asset?.assetSerialNo;
|
||||
map['siteName'] = asset?.site?.custName;
|
||||
|
||||
/// TODO : the below parameters need to be discussed
|
||||
// map['relatedToEmployeeId'] = "";
|
||||
// map['assetGroup'] = {
|
||||
// "id": 1,
|
||||
// "name": "",
|
||||
// "code": "",
|
||||
// };
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,9 @@
|
||||
import 'package:test_sa/models/device/device.dart';
|
||||
|
||||
import '../hospital.dart';
|
||||
import 'asset.dart';
|
||||
|
||||
@Deprecated("Use asset_transfer_search.dart instead of this one")
|
||||
class DeviceTransferSearch {
|
||||
Device device;
|
||||
Asset device;
|
||||
String title, room;
|
||||
bool mostRecent;
|
||||
Hospital hospital;
|
||||
@ -1,3 +1,4 @@
|
||||
@Deprecated("Use the class inside model_definition.dart")
|
||||
class ModelDefinition {
|
||||
int id;
|
||||
String assetName;
|
||||
@ -0,0 +1,149 @@
|
||||
import 'package:test_sa/models/asset/supplier.dart';
|
||||
|
||||
class ModelDefinition {
|
||||
ModelDefinition({
|
||||
this.id,
|
||||
this.assetName,
|
||||
this.modelDefCode,
|
||||
this.modelName,
|
||||
this.manufacturerId,
|
||||
this.manufacturerName,
|
||||
this.supplierName,
|
||||
this.replacementDate,
|
||||
this.essentialEquipement,
|
||||
this.businessCritical,
|
||||
this.lifeSpan,
|
||||
this.modelDefRelatedDefects,
|
||||
this.suppliers,
|
||||
});
|
||||
|
||||
ModelDefinition.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
assetName = json['assetName'];
|
||||
modelDefCode = json['modelDefCode'];
|
||||
modelName = json['modelName'];
|
||||
manufacturerId = json['manufacturerId'];
|
||||
manufacturerName = json['manufacturerName'];
|
||||
supplierName = json['supplierName'];
|
||||
replacementDate = json['replacementDate'];
|
||||
essentialEquipement = json['essentialEquipement'];
|
||||
businessCritical = json['businessCritical'];
|
||||
lifeSpan = json['lifeSpan'];
|
||||
if (json['modelDefRelatedDefects'] != null) {
|
||||
modelDefRelatedDefects = [];
|
||||
json['modelDefRelatedDefects'].forEach((v) {
|
||||
modelDefRelatedDefects.add(ModelDefRelatedDefects.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['suppliers'] != null) {
|
||||
suppliers = [];
|
||||
json['suppliers'].forEach((v) {
|
||||
suppliers.add(Supplier.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
num id;
|
||||
String assetName;
|
||||
String modelDefCode;
|
||||
String modelName;
|
||||
num manufacturerId;
|
||||
String manufacturerName;
|
||||
dynamic supplierName;
|
||||
String replacementDate;
|
||||
String essentialEquipement;
|
||||
String businessCritical;
|
||||
num lifeSpan;
|
||||
List<ModelDefRelatedDefects> modelDefRelatedDefects;
|
||||
List<Supplier> suppliers;
|
||||
ModelDefinition copyWith({
|
||||
num id,
|
||||
String assetName,
|
||||
String modelDefCode,
|
||||
String modelName,
|
||||
num manufacturerId,
|
||||
String manufacturerName,
|
||||
dynamic supplierName,
|
||||
String replacementDate,
|
||||
String essentialEquipement,
|
||||
String businessCritical,
|
||||
num lifeSpan,
|
||||
List<ModelDefRelatedDefects> modelDefRelatedDefects,
|
||||
List<Supplier> suppliers,
|
||||
}) =>
|
||||
ModelDefinition(
|
||||
id: id ?? this.id,
|
||||
assetName: assetName ?? this.assetName,
|
||||
modelDefCode: modelDefCode ?? this.modelDefCode,
|
||||
modelName: modelName ?? this.modelName,
|
||||
manufacturerId: manufacturerId ?? this.manufacturerId,
|
||||
manufacturerName: manufacturerName ?? this.manufacturerName,
|
||||
supplierName: supplierName ?? this.supplierName,
|
||||
replacementDate: replacementDate ?? this.replacementDate,
|
||||
essentialEquipement: essentialEquipement ?? this.essentialEquipement,
|
||||
businessCritical: businessCritical ?? this.businessCritical,
|
||||
lifeSpan: lifeSpan ?? this.lifeSpan,
|
||||
modelDefRelatedDefects: modelDefRelatedDefects ?? this.modelDefRelatedDefects,
|
||||
suppliers: suppliers ?? this.suppliers,
|
||||
);
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['id'] = id;
|
||||
map['assetName'] = assetName;
|
||||
map['modelDefCode'] = modelDefCode;
|
||||
map['modelName'] = modelName;
|
||||
map['manufacturerId'] = manufacturerId;
|
||||
map['manufacturerName'] = manufacturerName;
|
||||
map['supplierName'] = supplierName;
|
||||
map['replacementDate'] = replacementDate;
|
||||
map['essentialEquipement'] = essentialEquipement;
|
||||
map['businessCritical'] = businessCritical;
|
||||
map['lifeSpan'] = lifeSpan;
|
||||
if (modelDefRelatedDefects != null) {
|
||||
map['modelDefRelatedDefects'] = modelDefRelatedDefects.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (suppliers != null) {
|
||||
map['suppliers'] = suppliers.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
class ModelDefRelatedDefects {
|
||||
ModelDefRelatedDefects({
|
||||
this.id,
|
||||
this.defectName,
|
||||
this.workPerformed,
|
||||
this.estimatedTime,
|
||||
});
|
||||
|
||||
ModelDefRelatedDefects.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
defectName = json['defectName'];
|
||||
workPerformed = json['workPerformed'];
|
||||
estimatedTime = json['estimatedTime'];
|
||||
}
|
||||
num id;
|
||||
String defectName;
|
||||
String workPerformed;
|
||||
String estimatedTime;
|
||||
ModelDefRelatedDefects copyWith({
|
||||
num id,
|
||||
String defectName,
|
||||
String workPerformed,
|
||||
String estimatedTime,
|
||||
}) =>
|
||||
ModelDefRelatedDefects(
|
||||
id: id ?? this.id,
|
||||
defectName: defectName ?? this.defectName,
|
||||
workPerformed: workPerformed ?? this.workPerformed,
|
||||
estimatedTime: estimatedTime ?? this.estimatedTime,
|
||||
);
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['id'] = id;
|
||||
map['defectName'] = defectName;
|
||||
map['workPerformed'] = workPerformed;
|
||||
map['estimatedTime'] = estimatedTime;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
class Supplier {
|
||||
Supplier({
|
||||
this.id,
|
||||
this.suppliername,
|
||||
});
|
||||
|
||||
Supplier.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
suppliername = json['suppliername'];
|
||||
}
|
||||
num id;
|
||||
String suppliername;
|
||||
Supplier copyWith({
|
||||
num id,
|
||||
String suppliername,
|
||||
}) =>
|
||||
Supplier(
|
||||
id: id ?? this.id,
|
||||
suppliername: suppliername ?? this.suppliername,
|
||||
);
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['id'] = id;
|
||||
map['suppliername'] = suppliername;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
import '../lookup.dart';
|
||||
|
||||
class TechnicalGuidanceBook {
|
||||
TechnicalGuidanceBook({this.id, this.guidanceBook});
|
||||
|
||||
TechnicalGuidanceBook.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
guidanceBook = json['guidanceBook'] != null ? Lookup.fromJson(json['guidanceBook']) : null;
|
||||
}
|
||||
num id;
|
||||
Lookup guidanceBook;
|
||||
TechnicalGuidanceBook copyWith({
|
||||
num id,
|
||||
Lookup guidanceBook,
|
||||
}) =>
|
||||
TechnicalGuidanceBook(
|
||||
id: id ?? this.id,
|
||||
guidanceBook: guidanceBook ?? this.guidanceBook,
|
||||
);
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['id'] = id;
|
||||
if (guidanceBook != null) {
|
||||
map['guidanceBook'] = guidanceBook.toJson();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@ -1,89 +0,0 @@
|
||||
import 'package:test_sa/models/hospital.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
import 'model.dart';
|
||||
|
||||
class Device {
|
||||
int id;
|
||||
String serialNumber;
|
||||
String number;
|
||||
String assetName;
|
||||
String destBuildingName;
|
||||
int destBuildingId;
|
||||
String destDepartmentName;
|
||||
int destDepartmentId;
|
||||
String destRoom;
|
||||
String destFloor;
|
||||
int destFloorId;
|
||||
String destSiteName;
|
||||
|
||||
// String brand;
|
||||
// String model;
|
||||
ModelDefinition modelDefinition;
|
||||
Hospital hospital;
|
||||
|
||||
Device({
|
||||
this.id,
|
||||
this.serialNumber,
|
||||
this.number,
|
||||
this.assetName,
|
||||
this.hospital,
|
||||
this.destBuildingName,
|
||||
this.destDepartmentName,
|
||||
this.destRoom,
|
||||
this.destFloor,
|
||||
this.destSiteName,
|
||||
// this.brand,
|
||||
// this.model,
|
||||
this.modelDefinition,
|
||||
this.destFloorId,
|
||||
this.destDepartmentId,
|
||||
this.destBuildingId,
|
||||
});
|
||||
|
||||
factory Device.fromJson(Map<String, dynamic> parsedJson, {bool startKeyWithDest = true}) {
|
||||
return Device(
|
||||
id: parsedJson["id"],
|
||||
serialNumber: parsedJson["assetSerialNo"],
|
||||
number: parsedJson["assetNumber"],
|
||||
assetName: parsedJson["assetName"],
|
||||
modelDefinition: ModelDefinition.fromJson(parsedJson["modelDefinition"]),
|
||||
hospital: Hospital.fromJson(parsedJson["site"]),
|
||||
destBuildingName: startKeyWithDest ? parsedJson["destBuildingName"] : parsedJson['building']['name'],
|
||||
destBuildingId: startKeyWithDest ? parsedJson["destBuildingName"] : parsedJson['building']['id'],
|
||||
destDepartmentName: startKeyWithDest ? parsedJson["destDepartmentName"] : parsedJson['department']['departmentName'],
|
||||
destDepartmentId: startKeyWithDest ? parsedJson["destDepartmentName"] : parsedJson['department']['id'],
|
||||
destRoom: startKeyWithDest ? parsedJson["destRoom"] : parsedJson['room'],
|
||||
destFloor: startKeyWithDest ? parsedJson["destFloor"] : parsedJson['floor']['name'],
|
||||
destFloorId: startKeyWithDest ? null : parsedJson['floor']['id'],
|
||||
destSiteName: parsedJson['destSiteName']
|
||||
// parsedJson["modelDefinition"] == null ? "" :
|
||||
// parsedJson["modelDefinition"]["manufacturerName"],
|
||||
// model: parsedJson["modelDefinition"] == null ? "" :
|
||||
// parsedJson["modelDefinition"]["modelName"],
|
||||
);
|
||||
}
|
||||
|
||||
factory Device.fromDevice(Device device) {
|
||||
return Device(
|
||||
id: device.id,
|
||||
serialNumber: device.serialNumber,
|
||||
number: device.number,
|
||||
// brand: device.brand,
|
||||
// model: device.model,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap(Lookup assetType) {
|
||||
return {
|
||||
'id': id,
|
||||
'assetSerialNo': serialNumber,
|
||||
'assetNumber': number,
|
||||
'assetName': assetName,
|
||||
'modelDefinition': modelDefinition.toJson(),
|
||||
'site': hospital.toMap(),
|
||||
'AssetType': assetType.toMap(),
|
||||
"supplier": {"id": 0, "suppliername": "string"},
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,132 +0,0 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/models/department.dart';
|
||||
import 'package:test_sa/models/device/device.dart';
|
||||
import 'package:test_sa/models/device/device_transfer_info.dart';
|
||||
import 'package:test_sa/models/hospital.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
import '../timer_model.dart';
|
||||
|
||||
class DeviceTransfer {
|
||||
int id;
|
||||
String userId;
|
||||
String title;
|
||||
Device device;
|
||||
DeviceTransferInfo sender;
|
||||
DeviceTransferInfo receiver;
|
||||
String createdOn;
|
||||
|
||||
DeviceTransfer({
|
||||
this.id,
|
||||
this.device,
|
||||
this.title,
|
||||
this.userId,
|
||||
this.sender,
|
||||
this.receiver,
|
||||
this.createdOn,
|
||||
});
|
||||
|
||||
bool validate() {
|
||||
if (device == null) return false;
|
||||
return receiver.validate();
|
||||
}
|
||||
|
||||
fromDeviceTransfer(DeviceTransfer old) {
|
||||
id = old.id;
|
||||
title = old.title;
|
||||
userId = old.userId;
|
||||
device = Device.fromDevice(old.device);
|
||||
final sender = DeviceTransferInfo();
|
||||
sender.fromDetails(old.sender);
|
||||
this.sender = sender;
|
||||
final receiver = DeviceTransferInfo();
|
||||
receiver.fromDetails(old.receiver);
|
||||
this.receiver = receiver;
|
||||
createdOn = old.createdOn;
|
||||
}
|
||||
|
||||
factory DeviceTransfer.fromJson(Map<String, dynamic> parsedJson) {
|
||||
List<String> senderFiles = [];
|
||||
if (parsedJson["senderAttachments"] != null && parsedJson["senderAttachments"] is List) {
|
||||
List list = parsedJson["senderAttachments"];
|
||||
senderFiles = list.map((e) => (URLs.getFileUrl(e["attachmentName"]))).toList();
|
||||
}
|
||||
List<String> receiverFiles = [];
|
||||
if (parsedJson["receiverAttachments"] != null && parsedJson["receiverAttachments"] is List) {
|
||||
List list = parsedJson["receiverAttachments"];
|
||||
receiverFiles = list.map((e) => (URLs.getFileUrl(e["attachmentName"]))).toList();
|
||||
}
|
||||
return DeviceTransfer(
|
||||
id: parsedJson["id"],
|
||||
title: parsedJson["transferCode"],
|
||||
userId: parsedJson["uid"],
|
||||
createdOn: parsedJson['createdOn'],
|
||||
device: Device(
|
||||
id: parsedJson["assetId"],
|
||||
number: parsedJson["assetNumber"],
|
||||
assetName: parsedJson["assetName"],
|
||||
serialNumber: parsedJson["assetSerialNo"],
|
||||
destBuildingId: parsedJson["destBuildingId"],
|
||||
destBuildingName: parsedJson["destBuildingName"],
|
||||
destDepartmentId: parsedJson["destDepartmentId"],
|
||||
destDepartmentName: parsedJson["destDepartmentName"],
|
||||
destFloorId: parsedJson["destFloorId"],
|
||||
destFloor: parsedJson["destFloorName"],
|
||||
destRoom: parsedJson["destRoom"],
|
||||
destSiteName: parsedJson["destSiteName"],
|
||||
),
|
||||
sender: DeviceTransferInfo(
|
||||
travelingHours: parsedJson["senderTravelingHours"],
|
||||
comment: parsedJson["senderComment"],
|
||||
workingHours: parsedJson["senderWorkingHours"],
|
||||
attachments: senderFiles?.map((e) => File(e))?.toList(),
|
||||
timer: TimerModel(
|
||||
startAt: DateTime.tryParse(parsedJson["senderStartDate"] ?? ""),
|
||||
endAt: DateTime.tryParse(parsedJson["senderEndDate"] ?? ""),
|
||||
durationInSecond: ((parsedJson["workingHours"] ?? 0) * 60 * 60).toInt(),
|
||||
),
|
||||
// startDate: parsedJson["senderStartDate"] == null ? null : DateTime.parse(parsedJson["senderStartDate"]),
|
||||
// endDate: parsedJson["senderEndDate"] == null ? null : DateTime.parse(parsedJson["senderEndDate"]),
|
||||
userId: parsedJson["senderAssignedEmployeeId"],
|
||||
userName: parsedJson["senderAssignedEmployeeName"],
|
||||
assignedEmployeeName: parsedJson["senderAssignedEmployeeName"],
|
||||
client: Hospital(id: parsedJson["senderSiteId"], name: parsedJson["senderSiteName"]),
|
||||
department: Department(
|
||||
id: parsedJson["senderDepartmentId"],
|
||||
name: parsedJson["senderDepartmentName"],
|
||||
),
|
||||
engSignature: URLs.getFileUrl(parsedJson["senderEngSignature"]),
|
||||
status: Lookup(
|
||||
id: parsedJson["senderMachineStatusId"],
|
||||
name: parsedJson["senderMachineStatusName"],
|
||||
),
|
||||
),
|
||||
receiver: DeviceTransferInfo(
|
||||
travelingHours: parsedJson["receiverTravelingHours"],
|
||||
comment: parsedJson["receiverComment"],
|
||||
workingHours: parsedJson["receiverWorkingHours"],
|
||||
attachments: receiverFiles?.map((e) => File(e))?.toList(),
|
||||
timer: parsedJson["receiverStartDate"] != null || parsedJson["receiverEndDate"] != null
|
||||
? TimerModel(startAt: DateTime.tryParse(parsedJson["receiverStartDate"] ?? ""), endAt: DateTime.tryParse(parsedJson["receiverEndDate"] ?? ""))
|
||||
: null,
|
||||
// startDate: parsedJson["receiverStartDate"] == null ? null : DateTime.parse(parsedJson["receiverStartDate"]),
|
||||
// endDate: parsedJson["receiverEndDate"] == null ? null : DateTime.parse(parsedJson["receiverEndDate"]),
|
||||
userId: parsedJson["receiverAssignedEmployeeId"],
|
||||
userName: parsedJson["receiverAssignedEmployeeName"],
|
||||
assignedEmployeeName: parsedJson["receiverAssignedEmployeeName"],
|
||||
client: Hospital(id: parsedJson["destSiteId"], name: parsedJson["destSiteName"]),
|
||||
department: Department(
|
||||
id: parsedJson["destDepartmentId"],
|
||||
name: parsedJson["destDepartmentName"],
|
||||
),
|
||||
engSignature: URLs.getFileUrl(parsedJson["receiverEngSignature"]),
|
||||
status: Lookup(
|
||||
id: parsedJson["receiverMachineStatusId"],
|
||||
name: parsedJson["receiverMachineStatusName"],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/models/enums/translation_keys.dart';
|
||||
|
||||
import '../common_widgets/app_filled_button.dart';
|
||||
import '../common_widgets/default_app_bar.dart';
|
||||
|
||||
class NewServiceRequestPage extends StatelessWidget {
|
||||
static const String routeName = "/new_service_request_page";
|
||||
const NewServiceRequestPage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: const DefaultAppBar(title: TranslationKeys.newServiceRequest),
|
||||
body: Column(
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
child: Column(children: []),
|
||||
).expanded,
|
||||
AppFilledButton(label: TranslationKeys.submitRequest, maxWidth: true, onPressed: () {})
|
||||
],
|
||||
).paddingOnly(left: 16, right: 16, bottom: 24),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,98 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:test_sa/controllers/localization/localization.dart';
|
||||
import 'package:test_sa/models/device/device.dart';
|
||||
import 'package:test_sa/models/subtitle.dart';
|
||||
import 'package:test_sa/views/app_style/colors.dart';
|
||||
import 'package:test_sa/views/app_style/sizing.dart';
|
||||
import 'package:test_sa/views/widgets/equipment/single_device_picker.dart';
|
||||
|
||||
class DeviceButton extends StatelessWidget {
|
||||
final Function(Device) onDevicePick;
|
||||
final Device device;
|
||||
|
||||
const DeviceButton({Key key, this.device, this.onDevicePick}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Subtitle _subtitle = AppLocalization.of(context).subtitle;
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
elevation: 0,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: device == null ? 12 : 8),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
||||
),
|
||||
foregroundColor: AColors.primaryColor,
|
||||
backgroundColor: AColors.inputFieldBackgroundColor,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
FaIcon(
|
||||
FontAwesomeIcons.hardDrive,
|
||||
size: 28,
|
||||
color: AColors.black,
|
||||
),
|
||||
device == null
|
||||
? Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6),
|
||||
child: Text(
|
||||
_subtitle.pickDevice,
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
textScaleFactor: AppStyle.getScaleFactor(context),
|
||||
textDirection: TextDirection.rtl,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Expanded(
|
||||
child: ListTile(
|
||||
contentPadding: EdgeInsets.all(0),
|
||||
title: Text(
|
||||
"${_subtitle.sn} : " + device.serialNumber,
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Divider(
|
||||
color: Theme.of(context).textTheme.subtitle1.color,
|
||||
),
|
||||
Text(
|
||||
"${_subtitle.assetNumber} : ${device.number}",
|
||||
style: Theme.of(context).textTheme.subtitle2,
|
||||
),
|
||||
Divider(
|
||||
color: Theme.of(context).textTheme.subtitle1.color,
|
||||
),
|
||||
Text(
|
||||
"${_subtitle.assetName} : ${device.modelDefinition.assetName}",
|
||||
style: Theme.of(context).textTheme.subtitle2,
|
||||
),
|
||||
Divider(
|
||||
color: Theme.of(context).textTheme.subtitle1.color,
|
||||
),
|
||||
Text(
|
||||
"${_subtitle.brand} : ${device.modelDefinition.manufacturerName}",
|
||||
style: Theme.of(context).textTheme.subtitle2,
|
||||
),
|
||||
Divider(
|
||||
color: Theme.of(context).textTheme.subtitle1.color,
|
||||
),
|
||||
Text(
|
||||
"${_subtitle.model} : ${device.modelDefinition.modelName}",
|
||||
style: Theme.of(context).textTheme.subtitle2,
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
const Icon(Icons.keyboard_arrow_down, size: 28, color: AColors.grey3A),
|
||||
],
|
||||
),
|
||||
onPressed: () async {
|
||||
Device _device = await Navigator.of(context).pushNamed(SingleDevicePicker.id) as Device;
|
||||
onDevicePick(_device);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/models/enums/translation_keys.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
|
||||
import 'package:test_sa/views/widgets/equipment/single_device_picker.dart';
|
||||
|
||||
import '../../../models/asset/asset.dart';
|
||||
|
||||
class PickAsset extends StatelessWidget {
|
||||
final Function(Asset) onPickAsset;
|
||||
final Asset asset;
|
||||
|
||||
const PickAsset({Key key, this.asset, this.onPickAsset}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
AppTextFormField(
|
||||
enable: false,
|
||||
labelText: TranslationKeys.submitRequest,
|
||||
initialValue: context.translate(TranslationKeys.site),
|
||||
suffixIcon: "qr".toSvgAsset(height: 24, fit: BoxFit.fitHeight).paddingOnly(end: 16),
|
||||
).onPress(() async {
|
||||
Asset device = await Navigator.of(context).pushNamed(SingleDevicePicker.id) as Asset;
|
||||
onPickAsset(device);
|
||||
}),
|
||||
if (asset != null) 8.height,
|
||||
if (asset != null)
|
||||
Card(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
context.translate(TranslationKeys.myAssets).heading5(context),
|
||||
8.height,
|
||||
"${context.translate(TranslationKeys.myAssets)}: ${asset.assetNumber}".bodyText(context),
|
||||
"${context.translate(TranslationKeys.myAssets)}: ${asset.id}".bodyText(context),
|
||||
"${context.translate(TranslationKeys.myAssets)}: ${asset.assetNumber}".bodyText(context),
|
||||
"${context.translate(TranslationKeys.myAssets)}: ${asset.assetNumber}".bodyText(context),
|
||||
const Divider().defaultStyle(context),
|
||||
"${context.translate(TranslationKeys.myAssets)}: ${asset.assetNumber}".bodyText(context),
|
||||
"${context.translate(TranslationKeys.myAssets)}: ${asset.assetNumber}".bodyText(context),
|
||||
],
|
||||
).paddingAll(16),
|
||||
),
|
||||
],
|
||||
);
|
||||
// return ElevatedButton(
|
||||
// style: ElevatedButton.styleFrom(
|
||||
// elevation: 0,
|
||||
// padding: EdgeInsets.symmetric(horizontal: 16, vertical: device == null ? 12 : 8),
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
||||
// ),
|
||||
// foregroundColor: AColors.primaryColor,
|
||||
// backgroundColor: AColors.inputFieldBackgroundColor,
|
||||
// ),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: ListTile(
|
||||
// contentPadding: const EdgeInsets.all(0),
|
||||
// title: Text(
|
||||
// "${"context"} : ${device.serialNumber}",
|
||||
// style: Theme.of(context).textTheme.subtitle1,
|
||||
// ),
|
||||
// subtitle: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Divider(
|
||||
// color: Theme.of(context).textTheme.subtitle1.color,
|
||||
// ),
|
||||
// Text(
|
||||
// "${_subtitle.assetNumber} : ${device.number}",
|
||||
// style: Theme.of(context).textTheme.subtitle2,
|
||||
// ),
|
||||
// Divider(
|
||||
// color: Theme.of(context).textTheme.subtitle1.color,
|
||||
// ),
|
||||
// Text(
|
||||
// "${_subtitle.assetName} : ${device.modelDefinition.assetName}",
|
||||
// style: Theme.of(context).textTheme.subtitle2,
|
||||
// ),
|
||||
// Divider(
|
||||
// color: Theme.of(context).textTheme.subtitle1.color,
|
||||
// ),
|
||||
// Text(
|
||||
// "${_subtitle.brand} : ${device.modelDefinition.manufacturerName}",
|
||||
// style: Theme.of(context).textTheme.subtitle2,
|
||||
// ),
|
||||
// Divider(
|
||||
// color: Theme.of(context).textTheme.subtitle1.color,
|
||||
// ),
|
||||
// Text(
|
||||
// "${_subtitle.model} : ${device.modelDefinition.modelName}",
|
||||
// style: Theme.of(context).textTheme.subtitle2,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// )),
|
||||
// const Icon(Icons.keyboard_arrow_down, size: 28, color: AColors.grey3A),
|
||||
// ],
|
||||
// ),
|
||||
// onPressed: () async {
|
||||
// Device _device = await Navigator.of(context).pushNamed(SingleDevicePicker.id) as Device;
|
||||
// onDevicePick(_device);
|
||||
// });
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue