|
|
|
@ -9,7 +9,11 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/search_result/ResultB
|
|
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/search_result/ResultByHospital.dart';
|
|
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/search_result/ResultByHospital.dart';
|
|
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/search_result/ResultByRegion.dart';
|
|
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/search_result/ResultByRegion.dart';
|
|
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart';
|
|
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/services/appointment_services/doctor_response_mapper.dart';
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
|
|
|
|
@ -17,6 +21,9 @@ import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import '../../../config/shared_pref_kay.dart';
|
|
|
|
|
|
|
|
import '../../../core/service/client/base_app_client.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class SearchResultWithTabForHospital extends StatefulWidget {
|
|
|
|
class SearchResultWithTabForHospital extends StatefulWidget {
|
|
|
|
List<DoctorList> doctorsList = [];
|
|
|
|
List<DoctorList> doctorsList = [];
|
|
|
|
RegionList patientDoctorAppointmentListHospital;
|
|
|
|
RegionList patientDoctorAppointmentListHospital;
|
|
|
|
@ -54,6 +61,8 @@ class _SearchResultWithTabForHospitalState
|
|
|
|
int selectedHospitalIndex = -1;
|
|
|
|
int selectedHospitalIndex = -1;
|
|
|
|
ScrollController scrollController = ScrollController();
|
|
|
|
ScrollController scrollController = ScrollController();
|
|
|
|
RegionList? doctorList;
|
|
|
|
RegionList? doctorList;
|
|
|
|
|
|
|
|
bool nearestAppointment= false;
|
|
|
|
|
|
|
|
int clinicId = -1;
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
@ -135,6 +144,8 @@ class _SearchResultWithTabForHospitalState
|
|
|
|
doctorList = null;
|
|
|
|
doctorList = null;
|
|
|
|
_currentIndex = 0;
|
|
|
|
_currentIndex = 0;
|
|
|
|
changePageViewIndex(0);
|
|
|
|
changePageViewIndex(0);
|
|
|
|
|
|
|
|
nearestAppointment = false;
|
|
|
|
|
|
|
|
clinicId = -1;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -159,6 +170,9 @@ class _SearchResultWithTabForHospitalState
|
|
|
|
doctorList = null;
|
|
|
|
doctorList = null;
|
|
|
|
_currentIndex = 1;
|
|
|
|
_currentIndex = 1;
|
|
|
|
changePageViewIndex(1);
|
|
|
|
changePageViewIndex(1);
|
|
|
|
|
|
|
|
nearestAppointment = false;
|
|
|
|
|
|
|
|
clinicId = -1;
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -183,6 +197,9 @@ class _SearchResultWithTabForHospitalState
|
|
|
|
doctorList = null;
|
|
|
|
doctorList = null;
|
|
|
|
_currentIndex = 2;
|
|
|
|
_currentIndex = 2;
|
|
|
|
changePageViewIndex(2);
|
|
|
|
changePageViewIndex(2);
|
|
|
|
|
|
|
|
nearestAppointment = false;
|
|
|
|
|
|
|
|
clinicId = -1;
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -203,9 +220,12 @@ class _SearchResultWithTabForHospitalState
|
|
|
|
: CustomColors.grey2,
|
|
|
|
: CustomColors.grey2,
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
_currentIndex = 3;
|
|
|
|
|
|
|
|
doctorList = null;
|
|
|
|
doctorList = null;
|
|
|
|
changePageViewIndex(3);
|
|
|
|
changePageViewIndex(3);
|
|
|
|
|
|
|
|
_currentIndex = 3;
|
|
|
|
|
|
|
|
nearestAppointment= false;
|
|
|
|
|
|
|
|
clinicId = -1;
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -350,11 +370,14 @@ class _SearchResultWithTabForHospitalState
|
|
|
|
selectedRegion != '' &&
|
|
|
|
selectedRegion != '' &&
|
|
|
|
selectedHospitalIndex != -1)
|
|
|
|
selectedHospitalIndex != -1)
|
|
|
|
? ResultByClinic(
|
|
|
|
? ResultByClinic(
|
|
|
|
onClinicSelected: (doctorList) {
|
|
|
|
onClinicSelected: (doctorList, clinicId) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
this.nearestAppointment = false;
|
|
|
|
this.doctorList = doctorList;
|
|
|
|
this.doctorList = doctorList;
|
|
|
|
_currentIndex = 4;
|
|
|
|
_currentIndex = 4;
|
|
|
|
changePageViewIndex(4);
|
|
|
|
changePageViewIndex(4);
|
|
|
|
|
|
|
|
if(clinicId != null)
|
|
|
|
|
|
|
|
this.clinicId = clinicId;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
selectedValue: selectedHospital)
|
|
|
|
selectedValue: selectedHospital)
|
|
|
|
@ -384,7 +407,19 @@ class _SearchResultWithTabForHospitalState
|
|
|
|
widget.isLiveCareAppointment,
|
|
|
|
widget.isLiveCareAppointment,
|
|
|
|
isDoctorSearchResult: widget.isDoctorSearchResult,
|
|
|
|
isDoctorSearchResult: widget.isDoctorSearchResult,
|
|
|
|
isObGyneAppointment: widget.isObGyneAppointment,
|
|
|
|
isObGyneAppointment: widget.isObGyneAppointment,
|
|
|
|
isDoctorNameSearch: widget.isDoctorNameSearch)
|
|
|
|
isDoctorNameSearch: widget.isDoctorNameSearch,
|
|
|
|
|
|
|
|
showNearestAppointment: clinicId != -1 ,
|
|
|
|
|
|
|
|
nearestAppointmentDoctors: nearestAppointment,
|
|
|
|
|
|
|
|
refreshDoctorList: (isNearestAppointmentChecked){
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
// changePageViewIndex(3);
|
|
|
|
|
|
|
|
// _currentIndex = 3;
|
|
|
|
|
|
|
|
nearestAppointment= false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
callDoctorsSearchAPI(clinicId, isNearestAppointmentChecked);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
: SizedBox.shrink(),
|
|
|
|
: SizedBox.shrink(),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -395,6 +430,62 @@ class _SearchResultWithTabForHospitalState
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
callDoctorsSearchAPI(int clinicID, bool nearestAppointment) {
|
|
|
|
|
|
|
|
var isArabic = context.read<ProjectViewModel>().isArabic;
|
|
|
|
|
|
|
|
int languageID = isArabic ? 1 : 2;
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
|
|
|
List<DoctorList> doctorsList = [];
|
|
|
|
|
|
|
|
List<String> arr = [];
|
|
|
|
|
|
|
|
List<String> arrDistance = [];
|
|
|
|
|
|
|
|
List<String> result;
|
|
|
|
|
|
|
|
int numAll;
|
|
|
|
|
|
|
|
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
|
|
|
service
|
|
|
|
|
|
|
|
.getDoctorsList(clinicID, selectedHospital?.mainProjectID.toString() != "" ? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1") : 0, nearestAppointment, languageID, null)
|
|
|
|
|
|
|
|
.then((res) async {
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
|
|
|
RegionList regionHospitalList = RegionList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (res['DoctorList'].length != 0) {
|
|
|
|
|
|
|
|
res['DoctorList'].forEach((v) {
|
|
|
|
|
|
|
|
doctorsList.add(new DoctorList.fromJson(
|
|
|
|
|
|
|
|
v,
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList, isArabic: isArabic);
|
|
|
|
|
|
|
|
var lat = await sharedPref.getDouble(USER_LAT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var lng = await sharedPref.getDouble(USER_LONG);
|
|
|
|
|
|
|
|
var isLocationEnabled = (lat != null && lat != 0.0) && (lng != null && lng != 0.0);
|
|
|
|
|
|
|
|
regionHospitalList = await DoctorMapper.sortList(isLocationEnabled, regionHospitalList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
this.doctorList = regionHospitalList;
|
|
|
|
|
|
|
|
_currentIndex = 4;
|
|
|
|
|
|
|
|
changePageViewIndex(4);
|
|
|
|
|
|
|
|
this.nearestAppointment = nearestAppointment;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorSearchMsg']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
// navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
print(err);
|
|
|
|
|
|
|
|
AppToast.showErrorToast(message: err, localContext: context);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
String getTitle() {
|
|
|
|
String getTitle() {
|
|
|
|
switch (_currentIndex) {
|
|
|
|
switch (_currentIndex) {
|
|
|
|
case 0:
|
|
|
|
case 0:
|
|
|
|
|