|
|
|
|
@ -1,4 +1,3 @@
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
@ -11,6 +10,7 @@ import 'package:test_sa/models/service_request/service_request.dart';
|
|
|
|
|
import 'package:test_sa/models/subtitle.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';
|
|
|
|
|
import 'package:test_sa/views/pages/user/requests/report/create_service_report.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/buttons/app_button.dart';
|
|
|
|
|
@ -19,11 +19,11 @@ import 'package:test_sa/views/widgets/images/images_list.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/image_loader.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/requests/info_row.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/requests/request_status.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/requests/service_request_update_dialog.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/sound/sound_player.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/titles/app_sub_title.dart';
|
|
|
|
|
|
|
|
|
|
import 'report/future_service_report.dart';
|
|
|
|
|
|
|
|
|
|
class RequestDetailsPage extends StatelessWidget {
|
|
|
|
|
static final String id = "/call-details";
|
|
|
|
|
final ServiceRequest serviceRequest;
|
|
|
|
|
@ -42,8 +42,8 @@ class RequestDetailsPage extends StatelessWidget {
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
color:AColors.primaryColor,
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 0,vertical: 4),
|
|
|
|
|
color: AColors.primaryColor,
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
ABackButton(),
|
|
|
|
|
@ -51,124 +51,133 @@ class RequestDetailsPage extends StatelessWidget {
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
_subtitle.details,
|
|
|
|
|
style: Theme.of(context).textTheme.headline6.copyWith(
|
|
|
|
|
color: AColors.white,
|
|
|
|
|
fontStyle: FontStyle.italic
|
|
|
|
|
),
|
|
|
|
|
style: Theme.of(context).textTheme.headline6.copyWith(color: AColors.white, fontStyle: FontStyle.italic),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
_userProvider.user.type == UsersTypes.normal_user ?
|
|
|
|
|
// AIconButton(
|
|
|
|
|
// iconData: Icons.warning_amber_rounded,
|
|
|
|
|
// color: AColors.white,
|
|
|
|
|
// buttonSize: 42,
|
|
|
|
|
// backgroundColor: AColors.deepOrange,
|
|
|
|
|
// onPressed: (){
|
|
|
|
|
// Navigator.of(context).push(
|
|
|
|
|
// MaterialPageRoute(
|
|
|
|
|
// builder: (_) => ReportIssuesPage(serviceRequest: serviceRequest,)
|
|
|
|
|
// )
|
|
|
|
|
// );
|
|
|
|
|
// },
|
|
|
|
|
// )
|
|
|
|
|
const SizedBox(width: 48,)
|
|
|
|
|
: AIconButton(
|
|
|
|
|
iconData: Icons.edit,
|
|
|
|
|
color: AColors.white,
|
|
|
|
|
buttonSize: 42,
|
|
|
|
|
backgroundColor: AColors.green,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (context){
|
|
|
|
|
return ServiceRequestsUpdateDialog(request: serviceRequest,);
|
|
|
|
|
});
|
|
|
|
|
// DateTime picked = await showDatePicker(
|
|
|
|
|
// context: context,
|
|
|
|
|
// initialDate: DateTime.now(),
|
|
|
|
|
// firstDate: DateTime.now(),
|
|
|
|
|
// lastDate: DateTime.now().add(Duration(days: 182))
|
|
|
|
|
// );
|
|
|
|
|
// if(picked == null){return;}
|
|
|
|
|
// showDialog<void>(
|
|
|
|
|
// context: context,
|
|
|
|
|
// barrierDismissible: false,
|
|
|
|
|
// builder: (BuildContext context) {
|
|
|
|
|
// return CupertinoAlertDialog(
|
|
|
|
|
// title: Text(_subtitle.updatingDots),
|
|
|
|
|
// content: Center(child: CircularProgressIndicator()),
|
|
|
|
|
_userProvider.user.type == UsersTypes.normal_user
|
|
|
|
|
?
|
|
|
|
|
// AIconButton(
|
|
|
|
|
// iconData: Icons.warning_amber_rounded,
|
|
|
|
|
// color: AColors.white,
|
|
|
|
|
// buttonSize: 42,
|
|
|
|
|
// backgroundColor: AColors.deepOrange,
|
|
|
|
|
// onPressed: (){
|
|
|
|
|
// Navigator.of(context).push(
|
|
|
|
|
// MaterialPageRoute(
|
|
|
|
|
// builder: (_) => ReportIssuesPage(serviceRequest: serviceRequest,)
|
|
|
|
|
// )
|
|
|
|
|
// );
|
|
|
|
|
// },
|
|
|
|
|
// );
|
|
|
|
|
// int status = await _serviceRequestsProvider.updateDate(
|
|
|
|
|
// user: _userProvider.user,
|
|
|
|
|
// host: _settingProvider.host,
|
|
|
|
|
// request: serviceRequest,
|
|
|
|
|
// newDate: picked.toString().split(" ").first
|
|
|
|
|
// );
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// Fluttertoast.showToast(
|
|
|
|
|
// msg: HttpStatusManger.getStatusMessage(status: status, subtitle: _subtitle),
|
|
|
|
|
// );
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 16,)
|
|
|
|
|
// )
|
|
|
|
|
const SizedBox(
|
|
|
|
|
width: 48,
|
|
|
|
|
)
|
|
|
|
|
: AIconButton(
|
|
|
|
|
iconData: Icons.edit,
|
|
|
|
|
color: AColors.white,
|
|
|
|
|
buttonSize: 42,
|
|
|
|
|
backgroundColor: AColors.green,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
Navigator.of(context).push(
|
|
|
|
|
MaterialPageRoute(builder: (_) => CreateRequestPage(serviceRequest: serviceRequest)),
|
|
|
|
|
);
|
|
|
|
|
// showModalBottomSheet(
|
|
|
|
|
// context: context,
|
|
|
|
|
// builder: (context) {
|
|
|
|
|
//
|
|
|
|
|
// // return ServiceRequestsUpdateDialog(request: serviceRequest,);
|
|
|
|
|
// });
|
|
|
|
|
// DateTime picked = await showDatePicker(
|
|
|
|
|
// context: context,
|
|
|
|
|
// initialDate: DateTime.now(),
|
|
|
|
|
// firstDate: DateTime.now(),
|
|
|
|
|
// lastDate: DateTime.now().add(Duration(days: 182))
|
|
|
|
|
// );
|
|
|
|
|
// if(picked == null){return;}
|
|
|
|
|
// showDialog<void>(
|
|
|
|
|
// context: context,
|
|
|
|
|
// barrierDismissible: false,
|
|
|
|
|
// builder: (BuildContext context) {
|
|
|
|
|
// return CupertinoAlertDialog(
|
|
|
|
|
// title: Text(_subtitle.updatingDots),
|
|
|
|
|
// content: Center(child: CircularProgressIndicator()),
|
|
|
|
|
// );
|
|
|
|
|
// },
|
|
|
|
|
// );
|
|
|
|
|
// int status = await _serviceRequestsProvider.updateDate(
|
|
|
|
|
// user: _userProvider.user,
|
|
|
|
|
// host: _settingProvider.host,
|
|
|
|
|
// request: serviceRequest,
|
|
|
|
|
// newDate: picked.toString().split(" ").first
|
|
|
|
|
// );
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
|
// Fluttertoast.showToast(
|
|
|
|
|
// msg: HttpStatusManger.getStatusMessage(status: status, subtitle: _subtitle),
|
|
|
|
|
// );
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 16,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
serviceRequest.devicePhotos.isEmpty ? SizedBox.shrink():
|
|
|
|
|
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: ImagesList(
|
|
|
|
|
images: serviceRequest.devicePhotos,
|
|
|
|
|
serviceRequest.devicePhotos.isEmpty
|
|
|
|
|
? SizedBox.shrink()
|
|
|
|
|
: 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: ImagesList(
|
|
|
|
|
images: serviceRequest.devicePhotos,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
TabBar(
|
|
|
|
|
labelColor: AColors.primaryColor,
|
|
|
|
|
tabs: [
|
|
|
|
|
Tab(text: _subtitle.general,),
|
|
|
|
|
Tab(text: _subtitle.serviceRequestInformation,),
|
|
|
|
|
TabBar(labelColor: AColors.primaryColor, tabs: [
|
|
|
|
|
Tab(
|
|
|
|
|
text: _subtitle.general,
|
|
|
|
|
),
|
|
|
|
|
Tab(
|
|
|
|
|
text: _subtitle.serviceRequestInformation,
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
SizedBox(height: 8,),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: TabBarView(
|
|
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
ListView(
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 16),
|
|
|
|
|
@ -187,7 +196,7 @@ class RequestDetailsPage extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.deviceModel,
|
|
|
|
|
info : serviceRequest.deviceModel,
|
|
|
|
|
info: serviceRequest.deviceModel,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.engineerName,
|
|
|
|
|
@ -201,11 +210,12 @@ class RequestDetailsPage extends StatelessWidget {
|
|
|
|
|
title: _subtitle.date,
|
|
|
|
|
info: serviceRequest.date,
|
|
|
|
|
),
|
|
|
|
|
serviceRequest.nextVisitDate == null ? SizedBox.shrink() :
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.nextVisitDate,
|
|
|
|
|
info: DateFormat('EE dd/MM/yyyy').format(serviceRequest.nextVisitDate),
|
|
|
|
|
),
|
|
|
|
|
serviceRequest.nextVisitDate == null
|
|
|
|
|
? SizedBox.shrink()
|
|
|
|
|
: RequestInfoRow(
|
|
|
|
|
title: _subtitle.nextVisitDate,
|
|
|
|
|
info: DateFormat('EE dd/MM/yyyy').format(serviceRequest.nextVisitDate),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
@ -215,12 +225,12 @@ class RequestDetailsPage extends StatelessWidget {
|
|
|
|
|
textScaleFactor: AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
StatusLabel(label: serviceRequest.statusLabel,
|
|
|
|
|
color: AColors.getRequestStatusColor(serviceRequest.statusValue)
|
|
|
|
|
),
|
|
|
|
|
StatusLabel(label: serviceRequest.statusLabel, color: AColors.getRequestStatusColor(serviceRequest.statusValue)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Divider(color: Theme.of(context).primaryColor,),
|
|
|
|
|
Divider(
|
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.hospital,
|
|
|
|
|
info: serviceRequest.hospitalName,
|
|
|
|
|
@ -241,10 +251,10 @@ class RequestDetailsPage extends StatelessWidget {
|
|
|
|
|
title: _subtitle.maintenanceIssue,
|
|
|
|
|
content: serviceRequest.maintenanceIssue,
|
|
|
|
|
),
|
|
|
|
|
if(serviceRequest.audio?.isNotEmpty == true)
|
|
|
|
|
ASoundPlayer(
|
|
|
|
|
audio: serviceRequest.audio,
|
|
|
|
|
),
|
|
|
|
|
if (serviceRequest.audio?.isNotEmpty == true)
|
|
|
|
|
ASoundPlayer(
|
|
|
|
|
audio: serviceRequest.audio,
|
|
|
|
|
),
|
|
|
|
|
//
|
|
|
|
|
// Center(
|
|
|
|
|
// child: Padding(
|
|
|
|
|
@ -286,65 +296,64 @@ class RequestDetailsPage extends StatelessWidget {
|
|
|
|
|
// )
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
serviceRequest.viewReport ?
|
|
|
|
|
ListView(
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 16),
|
|
|
|
|
children: [
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.faultDescription,
|
|
|
|
|
content: serviceRequest.faultDescription,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.workPerformed,
|
|
|
|
|
content: serviceRequest.workPerformed,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.visitDate,
|
|
|
|
|
info: serviceRequest.visitDate,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.jobSheetNumber,
|
|
|
|
|
info: serviceRequest.jobSheetNumber,
|
|
|
|
|
),
|
|
|
|
|
_userProvider.user.type == UsersTypes.engineer
|
|
|
|
|
&& serviceRequest.reportID != null?
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(32),
|
|
|
|
|
child: AButton(
|
|
|
|
|
text: _subtitle.editServiceReport,
|
|
|
|
|
onPressed: (){
|
|
|
|
|
Navigator.of(context).push(
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (_) => FutureServiceReport(
|
|
|
|
|
request: serviceRequest,
|
|
|
|
|
serviceRequest.viewReport
|
|
|
|
|
? ListView(
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 16),
|
|
|
|
|
children: [
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.faultDescription,
|
|
|
|
|
content: serviceRequest.faultDescription,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.workPerformed,
|
|
|
|
|
content: serviceRequest.workPerformed,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.visitDate,
|
|
|
|
|
info: serviceRequest.visitDate,
|
|
|
|
|
),
|
|
|
|
|
RequestInfoRow(
|
|
|
|
|
title: _subtitle.jobSheetNumber,
|
|
|
|
|
info: serviceRequest.jobSheetNumber,
|
|
|
|
|
),
|
|
|
|
|
_userProvider.user.type == UsersTypes.engineer && serviceRequest.reportID != null
|
|
|
|
|
? Padding(
|
|
|
|
|
padding: EdgeInsets.all(32),
|
|
|
|
|
child: AButton(
|
|
|
|
|
text: _subtitle.editServiceReport,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).push(
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (_) => FutureServiceReport(
|
|
|
|
|
request: serviceRequest,
|
|
|
|
|
)),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: SizedBox.shrink(),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: _userProvider.user.type == UsersTypes.engineer
|
|
|
|
|
? Center(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.all(32),
|
|
|
|
|
child: AButton(
|
|
|
|
|
text: "Create Report",
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).push(
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (_) => CreateServiceReport(
|
|
|
|
|
request: serviceRequest,
|
|
|
|
|
)),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
): SizedBox.shrink(),
|
|
|
|
|
],
|
|
|
|
|
):
|
|
|
|
|
_userProvider.user.type == UsersTypes.engineer ?
|
|
|
|
|
Center(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.all(32),
|
|
|
|
|
child: AButton(
|
|
|
|
|
text: "Create Report",
|
|
|
|
|
onPressed: (){
|
|
|
|
|
Navigator.of(context).push(
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (_) => CreateServiceReport(
|
|
|
|
|
request: serviceRequest,
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
: Center(
|
|
|
|
|
child: ASubTitle(_subtitle.noDateFound),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
): Center(child: ASubTitle(_subtitle.noDateFound),),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|