family file

merge-update-with-lab-changes
Sultan Khan 6 years ago
parent 826c50ebf1
commit f6a3f0e615

@ -388,16 +388,12 @@ const Map<String, Map<String, String>> localizedValues = {
"building": {"en": "Building:", "ar": "المبنى"}, "building": {"en": "Building:", "ar": "المبنى"},
"branch": {"en": "Branch:", "ar": "الفرع"}, "branch": {"en": "Branch:", "ar": "الفرع"},
"emergencyServices": {"en": "Emergency Services:", "ar": "خدمات الطوارئ"}, "emergencyServices": {"en": "Emergency Services:", "ar": "خدمات الطوارئ"},
"locationDialogMessage": {"en": "Allow the HMG app to access your location will assist you in showing the hospitals according to the nearest to you.", "ar": "السماح لتطبيق مجموعة الحبيب الطبية بالوصول إلى موقعك سيساعدك في إظهار المستشفيات وفقًا للأقرب إليك."}, "user-view-requester": {
"parking":{"en":"Parking","ar":"مواقف"}, "en": "User Wants To View Your Medical File",
"alhabiServices":{"en":"HMG Service","ar":"خدمات الحبيب"}, "ar": "أشخاص يرغبون الاطلاع على ملفك الطبي"
"parkingTitle":{"en":"Car service, car service, service to save parking information, return to it later, 1- By clicking on (Read the code), save the parking data. 2- By clicking on the button (view my car park), it shows you the cars location in Google Maps. 3- Read another position by pressing the Clear Position Data button.","ar":" خدمة المواقف، تتيح هذه الخدمة للمستخدم معلومات عن موقف السيارة ليسهل عليه العودة لها لاحقاً ، 1- بالضغط على زر(قراءة الكود) تستطيع حفظ البيانات الخاصة بالموقف. 2-بالضغط على زر(عرض موقف سيارتي) يعرض لك موقع السيارة في خرائط قوقل. 3- لإعادة قراءة موقف آخرعن طريق الضغط على زر(مسح بيانات الموقف). "}, },
"readBarcode":{"en":"Read Barcode","ar":"قراءة الكود"}, "user-view": {
"showMyPark":{"en":"Show My Park","ar":"عرض بارك"}, "en": "User Can View Your Medical File",
"clearMyData":{"en":"clear My Data","ar":"امسح البيانات"}, "ar": "أشخاص يمكنهم الاطلاع على ملفك الطبي"
"floor":{"en":"Floor:","ar":"الطابق"}, },
"gate":{"en":"Gate:","ar":"بوابة"},
"building":{"en":"Building:","ar":"المبنى"},
"branch":{"en":"Branch:","ar":"الفرع"},
"emergencyServices":{"en":"Emergency Services:","ar":"خدمات الطوارئ"}
}; };

@ -256,10 +256,12 @@ class _SearchByClinicState extends State<SearchByClinic> {
filterClinic() { filterClinic() {
setState(() { setState(() {
if (widget.clnicIds.length > 0) {
clinicsList = clinicsList clinicsList = clinicsList
.where((i) => widget.clnicIds.indexOf(i.clinicID) > -1) .where((i) => widget.clnicIds.indexOf(i.clinicID) > -1)
.toList(); .toList();
print(clinicsList); print(clinicsList);
}
}); });
} }
} }

