diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 66c0c855..e0468c1f 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -173,7 +173,9 @@ class PatientDoctorAppointmentList { List patientDoctorAppointmentList = List(); PatientDoctorAppointmentList( - {this.filterName, this.distanceInKMs, DoctorList patientDoctorAppointment}) { + {this.filterName, + this.distanceInKMs, + DoctorList patientDoctorAppointment}) { patientDoctorAppointmentList.add(patientDoctorAppointment); } } diff --git a/lib/pages/BookAppointment/Search.dart b/lib/pages/BookAppointment/Search.dart index b5f83c4c..095d72a6 100644 --- a/lib/pages/BookAppointment/Search.dart +++ b/lib/pages/BookAppointment/Search.dart @@ -1,8 +1,10 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByClinic.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByDoctor.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/arrow_back.dart'; import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; @@ -28,29 +30,35 @@ class _SearchState extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { + AppGlobal.context = context; return Scaffold( - appBar: AppBar( - bottom: TabBar( - tabs: [ - Tab(text: TranslationBase.of(context).clinicName), - Tab( - text: TranslationBase.of(context).doctorName, - ) - ], - controller: _tabController, - ), - title: Text(TranslationBase.of(context).bookAppo, - style: TextStyle(color: Colors.white)), + appBar: AppBar( + bottom: TabBar( + tabs: [ + Tab(text: TranslationBase.of(context).clinicName), + Tab( + text: TranslationBase.of(context).doctorName, + ) + ], + controller: _tabController, ), - body: TabBarView( - physics: NeverScrollableScrollPhysics(), - children: [ - SearchByClinic( - clnicIds: widget.clnicIds, - ), - SearchByDoctor() - ], - controller: _tabController), - bottomNavigationBar: BottomBarSearch()); + title: Text(TranslationBase.of(context).bookAppo, + style: TextStyle(color: Colors.white)), + leading: Builder( + builder: (BuildContext context) { + return ArrowBack(); + }, + ), + ), + body: TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + SearchByClinic( + clnicIds: widget.clnicIds, + ), + SearchByDoctor() + ], + controller: _tabController), + ); } } diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 2ba7d571..de3aaed0 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -1,5 +1,5 @@ import "dart:collection"; - +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart'; @@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:flutter/material.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; @@ -29,7 +30,7 @@ class _SearchByClinicState extends State { List clinicsList = []; List projectsList = []; bool isMobileAppDentalAllow = false; - + bool isLoaded = false; @override void initState() { WidgetsBinding.instance.addPostFrameCallback((_) => getClinicsList()); @@ -58,40 +59,70 @@ class _SearchByClinicState extends State { style: TextStyle(fontSize: 16.0, letterSpacing: 0.9)), ], ), - Container( - height: 60.0, - decoration: BoxDecoration( - color: Colors.white, - border: Border.all( - color: Colors.grey[400], - width: 1.0, - ), - borderRadius: BorderRadius.circular(10), - ), - // margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 20.0), - padding: EdgeInsets.all(8.0), - width: MediaQuery.of(context).size.width, - child: DropdownButtonHideUnderline( - child: DropdownButton( - hint: new Text("Select Clinic"), - value: dropdownValue, - items: clinicsList.map((item) { - return new DropdownMenuItem( - value: item.clinicID.toString(), - child: new Text(item.clinicDescription), - ); - }).toList(), - onChanged: (newValue) { - setState(() { - dropdownValue = newValue; - if (!isDentalSelectedAndSupported()) { - projectDropdownValue = ""; - getDoctorsList(context); - } - }); - }, - ), - )), + widget.clnicIds != null && + widget.clnicIds.length > 1 && + isLoaded == true + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: clinicsList.map((result) { + return RoundedContainer( + child: ListTile( + onTap: () { + // setState(() { + dropdownValue = result.clinicID.toString(); + setState(() { + if (!isDentalSelectedAndSupported()) { + projectDropdownValue = ""; + getDoctorsList(context); + } + }); + }, + trailing: Icon(TranslationBase.of(AppGlobal.context) + .locale + .languageCode == + 'en' + ? Icons.keyboard_arrow_right + : Icons.keyboard_arrow_left), + title: Text(result.clinicDescription, + style: TextStyle( + fontSize: 14.0, + color: Colors.grey[700], + letterSpacing: 1.0)))); + }).toList()) + : Container( + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Colors.grey[400], + width: 1.0, + ), + borderRadius: BorderRadius.circular(10), + ), + // margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 20.0), + padding: EdgeInsets.all(8.0), + width: MediaQuery.of(context).size.width, + child: DropdownButtonHideUnderline( + child: DropdownButton( + hint: new Text("Select Clinic"), + value: dropdownValue, + items: clinicsList.map((item) { + return new DropdownMenuItem( + value: item.clinicID.toString(), + child: new Text(item.clinicDescription), + ); + }).toList(), + onChanged: (newValue) { + setState(() { + dropdownValue = newValue; + if (!isDentalSelectedAndSupported()) { + projectDropdownValue = ""; + getDoctorsList(context); + } + }); + }, + ), + )), isDentalSelectedAndSupported() == true || nearestAppo ? Container( height: 60.0, @@ -202,15 +233,18 @@ class _SearchByClinicState extends State { if (res['MessageStatus'] == 1) { setState(() { if (res['DoctorList'].length != 0) { - print(res['DoctorList']); doctorsList.clear(); res['DoctorList'].forEach((v) { - doctorsList.add(new DoctorList.fromJson(v)); + try { + doctorsList.add(new DoctorList.fromJson(v)); - arr.add(new DoctorList.fromJson(v).projectName); - arrDistance.add(new DoctorList.fromJson(v) - .projectDistanceInKiloMeters - .toString()); + arr.add(new DoctorList.fromJson(v).projectName); + arrDistance.add(new DoctorList.fromJson(v) + .projectDistanceInKiloMeters + .toString()); + } catch (issue) { + print(issue); + } }); } else {} }); @@ -260,7 +294,9 @@ class _SearchByClinicState extends State { clinicsList = clinicsList .where((i) => widget.clnicIds.indexOf(i.clinicID) > -1) .toList(); - print(clinicsList); + isLoaded = true; + + ///print(clinicsList); } }); } diff --git a/lib/pages/BookAppointment/widgets/BranchView.dart b/lib/pages/BookAppointment/widgets/BranchView.dart index 6819c54b..63d47b5f 100644 --- a/lib/pages/BookAppointment/widgets/BranchView.dart +++ b/lib/pages/BookAppointment/widgets/BranchView.dart @@ -27,6 +27,7 @@ class _BranchViewState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).bookAppo, isShowAppBar: true, + isBottomBar: false, body: new ListView.builder( itemBuilder: (BuildContext context, int index) { return new ExpandableListView( @@ -58,6 +59,8 @@ class ExpandableListView extends StatefulWidget { class _ExpandableListViewState extends State { bool expandFlag = false; + var _radioValue1; + @override Widget build(BuildContext context) { return new Container( @@ -150,6 +153,9 @@ class _ExpandableListViewState extends State { return ""; } } + + sortByProject() {} + sortByClinic() {} } class ExpandableContainer extends StatelessWidget { diff --git a/lib/pages/family/my-family.dart b/lib/pages/family/my-family.dart index bfce655d..8a9ff531 100644 --- a/lib/pages/family/my-family.dart +++ b/lib/pages/family/my-family.dart @@ -106,113 +106,113 @@ class _MyFamily extends State with TickerProviderStateMixin { child: Column( children: [ Expanded( - flex: 1, - child: FutureBuilder( - future: getFamilyFiles(), // async work - builder: (BuildContext context, - AsyncSnapshot - snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: + flex:4, + child: FutureBuilder( + future: getFamilyFiles(), // async work + builder: (BuildContext context, + AsyncSnapshot + 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 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 Padding( - padding: EdgeInsets.only(top: 50), - child: Column(children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - 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( - mainAxisAlignment: MainAxisAlignment.start, - children: snapshot - .data.getAllSharedRecordsByStatusList - .map((result) { - return result.status == 3 - ? Padding( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - flex: 3, - child: Text( - result.patientName)), - Expanded( - flex: 2, - child: IconButton( - icon: Icon(Icons.group), + child: Column(children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + 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( + mainAxisAlignment: MainAxisAlignment.start, + children: snapshot + .data.getAllSharedRecordsByStatusList + .map((result) { + return result.status == 3 + ? Padding( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: Text( + result.patientName)), + Expanded( + flex: 2, + child: IconButton( + icon: Icon(Icons.group), + color: Colors.black, + onPressed: () { + switchUser( + result, context); + }, + )), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.delete, color: Colors.black, - onPressed: () { - switchUser( - result, context); - }, - )), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.delete, - color: Colors.black, - ), - onPressed: () { - deleteFamily( - result, context); - }, - )), - ], - )) - : SizedBox(); - }).toList()) - ])); - } - }, - )), + ), + onPressed: () { + deleteFamily( + result, context); + }, + )), + ], + )) + : SizedBox(); + }).toList()) + ])); + } + }, + ), + ), Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).addFamilyMember, - () => { - Navigator.of(context) - .pushNamed(ADD_FAMILY_MEMBER_TYPE) - }, - color: Colors.grey[900], - textColor: Colors.white, - )) - ], - ), - ], - )) + flex:1, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).addFamilyMember, + () => { + Navigator.of(context) + .pushNamed(ADD_FAMILY_MEMBER_TYPE) + }, + color: Colors.grey[900], + textColor: Colors.white, + )) + ], + ), + ], + ), + ) ], )); } @@ -270,7 +270,53 @@ class _MyFamily extends State with TickerProviderStateMixin { ], ), Column( - children: [], + + children: [ + Row(children: [ + Expanded(flex:3,child:AppText('Name')), + Expanded(flex:1,child:AppText('Allow')), + Expanded(flex:1,child:AppText('Reject')), + ]), + Column(children: snapshot + .data['GetAllPendingRecordsList'] + .map((result) { + return Padding( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: Text( + result.patientName)), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.check_circle, + color: Colors.black, + ), + onPressed: () { + acceptRequest( + result, context); + }, + )), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.delete, + color: Colors.black, + ), + onPressed: () { + deleteRequest( + result, context); + }, + )) + ], + )); + + }).toList()) + ] ) ], ); @@ -289,7 +335,57 @@ class _MyFamily extends State with TickerProviderStateMixin { FutureBuilder( future: getSentRequest(), // async work builder: - (BuildContext context, AsyncSnapshot snapshot) { + (BuildContext context, AsyncSnapshot 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 SingleChildScrollView( + child: Container( + height: SizeConfig.screenHeight *.3, + child: ListView( + children: snapshot + .data.getAllSharedRecordsByStatusList + .map((result) { + return Padding( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: Text( + result.patientName)), + Expanded( + flex: 2, + child: AppText(result.statusDescription, color: Colors.red,)), + + ], + )); + + }).toList(), + ))); + } + }) + ], + )), + RoundedContainer( + child: ExpansionTile( + title: Text( + TranslationBase.of(context).userView, + style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), + ), + children: [ + FutureBuilder( + future: getUserViewRequest(), // async work + builder: (BuildContext context, + AsyncSnapshot snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: return Padding( @@ -305,44 +401,68 @@ class _MyFamily extends State with TickerProviderStateMixin { children: [ Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment.spaceBetween, children: [ Expanded( flex: 3, - child: Text( - TranslationBase.of(context).request)), + child: Text(TranslationBase.of(context) + .request)), Expanded( flex: 2, child: Text( - TranslationBase.of(context).switchUser, + TranslationBase.of(context) + .switchUser, )), Expanded( flex: 1, child: Text( - TranslationBase.of(context).deleteView, + TranslationBase.of(context) + .deleteView, )), ], ), Column( - children: [], + + children: [ + Row(children: [ + Expanded(flex:3,child:AppText('Name')), + Expanded(flex:1,child:AppText('Delete')), + ]), + Column(children: snapshot + .data['GetAllPendingRecordsList'] + .map((result) { + return Padding( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: Text( + result.patientName)), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.delete, + color: Colors.black, + ), + onPressed: () { + deleteRequest( + result, context); + }, + )), + + ], + )); + + }).toList()) + ] ) ], ); } }) ], - )), - RoundedContainer( - child: ExpansionTile( - title: Text( - TranslationBase.of(context).userView, - style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), - ), - children: [ - ListTile( - title: Text('data'), - ) - ], )) ], ), @@ -364,7 +484,7 @@ class _MyFamily extends State with TickerProviderStateMixin { return familyFileProvider.getUserViewRequest(user['PatientID']); } - Future getSentRequest() async { + Future getSentRequest() async { // var user = await sharedPref.getObject(USER_PROFILE); return familyFileProvider.getUserSentRequest(); } @@ -419,4 +539,10 @@ class _MyFamily extends State with TickerProviderStateMixin { HOME, ); } + deleteRequest(result, context){ + + } + acceptRequest(result, context){ + + } } diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index 4a70c0b1..1fcaefd2 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -85,7 +85,7 @@ class FamilyFilesProvider with ChangeNotifier { } } - Future getUserSentRequest() async { + Future getUserSentRequest() async { try { dynamic localRes; Map request = {}; diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index b18a5fd9..eda27361 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -25,7 +25,7 @@ class AppScaffold extends StatelessWidget { final bool isShowAppBar; final bool hasAppBarParam; final BaseViewModel baseViewModel; - + final bool isBottomBar; AppScaffold( {@required this.body, this.appBarTitle = '', @@ -33,7 +33,8 @@ class AppScaffold extends StatelessWidget { this.isShowAppBar = false, this.hasAppBarParam, this.bottomSheet, - this.baseViewModel}); + this.baseViewModel, + this.isBottomBar = true}); @override Widget build(BuildContext context) { @@ -74,7 +75,8 @@ class AppScaffold extends StatelessWidget { ) : buildBodyWidget(), bottomSheet: bottomSheet, - bottomNavigationBar: BottomBarSearch() + bottomNavigationBar: + this.isBottomBar == true ? BottomBarSearch() : SizedBox() //floatingActionButton: FloatingSearchButton(), ); } @@ -84,6 +86,6 @@ class AppScaffold extends StatelessWidget { } buildBodyWidget() { - return body ;//Stack(children: [body, buildAppLoaderWidget(isLoading)]); + return body; //Stack(children: [body, buildAppLoaderWidget(isLoading)]); } } diff --git a/lib/widgets/others/bottom_bar.dart b/lib/widgets/others/bottom_bar.dart index b6108c36..25649b06 100644 --- a/lib/widgets/others/bottom_bar.dart +++ b/lib/widgets/others/bottom_bar.dart @@ -259,18 +259,11 @@ class _SearchBot extends State { } else { goToClinic(clnicID); } - speak(); + // speak(); } break; case '102': { - // getDoctorsList( - // 0, - // 0, - // context, - // doctorId: null, - // doctorName: result['DoctorName'], - // ); getDoctorsList( 0, 0, @@ -278,7 +271,12 @@ class _SearchBot extends State { doctorId: result['DoctorId'], doctorName: null, ); - speak(); + } + break; + case '103': + { + List clnicID = unique(result['ClinicId']); + goToClinic(clnicID); } break; default: @@ -424,7 +422,7 @@ class _SearchBot extends State { type: 0, clnicIds: ids, ))); - // eventProvider.setValue({"clinic_id": ids}); + speak(); } List unique(List list) {