diff --git a/lib/config/config.dart b/lib/config/config.dart index 6549ada5..4dcc13dc 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -77,6 +77,7 @@ const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles'; const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin'; const END_CALL = 'LiveCareApi/DoctorApp/EndCall'; const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge'; +const GET_DASHBOARD = 'DoctorApplication.svc/REST/GetDoctorDashboardKPI'; var selectedPatientType = 1; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 18b58c28..b4c4c374 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -8,3 +8,4 @@ final APP_Language = 'language'; final DOCTOR_PROFILE = 'doctorProfile'; final LIVE_CARE_PATIENT = 'livecare-patient-profile'; final LOGGED_IN_USER = 'loggedUser'; +final DASHBOARD_DATA = 'dashboard-data'; diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dart index eaca545d..67dc45e6 100644 --- a/lib/providers/auth_provider.dart +++ b/lib/providers/auth_provider.dart @@ -17,17 +17,16 @@ class AuthProvider with ChangeNotifier { bool isLoading = true; DoctorProfileModel doctorProfile; BaseAppClient baseAppClient = BaseAppClient(); - setDoctorProfile(DoctorProfileModel profileModel){ + setDoctorProfile(DoctorProfileModel profileModel) { doctorProfile = profileModel; notifyListeners(); } - AuthProvider() { getUserAuthentication(); } - getUserAuthentication() async { + getUserAuthentication() async { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); if (profile != null) { doctorProfile = new DoctorProfileModel.fromJson(profile); @@ -154,7 +153,8 @@ class AuthProvider with ChangeNotifier { await baseAppClient.post(GET_DOC_PROFILES, onSuccess: (dynamic response, int statusCode) { localRes = response; - doctorProfile = DoctorProfileModel.fromJson(response['DoctorProfileList'][0]); + doctorProfile = + DoctorProfileModel.fromJson(response['DoctorProfileList'][0]); selectedClinicName = response['DoctorProfileList'][0]['ClinicDescription']; }, onFailure: (String error, int statusCode) { @@ -167,4 +167,21 @@ class AuthProvider with ChangeNotifier { throw error; } } + + Future getDashboard(docInfo) async { + try { + dynamic localRes; + await baseAppClient.post(GET_DASHBOARD, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: {"DoctorID": docInfo.doctorID}); + notifyListeners(); + return Future.value(localRes); + } catch (error) { + print(error); + throw error; + } + } } diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 8a43a42f..461ea5bc 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -363,7 +363,7 @@ class _VerifyAccountState extends State { "IsSilentLogIN": false }; - authProv.memberCheckActivationCodeNew(model).then((res) async{ + authProv.memberCheckActivationCodeNew(model).then((res) async { if (res['MessageStatus'] == 1) { sharedPref.setString(TOKEN, res['AuthenticationTokenID']); if (res['List_DoctorProfile'] != null) { @@ -394,12 +394,18 @@ class _VerifyAccountState extends State { */ loginProcessCompleted( Map profile, Function changeLoadingStata) { - var doctor = DoctorProfileModel.fromJson(profile); - authProv.setDoctorProfile(doctor); + var doctor = DoctorProfileModel.fromJson(profile); + authProv.setDoctorProfile(doctor); + this.getDashboard(doctor, changeLoadingStata); + } + getDashboard(doctor, Function changeLoadingStata) { + // authProv.getDashboard(doctor).then((value) { + // print(value); changeLoadingStata(false); - sharedPref.setObj(DOCTOR_PROFILE, profile); + // sharedPref.setObj(DASHBOARD_DATA, value); Navigator.of(context).pushReplacementNamed(HOME); + // }); } Future _asyncSimpleDialog( diff --git a/pubspec.yaml b/pubspec.yaml index bdda7810..038ad335 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,7 +14,7 @@ description: A new Flutter project. version: 1.0.0+1 environment: - sdk: ">=2.6.0 <3.0.0" + sdk: ">=2.8.0 <3.0.0" dependencies: flutter: @@ -50,7 +50,7 @@ dependencies: cupertino_icons: ^0.1.2 # SVG #flutter_svg: ^0.17.4 - percent_indicator: "^2.1.1" + percent_indicator: ^2.1.1 #Dependency Injection get_it: ^4.0.2 @@ -80,7 +80,7 @@ flutter: assets: - assets/images/ - assets/images/dashboard/ - # - images/a_dot_ham.jpeg + # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware.