|
|
|
|
@ -21,6 +21,7 @@ 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_button.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/equipment/auto_complete_devices_field.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/images/mini_one_image_picker.dart';
|
|
|
|
|
@ -43,6 +44,7 @@ class CreateServiceReport extends StatefulWidget {
|
|
|
|
|
final ServiceRequest request;
|
|
|
|
|
|
|
|
|
|
const CreateServiceReport({Key key, this.request}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_CreateServiceReportState createState() => _CreateServiceReportState();
|
|
|
|
|
}
|
|
|
|
|
@ -337,15 +339,15 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
const ASubTitle("Start Date"),
|
|
|
|
|
const ASubTitle("Start of Work"),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
ADatePicker(
|
|
|
|
|
ADateTimePicker(
|
|
|
|
|
date: _serviceReport.startDate,
|
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 365)),
|
|
|
|
|
to: DateTime.now().add(const Duration(days: 365)),
|
|
|
|
|
onDatePicker: (date) {
|
|
|
|
|
onDateTimePicker: (date) {
|
|
|
|
|
_serviceReport.startDate = date;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
@ -358,15 +360,15 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
const ASubTitle("End Date"),
|
|
|
|
|
const ASubTitle("End of Work"),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
),
|
|
|
|
|
ADatePicker(
|
|
|
|
|
ADateTimePicker(
|
|
|
|
|
date: _serviceReport.endDate,
|
|
|
|
|
from: DateTime.now().subtract(const Duration(days: 365)),
|
|
|
|
|
to: DateTime.now().add(const Duration(days: 365)),
|
|
|
|
|
onDatePicker: (date) {
|
|
|
|
|
onDateTimePicker: (date) {
|
|
|
|
|
_serviceReport.endDate = date;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
@ -376,31 +378,46 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
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;
|
|
|
|
|
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) ? null : _subtitle.requiredWord,
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
// _serviceReport.workHours = 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()
|
|
|
|
|
@ -577,6 +594,10 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 16,
|
|
|
|
|
),
|
|
|
|
|
ASubTitle(_subtitle.travelingExpense),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.travelingExpense?.toString(),
|
|
|
|
|
hintText: _subtitle.travelingExpense,
|
|
|
|
|
@ -587,19 +608,6 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
_serviceReport.travelingExpense = int.tryParse(value) ?? 0;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.comment,
|
|
|
|
|
hintText: _subtitle.comment,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_serviceReport.comment = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
@ -607,66 +615,68 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
// Traveling Hours & Working Hours
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
// Expanded(
|
|
|
|
|
// child: Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// ASubTitle(_subtitle.workingHours),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// Expanded(
|
|
|
|
|
// child: AppTimer(
|
|
|
|
|
// timer: _serviceReport.timer,
|
|
|
|
|
// onChange: (timer) async {
|
|
|
|
|
// _serviceReport.timer = timer;
|
|
|
|
|
// return true;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// // ATextFormField(
|
|
|
|
|
// // initialValue: _serviceReport?.workHours,
|
|
|
|
|
// // textAlign: TextAlign.center,
|
|
|
|
|
// // hintText: "i.e 3, 3.5, 4",
|
|
|
|
|
// // style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
// // validator: (value) =>
|
|
|
|
|
// // Validator.isNumeric(value)
|
|
|
|
|
// // ? null : _subtitle.requiredWord,
|
|
|
|
|
// // textInputType: TextInputType.number,
|
|
|
|
|
// // onSaved: (value){
|
|
|
|
|
// // _serviceReport.workHours = value;
|
|
|
|
|
// // },
|
|
|
|
|
// // ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(width: 8,),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
ASubTitle(_subtitle.workingHours),
|
|
|
|
|
ASubTitle(_subtitle.travelingHours),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: AppTimer(
|
|
|
|
|
timer: _serviceReport.timer,
|
|
|
|
|
onChange: (timer) async {
|
|
|
|
|
_serviceReport.timer = timer;
|
|
|
|
|
return true;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.travelingHours,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
hintText: "i.e 3, 3.5, 4",
|
|
|
|
|
style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
// validator: (value) =>
|
|
|
|
|
// Validator.isNumeric(value)
|
|
|
|
|
// ? null : _subtitle.requiredWord,
|
|
|
|
|
textInputType: TextInputType.number,
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_serviceReport.travelingHours = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
// ATextFormField(
|
|
|
|
|
// initialValue: _serviceReport?.workHours,
|
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
|
// hintText: "i.e 3, 3.5, 4",
|
|
|
|
|
// style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
// validator: (value) =>
|
|
|
|
|
// Validator.isNumeric(value)
|
|
|
|
|
// ? null : _subtitle.requiredWord,
|
|
|
|
|
// textInputType: TextInputType.number,
|
|
|
|
|
// onSaved: (value){
|
|
|
|
|
// _serviceReport.workHours = value;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// const SizedBox(width: 8,),
|
|
|
|
|
// Expanded(
|
|
|
|
|
// child: Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// ASubTitle(_subtitle.travelingHours),
|
|
|
|
|
// const SizedBox(height: 4,),
|
|
|
|
|
// ATextFormField(
|
|
|
|
|
// initialValue: _serviceReport?.travelingHours,
|
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
|
// hintText: "i.e 3, 3.5, 4",
|
|
|
|
|
// style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
// // validator: (value) =>
|
|
|
|
|
// // Validator.isNumeric(value)
|
|
|
|
|
// // ? null : _subtitle.requiredWord,
|
|
|
|
|
// textInputType: TextInputType.number,
|
|
|
|
|
// onSaved: (value){
|
|
|
|
|
// _serviceReport.travelingHours = value;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
@ -718,6 +728,24 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
ASubTitle(_subtitle.comment),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 4,
|
|
|
|
|
),
|
|
|
|
|
ATextFormField(
|
|
|
|
|
initialValue: _serviceReport?.comment,
|
|
|
|
|
hintText: "Technical Comment",
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
_serviceReport.comment = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
|
const ASubTitle("Nurse Signature"),
|
|
|
|
|
ESignature(
|
|
|
|
|
|