diff --git a/lib/config/config.dart b/lib/config/config.dart index 21e83c1e..c731f951 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -339,7 +339,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.3; +var VERSION_ID = 11.5; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 97a7c1d4..98f2dcf0 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -791,7 +791,7 @@ const Map localizedValues = { "Upon activation of this service, the system will send a monthly report automatically to the registered email which lists the vital signs and the results for the last visits made in AlHabib Medical Group.", "ar": "خدمة التقارير الشهرية: عند تفعيل هذه الخدمة سيقوم النظام بارسال تقرير شهري بشكل آلي على الايميل المسجل والذي يسرد المؤشرات الحيوية ونتائج التحاليل لآخر زيارات تمت بمجموعة الحبيب الطبية." }, - "language-setting": {"en": "SMS and Confirmation Calls Language", "ar": "لغة الرسائل القصيرة و الاتصال الآلي"}, + "language-setting": {"en": "SMS, WhatsApp and Confirmation Calls Language", "ar": "لغة الرسائل القصيرة والواتس اب وتأكيد المكالمات"}, "alert": {"en": "Alerts", "ar": "التنبيهات"}, "email-alert": {"en": "Alert by Email", "ar": "استلام التنبيهات بالبريد الالكتروني"}, "sms-alert": {"en": "Alert by SMS", "ar": "استلام التنبيهات بالرسائل القصيرة"}, diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index ec82db11..f92841e3 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -43,3 +43,4 @@ const CLINICS_LIST = 'CLINICS_LIST'; const COVID_QA_LIST = 'COVID_QA_LIST'; const IS_COVID_CONSENT_SHOWN = 'IS_COVID_CONSENT_SHOWN'; const REGISTER_INFO_DUBAI ='register-info-dubai'; +const IS_LAST_APPOINTMENT_RATE_SHOWN ='is-last-appointment-rate-shown'; diff --git a/lib/core/model/labs/patient_lab_orders.dart b/lib/core/model/labs/patient_lab_orders.dart index 9243c5ad..20dcda5a 100644 --- a/lib/core/model/labs/patient_lab_orders.dart +++ b/lib/core/model/labs/patient_lab_orders.dart @@ -17,6 +17,7 @@ class PatientLabOrders { String? genderDescription; String? invoiceNo; String? invoiceNo_VP; + String? invoiceType; bool? isActiveDoctorProfile; bool? isDoctorAllowVedioCall; bool? isExecludeDoctor; @@ -69,8 +70,10 @@ class PatientLabOrders { this.projectNameN, this.qR, this.setupID, - this.invoiceNo_VP, - this.speciality,this.isLiveCareAppointment}); + this.invoiceNo_VP, + this.invoiceType, + this.speciality, + this.isLiveCareAppointment}); PatientLabOrders.fromJson(Map json) { actualDoctorRate = json['ActualDoctorRate']; @@ -106,8 +109,9 @@ class PatientLabOrders { qR = json['QR']; setupID = json['SetupID']; invoiceNo_VP = json['invoiceNo_VP']; + invoiceType = json['InvoiceType']; isLiveCareAppointment = json['IsLiveCareAppointment']; - // speciality = json['Speciality'].cast(); + // speciality = json['Speciality'].cast(); } Map toJson() { @@ -146,7 +150,7 @@ class PatientLabOrders { data['SetupID'] = this.setupID; data['Speciality'] = this.speciality; data['IsLiveCareAppointment'] = this.isLiveCareAppointment; - data['invoiceNo_VP'] =this.invoiceNo_VP; + data['invoiceNo_VP'] = this.invoiceNo_VP; return data; } } @@ -155,8 +159,7 @@ class PatientLabOrdersList { String? filterName = ""; List patientLabOrdersList = []; - PatientLabOrdersList( - {this.filterName, PatientLabOrders? patientDoctorAppointment}) { - patientLabOrdersList.add(patientDoctorAppointment!); + PatientLabOrdersList({this.filterName, required PatientLabOrders patientDoctorAppointment}) { + patientLabOrdersList.add(patientDoctorAppointment); } } diff --git a/lib/core/model/labs/request_patient_lab_special_result.dart b/lib/core/model/labs/request_patient_lab_special_result.dart index 6cfd8ef6..b1e1e4e3 100644 --- a/lib/core/model/labs/request_patient_lab_special_result.dart +++ b/lib/core/model/labs/request_patient_lab_special_result.dart @@ -1,6 +1,7 @@ class RequestPatientLabSpecialResult { String? invoiceNo; String? invoiceNoVP; + String? invoiceType; String? orderNo; String? setupID; String? projectID; @@ -22,27 +23,29 @@ class RequestPatientLabSpecialResult { RequestPatientLabSpecialResult( {this.invoiceNo, this.invoiceNoVP, - this.orderNo, - this.setupID, - this.projectID, - this.clinicID, - this.versionID, - this.channel, - this.languageID, - this.iPAdress, - this.generalid, - this.patientOutSA, - this.sessionID, - this.isDentalAllowedBackend, - this.deviceTypeID, - this.patientID, - this.tokenID, - this.patientTypeID, - this.patientType}); + this.invoiceType, + this.orderNo, + this.setupID, + this.projectID, + this.clinicID, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType}); RequestPatientLabSpecialResult.fromJson(Map json) { invoiceNo = json['InvoiceNo']; invoiceNo = json['InvoiceNo_VP']; + invoiceType = json['InvoiceType']; orderNo = json['OrderNo']; setupID = json['SetupID']; projectID = json['ProjectID']; @@ -66,6 +69,7 @@ class RequestPatientLabSpecialResult { final Map data = new Map(); data['InvoiceNo'] = this.invoiceNo; data['InvoiceNo_VP'] = this.invoiceNoVP; + data['InvoiceType'] = this.invoiceType; data['OrderNo'] = this.orderNo; data['SetupID'] = this.setupID; data['ProjectID'] = this.projectID; diff --git a/lib/core/model/labs/request_send_lab_report_email.dart b/lib/core/model/labs/request_send_lab_report_email.dart index 440c4101..bfd99e52 100644 --- a/lib/core/model/labs/request_send_lab_report_email.dart +++ b/lib/core/model/labs/request_send_lab_report_email.dart @@ -24,6 +24,7 @@ class RequestSendLabReportEmail { String? projectID; String? invoiceNo; String? invoiceNoVP; + String? invoiceType; String? orderDate; String? orderNo; bool? isDownload; @@ -55,6 +56,7 @@ class RequestSendLabReportEmail { this.projectID, this.invoiceNo, this.invoiceNoVP, + this.invoiceType, this.orderDate, this.orderNo, this.isDownload, @@ -86,6 +88,7 @@ class RequestSendLabReportEmail { projectID = json['ProjectID']; invoiceNo = json['InvoiceNo']; invoiceNoVP = json['InvoiceNo_VP']; + invoiceType = json['InvoiceType']; orderDate = json['OrderDate']; orderNo = json['OrderNo']; isDownload = json['IsDownload']; @@ -119,6 +122,7 @@ class RequestSendLabReportEmail { data['ProjectID'] = this.projectID; data['InvoiceNo'] = this.invoiceNo; data['InvoiceNo_VP'] = this.invoiceNoVP; + data['InvoiceType'] = this.invoiceType; data['OrderDate'] = this.orderDate; data['OrderNo'] = this.orderNo; data['IsDownload'] = this.isDownload; diff --git a/lib/core/model/radiology/final_radiology.dart b/lib/core/model/radiology/final_radiology.dart index 4b139742..44a5883f 100644 --- a/lib/core/model/radiology/final_radiology.dart +++ b/lib/core/model/radiology/final_radiology.dart @@ -7,6 +7,7 @@ class FinalRadiology { int? invoiceLineItemNo; int? invoiceNo; dynamic invoiceNo_VP; + String? invoiceType; int? doctorID; int? clinicID; DateTime? orderDate; @@ -51,6 +52,7 @@ class FinalRadiology { this.invoiceLineItemNo, this.invoiceNo, this.invoiceNo_VP, + this.invoiceType, this.doctorID, this.clinicID, this.orderDate, @@ -96,6 +98,7 @@ class FinalRadiology { invoiceLineItemNo = json['InvoiceLineItemNo']; invoiceNo = json['InvoiceNo']; invoiceNo_VP = json['InvoiceNo_VP']; + invoiceType = json['InvoiceType']; doctorID = json['DoctorID']; clinicID = json['ClinicID']; orderDate = DateUtil.convertStringToDate(json['OrderDate']); @@ -145,6 +148,7 @@ class FinalRadiology { data['InvoiceLineItemNo'] = this.invoiceLineItemNo; data['InvoiceNo'] = this.invoiceNo; data['InvoiceNo_VP'] = this.invoiceNo_VP; + data['InvoiceType'] = this.invoiceType; data['DoctorID'] = this.doctorID; data['ClinicID'] = this.clinicID; data['OrderDate'] = this.orderDate; diff --git a/lib/core/model/radiology/request_send_rad_report_email.dart b/lib/core/model/radiology/request_send_rad_report_email.dart index 47b84a8a..185efeb6 100644 --- a/lib/core/model/radiology/request_send_rad_report_email.dart +++ b/lib/core/model/radiology/request_send_rad_report_email.dart @@ -7,6 +7,7 @@ class RequestSendRadReportEmail { String? generalid; int? invoiceNo; int? invoiceNo_VP; + String? invoiceType; String? iPAdress; bool? isDentalAllowedBackend; int? languageID; @@ -30,32 +31,33 @@ class RequestSendRadReportEmail { RequestSendRadReportEmail( {this.channel, - this.clinicName, - this.dateofBirth, - this.deviceTypeID, - this.doctorName, - this.generalid, - this.invoiceNo, - this.invoiceNo_VP, - this.iPAdress, - this.isDentalAllowedBackend, - this.languageID, - this.orderDate, - this.patientID, - this.patientIditificationNum, - this.patientMobileNumber, - this.patientName, - this.patientOutSA, - this.patientType, - this.patientTypeID, - this.projectID, - this.projectName, - this.radResult, - this.sessionID, - this.setupID, - this.to, - this.tokenID, - this.versionID}); + this.clinicName, + this.dateofBirth, + this.deviceTypeID, + this.doctorName, + this.generalid, + this.invoiceNo, + this.invoiceNo_VP, + this.invoiceType, + this.iPAdress, + this.isDentalAllowedBackend, + this.languageID, + this.orderDate, + this.patientID, + this.patientIditificationNum, + this.patientMobileNumber, + this.patientName, + this.patientOutSA, + this.patientType, + this.patientTypeID, + this.projectID, + this.projectName, + this.radResult, + this.sessionID, + this.setupID, + this.to, + this.tokenID, + this.versionID}); RequestSendRadReportEmail.fromJson(Map json) { channel = json['Channel']; @@ -66,6 +68,7 @@ class RequestSendRadReportEmail { generalid = json['generalid']; invoiceNo = json['InvoiceNo']; invoiceNo_VP = json['InvoiceNo_VP']; + invoiceType = json['InvoiceType']; iPAdress = json['IPAdress']; isDentalAllowedBackend = json['isDentalAllowedBackend']; languageID = json['LanguageID']; @@ -98,6 +101,7 @@ class RequestSendRadReportEmail { data['generalid'] = this.generalid; data['InvoiceNo'] = this.invoiceNo; data['InvoiceNo_VP'] = this.invoiceNo_VP; + data['InvoiceType'] = this.invoiceType; data['IPAdress'] = this.iPAdress; data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; data['LanguageID'] = this.languageID; diff --git a/lib/core/service/appointment_rate_service.dart b/lib/core/service/appointment_rate_service.dart index 73fc587c..cdab0def 100644 --- a/lib/core/service/appointment_rate_service.dart +++ b/lib/core/service/appointment_rate_service.dart @@ -8,8 +8,10 @@ class AppointmentRateService extends BaseService { List appointmentRatedList =[]; AppointmentDetails? appointmentDetails; - Future getIsLastAppointmentRatedList() async { + Future getIsLastAppointmentRatedList(int languageID) async { hasError = false; + Map bodyData = Map(); + bodyData['LanguageID'] = languageID; await baseAppClient.post(IS_LAST_APPOITMENT_RATED, onSuccess: (dynamic response, int statusCode) { appointmentRatedList.clear(); response['IsLastAppoitmentRatedList'].forEach((appoint) { @@ -18,7 +20,7 @@ class AppointmentRateService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: Map()); + }, body: bodyData); } Future getAppointmentDetails() async { diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 3d98703a..a6a69cbf 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -73,14 +73,29 @@ class BaseAppClient { body['VersionID'] = VERSION_ID; body['Channel'] = CHANNEL; - body['LanguageID'] = (languageID == 'ar' ? 1 : 2); + + if (body.containsKey('LanguageID')) { + if(body['LanguageID'] != null) { + body['LanguageID'] = body['LanguageID']; + } else { + 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['IPAdress'] = IP_ADDRESS; body['generalid'] = GENERAL_ID; // body['isVidaPlus'] = true; - body['Latitude'] = await AppSharedPreferences().getDouble(USER_LAT); - body['Longitude'] = await AppSharedPreferences().getDouble(USER_LONG); + double? lat = await AppSharedPreferences().getDouble(USER_LAT); + double? long = await AppSharedPreferences().getDouble(USER_LONG); + + body['Latitude'] = lat == null ? 0.0 : lat; + body['Longitude'] = long == null ? 0.0 : long; if (body.containsKey('isDentalAllowedBackend')) { body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') @@ -90,7 +105,11 @@ class BaseAppClient { : IS_DENTAL_ALLOWED_BACKEND; } - body['DeviceTypeID'] = Platform.isIOS ? 1 : await Utils.isGoogleServicesAvailable() ? 2 : 3; + body['DeviceTypeID'] = Platform.isIOS + ? 1 + : await Utils.isGoogleServicesAvailable() + ? 2 + : 3; if (!body.containsKey('IsPublicRequest')) { // if (!body.containsKey('PatientType')) { @@ -150,7 +169,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body['PatientID'] = 4767370; //3844083 + // body['PatientID'] = 1231755; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 9830d84e..2425e537 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -34,7 +34,7 @@ class LabsService extends BaseService { List labResultList = []; List labOrdersResultsList = []; - Future getLaboratoryResult({String? projectID, int? clinicID, String? invoiceNo, String? orderNo, String? setupID, bool? isVidaPlus}) async { + Future getLaboratoryResult({String? projectID, int? clinicID, String? invoiceNo, String? invoiceType, String? orderNo, String? setupID, bool? isVidaPlus}) async { hasError = false; _requestPatientLabSpecialResult.projectID = projectID; _requestPatientLabSpecialResult.clinicID = clinicID; @@ -42,6 +42,8 @@ class LabsService extends BaseService { _requestPatientLabSpecialResult.invoiceNo = isVidaPlus! ? "0" : invoiceNo; _requestPatientLabSpecialResult.invoiceNoVP = isVidaPlus ? invoiceNo : "0"; + _requestPatientLabSpecialResult.invoiceType = invoiceType!; + _requestPatientLabSpecialResult.orderNo = orderNo; _requestPatientLabSpecialResult.setupID = setupID; @@ -61,6 +63,7 @@ class LabsService extends BaseService { Map body = Map(); body['InvoiceNo_VP'] = isVidaPlus! ? patientLabOrder!.invoiceNo : "0"; body['InvoiceNo'] = isVidaPlus ? "0" : patientLabOrder!.invoiceNo; + body['InvoiceType'] = patientLabOrder!.invoiceType; body['OrderNo'] = patientLabOrder!.orderNo; body['isDentalAllowedBackend'] = false; body['SetupID'] = patientLabOrder.setupID; @@ -205,6 +208,7 @@ class LabsService extends BaseService { _requestSendLabReportEmail.projectID = patientLabOrder!.projectID; _requestSendLabReportEmail.invoiceNo = isVidaPlus ? "0" : patientLabOrder.invoiceNo; _requestSendLabReportEmail.invoiceNoVP = isVidaPlus ? patientLabOrder.invoiceNo : "0"; + _requestSendLabReportEmail.invoiceType = patientLabOrder.invoiceType; _requestSendLabReportEmail.doctorName = patientLabOrder.doctorName; _requestSendLabReportEmail.clinicName = patientLabOrder.clinicDescription; _requestSendLabReportEmail.patientName = userObj!.firstName! + " " + userObj.lastName!; diff --git a/lib/core/service/medical/radiology_service.dart b/lib/core/service/medical/radiology_service.dart index 2239de8d..e8ca4e3a 100644 --- a/lib/core/service/medical/radiology_service.dart +++ b/lib/core/service/medical/radiology_service.dart @@ -10,13 +10,14 @@ class RadiologyService extends BaseService { bool isRadiologyVIDAPlus = false; - Future getRadImageURL({int? invoiceNo, int? lineItem, int? projectId, bool? isVidaPlus}) async { + Future getRadImageURL({int? invoiceNo, String? invoiceType, int? lineItem, int? projectId, bool? isVidaPlus}) async { hasError = false; final Map body = new Map(); body['InvoiceNo'] = isVidaPlus! ? "0" : invoiceNo; body['InvoiceNo_VP'] = isVidaPlus ? invoiceNo : "0"; body['LineItemNo'] = lineItem; body['ProjectID'] = projectId; + body['InvoiceType'] = invoiceType; await baseAppClient.post(GET_RAD_IMAGE_URL, isAllowAny: true, onSuccess: (dynamic response, int statusCode) { url = response['Data']; @@ -79,6 +80,7 @@ class RadiologyService extends BaseService { _requestSendRadReportEmail.radResult = finalRadiology.reportData; _requestSendRadReportEmail.to = userObj.emailAddress; _requestSendRadReportEmail.dateofBirth = userObj.dateofBirth; + _requestSendRadReportEmail.invoiceType = finalRadiology.invoiceType; hasError = false; await baseAppClient.post(SEND_RAD_REPORT_EMAIL, isAllowAny: true, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { diff --git a/lib/core/service/privilege_service.dart b/lib/core/service/privilege_service.dart index b3f2269a..b8b7b771 100644 --- a/lib/core/service/privilege_service.dart +++ b/lib/core/service/privilege_service.dart @@ -15,6 +15,7 @@ class PrivilegeService extends BaseService { Future getPrivilege() async { Map body = Map(); body['PatientType'] = 4; + body['LanguageID'] = 1; await baseAppClient.post(GET_PRIVILEGE, onSuccess: (dynamic response, int statusCode) { response['ServicePrivilegeList'].forEach((item) { privilegeModelList.add(PrivilegeModel.fromJson(item)); diff --git a/lib/core/viewModels/appointment_rate_view_model.dart b/lib/core/viewModels/appointment_rate_view_model.dart index 509a3d65..5b52843d 100644 --- a/lib/core/viewModels/appointment_rate_view_model.dart +++ b/lib/core/viewModels/appointment_rate_view_model.dart @@ -12,10 +12,10 @@ class AppointmentRateViewModel extends BaseViewModel { AppointmentDetails get appointmentDetails => _appointmentRateService.appointmentDetails!; - Future getIsLastAppointmentRatedList() async { + Future getIsLastAppointmentRatedList(int languageID) async { isHaveAppointmentNotRate = false; setState(ViewState.Busy); - await _appointmentRateService.getIsLastAppointmentRatedList(); + await _appointmentRateService.getIsLastAppointmentRatedList(languageID); if (_appointmentRateService.hasError) { error = _appointmentRateService.error!; setState(ViewState.Error); diff --git a/lib/core/viewModels/medical/labs_view_model.dart b/lib/core/viewModels/medical/labs_view_model.dart index 993ef7de..dae2b1c6 100644 --- a/lib/core/viewModels/medical/labs_view_model.dart +++ b/lib/core/viewModels/medical/labs_view_model.dart @@ -74,9 +74,15 @@ class LabsViewModel extends BaseViewModel { List labResultLists = []; - getLaboratoryResult({required String projectID, required int clinicID, required String invoiceNo, required String orderNo, required String setupID, required bool isVidaPlus}) async { + getLaboratoryResult({String? projectID, int? clinicID, String? invoiceNo, String? invoiceType, String? orderNo, String? setupID, bool? isVidaPlus}) async { setState(ViewState.Busy); - await _labsService.getLaboratoryResult(invoiceNo: invoiceNo, orderNo: orderNo, projectID: projectID, clinicID: clinicID, setupID: setupID, isVidaPlus: isVidaPlus); + await _labsService.getLaboratoryResult(invoiceNo: invoiceNo, + invoiceType: invoiceType, + orderNo: orderNo, + projectID: projectID, + clinicID: clinicID, + setupID: setupID, + isVidaPlus: isVidaPlus); if (_labsService.hasError) { error = _labsService.error!; setState(ViewState.Error); diff --git a/lib/core/viewModels/medical/radiology_view_model.dart b/lib/core/viewModels/medical/radiology_view_model.dart index a8ead482..91988934 100644 --- a/lib/core/viewModels/medical/radiology_view_model.dart +++ b/lib/core/viewModels/medical/radiology_view_model.dart @@ -48,9 +48,9 @@ class RadiologyViewModel extends BaseViewModel { String get radImageURL => _radiologyService.url; - getRadImageURL({required int invoiceNo, required int lineItem, required int projectId, required bool isVidaPlus}) async { + getRadImageURL({required int invoiceNo, String? invoiceType, required int lineItem, required int projectId, required bool isVidaPlus}) async { setState(ViewState.Busy); - await _radiologyService.getRadImageURL(invoiceNo: invoiceNo, lineItem: lineItem, projectId: projectId, isVidaPlus: isVidaPlus); + await _radiologyService.getRadImageURL(invoiceNo: invoiceNo, invoiceType: invoiceType, lineItem: lineItem, projectId: projectId, isVidaPlus: isVidaPlus); if (_radiologyService.hasError) { error = _radiologyService.error!; setState(ViewState.Error); diff --git a/lib/models/Authentication/check_activation_code_request.dart b/lib/models/Authentication/check_activation_code_request.dart index 9a3cdc3e..8d2cd71e 100644 --- a/lib/models/Authentication/check_activation_code_request.dart +++ b/lib/models/Authentication/check_activation_code_request.dart @@ -41,7 +41,7 @@ class CheckActivationCodeReq { this.isSilentLogin, this.versionID, this.channel, - this.languageID, + // this.languageID, this.iPAdress, this.generalid, this.patientOutSA, @@ -68,7 +68,7 @@ class CheckActivationCodeReq { isSilentLogin = json['IsSilentLogin']; versionID = json['VersionID']; channel = json['Channel']; - languageID = json['LanguageID']; + // languageID = json['LanguageID']; iPAdress = json['IPAdress']; generalid = json['generalid']; patientOutSA = json['PatientOutSA']; @@ -96,7 +96,7 @@ class CheckActivationCodeReq { data['IsSilentLogin'] = this.isSilentLogin; data['VersionID'] = this.versionID; data['Channel'] = this.channel; - data['LanguageID'] = this.languageID; + // data['LanguageID'] = this.languageID; data['IPAdress'] = this.iPAdress; data['generalid'] = this.generalid; data['PatientOutSA'] = this.patientOutSA; diff --git a/lib/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart b/lib/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart index ee00594e..61c5855e 100644 --- a/lib/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart +++ b/lib/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart @@ -1,7 +1,7 @@ class GetAllSharedRecordsByStatusReq { double? versionID; int? channel; - int? languageID; + //int? languageID; String? iPAdress; String? generalid; int? patientOutSA; @@ -17,7 +17,7 @@ class GetAllSharedRecordsByStatusReq { GetAllSharedRecordsByStatusReq( {this.versionID, this.channel, - this.languageID, + // this.languageID, this.iPAdress, this.generalid, this.patientOutSA, @@ -33,7 +33,7 @@ class GetAllSharedRecordsByStatusReq { GetAllSharedRecordsByStatusReq.fromJson(Map json) { versionID = json['VersionID']; channel = json['Channel']; - languageID = json['LanguageID']; + // languageID = json['LanguageID']; iPAdress = json['IPAdress']; generalid = json['generalid']; patientOutSA = json['PatientOutSA']; @@ -51,7 +51,7 @@ class GetAllSharedRecordsByStatusReq { final Map data = new Map(); data['VersionID'] = this.versionID; data['Channel'] = this.channel; - data['LanguageID'] = this.languageID; + // data['LanguageID'] = this.languageID; data['IPAdress'] = this.iPAdress; data['generalid'] = this.generalid; data['PatientOutSA'] = this.patientOutSA; diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 497e1df1..36a0393b 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -159,27 +159,54 @@ class _BookSuccessState extends State { Widget _getQRButtons() { return Container( alignment: Alignment.bottomCenter, + margin: EdgeInsets.all(14), height: MediaQuery.of(context).size.height * 0.18, - margin: EdgeInsets.only(bottom: 24), child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ - ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: CustomTextButton( - backgroundColor: CustomColors.green, - elevation: 0, - onPressed: () { -// navigateToQR(context); - GifLoaderDialogUtils.showMyDialog(context); - getAppoQR(context); - }, - child: Text(TranslationBase.of(context).viewQR.toUpperCase(), style: TextStyle(fontSize: 18.0, color: Colors.white)), - ), + Row( + children: [ + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: CustomTextButton( + backgroundColor: CustomColors.green, + elevation: 0, + onPressed: () { + GifLoaderDialogUtils.showMyDialog(context); + getAppoQR(context); + }, + child: Text(TranslationBase.of(context).checkinOptions, style: TextStyle(fontSize: 18.0, color: Colors.white)), + ), + ), + ), + mWidth(7), + Expanded( + flex: 1, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: CustomTextButton( + backgroundColor: Color(0xffc5272d), + elevation: 0, + onPressed: () { + navigateToHome(context); + // GifLoaderDialogUtils.showMyDialog(context); + // getAppoQR(context); + }, + child: Text(TranslationBase.of(context).done, style: TextStyle(fontSize: 18.0, color: Colors.white)), + ), + ), + ), + ], ), ], ), diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index 0f253b63..65ab728e 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -62,13 +62,9 @@ class _QRCodeState extends State { // _bytes = base64.decode(widget.appoQR.split(',').last); widget.authUser = new AuthenticatedUser(); - FlutterNfcKit.nfcAvailability.then((value) { - _supportsNFC = (value == NFCAvailability.available); - }); - - WidgetsBinding.instance.addPostFrameCallback((timeStamp) { + // WidgetsBinding.instance.addPostFrameCallback((timeStamp) { // startNFCScan(); - }); + // }); super.initState(); } @@ -77,7 +73,7 @@ class _QRCodeState extends State { Future.delayed(const Duration(milliseconds: 500), () { showNfcReader(context, onNcfScan: (String nfcId) { Future.delayed(const Duration(milliseconds: 100), () { - sendNfcCheckInRequest(nfcId); + sendNfcCheckInRequest(nfcId,2); locator().todoList.to_do_list_nfc(widget.appointment!); }); }, onCancel: () { @@ -90,7 +86,7 @@ class _QRCodeState extends State { startQRCodeScan() async { String onlineCheckInQRCode = (await BarcodeScanner.scan().then((value) => value.rawContent)); if (onlineCheckInQRCode != "") { - sendNfcCheckInRequest(onlineCheckInQRCode); + sendNfcCheckInRequest(onlineCheckInQRCode, 2); locator().todoList.to_do_list_nfc(widget.appointment!); } else {} } @@ -102,7 +98,7 @@ class _QRCodeState extends State { 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!); + sendNfcCheckInRequest(projectDetailListModel.checkInQrCode!,2); } else { AppToast.showErrorToast(message: TranslationBase.of(context).locationCheckInError); } @@ -113,6 +109,9 @@ class _QRCodeState extends State { Widget build(BuildContext context) { projectViewModel = Provider.of(context); _context = context; + FlutterNfcKit.nfcAvailability.then((value) { + _supportsNFC = (value == NFCAvailability.available); + }); List checkInOptionsList = getCheckInOptionsList(context); return AppScaffold( appBarTitle: TranslationBase.of(context).onlineCheckIn, @@ -160,7 +159,8 @@ class _QRCodeState extends State { onTap: () { showNfcReader(context, onNcfScan: (String nfcId) { Future.delayed(const Duration(milliseconds: 100), () { - sendNfcCheckInRequest(nfcId); + sendNfcCheckInRequest(nfcId, 2); + locator().todoList.to_do_list_nfc(widget.appointment!); }); }, onCancel: () { @@ -242,8 +242,10 @@ class _QRCodeState extends State { optionsList.add( InkWell( onTap: () { - if (projectViewModel.havePrivilege(80)) { + if (projectViewModel.havePrivilege(80) && _supportsNFC) { startNFCScan(); + } else { + Utils.showErrorToast(TranslationBase.of(context).NFCNotSupported); } }, child: MedicalProfileItem( @@ -377,12 +379,12 @@ class _QRCodeState extends State { return docSpeciality; } - sendNfcCheckInRequest(String nfcId) { + sendNfcCheckInRequest(String nfcId, int checkInBy) { GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.sendCheckinNfcRequest(widget.patientShareResponse!.appointmentNo!, nfcId, widget.patientShareResponse!.projectID!, context).then((res) { + service.sendCheckinNfcRequest(widget!.patientShareResponse!.appointmentNo!, nfcId, widget.patientShareResponse!.projectID!, checkInBy, context).then((res) { print(res); GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 791998c4..97c8ab95 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -426,10 +426,11 @@ class _DocAvailableAppointmentsState extends State wit } getCurrentLanguage() async { - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - setState(() { - this.language = languageID; - }); + this.language = projectViewModel.isArabic ? "ar" : "en"; + // var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + // setState(() { + // this.language = languageID; + // }); } } diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index bc127018..d8a593f0 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -456,15 +456,14 @@ class _MyFamily extends State with TickerProviderStateMixin { switchUser(user, context) { GifLoaderDialogUtils.showMyDialog(context); + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; // this // .familyFileProvider // .silentLoggin(user) // .then((value) => loginAfter(value, context)); // Utils.showProgressDialog(context); - this.familyFileProvider.silentLoggin(user, mainUser: user).then((value) { - loginAfter(value, context); - }).catchError((err) { + this.familyFileProvider.silentLoggin(user is AuthenticatedUser ? null : user, languageID, mainUser: user is AuthenticatedUser).then((value) => loginAfter(value, context)).catchError((err) { print("err:$err"); AppToast.showErrorToast(message: err.toString()); Navigator.of(context).pop(); @@ -560,7 +559,8 @@ class _MyFamily extends State with TickerProviderStateMixin { GifLoaderDialogUtils.showMyDialog(context); try { if (familySharedRecords == null) { - familySharedRecords = await familyFileProvider.getSharedRecordByStatus(); + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + familySharedRecords = await familyFileProvider.getSharedRecordByStatus(languageID); } sentRecordsList = []; familySharedRecordsList = []; diff --git a/lib/pages/DrawerPages/notifications/notification_details_page.dart b/lib/pages/DrawerPages/notifications/notification_details_page.dart index 05acad0a..1277cbcb 100644 --- a/lib/pages/DrawerPages/notifications/notification_details_page.dart +++ b/lib/pages/DrawerPages/notifications/notification_details_page.dart @@ -81,6 +81,16 @@ class _NotificationsDetailsPageState extends State { letterSpacing: -0.64, ), ), + SizedBox(height: 18), + Text( + widget.notification!.message!.trim(), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + letterSpacing: -0.48, + ), + ), if (widget.notification.notificationType == "2") Padding( padding: const EdgeInsets.only(top: 18), @@ -105,15 +115,24 @@ class _NotificationsDetailsPageState extends State { }, fit: BoxFit.fill), ), SizedBox(height: 18), - Text( - widget.notification.message!.trim(), - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - color: Color(0xff575757), - letterSpacing: -0.48, - ), - ), + // Text( + // widget.notification.message!.trim(), + // style: TextStyle( + // fontSize: 12, + // fontWeight: FontWeight.w600, + // color: Color(0xff575757), + // letterSpacing: -0.48, + // ), + // ), + // Text( + // widget.notification.message.trim(), + // style: TextStyle( + // fontSize: 12, + // fontWeight: FontWeight.w600, + // color: Color(0xff575757), + // letterSpacing: -0.48, + // ), + // ), ], ), ); diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 89edb85f..8f9d1fc1 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -5,8 +5,10 @@ import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -52,6 +54,8 @@ class _MyAppointmentsState extends State with SingleTickerProvid int _currentPage = 0; + ToDoCountProviderModel? toDoProvider; + @override void initState() { filterType = FilterType.Clinic; @@ -72,6 +76,7 @@ class _MyAppointmentsState extends State with SingleTickerProvid @override Widget build(BuildContext context) { + toDoProvider = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).myAppointmentsList, isShowAppBar: true, @@ -168,6 +173,19 @@ class _MyAppointmentsState extends State with SingleTickerProvid print(err); AppToast.showErrorToast(message: err); }); + getToDoCount(); + } + + getToDoCount() { + toDoProvider!.setState(0, true, "0"); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + if (res['MessageStatus'] == 1) { + toDoProvider!.setState(res['AppointmentActiveNumber'], true, "0"); + } else {} + }).catchError((err) { + print(err); + }); } bool isConfirmed(AppoitmentAllHistoryResultList appo) { @@ -378,9 +396,9 @@ class _MyAppointmentsState extends State with SingleTickerProvid isLiveCareAppointment: _appointmentResult.isLiveCareAppointment, date: DateUtil.convertStringToDate(_appointmentResult.appointmentDate!), isSortByClinic: _isSortByClinic, - rating: _appointmentResult.actualDoctorRate! + 0.0, - appointmentTime: _appointmentResult.isLiveCareAppointment - ! ? DateUtil.convertStringToDate(_appointmentResult.appointmentDate!).toString().split(" ")[1].substring(0, 5) + rating: _appointmentResult.actualDoctorRate + 0.0, + appointmentTime: _appointmentResult.isLiveCareAppointment! + ? DateUtil.convertStringToDate(_appointmentResult.appointmentDate).toString().split(" ")[1].substring(0, 5) : _appointmentResult.startTime!.substring(0, 5), // appointmentTime: _appointmentResult.startTime.substring(0, 5), remainingTimeInMinutes: (_appointmentResult.patientStatusType == AppointmentType.BOOKED || _appointmentResult.patientStatusType == AppointmentType.CONFIRMED) diff --git a/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart index 96174828..1062eaf3 100644 --- a/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart +++ b/lib/pages/MyAppointments/models/BookedButtonsAllowCheckIn.dart @@ -30,19 +30,19 @@ class BookedButtonsAllowCheckIn { { "title": TranslationBase.of(AppGlobal.context).add, "subtitle": TranslationBase.of(AppGlobal.context).reminder, - "icon": "reminder_icon.png", + "icon": "assets/images/new-design/reminder_icon.png", "caller": "addReminder", }, { "title": TranslationBase.of(AppGlobal.context).hospital, "subtitle": TranslationBase.of(AppGlobal.context).location, - "icon": "location_icon.png", + "icon": "assets/images/new-design/location_icon.png", "caller": "navigateToProject", }, { "title": TranslationBase.of(AppGlobal.context).online, "subtitle": TranslationBase.of(AppGlobal.context).payment, - "icon": "check-in.png", + "icon": "assets/images/new-design/check-in.png", "caller": "goToTodoList", } ]; diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 560163ae..89bad63d 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -99,6 +99,7 @@ class _AppointmentActionsState extends State { hasBadge: true, isEnable: !shouldEnable, imgColor: Color(0xff28323A), + isPngImage: appoButtonsList[index].icon!.contains(".png") ? true : false, ), ); }, @@ -481,8 +482,12 @@ class _AppointmentActionsState extends State { } askYourDoc() { GifLoaderDialogUtils.showMyDialog(context); + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + DoctorsListService service = new DoctorsListService(); - service.isAllowedToAskDoctor(widget.appo.doctorID!, context).then((res) { + service.isAllowedToAskDoctor(widget.appo.doctorID!,languageID, context).then((res) { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + service.isAllowedToAskDoctor(widget.appo.doctorID, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); print(res['PatientDoctorAppointmentResultList']); if (res['PatientDoctorAppointmentResultList'].length != 0) { @@ -495,12 +500,14 @@ class _AppointmentActionsState extends State { print(err); AppToast.showErrorToast(message: err); }); - } + }); + } getCallRequestType() { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.getCallRequestType(context).then((res) { + service.getCallRequestType(languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); List requestData = []; res['ListReqTypes'].forEach((element) { @@ -543,9 +550,11 @@ class _AppointmentActionsState extends State { } sendAskDocRequest(int requestType) { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service.sendAskDocCallRequest(widget.appo, requestType.toString(), context).then((res) { + + service.sendAskDocCallRequest(widget.appo, requestType.toString(), languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: "Request Sent Successfully"); @@ -621,33 +630,34 @@ class _AppointmentActionsState extends State { } } - -getPatientAppointmentHistoryWithAppo() { - GifLoaderDialogUtils.showMyDialog(context); - DoctorsListService service = new DoctorsListService(); - service.getPatientAppointmentHistoryWithAppoNo(widget.appo.appointmentNo).then((res) { - GifLoaderDialogUtils.hideDialog(context); - if (res['MessageStatus'] == 1) { - AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList.fromJson(res['AppoimentAllHistoryResultList'][0]); - Navigator.push( - context, - FadePage( - page: ToDo( - isShowAppBar: true, - isFromMyAppointments: true, - appointment: appo, + getPatientAppointmentHistoryWithAppo() { + GifLoaderDialogUtils.showMyDialog(context); + DoctorsListService service = new DoctorsListService(); + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + service.getPatientAppointmentHistoryWithAppoNo(widget.appo.appointmentNo, languageID).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList.fromJson(res['AppoimentAllHistoryResultList'][0]); + Navigator.push( + context, + FadePage( + page: ToDo( + isShowAppBar: true, + isFromMyAppointments: true, + appointment: appo, + ), ), - ), - ); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }).catchError((err) { - print(err); - GifLoaderDialogUtils.hideDialog(context); - err != null ?? AppToast.showErrorToast(message: err); - }); -} + ); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + err != null ?? AppToast.showErrorToast(message: err); + }); + } + rateAppointment() { widget.browser = new MyInAppBrowser(); var url = 'http://hmg.com/SitePages/pso.aspx?p=' + widget.appo.projectID.toString() + '.' + widget.appo.appointmentNo.toString() + '&c=1'; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 0a5bb78d..b2ee03e0 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -20,6 +20,7 @@ import 'package:diplomaticquarterapp/pages/ToDoList/widgets/paymentDialog.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -50,9 +51,8 @@ class ToDo extends StatefulWidget { List appoList = []; List ancillaryLists = []; List obGyneAppoList = []; - late var languageID; - late MyInAppBrowser browser; - + var languageID; + MyInAppBrowser? browser; bool isShowAppBar = true; Function()? onBackClick; bool isFromMyAppointments; @@ -84,6 +84,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { bool isInsured = false; bool isEligible = false; bool isCash = false; + MyInAppBrowser? browser; @override void initState() { @@ -877,7 +878,19 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { GifLoaderDialogUtils.hideDialog(context); err != null ?? AppToast.showErrorToast(message: err); }); - // getAncillaryOrders(); + getToDoCount(); + } + + getToDoCount() { + toDoProvider.setState(0, true, "0"); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + if (res['MessageStatus'] == 1) { + toDoProvider.setState(res['AppointmentActiveNumber'], true, "0"); + } else {} + }).catchError((err) { + print(err); + }); } checkPatientNphiesEligibility(context, AppoitmentAllHistoryResultList appo) { @@ -999,23 +1012,23 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { patientShareResponse.projectID = appo.projectID; patientShareResponse.isFollowup = appo.isFollowup; - FlutterNfcKit.nfcAvailability.then((value) { - if (value == NFCAvailability.available) { - PatientShareResponse patientShareResponse = new PatientShareResponse(); - patientShareResponse.doctorNameObj = appo.doctorNameObj; - patientShareResponse.doctorSpeciality = appo.doctorSpeciality; - patientShareResponse.projectName = appo.projectName; - patientShareResponse.appointmentDate = appo.appointmentDate; - patientShareResponse.appointmentNo = appo.appointmentNo; - patientShareResponse.clinicID = appo.clinicID; - patientShareResponse.projectID = appo.projectID; - patientShareResponse.isFollowup = appo.isFollowup; - navigateToQR(context, "", patientShareResponse, appo); - projectViewModel.analytics.todoList.to_do_list_check_in(appo); - } else { - Utils.showErrorToast(TranslationBase.of(context).NFCNotSupported); - } - }); + // FlutterNfcKit.nfcAvailability.then((value) { + // if (value == NFCAvailability.available) { + // PatientShareResponse patientShareResponse = new PatientShareResponse(); + patientShareResponse.doctorNameObj = appo.doctorNameObj; + patientShareResponse.doctorSpeciality = appo.doctorSpeciality; + patientShareResponse.projectName = appo.projectName; + patientShareResponse.appointmentDate = appo.appointmentDate; + patientShareResponse.appointmentNo = appo.appointmentNo; + patientShareResponse.clinicID = appo.clinicID; + patientShareResponse.projectID = appo.projectID; + patientShareResponse.isFollowup = appo.isFollowup; + navigateToQR(context, "", patientShareResponse, appo); + projectViewModel.analytics.todoList.to_do_list_check_in(appo); + // } else { + // Utils.showErrorToast(TranslationBase.of(context).NFCNotSupported); + // } + // }); projectViewModel.analytics.todoList.to_do_list_check_in(appo); DoctorsListService service = new DoctorsListService(); @@ -1069,7 +1082,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); - widget.browser.openPaymentBrowser( + browser?.openPaymentBrowser( amount, "Appointment check in", Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), @@ -1080,7 +1093,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { authenticatedUser.firstName!, authenticatedUser.patientID, authenticatedUser, - widget.browser, + widget!.browser!, appo.isLiveCareAppointment!, "2", appo.isLiveCareAppointment! ? widget.patientShareResponse.clinicID.toString() : "", @@ -1111,7 +1124,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { // if(selectedPaymentMethod != "TAMARA") { MyInAppBrowser.successURLS.forEach((element) { if (url.contains(element)) { - if (widget.browser.isOpened()) widget.browser.close(); + browser?.close(); MyInAppBrowser.isPaymentDone = true; return; } @@ -1121,7 +1134,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { // if(selectedPaymentMethod != "TAMARA") { MyInAppBrowser.errorURLS.forEach((element) { if (url.contains(element)) { - if (widget.browser.isOpened()) widget.browser.close(); + browser?.close(); MyInAppBrowser.isPaymentDone = false; return; } diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 93ba665d..18005ca9 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/geofencing/requests/GeoZonesRequestModel.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/geofencing/GeofencingServices.dart'; +import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; @@ -17,6 +18,7 @@ import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page_2.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; +import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/pages/videocall-webrtc-rnd/webrtc/start_video_call.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; @@ -36,6 +38,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart'; import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/not_auh_page.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -70,6 +73,7 @@ class LandingPage extends StatefulWidget { class _LandingPageState extends State with WidgetsBindingObserver { var authProvider = new AuthProvider(); + AppointmentRateViewModel appointmentRateViewModel = locator(); int currentTab = 0; late PageController pageController; @@ -275,7 +279,8 @@ class _LandingPageState extends State with WidgetsBindingObserver { WidgetsBinding.instance.addPostFrameCallback((_) { if (projectViewModel.isLogin && !projectViewModel.isLoginChild) { - familyFileProvider.getSharedRecordByStatus(); + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + familyFileProvider.getSharedRecordByStatus(languageID); } }); @@ -347,7 +352,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { Navigator.of(context).pushNamed(CONFIRM_LOGIN); } else { GifLoaderDialogUtils.showMyDialog(context); - authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { + authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES? value) { GifLoaderDialogUtils.hideDialog(context); if (value != null) { setUserValues(value); @@ -620,7 +625,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { void checkUserStatus(token) async { await PushNotificationHandler.getInstance().requestPermissions(); - authService.selectDeviceImei(token).then((SelectDeviceIMEIRES value) => setUserValues(value)); + authService.selectDeviceImei(token).then((SelectDeviceIMEIRES? value) => setUserValues(value)); if (authenticatedUserObject.isLogin) { var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); if (data != null) { diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 7c4cadc2..176ec57f 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -103,25 +103,25 @@ class _clinic_listState extends State { }); } }); - - getLanguageID(); super.initState(); } @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); + getLanguageID(); return Container( child: currentSelectedLiveCareType == "immediate" ? getLiveCareImmediateClinicList() : getLiveCareScheduleClinicList(), ); } void startLiveCare() { + int languageID = projectViewModel.isArabic ? 1 : 2; bool isError = false; LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); ERAppointmentFeesResponse erAppointmentFeesResponse = new ERAppointmentFeesResponse(); - service.getERAppointmentFees(selectedClinicID, widget.isPharmacyLiveCare, context).then((res) { + service.getERAppointmentFees(selectedClinicID, widget.isPharmacyLiveCare, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['HasAppointment'] == true) { isError = true; @@ -184,9 +184,10 @@ class _clinic_listState extends State { } getERAppointmentTime(GetERAppointmentFeesList getERAppointmentFeesList) { + int languageID = projectViewModel.isArabic ? 1 : 2; LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service.getERAppointmentTime(selectedClinicID, widget.isPharmacyLiveCare, context).then((res) { + service.getERAppointmentTime(selectedClinicID, widget.isPharmacyLiveCare, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); showLiveCarePaymentDialog(getERAppointmentFeesList, res['WatingtimeInteger']); }).catchError((err) { @@ -505,7 +506,8 @@ class _clinic_listState extends State { } getLanguageID() async { - languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + languageID = projectViewModel.isArabic ? "ar" : "en"; + // languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); } getLiveCareClinicsList() { @@ -758,11 +760,12 @@ class _clinic_listState extends State { } void startScheduleLiveCare() { + int languageID = projectViewModel.isArabic ? 1 : 2; List doctorsList = []; LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - List _patientDoctorAppointmentListHospital =[]; - service.getLiveCareScheduledDoctorList(context, selectedClinicID).then((res) { + List _patientDoctorAppointmentListHospital = []; + service.getLiveCareScheduledDoctorList(context, selectedClinicID, languageID).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 7bb5dd7b..d81be3a1 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -602,6 +602,8 @@ class _ConfirmLogin extends State { { // if(widget.isDubai ==false){ widget.changePageViewIndex!(1), + // if(widget.isDubai ==false){ + Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)), } } @@ -744,37 +746,17 @@ class _ConfirmLogin extends State { projectViewModel.user = authenticatedUserObject.user; await authenticatedUserObject.getUser(getUser: true); - // getToDoCount(); + GifLoaderDialogUtils.hideDialog(context); - appointmentRateViewModel - .getIsLastAppointmentRatedList() - .then((value) => { - getToDoCount(), - checkIfIsInPatient(), - GifLoaderDialogUtils.hideDialog(AppGlobal.context), - if (appointmentRateViewModel.isHaveAppointmentNotRate) - { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: RateAppointmentDoctor(), - ), - (r) => false) - } - else - { - Navigator.pushAndRemoveUntil( - context, - FadePage( - page: LandingPage(), - ), - (r) => false) - }, - insertIMEI() - }) - .catchError((err) { - print(err); - }); + getToDoCount(); + + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), + (r) => false); + insertIMEI(); } loading(flag) { diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 32f5bf0c..24e69a5c 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -359,9 +359,9 @@ class _Login extends State { projectViewModel.isLogin = true; authenticatedUserObject.user = result.list; projectViewModel.user = authenticatedUserObject.user; - + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; appointmentRateViewModel - .getIsLastAppointmentRatedList() + .getIsLastAppointmentRatedList(languageID) .then((value) => { checkIfIsInPatient(), getToDoCount(), @@ -410,7 +410,7 @@ class _Login extends State { bool hasAdmissionRequest = false; GetAdmissionInfoResponseModel getAdmissionInfoResponseModel; GetAdmissionRequestInfoResponseModel getAdmissionRequestInfoResponseModel; - ClinicListService service = new ClinicListService(); + ClinicListService? service = new ClinicListService(); service.checkIfInPatientAPI(context).then((res) { if (res['MessageStatus'] == 1) { isAdmitted = res['isAdmitted']; diff --git a/lib/pages/login/register-info.dart b/lib/pages/login/register-info.dart index 52f83ac8..41554c43 100644 --- a/lib/pages/login/register-info.dart +++ b/lib/pages/login/register-info.dart @@ -705,7 +705,8 @@ class _RegisterInfo extends State { projectViewModel.isLogin = true; projectViewModel.user = authenticatedUserObject.user; await authenticatedUserObject.getUser(getUser: true); - appointmentRateViewModel.getIsLastAppointmentRatedList().then((value) { + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + appointmentRateViewModel.getIsLastAppointmentRatedList(languageID).then((value) { getToDoCount(); GifLoaderDialogUtils.hideDialog(AppGlobal.context); if (appointmentRateViewModel.isHaveAppointmentNotRate) { diff --git a/lib/pages/medical/ask_doctor/request_type.dart b/lib/pages/medical/ask_doctor/request_type.dart index 3bff9a19..2dece140 100644 --- a/lib/pages/medical/ask_doctor/request_type.dart +++ b/lib/pages/medical/ask_doctor/request_type.dart @@ -27,7 +27,8 @@ class _RequestTypePageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getQuestionTypes(), + // onModelReady: (model) => model.getQuestionTypes(), + onModelReady: (model) => model.getCallRequestTypeLOVs(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).requestType, diff --git a/lib/pages/medical/labs/laboratory_result_page.dart b/lib/pages/medical/labs/laboratory_result_page.dart index 04bd7e35..698e34d5 100644 --- a/lib/pages/medical/labs/laboratory_result_page.dart +++ b/lib/pages/medical/labs/laboratory_result_page.dart @@ -34,11 +34,12 @@ class _LaboratoryResultPageState extends State { ProjectViewModel projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getLaboratoryResult( - invoiceNo: widget.patientLabOrders!.invoiceNo!, - clinicID: widget.patientLabOrders!.clinicID!, - projectID: widget.patientLabOrders!.projectID!, - orderNo: widget.patientLabOrders!.orderNo!, - setupID: widget.patientLabOrders!.setupID ?? "0", + invoiceNo: widget.patientLabOrders!.invoiceNo, + invoiceType: widget.patientLabOrders!.invoiceType, + clinicID: widget.patientLabOrders!.clinicID, + projectID: widget.patientLabOrders!.projectID, + orderNo: widget.patientLabOrders!.orderNo, + setupID: widget.patientLabOrders!.setupID, isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrders!.projectID!)), ), builder: (_, model, w) => AppScaffold( diff --git a/lib/pages/medical/radiology/radiology_details_page.dart b/lib/pages/medical/radiology/radiology_details_page.dart index d42cbe34..409890f2 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -29,6 +29,7 @@ class RadiologyDetailsPage extends StatelessWidget { return BaseView( onModelReady: (model) => model.getRadImageURL( projectId: finalRadiology!.projectID!, + invoiceType: finalRadiology!.invoiceType, lineItem: finalRadiology!.invoiceLineItemNo!, invoiceNo: Utils.isVidaPlusProject(projectViewModel, finalRadiology!.projectID!) ? finalRadiology!.invoiceNo_VP : finalRadiology!.invoiceNo, isVidaPlus: Utils.isVidaPlusProject(projectViewModel, finalRadiology!.projectID!)), diff --git a/lib/pages/packages_offers/OfferAndPackagesPage.dart b/lib/pages/packages_offers/OfferAndPackagesPage.dart index f13122e5..bad29b62 100644 --- a/lib/pages/packages_offers/OfferAndPackagesPage.dart +++ b/lib/pages/packages_offers/OfferAndPackagesPage.dart @@ -292,7 +292,7 @@ class _PackagesHomePageState extends State { } else { GifLoaderDialogUtils.showMyDialog(context); - auth.AuthProvider().selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { + auth.AuthProvider().selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES? value) { GifLoaderDialogUtils.hideDialog(context); if (value != null) { sharedPref.setObject(IMEI_USER_DATA, value); diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index 29b99b85..f4928e49 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -324,7 +324,7 @@ class _FooterWidgetState extends State { GifLoaderDialogUtils.showMyDialog(context); authService .selectDeviceImei(DEVICE_TOKEN) - .then((SelectDeviceIMEIRES value) { + .then((SelectDeviceIMEIRES? value) { GifLoaderDialogUtils.hideDialog(context); if (value != null) { setUserValues(value); diff --git a/lib/pages/rateAppointment/rate_appointment_clinic.dart b/lib/pages/rateAppointment/rate_appointment_clinic.dart index 377cd9d7..d55c5073 100644 --- a/lib/pages/rateAppointment/rate_appointment_clinic.dart +++ b/lib/pages/rateAppointment/rate_appointment_clinic.dart @@ -191,11 +191,17 @@ class _RateAppointmentClinicState extends State { child: DefaultButton( TranslationBase.of(context).later, () { - Navigator.pushReplacement( + // Navigator.pushReplacement( + // context, + // FadePage( + // page: LandingPage(), + // ), + // ); + Navigator.pop( + context, + ); + Navigator.pop( context, - FadePage( - page: LandingPage(), - ), ); }, color: CustomColors.accentColor, diff --git a/lib/pages/rateAppointment/rate_appointment_doctor.dart b/lib/pages/rateAppointment/rate_appointment_doctor.dart index 5bea3b63..ff1d2e33 100644 --- a/lib/pages/rateAppointment/rate_appointment_doctor.dart +++ b/lib/pages/rateAppointment/rate_appointment_doctor.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; @@ -15,6 +16,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.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 RateAppointmentDoctor extends StatefulWidget { @@ -30,9 +32,11 @@ class _RateAppointmentDoctorState extends State { final formKey = GlobalKey(); String note = ""; int rating = 0; + ProjectViewModel? projectViewModel; @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, @@ -189,12 +193,21 @@ class _RateAppointmentDoctorState extends State { }); dialog.showAlertDialog(context); } else { - Navigator.pushReplacement( - context, - FadePage( - page: LandingPage(), - ), - ); + if(projectViewModel!.isLoginChild) { + Navigator.pushReplacement( + context, + FadePage( + page: LandingPage(), + ), + ); + } else { + Navigator.pop( + context, + // FadePage( + // page: LandingPage(), + // ), + ); + } } }, color: CustomColors.accentColor, diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index d93a4e0d..ba909299 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -46,10 +46,9 @@ class DoctorsListService extends BaseService { long = await this.sharedPref.getDouble(USER_LONG); } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); // Request req = appGlobal.getPublicRequest(); request = { - // "LanguageID": languageID == 'ar' ? 1 : 2, + // // "IPAdress": "10.20.10.20", // "VersionID": req.VersionID, // "Channel": req.Channel, @@ -104,10 +103,8 @@ class DoctorsListService extends BaseService { long = await this.sharedPref.getDouble(USER_LONG); } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "VersionID": req.VersionID, "Channel": req.Channel, @@ -143,10 +140,9 @@ class DoctorsListService extends BaseService { Future getDoctorsProfile(int docID, int clinicID, int projectID, context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "VersionID": req.VersionID, "Channel": req.Channel, @@ -176,10 +172,9 @@ class DoctorsListService extends BaseService { Future getDoctorsRating(int docID, context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "VersionID": req.VersionID, "Channel": req.Channel, @@ -227,10 +222,9 @@ class DoctorsListService extends BaseService { Future getDoctorsRatingDetails(int docID, context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "VersionID": req.VersionID, "Channel": req.Channel, @@ -258,7 +252,7 @@ class DoctorsListService extends BaseService { Future getDoctorFreeSlots(int docID, int clinicID, int projectID, BuildContext context, [ProjectViewModel? projectViewModel]) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "DoctorID": docID, @@ -270,7 +264,6 @@ class DoctorsListService extends BaseService { "isReschadual": false, "VersionID": req.VersionID, "Channel": 3, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "generalid": "Cs2020@2016\$2958", "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, @@ -301,7 +294,7 @@ class DoctorsListService extends BaseService { Future getDoctorScheduledFreeSlots(int docID, int clinicID, int projectID, int serviceID, BuildContext context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "DoctorID": docID, @@ -314,7 +307,6 @@ class DoctorsListService extends BaseService { "isReschadual": false, "VersionID": req.VersionID, "Channel": 3, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "generalid": "Cs2020@2016\$2958", "PatientOutSA": authUser.outSA, @@ -342,7 +334,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsForLiveCare": false, @@ -366,7 +357,6 @@ class DoctorsListService extends BaseService { "Age": authUser.age != null ? authUser.age : 0, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -410,7 +400,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsForLiveCare": true, @@ -433,7 +422,6 @@ class DoctorsListService extends BaseService { "GenderID": authUser.gender, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -463,7 +451,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -473,7 +460,6 @@ class DoctorsListService extends BaseService { "IsActiveAppointment": true, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -522,7 +508,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -533,7 +518,6 @@ class DoctorsListService extends BaseService { "IsForLiveCare": true, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -563,17 +547,9 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); - request = { - "LanguageID": languageID == 'ar' ? 1 : 2, - "ProjectID": 15, - "DeviceTypeID": req.DeviceTypeID, - "PatientID": authUser.patientID, - "PatientTypeID": authUser.patientType, - "PatientType": authUser.patientType - }; + request = {"ProjectID": 15, "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, "PatientType": authUser.patientType}; dynamic localRes; @@ -593,11 +569,9 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, "ProjectID": projectID, "SetupID": setupID, "isDentalAllowedBackend": false, @@ -617,9 +591,9 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getPatientAppointmentHistoryWithAppoNo(int appoNo) async { + Future getPatientAppointmentHistoryWithAppoNo(int appoNo, int languageID) async { Map request; - request = {"IsActiveAppointment": true, "AppointmentNo": appoNo, "IsComingFromCOC": false}; + request = {"IsActiveAppointment": true, "AppointmentNo": appoNo, "IsComingFromCOC": false, "LanguageID": languageID}; dynamic localRes; await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, onSuccess: (response, statusCode) async { localRes = response; @@ -638,14 +612,12 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsActiveAppointment": isActiveAppointment, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "SessionID": "YckwoXhUmWBsnHKEKig", @@ -669,14 +641,13 @@ class DoctorsListService extends BaseService { Future getPatientAppointmentCurfewHistory(bool isActiveAppointment) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "IsActiveAppointment": isActiveAppointment, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "SessionID": "YckwoXhUmWBsnHKEKig", @@ -705,7 +676,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -716,7 +686,6 @@ class DoctorsListService extends BaseService { "ConfirmationBy": 102, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "SessionID": "YckwoXhUmWBsnHKEKig", @@ -752,7 +721,6 @@ class DoctorsListService extends BaseService { long = await this.sharedPref.getDouble(USER_LONG); } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -770,7 +738,6 @@ class DoctorsListService extends BaseService { "DeviceType": req.DeviceType, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -801,7 +768,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -818,7 +784,6 @@ class DoctorsListService extends BaseService { "StrAppointmentDate": DateUtil.getDateFormatted(appo.appointmentDate!), "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -848,7 +813,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -858,7 +822,6 @@ class DoctorsListService extends BaseService { "IsFollowup": patientShareResponse.isFollowup, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -888,7 +851,6 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -901,7 +863,6 @@ class DoctorsListService extends BaseService { "To": to, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -929,14 +890,13 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "ClientRequestID": transactionID, "IsPharmacy": isPharma, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -974,7 +934,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "AdvanceNumber": advanceNumber, @@ -983,7 +943,6 @@ class DoctorsListService extends BaseService { "AppointmentID": appointmentID, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1009,7 +968,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "AdvanceNumber": advanceNumber, @@ -1024,7 +983,6 @@ class DoctorsListService extends BaseService { "DeviceType": Platform.isIOS ? "iOS" : "Android", "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1086,13 +1044,13 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future isAllowedToAskDoctor(int docID, BuildContext context) async { + Future isAllowedToAskDoctor(int docID, 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; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "IsForAskYourDoctor": true, @@ -1100,9 +1058,9 @@ class DoctorsListService extends BaseService { "Top": 25, "beforeDays": 15, "exludType": 4, + "LanguageID": languageID, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1123,18 +1081,17 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getCallRequestType(BuildContext context) async { + Future getCallRequestType(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; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1143,6 +1100,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": languageID, "PatientType": authUser.patientType }; @@ -1155,19 +1113,20 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future sendAskDocCallRequest(AppoitmentAllHistoryResultList appo, String requestType, BuildContext context) async { + Future sendAskDocCallRequest(AppoitmentAllHistoryResultList appo, String requestType, 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; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "ProjectID": appo.projectID, "SetupID": appo.setupID, "DoctorID": appo.doctorID, + "ClinicID": appo.clinicID, "RequestType": requestType, "RequestTypeID": requestType, "PatientMobileNumber": authUser.mobileNumber, @@ -1182,7 +1141,6 @@ class DoctorsListService extends BaseService { "EditedOn": DateUtil.getYearMonthDayHourMinSecDateFormatted(DateTime.now()).split(" ")[0], "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1191,6 +1149,7 @@ class DoctorsListService extends BaseService { "DeviceTypeID": req.DeviceTypeID, "PatientID": authUser.patientID, "PatientTypeID": authUser.patientType, + "LanguageID": languageID, "PatientType": authUser.patientType }; @@ -1209,13 +1168,12 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "AppointmentNo": appoNo, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1242,7 +1200,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "AppointmentNo": appoNo, @@ -1250,7 +1208,6 @@ class DoctorsListService extends BaseService { "ClinicID": clinicID, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1277,7 +1234,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "AppointmentNo": appo.appointmentNo, @@ -1287,7 +1244,6 @@ class DoctorsListService extends BaseService { "VersionID": req.VersionID, "SetupID": appo.setupID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1314,7 +1270,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "AppointmentDate": appoDate, @@ -1327,7 +1283,6 @@ class DoctorsListService extends BaseService { "SetupID": setupId, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1354,7 +1309,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "ProjectID": projectID, @@ -1372,7 +1327,6 @@ class DoctorsListService extends BaseService { }, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1399,7 +1353,7 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { @@ -1418,7 +1372,7 @@ class DoctorsListService extends BaseService { "PaymentMethod": paymentMethodName, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1444,13 +1398,12 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1485,13 +1438,12 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1529,14 +1481,13 @@ class DoctorsListService extends BaseService { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { "MedCategoryID": medCategoryId, "MedGetStsID": medCategoryStsId, "VersionID": req.VersionID, "Channel": req.Channel, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": req.IPAdress, "generalid": req.generalid, "PatientOutSA": authUser.outSA, @@ -1556,14 +1507,10 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future sendCheckinNfcRequest(int appointmentNo, String nfcCode, int projectId, BuildContext context) async { + Future sendCheckinNfcRequest(int appointmentNo, String nfcCode, int projectId, int checkInBy, BuildContext context) async { Map request; - request = { - "AppointmentNo": appointmentNo, - "NFC_Code": nfcCode, - "ProjectID": projectId, - }; + request = {"AppointmentNo": appointmentNo, "NFC_Code": nfcCode, "ProjectID": projectId, "CheckinBy": checkInBy}; dynamic localRes; await baseAppClient.post(SEND_CHECK_IN_NFC_REQUEST, onSuccess: (response, statusCode) async { localRes = response; @@ -1829,7 +1776,6 @@ class DoctorsListService extends BaseService { Map requestFreeSlots; Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); requestFreeSlots = { "DoctorID": docID, @@ -1841,7 +1787,6 @@ class DoctorsListService extends BaseService { "isReschadual": false, "VersionID": req.VersionID, "Channel": 3, - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "generalid": "Cs2020@2016\$2958", "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index 29e6ac2d..a473873a 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -151,24 +151,31 @@ class AuthProvider with ChangeNotifier { } } - Future selectDeviceImei(imei) async { + Future selectDeviceImei(imei) async { try { dynamic localRes; print(imei); Map request = {}; request['IMEI'] = imei; - await BaseAppClient().post(SELECT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) { + await BaseAppClient().post(SELECT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) async { localRes = Map(); if (response['Patient_SELECTDeviceIMEIbyIMEIList'][0] != null) { - localRes = SelectDeviceIMEIRES.fromJson(response['Patient_SELECTDeviceIMEIbyIMEIList'][0]); + localRes = SelectDeviceIMEIRES.fromJson( + response['Patient_SELECTDeviceIMEIbyIMEIList'][0]); } + request['LanguageID'] = Provider.of(AppGlobal.context, listen: false).isArabic ? 1 : 2; + await new BaseAppClient().post(SELECT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) { + localRes = SelectDeviceIMEIRES.fromJson(response['Patient_SELECTDeviceIMEIbyIMEIList'][0]); }, onFailure: (String error, int statusCode) { throw error; }, body: request); return Future.value(localRes); - } catch (error) { + }); + } + catch (error) { return Future.error(error); } + } Future checkPatientAuthentication(CheckPatientAuthenticationReq request) async { diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index a4390fe6..1de5e6ab 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -38,6 +38,7 @@ class ClinicListService extends BaseService { request = { "IsActiveAppointment": true, + "LanguageID": 1 }; dynamic localRes; @@ -143,6 +144,10 @@ class ClinicListService extends BaseService { Future getProjectsList(context) async { Map request = {}; + request = { + "LanguageID": null + }; + dynamic localRes; await baseAppClient.post(GET_PROJECTS_LIST, onSuccess: (response, statusCode) async { diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index ebab13fb..cb566a44 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -1,7 +1,9 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/family-file/add_family_file_request.dart'; import 'package:diplomaticquarterapp/core/model/family-file/insert_share_file_request.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/send_activation_request.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; @@ -9,6 +11,7 @@ import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordsBySta import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:flutter/cupertino.dart'; +import 'package:provider/provider.dart'; // SharedPreferences sharedPref = new SharedPreferences(); enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } @@ -36,7 +39,7 @@ class FamilyFilesProvider with ChangeNotifier { dynamic authenticatedUser; GetAllSharedRecordsByStatusResponse allSharedRecordsByStatusResponse = GetAllSharedRecordsByStatusResponse(); - Future getSharedRecordByStatus() async { + Future getSharedRecordByStatus(int languageID) async { dynamic localRes; try { var request = GetAllSharedRecordsByStatusReq(); @@ -234,7 +237,7 @@ class FamilyFilesProvider with ChangeNotifier { } } - Future silentLoggin(GetAllSharedRecordsByStatusList switchUser, {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) ?? ""); @@ -252,6 +255,7 @@ class FamilyFilesProvider with ChangeNotifier { request['ZipCode'] = currentUser.outSA == 1 ? "971" : "966"; request['activationCode'] = '0000'; request['isRegister'] = false; + request['LanguageID'] = languageID; } else { var currentUser = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); //const request = new SwitchUserRequest(); @@ -277,6 +281,7 @@ class FamilyFilesProvider with ChangeNotifier { // request['ZipCode'] = currentUser.outSA == 1 ? "971" : "966"; request['activationCode'] = '0000'; request['isRegister'] = false; + request['LanguageID'] = languageID; } try { dynamic localRes; @@ -289,7 +294,8 @@ class FamilyFilesProvider with ChangeNotifier { }, body: request); sharedPref.setString(BLOOD_TYPE, localRes['PatientBloodType'] ?? ""); return Future.value(localRes); - } catch (error) { + } + catch (error) { print(error); throw error; } diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index 42592878..2d64d378 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -57,7 +57,7 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future getLiveCareScheduledDoctorList(BuildContext context, int serviceID) async { + Future getLiveCareScheduledDoctorList(BuildContext context, int serviceID, int languageID) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -69,7 +69,8 @@ class LiveCareService extends BaseService { "ServiceID": serviceID, "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, - "Gender": authUser.gender != null ? authUser.gender : 0 + "Gender": authUser.gender != null ? authUser.gender : 0, + "LanguageID": languageID }; dynamic localRes; @@ -146,7 +147,7 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future getERAppointmentFees(int serviceID, bool isPharmaLiveCare, BuildContext context) async { + Future getERAppointmentFees(int serviceID, bool isPharmaLiveCare, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -160,7 +161,8 @@ class LiveCareService extends BaseService { "ProjectID": 12, "PatientID": authUser.patientID != null ? authUser.patientID : 0, "Age": authUser.age != null ? authUser.age : 0, - "Gender": authUser.gender != null ? authUser.gender : 0 + "Gender": authUser.gender != null ? authUser.gender : 0, + "LanguageID": languageID }; dynamic localRes; @@ -173,7 +175,7 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future getERAppointmentTime(int serviceID, bool isPharmaLiveCare, BuildContext context) async { + Future getERAppointmentTime(int serviceID, bool isPharmaLiveCare, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -187,7 +189,8 @@ class LiveCareService extends BaseService { "ProjectID": 12, "Age": authUser.age != null ? authUser.age : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0, - "Gender": authUser.gender != null ? authUser.gender : 0 + "Gender": authUser.gender != null ? authUser.gender : 0, + "LanguageID": languageID }; dynamic localRes; diff --git a/lib/services/my_invoice_service/my_invoice_services.dart b/lib/services/my_invoice_service/my_invoice_services.dart index 92463537..2245eeef 100644 --- a/lib/services/my_invoice_service/my_invoice_services.dart +++ b/lib/services/my_invoice_service/my_invoice_services.dart @@ -15,11 +15,9 @@ class MyInvoicesService extends BaseService { Future getAllDentalAppointments(int projectID, context) async { Map request; - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "VersionID": req.VersionID, "Channel": req.Channel, @@ -38,8 +36,7 @@ class MyInvoicesService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_ALL_APPOINTMENTS_FOR_DENTAL_CLINIC, - onSuccess: (response, statusCode) async { + await baseAppClient.post(GET_ALL_APPOINTMENTS_FOR_DENTAL_CLINIC, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { throw error; @@ -49,11 +46,9 @@ class MyInvoicesService extends BaseService { Future getDentalAppointmentInvoice(int projectID, int appoNo, int invoiceNo, context) async { Map request; - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "VersionID": req.VersionID, "Channel": req.Channel, @@ -74,22 +69,19 @@ class MyInvoicesService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_DENTAL_APPOINTMENT_INVOICE, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(GET_DENTAL_APPOINTMENT_INVOICE, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } Future sendDentalAppointmentInvoiceEmail(int projectID, int appoNo, context) async { Map request; - var languageID = - await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "VersionID": req.VersionID, "Channel": req.Channel, @@ -110,13 +102,11 @@ class MyInvoicesService extends BaseService { dynamic localRes; - await baseAppClient.post(SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL, - onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + await baseAppClient.post(SEND_DENTAL_APPOINTMENT_INVOICE_EMAIL, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } - } diff --git a/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart b/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart index 459c0e83..6c316f7f 100644 --- a/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart +++ b/lib/services/smartwatch_integration/SmartWatchIntegrationService.dart @@ -23,11 +23,9 @@ class SmartWatchIntegrationService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { - "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "VersionID": req.VersionID, "Channel": req.Channel, diff --git a/lib/splashPage.dart b/lib/splashPage.dart index eda593ec..0de11156 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -63,7 +63,11 @@ class _SplashScreenState extends State { AppSharedPreferences().setString(APP_LANGUAGE, projectProvider.isArabic ? "ar" : "en"); var themeNotifier = Provider.of(context, listen: false); themeNotifier.setTheme(defaultTheme(fontName: projectProvider.isArabic ? 'Cairo' : 'Poppins')); - PushNotificationHandler.getInstance().init(context); // Asyncronously + PushNotificationHandler().init(context); // Asyncronously + AppSharedPreferences().getAll().then((value) { + // debugPrint("ALL SHARED PREFERENCES!!!!!"); + // debugPrint(jsonEncode(value)); + }); } @override diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index c62dfbc4..9b4541ca 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -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, // headingAccuracy: 0, // Added by Aamir diff --git a/lib/widgets/data_display/medical/time_line_new_widget.dart b/lib/widgets/data_display/medical/time_line_new_widget.dart index 53e2182b..3419a858 100644 --- a/lib/widgets/data_display/medical/time_line_new_widget.dart +++ b/lib/widgets/data_display/medical/time_line_new_widget.dart @@ -295,7 +295,7 @@ class _TimeLineViewState extends State { Navigator.of(context).pushNamed(CONFIRM_LOGIN); } else { GifLoaderDialogUtils.showMyDialog(context); - authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { + authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES? value) { GifLoaderDialogUtils.hideDialog(context); if (value != null) { sharedPref.setObject(IMEI_USER_DATA, value); diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index c8159f2b..19a1a5dc 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -1,5 +1,3 @@ -import 'dart:convert'; - import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; import 'package:diplomaticquarterapp/config/config.dart'; @@ -218,7 +216,7 @@ class _AppDrawerState extends State { : SizedBox(), FutureBuilder( future: getFamilyFiles(), // async work - builder: (BuildContext context, AsyncSnapshot snapshot) { + builder: (BuildContext context, AsyncSnapshot snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: return Padding(padding: EdgeInsets.all(10), child: Text('')); @@ -631,7 +629,7 @@ class _AppDrawerState extends State { Navigator.of(context).pushNamed(CONFIRM_LOGIN); } else { GifLoaderDialogUtils.showMyDialog(context); - authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { + authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES? value) { GifLoaderDialogUtils.hideDialog(context); if (value != null) { setUserValues(value); @@ -652,23 +650,23 @@ class _AppDrawerState extends State { locator().hamburgerMenu.logMenuItemClick('login'); } - Future getFamilyFiles() async { + Future getFamilyFiles() async { if (user != null) { if (await sharedPref.getObject(FAMILY_FILE) != null) { // print(await sharedPref.getObject(FAMILY_FILE)); return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(await sharedPref.getObject(FAMILY_FILE))); } else { - return familyFileProvider.getSharedRecordByStatus(); + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + return familyFileProvider.getSharedRecordByStatus(languageID); } } - return familyFileProvider.getSharedRecordByStatus(); } switchUser(user, context) { - GetAllSharedRecordsByStatusList switchUser = GetAllSharedRecordsByStatusList.fromJson(jsonDecode(jsonEncode(user))); + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); sharedPref.remove(BLOOD_TYPE); - this.familyFileProvider.silentLoggin(switchUser, mainUser: user is AuthenticatedUser).then((value) { + this.familyFileProvider.silentLoggin(user is AuthenticatedUser ? null : user, languageID, mainUser: user is AuthenticatedUser).then((value) { // GifLoaderDialogUtils.hideDialog(context); // Navigator.of(context).pop(); loginAfter(value, context, user is AuthenticatedUser); @@ -676,7 +674,7 @@ class _AppDrawerState extends State { }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); - AppToast.showErrorToast(message: err); + AppToast.showErrorToast(message: err.toString()); Navigator.of(context).pop(); }); } @@ -720,8 +718,10 @@ class _AppDrawerState extends State { if (pharmacyModuleViewModel.error.isNotEmpty) await pharmacyModuleViewModel.createUser(); + int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; + appointmentRateViewModel - .getIsLastAppointmentRatedList() + .getIsLastAppointmentRatedList(languageID) .then((value) => { getToDoCount(), //Utils.hideProgressDialog(), diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 089e9eee..43e6e88c 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -27,7 +27,12 @@ var _InAppBrowserOptions = InAppBrowserClassOptions( ios: IOSInAppWebViewOptions(applePayAPIEnabled: true, isFraudulentWebsiteWarningEnabled: false)), crossPlatform: InAppBrowserOptions(hideUrlBar: true, toolbarTopBackgroundColor: Colors.black), android: AndroidInAppBrowserOptions(), - ios: IOSInAppBrowserOptions(hideToolbarBottom: true, toolbarBottomBackgroundColor: Colors.white, closeButtonColor: Colors.white, presentationStyle: IOSUIModalPresentationStyle.OVER_FULL_SCREEN)); + ios: IOSInAppBrowserOptions( + hideToolbarBottom: true, + toolbarBottomBackgroundColor: Colors.white, + closeButtonColor: Colors.white, + closeButtonCaption: "Close", + presentationStyle: IOSUIModalPresentationStyle.OVER_FULL_SCREEN)); class MyInAppBrowser extends InAppBrowser { _PAYMENT_TYPE? paymentType; @@ -281,7 +286,7 @@ class MyInAppBrowser extends InAppBrowser { Platform.isIOS ? form = form.replaceFirst('DEVICE_TOKEN', await AppSharedPreferences().getString(PUSH_TOKEN) + "," + await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN)) - : form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); + : form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN) ?? ""); // form = form.replaceFirst('DEVICE_TOKEN', await AppSharedPreferences().getString(PUSH_TOKEN) + "," + await AppSharedPreferences().getString(ONESIGNAL_APNS_TOKEN)); // form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); diff --git a/lib/widgets/others/not_auh_page.dart b/lib/widgets/others/not_auh_page.dart index f9dab34e..063878bb 100644 --- a/lib/widgets/others/not_auh_page.dart +++ b/lib/widgets/others/not_auh_page.dart @@ -335,7 +335,7 @@ class _NotAutPageState extends State { Navigator.of(context).pushNamed(CONFIRM_LOGIN); } else { GifLoaderDialogUtils.showMyDialog(context); - authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { + authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES? value) { GifLoaderDialogUtils.hideDialog(context); if (value != null) { sharedPref.setObject(IMEI_USER_DATA, value); diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart index 819f29c3..d35837b6 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -125,7 +125,7 @@ class BottomNavPharmacyItem extends StatelessWidget { Navigator.of(context).pushNamed(CONFIRM_LOGIN); } else { GifLoaderDialogUtils.showMyDialog(context); - authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { + authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES? value) { GifLoaderDialogUtils.hideDialog(context); if (value != null) { setUserValues(value);