|
|
|
|
@ -1,8 +1,7 @@
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/asset_transfer_provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/device_transfer_provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
@ -13,7 +12,6 @@ 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';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../extensions/text_extensions.dart';
|
|
|
|
|
import '../../../models/enums/user_types.dart';
|
|
|
|
|
import '../../../new_views/app_style/app_color.dart';
|
|
|
|
|
@ -51,7 +49,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
key: _scaffoldKey,
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
child: FutureBuilder(
|
|
|
|
|
future: Provider.of<AssetTransferProvider>(context).getRequestById(assetTransferId: widget.model.id?.toInt()),
|
|
|
|
|
future: Provider.of<DeviceTransferProvider>(context).getRequestById(assetTransferId: widget.model.id?.toInt()),
|
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
|
|
|
return const ALoading();
|
|
|
|
|
@ -74,30 +72,44 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
context.translation.transferDetails.heading5(context),
|
|
|
|
|
8.height,
|
|
|
|
|
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 ?? ""}'),
|
|
|
|
|
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: [
|
|
|
|
|
_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 ?? ""}'),
|
|
|
|
|
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.createdDate, value: _model?.createdDate?.toInitialVisitCardFormat),
|
|
|
|
|
// infoText(label: context.translation.telephone, value: _model?.te),
|
|
|
|
|
|
|
|
|
|
if ((_model?.comment ?? "").isNotEmpty) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
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) ...[
|
|
|
|
|
attachmentWidget(),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
@ -121,7 +133,9 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
_buildCard(
|
|
|
|
|
isSender: true,
|
|
|
|
|
site: _model?.senderSiteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
unit: _model?.senderDepartmentName?.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(
|
|
|
|
|
@ -137,7 +151,9 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
_buildCard(
|
|
|
|
|
isSender: false,
|
|
|
|
|
site: _model?.destSiteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
|
|
|
|
|
unit: _model?.destDepartmentName?.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(
|
|
|
|
|
@ -160,13 +176,14 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget attachmentWidget() {
|
|
|
|
|
return Column(
|
|
|
|
|
return _attachments.isNotEmpty? Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
8.height,
|
|
|
|
|
if (_attachments.isNotEmpty) ...[
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
context.translation.attachments.bodyText(context),
|
|
|
|
|
Text(
|
|
|
|
|
"Attachments".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
MultiFilesPicker(
|
|
|
|
|
label: context.translation.attachments,
|
|
|
|
|
@ -175,15 +192,14 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
onlyImages: false,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
):const SizedBox();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_buildTextWidget(String text) {
|
|
|
|
|
return text.bodyText(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_buildCard({required String site, required String unit, required String comment, required bool isSender, StatusLabel? statusLabel}) {
|
|
|
|
|
_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 =
|
|
|
|
|
@ -219,12 +235,17 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
_buildTextWidget('${context.translation.site} : $site'),
|
|
|
|
|
_buildTextWidget('${context.translation.department} : $unit'),
|
|
|
|
|
infoText(label: context.translation.site, value: site),
|
|
|
|
|
infoText(label: context.translation.building, value: building),
|
|
|
|
|
infoText(label: context.translation.floor, value: floor),
|
|
|
|
|
infoText(label: context.translation.department, value: dept),
|
|
|
|
|
if (comment.isNotEmpty) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
"Technical Comments".addTranslation,
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
_buildTextWidget(comment),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
|