nearest appointment flow implemented

merge-update-with-lab-changes
haroon amjad 6 years ago
parent 51078227ab
commit ce9903fd13

@ -82,7 +82,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
onChanged: (newValue) { onChanged: (newValue) {
setState(() { setState(() {
dropdownValue = newValue; dropdownValue = newValue;
if (!isDentalSelectedAndSupported()) { if (!isDentalSelectedAndSupported() && !nearestAppo) {
projectDropdownValue = ""; projectDropdownValue = "";
getDoctorsList(context); getDoctorsList(context);
} }
@ -194,6 +194,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
.getDoctorsList( .getDoctorsList(
int.parse(dropdownValue), int.parse(dropdownValue),
projectDropdownValue != "" ? int.parse(projectDropdownValue) : 0, projectDropdownValue != "" ? int.parse(projectDropdownValue) : 0,
nearestAppo,
context) context)
.then((res) { .then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
@ -248,6 +249,8 @@ class _SearchByClinicState extends State<SearchByClinic> {
num: numAll, num: numAll,
resultDistance: resultDistance), resultDistance: resultDistance),
), ),
); ).then((value) {
getProjectsList();
});
} }
} }

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart
import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart';
@ -39,7 +40,7 @@ class DoctorView extends StatelessWidget {
fit: BoxFit.fill, height: 60.0, width: 60.0), fit: BoxFit.fill, height: 60.0, width: 60.0),
), ),
Container( Container(
width: MediaQuery.of(context).size.width * 0.5, width: MediaQuery.of(context).size.width * 0.55,
margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0), margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -74,6 +75,16 @@ class DoctorView extends StatelessWidget {
color: Colors.grey[600], color: Colors.grey[600],
letterSpacing: 1.0)), letterSpacing: 1.0)),
), ),
this.doctor.nearestFreeSlot != null ? Container(
margin: EdgeInsets.only(top: 3.0, bottom: 3.0),
child: Text(
getDate(this.doctor.nearestFreeSlot),
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold,
color: Colors.green[600],
letterSpacing: 1.0)),
) : Container(),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -136,6 +147,29 @@ class DoctorView extends StatelessWidget {
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
String getDate(String date) {
DateTime dateObj = DateUtil.convertStringToDate(date);
return DateUtil.getWeekDay(dateObj.weekday) +
", " +
dateObj.day.toString() +
" " +
DateUtil.getMonth(dateObj.month) +
" " +
dateObj.year.toString() +
" " +
dateObj.hour.toString() +
":" +
getMinute(dateObj);
}
String getMinute(DateTime dateObj) {
if(dateObj.minute == 0) {
return dateObj.minute.toString() + "0";
} else {
return dateObj.minute.toString();
}
}
Future navigateToDoctorProfile(context, docObject, docProfile, Future navigateToDoctorProfile(context, docObject, docProfile,
{isAppo}) async { {isAppo}) async {
Navigator.push( Navigator.push(

@ -10,7 +10,6 @@ import 'package:diplomaticquarterapp/models/Request.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
class DoctorsListService extends BaseService { class DoctorsListService extends BaseService {
@ -23,7 +22,8 @@ class DoctorsListService extends BaseService {
double lat; double lat;
double long; double long;
Future<Map> getDoctorsList(int clinicID, int projectID, BuildContext context, Future<Map> getDoctorsList(
int clinicID, int projectID, bool isNearest, BuildContext context,
{doctorId}) async { {doctorId}) async {
//Utils.showProgressDialog(context); //Utils.showProgressDialog(context);
Map<String, dynamic> request; Map<String, dynamic> request;
@ -34,7 +34,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);
} }
@ -62,6 +63,9 @@ class DoctorsListService extends BaseService {
"IsGetNearAppointment": false, "IsGetNearAppointment": false,
"Latitude": lat.toString(), "Latitude": lat.toString(),
"Longitude": long.toString(), "Longitude": long.toString(),
"IsGetNearAppointment": isNearest,
if (isNearest)
"SelectedDate": DateUtil.convertDateToString(DateTime.now()),
"License": true "License": true
}; };
@ -88,7 +92,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);
} }

@ -312,7 +312,7 @@ class _SearchBot extends State<BottomBarSearch> {
List<DoctorList> doctorsList = []; List<DoctorList> doctorsList = [];
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
service service
.getDoctorsList(clinicId, projectId, context, doctorId: doctorName) .getDoctorsList(clinicId, projectId, false, context, doctorId: doctorName)
.then((res) { .then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
setState(() { setState(() {

Loading…
Cancel
Save