|
|
|
@ -14,6 +14,7 @@ import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service
|
|
|
|
|
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/utils_new.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
@ -43,6 +44,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
|
|
|
|
|
bool isProjectLoaded = false;
|
|
|
|
|
|
|
|
|
|
ListClinicCentralized selectedClinic;
|
|
|
|
|
final GlobalKey dropdownKey = GlobalKey();
|
|
|
|
|
|
|
|
|
|
AuthenticatedUser authUser = new AuthenticatedUser();
|
|
|
|
|
AuthProvider authProvider = new AuthProvider();
|
|
|
|
@ -56,108 +58,128 @@ class _SearchByClinicState extends State<SearchByClinic> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Container(
|
|
|
|
|
margin: EdgeInsets.all(10.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Checkbox(
|
|
|
|
|
activeColor: new Color(0xFF40ACC9),
|
|
|
|
|
value: nearestAppo,
|
|
|
|
|
onChanged: (bool value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
nearestAppo = value;
|
|
|
|
|
print(nearestAppo);
|
|
|
|
|
if (nearestAppo)
|
|
|
|
|
getProjectsList();
|
|
|
|
|
else
|
|
|
|
|
isProjectLoaded = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Text(TranslationBase.of(context).nearestAppo,
|
|
|
|
|
style: TextStyle(fontSize: 16.0, letterSpacing: 0.9)),
|
|
|
|
|
],
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 2,right: 2),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Checkbox(
|
|
|
|
|
activeColor: new Color(0xFF40ACC9),
|
|
|
|
|
value: nearestAppo,
|
|
|
|
|
onChanged: (bool value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
nearestAppo = value;
|
|
|
|
|
print(nearestAppo);
|
|
|
|
|
if (nearestAppo)
|
|
|
|
|
getProjectsList();
|
|
|
|
|
else
|
|
|
|
|
isProjectLoaded = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).nearestAppo,
|
|
|
|
|
style: TextStyle(fontSize: 14.0, letterSpacing: -0.56),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
widget.clnicIds != null &&
|
|
|
|
|
widget.clnicIds.length > 1 &&
|
|
|
|
|
isLoaded == true
|
|
|
|
|
? Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: clinicsList.map<Widget>((result) {
|
|
|
|
|
return RoundedContainer(
|
|
|
|
|
child: ListTile(
|
|
|
|
|
onTap: () {
|
|
|
|
|
// setState(() {
|
|
|
|
|
dropdownValue = result.clinicID.toString();
|
|
|
|
|
setState(() {
|
|
|
|
|
if (!isDentalSelectedAndSupported()) {
|
|
|
|
|
projectDropdownValue = "";
|
|
|
|
|
getDoctorsList(context);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
title: Text(result.clinicDescription,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14.0,
|
|
|
|
|
color: Colors.grey[700],
|
|
|
|
|
letterSpacing: 1.0))));
|
|
|
|
|
}).toList())
|
|
|
|
|
: Container(
|
|
|
|
|
height: 60.0,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Colors.grey[400],
|
|
|
|
|
width: 1.0,
|
|
|
|
|
),
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
),
|
|
|
|
|
// margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 20.0),
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
|
|
child: DropdownButton<String>(
|
|
|
|
|
hint: new Text(TranslationBase.of(context).selectClinic),
|
|
|
|
|
value: dropdownValue,
|
|
|
|
|
items: clinicsList.map((item) {
|
|
|
|
|
return new DropdownMenuItem<String>(
|
|
|
|
|
value: item.clinicID.toString() +
|
|
|
|
|
"-" +
|
|
|
|
|
item.isLiveCareClinicAndOnline.toString() +
|
|
|
|
|
"-" +
|
|
|
|
|
item.liveCareClinicID.toString() +
|
|
|
|
|
"-" +
|
|
|
|
|
item.liveCareServiceID.toString(),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
widget.clnicIds != null && widget.clnicIds.length > 1 && isLoaded == true
|
|
|
|
|
? Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 20,right: 20),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: clinicsList.map<Widget>((result) {
|
|
|
|
|
return RoundedContainer(
|
|
|
|
|
child: ListTile(
|
|
|
|
|
onTap: () {
|
|
|
|
|
// setState(() {
|
|
|
|
|
dropdownValue = result.clinicID.toString();
|
|
|
|
|
setState(() {
|
|
|
|
|
if (!isDentalSelectedAndSupported()) {
|
|
|
|
|
projectDropdownValue = "";
|
|
|
|
|
getDoctorsList(context);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
title: Text(result.clinicDescription, style: TextStyle(fontSize: 14.0, color: Colors.grey[700], letterSpacing: 1.0))));
|
|
|
|
|
}).toList()),
|
|
|
|
|
)
|
|
|
|
|
: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
dropdownKey.currentState;
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
margin: const EdgeInsets.only(left: 16,right: 16),
|
|
|
|
|
decoration: containerRadius(Colors.white, 12),
|
|
|
|
|
padding: EdgeInsets.only(left: 12, right: 12, top: 14, bottom: 14),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Flexible(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(item.clinicDescription),
|
|
|
|
|
item.isLiveCareClinicAndOnline
|
|
|
|
|
? SvgPicture.asset(
|
|
|
|
|
'assets/images/new-design/video_icon_green_right.svg',
|
|
|
|
|
height: 15,
|
|
|
|
|
width: 15,
|
|
|
|
|
fit: BoxFit.cover)
|
|
|
|
|
: Container(),
|
|
|
|
|
]),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
onChanged: (newValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
print(newValue);
|
|
|
|
|
dropdownValue = newValue;
|
|
|
|
|
if (!isDentalSelectedAndSupported() && !nearestAppo) {
|
|
|
|
|
projectDropdownValue = "";
|
|
|
|
|
getDoctorsList(context);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
isDentalSelectedAndSupported() == true ||
|
|
|
|
|
(nearestAppo && isProjectLoaded)
|
|
|
|
|
Text(
|
|
|
|
|
"Select Clinic",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: 20,
|
|
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
|
|
child: DropdownButton<String>(
|
|
|
|
|
key: dropdownKey,
|
|
|
|
|
hint: new Text(TranslationBase.of(context).selectClinic),
|
|
|
|
|
value: dropdownValue,
|
|
|
|
|
iconSize: 0,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Color(0xFF575757),
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
),
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
items: clinicsList.map((item) {
|
|
|
|
|
return new DropdownMenuItem<String>(
|
|
|
|
|
value: item.clinicID.toString() +
|
|
|
|
|
"-" +
|
|
|
|
|
item.isLiveCareClinicAndOnline.toString() +
|
|
|
|
|
"-" +
|
|
|
|
|
item.liveCareClinicID.toString() +
|
|
|
|
|
"-" +
|
|
|
|
|
item.liveCareServiceID.toString(),
|
|
|
|
|
child: Text(item.clinicDescription),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
onChanged: (newValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
print(newValue);
|
|
|
|
|
dropdownValue = newValue;
|
|
|
|
|
if (!isDentalSelectedAndSupported() && !nearestAppo) {
|
|
|
|
|
projectDropdownValue = "";
|
|
|
|
|
getDoctorsList(context);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.keyboard_arrow_down_rounded,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
isDentalSelectedAndSupported() == true || (nearestAppo && isProjectLoaded)
|
|
|
|
|
? Container(
|
|
|
|
|
height: 60.0,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
@ -196,9 +218,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isDentalSelectedAndSupported() {
|
|
|
|
|
return dropdownValue != "" &&
|
|
|
|
|
(dropdownValue == "17") &&
|
|
|
|
|
isMobileAppDentalAllow;
|
|
|
|
|
return dropdownValue != "" && (dropdownValue == "17") && isMobileAppDentalAllow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getClinicsList() {
|
|
|
|
@ -258,10 +278,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: LiveCareBookAppointment(
|
|
|
|
|
clinicName: "Family Medicine",
|
|
|
|
|
liveCareClinicID: dropdownValue.split("-")[2],
|
|
|
|
|
liveCareServiceID: dropdownValue.split("-")[3]),
|
|
|
|
|
page: LiveCareBookAppointment(clinicName: "Family Medicine", liveCareClinicID: dropdownValue.split("-")[2], liveCareServiceID: dropdownValue.split("-")[3]),
|
|
|
|
|
),
|
|
|
|
|
).then((value) {
|
|
|
|
|
print(value);
|
|
|
|
@ -285,17 +302,10 @@ class _SearchByClinicState extends State<SearchByClinic> {
|
|
|
|
|
List<String> arrDistance = [];
|
|
|
|
|
List<String> result;
|
|
|
|
|
int numAll;
|
|
|
|
|
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital =
|
|
|
|
|
List();
|
|
|
|
|
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital = List();
|
|
|
|
|
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service
|
|
|
|
|
.getDoctorsList(
|
|
|
|
|
int.parse(dropdownValue.split("-")[0]),
|
|
|
|
|
projectDropdownValue != "" ? int.parse(projectDropdownValue) : 0,
|
|
|
|
|
nearestAppo,
|
|
|
|
|
context)
|
|
|
|
|
.then((res) {
|
|
|
|
|
service.getDoctorsList(int.parse(dropdownValue.split("-")[0]), projectDropdownValue != "" ? int.parse(projectDropdownValue) : 0, nearestAppo, context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
setState(() {
|
|
|
|
@ -305,27 +315,17 @@ class _SearchByClinicState extends State<SearchByClinic> {
|
|
|
|
|
doctorsList.add(new DoctorList.fromJson(v));
|
|
|
|
|
});
|
|
|
|
|
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 {}
|
|
|
|
@ -333,8 +333,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
|
|
|
|
|
|
|
|
|
|
result = LinkedHashSet<String>.from(arr).toList();
|
|
|
|
|
numAll = result.length;
|
|
|
|
|
navigateToSearchResults(
|
|
|
|
|
context, doctorsList, _patientDoctorAppointmentListHospital);
|
|
|
|
|
navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital);
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
@ -345,8 +344,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future navigateToDentalComplaints(
|
|
|
|
|
BuildContext context, SearchInfo searchInfo) async {
|
|
|
|
|
Future navigateToDentalComplaints(BuildContext context, SearchInfo searchInfo) async {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
@ -355,20 +353,9 @@ class _SearchByClinicState extends State<SearchByClinic> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future navigateToSearchResults(
|
|
|
|
|
context,
|
|
|
|
|
List<DoctorList> docList,
|
|
|
|
|
List<PatientDoctorAppointmentList>
|
|
|
|
|
patientDoctorAppointmentListHospital) async {
|
|
|
|
|
Future navigateToSearchResults(context, List<DoctorList> docList, List<PatientDoctorAppointmentList> patientDoctorAppointmentListHospital) async {
|
|
|
|
|
isProjectLoaded = false;
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: SearchResults(
|
|
|
|
|
isLiveCareAppointment: false,
|
|
|
|
|
doctorsList: docList,
|
|
|
|
|
patientDoctorAppointmentListHospital:
|
|
|
|
|
patientDoctorAppointmentListHospital)))
|
|
|
|
|
Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital)))
|
|
|
|
|
.then((value) {
|
|
|
|
|
getProjectsList();
|
|
|
|
|
});
|
|
|
|
@ -377,9 +364,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
|
|
|
|
|
filterClinic() {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (widget.clnicIds != null && widget.clnicIds.length > 0) {
|
|
|
|
|
clinicsList = clinicsList
|
|
|
|
|
.where((i) => widget.clnicIds.indexOf(i.clinicID) > -1)
|
|
|
|
|
.toList();
|
|
|
|
|
clinicsList = clinicsList.where((i) => widget.clnicIds.indexOf(i.clinicID) > -1).toList();
|
|
|
|
|
isLoaded = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|