WD: hospital top and bottom name added

merge-update-with-lab-changes
taha.alam 2 years ago
parent fe9d259cbd
commit 81b94814ce

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

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

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

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

@ -70,16 +70,11 @@ class _SearchByHospitalState extends State<SearchByHospital> {
value: nearestAppo, value: nearestAppo,
onChanged: (bool? value) { onChanged: (bool? value) {
nearestAppo = value ?? false; nearestAppo = value ?? false;
setState(() { setState(() {});
});
}, },
), ),
AutoSizeText( AutoSizeText(
TranslationBase TranslationBase.of(context).nearestAppo.trim(),
.of(context)
.nearestAppo
.trim(),
maxLines: 1, maxLines: 1,
minFontSize: 10, minFontSize: 10,
style: TextStyle( style: TextStyle(
@ -93,14 +88,12 @@ class _SearchByHospitalState extends State<SearchByHospital> {
], ],
), ),
), ),
mHeight(8), mHeight(8),
Container( Container(
width: double.infinity, width: double.infinity,
decoration: containerRadius(Colors.white, 12), decoration: containerRadius(Colors.white, 12),
margin: EdgeInsets.only(left: 20, right: 20), margin: EdgeInsets.only(left: 20, right: 20),
padding: padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12),
child: Row( child: Row(
children: [ children: [
Flexible( Flexible(
@ -108,9 +101,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
TranslationBase TranslationBase.of(context).selectHospital,
.of(context)
.selectHospital,
style: TextStyle( style: TextStyle(
fontSize: 11, fontSize: 11,
letterSpacing: -0.44, letterSpacing: -0.44,
@ -123,9 +114,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
child: DropdownButtonHideUnderline( child: DropdownButtonHideUnderline(
child: DropdownButton<HospitalsModel>( child: DropdownButton<HospitalsModel>(
hint: Text( hint: Text(
TranslationBase TranslationBase.of(context).selectHospital),
.of(context)
.selectHospital),
value: selectedHospital, value: selectedHospital,
iconSize: 0, iconSize: 0,
isExpanded: true, isExpanded: true,
@ -141,8 +130,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
maxLines: 1, maxLines: 1,
minFontSize: 10, minFontSize: 10,
style: TextStyle( style: TextStyle(
fontSize: fontSize: SizeConfig.textMultiplier! * 1.6,
SizeConfig.textMultiplier! * 1.6,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: -0.39, letterSpacing: -0.39,
height: 0.8, height: 0.8,
@ -151,7 +139,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
// Text('${item.name!}'), // Text('${item.name!}'),
); );
}).toList(), }).toList(),
onChanged: (HospitalsModel? newValue){ onChanged: (HospitalsModel? newValue) {
getClinicWrtHospital(newValue); getClinicWrtHospital(newValue);
setState(() { setState(() {
selectedHospital = newValue; selectedHospital = newValue;
@ -182,8 +170,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
"-" + "-" +
clincs.liveCareClinicID.toString() + clincs.liveCareClinicID.toString() +
"-" + "-" +
clincs.liveCareServiceID.toString( clincs.liveCareServiceID.toString();
);
}); });
getDoctorsList(context); getDoctorsList(context);
@ -208,9 +195,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
TranslationBase TranslationBase.of(context).selectClinic,
.of(context)
.selectClinic,
style: TextStyle( style: TextStyle(
fontSize: 11, fontSize: 11,
letterSpacing: -0.44, letterSpacing: -0.44,
@ -264,9 +249,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
getProjectsList() { getProjectsList() {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
int languageID = context int languageID = context.read<ProjectViewModel>().isArabic ? 1 : 2;
.read<ProjectViewModel>()
.isArabic ? 1 : 2;
ClinicListService service = new ClinicListService(); ClinicListService service = new ClinicListService();
List<HospitalsModel> projectsListLocal = []; List<HospitalsModel> projectsListLocal = [];
service.getProjectsList(languageID, context).then((res) { service.getProjectsList(languageID, context).then((res) {
@ -289,7 +272,6 @@ class _SearchByHospitalState extends State<SearchByHospital> {
}); });
} }
void getClinicWrtHospital(HospitalsModel? newValue) async { void getClinicWrtHospital(HospitalsModel? newValue) async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
ClinicListService service = new ClinicListService(); ClinicListService service = new ClinicListService();
@ -299,43 +281,33 @@ class _SearchByHospitalState extends State<SearchByHospital> {
}); });
List<ListClinicCentralized> clinicId = []; List<ListClinicCentralized> clinicId = [];
try { try {
Map res = await service Map res = await service.getClinicByHospital(
.getClinicB
yHospital(
projectID: newValue?.mainProjectID.toString() ?? ""); projectID: newValue?.mainProjectID.toString() ?? "");
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
List list = res['ListClinic']; List list = res['ListClinic'];
if (list.isEmpty) { if (list.isEmpty) {
AppToast.showErrorToast(message: AppToast.showErrorToast(
TranslationBase message: TranslationBase.of(context).NoClinicFound,
.of(context)
.NoClinicFound,
); );
} }
res['ListClinic'].forEach((v) { res['ListClinic'].forEach((v) {
clinicId.add(ListClinicCentralized.fromJson(v)); clinicId.add(ListClinicCentralized.fromJson(v));
}); });
clinicIds = clinicId; clinicIds = clinicId;
setState(() { setState(() {});
});
} else { } else {
AppToast.showErrorToast(message: AppToast.showErrorToast(
TranslationBase message: TranslationBase.of(context).NoClinicFound,
.of(context)
.NoClinicFound,
); );
} }
} catch (e) { } catch (e) {
print("the error is $e"); print("the error is $e");
AppToast.showErrorToast(message: AppToast.showErrorToast(
TranslationBase.of(context).NoClinicFound, message: TranslationBase.of(context).NoClinicFound,
); );
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
} }
// .then((res) { // .then((res) {
@ -383,8 +355,8 @@ class _SearchByHospitalState extends State<SearchByHospital> {
super.dispose(); super.dispose();
} }
Future navigateToDentalComplaints(BuildContext context, Future navigateToDentalComplaints(
SearchInfo searchInfo) async { BuildContext context, SearchInfo searchInfo) async {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
@ -400,9 +372,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
} }
callDoctorsSearchAPI(int clinicID) { callDoctorsSearchAPI(int clinicID) {
int languageID = context int languageID = context.read<ProjectViewModel>().isArabic ? 1 : 2;
.read<ProjectViewModel>()
.isArabic ? 1 : 2;
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
List<DoctorList> doctorsList = []; List<DoctorList> doctorsList = [];
List<String> arr = []; List<String> arr = [];
@ -429,7 +399,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
if (res['DoctorList'].length != 0) { if (res['DoctorList'].length != 0) {
doctorsList.clear(); doctorsList.clear();
res['DoctorList'].forEach((v) { res['DoctorList'].forEach((v) {
doctorsList.add( DoctorList.fromJson(v)); doctorsList.add(DoctorList.fromJson(v));
}); });
doctorsList.forEach((element) { doctorsList.forEach((element) {
List<PatientDoctorAppointmentList> doctorByHospital = List<PatientDoctorAppointmentList> doctorByHospital =
@ -449,7 +419,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
} else { } else {
_patientDoctorAppointmentListHospital.add( _patientDoctorAppointmentListHospital.add(
PatientDoctorAppointmentList( PatientDoctorAppointmentList(
filterName: element.projectName, filterName: element.getProjectCompleteName(),
distanceInKMs: distanceInKMs:
element.projectDistanceInKiloMeters.toString(), element.projectDistanceInKiloMeters.toString(),
patientDoctorAppointment: element)); patientDoctorAppointment: element));
@ -472,7 +442,8 @@ class _SearchByHospitalState extends State<SearchByHospital> {
}); });
} }
Future navigateToSearchResults(context, Future navigateToSearchResults(
context,
List<DoctorList> docList, List<DoctorList> docList,
List<PatientDoctorAppointmentList> List<PatientDoctorAppointmentList>
patientDoctorAppointmentListHospital) async { patientDoctorAppointmentListHospital) async {
@ -490,9 +461,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
dropdownTitle = ""; dropdownTitle = "";
selectedHospital = null; selectedHospital = null;
clinicIds = List.empty(); clinicIds = List.empty();
setState(() { setState(() {});
});
// getProjectsList(); // getProjectsList();
}); });
} }
@ -522,13 +491,8 @@ class _SearchByHospitalState extends State<SearchByHospital> {
searchInfo.clinic = selectedClinic; searchInfo.clinic = selectedClinic;
searchInfo.date = DateTime.now(); searchInfo.date = DateTime.now();
if (context if (context.read<ProjectViewModel>().isLogin) {
.read<ProjectViewModel>() if (context.read<ProjectViewModel>().user.age! > 12) {
.isLogin) {
if (context
.read<ProjectViewModel>()
.user
.age! > 12) {
navigateToDentalComplaints(context, searchInfo); navigateToDentalComplaints(context, searchInfo);
} else { } else {
callDoctorsSearchAPI(17); callDoctorsSearchAPI(17);
@ -564,9 +528,7 @@ class _SearchByHospitalState extends State<SearchByHospital> {
callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0])); callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0]));
} }
}); });
setState(() { setState(() {});
});
} else { } else {
callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0])); callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0]));
} }

Loading…
Cancel
Save