WD: hospital top and bottom name added

merge-update-with-lab-changes
taha.alam 1 year ago
parent fe9d259cbd
commit 81b94814ce

@ -44,6 +44,8 @@ class DoctorList {
List<String>? specialityN;
dynamic workingHours;
dynamic decimalDoctorRate;
String? projectBottomName;
String? projectTopName;
DoctorList(
{this.clinicID,
@ -90,7 +92,9 @@ class DoctorList {
this.speciality,
this.specialityN,
this.workingHours,
this.decimalDoctorRate});
this.decimalDoctorRate,
this.projectBottomName,
this.projectTopName});
DoctorList.fromJson(Map<String, dynamic> json) {
clinicID = json['ClinicID'];
@ -138,6 +142,8 @@ class DoctorList {
if (json.containsKey('SpecialityN') && json['SpecialityN'] != null) specialityN = json['SpecialityN'].cast<String>();
workingHours = json['WorkingHours'];
decimalDoctorRate = json['DecimalDoctorRate'];
projectBottomName = json['ProjectNameBottom'];
projectTopName = json['ProjectNameTop'];
}
Map<String, dynamic> toJson() {
@ -188,6 +194,10 @@ class DoctorList {
data['DecimalDoctorRate'] = this.decimalDoctorRate;
return data;
}
String getProjectCompleteName(){
return "${this.projectTopName} ${this.projectBottomName}";
}
}
class PatientDoctorAppointmentList {

@ -79,13 +79,12 @@ class _SearchState extends State<Search> with TickerProviderStateMixin {
letterSpacing: -0.48,
),
tabs: [
Text(
TranslationBase.of(context).clinicName,
TranslationBase.of(context).hospitalName,
style: TextStyle(fontSize: 12),
),
Text(
TranslationBase.of(context).hospitalName,
TranslationBase.of(context).clinicName,
style: TextStyle(fontSize: 12),
),
Text(
@ -112,8 +111,8 @@ class _SearchState extends State<Search> with TickerProviderStateMixin {
child: TabBarView(
physics: NeverScrollableScrollPhysics(),
children: [
SearchByClinic(clnicIds: widget.clnicIds),
SearchByHospital(),
SearchByClinic(clnicIds: widget.clnicIds),
SearchByDoctor(),
],
controller: _tabController,

@ -656,7 +656,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
_patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element);
} else {
_patientDoctorAppointmentListHospital
.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element));
.add(PatientDoctorAppointmentList(filterName: element.getProjectCompleteName(), distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element));
}
});
} else {}

@ -111,7 +111,7 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
_patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element);
} else {
_patientDoctorAppointmentListHospital
.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element));
.add(PatientDoctorAppointmentList(filterName: element.getProjectCompleteName(), distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element));
}
});
} else {

@ -70,16 +70,11 @@ class _SearchByHospitalState extends State<SearchByHospital> {
value: nearestAppo,
onChanged: (bool? value) {
nearestAppo = value ?? false;
setState(() {
});
setState(() {});
},
),
AutoSizeText(
TranslationBase
.of(context)
.nearestAppo
.trim(),
TranslationBase.of(context).nearestAppo.trim(),
maxLines: 1,
minFontSize: 10,
style: TextStyle(
@ -93,14 +88,12 @@ class _SearchByHospitalState extends State<SearchByHospital> {
],
),
),
mHeight(8),
Container(
width: double.infinity,
decoration: containerRadius(Colors.white, 12),
margin: EdgeInsets.only(left: 20, right: 20),
padding:
EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
child: Row(
children: [
Flexible(
@ -108,9 +101,7 @@ 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,
@ -123,9 +114,7 @@ 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,
@ -141,8 +130,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
maxLines: 1,
minFontSize: 10,
style: TextStyle(
fontSize:
SizeConfig.textMultiplier! * 1.6,
fontSize: SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.w600,
letterSpacing: -0.39,
height: 0.8,
@ -151,7 +139,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
// Text('${item.name!}'),
);
}).toList(),
onChanged: (HospitalsModel? newValue){
onChanged: (HospitalsModel? newValue) {
getClinicWrtHospital(newValue);
setState(() {
selectedHospital = newValue;
@ -172,29 +160,28 @@ 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,
@ -208,9 +195,7 @@ 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,
@ -264,9 +249,7 @@ 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) {
@ -289,7 +272,6 @@ class _SearchByHospitalState extends State<SearchByHospital> {
});
}
void getClinicWrtHospital(HospitalsModel? newValue) async {
GifLoaderDialogUtils.showMyDialog(context);
ClinicListService service = new ClinicListService();
@ -299,43 +281,33 @@ class _SearchByHospitalState extends State<SearchByHospital> {
});
List<ListClinicCentralized> clinicId = [];
try {
Map res = await service
.getClinicB
yHospital(
Map res = await service.getClinicByHospital(
projectID: newValue?.mainProjectID.toString() ?? "");
GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) {
List list = res['ListClinic'];
if (list.isEmpty) {
AppToast.showErrorToast(message:
TranslationBase
.of(context)
.NoClinicFound,
AppToast.showErrorToast(
message: TranslationBase.of(context).NoClinicFound,
);
}
res['ListClinic'].forEach((v) {
clinicId.add(ListClinicCentralized.fromJson(v));
});
clinicIds = clinicId;
setState(() {
});
setState(() {});
} else {
AppToast.showErrorToast(message:
TranslationBase
.of(context)
.NoClinicFound,
AppToast.showErrorToast(
message: TranslationBase.of(context).NoClinicFound,
);
}
} catch (e) {
print("the error is $e");
AppToast.showErrorToast(message:
TranslationBase.of(context).NoClinicFound,
);
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(
message: TranslationBase.of(context).NoClinicFound,
);
GifLoaderDialogUtils.hideDialog(context);
}
// .then((res) {
@ -383,8 +355,8 @@ 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(
@ -400,9 +372,7 @@ 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 = [];
@ -410,18 +380,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) {
@ -429,29 +399,29 @@ class _SearchByHospitalState extends State<SearchByHospital> {
if (res['DoctorList'].length != 0) {
doctorsList.clear();
res['DoctorList'].forEach((v) {
doctorsList.add( 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 {
_patientDoctorAppointmentListHospital.add(
PatientDoctorAppointmentList(
filterName: element.projectName,
filterName: element.getProjectCompleteName(),
distanceInKMs:
element.projectDistanceInKiloMeters.toString(),
element.projectDistanceInKiloMeters.toString(),
patientDoctorAppointment: element));
}
});
@ -472,27 +442,26 @@ 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 = "";
selectedHospital = null;
clinicIds = List.empty();
setState(() {
});
setState(() {});
// getProjectsList();
});
}
@ -522,13 +491,8 @@ 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);
@ -540,9 +504,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(
@ -564,9 +528,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0]));
}
});
setState(() {
});
setState(() {});
} else {
callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0]));
}

Loading…
Cancel
Save