|
|
|
|
@ -134,40 +134,53 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context),
|
|
|
|
|
8.height,
|
|
|
|
|
// sender card
|
|
|
|
|
_buildCard(
|
|
|
|
|
isSender: true,
|
|
|
|
|
site: _model?.senderSiteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
dept: _model?.senderDepartmentName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
building: _model?.senderBuildingName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
floor: _model?.senderFloorName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
comment: _model?.senderComment ?? "",
|
|
|
|
|
statusLabel: _model?.senderMachineStatusName != null
|
|
|
|
|
? StatusLabel(
|
|
|
|
|
label: _model!.senderMachineStatusName!,
|
|
|
|
|
id: _model!.senderMachineStatusId!.toInt(),
|
|
|
|
|
textColor: AppColor.getRequestStatusTextColorByName(context, _model!.senderMachineStatusName!),
|
|
|
|
|
backgroundColor: AppColor.getRequestStatusColorByName(context, _model!.senderMachineStatusName!),
|
|
|
|
|
)
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
// receiver card
|
|
|
|
|
_buildCard(
|
|
|
|
|
isSender: false,
|
|
|
|
|
site: _model?.destSiteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
dept: _model?.destDepartmentName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
building: _model?.destBuildingName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
floor: _model?.destFloorName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
comment: _model?.receiverComment ?? "",
|
|
|
|
|
statusLabel: _model?.receiverMachineStatusName != null
|
|
|
|
|
? StatusLabel(
|
|
|
|
|
label: _model!.receiverMachineStatusName ?? "",
|
|
|
|
|
id: _model!.receiverMachineStatusId!.toInt(),
|
|
|
|
|
textColor: AppColor.getRequestStatusTextColorByName(context, _model!.receiverMachineStatusName!),
|
|
|
|
|
backgroundColor: AppColor.getRequestStatusColorByName(context, _model!.receiverMachineStatusName!))
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
if (_model?.transferType?.value == 1) ...[
|
|
|
|
|
_internalRequestDetailsCard(
|
|
|
|
|
statusLabel: _model?.senderMachineStatusName != null
|
|
|
|
|
? StatusLabel(
|
|
|
|
|
label: _model!.senderMachineStatusName!,
|
|
|
|
|
id: _model!.senderMachineStatusId!.toInt(),
|
|
|
|
|
textColor: AppColor.getRequestStatusTextColorByName(context, _model!.senderMachineStatusName!),
|
|
|
|
|
backgroundColor: AppColor.getRequestStatusColorByName(context, _model!.senderMachineStatusName!),
|
|
|
|
|
)
|
|
|
|
|
: null,
|
|
|
|
|
)
|
|
|
|
|
] else ...[
|
|
|
|
|
// sender card
|
|
|
|
|
_buildCard(
|
|
|
|
|
isSender: true,
|
|
|
|
|
site: _model?.senderSiteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
dept: _model?.senderDepartmentName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
building: _model?.senderBuildingName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
floor: _model?.senderFloorName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
comment: _model?.senderComment ?? "",
|
|
|
|
|
statusLabel: _model?.senderMachineStatusName != null
|
|
|
|
|
? StatusLabel(
|
|
|
|
|
label: _model!.senderMachineStatusName!,
|
|
|
|
|
id: _model!.senderMachineStatusId!.toInt(),
|
|
|
|
|
textColor: AppColor.getRequestStatusTextColorByName(context, _model!.senderMachineStatusName!),
|
|
|
|
|
backgroundColor: AppColor.getRequestStatusColorByName(context, _model!.senderMachineStatusName!),
|
|
|
|
|
)
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
// receiver card
|
|
|
|
|
_buildCard(
|
|
|
|
|
isSender: false,
|
|
|
|
|
site: _model?.destSiteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
dept: _model?.destDepartmentName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
building: _model?.destBuildingName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
floor: _model?.destFloorName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
comment: _model?.receiverComment ?? "",
|
|
|
|
|
statusLabel: _model?.receiverMachineStatusName != null
|
|
|
|
|
? StatusLabel(
|
|
|
|
|
label: _model!.receiverMachineStatusName ?? "",
|
|
|
|
|
id: _model!.receiverMachineStatusId!.toInt(),
|
|
|
|
|
textColor: AppColor.getRequestStatusTextColorByName(context, _model!.receiverMachineStatusName!),
|
|
|
|
|
backgroundColor: AppColor.getRequestStatusColorByName(context, _model!.receiverMachineStatusName!))
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
).paddingAll(16),
|
|
|
|
|
),
|
|
|
|
|
@ -180,39 +193,67 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Widget attachmentWidget() {
|
|
|
|
|
// _attachments.forEach((abc) {
|
|
|
|
|
// print(abc);
|
|
|
|
|
// });
|
|
|
|
|
//
|
|
|
|
|
// return Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// 8.height,
|
|
|
|
|
// if (_attachments.isNotEmpty) ...[
|
|
|
|
|
// const Divider().defaultStyle(context),
|
|
|
|
|
// context.translation.attachments.bodyText(context),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// MultiFilesPicker(
|
|
|
|
|
// label: context.translation.attachments,
|
|
|
|
|
// files: _attachments,
|
|
|
|
|
// enabled: false,
|
|
|
|
|
// onlyImages: false,
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ],
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
_buildTextWidget(String text) {
|
|
|
|
|
return text.bodyText(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_internalRequestDetailsCard({StatusLabel? statusLabel}) {
|
|
|
|
|
bool isCurrentEngineerEligibleForEdit = _model?.senderAssignedEmployeeId == _userProvider!.user?.userID;
|
|
|
|
|
|
|
|
|
|
// bool isCurrentRequestEditAble = ((_model?.senderMachineStatusName?.toLowerCase().contains("close") ?? false));
|
|
|
|
|
bool isCurrentRequestEditAble = (!(_model?.senderMachineStatusValue==3));
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
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(() {});
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
context.translation.details.heading5(context),
|
|
|
|
|
infoText(label: context.translation.site, value: _model?.senderSiteName),
|
|
|
|
|
infoText(label: "Sender Building".addTranslation, value: _model?.senderBuildingName),
|
|
|
|
|
infoText(label: "Sender Floor".addTranslation, value: _model?.senderFloorName),
|
|
|
|
|
infoText(label: "Sender Department".addTranslation, value: _model?.senderDepartmentName),
|
|
|
|
|
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) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
Text(
|
|
|
|
|
"Technical Comments".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
_buildTextWidget(_model?.comment ?? ''),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_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?.senderMachineStatusName?.toLowerCase().contains("close") ?? false)) : ((_model?.receiverMachineStatusName?.toLowerCase().contains("close") ?? false));
|
|
|
|
|
isSender ? ((_model?.senderMachineStatusValue==3)) : ((_model?.receiverMachineStatusValue==3));
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
@ -235,7 +276,6 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
// ? (!(_model?.senderMachineStatusName?.toLowerCase()?.contains("close") ?? false) && !(_model?.senderMachineStatusName?.toLowerCase()?.contains("complete") ?? false))
|
|
|
|
|
// : (!(_model?.receiverMachineStatusName?.toLowerCase()?.contains("close") ?? false) && !(_model?.receiverMachineStatusName?.toLowerCase()?.contains("complete") ?? false)))
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
"edit".toSvgAsset(height: 48, width: 48).onPress(() async {
|
|
|
|
|
bool isReload = (await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model!, isSender: isSender)))) as bool;
|
|
|
|
|
if (isReload ?? false) {
|
|
|
|
|
|