diff --git a/lib/controllers/providers/api/service_requests_provider.dart b/lib/controllers/providers/api/service_requests_provider.dart index 9ed361c8..1f6c5071 100644 --- a/lib/controllers/providers/api/service_requests_provider.dart +++ b/lib/controllers/providers/api/service_requests_provider.dart @@ -294,7 +294,7 @@ class ServiceRequestsProvider extends ChangeNotifier { "id": request.id, }, "assetType": report.assetType?.toMap(), - "assignedEmployee": {"id": report.engineer.id, "name": report.engineer.name}, + "assignedEmployee": {"id": report.engineer?.id, "name": report.engineer?.name ?? ""}, "visitDate": report.visitDate?.toIso8601String() ?? "", // "assistantEmployees": [ // {"id": report.engineer.id, "name": report.engineer.name}, diff --git a/lib/models/service_report.dart b/lib/models/service_report.dart index 1fca48b5..637de4e3 100644 --- a/lib/models/service_report.dart +++ b/lib/models/service_report.dart @@ -140,7 +140,7 @@ class ServiceReport { //if(serviceType == null) return false; if (status == null) return false; if (type == null && assetType == null) return false; - if (engineer == null) return false; + // if (engineer == null) return false; if (callLastSituation == null) return false; if (callLastSituation?.value == 12) { // if(invoiceCode != null || invoiceCode?.isEmpty == true) return false; @@ -148,7 +148,7 @@ class ServiceReport { } if (parts == null) return false; //if(endDate == null) return false; - //if(reason == null) return false; + if (reason == null) return false; //todo uncoment this line //if((device?.id == null || device.id.isEmpty) && type?.id != 1) return false; //if(quantity == null || quantity.isEmpty) return false; diff --git a/lib/views/pages/user/requests/report/create_service_report.dart b/lib/views/pages/user/requests/report/create_service_report.dart index dfc0beca..692027ca 100644 --- a/lib/views/pages/user/requests/report/create_service_report.dart +++ b/lib/views/pages/user/requests/report/create_service_report.dart @@ -402,7 +402,7 @@ class _CreateServiceReportState extends State with TickerPr 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, + validator: (value) => Validator.isNumeric(value.isEmpty ? "0" : value) ? null : _subtitle.requiredWord, textInputType: TextInputType.number, onSaved: (value) { // _serviceReport.workHours = value;