|
|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/localization/localization.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/asset_transfer_provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
|
@ -12,11 +11,8 @@ import 'package:test_sa/models/device/asset_transfer.dart';
|
|
|
|
|
import 'package:test_sa/views/app_style/colors.dart';
|
|
|
|
|
import 'package:test_sa/views/app_style/sizing.dart';
|
|
|
|
|
import 'package:test_sa/views/pages/device_transfer/update_device_transfer.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/buttons/app_small_button.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/requests/info_row.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../extensions/text_extensions.dart';
|
|
|
|
|
import '../../../models/enums/user_types.dart';
|
|
|
|
|
@ -73,31 +69,12 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
_buildDetailsCard(
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
/// TBD
|
|
|
|
|
// StatusLabel(
|
|
|
|
|
// label: "",
|
|
|
|
|
// id: 0,
|
|
|
|
|
// textColor: AColors.getPriorityStatusTextColor(0),
|
|
|
|
|
// backgroundColor: AColors.getPriorityStatusColor(0)),
|
|
|
|
|
8.width,
|
|
|
|
|
/// TBD
|
|
|
|
|
//StatusLabel(label: '', textColor: AColors.getRequestStatusTextColor(0), backgroundColor: AColors.getRequestStatusColor(0)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
1.width.expanded,
|
|
|
|
|
Text(widget.model.createdOn != null ?widget.model.createdOn.toServiceRequestCardFormat:"", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(context.translation.transferDetails, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
|
8.height,
|
|
|
|
|
Column(
|
|
|
|
|
@ -111,35 +88,68 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
],
|
|
|
|
|
).paddingAll(14)
|
|
|
|
|
).expanded,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
/// TBD
|
|
|
|
|
// Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// /// TBD
|
|
|
|
|
// // StatusLabel(
|
|
|
|
|
// // label: "",
|
|
|
|
|
// // id: 0,
|
|
|
|
|
// // textColor: AColors.getPriorityStatusTextColor(0),
|
|
|
|
|
// // backgroundColor: AColors.getPriorityStatusColor(0)),
|
|
|
|
|
// 8.width,
|
|
|
|
|
//
|
|
|
|
|
// /// TBD
|
|
|
|
|
// //StatusLabel(label: '', textColor: AColors.getRequestStatusTextColor(0), backgroundColor: AColors.getRequestStatusColor(0)),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
1.width,
|
|
|
|
|
Text(widget.model.createdOn != null ? widget.model.createdOn.toServiceRequestCardFormat : "",
|
|
|
|
|
textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).paddingAll(14),
|
|
|
|
|
),
|
|
|
|
|
// sender card
|
|
|
|
|
_buildCard(
|
|
|
|
|
isSender: true,
|
|
|
|
|
site: _model.senderSiteName ?? "",
|
|
|
|
|
|
|
|
|
|
/// TBD
|
|
|
|
|
unit: _model.senderDepartmentName ?? "",
|
|
|
|
|
comment: _model.senderComment ?? "",
|
|
|
|
|
|
|
|
|
|
/// TBD
|
|
|
|
|
statusLabel: _model.senderMachineStatusName != null? StatusLabel(
|
|
|
|
|
statusLabel: _model.senderMachineStatusName != null
|
|
|
|
|
? StatusLabel(
|
|
|
|
|
label: _model.senderMachineStatusName,
|
|
|
|
|
id: _model.senderMachineStatusId,
|
|
|
|
|
textColor: AColors.getRequestStatusTextColor(getIdstatus(_model.senderMachineStatusName)),
|
|
|
|
|
backgroundColor: AColors.getRequestStatusColor(getIdstatus(_model.senderMachineStatusName))):null,
|
|
|
|
|
backgroundColor: AColors.getRequestStatusColor(getIdstatus(_model.senderMachineStatusName)))
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
// receiver card
|
|
|
|
|
_buildCard(
|
|
|
|
|
isSender: false,
|
|
|
|
|
site: _model.destSiteName ?? "",
|
|
|
|
|
|
|
|
|
|
/// TBD
|
|
|
|
|
unit: _model.destDepartmentName ?? "",
|
|
|
|
|
comment: _model.receiverComment ?? "",
|
|
|
|
|
|
|
|
|
|
/// TBD
|
|
|
|
|
statusLabel: _model.receiverMachineStatusName != null ? StatusLabel(
|
|
|
|
|
statusLabel: _model.receiverMachineStatusName != null
|
|
|
|
|
? StatusLabel(
|
|
|
|
|
label: _model.receiverMachineStatusName ?? "",
|
|
|
|
|
id: _model.receiverMachineStatusId,
|
|
|
|
|
textColor: AColors.getRequestStatusTextColor(getIdstatus(_model.receiverMachineStatusName)),
|
|
|
|
|
backgroundColor: AColors.getRequestStatusColor(getIdstatus(_model.receiverMachineStatusName))):null,
|
|
|
|
|
backgroundColor: AColors.getRequestStatusColor(getIdstatus(_model.receiverMachineStatusName)))
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -164,7 +174,8 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
|
|
|
|
|
_buildTextWidget(String text) {
|
|
|
|
|
return Text(
|
|
|
|
|
text, style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
text,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -185,11 +196,10 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
children: [
|
|
|
|
|
statusLabel ?? Container(),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(isSender?context.translation.senderDetails:context.translation.receiverDetails,
|
|
|
|
|
style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
|
Text(isSender ? context.translation.senderDetails : context.translation.receiverDetails, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (_userProvider.user?.type == UsersTypes.engineer)
|
|
|
|
|
if ((_userProvider.user?.type == UsersTypes.engineer) && (isSender ? _model.senderMachineStatusName != "Closed" : _model.receiverMachineStatusName != "Closed"))
|
|
|
|
|
CircleAvatar(
|
|
|
|
|
radius: 25,
|
|
|
|
|
backgroundColor: AppColor.neutral30,
|
|
|
|
|
@ -201,26 +211,13 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
child: SvgPicture.asset('assets/images/update.svg'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
).onPress(
|
|
|
|
|
isSender ? _model.senderMachineStatusName == "Closed"
|
|
|
|
|
? null
|
|
|
|
|
: () {
|
|
|
|
|
Navigator.of(context).push(MaterialPageRoute(
|
|
|
|
|
builder: (_) => UpdateDeviceTransfer(
|
|
|
|
|
model: _model,
|
|
|
|
|
isSender: isSender,
|
|
|
|
|
)));
|
|
|
|
|
).onPress(isSender
|
|
|
|
|
? () {
|
|
|
|
|
Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model, isSender: isSender)));
|
|
|
|
|
}
|
|
|
|
|
: _model.receiverMachineStatusName == "Closed"
|
|
|
|
|
? null
|
|
|
|
|
: () {
|
|
|
|
|
Navigator.of(context).push(MaterialPageRoute(
|
|
|
|
|
builder: (_) => UpdateDeviceTransfer(
|
|
|
|
|
model: _model,
|
|
|
|
|
isSender: isSender,
|
|
|
|
|
)));
|
|
|
|
|
Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model, isSender: isSender)));
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
@ -253,5 +250,4 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|