Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into development

 Conflicts:
	lib/screens/dashboard_screen.dart
merge-requests/149/head
Mohammad ALjammal 6 years ago
commit d4b3e42070

@ -16,6 +16,8 @@ const PATIENT_REFER_TO_DOCTOR_URL =
"Services/DoctorApplication.svc/REST/ReferToDoctor"; "Services/DoctorApplication.svc/REST/ReferToDoctor";
const PATIENT_GET_DOCTOR_BY_CLINIC_URL = const PATIENT_GET_DOCTOR_BY_CLINIC_URL =
"Services/DoctorApplication.svc/REST/GetDoctorsByClinicID"; "Services/DoctorApplication.svc/REST/GetDoctorsByClinicID";
const GET_CLINICS_FOR_DOCTOR =
'Services/DoctorApplication.svc/REST/GetClinicsForDoctor';
const PATIENT_GET_LIST_REFERAL_URL = const PATIENT_GET_LIST_REFERAL_URL =
"Services/Lists.svc/REST/GetList_STPReferralFrequency"; "Services/Lists.svc/REST/GetList_STPReferralFrequency";
const PATIENT_GET_CLINIC_BY_PROJECT_URL = const PATIENT_GET_CLINIC_BY_PROJECT_URL =
@ -35,23 +37,43 @@ const START_LIVECARE_CALL = 'LiveCareApi/DoctorApp/CallPatient';
const LIVE_CARE_STATISTICS_FOR_CERTAIN_DOCTOR_URL = const LIVE_CARE_STATISTICS_FOR_CERTAIN_DOCTOR_URL =
"Lists.svc/REST/DashBoard_GetLiveCareDoctorsStatsticsForCertainDoctor"; "Lists.svc/REST/DashBoard_GetLiveCareDoctorsStatsticsForCertainDoctor";
const GET_PRESCRIPTION_REPORT = 'Services/Patients.svc/REST/GetPrescriptionReport'; const GET_PRESCRIPTION_REPORT =
'Services/Patients.svc/REST/GetPrescriptionReport';
const GT_MY_PATIENT_QUESTION = 'Services/DoctorApplication.svc/REST/GtMyPatientsQuestions'; const GT_MY_PATIENT_QUESTION =
'Services/DoctorApplication.svc/REST/GtMyPatientsQuestions';
const GET_PATIENT = 'Services/DoctorApplication.svc/REST/'; const GET_PATIENT = 'Services/DoctorApplication.svc/REST/';
const GET_PRESCRIPTION_REPORT_FOR_IN_PATIENT= 'Services/DoctorApplication.svc/REST/GetPrescriptionReportForInPatient'; const GET_PRESCRIPTION_REPORT_FOR_IN_PATIENT =
'Services/DoctorApplication.svc/REST/GetPrescriptionReportForInPatient';
const GET_MY_REFERRAL_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferralPatient'; const GET_MY_REFERRAL_PATIENT =
'Services/DoctorApplication.svc/REST/GtMyReferralPatient';
const ADD_REFERRED_DOCTOR_REMARKS= 'Services/DoctorApplication.svc/REST/AddReferredDoctorRemarks'; const ADD_REFERRED_DOCTOR_REMARKS =
'Services/DoctorApplication.svc/REST/AddReferredDoctorRemarks';
const GET_MY_REFERRED_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredPatient'; const GET_MY_REFERRED_PATIENT =
'Services/DoctorApplication.svc/REST/GtMyReferredPatient';
const GET_DOCTOR_WORKING_HOURS_TABLE = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; const GET_DOCTOR_WORKING_HOURS_TABLE =
'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable';
const GET_PATIENT_LAB_RESULTS= 'Services/DoctorApplication.svc/REST/GetPatientLabResults'; const GET_PATIENT_LAB_RESULTS =
'Services/DoctorApplication.svc/REST/GetPatientLabResults';
const LOGIN_URL = 'Services/Sentry.svc/REST/MemberLogIN_New';
const INSERT_DEVICE_IMEI =
'Services/Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI';
const SELECT_DEVICE_IMEI =
'Services/Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI';
const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE =
'Services/Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType';
const MEMBER_CHECK_ACTIVATION_CODE_NEW =
'Services/Sentry.svc/REST/MemberCheckActivationCode_New';
const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles';
var selectedPatientType = 1; var selectedPatientType = 1;

