Merge remote-tracking branch 'origin/main_design2.0' into main_design2.0

main_design2.0
nextwo 1 year ago
commit 985ab01bf0

@ -7,8 +7,8 @@ import 'package:http/http.dart';
import 'package:test_sa/controllers/api_routes/api_manager.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/models/device/asset.dart';
import 'package:test_sa/models/device/asset_transfer.dart';
import 'package:test_sa/models/device/device.dart';
import 'package:test_sa/models/user.dart';
import '../../../models/hospital.dart';
@ -124,7 +124,7 @@ class AssetTransferProvider extends ChangeNotifier {
Future<void> createRequest({
@required BuildContext context,
@required AssetTransfer assetDestination,
@required Device asset,
@required Asset asset,
}) async {
Response response;
try {

@ -1,6 +1,7 @@
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:http/http.dart';
import 'package:test_sa/controllers/api_routes/api_manager.dart';
import 'package:test_sa/controllers/api_routes/http_status_manger.dart';
@ -8,8 +9,8 @@ import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/models/device/asset_by_id_model.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/user.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../../../models/device/device.dart';
import '../../../models/device/asset.dart';
class AssetProvider extends ChangeNotifier {
//reset provider data
@ -27,9 +28,9 @@ class AssetProvider extends ChangeNotifier {
set stateCode(int code) => _stateCode = code;
List<Device> _devices = [];
List<Asset> _devices = [];
List<Device> get devices => _devices;
List<Asset> get devices => _devices;
// when categories in-process _loading = true
// done _loading = true
@ -70,7 +71,7 @@ class AssetProvider extends ChangeNotifier {
if (response.statusCode >= 200 && response.statusCode < 300) {
// client's request was successfully received
List equipmentListJson = json.decode(response.body)["data"];
var dList = equipmentListJson.map<Device>((asset) => Device.fromJson(asset)).toList();
var dList = equipmentListJson.map<Asset>((asset) => Asset.fromJson(asset)).toList();
try {
if (isQr) {
dList = dList.where((element) => number?.toLowerCase() == element?.assetNumber?.toLowerCase())?.toList() ?? [];
@ -106,7 +107,7 @@ class AssetProvider extends ChangeNotifier {
throw (HttpStatusManger.getStatusMessage(status: response.statusCode, subtitle: appLocalizations));
}
Future<List<Device>> getDevicesList({
Future<List<Asset>> getDevicesList({
@required String host,
@required User user,
@required int hospitalId,
@ -128,12 +129,12 @@ class AssetProvider extends ChangeNotifier {
// "${number?.isEmpty == false ? "&assetNo=$number" : ""}"
// ),
// );
List<Device> page = [];
List<Asset> page = [];
if (response.statusCode >= 200 && response.statusCode < 300) {
// client's request was successfully received
List equipmentListJson = json.decode(response.body)["data"];
page = equipmentListJson.map((asset) => Device.fromJson(asset)).toList();
_devices.addAll(equipmentListJson.map<Device>((asset) => Device.fromJson(asset)).toList());
page = equipmentListJson.map((asset) => Asset.fromJson(asset)).toList();
_devices.addAll(equipmentListJson.map<Asset>((asset) => Asset.fromJson(asset)).toList());
notifyListeners();
}
return page;

@ -61,8 +61,8 @@ class UserProvider extends ChangeNotifier {
Navigator.pop(context);
return response.statusCode;
} catch (error) {
Navigator.pop(context);
debugPrint(error);
Navigator.pop(context);
_loading = false;
notifyListeners();
return -1;

@ -1,4 +1,4 @@
import 'package:test_sa/models/lookup.dart';
import 'device/asset.dart';
class CallRequestForWorkOrder {
int id;
@ -63,229 +63,6 @@ class CallRequestForWorkOrder {
}
}
@Deprecated("")
class Asset {
int id;
String assetSerialNo;
String systemID;
String assetNumber;
ModelDefinition modelDefinition;
String supplier;
String ipAddress;
String macAddress;
String portNumber;
Lookup assetReplace;
String oldAsset;
Lookup isParent;
String parentAsset;
Lookup assetType;
Site site;
Building building;
String floor;
Department department;
String room;
String testsDay;
num purchasingPrice;
String nbv;
String currency;
String poNo;
String invoiceNumber;
String invoiceDate;
String replacementDate;
Department originDepartment;
Site originSite;
String budgetYear;
String lastPOPrice;
String commissioningStatus;
String productionDate;
String edd;
String technicalInspectionDate;
String deliveryInspectionDate;
String endUserAcceptanceDate;
String receivingCommittee;
String siteWarrantyMonths;
String extendedWarrantyMonths;
String remainderWarrantyMonths;
String eomWarrantyMonthsNo;
String warrantyValue;
String warrantyEndDate;
String warrantyContractConditions;
List technicalGuidanceBooks;
String comment;
String tagCode;
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(Map<String, dynamic> json) {
id = json['id'];
assetSerialNo = json['assetSerialNo'];
systemID = json['systemID'];
assetNumber = json['assetNumber'];
modelDefinition = json['modelDefinition'] != null ? new ModelDefinition.fromJson(json['modelDefinition']) : null;
supplier = json['supplier'];
ipAddress = json['ipAddress'];
macAddress = json['macAddress'];
portNumber = json['portNumber'];
assetReplace = json['assetReplace'] != null ? Lookup.fromJson(json['assetReplace']) : null;
oldAsset = json['oldAsset'];
isParent = json['isParent'] != null ? Lookup.fromJson(json['isParent']) : null;
parentAsset = json['parentAsset'];
assetType = json['assetType'] != null ? Lookup.fromJson(json['assetType']) : null;
site = json['site'] != null ? new Site.fromJson(json['site']) : null;
building = json['building'];
floor = json['floor'];
department = json['department'] != null ? new Department.fromJson(json['department']) : null;
room = json['room'];
testsDay = json['testsDay'];
purchasingPrice = json['purchasingPrice'];
nbv = json['nbv'];
currency = json['currency'];
poNo = json['poNo'];
invoiceNumber = json['invoiceNumber'];
invoiceDate = json['invoiceDate'];
replacementDate = json['replacementDate'];
originDepartment = json['originDepartment'] != null ? new Department.fromJson(json['originDepartment']) : null;
originSite = json['originSite'] != null ? new Site.fromJson(json['originSite']) : null;
budgetYear = json['budgetYear'];
lastPOPrice = json['lastPOPrice'];
commissioningStatus = json['commissioningStatus'];
productionDate = json['productionDate'];
edd = json['edd'];
technicalInspectionDate = json['technicalInspectionDate'];
deliveryInspectionDate = json['deliveryInspectionDate'];
endUserAcceptanceDate = json['endUserAcceptanceDate'];
receivingCommittee = json['receivingCommittee'];
siteWarrantyMonths = json['siteWarrantyMonths'];
extendedWarrantyMonths = json['extendedWarrantyMonths'];
remainderWarrantyMonths = json['remainderWarrantyMonths'];
eomWarrantyMonthsNo = json['eomWarrantyMonthsNo'];
warrantyValue = json['warrantyValue'];
warrantyEndDate = json['warrantyEndDate'];
warrantyContractConditions = json['warrantyContractConditions'];
if (json['technicalGuidanceBooks'] != null) {
technicalGuidanceBooks = [];
json['technicalGuidanceBooks'].forEach((v) {
//technicalGuidanceBooks.add(new Null.fromJson(v));
});
}
comment = json['comment'];
tagCode = json['tagCode'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['assetSerialNo'] = this.assetSerialNo;
data['systemID'] = this.systemID;
data['assetNumber'] = this.assetNumber;
if (this.modelDefinition != null) {
data['modelDefinition'] = this.modelDefinition.toJson();
}
data['supplier'] = this.supplier;
data['ipAddress'] = this.ipAddress;
data['macAddress'] = this.macAddress;
data['portNumber'] = this.portNumber;
data['assetReplace'] = this.assetReplace;
data['oldAsset'] = this.oldAsset;
data['isParent'] = this.isParent;
data['parentAsset'] = this.parentAsset;
data['assetType'] = this.assetType;
if (this.site != null) {
data['site'] = this.site.toJson();
}
data['building'] = this.building;
data['floor'] = this.floor;
if (this.department != null) {
data['department'] = this.department.toJson();
}
data['room'] = this.room;
data['testsDay'] = this.testsDay;
data['purchasingPrice'] = this.purchasingPrice;
data['nbv'] = this.nbv;
data['currency'] = this.currency;
data['poNo'] = this.poNo;
data['invoiceNumber'] = this.invoiceNumber;
data['invoiceDate'] = this.invoiceDate;
data['replacementDate'] = this.replacementDate;
if (this.originDepartment != null) {
data['originDepartment'] = this.originDepartment.toJson();
}
if (this.originSite != null) {
data['originSite'] = this.originSite.toJson();
}
data['budgetYear'] = this.budgetYear;
data['lastPOPrice'] = this.lastPOPrice;
data['commissioningStatus'] = this.commissioningStatus;
data['productionDate'] = this.productionDate;
data['edd'] = this.edd;
data['technicalInspectionDate'] = this.technicalInspectionDate;
data['deliveryInspectionDate'] = this.deliveryInspectionDate;
data['endUserAcceptanceDate'] = this.endUserAcceptanceDate;
data['receivingCommittee'] = this.receivingCommittee;
data['siteWarrantyMonths'] = this.siteWarrantyMonths;
data['extendedWarrantyMonths'] = this.extendedWarrantyMonths;
data['remainderWarrantyMonths'] = this.remainderWarrantyMonths;
data['eomWarrantyMonthsNo'] = this.eomWarrantyMonthsNo;
data['warrantyValue'] = this.warrantyValue;
data['warrantyEndDate'] = this.warrantyEndDate;
data['warrantyContractConditions'] = this.warrantyContractConditions;
if (this.technicalGuidanceBooks != null) {
data['technicalGuidanceBooks'] = this.technicalGuidanceBooks.map((v) => v.toJson()).toList();
}
data['comment'] = this.comment;
data['tagCode'] = this.tagCode;
return data;
}
}
class ModelDefinition {
int id;
String assetName;

@ -8,8 +8,8 @@ import '../new_models/floor.dart';
import '../new_models/site.dart';
import 'model_definition.dart';
class Device {
Device({
class Asset {
Asset({
this.id,
this.assetSerialNo,
this.systemID,
@ -61,7 +61,7 @@ class Device {
this.assetPhoto,
});
Device.fromJson(dynamic json) {
Asset.fromJson(dynamic json) {
id = json['id'];
assetSerialNo = json['assetSerialNo'];
systemID = json['systemID'];
@ -165,7 +165,7 @@ class Device {
String comment;
String tagCode;
String assetPhoto;
Device copyWith({
Asset copyWith({
num id,
String assetSerialNo,
String systemID,
@ -216,7 +216,7 @@ class Device {
String tagCode,
String assetPhoto,
}) =>
Device(
Asset(
id: id ?? this.id,
assetSerialNo: assetSerialNo ?? this.assetSerialNo,
systemID: systemID ?? this.systemID,

@ -1,7 +1,7 @@
import 'package:flutter/src/widgets/framework.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/models/device/device.dart';
import 'package:test_sa/models/device/asset.dart';
import 'asset_transfer_attachment.dart';
@ -226,7 +226,7 @@ class AssetTransfer {
return map;
}
Map<String, dynamic> transferBody({Device asset}) {
Map<String, dynamic> transferBody({Asset asset}) {
final map = <String, dynamic>{};
map['id'] = 0;
map['transferNo'] = transferNo;

@ -1,8 +1,8 @@
import 'asset.dart';
import 'asset_transfer.dart';
import 'device.dart';
class AssetTransferSearch extends AssetTransfer {
Device asset;
Asset asset;
int pageNumber = 10, pageSize;
bool mostRecent;

@ -1,9 +1,9 @@
import '../hospital.dart';
import 'device.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;

@ -2,7 +2,7 @@ import 'dart:typed_data';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/models/device/device.dart';
import 'package:test_sa/models/device/asset.dart';
import 'package:test_sa/models/engineer.dart';
import 'package:test_sa/models/fault_description.dart';
import 'package:test_sa/models/lookup.dart';
@ -35,7 +35,7 @@ class ServiceReport {
String invoiceCode;
List<Part> parts;
List<String> files;
Device device;
Asset device;
String quantity;
String jobSheetNumber;
TimerModel timer;
@ -235,7 +235,7 @@ class ServiceReport {
durationInSecond: ((parsedJson["workingHours"] ?? 0) * 60 * 60).toInt(),
),
//workPreformed: parsedJson["work_performed"],
device: Device.fromJson(parsedJson["callRequest"]["asset"]),
device: Asset.fromJson(parsedJson["callRequest"]["asset"]),
signatureNurse: URLs.getFileUrl(parsedJson["nurseSignature"]),
signatureEngineer: URLs.getFileUrl(parsedJson["engSignature"]),
comment: parsedJson['comment'],

@ -2,6 +2,7 @@ import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/service_request/sub_work_order_details.dart';
import 'package:test_sa/models/timer_model.dart';
import '../device/asset.dart';
import '../fault_description.dart';
class SearchWorkOrder {
@ -1563,354 +1564,6 @@ class CallSiteContactPerson {
}
}
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 ? AssetReplace.fromJson(json['assetReplace']) : null;
oldAsset = json['oldAsset'] != null ? OldAsset.fromJson(json['oldAsset']) : null;
isParent = json['isParent'] != null ? IsParent.fromJson(json['isParent']) : null;
parentAsset = json['parentAsset'] != null ? ParentAsset.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 ? Currency.fromJson(json['currency']) : null;
poNo = json['poNo'];
invoiceNumber = json['invoiceNumber'];
invoiceDate = json['invoiceDate'];
replacementDate = json['replacementDate'];
originDepartment = json['originDepartment'] != null ? OriginDepartment.fromJson(json['originDepartment']) : null;
originSite = json['originSite'] != null ? OriginSite.fromJson(json['originSite']) : null;
budgetYear = json['budgetYear'];
lastPOPrice = json['lastPOPrice'];
commissioningStatus = json['commissioningStatus'] != null ? CommissioningStatus.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 ? SiteWarrantyMonths.fromJson(json['siteWarrantyMonths']) : null;
extendedWarrantyMonths = json['extendedWarrantyMonths'] != null ? ExtendedWarrantyMonths.fromJson(json['extendedWarrantyMonths']) : null;
remainderWarrantyMonths = json['remainderWarrantyMonths'] != null ? RemainderWarrantyMonths.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(TechnicalGuidanceBooks.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;
AssetReplace assetReplace;
OldAsset oldAsset;
IsParent isParent;
ParentAsset parentAsset;
Lookup assetType;
Site site;
Building building;
Floor floor;
Department department;
String room;
num testsDay;
num purchasingPrice;
String nbv;
Currency currency;
String poNo;
String invoiceNumber;
String invoiceDate;
String replacementDate;
OriginDepartment originDepartment;
OriginSite originSite;
num budgetYear;
num lastPOPrice;
CommissioningStatus commissioningStatus;
String productionDate;
String edd;
String technicalInspectionDate;
String deliveryInspectionDate;
String endUserAcceptanceDate;
String receivingCommittee;
SiteWarrantyMonths siteWarrantyMonths;
ExtendedWarrantyMonths extendedWarrantyMonths;
RemainderWarrantyMonths remainderWarrantyMonths;
num eomWarrantyMonthsNo;
num warrantyValue;
String warrantyEndDate;
String warrantyContractConditions;
List<TechnicalGuidanceBooks> technicalGuidanceBooks;
String comment;
String tagCode;
Asset copyWith({
num id,
String assetSerialNo,
String systemID,
String assetNumber,
ModelDefinition modelDefinition,
SupplierModel supplier,
String ipAddress,
String macAddress,
String portNumber,
AssetReplace assetReplace,
OldAsset oldAsset,
IsParent isParent,
ParentAsset parentAsset,
Lookup assetType,
Site site,
Building building,
Floor floor,
Department department,
String room,
num testsDay,
num purchasingPrice,
String nbv,
Currency currency,
String poNo,
String invoiceNumber,
String invoiceDate,
String replacementDate,
OriginDepartment originDepartment,
OriginSite originSite,
num budgetYear,
num lastPOPrice,
CommissioningStatus commissioningStatus,
String productionDate,
String edd,
String technicalInspectionDate,
String deliveryInspectionDate,
String endUserAcceptanceDate,
String receivingCommittee,
SiteWarrantyMonths siteWarrantyMonths,
ExtendedWarrantyMonths extendedWarrantyMonths,
RemainderWarrantyMonths remainderWarrantyMonths,
num eomWarrantyMonthsNo,
num warrantyValue,
String warrantyEndDate,
String warrantyContractConditions,
List<TechnicalGuidanceBooks> 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 ?? 0;
map['assetSerialNo'] = assetSerialNo;
map['systemID'] = systemID;
map['assetNumber'] = assetNumber;
if (modelDefinition != null) {
map['modelDefinition'] = modelDefinition.toJson();
}
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();
}
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 TechnicalGuidanceBooks {
TechnicalGuidanceBooks({
this.id,

@ -2,7 +2,7 @@ import 'package:flutter/src/widgets/framework.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/models/device/device.dart';
import 'package:test_sa/models/device/asset.dart';
import 'package:test_sa/models/fault_description.dart';
import 'package:test_sa/models/lookup.dart';
@ -45,7 +45,7 @@ class ServiceRequest {
Lookup requestedThrough;
Lookup firstAction;
Lookup loanAvailability;
Device device;
Asset device;
ServiceRequest({
this.id,
@ -131,7 +131,7 @@ class ServiceRequest {
visitDate: DateTime.tryParse(parsedJson["visitDate"] ?? "").toString().split(" ").first,
nextVisitDate: DateTime.tryParse(parsedJson["nextVisitDate"] ?? ""),
//workPerformed: parsedJson["workOrder"] != null ? parsedJson["workOrder"]["workPerformed"] : null,
device: Device.fromJson(parsedJson["asset"]),
device: Asset.fromJson(parsedJson["asset"]),
reviewComment: parsedJson["reviewComment"],
type: Lookup.fromJson(parsedJson['typeofRequest']),
defectType: Lookup.fromJson(parsedJson['defectType']),

@ -4,12 +4,12 @@ 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 '../../models/device/device.dart';
import '../../models/device/asset.dart';
class AssetInfoCard extends StatelessWidget {
const AssetInfoCard({Key key, @required this.asset}) : super(key: key);
final Device asset;
final Asset asset;
@override
Widget build(BuildContext context) {

@ -104,7 +104,7 @@ class _LoginPageState extends State<LoginPage> {
// Navigator.pushNamed(context, LandPage.routeName);
Navigator.pushNamed(context, old.LandPage.id);
} else {
Fluttertoast.showToast(msg: _userProvider.user.message);
Fluttertoast.showToast(msg: _userProvider.user?.message ?? context.translation.failedToCompleteRequest);
}
}
}

@ -8,8 +8,8 @@ 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/device/asset.dart';
import 'package:test_sa/models/device/asset_transfer.dart';
import 'package:test_sa/models/device/device.dart';
import 'package:test_sa/models/new_models/department.dart';
import 'package:test_sa/models/new_models/floor.dart';
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
@ -41,8 +41,8 @@ class _RequestDeviceTransferState extends State<RequestDeviceTransfer> {
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
final TextEditingController _receiverNameController = TextEditingController(), _commentsController = TextEditingController();
final Device _assetDestination = Device();
Device _pickedAsset;
final Asset _assetDestination = Asset();
Asset _pickedAsset;
@override
void setState(VoidCallback fn) {
@ -99,6 +99,8 @@ class _RequestDeviceTransferState extends State<RequestDeviceTransfer> {
16.height,
context.translation.receiverDetails.heading5(context),
8.height,
/// todo [TBD] : receiverName
AppTextFormField(
controller: _receiverNameController,
labelText: context.translation.receiverName,

@ -1,20 +1,14 @@
import 'package:flutter/material.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/controllers/localization/localization.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/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 '../../../models/device/device.dart';
import 'package:test_sa/models/device/asset.dart';
class AssetItemGridView extends StatelessWidget {
final Device device;
final Function(Device) onPressed;
final Asset device;
final Function(Asset) onPressed;
const AssetItemGridView({Key key, this.device, this.onPressed}) : super(key: key);

@ -1,20 +1,14 @@
import 'package:flutter/material.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/controllers/localization/localization.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/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 '../../../models/device/device.dart';
import 'package:test_sa/models/device/asset.dart';
class AssetItemListView extends StatelessWidget {
final Device device;
final Function(Device) onPressed;
final Asset device;
final Function(Asset) onPressed;
const AssetItemListView({Key key, this.device, this.onPressed}) : super(key: key);

@ -8,10 +8,10 @@ import 'package:test_sa/views/app_style/colors.dart';
import 'package:test_sa/views/app_style/sizing.dart';
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
import '../../../models/device/device.dart';
import '../../../models/device/asset.dart';
class AutoCompleteDeviceField extends StatefulWidget {
final Device initialValue;
final Asset initialValue;
final int hospitalId;
final Function(int) onPick;
@ -60,7 +60,7 @@ class _AutoCompleteDeviceFieldState extends State<AutoCompleteDeviceField> {
border: Border.all(color: AColors.black),
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
boxShadow: [AppStyle.boxShadow]),
child: TypeAheadField<Device>(
child: TypeAheadField<Asset>(
textFieldConfiguration: TextFieldConfiguration(
style: Theme.of(context).textTheme.headline6,
controller: _controller,

@ -4,13 +4,13 @@ import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/views/widgets/equipment/single_device_picker.dart';
import '../../../models/device/device.dart';
import '../../../models/device/asset.dart';
import '../../../new_views/app_style/app_color.dart';
import '../../../new_views/common_widgets/asset_info_card.dart';
class PickAsset extends StatelessWidget {
final Function(Device) onPickAsset;
final Device device;
final Function(Asset) onPickAsset;
final Asset device;
const PickAsset({Key key, this.device, this.onPickAsset}) : super(key: key);
@ -33,7 +33,7 @@ class PickAsset extends StatelessWidget {
context.translation.pickAsset.bodyText(context).custom(color: context.isDark ? AppColor.neutral40 : AppColor.neutral50),
],
).onPress(() async {
Device device = await Navigator.of(context).pushNamed(SingleDevicePicker.id) as Device;
Asset device = await Navigator.of(context).pushNamed(SingleDevicePicker.id) as Asset;
onPickAsset(device);
}).expanded,
"qr".toSvgAsset(height: 24, fit: BoxFit.fitHeight, color: context.isDark ? AppColor.primary40 : AppColor.primary70),

@ -7,17 +7,16 @@ 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/new_views/common_widgets/app_text_form_field.dart';
import 'package:test_sa/views/widgets/equipment/asset_detail_page.dart';
import 'package:test_sa/views/widgets/equipment/asset_item_gridview.dart';
import 'package:test_sa/views/widgets/equipment/asset_item_listview.dart';
import 'package:test_sa/views/widgets/loaders/lazy_loading.dart';
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
import 'package:test_sa/views/widgets/loaders/no_item_found.dart';
import '../../../models/device/device.dart';
import '../../../models/device/asset.dart';
import '../../../new_views/app_style/app_color.dart';
import '../../../new_views/common_widgets/asset_info_card.dart';
import '../qr/scan_qr.dart';
class SingleDevicePicker extends StatefulWidget {
@ -32,8 +31,8 @@ class _SingleDevicePickerState extends State<SingleDevicePicker> {
AssetProvider _devicesProvider;
UserProvider _userProvider;
SettingProvider _settingProvider;
List<Device> _searchableList = [];
List<Device> _initList = [];
List<Asset> _searchableList = [];
List<Asset> _initList = [];
bool _firstTime = true;
bool showListView = true;

@ -8,7 +8,7 @@ import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/views/app_style/colors.dart';
import 'package:test_sa/views/app_style/sizing.dart';
import '../../../../models/device/device.dart';
import '../../../../models/device/asset.dart';
class AutoCompleteDeviceNumberField extends StatefulWidget {
final Lookup initialValue;
@ -52,7 +52,7 @@ class _AutoCompleteDeviceNumberFieldState extends State<AutoCompleteDeviceNumber
border: Border.all(color: AColors.black),
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
boxShadow: const [AppStyle.boxShadow]),
child: TypeAheadField<Device>(
child: TypeAheadField<Asset>(
textFieldConfiguration: TextFieldConfiguration(
style: Theme.of(context).textTheme.headline6,
controller: _controller,

Loading…
Cancel
Save