From c4c68fbe8b75a1237cc9b97a52bf12a5a1997731 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 17 Apr 2025 11:02:51 +0300 Subject: [PATCH] asset fixes --- lib/models/device/asset_transfer.dart | 8 +++- .../create__asset_transfer_request.dart | 41 ++++++++++--------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/lib/models/device/asset_transfer.dart b/lib/models/device/asset_transfer.dart index de7eab0b..d7e22270 100644 --- a/lib/models/device/asset_transfer.dart +++ b/lib/models/device/asset_transfer.dart @@ -526,7 +526,7 @@ class AssetTransfer { map['destRoomId'] = destRoomId; map['comment'] = comment; if (attachments != null) { - map['attachment'] = attachments!.map((v) => v.toJson()).toList(); + map['attachments'] = attachments!.map((v) => v.toJson()).toList(); } return map; } @@ -546,7 +546,11 @@ class AssetTransfer { map['assetTransferEngineerTimers'] = assetTransferEngineerTimers!.map((v) => v.toJson()).toList(); } if (modelAssistantEmployees != null) { - map['assetTransferAssistantEmployees'] = [modelAssistantEmployees!.toJson()]; + if(modelAssistantEmployees!.employeeId!=null) { + map['assetTransferAssistantEmployees'] = [modelAssistantEmployees!.toJson()]; + }else { + map['assetTransferAssistantEmployees'] =[]; + } } return map; } diff --git a/lib/views/pages/device_transfer/create__asset_transfer_request.dart b/lib/views/pages/device_transfer/create__asset_transfer_request.dart index d9587739..0ffd8dfe 100644 --- a/lib/views/pages/device_transfer/create__asset_transfer_request.dart +++ b/lib/views/pages/device_transfer/create__asset_transfer_request.dart @@ -129,27 +129,27 @@ class _CreateAssetTransferRequestState extends State backgroundColor: AppColor.white936, onPick: (asset) async { _pickedAsset = asset; - await checkAssetForPendingServiceRequest(asset.id!.toInt()); - if (_pickedAsset != null && pendingAssetServiceRequest != null && pendingAssetServiceRequest!.details!.isNotEmpty) { - showPendingRequestBottomSheet(); - } + // await checkAssetForPendingServiceRequest(asset.id!.toInt()); + // if (_pickedAsset != null && pendingAssetServiceRequest != null && pendingAssetServiceRequest!.details!.isNotEmpty) { + // showPendingRequestBottomSheet(); + // } setState(() {}); }), - if (pendingAssetServiceRequest != null && pendingAssetServiceRequest!.details!.isNotEmpty) ...[ - 8.height, - Row( - children: [ - const Icon(Icons.warning, color: Color(0xffEE404C), size: 14), - 8.width, - Text( - "This asset already have ${pendingAssetServiceRequest!.details!.length} request pending", - style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Color(0xff7D859A), decoration: TextDecoration.underline), - ).expanded, - ], - ).onPress(() { - showPendingRequests(); - }), - ], + // if (pendingAssetServiceRequest != null && pendingAssetServiceRequest!.details!.isNotEmpty) ...[ + // 8.height, + // Row( + // children: [ + // const Icon(Icons.warning, color: Color(0xffEE404C), size: 14), + // 8.width, + // Text( + // "This asset already have ${pendingAssetServiceRequest!.details!.length} request pending", + // style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500, color: Color(0xff7D859A), decoration: TextDecoration.underline), + // ).expanded, + // ], + // ).onPress(() { + // showPendingRequests(); + // }), + // ], 21.height, requestTypeWidget(context), 12.height, @@ -177,6 +177,7 @@ class _CreateAssetTransferRequestState extends State title: context.translation.building, initialValue: _assetDestination.building, showShadow: false, + showAsBottomSheet: true, backgroundColor: AppColor.neutral100, enabled: _assetDestination.site?.buildings?.isNotEmpty ?? false, staticData: _assetDestination.site?.buildings ?? [], @@ -197,6 +198,7 @@ class _CreateAssetTransferRequestState extends State context: context, title: context.translation.floor, showShadow: false, + showAsBottomSheet: true, initialValue: _assetDestination.floor, backgroundColor: AppColor.neutral100, enabled: _assetDestination.building?.floors?.isNotEmpty ?? false, @@ -212,6 +214,7 @@ class _CreateAssetTransferRequestState extends State context: context, title: context.translation.department, showShadow: false, + showAsBottomSheet: true, initialValue: _assetDestination.department, backgroundColor: AppColor.neutral100, enabled: _assetDestination.floor?.departments?.isNotEmpty ?? false,