From 7a8392a97ea3182faffff461daf003fda325ad3b Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 31 Aug 2020 15:43:31 +0300 Subject: [PATCH 01/12] updates --- CustomFlutterFirebaseMessagingService.java | 17 +++++ ...CustomFlutterFirebaseMessagingService.java | 17 +++++ .../conference/conference_button_bar.dart | 10 +-- lib/pages/conference/conference_page.dart | 30 ++++----- lib/pages/landing/landing_page.dart | 63 +++++++++++++++++++ lib/pages/login/login.dart | 40 ++++++------ 6 files changed, 136 insertions(+), 41 deletions(-) create mode 100644 CustomFlutterFirebaseMessagingService.java create mode 100644 android/CustomFlutterFirebaseMessagingService.java diff --git a/CustomFlutterFirebaseMessagingService.java b/CustomFlutterFirebaseMessagingService.java new file mode 100644 index 00000000..0a4d83be --- /dev/null +++ b/CustomFlutterFirebaseMessagingService.java @@ -0,0 +1,17 @@ +package io.flutter.plugins.firebasemessaging; + +import android.content.Intent; + +import com.google.firebase.messaging.RemoteMessage; + +public class CustomFlutterFirebaseMessagingService extends FlutterFirebaseMessagingService { + @Override + public void onMessageReceived(RemoteMessage remoteMessage) { + if (remoteMessage.getData().containsKey("is_call")) { + Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName()); + startActivity(intent); + super.onMessageReceived(remoteMessage); + } else + super.onMessageReceived(remoteMessage); + } +} \ No newline at end of file diff --git a/android/CustomFlutterFirebaseMessagingService.java b/android/CustomFlutterFirebaseMessagingService.java new file mode 100644 index 00000000..0a4d83be --- /dev/null +++ b/android/CustomFlutterFirebaseMessagingService.java @@ -0,0 +1,17 @@ +package io.flutter.plugins.firebasemessaging; + +import android.content.Intent; + +import com.google.firebase.messaging.RemoteMessage; + +public class CustomFlutterFirebaseMessagingService extends FlutterFirebaseMessagingService { + @Override + public void onMessageReceived(RemoteMessage remoteMessage) { + if (remoteMessage.getData().containsKey("is_call")) { + Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName()); + startActivity(intent); + super.onMessageReceived(remoteMessage); + } else + super.onMessageReceived(remoteMessage); + } +} \ No newline at end of file diff --git a/lib/pages/conference/conference_button_bar.dart b/lib/pages/conference/conference_button_bar.dart index d9abd212..d49c4e4a 100644 --- a/lib/pages/conference/conference_button_bar.dart +++ b/lib/pages/conference/conference_button_bar.dart @@ -212,6 +212,11 @@ class _ConferenceButtonBarState extends State with AfterLay key: Key('microphone-button'), onPressed: () => _onPressed(widget.onAudioEnabled), ), + CircleButton( + child: const Icon(Icons.switch_camera, color: Colors.white), + key: Key('switch-camera-button'), + onPressed: () => _onPressed(widget.onSwitchCamera), + ), CircleButton( radius: 35, child: const RotationTransition( @@ -226,11 +231,6 @@ class _ConferenceButtonBarState extends State with AfterLay key: Key('hangup-button'), onPressed: () => _onPressed(widget.onHangup), ), - CircleButton( - child: const Icon(Icons.switch_camera, color: Colors.white), - key: Key('switch-camera-button'), - onPressed: () => _onPressed(widget.onSwitchCamera), - ), ], ), ); diff --git a/lib/pages/conference/conference_page.dart b/lib/pages/conference/conference_page.dart index 60ffb0d5..7848d4f7 100644 --- a/lib/pages/conference/conference_page.dart +++ b/lib/pages/conference/conference_page.dart @@ -217,21 +217,21 @@ class _ConferencePageState extends State { ); } - if (length <= 3) { - buildInCols(true, false, 1); - } else if (length == 5) { - buildInCols(false, true, 2); - } else if (length <= 6 || length == 8) { - buildInCols(false, false, 2); - } else if (length == 7 || length == 9) { - buildInCols(true, false, 2); - } else if (length == 10) { - buildInCols(false, true, 3); - } else if (length == 13 || length == 16) { - buildInCols(true, false, 3); - } else if (length <= 18) { - buildInCols(false, false, 3); - } +// if (length <= 3) { +// buildInCols(true, false, 1); +// } else if (length == 5) { +// buildInCols(false, true, 2); +// } else if (length <= 6 || length == 8) { +// buildInCols(false, false, 2); +// } else if (length == 7 || length == 9) { +// buildInCols(true, false, 2); +// } else if (length == 10) { +// buildInCols(false, true, 3); +// } else if (length == 13 || length == 16) { +// buildInCols(true, false, 3); +// } else if (length <= 18) { +// buildInCols(false, false, 3); +// } return Column( children: children, diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 80c65128..7c32b212 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -13,6 +13,7 @@ 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/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; @@ -101,6 +102,18 @@ class _LandingPageState extends State with WidgetsBindingObserver { }); pageController = PageController(keepPage: true); _firebaseMessaging.setAutoInitEnabled(true); + + if (Platform.isIOS) { + _firebaseMessaging.requestNotificationPermissions( +// const IosNotificationSettings( +// sound: true, +// badge: true, +// alert: true, +// provisional: true, +// ), + ); + } + _firebaseMessaging.getToken().then((String token) { sharedPref.setString(PUSH_TOKEN, token); if (token != null) { @@ -112,6 +125,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { //_firebase Background message handler _firebaseMessaging.configure( onMessage: (Map message) async { + showDialog("onMessage: $message"); print("onMessage: $message"); print(message); print(message['name']); @@ -182,19 +196,68 @@ class _LandingPageState extends State with WidgetsBindingObserver { onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, onLaunch: (Map message) async { print("onLaunch: $message"); + showDialog("onLaunch: $message"); }, onResume: (Map message) async { print("onResume: $message"); + print(message); + print(message['name']); + print(message['appointmentdate']); + + showDialog("onResume: $message"); + + if (Platform.isIOS) { + if (message['is_call'] == "true") { + var route = ModalRoute.of(context); + + if (route != null) { + print(route.settings.name); + } + + Map myMap = + new Map.from(message); + print(myMap); + LandingPage.isOpenCallPage = true; + LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + if (!isPageNavigated) { + isPageNavigated = true; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => IncomingCall( + incomingCallData: LandingPage.incomingCallData))) + .then((value) { + isPageNavigated = false; + }); + } + } else { + print("Is Call Not Found iOS"); + } + } else { + print("Is Call Not Found iOS"); + } }, ); } + showDialog(String message) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: message, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + void requestPermissions() async { await [ Permission.location, Permission.storage, Permission.camera, Permission.photos, + Permission.notification, Permission.accessMediaLocation ].request(); } diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 83d10fe6..f72c7c6a 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -1,19 +1,14 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_request.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; -import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; -import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; -import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -21,7 +16,6 @@ import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_pro import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; class Login extends StatefulWidget { @override @@ -41,9 +35,16 @@ class _Login extends State { @override void initState() { +// getDeviceToken(); super.initState(); } + getDeviceToken() async { + setState(() async { + nationalIDorFile.text = await sharedPref.getString(PUSH_TOKEN); + }); + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -184,20 +185,17 @@ class _Login extends State { request['PatientID'] = int.parse(nationalIDorFile.text); } // request.isRegister = false; - this - .authService - .checkActivationCode(request, code) - .then((result) => { - result = CheckActivationCode.fromJson(result), - this.sharedPref.setObject(USER_PROFILE, result.list), - this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), - this.sharedPref.setString(TOKEN, result.authenticationTokenID), - //this.checkIfUserAgreedBefore(result), - Navigator.of(context).pushNamed( - HOME, - ) - // SMSOTP.showLoadingDialog(context, false), - }); + this.authService.checkActivationCode(request, code).then((result) => { + result = CheckActivationCode.fromJson(result), + this.sharedPref.setObject(USER_PROFILE, result.list), + this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), + this.sharedPref.setString(TOKEN, result.authenticationTokenID), + //this.checkIfUserAgreedBefore(result), + Navigator.of(context).pushNamed( + HOME, + ) + // SMSOTP.showLoadingDialog(context, false), + }); } showLoader(bool isTrue) { From 823eda0d5ccaeb5331208f7c9d020ef7e3fc5359 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 31 Aug 2020 16:49:37 +0300 Subject: [PATCH 02/12] updates --- lib/core/viewModels/project_view_model.dart | 2 +- lib/main.dart | 3 --- .../components/SearchByClinic.dart | 3 ++- lib/pages/login/login.dart | 21 +++++++++++-------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index ed752b50..c231d455 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -8,7 +8,7 @@ import 'package:flutter/cupertino.dart'; class ProjectViewModel with ChangeNotifier { AppSharedPreferences sharedPref = AppSharedPreferences(); Locale _appLocale; - String currentLanguage = 'ar'; + String currentLanguage = 'en'; bool _isArabic = false; bool isInternetConnection = true; bool isLoading = false; diff --git a/lib/main.dart b/lib/main.dart index ca2e7a82..a1944fd0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,4 @@ -import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; -import 'package:diplomaticquarterapp/pages/login/login.dart'; import 'package:diplomaticquarterapp/routes.dart'; -import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 03370d82..9dc97373 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -148,7 +148,8 @@ class _SearchByClinicState extends State { context, MaterialPageRoute( builder: (context) => - BranchView(doctorsList: docList, result: result, num: numAll), +// BranchView(doctorsList: docList, result: result, num: numAll), + SearchResults(doctorsList: docList), ), ); //builder: (context) => SearchResults(doctorsList: docList))); diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index f223f91f..7510987c 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -2,22 +2,17 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_request.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; -import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; -import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; -import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -26,7 +21,6 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; class Login extends StatefulWidget { @override @@ -48,9 +42,16 @@ class _Login extends State { @override void initState() { +// getDeviceToken(); super.initState(); } + getDeviceToken() async { + setState(() async { + nationalIDorFile.text = await sharedPref.getString(PUSH_TOKEN); + }); + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -196,7 +197,10 @@ class _Login extends State { this.sharedPref.setObject(USER_PROFILE, result.list), this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), this.sharedPref.setString(TOKEN, result.authenticationTokenID), - + //this.checkIfUserAgreedBefore(result), + Navigator.of(context).pushNamed( + HOME, + ), appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { @@ -219,7 +223,6 @@ class _Login extends State { ) } }) - // SMSOTP.showLoadingDialog(context, false), }); } From 84e92cb0401eaee4490d955ffb2b7cfbc6c15ac7 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 31 Aug 2020 17:41:57 +0300 Subject: [PATCH 03/12] updates & fixes --- Certs/APNSDevPushCert.p12 | Bin 0 -> 3249 bytes Certs/APNSProdCert.certSigningRequest | 16 ++++++++ Certs/APNSProdCert.p12 | Bin 0 -> 3417 bytes ...pplePushServicesSandbox.certSigningRequest | 16 ++++++++ Certs/aps.cer | Bin 1649 -> 1649 bytes Certs/aps_development.cer | Bin 0 -> 1445 bytes .../components/SearchByClinic.dart | 3 +- .../BookAppointment/widgets/BranchView.dart | 35 ++++++++---------- .../BookAppointment/widgets/DoctorView.dart | 2 +- 9 files changed, 49 insertions(+), 23 deletions(-) create mode 100644 Certs/APNSDevPushCert.p12 create mode 100644 Certs/APNSProdCert.certSigningRequest create mode 100644 Certs/APNSProdCert.p12 create mode 100644 Certs/ApplePushServicesSandbox.certSigningRequest create mode 100644 Certs/aps_development.cer diff --git a/Certs/APNSDevPushCert.p12 b/Certs/APNSDevPushCert.p12 new file mode 100644 index 0000000000000000000000000000000000000000..dba27aecd2549bf8a8aef99be837f25796d10be9 GIT binary patch literal 3249 zcmY+FXHXLew}ul)LP?M=T?ok1A#~|YM1jzoC?YK&kwl6#K_Gw>#n6!+2wB91KXdHxatF=A+#$OydnC{bPJ2tcLR>6k77N^Fwoy6E$hutevVoH>R+&huxuiI?p z#N%o#u|B}ejI@3^r3j7bu7q{w>I*^-Tp*8NG zc=ck~8c&}w%iI<^I468X_@*#2PP)-%iJsMkqvZ=O!XcG=F9}a54fM4Vx} z!y4g{GMSG&`UPhuqDNZv?oAKfe|ER+4sF{+53Ksdl55;cfRua5&WHzo%`D{G{^ZdP zn^fAV?<=W*R~y^$^*se0>f<(j)S6~?cGuFW7G1MzffPrbM0x%5;;fZoIg+xS4|n~H zpr!YL1HPy9ugt;ghVLgA^Q-_K-7RWp4Z*2k)$;ahVSIub&u^^6rO9k_tX}!hD8To% zAI}2=`phr=JOTC(E85m4SiUyak~M{<;~64uV6$I7m5U!~wxmU5Ed1cU4cEbn-G9y3 zLo#CzUzm*LuC+vJ^N|fpHWSzcRlxycyqU%}i$lv=vm&fL123;;Xr**5EtLcn{786G z?0jj46|^fUvY3nXT%mlZ2$$$4tjfIZpIyGxhH6}>7;pA4^Mfr454&4EWqL#%P}KwORvY4EUN*8i2&A-_bXE5juCJ6aja zg~368&hYxRC8Xjn=4~>|Hrl`7BX5~}GzlgvM+f)AZbo?1srV6RTtYmm-Ow|lTiTz% z<(xsMwcHC+*9Is>DU^2ytz6$6x^B1Rz4yf1$X$6Rq2;3z5Vrs3>JTruxhyN^o$td6 z-Zlm*mTZpY46xl^PBn(-ofRqy4LKnNGf~O%BxhxoB@T#a=+~#NA>6(A7>mS!g9^Id zA`rz+Gv5fU9Oc#C#=cWmWGjqna8`9yfNJo3S>P5XP&GJ>RQd`ahIf^YP9u`mj9v~{ zhCDI?qn$ZWjD*0xw|hzcm#!j(H${g}3P$wUrNKMH+80p^dbgHCo{AdVUqJ&BHbN=KH2UD5Y(U^-4(b?NJ{QaIvj!GDt9U8kZ+# z*bffAR4^fcHKsmp37yYWB1z>r`r_$*kBaEVBgk*nIL~bI?HD ztDk`uGri-R_p2wDP!Eo+G=4C%Pvh<5^YBZzA6=rE$b<+@dxplf@PBX0R#yUE#B#{Z z?q91(r*KA!c2o2aibY=!1@2R<%OTq;Yx_=l)F=~2B~=)q+JWO)XCZxM9D^UJrkfat z(tRWp0<)jbLtiqD;NoYs5~@s(WT2nsx^)8*Yn~qztt0g`{qxJaZDp_C8TqZ$N@qKV z77kAR3Gqk+#fwwN*EIx)YhP@+v3?A*Do$j-g(2TR3o*lYda>X2mD}g%I+=9>_#NJ? zbuHFnFiU}(e6$K9P5-EywSi6&uG?sYa#0sB} zEV3cHi{1aCPox%jRoD5DD*ENK@}87baEO5l{bF^}I=F0Q*_GSh20~?0``Lnnp0&Ey z^=w(&!l{Rzx?epP79!yfZQ=cf1tuAX>F-#Az&~u3tb-NTD-On4HIyKrDZY3>`AA{T##gB$5!e2GNsvXzsDur zwzARROH{z9&Um;;xV~Vc{HYkhmLsZCANY&j8NC(>r6R|v2pkyme}G27fn7m3@U7pr zr7C%s@H<4n#xXK%4)Mdi4KLPxPUv?1oC1#Xr;o;Xu8m<0n9etcTrgwI$TK z5@`i_JSh+jQ`OuIt4S`MkSjLI#wpZL*VwZQ<{5{)U9CJMuq#GzLV!354bbOUciHVv zGh=@KU6m8NmHbj))2?jGLrA~z@%s2E6m?eMZnS6OqG)4FTxTJ6@-i+<>qxg^T9#wx z7}B4a9n_vkssOiX?=WV>*SerckO#I3;7<|T8v+7s$WQy1kUouGhp<7v+ zo=hk0nXKPzsXkx=kRA&9Tp%^l@S`bgvJXl8w6iN8b>j$M$3D2pF*|a4y{uw!{lZ9~ zV9Zs?YYbgZ}wJoic^=%Zjk8 z$<#eLl7x)ZL~P_6L~8QH zVruVRJ%BT7tCfzU*)in{)qsCc3rr;!JBsOKbWv4a`L1=-(-enL+hxq^39?A-Y!VhSpc5n#=pG9Sfvd zjl-0#yo)<6$xfQRh(7zIWX{6!{fBAw(@+1du4h%3%J-F`oPS744!m#LL}-|ef8ah2 z!xt-L_@QXA;Tw0|8@P2$oSPEd@Qe{x^bhSXbd|Zo7(XmEm~dBKA6}V#TeTKW1w=!$}$tDxpmxa#l;S1{cqKQh7uJ9#VnSE zZ~kCk24@}_?(yl^Jh@*N6<3%zaZh+$=pa|2{}r{BH%;83za5$%vv!-J{jBa$@^Mwe zu&Mh2(dnDq@iM(!RdmfBcy|k<=A0A5ua~`wYC8T)@NnafdQh{;7?YKxxycGR;iRr4 z0D4A2AG6MArzq#QnX9(HIPykIez56a?7nwFF!JWkPco9LZf@J=9#E{sO;}*F#)|f> zt&9tH#6C95kPl%DNoS?CN?vUWn5t;=YBW*)L*BV(3G?!u@tZ)t%3VF2gz>9|aqj>T zHDR5R{lTkk1PAC}uAwz2=NM#PSFFio_h`A?{Al`U4pSM8S6A#nhhUSHzWMu}qi-+$#u$EbE+k4<$vbIfmUMk!Gu6KT*BerLKnOKB* zJm5%dw16a?E1oIZAY}gcJ2G)8Ub-X*KmxD;AAlRc58wsx1c?0BUI6rO9RdhLi2Xav zt#}c{wbyqPtu-^4YFd;0SwZCPy6cR=Ap(JbBbXpynG5uE{9pix%X5X?wM=igd}F;q a2FfE-=cWZ11u^#OOP7v5iIk@U0{;WD2?4_Z literal 0 HcmV?d00001 diff --git a/Certs/APNSProdCert.certSigningRequest b/Certs/APNSProdCert.certSigningRequest new file mode 100644 index 00000000..3f13a387 --- /dev/null +++ b/Certs/APNSProdCert.certSigningRequest @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIICkDCCAXgCAQAwSzEjMCEGCSqGSIb3DQEJARYUaGFyb29uNjEzOEBnbWFpbC5j +b20xFzAVBgNVBAMMDk1vaGFtZWQgTWVrYXd5MQswCQYDVQQGEwJBRTCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBALcPrk09MmhQhRNe8LYdaeN4mYtoKJg3 +SndMLgpxnaRqP7a6f4sp118wCFZsTXnwhPVP4DzmXWc2AzZtsusmhdw1tzNFtme0 +PtEjDXIPI2lHU3Zhi2zukZdAVxF+uNi3pcp0axina60ZQciIfb/7Fx6hNbqpk90E +O8a2Ob17Wq/ZTYIP4H7ZGydUe2ra9QyDtjmGj9vpEv+xXYWX685sgEylTG14DSOP +ozGsQmaf+QCMbCT3osq7idWc1IQ+3Oed0kUTx1jmRtZwPzQkJJ1Bx3vYSXN/EOlb +u+ei1Nqtc14aVCYvmcuvGDtMyRtw6w+syCw2CpJCPGNkxNz+EH9h+EUCAwEAAaAA +MA0GCSqGSIb3DQEBCwUAA4IBAQBYdu2AaZY6kReuT1Xp8ktlyPfjBRKhPPChuaeR +tFnYMsJtG0aIA/xOu4/RYDgmL92seimULXd9DIPvkJ2DuaB+bdfGTw0qXUlihkm8 +ui5O0L2F9OZbQxJogvTmrMsKnkoR27O5vyfCn9VMOLk3x1nyEzAXIj/5GHWw9T6t +r65jPUOfm6ikiZtICBzSaTPBtyfZB8mrbwG2dpOvVNSa1dj3xip4L8CL6TxH+qM3 ++N90QFYjvjphJkpn2Kt0ow9IyIyeqJbIYJmsWoV9pXddOHCjKdTWUjq7D2Jn3eUA +DAKjKgVqF4/dU10k7EtSfrw01aHLXjj5FxsD5YhVrgTA5xSq +-----END CERTIFICATE REQUEST----- diff --git a/Certs/APNSProdCert.p12 b/Certs/APNSProdCert.p12 new file mode 100644 index 0000000000000000000000000000000000000000..b0ada4531c7cf19e65b097056fd0e7d80c71d563 GIT binary patch literal 3417 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 literal 0 HcmV?d00001 diff --git a/Certs/ApplePushServicesSandbox.certSigningRequest b/Certs/ApplePushServicesSandbox.certSigningRequest new file mode 100644 index 00000000..7d509a0a --- /dev/null +++ b/Certs/ApplePushServicesSandbox.certSigningRequest @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIICkDCCAXgCAQAwSzEjMCEGCSqGSIb3DQEJARYUaGFyb29uNjEzOEBnbWFpbC5j +b20xFzAVBgNVBAMMDk1vaGFtZWQgTWVrYXd5MQswCQYDVQQGEwJBRTCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnHqsyE7WfiVcE1Lpa4t4OVO6qlll2q +1djs0XG06R/dlDtIqv4940/XLj+hU93mzAcVvFW4DSIEdD3InM3+T6oMTjPu6meU +69h9ryaVkluQRrT/tdGI1EKO4MWGMe4MDIt7DqMhMfAcxTwekwdxdKaCEhaw3qnA +l/64AelY6URW1pHHJMA0VV7j+pE3jVNai+muMXPrhQ1VrOrV8FftpY3bEeRJR2Cl +T0tv0LhEMu4SfLnVWCzGQQC82hilDw3rH3ZDs8DFxF9agNVdwKlYamarh1dQXwRq +Yx2+sjY1/51r9L4VS+GAh9ECxz0e+43NpzfZ/N+mTeDYKDepaBwPQ6kCAwEAAaAA +MA0GCSqGSIb3DQEBCwUAA4IBAQB89OyLfywKT7ftmpEqCmgsmaJexb580q9w8wOk +1JhJkNV5ec+p1dnge2NZeJ4LGII/5wmPj1vANNW0GZdmJDgnC+2gg9toq1QLCAsF +rW7/LMpgAoEH+P5bhrHV9RRv6BQi0ZmN0apBHjp/pqZfm2Cl5jQPEWjUEf2tIF4l +LSKdok6IPO9n4Fgyk0XdUNSEhgVhsLtZkGiXnkI1YovKDnupTFYPXMLp103bc9zP +xDxwscvOysNDijlzZAkJPg2z8NrJIRDrKvLRHzxQwZ/1LHVB/51bp/1iyks3vOjh +qw5XVsrtGAjCjU9md7q3XkPSyKzhK9UqPdOxdvl1OY0KKIIY +-----END CERTIFICATE REQUEST----- diff --git a/Certs/aps.cer b/Certs/aps.cer index fb46df86ede33f276e4356445e82b29065fe162c..d95bac402ce2fd89a3be82eddb4e63848532dabc 100644 GIT binary patch delta 605 zcmV-j0;2u#4Dk#XFoFhcFoFeDpaTK{0s;se>+1ncusUav7qAvHFfchXGcz$-7Y#Bo zFgY?gFgY?aGm+iof42{=O+7MbP=ym-@U|Uk<9L~iXegLBN_R{y3UQsJYCpERe~T&C zUoZ$(Y)yIag!ND0Jmy_zHUll|MYdyLhnPc3DZVP-}VNgS}!Zj*xq?tdBfY=s|Z{fd}c zC)L)0$w|U&%7zEbl+8fh8_k~%n_nwxaYKWgQ0!ZQ{;eRCb$@9re}y_AjtOFk?@0(6Y<$p7ym10PZ{if&1!U7zB{f--Q delta 605 zcmV-j0;2u#4Dk#XFoFhcFoFeDpaTK{0s;sNY?vm;s{TFW zPuDI#p;O)F%m)>`Rk#fz1av*foX!4Estisu?&@ch>)3s-CY6#~kVdrswb6*wLXP0Y zhB59842ydXqaiWy9K}2ylLv8hrh*a{u->V_m;Sf`=~(GRe^%C!$0WcsRbJ!zkvEM~ zT8rtfF>~vM4OOh_)$mvCrH$JW)nk7^M#l>mPPQ zv%tl~Us{0GUBIbWYG$j4S5RLBYGWO~vNkpUoon>I6-(iOhtUGZJs$gw&8Iin{NJWc z;MgcPsc0Mz0z;{@!2+%U6!XdYfIHgEkV>$M<1Zj!=wI4F`ICbL?thl)|6;xS)=J4j znAkO0s(-jV<<$)c7~h-c?{&?`%wN=;G)N;4u!478+SDCvvm~gB_|h0KK@MMz?|H{d(e2^-j1Xtd67O8%72v0(;b!8RpEdi`nv7sgSt65Dib(X>FsFPIKN~!&SZlvi z3x2SIpC@wtxD0yd^{m^EK)J-=(*ckm>o;qAp$(OH%MN&$|;Anh4bj&Z$KunQ58HV9g4Sr6n2pMVTd)26E!OMg|5J z#s&tKMuvu_Q9!OC64#({fuWv(4jUKeB(=`TpL9|f8F}QA^KX79|!G82T7^K^*1`aTwI`xv6<23ZDMK3IV0X84AIvMP-@Esl`?b1Wbd5 z6gLl-v7@o6rK^Qmlp9i520I!wF)ASkHzO+pa}y&!15licsfm%1Vdn8wXIkE-KMFl) zsyA)N_U5V9tCmiSU3K-wn~Q~8UdrE{V(qc&pY3D+>w5MJgYP~&!!EifbO)~zONs4? zIcNX*uj27De)lSU%Ih1o>(!=Cik{%M<^R@;9ao(C9vp2me8T;+gCXx!sp6U}>rqq<+NGc11H${V`o)zuH- zZGT#R`G|X3K$nZO_ zWMXDyU|ih9_!Jl-55b90R+xp!fWbf>7)`RuED{D{4I&-t;+!kDNhEZ?dA;kKd*soe zkj2}9>iI!R6j+)V*?=4-gU0{RWSyMC%4pE|(V+1#8;3R0cE%GG;Rha(9FcV z$HF*!N4pah~P4X7s-g!2@D zNht@IUXy^iqZlZgl30|Y08C-IKn-~*z*Li$k_pZT3i)XYrNyZ_C>9mu1NDL|1FD4E z56m_S1x1O;z~l-xvm_OiCX4k9G~u3L6qC&;DJihh*Do(G*8@2rRS%dz^}(#Os6UUE^6 zfh@>4J{B<+kcgQWRcSeTjE8w>>4xWMI1ata$W zBMTF-s6j1xfLVc&!CXjf{w|$m(u)HR-cs|jk*L|T?bd9eF3FzlCoX#zKYV;|$8Q(8 zkn{7LtIqz5`zx`Xsj4O}iWjL@T;`}My83fy&@{#K$qWCS)j2+A z?yID4{c%l8ZBTt1Bv;JfVZ|(F`fvZKT}_(|dLQrF zaWFGrfy>wLr;~T|Tu|kVTb?m7FC_l_24m|IBfW<#Npp-7k?WvtlMsdL^*x zrG7%KK-s~wTP)cRS6?#c$-L(M(lVo|?(e@(M_z?#vhG$+ROac crFP{c3V7V}$h`SRdzzP)WYF4ei@tjS08HK-ApigX literal 0 HcmV?d00001 diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 33828171..bfadd3b0 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -162,8 +162,7 @@ class _SearchByClinicState extends State { context, MaterialPageRoute( builder: (context) => -// BranchView(doctorsList: docList, result: result, num: numAll), - SearchResults(doctorsList: docList), + BranchView(doctorsList: docList, result: result, num: numAll), ), ); //builder: (context) => SearchResults(doctorsList: docList))); diff --git a/lib/pages/BookAppointment/widgets/BranchView.dart b/lib/pages/BookAppointment/widgets/BranchView.dart index 82c38cb2..ecf2bfd6 100644 --- a/lib/pages/BookAppointment/widgets/BranchView.dart +++ b/lib/pages/BookAppointment/widgets/BranchView.dart @@ -1,8 +1,6 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.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:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -30,7 +28,6 @@ class _BranchViewState extends State { body: new ListView.builder( itemBuilder: (BuildContext context, int index) { return new ExpandableListView( - result2: widget.result, val: index, doctorsList2: widget.doctorsList); @@ -42,13 +39,11 @@ class _BranchViewState extends State { } class ExpandableListView extends StatefulWidget { - final List result2; final List doctorsList2; final val; - const ExpandableListView( - {Key key, this.result2, this.val, this.doctorsList2}) + const ExpandableListView({Key key, this.result2, this.val, this.doctorsList2}) : super(key: key); @override @@ -61,11 +56,9 @@ class _ExpandableListViewState extends State { @override Widget build(BuildContext context) { return new Container( - // margin: new EdgeInsets.symmetric(vertical: 1.0), width: MediaQuery.of(context).size.width * 0.6, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0), + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 0.0), child: Card( - // margin: EdgeInsets.fromLTRB(20.0, 16.0, 20.0, 8.0), color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), @@ -77,19 +70,19 @@ class _ExpandableListViewState extends State { child: new Column( children: [ new Container( + margin: EdgeInsets.only(left: 5.0, right: 5.0), color: Colors.white, - // padding: new EdgeInsets.symmetric(horizontal: 5.0), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ new Text( - widget.result2[widget.val].toString()+" "+ "22 كم", + widget.result2[widget.val].toString() + " " + " - 22 KM", style: new TextStyle( fontWeight: FontWeight.bold, color: Colors.black), ), new IconButton( icon: new Container( - height: 30.0, + height: 28.0, width: 30.0, decoration: new BoxDecoration( color: Colors.red, @@ -124,13 +117,14 @@ class _ExpandableListViewState extends State { itemCount: widget.doctorsList2.length, itemBuilder: (context, index) { return widget.result2[widget.val].toString() == - widget.doctorsList2[index].projectName.toString()? DoctorView( - //AJ note - doctor: - widget.doctorsList2[index] - - // widget.doctorsList2[index] - ):Container(); + widget.doctorsList2[index].projectName.toString() + ? DoctorView( + //AJ note + doctor: widget.doctorsList2[index] + + // widget.doctorsList2[index] + ) + : Container(); }, ), ) @@ -162,7 +156,8 @@ class ExpandableContainer extends StatelessWidget { duration: new Duration(milliseconds: 500), curve: Curves.easeInOut, width: screenWidth, - height: expanded ? expandedHeight : collapsedHeight, + height: + expanded ? expandedHeight : collapsedHeight, child: new Container( child: child, decoration: new BoxDecoration( diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 3d69a93d..39e4ab36 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -39,7 +39,7 @@ class DoctorView extends StatelessWidget { fit: BoxFit.fill, height: 60.0, width: 60.0), ), Container( - width: MediaQuery.of(context).size.width * 0.6, + width: MediaQuery.of(context).size.width * 0.52, margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, From f669adcb9dc6c49c040fed27963487c4f7800910 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 1 Sep 2020 16:38:04 +0300 Subject: [PATCH 04/12] Location service implemented --- lib/config/localized_values.dart | 3 +- lib/config/shared_pref_kay.dart | 2 + .../Appointments/DoctorListResponse.dart | 2 +- lib/pages/BookAppointment/BookingOptions.dart | 27 ++- lib/pages/BookAppointment/Search.dart | 6 +- lib/pages/BookAppointment/SearchResults.dart | 60 +++++-- .../components/SearchByClinic.dart | 49 +++-- .../BookAppointment/widgets/BranchView.dart | 18 +- .../BookAppointment/widgets/DoctorView.dart | 4 +- lib/pages/livecare/widgets/clinic_list.dart | 169 +++++++++--------- .../appointment_services/GetDoctorsList.dart | 12 +- lib/uitl/location_util.dart | 69 +++++++ lib/uitl/translations_delegate_base.dart | 2 + 13 files changed, 287 insertions(+), 136 deletions(-) create mode 100644 lib/uitl/location_util.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 35d24cc7..c6c109f3 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -362,5 +362,6 @@ const Map> localizedValues = { "medicalProfile": {"en": "Medical Profile", 'ar': 'الملف الطبي'}, "consultation": {"en": "Consultation", "ar": "استشارة"}, "logs": {"en": "Logs", "ar": "السجلات"}, - "textToSpeech": {"en": "How May I Help You?", "ar": "كيف يمكنني مساعدتك؟"} + "textToSpeech": {"en": "How May I Help You?", "ar": "كيف يمكنني مساعدتك؟"}, + "locationDialogMessage": {"en": "Allow the HMG app to access your location will assist you in showing the hospitals according to the nearest to you.", "ar": "السماح لتطبيق مجموعة الحبيب الطبية بالوصول إلى موقعك سيساعدك في إظهار المستشفيات وفقًا للأقرب إليك."} }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 414c6a80..68df4e75 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -11,3 +11,5 @@ const AUTH_DATA = 'auth-data'; const IMEI_USER_DATA = 'imei-user-data'; const NHIC_DATA = 'nhic-data'; const FAMILY_FILE = 'family-file'; +const USER_LAT = 'user-lat'; +const USER_LONG = 'user-long'; \ No newline at end of file diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 2f4ee2a0..07563a25 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -30,7 +30,7 @@ class DoctorList { int noOfPatientsRate; int originalClinicID; int personRate; - int projectDistanceInKiloMeters; + dynamic projectDistanceInKiloMeters; String qR; dynamic qRString; int rateNumber; diff --git a/lib/pages/BookAppointment/BookingOptions.dart b/lib/pages/BookAppointment/BookingOptions.dart index dacb25e9..b6dc5500 100644 --- a/lib/pages/BookAppointment/BookingOptions.dart +++ b/lib/pages/BookAppointment/BookingOptions.dart @@ -1,19 +1,36 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/CardCommon.dart'; -import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; import '../../uitl/translations_delegate_base.dart'; -class BookingOptions extends StatelessWidget { +class BookingOptions extends StatefulWidget { final bool isAppbar; + BookingOptions({this.isAppbar = false}); + + @override + _BookingOptionsState createState() => _BookingOptionsState(); +} + +class _BookingOptionsState extends State { + LocationUtils locationUtils; + + @override + void initState() { + locationUtils = + new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance + .addPostFrameCallback((_) => locationUtils.getCurrentLocation()); + + super.initState(); + } + @override Widget build(BuildContext context) { - final searchValue = Provider.of(context); return AppScaffold( - isShowAppBar: isAppbar, + isShowAppBar: widget.isAppbar, appBarTitle: TranslationBase.of(context).bookAppo, body: Container( margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), diff --git a/lib/pages/BookAppointment/Search.dart b/lib/pages/BookAppointment/Search.dart index 9af6b449..08b49462 100644 --- a/lib/pages/BookAppointment/Search.dart +++ b/lib/pages/BookAppointment/Search.dart @@ -1,13 +1,17 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByClinic.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByDoctor.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; -import 'package:diplomaticquarterapp/widgets/others/floating_button_search.dart'; import 'package:flutter/material.dart'; +import 'package:geolocator/geolocator.dart'; class Search extends StatefulWidget { final int type; + Search({this.type = 0}); + @override _SearchState createState() => _SearchState(); } diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index 7da5112b..5d74cc59 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -1,11 +1,11 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; -import 'widgets/DoctorView.dart'; - class SearchResults extends StatefulWidget { List doctorsList = []; @@ -49,19 +49,51 @@ class _SearchResultsState extends State { body: Container( margin: EdgeInsets.only(bottom: 10.0), child: SingleChildScrollView( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - itemCount: widget.doctorsList.length, - itemBuilder: (context, index) { - return DoctorView( - //AJ note - doctor: widget.doctorsList[index], - ); - }, + physics: BouncingScrollPhysics(), + child: FractionallySizedBox( + widthFactor: 1.0, + child: Column( + children: [ + ...List.generate( + widget.doctorsList.length, + (index) => AppExpandableNotifier( + title: widget.doctorsList[index].projectName, + bodyWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: widget.doctorsList.map((doctorObj) { + return DoctorView( + doctor: doctorObj, + ); + }).toList(), + ), + ), + ) + ], + ), ), + +// ListView.builder( +// scrollDirection: Axis.vertical, +// shrinkWrap: true, +// physics: ScrollPhysics(), +// padding: EdgeInsets.all(0.0), +// itemCount: widget.doctorsList.length, +// itemBuilder: (context, index) { +// return AppExpandableNotifier( +// title: widget.doctorsList[index].projectName, +// bodyWidget: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: widget.doctorsList.map((labOrder) { +// return DoctorView( +// doctor: widget.doctorsList[index], +// ); +// }).toList(), +// ), +// ); +// }, +// ), ), ), ); diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index bfadd3b0..2188d296 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -1,4 +1,4 @@ -import 'dart:convert'; +import "dart:collection"; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; @@ -6,16 +6,11 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.da import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; -import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; -import '../SearchResults.dart'; -import "dart:collection"; - class SearchByClinic extends StatefulWidget { @override _SearchByClinicState createState() => _SearchByClinicState(); @@ -30,14 +25,6 @@ class _SearchByClinicState extends State { @override void initState() { WidgetsBinding.instance.addPostFrameCallback((_) => getClinicsList()); - // event.controller.stream.listen((p) { - // if (p['clinic_id'] != null) { - // // setState(() { - // dropdownValue = p['clinic_id'].toString(); - // //}); - // getDoctorsList(context); - // } - // }); super.initState(); } @@ -118,36 +105,43 @@ class _SearchByClinicState extends State { getDoctorsList(BuildContext context) { List doctorsList = []; - //======================== List arr = []; + List arrDistance = []; var distinctIds; List result; int numAll; - //========================= DoctorsListService service = new DoctorsListService(); service.getDoctorsList(int.parse(dropdownValue), 0, context).then((res) { if (res['MessageStatus'] == 1) { setState(() { if (res['DoctorList'].length != 0) { + print(res['DoctorList']); doctorsList.clear(); res['DoctorList'].forEach((v) { doctorsList.add(new DoctorList.fromJson(v)); arr.add(new DoctorList.fromJson(v).projectName); - // print(DoctorList.fromJson(v).projectName); - // print(DoctorList.fromJson(v).projectDistanceInKiloMeters); - // distinctIds = result.toSet().toList(); + arrDistance.add(new DoctorList.fromJson(v) + .projectDistanceInKiloMeters + .toString()); + +// print(DoctorList +// .fromJson(v) +// .projectName); +// print(DoctorList +// .fromJson(v) +// .projectDistanceInKiloMeters); +// distinctIds = result.toSet().toList(); }); } else {} }); result = LinkedHashSet.from(arr).toList(); numAll = result.length; - // print(result); - print("numAll=" + numAll.toString()); - navigateToSearchResults(context, doctorsList, result, numAll); + navigateToSearchResults( + context, doctorsList, result, numAll, arrDistance); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -157,12 +151,17 @@ class _SearchByClinicState extends State { text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } - Future navigateToSearchResults(context, docList, result, numAll) async { + Future navigateToSearchResults( + context, docList, result, numAll, resultDistance) async { Navigator.push( context, MaterialPageRoute( - builder: (context) => - BranchView(doctorsList: docList, result: result, num: numAll), +// builder: (context) => SearchResults(doctorsList: docList) + builder: (context) => BranchView( + doctorsList: docList, + result: result, + num: numAll, + resultDistance: resultDistance), ), ); //builder: (context) => SearchResults(doctorsList: docList))); diff --git a/lib/pages/BookAppointment/widgets/BranchView.dart b/lib/pages/BookAppointment/widgets/BranchView.dart index ecf2bfd6..da069b75 100644 --- a/lib/pages/BookAppointment/widgets/BranchView.dart +++ b/lib/pages/BookAppointment/widgets/BranchView.dart @@ -10,9 +10,11 @@ class BranchView extends StatefulWidget { final List doctorsList; final List result; + final List resultDistance; final int num; - const BranchView({Key key, this.doctorsList, this.result, this.num}) + const BranchView( + {Key key, this.doctorsList, this.result, this.resultDistance, this.num}) : super(key: key); @override @@ -29,6 +31,7 @@ class _BranchViewState extends State { itemBuilder: (BuildContext context, int index) { return new ExpandableListView( result2: widget.result, + resultDistance: widget.resultDistance, val: index, doctorsList2: widget.doctorsList); }, @@ -40,10 +43,12 @@ class _BranchViewState extends State { class ExpandableListView extends StatefulWidget { final List result2; + final List resultDistance; final List doctorsList2; final val; - const ExpandableListView({Key key, this.result2, this.val, this.doctorsList2}) + const ExpandableListView( + {Key key, this.result2, this.resultDistance, this.val, this.doctorsList2}) : super(key: key); @override @@ -76,7 +81,11 @@ class _ExpandableListViewState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ new Text( - widget.result2[widget.val].toString() + " " + " - 22 KM", + widget.result2[widget.val].toString() + + " " + + " - " + + widget.resultDistance[widget.val].toString() + + " KM", style: new TextStyle( fontWeight: FontWeight.bold, color: Colors.black), ), @@ -156,8 +165,7 @@ class ExpandableContainer extends StatelessWidget { duration: new Duration(milliseconds: 500), curve: Curves.easeInOut, width: screenWidth, - height: - expanded ? expandedHeight : collapsedHeight, + height: expanded ? MediaQuery.of(context).size.height : collapsedHeight, child: new Container( child: child, decoration: new BoxDecoration( diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 39e4ab36..e8f08af5 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -21,7 +21,7 @@ class DoctorView extends StatelessWidget { getDoctorsProfile(context, doctor); }, child: Card( - margin: EdgeInsets.fromLTRB(20.0, 16.0, 20.0, 8.0), + margin: EdgeInsets.fromLTRB(10.0, 16.0, 10.0, 8.0), color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), @@ -39,7 +39,7 @@ class DoctorView extends StatelessWidget { fit: BoxFit.fill, height: 60.0, width: 60.0), ), Container( - width: MediaQuery.of(context).size.width * 0.52, + width: MediaQuery.of(context).size.width * 0.5, margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 77c3e741..9100a64e 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -14,7 +14,6 @@ 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'; @@ -49,7 +48,7 @@ class _clinic_listState extends State { liveCareClinicsListResponse = new LiveCareClinicsListResponse(); WidgetsBinding.instance.addPostFrameCallback((_) { // Future.delayed(new Duration(milliseconds: 1200), () { - getLiveCareClinicsList(); + getLiveCareClinicsList(); // }); }); getLanguageID(); @@ -58,79 +57,82 @@ class _clinic_listState extends State { @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)), - ), - ), + return SingleChildScrollView( + child: Column( + children: [ + 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: 10.0, + ), + ], + ), + ) + : Container(), + isDataLoaded ? 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)), + ), + ), + ) : Container(), + ], ), ); } void startLiveCare() { + bool isError = false; LiveCareService service = new LiveCareService(); ERAppointmentFeesResponse erAppointmentFeesResponse = new ERAppointmentFeesResponse(); @@ -141,12 +143,15 @@ class _clinic_listState extends State { }) .catchError((err) { print(err); + isError = true; + AppToast.showErrorToast(message: err); }) .showProgressBar( text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) .then((value) { - getERAppointmentTime( - erAppointmentFeesResponse.getERAppointmentFeesList); + if (!isError) + getERAppointmentTime( + erAppointmentFeesResponse.getERAppointmentFeesList); }); } @@ -158,6 +163,7 @@ class _clinic_listState extends State { getERAppointmentFeesList, res['WatingtimeInteger']); }).catchError((err) { print(err); + AppToast.showErrorToast(message: err); }).showProgressBar( text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } @@ -339,14 +345,17 @@ class _clinic_listState extends State { 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(); - }); + 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 { diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index ba3ad56e..27a66d43 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -20,6 +20,9 @@ class DoctorsListService extends BaseService { AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); + double lat; + double long; + Future getDoctorsList(int clinicID, int projectID, BuildContext context, {doctorId}) async { //Utils.showProgressDialog(context); @@ -31,6 +34,11 @@ class DoctorsListService extends BaseService { authUser = data; } + if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { + lat = await this.sharedPref.getDouble(USER_LAT); + long = await this.sharedPref.getDouble(USER_LONG); + } + var languageID = await sharedPref.getString(APP_LANGUAGE); Request req = appGlobal.getPublicRequest(); request = { @@ -52,8 +60,8 @@ class DoctorsListService extends BaseService { "gender": authUser.gender != null ? authUser.gender : 0, "age": authUser.age != null ? authUser.age : 0, "IsGetNearAppointment": false, - "Latitude": 0, - "Longitude": 0, + "Latitude": lat.toString(), + "Longitude": long.toString(), "License": true }; diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart new file mode 100644 index 00000000..e3012734 --- /dev/null +++ b/lib/uitl/location_util.dart @@ -0,0 +1,69 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:geolocator/geolocator.dart'; + +class LocationUtils { + AppSharedPreferences sharedPref = new AppSharedPreferences(); + + bool isShowConfirmDialog; + BuildContext context; + + LocationUtils({@required this.isShowConfirmDialog, @required this.context}); + + void getCurrentLocation() async { + print("current location"); + isLocationServiceEnabled().then((value) { + if (value) { + checkPermission().then((permission) { + if (permission == LocationPermission.always || + permission == LocationPermission.whileInUse) { + getLastKnownPosition().then((value) => setLocation(value)); + } + + if (permission == LocationPermission.denied || + permission == LocationPermission.deniedForever) { + setZeroLocation(); + if (isShowConfirmDialog) showErrorLocationDialog(false); + } + }).catchError((err) { + print(err); + }); + } else { + if (isShowConfirmDialog) showErrorLocationDialog(false); + } + }).catchError((err) { + print(err); + }); + } + + showErrorLocationDialog(bool isPermissionError) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).locationDialogMessage, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => { + ConfirmDialog.closeAlertDialog(context), + if (isPermissionError) + openAppSettings() + else + openLocationSettings() + }, + cancelFunction: () => {}); + return dialog.showAlertDialog(context); + } + + void setLocation(Position position) { + print(position); + this.sharedPref.setDouble(USER_LAT, position.latitude); + this.sharedPref.setDouble(USER_LONG, position.longitude); + } + + void setZeroLocation() { + this.sharedPref.setDouble(USER_LAT, 0.0); + this.sharedPref.setDouble(USER_LONG, 0.0); + } +} diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index df1999bb..fc1bd800 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -449,6 +449,8 @@ class TranslationBase { String get logs => localizedValues['logs'][locale.languageCode]; String get textToSpeech => localizedValues['textToSpeech'][locale.languageCode]; + String get locationDialogMessage => + localizedValues['locationDialogMessage'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From 6ea1ed3eaa0971b337b52f4c31b5a344a8275609 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 1 Sep 2020 17:13:21 +0300 Subject: [PATCH 05/12] added geolocation dependency in pubspec --- pubspec.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pubspec.yaml b/pubspec.yaml index 657f7b78..f4c5e5c2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -99,6 +99,9 @@ dependencies: #hijri hijri: ^2.0.3 + #Handle Geolocation + geolocator: ^6.0.0+1 + #Dependencies for video call implementation native_device_orientation: ^0.3.0 enum_to_string: ^1.0.9 From e29c6a892ece5c25522e1e01ffbd23fc8c24cac7 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 2 Sep 2020 10:02:06 +0300 Subject: [PATCH 06/12] updates --- lib/pages/BookAppointment/BookConfirm.dart | 2 -- lib/pages/BookAppointment/widgets/BranchView.dart | 15 +++++++++++---- lib/uitl/utils.dart | 1 - 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 8c1d781c..88ecdb6b 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -502,8 +502,6 @@ class _BookConfirmState extends State { Future navigateToBookSuccess(context, DoctorList docObject, PatientShareResponse patientShareResponse) async { - print(widget.appoDateFormatted); -// print(widget.appoTimeFormatted); Navigator.push( context, diff --git a/lib/pages/BookAppointment/widgets/BranchView.dart b/lib/pages/BookAppointment/widgets/BranchView.dart index da069b75..8ec0bbd5 100644 --- a/lib/pages/BookAppointment/widgets/BranchView.dart +++ b/lib/pages/BookAppointment/widgets/BranchView.dart @@ -82,10 +82,13 @@ class _ExpandableListViewState extends State { children: [ new Text( widget.result2[widget.val].toString() + - " " + - " - " + - widget.resultDistance[widget.val].toString() + - " KM", + " " + + widget.resultDistance[widget.val] + .toString() != + "0" + ? getProjectDistance( + widget.resultDistance[widget.val].toString()) + : "", style: new TextStyle( fontWeight: FontWeight.bold, color: Colors.black), ), @@ -143,6 +146,10 @@ class _ExpandableListViewState extends State { ), ); } + + String getProjectDistance(String distance) { + return " - " + distance + " KM"; + } } class ExpandableContainer extends StatelessWidget { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 526c0f5b..6958e67f 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -1,5 +1,4 @@ import 'package:connectivity/connectivity.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; From 35cd02494c93e24a4eb909bbb9e6bb4725691ee1 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 2 Sep 2020 12:10:40 +0300 Subject: [PATCH 07/12] implemented search by doctor list --- lib/config/localized_values.dart | 5 +- .../Appointments/DoctorListResponse.dart | 86 +++++++++++-------- lib/pages/BookAppointment/SearchResults.dart | 74 ++++------------ .../components/SearchByClinic.dart | 8 -- .../components/SearchByDoctor.dart | 44 +++++++++- .../BookAppointment/widgets/BranchView.dart | 16 ++-- 6 files changed, 117 insertions(+), 116 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index ea14b71f..95398e23 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -363,7 +363,7 @@ const Map> localizedValues = { "consultation": {"en": "Consultation", "ar": "استشارة"}, "logs": {"en": "Logs", "ar": "السجلات"}, "textToSpeech": {"en": "How May I Help You?", "ar": "كيف يمكنني مساعدتك؟"}, - "locationDialogMessage": {"en": "Allow the HMG app to access your location will assist you in showing the hospitals according to the nearest to you.", "ar": "السماح لتطبيق مجموعة الحبيب الطبية بالوصول إلى موقعك سيساعدك في إظهار المستشفيات وفقًا للأقرب إليك."} + "locationDialogMessage": {"en": "Allow the HMG app to access your location will assist you in showing the hospitals according to the nearest to you.", "ar": "السماح لتطبيق مجموعة الحبيب الطبية بالوصول إلى موقعك سيساعدك في إظهار المستشفيات وفقًا للأقرب إليك."}, "parking":{"en":"Parking","ar":"مواقف"}, "alhabiServices":{"en":"HMG Service","ar":"خدمات الحبيب"}, "parkingTitle":{"en":"Car service, car service, service to save parking information, return to it later, 1- By clicking on (Read the code), save the parking data. 2- By clicking on the button (view my car park), it shows you the car’s location in Google Maps. 3- Read another position by pressing the Clear Position Data button.","ar":" خدمة المواقف، تتيح هذه الخدمة للمستخدم معلومات عن موقف السيارة ليسهل عليه العودة لها لاحقاً ، 1- بالضغط على زر(قراءة الكود) تستطيع حفظ البيانات الخاصة بالموقف. 2-بالضغط على زر(عرض موقف سيارتي) يعرض لك موقع السيارة في خرائط قوقل. 3- لإعادة قراءة موقف آخرعن طريق الضغط على زر(مسح بيانات الموقف). "}, @@ -374,6 +374,5 @@ const Map> localizedValues = { "gate":{"en":"Gate:","ar":"بوابة"}, "building":{"en":"Building:","ar":"المبنى"}, "branch":{"en":"Branch:","ar":"الفرع"}, - "emergencyServices":{"en":"Emergency Services:","ar":"خدمات الطوارئ"}, - "textToSpeech": {"en": "How May I Help You?", "ar": "كيف يمكنني مساعدتك؟"} + "emergencyServices":{"en":"Emergency Services:","ar":"خدمات الطوارئ"} }; diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 07563a25..8e1f0b35 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -41,44 +41,44 @@ class DoctorList { DoctorList( {this.clinicID, - this.clinicName, - this.doctorTitle, - this.iD, - this.name, - this.projectID, - this.projectName, - this.actualDoctorRate, - this.clinicRoomNo, - this.date, - this.dayName, - this.doctorID, - this.doctorImageURL, - this.doctorProfile, - this.doctorProfileInfo, - this.doctorRate, - this.gender, - this.genderDescription, - this.isAppointmentAllowed, - this.isDoctorAllowVedioCall, - this.isDoctorDummy, - this.isLiveCare, - this.latitude, - this.longitude, - this.nationalityFlagURL, - this.nationalityID, - this.nationalityName, - this.nearestFreeSlot, - this.noOfPatientsRate, - this.originalClinicID, - this.personRate, - this.projectDistanceInKiloMeters, - this.qR, - this.qRString, - this.rateNumber, - this.serviceID, - this.setupID, - this.speciality, - this.workingHours}); + this.clinicName, + this.doctorTitle, + this.iD, + this.name, + this.projectID, + this.projectName, + this.actualDoctorRate, + this.clinicRoomNo, + this.date, + this.dayName, + this.doctorID, + this.doctorImageURL, + this.doctorProfile, + this.doctorProfileInfo, + this.doctorRate, + this.gender, + this.genderDescription, + this.isAppointmentAllowed, + this.isDoctorAllowVedioCall, + this.isDoctorDummy, + this.isLiveCare, + this.latitude, + this.longitude, + this.nationalityFlagURL, + this.nationalityID, + this.nationalityName, + this.nearestFreeSlot, + this.noOfPatientsRate, + this.originalClinicID, + this.personRate, + this.projectDistanceInKiloMeters, + this.qR, + this.qRString, + this.rateNumber, + this.serviceID, + this.setupID, + this.speciality, + this.workingHours}); DoctorList.fromJson(Map json) { clinicID = json['ClinicID']; @@ -166,3 +166,13 @@ class DoctorList { return data; } } + +class PatientDoctorAppointmentList { + String filterName = ""; + List patientDoctorAppointmentList = List(); + + PatientDoctorAppointmentList( + {this.filterName, DoctorList patientDoctorAppointment}) { + patientDoctorAppointmentList.add(patientDoctorAppointment); + } +} diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index 5d74cc59..8b9dd984 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -8,8 +8,10 @@ import 'package:flutter/material.dart'; class SearchResults extends StatefulWidget { List doctorsList = []; + List patientDoctorAppointmentListHospital; - SearchResults({@required this.doctorsList}); + SearchResults( + {@required this.doctorsList, this.patientDoctorAppointmentListHospital}); @override _SearchResultsState createState() => _SearchResultsState(); @@ -21,23 +23,7 @@ class _SearchResultsState extends State { @override void initState() { - event.controller.stream.listen((p) { - // if (p['project_id'] != null) { - // tempList = []; - // widget.doctorsList.forEach((e) => { - // if (e.projectID == int.parse(p['project_id'])) {tempList.add(e)} - // }); - // } else if (p['doctor_id'] != null) { - // tempList = []; - // widget.doctorsList.forEach((e) => { - // if (e.doctorID == int.parse(p['doctor_id'])) {tempList.add(e)} - // }); - // DoctorView().getDoctorsProfile(context, tempList[0], isAppo: true); - // } - // setState(() { - // widget.doctorsList = tempList; - // }); - }); + event.controller.stream.listen((p) {}); super.initState(); } @@ -50,50 +36,28 @@ class _SearchResultsState extends State { margin: EdgeInsets.only(bottom: 10.0), child: SingleChildScrollView( physics: BouncingScrollPhysics(), - child: FractionallySizedBox( - widthFactor: 1.0, - child: Column( - children: [ - ...List.generate( - widget.doctorsList.length, - (index) => AppExpandableNotifier( - title: widget.doctorsList[index].projectName, + child: Column( + children: [ + ...List.generate( + widget.patientDoctorAppointmentListHospital.length, + (index) => AppExpandableNotifier( + title: widget + .patientDoctorAppointmentListHospital[index].filterName, bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: widget.doctorsList.map((doctorObj) { + children: widget + .patientDoctorAppointmentListHospital[index] + .patientDoctorAppointmentList + .map((doctor) { return DoctorView( - doctor: doctorObj, + doctor: doctor, ); }).toList(), - ), - ), - ) - ], - ), + )), + ) + ], ), - -// ListView.builder( -// scrollDirection: Axis.vertical, -// shrinkWrap: true, -// physics: ScrollPhysics(), -// padding: EdgeInsets.all(0.0), -// itemCount: widget.doctorsList.length, -// itemBuilder: (context, index) { -// return AppExpandableNotifier( -// title: widget.doctorsList[index].projectName, -// bodyWidget: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: widget.doctorsList.map((labOrder) { -// return DoctorView( -// doctor: widget.doctorsList[index], -// ); -// }).toList(), -// ), -// ); -// }, -// ), ), ), ); diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 2188d296..35fcf593 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -125,14 +125,6 @@ class _SearchByClinicState extends State { arrDistance.add(new DoctorList.fromJson(v) .projectDistanceInKiloMeters .toString()); - -// print(DoctorList -// .fromJson(v) -// .projectName); -// print(DoctorList -// .fromJson(v) -// .projectDistanceInKiloMeters); -// distinctIds = result.toSet().toList(); }); } else {} }); diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 3e817878..4fb55c7c 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -84,6 +84,10 @@ class _SearchByDoctorState extends State { getDoctorsList(BuildContext context) { List doctorsList = []; DoctorsListService service = new DoctorsListService(); + + List _patientDoctorAppointmentListHospital = + List(); + service .getDoctorsListByName(doctorNameController.text, context) .then((res) { @@ -93,9 +97,34 @@ class _SearchByDoctorState extends State { res['DoctorList'].forEach((v) { doctorsList.add(new DoctorList.fromJson(v)); }); + + doctorsList.forEach((element) { + List doctorByHospital = + _patientDoctorAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[ + _patientDoctorAppointmentListHospital + .indexOf(doctorByHospital[0])] + .patientDoctorAppointmentList + .add(element); + } else { + _patientDoctorAppointmentListHospital.add( + PatientDoctorAppointmentList( + filterName: element.projectName, + patientDoctorAppointment: element)); + } + }); } else {} }); - navigateToSearchResults(context, doctorsList); + + navigateToSearchResults( + context, doctorsList, _patientDoctorAppointmentListHospital); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -107,7 +136,7 @@ class _SearchByDoctorState extends State { _onDocTextChanged(content) { print(content); - if (content.length >= 4) { + if (content.length >= 3) { setState(() { _isButtonDisabled = false; }); @@ -123,10 +152,17 @@ class _SearchByDoctorState extends State { getDoctorsList(context); } - Future navigateToSearchResults(context, List docList) async { + Future navigateToSearchResults( + context, + List docList, + List + patientDoctorAppointmentListHospital) async { Navigator.push( context, MaterialPageRoute( - builder: (context) => SearchResults(doctorsList: docList))); + builder: (context) => SearchResults( + doctorsList: docList, + patientDoctorAppointmentListHospital: + patientDoctorAppointmentListHospital))); } } diff --git a/lib/pages/BookAppointment/widgets/BranchView.dart b/lib/pages/BookAppointment/widgets/BranchView.dart index 8ec0bbd5..6819c54b 100644 --- a/lib/pages/BookAppointment/widgets/BranchView.dart +++ b/lib/pages/BookAppointment/widgets/BranchView.dart @@ -82,13 +82,9 @@ class _ExpandableListViewState extends State { children: [ new Text( widget.result2[widget.val].toString() + - " " + - widget.resultDistance[widget.val] - .toString() != - "0" - ? getProjectDistance( - widget.resultDistance[widget.val].toString()) - : "", + " " + + getProjectDistance( + widget.resultDistance[widget.val].toString()), style: new TextStyle( fontWeight: FontWeight.bold, color: Colors.black), ), @@ -148,7 +144,11 @@ class _ExpandableListViewState extends State { } String getProjectDistance(String distance) { - return " - " + distance + " KM"; + if (distance != "0") + return " - " + distance + " KMs"; + else { + return ""; + } } } From a7f5dfab5c5f972a90f12fa46d45652dc4206ff5 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 2 Sep 2020 12:22:05 +0300 Subject: [PATCH 08/12] fixes --- lib/models/Appointments/DoctorListResponse.dart | 3 ++- lib/pages/BookAppointment/SearchResults.dart | 5 +++-- .../BookAppointment/components/SearchByDoctor.dart | 1 + .../appointment_services/GetDoctorsList.dart | 12 ++++++++++-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 8e1f0b35..66c0c855 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -169,10 +169,11 @@ class DoctorList { class PatientDoctorAppointmentList { String filterName = ""; + String distanceInKMs = ""; List patientDoctorAppointmentList = List(); PatientDoctorAppointmentList( - {this.filterName, DoctorList patientDoctorAppointment}) { + {this.filterName, this.distanceInKMs, DoctorList patientDoctorAppointment}) { patientDoctorAppointmentList.add(patientDoctorAppointment); } } diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index 8b9dd984..c52002b4 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -33,7 +33,7 @@ class _SearchResultsState extends State { appBarTitle: TranslationBase.of(context).bookAppo, isShowAppBar: true, body: Container( - margin: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.all(10.0), child: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Column( @@ -42,7 +42,8 @@ class _SearchResultsState extends State { widget.patientDoctorAppointmentListHospital.length, (index) => AppExpandableNotifier( title: widget - .patientDoctorAppointmentListHospital[index].filterName, + .patientDoctorAppointmentListHospital[index].filterName + " - " +widget + .patientDoctorAppointmentListHospital[index].distanceInKMs + " KMs" , bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 4fb55c7c..1e7deb38 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -117,6 +117,7 @@ class _SearchByDoctorState extends State { _patientDoctorAppointmentListHospital.add( PatientDoctorAppointmentList( filterName: element.projectName, + distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); } }); diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 27a66d43..61845095 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -79,12 +79,20 @@ class DoctorsListService extends BaseService { Future getDoctorsListByName(String docName, BuildContext context) async { Map request; + double lat; + double long; + if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson( await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } + if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { + lat = await this.sharedPref.getDouble(USER_LAT); + long = await this.sharedPref.getDouble(USER_LONG); + } + var languageID = await sharedPref.getString(APP_LANGUAGE); Request req = appGlobal.getPublicRequest(); request = { @@ -106,8 +114,8 @@ class DoctorsListService extends BaseService { "gender": authUser.gender != null ? authUser.gender : 0, "age": authUser.age != null ? authUser.age : 0, "IsGetNearAppointment": false, - "Latitude": 0, - "Longitude": 0, + "Latitude": lat, + "Longitude": long, "License": true }; From 1886f3a763a1e3444cb32d49b3f653fa6bfdc967 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 3 Sep 2020 10:12:05 +0300 Subject: [PATCH 09/12] implementing Dental Appointment flow --- lib/config/config.dart | 3 + lib/models/Appointments/SearchInfoModel.dart | 10 + .../BookAppointment/DentalComplaints.dart | 49 +++++ .../components/SearchByClinic.dart | 172 ++++++++++++++---- .../clinic_services/get_clinic_service.dart | 87 +++++++++ 5 files changed, 281 insertions(+), 40 deletions(-) create mode 100644 lib/models/Appointments/SearchInfoModel.dart create mode 100644 lib/pages/BookAppointment/DentalComplaints.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 91cc2eda..f3b05b6a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -69,6 +69,9 @@ const GET_QR_PARKING = '/Services/SWP.svc/REST/GetQRParkingByID'; //URL to get clinic list const GET_CLINICS_LIST_URL = "Services/lists.svc/REST/GetClinicCentralized"; +//URL to get projects list +const GET_PROJECTS_LIST = 'Services/Lists.svc/REST/GetProject'; + //URL to get doctors list const GET_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/SearchDoctorsByTime"; diff --git a/lib/models/Appointments/SearchInfoModel.dart b/lib/models/Appointments/SearchInfoModel.dart new file mode 100644 index 00000000..f5500bca --- /dev/null +++ b/lib/models/Appointments/SearchInfoModel.dart @@ -0,0 +1,10 @@ +class SearchInfo { + int ProjectID; + int ClinicID; + String DoctorName; + String SelectedDate; + String SelectedTime; + String currentLat; + String currentLong; + DateTime date; +} diff --git a/lib/pages/BookAppointment/DentalComplaints.dart b/lib/pages/BookAppointment/DentalComplaints.dart new file mode 100644 index 00000000..756aa8bf --- /dev/null +++ b/lib/pages/BookAppointment/DentalComplaints.dart @@ -0,0 +1,49 @@ +import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.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 DentalComplaints extends StatefulWidget { + SearchInfo searchInfo; + + DentalComplaints({@required this.searchInfo}); + + @override + _DentalComplaintsState createState() => _DentalComplaintsState(); +} + +class _DentalComplaintsState extends State { + @override + void initState() { + WidgetsBinding.instance + .addPostFrameCallback((_) => getChiefComplaintsList()); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: "Symptoms", + body: Container(), + ); + } + + getChiefComplaintsList() { + ClinicListService service = new ClinicListService(); + service + .getChiefComplaintsList( + widget.searchInfo.ClinicID, widget.searchInfo.ProjectID, context) + .then((res) { + if (res['MessageStatus'] == 1) { +// setState(() { +// res['List_DentalChiefComplain'].forEach((v) {}); +// }); + } else {} + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } +} diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 35fcf593..6ff05204 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -1,7 +1,10 @@ import "dart:collection"; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart'; import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/DentalComplaints.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; @@ -19,8 +22,11 @@ class SearchByClinic extends StatefulWidget { class _SearchByClinicState extends State { bool nearestAppo = false; String dropdownValue; + String projectDropdownValue; var event = RobotProvider(); List clinicsList = []; + List projectsList = []; + bool isMobileAppDentalAllow = false; @override void initState() { @@ -76,25 +82,91 @@ class _SearchByClinicState extends State { onChanged: (newValue) { setState(() { dropdownValue = newValue; - - getDoctorsList(context); + if (!isDentalSelectedAndSupported()) { + projectDropdownValue = ""; + getDoctorsList(context); + } }); }, ), )), + isDentalSelectedAndSupported() == true || nearestAppo + ? Container( + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Colors.grey[400], + width: 1.0, + ), + borderRadius: BorderRadius.circular(10), + ), + padding: EdgeInsets.all(8.0), + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.only(top: 15.0), + child: DropdownButtonHideUnderline( + child: DropdownButton( + hint: new Text("Select Project"), + value: projectDropdownValue, + items: projectsList.map((item) { + return new DropdownMenuItem( + value: item.mainProjectID.toString(), + child: new Text(item.name), + ); + }).toList(), + onChanged: (newValue) { + setState(() { + projectDropdownValue = newValue; + getDoctorsList(context); + }); + }, + ), + )) + : Container(), ], ), ); } + bool isDentalSelectedAndSupported() { + return dropdownValue != "" && + (dropdownValue == "17") && + isMobileAppDentalAllow; + } + getClinicsList() { ClinicListService service = new ClinicListService(); - service.getClinicsList(context).then((res) { + service + .getClinicsList(context) + .then((res) { + if (res['MessageStatus'] == 1) { + setState(() { + isMobileAppDentalAllow = res['ISMobileAppDentalAllow']; + res['ListClinicCentralized'].forEach((v) { + clinicsList.add(new ListClinicCentralized.fromJson(v)); + }); + }); + } else {} + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + getProjectsList(); + }); + } + + getProjectsList() { + ClinicListService service = new ClinicListService(); + service.getProjectsList(context).then((res) { if (res['MessageStatus'] == 1) { setState(() { - res['ListClinicCentralized'].forEach((v) { - clinicsList.add(new ListClinicCentralized.fromJson(v)); + res['ListProject'].forEach((v) { + projectsList.add(new HospitalsModel.fromJson(v)); }); + print(projectsList.length); }); } else {} }).catchError((err) { @@ -104,43 +176,65 @@ class _SearchByClinicState extends State { } getDoctorsList(BuildContext context) { - List doctorsList = []; + SearchInfo searchInfo = new SearchInfo(); + if (dropdownValue == "17") { + searchInfo.ProjectID = int.parse(projectDropdownValue); + searchInfo.ClinicID = int.parse(dropdownValue); + searchInfo.date = DateTime.now(); - List arr = []; - List arrDistance = []; - var distinctIds; - List result; - int numAll; - DoctorsListService service = new DoctorsListService(); - service.getDoctorsList(int.parse(dropdownValue), 0, context).then((res) { - if (res['MessageStatus'] == 1) { - setState(() { - if (res['DoctorList'].length != 0) { - print(res['DoctorList']); - doctorsList.clear(); - res['DoctorList'].forEach((v) { - doctorsList.add(new DoctorList.fromJson(v)); + navigateToDentalComplaints(context, searchInfo); + } else { + List doctorsList = []; + List arr = []; + List arrDistance = []; + List result; + int numAll; + DoctorsListService service = new DoctorsListService(); + service + .getDoctorsList( + int.parse(dropdownValue), + projectDropdownValue != "" ? int.parse(projectDropdownValue) : 0, + context) + .then((res) { + if (res['MessageStatus'] == 1) { + setState(() { + if (res['DoctorList'].length != 0) { + print(res['DoctorList']); + doctorsList.clear(); + res['DoctorList'].forEach((v) { + doctorsList.add(new DoctorList.fromJson(v)); - arr.add(new DoctorList.fromJson(v).projectName); - arrDistance.add(new DoctorList.fromJson(v) - .projectDistanceInKiloMeters - .toString()); - }); - } else {} - }); + arr.add(new DoctorList.fromJson(v).projectName); + arrDistance.add(new DoctorList.fromJson(v) + .projectDistanceInKiloMeters + .toString()); + }); + } else {} + }); - result = LinkedHashSet.from(arr).toList(); - numAll = result.length; + result = LinkedHashSet.from(arr).toList(); + numAll = result.length; - navigateToSearchResults( - context, doctorsList, result, numAll, arrDistance); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }).catchError((err) { - print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + navigateToSearchResults( + context, doctorsList, result, numAll, arrDistance); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + } + + Future navigateToDentalComplaints( + BuildContext context, SearchInfo searchInfo) async { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => DentalComplaints(searchInfo: searchInfo), + ), + ); } Future navigateToSearchResults( @@ -148,7 +242,6 @@ class _SearchByClinicState extends State { Navigator.push( context, MaterialPageRoute( -// builder: (context) => SearchResults(doctorsList: docList) builder: (context) => BranchView( doctorsList: docList, result: result, @@ -156,6 +249,5 @@ class _SearchByClinicState extends State { resultDistance: resultDistance), ), ); - //builder: (context) => SearchResults(doctorsList: docList))); } } diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 42c9754c..cb486762 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -1,13 +1,22 @@ 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 ClinicListService extends BaseService { AppSharedPreferences sharedPref = AppSharedPreferences(); AppGlobal appGlobal = new AppGlobal(); + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + double lat; + double long; + Future getClinicsList(context) async { Map request; var languageID = await sharedPref.getString(APP_LANGUAGE); @@ -34,4 +43,82 @@ class ClinicListService extends BaseService { }, body: request); return Future.value(localRes); } + + Future getProjectsList(context) async { + Map request; + 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": null + }; + + dynamic localRes; + + await baseAppClient.post(GET_PROJECTS_LIST, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future getChiefComplaintsList(int clinicID, int projectID, BuildContext context, + {doctorId}) async { + //Utils.showProgressDialog(context); + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + if (await this.sharedPref.getDouble(USER_LAT) != null && + await this.sharedPref.getDouble(USER_LONG) != null) { + lat = await this.sharedPref.getDouble(USER_LAT); + long = await this.sharedPref.getDouble(USER_LONG); + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "ClinicID": clinicID, + "ProjectID": projectID, + "SelectedDate": "", + "SelectedTime": "", + "License": true, + "VersionID": 5.6, + "Channel": 3, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "generalid": "Cs2020@2016\$2958", + "PatientOutSA": 0, + "SessionID": null, + "isDentalAllowedBackend": true, + "DeviceTypeID": 1, + "PatientID": 1, + "ContinueDentalPlan": true, + "IsSearchAppointmnetByClinicID": false + }; + + dynamic localRes; + + await baseAppClient.post(GET_DOCTORS_LIST_URL, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + } From 51078227ab9f0e3e423a50c324f327bdf2074707 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 3 Sep 2020 11:51:40 +0300 Subject: [PATCH 10/12] Dental appointment flow implemented --- lib/config/config.dart | 3 + lib/config/localized_values.dart | 3 +- lib/core/service/client/base_app_client.dart | 42 ++++-- .../DentalChiefComplaintsModel.dart | 48 +++++++ .../BookAppointment/DentalComplaints.dart | 41 +++++- lib/pages/BookAppointment/SearchResults.dart | 2 +- .../BookAppointment/widgets/BranchView.dart | 2 +- .../widgets/DentalComplaintCard.dart | 135 ++++++++++++++++++ .../clinic_services/get_clinic_service.dart | 78 +++++++--- lib/uitl/translations_delegate_base.dart | 2 + 10 files changed, 315 insertions(+), 41 deletions(-) create mode 100644 lib/models/Appointments/DentalChiefComplaintsModel.dart create mode 100644 lib/pages/BookAppointment/widgets/DentalComplaintCard.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index f3b05b6a..8cdd118b 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -75,6 +75,9 @@ const GET_PROJECTS_LIST = 'Services/Lists.svc/REST/GetProject'; //URL to get doctors list const GET_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/SearchDoctorsByTime"; +//URL to dental doctors list +const GET_DENTAL_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/Dental_DoctorChiefComplaintMapping"; + //URL to get doctor free slots const GET_DOCTOR_FREE_SLOTS = "Services/Doctors.svc/REST/GetDoctorFreeSlots"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 95398e23..d950f05d 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -374,5 +374,6 @@ const Map> localizedValues = { "gate":{"en":"Gate:","ar":"بوابة"}, "building":{"en":"Building:","ar":"المبنى"}, "branch":{"en":"Branch:","ar":"الفرع"}, - "emergencyServices":{"en":"Emergency Services:","ar":"خدمات الطوارئ"} + "emergencyServices":{"en":"Emergency Services:","ar":"خدمات الطوارئ"}, + "km":{"en":"KMs:","ar":"كم"}, }; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index f45fe22b..bc5c8a3f 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -2,14 +2,11 @@ import 'dart:convert'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:http/http.dart' as http; -import '../../../locator.dart'; import '../../../routes.dart'; AppSharedPreferences sharedPref = new AppSharedPreferences(); @@ -33,9 +30,11 @@ class BaseAppClient { 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; + if (body.containsKey('SetupID')) { + 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; @@ -46,16 +45,29 @@ class BaseAppClient { body['PatientOutSA'] = body.containsKey('PatientOutSA') ? body['PatientOutSA'] != null ? body['PatientOutSA'] : PATIENT_OUT_SA : PATIENT_OUT_SA; - body['isDentalAllowedBackend'] = IS_DENTAL_ALLOWED_BACKEND; + + if (body.containsKey('isDentalAllowedBackend')) { + body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') + ? body['isDentalAllowedBackend'] != null ? body['isDentalAllowedBackend'] : IS_DENTAL_ALLOWED_BACKEND + : IS_DENTAL_ALLOWED_BACKEND; + } + body['DeviceTypeID'] = DeviceTypeID; - body['PatientType'] = body.containsKey('PatientType') - ? body['PatientType'] != null ? body['PatientType'] : PATIENT_TYPE - : PATIENT_TYPE; - body['PatientTypeID'] = body.containsKey('PatientTypeID') - ? body['PatientTypeID'] != null - ? body['PatientTypeID'] - : PATIENT_TYPE_ID - : PATIENT_TYPE_ID; + + if (body.containsKey('PatientType')) { + body['PatientType'] = body.containsKey('PatientType') + ? body['PatientType'] != null ? body['PatientType'] : PATIENT_TYPE + : PATIENT_TYPE; + } + + if (body.containsKey('PatientTypeID')) { + body['PatientTypeID'] = body.containsKey('PatientTypeID') + ? body['PatientTypeID'] != null + ? body['PatientTypeID'] + : PATIENT_TYPE_ID + : PATIENT_TYPE_ID; + } + if (user != null) { body['TokenID'] = token; body['PatientID'] = diff --git a/lib/models/Appointments/DentalChiefComplaintsModel.dart b/lib/models/Appointments/DentalChiefComplaintsModel.dart new file mode 100644 index 00000000..c15b828a --- /dev/null +++ b/lib/models/Appointments/DentalChiefComplaintsModel.dart @@ -0,0 +1,48 @@ +class DentalChiefComplaintsModel { + List listDentalChiefComplain; + + DentalChiefComplaintsModel({this.listDentalChiefComplain}); + + DentalChiefComplaintsModel.fromJson(Map json) { + if (json['List_DentalChiefComplain'] != null) { + listDentalChiefComplain = new List(); + json['List_DentalChiefComplain'].forEach((v) { + listDentalChiefComplain.add(new ListDentalChiefComplain.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.listDentalChiefComplain != null) { + data['List_DentalChiefComplain'] = + this.listDentalChiefComplain.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ListDentalChiefComplain { + int projectID; + int iD; + String name; + String nameN; + + ListDentalChiefComplain({this.projectID, this.iD, this.name, this.nameN}); + + ListDentalChiefComplain.fromJson(Map json) { + projectID = json['ProjectID']; + iD = json['ID']; + name = json['Name']; + nameN = json['NameN']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['ID'] = this.iD; + data['Name'] = this.name; + data['NameN'] = this.nameN; + return data; + } +} diff --git a/lib/pages/BookAppointment/DentalComplaints.dart b/lib/pages/BookAppointment/DentalComplaints.dart index 756aa8bf..9d3da450 100644 --- a/lib/pages/BookAppointment/DentalComplaints.dart +++ b/lib/pages/BookAppointment/DentalComplaints.dart @@ -1,5 +1,10 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DentalChiefComplaintsModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DentalComplaintCard.dart'; +import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; @@ -14,6 +19,11 @@ class DentalComplaints extends StatefulWidget { } class _DentalComplaintsState extends State { + List complaintsList = []; + AppSharedPreferences sharedPref = AppSharedPreferences(); + bool isDataLoaded = false; + var languageID; + @override void initState() { WidgetsBinding.instance @@ -26,20 +36,43 @@ class _DentalComplaintsState extends State { return AppScaffold( isShowAppBar: true, appBarTitle: "Symptoms", - body: Container(), + body: Container( + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), + child: ListView.builder( + itemCount: complaintsList.length, + itemBuilder: (BuildContext context, int index) { + return Container( + margin: EdgeInsets.only(bottom: 10.0), + child: DentalComplaintCard( + listDentalChiefComplain: complaintsList[index], + languageID: languageID, + ), + ); + }, + ), + ), ); } + getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); + } + getChiefComplaintsList() { + getLanguageID(); ClinicListService service = new ClinicListService(); service .getChiefComplaintsList( widget.searchInfo.ClinicID, widget.searchInfo.ProjectID, context) .then((res) { if (res['MessageStatus'] == 1) { -// setState(() { -// res['List_DentalChiefComplain'].forEach((v) {}); -// }); + print(res['List_DentalChiefComplain']); + setState(() { + res['List_DentalChiefComplain'].forEach((v) { + complaintsList.add(new ListDentalChiefComplain.fromJson(v)); + }); + print(complaintsList.length); + }); } else {} }).catchError((err) { print(err); diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index c52002b4..2b5fac17 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -43,7 +43,7 @@ class _SearchResultsState extends State { (index) => AppExpandableNotifier( title: widget .patientDoctorAppointmentListHospital[index].filterName + " - " +widget - .patientDoctorAppointmentListHospital[index].distanceInKMs + " KMs" , + .patientDoctorAppointmentListHospital[index].distanceInKMs + " " + TranslationBase.of(context).km, bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/pages/BookAppointment/widgets/BranchView.dart b/lib/pages/BookAppointment/widgets/BranchView.dart index 6819c54b..88912a3f 100644 --- a/lib/pages/BookAppointment/widgets/BranchView.dart +++ b/lib/pages/BookAppointment/widgets/BranchView.dart @@ -145,7 +145,7 @@ class _ExpandableListViewState extends State { String getProjectDistance(String distance) { if (distance != "0") - return " - " + distance + " KMs"; + return " - " + distance + " " + TranslationBase.of(context).km; else { return ""; } diff --git a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart new file mode 100644 index 00000000..27f37d0a --- /dev/null +++ b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart @@ -0,0 +1,135 @@ +import 'package:diplomaticquarterapp/models/Appointments/DentalChiefComplaintsModel.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; + +// ignore: must_be_immutable +class DentalComplaintCard extends StatefulWidget { + final ListDentalChiefComplain listDentalChiefComplain; + var languageID; + + DentalComplaintCard( + {@required this.listDentalChiefComplain, this.languageID}); + + @override + _DentalComplaintCardState createState() => _DentalComplaintCardState(); +} + +class _DentalComplaintCardState extends State { + @override + Widget build(BuildContext context) { + return Container( + child: InkWell( + onTap: () { + getChiefComplaintsList(); + }, + child: Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + child: Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.85, + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + child: Text(widget.listDentalChiefComplain.name, + style: + TextStyle(fontSize: 16.0, color: Colors.black)), + ), + ], + ), + ), + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Icon(Icons.arrow_forward_ios, + size: 20.0, color: Colors.black54), + ], + ), + ), + ], + ), + ), + ), + ); + } + + getChiefComplaintsList() { + List doctorsList = []; + List _patientDoctorAppointmentListHospital = + List(); + + ClinicListService service = new ClinicListService(); + service + .getChiefComplaintDoctorList(widget.listDentalChiefComplain.iD, + widget.listDentalChiefComplain.projectID, context) + .then((res) { + if (res['MessageStatus'] == 1) { + print(res['List_DentalDoctorChiefComplaintMapping']); + setState(() { + doctorsList.clear(); + res['List_DentalDoctorChiefComplaintMapping'].forEach((v) { + doctorsList.add(new DoctorList.fromJson(v)); + }); + + doctorsList.forEach((element) { + List doctorByHospital = + _patientDoctorAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[ + _patientDoctorAppointmentListHospital + .indexOf(doctorByHospital[0])] + .patientDoctorAppointmentList + .add(element); + } else { + _patientDoctorAppointmentListHospital.add( + PatientDoctorAppointmentList( + filterName: element.projectName, + distanceInKMs: + element.projectDistanceInKiloMeters.toString(), + patientDoctorAppointment: element)); + } + }); + navigateToSearchResults( + context, doctorsList, _patientDoctorAppointmentListHospital); + }); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + Future navigateToSearchResults( + context, + List docList, + List + patientDoctorAppointmentListHospital) async { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SearchResults( + doctorsList: docList, + patientDoctorAppointmentListHospital: + patientDoctorAppointmentListHospital))); + } +} diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index cb486762..8cc1e469 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -37,10 +37,10 @@ class ClinicListService extends BaseService { await baseAppClient.post(GET_CLINICS_LIST_URL, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } @@ -64,14 +64,15 @@ class ClinicListService extends BaseService { await baseAppClient.post(GET_PROJECTS_LIST, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } - Future getChiefComplaintsList(int clinicID, int projectID, BuildContext context, + Future getChiefComplaintsList( + int clinicID, int projectID, BuildContext context, {doctorId}) async { //Utils.showProgressDialog(context); Map request; @@ -82,12 +83,6 @@ class ClinicListService extends BaseService { authUser = data; } - if (await this.sharedPref.getDouble(USER_LAT) != null && - await this.sharedPref.getDouble(USER_LONG) != null) { - lat = await this.sharedPref.getDouble(USER_LAT); - long = await this.sharedPref.getDouble(USER_LONG); - } - var languageID = await sharedPref.getString(APP_LANGUAGE); Request req = appGlobal.getPublicRequest(); request = { @@ -114,11 +109,56 @@ class ClinicListService extends BaseService { await baseAppClient.post(GET_DOCTORS_LIST_URL, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } + Future getChiefComplaintDoctorList( + int chiefComplaintID, int projectID, BuildContext context, + {doctorId}) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + if (await this.sharedPref.getDouble(USER_LAT) != null && + await this.sharedPref.getDouble(USER_LONG) != null) { + lat = await this.sharedPref.getDouble(USER_LAT); + long = await this.sharedPref.getDouble(USER_LONG); + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "ChiefComplaintID": chiefComplaintID, + "ProjectID": projectID, + "VersionID": 5.6, + "Channel": 3, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": 0, + "SessionID": null, + "isDentalAllowedBackend": true, + "Latitude": lat.toString(), + "Longitude": long.toString(), + "DeviceTypeID": 1 + }; + + dynamic localRes; + + await baseAppClient.post(GET_DENTAL_DOCTORS_LIST_URL, + 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 d9fc04bc..3b3e581d 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -452,6 +452,8 @@ class TranslationBase { localizedValues['textToSpeech'][locale.languageCode]; String get locationDialogMessage => localizedValues['locationDialogMessage'][locale.languageCode]; + String get km => + localizedValues['km'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From ce9903fd13f427671ee29c4916b16c84707bea11 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 3 Sep 2020 12:13:15 +0300 Subject: [PATCH 11/12] nearest appointment flow implemented --- .../components/SearchByClinic.dart | 7 ++-- .../BookAppointment/widgets/DoctorView.dart | 36 ++++++++++++++++++- .../appointment_services/GetDoctorsList.dart | 13 ++++--- lib/widgets/others/bottom_bar.dart | 2 +- 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 6ff05204..6b3eff38 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -82,7 +82,7 @@ class _SearchByClinicState extends State { onChanged: (newValue) { setState(() { dropdownValue = newValue; - if (!isDentalSelectedAndSupported()) { + if (!isDentalSelectedAndSupported() && !nearestAppo) { projectDropdownValue = ""; getDoctorsList(context); } @@ -194,6 +194,7 @@ class _SearchByClinicState extends State { .getDoctorsList( int.parse(dropdownValue), projectDropdownValue != "" ? int.parse(projectDropdownValue) : 0, + nearestAppo, context) .then((res) { if (res['MessageStatus'] == 1) { @@ -248,6 +249,8 @@ class _SearchByClinicState extends State { num: numAll, resultDistance: resultDistance), ), - ); + ).then((value) { + getProjectsList(); + }); } } diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index e8f08af5..67c536c4 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; @@ -39,7 +40,7 @@ class DoctorView extends StatelessWidget { fit: BoxFit.fill, height: 60.0, width: 60.0), ), Container( - width: MediaQuery.of(context).size.width * 0.5, + width: MediaQuery.of(context).size.width * 0.55, margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -74,6 +75,16 @@ class DoctorView extends StatelessWidget { color: Colors.grey[600], letterSpacing: 1.0)), ), + this.doctor.nearestFreeSlot != null ? Container( + margin: EdgeInsets.only(top: 3.0, bottom: 3.0), + child: Text( + getDate(this.doctor.nearestFreeSlot), + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.bold, + color: Colors.green[600], + letterSpacing: 1.0)), + ) : Container(), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, @@ -136,6 +147,29 @@ class DoctorView extends StatelessWidget { }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } + String getDate(String date) { + DateTime dateObj = DateUtil.convertStringToDate(date); + return DateUtil.getWeekDay(dateObj.weekday) + + ", " + + dateObj.day.toString() + + " " + + DateUtil.getMonth(dateObj.month) + + " " + + dateObj.year.toString() + + " " + + dateObj.hour.toString() + + ":" + + getMinute(dateObj); + } + + String getMinute(DateTime dateObj) { + if(dateObj.minute == 0) { + return dateObj.minute.toString() + "0"; + } else { + return dateObj.minute.toString(); + } + } + Future navigateToDoctorProfile(context, docObject, docProfile, {isAppo}) async { Navigator.push( diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 61845095..c992e8e9 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 { @@ -23,7 +22,8 @@ class DoctorsListService extends BaseService { double lat; double long; - Future getDoctorsList(int clinicID, int projectID, BuildContext context, + Future getDoctorsList( + int clinicID, int projectID, bool isNearest, BuildContext context, {doctorId}) async { //Utils.showProgressDialog(context); Map request; @@ -34,7 +34,8 @@ class DoctorsListService extends BaseService { authUser = data; } - if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { + if (await this.sharedPref.getDouble(USER_LAT) != null && + await this.sharedPref.getDouble(USER_LONG) != null) { lat = await this.sharedPref.getDouble(USER_LAT); long = await this.sharedPref.getDouble(USER_LONG); } @@ -62,6 +63,9 @@ class DoctorsListService extends BaseService { "IsGetNearAppointment": false, "Latitude": lat.toString(), "Longitude": long.toString(), + "IsGetNearAppointment": isNearest, + if (isNearest) + "SelectedDate": DateUtil.convertDateToString(DateTime.now()), "License": true }; @@ -88,7 +92,8 @@ class DoctorsListService extends BaseService { authUser = data; } - if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { + if (await this.sharedPref.getDouble(USER_LAT) != null && + await this.sharedPref.getDouble(USER_LONG) != null) { lat = await this.sharedPref.getDouble(USER_LAT); long = await this.sharedPref.getDouble(USER_LONG); } diff --git a/lib/widgets/others/bottom_bar.dart b/lib/widgets/others/bottom_bar.dart index 32df2dfc..d0fc01f6 100644 --- a/lib/widgets/others/bottom_bar.dart +++ b/lib/widgets/others/bottom_bar.dart @@ -312,7 +312,7 @@ class _SearchBot extends State { List doctorsList = []; DoctorsListService service = new DoctorsListService(); service - .getDoctorsList(clinicId, projectId, context, doctorId: doctorName) + .getDoctorsList(clinicId, projectId, false, context, doctorId: doctorName) .then((res) { if (res['MessageStatus'] == 1) { setState(() { From 3e5ef26b29225e83fd4a651c7a72f62bd6bc3695 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 3 Sep 2020 14:03:31 +0300 Subject: [PATCH 12/12] my appointment sorting implemented --- .../AppoimentAllHistoryResultList.dart | 10 + lib/pages/MyAppointments/MyAppointments.dart | 239 ++++++++++++++---- .../widgets/AppointmentCardView.dart | 4 +- 3 files changed, 207 insertions(+), 46 deletions(-) diff --git a/lib/models/Appointments/AppoimentAllHistoryResultList.dart b/lib/models/Appointments/AppoimentAllHistoryResultList.dart index a935542a..9ba1fb8e 100644 --- a/lib/models/Appointments/AppoimentAllHistoryResultList.dart +++ b/lib/models/Appointments/AppoimentAllHistoryResultList.dart @@ -272,3 +272,13 @@ class AppoitmentAllHistoryResultList { return data; } } + +class PatientAppointmentList { + String filterName = ""; + List patientDoctorAppointmentList = List(); + + PatientAppointmentList( + {this.filterName, AppoitmentAllHistoryResultList patientDoctorAppointment}) { + patientDoctorAppointmentList.add(patientDoctorAppointment); + } +} diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 63034373..699990ac 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/AppointmentCar 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/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; @@ -15,6 +16,13 @@ class MyAppointments extends StatefulWidget { List confirmedAppoList = []; List arrivedAppoList = []; + List _patientBookedAppointmentListHospital = List(); + + List _patientConfirmedAppointmentListHospital = + List(); + + List _patientArrivedAppointmentListHospital = List(); + @override _MyAppointmentsState createState() => _MyAppointmentsState(); } @@ -40,7 +48,6 @@ class _MyAppointmentsState extends State isShowAppBar: true, body: Container( child: Column(children: [ - /// this is will not colored with theme data TabBar( tabs: [ Tab(text: TranslationBase.of(context).booked), @@ -94,7 +101,8 @@ class _MyAppointmentsState extends State } }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } bool isConfirmed(AppoitmentAllHistoryResultList appo) { @@ -123,64 +131,176 @@ class _MyAppointmentsState extends State widget.arrivedAppoList.add(v); } }); + + widget.bookedAppoList.forEach((element) { + List doctorByHospital = + widget._patientBookedAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.clinicName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + widget + ._patientBookedAppointmentListHospital[widget + ._patientBookedAppointmentListHospital + .indexOf(doctorByHospital[0])] + .patientDoctorAppointmentList + .add(element); + } else { + widget._patientBookedAppointmentListHospital.add(PatientAppointmentList( + filterName: element.clinicName, patientDoctorAppointment: element)); + } + }); + + widget.confirmedAppoList.forEach((element) { + List doctorByHospital = + widget._patientConfirmedAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.clinicName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + widget + ._patientConfirmedAppointmentListHospital[widget + ._patientConfirmedAppointmentListHospital + .indexOf(doctorByHospital[0])] + .patientDoctorAppointmentList + .add(element); + } else { + widget._patientConfirmedAppointmentListHospital.add( + PatientAppointmentList( + filterName: element.clinicName, + patientDoctorAppointment: element)); + } + }); + + widget.arrivedAppoList.forEach((element) { + List doctorByHospital = + widget._patientArrivedAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.clinicName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + widget + ._patientArrivedAppointmentListHospital[widget + ._patientArrivedAppointmentListHospital + .indexOf(doctorByHospital[0])] + .patientDoctorAppointmentList + .add(element); + } else { + widget._patientArrivedAppointmentListHospital.add( + PatientAppointmentList( + filterName: element.clinicName, + patientDoctorAppointment: element)); + } + }); } openAppointmentsTab() { if (widget.bookedAppoList.length != 0) { - _tabController.animateTo((_tabController.index + 1) % 1); + _tabController.index = 0; } else if (widget.confirmedAppoList.length != 0) { - _tabController.animateTo((_tabController.index + 1) % 2); + _tabController.index = 1; } else if (widget.arrivedAppoList.length != 0) { - _tabController.animateTo((_tabController.index + 1) % 3); + _tabController.index = 2; return; } } Widget getBookedAppointments() { return Container( - child: widget.bookedAppoList.length != 0 - ? new ListView.builder( - itemCount: widget.bookedAppoList.length, - itemBuilder: (context, i) { - return AppointmentCard( - appo: widget.bookedAppoList[i], - onReloadAppointmentHistory: getPatientAppointmentHistory, - ); - }, - ) - : Container( - child: Center( + margin: EdgeInsets.only(top: 10.0), + child: Container( + child: widget.bookedAppoList.length != 0 + ? SingleChildScrollView( + physics: BouncingScrollPhysics(), child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, children: [ - Image.asset( - "assets/images/new-design/noAppointmentIcon.png"), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("No Booked Appointments", - style: TextStyle( - fontSize: 16.0, + ...List.generate( + widget._patientBookedAppointmentListHospital.length, + (index) => AppExpandableNotifier( + title: widget + ._patientBookedAppointmentListHospital[index] + .filterName, + bodyWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: widget + ._patientBookedAppointmentListHospital[index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), )), - ), + ) ], ), + ) + : Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/images/new-design/noAppointmentIcon.png"), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text("No Booked Appointments", + style: TextStyle( + fontSize: 16.0, + )), + ), + ], + ), + ), ), - ), + ), ); } Widget getConfirmedAppointments() { return widget.confirmedAppoList.length != 0 ? Container( - child: new ListView.builder( - itemCount: widget.confirmedAppoList.length, - itemBuilder: (context, i) { - return AppointmentCard( - appo: widget.confirmedAppoList[i], - onReloadAppointmentHistory: getPatientAppointmentHistory, - ); - }, + margin: EdgeInsets.only(top: 10.0), + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + ...List.generate( + widget._patientConfirmedAppointmentListHospital.length, + (index) => AppExpandableNotifier( + title: widget + ._patientConfirmedAppointmentListHospital[index] + .filterName, + bodyWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: widget + ._patientConfirmedAppointmentListHospital[index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), + )), + ) + ], + ), ), ) : Container( @@ -206,16 +326,47 @@ class _MyAppointmentsState extends State Widget getArrivedAppointments() { return widget.arrivedAppoList.length != 0 ? Container( - child: new ListView.builder( - itemCount: widget.arrivedAppoList.length, - itemBuilder: (context, i) { - return AppointmentCard( - appo: widget.arrivedAppoList[i], - onReloadAppointmentHistory: getPatientAppointmentHistory, - ); - }, + margin: EdgeInsets.only(top: 10.0), + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + ...List.generate( + widget._patientArrivedAppointmentListHospital.length, + (index) => AppExpandableNotifier( + title: widget + ._patientArrivedAppointmentListHospital[index] + .filterName, + bodyWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: widget + ._patientArrivedAppointmentListHospital[index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), + )), + ) + ], + ), ), ) +// Container( +// child: new ListView.builder( +// itemCount: widget.arrivedAppoList.length, +// itemBuilder: (context, i) { +// return AppointmentCard( +// appo: widget.arrivedAppoList[i], +// onReloadAppointmentHistory: getPatientAppointmentHistory, +// ); +// }, +// ), +// ) : Container( child: Center( child: Column( diff --git a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart index e2f6f706..b64bd232 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart @@ -42,7 +42,7 @@ class _ApointmentCardState extends State { fit: BoxFit.fill, height: 60.0, width: 60.0), ), Container( - width: MediaQuery.of(context).size.width * 0.6, + width: MediaQuery.of(context).size.width * 0.57, margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -95,7 +95,7 @@ class _ApointmentCardState extends State { emptyIcon: Icons.star, ), Container( - transform: Matrix4.translationValues(0.0, -40.0, 0.0), + transform: Matrix4.translationValues(15.0, -40.0, 0.0), child: Image.asset( "assets/images/new-design/arrow.png", width: 25.0,