|
|
|
|
@ -49,7 +49,7 @@ class _ServiceRequestDetailsPageState extends State<ServiceRequestDetailsPage> {
|
|
|
|
|
ServiceRequestsProvider _serviceRequestsProvider = Provider.of<ServiceRequestsProvider>(context);
|
|
|
|
|
// _serviceRequestsProvider.getServiceRequestObjectById(requestId: serviceRequest.id);
|
|
|
|
|
|
|
|
|
|
Widget informationCard() {
|
|
|
|
|
Widget informationCard(ServiceRequest serviceRequest) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
@ -66,32 +66,32 @@ class _ServiceRequestDetailsPageState extends State<ServiceRequestDetailsPage> {
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
StatusLabel(
|
|
|
|
|
label: widget.serviceRequest.priority.name,
|
|
|
|
|
id: widget.serviceRequest.priority.id,
|
|
|
|
|
textColor: AColors.getPriorityStatusTextColor(widget.serviceRequest.priority.id),
|
|
|
|
|
backgroundColor: AColors.getPriorityStatusColor(widget.serviceRequest.priority.id)),
|
|
|
|
|
label: serviceRequest.priority.name,
|
|
|
|
|
id: serviceRequest.priority.id,
|
|
|
|
|
textColor: AColors.getPriorityStatusTextColor(serviceRequest.priority.id),
|
|
|
|
|
backgroundColor: AColors.getPriorityStatusColor(serviceRequest.priority.id)),
|
|
|
|
|
8.width,
|
|
|
|
|
StatusLabel(
|
|
|
|
|
label: widget.serviceRequest.statusLabel,
|
|
|
|
|
textColor: AColors.getRequestStatusTextColor(widget.serviceRequest.statusValue),
|
|
|
|
|
backgroundColor: AColors.getRequestStatusColor(widget.serviceRequest.statusValue)),
|
|
|
|
|
label: serviceRequest.statusLabel,
|
|
|
|
|
textColor: AColors.getRequestStatusTextColor(serviceRequest.statusValue),
|
|
|
|
|
backgroundColor: AColors.getRequestStatusColor(serviceRequest.statusValue)),
|
|
|
|
|
1.width.expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(widget.serviceRequest.deviceEnName, style: AppTextStyles.heading5.copyWith(color: context.isDark?AppColor.neutral30: const Color(0xFF3B3D4A))),
|
|
|
|
|
Text(serviceRequest.deviceEnName, style: AppTextStyles.heading5.copyWith(color: context.isDark ? AppColor.neutral30 : const Color(0xFF3B3D4A))),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.assetNumber}: ${widget.serviceRequest.device.assetNumber}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark?AppColor.neutral10:Color(0xFF757575)),
|
|
|
|
|
'${context.translation.assetNumber}: ${serviceRequest.device.assetNumber}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.requestType}: ${widget.serviceRequest.type.name}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark?AppColor.neutral10:Color(0xFF757575)),
|
|
|
|
|
'${context.translation.requestType}: ${serviceRequest.type.name}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.requestNo}: ${widget.serviceRequest.requestCode}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark?AppColor.neutral10:Color(0xFF757575)),
|
|
|
|
|
'${context.translation.requestNo}: ${serviceRequest.requestCode}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
@ -100,10 +100,11 @@ class _ServiceRequestDetailsPageState extends State<ServiceRequestDetailsPage> {
|
|
|
|
|
children: [
|
|
|
|
|
if (_userProvider.user.type == UsersTypes.normal_user)
|
|
|
|
|
context.translation.code.toSvgAsset(width: 48).onPress(() {
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => UpdateServiceRequestPage(serviceRequest: widget.serviceRequest)));
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => UpdateServiceRequestPage(serviceRequest: serviceRequest)));
|
|
|
|
|
}),
|
|
|
|
|
if (_userProvider.user.type == UsersTypes.engineer) 16.height,
|
|
|
|
|
Text(widget.serviceRequest.date.toServiceRequestCardFormat, textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: context.isDark?AppColor.neutral30:const Color(0xFF3B3D4A))),
|
|
|
|
|
Text(serviceRequest.date.toServiceRequestCardFormat,
|
|
|
|
|
textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral30 : const Color(0xFF3B3D4A))),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
@ -112,34 +113,35 @@ class _ServiceRequestDetailsPageState extends State<ServiceRequestDetailsPage> {
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.manufacture}: ${widget.serviceRequest.device.modelDefinition.manufacturerName}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark?AppColor.neutral10:Color(0xFF757575)),
|
|
|
|
|
'${context.translation.manufacture}: ${serviceRequest.device.modelDefinition.manufacturerName}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.model}: ${widget.serviceRequest.device.modelDefinition.modelName}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark?AppColor.neutral10:Color(0xFF757575)),
|
|
|
|
|
'${context.translation.model}: ${serviceRequest.device.modelDefinition.modelName}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
if ((widget.serviceRequest.callComments ?? "").isNotEmpty) ...[
|
|
|
|
|
if ((serviceRequest.callComments ?? "").isNotEmpty) ...[
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
widget.serviceRequest.callComments,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark?AppColor.neutral10:Color(0xFF757575)),
|
|
|
|
|
serviceRequest.callComments,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
if (widget.serviceRequest.devicePhotos.isNotEmpty) ...[
|
|
|
|
|
if (serviceRequest.devicePhotos.isNotEmpty) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
FilesList(images: widget.serviceRequest.devicePhotos),
|
|
|
|
|
FilesList(images: serviceRequest.devicePhotos),
|
|
|
|
|
],
|
|
|
|
|
if (widget.serviceRequest.audio?.isNotEmpty ?? false) ...[
|
|
|
|
|
if (serviceRequest.audio?.isNotEmpty ?? false) ...[
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
16.height,
|
|
|
|
|
ASoundPlayer(audio: widget.serviceRequest.audio),
|
|
|
|
|
ASoundPlayer(audio: serviceRequest.audio),
|
|
|
|
|
8.height,
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
).paddingAll(16),
|
|
|
|
|
).paddingOnly(start: 16, end: 16, top: 16, bottom: 8),
|
|
|
|
|
(_userProvider.user.type == UsersTypes.normal_user
|
|
|
|
|
? Container(
|
|
|
|
|
height: 50,
|
|
|
|
|
@ -158,12 +160,12 @@ class _ServiceRequestDetailsPageState extends State<ServiceRequestDetailsPage> {
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.viewComments}...',
|
|
|
|
|
'${context.translation.commentHere}...',
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(
|
|
|
|
|
color: AppColor.neutral50.withOpacity(.6),
|
|
|
|
|
),
|
|
|
|
|
).expanded,
|
|
|
|
|
SvgPicture.asset("assets/images/comment_send.svg", width: 24 * AppStyle.getScaleFactor(context), height: 24 * AppStyle.getScaleFactor(context), color: AppColor.primary70),
|
|
|
|
|
SvgPicture.asset("assets/images/comment_send.svg", width: 24 * AppStyle.getScaleFactor(context), height: 20 * AppStyle.getScaleFactor(context), color: AppColor.primary70),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -190,17 +192,18 @@ class _ServiceRequestDetailsPageState extends State<ServiceRequestDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(bottom: 16, start: 16, end: 16))
|
|
|
|
|
.onPress(() async {
|
|
|
|
|
await showModalBottomSheet(
|
|
|
|
|
.onPress(() {
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
useSafeArea: true,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
useRootNavigator: true,
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
builder: (context) => CommentsBottomSheet(requestId: widget.serviceRequest.id),
|
|
|
|
|
builder: (context) => CommentsBottomSheet(requestId: serviceRequest.id),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context);
|
|
|
|
|
).toShadowContainer(context, padding: 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
@ -213,13 +216,13 @@ class _ServiceRequestDetailsPageState extends State<ServiceRequestDetailsPage> {
|
|
|
|
|
if (snap.connectionState == ConnectionState.waiting) {
|
|
|
|
|
return const ALoading();
|
|
|
|
|
} else if (snap.hasData) {
|
|
|
|
|
final serviceRequest = snap.data;
|
|
|
|
|
ServiceRequest serviceRequest = snap.data;
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SingleChildScrollView(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
child: informationCard(),
|
|
|
|
|
child: informationCard(serviceRequest),
|
|
|
|
|
).expanded,
|
|
|
|
|
if (_userProvider.user.type == UsersTypes.engineer || (serviceRequest.statusValue == 5 || serviceRequest.statusValue == 3))
|
|
|
|
|
(serviceRequest.firstAction == null
|
|
|
|
|
|