Enhancemnets

merge-requests/30/head
zaid_daoud 3 years ago
parent 64cb524917
commit 9346990626

@ -314,8 +314,8 @@ class ServiceRequestsProvider extends ChangeNotifier {
"currentSituation": null,
"repairLocation": report.repairLocation?.toMap(),
"reason": report.reason?.toMap(),
"startofWorkTime": report.timer?.startAt?.toIso8601String() ?? "",
"endofWorkTime": report.timer?.endAt?.toIso8601String() ?? "",
"startofWorkTime": report.startDate?.toIso8601String() ?? "",
"endofWorkTime": report.endDate?.toIso8601String() ?? "",
"workingHours": report.timer?.durationInSecond,
"travelingHours": report.travelingHours,
"travelingExpenses": report.travelingExpense ?? 0,

@ -13,6 +13,7 @@ class ServiceReport {
String operatingHours;
DateTime visitDate;
DateTime endDate;
DateTime startDate;
Lookup assetType;
Lookup callLastSituation;
Lookup repairLocation;
@ -69,6 +70,7 @@ class ServiceReport {
this.comment,
this.repairLocation,
this.travelingExpense,
this.startDate,
});
Map<String, dynamic> toMap(ServiceRequest request) {
@ -123,6 +125,8 @@ class ServiceReport {
_map["engSignature"] = signatureEngineer;
_map["comment"] = comment;
_map["travelingExpense"] = travelingExpense;
_map["startofWorkTime"] = startDate;
_map["endofWorkTime"] = endDate;
return _map;
}

@ -35,6 +35,7 @@ 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 '../../../../widgets/speech_to_text/speech_to_text.dart';
import '../../../../widgets/status/report/service_report_repair_location.dart';
class CreateServiceReport extends StatefulWidget {
@ -330,6 +331,54 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
SizedBox(
height: 8 * AppStyle.getScaleFactor(context),
),
Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const ASubTitle("Start Date"),
SizedBox(
height: 8 * AppStyle.getScaleFactor(context),
),
ADatePicker(
date: _serviceReport.startDate,
from: DateTime.now().subtract(const Duration(days: 365)),
to: DateTime.now().add(const Duration(days: 365)),
onDatePicker: (date) {
_serviceReport.startDate = date;
setState(() {});
},
),
],
),
),
const SizedBox(width: 8),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const ASubTitle("End Date"),
SizedBox(
height: 8 * AppStyle.getScaleFactor(context),
),
ADatePicker(
date: _serviceReport.endDate,
from: DateTime.now().subtract(const Duration(days: 365)),
to: DateTime.now().add(const Duration(days: 365)),
onDatePicker: (date) {
_serviceReport.endDate = date;
setState(() {});
},
),
],
),
),
],
),
SizedBox(
height: 8 * AppStyle.getScaleFactor(context),
),
const ASubTitle("Assigned Employee"),
const SizedBox(
height: 8,
@ -404,65 +453,69 @@ 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,
// ),
// ),
// ),
// ],
// ),
// const SizedBox(height: 4,),
// ATextFormField(
// initialValue: _serviceReport?.faultDescriptionId,
// textAlign: TextAlign.center,
// controller: _faultController,
// style: Theme.of(context).textTheme.subtitle1,
// validator: (value) =>
// Validator.hasValue(value)
// ? null : _subtitle.requiredWord,
// textInputType: TextInputType.multiline,
// onSaved: (value){
// _serviceReport.faultDescriptionId = value;
// },
// ),
// 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: 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(
children: [
ASubTitle(_subtitle.faultDescription),
Expanded(
child: SizedBox(
height: 32 * AppStyle.getScaleFactor(context),
child: SpeechToTextButton(
controller: _faultController,
mini: true,
),
),
),
],
),
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: 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,

Loading…
Cancel
Save