asset transfer room model & comment added

main_design2.0
Sikander Saleem 2 years ago
parent 162ebd38be
commit 2932796068

@ -1,6 +1,7 @@
import 'package:test_sa/models/device/supplier.dart'; import 'package:test_sa/models/device/supplier.dart';
import 'package:test_sa/models/device/technical_guidance_book.dart'; import 'package:test_sa/models/device/technical_guidance_book.dart';
import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/new_models/room_model.dart';
import '../new_models/building.dart'; import '../new_models/building.dart';
import '../new_models/department.dart'; import '../new_models/department.dart';
@ -80,7 +81,7 @@ class Asset {
building = json['building'] != null ? Building.fromJson(json['building']) : null; building = json['building'] != null ? Building.fromJson(json['building']) : null;
floor = json['floor'] != null ? Floor.fromJson(json['floor']) : null; floor = json['floor'] != null ? Floor.fromJson(json['floor']) : null;
department = json['department'] != null ? Department.fromJson(json['department']) : null; department = json['department'] != null ? Department.fromJson(json['department']) : null;
room = json['room']; room = json['room'] != null ? Rooms.fromJson(json['room']) : null;
testsDay = json['testsDay']; testsDay = json['testsDay'];
purchasingPrice = json['purchasingPrice']; purchasingPrice = json['purchasingPrice'];
nbv = json['nbv']; nbv = json['nbv'];
@ -136,7 +137,8 @@ class Asset {
Building building; Building building;
Floor floor; Floor floor;
Department department; Department department;
String room; Rooms room;
// String room;
num testsDay; num testsDay;
num purchasingPrice; num purchasingPrice;
String nbv; String nbv;
@ -187,7 +189,7 @@ class Asset {
Building building, Building building,
Floor floor, Floor floor,
Department department, Department department,
String room, Rooms room,
num testsDay, num testsDay,
num purchasingPrice, num purchasingPrice,
String nbv, String nbv,
@ -313,7 +315,10 @@ class Asset {
if (department != null) { if (department != null) {
map['department'] = department.toJson(); map['department'] = department.toJson();
} }
map['room'] = room; // map['room'] = room;
if (room != null) {
map['room'] = room.toJson();
}
map['testsDay'] = testsDay; map['testsDay'] = testsDay;
map['purchasingPrice'] = purchasingPrice; map['purchasingPrice'] = purchasingPrice;
map['nbv'] = nbv; map['nbv'] = nbv;

@ -25,6 +25,7 @@ class AssetTransfer {
this.senderAssignedEmployeeId, this.senderAssignedEmployeeId,
this.senderMachineStatusId, this.senderMachineStatusId,
this.senderComment, this.senderComment,
this.comment,
this.senderStartDate, this.senderStartDate,
this.senderEndDate, this.senderEndDate,
this.senderWorkingHours, this.senderWorkingHours,
@ -88,6 +89,7 @@ class AssetTransfer {
senderAssignedEmployeeId = json['senderAssignedEmployeeId']; senderAssignedEmployeeId = json['senderAssignedEmployeeId'];
senderMachineStatusId = json['senderMachineStatusId']; senderMachineStatusId = json['senderMachineStatusId'];
senderComment = json['senderComment']; senderComment = json['senderComment'];
comment = json['comment'];
senderStartDate = json['senderStartDate']; senderStartDate = json['senderStartDate'];
senderEndDate = json['senderEndDate']; senderEndDate = json['senderEndDate'];
senderWorkingHours = json['senderWorkingHours']; senderWorkingHours = json['senderWorkingHours'];
@ -170,7 +172,7 @@ class AssetTransfer {
num destBuildingId; num destBuildingId;
num destFloorId; num destFloorId;
num destDepartmentId; num destDepartmentId;
String destRoom; num destRoom;
num senderSiteId; num senderSiteId;
num senderBuildingId; num senderBuildingId;
num senderFloorId; num senderFloorId;
@ -179,6 +181,7 @@ class AssetTransfer {
String senderAssignedEmployeeId; String senderAssignedEmployeeId;
num senderMachineStatusId; num senderMachineStatusId;
String senderComment; String senderComment;
String comment;
String senderStartDate; String senderStartDate;
String senderEndDate; String senderEndDate;
String senderWorkingHours; String senderWorkingHours;
@ -234,6 +237,7 @@ class AssetTransfer {
String senderAssignedEmployeeId, String senderAssignedEmployeeId,
num senderMachineStatusId, num senderMachineStatusId,
String senderComment, String senderComment,
String comment,
String senderStartDate, String senderStartDate,
String senderEndDate, String senderEndDate,
String senderWorkingHours, String senderWorkingHours,
@ -297,6 +301,7 @@ class AssetTransfer {
senderAssignedEmployeeId: senderAssignedEmployeeId ?? this.senderAssignedEmployeeId, senderAssignedEmployeeId: senderAssignedEmployeeId ?? this.senderAssignedEmployeeId,
senderMachineStatusId: senderMachineStatusId ?? this.senderMachineStatusId, senderMachineStatusId: senderMachineStatusId ?? this.senderMachineStatusId,
senderComment: senderComment ?? this.senderComment, senderComment: senderComment ?? this.senderComment,
comment: comment ?? this.comment,
senderStartDate: senderStartDate ?? this.senderStartDate, senderStartDate: senderStartDate ?? this.senderStartDate,
senderEndDate: senderEndDate ?? this.senderEndDate, senderEndDate: senderEndDate ?? this.senderEndDate,
senderWorkingHours: senderWorkingHours ?? this.senderWorkingHours, senderWorkingHours: senderWorkingHours ?? this.senderWorkingHours,
@ -360,6 +365,7 @@ class AssetTransfer {
map['senderAssignedEmployeeId'] = senderAssignedEmployeeId; map['senderAssignedEmployeeId'] = senderAssignedEmployeeId;
map['senderMachineStatusId'] = senderMachineStatusId; map['senderMachineStatusId'] = senderMachineStatusId;
map['senderComment'] = senderComment; map['senderComment'] = senderComment;
map['comment'] = comment;
map['senderStartDate'] = senderStartDate; map['senderStartDate'] = senderStartDate;
map['senderEndDate'] = senderEndDate; map['senderEndDate'] = senderEndDate;
map['senderWorkingHours'] = senderWorkingHours; map['senderWorkingHours'] = senderWorkingHours;
@ -427,6 +433,7 @@ class AssetTransfer {
map['senderAssignedEmployeeId'] = senderAssignedEmployeeId; map['senderAssignedEmployeeId'] = senderAssignedEmployeeId;
map['senderMachineStatusId'] = senderMachineStatusId; map['senderMachineStatusId'] = senderMachineStatusId;
map['senderComment'] = senderComment; map['senderComment'] = senderComment;
map['comment'] = comment;
map['senderStartDate'] = senderStartDate; map['senderStartDate'] = senderStartDate;
map['senderEndDate'] = senderEndDate; map['senderEndDate'] = senderEndDate;
map['senderWorkingHours'] = senderWorkingHours; map['senderWorkingHours'] = senderWorkingHours;
@ -468,6 +475,7 @@ class AssetTransfer {
senderAssignedEmployeeId = assetTransfer.senderAssignedEmployeeId; senderAssignedEmployeeId = assetTransfer.senderAssignedEmployeeId;
senderMachineStatusId = assetTransfer.senderMachineStatusId; senderMachineStatusId = assetTransfer.senderMachineStatusId;
senderComment = assetTransfer.senderComment; senderComment = assetTransfer.senderComment;
comment = assetTransfer.comment;
senderStartDate = assetTransfer.senderStartDate; senderStartDate = assetTransfer.senderStartDate;
senderEndDate = assetTransfer.senderEndDate; senderEndDate = assetTransfer.senderEndDate;
senderWorkingHours = assetTransfer.senderWorkingHours; senderWorkingHours = assetTransfer.senderWorkingHours;

@ -1,3 +1,5 @@
import 'package:test_sa/models/new_models/room_model.dart';
import '../base.dart'; import '../base.dart';
class Department extends Base { class Department extends Base {
@ -5,7 +7,9 @@ class Department extends Base {
this.id, this.id,
this.departmentName, this.departmentName,
this.departmentCode, this.departmentCode,
this.departmentId,
this.ntCode, this.ntCode,
this.rooms,
}) : super(identifier: id.toString(), name: departmentName); }) : super(identifier: id.toString(), name: departmentName);
Department.fromJson(dynamic json) { Department.fromJson(dynamic json) {
@ -14,25 +18,31 @@ class Department extends Base {
departmentName = json['departmentName'] ?? json['name']; departmentName = json['departmentName'] ?? json['name'];
name = departmentName; name = departmentName;
departmentCode = json['departmentCode']; departmentCode = json['departmentCode'];
departmentId = json['departmentId'];
ntCode = json['ntCode']; ntCode = json['ntCode'];
rooms = <Rooms>[];
if (json['rooms'] != null) {
json['rooms'].forEach((v) {
rooms.add(Rooms.fromJson(v));
});
}
} }
num id; num id;
String departmentName; String departmentName;
String departmentCode; String departmentCode;
String departmentId;
String ntCode; String ntCode;
Department copyWith({ List<Rooms> rooms;
num id,
String departmentName, Department copyWith({num id, String departmentName, String departmentCode, String ntCode, List<Rooms> rooms}) => Department(
String departmentCode,
String ntCode,
}) =>
Department(
id: id ?? this.id, id: id ?? this.id,
departmentName: departmentName ?? this.departmentName, departmentName: departmentName ?? this.departmentName,
departmentCode: departmentCode ?? this.departmentCode, departmentCode: departmentCode ?? this.departmentCode,
departmentId: departmentId ?? this.departmentId,
ntCode: ntCode ?? this.ntCode, ntCode: ntCode ?? this.ntCode,
rooms: rooms ?? this.rooms,
); );
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -40,7 +50,11 @@ class Department extends Base {
map['id'] = id; map['id'] = id;
map['departmentName'] = departmentName; map['departmentName'] = departmentName;
map['departmentCode'] = departmentCode; map['departmentCode'] = departmentCode;
map['departmentId'] = departmentId;
map['ntCode'] = ntCode; map['ntCode'] = ntCode;
if (rooms != null) {
map['rooms'] = rooms.map((v) => v.toJson()).toList();
}
return map; return map;
} }
} }

@ -0,0 +1,26 @@
import 'package:test_sa/models/base.dart';
class Rooms extends Base {
int id;
int departmentId;
int clientRoomId;
String roomName;
Rooms({this.id, this.departmentId, this.clientRoomId, this.roomName});
Rooms.fromJson(Map<String, dynamic> json) {
id = json['id'];
departmentId = json['departmentId'];
clientRoomId = json['clientRoomId'];
roomName = json['roomName'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['departmentId'] = this.departmentId;
data['clientRoomId'] = this.clientRoomId;
data['roomName'] = this.roomName;
return data;
}
}

@ -78,6 +78,12 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
_buildTextWidget('${context.translation.assetNumber} : ${_model?.assetNumber ?? ""}'), _buildTextWidget('${context.translation.assetNumber} : ${_model?.assetNumber ?? ""}'),
_buildTextWidget('${context.translation.model} : ${_model?.modelName ?? ""}'), _buildTextWidget('${context.translation.model} : ${_model?.modelName ?? ""}'),
_buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo ?? ""}'), _buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo ?? ""}'),
if ((_model?.comment ?? "").isNotEmpty) ...[
8.height,
const Divider().defaultStyle(context),
8.height,
_buildTextWidget(_model?.comment),
]
], ],
), ),
8.height, 8.height,
@ -193,13 +199,12 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
], ],
), ),
if ((_userProvider.user?.type == UsersTypes.engineer)) if ((_userProvider.user?.type == UsersTypes.engineer))
if(isCurrentEngineerEligibleForEdit && !isCurrentRequestCompletedOrClosed) if (isCurrentEngineerEligibleForEdit && !isCurrentRequestCompletedOrClosed)
// if (isSender
// if (isSender // ? (!(_model?.senderMachineStatusName?.toLowerCase()?.contains("close") ?? false) && !(_model?.senderMachineStatusName?.toLowerCase()?.contains("complete") ?? false))
// ? (!(_model?.senderMachineStatusName?.toLowerCase()?.contains("close") ?? false) && !(_model?.senderMachineStatusName?.toLowerCase()?.contains("complete") ?? false)) // : (!(_model?.receiverMachineStatusName?.toLowerCase()?.contains("close") ?? false) && !(_model?.receiverMachineStatusName?.toLowerCase()?.contains("complete") ?? false)))
// : (!(_model?.receiverMachineStatusName?.toLowerCase()?.contains("close") ?? false) && !(_model?.receiverMachineStatusName?.toLowerCase()?.contains("complete") ?? false))) //
//
"edit".toSvgAsset(height: 48, width: 48).onPress(() { "edit".toSvgAsset(height: 48, width: 48).onPress(() {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model, isSender: isSender))); Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model, isSender: isSender)));

