|
|
|
|
@ -8,7 +8,7 @@ import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/models/device/asset_transfer.dart';
|
|
|
|
|
import 'package:test_sa/models/device/device_transfer.dart';
|
|
|
|
|
import 'package:test_sa/views/pages/device_transfer/update_device_transfer.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/images/multi_image_picker.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
|
|
|
|
|
@ -21,7 +21,7 @@ import '../../../new_views/common_widgets/default_app_bar.dart';
|
|
|
|
|
import '../../widgets/requests/request_status.dart';
|
|
|
|
|
|
|
|
|
|
class DeviceTransferDetails extends StatefulWidget {
|
|
|
|
|
final AssetTransfer model;
|
|
|
|
|
final DeviceTransfer model;
|
|
|
|
|
|
|
|
|
|
const DeviceTransferDetails({Key? key, required this.model}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@ -31,7 +31,7 @@ class DeviceTransferDetails extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
UserProvider? _userProvider;
|
|
|
|
|
AssetTransfer? _model;
|
|
|
|
|
DeviceTransfer? _model;
|
|
|
|
|
final bool _isLoading = false;
|
|
|
|
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
|
List<File> _attachments = [];
|
|
|
|
|
@ -56,7 +56,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
|
|
|
return const ALoading();
|
|
|
|
|
} else {
|
|
|
|
|
_model = snapshot.data as AssetTransfer?;
|
|
|
|
|
_model = snapshot.data as DeviceTransfer?;
|
|
|
|
|
_attachments = _model?.assetTransferAttachments?.map((e) => File(e.attachmentName ?? '')).toList() ?? [];
|
|
|
|
|
return Form(
|
|
|
|
|
key: _formKey,
|
|
|
|
|
@ -65,89 +65,91 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
isFailedLoading: false,
|
|
|
|
|
stateCode: 200,
|
|
|
|
|
onRefresh: () async {},
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
context.translation.transferDetails.heading5(context),
|
|
|
|
|
8.height,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
_buildTextWidget('${context.translation.transferType} : ${_model?.transferType?.name ?? ""}'),
|
|
|
|
|
_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 ?? ""}'),
|
|
|
|
|
if (_model?.receiverEndUserName != null) _buildTextWidget('${context.translation.receiverName} : ${_model?.receiverEndUserName ?? ""}'),
|
|
|
|
|
_buildTextWidget('${context.translation.requestNo} : ${_model?.transferCode ?? ""}'),
|
|
|
|
|
infoText(label: context.translation.employeeId, value: _model?.employeeId),
|
|
|
|
|
infoText(label: context.translation.name, value: _model?.name),
|
|
|
|
|
infoText(label: context.translation.createdDate, value: _model?.createdDate?.toInitialVisitCardFormat),
|
|
|
|
|
if ((_model?.comment ?? "").isNotEmpty) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
8.height,
|
|
|
|
|
_buildTextWidget(_model!.comment!),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
context.translation.transferDetails.heading5(context),
|
|
|
|
|
8.height,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
_buildTextWidget('${context.translation.requestNo} : ${_model?.transferCode ?? ""}'),
|
|
|
|
|
_buildTextWidget('${context.translation.transferType} : ${_model?.transferType?.name ?? ""}'),
|
|
|
|
|
_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 ?? ""}'),
|
|
|
|
|
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.createdDate, value: _model?.createdDate?.toInitialVisitCardFormat),
|
|
|
|
|
if ((_model?.comment ?? "").isNotEmpty) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
8.height,
|
|
|
|
|
_buildTextWidget(_model!.comment!),
|
|
|
|
|
],
|
|
|
|
|
if (_attachments.isNotEmpty) ...[
|
|
|
|
|
attachmentWidget(),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
if (_attachments.isNotEmpty) ...[
|
|
|
|
|
attachmentWidget(),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
],
|
|
|
|
|
).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,
|
|
|
|
|
// sender card
|
|
|
|
|
_buildCard(
|
|
|
|
|
isSender: true,
|
|
|
|
|
site: _model?.senderSiteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
unit: _model?.senderDepartmentName?.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 ?? "",
|
|
|
|
|
unit: _model?.destDepartmentName?.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),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
],
|
|
|
|
|
).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,
|
|
|
|
|
// sender card
|
|
|
|
|
_buildCard(
|
|
|
|
|
isSender: true,
|
|
|
|
|
site: _model?.senderSiteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
unit: _model?.senderDepartmentName?.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 ?? "",
|
|
|
|
|
unit: _model?.destDepartmentName?.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),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|