|
|
|
|
@ -5,11 +5,17 @@ import 'package:test_sa/controllers/localization/localization.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/service_requests_provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
|
|
|
|
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/text_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/models/enums/translation_keys.dart';
|
|
|
|
|
import 'package:test_sa/models/enums/user_types.dart';
|
|
|
|
|
import 'package:test_sa/models/service_request/service_request.dart';
|
|
|
|
|
import 'package:test_sa/models/subtitle.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/default_app_bar.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/user/requests/create_request.dart';
|
|
|
|
|
@ -44,9 +50,113 @@ class RequestDetailsPage extends StatelessWidget {
|
|
|
|
|
ServiceRequestsProvider _serviceRequestsProvider = Provider.of<ServiceRequestsProvider>(context);
|
|
|
|
|
_serviceRequestsProvider.getServiceRequestObjectById(requestId: serviceRequest.id);
|
|
|
|
|
|
|
|
|
|
Widget informationCard() {
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: ShapeDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(20),
|
|
|
|
|
),
|
|
|
|
|
shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 14, offset: Offset(0, 0), spreadRadius: 0)],
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
StatusLabel(
|
|
|
|
|
label: serviceRequest.priority.name,
|
|
|
|
|
id: serviceRequest.priority.id,
|
|
|
|
|
textColor: AColors.getPriorityStatusTextColor(serviceRequest.priority.id),
|
|
|
|
|
backgroundColor: AColors.getPriorityStatusColor(serviceRequest.priority.id)),
|
|
|
|
|
8.width,
|
|
|
|
|
StatusLabel(
|
|
|
|
|
label: serviceRequest.statusLabel,
|
|
|
|
|
textColor: AColors.getRequestStatusTextColor(serviceRequest.statusValue),
|
|
|
|
|
backgroundColor: AColors.getRequestStatusColor(serviceRequest.statusValue)),
|
|
|
|
|
1.width.expanded,
|
|
|
|
|
Text(serviceRequest.date.toServiceRequestCardFormat, textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(serviceRequest.deviceEnName, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
|
|
|
|
|
Text(
|
|
|
|
|
'${_subtitle.assetNumber}: ${serviceRequest.device.number}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'Request Type: ${serviceRequest.type.name}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'Request No: ${serviceRequest.requestCode}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
'Manufacture: ${serviceRequest.device.modelDefinition.manufacturerName}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'Model: ${serviceRequest.device.modelDefinition.modelName}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
8.height,
|
|
|
|
|
if ((serviceRequest.callComments ?? "").isNotEmpty) ...[
|
|
|
|
|
Text(
|
|
|
|
|
serviceRequest.callComments,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
],
|
|
|
|
|
if (serviceRequest.devicePhotos.isNotEmpty) ...[
|
|
|
|
|
FilesList(images: serviceRequest.devicePhotos),
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
],
|
|
|
|
|
if (serviceRequest.audio?.isNotEmpty == true) ...[
|
|
|
|
|
16.height,
|
|
|
|
|
ASoundPlayer(
|
|
|
|
|
audio: serviceRequest.audio,
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
],
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
'View Comments',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
|
|
|
|
|
),
|
|
|
|
|
4.width,
|
|
|
|
|
const Icon(
|
|
|
|
|
Icons.arrow_forward,
|
|
|
|
|
color: Color(0xFF4A8DB7),
|
|
|
|
|
size: 14,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).paddingAll(16),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DefaultTabController(
|
|
|
|
|
length: 2,
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
appBar: const DefaultAppBar(title: TranslationKeys.serviceRequest),
|
|
|
|
|
backgroundColor: const Color(0xfff8f9fb),
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
child: FutureBuilder(
|
|
|
|
|
future: _serviceRequestsProvider.getServiceRequestObjectById(requestId: serviceRequest.id),
|
|
|
|
|
@ -150,45 +260,6 @@ class RequestDetailsPage extends StatelessWidget {
|
|
|
|
|
images: serviceRequest.devicePhotos,
|
|
|
|
|
),
|
|
|
|
|
).paddingOnly(top: 4, bottom: 4),
|
|
|
|
|
|
|
|
|
|
// Column(
|
|
|
|
|
// children: [
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// MaterialButton(
|
|
|
|
|
// padding: EdgeInsets.zero,
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// Navigator.of(context).push(MaterialPageRoute(
|
|
|
|
|
// builder: (_) => Scaffold(
|
|
|
|
|
// body: InteractiveViewer(
|
|
|
|
|
// child: Center(
|
|
|
|
|
// child: ImageLoader(
|
|
|
|
|
// url: serviceRequest.devicePhotos.first,
|
|
|
|
|
// boxFit: BoxFit.contain,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// )));
|
|
|
|
|
// },
|
|
|
|
|
// child: SizedBox(
|
|
|
|
|
// height: 140 * AppStyle.getScaleFactor(context),
|
|
|
|
|
// width: MediaQuery.of(context).size.width,
|
|
|
|
|
// child: ImageLoader(
|
|
|
|
|
// url: serviceRequest.devicePhotos.first,
|
|
|
|
|
// boxFit: BoxFit.cover,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(height: 8),
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 60 * AppStyle.getScaleFactor(context),
|
|
|
|
|
// child: FilesList(
|
|
|
|
|
// images: serviceRequest.devicePhotos,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
TabBar(labelColor: AColors.primaryColor, tabs: [
|
|
|
|
|
Tab(
|
|
|
|
|
text: _subtitle.general,
|
|
|
|
|
@ -203,121 +274,127 @@ class RequestDetailsPage extends StatelessWidget {
|
|
|
|
|
Expanded(
|
|
|
|
|
child: TabBarView(
|
|
|
|
|
children: [
|
|
|
|
|
ListView(
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 16),
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.callId,
|
|
|
|
|
info: serviceRequest.requestCode,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: "Asset Number",
|
|
|
|
|
info: serviceRequest.deviceNumber,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.assetName,
|
|
|
|
|
info: serviceRequest.deviceEnName,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.deviceModel,
|
|
|
|
|
info: serviceRequest.deviceModel,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.engineerName,
|
|
|
|
|
info: serviceRequest.engineerName,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.engineerPhone,
|
|
|
|
|
info: serviceRequest.engineerMobile,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.date,
|
|
|
|
|
info: serviceRequest.date,
|
|
|
|
|
),
|
|
|
|
|
serviceRequest.nextVisitDate == null
|
|
|
|
|
? SizedBox.shrink()
|
|
|
|
|
: RequestInfoRow(
|
|
|
|
|
title: _subtitle.nextVisitDate,
|
|
|
|
|
info: DateFormat('EE dd/MM/yyyy').format(serviceRequest.nextVisitDate),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
ListView(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
"${_subtitle.status} : ",
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
textScaleFactor: AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
informationCard(),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.callId,
|
|
|
|
|
info: serviceRequest.requestCode,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: "Asset Number",
|
|
|
|
|
info: serviceRequest.deviceNumber,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.assetName,
|
|
|
|
|
info: serviceRequest.deviceEnName,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.deviceModel,
|
|
|
|
|
info: serviceRequest.deviceModel,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.engineerName,
|
|
|
|
|
info: serviceRequest.engineerName,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.engineerPhone,
|
|
|
|
|
info: serviceRequest.engineerMobile,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.date,
|
|
|
|
|
info: serviceRequest.date,
|
|
|
|
|
),
|
|
|
|
|
StatusLabel(label: serviceRequest.statusLabel, color: AColors.getRequestStatusColor(serviceRequest.statusValue)),
|
|
|
|
|
serviceRequest.nextVisitDate == null
|
|
|
|
|
? SizedBox.shrink()
|
|
|
|
|
: RequestInfoRow(
|
|
|
|
|
title: _subtitle.nextVisitDate,
|
|
|
|
|
info: DateFormat('EE dd/MM/yyyy').format(serviceRequest.nextVisitDate),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
"${_subtitle.status} : ",
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
textScaleFactor: AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
StatusLabel(label: serviceRequest.statusLabel, backgroundColor: AColors.getRequestStatusColor(serviceRequest.statusValue)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Divider(
|
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.hospital,
|
|
|
|
|
info: serviceRequest.hospitalName,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.unite,
|
|
|
|
|
info: serviceRequest.departmentName,
|
|
|
|
|
),
|
|
|
|
|
// RequestInfoRow(
|
|
|
|
|
// title: _subtitle.deviceArName,
|
|
|
|
|
// content: serviceRequest.deviceArName,
|
|
|
|
|
// ),
|
|
|
|
|
// RequestInfoRow(
|
|
|
|
|
// title: _subtitle.deviceName,
|
|
|
|
|
// content: serviceRequest.deviceEnName,
|
|
|
|
|
// ),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.maintenanceIssue,
|
|
|
|
|
content: serviceRequest.callComments,
|
|
|
|
|
),
|
|
|
|
|
if (serviceRequest.audio?.isNotEmpty == true)
|
|
|
|
|
ASoundPlayer(
|
|
|
|
|
audio: serviceRequest.audio,
|
|
|
|
|
),
|
|
|
|
|
//
|
|
|
|
|
// Center(
|
|
|
|
|
// child: Padding(
|
|
|
|
|
// padding: EdgeInsets.all(32),
|
|
|
|
|
// child: AButton(
|
|
|
|
|
// text: _subtitle.duplicateRequest,
|
|
|
|
|
// onPressed: () async {
|
|
|
|
|
// bool result = await showDialog(
|
|
|
|
|
// context: context,
|
|
|
|
|
// builder: (_) => AAlertDialog(
|
|
|
|
|
// title: _subtitle.duplicateAlert,
|
|
|
|
|
// content: _subtitle.duplicateAlertMessage,
|
|
|
|
|
// )
|
|
|
|
|
// );
|
|
|
|
|
// if(result == true){
|
|
|
|
|
// showDialog(
|
|
|
|
|
// context: context,
|
|
|
|
|
// builder: (context){
|
|
|
|
|
// return Center(child: CircularProgressIndicator());
|
|
|
|
|
// }
|
|
|
|
|
// );
|
|
|
|
|
// int status = await _serviceRequestsProvider.createDuplicatedReport(
|
|
|
|
|
// host: _settingProvider.host,
|
|
|
|
|
// user: _userProvider.user,
|
|
|
|
|
// request: serviceRequest
|
|
|
|
|
// );
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
|
// SnackBar(
|
|
|
|
|
// content: Text(
|
|
|
|
|
// HttpStatusManger.getStatusMessage(status: status, subtitle: _subtitle)
|
|
|
|
|
// )
|
|
|
|
|
// )
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// )
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Divider(
|
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.hospital,
|
|
|
|
|
info: serviceRequest.hospitalName,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.unite,
|
|
|
|
|
info: serviceRequest.departmentName,
|
|
|
|
|
),
|
|
|
|
|
// RequestInfoRow(
|
|
|
|
|
// title: _subtitle.deviceArName,
|
|
|
|
|
// content: serviceRequest.deviceArName,
|
|
|
|
|
// ),
|
|
|
|
|
// RequestInfoRow(
|
|
|
|
|
// title: _subtitle.deviceName,
|
|
|
|
|
// content: serviceRequest.deviceEnName,
|
|
|
|
|
// ),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.maintenanceIssue,
|
|
|
|
|
content: serviceRequest.callComments,
|
|
|
|
|
),
|
|
|
|
|
if (serviceRequest.audio?.isNotEmpty == true)
|
|
|
|
|
ASoundPlayer(
|
|
|
|
|
audio: serviceRequest.audio,
|
|
|
|
|
),
|
|
|
|
|
//
|
|
|
|
|
// Center(
|
|
|
|
|
// child: Padding(
|
|
|
|
|
// padding: EdgeInsets.all(32),
|
|
|
|
|
// child: AButton(
|
|
|
|
|
// text: _subtitle.duplicateRequest,
|
|
|
|
|
// onPressed: () async {
|
|
|
|
|
// bool result = await showDialog(
|
|
|
|
|
// context: context,
|
|
|
|
|
// builder: (_) => AAlertDialog(
|
|
|
|
|
// title: _subtitle.duplicateAlert,
|
|
|
|
|
// content: _subtitle.duplicateAlertMessage,
|
|
|
|
|
// )
|
|
|
|
|
// );
|
|
|
|
|
// if(result == true){
|
|
|
|
|
// showDialog(
|
|
|
|
|
// context: context,
|
|
|
|
|
// builder: (context){
|
|
|
|
|
// return Center(child: CircularProgressIndicator());
|
|
|
|
|
// }
|
|
|
|
|
// );
|
|
|
|
|
// int status = await _serviceRequestsProvider.createDuplicatedReport(
|
|
|
|
|
// host: _settingProvider.host,
|
|
|
|
|
// user: _userProvider.user,
|
|
|
|
|
// request: serviceRequest
|
|
|
|
|
// );
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
|
// SnackBar(
|
|
|
|
|
// content: Text(
|
|
|
|
|
// HttpStatusManger.getStatusMessage(status: status, subtitle: _subtitle)
|
|
|
|
|
// )
|
|
|
|
|
// )
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// )
|
|
|
|
|
).expanded,
|
|
|
|
|
AppFilledButton(label: TranslationKeys.login, maxWidth: true, onPressed: () {}).paddingOnly(left: 16, right: 16, bottom: 24),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
// workOrders.isEmpty ?
|
|
|
|
|
|