From df2c7af28146c4e758421aac556691dbe456e4c0 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 9 Jul 2026 11:38:38 +0300 Subject: [PATCH] asset model asset attachment changed. --- lib/models/device/asset_by_id_model.dart | 31 +++++++++++++++++-- .../device_transfer/device_search_screen.dart | 1 - 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/lib/models/device/asset_by_id_model.dart b/lib/models/device/asset_by_id_model.dart index c631b767..b7b0e759 100644 --- a/lib/models/device/asset_by_id_model.dart +++ b/lib/models/device/asset_by_id_model.dart @@ -54,7 +54,7 @@ class AssetByIdModel { String? comment; bool? isEnabled; String? tagCode; - List? assetAttachments; + List? assetAttachments; String? retirementTypeName; String? retirementStatusName; String? retirementDate; @@ -189,9 +189,9 @@ class AssetByIdModel { isEnabled = json['isEnabled']; tagCode = json['tagCode']; if (json['assetAttachments'] != null) { - assetAttachments = []; + assetAttachments = []; json['assetAttachments'].forEach((v) { - assetAttachments!.add(v); + assetAttachments!.add(AssetAttachment.fromJson(v)); }); } retirementTypeName = json['retirementTypeName']; @@ -323,6 +323,31 @@ class MultiAssets { } } +class AssetAttachment { + int? id; + String? attachmentName; + String? attachmentURL; + String? originalName; + + AssetAttachment({this.id, this.attachmentName, this.attachmentURL, this.originalName}); + + AssetAttachment.fromJson(Map json) { + id = json['id']; + attachmentName = json['attachmentName']; + attachmentURL = json['attachmentURL']; + originalName = json['originalName']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['attachmentName'] = attachmentName; + data['attachmentURL'] = attachmentURL; + data['originalName'] = originalName; + return data; + } +} + class ModelDefinition { int? id; String? assetName; diff --git a/lib/modules/tm_module/device_transfer/device_search_screen.dart b/lib/modules/tm_module/device_transfer/device_search_screen.dart index 56768834..48c96eae 100644 --- a/lib/modules/tm_module/device_transfer/device_search_screen.dart +++ b/lib/modules/tm_module/device_transfer/device_search_screen.dart @@ -49,7 +49,6 @@ class _DeviceSearchScreenState extends State { _modelController.dispose(); _supplierController.dispose(); _siteController.dispose(); - _siteController.dispose(); _manufactureController.dispose(); _mdController.dispose(); super.dispose();