|
|
|
|
@ -2,6 +2,7 @@ import 'dart:collection';
|
|
|
|
|
|
|
|
|
|
import 'package:auto_size_text/auto_size_text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/config.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/components/LaserClinic.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
@ -118,15 +119,11 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
child: DropdownButtonHideUnderline(
|
|
|
|
|
child: DropdownButton<HospitalsModel>(
|
|
|
|
|
key: projectDropdownKey,
|
|
|
|
|
hint: Text(
|
|
|
|
|
TranslationBase.of(context).selectHospital),
|
|
|
|
|
hint: Text(TranslationBase.of(context).selectHospital),
|
|
|
|
|
value: selectedHospital,
|
|
|
|
|
iconSize: 0,
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
color: Colors.black),
|
|
|
|
|
style: TextStyle(fontSize: 14, letterSpacing: -0.56, color: Colors.black),
|
|
|
|
|
items: projectsList.map((HospitalsModel item) {
|
|
|
|
|
return DropdownMenuItem<HospitalsModel>(
|
|
|
|
|
value: item,
|
|
|
|
|
@ -164,29 +161,16 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
mHeight(8),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
showClickListDialog(context, clinicIds ?? List.empty(),
|
|
|
|
|
onSelection: (ListClinicCentralized clincs) {
|
|
|
|
|
showClickListDialog(context, clinicIds ?? List.empty(), onSelection: (ListClinicCentralized clincs) {
|
|
|
|
|
selectedClinic = clincs;
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
setState(() {
|
|
|
|
|
dropdownTitle = clincs.clinicDescription!;
|
|
|
|
|
dropdownValue = clincs.clinicID.toString() +
|
|
|
|
|
"-" +
|
|
|
|
|
clincs.isLiveCareClinicAndOnline.toString() +
|
|
|
|
|
"-" +
|
|
|
|
|
clincs.liveCareClinicID.toString() +
|
|
|
|
|
"-" +
|
|
|
|
|
clincs.liveCareServiceID.toString();
|
|
|
|
|
dropdownValue = clincs.clinicID.toString() + "-" + clincs.isLiveCareClinicAndOnline.toString() + "-" + clincs.liveCareClinicID.toString() + "-" + clincs.liveCareServiceID.toString();
|
|
|
|
|
});
|
|
|
|
|
getDoctorsList(context);
|
|
|
|
|
|
|
|
|
|
context
|
|
|
|
|
.read<ProjectViewModel>()
|
|
|
|
|
.analytics
|
|
|
|
|
.appointment
|
|
|
|
|
.book_appointment_select_clinic(
|
|
|
|
|
appointment_type: 'regular',
|
|
|
|
|
clinic: clincs.clinicDescription);
|
|
|
|
|
context.read<ProjectViewModel>().analytics.appointment.book_appointment_select_clinic(appointment_type: 'regular', clinic: clincs.clinicDescription);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
@ -302,8 +286,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
});
|
|
|
|
|
List<ListClinicCentralized> clinicId = [];
|
|
|
|
|
try {
|
|
|
|
|
Map res = await service.getClinicByHospital(
|
|
|
|
|
projectID: newValue?.mainProjectID.toString() ?? "");
|
|
|
|
|
Map res = await service.getClinicByHospital(projectID: newValue?.mainProjectID.toString() ?? "");
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
List list = res['ListClinic'];
|
|
|
|
|
@ -376,8 +359,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future navigateToDentalComplaints(
|
|
|
|
|
BuildContext context, SearchInfo searchInfo) async {
|
|
|
|
|
Future navigateToDentalComplaints(BuildContext context, SearchInfo searchInfo) async {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
@ -401,20 +383,10 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
List<String> arrDistance = [];
|
|
|
|
|
List<String> result;
|
|
|
|
|
int numAll;
|
|
|
|
|
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital =
|
|
|
|
|
[];
|
|
|
|
|
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital = [];
|
|
|
|
|
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
service
|
|
|
|
|
.getDoctorsList(
|
|
|
|
|
clinicID,
|
|
|
|
|
selectedHospital?.mainProjectID.toString() != ""
|
|
|
|
|
? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1")
|
|
|
|
|
: 0,
|
|
|
|
|
nearestAppo,
|
|
|
|
|
languageID,
|
|
|
|
|
null)
|
|
|
|
|
.then((res) {
|
|
|
|
|
service.getDoctorsList(clinicID, selectedHospital?.mainProjectID.toString() != "" ? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1") : 0, nearestAppo, languageID, null).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
setState(() {
|
|
|
|
|
@ -424,27 +396,17 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
doctorsList.add(DoctorList.fromJson(v));
|
|
|
|
|
});
|
|
|
|
|
doctorsList.forEach((element) {
|
|
|
|
|
List<PatientDoctorAppointmentList> doctorByHospital =
|
|
|
|
|
_patientDoctorAppointmentListHospital
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) =>
|
|
|
|
|
elementClinic.filterName == element.getProjectCompleteName(),
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
List<PatientDoctorAppointmentList> doctorByHospital = _patientDoctorAppointmentListHospital
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) => elementClinic.filterName == element.getProjectCompleteName(),
|
|
|
|
|
)
|
|
|
|
|
.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.getProjectCompleteName(),
|
|
|
|
|
distanceInKMs:
|
|
|
|
|
element.projectDistanceInKiloMeters.toString(),
|
|
|
|
|
patientDoctorAppointment: element));
|
|
|
|
|
_patientDoctorAppointmentListHospital
|
|
|
|
|
.add(PatientDoctorAppointmentList(filterName: element.getProjectCompleteName(), distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {}
|
|
|
|
|
@ -452,8 +414,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
|
|
|
|
|
result = LinkedHashSet<String>.from(arr).toList();
|
|
|
|
|
numAll = result.length;
|
|
|
|
|
navigateToSearchResults(
|
|
|
|
|
context, doctorsList, _patientDoctorAppointmentListHospital);
|
|
|
|
|
navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital);
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
@ -464,20 +425,9 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future navigateToSearchResults(
|
|
|
|
|
context,
|
|
|
|
|
List<DoctorList> docList,
|
|
|
|
|
List<PatientDoctorAppointmentList>
|
|
|
|
|
patientDoctorAppointmentListHospital) async {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: SearchResults(
|
|
|
|
|
isLiveCareAppointment: false,
|
|
|
|
|
doctorsList: docList,
|
|
|
|
|
isDoctorSearchResult: false,
|
|
|
|
|
patientDoctorAppointmentListHospital:
|
|
|
|
|
patientDoctorAppointmentListHospital)))
|
|
|
|
|
Future navigateToSearchResults(context, List<DoctorList> docList, List<PatientDoctorAppointmentList> patientDoctorAppointmentListHospital) async {
|
|
|
|
|
Navigator.push(context,
|
|
|
|
|
FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, isDoctorSearchResult: false, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital)))
|
|
|
|
|
.then((value) {
|
|
|
|
|
print("navigation return ");
|
|
|
|
|
dropdownValue = null;
|
|
|
|
|
@ -493,7 +443,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: LaserBooking(),
|
|
|
|
|
page: LaserClinic(selectedHospital: selectedHospital!),
|
|
|
|
|
),
|
|
|
|
|
).then((value) {
|
|
|
|
|
print("LaserBooking navigation return ");
|
|
|
|
|
@ -534,10 +484,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: LiveCareBookAppointment(
|
|
|
|
|
clinicName: dropdownTitle,
|
|
|
|
|
liveCareClinicID: dropdownValue!.split("-")[2],
|
|
|
|
|
liveCareServiceID: dropdownValue!.split("-")[3]),
|
|
|
|
|
page: LiveCareBookAppointment(clinicName: dropdownTitle, liveCareClinicID: dropdownValue!.split("-")[2], liveCareServiceID: dropdownValue!.split("-")[3]),
|
|
|
|
|
),
|
|
|
|
|
).then((value) {
|
|
|
|
|
print("navigation return ");
|
|
|
|
|
|