@ -1,74 +1,117 @@
import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart';
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart';
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/routes.dart';
class MyFamily extends StatelessWidget { class MyFamily extends StatefulWidget {
//bool isLoading = true; @override
_MyFamily createState() => _MyFamily();
}
class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
final familyFileProvider = FamilyFilesProvider(); final familyFileProvider = FamilyFilesProvider();
AppSharedPreferences sharedPref = new AppSharedPreferences(); AppSharedPreferences sharedPref = new AppSharedPreferences();
var userID; var userID;
TabController _tabController;
@override
void initState() {
_tabController = new TabController(length: 2, vsync: this, initialIndex: 0);
super.initState();
}
bool expandFlag = false;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return Scaffold(
appBarTitle: TranslationBase.of(context).myFamilyFiles, appBar: AppBar(
isShowAppBar: true, bottom: TabBar(
body: DefaultTabController(
length: 2,
child: SingleChildScrollView(
padding: EdgeInsets.all(20),
child: Container(
height: SizeConfig.realScreenHeight,
width: SizeConfig.realScreenWidth,
child: Stack(
children: <Widget>[
TabBar(
indicatorColor: Colors.red, indicatorColor: Colors.red,
tabs: [ tabs: [
Padding( Padding(
padding: EdgeInsets.all(6), padding: EdgeInsets.all(6),
child: child: AppText(
Text(TranslationBase.of(context).family)), TranslationBase.of(context).family,
color: Colors.white,
)),
Padding( Padding(
padding: EdgeInsets.all(6), padding: EdgeInsets.all(6),
child: child: AppText(
Text(TranslationBase.of(context).request)), TranslationBase.of(context).request,
color: Colors.white,
)),
], ],
controller: _tabController,
), ),
TabBarView( title: AppText(TranslationBase.of(context).myFamilyFiles,
children: [ color: Colors.white)),
myFamilyDetails(context), body: TabBarView(
myFamilyRequest(context) // physics: NeverScrollableScrollPhysics(),
], children: [myFamilyDetails(context), myFamilyRequest(context)],
) controller: _tabController),
], bottomNavigationBar: BottomBarSearch());
)))));
// AppScaffold(
// appBarTitle: TranslationBase.of(context).myFamilyFiles,
// isShowAppBar: true,
// body: SingleChildScrollView(
// child: Container(
// height: SizeConfig.screenHeight,
// width: SizeConfig.realScreenWidth,
// padding: EdgeInsets.all(20),
// child: Stack(
// children: <Widget>[
// TabBar(
// controller: _tabController,
// indicatorColor: Colors.red,
// tabs: [
// Padding(
// padding: EdgeInsets.all(6),
// child: Text(TranslationBase.of(context).family)),
// Padding(
// padding: EdgeInsets.all(6),
// child: Text(TranslationBase.of(context).request)),
// ],
// ),
// TabBarView(
// controller: _tabController,
// children: [
// myFamilyDetails(context),
// myFamilyRequest(context)
// ],
// )
// ],
// ))));
} }
Widget myFamilyDetails(context) { Widget myFamilyDetails(context) {
return // Padding( return Container(
//padding: EdgeInsets.only(top: 50), height: MediaQuery.of(context).size.height,
//child: margin: EdgeInsets.fromLTRB(20.0, 0, 20.0, 0.0),
Column( child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 3, flex: 1,
child: FutureBuilder( child: FutureBuilder(
future: getFamilyFiles(), // async work future: getFamilyFiles(), // async work
builder: (BuildContext context, builder: (BuildContext context,
AsyncSnapshot<GetAllSharedRecordsByStatusResponse> snapshot) { AsyncSnapshot<GetAllSharedRecordsByStatusResponse>
snapshot) {
switch (snapshot.connectionState) { switch (snapshot.connectionState) {
case ConnectionState.waiting: case ConnectionState.waiting:
return Padding( return Padding(
@ -84,21 +127,24 @@ class MyFamily extends StatelessWidget {
padding: EdgeInsets.only(top: 50), padding: EdgeInsets.only(top: 50),
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 3, flex: 3,
child: Text( child: Text(TranslationBase.of(context)
TranslationBase.of(context).request)), .request)),
Expanded( Expanded(
flex: 2, flex: 2,
child: Text( child: Text(
TranslationBase.of(context).switchUser, TranslationBase.of(context)
.switchUser,
)), )),
Expanded( Expanded(
flex: 1, flex: 1,
child: Text( child: Text(
TranslationBase.of(context).deleteView, TranslationBase.of(context)
.deleteView,
)), )),
], ],
), ),
@ -114,8 +160,8 @@ class MyFamily extends StatelessWidget {
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 3, flex: 3,
child: child: Text(
Text(result.patientName)), result.patientName)),
Expanded( Expanded(
flex: 2, flex: 2,
child: IconButton( child: IconButton(
@ -149,6 +195,7 @@ class MyFamily extends StatelessWidget {
Expanded( Expanded(
flex: 1, flex: 1,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
Row( Row(
children: <Widget>[ children: <Widget>[
@ -156,7 +203,8 @@ class MyFamily extends StatelessWidget {
child: DefaultButton( child: DefaultButton(
TranslationBase.of(context).addFamilyMember, TranslationBase.of(context).addFamilyMember,
() => { () => {
Navigator.of(context).pushNamed(ADD_FAMILY_MEMBER_TYPE) Navigator.of(context)
.pushNamed(ADD_FAMILY_MEMBER_TYPE)
}, },
color: Colors.grey[900], color: Colors.grey[900],
textColor: Colors.white, textColor: Colors.white,
@ -166,13 +214,138 @@ class MyFamily extends StatelessWidget {
], ],
)) ))
], ],
); ));
} }
addMember() {}
Widget myFamilyRequest(context) { Widget myFamilyRequest(context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
children: <Widget>[
// SizedBox(height: 20.0),
RoundedContainer(
child: ExpansionTile(
title: Text(
TranslationBase.of(context).userViewRequest,
style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold),
),
children: <Widget>[
FutureBuilder(
future: getUserViewRequest(), // async work
builder: (BuildContext context,
AsyncSnapshot<dynamic> snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
return Padding(
padding: EdgeInsets.only(top: 50),
child: Text('Loading....'));
default:
if (snapshot.hasError)
return Padding(
padding: EdgeInsets.all(10),
child: Text(snapshot.error));
else
return Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
flex: 3,
child: Text(TranslationBase.of(context)
.request)),
Expanded(
flex: 2,
child: Text(
TranslationBase.of(context)
.switchUser,
)),
Expanded(
flex: 1,
child: Text(
TranslationBase.of(context)
.deleteView,
)),
],
),
Column(
children: [],
)
],
);
}
})
],
),
),
RoundedContainer(
child: ExpansionTile(
title: Text(
TranslationBase.of(context).sentRequest,
style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold),
),
children: <Widget>[
FutureBuilder(
future: getSentRequest(), // async work
builder:
(BuildContext context, AsyncSnapshot<dynamic> snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
return Padding(
padding: EdgeInsets.only(top: 50),
child: Text('Loading....'));
default:
if (snapshot.hasError)
return Padding(
padding: EdgeInsets.all(10),
child: Text(snapshot.error));
else
return Column( return Column(
children: <Widget>[], children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
flex: 3,
child: Text(
TranslationBase.of(context).request)),
Expanded(
flex: 2,
child: Text(
TranslationBase.of(context).switchUser,
)),
Expanded(
flex: 1,
child: Text(
TranslationBase.of(context).deleteView,
)),
],
),
Column(
children: [],
)
],
);
}
})
],
)),
RoundedContainer(
child: ExpansionTile(
title: Text(
TranslationBase.of(context).userView,
style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold),
),
children: <Widget>[
ListTile(
title: Text('data'),
)
],
))
],
),
); );
} }
@ -186,6 +359,16 @@ class MyFamily extends StatelessWidget {
} }
} }
Future getUserViewRequest() async {
var user = await sharedPref.getObject(USER_PROFILE);
return familyFileProvider.getUserViewRequest(user['PatientID']);
}
Future getSentRequest() async {
// var user = await sharedPref.getObject(USER_PROFILE);
return familyFileProvider.getUserSentRequest();
}
deleteFamily(family, context) { deleteFamily(family, context) {
ConfirmDialog dialog = new ConfirmDialog( ConfirmDialog dialog = new ConfirmDialog(
context: context, context: context,

@ -24,7 +24,7 @@ class DoctorsListService extends BaseService {
double long; double long;
Future<Map> getDoctorsList(int clinicID, int projectID, BuildContext context, Future<Map> getDoctorsList(int clinicID, int projectID, BuildContext context,
{doctorId}) async { {doctorId, doctorName}) async {
//Utils.showProgressDialog(context); //Utils.showProgressDialog(context);
Map<String, dynamic> request; Map<String, dynamic> request;
@ -54,7 +54,7 @@ class DoctorsListService extends BaseService {
"SessionID": "YckwoXhUmWBsnHKEKig", "SessionID": "YckwoXhUmWBsnHKEKig",
"ClinicID": clinicID, "ClinicID": clinicID,
"ProjectID": projectID, "ProjectID": projectID,
//"DoctorName": doctorId, //!= null ? doctorId : 0, "DoctorName": doctorName, //!= null ? doctorId : 0,
"ContinueDentalPlan": false, "ContinueDentalPlan": false,
"IsSearchAppointmnetByClinicID": true, "IsSearchAppointmnetByClinicID": true,
"PatientID": authUser.patientID != null ? authUser.patientID : 0, "PatientID": authUser.patientID != null ? authUser.patientID : 0,
@ -94,7 +94,8 @@ class DoctorsListService extends BaseService {
authUser = data; authUser = data;
} }
if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { if (await this.sharedPref.getDouble(USER_LAT) != null &&
await this.sharedPref.getDouble(USER_LONG) != null) {
lat = await this.sharedPref.getDouble(USER_LAT); lat = await this.sharedPref.getDouble(USER_LAT);
long = await this.sharedPref.getDouble(USER_LONG); long = await this.sharedPref.getDouble(USER_LONG);
} }

@ -33,6 +33,10 @@ const String REMOVE_FILE_STATUS =
const String ACTIVATION_CODE_URL = const String ACTIVATION_CODE_URL =
"Services/Authentication.svc/REST/CheckActivationCode"; "Services/Authentication.svc/REST/CheckActivationCode";
const String SENT_REQUEST_URL =
'Services/Authentication.svc/REST/GetAllSharedRecordsByStatus';
const String RECEVIED_REQUEST_URL =
'Services/Authentication.svc/REST/GetAllPendingRecordsByResponseId';
class FamilyFilesProvider with ChangeNotifier { class FamilyFilesProvider with ChangeNotifier {
bool isLogin = false; bool isLogin = false;
@ -60,6 +64,48 @@ class FamilyFilesProvider with ChangeNotifier {
} }
} }
Future getUserViewRequest(responseID) async {
try {
dynamic localRes;
Map<String, dynamic> request = {};
request['ResponseID'] = responseID;
await new BaseAppClient().post(RECEVIED_REQUEST_URL,
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
AppToast.showErrorToast(message: error);
throw error;
}, body: request);
sharedPref.setObject(FAMILY_FILE, localRes);
return Future.value(
GetAllSharedRecordsByStatusResponse.fromJson(localRes));
} catch (error) {
print(error);
throw error;
}
}
Future getUserSentRequest() async {
try {
dynamic localRes;
Map<String, dynamic> request = {};
request['Status'] = 0;
await new BaseAppClient().post(SENT_REQUEST_URL,
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
AppToast.showErrorToast(message: error);
throw error;
}, body: request);
sharedPref.setObject(FAMILY_FILE, localRes);
return Future.value(
GetAllSharedRecordsByStatusResponse.fromJson(localRes));
} catch (error) {
print(error);
throw error;
}
}
Future<dynamic> addFamilyFile(AddFamilyFileReq request) async { Future<dynamic> addFamilyFile(AddFamilyFileReq request) async {
try { try {
dynamic localRes; dynamic localRes;

@ -417,24 +417,37 @@ class TranslationBase {
String get removeFamilyMember => String get removeFamilyMember =>
localizedValues['remove-family-member'][locale.languageCode]; localizedValues['remove-family-member'][locale.languageCode];
String get myMedicalFile =>localizedValues['MyMedicalFile'][locale.languageCode]; String get myMedicalFile =>
String get myMedicalFileSubTitle =>localizedValues['myMedicalFileSubTitle'][locale.languageCode]; localizedValues['MyMedicalFile'][locale.languageCode];
String get myMedicalFileSubTitle =>
localizedValues['myMedicalFileSubTitle'][locale.languageCode];
String get viewMore => localizedValues['viewMore'][locale.languageCode]; String get viewMore => localizedValues['viewMore'][locale.languageCode];
String get homeHealthCareService =>localizedValues['homeHealthCareService'][locale.languageCode]; String get homeHealthCareService =>
String get onlinePharmacy =>localizedValues['OnlinePharmacy'][locale.languageCode]; localizedValues['homeHealthCareService'][locale.languageCode];
String get emergencyService =>localizedValues['EmergencyService'][locale.languageCode]; String get onlinePharmacy =>
String get onlinePaymentService =>localizedValues['OnlinePaymentService'][locale.languageCode]; localizedValues['OnlinePharmacy'][locale.languageCode];
String get offersAndPackages =>localizedValues['OffersAndPackages'][locale.languageCode]; String get emergencyService =>
String get comprehensiveMedicalCheckup =>localizedValues['ComprehensiveMedicalCheckup'][locale.languageCode]; localizedValues['EmergencyService'][locale.languageCode];
String get onlinePaymentService =>
localizedValues['OnlinePaymentService'][locale.languageCode];
String get offersAndPackages =>
localizedValues['OffersAndPackages'][locale.languageCode];
String get comprehensiveMedicalCheckup =>
localizedValues['ComprehensiveMedicalCheckup'][locale.languageCode];
String get hMGService => localizedValues['HMGService'][locale.languageCode]; String get hMGService => localizedValues['HMGService'][locale.languageCode];
String get viewAllHabibMedicalService =>localizedValues['ViewAllHabibMedicalService'][locale.languageCode]; String get viewAllHabibMedicalService =>
localizedValues['ViewAllHabibMedicalService'][locale.languageCode];
String get viewAll => localizedValues['viewAll'][locale.languageCode]; String get viewAll => localizedValues['viewAll'][locale.languageCode];
String get contactUs => localizedValues['ContactUs'][locale.languageCode]; String get contactUs => localizedValues['ContactUs'][locale.languageCode];
String get viewAllWaysReachUs =>localizedValues['ViewAllWaysReachUs'][locale.languageCode]; String get viewAllWaysReachUs =>
String get medicalProfile =>localizedValues['medicalProfile'][locale.languageCode]; localizedValues['ViewAllWaysReachUs'][locale.languageCode];
String get medicalProfile =>
localizedValues['medicalProfile'][locale.languageCode];
String get parking => localizedValues['parking'][locale.languageCode]; String get parking => localizedValues['parking'][locale.languageCode];
String get alhabiServices =>localizedValues['alhabiServices'][locale.languageCode]; String get alhabiServices =>
String get parkingTitle =>localizedValues['parkingTitle'][locale.languageCode]; localizedValues['alhabiServices'][locale.languageCode];
String get parkingTitle =>
localizedValues['parkingTitle'][locale.languageCode];
String get readBarcode => localizedValues['readBarcode'][locale.languageCode]; String get readBarcode => localizedValues['readBarcode'][locale.languageCode];
String get showMyPark => localizedValues['showMyPark'][locale.languageCode]; String get showMyPark => localizedValues['showMyPark'][locale.languageCode];
String get clearMyData => localizedValues['clearMyData'][locale.languageCode]; String get clearMyData => localizedValues['clearMyData'][locale.languageCode];
@ -442,8 +455,8 @@ class TranslationBase {
String get gate => localizedValues['gate'][locale.languageCode]; String get gate => localizedValues['gate'][locale.languageCode];
String get building => localizedValues['building'][locale.languageCode]; String get building => localizedValues['building'][locale.languageCode];
String get branch => localizedValues['branch'][locale.languageCode]; String get branch => localizedValues['branch'][locale.languageCode];
String get emergencyServices =>localizedValues['emergencyServices'][locale.languageCode]; String get emergencyServices =>
localizedValues['emergencyServices'][locale.languageCode];
String get consultation => String get consultation =>
localizedValues['consultation'][locale.languageCode]; localizedValues['consultation'][locale.languageCode];
@ -452,6 +465,11 @@ class TranslationBase {
localizedValues['textToSpeech'][locale.languageCode]; localizedValues['textToSpeech'][locale.languageCode];
String get locationDialogMessage => String get locationDialogMessage =>
localizedValues['locationDialogMessage'][locale.languageCode]; localizedValues['locationDialogMessage'][locale.languageCode];
String get userViewRequest =>
localizedValues['user-view-requester'][locale.languageCode];
String get userView => localizedValues['user-view'][locale.languageCode];
String get sentRequest =>
localizedValues['sent-requests'][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -138,7 +138,7 @@ class _SearchBot extends State<BottomBarSearch> {
} }
Future _speak(reconizedWord) async { Future _speak(reconizedWord) async {
await flutterTts.speak(reconizedWord); //await flutterTts.speak(reconizedWord);
getPages(reconizedWord); getPages(reconizedWord);
} }
@ -199,20 +199,21 @@ class _SearchBot extends State<BottomBarSearch> {
getCommands(result) async { getCommands(result) async {
print(result); print(result);
results = result; results = result;
List clnicID = unique(result['ClinicId']);
switch (result["CommandNumber"]) { switch (result["CommandNumber"]) {
case 100: case '100':
{
List clnicID = unique(result['ClinicId']);
if (result['ProjectId'] != 0 && if (result['ProjectId'] != 0 &&
clnicID.length > 0 && clnicID.length > 0 &&
result['DoctorId'].length > 0) { result['DoctorId'].length > 0) {
var name = result['DoctorName'].replaceAll('دكتور', '');
if (clnicID.length == 1) { if (clnicID.length == 1) {
getDoctorsList( getDoctorsList(
result['ProjectId'], result['ProjectId'],
clnicID[0], clnicID[0],
context, context,
doctorId: result['DoctorId'], doctorId: result['DoctorId'],
doctorName: name.trim(), doctorName: null,
); );
} else { } else {
goToClinic(clnicID); goToClinic(clnicID);
@ -244,14 +245,13 @@ class _SearchBot extends State<BottomBarSearch> {
} else if (result['ProjectId'] == 0 && } else if (result['ProjectId'] == 0 &&
clnicID.length > 0 && clnicID.length > 0 &&
result['DoctorId'].length > 0) { result['DoctorId'].length > 0) {
var name = result['DoctorName'].replaceAll('دكتور', '');
if (clnicID.length == 1) { if (clnicID.length == 1) {
getDoctorsList( getDoctorsList(
result['ProjectId'], result['ProjectId'],
clnicID[0], clnicID[0],
context, context,
doctorId: result['DoctorId'], doctorId: result['DoctorId'],
doctorName: name.trim(), doctorName: null,
); );
} else { } else {
goToClinic(clnicID); goToClinic(clnicID);
@ -260,33 +260,27 @@ class _SearchBot extends State<BottomBarSearch> {
goToClinic(clnicID); goToClinic(clnicID);
} }
speak(); speak();
}
break;
case '102':
{
// getDoctorsList(
// 0,
// 0,
// context,
// doctorId: null,
// doctorName: result['DoctorName'],
// );
getDoctorsList(
0,
0,
context,
doctorId: result['DoctorId'],
doctorName: null,
);
speak();
}
break; break;
// case '101':
// Navigator.push(
// AppGlobal.context,
// MaterialPageRoute(
// builder: (context) => Search(
// type: 0,
// )));
// break;
// case '102':
// Navigator.push(
// AppGlobal.context,
// MaterialPageRoute(
// builder: (context) => Search(
// type: 1,
// )));
// break;
// case '103':
// eventProvider.setValue({"clinic_id": understand});
// break;
// case '104':
// eventProvider.setValue({"project_id": understand});
// break;
// case '105':
// eventProvider.setValue({"doctor_id": understand});
// break;
default: default:
Navigator.of(context).pushNamed(HOME); Navigator.of(context).pushNamed(HOME);
speak(); speak();
@ -325,11 +319,13 @@ class _SearchBot extends State<BottomBarSearch> {
List<String> arrDistance = []; List<String> arrDistance = [];
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
service service
.getDoctorsList(clinicId, projectId, context, doctorId: doctorId) .getDoctorsList(clinicId, projectId, context,
doctorId: doctorId, doctorName: doctorName)
.then((res) { .then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
setState(() { setState(() {
if (res['SearchDoctorsByTime_IsVoiceCommandList'].length != 0) { if (res['SearchDoctorsByTime_IsVoiceCommandList'] != null &&
res['SearchDoctorsByTime_IsVoiceCommandList'].length != 0) {
doctorsList.clear(); doctorsList.clear();
res['SearchDoctorsByTime_IsVoiceCommandList'].forEach((v1) { res['SearchDoctorsByTime_IsVoiceCommandList'].forEach((v1) {
v1['DoctorList'].forEach((v) { v1['DoctorList'].forEach((v) {
@ -340,6 +336,25 @@ class _SearchBot extends State<BottomBarSearch> {
.toString()); .toString());
}); });
}); });
if (doctorsList.length == 1) {
getDoctorProfile(
projectId, clinicId, doctorId[0], context, doctorsList);
//speak();
} else {
navigateToSearchResults(context, doctorsList, arr, arrDistance);
}
} else if (res['DoctorList'].length != 0) {
doctorsList.clear();
res['DoctorList'].forEach((v) {
doctorsList.add(new DoctorList.fromJson(v));
arr.add(new DoctorList.fromJson(v).projectName);
arrDistance.add(new DoctorList.fromJson(v)
.projectDistanceInKiloMeters
.toString());
});
if (doctorsList.length == 1) { if (doctorsList.length == 1) {
getDoctorProfile( getDoctorProfile(
projectId, clinicId, doctorId[0], context, doctorsList); projectId, clinicId, doctorId[0], context, doctorsList);

Loading…
Cancel
Save