@ -213,5 +213,7 @@ const Map<String, Map<String, String>> localizedValues = {
}, },
'livecare': {'en': 'Live Care', 'ar': 'Live Care'}, 'livecare': {'en': 'Live Care', 'ar': 'Live Care'},
'beingBad': {'en': 'being bad', 'ar': 'سيء'}, 'beingBad': {'en': 'being bad', 'ar': 'سيء'},
'beingGreat': {'en': 'being great', 'ar': 'راثع'}, 'beingGreat': {'en': 'being great', 'ar': 'رائع'},
'cancel': {'en': 'CANCEL', 'ar': 'الغاء'},
'done': {'en': 'DONE', 'ar': 'تأكيد'},
}; };

@ -8,6 +8,7 @@ import 'package:http_interceptor/http_interceptor.dart';
import '../providers/auth_provider.dart'; import '../providers/auth_provider.dart';
import '../util/dr_app_shared_pref.dart'; import '../util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/config/config.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
List<String> publicUrls = [ List<String> publicUrls = [
@ -18,10 +19,9 @@ List<String> publicUrls = [
]; ];
class HttpInterceptor extends InterceptorContract { class HttpInterceptor extends InterceptorContract {
Client getClient() {
Client getClient(){ return HttpClientWithInterceptor.build(interceptors: [this]);
return HttpClientWithInterceptor.build(interceptors: [this]); }
}
Future<RequestData> interceptRequest({RequestData data}) async { Future<RequestData> interceptRequest({RequestData data}) async {
print('RequestData ${data.body}'); print('RequestData ${data.body}');
@ -29,26 +29,26 @@ class HttpInterceptor extends InterceptorContract {
try { try {
data.headers["Content-Type"] = "application/json"; data.headers["Content-Type"] = "application/json";
data.headers["Accept"] = "application/json"; data.headers["Accept"] = "application/json";
// if (publicUrls.contains(data.url)) { // if (publicUrls.contains(data.url)) {
// var loggedUserInfo = await sharedPref.getObj('loggedUser'); // var loggedUserInfo = await sharedPref.getObj('loggedUser');
// var token = await sharedPref.getString(TOKEN); // var token = await sharedPref.getString(TOKEN);
// // print("token"+token); // // print("token"+token);
// // print('loggedUserInfo${loggedUserInfo["LogInTokenID"]}'); // // print('loggedUserInfo${loggedUserInfo["LogInTokenID"]}');
// // // the sevices handel the token in differat name so I ask to be change // // // the sevices handel the token in differat name so I ask to be change
// // // we must change the imple // // // we must change the imple
// var body = json.decode(data.body); // var body = json.decode(data.body);
// body['LogInTokenID']=token; // body['LogInTokenID']=token;
// data.body = json.encode(body); // data.body = json.encode(body);
// // data.body['LogInTokenID'] = ''; // // data.body['LogInTokenID'] = '';
// } else { // } else {
// if (data.body['LogInTokenID']) { // if (data.body['LogInTokenID']) {
// data.body['LogInTokenID'] = ''; // data.body['LogInTokenID'] = '';
// } // }
// if (data.body['TokenID']) { // if (data.body['TokenID']) {
// data.body['TokenID'] = ''; // data.body['TokenID'] = '';
// } // }
// } // }
} catch (e) { } catch (e) {
print(e); print(e);
} }

@ -3,21 +3,10 @@ import 'package:doctor_app_flutter/models/doctor/clinic_model.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:doctor_app_flutter/config/config.dart';
import '../models/doctor/user_model.dart'; import '../models/doctor/user_model.dart';
const LOGIN_URL = 'Services/Sentry.svc/REST/MemberLogIN_New';
const INSERT_DEVICE_IMEI =
'Services/Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI';
const SELECT_DEVICE_IMEI =
'Services/Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI';
const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE =
'Services/Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType';
const MEMBER_CHECK_ACTIVATION_CODE_NEW =
'Services/Sentry.svc/REST/MemberCheckActivationCode_New';
const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED }
@ -166,11 +155,12 @@ class AuthProvider with ChangeNotifier {
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
localRes = response; localRes = response;
//ClinicDescription //ClinicDescription
selectedClinicName = response['DoctorProfileList'][0]['ClinicDescription']; selectedClinicName =
response['DoctorProfileList'][0]['ClinicDescription'];
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
throw error; throw error;
}, body: docInfo); }, body: docInfo);
notifyListeners(); notifyListeners();
return Future.value(localRes); return Future.value(localRes);
} catch (error) { } catch (error) {
print(error); print(error);

@ -1,8 +1,10 @@
import 'dart:async'; import 'dart:async';
import 'package:connectivity/connectivity.dart'; import 'package:connectivity/connectivity.dart';
import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/models/doctor/clinic_model.dart';
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart';
import 'package:doctor_app_flutter/providers/auth_provider.dart'; import 'package:doctor_app_flutter/providers/auth_provider.dart';
@ -10,6 +12,7 @@ import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
Helpers helpers = Helpers(); Helpers helpers = Helpers();
class ProjectProvider with ChangeNotifier { class ProjectProvider with ChangeNotifier {
@ -18,12 +21,15 @@ class ProjectProvider with ChangeNotifier {
String currentLanguage = 'ar'; String currentLanguage = 'ar';
bool _isArabic = false; bool _isArabic = false;
bool isInternetConnection = true; bool isInternetConnection = true;
List<ClinicModel> doctorClinicsList = [];
bool isLoading = false;
bool isError = false;
String error = '';
Locale get appLocal => _appLocale; Locale get appLocal => _appLocale;
bool get isArabic => _isArabic; bool get isArabic => _isArabic;
StreamSubscription subscription; StreamSubscription subscription;
// AuthProvider authProvider = AuthProvider();
ProjectProvider() { ProjectProvider() {
loadSharedPrefLanguage(); loadSharedPrefLanguage();
@ -66,17 +72,44 @@ class ProjectProvider with ChangeNotifier {
currentLanguage = 'en'; currentLanguage = 'en';
sharedPref.setString(APP_Language, 'en'); sharedPref.setString(APP_Language, 'en');
} }
getProfile(); callServicesAfterChangeLang();
notifyListeners(); notifyListeners();
} }
callServicesAfterChangeLang() {
getProfile();
getDoctorClinicsList();
}
@override @override
void dispose() { void dispose() {
if (subscription != null) subscription.cancel(); if (subscription != null) subscription.cancel();
super.dispose(); super.dispose();
} }
void getProfile()async{ Future<dynamic> getDoctorClinicsList() async {
try {
dynamic localRes;
await BaseAppClient.post(GET_CLINICS_FOR_DOCTOR,
onSuccess: (dynamic response, int statusCode) {
doctorClinicsList = [];
response['List_DoctorsClinic'].forEach((v) {
doctorClinicsList.add(new ClinicModel.fromJson(v));
});
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: {});
return Future.value(localRes);
} catch (error) {
print(error);
throw error;
}
}
void getProfile() async {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile);
ProfileReqModel docInfo = new ProfileReqModel( ProfileReqModel docInfo = new ProfileReqModel(
@ -87,13 +120,12 @@ class ProjectProvider with ChangeNotifier {
tokenID: '', tokenID: '',
languageID: 2); languageID: 2);
Provider.of<AuthProvider>(AppGlobal.CONTEX,listen: false) Provider.of<AuthProvider>(AppGlobal.CONTEX, listen: false)
.getDocProfiles(docInfo.toJson()).then((res) async { .getDocProfiles(docInfo.toJson())
.then((res) async {
sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]); sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]);
}).catchError((err) { }).catchError((err) {
print(err); print(err);
}); });
} }
} }

