From 4d0b18b5a848fcc0fbcd837613d96a08092dd85d Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 17 Jan 2024 17:05:45 +0300 Subject: [PATCH] room model & gas refill request number added. --- lib/models/device/asset_transfer.dart | 16 +++---- lib/models/device/asset_transfer_search.dart | 2 +- lib/models/new_models/room_model.dart | 42 ++++++++++++++----- .../request_device_transfer.dart | 6 ++- .../user/gas_refill/gas_refill_details.dart | 1 + 5 files changed, 46 insertions(+), 21 deletions(-) diff --git a/lib/models/device/asset_transfer.dart b/lib/models/device/asset_transfer.dart index 518e51d0..de4a52e0 100644 --- a/lib/models/device/asset_transfer.dart +++ b/lib/models/device/asset_transfer.dart @@ -16,7 +16,7 @@ class AssetTransfer { this.destBuildingId, this.destFloorId, this.destDepartmentId, - this.destRoom, + this.destRoomId, this.senderSiteId, this.senderBuildingId, this.senderFloorId, @@ -80,7 +80,7 @@ class AssetTransfer { destBuildingId = json['destBuildingId']; destFloorId = json['destFloorId']; destDepartmentId = json['destDepartmentId']; - destRoom = json['destRoom']; + destRoomId = json['destRoomId']; senderSiteId = json['senderSiteId']; senderBuildingId = json['senderBuildingId']; senderFloorId = json['senderFloorId']; @@ -172,7 +172,7 @@ class AssetTransfer { num destBuildingId; num destFloorId; num destDepartmentId; - num destRoom; + num destRoomId; num senderSiteId; num senderBuildingId; num senderFloorId; @@ -228,7 +228,7 @@ class AssetTransfer { num destBuildingId, num destFloorId, num destDepartmentId, - String destRoom, + String destRoomId, num senderSiteId, num senderBuildingId, num senderFloorId, @@ -292,7 +292,7 @@ class AssetTransfer { destBuildingId: destBuildingId ?? this.destBuildingId, destFloorId: destFloorId ?? this.destFloorId, destDepartmentId: destDepartmentId ?? this.destDepartmentId, - destRoom: destRoom ?? this.destRoom, + destRoomId: destRoomId ?? this.destRoomId, senderSiteId: senderSiteId ?? this.senderSiteId, senderBuildingId: senderBuildingId ?? this.senderBuildingId, senderFloorId: senderFloorId ?? this.senderFloorId, @@ -356,7 +356,7 @@ class AssetTransfer { map['destBuildingId'] = destBuildingId; map['destFloorId'] = destFloorId; map['destDepartmentId'] = destDepartmentId; - map['destRoom'] = destRoom; + map['destRoomId'] = destRoomId; map['senderSiteId'] = senderSiteId; map['senderBuildingId'] = senderBuildingId; map['senderFloorId'] = senderFloorId; @@ -424,7 +424,7 @@ class AssetTransfer { map['destBuildingId'] = destBuildingId; map['destFloorId'] = destFloorId; map['destDepartmentId'] = destDepartmentId; - map['destRoom'] = destRoom; + map['destRoomId'] = destRoomId; map['senderSiteId'] = asset?.site?.id; map['senderBuildingId'] = asset?.building?.id; map['senderFloorId'] = asset?.floor?.id; @@ -466,7 +466,7 @@ class AssetTransfer { destBuildingId = assetTransfer.destBuildingId; destFloorId = assetTransfer.destFloorId; destDepartmentId = assetTransfer.destDepartmentId; - destRoom = assetTransfer.destRoom; + destRoomId = assetTransfer.destRoomId; senderSiteId = assetTransfer.senderSiteId; senderBuildingId = assetTransfer.senderBuildingId; senderFloorId = assetTransfer.senderFloorId; diff --git a/lib/models/device/asset_transfer_search.dart b/lib/models/device/asset_transfer_search.dart index 79a5587d..80ee623b 100644 --- a/lib/models/device/asset_transfer_search.dart +++ b/lib/models/device/asset_transfer_search.dart @@ -18,7 +18,7 @@ class AssetTransferSearch extends AssetTransfer { map['destBuildingId'] = destBuildingId; map['destFloorId'] = destFloorId; map['destDepartmentId'] = destDepartmentId; - map['destRoom'] = destRoom; + map['destRoomId'] = destRoomId; map['senderSiteId'] = senderSiteId; map['senderBuildingId'] = senderBuildingId; map['senderFloorId'] = senderFloorId; diff --git a/lib/models/new_models/room_model.dart b/lib/models/new_models/room_model.dart index 8ee19de8..810b1bd5 100644 --- a/lib/models/new_models/room_model.dart +++ b/lib/models/new_models/room_model.dart @@ -2,25 +2,47 @@ import 'package:test_sa/models/base.dart'; class Rooms extends Base { int id; - int departmentId; - int clientRoomId; - String roomName; + String name; + int value; - Rooms({this.id, this.departmentId, this.clientRoomId, this.roomName}); + Rooms({this.id, this.name, this.value}); Rooms.fromJson(Map json) { id = json['id']; - departmentId = json['departmentId']; - clientRoomId = json['clientRoomId']; - roomName = json['roomName']; + name = json['name']; + value = json['value']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; - data['departmentId'] = this.departmentId; - data['clientRoomId'] = this.clientRoomId; - data['roomName'] = this.roomName; + data['name'] = this.name; + data['value'] = this.value; return data; } } +// +// class Rooms extends Base { +// int id; +// int departmentId; +// int clientRoomId; +// String roomName; +// +// Rooms({this.id, this.departmentId, this.clientRoomId, this.roomName}); +// +// Rooms.fromJson(Map json) { +// id = json['id']; +// departmentId = json['departmentId']; +// clientRoomId = json['clientRoomId']; +// roomName = json['roomName']; +// } +// +// Map toJson() { +// final Map data = new Map(); +// data['id'] = this.id; +// data['departmentId'] = this.departmentId; +// data['clientRoomId'] = this.clientRoomId; +// data['roomName'] = this.roomName; +// return data; +// } +// } diff --git a/lib/views/pages/device_transfer/request_device_transfer.dart b/lib/views/pages/device_transfer/request_device_transfer.dart index 86ee1e53..ee5c0bf9 100644 --- a/lib/views/pages/device_transfer/request_device_transfer.dart +++ b/lib/views/pages/device_transfer/request_device_transfer.dart @@ -56,7 +56,7 @@ class _RequestDeviceTransferState extends State { _transferModel.destBuildingId = _assetDestination.building?.id; _transferModel.destFloorId = _assetDestination.floor?.id; _transferModel.destDepartmentId = _assetDestination.department?.id; - _transferModel.destRoom = _assetDestination.room?.clientRoomId; + _transferModel.destRoomId = _assetDestination.room?.id; if (!_formKey.currentState.validate() || !(await _transferModel.validate(context))) { return; } @@ -158,6 +158,8 @@ class _RequestDeviceTransferState extends State { staticData: _assetDestination?.floor?.departments ?? [], onSelect: (value) { _assetDestination?.department = value; + _assetDestination?.room = null; + setState(() {}); }, ), 8.height, @@ -169,7 +171,7 @@ class _RequestDeviceTransferState extends State { staticData: _assetDestination?.department?.rooms ?? [], onSelect: (value) { _assetDestination?.room = value; - _transferModel.destRoom = value.clientRoomId; + setState(() {}); }, ), 8.height, diff --git a/lib/views/pages/user/gas_refill/gas_refill_details.dart b/lib/views/pages/user/gas_refill/gas_refill_details.dart index e5d3cd8d..f10d75f6 100644 --- a/lib/views/pages/user/gas_refill/gas_refill_details.dart +++ b/lib/views/pages/user/gas_refill/gas_refill_details.dart @@ -107,6 +107,7 @@ class _GasRefillDetailsPageState extends State { 8.height, context.translation.gasRefillRequest.heading5(context), 8.height, + '${context.translation.requestNo}: ${gasRefillModel.gazRefillNo}'.bodyText(context), '${context.translation.gasRequest}: ${gasRefillModel.gazRefillDetails[0].gasType?.name}'.bodyText(context), '${context.translation.cylinderSize}: ${gasRefillModel.gazRefillDetails[0].cylinderSize?.name}'.bodyText(context), '${context.translation.site}: ${gasRefillModel.site?.name?.cleanupWhitespace?.capitalizeFirstOfEach}'.bodyText(context),