@ -12,6 +12,7 @@ import 'package:test_sa/models/device/asset.dart';
import 'package:test_sa/models/device/asset_transfer.dart'; import 'package:test_sa/models/device/asset_transfer.dart';
import 'package:test_sa/models/new_models/department.dart'; import 'package:test_sa/models/new_models/department.dart';
import 'package:test_sa/models/new_models/floor.dart'; import 'package:test_sa/models/new_models/floor.dart';
import 'package:test_sa/models/new_models/room_model.dart';
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart'; import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
import '../../../models/new_models/building.dart'; import '../../../models/new_models/building.dart';
@ -55,6 +56,7 @@ class _RequestDeviceTransferState extends State<RequestDeviceTransfer> {
_transferModel.destBuildingId = _assetDestination.building?.id; _transferModel.destBuildingId = _assetDestination.building?.id;
_transferModel.destFloorId = _assetDestination.floor?.id; _transferModel.destFloorId = _assetDestination.floor?.id;
_transferModel.destDepartmentId = _assetDestination.department?.id; _transferModel.destDepartmentId = _assetDestination.department?.id;
_transferModel.destRoom = _assetDestination.room?.clientRoomId;
if (!_formKey.currentState.validate() || !(await _transferModel.validate(context))) { if (!_formKey.currentState.validate() || !(await _transferModel.validate(context))) {
return; return;
} }
@ -159,23 +161,24 @@ class _RequestDeviceTransferState extends State<RequestDeviceTransfer> {
}, },
), ),
8.height, 8.height,
// SingleItemDropDownMenu<Department, NullableLoadingProvider>( SingleItemDropDownMenu<Rooms, NullableLoadingProvider>(
// context: context, context: context,
// title: context.translation.room, title: context.translation.room,
// initialValue: _assetDestination?.department, initialValue: _assetDestination?.room,
// enabled: _assetDestination?.floor?.departments?.isNotEmpty ?? false, enabled: _assetDestination?.department?.rooms?.isNotEmpty ?? false,
// staticData: _assetDestination?.floor?.departments ?? [], staticData: _assetDestination?.department?.rooms ?? [],
// onSelect: (value) { onSelect: (value) {
// _assetDestination?.department = value; _assetDestination?.room = value;
// }, _transferModel.destRoom = value.clientRoomId;
// ),
8.height,
AppTextFormField(
labelText: context.translation.room,
onSaved: (text) {
_transferModel.destRoom = text;
}, },
), ),
8.height,
// AppTextFormField(
// labelText: context.translation.room,
// onSaved: (text) {
// _transferModel.destRoom = text;
// },
// ),
16.height, 16.height,
context.translation.comments.heading5(context), context.translation.comments.heading5(context),
8.height, 8.height,
@ -183,7 +186,7 @@ class _RequestDeviceTransferState extends State<RequestDeviceTransfer> {
controller: _commentsController, controller: _commentsController,
labelText: context.translation.comments, labelText: context.translation.comments,
onSaved: (text) { onSaved: (text) {
_transferModel.senderComment = text; _transferModel.comment = text;
}, },
), ),
100.height, 100.height,

Loading…
Cancel
Save