ATOMS-857 fixed

design_3.0_task_module_new
WaseemAbbasi22 6 months ago
parent ef7722ab2a
commit eeafda869a

@ -548,5 +548,6 @@
"rejectionDetails": "تفاصيل الرفض",
"part": "جزء",
"creationDate": "تاريخ الإنشاء",
"transferType": "نوع النقل"
"transferType": "نوع النقل",
"createdBy": "تم الإنشاء بواسطة"
}

@ -548,5 +548,6 @@
"since": "Since",
"rejectionDetails": "Rejection Details",
"part": "Part",
"creationDate": "Creation Date"
"creationDate": "Creation Date",
"createdBy": "Created BY"
}

@ -1,6 +1,3 @@
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/asset.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/new_models/assistant_employee.dart';
@ -49,6 +46,7 @@ class DeviceTransfer {
this.receiverEngSignature,
this.receiverAttachments,
this.assetTransferAttachments,
this.assetTransferContactPersons,
this.attachments,
this.assetNumber,
this.assetName,
@ -134,6 +132,12 @@ class DeviceTransfer {
assetTransferAttachments?.add(AssetTransferAttachment.fromJson(v));
});
}
if (json['assetTransferContactPersons'] != null) {
assetTransferContactPersons = [];
json['assetTransferContactPersons'].forEach((v) {
assetTransferContactPersons?.add(AssetTransferContactPerson.fromJson(v));
});
}
receiverAssignedEmployeeId = json['receiverAssignedEmployeeId'];
receiverMachineStatusId = json['receiverMachineStatusId'];
receiverMachineStatusValue = json['receiverMachineStatusValue'];
@ -299,9 +303,8 @@ class DeviceTransfer {
List<TimerModel>? timerModelList = [];
List<AssistantEmployees>? assistantEmployees;
List<AssetTransferAssistantEmployees>? assetTransferAssistantEmployeesSender;
List<AssetTransferAssistantEmployees>? assetTransferAssistantEmployeesReceiver;
List<AssetTransferContactPerson>? assetTransferContactPersons;
AssetTransferAssistantEmployees? modelAssistantEmployees;
TimerModel? tbsTimer = TimerModel();
@ -693,32 +696,33 @@ class DeviceTransfer {
manufacturerName = assetTransfer.manufacturerName;
senderVisitTimers = assetTransfer.senderVisitTimers;
receiverVisitTimers = assetTransfer.receiverVisitTimers;
assetTransferAttachments=assetTransfer.assetTransferAttachments;
assetTransferAttachments = assetTransfer.assetTransferAttachments;
assetTransferAssistantEmployeesReceiver = assetTransfer.assetTransferAssistantEmployeesReceiver;
assetTransferAssistantEmployeesSender = assetTransfer.assetTransferAssistantEmployeesSender;
senderMachineStatusValue = assetTransfer.senderMachineStatusValue;
receiverMachineStatusValue = assetTransfer.receiverMachineStatusValue;
assetTransferContactPersons = assetTransfer.assetTransferContactPersons;
}
//
// Future<bool> validate(BuildContext context) async {
// if (assetId == null) {
// await Fluttertoast.showToast(msg: "${context.translation.youHaveToSelect} ${context.translation.device}");
// return false;
// } else if (destSiteId == null) {
// await Fluttertoast.showToast(msg: "${context.translation.youHaveToSelect} ${context.translation.destinationSite}");
// return false;
// } else if (destBuildingId == null) {
// await Fluttertoast.showToast(msg: "${context.translation.youHaveToSelect} ${context.translation.building}");
// return false;
// } else if (destFloorId == null) {
// await Fluttertoast.showToast(msg: "${context.translation.youHaveToSelect} ${context.translation.floor}");
// return false;
// } else if (destDepartmentId == null) {
// await Fluttertoast.showToast(msg: "${context.translation.youHaveToSelect} ${context.translation.department}");
// return false;
// }
// return true;
// }
//
// Future<bool> validate(BuildContext context) async {
// if (assetId == null) {
// await Fluttertoast.showToast(msg: "${context.translation.youHaveToSelect} ${context.translation.device}");
// return false;
// } else if (destSiteId == null) {
// await Fluttertoast.showToast(msg: "${context.translation.youHaveToSelect} ${context.translation.destinationSite}");
// return false;
// } else if (destBuildingId == null) {
// await Fluttertoast.showToast(msg: "${context.translation.youHaveToSelect} ${context.translation.building}");
// return false;
// } else if (destFloorId == null) {
// await Fluttertoast.showToast(msg: "${context.translation.youHaveToSelect} ${context.translation.floor}");
// return false;
// } else if (destDepartmentId == null) {
// await Fluttertoast.showToast(msg: "${context.translation.youHaveToSelect} ${context.translation.department}");
// return false;
// }
// return true;
// }
}
class AssetTransferAssistantEmployees {
@ -759,3 +763,47 @@ class AssetTransferAssistantEmployees {
return data;
}
}
class AssetTransferContactPerson {
int? id;
String? employeeId;
String? employeeNumber;
String? employeeName;
String? email;
String? mobileNo;
String? extension;
AssetTransferContactPerson({
this.id,
this.employeeId,
this.employeeNumber,
this.employeeName,
this.email,
this.mobileNo,
this.extension,
});
factory AssetTransferContactPerson.fromJson(Map<String, dynamic> json) {
return AssetTransferContactPerson(
id: json['id'],
employeeId: json['employeeId'],
employeeNumber: json['employeeNumber'],
employeeName: json['employeeName'],
email: json['email'],
mobileNo: json['mobileNo'],
extension: json['extension'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'employeeId': employeeId,
'employeeNumber': employeeNumber,
'employeeName': employeeName,
'email': email,
'mobileNo': mobileNo,
'extension': extension,
};
}
}

@ -79,6 +79,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
),
_buildTextWidget('${context.translation.requestNo} : ${_model?.transferCode ?? ""}'),
_buildTextWidget('${context.translation.transferType} : ${_model?.transferType?.name ?? ""}'),
const Divider().defaultStyle(context),
Text(
"Asset Info".addTranslation,
@ -91,16 +92,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider().defaultStyle(context),
Text(
"Contact Info".addTranslation,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
if (_model?.receiverEndUserName != null) _buildTextWidget('${context.translation.receiverName} : ${_model?.receiverEndUserName ?? ""}'),
infoText(label: context.translation.employeeId, value: _model?.employeeId),
infoText(label: context.translation.name, value: _model?.name),
// infoText(label: context.translation.telephone, value: _model?.te),
_contactInfo(),
if ((_model?.comment ?? "").isNotEmpty) ...[
const Divider().defaultStyle(context),
Text(
@ -197,14 +189,13 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
);
}
_buildTextWidget(String text) {
return text.bodyText(context);
}
_internalRequestDetailsCard({StatusLabel? statusLabel}) {
bool isCurrentEngineerEligibleForEdit = _model?.senderAssignedEmployeeId == _userProvider!.user?.userID;
bool isCurrentRequestEditAble = (!(_model?.senderMachineStatusValue==3));
bool isCurrentRequestEditAble = (!(_model?.senderMachineStatusValue == 3));
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -216,17 +207,16 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
children: [
statusLabel ?? Container(),
if (statusLabel != null) 8.height,
],
),
if ((_userProvider!.user?.type == UsersTypes.engineer))
if (isCurrentEngineerEligibleForEdit && isCurrentRequestEditAble)
"edit".toSvgAsset(height: 40, width: 40).onPress(() async {
bool isReload = (await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model!, isSender: true)))) as bool;
if (isReload ?? false) {
setState(() {});
}
}),
"edit".toSvgAsset(height: 40, width: 40).onPress(() async {
bool isReload = (await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model!, isSender: true)))) as bool;
if (isReload ?? false) {
setState(() {});
}
}),
],
),
context.translation.details.heading5(context),
@ -237,14 +227,14 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
infoText(label: "Receiver Building".addTranslation, value: _model?.destBuildingName),
infoText(label: "Receiver Floor".addTranslation, value: _model?.destFloorName),
infoText(label: "Receiver Department".addTranslation, value: _model?.destDepartmentName),
if (_model!.comment != null && _model!.comment!.isNotEmpty) ...[
if (_model!.senderComment != null && _model!.senderComment!.isNotEmpty) ...[
8.height,
const Divider().defaultStyle(context),
Text(
"Technical Comments".addTranslation,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
_buildTextWidget(_model?.comment ?? ''),
_buildTextWidget(_model?.senderComment ?? ''),
]
],
).toShadowContainer(context);
@ -253,8 +243,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
_buildCard({required String site, String? building, String? dept, String? floor, required String comment, required bool isSender, StatusLabel? statusLabel}) {
bool isCurrentEngineerEligibleForEdit = isSender ? _model?.senderAssignedEmployeeId == _userProvider!.user?.userID : _model?.receiverAssignedEmployeeId == _userProvider!.user?.userID;
bool isCurrentRequestClosed =
isSender ? ((_model?.senderMachineStatusValue==3)) : ((_model?.receiverMachineStatusValue==3));
bool isCurrentRequestClosed = isSender ? ((_model?.senderMachineStatusValue == 3)) : ((_model?.receiverMachineStatusValue == 3));
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -302,6 +291,42 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
).toShadowContainer(context);
}
Widget _contactInfo() {
if (_model?.assetTransferContactPersons != null && _model!.assetTransferContactPersons!.isNotEmpty) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider().defaultStyle(context),
Text(
"Contact Info".addTranslation,
style: AppTextStyles.heading6.copyWith(
color: context.isDark ? AppColor.neutral30 : AppColor.neutral50,
),
),
..._model!.assetTransferContactPersons!.asMap().entries.map((entry) {
final index = entry.key;
final person = entry.value;
final isLast = index == _model!.assetTransferContactPersons!.length - 1;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 8),
infoText(label: context.translation.employeeId, value: person.employeeNumber),
infoText(label: context.translation.name, value: person.employeeName),
infoText(label: context.translation.email, value: person.email),
infoText(label: context.translation.phoneNumber, value: person.mobileNo),
infoText(label: context.translation.extensionNo, value: person.extension),
if (!isLast && _model!.assetTransferContactPersons!.length > 1) const Divider().defaultStyle(context),
],
);
}).toList(),
],
);
}
return const SizedBox();
}
Widget infoText({
String? label,
String? value,

@ -1305,10 +1305,10 @@ packages:
dependency: "direct main"
description:
name: record_mp3_plus
sha256: bf0b3f3ed96227a289ddf71605eb5370e5d43b8a2c17429ec55e60ace03d76e9
sha256: "654e2eb4ef028c1eaf73b981e9e2abd3756c61b0ee88dc6bc60416c474fbce5d"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.3.0"
rive:
dependency: "direct main"
description:

Loading…
Cancel
Save