|
|
|
|
@ -13,6 +13,7 @@ import 'package:test_sa/views/pages/device_transfer/update_device_transfer.dart'
|
|
|
|
|
import 'package:test_sa/views/widgets/images/files_list.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
|
|
|
|
|
import '../../../extensions/text_extensions.dart';
|
|
|
|
|
import '../../../models/enums/user_types.dart';
|
|
|
|
|
import '../../../new_views/app_style/app_color.dart';
|
|
|
|
|
@ -57,131 +58,135 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
} else {
|
|
|
|
|
_model = snapshot.data as DeviceTransfer?;
|
|
|
|
|
_attachments = _model?.assetTransferAttachments?.map((e) => File(e.attachmentName ?? '')).toList() ?? [];
|
|
|
|
|
return Form(
|
|
|
|
|
key: _formKey,
|
|
|
|
|
child: LoadingManager(
|
|
|
|
|
isLoading: _isLoading,
|
|
|
|
|
isFailedLoading: false,
|
|
|
|
|
stateCode: 200,
|
|
|
|
|
onRefresh: () async {},
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Transfer Details".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
_buildTextWidget('${context.translation.requestNo} : ${_model?.transferCode ?? ""}'),
|
|
|
|
|
_buildTextWidget('${context.translation.transferType} : ${_model?.transferType?.name ?? ""}'),
|
|
|
|
|
_buildTextWidget('${context.translation.createdBy} : ${_model?.name ?? ""}'),
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
Text(
|
|
|
|
|
"Asset Info".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
_buildTextWidget('${context.translation.assetName} : ${_model?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? ""}'),
|
|
|
|
|
_buildTextWidget('${context.translation.assetNumber} : ${_model?.assetNumber ?? ""}'),
|
|
|
|
|
_buildTextWidget('${context.translation.model} : ${_model?.modelName ?? ""}'),
|
|
|
|
|
_buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo ?? ""}'),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
_contactInfo(),
|
|
|
|
|
if ((_model?.comment ?? "").isNotEmpty) ...[
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
return _model != null
|
|
|
|
|
? Form(
|
|
|
|
|
key: _formKey,
|
|
|
|
|
child: LoadingManager(
|
|
|
|
|
isLoading: _isLoading,
|
|
|
|
|
isFailedLoading: false,
|
|
|
|
|
stateCode: 200,
|
|
|
|
|
onRefresh: () async {},
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Comments".addTranslation,
|
|
|
|
|
"Transfer Details".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
_buildTextWidget(_model!.comment!),
|
|
|
|
|
],
|
|
|
|
|
if (_attachments.isNotEmpty) ...[
|
|
|
|
|
_buildTextWidget('${context.translation.requestNo} : ${_model?.transferCode ?? ""}'),
|
|
|
|
|
_buildTextWidget('${context.translation.transferType} : ${_model?.transferType?.name ?? ""}'),
|
|
|
|
|
_buildTextWidget('${context.translation.createdBy} : ${_model?.name ?? ""}'),
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
Text(
|
|
|
|
|
"Attachments".addTranslation,
|
|
|
|
|
"Asset Info".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
FilesList(images: _model?.assetTransferAttachments?.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
|
|
|
|
|
//attachmentWidget(),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
_buildTextWidget('${context.translation.assetName} : ${_model?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? ""}'),
|
|
|
|
|
_buildTextWidget('${context.translation.assetNumber} : ${_model?.assetNumber ?? ""}'),
|
|
|
|
|
_buildTextWidget('${context.translation.model} : ${_model?.modelName ?? ""}'),
|
|
|
|
|
_buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo ?? ""}'),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
_contactInfo(),
|
|
|
|
|
if ((_model?.comment ?? "").isNotEmpty) ...[
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
Text(
|
|
|
|
|
"Comments".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
_buildTextWidget(_model!.comment!),
|
|
|
|
|
],
|
|
|
|
|
if (_attachments.isNotEmpty) ...[
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
Text(
|
|
|
|
|
"Attachments".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
FilesList(images: _model?.assetTransferAttachments?.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
|
|
|
|
|
//attachmentWidget(),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
1.width,
|
|
|
|
|
Text(
|
|
|
|
|
_model?.createdOn != null ? _model!.createdOn!.toServiceRequestCardFormat : "",
|
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
|
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context),
|
|
|
|
|
8.height,
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
1.width,
|
|
|
|
|
Text(
|
|
|
|
|
_model?.createdOn != null ? _model!.createdOn!.toServiceRequestCardFormat : "",
|
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
|
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context),
|
|
|
|
|
8.height,
|
|
|
|
|
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),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
],
|
|
|
|
|
).paddingAll(16),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: const Center(
|
|
|
|
|
child: NoDataFound(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|