diff --git a/lib/config/config.dart b/lib/config/config.dart index 4972ab64..24712062 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,10 +21,10 @@ var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; // var BASE_URL = 'http://10.50.100.198:4422/'; -var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.20.200.111:1010/'; - // var BASE_URL = 'https://uat.hmgwebservices.com/'; + var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -343,7 +343,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnari var CHANNEL = 3; var GENERAL_ID = 'Cs2020@2016\$2958'; var IP_ADDRESS = '10.20.10.20'; -var VERSION_ID = 11.8; +var VERSION_ID = 11.9; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/core/model/reports/Reports.dart b/lib/core/model/reports/Reports.dart index 315aae6f..9e3d59f0 100644 --- a/lib/core/model/reports/Reports.dart +++ b/lib/core/model/reports/Reports.dart @@ -5,6 +5,7 @@ class Reports { DateTime? encounterDate; int? projectID; int? invoiceNo; + dynamic invoiceNo_VP; int? encounterNo; String? procedureId; int? requestType; @@ -35,6 +36,7 @@ class Reports { this.encounterDate, this.projectID, this.invoiceNo, + this.invoiceNo_VP, this.encounterNo, this.procedureId, this.requestType, @@ -63,10 +65,10 @@ class Reports { Reports.fromJson(Map json) { try { status = json['Status']; - encounterDate = DateUtil.convertStringToDate( - json['EncounterDate']); //json['EncounterDate']; + encounterDate = DateUtil.convertStringToDate(json['EncounterDate']); //json['EncounterDate']; projectID = json['ProjectID']; invoiceNo = json['InvoiceNo']; + invoiceNo_VP = json['InvoiceNo_VP']; encounterNo = json['EncounterNo']; procedureId = json['ProcedureId']; requestType = json['RequestType']; @@ -74,11 +76,9 @@ class Reports { patientID = json['PatientID']; doctorID = json['DoctorID']; clinicID = json['ClinicID']; - requestDate = DateUtil.convertStringToDate( - json['RequestDate']); //json['RequestDate']; + requestDate = DateUtil.convertStringToDate(json['RequestDate']); //json['RequestDate']; isRead = json['IsRead']; - isReadOn = - DateUtil.convertStringToDate(json['IsReadOn']); //json['IsReadOn']; + isReadOn = DateUtil.convertStringToDate(json['IsReadOn']); //json['IsReadOn']; actualDoctorRate = json['ActualDoctorRate']; clinicDescription = json['ClinicDescription']; clinicDescriptionN = json['ClinicDescriptionN']; @@ -93,7 +93,7 @@ class Reports { noOfPatientsRate = json['NoOfPatientsRate']; projectName = json['ProjectName']; projectNameN = json['ProjectNameN']; - }catch(e){ + } catch (e) { print(e); } } @@ -104,6 +104,7 @@ class Reports { data['EncounterDate'] = this.encounterDate; data['ProjectID'] = this.projectID; data['InvoiceNo'] = this.invoiceNo; + data['InvoiceNo_VP'] = this.invoiceNo_VP; data['EncounterNo'] = this.encounterNo; data['ProcedureId'] = this.procedureId; data['RequestType'] = this.requestType; @@ -135,7 +136,7 @@ class Reports { class ReportsList { String? filterName = ""; - List reportsList =[]; + List reportsList = []; ReportsList({this.filterName, Reports? reports}) { reportsList.add(reports!); diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 371d5d0e..70502112 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -30,8 +30,7 @@ AppSharedPreferences sharedPref = new AppSharedPreferences(); /// onFailure: (String error, int statusCode) {}, /// body: Map(); /// -AuthenticatedUserObject authenticatedUserObject = - locator(); +AuthenticatedUserObject authenticatedUserObject = locator(); VitalSignService _vitalSignService = locator(); class BaseAppClient { @@ -55,17 +54,12 @@ class BaseAppClient { url = BASE_URL + endPoint; } try { - String? pharmacyToken = - await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN); + String? pharmacyToken = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN); var user = await sharedPref.getObject(USER_PROFILE); - Map headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }; + Map headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}; if (!isExternal) { String? token = await sharedPref.getString(TOKEN); - String? languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + String? languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); if (endPoint == SEND_ACTIVATION_CODE) { languageID = 'en'; } @@ -81,24 +75,19 @@ class BaseAppClient { body['Channel'] = CHANNEL; if (body.containsKey('LanguageID')) { - - if(body['LanguageID'] != null) { + if (body['LanguageID'] != null) { //change this line because language issue happened on dental - body['LanguageID'] = body['LanguageID'] =='ar' ? 1 : body['LanguageID'] =='en' ? 2 : body['LanguageID']; + body['LanguageID'] = body['LanguageID'] == 'ar' + ? 1 + : body['LanguageID'] == 'en' + ? 2 + : body['LanguageID']; } else { - body['LanguageID'] = - Provider.of(AppGlobal.context, listen: false) - .isArabic - ? 1 - : 2; + body['LanguageID'] = Provider.of(AppGlobal.context, listen: false).isArabic ? 1 : 2; } } else { // body['LanguageID'] = (languageID.toString().toLowerCase() == 'ar' ? 1 : 2); - body['LanguageID'] = - Provider.of(AppGlobal.context, listen: false) - .isArabic - ? 1 - : 2; + body['LanguageID'] = Provider.of(AppGlobal.context, listen: false).isArabic ? 1 : 2; } // body['LanguageID'] = Provider.of(AppGlobal.context, listen: false).isArabic ? 1 : 2; @@ -114,12 +103,11 @@ class BaseAppClient { body['Longitude'] = long; if (body.containsKey('isDentalAllowedBackend')) { - body['isDentalAllowedBackend'] = - body.containsKey('isDentalAllowedBackend') - ? body['isDentalAllowedBackend'] != null - ? body['isDentalAllowedBackend'] - : IS_DENTAL_ALLOWED_BACKEND - : IS_DENTAL_ALLOWED_BACKEND; + body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') + ? body['isDentalAllowedBackend'] != null + ? body['isDentalAllowedBackend'] + : IS_DENTAL_ALLOWED_BACKEND + : IS_DENTAL_ALLOWED_BACKEND; } body['DeviceTypeID'] = Platform.isIOS @@ -163,16 +151,15 @@ class BaseAppClient { if (user != null) { body['TokenID'] = body['TokenID'] != null ? body['TokenID'] : token; - body['PatientID'] = body['PatientID'] != null - ? body['PatientID'] - : user['PatientID']; + body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID']; body['PatientOutSA'] = body.containsKey('PatientOutSA') ? body['PatientOutSA'] != null ? body['PatientOutSA'] : user['OutSA'] : user['OutSA']; - body['SessionID'] = getSessionId(body['TokenID']); //getSe + body['SessionID'] = getSessionId(body['TokenID'] != null ? body['TokenID'] : ""); //getSe + // body['SessionID'] = body['TokenID']; //getSe // headers = { // 'Content-Type': 'application/json', @@ -188,7 +175,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 291367; //3844083 + // body['PatientID'] = 1400563; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 @@ -203,15 +190,12 @@ class BaseAppClient { print(jsonBody); // } - if (await Utils.checkConnection( - bypassConnectionCheck: bypassConnectionCheck)) { - final response = await http.post(Uri.parse(url.trim()), - body: json.encode(body), headers: headers); + if (await Utils.checkConnection(bypassConnectionCheck: bypassConnectionCheck)) { + final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers); final int statusCode = response.statusCode; if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); - logApiEndpointError( - endPoint, 'Error While Fetching data', statusCode); + logApiEndpointError(endPoint, 'Error While Fetching data', statusCode); } else { // var decoded = utf8.decode(response.bodyBytes); var parsed = json.decode(utf8.decode(response.bodyBytes)); @@ -225,12 +209,8 @@ class BaseAppClient { onSuccess(parsed, statusCode); } else { if (parsed['ErrorType'] == 4) { - navigateToAppUpdate( - AppGlobal.context, parsed['ErrorEndUserMessage']); - logApiEndpointError( - endPoint, - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + navigateToAppUpdate(AppGlobal.context, parsed['ErrorEndUserMessage']); + logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } if (parsed['ErrorType'] == 2) { await logout(); @@ -249,46 +229,28 @@ class BaseAppClient { // if (parsed != null) { // onSuccess(parsed, statusCode); // } else { - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); - logApiEndpointError( - endPoint, - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); // logout(); // } } - } else if (parsed['MessageStatus'] == 1 || - parsed['SMSLoginRequired'] == true) { + } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { onSuccess(parsed, statusCode); - } else if (parsed['MessageStatus'] == 2 && - parsed['IsAuthenticated']) { + } else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) { if (parsed['SameClinicApptList'] != null) { onSuccess(parsed, statusCode); } else { - if (parsed['message'] == null && - parsed['ErrorEndUserMessage'] == null) { + if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) { if (parsed['ErrorSearchMsg'] == null) { - onFailure("Server Error found with no available message", - statusCode); - logApiEndpointError( - endPoint, - "Server Error found with no available message", - statusCode); + onFailure("Server Error found with no available message", statusCode); + logApiEndpointError(endPoint, "Server Error found with no available message", statusCode); } else { onFailure(parsed['ErrorSearchMsg'], statusCode); - logApiEndpointError( - endPoint, parsed['ErrorSearchMsg'], statusCode); + logApiEndpointError(endPoint, parsed['ErrorSearchMsg'], statusCode); } } else { - onFailure( - parsed['message'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage'], - statusCode); - logApiEndpointError(endPoint, - parsed['message'] ?? parsed['message'], statusCode); + onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + logApiEndpointError(endPoint, parsed['message'] ?? parsed['message'], statusCode); } } } @@ -300,18 +262,11 @@ class BaseAppClient { onSuccess(parsed, statusCode); } else { if (parsed['message'] != null) { - onFailure( - parsed['message'] ?? parsed['message'], statusCode); - logApiEndpointError(endPoint, - parsed['message'] ?? parsed['message'], statusCode); + onFailure(parsed['message'] ?? parsed['message'], statusCode); + logApiEndpointError(endPoint, parsed['message'] ?? parsed['message'], statusCode); } else { - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); - logApiEndpointError( - endPoint, - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } } @@ -320,8 +275,7 @@ class BaseAppClient { } } else { onFailure('Please Check The Internet Connection', -1); - _analytics.errorTracking - .log("internet_connectivity", error: "no internet available"); + _analytics.errorTracking.log("internet_connectivity", error: "no internet available"); } } catch (e) { print(e); @@ -331,11 +285,7 @@ class BaseAppClient { } postPharmacy(String endPoint, - {Map? body, - Function(dynamic response, int statusCode)? onSuccess, - Function(String error, int statusCode)? onFailure, - bool isAllowAny = false, - bool isExternal = false}) async { + {Map? body, Function(dynamic response, int statusCode)? onSuccess, Function(String error, int statusCode)? onFailure, bool isAllowAny = false, bool isExternal = false}) async { var token = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN); var user = await sharedPref.getObject(USER_PROFILE); String url; @@ -352,16 +302,13 @@ class BaseAppClient { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': pharmacyToken ?? '', - 'Mobilenumber': user != null - ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) - : "", + 'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "", 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', 'Username': user != null ? user['PatientID'].toString() : "", }; if (!isExternal) { String token = await sharedPref.getString(TOKEN); - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); // if (body.containsKey('SetupID')) { // body['SetupID'] = body.containsKey('SetupID') @@ -423,14 +370,12 @@ class BaseAppClient { print("Headers : ${json.encode(headers)}"); if (await Utils.checkConnection()) { - final response = await http.post(Uri.parse(url.trim()), - body: json.encode(body), headers: headers); + final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers); final int statusCode = response.statusCode; // print("statusCode :$statusCode"); if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure!('Error While Fetching data', statusCode); - logApiEndpointError( - endPoint, 'Error While Fetching data', statusCode); + logApiEndpointError(endPoint, 'Error While Fetching data', statusCode); } else { // var parsed = json.decode(response.body.toString()); var parsed = json.decode(utf8.decode(response.bodyBytes)); @@ -438,12 +383,8 @@ class BaseAppClient { onSuccess!(parsed, statusCode); } else { if (parsed['ErrorType'] == 4) { - navigateToAppUpdate( - AppGlobal.context, parsed['ErrorEndUserMessage']); - logApiEndpointError( - endPoint, - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + navigateToAppUpdate(AppGlobal.context, parsed['ErrorEndUserMessage']); + logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } if (isAllowAny) { onSuccess!(parsed, statusCode); @@ -458,56 +399,29 @@ class BaseAppClient { if (parsed != null) { onSuccess!(parsed, statusCode); } else { - onFailure!( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); - logApiEndpointError( - endPoint, - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); - logApiEndpointError( - endPoint, 'session logged out', statusCode); + onFailure!(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + logApiEndpointError(endPoint, 'session logged out', statusCode); logout(); } } - } else if (parsed['MessageStatus'] == 1 || - parsed['SMSLoginRequired'] == true) { + } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { onSuccess!(parsed, statusCode); - } else if (parsed['MessageStatus'] == 2 && - parsed['IsAuthenticated']) { + } else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) { if (parsed['SameClinicApptList'] != null) { onSuccess!(parsed, statusCode); } else { - if (parsed['message'] == null && - parsed['ErrorEndUserMessage'] == null) { + if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) { if (parsed['ErrorSearchMsg'] == null) { - onFailure!("Server Error found with no available message", - statusCode); - logApiEndpointError( - endPoint, - "Server Error found with no available message", - statusCode); + onFailure!("Server Error found with no available message", statusCode); + logApiEndpointError(endPoint, "Server Error found with no available message", statusCode); } else { onFailure!(parsed['ErrorSearchMsg'], statusCode); - logApiEndpointError( - endPoint, - parsed['ErrorSearchMsg'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage'], - statusCode); + logApiEndpointError(endPoint, parsed['ErrorSearchMsg'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } else { - onFailure!( - parsed['message'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage'], - statusCode); - logApiEndpointError( - endPoint, - parsed['message'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage'], - statusCode); + onFailure!(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + logApiEndpointError(endPoint, parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } } else if (!parsed['IsAuthenticated']) { @@ -519,22 +433,11 @@ class BaseAppClient { onSuccess!(parsed, statusCode); } else { if (parsed['message'] != null) { - onFailure!( - parsed['message'] ?? parsed['message'], statusCode); - logApiEndpointError( - endPoint, - parsed['message'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage'], - statusCode); + onFailure!(parsed['message'] ?? parsed['message'], statusCode); + logApiEndpointError(endPoint, parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } else { - onFailure!( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); - logApiEndpointError( - endPoint, - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + onFailure!(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } } @@ -542,8 +445,7 @@ class BaseAppClient { } } else { onFailure!('Please Check The Internet Connection', -1); - _analytics.errorTracking - .log("internet_connectivity", error: "no internet available"); + _analytics.errorTracking.log("internet_connectivity", error: "no internet available"); } } catch (e) { print(e); @@ -555,8 +457,7 @@ class BaseAppClient { Future navigateToAppUpdate(context, String text) async { Navigator.pushAndRemoveUntil( context, - MaterialPageRoute( - builder: (context) => AppUpdatePage(appUpdateText: text)), + MaterialPageRoute(builder: (context) => AppUpdatePage(appUpdateText: text)), (Route route) => false, ); } @@ -587,10 +488,7 @@ class BaseAppClient { if (await Utils.checkConnection()) { final response = await http.get( Uri.parse(url.trim()), - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }, + headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}, ); final int statusCode = response.statusCode; // print("statusCode :$statusCode"); @@ -604,8 +502,7 @@ class BaseAppClient { } } else { onFailure!('Please Check The Internet Connection', -1); - _analytics.errorTracking - .log("internet_connectivity", error: "no internet available"); + _analytics.errorTracking.log("internet_connectivity", error: "no internet available"); } } @@ -637,9 +534,7 @@ class BaseAppClient { 'Content-Type': 'text/html; charset=utf-8', 'Accept': 'application/json', 'Authorization': token ?? '', - 'Mobilenumber': user != null - ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) - : "", + 'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "", 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', 'Username': user != null ? user['PatientID'].toString() : "", // 'Host': "mdlaboratories.com", @@ -649,19 +544,14 @@ class BaseAppClient { if (statusCode < 200 || statusCode >= 400 || json == null) { if (statusCode == 401) { - onFailure!(TranslationBase.of(AppGlobal.context).pharmacyRelogin, - statusCode); - logApiEndpointError( - endPoint, - TranslationBase.of(AppGlobal.context).pharmacyRelogin, - statusCode); + onFailure!(TranslationBase.of(AppGlobal.context).pharmacyRelogin, statusCode); + logApiEndpointError(endPoint, TranslationBase.of(AppGlobal.context).pharmacyRelogin, statusCode); Navigator.of(AppGlobal.context).pushNamed(HOME); } else { var bodyUtf = json.decode(utf8.decode(response.bodyBytes)); // print(bodyUtf); onFailure!(bodyUtf['error']['ErrorEndUserMsg'], statusCode); - logApiEndpointError( - endPoint, bodyUtf['error']['ErrorEndUserMsg'], statusCode); + logApiEndpointError(endPoint, bodyUtf['error']['ErrorEndUserMsg'], statusCode); } } else { // var parsed = json.decode(response.body.toString()); @@ -670,8 +560,7 @@ class BaseAppClient { } } else { onFailure!('Please Check The Internet Connection', -1); - _analytics.errorTracking - .log("internet_connectivity", error: "no internet available"); + _analytics.errorTracking.log("internet_connectivity", error: "no internet available"); } } @@ -687,8 +576,7 @@ class BaseAppClient { // print("body: $body"); if (await Utils.checkConnection()) { - headers!.addAll( - {'Content-Type': 'application/json', 'Accept': 'application/json'}); + headers!.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.post( Uri.parse(url.trim()), body: json.encode(body), @@ -696,12 +584,7 @@ class BaseAppClient { ); final int statusCode = response.statusCode; // print("statusCode :$statusCode"); - if (await handleUnauthorized(statusCode, forUrl: fullUrl)) - simplePost(fullUrl, - onFailure: onFailure, - onSuccess: onSuccess, - body: body, - headers: headers); + if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simplePost(fullUrl, onFailure: onFailure, onSuccess: onSuccess, body: body, headers: headers); // print(response.body.toString()); @@ -713,16 +596,12 @@ class BaseAppClient { } } else { onFailure!('Please Check The Internet Connection', -1); - _analytics.errorTracking - .log("internet_connectivity", error: "no internet available"); + _analytics.errorTracking.log("internet_connectivity", error: "no internet available"); } } simpleGet(String fullUrl, - {Function(dynamic response, int statusCode)? onSuccess, - Function(String error, int statusCode)? onFailure, - Map? queryParams, - Map? headers}) async { + {Function(dynamic response, int statusCode)? onSuccess, Function(String error, int statusCode)? onFailure, Map? queryParams, Map? headers}) async { headers = headers ?? {}; String url = fullUrl; @@ -734,8 +613,7 @@ class BaseAppClient { } if (await Utils.checkConnection()) { - headers.addAll( - {'Content-Type': 'application/json', 'Accept': 'application/json'}); + headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.get( Uri.parse(url.trim()), headers: headers, @@ -743,12 +621,7 @@ class BaseAppClient { final int statusCode = response.statusCode; // print("statusCode :$statusCode"); - if (await handleUnauthorized(statusCode, forUrl: fullUrl)) - simpleGet(fullUrl, - onFailure: onFailure, - onSuccess: onSuccess, - headers: headers, - queryParams: queryParams); + if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simpleGet(fullUrl, onFailure: onFailure, onSuccess: onSuccess, headers: headers, queryParams: queryParams); if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure!('Error While Fetching data', statusCode); @@ -758,22 +631,17 @@ class BaseAppClient { } } else { onFailure!('Please Check The Internet Connection', -1); - _analytics.errorTracking - .log("internet_connectivity", error: "no internet available"); + _analytics.errorTracking.log("internet_connectivity", error: "no internet available"); } } simplePut(String fullUrl, - {Map? body, - Map? headers, - Function(dynamic response, int statusCode)? onSuccess, - Function(String error, int statusCode)? onFailure}) async { + {Map? body, Map? headers, Function(dynamic response, int statusCode)? onSuccess, Function(String error, int statusCode)? onFailure}) async { String url = fullUrl; // print("URL Query String: $url"); if (await Utils.checkConnection()) { - headers!.addAll( - {'Content-Type': 'application/json', 'Accept': 'application/json'}); + headers!.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.put( Uri.parse(url.trim()), body: json.encode(body), @@ -782,12 +650,7 @@ class BaseAppClient { final int statusCode = response.statusCode; // print("statusCode :$statusCode"); - if (await handleUnauthorized(statusCode, forUrl: fullUrl)) - simplePut(fullUrl, - onFailure: onFailure, - onSuccess: onSuccess, - headers: headers, - body: body); + if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simplePut(fullUrl, onFailure: onFailure, onSuccess: onSuccess, headers: headers, body: body); if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure!('Error While Fetching data', statusCode); @@ -797,16 +660,12 @@ class BaseAppClient { } } else { onFailure!('Please Check The Internet Connection', -1); - _analytics.errorTracking - .log("internet_connectivity", error: "no internet available"); + _analytics.errorTracking.log("internet_connectivity", error: "no internet available"); } } simpleDelete(String fullUrl, - {Function(dynamic response, int statusCode)? onSuccess, - Function(String error, int statusCode)? onFailure, - Map? queryParams, - Map? headers}) async { + {Function(dynamic response, int statusCode)? onSuccess, Function(String error, int statusCode)? onFailure, Map? queryParams, Map? headers}) async { String url = fullUrl; // print("URL Query String: $url"); @@ -818,8 +677,7 @@ class BaseAppClient { } if (await Utils.checkConnection()) { - headers!.addAll( - {'Content-Type': 'application/json', 'Accept': 'application/json'}); + headers!.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); final response = await http.delete( Uri.parse(url.trim()), headers: headers, @@ -827,12 +685,7 @@ class BaseAppClient { final int statusCode = response.statusCode; // print("statusCode :$statusCode"); - if (await handleUnauthorized(statusCode, forUrl: fullUrl)) - simpleDelete(fullUrl, - onFailure: onFailure, - onSuccess: onSuccess, - queryParams: queryParams, - headers: headers); + if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simpleDelete(fullUrl, onFailure: onFailure, onSuccess: onSuccess, queryParams: queryParams, headers: headers); if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure!('Error While Fetching data', statusCode); @@ -842,13 +695,11 @@ class BaseAppClient { } } else { onFailure!('Please Check The Internet Connection', -1); - _analytics.errorTracking - .log("internet_connectivity", error: "no internet available"); + _analytics.errorTracking.log("internet_connectivity", error: "no internet available"); } } - Future handleUnauthorized(int statusCode, - {required String forUrl}) async { + Future handleUnauthorized(int statusCode, {required String forUrl}) async { if (forUrl.startsWith(EXA_CART_API_BASE_URL) && statusCode == 401) { final token = await generatePackagesToken(); packagesAuthHeader['Authorization'] = 'Bearer $token'; @@ -861,10 +712,8 @@ class BaseAppClient { await sharedPref.remove(LOGIN_TOKEN_ID); await sharedPref.remove(PHARMACY_CUSTOMER_ID); await authenticatedUserObject.getUser(); - Provider.of(AppGlobal.context, listen: false).isLogin = - false; - var model = - Provider.of(AppGlobal.context, listen: false); + Provider.of(AppGlobal.context, listen: false).isLogin = false; + var model = Provider.of(AppGlobal.context, listen: false); _vitalSignService.weightKg = ""; _vitalSignService.heightCm = ""; model.setState(0, 0, false, null); @@ -873,13 +722,13 @@ class BaseAppClient { String getSessionId(String id) { ///return id.replaceAll(RegExp('/[^\w\s]/'), ''); + // if (id != null) return id.replaceAll(RegExp('/[^a-zA-Z]'), ''); return id.replaceAll(RegExp('/[^a-zA-Z]'), ''); } static defaultHttpParameters() async { String token = await sharedPref.getString(TOKEN); - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); var user = await sharedPref.getObject(USER_PROFILE); var params = {}; if (user != null) { @@ -899,11 +748,7 @@ class BaseAppClient { } pharmacyPost(String endPoint, - {Map? body, - Function(dynamic response, int statusCode)? onSuccess, - Function(String error, int statusCode)? onFailure, - bool isAllowAny = false, - bool isExternal = false}) async { + {Map? body, Function(dynamic response, int statusCode)? onSuccess, Function(String error, int statusCode)? onFailure, bool isAllowAny = false, bool isExternal = false}) async { var token = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN); var user = await sharedPref.getObject(USER_PROFILE); String url; @@ -915,8 +760,7 @@ class BaseAppClient { try { if (isExternal) { String token = await sharedPref.getString(TOKEN); - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); var user = await sharedPref.getObject(USER_PROFILE); if (body!.containsKey('SetupID')) { body['SetupID'] = body.containsKey('SetupID') @@ -939,12 +783,11 @@ class BaseAppClient { : user['OutSA']; if (body.containsKey('isDentalAllowedBackend')) { - body['isDentalAllowedBackend'] = - body.containsKey('isDentalAllowedBackend') - ? body['isDentalAllowedBackend'] != null - ? body['isDentalAllowedBackend'] - : IS_DENTAL_ALLOWED_BACKEND - : IS_DENTAL_ALLOWED_BACKEND; + body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') + ? body['isDentalAllowedBackend'] != null + ? body['isDentalAllowedBackend'] + : IS_DENTAL_ALLOWED_BACKEND + : IS_DENTAL_ALLOWED_BACKEND; } body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; @@ -967,9 +810,7 @@ class BaseAppClient { : user['PatientType']; if (user != null) { body['TokenID'] = token; - body['PatientID'] = body['PatientID'] != null - ? body['PatientID'] - : user['PatientID']; + body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID']; body['PatientOutSA'] = user['OutSA']; // body['SessionID'] = SESSION_ID; //getSessionId(token); } @@ -981,14 +822,11 @@ class BaseAppClient { var ss = json.encode(body); if (await Utils.checkConnection()) { - final response = await http - .post(Uri.parse(url.trim()), body: json.encode(body), headers: { + final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': token ?? '', - 'Mobilenumber': user != null - ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) - : "", + 'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "", 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', 'Username': user != null ? user['PatientID'].toString() : "", }); @@ -996,15 +834,8 @@ class BaseAppClient { // print("statusCode :$statusCode"); if (statusCode < 200 || statusCode >= 400 || json == null) { var parsed = json.decode(utf8.decode(response.bodyBytes)); - onFailure!( - parsed['error']['ErrorEndUserMsgN'] ?? - 'Error While Fetching data', - statusCode); - logApiEndpointError( - endPoint, - parsed['error']['ErrorEndUserMsgN'] ?? - 'Error While Fetching data', - statusCode); + onFailure!(parsed['error']['ErrorEndUserMsgN'] ?? 'Error While Fetching data', statusCode); + logApiEndpointError(endPoint, parsed['error']['ErrorEndUserMsgN'] ?? 'Error While Fetching data', statusCode); } else { // var parsed = json.decode(response.body.toString()); var parsed = json.decode(utf8.decode(response.bodyBytes)); @@ -1012,8 +843,7 @@ class BaseAppClient { onSuccess!(parsed, statusCode); } else { if (parsed['ErrorType'] == 4) { - navigateToAppUpdate( - AppGlobal.context, parsed['ErrorEndUserMessage']); + navigateToAppUpdate(AppGlobal.context, parsed['ErrorEndUserMessage']); } if (isAllowAny) { onSuccess!(parsed, statusCode); @@ -1028,47 +858,25 @@ class BaseAppClient { if (parsed != null) { onSuccess!(parsed, statusCode); } else { - onFailure!( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); - logApiEndpointError( - endPoint, - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + onFailure!(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); logout(); } } - } else if (parsed['MessageStatus'] == 1 || - parsed['SMSLoginRequired'] == true) { + } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { onSuccess!(parsed, statusCode); - } else if (parsed['MessageStatus'] == 2 && - parsed['IsAuthenticated']) { - if (parsed['message'] == null && - parsed['ErrorEndUserMessage'] == null) { + } else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) { + if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) { if (parsed['ErrorSearchMsg'] == null) { - onFailure!("Server Error found with no available message", - statusCode); - logApiEndpointError( - endPoint, - "Server Error found with no available message", - statusCode); + onFailure!("Server Error found with no available message", statusCode); + logApiEndpointError(endPoint, "Server Error found with no available message", statusCode); } else { onFailure!(parsed['ErrorSearchMsg'], statusCode); - logApiEndpointError( - endPoint, parsed['ErrorSearchMsg'], statusCode); + logApiEndpointError(endPoint, parsed['ErrorSearchMsg'], statusCode); } } else { - onFailure!( - parsed['message'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage'], - statusCode); - logApiEndpointError( - endPoint, - parsed['message'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage'], - statusCode); + onFailure!(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + logApiEndpointError(endPoint, parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } else if (!parsed['IsAuthenticated']) { await logout(); @@ -1079,18 +887,11 @@ class BaseAppClient { onSuccess!(parsed, statusCode); } else { if (parsed['message'] != null) { - onFailure!( - parsed['message'] ?? parsed['message'], statusCode); - logApiEndpointError(endPoint, - parsed['message'] ?? parsed['message'], statusCode); + onFailure!(parsed['message'] ?? parsed['message'], statusCode); + logApiEndpointError(endPoint, parsed['message'] ?? parsed['message'], statusCode); } else { - onFailure!( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); - logApiEndpointError( - endPoint, - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + onFailure!(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } } @@ -1098,8 +899,7 @@ class BaseAppClient { } } else { onFailure!('Please Check The Internet Connection', -1); - _analytics.errorTracking - .log("internet_connectivity", error: "no internet available"); + _analytics.errorTracking.log("internet_connectivity", error: "no internet available"); } } catch (e) { print(e); @@ -1111,15 +911,11 @@ class BaseAppClient { Future generatePackagesToken() async { var url = EXA_CART_API_BASE_URL + PACKAGES_TOKEN; var body = { - "api_client": { - "client_id": "a4ab6be4-424f-4836-b032-46caed88e184", - "client_secret": "3c1a3e07-4a40-4510-9fb0-ee5f0a72752c" - } + "api_client": {"client_id": "a4ab6be4-424f-4836-b032-46caed88e184", "client_secret": "3c1a3e07-4a40-4510-9fb0-ee5f0a72752c"} }; String? token; final completer = Completer(); - simplePost(url, body: body, headers: {}, - onSuccess: (dynamic stringResponse, int statusCode) { + simplePost(url, body: body, headers: {}, onSuccess: (dynamic stringResponse, int statusCode) { if (statusCode == 200) { var jsonResponse = json.decode(stringResponse); token = jsonResponse['auth_token']; diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 2425e537..77ea728e 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -191,6 +191,8 @@ class LabsService extends BaseService { body['ProjectID'] = patientLabOrder.projectID; body['ClinicID'] = patientLabOrder.clinicID; body['Procedure'] = procedure; + body['Procedure'] = procedure; + body['LanguageID'] = 1; await baseAppClient.post(GET_Patient_LAB_ORDERS_RESULT, onSuccess: (dynamic response, int statusCode) { labOrdersResultsList.clear(); response['ListPLR'].forEach((lab) { @@ -223,6 +225,7 @@ class LabsService extends BaseService { _requestSendLabReportEmail.orderNo = patientLabOrder.orderNo; _requestSendLabReportEmail.isDownload = isDownload; _requestSendLabReportEmail.doctorID = patientLabOrder.doctorID; + _requestSendLabReportEmail.languageID = 1; await baseAppClient.post(SEND_LAB_RESULT_EMAIL, onSuccess: (dynamic response, int statusCode) { if (isDownload) { diff --git a/lib/core/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index d8874d7d..def7e97a 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -42,9 +42,10 @@ class ReportsService extends BaseService { }, body: _requestReportsInpatient.toJson()); } - Future getInpatientAdmissionsList() async { + Future getInpatientAdmissionsList(int languageID) async { Map body = new Map(); body['IsForMedicalReport'] = true; + body['LanguageID'] = languageID; hasError = false; await baseAppClient.post(GET_INPATIENT_ADMISSIONS, onSuccess: (dynamic response, int statusCode) { admissionsMedicalReport.clear(); diff --git a/lib/core/viewModels/er/rrt-view-model.dart b/lib/core/viewModels/er/rrt-view-model.dart index 5c502077..2be06372 100644 --- a/lib/core/viewModels/er/rrt-view-model.dart +++ b/lib/core/viewModels/er/rrt-view-model.dart @@ -38,10 +38,10 @@ class RRTViewModel extends BaseViewModel { _RRTServiceData rrtServiceData = _RRTServiceData(); - Future<_RRTServiceData> loadRequiredData() async { + Future<_RRTServiceData> loadRequiredData(int languageID) async { // await getServicePrice(); // await getAllOrders(); - await getProcedureDetails(); + await getProcedureDetails(languageID); await getAllOrdersRC(); // getProcedureDetails(); return rrtServiceData; @@ -122,9 +122,9 @@ class RRTViewModel extends BaseViewModel { return rrtServiceData; } - Future<_RRTServiceData> getProcedureDetails() async { + Future<_RRTServiceData> getProcedureDetails(int languageID) async { DoctorsListService service = new DoctorsListService(); - await service.getRRTProcedures(15).then((res) { + await service.getRRTProcedures(15, languageID).then((res) { rrtProcedureList.clear(); var data = res["Vida_ProcedureList"]; data.forEach((json) { diff --git a/lib/core/viewModels/medical/ask_doctor_view_model.dart b/lib/core/viewModels/medical/ask_doctor_view_model.dart index 5a091234..f254c915 100644 --- a/lib/core/viewModels/medical/ask_doctor_view_model.dart +++ b/lib/core/viewModels/medical/ask_doctor_view_model.dart @@ -14,7 +14,7 @@ class AskDoctorViewModel extends BaseViewModel { AskDoctorService _askDoctorService = locator(); MyDoctorService _myDoctorService = locator(); - List patientDoctorAppointmentListHospital =[]; + List patientDoctorAppointmentListHospital = []; List get askDoctorReqTypes => _askDoctorService.askDoctorReqTypes; @@ -28,12 +28,14 @@ class AskDoctorViewModel extends BaseViewModel { setState(ViewState.Error); } else if (_myDoctorService.patientDoctorAppointmentList.length != 0) { _myDoctorService.patientDoctorAppointmentList.forEach((element) { - List doctorByClinic = patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.projectName).toList(); + if (!element.isLiveCareClinic!) { + List doctorByClinic = patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.projectName).toList(); - if (doctorByClinic.length != 0) { - patientDoctorAppointmentListHospital[patientDoctorAppointmentListHospital.indexOf(doctorByClinic[0])].patientDoctorAppointmentList!.add(element); - } else { - patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); + if (doctorByClinic.length != 0) { + patientDoctorAppointmentListHospital[patientDoctorAppointmentListHospital.indexOf(doctorByClinic[0])].patientDoctorAppointmentList!.add(element); + } else { + patientDoctorAppointmentListHospital.add(PatientDoctorAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); + } } setState(ViewState.Idle); }); diff --git a/lib/core/viewModels/medical/reports_view_model.dart b/lib/core/viewModels/medical/reports_view_model.dart index 9a04650f..04f701c5 100644 --- a/lib/core/viewModels/medical/reports_view_model.dart +++ b/lib/core/viewModels/medical/reports_view_model.dart @@ -26,7 +26,7 @@ class ReportsViewModel extends BaseViewModel { List get admissionsMedicalReportList => _reportsService.admissionsMedicalReport; - getReports() async { + getReports(int languageID) async { setState(ViewState.Busy); reportsOrderRequestList.clear(); reportsOrderReadyList.clear(); @@ -37,7 +37,7 @@ class ReportsViewModel extends BaseViewModel { setState(ViewState.Error); } else { _filterList(); - await _reportsService.getInpatientAdmissionsList(); + await _reportsService.getInpatientAdmissionsList(languageID); setState(ViewState.Idle); } } diff --git a/lib/main.dart b/lib/main.dart index ef50efaa..b06c21d0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:fluttertoast/fluttertoast.dart'; import 'package:logger/logger.dart'; import 'package:provider/provider.dart'; @@ -105,6 +106,7 @@ class _MyApp extends State { @override Widget build(BuildContext context) { PlatformBridge.init(context); + LocalNotification.init(onNotificationClick: (payload) { LocalNotification.getInstance()?.showNow(title: "Payload", subtitle: payload, payload: payload); }); diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 491a2b58..d2644d72 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -330,7 +330,9 @@ class _BookConfirmState extends State { GifLoaderDialogUtils.showMyDialog(context); AppoitmentAllHistoryResultList appo; widget.service - .insertAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, widget.selectedTime, widget.selectedDate, initialSlotDuration, context, 'null', null, null, projectViewModel) + // .insertAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, widget.selectedTime, widget.selectedDate, initialSlotDuration, context, 'null', null, null, projectViewModel) + .insertAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, widget.selectedTime, widget.selectedDate, initialSlotDuration, projectViewModel.isArabic ? 1 : 2, context, null, + null, null, projectViewModel) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); @@ -387,7 +389,8 @@ class _BookConfirmState extends State { GifLoaderDialogUtils.showMyDialog(context); AppoitmentAllHistoryResultList appo; widget.service - .insertLiveCareScheduleAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, docObject.serviceID, widget.selectedTime, widget.selectedDate, context) + .insertLiveCareScheduleAppointment( + docObject.doctorID!, docObject.clinicID!, docObject.projectID!, docObject.serviceID, widget.selectedTime, widget.selectedDate, projectViewModel.isArabic ? 1 : 2, context) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); @@ -451,7 +454,7 @@ class _BookConfirmState extends State { widget.service.getPatientShare(appointmentNo, clinicID, projectID, languageID, context).then((res) { projectViewModel.selectedBodyPartList.clear(); projectViewModel.laserSelectionDuration = 0; - if(res['OnlineCheckInAppointments'].length != 0) { + if (res['OnlineCheckInAppointments'].length != 0) { widget.patientShareResponse = new PatientShareResponse.fromJson(res['OnlineCheckInAppointments'][0]); } @@ -492,7 +495,7 @@ class _BookConfirmState extends State { } getLiveCareAppointmentPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { - widget.service.getLiveCareAppointmentPatientShare(appointmentNo, clinicID, projectID, context).then((res) { + widget.service.getLiveCareAppointmentPatientShare(appointmentNo, clinicID, projectID, projectViewModel.isArabic ? 1 : 2, context).then((res) { widget.patientShareResponse = new PatientShareResponse.fromJson(res); GifLoaderDialogUtils.hideDialog(context); navigateToBookSuccess(context, docObject, widget.patientShareResponse, false); diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 36a0393b..8d1d2943 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -493,7 +493,7 @@ class _BookSuccessState extends State { setOnlineCheckInForAppointment() { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); - service.setOnlineCheckInForAppointment(widget.patientShareResponse.appointmentNo.toString(), widget.patientShareResponse.projectID!, context).then((res) { + service.setOnlineCheckInForAppointment(widget.patientShareResponse.appointmentNo.toString(), widget.patientShareResponse.projectID!, projectViewModel.isArabic ? 1 : 2, context).then((res) { AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); appo.clinicID = widget.docObject.clinicID; appo.projectID = widget.docObject.projectID; @@ -537,8 +537,8 @@ class _BookSuccessState extends State { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); service - .insertVIDARequest(appo.appointmentNo!, appo.clinicID!, appo.projectID!, appo.serviceID!, appo.doctorID!, appo.appointmentDate!, - Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), context) + .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate!, + Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), projectViewModel.isArabic ? 1 : 2, context) .then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index e545f0fd..e102e5a0 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -234,7 +234,7 @@ class _DoctorProfileState extends State with TickerProviderStateM getDoctorRatings() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getDoctorsRating(widget.doctor.doctorID!, context).then((res) { + service.getDoctorsRating(widget.doctor.doctorID!, projectViewModel.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { print(res['NotesDoctorRatingList']); @@ -251,7 +251,7 @@ class _DoctorProfileState extends State with TickerProviderStateM getDoctorRatingsDetails() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getDoctorsRatingDetails(widget.doctor.doctorID!, context).then((res) { + service.getDoctorsRatingDetails(widget.doctor.doctorID!, projectViewModel.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { doctorDetailsList.clear(); @@ -494,7 +494,7 @@ class _DoctorProfileState extends State with TickerProviderStateM barrierDismissible: true, barrierLabel: '', context: context, - pageBuilder: (context, animation1, animation2){ + pageBuilder: (context, animation1, animation2) { return SizedBox(); }); } diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index 44f3bf6e..a96e8dc6 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -74,7 +74,7 @@ class _QRCodeState extends State { Future.delayed(const Duration(milliseconds: 500), () { showNfcReader(context, onNcfScan: (String nfcId) { Future.delayed(const Duration(milliseconds: 100), () { - sendNfcCheckInRequest(nfcId,2); + sendNfcCheckInRequest(nfcId, 2); locator().todoList.to_do_list_nfc(widget.appointment!); }); }, onCancel: () { @@ -93,14 +93,16 @@ class _QRCodeState extends State { } startLocationCheckIn() async { + GifLoaderDialogUtils.showMyDialog(context); locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); locationUtils.getCurrentLocation(callBack: (value) { projectDetailListModel = Utils.getProjectDetailObj(projectViewModel, widget.appointment!.projectID); double dist = Utils.distance(value.latitude, value.longitude, double.parse(projectDetailListModel.latitude!), double.parse(projectDetailListModel.longitude!)).ceilToDouble() * 1000; print(dist); if (dist <= projectDetailListModel.geofenceRadius!) { - sendNfcCheckInRequest(projectDetailListModel.checkInQrCode!,2); + sendNfcCheckInRequest(projectDetailListModel.checkInQrCode!, 2); } else { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: TranslationBase.of(context).locationCheckInError); } }); diff --git a/lib/pages/BookAppointment/components/LaserClinic.dart b/lib/pages/BookAppointment/components/LaserClinic.dart index b3aeb69c..e3be8e68 100644 --- a/lib/pages/BookAppointment/components/LaserClinic.dart +++ b/lib/pages/BookAppointment/components/LaserClinic.dart @@ -69,7 +69,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getLaserBodyPartsList(laserCategoryId, widget.selectedHospital.iD).then((res) { + service.getLaserBodyPartsList(laserCategoryId, widget.selectedHospital.iD, projectViewModel.isArabic ? 1 : 2).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['Laser_GetBodyPartsByCategoryList'].length != 0) { diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index e4561759..d354a02b 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -408,7 +408,7 @@ class _CovidTimeSlotsState extends State with TickerProviderStat insertCovidQuestionnaire(context, DoctorList docObject) async { DoctorsListService service = new DoctorsListService(); List qa = await sharedPref.getObject(COVID_QA_LIST); - service.insertCovidQuestionnaire(qa, widget.projectID!, widget.selectedProject!.testTypeEnum!, widget.selectedProject!.testProcedureEnum!).then((res) { + service.insertCovidQuestionnaire(qa, widget.projectID!, widget.selectedProject!.testTypeEnum!, projectViewModel.isArabic ? 1 : 2, widget.selectedProject!.testProcedureEnum!).then((res) { insertAppointmentCovidTest(context, docObject); }).catchError((err) { print(err); @@ -426,8 +426,8 @@ class _CovidTimeSlotsState extends State with TickerProviderStat DoctorsListService service = new DoctorsListService(); AppoitmentAllHistoryResultList appo; service - .insertAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, CovidTimeSlots.selectedTime!, CovidTimeSlots.selectedDate!, 0, context, - widget.selectedProcedure!.procedureID, widget.selectedProject!.testTypeEnum, widget.selectedProject!.testProcedureEnum) + .insertAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, CovidTimeSlots.selectedTime!, CovidTimeSlots.selectedDate!, 0, projectViewModel.isArabic ? 1 : 2, context, + widget.selectedProcedure!.procedureID!, widget.selectedProject!.testTypeEnum!, widget.selectedProject!.testProcedureEnum) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index d7756609..d21315f3 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -341,8 +341,8 @@ class _MyFamily extends State with TickerProviderStateMixin { return requestDecoratedContainerWithExpandable( TranslationBase.of(context).sentRequest, [ - Expanded(flex: 4, child: columnText(TranslationBase.of(context).name)), - Expanded(flex: 2, child: columnText(TranslationBase.of(context).status)), + Expanded(flex: 3, child: columnText(TranslationBase.of(context).name)), + Expanded(flex: 1, child: columnText(TranslationBase.of(context).status)), ], sentRecordsList.map((result) { return sentItemView(result); @@ -351,29 +351,26 @@ class _MyFamily extends State with TickerProviderStateMixin { Widget sentItemView(GetAllSharedRecordsByStatusList result) { return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Expanded(flex: 2, child: rowText(result.patientName!)), + Expanded(flex: 3, child: rowText(result.patientName!)), Expanded( flex: 1, - child: Row( - children: [ - Container( - padding: EdgeInsets.only(top: 3, bottom: 3, left: 8, right: 8), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(50), - color: result.status == 3 ? Color(0xff349745) : Color(0xffD02127), - ), - child: Text( - result.statusDescription != null ? result.statusDescription! : "", - style: TextStyle( - fontSize: 10, - color: Colors.white, - letterSpacing: -0.4, - fontWeight: FontWeight.w600, - ), - ), + child: Container( + padding: EdgeInsets.only(top: 3, bottom: 3, left: 8, right: 8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(50), + color: result.status == 3 ? Color(0xff349745) : Color(0xffD02127), + ), + child: Text( + result.statusDescription != null ? result.statusDescription! : "", + style: TextStyle( + fontSize: 10, + color: Colors.white, + letterSpacing: -0.4, + fontWeight: FontWeight.w600, ), - ], + ), ), ), ], @@ -532,7 +529,7 @@ class _MyFamily extends State with TickerProviderStateMixin { request["Status"] = status; this.familyFileProvider.acceptRejectFamily(request).then((value) async { await refreshFamily(context); - await GifLoaderDialogUtils.hideDialog(context); + await GifLoaderDialogUtils.hideDialog(context); }); } @@ -552,6 +549,7 @@ class _MyFamily extends State with TickerProviderStateMixin { List sentRecordsList = []; Future getFamilyFiles() async { + int languageID = projectViewModel.isArabic ? 1 : 2; GetAllSharedRecordsByStatusResponse? familySharedRecords; if (await sharedPref.getObject(FAMILY_FILE) != null) { familySharedRecords = GetAllSharedRecordsByStatusResponse.fromJson(await sharedPref.getObject(FAMILY_FILE)); @@ -559,12 +557,11 @@ class _MyFamily extends State with TickerProviderStateMixin { GifLoaderDialogUtils.showMyDialog(context); try { if (familySharedRecords == null) { - int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; familySharedRecords = await familyFileProvider.getSharedRecordByStatus(languageID); } - familySharedRecordsList =[]; + familySharedRecordsList = []; sentRecordsList = []; - familySharedRecords.getAllSharedRecordsByStatusList!.forEach((element) { + familySharedRecords!.getAllSharedRecordsByStatusList!.forEach((element) { if (element.status == 3) { familySharedRecordsList.add(element); } @@ -572,7 +569,7 @@ class _MyFamily extends State with TickerProviderStateMixin { }); approvedRecordsList = []; pendingRecordsList = []; - GetAllSharedRecordsByStatusResponse pendingAndApprovedRecords = await getUserViewRequest(); + GetAllSharedRecordsByStatusResponse pendingAndApprovedRecords = await getUserViewRequest(languageID); pendingAndApprovedRecords.getAllSharedRecordsByStatusList!.forEach((element) { print(element.toJson()); @@ -589,9 +586,9 @@ class _MyFamily extends State with TickerProviderStateMixin { } } - Future getUserViewRequest() async { + Future getUserViewRequest(int languageID) async { var user = await sharedPref.getObject(USER_PROFILE); - return familyFileProvider.getUserViewRequest(user['PatientID']); + return familyFileProvider.getUserViewRequest(user['PatientID'], languageID); } Future getSentRequest() async { @@ -617,7 +614,7 @@ class _MyFamily extends State with TickerProviderStateMixin { Widget columnText(String title) { return Text( title, - textAlign: TextAlign.left, + // textAlign: TextAlign.left, style: TextStyle( fontSize: 12, color: CustomColors.textDarkColor, @@ -630,7 +627,7 @@ class _MyFamily extends State with TickerProviderStateMixin { Widget rowText(String title) { return Text( title, - textAlign: TextAlign.left, + // textAlign: TextAlign.left, style: TextStyle( fontSize: 10, color: CustomColors.textColor, diff --git a/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart b/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart index 891acf45..83451428 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-main-screen.dart @@ -57,7 +57,7 @@ class RRTMainScreenState extends State with SingleTickerProviderS onModelReady: (vm) async { viewModel = vm; loadingData = true; - await vm.loadRequiredData().then((value) {}).whenComplete(() => setState(() => loadingData = false)); + await vm.loadRequiredData(projectViewModel.isArabic ? 1 : 2).then((value) {}).whenComplete(() => setState(() => loadingData = false)); }, builder: (ctx, vm, widget) => content(), )); diff --git a/lib/pages/ErService/rapid-response-team/rrt-request-page.dart b/lib/pages/ErService/rapid-response-team/rrt-request-page.dart index f519a0a9..a473fd50 100644 --- a/lib/pages/ErService/rapid-response-team/rrt-request-page.dart +++ b/lib/pages/ErService/rapid-response-team/rrt-request-page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/ComprehensiveMedicalCheckup/GetCMCAllOrdersResponseModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/rrt-view-model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/rrt/RRTProcedureList.dart'; import 'package:diplomaticquarterapp/models/rrt/service_price.dart'; import 'package:diplomaticquarterapp/pages/ErService/rapid-response-team/rrt-order-list-item.dart'; @@ -16,6 +17,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class RRTRequestPage extends StatefulWidget { final List pendingOrders; @@ -32,6 +34,8 @@ class RRTRequestPageState extends State { bool acceptTerms = false; late VidaProcedureList selectedProcedure; + ProjectViewModel? projectViewModel; + @override void initState() { // getProcedureDetails(); @@ -40,6 +44,7 @@ class RRTRequestPageState extends State { @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return BaseView( onModelReady: (vm) { // viewModel = vm; @@ -272,7 +277,7 @@ class RRTRequestPageState extends State { getProcedureDetails() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getRRTProcedures(15).then((res) { + service.getRRTProcedures(15, projectViewModel!.isArabic ? 1 : 2).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res['Vida_ProcedureList']); }).catchError((err) { diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index b9693f23..c2f39085 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -151,7 +151,6 @@ class _AppointmentDetailsState extends State with SingleTick Material( color: Color(0xffF8F8F8), child: TabBar( - onTap: (index) { setState(() { if (index == 1) { @@ -248,21 +247,13 @@ class _AppointmentDetailsState extends State with SingleTick list.add( Expanded( child: DefaultButton( - TranslationBase - .of(context) - .cancelAppointment, - () { + TranslationBase.of(context).cancelAppointment, + () { ConfirmDialog dialog = new ConfirmDialog( context: context, - confirmMessage: TranslationBase - .of(context) - .cancelAppoMsg, - okText: TranslationBase - .of(context) - .confirm, - cancelText: TranslationBase - .of(context) - .cancel_nocaps, + confirmMessage: TranslationBase.of(context).cancelAppoMsg, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: cancelAppointment, cancelFunction: () => {}); dialog.showAlertDialog(context); @@ -272,8 +263,7 @@ class _AppointmentDetailsState extends State with SingleTick ), ), ); - } - else if (_tabController!.index == 1) { + } else if (_tabController!.index == 1) { list.add( Expanded( child: DefaultButton( @@ -329,7 +319,7 @@ class _AppointmentDetailsState extends State with SingleTick void getDoctorRatingsDetails() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getDoctorsRatingDetails(widget.appo.doctorID!, context).then((res) { + service.getDoctorsRatingDetails(widget.appo.doctorID, projectViewModel!.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { doctorDetailsList.clear(); @@ -678,7 +668,6 @@ class _AppointmentDetailsState extends State with SingleTick } getToDoCount() { - toDoProvider!.setState(0, 0, true, toDoProvider!.notificationsCount); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 043adee4..1d511c91 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -25,6 +25,11 @@ import 'package:provider/provider.dart'; import 'AppointmentDetails.dart'; class MyAppointments extends StatefulWidget { + @override + _MyAppointmentsState createState() => _MyAppointmentsState(); +} + +class _MyAppointmentsState extends State with SingleTickerProviderStateMixin { List upcomingAppoList = []; List arrivedAppoListNew = []; @@ -32,27 +37,22 @@ class MyAppointments extends StatefulWidget { List confirmedAppoList = []; List arrivedAppoList = []; - List _patientBookedAppointmentListHospital =[]; - List _patientConfirmedAppointmentListHospital =[]; - List _patientArrivedAppointmentListHospital =[]; + List _patientBookedAppointmentListHospital = []; + List _patientConfirmedAppointmentListHospital = []; + List _patientArrivedAppointmentListHospital = []; - List _patientBookedAppointmentListClinic =[]; - List _patientConfirmedAppointmentListClinic =[]; - List _patientArrivedAppointmentListClinic =[]; + List _patientBookedAppointmentListClinic = []; + List _patientConfirmedAppointmentListClinic = []; + List _patientArrivedAppointmentListClinic = []; List _patientBookedAndConfirmedAppointmentListHospital = []; List _patientBookedAndConfirmedAppointmentListClinic = []; - @override - _MyAppointmentsState createState() => _MyAppointmentsState(); -} - -class _MyAppointmentsState extends State with SingleTickerProviderStateMixin { bool isDataLoaded = false; var sharedPref = new AppSharedPreferences(); AuthenticatedUserObject authenticatedUserObject = locator(); - List imagesInfo =[]; + List imagesInfo = []; FilterType? filterType; @@ -145,23 +145,23 @@ class _MyAppointmentsState extends State with SingleTickerProvid GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - widget.upcomingAppoList.clear(); - widget.arrivedAppoListNew.clear(); + upcomingAppoList.clear(); + arrivedAppoListNew.clear(); - widget.bookedAppoList.clear(); - widget.confirmedAppoList.clear(); - widget.arrivedAppoList.clear(); + bookedAppoList.clear(); + confirmedAppoList.clear(); + arrivedAppoList.clear(); - widget._patientBookedAppointmentListHospital.clear(); - widget._patientConfirmedAppointmentListHospital.clear(); - widget._patientArrivedAppointmentListHospital.clear(); + _patientBookedAppointmentListHospital.clear(); + _patientConfirmedAppointmentListHospital.clear(); + _patientArrivedAppointmentListHospital.clear(); - widget._patientBookedAppointmentListClinic.clear(); - widget._patientConfirmedAppointmentListClinic.clear(); - widget._patientArrivedAppointmentListClinic.clear(); + _patientBookedAppointmentListClinic.clear(); + _patientConfirmedAppointmentListClinic.clear(); + _patientArrivedAppointmentListClinic.clear(); - widget._patientBookedAndConfirmedAppointmentListHospital.clear(); - widget._patientBookedAndConfirmedAppointmentListClinic.clear(); + _patientBookedAndConfirmedAppointmentListHospital.clear(); + _patientBookedAndConfirmedAppointmentListClinic.clear(); service.getPatientAppointmentHistory(false, languageID, context, isForUpcomming: isForUpcoming, IsForArrived: isForArrived).then((res) { GifLoaderDialogUtils.hideDialog(context); @@ -170,9 +170,9 @@ class _MyAppointmentsState extends State with SingleTickerProvid if (res['AppoimentAllHistoryResultList'].length != 0) { res['AppoimentAllHistoryResultList'].forEach((v) { if (isForArrived) { - widget.arrivedAppoListNew.add(new AppoitmentAllHistoryResultList.fromJson(v)); + arrivedAppoListNew.add(new AppoitmentAllHistoryResultList.fromJson(v)); } else { - widget.upcomingAppoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); + upcomingAppoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); } }); sortAppointmentList(isForUpcoming, isForArrived); @@ -217,122 +217,122 @@ class _MyAppointmentsState extends State with SingleTickerProvid sortAppointmentList(bool isForUpcoming, bool isForArrived) { if (isForArrived) { - widget.arrivedAppoListNew.forEach((v) { + arrivedAppoListNew.forEach((v) { if (isBooked(v)) { - widget.bookedAppoList.add(v); + bookedAppoList.add(v); } if (isConfirmed(v)) { - widget.confirmedAppoList.add(v); + confirmedAppoList.add(v); } if (isArrived(v)) { - widget.arrivedAppoList.add(v); + arrivedAppoList.add(v); } }); } else { - widget.upcomingAppoList.forEach((v) { + upcomingAppoList.forEach((v) { if (isBooked(v)) { - widget.bookedAppoList.add(v); + bookedAppoList.add(v); } if (isConfirmed(v)) { - widget.confirmedAppoList.add(v); + confirmedAppoList.add(v); } if (isArrived(v)) { - widget.arrivedAppoList.add(v); + arrivedAppoList.add(v); } }); } - widget.bookedAppoList.forEach((element) { - List doctorByClinic = widget._patientBookedAppointmentListClinic + bookedAppoList.forEach((element) { + List doctorByClinic = _patientBookedAppointmentListClinic .where( (elementClinic) => elementClinic.filterName == element.clinicName, ) .toList(); if (doctorByClinic.length != 0) { - widget._patientBookedAppointmentListClinic[widget._patientBookedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList!.add(element); + _patientBookedAppointmentListClinic[_patientBookedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList!.add(element); } else { - widget._patientBookedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); + _patientBookedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); } - List doctorByHospital = widget._patientBookedAppointmentListHospital + List doctorByHospital = _patientBookedAppointmentListHospital .where( (elementClinic) => elementClinic.filterName == element.projectName, ) .toList(); if (doctorByHospital.length != 0) { - widget._patientBookedAppointmentListHospital[widget._patientBookedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element); + _patientBookedAppointmentListHospital[_patientBookedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element); } else { - widget._patientBookedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); + _patientBookedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); } - - //Merging Booked & Confirmed Appointments into Upcoming Tab - widget._patientBookedAndConfirmedAppointmentListHospital.addAll(widget._patientBookedAppointmentListHospital); - widget._patientBookedAndConfirmedAppointmentListClinic.addAll(widget._patientBookedAppointmentListClinic); }); - widget.confirmedAppoList.forEach((element) { - List doctorByClinic = widget._patientConfirmedAppointmentListClinic + confirmedAppoList.forEach((element) { + List doctorByClinic = _patientConfirmedAppointmentListClinic .where( (elementClinic) => elementClinic.filterName == element.clinicName, ) .toList(); if (doctorByClinic.length != 0) { - widget._patientConfirmedAppointmentListClinic[widget._patientConfirmedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList!.add(element); + _patientConfirmedAppointmentListClinic[_patientConfirmedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList!.add(element); } else { - widget._patientConfirmedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); + _patientConfirmedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); } - List doctorByHospital = widget._patientConfirmedAppointmentListHospital + List doctorByHospital = _patientConfirmedAppointmentListHospital .where( (elementClinic) => elementClinic.filterName == element.projectName, ) .toList(); if (doctorByHospital.length != 0) { - widget._patientConfirmedAppointmentListHospital[widget._patientConfirmedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element); + _patientConfirmedAppointmentListHospital[_patientConfirmedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element); } else { - widget._patientConfirmedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); + _patientConfirmedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); } //Merging Booked & Confirmed Appointments into Upcoming Tab - widget._patientBookedAndConfirmedAppointmentListHospital.addAll(widget._patientConfirmedAppointmentListHospital); - widget._patientBookedAndConfirmedAppointmentListClinic.addAll(widget._patientConfirmedAppointmentListClinic); + // _patientBookedAndConfirmedAppointmentListHospital.addAll(_patientConfirmedAppointmentListHospital); + // _patientBookedAndConfirmedAppointmentListClinic.addAll(_patientConfirmedAppointmentListClinic); }); - widget.arrivedAppoList.forEach((element) { - List doctorByClinic = widget._patientArrivedAppointmentListClinic + arrivedAppoList.forEach((element) { + List doctorByClinic = _patientArrivedAppointmentListClinic .where( (elementClinic) => elementClinic.filterName == element.clinicName, ) .toList(); if (doctorByClinic.length != 0) { - widget._patientArrivedAppointmentListClinic[widget._patientArrivedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList!.add(element); + _patientArrivedAppointmentListClinic[_patientArrivedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList!.add(element); } else { - widget._patientArrivedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); + _patientArrivedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element)); } - List doctorByHospital = widget._patientArrivedAppointmentListHospital + List doctorByHospital = _patientArrivedAppointmentListHospital .where( (elementClinic) => elementClinic.filterName == element.projectName, ) .toList(); if (doctorByHospital.length != 0) { - widget._patientArrivedAppointmentListHospital[widget._patientArrivedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element); + _patientArrivedAppointmentListHospital[_patientArrivedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element); } else { - widget._patientArrivedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); + _patientArrivedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element)); } // openAppointmentsTab(); }); + + //Merging Booked & Confirmed Appointments into Upcoming Tab + _patientBookedAndConfirmedAppointmentListHospital.addAll(_patientBookedAppointmentListHospital); + _patientBookedAndConfirmedAppointmentListClinic.addAll(_patientBookedAppointmentListClinic); } openAppointmentsTab() async { @@ -345,11 +345,11 @@ class _MyAppointmentsState extends State with SingleTickerProvid } else if (flag == 3) { index = 2; } else { - if (widget._patientBookedAppointmentListClinic.length != 0) { + if (_patientBookedAppointmentListClinic.length != 0) { index = 0; - } else if (widget._patientConfirmedAppointmentListClinic.length != 0) { + } else if (_patientConfirmedAppointmentListClinic.length != 0) { index = 1; - } else if (widget._patientArrivedAppointmentListClinic.length != 0) { + } else if (_patientArrivedAppointmentListClinic.length != 0) { index = 2; // return; } @@ -359,12 +359,12 @@ class _MyAppointmentsState extends State with SingleTickerProvid } Widget getBookedAppointments() { - return _getAppointment(widget.bookedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientBookedAppointmentListClinic : widget._patientBookedAppointmentListHospital); + return _getAppointment(bookedAppoList.length, (filterType == FilterType.Clinic) ? _patientBookedAppointmentListClinic : _patientBookedAppointmentListHospital); } Widget getBookedAndConfirmedAppointments() { - return _getAppointment((widget.bookedAppoList.length + widget.confirmedAppoList.length), - (filterType == FilterType.Clinic) ? widget._patientBookedAndConfirmedAppointmentListClinic : widget._patientBookedAndConfirmedAppointmentListHospital); + return _getAppointment( + (bookedAppoList.length + confirmedAppoList.length), (filterType == FilterType.Clinic) ? _patientBookedAndConfirmedAppointmentListClinic : _patientBookedAndConfirmedAppointmentListHospital); } Widget _getAppointment(int _listLength, List _list) { @@ -382,7 +382,9 @@ class _MyAppointmentsState extends State with SingleTickerProvid Container( margin: EdgeInsets.only(top: 10.0), child: Text( - _currentPage == 0 ? TranslationBase.of(context).noBookedAppo : (_currentPage == 1 ? TranslationBase.of(context).noUpcomingAppointment : TranslationBase.of(context).noArrivedAppo), + _currentPage == 0 + ? TranslationBase.of(context).noBookedAppo + : (_currentPage == 1 ? TranslationBase.of(context).noUpcomingAppointment : TranslationBase.of(context).noArrivedAppo), style: TextStyle( fontSize: 16.0, ), @@ -429,7 +431,12 @@ class _MyAppointmentsState extends State with SingleTickerProvid ), ), ).then((value) { - getPatientAppointmentHistory(true, false); + if (_currentPage == 1) { + getPatientAppointmentHistory(true, false); + } + if (_currentPage == 2) { + getPatientAppointmentHistory(false, true); + } }), isInOutPatient: _appointmentResult.isInOutPatient, name: _appointmentResult.doctorTitle! + " " + _appointmentResult.doctorNameObj!, @@ -461,11 +468,11 @@ class _MyAppointmentsState extends State with SingleTickerProvid } Widget getConfirmedAppointments() { - return _getAppointment(widget.confirmedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientConfirmedAppointmentListClinic : widget._patientConfirmedAppointmentListHospital); + return _getAppointment(confirmedAppoList.length, (filterType == FilterType.Clinic) ? _patientConfirmedAppointmentListClinic : _patientConfirmedAppointmentListHospital); } Widget getArrivedAppointments() { - return _getAppointment(widget.arrivedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientArrivedAppointmentListClinic : widget._patientArrivedAppointmentListHospital); + return _getAppointment(arrivedAppoList.length, (filterType == FilterType.Clinic) ? _patientArrivedAppointmentListClinic : _patientArrivedAppointmentListHospital); } setFilterType(FilterType filterType) { @@ -479,6 +486,12 @@ class _MyAppointmentsState extends State with SingleTickerProvid onTap: () { setState(() { _currentPage = _value; + if (_value == 1) { + getPatientAppointmentHistory(true, false); + } + if (_value == 2) { + getPatientAppointmentHistory(false, true); + } }); }, child: Row( @@ -501,7 +514,6 @@ class _MyAppointmentsState extends State with SingleTickerProvid getPatientAppointmentHistory(false, true); } }); - //_pageController.animateToPage(index, duration: Duration(milliseconds: 250), curve: Curves.easeInOut); }, ), ), diff --git a/lib/pages/MyAppointments/widgets/PrescriptionReport.dart b/lib/pages/MyAppointments/widgets/PrescriptionReport.dart index 704c8ba2..1bbb8626 100644 --- a/lib/pages/MyAppointments/widgets/PrescriptionReport.dart +++ b/lib/pages/MyAppointments/widgets/PrescriptionReport.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; @@ -10,22 +11,22 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class PrescriptionReportPage extends StatefulWidget { List prescriptionReportEnhList; dynamic listPres; AppoitmentAllHistoryResultList appo; - PrescriptionReportPage( - {required this.prescriptionReportEnhList, - required this.listPres, - required this.appo}); + PrescriptionReportPage({required this.prescriptionReportEnhList, required this.listPres, required this.appo}); @override _PrescriptionReportState createState() => _PrescriptionReportState(); } class _PrescriptionReportState extends State { + ProjectViewModel? projectViewModel; + @override void initState() { super.initState(); @@ -33,6 +34,7 @@ class _PrescriptionReportState extends State { @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, appBarTitle: 'Items', @@ -41,8 +43,7 @@ class _PrescriptionReportState extends State { child: ListView.builder( itemBuilder: (context, index) => InkWell( onTap: () { - navigateToPrescriptionDetails( - widget.prescriptionReportEnhList[index]); + navigateToPrescriptionDetails(widget.prescriptionReportEnhList[index]); }, child: Container( width: double.infinity, @@ -69,9 +70,7 @@ class _PrescriptionReportState extends State { Expanded( child: Padding( padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts(widget - .prescriptionReportEnhList[index].itemDescription)), + child: Center(child: Texts(widget.prescriptionReportEnhList[index].itemDescription)), )), Icon( Icons.arrow_forward, @@ -116,10 +115,7 @@ class _PrescriptionReportState extends State { sendPrescriptionReportEmail() { DoctorsListService service = new DoctorsListService(); GifLoaderDialogUtils.showMyDialog(context); - service - .sendPrescriptionEmail(widget.appo.appointmentDate!, widget.appo.setupID!, - widget.listPres, context) - .then((res) { + service.sendPrescriptionEmail(widget.appo.appointmentDate!, widget.appo.setupID!, projectViewModel!.isArabic ? 1 : 2, widget.listPres, context).then((res) { GifLoaderDialogUtils.hideDialog(context); AppToast.showSuccessToast(message: 'A copy has been sent to the e-mail'); }).catchError((err) { @@ -142,8 +138,7 @@ class _PrescriptionReportState extends State { prescriptionReport.frequency = prescriptionReportEnh.frequency; prescriptionReport.frequencyN = prescriptionReportEnh.frequency; - prescriptionReport.doseDailyQuantity = - prescriptionReportEnh.doseDailyQuantity; + prescriptionReport.doseDailyQuantity = prescriptionReportEnh.doseDailyQuantity; prescriptionReport.days = prescriptionReportEnh.days; diff --git a/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart b/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart index 861e7882..500f6750 100644 --- a/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart +++ b/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart @@ -315,8 +315,8 @@ class _CovidTimeSlotsState extends State with TickerProviderSta Widget getSelectedButton(int index) { return CustomTextButton( - backgroundColor: CustomColors.green, - elevation: 0, + backgroundColor: CustomColors.green, + elevation: 0, onPressed: () { setState(() { selectedButtonIndex = index; @@ -352,8 +352,8 @@ class _CovidTimeSlotsState extends State with TickerProviderSta DoctorsListService service = new DoctorsListService(); AppoitmentAllHistoryResultList appo; service - .insertAppointment( - docObject.doctorID!, docObject.clinicID!, docObject.projectID!, ObGyneTimeSlots.selectedTime, ObGyneTimeSlots.selectedDate, 0, context, widget.obGyneProcedureListResponse!.procedureId!) + .insertAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, ObGyneTimeSlots.selectedTime, ObGyneTimeSlots.selectedDate, 0, projectViewModel!.isArabic ? 1 : 2, context, + widget.obGyneProcedureListResponse!.procedureId) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); @@ -394,7 +394,7 @@ class _CovidTimeSlotsState extends State with TickerProviderSta DoctorsListService service = new DoctorsListService(); service .updateObGyneAppointment(widget.obGyneProcedureListResponse!.episodeID!, int.parse(appoNo), widget.obGyneProcedureListResponse!.orderNo!, widget.obGyneProcedureListResponse!.procedureId!, - widget.obGyneProcedureListResponse!.lineItemNo!, widget.obGyneProcedureListResponse!.uniqueRowID!) + widget.obGyneProcedureListResponse!.lineItemNo!, widget.obGyneProcedureListResponse!.uniqueRowID!, projectViewModel!.isArabic ? 1 : 2) .then((res) {}) .catchError((err) { print(err); diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 26246163..bf48dd91 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -47,15 +47,12 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; class ToDo extends StatefulWidget { - PatientShareResponse patientShareResponse = PatientShareResponse(); - List appoList = []; - List ancillaryLists = []; - List obGyneAppoList = []; + PatientShareResponse? patientShareResponse; var languageID; - MyInAppBrowser? browser; - bool isShowAppBar = true; + MyInAppBrowser? browser; + bool? isShowAppBar = true; Function()? onBackClick; - bool isFromMyAppointments; + bool? isFromMyAppointments; AppoitmentAllHistoryResultList? appointment; ToDo({required this.isShowAppBar, this.onBackClick, this.isFromMyAppointments = false, this.appointment}); @@ -86,6 +83,10 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { bool isCash = false; MyInAppBrowser? browser; + List appoList = []; + List ancillaryLists = []; + List obGyneAppoList = []; + @override void initState() { widget.patientShareResponse = new PatientShareResponse(); @@ -103,6 +104,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { @override void dispose() { super.dispose(); + // getToDoCount(); _tabController.dispose(); } @@ -113,7 +115,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { return AppScaffold( appBarTitle: TranslationBase.of(context).todoList, imagesInfo: imagesInfo, - isShowAppBar: widget.isShowAppBar, + isShowAppBar: widget.isShowAppBar!, isShowDecPage: true, showNewAppBar: true, showNewAppBarTitle: true, @@ -162,15 +164,15 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { child: AppExpandableNotifier( isExpand: true, hasCounter: true, - counter: widget.appoList.length.toString(), + counter: appoList.length.toString(), title: TranslationBase.of(context).appointments, - bodyWidget: widget.appoList.length != 0 + bodyWidget: appoList.length != 0 ? ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), padding: EdgeInsets.all(0.0), - itemCount: widget.appoList.length, + itemCount: appoList.length, itemBuilder: (context, index) { return Container( width: double.infinity, @@ -190,12 +192,12 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { children: [ Padding( padding: const EdgeInsets.only(top: 4.0), - child: widget.appoList[index].clinicID == 265 + child: appoList[index].clinicID == 265 ? Container( margin: EdgeInsets.only(left: 5.0, right: 5.0), child: SvgPicture.asset("assets/images/new/CoronaIcon.svg", width: 35.0, height: 35.0), ) - : widget.appoList[index].isLiveCareAppointment! + : appoList[index].isLiveCareAppointment! ? SvgPicture.asset("assets/images/new/virtual.svg") : SvgPicture.asset("assets/images/new/hospital-visit.svg"), ), @@ -205,9 +207,9 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), child: Text( - widget.appoList[index].clinicID == 265 + appoList[index].clinicID == 265 ? TranslationBase.of(context).covidTestTodo - : widget.appoList[index].isLiveCareAppointment! + : appoList[index].isLiveCareAppointment! ? TranslationBase.of(context).liveCareAppo : TranslationBase.of(context).walkinAppo, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)), @@ -215,8 +217,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(left: 8.0, right: 8.0), child: CountdownTimer( - controller: new CountdownTimerController( - endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay! * 1000) * 60), + controller: + new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (appoList[index].remaniningHoursTocanPay! * 1000) * 60), widgetBuilder: (_, CurrentRemainingTime? time) { return time != null ? Text( @@ -236,17 +238,17 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { child: Container( child: InkWell( onTap: () { - performNextAction(widget.appoList[index]); + performNextAction(appoList[index]); }, child: Container( padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), decoration: BoxDecoration( - color: getNextActionButtonColor(widget.appoList[index].nextAction), + color: getNextActionButtonColor(appoList[index].nextAction), border: Border.all(color: Colors.white, width: 1), borderRadius: BorderRadius.circular(6), ), child: Text( - getNextActionText(widget.appoList[index].nextAction), + getNextActionText(appoList[index].nextAction), textAlign: TextAlign.center, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), ), @@ -259,7 +261,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(top: 8.0), child: Text( - widget.appoList[index].doctorTitle! + " " + widget.appoList[index].doctorNameObj!, + appoList[index].doctorTitle! + " " + appoList[index].doctorNameObj!, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), ), @@ -267,8 +269,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { mainAxisSize: MainAxisSize.min, children: [ LargeAvatar( - name: widget.appoList[index].doctorTitle! + " " + widget.appoList[index].doctorNameObj!, - url: widget.appoList[index].doctorImageURL, + name: appoList[index].doctorTitle! + " " + appoList[index].doctorNameObj!, + url: appoList[index].doctorImageURL, width: 52, height: 52, ), @@ -278,26 +280,26 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName!, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).clinic + ": ", appoList[index].clinicName!, projectViewModel.isArabic), // MyRichText(TranslationBase.of(context).appointmentDate + ": ", - // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) + " " + widget.appoList[index].startTime.substring(0, 5), projectViewModel.isArabic), + // DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(appoList[index].appointmentDate)) + " " + appoList[index].startTime.substring(0, 5), projectViewModel.isArabic), // Timezone changes - widget.appoList[index].isLiveCareAppointment! + appoList[index].isLiveCareAppointment! ? MyRichText( TranslationBase.of(context).appointmentDate + ": ", - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate!)) + + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(appoList[index].appointmentDate)) + " " + - DateUtil.convertStringToDate(widget.appoList[index].appointmentDate!).toString().split(" ")[1].substring(0, 5), + DateUtil.convertStringToDate(appoList[index].appointmentDate).toString().split(" ")[1].substring(0, 5), projectViewModel.isArabic) : MyRichText( TranslationBase.of(context).appointmentDate + ": ", - DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate!)) + + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(appoList[index].appointmentDate)) + " " + - widget.appoList[index].startTime!.substring(0, 5), + appoList[index].startTime!.substring(0, 5), projectViewModel.isArabic), - MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName!, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, appoList[index].projectName!, projectViewModel.isArabic), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, @@ -315,7 +317,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { RatingBar( itemSize: 20.0, allowHalfRating: true, - initialRating: widget.appoList[index].actualDoctorRate!.toDouble(), + initialRating: appoList[index].actualDoctorRate!.toDouble(), ratingWidget: RatingWidget( full: Icon( Icons.star, @@ -345,13 +347,13 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(top: 12.0), child: Text( - getNextActionDescription(widget.appoList[index].nextAction), + getNextActionDescription(appoList[index].nextAction), style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 25 / 16), ), ), InkWell( onTap: () { - navigateToAppointmentDetails(context, widget.appoList[index]); + navigateToAppointmentDetails(context, appoList[index]); }, child: Padding( padding: const EdgeInsets.only(top: 0.0), @@ -380,9 +382,9 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { child: AppExpandableNotifier( isExpand: true, hasCounter: true, - counter: (widget.ancillaryLists.isNotEmpty) ? widget.ancillaryLists[0].ancillaryOrderList!.length.toString() : "0", + counter: (ancillaryLists.isNotEmpty) ? ancillaryLists[0].ancillaryOrderList!.length.toString() : "0", title: TranslationBase.of(context).anicllaryOrders, - bodyWidget: widget.ancillaryLists.length != 0 + bodyWidget: ancillaryLists.length != 0 ? Container( padding: EdgeInsets.all(12), child: ListView.separated( @@ -391,18 +393,18 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { reverse: true, itemBuilder: (context, index) { return DoctorCard( - onTap: () => ancillaryOrdersDetails(widget.ancillaryLists[0].ancillaryOrderList![index], widget.ancillaryLists[0].projectID), + onTap: () => ancillaryOrdersDetails(ancillaryLists[0].ancillaryOrderList![index], ancillaryLists[0].projectID), isInOutPatient: true, - name: TranslationBase.of(context).dr.toString() + " " + (widget.ancillaryLists[0].ancillaryOrderList![index].doctorName ?? ""), - billNo: widget.ancillaryLists[0].ancillaryOrderList![index].orderNo.toString(), + name: TranslationBase.of(context).dr.toString() + " " + (ancillaryLists[0].ancillaryOrderList![index].doctorName ?? ""), + billNo: ancillaryLists[0].ancillaryOrderList![index].orderNo.toString(), profileUrl: "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png", - subName: widget.ancillaryLists[0].projectName, + subName: ancillaryLists[0].projectName, isLiveCareAppointment: false, - date: DateUtil.convertStringToDate(widget.ancillaryLists[0]!.ancillaryOrderList![index].orderDate!), + date: DateUtil.convertStringToDate(ancillaryLists[0].ancillaryOrderList![index].orderDate), isSortByClinic: true, ); }, - itemCount: widget.ancillaryLists[0].ancillaryOrderList!.length, + itemCount: ancillaryLists[0].ancillaryOrderList!.length, separatorBuilder: (context, index) => SizedBox(height: 14), ), ) @@ -412,13 +414,13 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { ), ), Container( - child: widget.obGyneAppoList.length != 0 + child: obGyneAppoList.length != 0 ? ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), padding: EdgeInsets.all(0.0), - itemCount: widget.obGyneAppoList.length, + itemCount: obGyneAppoList.length, itemBuilder: (context, index) { return Container( width: double.infinity, @@ -456,7 +458,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Container( child: InkWell( onTap: () { - getOBGyneDoctorsList(widget.obGyneAppoList[index].projectID!, widget.obGyneAppoList[index].setupID!, widget.obGyneAppoList[index]); + getOBGyneDoctorsList(obGyneAppoList[index].projectID!, obGyneAppoList[index].setupID!, obGyneAppoList[index]); }, child: Container( padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), @@ -477,7 +479,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { Padding( padding: const EdgeInsets.only(top: 8.0), child: Text( - TranslationBase.of(context).dr + " " + widget.obGyneAppoList[index].doctorName!, + TranslationBase.of(context).dr + " " + obGyneAppoList[index].doctorName!, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), ), ), @@ -485,7 +487,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { mainAxisSize: MainAxisSize.min, children: [ LargeAvatar( - name: TranslationBase.of(context).dr + " " + widget.obGyneAppoList[index].doctorName!, + name: TranslationBase.of(context).dr + " " + obGyneAppoList[index].doctorName!, url: "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png", width: 52, height: 52, @@ -496,12 +498,12 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - MyRichText(TranslationBase.of(context).clinic + ": ", widget.obGyneAppoList[index].clinicDescription!, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).clinic + ": ", obGyneAppoList[index].clinicDescription!, projectViewModel.isArabic), MyRichText( TranslationBase.of(context).orderDate + ": ", - DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.obGyneAppoList[index].orderDate!)).split(" ")[0], + DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(obGyneAppoList[index].orderDate)).split(" ")[0], projectViewModel.isArabic), - MyRichText(TranslationBase.of(context).branch, widget.obGyneAppoList[index].projectDescription!, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, obGyneAppoList[index].projectDescription!, projectViewModel.isArabic), ], ), ), @@ -772,14 +774,14 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.getOBGyneOrdersList(context).then((res) { - widget.obGyneAppoList.clear(); + obGyneAppoList.clear(); GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { if (res['HIS_OBGYNEProcedureGet_List'].length != 0) { - widget.obGyneAppoList.clear(); + obGyneAppoList.clear(); res['HIS_OBGYNEProcedureGet_List'].forEach((v) { - widget.obGyneAppoList.add(new OBGyneProcedureListResponse.fromJson(v)); + obGyneAppoList.add(new OBGyneProcedureListResponse.fromJson(v)); }); } else { // Navigator.of(context).popAndPushNamed(HOME); @@ -799,7 +801,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { DoctorsListService service = new DoctorsListService(); List doctorsList = []; List _patientDoctorAppointmentListHospital = []; - service.getOBGyneDoctorsList(projectID, setupID, context).then((res) { + service.getOBGyneDoctorsList(projectID, setupID, projectViewModel.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res['HIS_ObgyneUltrasoundDoctorsList'][0]); if (res['MessageStatus'] == 1) { @@ -845,32 +847,31 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { obGyneProcedureListResponse: obGyneProcedureListResponse))); } - getPatientAppointmentHistory() { + getPatientAppointmentHistory() async { int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.getPatientAppointmentHistory(true, languageID, context).then((res) { - widget.appoList.clear(); + appoList.clear(); GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - setState(() { - if (res['AppoimentAllHistoryResultList'].length != 0) { - widget.appoList.clear(); - res['AppoimentAllHistoryResultList'].forEach((v) { - widget.appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); - }); - } - if (res['AncillaryOrderList'].length != 0) { - res['AncillaryOrderList'].forEach((item) { - widget.ancillaryLists.add(AncillaryOrdersListModel.fromJson(item)); - }); - } - dataLoaded = true; - if (widget.isFromMyAppointments) { - performNextAction(widget.appointment!); - widget.isFromMyAppointments = false; - } - }); + if (res['AppoimentAllHistoryResultList'].length != 0) { + appoList.clear(); + res['AppoimentAllHistoryResultList'].forEach((v) { + appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); + }); + } + if (res['AncillaryOrderList'].length != 0) { + res['AncillaryOrderList'].forEach((item) { + ancillaryLists.add(AncillaryOrdersListModel.fromJson(item)); + }); + } + dataLoaded = true; + if (widget.isFromMyAppointments!) { + performNextAction(widget.appointment!); + widget.isFromMyAppointments = false; + } + setState(() {}); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -959,10 +960,10 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { isCash = res["IsCash"]; if (isCash) { - openPaymentDialog(appo, widget.patientShareResponse); + openPaymentDialog(appo, widget.patientShareResponse!); } else { if (isInsured && isEligible) { - openPaymentDialog(appo, widget.patientShareResponse); + openPaymentDialog(appo, widget.patientShareResponse!); } else { if (isInsured && !isEligible) { errorMsg = TranslationBase.of(context).invalidEligibility; @@ -990,10 +991,10 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { getLiveCareAppointmentPatientShare(context, DoctorsListService service, AppoitmentAllHistoryResultList appo) { GifLoaderDialogUtils.showMyDialog(context); - service.getLiveCareAppointmentPatientShare(appo.appointmentNo.toString(), appo.clinicID!, appo.projectID!, context).then((res) { + service.getLiveCareAppointmentPatientShare(appo.appointmentNo.toString(), appo.clinicID, appo.projectID, projectViewModel.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); widget.patientShareResponse = new PatientShareResponse.fromJson(res); - openPaymentDialog(appo, widget.patientShareResponse); + openPaymentDialog(appo, widget.patientShareResponse!); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err); @@ -1084,7 +1085,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { openPayment(paymentMethod, AuthenticatedUser authenticatedUser, num amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) { widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); - browser?.openPaymentBrowser( + widget.browser?.openPaymentBrowser( amount, "Appointment check in", Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), @@ -1098,7 +1099,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { widget!.browser!, appo.isLiveCareAppointment!, "2", - appo.isLiveCareAppointment! ? widget.patientShareResponse.clinicID.toString() : "", + appo.isLiveCareAppointment! ? widget.patientShareResponse!.clinicID.toString() : "", context, appo.appointmentDate, appo.appointmentNo, @@ -1302,8 +1303,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service - .insertVIDARequest(appo.appointmentNo!, appo.clinicID!, appo.projectID!, appo.serviceID!, appo.doctorID!, appo.appointmentDate!, - Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), context) + .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate!, + Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), projectViewModel.isArabic ? 1 : 2, context) .then((res) { GifLoaderDialogUtils.hideDialog(context); getPatientAppointmentHistory(); @@ -1321,7 +1322,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { onSelectedMethod: (String metohd, [String? selectedInstallmentPlan]) { setState(() {}); }, - patientShare: widget.patientShareResponse.patientShareWithTax))) + patientShare: widget.patientShareResponse!.patientShareWithTax))) .then((value) { print(value); selectedPaymentMethod = value[0] ?? ""; @@ -1330,7 +1331,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { if (value != null) { final appType = appo.isLiveCareAppointment! ? 'livecare' : 'regular'; - openPayment(value, projectViewModel.user , double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); + openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); projectViewModel.analytics.appointment.payment_method(appointment_type: appType, clinic: appo.clinicName, payment_method: value[0], payment_type: 'appointment'); } }); @@ -1362,8 +1363,8 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service - .insertVIDARequest(appo.appointmentNo!, appo.clinicID!, appo.projectID!, appo.serviceID!, appo.doctorID!, appo.appointmentDate!, - Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), context) + .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate!, + Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), projectViewModel.isArabic ? 1 : 2, context) .then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 026d9df1..10753340 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -634,7 +634,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { authService.getDashboard().then((value) async { setState(() { if (value != null) { - notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); + notificationCount = value ['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); model.setState(model.count, 0, true, notificationCount); sharedPref.setString(NOTIFICATION_COUNT, notificationCount); FlutterAppIconBadge.updateBadge(int.parse(notificationCount)); diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index 2f4cccc3..48eb7447 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -454,7 +454,7 @@ class _AdvancePaymentPageState extends State { String getPatientName() { if (_selectedPatientInfo != null) - return _selectedPatientInfo.fullName!; + return _selectedPatientInfo.fullName ??""; else return TranslationBase.of(context).selectPatientName; } @@ -469,7 +469,7 @@ class _AdvancePaymentPageState extends State { } String getFamilyMembersName() { - if (selectedPatientFamily != null) + if (selectedPatientFamily.patientName != null) return selectedPatientFamily.patientName!; else return TranslationBase.of(context).selectFamilyPatientName; diff --git a/lib/pages/medical/eye/EyeHomePage.dart b/lib/pages/medical/eye/EyeHomePage.dart index 428c41d2..4a0c5ecc 100644 --- a/lib/pages/medical/eye/EyeHomePage.dart +++ b/lib/pages/medical/eye/EyeHomePage.dart @@ -34,14 +34,15 @@ class EyeHomePage extends StatefulWidget { } class _EyeHomePageState extends State with SingleTickerProviderStateMixin { - late TabController _tabController; - List doctorDetailsList = []; + TabController? _tabController; + List? doctorDetailsList = []; + ProjectViewModel? projectViewModel; @override void initState() { super.initState(); _tabController = TabController(length: 2, vsync: this); - _tabController.addListener(() { + _tabController!.addListener(() { setState(() {}); }); } @@ -49,12 +50,12 @@ class _EyeHomePageState extends State with SingleTickerProviderStat @override void dispose() { super.dispose(); - _tabController.dispose(); + _tabController!.dispose(); } @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, @@ -82,7 +83,7 @@ class _EyeHomePageState extends State with SingleTickerProviderStat "", //model.user.emailAddress, ), - isNeedToShowButton: _tabController.index == 0 ? true : projectViewModel.havePrivilege(15), + isNeedToShowButton: _tabController!.index == 0 ? true : projectViewModel!.havePrivilege(15), showConfirmMessageDialog: true, onRatingAndReviewTap: getDoctorRatingsDetails, onTap: () { @@ -93,7 +94,7 @@ class _EyeHomePageState extends State with SingleTickerProviderStat projectName: widget.appointmentAllHistoryResultList!.projectName!, projectID: widget.appointmentAllHistoryResultList!.projectID!); GifLoaderDialogUtils.hideDialog(context); - }, projectViewModel.user!.emailAddress!); + }, projectViewModel!.user!.emailAddress!); }, ), Container( @@ -180,14 +181,14 @@ class _EyeHomePageState extends State with SingleTickerProviderStat void getDoctorRatingsDetails() { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getDoctorsRatingDetails(widget.appointmentAllHistoryResultList!.doctorID!, context).then((res) { + service.getDoctorsRatingDetails(widget.appointmentAllHistoryResultList!.doctorID!, projectViewModel!.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - doctorDetailsList.clear(); + doctorDetailsList!.clear(); res['DoctorRatingDetailsList'].forEach((v) { - doctorDetailsList.add(new DoctorRateDetails.fromJson(v)); + doctorDetailsList!.add(new DoctorRateDetails.fromJson(v)); }); - showRatingDialog(doctorDetailsList); + showRatingDialog(doctorDetailsList!); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index ca927632..a2d94bda 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -31,6 +31,7 @@ class _HomeReportPageState extends State with SingleTickerProvid late TabController _tabController_new; List imagesInfo =[]; int _currentPage = 0; + ProjectViewModel? projectViewModel; @override void initState() { @@ -46,7 +47,7 @@ class _HomeReportPageState extends State with SingleTickerProvid @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); + projectViewModel = Provider.of(context); imagesInfo.add(ImagesInfo( imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/0.png')); imagesInfo.add(ImagesInfo( @@ -55,7 +56,7 @@ class _HomeReportPageState extends State with SingleTickerProvid imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/2.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/2.png')); return BaseView( onModelReady: (model) { - model.getReports(); + model.getReports(projectViewModel!.isArabic ? 1 : 2); }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, @@ -156,11 +157,13 @@ class _HomeReportPageState extends State with SingleTickerProvid return InkWell( onTap: () { Navigator.push( - context, - FadePage( - page: InPatientMedicalReports( + context, + FadePage( + page: InPatientMedicalReports( admissionMedicalReport: admissionMedicalReport, - ))); + ), + ), + ); }, child: Container( // height: 100.0, @@ -209,14 +212,14 @@ class _HomeReportPageState extends State with SingleTickerProvid mainAxisSize: MainAxisSize.min, children: [ if (admissionMedicalReport.clinicName != null) - MyRichText(TranslationBase.of(context).clinic + ":", admissionMedicalReport.clinicName!, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).clinic + ":", admissionMedicalReport.clinicName!, projectViewModel!.isArabic), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ MyRichText( TranslationBase.of(context).status + ":", - projectViewModel.isArabic ? admissionMedicalReport.statusDescriptionN! : admissionMedicalReport.statusDescription!, - projectViewModel.isArabic), + projectViewModel!.isArabic ? admissionMedicalReport.statusDescriptionN! : admissionMedicalReport.statusDescription!, + projectViewModel!.isArabic), Icon( Icons.arrow_forward, color: Theme.of(context).primaryColor, @@ -245,7 +248,7 @@ class _HomeReportPageState extends State with SingleTickerProvid ], ), ), - if (projectViewModel.havePrivilege(21) + if (projectViewModel!.havePrivilege(21) // && _tabController_new.index == 0 ) if (_tabController_new.index == 0) @@ -259,7 +262,7 @@ class _HomeReportPageState extends State with SingleTickerProvid page: MedicalReports(), ), ).then((value) { - model.getReports(); + model.getReports(projectViewModel!.isArabic ? 1 : 2); }), ), ) diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index a20bf42c..2fa13b03 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; @@ -211,8 +212,15 @@ class ReportListWidget extends StatelessWidget { GifLoaderDialogUtils.showMyDialog(AppGlobal.context); ReportsService _reportsService = locator(); _reportsService - .sendEmailForMedicalReport(report.projectName!, report.clinicDescription!, report.doctorName, DateUtil.convertDateToString(report.requestDate!), report.invoiceNo.toString(), report.projectID!, - DateUtil.convertDateToString(report.requestDate!), report.setupId!) + .sendEmailForMedicalReport( + report.projectName!, + report.clinicDescription!, + report.doctorName, + DateUtil.convertDateToString(report.requestDate!), + Utils.isVidaPlusProject(projectViewModel, report.projectID!) ? report.invoiceNo_VP.toString() : report.invoiceNo.toString(), + report.projectID!, + DateUtil.convertDateToString(report.requestDate!), + report.setupId!) .then((value) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); AppToast.showSuccessToast(message: TranslationBase.of(AppGlobal.context).emailSentSuccessfully); diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 04872d13..cf498e59 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/models/anicllary-orders/ancillary_orders_proc_list.dart'; import 'package:diplomaticquarterapp/models/apple_pay_request.dart'; +import 'package:diplomaticquarterapp/pages/final_products_page.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -173,7 +174,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorsRating(int docID, context) async { + Future getDoctorsRating(int docID, int languageID, context) async { Map request; Request req = appGlobal.getPublicRequest(); @@ -190,6 +191,7 @@ class DoctorsListService extends BaseService { "PatientID": 0, "License": true, "IsRegistered": true, + "LanguageID": languageID, "isDentalAllowedBackend": false }; @@ -223,7 +225,7 @@ class DoctorsListService extends BaseService { return Future.value(images); } - Future getDoctorsRatingDetails(int docID, context) async { + Future getDoctorsRatingDetails(int docID, int languageID, context) async { Map request; Request req = appGlobal.getPublicRequest(); @@ -240,6 +242,7 @@ class DoctorsListService extends BaseService { "PatientID": 0, "License": true, "IsRegistered": true, + "LanguageID": languageID, "isDentalAllowedBackend": false }; @@ -272,6 +275,7 @@ class DoctorsListService extends BaseService { "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, "SessionID": null, "isDentalAllowedBackend": false, + "LanguageID": 1, "DeviceTypeID": 1 }; @@ -315,6 +319,7 @@ class DoctorsListService extends BaseService { "PatientOutSA": authUser.outSA, "SessionID": null, "isDentalAllowedBackend": false, + "LanguageID": 1, "DeviceTypeID": 1 }; @@ -328,7 +333,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, int initialSlotDuration, BuildContext context, + Future insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, int initialSlotDuration, int languageID, BuildContext context, [String? procedureID, num? testTypeEnum, num? testProcedureEnum, ProjectViewModel? projectViewModel]) async { Map request; @@ -395,7 +400,7 @@ class DoctorsListService extends BaseService { } } - Future insertLiveCareScheduleAppointment(int docID, int clinicID, int projectID, int serviceID, String selectedTime, String selectedDate, BuildContext context) async { + Future insertLiveCareScheduleAppointment(int docID, int clinicID, int projectID, int serviceID, String selectedTime, String selectedDate, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -485,14 +490,14 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future setOnlineCheckInForAppointment(String appoID, int projectID, BuildContext context) async { + Future setOnlineCheckInForAppointment(String appoID, int projectID, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - request = {"ProjectID": projectID, "AppointmentNo": appoID}; + request = {"ProjectID": projectID, "AppointmentNo": appoID, "LanguageID": languageID}; dynamic localRes; @@ -504,7 +509,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getLiveCareAppointmentPatientShare(String appoID, int clinicID, int projectID, BuildContext context) async { + Future getLiveCareAppointmentPatientShare(String appoID, int clinicID, int projectID, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -530,6 +535,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": languageID, "PatientType": authUser.patientType }; @@ -565,7 +571,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getOBGyneDoctorsList(int projectID, String setupID, BuildContext context) async { + Future getOBGyneDoctorsList(int projectID, String setupID, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -582,6 +588,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": languageID, "PatientType": authUser.patientType }; @@ -713,7 +720,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future insertVIDARequest(int appoNo, int clinicID, int projectID, int serviceID, int docID, String appoDate, String clientRequestID, BuildContext context) async { + Future insertVIDARequest(int appoNo, int clinicID, int projectID, int serviceID, int docID, String appoDate, String clientRequestID, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -754,6 +761,7 @@ class DoctorsListService extends BaseService { "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType, "VoipToken": await sharedPref.getString(ONESIGNAL_APNS_TOKEN), + "LanguageID": languageID, "IsVoip": Platform.isIOS ? true : false }; @@ -799,6 +807,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "PatientType": authUser.patientType }; @@ -837,6 +846,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "PatientType": authUser.patientType }; @@ -912,6 +922,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "PatientType": authUser.patientType }; dynamic localRes; @@ -958,6 +969,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "PatientType": authUser.patientType }; dynamic localRes; @@ -1001,6 +1013,7 @@ class DoctorsListService extends BaseService { "PatientType": authUser.patientType, "DeviceToken": await sharedPref.getString(PUSH_TOKEN), "VoipToken": await sharedPref.getString(ONESIGNAL_APNS_TOKEN), + "LanguageID": 1, "IsVoip": Platform.isIOS ? true : false }; @@ -1037,6 +1050,7 @@ class DoctorsListService extends BaseService { }); request = { + "LanguageID": 1, "RequestAncillaryOrderInvoice": [ {"MemberID": 102, "ProjectID": projectID, "AppointmentNo": appointmentID, "OrderNo": orderNo, "AncillaryOrderInvoiceProcList": selectedProcListAPI} ], @@ -1237,7 +1251,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientPrescriptionReports(AppoitmentAllHistoryResultList appo, BuildContext context) async { + Future getPatientPrescriptionReports(AppoitmentAllHistoryResultList appo, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); @@ -1261,6 +1275,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": languageID, "PatientType": authUser.patientType }; @@ -1273,7 +1288,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future sendPrescriptionEmail(String appoDate, String setupId, dynamic prescriptionReportEnhList, BuildContext context) async { + Future sendPrescriptionEmail(String appoDate, String setupId, int languageID, dynamic prescriptionReportEnhList, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); @@ -1300,6 +1315,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": authUser.patientType, "PatientType": authUser.patientType }; @@ -1343,6 +1359,7 @@ class DoctorsListService extends BaseService { "isDentalAllowedBackend": false, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "PatientType": authUser.patientType }; dynamic localRes; @@ -1381,7 +1398,7 @@ class DoctorsListService extends BaseService { "PaymentMethod": paymentMethodName, "VersionID": req.VersionID, "Channel": req.Channel, - + "LanguageID": 1, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1417,6 +1434,7 @@ class DoctorsListService extends BaseService { "generalid": req.generalid, "PatientOutSA": authUser.outSA, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "ERAdvanceAmount": { "ProjectId": projectID, "PatientId": authUser.patientID, @@ -1457,6 +1475,7 @@ class DoctorsListService extends BaseService { "generalid": req.generalid, "PatientOutSA": authUser.outSA, "PatientTypeID": authUser.patientType, + "LanguageID": 1, "EROnlineCheckinPaymentDetails": { "CheckinDate": DateUtil.convertDateToString(DateTime.now()), "ExpectedArrivalTime": DateUtil.convertDateToString(DateTime.now()), @@ -1534,6 +1553,7 @@ class DoctorsListService extends BaseService { request = { "ProjectID": projectID, + "LanguageID": 1, }; dynamic localRes; await baseAppClient.post(HAS_DENTAL_PLAN, onSuccess: (response, statusCode) async { @@ -1544,7 +1564,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future> getTamaraPaymentDetails(BuildContext context) async { + Future> getTamaraPaymentDetails(BuildContext context) async { dynamic localRes; await baseAppClient.get(GET_TAMARA_PLAN, isExternal: true, onSuccess: (response, statusCode) async { print(response); @@ -1596,12 +1616,13 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getLaserBodyPartsList(int laserCategoryID, int projectID) async { + Future getLaserBodyPartsList(int laserCategoryID, int projectID, int languageID) async { Map request; request = { "LaserCategoryID": laserCategoryID, "ProjectID": projectID, + "LanguageID": languageID, }; dynamic localRes; await baseAppClient.post(LASER_BODY_PARTS, onSuccess: (response, statusCode) async { @@ -1612,11 +1633,12 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future insertCovidQuestionnaire(List qa, int projectID, int testTypeEnum, int testProcedureEnum) async { + Future insertCovidQuestionnaire(List qa, int projectID, int testTypeEnum, int languageID, int testProcedureEnum) async { Map request; request = { "ProjectID": projectID, + "LanguageID": languageID, "IsForTravel": qa[0]['ans'].toString(), "IsComingOutSA": qa[1]['ans'].toString(), "IsFeverCurrently": qa[2]['ans'].toString(), @@ -1659,11 +1681,12 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future updateObGyneAppointment(int episodeID, int appointmentNo, int orderNo, String procedureId, int lineItemNo, int uniqueRowID) async { + Future updateObGyneAppointment(int episodeID, int appointmentNo, int orderNo, String procedureId, int lineItemNo, int uniqueRowID, int languageID) async { Map request; request = { "EpisodeID": episodeID, + "LanguageID": languageID, "AppointmentNo": appointmentNo, "OrderNo": orderNo, "ProcedureId": procedureId, @@ -1682,10 +1705,10 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getRRTProcedures(int projectID) async { + Future getRRTProcedures(int projectID, int languageID) async { Map request; - request = {"ProjectID": projectID}; + request = {"ProjectID": projectID, "LanguageID": languageID}; dynamic localRes; await baseAppClient.post(GET_RRT_PROCEDURE_LIST, onSuccess: (response, statusCode) async { @@ -1703,6 +1726,7 @@ class DoctorsListService extends BaseService { "ClientRequestID": clientRequestID, "Status": status, "FortID": tamaraOrderID, // Tamara order ID + "LanguageID": 1, "Installments_Number": selectedInstallments }; @@ -1718,7 +1742,7 @@ class DoctorsListService extends BaseService { Future markAppointmentForTamara(int projectID, String appoNo) async { Map request; - request = {"ProjectID": projectID, "AppointmentNo": appoNo}; + request = {"ProjectID": projectID, "AppointmentNo": appoNo, "LanguageID": 1}; dynamic localRes; await baseAppClient.post(MARK_APPOINTMENT_TAMARA_STATUS, onSuccess: (response, statusCode) async { localRes = response; @@ -1731,7 +1755,7 @@ class DoctorsListService extends BaseService { Future autoGenerateInvoiceTamara(int projectID, String appoNo, String mobileNo) async { Map request; - request = {"ProjectID": projectID, "AppointmentNo": appoNo, "MobileNo": mobileNo, "UserID": 102}; + request = {"ProjectID": projectID, "AppointmentNo": appoNo, "MobileNo": mobileNo, "UserID": 102, "LanguageID": 1}; dynamic localRes; await baseAppClient.post(AUTO_GENERATE_INVOICE_TAMARA, onSuccess: (response, statusCode) async { localRes = response; @@ -1744,7 +1768,7 @@ class DoctorsListService extends BaseService { Future checkPatientNphiesEligibility(int projectID) async { Map request; - request = {"ProjectID": projectID}; + request = {"ProjectID": projectID, "LanguageID": 1}; dynamic localRes; await baseAppClient.post(CHECK_PATIENT_NPHIES_ELIGIBILITY, onSuccess: (response, statusCode) async { localRes = response; @@ -1757,7 +1781,7 @@ class DoctorsListService extends BaseService { Future convertPatientToCash(int projectID) async { Map request; - request = {"ProjectID": projectID}; + request = {"ProjectID": projectID, "LanguageID": 1}; dynamic localRes; await baseAppClient.post(CONVERT_PATIENT_TO_CASH, onSuccess: (response, statusCode) async { localRes = response; @@ -1801,6 +1825,7 @@ class DoctorsListService extends BaseService { "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, "SessionID": null, "isDentalAllowedBackend": false, + "LanguageID": 1, "DeviceTypeID": 1 }; diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index cb566a44..123cc4d1 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -43,6 +43,7 @@ class FamilyFilesProvider with ChangeNotifier { dynamic localRes; try { var request = GetAllSharedRecordsByStatusReq(); + // var request = {"LanguageID": languageID}; // var result = await sharedPref.getObject(MAIN_USER); // request.status = 0; // request.patientID = result["PatientID"]; @@ -61,7 +62,7 @@ class FamilyFilesProvider with ChangeNotifier { } } - Future getUserViewRequest(responseID) async { + Future getUserViewRequest(responseID, int languageID) async { try { dynamic localRes; Map request = {}; @@ -237,7 +238,7 @@ class FamilyFilesProvider with ChangeNotifier { } } - Future silentLoggin(GetAllSharedRecordsByStatusList switchUser, int languageID, {onSuccess, mainUser}) async { + Future silentLoggin(GetAllSharedRecordsByStatusList? switchUser, int languageID, {onSuccess, mainUser}) async { Map request = {}; if (mainUser == true) { var currentUser = AuthenticatedUser.fromJson(await sharedPref.getObject(MAIN_USER) ?? ""); @@ -262,17 +263,17 @@ class FamilyFilesProvider with ChangeNotifier { // request['LogInTokenID'] = ''; // request['PatientOutSA'] = currentUser.outSA; //? 1 : 0; - request['PatientOutSA'] = switchUser.familyRegionID != null - ? switchUser.familyRegionID == 1 + request['PatientOutSA'] = switchUser!.familyRegionID != null + ? switchUser!.familyRegionID == 1 ? 0 : 1 : currentUser.outSA; //currentUser.outSA; //? 1 : 0; - request['PatientMobileNumber'] = switchUser.mobileNumber; //['MobileNumber']; + request['PatientMobileNumber'] = switchUser!.mobileNumber; //['MobileNumber']; request['SearchType'] = 2; - request['SuperUser'] = switchUser.patientID; //currentUser.PatientID; + request['SuperUser'] = switchUser!.patientID; //currentUser.PatientID; request['PatientIdentificationID'] = ''; request['IsSilentLogin'] = true; - request['PatientID'] = switchUser.responseID; //['PatientID']; + request['PatientID'] = switchUser!.responseID; //['PatientID']; request['ZipCode'] = switchUser.familyRegionID != null ? switchUser.familyRegionID == 1 ? "966" diff --git a/lib/uitl/app_toast.dart b/lib/uitl/app_toast.dart index 8031aeae..51f3b973 100644 --- a/lib/uitl/app_toast.dart +++ b/lib/uitl/app_toast.dart @@ -17,13 +17,19 @@ class AppToast { int? imageSize, }) { Fluttertoast.showToast( - msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds!, backgroundColor: backgroundColor, textColor: textColor, fontSize: fontSize); + msg: message, + toastLength: toastLength, + gravity: toastGravity, + timeInSecForIosWeb: timeInSeconds!, + backgroundColor: backgroundColor, + textColor: textColor, + fontSize: fontSize); } static void showSuccessToast({ required String message, Toast toastLength = Toast.LENGTH_LONG, - int timeInSeconds =2, + int timeInSeconds = 2, double fontSize = 16, ToastGravity toastGravity = ToastGravity.TOP, Color textColor = Colors.white, @@ -31,7 +37,14 @@ class AppToast { int? elevation, int imageSize = 32, }) { - Fluttertoast.showToast(msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds ?? 0, backgroundColor: Colors.green, textColor: textColor, fontSize: fontSize); + Fluttertoast.showToast( + msg: message, + toastLength: toastLength, + gravity: toastGravity, + timeInSecForIosWeb: timeInSeconds ?? 0, + backgroundColor: Colors.green, + textColor: textColor, + fontSize: fontSize); } static void showErrorToast({ @@ -45,7 +58,34 @@ class AppToast { int? elevation, int imageSize = 32, }) { - Fluttertoast.showToast(msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds, backgroundColor: Colors.red, textColor: textColor, fontSize: fontSize); + FToast fToast = FToast(); + fToast.init(AppGlobal.context); + Widget toast = Container( + padding: EdgeInsets.all(8), + alignment: Alignment.topCenter, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(radius.toDouble()), + color: Colors.red, + ), + child: Wrap( + children: [ + Text( + message, + style: TextStyle(color: textColor, fontSize: fontSize), + softWrap: true, + overflow: TextOverflow.clip, + ), + ], + ), + ); + fToast.showToast( + child: toast, + gravity: ToastGravity.TOP, + toastDuration: Duration(seconds: timeInSeconds), + positionedToastBuilder: (context, child) { + return Positioned(top: 50, left: 10, right: 10, child: child); + }); + // Fluttertoast.showToast(msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds, backgroundColor: Colors.red, textColor: textColor, fontSize: fontSize); } void cancelToast() { @@ -53,7 +93,8 @@ class AppToast { } void backWithEmpty() { - AppToast.showErrorToast(message: TranslationBase.of(AppGlobal.context).empty); + AppToast.showErrorToast( + message: TranslationBase.of(AppGlobal.context).empty); Navigator.of(AppGlobal.context).pop(); } diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index 5e16f14b..d4d88ff9 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -64,7 +64,7 @@ class LocationUtils { print(err); }); } else { - if (isShowConfirmDialog) showErrorLocationDialog(false); + if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: () {}); } }).catchError((err) { print(err); @@ -128,8 +128,8 @@ class LocationUtils { heading: 0.0, speed: 0.0, speedAccuracy: 1, altitudeAccuracy: 0.0, headingAccuracy: 0.0, - // altitudeAccuracy: 0.0, - // headingAccuracy: 0.0, + // altitudeAccuracy: 0.0, + // headingAccuracy: 0.0, // altitudeAccuracy: 0, // headingAccuracy: 0, // Added by Aamir @@ -155,14 +155,28 @@ class LocationUtils { } } - showErrorLocationDialog(bool isPermissionError) { + showErrorLocationDialog(bool isPermissionError, {Function()? failureCallBack}) { ConfirmDialog dialog = new ConfirmDialog( context: context, confirmMessage: TranslationBase.of(context).locationDialogMessage, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => {ConfirmDialog.closeAlertDialog(context), if (isPermissionError) Geolocator.openAppSettings() else Geolocator.openLocationSettings(), Navigator.of(context).canPop()}, - cancelFunction: () => {}); + okFunction: () { + ConfirmDialog.closeAlertDialog(context); + if (isPermissionError) + Geolocator.openAppSettings(); + else + Geolocator.openLocationSettings(); + Navigator.of(context).canPop(); + if (failureCallBack != null) { + failureCallBack(); + } + }, + cancelFunction: () { + if (failureCallBack != null) { + failureCallBack(); + } + }); return dialog.showAlertDialog(context); } diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 9b340601..8c4af667 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -1,3 +1,4 @@ +import 'dart:io' show Platform; import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; import 'package:diplomaticquarterapp/config/config.dart'; @@ -64,12 +65,6 @@ class AppDrawer extends StatefulWidget { class _AppDrawerState extends State { final InAppReview _inAppReview = InAppReview.instance; - @override - void initState() { - super.initState(); - checkUserData(); - } - ProjectViewModel? projectProvider; var sharedPref = new AppSharedPreferences(); var familyFileProvider = FamilyFilesProvider(); @@ -86,6 +81,12 @@ class _AppDrawerState extends State { final authService = new AuthProvider(); String pharmacyLiveCareQRCode = ""; + @override + void initState() { + super.initState(); + checkUserData(); + } + @override Widget build(BuildContext context) { projectProvider = Provider.of(context); @@ -219,7 +220,7 @@ class _AppDrawerState extends State { builder: (BuildContext context, AsyncSnapshot snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: - return Padding(padding: EdgeInsets.all(10), child: Text('')); + return Padding(padding: EdgeInsets.all(10), child: CircularProgressIndicator()); default: if (snapshot.hasError) return Padding(padding: EdgeInsets.all(10), child: Text(snapshot.error.toString())); @@ -423,9 +424,9 @@ class _AppDrawerState extends State { openAppReviewDialog(); locator().hamburgerMenu.logMenuItemClick('rate our app'); // if (Platform.isIOS) { - // launch("https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978"); + // launchUrl(Uri.parse("https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978")); // } else { - // launch("https://play.google.com/store/apps/details?id=com.ejada.hmg&hl=en"); + // launchUrl(Uri.parse("https://play.google.com/store/apps/details?id=com.ejada.hmg&hl=en")); // } }, ), @@ -674,7 +675,7 @@ class _AppDrawerState extends State { }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); - AppToast.showErrorToast(message: err.toString()); + // AppToast.showErrorToast(message: err.toString()); Navigator.of(context).pop(); }); } @@ -689,20 +690,16 @@ class _AppDrawerState extends State { var currentLang = await sharedPref.getString(APP_LANGUAGE); var mainUser = await sharedPref.getObject(MAIN_USER); var loginType = await sharedPref.getInt(LAST_LOGIN); - var pushToken = await sharedPref.getString(PUSH_TOKEN); - var oneSignalPushToken = await sharedPref.getString(ONESIGNAL_APNS_TOKEN); - this.sharedPref.clear(); + // this.sharedPref.clear(); if (mainUser["PatientID"] != result.list.patientID) { result.list.isFamily = true; } else { result.list.isFamily = false; } // result.list.cRSVerificationStatus = result['CRSVerificationStatus']; - this.sharedPref.setString(APP_LANGUAGE, currentLang); - this.sharedPref.setString(BLOOD_TYPE, bloodType); - this.sharedPref.setString(PUSH_TOKEN, pushToken); - this.sharedPref.setString(ONESIGNAL_APNS_TOKEN, oneSignalPushToken); - this.sharedPref.setInt(LAST_LOGIN, loginType ?? 1); + await this.sharedPref.setString(APP_LANGUAGE, currentLang); + await this.sharedPref.setString(BLOOD_TYPE, bloodType); + await this.sharedPref.setInt(LAST_LOGIN, loginType ?? 1 ); await this.sharedPref.setObject(MAIN_USER, mainUser); await this.sharedPref.setObject(USER_PROFILE, result.list); await this.sharedPref.setObject(FAMILY_FILE, familyFile); @@ -716,7 +713,7 @@ class _AppDrawerState extends State { _vitalSignService.heightCm = ""; _vitalSignService.weightKg = ""; - if (pharmacyModuleViewModel.error.isNotEmpty) await pharmacyModuleViewModel.createUser(); + // if (pharmacyModuleViewModel.error.isNotEmpty) await pharmacyModuleViewModel.createUser(); int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 43e6e88c..6205e7e8 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -37,8 +37,8 @@ var _InAppBrowserOptions = InAppBrowserClassOptions( class MyInAppBrowser extends InAppBrowser { _PAYMENT_TYPE? paymentType; - // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE - static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT + static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE + // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index 35e03de7..68f406cf 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -218,7 +218,7 @@ class DoctorHeader extends StatelessWidget { List doctorDetailsList = []; DoctorsListService service = new DoctorsListService(); - service.getDoctorsRatingDetails(headerModel.doctorId, context).then((res) { + service.getDoctorsRatingDetails(headerModel.doctorId, projectViewModel.isArabic ? 1 : 2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { doctorDetailsList.clear();