|
|
|
@ -23,24 +23,21 @@ import 'package:test_sa/views/widgets/app_text_form_field.dart';
|
|
|
|
import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
|
|
|
|
import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
|
|
|
|
import 'package:test_sa/views/widgets/buttons/app_button.dart';
|
|
|
|
import 'package:test_sa/views/widgets/buttons/app_button.dart';
|
|
|
|
import 'package:test_sa/views/widgets/date_and_time/date_picker.dart';
|
|
|
|
import 'package:test_sa/views/widgets/date_and_time/date_picker.dart';
|
|
|
|
import 'package:test_sa/views/widgets/date_and_time/time_picker.dart';
|
|
|
|
|
|
|
|
import 'package:test_sa/views/widgets/e_signature/e_signature.dart';
|
|
|
|
import 'package:test_sa/views/widgets/e_signature/e_signature.dart';
|
|
|
|
import 'package:test_sa/views/widgets/equipment/auto_complete_devices_field.dart';
|
|
|
|
import 'package:test_sa/views/widgets/equipment/auto_complete_devices_field.dart';
|
|
|
|
import 'package:test_sa/views/widgets/images/mini_one_image_picker.dart';
|
|
|
|
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/loaders/loading_manager.dart';
|
|
|
|
import 'package:test_sa/views/widgets/parts/auto_complete_parts_field.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/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_equipment_status.dart';
|
|
|
|
import 'package:test_sa/views/widgets/status/report/service_report_equipment_status.dart';
|
|
|
|
import 'package:test_sa/views/widgets/status/report/service_report_last_call.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_reasons.dart';
|
|
|
|
import 'package:test_sa/views/widgets/status/report/service_report_status.dart';
|
|
|
|
|
|
|
|
import 'package:test_sa/views/widgets/titles/app_sub_title.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 '../../../../../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_fault_description.dart';
|
|
|
|
import '../../../../widgets/status/report/service_report_repair_location.dart';
|
|
|
|
import '../../../../widgets/status/report/service_report_repair_location.dart';
|
|
|
|
|
|
|
|
import '../../../../widgets/timer/app_timer.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class CreateServiceReport extends StatefulWidget {
|
|
|
|
class CreateServiceReport extends StatefulWidget {
|
|
|
|
static final String id = "/create-service-report";
|
|
|
|
static final String id = "/create-service-report";
|
|
|
|
@ -331,7 +328,7 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
// ASubTitle(_subtitle.reportStatus),
|
|
|
|
// ASubTitle(_subtitle.reportStatus),
|
|
|
|
ASubTitle("Equipment Status"),
|
|
|
|
ASubTitle("Equipment Status"),
|
|
|
|
_validate && _serviceReport.equipmentStatus == null
|
|
|
|
_validate && _serviceReport.equipmentStatus == null
|
|
|
|
? ASubTitle(
|
|
|
|
? ASubTitle(
|
|
|
|
@ -418,71 +415,23 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
ASubTitle(_subtitle.workingHours),
|
|
|
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
child: AppTimer(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
timer: _serviceReport.timer,
|
|
|
|
children: [
|
|
|
|
onChange: (timer) async {
|
|
|
|
const ASubTitle("Start of Work"),
|
|
|
|
_serviceReport.timer = timer;
|
|
|
|
SizedBox(
|
|
|
|
_serviceReport.workingHours = num.tryParse((((timer?.durationInSecond ?? 0) / 60) / 60)?.toStringAsFixed(2) ?? "0");
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
return true;
|
|
|
|
),
|
|
|
|
},
|
|
|
|
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(() {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
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(() {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
ASubTitle(_subtitle.workingHours),
|
|
|
|
|
|
|
|
const SizedBox(height: 4),
|
|
|
|
|
|
|
|
ATextFormField(
|
|
|
|
|
|
|
|
initialValue: null,
|
|
|
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
|
|
|
hintText: _serviceReport.startDate == null
|
|
|
|
|
|
|
|
? "0"
|
|
|
|
|
|
|
|
: ((_serviceReport?.endDate?.difference(_serviceReport?.startDate)?.inMinutes ?? 0) / 60)?.toStringAsFixed(2)?.toString() ?? "0",
|
|
|
|
|
|
|
|
enable: false,
|
|
|
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
|
|
|
validator: (value) => Validator.isNumeric(value) ? null : _subtitle.requiredWord,
|
|
|
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
|
|
|
// _serviceReport.workHours = value;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 8,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
// device sn
|
|
|
|
// device sn
|
|
|
|
Visibility(
|
|
|
|
Visibility(
|
|
|
|
visible: widget.request.deviceSerialNumber == null,
|
|
|
|
visible: widget.request.deviceSerialNumber == null,
|
|
|
|
@ -636,7 +585,7 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
enable: false,
|
|
|
|
enable: false,
|
|
|
|
hintText: _serviceReport.faultDescription?.workPerformed ?? "",
|
|
|
|
hintText: _serviceReport.faultDescription?.workPerformed ?? "",
|
|
|
|
controller: _workPreformedController,
|
|
|
|
controller: _workPreformedController,
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
validator: (value) => Validator.hasValue(value) ? null : _subtitle.requiredWord,
|
|
|
|
validator: (value) => Validator.hasValue(value) ? null : _subtitle.requiredWord,
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
onSaved: (value) {
|
|
|
|
onSaved: (value) {
|
|
|
|
@ -701,7 +650,7 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
),
|
|
|
|
),
|
|
|
|
ATextFormField(
|
|
|
|
ATextFormField(
|
|
|
|
initialValue: _serviceReport?.travelingExpense?.toString(),
|
|
|
|
initialValue: _serviceReport?.travelingExpense?.toString(),
|
|
|
|
hintText: _subtitle.travelingExpense,
|
|
|
|
hintText: "i.e 3, 3.5, 4",
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
@ -929,9 +878,9 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Column(
|
|
|
|
Column(
|
|
|
|
children: List.generate(_serviceReport.parts.length, (index) {
|
|
|
|
children: List.generate(_serviceReport.parts.length, (index) {
|
|
|
|
Part _part = _serviceReport.parts[index];
|
|
|
|
Part part = _serviceReport.parts[index];
|
|
|
|
return PartItem(
|
|
|
|
return PartItem(
|
|
|
|
part: _part,
|
|
|
|
part: part,
|
|
|
|
onDelete: (part) {
|
|
|
|
onDelete: (part) {
|
|
|
|
_serviceReport.parts.remove(part);
|
|
|
|
_serviceReport.parts.remove(part);
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
|