get clinic list after changing the language

merge-requests/148/head
hussam al-habibeh 6 years ago
parent aa57f4c4d7
commit acaaca314e

@ -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 =
@ -60,6 +62,18 @@ const GET_DOCTOR_WORKING_HOURS_TABLE =
const GET_PATIENT_LAB_RESULTS = const GET_PATIENT_LAB_RESULTS =
'Services/DoctorApplication.svc/REST/GetPatientLabResults'; '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;

@ -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,25 +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';
const GET_CLINICS_FOR_DOCTOR =
'Services/DoctorApplication.svc/REST/GetClinicsForDoctor';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED }

@ -21,7 +21,7 @@ class ProjectProvider with ChangeNotifier {
String currentLanguage = 'ar'; String currentLanguage = 'ar';
bool _isArabic = false; bool _isArabic = false;
bool isInternetConnection = true; bool isInternetConnection = true;
List<ClinicModel> clinicList = []; List<ClinicModel> doctorClinicsList = [];
bool isLoading = false; bool isLoading = false;
bool isError = false; bool isError = false;
String error = ''; String error = '';
@ -78,7 +78,7 @@ class ProjectProvider with ChangeNotifier {
callServicesAfterChangeLang() { callServicesAfterChangeLang() {
getProfile(); getProfile();
getClinicNames(); getDoctorClinicsList();
} }
@override @override
@ -87,15 +87,15 @@ class ProjectProvider with ChangeNotifier {
super.dispose(); super.dispose();
} }
Future<dynamic> getClinicNames() async { Future<dynamic> getDoctorClinicsList() async {
try { try {
dynamic localRes; dynamic localRes;
await BaseAppClient.post(GET_CLINICS_FOR_DOCTOR, await BaseAppClient.post(GET_CLINICS_FOR_DOCTOR,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
clinicList = []; doctorClinicsList = [];
response['List_DoctorsClinic'].forEach((v) { response['List_DoctorsClinic'].forEach((v) {
clinicList.add(new ClinicModel.fromJson(v)); doctorClinicsList.add(new ClinicModel.fromJson(v));
}); });
localRes = response; localRes = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {

@ -57,7 +57,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
super.didChangeDependencies(); super.didChangeDependencies();
if (_isInit) { if (_isInit) {
projectsProvider = Provider.of<ProjectProvider>(context); projectsProvider = Provider.of<ProjectProvider>(context);
projectsProvider.getClinicNames(); projectsProvider.getDoctorClinicsList();
} }
_isInit = false; _isInit = false;
} }
@ -117,7 +117,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
showCupertinoPicker( showCupertinoPicker(
decKey: '', decKey: '',
context: context, context: context,
actionList: projectsProvider.clinicList); actionList:
projectsProvider.doctorClinicsList);
}, },
child: Container( child: Container(
margin: margin:
@ -574,7 +575,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
onTap: () => onTap: () =>
changeClinic(e.clinicID, context), changeClinic(e.clinicID, context),
child: Text( child: Text(
e.clinicName ?? 'asd', e.clinicName,
style: TextStyle( style: TextStyle(
fontSize: fontSize:
SizeConfig.textMultiplier * SizeConfig.textMultiplier *

Loading…
Cancel
Save