Booking appointment 1.0

merge-requests/390/head
Mirza.Shafique 3 years ago
parent 288d64214e
commit 62631677ad

@ -46,7 +46,7 @@ const Map localizedValues = {
'doctor': {'en': 'Doctor', 'ar': 'الطبيب'},
'clinicName': {'en': 'Clinic Name', 'ar': 'اسم العيادة'},
'doctorName': {'en': 'Doctor Name', 'ar': 'إسم الطبيب'},
'nearestAppo': {'en': 'Nearest appointment', 'ar': 'أقرب موعد'},
'nearestAppo': {'en': 'Nearest Appointment', 'ar': 'أقرب موعد'},
'searchByDocText': {'en': 'Type the name of the doctor to help you find him', 'ar': 'اكتب اسم الطبيب لمساعدتك في العثور عليه'},
'enterDocName': {'en': 'Enter Doctor name', 'ar': 'أدخل إسم الطبيب'},
'search': {'en': 'Search', 'ar': 'بحث'},

@ -1,6 +1,7 @@
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/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
@ -22,8 +23,7 @@ class _SearchState extends State<Search> with TickerProviderStateMixin {
@override
void initState() {
_tabController =
new TabController(length: 2, vsync: this, initialIndex: widget.type);
_tabController = new TabController(length: 2, vsync: this, initialIndex: widget.type);
super.initState();
}
@ -32,28 +32,22 @@ class _SearchState extends State<Search> with TickerProviderStateMixin {
Widget build(BuildContext context) {
AppGlobal.context = context;
return AppScaffold(
isShowAppBar: true,
isShowAppBar: false,
isShowDecPage: false,
appBarTitle: TranslationBase.of(context).bookAppo,
backgroundColor: Color(0xFFF7F7F7),
body: Container(
child: Column(
children: [
TabBar(
tabs: [
Tab(child: Text(TranslationBase.of(context).clinicName, style: TextStyle(color: Colors.black))),
Tab(
child: Text(TranslationBase.of(context).clinicName,
style: TextStyle(color: Colors.black))),
Tab(
child: Text(TranslationBase.of(context).doctorName,
style: TextStyle(color: Colors.black)),
child: Text(TranslationBase.of(context).doctorName, style: TextStyle(color: Colors.black)),
)
],
controller: _tabController,
),
Divider(
color: Colors.grey[600],
thickness: 0.5,
),
Expanded(
child: new TabBarView(
physics: NeverScrollableScrollPhysics(),

@ -14,6 +14,7 @@ import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
@ -43,6 +44,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
bool isProjectLoaded = false;
ListClinicCentralized selectedClinic;
final GlobalKey dropdownKey = GlobalKey();
AuthenticatedUser authUser = new AuthenticatedUser();
AuthProvider authProvider = new AuthProvider();
@ -56,108 +58,128 @@ class _SearchByClinicState extends State<SearchByClinic> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Checkbox(
activeColor: new Color(0xFF40ACC9),
value: nearestAppo,
onChanged: (bool value) {
setState(() {
nearestAppo = value;
print(nearestAppo);
if (nearestAppo)
getProjectsList();
else
isProjectLoaded = false;
});
},
),
Text(TranslationBase.of(context).nearestAppo,
style: TextStyle(fontSize: 16.0, letterSpacing: 0.9)),
],
Padding(
padding: const EdgeInsets.only(left: 2,right: 2),
child: Row(
children: <Widget>[
Checkbox(
activeColor: new Color(0xFF40ACC9),
value: nearestAppo,
onChanged: (bool value) {
setState(() {
nearestAppo = value;
print(nearestAppo);
if (nearestAppo)
getProjectsList();
else
isProjectLoaded = false;
});
},
),
Text(
TranslationBase.of(context).nearestAppo,
style: TextStyle(fontSize: 14.0, letterSpacing: -0.56),
),
],
),
),
widget.clnicIds != null &&
widget.clnicIds.length > 1 &&
isLoaded == true
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: clinicsList.map<Widget>((result) {
return RoundedContainer(
child: ListTile(
onTap: () {
// setState(() {
dropdownValue = result.clinicID.toString();
setState(() {
if (!isDentalSelectedAndSupported()) {
projectDropdownValue = "";
getDoctorsList(context);
}
});
},
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<String>(
hint: new Text(TranslationBase.of(context).selectClinic),
value: dropdownValue,
items: clinicsList.map((item) {
return new DropdownMenuItem<String>(
value: item.clinicID.toString() +
"-" +
item.isLiveCareClinicAndOnline.toString() +
"-" +
item.liveCareClinicID.toString() +
"-" +
item.liveCareServiceID.toString(),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
widget.clnicIds != null && widget.clnicIds.length > 1 && isLoaded == true
? Padding(
padding: const EdgeInsets.only(left: 20,right: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: clinicsList.map<Widget>((result) {
return RoundedContainer(
child: ListTile(
onTap: () {
// setState(() {
dropdownValue = result.clinicID.toString();
setState(() {
if (!isDentalSelectedAndSupported()) {
projectDropdownValue = "";
getDoctorsList(context);
}
});
},
title: Text(result.clinicDescription, style: TextStyle(fontSize: 14.0, color: Colors.grey[700], letterSpacing: 1.0))));
}).toList()),
)
: InkWell(
onTap: () {
dropdownKey.currentState;
},
child: Container(
width: double.infinity,
margin: const EdgeInsets.only(left: 16,right: 16),
decoration: containerRadius(Colors.white, 12),
padding: EdgeInsets.only(left: 12, right: 12, top: 14, bottom: 14),
child: Row(
children: [
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(item.clinicDescription),
item.isLiveCareClinicAndOnline
? SvgPicture.asset(
'assets/images/new-design/video_icon_green_right.svg',
height: 15,
width: 15,
fit: BoxFit.cover)
: Container(),
]),
);
}).toList(),
onChanged: (newValue) {
setState(() {
print(newValue);
dropdownValue = newValue;
if (!isDentalSelectedAndSupported() && !nearestAppo) {
projectDropdownValue = "";
getDoctorsList(context);
}
});
},
),
)),
isDentalSelectedAndSupported() == true ||
(nearestAppo && isProjectLoaded)
Text(
"Select Clinic",
style: TextStyle(
color: Colors.black,
fontSize: 11,
letterSpacing: -0.44,
fontWeight: FontWeight.w600,
),
),
Container(
height: 20,
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
key: dropdownKey,
hint: new Text(TranslationBase.of(context).selectClinic),
value: dropdownValue,
iconSize: 0,
style: TextStyle(
color: Color(0xFF575757),
fontSize: 14,
letterSpacing: -0.56,
),
isExpanded: true,
items: clinicsList.map((item) {
return new DropdownMenuItem<String>(
value: item.clinicID.toString() +
"-" +
item.isLiveCareClinicAndOnline.toString() +
"-" +
item.liveCareClinicID.toString() +
"-" +
item.liveCareServiceID.toString(),
child: Text(item.clinicDescription),
);
}).toList(),
onChanged: (newValue) {
setState(() {
print(newValue);
dropdownValue = newValue;
if (!isDentalSelectedAndSupported() && !nearestAppo) {
projectDropdownValue = "";
getDoctorsList(context);
}
});
},
),
),
),
],
),
),
Icon(
Icons.keyboard_arrow_down_rounded,
),
],
)),
),
isDentalSelectedAndSupported() == true || (nearestAppo && isProjectLoaded)
? Container(
height: 60.0,
decoration: BoxDecoration(
@ -196,9 +218,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
}
bool isDentalSelectedAndSupported() {
return dropdownValue != "" &&
(dropdownValue == "17") &&
isMobileAppDentalAllow;
return dropdownValue != "" && (dropdownValue == "17") && isMobileAppDentalAllow;
}
getClinicsList() {
@ -258,10 +278,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
Navigator.push(
context,
FadePage(
page: LiveCareBookAppointment(
clinicName: "Family Medicine",
liveCareClinicID: dropdownValue.split("-")[2],
liveCareServiceID: dropdownValue.split("-")[3]),
page: LiveCareBookAppointment(clinicName: "Family Medicine", liveCareClinicID: dropdownValue.split("-")[2], liveCareServiceID: dropdownValue.split("-")[3]),
),
).then((value) {
print(value);
@ -285,17 +302,10 @@ class _SearchByClinicState extends State<SearchByClinic> {
List<String> arrDistance = [];
List<String> result;
int numAll;
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital =
List();
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital = List();
DoctorsListService service = new DoctorsListService();
service
.getDoctorsList(
int.parse(dropdownValue.split("-")[0]),
projectDropdownValue != "" ? int.parse(projectDropdownValue) : 0,
nearestAppo,
context)
.then((res) {
service.getDoctorsList(int.parse(dropdownValue.split("-")[0]), projectDropdownValue != "" ? int.parse(projectDropdownValue) : 0, nearestAppo, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) {
setState(() {
@ -305,27 +315,17 @@ class _SearchByClinicState extends State<SearchByClinic> {
doctorsList.add(new DoctorList.fromJson(v));
});
doctorsList.forEach((element) {
List<PatientDoctorAppointmentList> doctorByHospital =
_patientDoctorAppointmentListHospital
.where(
(elementClinic) =>
elementClinic.filterName == element.projectName,
)
.toList();
List<PatientDoctorAppointmentList> doctorByHospital = _patientDoctorAppointmentListHospital
.where(
(elementClinic) => elementClinic.filterName == element.projectName,
)
.toList();
if (doctorByHospital.length != 0) {
_patientDoctorAppointmentListHospital[
_patientDoctorAppointmentListHospital
.indexOf(doctorByHospital[0])]
.patientDoctorAppointmentList
.add(element);
_patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
} else {
_patientDoctorAppointmentListHospital.add(
PatientDoctorAppointmentList(
filterName: element.projectName,
distanceInKMs:
element.projectDistanceInKiloMeters.toString(),
patientDoctorAppointment: element));
_patientDoctorAppointmentListHospital
.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element));
}
});
} else {}
@ -333,8 +333,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
result = LinkedHashSet<String>.from(arr).toList();
numAll = result.length;
navigateToSearchResults(
context, doctorsList, _patientDoctorAppointmentListHospital);
navigateToSearchResults(context, doctorsList, _patientDoctorAppointmentListHospital);
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
@ -345,8 +344,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
});
}
Future navigateToDentalComplaints(
BuildContext context, SearchInfo searchInfo) async {
Future navigateToDentalComplaints(BuildContext context, SearchInfo searchInfo) async {
Navigator.push(
context,
FadePage(
@ -355,20 +353,9 @@ class _SearchByClinicState extends State<SearchByClinic> {
);
}
Future navigateToSearchResults(
context,
List<DoctorList> docList,
List<PatientDoctorAppointmentList>
patientDoctorAppointmentListHospital) async {
Future navigateToSearchResults(context, List<DoctorList> docList, List<PatientDoctorAppointmentList> patientDoctorAppointmentListHospital) async {
isProjectLoaded = false;
Navigator.push(
context,
FadePage(
page: SearchResults(
isLiveCareAppointment: false,
doctorsList: docList,
patientDoctorAppointmentListHospital:
patientDoctorAppointmentListHospital)))
Navigator.push(context, FadePage(page: SearchResults(isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital)))
.then((value) {
getProjectsList();
});
@ -377,9 +364,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
filterClinic() {
setState(() {
if (widget.clnicIds != null && widget.clnicIds.length > 0) {
clinicsList = clinicsList
.where((i) => widget.clnicIds.indexOf(i.clinicID) > -1)
.toList();
clinicsList = clinicsList.where((i) => widget.clnicIds.indexOf(i.clinicID) > -1).toList();
isLoaded = true;
}
});

@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da
import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart';
import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart';
import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart';
import 'package:diplomaticquarterapp/pages/landing/home_page_2.dart';
@ -613,7 +614,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
},
),
MedicalProfilePageNew(),
BookingOptions(),
Search(),
MyFamily(isAppbarVisible: false),
ToDo(isShowAppBar: false),
], // Please do not remove the BookingOptions from this array

@ -20,7 +20,6 @@ import 'package:huawei_location/location/location_availability.dart';
import 'package:permission_handler/permission_handler.dart';
class LocationUtils {
AppSharedPreferences sharedPref = new AppSharedPreferences();
bool isShowConfirmDialog;
@ -30,24 +29,20 @@ class LocationUtils {
void getCurrentLocation({Function(LatLng) callBack}) async {
print("current location");
if(Platform.isAndroid && (await FlutterHmsGmsAvailability.isHmsAvailable)) {
if (Platform.isAndroid && (await FlutterHmsGmsAvailability.isHmsAvailable)) {
_getHMSCurrentLocation(callBack);
}else{
} else {
Geolocator.isLocationServiceEnabled().then((value) {
if (value) {
Geolocator.checkPermission().then((permission) {
if (permission == LocationPermission.always ||
permission == LocationPermission.whileInUse) {
Geolocator.getLastKnownPosition()
.then((value){
setLocation(value);
if(callBack != null)
callBack(LatLng(value.latitude, value.longitude));
if (permission == LocationPermission.always || permission == LocationPermission.whileInUse) {
Geolocator.getLastKnownPosition().then((value) {
setLocation(value);
if (callBack != null) callBack(LatLng(value.latitude, value.longitude));
});
}
if (permission == LocationPermission.denied ||
permission == LocationPermission.deniedForever) {
if (permission == LocationPermission.denied || permission == LocationPermission.deniedForever) {
setZeroLocation();
if (isShowConfirmDialog) showErrorLocationDialog(false);
}
@ -64,11 +59,12 @@ class LocationUtils {
}
LocationCallback _locationCallback;
_getHMSCurrentLocation(Function(LatLng) callBack) async{
_getHMSCurrentLocation(Function(LatLng) callBack) async {
PermissionHandler permissionHandler = PermissionHandler();
int _locationUpdateCbId = 0;
doIt(){
doIt() {
FusedLocationProviderClient locationService = FusedLocationProviderClient();
LocationRequest locationRequest = LocationRequest();
locationRequest.priority = LocationRequest.PRIORITY_HIGH_ACCURACY;
@ -76,37 +72,31 @@ class LocationUtils {
List<LocationRequest> locationRequestList = <LocationRequest>[locationRequest];
LocationSettingsRequest locationSettingsRequest = LocationSettingsRequest(requests: locationRequestList);
locationService.checkLocationSettings(locationSettingsRequest).then((settings) async{
_locationUpdateCbId = await locationService.requestLocationUpdatesCb(locationRequest, LocationCallback(onLocationResult: (locationResult){
Location location = locationResult.lastLocation;
locationService.removeLocationUpdatesCb(_locationUpdateCbId);
callBack(LatLng(location.latitude, location.longitude));
setLocation(Position(latitude: location.latitude, longitude: location.longitude, altitude: location.altitude));
}, onLocationAvailability: (locationAvailability){
debugPrint("onLocationAvailability: $locationAvailability");
}));
}).catchError((error){
if(error.code == "LOCATION_SETTINGS_NOT_AVAILABLE"){
locationService.checkLocationSettings(locationSettingsRequest).then((settings) async {
_locationUpdateCbId = await locationService.requestLocationUpdatesCb(
locationRequest,
LocationCallback(onLocationResult: (locationResult) {
Location location = locationResult.lastLocation;
locationService.removeLocationUpdatesCb(_locationUpdateCbId);
callBack(LatLng(location.latitude, location.longitude));
setLocation(Position(latitude: location.latitude, longitude: location.longitude, altitude: location.altitude));
}, onLocationAvailability: (locationAvailability) {
debugPrint("onLocationAvailability: $locationAvailability");
}));
}).catchError((error) {
if (error.code == "LOCATION_SETTINGS_NOT_AVAILABLE") {
// Location service not enabled.
}
});
}
if(await permissionHandler.hasLocationPermission()){
if (await permissionHandler.hasLocationPermission()) {
doIt();
}else{
} else {
bool has = await requestPermissions();
if(has)
if (has)
doIt();
else if(isShowConfirmDialog)
showErrorLocationDialog(false);
else if (isShowConfirmDialog) showErrorLocationDialog(false);
}
}
@ -116,24 +106,14 @@ class LocationUtils {
confirmMessage: TranslationBase.of(context).locationDialogMessage,
okText: TranslationBase.of(context).confirm,
cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () => {
ConfirmDialog.closeAlertDialog(context),
if (isPermissionError)
Geolocator.openAppSettings()
else
Geolocator.openLocationSettings()
},
okFunction: () => {ConfirmDialog.closeAlertDialog(context), if (isPermissionError) Geolocator.openAppSettings() else Geolocator.openLocationSettings()},
cancelFunction: () => {});
return dialog.showAlertDialog(context);
}
void setLocation(Position position) {
this
.sharedPref
.setDouble(USER_LAT, position != null ? position.latitude : 0.0);
this
.sharedPref
.setDouble(USER_LONG, position != null ? position.longitude : 0.0);
this.sharedPref.setDouble(USER_LAT, position != null ? position.latitude : 0.0);
this.sharedPref.setDouble(USER_LONG, position != null ? position.longitude : 0.0);
}
void setZeroLocation() {
@ -141,7 +121,6 @@ class LocationUtils {
this.sharedPref.setDouble(USER_LONG, 0.0);
}
Future<bool> requestPermissions() async {
var result = await [
Permission.location,

@ -564,6 +564,8 @@ class _AppDrawerState extends State<AppDrawer> {
Provider.of<ProjectViewModel>(context, listen: false).user = authenticatedUserObject.user;
Provider.of<ProjectViewModel>(context, listen: false).setUser(authenticatedUserObject.user);
await pharmacyModuleViewModel.generatePharmacyToken();
_vitalSignService.heightCm = "";
_vitalSignService.weightKg = "";
if (pharmacyModuleViewModel.error.isNotEmpty) await pharmacyModuleViewModel.createUser();

Loading…
Cancel
Save