diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index df430e8e..e52251cd 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -30,6 +30,7 @@ class URLs { static get getServiceRequestTypes => "$_baseUrl/Lookups/GetLookup?lookupEnum=604"; // get static get getServiceRequestStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=503"; static get getRepairLocation => "$_baseUrl/Lookups/GetLookup?lookupEnum=504"; + static get equipmentStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=601"; static get getPreventiveMaintenanceVisits => "$_baseUrl/return/user/calibrations"; // get static get updatePreventiveMaintenanceVisits => "$_baseUrl/Visit/UpdateVisits"; // get @@ -59,7 +60,7 @@ class URLs { static get getPartNumber => "$_baseUrl/PartCatalog/GetPartAutoComplete"; // get static get getServiceReportPriority => "$_baseUrl/Lookups/GetLookup?lookupEnum=602"; // get static get getServiceReportDefectTypes => "$_baseUrl/Lookups/GetLookup?lookupEnum=601"; // get - static get getServiceReportFaultDescription => "$_baseUrl/CallRequest/GetCallRequestForWorkOrder"; // get + static get getCallRequestForWorkOrder => "$_baseUrl/CallRequest/GetCallRequestForWorkOrder"; // get //gas refill static get getGasTypes => "$_baseUrl/Lookups/GetLookup?lookupEnum=606"; // get diff --git a/lib/controllers/providers/api/service_requests_provider.dart b/lib/controllers/providers/api/service_requests_provider.dart index e2a59b23..628cb254 100644 --- a/lib/controllers/providers/api/service_requests_provider.dart +++ b/lib/controllers/providers/api/service_requests_provider.dart @@ -5,6 +5,7 @@ import 'package:http/http.dart'; import 'package:test_sa/controllers/api_routes/api_manager.dart'; import 'package:test_sa/controllers/api_routes/http_status_manger.dart'; import 'package:test_sa/controllers/api_routes/urls.dart'; +import 'package:test_sa/models/call_request_for_work_order_model.dart'; import 'package:test_sa/models/issue.dart'; import 'package:test_sa/models/service_report.dart'; import 'package:test_sa/models/service_request/service_request.dart'; @@ -363,6 +364,28 @@ class ServiceRequestsProvider extends ChangeNotifier { } } + CallRequestForWorkOrder callRequestForWorkOrder; + + Future getCallRequestForWorkOrder({String callId}) async { + Response response; + try { + response = await ApiManager.instance.get( + URLs.getCallRequestForWorkOrder + "?callId=$callId", + ); + stateCode = response.statusCode; + if (response.statusCode >= 200 && response.statusCode < 300) { + // client's request was successfully received + Map listJson = json.decode(response.body)["data"]; + callRequestForWorkOrder = CallRequestForWorkOrder.fromJson(listJson); + } + + notifyListeners(); + return callRequestForWorkOrder; + } catch (error) { + return null; + } + } + Future> searchWorkOrders({@required String callId}) async { Response response; diff --git a/lib/controllers/providers/api/status_drop_down/report/service_report_fault_description_provider.dart b/lib/controllers/providers/api/status_drop_down/report/service_report_fault_description_provider.dart index f50a5b1e..8946bd0a 100644 --- a/lib/controllers/providers/api/status_drop_down/report/service_report_fault_description_provider.dart +++ b/lib/controllers/providers/api/status_drop_down/report/service_report_fault_description_provider.dart @@ -42,14 +42,14 @@ class ServiceRequestFaultDescriptionProvider extends ChangeNotifier { /// return state code if request complete may be 200, 404 or 403 /// for more details check http state manager /// lib\controllers\http_status_manger\http_status_manger.dart - Future getData({String host, User user, String requestId}) async { + Future getCallRequestForWorkOrder({String host, User user, String requestId}) async { if (_loading == true) return -2; _loading = true; notifyListeners(); Response response; try { response = await ApiManager.instance.get( - URLs.getServiceReportFaultDescription + "?callId=$requestId", + URLs.getCallRequestForWorkOrder + "?callId=$requestId", ); _stateCode = response.statusCode; if (response.statusCode >= 200 && response.statusCode < 300) { diff --git a/lib/models/call_request_for_work_order_model.dart b/lib/models/call_request_for_work_order_model.dart new file mode 100644 index 00000000..dd0ac5a3 --- /dev/null +++ b/lib/models/call_request_for_work_order_model.dart @@ -0,0 +1,541 @@ +class CallRequestForWorkOrder { + int id; + String callNo; + Asset asset; + AssignedEmployee assignedEmployee; + List callSiteContactPerson; + Status status; + Status callLastSituation; + Status defectType; + Status firstAction; + int assetType; + + CallRequestForWorkOrder( + {this.id, this.callNo, this.asset, this.assignedEmployee, this.callSiteContactPerson, this.status, this.callLastSituation, this.defectType, this.firstAction, this.assetType}); + + CallRequestForWorkOrder.fromJson(Map json) { + id = json['id']; + callNo = json['callNo']; + asset = json['asset'] != null ? new Asset.fromJson(json['asset']) : null; + assignedEmployee = json['assignedEmployee'] != null ? new AssignedEmployee.fromJson(json['assignedEmployee']) : null; + if (json['callSiteContactPerson'] != null) { + callSiteContactPerson = []; + json['callSiteContactPerson'].forEach((v) { + callSiteContactPerson.add(new CallSiteContactPerson.fromJson(v)); + }); + } + status = json['status'] != null ? new Status.fromJson(json['status']) : null; + callLastSituation = json['callLastSituation'] != null ? new Status.fromJson(json['callLastSituation']) : null; + defectType = json['defectType'] != null ? new Status.fromJson(json['defectType']) : null; + firstAction = json['firstAction'] != null ? new Status.fromJson(json['firstAction']) : null; + assetType = json['assetType']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['callNo'] = this.callNo; + if (this.asset != null) { + data['asset'] = this.asset.toJson(); + } + if (this.assignedEmployee != null) { + data['assignedEmployee'] = this.assignedEmployee.toJson(); + } + if (this.callSiteContactPerson != null) { + data['callSiteContactPerson'] = this.callSiteContactPerson.map((v) => v.toJson()).toList(); + } + if (this.status != null) { + data['status'] = this.status.toJson(); + } + if (this.callLastSituation != null) { + data['callLastSituation'] = this.callLastSituation.toJson(); + } + if (this.defectType != null) { + data['defectType'] = this.defectType.toJson(); + } + if (this.firstAction != null) { + data['firstAction'] = this.firstAction.toJson(); + } + data['assetType'] = this.assetType; + return data; + } +} + +class Asset { + int id; + String assetSerialNo; + String systemID; + String assetNumber; + ModelDefinition modelDefinition; + String supplier; + String ipAddress; + String macAddress; + String portNumber; + String assetReplace; + String oldAsset; + bool isParent; + String parentAsset; + int assetType; + Site site; + Building building; + String floor; + Department department; + String room; + String testsDay; + String purchasingPrice; + String nbv; + String currency; + String poNo; + String invoiceNumber; + String invoiceDate; + String replacementDate; + Department originDepartment; + Site originSite; + String budgetYear; + String lastPOPrice; + String commissioningStatus; + String productionDate; + String edd; + String technicalInspectionDate; + String deliveryInspectionDate; + String endUserAcceptanceDate; + String receivingCommittee; + String siteWarrantyMonths; + String extendedWarrantyMonths; + String remainderWarrantyMonths; + String eomWarrantyMonthsNo; + String warrantyValue; + String warrantyEndDate; + String warrantyContractConditions; + List technicalGuidanceBooks; + String comment; + String tagCode; + + Asset( + {this.id, + this.assetSerialNo, + this.systemID, + this.assetNumber, + this.modelDefinition, + this.supplier, + this.ipAddress, + this.macAddress, + this.portNumber, + this.assetReplace, + this.oldAsset, + this.isParent, + this.parentAsset, + this.assetType, + this.site, + this.building, + this.floor, + this.department, + this.room, + this.testsDay, + this.purchasingPrice, + this.nbv, + this.currency, + this.poNo, + this.invoiceNumber, + this.invoiceDate, + this.replacementDate, + this.originDepartment, + this.originSite, + this.budgetYear, + this.lastPOPrice, + this.commissioningStatus, + this.productionDate, + this.edd, + this.technicalInspectionDate, + this.deliveryInspectionDate, + this.endUserAcceptanceDate, + this.receivingCommittee, + this.siteWarrantyMonths, + this.extendedWarrantyMonths, + this.remainderWarrantyMonths, + this.eomWarrantyMonthsNo, + this.warrantyValue, + this.warrantyEndDate, + this.warrantyContractConditions, + this.technicalGuidanceBooks, + this.comment, + this.tagCode}); + + Asset.fromJson(Map json) { + id = json['id']; + assetSerialNo = json['assetSerialNo']; + systemID = json['systemID']; + assetNumber = json['assetNumber']; + modelDefinition = json['modelDefinition'] != null ? new ModelDefinition.fromJson(json['modelDefinition']) : null; + supplier = json['supplier']; + ipAddress = json['ipAddress']; + macAddress = json['macAddress']; + portNumber = json['portNumber']; + assetReplace = json['assetReplace']; + oldAsset = json['oldAsset']; + isParent = json['isParent']; + parentAsset = json['parentAsset']; + assetType = json['assetType']; + site = json['site'] != null ? new Site.fromJson(json['site']) : null; + building = json['building']; + floor = json['floor']; + department = json['department'] != null ? new Department.fromJson(json['department']) : null; + room = json['room']; + testsDay = json['testsDay']; + purchasingPrice = json['purchasingPrice']; + nbv = json['nbv']; + currency = json['currency']; + poNo = json['poNo']; + invoiceNumber = json['invoiceNumber']; + invoiceDate = json['invoiceDate']; + replacementDate = json['replacementDate']; + originDepartment = json['originDepartment'] != null ? new Department.fromJson(json['originDepartment']) : null; + originSite = json['originSite'] != null ? new Site.fromJson(json['originSite']) : null; + budgetYear = json['budgetYear']; + lastPOPrice = json['lastPOPrice']; + commissioningStatus = json['commissioningStatus']; + productionDate = json['productionDate']; + edd = json['edd']; + technicalInspectionDate = json['technicalInspectionDate']; + deliveryInspectionDate = json['deliveryInspectionDate']; + endUserAcceptanceDate = json['endUserAcceptanceDate']; + receivingCommittee = json['receivingCommittee']; + siteWarrantyMonths = json['siteWarrantyMonths']; + extendedWarrantyMonths = json['extendedWarrantyMonths']; + remainderWarrantyMonths = json['remainderWarrantyMonths']; + eomWarrantyMonthsNo = json['eomWarrantyMonthsNo']; + warrantyValue = json['warrantyValue']; + warrantyEndDate = json['warrantyEndDate']; + warrantyContractConditions = json['warrantyContractConditions']; + if (json['technicalGuidanceBooks'] != null) { + technicalGuidanceBooks = []; + json['technicalGuidanceBooks'].forEach((v) { + //technicalGuidanceBooks.add(new Null.fromJson(v)); + }); + } + comment = json['comment']; + tagCode = json['tagCode']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['assetSerialNo'] = this.assetSerialNo; + data['systemID'] = this.systemID; + data['assetNumber'] = this.assetNumber; + if (this.modelDefinition != null) { + data['modelDefinition'] = this.modelDefinition.toJson(); + } + data['supplier'] = this.supplier; + data['ipAddress'] = this.ipAddress; + data['macAddress'] = this.macAddress; + data['portNumber'] = this.portNumber; + data['assetReplace'] = this.assetReplace; + data['oldAsset'] = this.oldAsset; + data['isParent'] = this.isParent; + data['parentAsset'] = this.parentAsset; + data['assetType'] = this.assetType; + if (this.site != null) { + data['site'] = this.site.toJson(); + } + data['building'] = this.building; + data['floor'] = this.floor; + if (this.department != null) { + data['department'] = this.department.toJson(); + } + data['room'] = this.room; + data['testsDay'] = this.testsDay; + data['purchasingPrice'] = this.purchasingPrice; + data['nbv'] = this.nbv; + data['currency'] = this.currency; + data['poNo'] = this.poNo; + data['invoiceNumber'] = this.invoiceNumber; + data['invoiceDate'] = this.invoiceDate; + data['replacementDate'] = this.replacementDate; + if (this.originDepartment != null) { + data['originDepartment'] = this.originDepartment.toJson(); + } + if (this.originSite != null) { + data['originSite'] = this.originSite.toJson(); + } + data['budgetYear'] = this.budgetYear; + data['lastPOPrice'] = this.lastPOPrice; + data['commissioningStatus'] = this.commissioningStatus; + data['productionDate'] = this.productionDate; + data['edd'] = this.edd; + data['technicalInspectionDate'] = this.technicalInspectionDate; + data['deliveryInspectionDate'] = this.deliveryInspectionDate; + data['endUserAcceptanceDate'] = this.endUserAcceptanceDate; + data['receivingCommittee'] = this.receivingCommittee; + data['siteWarrantyMonths'] = this.siteWarrantyMonths; + data['extendedWarrantyMonths'] = this.extendedWarrantyMonths; + data['remainderWarrantyMonths'] = this.remainderWarrantyMonths; + data['eomWarrantyMonthsNo'] = this.eomWarrantyMonthsNo; + data['warrantyValue'] = this.warrantyValue; + data['warrantyEndDate'] = this.warrantyEndDate; + data['warrantyContractConditions'] = this.warrantyContractConditions; + if (this.technicalGuidanceBooks != null) { + data['technicalGuidanceBooks'] = this.technicalGuidanceBooks.map((v) => v.toJson()).toList(); + } + data['comment'] = this.comment; + data['tagCode'] = this.tagCode; + return data; + } +} + +class ModelDefinition { + int id; + String assetName; + String modelDefCode; + String modelName; + int manufacturerId; + String manufacturerName; + String supplierName; + String replacementDate; + int lifeSpan; + List modelDefRelatedDefects; + List suppliers; + + ModelDefinition( + {this.id, + this.assetName, + this.modelDefCode, + this.modelName, + this.manufacturerId, + this.manufacturerName, + this.supplierName, + this.replacementDate, + this.lifeSpan, + this.modelDefRelatedDefects, + this.suppliers}); + + ModelDefinition.fromJson(Map json) { + id = json['id']; + assetName = json['assetName']; + modelDefCode = json['modelDefCode']; + modelName = json['modelName']; + manufacturerId = json['manufacturerId']; + manufacturerName = json['manufacturerName']; + supplierName = json['supplierName']; + replacementDate = json['replacementDate']; + lifeSpan = json['lifeSpan']; + if (json['modelDefRelatedDefects'] != null) { + modelDefRelatedDefects = []; + json['modelDefRelatedDefects'].forEach((v) { + modelDefRelatedDefects.add(new ModelDefRelatedDefects.fromJson(v)); + }); + } + if (json['suppliers'] != null) { + suppliers = []; + json['suppliers'].forEach((v) { + // suppliers!.add(new Null.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['assetName'] = this.assetName; + data['modelDefCode'] = this.modelDefCode; + data['modelName'] = this.modelName; + data['manufacturerId'] = this.manufacturerId; + data['manufacturerName'] = this.manufacturerName; + data['supplierName'] = this.supplierName; + data['replacementDate'] = this.replacementDate; + data['lifeSpan'] = this.lifeSpan; + if (this.modelDefRelatedDefects != null) { + data['modelDefRelatedDefects'] = this.modelDefRelatedDefects.map((v) => v.toJson()).toList(); + } + if (this.suppliers != null) { + data['suppliers'] = this.suppliers.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ModelDefRelatedDefects { + int id; + String defectName; + String workPerformed; + String estimatedTime; + + ModelDefRelatedDefects({this.id, this.defectName, this.workPerformed, this.estimatedTime}); + + ModelDefRelatedDefects.fromJson(Map json) { + id = json['id']; + defectName = json['defectName']; + workPerformed = json['workPerformed']; + estimatedTime = json['estimatedTime']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['defectName'] = this.defectName; + data['workPerformed'] = this.workPerformed; + data['estimatedTime'] = this.estimatedTime; + return data; + } +} + +class Site { + int id; + int customerCode; + String custName; + List buildings; + + Site({this.id, this.customerCode, this.custName, this.buildings}); + + Site.fromJson(Map json) { + id = json['id']; + customerCode = json['customerCode']; + custName = json['custName']; + if (json['buildings'] != null) { + buildings = []; + json['buildings'].forEach((v) { + // buildings!.add(new Null.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['customerCode'] = this.customerCode; + data['custName'] = this.custName; + if (this.buildings != null) { + data['buildings'] = this.buildings.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Department { + int id; + String departmentName; + String departmentCode; + String ntCode; + + Department({this.id, this.departmentName, this.departmentCode, this.ntCode}); + + Department.fromJson(Map json) { + id = json['id']; + departmentName = json['departmentName']; + departmentCode = json['departmentCode']; + ntCode = json['ntCode']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['departmentName'] = this.departmentName; + data['departmentCode'] = this.departmentCode; + data['ntCode'] = this.ntCode; + return data; + } +} + +class AssignedEmployee { + String id; + String name; + + AssignedEmployee({this.id, this.name}); + + AssignedEmployee.fromJson(Map json) { + id = json['id']; + name = json['name']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + return data; + } +} + +class CallSiteContactPerson { + int id; + Null employeeCode; + String name; + String telephone; + String job; + String email; + Null land; + String contactUserId; + + CallSiteContactPerson({this.id, this.employeeCode, this.name, this.telephone, this.job, this.email, this.land, this.contactUserId}); + + CallSiteContactPerson.fromJson(Map json) { + id = json['id']; + employeeCode = json['employeeCode']; + name = json['name']; + telephone = json['telephone']; + job = json['job']; + email = json['email']; + land = json['land']; + contactUserId = json['contactUserId']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['employeeCode'] = this.employeeCode; + data['name'] = this.name; + data['telephone'] = this.telephone; + data['job'] = this.job; + data['email'] = this.email; + data['land'] = this.land; + data['contactUserId'] = this.contactUserId; + return data; + } +} + +class Status { + int id; + String name; + int value; + + Status({this.id, this.name, this.value}); + + Status.fromJson(Map json) { + id = json['id']; + name = json['name']; + value = json['value']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['value'] = this.value; + return data; + } +} + +class Building { + int id; + String name; + int value; + var floor; + + Building({this.id, this.name, this.value,this.floor}); + + Building.fromJson(Map json) { + id = json['id']; + name = json['name']; + value = json['value']; + floor = json['floor']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['value'] = this.value; + data['floor'] = this.floor; + return data; + } +} + diff --git a/lib/models/fault_description.dart b/lib/models/fault_description.dart index 02e67e92..ecc99f7f 100644 --- a/lib/models/fault_description.dart +++ b/lib/models/fault_description.dart @@ -12,11 +12,11 @@ class FaultDescription { estimatedTime = json['estimatedTime']; } num id; - dynamic defectName; + String defectName; String workPerformed; String estimatedTime; FaultDescription copyWith({ num id, - dynamic defectName, + String defectName, String workPerformed, String estimatedTime, }) => FaultDescription( id: id ?? this.id, diff --git a/lib/models/service_report.dart b/lib/models/service_report.dart index e5d5c09d..52dbfac8 100644 --- a/lib/models/service_report.dart +++ b/lib/models/service_report.dart @@ -145,7 +145,7 @@ class ServiceReport { if (visitDate == null) return false; //if(serviceType == null) return false; if (status == null) return false; - if (type == null && assetType == null) return false; + //if (type == null && assetType == null) return false; // if (engineer == null) return false; if (callLastSituation == null) return false; if (callLastSituation?.value == 12) { diff --git a/lib/models/service_request/search_work_order.dart b/lib/models/service_request/search_work_order.dart index a130fee0..713e9125 100644 --- a/lib/models/service_request/search_work_order.dart +++ b/lib/models/service_request/search_work_order.dart @@ -237,7 +237,7 @@ class Asset { String oldAsset; String isParent; String parentAsset; - String assetType; + int assetType; Site site; String building; String floor; 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 2f4b2efe..1336ae07 100644 --- a/lib/views/pages/user/requests/report/create_service_report.dart +++ b/lib/views/pages/user/requests/report/create_service_report.dart @@ -11,6 +11,8 @@ import 'package:test_sa/controllers/providers/api/status_drop_down/report/servic import 'package:test_sa/controllers/providers/api/user_provider.dart'; import 'package:test_sa/controllers/providers/settings/setting_provider.dart'; import 'package:test_sa/controllers/validator/validator.dart'; +import 'package:test_sa/models/call_request_for_work_order_model.dart'; +import 'package:test_sa/models/engineer.dart'; import 'package:test_sa/models/part.dart'; import 'package:test_sa/models/service_report.dart'; import 'package:test_sa/models/service_request/service_request.dart'; @@ -28,6 +30,7 @@ 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'; @@ -74,6 +77,7 @@ class _CreateServiceReportState extends State with TickerPr parts: [], ); super.initState(); + // _isLoading = true; } @override @@ -83,14 +87,29 @@ class _CreateServiceReportState extends State with TickerPr super.dispose(); } + CallRequestForWorkOrder _callRequestForWorkOrder; + + void getRequestForWorkOrder() async { + _isLoading = true; + setState(() {}); + _callRequestForWorkOrder = await _serviceRequestsProvider.getCallRequestForWorkOrder(callId: widget.request.id); + _serviceReport.engineer = Engineer.fromJson(_callRequestForWorkOrder.assignedEmployee?.toJson()); + await _assetTypeProvider.getTypes(user: _userProvider.user, host: _settingProvider.host); + _isLoading = false; + setState(() {}); + } + @override Widget build(BuildContext context) { _userProvider = Provider.of(context); _settingProvider = Provider.of(context); _serviceRequestsProvider = Provider.of(context); _assetTypeProvider = Provider.of(context); + if (_callRequestForWorkOrder == null) { + getRequestForWorkOrder(); + } _serviceReport.assetType = _assetTypeProvider.statuses?.firstWhere( - (element) => element.value == widget.request?.device?.hospital?.id, + (element) => element.value == _callRequestForWorkOrder?.assetType, orElse: () => null, ); _subtitle = AppLocalization.of(context).subtitle; @@ -273,6 +292,7 @@ class _CreateServiceReportState extends State with TickerPr const SizedBox( height: 4, ), + LoadingManager( isLoading: _assetTypeProvider.isLoading, isFailedLoading: _assetTypeProvider.statuses == null, @@ -281,7 +301,7 @@ class _CreateServiceReportState extends State with TickerPr _assetTypeProvider.reset(); await _assetTypeProvider.getTypes(user: _userProvider.user, host: _settingProvider.host); _serviceReport?.assetType = _assetTypeProvider.statuses?.firstWhere( - (element) => element.value == widget.request?.device?.hospital?.id, + (element) => element.value == _callRequestForWorkOrder.assetType, orElse: () => null, ); }, @@ -589,9 +609,9 @@ class _CreateServiceReportState extends State with TickerPr // _serviceReport.engineer = engineer; // }, // ), - // const SizedBox( - // height: 8, - // ), + const SizedBox( + height: 8, + ), // invoice number & code _serviceReport.callLastSituation?.id != 12 ? const SizedBox.shrink() @@ -674,37 +694,39 @@ class _CreateServiceReportState extends State with TickerPr 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, - // ), + 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, + enable: false, + hintText: _serviceReport.faultDescription?.workPerformed ?? "", + 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( diff --git a/lib/views/widgets/status/report/fault_desc_menu.dart b/lib/views/widgets/status/report/fault_desc_menu.dart index 4d9e2aed..9250c7dd 100644 --- a/lib/views/widgets/status/report/fault_desc_menu.dart +++ b/lib/views/widgets/status/report/fault_desc_menu.dart @@ -94,7 +94,7 @@ class _SingleStatusMenuState extends State { return DropdownMenuItem( value: value, child: Text( - value.defectName, + value.defectName ?? "", style: Theme.of(context).textTheme.subtitle1.copyWith( color: Theme.of(context).primaryColor, fontSize: 11, diff --git a/lib/views/widgets/status/report/service_report_fault_description.dart b/lib/views/widgets/status/report/service_report_fault_description.dart index 9b0d851f..544fcbb3 100644 --- a/lib/views/widgets/status/report/service_report_fault_description.dart +++ b/lib/views/widgets/status/report/service_report_fault_description.dart @@ -26,7 +26,7 @@ class ServiceReportFaultDescription extends StatelessWidget { stateCode: menuProvider.stateCode, onRefresh: () async { menuProvider.reset(); - await menuProvider.getData(user: userProvider.user, host: settingProvider.host, requestId: requestId); + await menuProvider.getCallRequestForWorkOrder(user: userProvider.user, host: settingProvider.host, requestId: requestId); }, child: (menuProvider.items?.isEmpty ?? true) ? const ATextFormField(