|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
import 'dart:collection';
|
|
|
|
|
|
|
|
|
|
import 'package:auto_size_text/auto_size_text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/config.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
@ -56,6 +57,8 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
AppGlobal.context = context;
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
@ -66,14 +69,17 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
activeColor: CustomColors.accentColor,
|
|
|
|
|
value: nearestAppo,
|
|
|
|
|
onChanged: (bool? value) {
|
|
|
|
|
nearestAppo = value?? false;
|
|
|
|
|
nearestAppo = value ?? false;
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
AutoSizeText(
|
|
|
|
|
TranslationBase.of(context).nearestAppo.trim(),
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.nearestAppo
|
|
|
|
|
.trim(),
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minFontSize: 10,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
@ -94,7 +100,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
decoration: containerRadius(Colors.white, 12),
|
|
|
|
|
margin: EdgeInsets.only(left: 20, right: 20),
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
|
|
|
|
|
EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Flexible(
|
|
|
|
|
@ -102,7 +108,9 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).selectHospital,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.selectHospital,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
@ -115,7 +123,9 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
|
|
child: DropdownButton<HospitalsModel>(
|
|
|
|
|
hint: Text(
|
|
|
|
|
TranslationBase.of(context).selectHospital),
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.selectHospital),
|
|
|
|
|
value: selectedHospital,
|
|
|
|
|
iconSize: 0,
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
@ -132,7 +142,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
minFontSize: 10,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize:
|
|
|
|
|
SizeConfig.textMultiplier! * 1.6,
|
|
|
|
|
SizeConfig.textMultiplier! * 1.6,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.39,
|
|
|
|
|
height: 0.8,
|
|
|
|
|
@ -141,11 +151,11 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
// Text('${item.name!}'),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
onChanged: (HospitalsModel? newValue) async {
|
|
|
|
|
onChanged: (HospitalsModel? newValue){
|
|
|
|
|
getClinicWrtHospital(newValue);
|
|
|
|
|
// setState(() {
|
|
|
|
|
// selectedHospital = newValue;
|
|
|
|
|
// });
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedHospital = newValue;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -162,28 +172,29 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
onTap: () {
|
|
|
|
|
showClickListDialog(context, clinicIds ?? List.empty(),
|
|
|
|
|
onSelection: (ListClinicCentralized clincs) {
|
|
|
|
|
selectedClinic = clincs;
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
setState(() {
|
|
|
|
|
dropdownTitle = clincs.clinicDescription!;
|
|
|
|
|
dropdownValue = clincs.clinicID.toString() +
|
|
|
|
|
selectedClinic = clincs;
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
setState(() {
|
|
|
|
|
dropdownTitle = clincs.clinicDescription!;
|
|
|
|
|
dropdownValue = clincs.clinicID.toString() +
|
|
|
|
|
"-" +
|
|
|
|
|
clincs.isLiveCareClinicAndOnline.toString() +
|
|
|
|
|
"-" +
|
|
|
|
|
clincs.liveCareClinicID.toString() +
|
|
|
|
|
"-" +
|
|
|
|
|
clincs.liveCareServiceID.toString();
|
|
|
|
|
});
|
|
|
|
|
getDoctorsList(context);
|
|
|
|
|
|
|
|
|
|
context
|
|
|
|
|
.read<ProjectViewModel>()
|
|
|
|
|
.analytics
|
|
|
|
|
.appointment
|
|
|
|
|
.book_appointment_select_clinic(
|
|
|
|
|
clincs.liveCareServiceID.toString(
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
getDoctorsList(context);
|
|
|
|
|
|
|
|
|
|
context
|
|
|
|
|
.read<ProjectViewModel>()
|
|
|
|
|
.analytics
|
|
|
|
|
.appointment
|
|
|
|
|
.book_appointment_select_clinic(
|
|
|
|
|
appointment_type: 'regular',
|
|
|
|
|
clinic: clincs.clinicDescription);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
@ -197,7 +208,9 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).selectClinic,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.selectClinic,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
@ -230,7 +243,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
|
|
|
|
|
void openDropdown(GlobalKey key) {
|
|
|
|
|
GestureDetector? detector;
|
|
|
|
|
detector = searchForGestureDetector(key.currentContext!);
|
|
|
|
|
detector = searchForGestureDetector(key.currentContext!);
|
|
|
|
|
assert(detector != null);
|
|
|
|
|
detector!.onTap!();
|
|
|
|
|
}
|
|
|
|
|
@ -251,7 +264,9 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
getProjectsList() {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
|
|
|
|
|
int languageID = context.read<ProjectViewModel>().isArabic ? 1 : 2;
|
|
|
|
|
int languageID = context
|
|
|
|
|
.read<ProjectViewModel>()
|
|
|
|
|
.isArabic ? 1 : 2;
|
|
|
|
|
ClinicListService service = new ClinicListService();
|
|
|
|
|
List<HospitalsModel> projectsListLocal = [];
|
|
|
|
|
service.getProjectsList(languageID, context).then((res) {
|
|
|
|
|
@ -275,8 +290,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void getClinicWrtHospital(HospitalsModel? newValue) {
|
|
|
|
|
void getClinicWrtHospital(HospitalsModel? newValue) async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
ClinicListService service = new ClinicListService();
|
|
|
|
|
List<HospitalsModel> projectsListLocal = [];
|
|
|
|
|
@ -284,23 +298,25 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
clinicIds = List.empty();
|
|
|
|
|
});
|
|
|
|
|
List<ListClinicCentralized> clinicId = [];
|
|
|
|
|
service
|
|
|
|
|
.getClinicByHospital(
|
|
|
|
|
projectID: newValue?.mainProjectID.toString() ?? "")
|
|
|
|
|
.then((res) {
|
|
|
|
|
print("the result is obtained");
|
|
|
|
|
try {
|
|
|
|
|
Map res = await service
|
|
|
|
|
.getClinicB
|
|
|
|
|
|
|
|
|
|
yHospital(
|
|
|
|
|
projectID: newValue?.mainProjectID.toString() ?? "");
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
List list = res['ListClinic'];
|
|
|
|
|
|
|
|
|
|
if(list.isEmpty){
|
|
|
|
|
if (list.isEmpty) {
|
|
|
|
|
AppToast.showErrorToast(message:
|
|
|
|
|
TranslationBase.of(context).NoClinicFound,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.NoClinicFound,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
res['ListClinic'].forEach((v) {
|
|
|
|
|
clinicId?.add(ListClinicCentralized.fromJson(v));
|
|
|
|
|
clinicId.add(ListClinicCentralized.fromJson(v));
|
|
|
|
|
});
|
|
|
|
|
clinicIds = clinicId;
|
|
|
|
|
setState(() {
|
|
|
|
|
@ -308,27 +324,67 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message:
|
|
|
|
|
TranslationBase.of(context).NoClinicFound,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.NoClinicFound,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print('the error is $err');
|
|
|
|
|
AppToast.showErrorToast(message:
|
|
|
|
|
TranslationBase.of(context).NoClinicFound,
|
|
|
|
|
);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
} catch (e) {
|
|
|
|
|
print("the error is $e");
|
|
|
|
|
AppToast.showErrorToast(message:
|
|
|
|
|
TranslationBase.of(context).NoClinicFound,
|
|
|
|
|
);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
TranslationBase.of(context).NoClinicFound,
|
|
|
|
|
);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// .then((res) {
|
|
|
|
|
// print("the result is obtained");
|
|
|
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
// if (res['MessageStatus'] == 1) {
|
|
|
|
|
// List list = res['ListClinic'];
|
|
|
|
|
//
|
|
|
|
|
// if(list.isEmpty){
|
|
|
|
|
// AppToast.showErrorToast(message:
|
|
|
|
|
// TranslationBase.of(context).NoClinicFound,
|
|
|
|
|
// );
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// res['ListClinic'].forEach((v) {
|
|
|
|
|
// clinicId?.add(ListClinicCentralized.fromJson(v));
|
|
|
|
|
// });
|
|
|
|
|
// clinicIds = clinicId;
|
|
|
|
|
// setState(() {
|
|
|
|
|
//
|
|
|
|
|
// });
|
|
|
|
|
// } else {
|
|
|
|
|
// AppToast.showErrorToast(message:
|
|
|
|
|
// TranslationBase.of(context).NoClinicFound,
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
// }).catchError((err) {
|
|
|
|
|
// print('the error is $err');
|
|
|
|
|
// AppToast.showErrorToast(message:
|
|
|
|
|
// TranslationBase.of(context).NoClinicFound,
|
|
|
|
|
// );
|
|
|
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
// }).catchError((err) {
|
|
|
|
|
// AppToast.showErrorToast(message:
|
|
|
|
|
// TranslationBase.of(context).NoClinicFound,
|
|
|
|
|
// );
|
|
|
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
//
|
|
|
|
|
// print(err);
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future navigateToDentalComplaints(
|
|
|
|
|
BuildContext context, SearchInfo searchInfo) async {
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future navigateToDentalComplaints(BuildContext context,
|
|
|
|
|
SearchInfo searchInfo) async {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
@ -344,7 +400,9 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
callDoctorsSearchAPI(int clinicID) {
|
|
|
|
|
int languageID = context.read<ProjectViewModel>().isArabic ? 1 : 2;
|
|
|
|
|
int languageID = context
|
|
|
|
|
.read<ProjectViewModel>()
|
|
|
|
|
.isArabic ? 1 : 2;
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
List<DoctorList> doctorsList = [];
|
|
|
|
|
List<String> arr = [];
|
|
|
|
|
@ -352,18 +410,18 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
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,
|
|
|
|
|
nearestAppo,
|
|
|
|
|
languageID,
|
|
|
|
|
null)
|
|
|
|
|
clinicID,
|
|
|
|
|
selectedHospital?.mainProjectID.toString() != ""
|
|
|
|
|
? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1")
|
|
|
|
|
: 0,
|
|
|
|
|
nearestAppo,
|
|
|
|
|
languageID,
|
|
|
|
|
null)
|
|
|
|
|
.then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
@ -371,21 +429,21 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
if (res['DoctorList'].length != 0) {
|
|
|
|
|
doctorsList.clear();
|
|
|
|
|
res['DoctorList'].forEach((v) {
|
|
|
|
|
doctorsList.add(new DoctorList.fromJson(v));
|
|
|
|
|
doctorsList.add( DoctorList.fromJson(v));
|
|
|
|
|
});
|
|
|
|
|
doctorsList.forEach((element) {
|
|
|
|
|
List<PatientDoctorAppointmentList> doctorByHospital =
|
|
|
|
|
_patientDoctorAppointmentListHospital
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) =>
|
|
|
|
|
elementClinic.filterName == element.projectName,
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
_patientDoctorAppointmentListHospital
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) =>
|
|
|
|
|
elementClinic.filterName == element.projectName,
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
if (doctorByHospital.length != 0) {
|
|
|
|
|
_patientDoctorAppointmentListHospital[
|
|
|
|
|
_patientDoctorAppointmentListHospital
|
|
|
|
|
.indexOf(doctorByHospital[0])]
|
|
|
|
|
_patientDoctorAppointmentListHospital
|
|
|
|
|
.indexOf(doctorByHospital[0])]
|
|
|
|
|
.patientDoctorAppointmentList!
|
|
|
|
|
.add(element);
|
|
|
|
|
} else {
|
|
|
|
|
@ -393,7 +451,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
PatientDoctorAppointmentList(
|
|
|
|
|
filterName: element.projectName,
|
|
|
|
|
distanceInKMs:
|
|
|
|
|
element.projectDistanceInKiloMeters.toString(),
|
|
|
|
|
element.projectDistanceInKiloMeters.toString(),
|
|
|
|
|
patientDoctorAppointment: element));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@ -414,21 +472,19 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future navigateToSearchResults(
|
|
|
|
|
context,
|
|
|
|
|
Future navigateToSearchResults(context,
|
|
|
|
|
List<DoctorList> docList,
|
|
|
|
|
List<PatientDoctorAppointmentList>
|
|
|
|
|
patientDoctorAppointmentListHospital) async {
|
|
|
|
|
patientDoctorAppointmentListHospital) async {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: SearchResults(
|
|
|
|
|
isLiveCareAppointment: false,
|
|
|
|
|
doctorsList: docList,
|
|
|
|
|
patientDoctorAppointmentListHospital:
|
|
|
|
|
patientDoctorAppointmentListHospital)))
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: SearchResults(
|
|
|
|
|
isLiveCareAppointment: false,
|
|
|
|
|
doctorsList: docList,
|
|
|
|
|
patientDoctorAppointmentListHospital:
|
|
|
|
|
patientDoctorAppointmentListHospital)))
|
|
|
|
|
.then((value) {
|
|
|
|
|
|
|
|
|
|
print("navigation return ");
|
|
|
|
|
dropdownValue = null;
|
|
|
|
|
dropdownTitle = "";
|
|
|
|
|
@ -466,8 +522,13 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
searchInfo.clinic = selectedClinic;
|
|
|
|
|
searchInfo.date = DateTime.now();
|
|
|
|
|
|
|
|
|
|
if (context.read<ProjectViewModel>().isLogin) {
|
|
|
|
|
if (context.read<ProjectViewModel>().user.age! > 12) {
|
|
|
|
|
if (context
|
|
|
|
|
.read<ProjectViewModel>()
|
|
|
|
|
.isLogin) {
|
|
|
|
|
if (context
|
|
|
|
|
.read<ProjectViewModel>()
|
|
|
|
|
.user
|
|
|
|
|
.age! > 12) {
|
|
|
|
|
navigateToDentalComplaints(context, searchInfo);
|
|
|
|
|
} else {
|
|
|
|
|
callDoctorsSearchAPI(17);
|
|
|
|
|
@ -479,9 +540,9 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
navigateToLaserClinic(context);
|
|
|
|
|
// callDoctorsSearchAPI();
|
|
|
|
|
} else if (dropdownValue!.split("-")[1] == "true"
|
|
|
|
|
// && authProvider.isLogin &&
|
|
|
|
|
// authUser.patientType == 1
|
|
|
|
|
) {
|
|
|
|
|
// && authProvider.isLogin &&
|
|
|
|
|
// authUser.patientType == 1
|
|
|
|
|
) {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
|