|
|
|
|
@ -28,16 +28,14 @@ import 'package:test_sa/views/widgets/images/mini_one_image_picker.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/parts/auto_complete_parts_field.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/parts/part_item.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/status/employee/engineers_mune.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/status/report/service_report_last_call.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/status/report/service_report_reasons.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/status/report/service_report_status.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/status/report/service_status.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/timer/app_timer.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/titles/app_sub_title.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../../../controllers/providers/api/status_drop_down/report/service_types_provider.dart';
|
|
|
|
|
import '../../../../widgets/speech_to_text/speech_to_text.dart';
|
|
|
|
|
import '../../../../widgets/status/report/service_report_fault_description.dart';
|
|
|
|
|
import '../../../../widgets/status/report/service_report_repair_location.dart';
|
|
|
|
|
|
|
|
|
|
class CreateServiceReport extends StatefulWidget {
|
|
|
|
|
@ -75,7 +73,6 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
device: widget.request.device,
|
|
|
|
|
parts: [],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -275,12 +272,31 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
ServiceAssetTypeMenu(
|
|
|
|
|
initialValue: _serviceReport.assetType,
|
|
|
|
|
onSelect: (status) {
|
|
|
|
|
_serviceReport.assetType = status;
|
|
|
|
|
LoadingManager(
|
|
|
|
|
isLoading: _assetTypeProvider.isLoading,
|
|
|
|
|
isFailedLoading: _assetTypeProvider.statuses == null,
|
|
|
|
|
stateCode: _assetTypeProvider.stateCode,
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
_assetTypeProvider.reset();
|
|
|
|
|
await _assetTypeProvider.getTypes(user: _userProvider.user, host: _settingProvider.host);
|
|
|
|
|
_serviceReport?.assetType = _assetTypeProvider.statuses?.firstWhere(
|
|
|
|
|
(element) => element.value == widget.request?.device?.hospital?.id,
|
|
|
|
|
orElse: () => null,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.assetType?.name ?? "NULL",
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
enable: false,
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// ServiceAssetTypeMenu(
|
|
|
|
|
// initialValue: _serviceReport.assetType,
|
|
|
|
|
// onSelect: (status) {
|
|
|
|
|
// _serviceReport.assetType = status;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
@ -353,6 +369,21 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (_showCommentField)
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
if (_showCommentField)
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.reviewComment,
|
|
|
|
|
hintText: "Review Comment",
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_serviceReport.reviewComment = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
@ -417,176 +448,48 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
// _serviceReport.workHours = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
// Report type and Reasons
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
// Report Status
|
|
|
|
|
// Expanded(
|
|
|
|
|
// child: Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// ASubTitle(_subtitle.reportType),
|
|
|
|
|
// _validate && _serviceReport.type == null ?
|
|
|
|
|
// ASubTitle(_subtitle.requiredWord,color: Colors.red,):
|
|
|
|
|
// const SizedBox.shrink(),
|
|
|
|
|
// const SizedBox(height: 4,),
|
|
|
|
|
// ServiceReportTypeMenu(
|
|
|
|
|
// initialValue: _serviceReport.type,
|
|
|
|
|
// onSelect: (status){
|
|
|
|
|
// _serviceReport.type = status;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(width: 8,),
|
|
|
|
|
// visit date
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
ASubTitle(_subtitle.visitDate),
|
|
|
|
|
_validate && _serviceReport.visitDate == null
|
|
|
|
|
? ASubTitle(
|
|
|
|
|
_subtitle.requiredWord,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
)
|
|
|
|
|
: const SizedBox.shrink(),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ADatePicker(
|
|
|
|
|
date: _serviceReport.visitDate,
|
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 365)),
|
|
|
|
|
to: DateTime.now().add(const Duration(days: 365)),
|
|
|
|
|
onDatePicker: (date) {
|
|
|
|
|
_serviceReport.visitDate = date;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
// device sn
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: widget.request.deviceSerialNumber == null,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
ASubTitle(_subtitle.deviceSN),
|
|
|
|
|
_validate && _serviceReport.device?.id == null
|
|
|
|
|
? ASubTitle(
|
|
|
|
|
_subtitle.requiredWord,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
)
|
|
|
|
|
: const SizedBox.shrink(),
|
|
|
|
|
AutoCompleteDeviceField(
|
|
|
|
|
hospitalId: widget.request.hospitalId,
|
|
|
|
|
initialValue: _serviceReport.device,
|
|
|
|
|
onPick: (id) {
|
|
|
|
|
_serviceReport.device.id = id;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
ASubTitle(_subtitle.serviceType),
|
|
|
|
|
_validate && _serviceReport.assetType == null
|
|
|
|
|
? ASubTitle(
|
|
|
|
|
_subtitle.requiredWord,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
)
|
|
|
|
|
: const SizedBox.shrink(),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
LoadingManager(
|
|
|
|
|
isLoading: _assetTypeProvider.isLoading,
|
|
|
|
|
isFailedLoading: _assetTypeProvider.statuses == null,
|
|
|
|
|
stateCode: _assetTypeProvider.stateCode,
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
_assetTypeProvider.reset();
|
|
|
|
|
await _assetTypeProvider.getTypes(user: _userProvider.user, host: _settingProvider.host);
|
|
|
|
|
_serviceReport?.assetType = _assetTypeProvider.statuses?.firstWhere(
|
|
|
|
|
(element) => element.value == widget.request?.device?.hospital?.id,
|
|
|
|
|
orElse: () => null,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.assetType?.name ?? "NULL",
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
enable: false,
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// ServiceAssetTypeMenu(
|
|
|
|
|
// initialValue: _serviceReport.assetType,
|
|
|
|
|
// onSelect: (status) {
|
|
|
|
|
// _serviceReport.assetType = status;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
// Report status and Service Type
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
// report status
|
|
|
|
|
Expanded(
|
|
|
|
|
// device sn
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: widget.request.deviceSerialNumber == null,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
ASubTitle(_subtitle.reportStatus),
|
|
|
|
|
_validate && _serviceReport.status == null
|
|
|
|
|
ASubTitle(_subtitle.deviceSN),
|
|
|
|
|
_validate && _serviceReport.device?.id == null
|
|
|
|
|
? ASubTitle(
|
|
|
|
|
_subtitle.requiredWord,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
)
|
|
|
|
|
: const SizedBox.shrink(),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
ServiceReportStatusMenu(
|
|
|
|
|
report: _serviceReport,
|
|
|
|
|
request: widget.request,
|
|
|
|
|
onSelect: (status) {
|
|
|
|
|
_serviceReport.status = status;
|
|
|
|
|
_showCommentField = _serviceReport.status?.name == "Resolved";
|
|
|
|
|
setState(() {});
|
|
|
|
|
AutoCompleteDeviceField(
|
|
|
|
|
hospitalId: widget.request.hospitalId,
|
|
|
|
|
initialValue: _serviceReport.device,
|
|
|
|
|
onPick: (id) {
|
|
|
|
|
_serviceReport.device.id = id;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
width: 8,
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
// Provider.of<ServiceReportLastCallsProvider>(context).isLoading == null
|
|
|
|
|
// ? const SizedBox.shrink():
|
|
|
|
|
// Call's last Situation
|
|
|
|
|
Consumer<ServiceReportLastCallsProvider>(
|
|
|
|
|
builder: (_, provider, __) {
|
|
|
|
|
if (provider.isLoading == null) return const SizedBox.shrink();
|
|
|
|
|
return Expanded(
|
|
|
|
|
// Report status and Service Type
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
// report status
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
ASubTitle(_subtitle.callLastSituation),
|
|
|
|
|
_validate && _serviceReport.callLastSituation == null
|
|
|
|
|
ASubTitle(_subtitle.reportStatus),
|
|
|
|
|
_validate && _serviceReport.status == null
|
|
|
|
|
? ASubTitle(
|
|
|
|
|
_subtitle.requiredWord,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
@ -595,121 +498,99 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
ServiceReportLastCallsMenu(
|
|
|
|
|
ServiceReportStatusMenu(
|
|
|
|
|
report: _serviceReport,
|
|
|
|
|
request: widget.request,
|
|
|
|
|
onSelect: (status) {
|
|
|
|
|
if (status?.value == 12 || _serviceReport.callLastSituation?.value == 12) {
|
|
|
|
|
_serviceReport.callLastSituation = status;
|
|
|
|
|
setState(() {});
|
|
|
|
|
} else {
|
|
|
|
|
_serviceReport.callLastSituation = status;
|
|
|
|
|
}
|
|
|
|
|
_serviceReport.status = status;
|
|
|
|
|
_showCommentField = _serviceReport.status?.name == "Resolved";
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
width: 8,
|
|
|
|
|
),
|
|
|
|
|
// Provider.of<ServiceReportLastCallsProvider>(context).isLoading == null
|
|
|
|
|
// ? const SizedBox.shrink():
|
|
|
|
|
// Call's last Situation
|
|
|
|
|
Consumer<ServiceReportLastCallsProvider>(
|
|
|
|
|
builder: (_, provider, __) {
|
|
|
|
|
if (provider.isLoading == null) return const SizedBox.shrink();
|
|
|
|
|
return Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
ASubTitle(_subtitle.callLastSituation),
|
|
|
|
|
_validate && _serviceReport.callLastSituation == null
|
|
|
|
|
? ASubTitle(
|
|
|
|
|
_subtitle.requiredWord,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
)
|
|
|
|
|
: const SizedBox.shrink(),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
ServiceReportLastCallsMenu(
|
|
|
|
|
report: _serviceReport,
|
|
|
|
|
onSelect: (status) {
|
|
|
|
|
if (status?.value == 12 || _serviceReport.callLastSituation?.value == 12) {
|
|
|
|
|
_serviceReport.callLastSituation = status;
|
|
|
|
|
setState(() {});
|
|
|
|
|
} else {
|
|
|
|
|
_serviceReport.callLastSituation = status;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (_showCommentField)
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
if (_showCommentField)
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.reviewComment,
|
|
|
|
|
hintText: "Review Comment",
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_serviceReport.reviewComment = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
const ASubTitle("Start of Work"),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
ADateTimePicker(
|
|
|
|
|
date: _serviceReport.startDate,
|
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 365)),
|
|
|
|
|
to: DateTime.now().add(const Duration(days: 365)),
|
|
|
|
|
onDateTimePicker: (date) {
|
|
|
|
|
_serviceReport.startDate = date;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
if (_showCommentField)
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 8),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
const ASubTitle("End of Work"),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
ADateTimePicker(
|
|
|
|
|
date: _serviceReport.endDate,
|
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 365)),
|
|
|
|
|
to: DateTime.now().add(const Duration(days: 365)),
|
|
|
|
|
onDateTimePicker: (date) {
|
|
|
|
|
_serviceReport.endDate = date;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
if (_showCommentField)
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.reviewComment,
|
|
|
|
|
hintText: "Review Comment",
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_serviceReport.reviewComment = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
ASubTitle(_subtitle.workingHours),
|
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: null,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
hintText: _serviceReport.startDate == null ? "0" : _serviceReport?.endDate?.difference(_serviceReport?.startDate)?.inHours?.toString() ?? "0",
|
|
|
|
|
enable: false,
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
validator: (value) => Validator.isNumeric(value.isEmpty ? "0" : value) ? null : _subtitle.requiredWord,
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
// _serviceReport.workHours = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
const ASubTitle("Assigned Employee"),
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
_validate && _serviceReport.engineer == null
|
|
|
|
|
? ASubTitle(
|
|
|
|
|
_subtitle.requiredWord,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
)
|
|
|
|
|
: const SizedBox.shrink(),
|
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
EngineersMenu(
|
|
|
|
|
initialValue: _serviceReport.engineer,
|
|
|
|
|
onSelect: (engineer) {
|
|
|
|
|
_serviceReport.engineer = engineer;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
// const ASubTitle("Assigned Employee"),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// _validate && _serviceReport.engineer == null
|
|
|
|
|
// ? ASubTitle(
|
|
|
|
|
// _subtitle.requiredWord,
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
// )
|
|
|
|
|
// : const SizedBox.shrink(),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 4,
|
|
|
|
|
// ),
|
|
|
|
|
// EngineersMenu(
|
|
|
|
|
// initialValue: _serviceReport.engineer,
|
|
|
|
|
// onSelect: (engineer) {
|
|
|
|
|
// _serviceReport.engineer = engineer;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// invoice number & code
|
|
|
|
|
_serviceReport.callLastSituation?.id != 12
|
|
|
|
|
? const SizedBox.shrink()
|
|
|
|
|
@ -736,13 +617,17 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 8),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
width: 8,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
ASubTitle(_subtitle.invoiceCode),
|
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.invoiceCode,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
@ -759,33 +644,35 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
ASubTitle(_subtitle.faultDescription),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
height: 32 * AppStyle.getScaleFactor(context),
|
|
|
|
|
child: SpeechToTextButton(
|
|
|
|
|
controller: _faultController,
|
|
|
|
|
mini: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
ASubTitle(_subtitle.faultDescription),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.faultDescriptionId?.toString(),
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
controller: _faultController,
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
validator: (value) => Validator.hasValue(value) ? null : _subtitle.requiredWord,
|
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_serviceReport.faultDescriptionId = int.tryParse(value) ?? 0;
|
|
|
|
|
ServiceReportFaultDescription(
|
|
|
|
|
requestId: widget.request?.id,
|
|
|
|
|
initialValue: _serviceReport.faultDescription,
|
|
|
|
|
onSelect: (status) {
|
|
|
|
|
_serviceReport.faultDescription = status;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
// ATextFormField(
|
|
|
|
|
// initialValue: _serviceReport?.faultDescriptionId?.toString(),
|
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
|
// controller: _faultController,
|
|
|
|
|
// style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
// validator: (value) => Validator.hasValue(value) ? null : _subtitle.requiredWord,
|
|
|
|
|
// textInputType: TextInputType.multiline,
|
|
|
|
|
// onSaved: (value) {
|
|
|
|
|
// _serviceReport.faultDescriptionId = int.tryParse(value) ?? 0;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
ASubTitle(_subtitle.workPreformed),
|
|
|
|
|
@ -800,7 +687,9 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.workPreformed,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
@ -812,145 +701,9 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
_serviceReport.workPreformed = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
// const ASubTitle("Assigned Employee"),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// _validate && _serviceReport.engineer == null
|
|
|
|
|
// ? ASubTitle(
|
|
|
|
|
// _subtitle.requiredWord,
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
// )
|
|
|
|
|
// : const SizedBox.shrink(),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 4,
|
|
|
|
|
// ),
|
|
|
|
|
// EngineersMenu(
|
|
|
|
|
// initialValue: _serviceReport.engineer,
|
|
|
|
|
// onSelect: (engineer) {
|
|
|
|
|
// _serviceReport.engineer = engineer;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// invoice number & code
|
|
|
|
|
_serviceReport.callLastSituation?.id != 12
|
|
|
|
|
? const SizedBox.shrink()
|
|
|
|
|
: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
ASubTitle(_subtitle.invoiceNumber),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.invoiceNumber,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
validator: (value) => Validator.hasValue(value) ? null : _subtitle.requiredWord,
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_serviceReport.invoiceNumber = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
width: 8,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
ASubTitle(_subtitle.invoiceCode),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.invoiceCode,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
validator: (value) => Validator.hasValue(value) ? null : _subtitle.requiredWord,
|
|
|
|
|
textInputType: TextInputType.text,
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_serviceReport.invoiceCode = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
ASubTitle(_subtitle.faultDescription),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
ServiceReportFaultDescription(
|
|
|
|
|
requestId: widget.request.id,
|
|
|
|
|
initialValue: _serviceReport.faultDescription,
|
|
|
|
|
onSelect: (status) {
|
|
|
|
|
_serviceReport.faultDescription = status;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
// ATextFormField(
|
|
|
|
|
// initialValue: _serviceReport?.faultDescriptionId?.toString(),
|
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
|
// controller: _faultController,
|
|
|
|
|
// style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
// validator: (value) => Validator.hasValue(value) ? null : _subtitle.requiredWord,
|
|
|
|
|
// textInputType: TextInputType.multiline,
|
|
|
|
|
// onSaved: (value) {
|
|
|
|
|
// _serviceReport.faultDescriptionId = int.tryParse(value) ?? 0;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
ASubTitle(_subtitle.workPreformed),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
height: 32 * AppStyle.getScaleFactor(context),
|
|
|
|
|
child: SpeechToTextButton(
|
|
|
|
|
controller: _workPreformedController,
|
|
|
|
|
mini: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.workPreformed,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
controller: _workPreformedController,
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
validator: (value) => Validator.hasValue(value) ? null : _subtitle.requiredWord,
|
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_serviceReport.workPreformed = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
Row(
|
|
|
|
|
@ -1263,8 +1016,8 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
if (!_serviceReport.validate()) return;
|
|
|
|
|
_formKey.currentState.save();
|
|
|
|
|
|
|
|
|
|
_isLoading = true;
|
|
|
|
|
setState(() {});
|
|
|
|
|
_isLoading = true;
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
|
|
int status = await _serviceRequestsProvider.createServiceReport(
|
|
|
|
|
user: _userProvider.user,
|
|
|
|
|
|