From ff3368eefb7eacf1498304aaed71373c74b3b427 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 3 Nov 2020 10:09:47 +0300 Subject: [PATCH 1/6] Login check implemented for appointment & ToDo --- lib/pages/MyAppointments/MyAppointments.dart | 7 +- lib/pages/ToDoList/ToDo.dart | 5 +- lib/pages/landing/home_page.dart | 192 +++++++++++-------- 3 files changed, 125 insertions(+), 79 deletions(-) diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 129450ea..71167798 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResu import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/AppointmentCardView.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -33,12 +34,14 @@ class _MyAppointmentsState extends State bool isDataLoaded = false; var sharedPref = new AppSharedPreferences(); + var authProvider = new AuthProvider(); @override void initState() { _tabController = new TabController(length: 3, vsync: this); - WidgetsBinding.instance - .addPostFrameCallback((_) => getPatientAppointmentHistory()); + WidgetsBinding.instance.addPostFrameCallback((_) { + if (authProvider.isLogin) getPatientAppointmentHistory(); + }); super.initState(); } diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index bbaa7260..f0f3cb47 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -39,8 +39,9 @@ class _ToDoState extends State { @override void initState() { widget.patientShareResponse = new PatientShareResponse(); - WidgetsBinding.instance - .addPostFrameCallback((_) => getPatientAppointmentHistory()); + WidgetsBinding.instance.addPostFrameCallback((_) { + if (authProvider.isLogin) getPatientAppointmentHistory(); + }); super.initState(); } diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 34aa2fe2..5606007d 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/medicine_search_screen.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -88,9 +89,10 @@ class _HomePageState extends State { ) ], ), - ), - Container(width: double.infinity, height:projectViewModel.isArabic ? 120:110), + Container( + width: double.infinity, + height: projectViewModel.isArabic ? 120 : 110), ], ), Positioned( @@ -301,7 +303,9 @@ class _HomePageState extends State { bold: true, ), Texts( - TranslationBase.of(context).height, + TranslationBase.of( + context) + .height, color: Colors.white, fontSize: 10, ), @@ -333,7 +337,9 @@ class _HomePageState extends State { bold: true, ), Texts( - TranslationBase.of(context).weight, + TranslationBase.of( + context) + .weight, color: Colors.white, fontSize: 10, ) @@ -347,8 +353,10 @@ class _HomePageState extends State { ), Expanded( child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.center, children: [ Image.asset( 'assets/images/blood-drop.png', @@ -362,7 +370,9 @@ class _HomePageState extends State { color: Colors.white, ), Texts( - TranslationBase.of(context).bloodType, + TranslationBase.of( + context) + .bloodType, color: Colors.white, fontSize: 10, ) @@ -401,28 +411,35 @@ class _HomePageState extends State { padding: const EdgeInsets.all(15.0), child: Column( children: [ - SizedBox(height: 15,), - + SizedBox( + height: 15, + ), Container( width: 60, decoration: BoxDecoration( color: Colors.white, shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(12) - ), - child: Center(child: Image.asset('assets/images/vital_sign_icon.png', + borderRadius: + BorderRadius.circular(12)), + child: Center( + child: Image.asset( + 'assets/images/vital_sign_icon.png', width: 80, height: 50, - fit: BoxFit.contain,)), + fit: BoxFit.contain, + )), + ), + SizedBox( + height: 20, ), - SizedBox(height: 20,), Texts( - TranslationBase.of(context) - .vitalSigns, + TranslationBase.of(context).vitalSigns, textAlign: TextAlign.center, color: Colors.white, bold: true, - fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, + fontSize: projectViewModel.isArabic + ? SizeConfig.textMultiplier * 1.5 + : SizeConfig.textMultiplier * 1.7, ) ], ), @@ -450,26 +467,35 @@ class _HomePageState extends State { padding: const EdgeInsets.all(15.0), child: Column( children: [ - SizedBox(height: 15,), + SizedBox( + height: 15, + ), Container( width: 50, decoration: BoxDecoration( color: Colors.white, shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(12) - ), - child: Center(child: Image.asset('assets/images/search_medicine_icon.png', + borderRadius: + BorderRadius.circular(12)), + child: Center( + child: Image.asset( + 'assets/images/search_medicine_icon.png', width: 50, height: 50, - fit: BoxFit.contain,)), + fit: BoxFit.contain, + )), + ), + SizedBox( + height: 20, ), - SizedBox(height: 20,), Texts( TranslationBase.of(context).searchMedicine, textAlign: TextAlign.center, color: Colors.white, bold: true, - fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, + fontSize: projectViewModel.isArabic + ? SizeConfig.textMultiplier * 1.5 + : SizeConfig.textMultiplier * 1.7, ) ], ), @@ -481,8 +507,9 @@ class _HomePageState extends State { ), ), Expanded( - child: DashboardItem(opacity: 1.0, - onTap: (){ + child: DashboardItem( + opacity: 1.0, + onTap: () { Navigator.push( context, FadePage( @@ -495,25 +522,35 @@ class _HomePageState extends State { padding: const EdgeInsets.all(15.0), child: Column( children: [ - SizedBox(height: 15,), + SizedBox( + height: 15, + ), Container( decoration: BoxDecoration( color: Colors.white, shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(12) - ), - child: Center(child: Image.asset('assets/images/online_payment_icon.png', + borderRadius: + BorderRadius.circular(12)), + child: Center( + child: Image.asset( + 'assets/images/online_payment_icon.png', width: 80, height: 50, - fit: BoxFit.contain,)), + fit: BoxFit.contain, + )), + ), + SizedBox( + height: 15, ), - SizedBox(height: 15,), Texts( - TranslationBase.of(context).onlinePaymentService, + TranslationBase.of(context) + .onlinePaymentService, textAlign: TextAlign.center, color: Colors.white, bold: true, - fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, + fontSize: projectViewModel.isArabic + ? SizeConfig.textMultiplier * 1.5 + : SizeConfig.textMultiplier * 1.7, ) ], ), @@ -549,34 +586,33 @@ class _HomePageState extends State { ); }, child: MedicalProfileItem( - title: TranslationBase.of(context) - .myAppointments, + title: + TranslationBase.of(context).myAppointments, imagePath: 'my_appointment_icon.png', - subTitle: TranslationBase.of(context).myAppointmentsList, + subTitle: TranslationBase.of(context) + .myAppointmentsList, ), ), ), Expanded( flex: 1, child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: LabsHomePage())), + onTap: () => Navigator.push( + context, FadePage(page: LabsHomePage())), child: MedicalProfileItem( title: TranslationBase.of(context).lab, imagePath: 'lab_result_icon.png', - subTitle: - TranslationBase.of(context).lab, + subTitle: TranslationBase.of(context).lab, ), ), ), Expanded( flex: 1, child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: RadiologyHomePage())), + onTap: () => Navigator.push( + context, FadePage(page: RadiologyHomePage())), child: MedicalProfileItem( - title: TranslationBase.of(context) - .radiology, + title: TranslationBase.of(context).radiology, imagePath: 'radiology_icon.png', subTitle: TranslationBase.of(context) .radiologySubtitle, @@ -599,8 +635,7 @@ class _HomePageState extends State { ); }, child: MedicalProfileItem( - title: TranslationBase.of(context) - .medicines, + title: TranslationBase.of(context).medicines, imagePath: 'prescription_icon.png', subTitle: TranslationBase.of(context) .medicinesSubtitle, @@ -619,8 +654,7 @@ class _HomePageState extends State { ); }, child: MedicalProfileItem( - title: TranslationBase.of(context) - .myDoctor, + title: TranslationBase.of(context).myDoctor, imagePath: 'doctor_icon.png', subTitle: TranslationBase.of(context) .myDoctorSubtitle, @@ -631,12 +665,11 @@ class _HomePageState extends State { flex: 1, child: InkWell( onTap: () { - Navigator.push(context, - FadePage(page: InsuranceCard())); + Navigator.push( + context, FadePage(page: InsuranceCard())); }, child: MedicalProfileItem( - title: TranslationBase.of(context) - .insurance, + title: TranslationBase.of(context).insurance, imagePath: 'insurance_card_icon.png', subTitle: TranslationBase.of(context) .insuranceSubtitle, @@ -645,7 +678,6 @@ class _HomePageState extends State { ), ], ), - ], ), ), @@ -658,7 +690,7 @@ class _HomePageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ DashboardItem( - opacity:1.0, + opacity: 1.0, child: Container( width: double.infinity, padding: EdgeInsets.all(10), @@ -671,7 +703,8 @@ class _HomePageState extends State { bold: true, ), Texts( - TranslationBase.of(context).viewAllHabibMedicalService, + TranslationBase.of(context) + .viewAllHabibMedicalService, color: Colors.white, fontWeight: FontWeight.normal, fontSize: 10, @@ -689,13 +722,17 @@ class _HomePageState extends State { ), height: 100, imageName: 'ask_doctor_bg.png', - //color: Colors.grey[700], + //color: Colors.grey[700], width: MediaQuery.of(context).size.width * 0.45, onTap: () => Navigator.push( - context, FadePage(page: AllHabibMedicalService(goToMyProfile: widget.goToMyProfile,))), + context, + FadePage( + page: AllHabibMedicalService( + goToMyProfile: widget.goToMyProfile, + ))), ), DashboardItem( - opacity:1.0, + opacity: 1.0, onTap: () { Navigator.push( context, FadePage(page: ContactUsPage())); @@ -715,7 +752,7 @@ class _HomePageState extends State { TranslationBase.of(context).viewAllWaysReachUs, color: Colors.white, fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 1.0 , + fontSize: SizeConfig.textMultiplier * 1.0, ), Expanded( child: Container(), @@ -753,20 +790,23 @@ class _HomePageState extends State { } getToDoCount() { - toDoProvider.setState(0); - ClinicListService service = new ClinicListService(); - service.getActiveAppointmentNo(context).then((res) { - print(res['AppointmentActiveNumber']); - if (res['MessageStatus'] == 1) { - setState(() { - toDoProvider.setState(res['AppointmentActiveNumber']); - }); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }).catchError((err) { - print(err); - }); + var authProvider = AuthProvider(); + if (authProvider.isLogin) { + toDoProvider.setState(0); + ClinicListService service = new ClinicListService(); + service.getActiveAppointmentNo(context).then((res) { + print(res['AppointmentActiveNumber']); + if (res['MessageStatus'] == 1) { + setState(() { + toDoProvider.setState(res['AppointmentActiveNumber']); + }); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }); + } } } @@ -780,7 +820,9 @@ class DashboardItem extends StatelessWidget { this.width, this.height, this.color, - this.opacity = 1.0,this.icon,this.margin=0}) + this.opacity = 1.0, + this.icon, + this.margin = 0}) : super(key: key); final bool hasBorder; final String imageName; From 15a8e64e7c30245cd5bfc73127f136b001ebf2aa Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 8 Nov 2020 11:21:21 +0300 Subject: [PATCH 2/6] updates & fixes --- lib/core/model/my_balance/AdvanceModel.dart | 6 +++ .../service/medical/my_balance_service.dart | 1 + .../medical/my_balance_view_model.dart | 37 +++++++++++++------ lib/pages/BookAppointment/QRCode.dart | 12 ++++-- lib/pages/login/confirm-login.dart | 2 +- .../medical/balance/confirm_payment_page.dart | 23 ++++++------ .../authentication/auth_provider.dart | 2 +- lib/widgets/in_app_browser/InAppBrowser.dart | 30 +++++++-------- 8 files changed, 69 insertions(+), 44 deletions(-) diff --git a/lib/core/model/my_balance/AdvanceModel.dart b/lib/core/model/my_balance/AdvanceModel.dart index b95e08a2..d2792990 100644 --- a/lib/core/model/my_balance/AdvanceModel.dart +++ b/lib/core/model/my_balance/AdvanceModel.dart @@ -8,6 +8,9 @@ class AdvanceModel { String email; String note; String depositorName; + String mobileNumber; + String patientName; + int projectID; CitiesModel citiessModel; AdvanceModel( @@ -17,5 +20,8 @@ class AdvanceModel { this.hospitalsModel, this.fileNumber, this.depositorName, + this.mobileNumber, + this.patientName, + this.projectID, this.citiessModel}); } diff --git a/lib/core/service/medical/my_balance_service.dart b/lib/core/service/medical/my_balance_service.dart index 27d5d602..8937c318 100644 --- a/lib/core/service/medical/my_balance_service.dart +++ b/lib/core/service/medical/my_balance_service.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_advance_balance_amount.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart index b110edcb..af4e126e 100644 --- a/lib/core/viewModels/medical/my_balance_view_model.dart +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/blood_groub_details.dart'; import 'package:diplomaticquarterapp/core/model/blooddonation/get_all_cities.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_advance_balance_amount.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; @@ -25,11 +26,15 @@ class MyBalanceViewModel extends BaseViewModel { _myBalanceService.patientAdvanceBalanceAmountList; //======================== - BloodDonationService _bloodDonationService =locator(); - List get CitiesModelList => _bloodDonationService.CitiesModelList; - BloodDetailsService _bloodDetailsService =locator(); - List get BloodDetailsModelList => _bloodDetailsService.BloodModelList;//_bloodDonationService.CitiesModelList; + BloodDonationService _bloodDonationService = locator(); + List get CitiesModelList => + _bloodDonationService.CitiesModelList; + BloodDetailsService _bloodDetailsService = locator(); + + List get BloodDetailsModelList => + _bloodDetailsService + .BloodModelList; //_bloodDonationService.CitiesModelList; //=========================== @@ -44,8 +49,8 @@ class MyBalanceViewModel extends BaseViewModel { PatientInfoAndMobileNumber get patientInfoAndMobileNumber => _myBalanceService.patientInfoAndMobileNumber; - String get logInTokenID => _myBalanceService.logInTokenID; + String get verificationCode => _myBalanceService.verificationCode; getPatientAdvanceBalanceAmount() async { @@ -68,6 +73,7 @@ class MyBalanceViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + //============== Future getCities() async { setState(ViewState.Busy); @@ -79,9 +85,11 @@ class MyBalanceViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + Future getBlood() async { setState(ViewState.Busy); - await _bloodDetailsService .getAllBloodOrders();; + await _bloodDetailsService.getAllBloodOrders(); + ; if (_bloodDetailsService.hasError) { error = _bloodDetailsService.error; @@ -89,6 +97,7 @@ class MyBalanceViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + //=============== Future getPatientInfoByPatientID({String id}) async { @@ -105,7 +114,8 @@ class MyBalanceViewModel extends BaseViewModel { Future getPatientInfoByPatientIDAndMobileNumber() async { setState(ViewState.Busy); - await _myBalanceService.getPatientInfoByPatientIDAndMobileNumber(); + await _myBalanceService + .getPatientInfoByPatientIDAndMobileNumber(); if (_myBalanceService.hasError) { error = _myBalanceService.error; setState(ViewState.ErrorLocal); @@ -115,9 +125,11 @@ class MyBalanceViewModel extends BaseViewModel { } } - Future sendActivationCodeForAdvancePayment({int patientID,int projectID}) async { + Future sendActivationCodeForAdvancePayment( + {int patientID, int projectID}) async { setState(ViewState.Busy); - await _myBalanceService.sendActivationCodeForAdvancePayment(patientID: patientID,projectID: projectID); + await _myBalanceService.sendActivationCodeForAdvancePayment( + patientID: patientID, projectID: projectID); if (_myBalanceService.hasError) { error = _myBalanceService.error; setState(ViewState.ErrorLocal); @@ -126,9 +138,12 @@ class MyBalanceViewModel extends BaseViewModel { setState(ViewState.Idle); } } - Future checkActivationCodeForAdvancePayment({String activationCode}) async { + + Future checkActivationCodeForAdvancePayment( + {String activationCode, String patientMobileNumber}) async { setState(ViewState.Busy); - await _myBalanceService.checkActivationCodeForAdvancePayment(activationCode: activationCode); + await _myBalanceService.checkActivationCodeForAdvancePayment( + activationCode: activationCode); if (_myBalanceService.hasError) { error = _myBalanceService.error; setState(ViewState.ErrorLocal); diff --git a/lib/pages/BookAppointment/QRCode.dart b/lib/pages/BookAppointment/QRCode.dart index c632a26e..fb60638d 100644 --- a/lib/pages/BookAppointment/QRCode.dart +++ b/lib/pages/BookAppointment/QRCode.dart @@ -252,7 +252,9 @@ class _QRCodeState extends State { ConfirmDialog.closeAlertDialog(context); AppToast.showErrorToast(message: err); print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", + backgroundColor: Colors.blue.withOpacity(0.6)); }, cancelFunction: () => {}); dialog.showAlertDialog(context); @@ -290,9 +292,11 @@ class _QRCodeState extends State { String getDoctorSpeciality(List docSpecial) { String docSpeciality = ""; - docSpecial.forEach((v) { - docSpeciality = docSpeciality + v + "\n"; - }); + if (docSpecial != null && docSpecial.length != 0) { + docSpecial.forEach((v) { + docSpeciality = docSpeciality + v + "\n"; + }); + } return docSpeciality; } } diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index bfde20d7..6c6f450c 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -519,7 +519,7 @@ class _ConfirmLogin extends State { checkIfUserAgreedBefore(CheckActivationCode result) { print(result); - if (result.isNeedUserAgreement) { + if (result.isNeedUserAgreement == true) { //move to agreement page. } else { insertIMEI(); diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 8847aaa1..5fcb24ed 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -30,6 +30,7 @@ class ConfirmPaymentPage extends StatelessWidget { MyInAppBrowser browser; AuthenticatedUser authenticatedUser; AppSharedPreferences sharedPref = AppSharedPreferences(); + String transID = ""; ConfirmPaymentPage( {this.advanceModel, @@ -205,16 +206,19 @@ class ConfirmPaymentPage extends StatelessWidget { appo: appo, onLoadStartCallback: onBrowserLoadStart); + transID = Utils.getAdvancePaymentTransID( + advanceModel.projectID, int.parse(advanceModel.fileNumber)); + browser.openPaymentBrowser( amount, "Advance Payment", - Utils.getAdvancePaymentTransID( - authenticatedUser.projectID, authenticatedUser.patientID), - appo.projectID.toString(), - authenticatedUser.emailAddress, + transID, + advanceModel.projectID.toString(), + advanceModel.email, paymentMethod, authenticatedUser, - browser); + browser, + advanceModel); } onBrowserLoadStart(String url) { @@ -245,12 +249,7 @@ class ConfirmPaymentPage extends StatelessWidget { checkPaymentStatus(AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); - service - .checkPaymentStatus( - Utils.getAdvancePaymentTransID( - appo.projectID, authenticatedUser.patientID), - AppGlobal.context) - .then((res) { + service.checkPaymentStatus(transID, AppGlobal.context).then((res) { print("Printing Payment Status Reponse!!!!"); print(res); String paymentInfo = res['Response_Message']; @@ -262,7 +261,7 @@ class ConfirmPaymentPage extends StatelessWidget { }).catchError((err) { print(err); }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index 2142bc53..bc8d5d5a 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -111,7 +111,7 @@ class AuthProvider with ChangeNotifier { var imei = await sharedPref.getString(PUSH_TOKEN); // if (!request.) { - newRequest.iMEI = imei; + newRequest.iMEI = imei; //imei!=null ? imei : ''; newRequest.firstName = request.firstName + " " + request.lastName; newRequest.firstNameN = request.firstNameN + " " + request.lastNameN; newRequest.lastNameN = request.lastNameN ?? ""; diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 68f15add..795fcc5a 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; @@ -97,19 +98,19 @@ class MyInAppBrowser extends InAppBrowser { } openPaymentBrowser( - double amount, - String orderDesc, - String transactionID, - String projId, - String emailId, - String paymentMethod, - AuthenticatedUser authenticatedUser, - InAppBrowser browser, - ) { + double amount, + String orderDesc, + String transactionID, + String projId, + String emailId, + String paymentMethod, + AuthenticatedUser authenticatedUser, + InAppBrowser browser, + [AdvanceModel advanceModel]) { this.browser = browser; this.browser.openUrl( url: generateURL(amount, orderDesc, transactionID, projId, emailId, - paymentMethod, authenticatedUser)); + paymentMethod, authenticatedUser, [advanceModel, null, null])); } openBrowser(String url) { @@ -157,7 +158,7 @@ class MyInAppBrowser extends InAppBrowser { 'PATIENT_TYPE_ID', patientData == null ? authUser.patientType.toString() - : patientData.PatientType); + : "1"); // form = form.replaceFirst('DEVICE_TOKEN', this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false) + "," + this.cs.sharedService.getSharedData(AuthenticationService.APNS_TOKEN, false)); // form = form.replaceFirst('LATITUDE_VALUE', this.cs.sharedService.getSharedData('userLat', false)); @@ -165,8 +166,7 @@ class MyInAppBrowser extends InAppBrowser { form = form.replaceFirst('LATITUDE_VALUE', "24.708488"); form = form.replaceFirst('LONGITUDE_VALUE', "46.665925"); - form = form.replaceFirst('DEVICE_TOKEN', - "e8wKxa4EGK8:APA91bGtygxh5E22pSARVKlngyi0iQbyRUvvUWiCIsaAcbE0hiffhUR094WVx22O5bsvwc706LspzIuJthUyK_748jzuaedD-ZwDm9BX_yyYV2K2YnuFBlHQ9pOKy65RfoprtvqyTN1O"); + form = form.replaceFirst('DEVICE_TOKEN', deviceToken); if (servID == "4") form = form.replaceFirst( @@ -186,8 +186,8 @@ class MyInAppBrowser extends InAppBrowser { form = form.replaceFirst('CUSTNAME_VALUE', authUser.firstName); form = form.replaceFirst('CUSTID_VALUE', authUser.patientID.toString()); } else { - form = form.replaceFirst('CUSTNAME_VALUE', patientData.FirstName); - form = form.replaceFirst('CUSTID_VALUE', patientData.PatientID); + form = form.replaceFirst('CUSTNAME_VALUE', patientData.depositorName); + form = form.replaceFirst('CUSTID_VALUE', patientData.fileNumber); } var bytes = utf8.encode(form); From d75e5caf08b46144a899b4d38b7c4c322a3727b0 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 8 Nov 2020 11:40:42 +0300 Subject: [PATCH 3/6] fixed appointment online checkIn issue --- lib/pages/BookAppointment/BookConfirm.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 507d7ec1..fa69d913 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResu import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -513,6 +514,9 @@ class _BookConfirmState extends State { widget.patientShareResponse = new PatientShareResponse.fromJson(res); navigateToBookSuccess(context, docObject, widget.patientShareResponse); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + navigateToHome(context); print(err); }); } @@ -528,6 +532,9 @@ class _BookConfirmState extends State { widget.patientShareResponse = new PatientShareResponse.fromJson(res); navigateToBookSuccess(context, docObject, widget.patientShareResponse); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + navigateToHome(context); print(err); }); } @@ -584,6 +591,10 @@ class _BookConfirmState extends State { } } + Future navigateToHome(context) async { + Navigator.of(context).popAndPushNamed(HOME); + } + Future navigateToBookSuccess(context, DoctorList docObject, PatientShareResponse patientShareResponse) async { GifLoaderDialogUtils.hideDialog(context); From ee67852970c37ec7a32de19219dedaf2e2efaf42 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 8 Nov 2020 12:34:17 +0300 Subject: [PATCH 4/6] Bottom navbar count & ToDo list fixed --- lib/pages/ToDoList/ToDo.dart | 9 ++++++--- lib/pages/landing/home_page.dart | 10 +++++----- lib/services/clinic_services/get_clinic_service.dart | 2 ++ .../bottom_navigation/bottom_navigation_item.dart | 6 ++++-- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index f0f3cb47..006503a4 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1,4 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; @@ -7,7 +9,6 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dar import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/widgets/paymentDialog.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; -import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -34,13 +35,14 @@ class _ToDoState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser; - AuthProvider authProvider = new AuthProvider(); + AuthenticatedUserObject authenticatedUserObject = + locator(); @override void initState() { widget.patientShareResponse = new PatientShareResponse(); WidgetsBinding.instance.addPostFrameCallback((_) { - if (authProvider.isLogin) getPatientAppointmentHistory(); + if (authenticatedUserObject.isLogin) getPatientAppointmentHistory(); }); super.initState(); } @@ -512,6 +514,7 @@ class _ToDoState extends State { openPaymentDialog(appo, widget.patientShareResponse); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); print(err); }); } diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 30dadc9a..0778b3a6 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -16,7 +16,6 @@ import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/medicine_search_screen.dart'; -import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -50,8 +49,9 @@ class _HomePageState extends State { }); super.initState(); } - AuthenticatedUserObject authenticatedUserObject = locator(); + AuthenticatedUserObject authenticatedUserObject = + locator(); @override Widget build(BuildContext context) { @@ -112,7 +112,8 @@ class _HomePageState extends State { Orientation.landscape ? 0.02 : 0.03), - child: (!authenticatedUserObject.isLogin && projectViewModel.user == null) + child: (!authenticatedUserObject.isLogin && + projectViewModel.user == null) ? Container( width: double.infinity, height: 160, @@ -795,8 +796,7 @@ class _HomePageState extends State { } getToDoCount() { - var authProvider = AuthProvider(); - if (authProvider.isLogin) { + if (authenticatedUserObject.isLogin) { toDoProvider.setState(0); ClinicListService service = new ClinicListService(); service.getActiveAppointmentNo(context).then((res) { diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index a508b08b..babef434 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -58,6 +58,8 @@ class ClinicListService extends BaseService { "TokenID": "", "IsActiveAppointment": true, "DeviceTypeID": req.DeviceTypeID, + "PatientType": user.patientType, + "PatientTypeID": user.patientType, "SessionID": null }; diff --git a/lib/widgets/bottom_navigation/bottom_navigation_item.dart b/lib/widgets/bottom_navigation/bottom_navigation_item.dart index f491917c..b1c565f6 100644 --- a/lib/widgets/bottom_navigation/bottom_navigation_item.dart +++ b/lib/widgets/bottom_navigation/bottom_navigation_item.dart @@ -1,4 +1,6 @@ import 'package:badges/badges.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -14,7 +16,7 @@ class BottomNavigationItem extends StatelessWidget { final int currentIndex; final String name; - var authProvider = new AuthProvider(); + AuthenticatedUserObject authenticatedUserObject = locator(); BottomNavigationItem( {this.icon, @@ -64,7 +66,7 @@ class BottomNavigationItem extends StatelessWidget { ), ], ) - : authProvider.isLogin + : authenticatedUserObject.isLogin ? Stack( alignment: AlignmentDirectional.center, children: [ From 506e32e8c8015e9b1b67b647bdd3ca513de471fe Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 9 Nov 2020 15:25:53 +0300 Subject: [PATCH 5/6] Payment issues resolved --- lib/config/config.dart | 3 + .../service/medical/my_balance_service.dart | 8 ++- lib/pages/Blood/confirm_payment_page.dart | 2 +- lib/pages/BookAppointment/BookSuccess.dart | 2 +- lib/pages/ToDoList/ToDo.dart | 2 +- lib/pages/landing/landing_page.dart | 1 + .../medical/balance/confirm_payment_page.dart | 42 +++++++----- .../balance/dialogs/ConfirmSMSDialog.dart | 7 +- .../appointment_services/GetDoctorsList.dart | 64 +++++++++++++++++-- lib/widgets/in_app_browser/InAppBrowser.dart | 34 ++++------ 10 files changed, 114 insertions(+), 51 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index ca1ed829..1fcad6ba 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -175,6 +175,8 @@ const CHECK_PAYMENT_STATUS = //URL create advance payment const CREATE_ADVANCE_PAYMENT = "Services/Doctors.svc/REST/CreateAdvancePayment"; +const HIS_CREATE_ADVANCE_PAYMENT = "Services/Patients.svc/REST/HIS_CreateAdvancePayment"; + const ADD_ADVANCE_NUMBER_REQUEST = 'Services/PayFort_Serv.svc/REST/AddAdvancedNumberRequest'; @@ -235,6 +237,7 @@ const SESSION_ID = 'TMRhVmkGhOsvamErw'; const IS_DENTAL_ALLOWED_BACKEND = false; const PATIENT_TYPE = 1; const PATIENT_TYPE_ID = 1; +var DEVICE_TOKEN = ""; var DeviceTypeID = Platform.isIOS ? 1 : 2; const LANGUAGE_ID = 2; const GET_PHARMCY_ITEMS = "Services/Lists.svc/REST/GetPharmcyItems_Region"; diff --git a/lib/core/service/medical/my_balance_service.dart b/lib/core/service/medical/my_balance_service.dart index 8937c318..383c37f1 100644 --- a/lib/core/service/medical/my_balance_service.dart +++ b/lib/core/service/medical/my_balance_service.dart @@ -6,7 +6,9 @@ import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_advance_balance_amount.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; @@ -22,6 +24,8 @@ class MyBalanceService extends BaseService { String logInTokenID; String verificationCode; + AuthenticatedUserObject authenticatedUserObject = locator(); + getPatientAdvanceBalanceAmount() async { hasError = false; super.error = ""; @@ -62,8 +66,8 @@ class MyBalanceService extends BaseService { super.error = ""; Map body = Map(); body['isDentalAllowedBackend'] = false; - body['MobileNo'] = user.mobileNumber; - body['ProjectID'] = user.projectID; + body['MobileNo'] = authenticatedUserObject.user.mobileNumber; + body['ProjectID'] = authenticatedUserObject.user.projectID; await baseAppClient.post(GET_PATIENT_INFO_BY_ID_AND_MOBILE_NUMBER, onSuccess: (response, statusCode) async { diff --git a/lib/pages/Blood/confirm_payment_page.dart b/lib/pages/Blood/confirm_payment_page.dart index cc5df0a6..3d9fccb2 100644 --- a/lib/pages/Blood/confirm_payment_page.dart +++ b/lib/pages/Blood/confirm_payment_page.dart @@ -269,7 +269,7 @@ class ConfirmPaymentPage extends StatelessWidget { DoctorsListService service = new DoctorsListService(); String paymentReference = res['Fort_id'].toString(); service - .createAdvancePayment(appo, res['Amount'], res['Fort_id'], + .createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], AppGlobal.context) .then((res) { print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index a070d38d..9636d236 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -652,7 +652,7 @@ class _BookSuccessState extends State { String paymentReference = res['Fort_id'].toString(); service .createAdvancePayment( - appo, res['Amount'], res['Fort_id'], res['PaymentMethod'], context) + appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], context) .then((res) { print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); addAdvancedNumberRequest( diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 006503a4..1e82e3df 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -664,7 +664,7 @@ class _ToDoState extends State { String paymentReference = res['Fort_id'].toString(); service .createAdvancePayment( - appo, res['Amount'], res['Fort_id'], res['PaymentMethod'], context) + appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], context) .then((res) { GifLoaderDialogUtils.hideDialog(context); print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 63eeb0d3..609f6b2c 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -138,6 +138,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { _firebaseMessaging.getToken().then((String token) { sharedPref.setString(PUSH_TOKEN, token); if (token != null) { + DEVICE_TOKEN = token; checkUserStatus(token); } requestPermissions(); diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 5fcb24ed..dbc2537f 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -55,7 +56,7 @@ class ConfirmPaymentPage extends StatelessWidget { new AppoitmentAllHistoryResultList(); appo.projectID = patientInfoAndMobileNumber.projectID; openPayment(selectedPaymentMethod, authenticatedUser, - double.parse(advanceModel.amount), appo); + double.parse(advanceModel.amount), null); } }); } @@ -207,18 +208,17 @@ class ConfirmPaymentPage extends StatelessWidget { onLoadStartCallback: onBrowserLoadStart); transID = Utils.getAdvancePaymentTransID( - advanceModel.projectID, int.parse(advanceModel.fileNumber)); + advanceModel.hospitalsModel.iD, int.parse(advanceModel.fileNumber)); browser.openPaymentBrowser( amount, "Advance Payment", transID, - advanceModel.projectID.toString(), + advanceModel.hospitalsModel.iD.toString(), advanceModel.email, paymentMethod, authenticatedUser, - browser, - advanceModel); + browser); } onBrowserLoadStart(String url) { @@ -248,6 +248,7 @@ class ConfirmPaymentPage extends StatelessWidget { } checkPaymentStatus(AppoitmentAllHistoryResultList appo) { + GifLoaderDialogUtils.showMyDialog(AppGlobal.context); DoctorsListService service = new DoctorsListService(); service.checkPaymentStatus(transID, AppGlobal.context).then((res) { print("Printing Payment Status Reponse!!!!"); @@ -256,46 +257,55 @@ class ConfirmPaymentPage extends StatelessWidget { if (paymentInfo == 'Success') { createAdvancePayment(res, appo); } else { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); AppToast.showErrorToast(message: res['Response_Message']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + AppToast.showErrorToast(message: err); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); String paymentReference = res['Fort_id'].toString(); - service - .createAdvancePayment(appo, res['Amount'], res['Fort_id'], - res['PaymentMethod'], AppGlobal.context) + service.HIS_createAdvancePayment( + appo, + advanceModel.hospitalsModel.iD.toString(), + res['Amount'], + res['Fort_id'], + res['PaymentMethod'], + AppGlobal.context) .then((res) { print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); addAdvancedNumberRequest( res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), paymentReference, - appo.appointmentNo.toString(), + 0, appo); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + AppToast.showErrorToast(message: err); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } addAdvancedNumberRequest(String advanceNumber, String paymentReference, - String appointmentID, AppoitmentAllHistoryResultList appo) { + dynamic appointmentID, AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); service .addAdvancedNumberRequest( advanceNumber, paymentReference, appointmentID, AppGlobal.context) .then((res) { print(res); + GifLoaderDialogUtils.hideDialog(AppGlobal.context); navigateToHome(AppGlobal.context); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); + AppToast.showErrorToast(message: err); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } Future navigateToHome(context) async { diff --git a/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart b/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart index 8dd2b29e..10d61f68 100644 --- a/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart +++ b/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart @@ -7,12 +7,12 @@ import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:smart_progress_bar/smart_progress_bar.dart'; class ConfirmSMSDialog extends StatefulWidget { final String phoneNumber; @@ -332,12 +332,11 @@ class _ConfirmSMSDialogState extends State { if (verifyAccountForm.currentState.validate()) { final activationCode = digit1.text + digit2.text + digit3.text + digit4.text; + GifLoaderDialogUtils.showMyDialog(AppGlobal.context); model .checkActivationCodeForAdvancePayment(activationCode: activationCode) - .then((value) {}) - .showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) .then((value) { + GifLoaderDialogUtils.hideDialog(AppGlobal.context); Navigator.pop(context, true); }); } diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 39117783..bc100df3 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -6,7 +6,6 @@ import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/models/LiveCare/insertVIDARequest.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -813,7 +812,7 @@ class DoctorsListService extends BaseService { Future addAdvancedNumberRequest( String advanceNumber, String paymentReference, - String appointmentID, + dynamic appointmentID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -1109,6 +1108,7 @@ class DoctorsListService extends BaseService { Future createAdvancePayment( AppoitmentAllHistoryResultList appo, + String projectID, double payedAmount, String paymentReference, String paymentMethodName, @@ -1122,9 +1122,9 @@ class DoctorsListService extends BaseService { var languageID = await sharedPref.getString(APP_LANGUAGE); Request req = appGlobal.getPublicRequest(); request = { - "ProjectID": appo.projectID.toString(), + "ProjectID": projectID, "OnlineCheckInAppointment": { - "AppointmentNo": appo.appointmentNo.toString(), + "AppointmentNo": appo != null ? appo.appointmentNo.toString() : "0", "PaymentMethodName": paymentMethodName, "PaymentAmount": payedAmount == 0 ? "0" : payedAmount.toString(), "PaymentDate": payedAmount == 0 @@ -1133,9 +1133,9 @@ class DoctorsListService extends BaseService { DateTime.now().millisecondsSinceEpoch.toString() + ")/", "PaymentReferenceNumber": payedAmount == 0 ? "" : paymentReference, - "ProjectID": appo.projectID.toString(), + "ProjectID": appo != null ? appo.projectID.toString() : projectID, "PatientID": authUser.patientID, - "ClinicID": appo.clinicID, + "ClinicID": appo != null ? appo.clinicID : "0", "UserID": authUser.patientID, "Status": authUser.patientType }, @@ -1161,4 +1161,56 @@ class DoctorsListService extends BaseService { }, body: request); return Future.value(localRes); } + + Future HIS_createAdvancePayment( + AppoitmentAllHistoryResultList appo, + String projectID, + double payedAmount, + String paymentReference, + String paymentMethodName, + 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 = { + "CustName": authUser.firstName + " " + authUser.lastName, + "CustID": authUser.patientID, + "SetupID": "010266", + "ProjectID": projectID, + "PatientID": authUser.patientID, + "AccountID": authUser.patientID, + "PaymentAmount": payedAmount, + "NationalityID": null, + "DepositorName": authUser.firstName + " " + authUser.lastName, + "CreatedBy": 3, + "PaymentMethodName": paymentMethodName, + "PaymentReference": paymentReference, + "PaymentMethod": paymentMethodName, + "VersionID": req.VersionID, + "Channel": req.Channel, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": authUser.outSA, + "SessionID": "YckwoXhUmWBsnHKEKig", + "isDentalAllowedBackend": false, + "TokenID": "@dm!n", + "PatientTypeID": authUser.patientType, + "PatientType": authUser.patientType + }; + dynamic localRes; + await baseAppClient.post(HIS_CREATE_ADVANCE_PAYMENT, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } } diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 795fcc5a..8ca40730 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -1,5 +1,6 @@ import 'dart:convert'; +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; @@ -39,6 +40,8 @@ class MyInAppBrowser extends InAppBrowser { AuthenticatedUser authUser; AppoitmentAllHistoryResultList appo; + String deviceToken; + static bool isPaymentDone = false; MyInAppBrowser({this.onExitCallback, this.appo, this.onLoadStartCallback}); @@ -84,9 +87,9 @@ class MyInAppBrowser extends InAppBrowser { return await sharedPref.getString(APP_LANGUAGE); } - Future getDeviceToken() async { + getDeviceToken() async { String deviceToken = await sharedPref.getString(PUSH_TOKEN); - return deviceToken; + this.deviceToken = deviceToken; } getPatientData() async { @@ -105,12 +108,12 @@ class MyInAppBrowser extends InAppBrowser { String emailId, String paymentMethod, AuthenticatedUser authenticatedUser, - InAppBrowser browser, - [AdvanceModel advanceModel]) { + InAppBrowser browser) { + getDeviceToken(); this.browser = browser; this.browser.openUrl( url: generateURL(amount, orderDesc, transactionID, projId, emailId, - paymentMethod, authenticatedUser, [advanceModel, null, null])); + paymentMethod, authenticatedUser)); } openBrowser(String url) { @@ -132,12 +135,6 @@ class MyInAppBrowser extends InAppBrowser { getPatientData(); String currentLanguageID = getLanguageID() == 'ar' ? 'AR' : 'EN'; String form = getForm(); - String deviceToken; - - getDeviceToken().then((value) { - print(value); - deviceToken = value; - }); if (authUser != null) { form = form.replaceFirst("EMAIL_VALUE", authUser.emailAddress); @@ -154,20 +151,13 @@ class MyInAppBrowser extends InAppBrowser { form = form.replaceFirst('LANG_VALUE', currentLanguageID); form = form.replaceFirst('PATIENT_OUT_SA', authUser.outSA == 0 ? false.toString() : true.toString()); - form = form.replaceFirst( - 'PATIENT_TYPE_ID', - patientData == null - ? authUser.patientType.toString() - : "1"); + form = form.replaceFirst('PATIENT_TYPE_ID', + patientData == null ? authUser.patientType.toString() : "1"); // form = form.replaceFirst('DEVICE_TOKEN', this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false) + "," + this.cs.sharedService.getSharedData(AuthenticationService.APNS_TOKEN, false)); // form = form.replaceFirst('LATITUDE_VALUE', this.cs.sharedService.getSharedData('userLat', false)); // form = form.replaceFirst('LONGITUDE_VALUE', this.cs.sharedService.getSharedData('userLong', false)); - form = form.replaceFirst('LATITUDE_VALUE', "24.708488"); - form = form.replaceFirst('LONGITUDE_VALUE', "46.665925"); - form = form.replaceFirst('DEVICE_TOKEN', deviceToken); - if (servID == "4") form = form.replaceFirst( 'SERVICE_URL_VALUE', MyInAppBrowser.PREAUTH_SERVICE_URL); @@ -190,6 +180,10 @@ class MyInAppBrowser extends InAppBrowser { form = form.replaceFirst('CUSTID_VALUE', patientData.fileNumber); } + form = form.replaceFirst('LATITUDE_VALUE', "24.708488"); + form = form.replaceFirst('LONGITUDE_VALUE', "46.665925"); + form = form.replaceFirst('DEVICE_TOKEN', DEVICE_TOKEN); + var bytes = utf8.encode(form); var base64Str = base64.encode(bytes); print(form); From 10efccbce8c1a91403f5334b1fe3d6f40bc181b0 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 11 Nov 2020 10:10:04 +0300 Subject: [PATCH 6/6] my appointment fixes --- .../components/DocAvailableAppointments.dart | 2 +- lib/pages/Covid-DriveThru/Covid-TimeSlots.dart | 2 +- lib/pages/MyAppointments/MyAppointments.dart | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 2d857bc9..8d0cc84d 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -235,7 +235,7 @@ class _DocAvailableAppointmentsState extends State return children; }, ), - onDaySelected: (date, events,holidays) { + onDaySelected: (date, events, holidays) { _onDaySelected(date, events); _animationController.forward(from: 0.0); }, diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index 8310528d..1e1fc444 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -348,7 +348,7 @@ class _CovidTimeSlotsState extends State return children; }, ), - onDaySelected: (date, event,holidays) { + onDaySelected: (date, event, holidays) { _onDaySelected( date, event, diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 71167798..454abb4d 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -1,4 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/AppointmentCardView.dart'; @@ -34,13 +36,13 @@ class _MyAppointmentsState extends State bool isDataLoaded = false; var sharedPref = new AppSharedPreferences(); - var authProvider = new AuthProvider(); + AuthenticatedUserObject authenticatedUserObject = locator(); @override void initState() { _tabController = new TabController(length: 3, vsync: this); WidgetsBinding.instance.addPostFrameCallback((_) { - if (authProvider.isLogin) getPatientAppointmentHistory(); + if (authenticatedUserObject.isLogin) getPatientAppointmentHistory(); }); super.initState(); } @@ -87,6 +89,11 @@ class _MyAppointmentsState extends State widget.bookedAppoList.clear(); widget.confirmedAppoList.clear(); widget.arrivedAppoList.clear(); + + widget._patientBookedAppointmentListHospital.clear(); + widget._patientConfirmedAppointmentListHospital.clear(); + widget._patientArrivedAppointmentListHospital.clear(); + service.getPatientAppointmentHistory(false, context).then((res) { print(res['AppoimentAllHistoryResultList'].length); if (res['MessageStatus'] == 1) {