merge-update-with-lab-changes
Sultan Khan 5 years ago
parent badb4e52df
commit 3a4c016f4e

@ -7,7 +7,8 @@ import 'package:flutter/material.dart';
class Search extends StatefulWidget {
final int type;
Search({this.type = 0});
final List clnicIds;
Search({this.type = 0, this.clnicIds});
@override
_SearchState createState() => _SearchState();
}
@ -41,7 +42,12 @@ class _SearchState extends State<Search> with TickerProviderStateMixin {
),
body: TabBarView(
physics: NeverScrollableScrollPhysics(),
children: [SearchByClinic(), SearchByDoctor()],
children: [
SearchByClinic(
clnicIds: widget.clnicIds,
),
SearchByDoctor()
],
controller: _tabController),
bottomNavigationBar: BottomBarSearch());
}

@ -17,6 +17,8 @@ import '../SearchResults.dart';
import "dart:collection";
class SearchByClinic extends StatefulWidget {
final List clnicIds;
SearchByClinic({this.clnicIds});
@override
_SearchByClinicState createState() => _SearchByClinicState();
}
@ -30,14 +32,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
@override
void initState() {
WidgetsBinding.instance.addPostFrameCallback((_) => getClinicsList());
// event.controller.stream.listen((p) {
// if (p['clinic_id'] != null) {
// // setState(() {
// dropdownValue = p['clinic_id'].toString();
// //});
// getDoctorsList(context);
// }
// });
super.initState();
}
@ -109,6 +104,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
clinicsList.add(new ListClinicCentralized.fromJson(v));
});
});
filterClinic();
} else {}
}).catchError((err) {
print(err);
@ -167,4 +163,13 @@ class _SearchByClinicState extends State<SearchByClinic> {
);
//builder: (context) => SearchResults(doctorsList: docList)));
}
filterClinic() {
setState(() {
clinicsList = clinicsList
.where((i) => widget.clnicIds.indexOf(i.clinicID) > -1)
.toList();
print(clinicsList);
});
}
}

@ -54,7 +54,9 @@ class DoctorsListService extends BaseService {
"IsGetNearAppointment": false,
"Latitude": 0,
"Longitude": 0,
"License": true
"License": true,
// "IsVoiceCommand": doctorId != null && doctorId.length > 0 ? true : false,
// "DoctorIDsList": doctorId
};
dynamic localRes;

@ -194,62 +194,70 @@ class _SearchBot extends State<BottomBarSearch> {
searchProvider
.getBotPages(request)
.then((value) => {getCommands(value['Understand'])});
//getDoctorsList(12, 17, 40036, context);
}
getCommands(result) async {
//RoboSearch.closeAlertDialog(context);
print(result);
results = result;
//getDoctorsList(12, 17, 40036, context);
List clnicID = unique(result['ClinicId']);
switch (result["CommandNumber"]) {
case 100:
if (result['ProjectId'] != 0 &&
result['ClinicId'] != 0 &&
result['DoctorId'] != 0) {
clnicID.length > 0 &&
result['DoctorId'].length > 0) {
var name = result['DoctorName'].replaceAll('دكتور', '');
getDoctorsList(
result['ProjectId'],
result['ClinicId'],
context,
doctorId: result['DoctorId'],
doctorName: name.trim(),
);
if (clnicID.length == 1) {
getDoctorsList(
result['ProjectId'],
clnicID[0],
context,
doctorId: result['DoctorId'],
doctorName: name.trim(),
);
} else {
goToClinic(clnicID);
}
} else if (result['ProjectId'] != 0 &&
result['ClinicId'] != 0 &&
result['DoctorId'] == 0) {
getDoctorsList(
result['ProjectId'],
result['ClinicId'],
context,
);
clnicID.length > 0 &&
result['DoctorId'].length == 0) {
if (clnicID.length == 1) {
getDoctorsList(
result['ProjectId'],
clnicID[0],
context,
);
} else {
goToClinic(clnicID);
}
} else if (result['ProjectId'] == 0 &&
result['ClinicId'] != 0 &&
result['DoctorId'] == 0) {
getDoctorsList(
result['ProjectId'],
result['ClinicId'],
context,
);
clnicID.length > 0 &&
result['DoctorId'].length == 0) {
if (clnicID.length == 1) {
getDoctorsList(
result['ProjectId'],
clnicID[0],
context,
);
} else {
goToClinic(clnicID);
}
} else if (result['ProjectId'] == 0 &&
result['ClinicId'] != 0 &&
result['DoctorId'] != 0) {
clnicID.length > 0 &&
result['DoctorId'].length > 0) {
var name = result['DoctorName'].replaceAll('دكتور', '');
getDoctorsList(
result['ProjectId'],
result['ClinicId'],
context,
doctorId: result['DoctorId'],
doctorName: name.trim(),
);
if (clnicID.length == 1) {
getDoctorsList(
result['ProjectId'],
clnicID[0],
context,
doctorId: result['DoctorId'],
doctorName: name.trim(),
);
} else {
goToClinic(clnicID);
}
} else {
Navigator.push(
AppGlobal.context,
MaterialPageRoute(
builder: (context) => Search(
type: 0,
)));
goToClinic(clnicID);
}
speak();
break;
@ -327,9 +335,9 @@ class _SearchBot extends State<BottomBarSearch> {
doctorsList.add(new DoctorList.fromJson(v));
arr.add(new DoctorList.fromJson(v).projectName);
});
if (res['DoctorList'].length == 1 && doctorId != null) {
if (res['DoctorList'].length == 1) {
getDoctorProfile(
projectId, clinicId, doctorId, context, doctorsList);
projectId, clinicId, doctorId[0], context, doctorsList);
//speak();
} else {
@ -384,4 +392,19 @@ class _SearchBot extends State<BottomBarSearch> {
// initSpeechState().then((value) => startVoiceSearch());
// });
}
goToClinic(List ids) {
Navigator.push(
AppGlobal.context,
MaterialPageRoute(
builder: (context) => Search(
type: 0,
clnicIds: ids,
)));
// eventProvider.setValue({"clinic_id": ids});
}
List unique(List list) {
return list.toSet().toList();
}
}

Loading…
Cancel
Save