diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index cf4849f..65c8935 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -1,4 +1,4 @@ -class URLs{ +class URLs { URLs._(); static const host2 = "http://194.163.164.213/atoms/api"; static const host1 = "https://atomsuat.hmg.com"; // uat url @@ -11,8 +11,7 @@ class URLs{ set host(String value) => _host = value; - static String getFileUrl(String file) => file == null || file.isEmpty - ? null : "$_host/attachment/$file"; + static String getFileUrl(String file) => file == null || file.isEmpty ? null : "$_host/attachment/$file"; // API Routes static get login => "$_baseUrl/MobileAuth/Login"; // post @@ -39,7 +38,7 @@ class URLs{ static get getRecentNotifications => "$_baseUrl/return/user/recent/notification"; // get static get createRequest => "$_baseUrl/CallRequest/AddCallRequest"; // get static get createReport => "$_baseUrl/handle/create/report/issue"; // get - static get updateRequestDate => "$_baseUrl/handle/update/request"; // get + static get updateRequestDate => "$_baseUrl/CallRequest/UpdateCallRequest"; // get // service report static get createServiceReport => "$_baseUrl/WorkOrder/AddWorkOrder"; // get @@ -47,7 +46,7 @@ class URLs{ static get getServiceReport => "$_baseUrl/WorkOrder/GetWorkOrderById"; // get static get createDuplicatedReport => "$_baseUrl/handle/duplicate/request"; // get - static get getServiceReportReasons => "$_baseUrl/Lookups/GetLookup?lookupEnum=522"; // get + static get getServiceReportReasons => "$_baseUrl/Lookups/GetLookup?lookupEnum=522"; // get static get getServiceReportTypes => "$_baseUrl/Lookups/GetLookup?lookupEnum=501"; // get static get getServiceReportStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=521"; // get static get getServiceReportLastCalls => "$_baseUrl/Lookups/GetLookup?lookupEnum=520"; // get @@ -83,5 +82,4 @@ class URLs{ static get getPentryStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=401"; // get // contacts static get getPentryContacts => "$_baseUrl/handle/return/all/contacts"; // get - -} \ No newline at end of file +} diff --git a/lib/controllers/providers/api/service_requests_provider.dart b/lib/controllers/providers/api/service_requests_provider.dart index d80faed..5906225 100644 --- a/lib/controllers/providers/api/service_requests_provider.dart +++ b/lib/controllers/providers/api/service_requests_provider.dart @@ -193,17 +193,15 @@ class ServiceRequestsProvider extends ChangeNotifier { @required ServiceRequest request, }) async { Response response; - Map body = {}; - body["uid"] = user.id; - body["token"] = user.token; - body["nid"] = request.id; - if (newDate != null) body["date"] = newDate; - if (employee != null) body["ass_emp"] = employee.id.toString(); + var body = { + "callCreatedBy": {"id": user.id, "name": user.userName}, + "assets": request.deviceId == null ? [] : [request.deviceId], + "requestedDate": newDate, + "requestedTime": newDate, + }; try { - response = await post( - Uri.parse( - //host+ - URLs.updateRequestDate), + response = await ApiManager.instance.put( + URLs.updateRequestDate, body: body, ); stateCode = response.statusCode; diff --git a/lib/models/device/device.dart b/lib/models/device/device.dart index 5bcecd5..001289e 100644 --- a/lib/models/device/device.dart +++ b/lib/models/device/device.dart @@ -3,7 +3,7 @@ import 'package:test_sa/models/lookup.dart'; import 'model.dart'; -class Device{ +class Device { int id; String serialNumber; String number; @@ -12,7 +12,6 @@ class Device{ ModelDefinition modelDefinition; Hospital hospital; - Device({ this.id, this.serialNumber, @@ -21,20 +20,15 @@ class Device{ // this.brand, // this.model, this.modelDefinition, - }); - - - - factory Device.fromJson(Map parsedJson){ - + factory Device.fromJson(Map parsedJson) { return Device( id: parsedJson["id"], serialNumber: parsedJson["assetSerialNo"], number: parsedJson["assetNumber"], - modelDefinition:ModelDefinition.fromJson(parsedJson["modelDefinition"]), - hospital:Hospital.fromJson(parsedJson["site"]), + modelDefinition: ModelDefinition.fromJson(parsedJson["modelDefinition"]), + hospital: Hospital.fromJson(parsedJson["site"]), // parsedJson["modelDefinition"] == null ? "" : // parsedJson["modelDefinition"]["manufacturerName"], // model: parsedJson["modelDefinition"] == null ? "" : @@ -42,7 +36,7 @@ class Device{ ); } - factory Device.fromDevice(Device device){ + factory Device.fromDevice(Device device) { return Device( id: device.id, serialNumber: device.serialNumber, @@ -59,7 +53,8 @@ class Device{ 'assetNumber': number, 'modelDefinition': modelDefinition.toJson(), 'site': hospital.toMap(), - 'AssetType':assetType.toMap(), + 'AssetType': assetType.toMap(), + "supplier": {"id": 0, "suppliername": "string"}, }; } -} \ No newline at end of file +} diff --git a/lib/models/service_report.dart b/lib/models/service_report.dart index af66ca7..8abb130 100644 --- a/lib/models/service_report.dart +++ b/lib/models/service_report.dart @@ -113,41 +113,6 @@ class ServiceReport { } _map["nurseSignature"] = signatureNurse; _map["engSignature"] = signatureEngineer; - - // ///TODO : zaid - // _map["supplier"] = { - // "id": 0, - // "suppliername": "string", - // "name": "string", - // "website": "string", - // "email": "string", - // "code": "string", - // "suppNo": 0, - // "suppStatusId": 0, - // "cityId": 0, - // "person": "string", - // "comment": "string", - // "zipcode": 0, - // "contact": "string", - // "telephones": [ - // {"id": 0, "supplierId": 0, "telephone": "string"} - // ], - // "faxes": [ - // {"id": 0, "supplierId": 0, "fax": "string"} - // ], - // "addresses": [ - // {"id": 0, "supplierId": 0, "address": "string"} - // ], - // "attachments": [ - // {"id": 0, "supplierId": 0, "attachmentName": "string", "attachmentURL": "string"} - // ], - // "suppPersons": [ - // {"id": 0, "supplierId": 0, "personName": "string", "personRoleId": 0, "contact": "string", "externalEngCode": "string", "email": "string"} - // ], - // "suppTCodes": [ - // {"id": 0, "supplierId": 0, "codeTypeId": 0, "codeValue": "string"} - // ] - // }; return _map; }