|
|
|
|
@ -34,8 +34,7 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 10.0, bottom: 15.0),
|
|
|
|
|
child: Text(TranslationBase.of(context).searchByDocText,
|
|
|
|
|
style: TextStyle(fontSize: 16.0, letterSpacing: 0.9)),
|
|
|
|
|
child: Text(TranslationBase.of(context).searchByDocText, style: TextStyle(fontSize: 16.0, letterSpacing: 0.9)),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(color: Colors.white),
|
|
|
|
|
@ -44,11 +43,7 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
|
|
|
|
|
onChanged: (content) {
|
|
|
|
|
_onDocTextChanged(content);
|
|
|
|
|
},
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
labelText: TranslationBase.of(context).enterDocName,
|
|
|
|
|
fillColor: Colors.white,
|
|
|
|
|
prefixIcon: Icon(Icons.search),
|
|
|
|
|
border: OutlineInputBorder())),
|
|
|
|
|
decoration: InputDecoration(labelText: TranslationBase.of(context).enterDocName, fillColor: Colors.white, prefixIcon: Icon(Icons.search), border: OutlineInputBorder())),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Align(
|
|
|
|
|
@ -78,8 +73,7 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
|
|
|
|
|
_searchDoctor(context);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: Text(TranslationBase.of(context).search,
|
|
|
|
|
style: TextStyle(fontSize: 18.0)),
|
|
|
|
|
child: Text(TranslationBase.of(context).search, style: TextStyle(fontSize: 18.0)),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -89,13 +83,10 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
|
|
|
|
|
List<DoctorList> doctorsList = [];
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
|
|
|
|
|
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital =
|
|
|
|
|
List();
|
|
|
|
|
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital = List();
|
|
|
|
|
|
|
|
|
|
service
|
|
|
|
|
.getDoctorsListByName(doctorNameController.text, context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
service.getDoctorsListByName(doctorNameController.text, context).then((res) {
|
|
|
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (res['DoctorList'].length != 0) {
|
|
|
|
|
@ -104,27 +95,13 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
doctorsList.forEach((element) {
|
|
|
|
|
List<PatientDoctorAppointmentList> doctorByHospital =
|
|
|
|
|
_patientDoctorAppointmentListHospital
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) =>
|
|
|
|
|
elementClinic.filterName == element.projectName,
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
List<PatientDoctorAppointmentList> doctorByHospital = _patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.projectName).toList();
|
|
|
|
|
|
|
|
|
|
if (doctorByHospital.length != 0) {
|
|
|
|
|
_patientDoctorAppointmentListHospital[
|
|
|
|
|
_patientDoctorAppointmentListHospital
|
|
|
|
|
.indexOf(doctorByHospital[0])]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.add(element);
|
|
|
|
|
_patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
|
|
|
|
|
} else {
|
|
|
|
|
_patientDoctorAppointmentListHospital.add(
|
|
|
|
|
PatientDoctorAppointmentList(
|
|
|
|
|
filterName: element.projectName,
|
|
|
|
|
distanceInKMs:
|
|
|
|
|
element.projectDistanceInKiloMeters.toString(),
|
|
|
|
|
patientDoctorAppointment: element));
|
|
|
|
|
_patientDoctorAppointmentListHospital
|
|
|
|
|
.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
@ -133,8 +110,7 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
navigateToSearchResults(
|
|
|
|
|
context, doctorsList, _patientDoctorAppointmentListHospital);
|
|
|
|
|
navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital);
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
@ -164,18 +140,7 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
|
|
|
|
|
getDoctorsList(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
navigateToSearchResults(
|
|
|
|
|
context,
|
|
|
|
|
List<DoctorList> docList,
|
|
|
|
|
List<PatientDoctorAppointmentList>
|
|
|
|
|
patientDoctorAppointmentListHospital) {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: SearchResults(
|
|
|
|
|
isLiveCareAppointment: false,
|
|
|
|
|
doctorsList: docList,
|
|
|
|
|
patientDoctorAppointmentListHospital:
|
|
|
|
|
patientDoctorAppointmentListHospital)));
|
|
|
|
|
navigateToSearchResults(context, List<DoctorList> docList, List<PatientDoctorAppointmentList> patientDoctorAppointmentListHospital) {
|
|
|
|
|
Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|