diff --git a/android/google-services.json b/android/google-services.json new file mode 100644 index 00000000..a4655794 --- /dev/null +++ b/android/google-services.json @@ -0,0 +1,40 @@ +{ + "project_info": { + "project_number": "864393916058", + "firebase_url": "https://diplomaticquarter-d2385.firebaseio.com", + "project_id": "diplomaticquarter-d2385", + "storage_bucket": "diplomaticquarter-d2385.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:864393916058:android:5b5a65cd6d8c18b4b97923", + "android_client_info": { + "package_name": "com.cloud.diplomaticquarterapp" + } + }, + "oauth_client": [ + { + "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBdV3mos1BPhUzNKCj2KANJtiO3o2zh9IM" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/google-services.json b/google-services.json new file mode 100644 index 00000000..a4655794 --- /dev/null +++ b/google-services.json @@ -0,0 +1,40 @@ +{ + "project_info": { + "project_number": "864393916058", + "firebase_url": "https://diplomaticquarter-d2385.firebaseio.com", + "project_id": "diplomaticquarter-d2385", + "storage_bucket": "diplomaticquarter-d2385.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:864393916058:android:5b5a65cd6d8c18b4b97923", + "android_client_info": { + "package_name": "com.cloud.diplomaticquarterapp" + } + }, + "oauth_client": [ + { + "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyBdV3mos1BPhUzNKCj2KANJtiO3o2zh9IM" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "864393916058-tphjrn8j39ntevt32ekcvmll8aue7qql.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/lib/config/config.dart b/lib/config/config.dart index 0df3a581..3c7c7cd3 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,7 +5,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; const MAX_SMALL_SCREEN = 660; -const BASE_URL = 'https://hmgwebservices.com/Services'; +const BASE_URL = 'https://uat.hmgwebservices.com/Services'; const GET_PROJECT = '/Lists.svc/REST/GetProject'; @@ -97,6 +97,19 @@ const IS_ALLOW_ASK_DOCTOR = '/Doctors.svc/REST/GetPatientDoctorAppointmentResult const GET_CALL_REQUEST_TYPE = '/Doctors.svc/REST/GetCallRequestType_LOV'; const SEND_CALL_REQUEST = '/Doctors.svc/REST/InsertCallInfo'; +const GET_LIVECARE_CLINICS = '/ER_VirtualCall.svc/REST/PatientER_GetClinics'; +const GET_LIVECARE_CLINIC_TIMING = '/ER_VirtualCall.svc/REST/PatientER_GetClinicsServiceTimingsSchedule'; + +const GET_ER_APPOINTMENT_FEES = '/DoctorApplication.svc/REST/GetERAppointmentFees'; +const GET_ER_APPOINTMENT_TIME = '/ER_VirtualCall.svc/REST/GetRestTime'; + +const ADD_NEW_CALL_FOR_PATIENT_ER = '/DoctorApplication.svc/REST/NewCallForPatientER'; + +const GET_LIVECARE_HISTORY = '/ER_VirtualCall.svc/REST/GetPatientErVirtualHistory'; +const CANCEL_LIVECARE_REQUEST = '/ER_VirtualCall.svc/REST/DeleteErRequest'; +const SEND_LIVECARE_INVOICE_EMAIL = '/Notifications.svc/REST/SendInvoiceForLiveCare'; + + //URL to get medicine and pharmacies list const CHANNEL = 3; const GENERAL_ID = 'Cs2020@2016\$2958'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 987feb96..9c33d98e 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -252,5 +252,8 @@ const Map> localizedValues = { "policyNumber": {"en": "Policy Number: ", "ar": "رقم بوليصة التاميت:"}, "seeDetails": {"en": "SEE DETAILS", "ar": "منافعك التامينية"}, "insuranceCards": {"en": "Insurance Cards", "ar": "بطاقات التأمين"}, - "requestType": {"en": "Request Type", "ar": "نوع الاستفسار"} + "requestType": {"en": "Request Type", "ar": "نوع الاستفسار"}, + "consultation": {"en": "Consultation", "ar": "استشارة"}, + "logs": {"en": "Logs", "ar": "السجلات"} + }; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 53f91de7..ec061e5f 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -24,7 +24,7 @@ class BaseAppClient { try { //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en'); var user = await sharedPref.getObject(USER_PROFILE); body['SetupID'] = body.containsKey('SetupID') ? body['SetupID']!=null? body['SetupID'] :SETUP_ID :SETUP_ID; body['VersionID'] = body.containsKey('VersionID') ? body['VersionID']!=null? body['VersionID'] :VERSION_ID :VERSION_ID; diff --git a/lib/core/service/medical/vital_sign_service.dart b/lib/core/service/medical/vital_sign_service.dart index b353d3b9..ad35d357 100644 --- a/lib/core/service/medical/vital_sign_service.dart +++ b/lib/core/service/medical/vital_sign_service.dart @@ -24,6 +24,6 @@ class VitalSignService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: Map()); + }, body: body); } } diff --git a/lib/main.dart b/lib/main.dart index dd0f3d97..da20fbbc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -8,7 +8,8 @@ import 'config/size_config.dart'; import 'core/viewModels/project_view_model.dart'; import 'locator.dart'; -void main() { + +void main() async { setupLocator(); runApp(MyApp()); } diff --git a/lib/models/FamilyFiles/PatientERVirtualHistoryResponse.dart b/lib/models/FamilyFiles/PatientERVirtualHistoryResponse.dart new file mode 100644 index 00000000..11a8157c --- /dev/null +++ b/lib/models/FamilyFiles/PatientERVirtualHistoryResponse.dart @@ -0,0 +1,108 @@ +class PatientERVirtualHistoryResponse { + List erRequestHistoryList; + + PatientERVirtualHistoryResponse({this.erRequestHistoryList}); + + PatientERVirtualHistoryResponse.fromJson(Map json) { + if (json['ErRequestHistoryList'] != null) { + erRequestHistoryList = new List(); + json['ErRequestHistoryList'].forEach((v) { + erRequestHistoryList.add(new ErRequestHistoryList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.erRequestHistoryList != null) { + data['ErRequestHistoryList'] = + this.erRequestHistoryList.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ErRequestHistoryList { + dynamic appointmentNo; + String arrivalTime; + int callDuration; + int callStatus; + String clientRequestID; + String doctorID; + String doctorName; + String doctorNameN; + String doctorTitle; + String exWaitingTime; + bool isAppointmentHaveRating; + int patCount; + int projectID; + String sArrivalTime; + int serviceID; + String stringCallStatus; + int vCID; + int watingtimeInteger; + + ErRequestHistoryList( + {this.appointmentNo, + this.arrivalTime, + this.callDuration, + this.callStatus, + this.clientRequestID, + this.doctorID, + this.doctorName, + this.doctorNameN, + this.doctorTitle, + this.exWaitingTime, + this.isAppointmentHaveRating, + this.patCount, + this.projectID, + this.sArrivalTime, + this.serviceID, + this.stringCallStatus, + this.vCID, + this.watingtimeInteger}); + + ErRequestHistoryList.fromJson(Map json) { + appointmentNo = json['AppointmentNo'] != null ? json['AppointmentNo'] : "0"; + arrivalTime = json['ArrivalTime']; + callDuration = json['CallDuration']; + callStatus = json['CallStatus']; + clientRequestID = json['ClientRequestID']; + doctorID = json['DoctorID']; + doctorName = json['DoctorName']; + doctorNameN = json['DoctorNameN']; + doctorTitle = json['DoctorTitle']; + exWaitingTime = json['Ex_WaitingTime']; + isAppointmentHaveRating = json['IsAppointmentHaveRating']; + patCount = json['Pat_Count']; + projectID = json['ProjectID']; + sArrivalTime = json['SArrivalTime']; + serviceID = json['ServiceID']; + stringCallStatus = json['StringCallStatus']; + vCID = json['VC_ID']; + watingtimeInteger = json['WatingtimeInteger']; + } + + Map toJson() { + final Map data = new Map(); + data['AppointmentNo'] = this.appointmentNo; + data['ArrivalTime'] = this.arrivalTime; + data['CallDuration'] = this.callDuration; + data['CallStatus'] = this.callStatus; + data['ClientRequestID'] = this.clientRequestID; + data['DoctorID'] = this.doctorID; + data['DoctorName'] = this.doctorName; + data['DoctorNameN'] = this.doctorNameN; + data['DoctorTitle'] = this.doctorTitle; + data['Ex_WaitingTime'] = this.exWaitingTime; + data['IsAppointmentHaveRating'] = this.isAppointmentHaveRating; + data['Pat_Count'] = this.patCount; + data['ProjectID'] = this.projectID; + data['SArrivalTime'] = this.sArrivalTime; + data['ServiceID'] = this.serviceID; + data['StringCallStatus'] = this.stringCallStatus; + data['VC_ID'] = this.vCID; + data['WatingtimeInteger'] = this.watingtimeInteger; + return data; + } +} diff --git a/lib/models/LiveCare/ClinicsServiceTimingsResponse.dart b/lib/models/LiveCare/ClinicsServiceTimingsResponse.dart new file mode 100644 index 00000000..223b633f --- /dev/null +++ b/lib/models/LiveCare/ClinicsServiceTimingsResponse.dart @@ -0,0 +1,122 @@ +class ClinicsServiceTimingsResponse { + List + patientERGetClinicsServiceTimingsList; + + ClinicsServiceTimingsResponse({this.patientERGetClinicsServiceTimingsList}); + + ClinicsServiceTimingsResponse.fromJson(Map json) { + if (json['PatientER_GetClinicsServiceTimingsList'] != null) { + patientERGetClinicsServiceTimingsList = + new List(); + json['PatientER_GetClinicsServiceTimingsList'].forEach((v) { + patientERGetClinicsServiceTimingsList + .add(new PatientERGetClinicsServiceTimingsList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.patientERGetClinicsServiceTimingsList != null) { + data['PatientER_GetClinicsServiceTimingsList'] = this + .patientERGetClinicsServiceTimingsList + .map((v) => v.toJson()) + .toList(); + } + return data; + } +} + +class PatientERGetClinicsServiceTimingsList { + int iD; + int serviceID; + Null shiftID; + int dayOfWeek; + String dayOfWeekStr; + Null startTime; + Null endTime; + bool isActive; + String createdOn; + String createdBy; + bool projectOutSA; + String dayOfWeekStrN; + List shiftTimings; + + PatientERGetClinicsServiceTimingsList( + {this.iD, + this.serviceID, + this.shiftID, + this.dayOfWeek, + this.dayOfWeekStr, + this.startTime, + this.endTime, + this.isActive, + this.createdOn, + this.createdBy, + this.projectOutSA, + this.dayOfWeekStrN, + this.shiftTimings}); + + PatientERGetClinicsServiceTimingsList.fromJson(Map json) { + iD = json['ID']; + serviceID = json['ServiceID']; + shiftID = json['ShiftID']; + dayOfWeek = json['DayOfWeek']; + dayOfWeekStr = json['DayOfWeekStr']; + startTime = json['StartTime']; + endTime = json['EndTime']; + isActive = json['IsActive']; + createdOn = json['CreatedOn']; + createdBy = json['CreatedBy']; + projectOutSA = json['ProjectOutSA']; + dayOfWeekStrN = json['DayOfWeekStrN']; + if (json['ShiftTimings'] != null) { + shiftTimings = new List(); + json['ShiftTimings'].forEach((v) { + shiftTimings.add(new ShiftTimings.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['ServiceID'] = this.serviceID; + data['ShiftID'] = this.shiftID; + data['DayOfWeek'] = this.dayOfWeek; + data['DayOfWeekStr'] = this.dayOfWeekStr; + data['StartTime'] = this.startTime; + data['EndTime'] = this.endTime; + data['IsActive'] = this.isActive; + data['CreatedOn'] = this.createdOn; + data['CreatedBy'] = this.createdBy; + data['ProjectOutSA'] = this.projectOutSA; + data['DayOfWeekStrN'] = this.dayOfWeekStrN; + if (this.shiftTimings != null) { + data['ShiftTimings'] = this.shiftTimings.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ShiftTimings { + String endTime; + int shiftID; + String startTime; + + ShiftTimings({this.endTime, this.shiftID, this.startTime}); + + ShiftTimings.fromJson(Map json) { + endTime = json['EndTime']; + shiftID = json['ShiftID']; + startTime = json['StartTime']; + } + + Map toJson() { + final Map data = new Map(); + data['EndTime'] = this.endTime; + data['ShiftID'] = this.shiftID; + data['StartTime'] = this.startTime; + return data; + } +} diff --git a/lib/models/LiveCare/ERAppointmentFeesResponse.dart b/lib/models/LiveCare/ERAppointmentFeesResponse.dart new file mode 100644 index 00000000..a6cc061a --- /dev/null +++ b/lib/models/LiveCare/ERAppointmentFeesResponse.dart @@ -0,0 +1,61 @@ +class ERAppointmentFeesResponse { + GetERAppointmentFeesList getERAppointmentFeesList; + + ERAppointmentFeesResponse({this.getERAppointmentFeesList}); + + ERAppointmentFeesResponse.fromJson(Map json) { + getERAppointmentFeesList = json['GetERAppointmentFeesList'] != null + ? new GetERAppointmentFeesList.fromJson( + json['GetERAppointmentFeesList']) + : null; + } + + Map toJson() { + final Map data = new Map(); + if (this.getERAppointmentFeesList != null) { + data['GetERAppointmentFeesList'] = this.getERAppointmentFeesList.toJson(); + } + return data; + } +} + +class GetERAppointmentFeesList { + String amount; + String companyName; + bool isInsured; + bool isShowInsuranceUpdateModule; + String tax; + String total; + String currency; + + GetERAppointmentFeesList( + {this.amount, + this.companyName, + this.isInsured, + this.isShowInsuranceUpdateModule, + this.tax, + this.total, + this.currency}); + + GetERAppointmentFeesList.fromJson(Map json) { + amount = json['Amount']; + companyName = json['CompanyName']; + isInsured = json['IsInsured']; + isShowInsuranceUpdateModule = json['IsShowInsuranceUpdateModule']; + tax = json['Tax']; + total = json['Total']; + currency = json['currency']; + } + + Map toJson() { + final Map data = new Map(); + data['Amount'] = this.amount; + data['CompanyName'] = this.companyName; + data['IsInsured'] = this.isInsured; + data['IsShowInsuranceUpdateModule'] = this.isShowInsuranceUpdateModule; + data['Tax'] = this.tax; + data['Total'] = this.total; + data['currency'] = this.currency; + return data; + } +} diff --git a/lib/models/LiveCare/LiveCareClinicsListResponse.dart b/lib/models/LiveCare/LiveCareClinicsListResponse.dart new file mode 100644 index 00000000..094fb1a5 --- /dev/null +++ b/lib/models/LiveCare/LiveCareClinicsListResponse.dart @@ -0,0 +1,129 @@ +class LiveCareClinicsListResponse { + List patientERGetClinicsList; + + LiveCareClinicsListResponse({this.patientERGetClinicsList}); + + LiveCareClinicsListResponse.fromJson(Map json) { + if (json['PatientER_GetClinicsList'] != null) { + patientERGetClinicsList = new List(); + json['PatientER_GetClinicsList'].forEach((v) { + patientERGetClinicsList.add(new PatientERGetClinicsList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.patientERGetClinicsList != null) { + data['PatientER_GetClinicsList'] = + this.patientERGetClinicsList.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class PatientERGetClinicsList { + int iD; + int serviceID; + String serviceName; + String serviceNameN; + int clinicID; + int age; + bool isCheckAgeBelow; + int gender; + bool isActive; + String createdOn; + String createdBy; + int isOnline; + Null endTime; + bool projectOutSA; + List shiftTimings; + Null startTime; + + PatientERGetClinicsList( + {this.iD, + this.serviceID, + this.serviceName, + this.serviceNameN, + this.clinicID, + this.age, + this.isCheckAgeBelow, + this.gender, + this.isActive, + this.createdOn, + this.createdBy, + this.isOnline, + this.endTime, + this.projectOutSA, + this.shiftTimings, + this.startTime}); + + PatientERGetClinicsList.fromJson(Map json) { + iD = json['ID']; + serviceID = json['ServiceID']; + serviceName = json['ServiceName']; + serviceNameN = json['ServiceNameN']; + clinicID = json['ClinicID']; + age = json['Age']; + isCheckAgeBelow = json['IsCheckAgeBelow']; + gender = json['Gender']; + isActive = json['IsActive']; + createdOn = json['CreatedOn']; + createdBy = json['CreatedBy']; + isOnline = json['IsOnline']; + endTime = json['EndTime']; + projectOutSA = json['ProjectOutSA']; + if (json['ShiftTimings'] != null) { + shiftTimings = new List(); + json['ShiftTimings'].forEach((v) { + shiftTimings.add(new ShiftTimings.fromJson(v)); + }); + } + startTime = json['StartTime']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['ServiceID'] = this.serviceID; + data['ServiceName'] = this.serviceName; + data['ServiceNameN'] = this.serviceNameN; + data['ClinicID'] = this.clinicID; + data['Age'] = this.age; + data['IsCheckAgeBelow'] = this.isCheckAgeBelow; + data['Gender'] = this.gender; + data['IsActive'] = this.isActive; + data['CreatedOn'] = this.createdOn; + data['CreatedBy'] = this.createdBy; + data['IsOnline'] = this.isOnline; + data['EndTime'] = this.endTime; + data['ProjectOutSA'] = this.projectOutSA; + if (this.shiftTimings != null) { + data['ShiftTimings'] = this.shiftTimings.map((v) => v.toJson()).toList(); + } + data['StartTime'] = this.startTime; + return data; + } +} + +class ShiftTimings { + String endTime; + int shiftID; + String startTime; + + ShiftTimings({this.endTime, this.shiftID, this.startTime}); + + ShiftTimings.fromJson(Map json) { + endTime = json['EndTime']; + shiftID = json['ShiftID']; + startTime = json['StartTime']; + } + + Map toJson() { + final Map data = new Map(); + data['EndTime'] = this.endTime; + data['ShiftID'] = this.shiftID; + data['StartTime'] = this.startTime; + return data; + } +} diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index a31292fa..8c1d781c 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:rating_bar/rating_bar.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'BookSuccess.dart'; @@ -33,7 +34,6 @@ class BookConfirm extends StatefulWidget { PatientShareResponse patientShareResponse; AuthenticatedUser authUser; - @override _BookConfirmState createState() => _BookConfirmState(); } @@ -303,14 +303,19 @@ class _BookConfirmState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(widget.authUser.firstName + " " + widget.authUser.lastName, + Text( + widget.authUser.firstName + + " " + + widget.authUser.lastName, style: TextStyle( fontSize: 14.0, color: Colors.grey[900], letterSpacing: 1.0)), Container( margin: EdgeInsets.only(top: 5.0), - child: Text("Gender: " + widget.authUser.genderDescription, + child: Text( + "Gender: " + + widget.authUser.genderDescription, style: TextStyle( fontSize: 12.0, color: Colors.grey[600], @@ -318,7 +323,8 @@ class _BookConfirmState extends State { ), Container( margin: EdgeInsets.only(top: 5.0, bottom: 3.0), - child: Text("Age: " + widget.authUser.age.toString(), + child: Text( + "Age: " + widget.authUser.age.toString(), style: TextStyle( fontSize: 12.0, color: Colors.grey[600], @@ -352,7 +358,6 @@ class _BookConfirmState extends State { disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { -// navigateToBookSuccess(context); insertAppointment(context, widget.doctor); }, child: Text(TranslationBase.of(context).bookNow, @@ -363,31 +368,43 @@ class _BookConfirmState extends State { ); } - cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) { + cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, + BuildContext context) { ConfirmDialog.closeAlertDialog(context); DoctorsListService service = new DoctorsListService(); service.cancelAppointment(appo, context).then((res) { if (res['MessageStatus'] == 1) { - insertAppointment(context, docObject); + Future.delayed(new Duration(milliseconds: 1500), () { + insertAppointment(context, docObject); + }); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { print(err); - }); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } insertAppointment(context, DoctorList docObject) { AppoitmentAllHistoryResultList appo; widget.service - .insertAppointment(docObject.doctorID, docObject.clinicID, - docObject.projectID, widget.selectedTime, widget.selectedDate, context) + .insertAppointment( + docObject.doctorID, + docObject.clinicID, + docObject.projectID, + widget.selectedTime, + widget.selectedDate, + context) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: "Appointment Booked Successfully"); print(res['AppointmentNo']); - getPatientShare(context, res['AppointmentNo'], docObject.clinicID, - docObject.projectID, docObject); + + Future.delayed(new Duration(milliseconds: 1800), () { + getPatientShare(context, res['AppointmentNo'], docObject.clinicID, + docObject.projectID, docObject); + }); } else { appo = new AppoitmentAllHistoryResultList(); appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo']; @@ -411,8 +428,10 @@ class _BookConfirmState extends State { dialog.showAlertDialog(context); } }).catchError((err) { + AppToast.showErrorToast(message: err); print(err); - }); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } getPatientShare(context, String appointmentNo, int clinicID, int projectID, @@ -425,7 +444,8 @@ class _BookConfirmState extends State { navigateToBookSuccess(context, docObject, widget.patientShareResponse); }).catchError((err) { print(err); - }); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } String getTime(DateTime dateTime) { @@ -471,8 +491,8 @@ class _BookConfirmState extends State { getPatientData() async { AppSharedPreferences sharedPref = AppSharedPreferences(); if (await sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await sharedPref.getObject(USER_PROFILE)); + var data = + AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); setState(() { print(data); widget.authUser = data; diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 163c42e2..7a19ea28 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -12,6 +12,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'QRCode.dart'; @@ -506,7 +507,6 @@ class _BookSuccessState extends State { if (url.contains(element)) { if (widget.browser.isOpened()) widget.browser.close(); MyInAppBrowser.isPaymentDone = true; - Utils.hideProgressDialog(); return; } }); @@ -515,7 +515,6 @@ class _BookSuccessState extends State { if (url.contains(element)) { if (widget.browser.isOpened()) widget.browser.close(); MyInAppBrowser.isPaymentDone = false; - Utils.hideProgressDialog(); return; } }); @@ -544,7 +543,7 @@ class _BookSuccessState extends State { } }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { @@ -561,7 +560,7 @@ class _BookSuccessState extends State { appo.appointmentNo.toString()); }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } // // Future navigateToQR( @@ -586,7 +585,7 @@ class _BookSuccessState extends State { getAppoQR(context); }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Widget _getQRAppo() { @@ -743,7 +742,7 @@ class _BookSuccessState extends State { navigateToQR(context, res['AppointmentQR']); }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Future navigateToQR(context, String appoQR) async { diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index a850437b..c632a26e 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -14,6 +14,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; class QRCode extends StatefulWidget { PatientShareResponse patientShareResponse; @@ -251,7 +252,7 @@ class _QRCodeState extends State { ConfirmDialog.closeAlertDialog(context); AppToast.showErrorToast(message: err); print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); }, cancelFunction: () => {}); dialog.showAlertDialog(context); diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 19c7cc79..3c5e49ff 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -7,6 +7,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:table_calendar/table_calendar.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; import '../../../uitl/date_uitl.dart'; @@ -339,7 +340,7 @@ class _DocAvailableAppointmentsState extends State } }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Widget _buildEventsMarker(DateTime date, List events) { diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 63053077..edfa9cd1 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; import '../SearchResults.dart'; @@ -96,7 +97,7 @@ class _SearchByClinicState extends State { } else {} }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } getDoctorsList(BuildContext context) { @@ -118,7 +119,7 @@ class _SearchByClinicState extends State { } }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Future navigateToSearchResults(context, docList) async { diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 668426ad..e1afea54 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsLis import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; import '../SearchResults.dart'; @@ -94,7 +95,7 @@ class _SearchByDoctorState extends State { } }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } _onDocTextChanged(content) { diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 031f53c3..38838917 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsLis import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; import '../DoctorProfile.dart'; @@ -130,7 +131,7 @@ class DoctorView extends StatelessWidget { } }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Future navigateToDoctorProfile(context, docObject, docProfile) async { diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index acd6fba9..63034373 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; class MyAppointments extends StatefulWidget { List appoList = []; @@ -93,7 +94,7 @@ class _MyAppointmentsState extends State } }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } bool isConfirmed(AppoitmentAllHistoryResultList appo) { diff --git a/lib/pages/MyAppointments/VisitTicket.dart b/lib/pages/MyAppointments/VisitTicket.dart index 923ef67d..54dcf13f 100644 --- a/lib/pages/MyAppointments/VisitTicket.dart +++ b/lib/pages/MyAppointments/VisitTicket.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; class VisitTicket extends StatefulWidget { List appoList = []; @@ -68,7 +69,7 @@ class _VisitTicketState extends State { }).catchError((err) { print(err); loading(false); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } loading(bool flag) { diff --git a/lib/pages/MyAppointments/models/ArrivedButtons.dart b/lib/pages/MyAppointments/models/ArrivedButtons.dart index 89fb4c1d..4a288730 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtons.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtons.dart @@ -30,7 +30,7 @@ class ArrivedButtons { { "title": "Vital Signs", "subtitle": "Values", - "icon": "assets/images/new-design/location_icon.png", + "icon": "assets/images/new-design/vital_signs.png", "caller": "VitalSigns" }, { diff --git a/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart b/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart index 4af79e74..de9bc564 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtonsAllowCheckIn.dart @@ -30,7 +30,7 @@ class ArrivedButtons { { "title": "Vital Signs", "subtitle": "Values", - "icon": "assets/images/new-design/location_icon.png", + "icon": "assets/images/new-design/vital_signs.png", "caller": "VitalSigns" }, { diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index a46cb42b..a876160f 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -18,7 +18,7 @@ import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -357,7 +357,7 @@ class _AppointmentActionsState extends State { } }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } openAppointmentRadiology() { @@ -374,7 +374,7 @@ class _AppointmentActionsState extends State { }).catchError((err) { print(err); AppToast.showErrorToast(message: err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } openPrescriptionReport() { @@ -394,7 +394,7 @@ class _AppointmentActionsState extends State { }).catchError((err) { print(err); AppToast.showErrorToast(message: err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Future navigateToMedicinePrescriptionReport( @@ -460,7 +460,7 @@ class _AppointmentActionsState extends State { } }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } getCallRequestType() { @@ -470,19 +470,15 @@ class _AppointmentActionsState extends State { res['ListReqTypes'].forEach((element) { requestData.add(new AskDocRequestType.fromJson(element)); }); -// print(requestData.length); - Utils.hideProgressDialog(); Future.delayed(const Duration(milliseconds: 400), () { showAskDocRequestDialog(requestData); }); }).catchError((err) { print(err); - Utils.hideProgressDialog(); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } showAskDocRequestDialog(List requestData) { - Utils.hideProgressDialog(); showGeneralDialog( barrierColor: Colors.black.withOpacity(0.5), transitionBuilder: (context, a1, a2, widget) { @@ -524,7 +520,7 @@ class _AppointmentActionsState extends State { }).catchError((err) { print(err); AppToast.showErrorToast(message: err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } confirmAppointment() { @@ -541,7 +537,7 @@ class _AppointmentActionsState extends State { } }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } navigateToInsuranceApprovals(int appoNo) { diff --git a/lib/pages/MyAppointments/widgets/PrescriptionReport.dart b/lib/pages/MyAppointments/widgets/PrescriptionReport.dart index ae19a900..932211ba 100644 --- a/lib/pages/MyAppointments/widgets/PrescriptionReport.dart +++ b/lib/pages/MyAppointments/widgets/PrescriptionReport.dart @@ -4,7 +4,7 @@ import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResu import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -115,12 +115,10 @@ class _PrescriptionReportState extends State { DoctorsListService service = new DoctorsListService(); service.sendPrescriptionEmail(widget.appo.appointmentDate, widget.appo.setupID, widget.listPres, context).then((res) { AppToast.showSuccessToast(message: 'A copy has been sent to the e-mail'); - Utils.hideProgressDialog(); }).catchError((err) { print(err); - Utils.hideProgressDialog(); AppToast.showErrorToast(message: err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } navigateToPrescriptionDetails(PrescriptionReportEnh prescriptionReportEnh) { diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 24b7aa74..dc96864a 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -13,11 +13,11 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; class ToDo extends StatefulWidget { PatientShareResponse patientShareResponse; @@ -443,7 +443,8 @@ class _ToDoState extends State { } }).catchError((err) { print(err); - }); + AppToast.showErrorToast(message: err); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } getPatientShare(context, AppoitmentAllHistoryResultList appo) { @@ -456,7 +457,7 @@ class _ToDoState extends State { openPaymentDialog(appo, widget.patientShareResponse); }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } getAppoQR(context, AppoitmentAllHistoryResultList appo) { @@ -477,7 +478,7 @@ class _ToDoState extends State { navigateToQR(context, res['AppointmentQR'], patientShareResponse); }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Future navigateToQR( @@ -555,7 +556,6 @@ class _ToDoState extends State { if (url.contains(element)) { if (widget.browser.isOpened()) widget.browser.close(); MyInAppBrowser.isPaymentDone = true; - Utils.hideProgressDialog(); return; } }); @@ -564,7 +564,6 @@ class _ToDoState extends State { if (url.contains(element)) { if (widget.browser.isOpened()) widget.browser.close(); MyInAppBrowser.isPaymentDone = false; - Utils.hideProgressDialog(); return; } }); @@ -593,7 +592,7 @@ class _ToDoState extends State { } }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { @@ -611,7 +610,7 @@ class _ToDoState extends State { appo); }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } addAdvancedNumberRequest(String advanceNumber, String paymentReference, @@ -625,7 +624,7 @@ class _ToDoState extends State { getAppoQR(context, appo); }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Future navigateToPaymentMethod( @@ -671,6 +670,6 @@ class _ToDoState extends State { } }).catchError((err) { print(err); - }); + }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } } diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index b172cffc..6219f282 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/hospital_view_model.dart'; +import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -48,6 +49,26 @@ class _HomePageState extends State { ), ), ), + InkWell( + onTap: ()=>Navigator.push(context, FadePage(page: LiveCareHome())), + child: Container( + margin: EdgeInsets.only(top: 12), + width: double.infinity, + height: 180, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.circular(12.0), + border: Border.all( + color: Colors.grey[400], + width: 1.0, + ), + ), + child: Center( + child: Texts('LiveCare'), + ), + ), + ), ], ), ), diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 7920e1d4..ba1d67ba 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -1,20 +1,40 @@ +import 'dart:io'; + import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; -import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; import 'package:diplomaticquarterapp/pages/medical/my_admissions_page.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:permission_handler/permission_handler.dart'; + import 'home_page.dart'; +Future myBackgroundMessageHandler( + Map message) async { + if (message.containsKey('data')) { + // Handle data message + final dynamic data = message['data']; + print(data); + } + + if (message.containsKey('notification')) { + // Handle notification message + final dynamic notification = message['notification']; + print(notification); + } + + // Or do other work. +} + class LandingPage extends StatefulWidget { @override _LandingPageState createState() => _LandingPageState(); @@ -25,6 +45,7 @@ class _LandingPageState extends State { PageController pageController; final FirebaseMessaging _firebaseMessaging = FirebaseMessaging(); final authService = new AuthProvider(); + _changeCurrentTab(int tab) { setState(() { currentTab = tab; @@ -37,6 +58,7 @@ class _LandingPageState extends State { super.initState(); pageController = PageController(keepPage: true); _firebaseMessaging.getToken().then((String token) { + print("Token: " + token); sharedPref.setString(PUSH_TOKEN, token); if (token != null) { checkUserStatus(token); @@ -44,7 +66,25 @@ class _LandingPageState extends State { requestPermissions(); //assert(token != null); }); + + //_firebase Background message handler + _firebaseMessaging.configure( + onMessage: (Map message) async { + print("onMessage: $message"); +// _showItemDialog(message); + }, + onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, + onLaunch: (Map message) async { + print("onLaunch: $message"); +// _navigateToItemDetail(message); + }, + onResume: (Map message) async { + print("onResume: $message"); +// _navigateToItemDetail(message); + }, + ); } + void requestPermissions() async { await [ Permission.location, @@ -82,7 +122,12 @@ class _LandingPageState extends State { physics: NeverScrollableScrollPhysics(), controller: pageController, children: [ - HomePage(), MedicalProfilePage(), MyAdmissionsPage(), ToDo(), BookingOptions()], // Please do not remove the BookingOptions from this array + HomePage(), + MedicalProfilePage(), + MyAdmissionsPage(), + ToDo(), + BookingOptions() + ], // Please do not remove the BookingOptions from this array ), bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab), ); diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart new file mode 100644 index 00000000..f3129823 --- /dev/null +++ b/lib/pages/livecare/livecare_home.dart @@ -0,0 +1,130 @@ +import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; +import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePendingRequest.dart'; +import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_list.dart'; +import 'package:diplomaticquarterapp/pages/livecare/widgets/livecare_logs.dart'; +import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; + +class LiveCareHome extends StatefulWidget { + static bool showFooterButton = true; + + @override + _LiveCareHomeState createState() => _LiveCareHomeState(); +} + +class _LiveCareHomeState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + + bool isDataLoaded = false; + bool hasLiveCareRequest = false; + + List erRequestHistoryList; + + ErRequestHistoryList pendingERRequestHistoryList; + + @override + void initState() { + _tabController = new TabController(length: 2, vsync: this); + erRequestHistoryList = List(); + + pendingERRequestHistoryList = new ErRequestHistoryList(); + + WidgetsBinding.instance.addPostFrameCallback((_) => getLiveCareHistory()); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: "LiveCare", + isShowAppBar: true, + body: Container( + child: Column(children: [ + /// this is will not colored with theme data + TabBar( + tabs: [ + Tab(text: TranslationBase.of(context).consultation), + Tab(text: TranslationBase.of(context).logs), + ], + controller: _tabController, + ), + Divider( + color: Colors.grey[600], + thickness: 0.5, + ), + Expanded( + child: TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + isDataLoaded && !hasLiveCareRequest + ? ClinicList( + getLiveCareHistory: getLiveCareHistory, + ) + : isDataLoaded + ? LiveCarePendingRequest( + getLiveCareHistory: getLiveCareHistory, + pendingERRequestHistoryList: + pendingERRequestHistoryList) + : Container(), + isDataLoaded + ? LiveCareLogs( + erRequestHistoryList: erRequestHistoryList, + ) + : Container(), + ], + controller: _tabController, + ), + ), + ]), + ), + ); + } + + void getLiveCareHistory() { + setState(() { + isDataLoaded = false; + hasLiveCareRequest = false; + }); + LiveCareService service = new LiveCareService(); + PatientERVirtualHistoryResponse patientERVirtualHistoryResponse = + new PatientERVirtualHistoryResponse(); + service + .getLivecareHistory(context) + .then((res) { + setState(() { + print(res['ErRequestHistoryList'].length); + if (res['ErRequestHistoryList'].length != 0) { + patientERVirtualHistoryResponse = + PatientERVirtualHistoryResponse.fromJson(res); + erRequestHistoryList = + patientERVirtualHistoryResponse.erRequestHistoryList; + + if (patientERVirtualHistoryResponse + .erRequestHistoryList[0].callStatus < + 4) { + pendingERRequestHistoryList = + patientERVirtualHistoryResponse.erRequestHistoryList[0]; + hasLiveCareRequest = true; + } else { + hasLiveCareRequest = false; + } + } + }); + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + setState(() { + isDataLoaded = true; + }); + }); + } +} diff --git a/lib/pages/livecare/widgets/ClinicTimingsDialog.dart b/lib/pages/livecare/widgets/ClinicTimingsDialog.dart new file mode 100644 index 00000000..d5fce79e --- /dev/null +++ b/lib/pages/livecare/widgets/ClinicTimingsDialog.dart @@ -0,0 +1,118 @@ +import 'package:diplomaticquarterapp/models/LiveCare/ClinicsServiceTimingsResponse.dart'; +import 'package:flutter/material.dart'; + +class ClinicTimingsDialog extends StatefulWidget { + final clinicName; + final List + patientERGetClinicsServiceTimingsList; + + ClinicTimingsDialog( + {@required this.clinicName, + @required this.patientERGetClinicsServiceTimingsList}); + + @override + _ClinicTimingsDialogState createState() => _ClinicTimingsDialogState(); +} + +class _ClinicTimingsDialogState extends State { + @override + void initState() { + print(widget.patientERGetClinicsServiceTimingsList); + super.initState(); + } + + @override + Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.42) / 2; + final double itemWidth = size.width / 2; + return Container( + child: Dialog( + shape: + RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), + child: Container( + height: MediaQuery.of(context).size.height * 0.68, + margin: EdgeInsets.all(20.0), + width: 450.0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(bottom: 10.0), + child: Text("Clinic Schedule", + textAlign: TextAlign.center, + style: + TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + Divider( + thickness: 1.0, + color: Colors.grey[400], + ), + Container( + margin: EdgeInsets.only(bottom: 20.0, top: 10.0), + child: Text(widget.clinicName, + style: + TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + CustomScrollView( + primary: false, + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + slivers: [ + SliverPadding( + padding: const EdgeInsets.fromLTRB(15, 0, 15, 0), + sliver: SliverGrid.count( + crossAxisCount: 2, + childAspectRatio: (itemWidth / itemHeight), + children: widget.patientERGetClinicsServiceTimingsList + .map((e) => Container( + height: 10.0, + child: Column( + children: [ + Text(e.dayOfWeekStr), + Text(e.shiftTimings[0].startTime + + " - " + + e.shiftTimings[0].endTime), + ], + ), + )) + .toList()), + ), + ], + ), + Divider( + thickness: 1.0, + color: Colors.grey[400], + ), + Container( + alignment: Alignment.center, + height: 30.0, + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Container( + child: Text("OK", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 18.0, + )), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart new file mode 100644 index 00000000..25ec8514 --- /dev/null +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -0,0 +1,212 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; +import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; +import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; + +class LiveCareHistoryCard extends StatefulWidget { + ErRequestHistoryList erRequestHistoryList; + + LiveCareHistoryCard({this.erRequestHistoryList}); + + @override + _LiveCareHistoryCardState createState() => _LiveCareHistoryCardState(); +} + +class _LiveCareHistoryCardState extends State { + AuthenticatedUser authUser = new AuthenticatedUser(); + AppSharedPreferences sharedPref = AppSharedPreferences(); + + @override + void initState() { + getAuthenticatedUser(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.all(10.0), + child: Card( + margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + child: Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height * 0.22, + padding: EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("Requested date:", + style: + TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(widget.erRequestHistoryList.sArrivalTime, + style: TextStyle(fontSize: 14.0)), + Text( + "Call Duration\n" + + getCallTime( + widget.erRequestHistoryList.callDuration), + textAlign: TextAlign.center, + style: + TextStyle(fontSize: 14.0, color: Colors.grey[600])), + ], + ), + ), + Container( + padding: EdgeInsets.all(7.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(5)), + color: Colors.green, + ), + margin: EdgeInsets.only(top: 5.0, bottom: 5.0), + child: Text(widget.erRequestHistoryList.stringCallStatus, + style: TextStyle(fontSize: 14.0, color: Colors.white)), + ), + Divider( + color: Colors.grey[500], + ), + Container( + margin: EdgeInsets.all(5.0), + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + child: InkWell( + onTap: () { + print("Invoice"); + openInvoice(); + }, + child: Container( + child: Row( + children: [ + Icon(Icons.content_paste, color: Colors.blue), + Container( + margin: EdgeInsets.only(left: 10.0), + child: Text("Invoice", + textAlign: TextAlign.center), + ), + ], + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + print("Complaints"); + openComplaint(); + }, + child: Container( + child: Row( + children: [ + Icon(Icons.add, size: 24.0, color: Colors.red), + Container( + margin: EdgeInsets.only(left: 10.0), + child: Text("Complaints", + textAlign: TextAlign.center), + ), + ], + ), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + print("Rate Dr & Appointment"); + }, + child: Container( + child: Row( + children: [ + Icon(Icons.star, + size: 24.0, color: Colors.yellow[700]), + Container( + width: MediaQuery.of(context).size.width * 0.2, + margin: EdgeInsets.only(left: 10.0), + child: Text("Rate Dr & Appointment", + overflow: TextOverflow.clip, + textAlign: TextAlign.center), + ), + ], + ), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + } + + openInvoice() { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: "Send a copy of this invoice to the email: " + + authUser.emailAddress, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {sendInvoiceEmail(context)}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + + openComplaint() { + Navigator.push(context, FadePage(page: FeedbackHomePage())); + } + + sendInvoiceEmail(context) { + ConfirmDialog.closeAlertDialog(context); + LiveCareService service = new LiveCareService(); + service + .sendLiveCareInvoiceEmail( + widget.erRequestHistoryList.appointmentNo.toString(), + widget.erRequestHistoryList.projectID, + authUser.emailAddress, + context) + .then((res) { + AppToast.showSuccessToast(message: "LiveCare invoice sent successfully"); + }).catchError((err) { + AppToast.showErrorToast(message: err); + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + getAuthenticatedUser() async { + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + setState(() { + authUser = data; + }); + } + } + + getCallTime(int number) { + number = number.round(); + var hours = (number / 60 / 60).floor(); + var minutes = (number / 60).floor() - (hours * 60).floor(); + var seconds = number % 60; + return '${hours.toString().padLeft(2, '0')}:${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}'; + } +} diff --git a/lib/pages/livecare/widgets/LiveCareInfoDialog.dart b/lib/pages/livecare/widgets/LiveCareInfoDialog.dart new file mode 100644 index 00000000..0fa02cbe --- /dev/null +++ b/lib/pages/livecare/widgets/LiveCareInfoDialog.dart @@ -0,0 +1,108 @@ +import 'package:flutter/material.dart'; + +class LiveCareInfoDialog extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + child: Dialog( + shape: + RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), + child: Container( + height: MediaQuery.of(context).size.height * 0.61, + margin: EdgeInsets.all(20.0), + width: 450.0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(bottom: 10.0), + child: Icon(Icons.info_outline, + size: 80.0, color: Colors.red[900]), + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(bottom: 20.0), + child: Text("Important Instructions", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 24.0, + fontWeight: FontWeight.bold, + color: Colors.red[900])), + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(bottom: 20.0), + child: Text( + "Please make sure that you're logged in on Al Habib Mobile Application", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.bold, + color: Colors.black)), + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(bottom: 20.0), + child: Icon(Icons.not_interested, + size: 80.0, color: Colors.red[900]), + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(bottom: 40.0), + child: Text( + "Otherwise, you will not receive the doctor's call.", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 22.0, + fontWeight: FontWeight.bold, + color: Colors.red[900])), + ), + Divider( + thickness: 1.0, + color: Colors.grey[400], + ), + Container( + alignment: Alignment.center, + height: 40.0, + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + child: InkWell( + onTap: () { + Navigator.pop(context, false); + }, + child: Container( + child: Text("Cancel", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 18.0, color: Colors.red[700])), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + Navigator.pop(context, true); + }, + child: Container( + child: Text("Ok", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 18.0, + )), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart b/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart new file mode 100644 index 00000000..e2dab5b0 --- /dev/null +++ b/lib/pages/livecare/widgets/LiveCarePaymentDialog.dart @@ -0,0 +1,296 @@ +import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; + +class LiveCarePaymentDialog extends StatefulWidget { + GetERAppointmentFeesList getERAppointmentFeesList; + int waitingTime; + String clinicName; + + LiveCarePaymentDialog( + {@required this.getERAppointmentFeesList, @required this.waitingTime, @required this.clinicName}); + + @override + _LiveCarePaymentDialogState createState() => _LiveCarePaymentDialogState(); +} + +class _LiveCarePaymentDialogState extends State { + int _selected = 0; + + @override + Widget build(BuildContext context) { + var size = MediaQuery.of(context).size; + final double itemHeight = ((size.height - kToolbarHeight - 24) * 0.42) / 2; + final double itemWidth = size.width / 2; + + return Container( + child: Dialog( + shape: + RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), + child: Container( + height: MediaQuery.of(context).size.height * 0.691, + margin: EdgeInsets.all(20.0), + width: 450.0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(bottom: 10.0), + child: Text("Online Consultation", + textAlign: TextAlign.center, + style: + TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + Divider( + thickness: 1.0, + color: Colors.grey[400], + ), + Flex( + direction: Axis.horizontal, + children: [ + Expanded( + child: Text("Waiting time to start LiveCare consultation", + textAlign: TextAlign.end, + style: TextStyle(fontSize: 13.0)), + ), + Expanded( + child: Container( + child: Icon(Icons.access_time, + size: 36.0, color: Colors.red[800]), + ), + ), + Expanded( + child: Text(widget.waitingTime.toString() + " Minutes", + textAlign: TextAlign.start, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + color: Colors.red[900])), + ), + ], + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(bottom: 10.0, top: 10.0), + child: Text(widget.clinicName, + textAlign: TextAlign.center, + style: + TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold)), + ), + Container( + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: Colors.black87, + borderRadius: new BorderRadius.only( + topLeft: const Radius.circular(5.0), + topRight: const Radius.circular(5.0), + ), + border: Border.all(color: Colors.black87)), + alignment: Alignment.center, + margin: EdgeInsets.only(top: 5.0), + padding: EdgeInsets.all(5.0), + child: Text("Consultation fee", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.bold, + color: Colors.white)), + ), + Container( + decoration: BoxDecoration( + borderRadius: new BorderRadius.only( + bottomLeft: const Radius.circular(5.0), + bottomRight: const Radius.circular(5.0), + ), + border: Border.all(color: Colors.black54)), + child: Table( + children: [ + TableRow(children: [ + TableCell( + child: _getNormalText( + TranslationBase.of(context).patientShareToDo)), + TableCell( + child: _getNormalText( + widget.getERAppointmentFeesList.amount + + " " + + widget.getERAppointmentFeesList.currency)), + ]), + TableRow(children: [ + TableCell( + child: _getNormalText( + TranslationBase.of(context).patientTaxToDo)), + TableCell( + child: _getNormalText( + widget.getERAppointmentFeesList.tax + + " " + + widget.getERAppointmentFeesList.currency)), + ]), + TableRow(children: [ + TableCell( + child: _getMarginText(TranslationBase.of(context) + .patientShareTotalToDo)), + TableCell( + child: _getMarginText( + widget.getERAppointmentFeesList.total + + " " + + widget.getERAppointmentFeesList.currency)), + ]), + ], + ), + ), + Container( + padding: EdgeInsets.only(top: 10.0, bottom: 10.0, left: 10.0), + decoration: BoxDecoration( + borderRadius: new BorderRadius.all( + const Radius.circular(5.0), + ), + color: Colors.green[200].withOpacity(0.5)), + margin: EdgeInsets.only(top: 20.0), + child: Row( + children: [ + Image.asset("assets/images/new-design/alert-triangle.png"), + Container( + margin: EdgeInsets.only(left: 10.0), + width: MediaQuery.of(context).size.width * 0.55, + child: Text( + "If you're Insurance patient, you have only have to pay the co-payment", + style: TextStyle(fontSize: 13.0)), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Container( + child: new Radio( + value: 1, + groupValue: _selected, + onChanged: onRadioChanged, + ), + ), + Container( + child: new Text( + 'I Accept the Terms And Conditions', + style: new TextStyle(fontSize: 14.0), + ), + ), +// Container( +//// alignment: Alignment.centerRight, +// child: new Text( +// 'Click Here', +// textAlign: TextAlign.end, +// style: new TextStyle(fontSize: 16.0), +// ), +// ), + ], + ), + ), + Divider( + thickness: 1.0, + color: Colors.grey[400], + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(top: 10.0), + child: new Text( + 'You can pay by the following Options:', + textAlign: TextAlign.center, + style: new TextStyle(fontSize: 14.0), + ), + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 5.0), + child: Image.asset( + "assets/images/new-design/payment_options_invoice_confirmation.png", + width: 300), + ), + Divider( + thickness: 1.0, + color: Colors.grey[400], + ), + Container( + alignment: Alignment.center, + height: 40.0, + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + child: InkWell( + onTap: () { + Navigator.pop(context, false); + }, + child: Container( + child: Text("Cancel", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 18.0, color: Colors.red[700])), + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + if(_selected == 0) { + AppToast.showErrorToast(message: "Please accept terms & conditions to continue"); + } else { + Navigator.pop(context, true); + } + }, + child: Container( + child: Text("Ok", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 18.0, + )), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + } + + void onRadioChanged(int value) { + setState(() { + _selected = value; + }); + } + + _getNormalText(text) { + return Container( + margin: EdgeInsets.only(top: 10.0, right: 10.0), + child: Text(text, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 14, + fontFamily: 'Open-Sans', + letterSpacing: 0.5, + color: Colors.black)), + ); + } + + _getMarginText(text) { + return Container( + margin: EdgeInsets.only(top: 10.0, right: 10.0, bottom: 10.0), + child: Text(text, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 14, + fontFamily: 'Open-Sans', + letterSpacing: 0.5, + fontWeight: FontWeight.bold, + color: Colors.black)), + ); + } +} diff --git a/lib/pages/livecare/widgets/LiveCarePendingRequest.dart b/lib/pages/livecare/widgets/LiveCarePendingRequest.dart new file mode 100644 index 00000000..bfd42e62 --- /dev/null +++ b/lib/pages/livecare/widgets/LiveCarePendingRequest.dart @@ -0,0 +1,167 @@ +import 'package:circular_countdown_timer/circular_countdown_timer.dart'; +import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; +import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; + +class LiveCarePendingRequest extends StatefulWidget { + ErRequestHistoryList pendingERRequestHistoryList; + final Function getLiveCareHistory; + + LiveCarePendingRequest( + {@required this.getLiveCareHistory, this.pendingERRequestHistoryList}); + + @override + _LiveCarePendingRequestState createState() => _LiveCarePendingRequestState(); +} + +class _LiveCarePendingRequestState extends State { + @override + void initState() { + // TODO: implement initState + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + border: Border.all(color: Colors.grey[300]), + borderRadius: BorderRadius.circular(10), + color: Colors.white, + shape: BoxShape.rectangle, + ), + margin: EdgeInsets.all(15.0), + padding: EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: Text("In Progress:", + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(top: 10.0), + child: Text("Estimated Waiting Time: ", + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + ), + Container( + transform: Matrix4.translationValues(0.0, -50.0, 0.0), + alignment: Alignment.center, + child: CircularCountDownTimer( + duration: + widget.pendingERRequestHistoryList.watingtimeInteger * 60, + width: MediaQuery.of(context).size.width / 3, + height: MediaQuery.of(context).size.height / 3, + color: Colors.white, + fillColor: Colors.green[700], + strokeWidth: 15.0, + textStyle: TextStyle( + fontSize: 22.0, + color: Colors.black87, + fontWeight: FontWeight.bold), + isReverse: true, + isTimerTextShown: true, + onComplete: () { + print('Countdown Ended'); + }, + ), + ), + Container( + transform: Matrix4.translationValues(0.0, -60.0, 0.0), + child: Divider( + color: Colors.grey[500], + thickness: 0.7, + ), + ), + Container( + transform: Matrix4.translationValues(0.0, -50.0, 0.0), + child: Text("Requested date:", + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)), + ), + Container( + transform: Matrix4.translationValues(0.0, -30.0, 0.0), + child: Text( + DateUtil.getDateFormatted( + widget.pendingERRequestHistoryList.arrivalTime), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + ), + Container( + transform: Matrix4.translationValues(0.0, -20.0, 0.0), + padding: EdgeInsets.all(7.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(5)), + color: Colors.red[800], + ), + margin: EdgeInsets.only(top: 5.0, bottom: 5.0), + child: Text(widget.pendingERRequestHistoryList.stringCallStatus, + style: TextStyle(fontSize: 14.0, color: Colors.white)), + ), + Container( + transform: Matrix4.translationValues(0.0, 0.0, 0.0), + child: Divider( + color: Colors.grey[500], + thickness: 0.7, + ), + ), + Container( + alignment: Alignment.center, + transform: Matrix4.translationValues(0.0, 10.0, 0.0), + child: Text( + "Your turn is after " + + widget.pendingERRequestHistoryList.patCount.toString() + + " Patients", + style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + Container( + transform: Matrix4.translationValues(0.0, 130.0, 0.0), + alignment: Alignment.bottomCenter, + width: MediaQuery.of(context).size.width, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width, + height: 45.0, + child: RaisedButton( + color: Colors.red[800], + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + cancelLiveCareRequest(); + }, + child: Text(TranslationBase.of(context).cancel, + style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ], + ), + ); + } + + cancelLiveCareRequest() { + LiveCareService service = new LiveCareService(); + service + .cancelLiveCareRequest(widget.pendingERRequestHistoryList.vCID, context) + .then((res) { + AppToast.showSuccessToast( + message: "LiveCare request cancelled successfully"); + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + widget.getLiveCareHistory(); + }); + } +} diff --git a/lib/pages/livecare/widgets/clinic_card.dart b/lib/pages/livecare/widgets/clinic_card.dart new file mode 100644 index 00000000..99c4b271 --- /dev/null +++ b/lib/pages/livecare/widgets/clinic_card.dart @@ -0,0 +1,136 @@ +import 'package:diplomaticquarterapp/models/LiveCare/ClinicsServiceTimingsResponse.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse.dart'; +import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; + +import 'ClinicTimingsDialog.dart'; + +// ignore: must_be_immutable +class ClinicCard extends StatefulWidget { + bool isSelected; + final PatientERGetClinicsList patientERGetClinicsList; + var languageID; + + ClinicCard( + {this.isSelected, + this.languageID, + @required this.patientERGetClinicsList}); + + @override + _State createState() => _State(); +} + +class _State extends State { + ClinicsServiceTimingsResponse clinicsServiceTimingsResponse; + + @override + void initState() { + clinicsServiceTimingsResponse = new ClinicsServiceTimingsResponse(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Card( + margin: EdgeInsets.fromLTRB(13.0, 10.0, 8.0, 8.0), + color: widget.isSelected ? Colors.blue : Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + child: Container( + width: MediaQuery.of(context).size.width * 0.8, + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + child: Text( + widget.languageID == 'ar' + ? widget.patientERGetClinicsList.serviceNameN + : widget.patientERGetClinicsList.serviceName, + style: TextStyle( + fontSize: 16.0, + color: + widget.isSelected ? Colors.white : Colors.black)), + ), + ], + ), + ), + ), + InkWell( + onTap: () { + getClinicTimings(widget.patientERGetClinicsList); + }, + child: Card( + margin: EdgeInsets.fromLTRB(8.0, 10.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + child: Container( + padding: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Icon(Icons.access_time, size: 26.0, color: Colors.red[800]), + ], + ), + ), + ), + ), + ], + ); + } + + getClinicTimings(PatientERGetClinicsList patientERGetClinicsList) { + LiveCareService service = new LiveCareService(); + service + .getLivecareClinicTiming(patientERGetClinicsList.serviceID, context) + .then((res) { + if (res['MessageStatus'] == 1) { + setState(() { + clinicsServiceTimingsResponse = + ClinicsServiceTimingsResponse.fromJson(res); + print(clinicsServiceTimingsResponse + .patientERGetClinicsServiceTimingsList.length); + + showGeneralDialog( + barrierColor: Colors.black.withOpacity(0.5), + transitionBuilder: (context, a1, a2, widget) { + final curvedValue = + Curves.easeInOutBack.transform(a1.value) - 1.0; + return Transform( + transform: + Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + child: Opacity( + opacity: a1.value, + child: ClinicTimingsDialog( + clinicName: patientERGetClinicsList.serviceName, + patientERGetClinicsServiceTimingsList: + clinicsServiceTimingsResponse + .patientERGetClinicsServiceTimingsList, + ), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}); + }); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } +} diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart new file mode 100644 index 00000000..77c3e741 --- /dev/null +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -0,0 +1,388 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; +import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCareInfoDialog.dart'; +import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePaymentDialog.dart'; +import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; + +class ClinicList extends StatefulWidget { + final Function getLiveCareHistory; + + ClinicList({@required this.getLiveCareHistory}); + + @override + _clinic_listState createState() => _clinic_listState(); +} + +class _clinic_listState extends State { + int currentSelectedIndex = 0; + LiveCareClinicsListResponse liveCareClinicsListResponse; + + bool isDataLoaded = false; + var languageID; + + int selectedClinicID = 1; + String selectedClinicName = "-"; + + AppSharedPreferences sharedPref = AppSharedPreferences(); + + AuthenticatedUser authUser; + AuthProvider authProvider = new AuthProvider(); + + MyInAppBrowser browser; + + @override + void initState() { + liveCareClinicsListResponse = new LiveCareClinicsListResponse(); + WidgetsBinding.instance.addPostFrameCallback((_) { +// Future.delayed(new Duration(milliseconds: 1200), () { + getLiveCareClinicsList(); +// }); + }); + getLanguageID(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: false, + body: SingleChildScrollView( + child: isDataLoaded + ? Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.all(15.0), + child: Text("Online Clinics: ", + style: TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: liveCareClinicsListResponse + .patientERGetClinicsList.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + updateSelectedIndex(liveCareClinicsListResponse + .patientERGetClinicsList[index]); + }, + child: ClinicCard( + isSelected: selectedClinicID == + liveCareClinicsListResponse + .patientERGetClinicsList[index] + .serviceID + ? true + : false, + patientERGetClinicsList: liveCareClinicsListResponse + .patientERGetClinicsList[index], + languageID: languageID, + ), + ); + }, + ), + Container( + height: 80.0, + ), + ], + ), + ) + : Container(), + ), + bottomSheet: Container( + width: MediaQuery.of(context).size.width, + height: 50.0, + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: startLiveCare, + child: Text("Start", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ); + } + + void startLiveCare() { + LiveCareService service = new LiveCareService(); + ERAppointmentFeesResponse erAppointmentFeesResponse = + new ERAppointmentFeesResponse(); + service + .getERAppointmentFees(selectedClinicID, context) + .then((res) { + erAppointmentFeesResponse = ERAppointmentFeesResponse.fromJson(res); + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + getERAppointmentTime( + erAppointmentFeesResponse.getERAppointmentFeesList); + }); + } + + getERAppointmentTime(GetERAppointmentFeesList getERAppointmentFeesList) { + LiveCareService service = new LiveCareService(); + service.getERAppointmentTime(selectedClinicID, context).then((res) { + print(res['WatingtimeInteger']); + showLiveCarePaymentDialog( + getERAppointmentFeesList, res['WatingtimeInteger']); + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + showLiveCarePaymentDialog( + GetERAppointmentFeesList getERAppointmentFeesList, int waitingTime) { + showGeneralDialog( + barrierColor: Colors.black.withOpacity(0.5), + transitionBuilder: (context, a1, a2, widget) { + final curvedValue = + Curves.easeInOutBack.transform(a1.value) - 1.0; + return Transform( + transform: + Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + child: Opacity( + opacity: a1.value, + child: LiveCarePaymentDialog( + getERAppointmentFeesList: getERAppointmentFeesList, + waitingTime: waitingTime, + clinicName: selectedClinicName), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}) + .then((value) { + if (value) { + if (getERAppointmentFeesList.total == "0" || + getERAppointmentFeesList.total == "0.0") { + showLiveCareInfoDialog(getERAppointmentFeesList); + } else { + navigateToPaymentMethod(getERAppointmentFeesList, context); + } + } + }); + } + + showLiveCareInfoDialog( + GetERAppointmentFeesList getERAppointmentFeesList) async { + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + setState(() { + authUser = data; + }); + } + + showGeneralDialog( + barrierColor: Colors.black.withOpacity(0.5), + transitionBuilder: (context, a1, a2, widget) { + final curvedValue = + Curves.easeInOutBack.transform(a1.value) - 1.0; + return Transform( + transform: + Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + child: Opacity( + opacity: a1.value, + child: LiveCareInfoDialog(), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}) + .then((value) { + if (value) { + if (getERAppointmentFeesList.total == "0" || + getERAppointmentFeesList.total == "0.0") { + addNewCallForPatientER(authUser.patientID.toString() + + "" + + DateTime.now().millisecondsSinceEpoch.toString()); + } else { + navigateToPaymentMethod(getERAppointmentFeesList, context); + } + } + }); + } + + Future navigateToPaymentMethod( + GetERAppointmentFeesList getERAppointmentFeesList, context) async { + AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList(); + + appo.clinicID = selectedClinicID; + appo.appointmentNo = DateTime.now().millisecondsSinceEpoch; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + setState(() { + authUser = data; + }); + } + + Navigator.push( + context, MaterialPageRoute(builder: (context) => PaymentMethod())) + .then((value) { + print(value); + if (value != null) { + openPayment(value, authUser, + double.parse(getERAppointmentFeesList.total), appo); + } + }); + } + + openPayment(String paymentMethod, AuthenticatedUser authenticatedUser, + double amount, AppoitmentAllHistoryResultList appo) { + browser = new MyInAppBrowser( + onExitCallback: onBrowserExit, + appo: appo, + onLoadStartCallback: onBrowserLoadStart); + + browser.openPaymentBrowser( + amount, + "LiveCare Payment", + Utils.getAppointmentTransID(12, appo.clinicID, appo.appointmentNo), + "12", + authenticatedUser.emailAddress, + paymentMethod, + authenticatedUser, + browser); + } + + onBrowserLoadStart(String url) { + print("onBrowserLoadStart"); + print(url); + + MyInAppBrowser.successURLS.forEach((element) { + if (url.contains(element)) { + if (browser.isOpened()) browser.close(); + MyInAppBrowser.isPaymentDone = true; + return; + } + }); + + MyInAppBrowser.errorURLS.forEach((element) { + if (url.contains(element)) { + if (browser.isOpened()) browser.close(); + MyInAppBrowser.isPaymentDone = false; + return; + } + }); + } + + onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { + print("onBrowserExit Called!!!!"); + if (isPaymentMade) checkPaymentStatus(appo); + } + + checkPaymentStatus(AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + service + .checkPaymentStatus( + Utils.getAppointmentTransID( + appo.projectID, appo.clinicID, appo.appointmentNo), + context) + .then((res) { + print("Printing Payment Status Reponse!!!!"); + print(res); + String paymentInfo = res['Response_Message']; + if (paymentInfo == 'Success') { + addNewCallForPatientER(Utils.getAppointmentTransID( + appo.projectID, appo.clinicID, appo.appointmentNo)); + } else { + AppToast.showErrorToast(message: res['Response_Message']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + addNewCallForPatientER(String clientRequestID) { + LiveCareService service = new LiveCareService(); + service + .addNewCallForPatientER(selectedClinicID, clientRequestID, context) + .then((res) { + AppToast.showSuccessToast( + message: "New Call has been added successfully"); + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)).then((value) { + widget.getLiveCareHistory(); + }); + } + + getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); + } + + getLiveCareClinicsList() { + isDataLoaded = false; + LiveCareService service = new LiveCareService(); + service.getLivecareClinics(context).then((res) { + print(res['PatientER_GetClinicsList'].length); + if (res['MessageStatus'] == 1) { + setState(() { + liveCareClinicsListResponse = + LiveCareClinicsListResponse.fromJson(res); + print(liveCareClinicsListResponse.patientERGetClinicsList.length); + selectedClinicID = + liveCareClinicsListResponse.patientERGetClinicsList[0].serviceID; + selectedClinicName = liveCareClinicsListResponse + .patientERGetClinicsList[0].serviceName; + isDataLoaded = true; + }); + } else { + isDataLoaded = true; + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + updateSelectedIndex(PatientERGetClinicsList patientERGetClinicsList) { + setState(() { + selectedClinicID = patientERGetClinicsList.serviceID; + selectedClinicName = patientERGetClinicsList.serviceName; + }); + } +} diff --git a/lib/pages/livecare/widgets/livecare_logs.dart b/lib/pages/livecare/widgets/livecare_logs.dart new file mode 100644 index 00000000..a7f7fdc0 --- /dev/null +++ b/lib/pages/livecare/widgets/livecare_logs.dart @@ -0,0 +1,40 @@ +import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; +import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCareHistoryCard.dart'; +import 'package:flutter/material.dart'; + +class LiveCareLogs extends StatefulWidget { + List erRequestHistoryList; + + LiveCareLogs({@required this.erRequestHistoryList}); + + @override + _LiveCareLogsState createState() => _LiveCareLogsState(); +} + +class _LiveCareLogsState extends State { + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + child: Container( + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: widget.erRequestHistoryList.length, + itemBuilder: (context, index) { + return widget.erRequestHistoryList[index].callStatus < 4 + ? Container() + : LiveCareHistoryCard( + erRequestHistoryList: widget.erRequestHistoryList[index]); + }, + ), + ), + ); + } +} diff --git a/lib/pages/medical/vital_sign/vital_sign_details_screen.dart b/lib/pages/medical/vital_sign/vital_sign_details_screen.dart index aa9e752a..a0dc78ff 100644 --- a/lib/pages/medical/vital_sign/vital_sign_details_screen.dart +++ b/lib/pages/medical/vital_sign/vital_sign_details_screen.dart @@ -101,7 +101,7 @@ class VitalSignDetailsScreen extends StatelessWidget { des: TranslationBase.of(context).bodyMeasurements, icon: DQIcons.bmi, lastVal: mode - .vitalSignResModelList[1].pulseBeatPerMinute + .vitalSignResModelList[0].pulseBeatPerMinute .toString(), unit: 'BMI', ), @@ -122,7 +122,7 @@ class VitalSignDetailsScreen extends StatelessWidget { des: TranslationBase.of(context).temperature, icon: DQIcons.thermometer, lastVal: mode - .vitalSignResModelList[1].temperatureCelcius + .vitalSignResModelList[0].temperatureCelcius .toString(), unit: 'C', ), diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 05205de2..6e6f804e 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -10,7 +10,6 @@ import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:flutter/cupertino.dart'; class DoctorsListService extends BaseService { @@ -22,7 +21,6 @@ class DoctorsListService extends BaseService { Future getDoctorsList( int clinicID, int projectID, BuildContext context) async { - Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -61,9 +59,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(GET_DOCTORS_LIST_URL, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); @@ -117,7 +113,6 @@ class DoctorsListService extends BaseService { Future getDoctorsProfile( int docID, int clinicID, int projectID, context) async { - Utils.showProgressDialog(context); Map request; var languageID = await sharedPref.getString(APP_LANGUAGE); Request req = appGlobal.getPublicRequest(); @@ -145,9 +140,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(GET_DOCTOR_PROFILE, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); @@ -155,7 +148,6 @@ class DoctorsListService extends BaseService { Future getDoctorFreeSlots( int docID, int clinicID, int projectID, BuildContext context) async { - Utils.showProgressDialog(context); Map request; var languageID = await sharedPref.getString(APP_LANGUAGE); Request req = appGlobal.getPublicRequest(); @@ -183,9 +175,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(GET_DOCTOR_FREE_SLOTS, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); @@ -193,8 +183,6 @@ class DoctorsListService extends BaseService { Future insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, BuildContext context) async { - Utils.showProgressDialog(context); - Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -240,9 +228,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(INSERT_SPECIFIC_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); @@ -250,7 +236,6 @@ class DoctorsListService extends BaseService { Future getPatientShare( String appoID, int clinicID, int projectID, BuildContext context) async { - Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -287,9 +272,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(GET_PATIENT_SHARE, onSuccess: (response, statusCode) async { localRes = response['OnlineCheckInAppointments'][0]; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); @@ -297,7 +280,6 @@ class DoctorsListService extends BaseService { Future getPatientAppointmentHistory( bool isActiveAppointment, BuildContext context) async { - Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -331,9 +313,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(GET_PATIENT_APPOINTMENT_HISTORY, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); @@ -375,7 +355,6 @@ class DoctorsListService extends BaseService { Future confirmAppointment( int appoNo, int clinicID, int projectID, BuildContext context) async { - Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -412,9 +391,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(CONFIRM_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); @@ -422,7 +399,6 @@ class DoctorsListService extends BaseService { Future cancelAppointment( AppoitmentAllHistoryResultList appo, BuildContext context) async { - Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -465,9 +441,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(CANCEL_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); @@ -475,7 +449,6 @@ class DoctorsListService extends BaseService { Future generateAppointmentQR( PatientShareResponse patientShareResponse, BuildContext context) async { - Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -512,9 +485,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(GENERATE_QR_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); @@ -529,7 +500,6 @@ class DoctorsListService extends BaseService { String QR, String speciality, BuildContext context) async { - Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -569,9 +539,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(EMAIL_QR_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); @@ -655,7 +623,6 @@ class DoctorsListService extends BaseService { } Future isAllowedToAskDoctor(int docID, BuildContext context) async { - Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson( @@ -689,16 +656,13 @@ class DoctorsListService extends BaseService { await baseAppClient.post(IS_ALLOW_ASK_DOCTOR, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); } Future getCallRequestType(BuildContext context) async { - Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson( @@ -727,9 +691,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(GET_CALL_REQUEST_TYPE, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); @@ -737,7 +699,6 @@ class DoctorsListService extends BaseService { Future sendAskDocCallRequest(AppoitmentAllHistoryResultList appo, String requestType, BuildContext context) async { - Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson( @@ -790,16 +751,13 @@ class DoctorsListService extends BaseService { await baseAppClient.post(SEND_CALL_REQUEST, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); } Future getPatientRadOrders(String appoNo, BuildContext context) async { - Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson( @@ -829,9 +787,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(GET_PATIENT_ORDERS, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); @@ -839,7 +795,6 @@ class DoctorsListService extends BaseService { Future getPatientPrescriptionReports( AppoitmentAllHistoryResultList appo, BuildContext context) async { - Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson( @@ -873,9 +828,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(GET_PRESCRIPTION_REPORT_ENH, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); @@ -883,7 +836,6 @@ class DoctorsListService extends BaseService { Future sendPrescriptionEmail(String appoDate, String setupId, dynamic prescriptionReportEnhList, BuildContext context) async { - Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson( @@ -920,9 +872,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(SEND_PRESCRIPTION_EMAIL, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); @@ -934,7 +884,6 @@ class DoctorsListService extends BaseService { String paymentReference, String paymentMethodName, BuildContext context) async { - Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson( @@ -978,9 +927,7 @@ class DoctorsListService extends BaseService { await baseAppClient.post(CREATE_ADVANCE_PAYMENT, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 05f6a2cb..42c9754c 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -1,17 +1,14 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; -import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; class ClinicListService extends BaseService { AppSharedPreferences sharedPref = AppSharedPreferences(); AppGlobal appGlobal = new AppGlobal(); Future getClinicsList(context) async { - Utils.showProgressDialog(context); Map request; var languageID = await sharedPref.getString(APP_LANGUAGE); Request req = appGlobal.getPublicRequest(); @@ -32,9 +29,7 @@ class ClinicListService extends BaseService { await baseAppClient.post(GET_CLINICS_LIST_URL, onSuccess: (response, statusCode) async { localRes = response; - Utils.hideProgressDialog(); }, onFailure: (String error, int statusCode) { - Utils.hideProgressDialog(); throw error; }, body: request); return Future.value(localRes); diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart new file mode 100644 index 00000000..f76e0336 --- /dev/null +++ b/lib/services/livecare_services/livecare_provider.dart @@ -0,0 +1,304 @@ +import 'dart:io'; + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/Request.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/material.dart'; + +class LiveCareService extends BaseService { + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + Future getLivecareClinics(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.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "VersionID": req.VersionID, + "Channel": req.Channel, + "generalid": 'Cs2020@2016\$2958', + "PatientOutSA": 0, + "TokenID": "", + "DeviceTypeID": req.DeviceTypeID, + "SessionID": "YckwoXhUmWBsnHKEKig", + "Age": authUser.age != null ? authUser.age : 0, + "PatientID": authUser.patientID != null ? authUser.patientID : 0, + "Gender": authUser.gender != null ? authUser.gender : 0 + }; + + dynamic localRes; + + await baseAppClient.post(GET_LIVECARE_CLINICS, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future getLivecareHistory(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.getString(APP_LANGUAGE); +// Request req = appGlobal.getPublicRequest(); + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "TokenID": "", + "SessionID": "YckwoXhUmWBsnHKEKig" + }; + + dynamic localRes; + + await baseAppClient.post(GET_LIVECARE_HISTORY, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future getLivecareClinicTiming( + int serviceID, 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.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "VersionID": req.VersionID, + "Channel": req.Channel, + "generalid": 'Cs2020@2016\$2958', + "PatientOutSA": 0, + "ServiceID": serviceID, + "DeviceTypeID": req.DeviceTypeID, + "SessionID": "YckwoXhUmWBsnHKEKig", + "Age": authUser.age != null ? authUser.age : 0, + "PatientID": authUser.patientID != null ? authUser.patientID : 0, + "Gender": authUser.gender != null ? authUser.gender : 0 + }; + + dynamic localRes; + + await baseAppClient.post(GET_LIVECARE_CLINIC_TIMING, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future getERAppointmentFees(int serviceID, 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.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "VersionID": req.VersionID, + "Channel": req.Channel, + "generalid": 'Cs2020@2016\$2958', + "PatientOutSA": 0, + "ServiceID": serviceID, + "ProjectID": 15, + "DeviceTypeID": req.DeviceTypeID, + "PatientType": authUser.patientType != null ? authUser.patientType : 0, + "PatientTypeID": authUser.patientType != null ? authUser.patientType : 0, + "SessionID": "YckwoXhUmWBsnHKEKig", + "Age": authUser.age != null ? authUser.age : 0, + "PatientID": authUser.patientID != null ? authUser.patientID : 0, + "Gender": authUser.gender != null ? authUser.gender : 0 + }; + + dynamic localRes; + + await baseAppClient.post(GET_ER_APPOINTMENT_FEES, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future getERAppointmentTime(int serviceID, 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.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "VersionID": req.VersionID, + "Channel": req.Channel, + "generalid": 'Cs2020@2016\$2958', + "PatientOutSA": 0, + "ServiceID": serviceID, + "ProjectID": 15, + "DeviceTypeID": req.DeviceTypeID, + "PatientType": authUser.patientType != null ? authUser.patientType : 0, + "PatientTypeID": authUser.patientType != null ? authUser.patientType : 0, + "SessionID": "YckwoXhUmWBsnHKEKig", + "Age": authUser.age != null ? authUser.age : 0, + "PatientID": authUser.patientID != null ? authUser.patientID : 0, + "Gender": authUser.gender != null ? authUser.gender : 0 + }; + + dynamic localRes; + + await baseAppClient.post(GET_ER_APPOINTMENT_TIME, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future addNewCallForPatientER( + int serviceID, String clientRequestID, BuildContext context) async { + Map request; + + String deviceToken; + getDeviceToken().then((value) { + print(value); + deviceToken = value; + }); + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "VersionID": req.VersionID, + "Channel": req.Channel, + "generalid": 'Cs2020@2016\$2958', + "PatientOutSA": 0, + "ErServiceID": serviceID, + "ClientRequestID": clientRequestID, + "DeviceToken": deviceToken, + "VoipToken": "", + "Latitude": "24.708488", + "Longitude": "46.665925", + "DeviceType": Platform.isIOS ? 'iOS' : 'Android', + "PatientType": authUser.patientType != null ? authUser.patientType : 0, + "PatientTypeID": authUser.patientType != null ? authUser.patientType : 0, + "SessionID": "YckwoXhUmWBsnHKEKig", + "Age": authUser.age != null ? authUser.age : 0, + "PatientID": authUser.patientID != null ? authUser.patientID : 0, + "Gender": authUser.gender != null ? authUser.gender : 0 + }; + + dynamic localRes; + + await baseAppClient.post(ADD_NEW_CALL_FOR_PATIENT_ER, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future getDeviceToken() async { + String deviceToken = await sharedPref.getString(PUSH_TOKEN); + return deviceToken; + } + + Future cancelLiveCareRequest(int vc_id, BuildContext context) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + request = {"VCID": vc_id}; + + dynamic localRes; + + await baseAppClient.post(CANCEL_LIVECARE_REQUEST, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future sendLiveCareInvoiceEmail(String appoNo, int projectID, + String emailAddress, BuildContext context) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + request = { + "To": emailAddress, + "ProjectID": projectID, + "AppointmentNo": appoNo + }; + + dynamic localRes; + + await baseAppClient.post(SEND_LIVECARE_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/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 93fcf496..53a82426 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -404,6 +404,11 @@ class TranslationBase { localizedValues['insuranceCards'][locale.languageCode]; String get requestType => localizedValues['requestType'][locale.languageCode]; + + String get consultation => + localizedValues['consultation'][locale.languageCode]; + String get logs => + localizedValues['logs'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 7be65a40..7100fa5f 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -1,8 +1,6 @@ import 'package:connectivity/connectivity.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:progress_dialog/progress_dialog.dart'; import 'app_shared_preferences.dart'; import 'app_toast.dart'; @@ -10,7 +8,6 @@ import 'app_toast.dart'; AppSharedPreferences sharedPref = new AppSharedPreferences(); class Utils { - static ProgressDialog pr; ///show custom Error Toast /// [message] to show for user @@ -109,34 +106,4 @@ class Utils { var length = loginType == 1 ? 10 : 7; return "([0-9]{" + length.toString() + "})"; } - - static showProgressDialog(context, [String message = "Loading..."]) async { - pr = ProgressDialog(context, - type: ProgressDialogType.Normal, isDismissible: false, showLogs: false); - pr.style( - message: message, - borderRadius: 10.0, - backgroundColor: Colors.white, - elevation: 10.0, - insetAnimCurve: Curves.easeInOut, - progress: 0.0, - maxProgress: 100.0, - progressTextStyle: TextStyle( - color: Colors.black, fontSize: 13.0, fontWeight: FontWeight.w400), - messageTextStyle: TextStyle( - color: Colors.black, fontSize: 19.0, fontWeight: FontWeight.w600)); - - if (!pr.isShowing()) { - await pr.show(); - } else { - await pr.hide(); - await pr.show(); - } - } - - static hideProgressDialog() async { - if (pr.isShowing()) { - await pr.hide(); - } - } } diff --git a/pubspec.yaml b/pubspec.yaml index c711d722..e91e58a6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -61,7 +61,7 @@ dependencies: # Notification Banner dropdown_banner: ^1.4.0 - flutter_local_notifications: +# flutter_local_notifications: # charts charts_flutter: ^0.9.0 @@ -87,8 +87,10 @@ dependencies: #InAppBrowser flutter_inappwebview: ^4.0.0+4 - #ProgressDialog - progress_dialog: ^1.2.4 + #Circular progress bar for reverse timer + circular_countdown_timer: ^0.0.5 + + smart_progress_bar: ^0.1.6 #hijri hijri: ^2.0.3