@ -54,6 +54,17 @@ class _DashboardScreenState extends State<DashboardScreen> {
AuthProvider authProvider; AuthProvider authProvider;
bool isLoading = false; bool isLoading = false;
ProjectProvider projectsProvider; ProjectProvider projectsProvider;
var _isInit = true;
void didChangeDependencies() {
super.didChangeDependencies();
if (_isInit) {
projectsProvider = Provider.of<ProjectProvider>(context);
projectsProvider.getDoctorClinicsList();
}
_isInit = false;
}
BuildContext myContext; BuildContext myContext;
GlobalKey _one = GlobalKey(); GlobalKey _one = GlobalKey();
@ -64,7 +75,6 @@ class _DashboardScreenState extends State<DashboardScreen> {
hospitalProvider = Provider.of(context); hospitalProvider = Provider.of(context);
authProvider = Provider.of(context); authProvider = Provider.of(context);
projectsProvider = Provider.of(context); projectsProvider = Provider.of(context);
print(authProvider.doctorsClinicList);
FocusScopeNode currentFocus = FocusScope.of(context); FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) { if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus(); currentFocus.unfocus();
@ -95,7 +105,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: SizeConfig.textMultiplier * 2.5, fontSize: SizeConfig.textMultiplier * 2.5,
), ),
alignment: Alignment.centerLeft, alignment: projectsProvider.isArabic
? Alignment.topRight
: Alignment.topLeft,
), ),
), ),
Row( Row(
@ -106,8 +118,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
InkWell( InkWell(
onTap: () async { onTap: () async {
showCupertinoPicker( showCupertinoPicker(
context: context, decKey: '',context: context,
actionList: authProvider.doctorsClinicList); actionList: projectsProvider.doctorClinicsList);
}, },
child: Container( child: Container(
margin: margin:
@ -304,7 +316,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
TranslationBase.of(context).patientServices, TranslationBase.of(context).patientServices,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
alignment: Alignment.centerLeft, alignment: projectsProvider.isArabic
? Alignment.topRight
: Alignment.topLeft,
), ),
), ),
Expanded( Expanded(
@ -532,19 +546,17 @@ class _DashboardScreenState extends State<DashboardScreen> {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
CupertinoButton( CupertinoButton(
child: Text( child: Text(TranslationBase.of(context).cancel
'Cancel'.toUpperCase(), // style: TextStyle(context)
// style: TextStyle(context) ),
),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
CupertinoButton( CupertinoButton(
child: Text( child: Text(TranslationBase.of(context).done
'Done'.toUpperCase(), // style: textStyle(context),
// style: textStyle(context), ),
),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
// onSelectFun(cupertinoPickerIndex); // onSelectFun(cupertinoPickerIndex);
@ -558,14 +570,19 @@ class _DashboardScreenState extends State<DashboardScreen> {
color: Color(0xfff7f7f7), color: Color(0xfff7f7f7),
child: Column( child: Column(
children: actionList children: actionList
.map((e) => Container( .map((e) => Flexible(
child: InkWell( child: Container(
onTap: () => child: InkWell(
changeClinic(e.clinicID, context), onTap: () =>
child: Text( changeClinic(e.clinicID, context),
e.clinicName, child: Text(
style: TextStyle(fontSize: 15), e.clinicName,
)), style: TextStyle(
fontSize:
SizeConfig.textMultiplier *
1.9),
)),
),
)) ))
.toList(), .toList(),
)) ))

@ -11,6 +11,7 @@ import '../util/dr_app_toast_msg.dart';
import 'package:connectivity/connectivity.dart'; import 'package:connectivity/connectivity.dart';
import 'dr_app_shared_pref.dart'; import 'dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
@ -51,7 +52,7 @@ class Helpers {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
CupertinoButton( CupertinoButton(
child: Text('Cancel'.toUpperCase(), child: Text(TranslationBase.of(context).cancel,
style: textStyle(context)), style: textStyle(context)),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
@ -59,7 +60,7 @@ class Helpers {
), ),
CupertinoButton( CupertinoButton(
child: Text( child: Text(
'Done'.toUpperCase(), TranslationBase.of(context).done,
style: textStyle(context), style: textStyle(context),
), ),
onPressed: () { onPressed: () {

@ -233,6 +233,8 @@ class TranslationBase {
String get livecare => localizedValues['livecare'][locale.languageCode]; String get livecare => localizedValues['livecare'][locale.languageCode];
String get beingBad => localizedValues['beingBad'][locale.languageCode]; String get beingBad => localizedValues['beingBad'][locale.languageCode];
String get beingGreat => localizedValues['beingGreat'][locale.languageCode]; String get beingGreat => localizedValues['beingGreat'][locale.languageCode];
String get cancel => localizedValues['cancel'][locale.languageCode];
String get done => localizedValues['done'][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -301,7 +301,7 @@ class _LoginFormState extends State<LoginForm> {
platformImei = platformImei =
await ImeiPlugin.getImei(shouldShowRequestPermissionRationale: false); await ImeiPlugin.getImei(shouldShowRequestPermissionRationale: false);
idunique = await ImeiPlugin.getImei(); idunique = await ImeiPlugin.getImei();
} catch(e) { } catch (e) {
platformImei = 'Failed to get platform version.'; platformImei = 'Failed to get platform version.';
} }

Loading…
Cancel
Save