LiveCare Scheduling updates

merge-update-with-lab-changes
haroon amjad 5 years ago
parent 06798ef327
commit c9256a654a

@ -47,6 +47,7 @@ const Map<String, Map<String, String>> localizedValues = {
}, },
'confirmAppo': {'en': 'Confirm Appointment', 'ar': 'تأكيد الموعد'}, 'confirmAppo': {'en': 'Confirm Appointment', 'ar': 'تأكيد الموعد'},
'confirm': {'en': 'Confirm', 'ar': 'تأكيد'}, 'confirm': {'en': 'Confirm', 'ar': 'تأكيد'},
'confirmLiveCare': {'en': 'Confirm LiveCare', 'ar': 'تأكيد لايف كير'},
'appointment': {'en': 'Appointment', 'ar': 'الموعد'}, 'appointment': {'en': 'Appointment', 'ar': 'الموعد'},
'confirmLater': {'en': 'Confirm Later', 'ar': 'تأكيد لاحقا'}, 'confirmLater': {'en': 'Confirm Later', 'ar': 'تأكيد لاحقا'},
'todoList': {'en': 'Todo List', 'ar': 'مهامي'}, 'todoList': {'en': 'Todo List', 'ar': 'مهامي'},

@ -14,3 +14,4 @@ const FAMILY_FILE = 'family-file';
const USER_LAT = 'user-lat'; const USER_LAT = 'user-lat';
const USER_LONG = 'user-long'; const USER_LONG = 'user-long';
const IS_GO_TO_PARKING = 'IS_GO_TO_PARKING'; const IS_GO_TO_PARKING = 'IS_GO_TO_PARKING';
const IS_LIVECARE_APPOINTMENT = 'is_livecare_appointment';

@ -13,17 +13,17 @@ class PatientShareResponse {
String doctorImageURL; String doctorImageURL;
String doctorNameObj; String doctorNameObj;
List<String> doctorSpeciality; List<String> doctorSpeciality;
Null errCode; dynamic errCode;
int groupID; int groupID;
bool iSAllowOnlineCheckedIN; bool iSAllowOnlineCheckedIN;
Null insurancePolicyNo; dynamic insurancePolicyNo;
bool isExcludedForOnlineCheckin; bool isExcludedForOnlineCheckin;
int isFollowup; int isFollowup;
bool isLiveCareAppointment; bool isLiveCareAppointment;
bool isOnlineCheckedIN; bool isOnlineCheckedIN;
String message; String message;
int nextAction; int nextAction;
Null patientCardID; dynamic patientCardID;
int patientID; int patientID;
dynamic patientShare; dynamic patientShare;
dynamic patientShareWithTax; dynamic patientShareWithTax;
@ -32,20 +32,20 @@ class PatientShareResponse {
String patientType; String patientType;
int paymentAmount; int paymentAmount;
String paymentDate; String paymentDate;
Null paymentMethodName; dynamic paymentMethodName;
Null paymentReferenceNumber; dynamic paymentReferenceNumber;
int policyId; int policyId;
String policyName; String policyName;
String procedureName; String procedureName;
int projectID; int projectID;
String projectName; String projectName;
Null setupID; dynamic setupID;
int sourceType; int sourceType;
String startTime; String startTime;
int status; int status;
int statusCode; int statusCode;
Null statusDesc; dynamic statusDesc;
Null subPolicyNo; dynamic subPolicyNo;
int userID; int userID;
PatientShareResponse( PatientShareResponse(

@ -0,0 +1,64 @@
class LiveCareScheduleClinicsListResponse {
List<ClinicsHaveScheduleList> clinicsHaveScheduleList;
LiveCareScheduleClinicsListResponse({this.clinicsHaveScheduleList});
LiveCareScheduleClinicsListResponse.fromJson(Map<String, dynamic> json) {
if (json['ClinicsHaveScheduleList'] != null) {
clinicsHaveScheduleList = new List<ClinicsHaveScheduleList>();
json['ClinicsHaveScheduleList'].forEach((v) {
clinicsHaveScheduleList.add(new ClinicsHaveScheduleList.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.clinicsHaveScheduleList != null) {
data['ClinicsHaveScheduleList'] =
this.clinicsHaveScheduleList.map((v) => v.toJson()).toList();
}
return data;
}
}
class ClinicsHaveScheduleList {
int clinicID;
int serviceID;
int projectID;
String clinicDesc;
String clinicDescN;
String projectDesc;
String projectDescN;
ClinicsHaveScheduleList(
{this.clinicID,
this.serviceID,
this.projectID,
this.clinicDesc,
this.clinicDescN,
this.projectDesc,
this.projectDescN});
ClinicsHaveScheduleList.fromJson(Map<String, dynamic> json) {
clinicID = json['ClinicID'];
serviceID = json['ServiceID'];
projectID = json['ProjectID'];
clinicDesc = json['ClinicDesc'];
clinicDescN = json['ClinicDescN'];
projectDesc = json['ProjectDesc'];
projectDescN = json['ProjectDescN'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ClinicID'] = this.clinicID;
data['ServiceID'] = this.serviceID;
data['ProjectID'] = this.projectID;
data['ClinicDesc'] = this.clinicDesc;
data['ClinicDescN'] = this.clinicDescN;
data['ProjectDesc'] = this.projectDesc;
data['ProjectDescN'] = this.projectDescN;
return data;
}
}

@ -24,10 +24,12 @@ class BookConfirm extends StatefulWidget {
String appoDateFormatted = ""; String appoDateFormatted = "";
String appoTimeFormatted = ""; String appoTimeFormatted = "";
bool isLiveCareAppointment;
BookConfirm( BookConfirm(
{@required this.doctor, {@required this.doctor,
@required this.selectedDate, @required this.selectedDate,
@required this.isLiveCareAppointment,
@required this.selectedTime}); @required this.selectedTime});
DoctorsListService service; DoctorsListService service;
@ -358,7 +360,11 @@ class _BookConfirmState extends State<BookConfirm> {
disabledTextColor: Colors.white, disabledTextColor: Colors.white,
disabledColor: new Color(0xFFbcc2c4), disabledColor: new Color(0xFFbcc2c4),
onPressed: () { onPressed: () {
insertAppointment(context, widget.doctor); if (!widget.isLiveCareAppointment) {
insertAppointment(context, widget.doctor);
} else {
insertLiveCareScheduledAppointment(context, widget.doctor);
}
}, },
child: Text(TranslationBase.of(context).bookNow, child: Text(TranslationBase.of(context).bookNow,
style: TextStyle(fontSize: 18.0)), style: TextStyle(fontSize: 18.0)),
@ -375,7 +381,11 @@ class _BookConfirmState extends State<BookConfirm> {
service.cancelAppointment(appo, context).then((res) { service.cancelAppointment(appo, context).then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
Future.delayed(new Duration(milliseconds: 1500), () { Future.delayed(new Duration(milliseconds: 1500), () {
insertAppointment(context, docObject); if (!widget.isLiveCareAppointment) {
insertAppointment(context, widget.doctor);
} else {
insertLiveCareScheduledAppointment(context, widget.doctor);
}
}); });
} else { } else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']); AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
@ -434,6 +444,55 @@ class _BookConfirmState extends State<BookConfirm> {
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
insertLiveCareScheduledAppointment(context, DoctorList docObject) {
AppoitmentAllHistoryResultList appo;
widget.service
.insertLiveCareScheduleAppointment(
docObject.doctorID,
docObject.clinicID,
docObject.projectID,
docObject.serviceID,
widget.selectedTime,
widget.selectedDate,
context)
.then((res) {
if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(message: "Appointment Booked Successfully");
print(res['AppointmentNo']);
Future.delayed(new Duration(milliseconds: 1800), () {
getLiveCareAppointmentPatientShare(context, res['AppointmentNo'],
docObject.clinicID, docObject.projectID, docObject);
});
} else {
appo = new AppoitmentAllHistoryResultList();
appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo'];
appo.clinicID = res['SameClinicApptList'][0]['DoctorID'];
appo.projectID = res['SameClinicApptList'][0]['ProjectID'];
appo.endTime = res['SameClinicApptList'][0]['EndTime'];
appo.startTime = res['SameClinicApptList'][0]['StartTime'];
appo.doctorID = res['SameClinicApptList'][0]['DoctorID'];
appo.isLiveCareAppointment = true;
appo.originalClinicID = 0;
appo.originalProjectID = 0;
appo.appointmentDate = res['SameClinicApptList'][0]['AppointmentDate'];
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: res['ErrorEndUserMessage'],
okText: TranslationBase.of(context).confirm,
cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () => {cancelAppointment(docObject, appo, context)},
cancelFunction: () => {});
dialog.showAlertDialog(context);
}
}).catchError((err) {
AppToast.showErrorToast(message: err);
print(err);
}).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
}
getPatientShare(context, String appointmentNo, int clinicID, int projectID, getPatientShare(context, String appointmentNo, int clinicID, int projectID,
DoctorList docObject) { DoctorList docObject) {
widget.service widget.service
@ -448,6 +507,21 @@ class _BookConfirmState extends State<BookConfirm> {
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
getLiveCareAppointmentPatientShare(context, String appointmentNo,
int clinicID, int projectID, DoctorList docObject) {
widget.service
.getLiveCareAppointmentPatientShare(
appointmentNo, clinicID, projectID, context)
.then((res) {
print(res);
widget.patientShareResponse = new PatientShareResponse.fromJson(res);
navigateToBookSuccess(context, docObject, widget.patientShareResponse);
}).catchError((err) {
print(err);
}).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
}
String getTime(DateTime dateTime) { String getTime(DateTime dateTime) {
final DateFormat formatter = DateFormat('HH:mm'); final DateFormat formatter = DateFormat('HH:mm');
setState(() { setState(() {
@ -502,7 +576,6 @@ class _BookConfirmState extends State<BookConfirm> {
Future navigateToBookSuccess(context, DoctorList docObject, Future navigateToBookSuccess(context, DoctorList docObject,
PatientShareResponse patientShareResponse) async { PatientShareResponse patientShareResponse) async {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(

@ -39,12 +39,6 @@ class _BookSuccessState extends State<BookSuccess> {
AppSharedPreferences sharedPref = AppSharedPreferences(); AppSharedPreferences sharedPref = AppSharedPreferences();
AuthenticatedUser authUser; AuthenticatedUser authUser;
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -184,6 +178,9 @@ class _BookSuccessState extends State<BookSuccess> {
case 30: case 30:
return _getQRAppo(); return _getQRAppo();
break; break;
case 50:
return _getConfirmAppo();
break;
} }
} }
@ -204,6 +201,9 @@ class _BookSuccessState extends State<BookSuccess> {
case 30: case 30:
return 'QR Code'; return 'QR Code';
break; break;
case 50:
return 'Confirm LiveCare';
break;
} }
} }
@ -286,8 +286,19 @@ class _BookSuccessState extends State<BookSuccess> {
textColor: Colors.white, textColor: Colors.white,
disabledTextColor: Colors.white, disabledTextColor: Colors.white,
disabledColor: new Color(0xFFbcc2c4), disabledColor: new Color(0xFFbcc2c4),
onPressed: () {}, onPressed: () {
child: Text(TranslationBase.of(context).confirm.toUpperCase(), AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
appo.clinicID = widget.docObject.clinicID;
appo.projectID = widget.docObject.projectID;
appo.appointmentNo = widget.patientShareResponse.appointmentNo;
confirmAppointment(appo);
},
child: Text(
widget.patientShareResponse.isLiveCareAppointment
? TranslationBase.of(context)
.confirmLiveCare
.toUpperCase()
: TranslationBase.of(context).confirm.toUpperCase(),
style: TextStyle(fontSize: 18.0)), style: TextStyle(fontSize: 18.0)),
), ),
), ),
@ -321,6 +332,23 @@ class _BookSuccessState extends State<BookSuccess> {
return Container(); return Container();
} }
confirmAppointment(AppoitmentAllHistoryResultList appo) {
DoctorsListService service = new DoctorsListService();
service
.confirmAppointment(
appo.appointmentNo, appo.clinicID, appo.projectID, context)
.then((res) {
if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
navigateToHome(context);
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
}).catchError((err) {
print(err);
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
}
Widget _getPayNowAppo() { Widget _getPayNowAppo() {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -543,7 +571,8 @@ class _BookSuccessState extends State<BookSuccess> {
} }
}).catchError((err) { }).catchError((err) {
print(err); print(err);
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); }).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { createAdvancePayment(res, AppoitmentAllHistoryResultList appo) {
@ -560,22 +589,12 @@ class _BookSuccessState extends State<BookSuccess> {
appo.appointmentNo.toString()); appo.appointmentNo.toString());
}).catchError((err) { }).catchError((err) {
print(err); print(err);
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); }).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
//
// Future navigateToQR( addAdvancedNumberRequest(
// context, String appoQR, PatientShareResponse patientShareResponse) async { String advanceNumber, String paymentReference, String appointmentID) {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => QRCode(
// patientShareResponse: patientShareResponse,
// appoQR: appoQR,
// ))).then((value) {});
// }
addAdvancedNumberRequest(String advanceNumber, String paymentReference,
String appointmentID) {
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
service service
.addAdvancedNumberRequest( .addAdvancedNumberRequest(
@ -585,7 +604,8 @@ class _BookSuccessState extends State<BookSuccess> {
getAppoQR(context); getAppoQR(context);
}).catchError((err) { }).catchError((err) {
print(err); print(err);
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); }).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
Widget _getQRAppo() { Widget _getQRAppo() {
@ -742,7 +762,8 @@ class _BookSuccessState extends State<BookSuccess> {
navigateToQR(context, res['AppointmentQR']); navigateToQR(context, res['AppointmentQR']);
}).catchError((err) { }).catchError((err) {
print(err); print(err);
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); }).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
Future navigateToQR(context, String appoQR) async { Future navigateToQR(context, String appoQR) async {

@ -3,6 +3,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/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -10,7 +11,7 @@ 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:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart';
import 'BookConfirm.dart'; import 'BookConfirm.dart';
import 'components/DocAvailableAppointments.dart'; import 'components/DocAvailableAppointments.dart';
import 'components/DocInfo.dart'; import 'components/DocInfo.dart';
@ -19,9 +20,12 @@ class DoctorProfile extends StatefulWidget {
DoctorList doctor; DoctorList doctor;
DoctorProfileList docProfileList; DoctorProfileList docProfileList;
final bool isOpenAppt; final bool isOpenAppt;
bool isLiveCareAppointment;
DoctorProfile( DoctorProfile(
{@required this.doctor, {@required this.doctor,
@required this.docProfileList, @required this.docProfileList,
@required this.isLiveCareAppointment,
this.isOpenAppt = false}); this.isOpenAppt = false});
AuthenticatedUser authUser; AuthenticatedUser authUser;
@ -35,6 +39,7 @@ class _DoctorProfileState extends State<DoctorProfile>
TabController _tabController; TabController _tabController;
bool showFooterButton = false; bool showFooterButton = false;
var event = RobotProvider(); var event = RobotProvider();
@override @override
void initState() { void initState() {
_tabController = new TabController( _tabController = new TabController(
@ -54,6 +59,7 @@ class _DoctorProfileState extends State<DoctorProfile>
}); });
_tabController = new TabController(length: 2, vsync: this); _tabController = new TabController(length: 2, vsync: this);
widget.authUser = new AuthenticatedUser(); widget.authUser = new AuthenticatedUser();
widget.doctor.speciality = widget.docProfileList.specialty;
getPatientData(); getPatientData();
super.initState(); super.initState();
} }
@ -190,7 +196,9 @@ class _DoctorProfileState extends State<DoctorProfile>
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
children: [ children: [
DoctorInformation(docProfileList: widget.docProfileList), DoctorInformation(docProfileList: widget.docProfileList),
DocAvailableAppointments(doctor: widget.doctor) DocAvailableAppointments(
doctor: widget.doctor,
isLiveCareAppointment: widget.isLiveCareAppointment)
], ],
controller: _tabController, controller: _tabController,
), ),
@ -245,6 +253,7 @@ class _DoctorProfileState extends State<DoctorProfile>
MaterialPageRoute( MaterialPageRoute(
builder: (context) => BookConfirm( builder: (context) => BookConfirm(
doctor: widget.doctor, doctor: widget.doctor,
isLiveCareAppointment: widget.isLiveCareAppointment,
selectedDate: DocAvailableAppointments.selectedDate, selectedDate: DocAvailableAppointments.selectedDate,
selectedTime: DocAvailableAppointments.selectedTime))); selectedTime: DocAvailableAppointments.selectedTime)));
} }

@ -9,9 +9,10 @@ import 'package:flutter/material.dart';
class SearchResults extends StatefulWidget { class SearchResults extends StatefulWidget {
List<DoctorList> doctorsList = []; List<DoctorList> doctorsList = [];
List<PatientDoctorAppointmentList> patientDoctorAppointmentListHospital; List<PatientDoctorAppointmentList> patientDoctorAppointmentListHospital;
bool isLiveCareAppointment;
SearchResults( SearchResults(
{@required this.doctorsList, this.patientDoctorAppointmentListHospital}); {@required this.doctorsList, this.patientDoctorAppointmentListHospital, @required this.isLiveCareAppointment});
@override @override
_SearchResultsState createState() => _SearchResultsState(); _SearchResultsState createState() => _SearchResultsState();
@ -53,6 +54,7 @@ class _SearchResultsState extends State<SearchResults> {
.map((doctor) { .map((doctor) {
return DoctorView( return DoctorView(
doctor: doctor, doctor: doctor,
isLiveCareAppointment: widget.isLiveCareAppointment,
); );
}).toList(), }).toList(),
)), )),

@ -2,12 +2,13 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart
import 'package:diplomaticquarterapp/models/Appointments/FreeSlot.dart'; import 'package:diplomaticquarterapp/models/Appointments/FreeSlot.dart';
import 'package:diplomaticquarterapp/models/Appointments/timeSlot.dart'; import 'package:diplomaticquarterapp/models/Appointments/timeSlot.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:table_calendar/table_calendar.dart';
import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart';
import 'package:table_calendar/table_calendar.dart';
import '../../../uitl/date_uitl.dart'; import '../../../uitl/date_uitl.dart';
@ -17,8 +18,10 @@ class DocAvailableAppointments extends StatefulWidget {
static DateTime selectedAppoDateTime; static DateTime selectedAppoDateTime;
static String selectedDate; static String selectedDate;
static String selectedTime; static String selectedTime;
bool isLiveCareAppointment;
DocAvailableAppointments({@required this.doctor}); DocAvailableAppointments(
{@required this.doctor, @required this.isLiveCareAppointment});
@override @override
_DocAvailableAppointmentsState createState() => _DocAvailableAppointmentsState createState() =>
@ -31,6 +34,8 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments>
AnimationController _animationController; AnimationController _animationController;
CalendarController _calendarController; CalendarController _calendarController;
AppSharedPreferences sharedPref = new AppSharedPreferences();
var selectedDate = ""; var selectedDate = "";
dynamic selectedDateJSON; dynamic selectedDateJSON;
dynamic jsonFreeSlots; dynamic jsonFreeSlots;
@ -56,8 +61,13 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments>
_selectedDay: ['Event A0'] _selectedDay: ['Event A0']
}; };
WidgetsBinding.instance WidgetsBinding.instance.addPostFrameCallback((_) async {
.addPostFrameCallback((_) => getDoctorFreeSlots(context, widget.doctor)); if (widget.isLiveCareAppointment)
getDoctorScheduledFreeSlots(context, widget.doctor);
else {
getDoctorFreeSlots(context, widget.doctor);
}
});
_calendarController = CalendarController(); _calendarController = CalendarController();
_animationController = AnimationController( _animationController = AnimationController(
@ -323,8 +333,8 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments>
getDoctorFreeSlots(context, DoctorList docObject) { getDoctorFreeSlots(context, DoctorList docObject) {
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
service service
.getDoctorFreeSlots( .getDoctorFreeSlots(docObject.doctorID, docObject.clinicID,
docObject.doctorID, docObject.clinicID, docObject.projectID, context) docObject.projectID, context)
.then((res) { .then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
if (res['FreeTimeSlots'].length != 0) { if (res['FreeTimeSlots'].length != 0) {
@ -340,7 +350,32 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments>
} }
}).catchError((err) { }).catchError((err) {
print(err); print(err);
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); }).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
}
getDoctorScheduledFreeSlots(context, DoctorList docObject) {
DoctorsListService service = new DoctorsListService();
service
.getDoctorScheduledFreeSlots(docObject.doctorID, docObject.clinicID,
docObject.projectID, docObject.serviceID, context)
.then((res) {
if (res['MessageStatus'] == 1) {
if (res['PatientER_DoctorFreeSlots'].length != 0) {
freeSlotsResponse = res['PatientER_DoctorFreeSlots'];
print("res['PatientER_DoctorFreeSlots']");
print(res['PatientER_DoctorFreeSlots'].length);
_getJSONSlots().then((value) => {
setState(() => {_events.clear(), _events = value})
});
} else {}
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
}).catchError((err) {
print(err);
}).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
Widget _buildEventsMarker(DateTime date, List events) { Widget _buildEventsMarker(DateTime date, List events) {

@ -162,6 +162,7 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => SearchResults( builder: (context) => SearchResults(
isLiveCareAppointment: false,
doctorsList: docList, doctorsList: docList,
patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital:
patientDoctorAppointmentListHospital))); patientDoctorAppointmentListHospital)));

@ -128,8 +128,8 @@ class _ExpandableListViewState extends State<ExpandableListView> {
widget.doctorsList2[index].projectName.toString() widget.doctorsList2[index].projectName.toString()
? DoctorView( ? DoctorView(
//AJ note //AJ note
doctor: widget.doctorsList2[index] doctor: widget.doctorsList2[index],
isLiveCareAppointment: false,
// widget.doctorsList2[index] // widget.doctorsList2[index]
) )
: Container(); : Container();

@ -11,9 +11,10 @@ import '../DoctorProfile.dart';
class DoctorView extends StatelessWidget { class DoctorView extends StatelessWidget {
final DoctorList doctor; final DoctorList doctor;
bool isLiveCareAppointment;
DoctorView({@required this.doctor}); DoctorView({@required this.doctor, @required this.isLiveCareAppointment});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -185,6 +186,7 @@ class DoctorView extends StatelessWidget {
MaterialPageRoute( MaterialPageRoute(
builder: (context) => DoctorProfile( builder: (context) => DoctorProfile(
doctor: docObject, doctor: docObject,
isLiveCareAppointment: isLiveCareAppointment,
docProfileList: docProfile, docProfileList: docProfile,
isOpenAppt: isAppo, isOpenAppt: isAppo,
))); )));

@ -113,7 +113,7 @@ class _HospitalsLiveChatPageState extends State<HospitalsLiveChatPage> {
IconButton( IconButton(
icon: Icon( icon: Icon(
Icons Icons
.arrow_forward_rounded, .arrow_forward_ios,
color: color:
tappedIndex == index tappedIndex == index
? Colors.white ? Colors.white

@ -356,14 +356,15 @@ class _AppointmentActionsState extends State<AppointmentActions> {
print(res); print(res);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
Navigator.of(context).pop();
} else { } else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']); AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
} }
}).catchError((err) { }).catchError((err) {
print(err); print(err);
}).showProgressBar( }).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)).then((value) {
Navigator.of(context).pop();
});
} }
openAppointmentRadiology() { openAppointmentRadiology() {

@ -284,7 +284,7 @@ class _ToDoState extends State<ToDo> {
break; break;
case 50: case 50:
return "assets/images/new-design/liveCare_logo_icon.png"; return "assets/images/new-design/confirm_button.png";
break; break;
default: default:
@ -297,14 +297,15 @@ class _ToDoState extends State<ToDo> {
case 10: case 10:
confirmAppointment(appo); confirmAppointment(appo);
break; break;
case 20: case 20:
getPatientShare(context, appo); getPatientShare(context, appo);
break; break;
case 30: case 30:
getAppoQR(context, appo); getAppoQR(context, appo);
break; break;
case 50:
confirmAppointment(appo);
break;
} }
} }
@ -334,7 +335,7 @@ class _ToDoState extends State<ToDo> {
break; break;
case 50: case 50:
return TranslationBase.of(context).livecare; return TranslationBase.of(context).confirmLiveCare;
break; break;
default: default:
@ -444,7 +445,8 @@ class _ToDoState extends State<ToDo> {
}).catchError((err) { }).catchError((err) {
print(err); print(err);
AppToast.showErrorToast(message: err); AppToast.showErrorToast(message: err);
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); }).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
getPatientShare(context, AppoitmentAllHistoryResultList appo) { getPatientShare(context, AppoitmentAllHistoryResultList appo) {
@ -457,7 +459,8 @@ class _ToDoState extends State<ToDo> {
openPaymentDialog(appo, widget.patientShareResponse); openPaymentDialog(appo, widget.patientShareResponse);
}).catchError((err) { }).catchError((err) {
print(err); print(err);
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); }).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
getAppoQR(context, AppoitmentAllHistoryResultList appo) { getAppoQR(context, AppoitmentAllHistoryResultList appo) {
@ -478,7 +481,8 @@ class _ToDoState extends State<ToDo> {
navigateToQR(context, res['AppointmentQR'], patientShareResponse); navigateToQR(context, res['AppointmentQR'], patientShareResponse);
}).catchError((err) { }).catchError((err) {
print(err); print(err);
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); }).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
Future navigateToQR( Future navigateToQR(
@ -592,7 +596,8 @@ class _ToDoState extends State<ToDo> {
} }
}).catchError((err) { }).catchError((err) {
print(err); print(err);
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); }).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { createAdvancePayment(res, AppoitmentAllHistoryResultList appo) {
@ -610,7 +615,8 @@ class _ToDoState extends State<ToDo> {
appo); appo);
}).catchError((err) { }).catchError((err) {
print(err); print(err);
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); }).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
addAdvancedNumberRequest(String advanceNumber, String paymentReference, addAdvancedNumberRequest(String advanceNumber, String paymentReference,
@ -624,7 +630,8 @@ class _ToDoState extends State<ToDo> {
getAppoQR(context, appo); getAppoQR(context, appo);
}).catchError((err) { }).catchError((err) {
print(err); print(err);
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); }).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
Future navigateToPaymentMethod( Future navigateToPaymentMethod(
@ -670,6 +677,7 @@ class _ToDoState extends State<ToDo> {
} }
}).catchError((err) { }).catchError((err) {
print(err); print(err);
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); }).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
} }

@ -8,6 +8,8 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart';
import 'livecare_type_select.dart';
class LiveCareHome extends StatefulWidget { class LiveCareHome extends StatefulWidget {
static bool showFooterButton = true; static bool showFooterButton = true;

@ -0,0 +1,51 @@
import 'package:diplomaticquarterapp/models/LiveCare/LiveCareScheduleClinicsListResponse.dart';
import 'package:flutter/material.dart';
class ScheduleClinicCard extends StatefulWidget {
bool isSelected;
final ClinicsHaveScheduleList clinicsHaveScheduleList;
var languageID;
ScheduleClinicCard(
{this.isSelected,
this.languageID,
@required this.clinicsHaveScheduleList});
@override
_ScheduleClinicCardState createState() => _ScheduleClinicCardState();
}
class _ScheduleClinicCardState extends State<ScheduleClinicCard> {
@override
Widget build(BuildContext context) {
return Container(
child: Card(
margin: EdgeInsets.fromLTRB(15.0, 10.0, 15.0, 8.0),
color: widget.isSelected ? Colors.blue : Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Container(
width: MediaQuery.of(context).size.width * 0.8,
padding: EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Container(
child: Text(
widget.languageID == 'ar'
? widget.clinicsHaveScheduleList.clinicDescN
: widget.clinicsHaveScheduleList.clinicDesc,
style: TextStyle(
fontSize: 16.0,
color:
widget.isSelected ? Colors.white : Colors.black)),
),
],
),
),
),
);
}
}

@ -0,0 +1,224 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class LiveCareTypeSelect extends StatefulWidget {
@override
_LiveCareTypeSelectState createState() => _LiveCareTypeSelectState();
}
class _LiveCareTypeSelectState extends State<LiveCareTypeSelect> {
var languageID;
AppSharedPreferences sharedPref = AppSharedPreferences();
@override
void initState() {
getLanguageID();
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: InkWell(
onTap: () {
Navigator.pop(context, null);
},
child: Icon(
Icons.close,
color: Colors.white,
),
),
title: Text(TranslationBase.of(context).bookAppo,
style: TextStyle(color: Colors.white)),
),
body: SingleChildScrollView(
child: Container(
margin: EdgeInsets.only(left: 20.0, right: 20.0),
child: Column(
children: <Widget>[
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(top: 15.0, bottom: 10.0),
child: Image.asset(
languageID == 'ar'
? "assets/images/new-design/liveCare_ar_bg.png"
: "assets/images/new-design/liveCare_en_bg.png",
width: 120),
),
Container(
alignment: Alignment.center,
child: Text("LiveCare Service",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 20.0))),
Container(
margin: EdgeInsets.only(top: 10.0),
alignment: Alignment.center,
child: Text(
"is to obtain medical advice with a specialist doctor Via a video call",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 18.0))),
Container(
margin: EdgeInsets.only(top: 15.0),
alignment: Alignment.centerLeft,
child: Text("WHY LIVECARE?",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 20.0))),
Container(
margin: EdgeInsets.only(top: 20.0, left: 20.0),
child: Row(
children: <Widget>[
SvgPicture.asset("assets/images/new-design/check_icon.svg",
width: 25),
Container(
width: MediaQuery.of(context).size.width * 0.75,
margin: EdgeInsets.all(10.0),
child: Text(
"No need to wait, you will get Medical consultation immediately via Video call.",
overflow: TextOverflow.clip,
style: TextStyle(fontSize: 14.0)),
)
],
),
),
Container(
margin: EdgeInsets.only(top: 5.0, left: 20.0),
child: Row(
children: <Widget>[
SvgPicture.asset("assets/images/new-design/check_icon.svg",
width: 25),
Container(
width: MediaQuery.of(context).size.width * 0.75,
margin: EdgeInsets.all(10.0),
child: Text("The doctor will see your medical file.",
overflow: TextOverflow.clip,
style: TextStyle(fontSize: 14.0)),
)
],
),
),
Container(
margin: EdgeInsets.only(top: 5.0, left: 20.0),
child: Row(
children: <Widget>[
SvgPicture.asset("assets/images/new-design/check_icon.svg",
width: 25),
Container(
width: MediaQuery.of(context).size.width * 0.75,
margin: EdgeInsets.all(10.0),
child: Text("Free Prescription delivery service.",
overflow: TextOverflow.clip,
style: TextStyle(fontSize: 14.0)),
)
],
),
),
Container(
margin: EdgeInsets.only(top: 20.0),
child: Text(
"** The service is included with some insurance companies according to the terms and conditions With our best wishes for health and wellness",
style: TextStyle(fontSize: 16.0))),
InkWell(
onTap: (){
Navigator.pop(context, "immediate");
},
child: Container(
decoration: BoxDecoration(
color: Colors.red[900],
borderRadius: BorderRadius.all(Radius.circular(10.0))),
height: 120.0,
margin: EdgeInsets.only(top: 20.0),
child: Row(
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 20.0),
child: SvgPicture.asset(
"assets/images/new-design/liveCare_logo_icon_white.svg",
width: 80),
),
Container(
width: MediaQuery.of(context).size.width * 0.6,
margin: EdgeInsets.fromLTRB(30.0, 20.0, 0.0, 0.0),
child: Column(
children: <Widget>[
Text("Get Medical consultation immediately",
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18.0,
color: Colors.white)),
Container(
margin: EdgeInsets.only(top: 10.0),
alignment: Alignment.centerLeft,
child: Text("Instant video call",
style: TextStyle(
fontSize: 18.0, color: Colors.white)),
)
],
),
),
],
)),
),
InkWell(
onTap: (){
Navigator.pop(context, "schedule");
},
child: Container(
decoration: BoxDecoration(
color: Colors.grey[700],
borderRadius: BorderRadius.all(Radius.circular(10.0))),
height: 120.0,
margin: EdgeInsets.only(top: 20.0),
child: Row(
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 20.0),
child: Image.asset(
"assets/images/new-design/calendar.png",
width: 70),
),
Container(
width: MediaQuery.of(context).size.width * 0.6,
margin: EdgeInsets.fromLTRB(30.0, 30.0, 0.0, 0.0),
child: Column(
children: <Widget>[
Container(
alignment: Alignment.centerLeft,
child: Text("Book Appointment",
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18.0,
color: Colors.white)),
),
Container(
margin: EdgeInsets.only(top: 10.0),
alignment: Alignment.centerLeft,
child: Text("Schedule Video Call",
style: TextStyle(
fontSize: 18.0, color: Colors.white)),
)
],
),
),
],
)),
),
],
),
),
),
);
}
getLanguageID() async {
var languageID = await sharedPref.getString(APP_LANGUAGE);
setState(() {
this.languageID = languageID;
});
}
}

@ -1,9 +1,14 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart'; import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart';
import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse.dart'; import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse.dart';
import 'package:diplomaticquarterapp/models/LiveCare/LiveCareScheduleClinicsListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart';
import 'package:diplomaticquarterapp/pages/livecare/livecare_scheduling/schedule_clinic_card.dart';
import 'package:diplomaticquarterapp/pages/livecare/livecare_type_select.dart';
import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCareInfoDialog.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCareInfoDialog.dart';
import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePaymentDialog.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePaymentDialog.dart';
import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart';
@ -30,8 +35,11 @@ class _clinic_listState extends State<ClinicList> {
int currentSelectedIndex = 0; int currentSelectedIndex = 0;
LiveCareClinicsListResponse liveCareClinicsListResponse; LiveCareClinicsListResponse liveCareClinicsListResponse;
LiveCareScheduleClinicsListResponse liveCareScheduleClinicsListResponse;
bool isDataLoaded = false; bool isDataLoaded = false;
var languageID; var languageID;
var currentSelectedLiveCareType;
int selectedClinicID = 1; int selectedClinicID = 1;
String selectedClinicName = "-"; String selectedClinicName = "-";
@ -46,11 +54,13 @@ class _clinic_listState extends State<ClinicList> {
@override @override
void initState() { void initState() {
liveCareClinicsListResponse = new LiveCareClinicsListResponse(); liveCareClinicsListResponse = new LiveCareClinicsListResponse();
liveCareScheduleClinicsListResponse =
new LiveCareScheduleClinicsListResponse();
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
// Future.delayed(new Duration(milliseconds: 1200), () { openLiveCareSelectionDialog();
getLiveCareClinicsList();
// });
}); });
getLanguageID(); getLanguageID();
super.initState(); super.initState();
} }
@ -58,77 +68,9 @@ class _clinic_listState extends State<ClinicList> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SingleChildScrollView( return SingleChildScrollView(
child: Column( child: currentSelectedLiveCareType == "immediate"
children: <Widget>[ ? getLiveCareImmediateClinicList()
isDataLoaded : getLiveCareScheduleClinicList());
? Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.all(15.0),
child: Text("Online Clinics: ",
style: TextStyle(
fontSize: 20.0, fontWeight: FontWeight.bold)),
),
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
padding: EdgeInsets.all(0.0),
itemCount: liveCareClinicsListResponse
.patientERGetClinicsList.length,
itemBuilder: (context, index) {
return InkWell(
onTap: () {
updateSelectedIndex(liveCareClinicsListResponse
.patientERGetClinicsList[index]);
},
child: ClinicCard(
isSelected: selectedClinicID ==
liveCareClinicsListResponse
.patientERGetClinicsList[index]
.serviceID
? true
: false,
patientERGetClinicsList:
liveCareClinicsListResponse
.patientERGetClinicsList[index],
languageID: languageID,
),
);
},
),
Container(
height: 10.0,
),
],
),
)
: Container(),
isDataLoaded ? Container(
width: MediaQuery.of(context).size.width,
height: 50.0,
margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
child: ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
minWidth: MediaQuery.of(context).size.width * 0.7,
height: 45.0,
child: RaisedButton(
color: new Color(0xFF60686b),
textColor: Colors.white,
disabledTextColor: Colors.white,
disabledColor: new Color(0xFFbcc2c4),
onPressed: startLiveCare,
child: Text("Start", style: TextStyle(fontSize: 18.0)),
),
),
) : Container(),
],
),
);
} }
void startLiveCare() { void startLiveCare() {
@ -388,10 +330,298 @@ class _clinic_listState extends State<ClinicList> {
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
} }
getLiveCareScheduleClinicsList() {
isDataLoaded = false;
LiveCareService service = new LiveCareService();
service.getLiveCareScheduledClinics(context).then((res) {
print(res['ClinicsHaveScheduleList'].length);
if (res['MessageStatus'] == 1) {
setState(() {
liveCareScheduleClinicsListResponse =
LiveCareScheduleClinicsListResponse.fromJson(res);
print(liveCareScheduleClinicsListResponse
.clinicsHaveScheduleList.length);
selectedClinicID = liveCareScheduleClinicsListResponse
.clinicsHaveScheduleList[0].serviceID;
selectedClinicName = liveCareScheduleClinicsListResponse
.clinicsHaveScheduleList[0].clinicDesc;
isDataLoaded = true;
});
} else {
isDataLoaded = true;
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
}).catchError((err) {
print(err);
}).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
}
openLiveCareSelectionDialog() {
Navigator.of(context)
.push(new MaterialPageRoute<String>(
builder: (BuildContext context) {
return LiveCareTypeSelect();
},
fullscreenDialog: true))
.then((value) {
if (value == null) {
Navigator.pop(context);
} else {
print(value);
if (value == "immediate") {
setState(() {
currentSelectedLiveCareType = "immediate";
});
getLiveCareClinicsList();
}
if (value == "schedule") {
setState(() {
currentSelectedLiveCareType = "schedule";
});
getLiveCareScheduleClinicsList();
}
}
});
}
Widget getLiveCareScheduleClinicList() {
return Column(
children: <Widget>[
isDataLoaded
? Container(
height: MediaQuery.of(context).size.height * 0.7,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// Container(
// margin: EdgeInsets.all(15.0),
// child: Text("Online Clinics: ",
// style: TextStyle(
// fontSize: 20.0, fontWeight: FontWeight.bold)),
// ),
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
padding: EdgeInsets.all(0.0),
itemCount: liveCareScheduleClinicsListResponse
.clinicsHaveScheduleList.length,
itemBuilder: (context, index) {
return InkWell(
onTap: () {
updateSelectedScheduleIndex(
liveCareScheduleClinicsListResponse
.clinicsHaveScheduleList[index]);
},
child: ScheduleClinicCard(
isSelected: selectedClinicID ==
liveCareScheduleClinicsListResponse
.clinicsHaveScheduleList[index]
.serviceID
? true
: false,
clinicsHaveScheduleList:
liveCareScheduleClinicsListResponse
.clinicsHaveScheduleList[index],
languageID: languageID,
),
);
},
),
Container(
height: 10.0,
),
],
),
)
: Container(),
isDataLoaded
? Align(
alignment: FractionalOffset.bottomCenter,
child: Container(
width: MediaQuery.of(context).size.width,
height: 50.0,
margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
child: ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
minWidth: MediaQuery.of(context).size.width * 0.7,
height: 45.0,
child: RaisedButton(
color: new Color(0xFF60686b),
textColor: Colors.white,
disabledTextColor: Colors.white,
disabledColor: new Color(0xFFbcc2c4),
onPressed: startScheduleLiveCare,
child: Text("Start", style: TextStyle(fontSize: 18.0)),
),
),
),
)
: Container(),
],
);
}
Widget getLiveCareImmediateClinicList() {
return Column(
children: <Widget>[
isDataLoaded
? Container(
height: MediaQuery.of(context).size.height * 0.7,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.all(15.0),
child: Text("Online Clinics: ",
style: TextStyle(
fontSize: 20.0, fontWeight: FontWeight.bold)),
),
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
padding: EdgeInsets.all(0.0),
itemCount: liveCareClinicsListResponse
.patientERGetClinicsList.length,
itemBuilder: (context, index) {
return InkWell(
onTap: () {
updateSelectedIndex(liveCareClinicsListResponse
.patientERGetClinicsList[index]);
},
child: ClinicCard(
isSelected: selectedClinicID ==
liveCareClinicsListResponse
.patientERGetClinicsList[index]
.serviceID
? true
: false,
patientERGetClinicsList: liveCareClinicsListResponse
.patientERGetClinicsList[index],
languageID: languageID,
),
);
},
),
Container(
height: 10.0,
),
],
),
)
: Container(),
isDataLoaded
? Align(
alignment: FractionalOffset.bottomCenter,
child: Container(
width: MediaQuery.of(context).size.width,
height: 50.0,
margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
child: ButtonTheme(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
minWidth: MediaQuery.of(context).size.width * 0.7,
height: 45.0,
child: RaisedButton(
color: new Color(0xFF60686b),
textColor: Colors.white,
disabledTextColor: Colors.white,
disabledColor: new Color(0xFFbcc2c4),
onPressed: startLiveCare,
child: Text("Start", style: TextStyle(fontSize: 18.0)),
),
),
),
)
: Container(),
],
);
}
void startScheduleLiveCare() {
List<DoctorList> doctorsList = [];
LiveCareService service = new LiveCareService();
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital =
List();
service
.getLiveCareScheduledDoctorList(context, selectedClinicID)
.then((res) {
print(res['DoctorByClinicIDList']);
print(res['DoctorByClinicIDList'].length);
if (res['MessageStatus'] == 1) {
setState(() {
if (res['DoctorByClinicIDList'].length != 0) {
res['DoctorByClinicIDList'].forEach((v) {
doctorsList.add(new DoctorList.fromJson(v));
});
doctorsList.forEach((element) {
List<PatientDoctorAppointmentList> doctorByHospital =
_patientDoctorAppointmentListHospital
.where(
(elementClinic) =>
elementClinic.filterName == element.projectName,
)
.toList();
if (doctorByHospital.length != 0) {
_patientDoctorAppointmentListHospital[
_patientDoctorAppointmentListHospital
.indexOf(doctorByHospital[0])]
.patientDoctorAppointmentList
.add(element);
} else {
_patientDoctorAppointmentListHospital.add(
PatientDoctorAppointmentList(
filterName: element.projectName,
distanceInKMs:
element.projectDistanceInKiloMeters.toString(),
patientDoctorAppointment: element));
}
});
} else {}
});
this.sharedPref.setBool(IS_LIVECARE_APPOINTMENT, true);
navigateToSearchResults(
context, doctorsList, _patientDoctorAppointmentListHospital);
} else {}
}).catchError((err) {
print(err);
}).showProgressBar(
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
}
Future navigateToSearchResults(
context,
List<DoctorList> docList,
List<PatientDoctorAppointmentList>
patientDoctorAppointmentListHospital) async {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SearchResults(
doctorsList: docList,
isLiveCareAppointment: true,
patientDoctorAppointmentListHospital:
patientDoctorAppointmentListHospital)));
}
updateSelectedIndex(PatientERGetClinicsList patientERGetClinicsList) { updateSelectedIndex(PatientERGetClinicsList patientERGetClinicsList) {
setState(() { setState(() {
selectedClinicID = patientERGetClinicsList.serviceID; selectedClinicID = patientERGetClinicsList.serviceID;
selectedClinicName = patientERGetClinicsList.serviceName; selectedClinicName = patientERGetClinicsList.serviceName;
}); });
} }
updateSelectedScheduleIndex(ClinicsHaveScheduleList patientERGetClinicsList) {
setState(() {
selectedClinicID = patientERGetClinicsList.serviceID;
selectedClinicName = patientERGetClinicsList.clinicDesc;
});
}
} }

@ -205,6 +205,42 @@ class DoctorsListService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future<Map> getDoctorScheduledFreeSlots(
int docID, int clinicID, int projectID, int serviceID, BuildContext context) async {
Map<String, dynamic> request;
var languageID = await sharedPref.getString(APP_LANGUAGE);
Request req = appGlobal.getPublicRequest();
request = {
"DoctorID": docID,
"IsBookingForLiveCare": 1,
"ClinicID": clinicID,
"ProjectID": projectID,
"OriginalClinicID": clinicID,
"ServiceID": serviceID,
"days": 50,
"isReschadual": false,
"VersionID": req.VersionID,
"Channel": 3,
"LanguageID": languageID == 'ar' ? 1 : 2,
"IPAdress": "10.20.10.20",
"generalid": "Cs2020@2016\$2958",
"PatientOutSA": 0,
"SessionID": null,
"isDentalAllowedBackend": false,
"DeviceTypeID": 1
};
dynamic localRes;
await baseAppClient.post(GET_LIVECARE_SCHEDULE_DOCTOR_TIME_SLOTS,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> insertAppointment(int docID, int clinicID, int projectID, Future<Map> insertAppointment(int docID, int clinicID, int projectID,
String selectedTime, String selectedDate, BuildContext context) async { String selectedTime, String selectedDate, BuildContext context) async {
Map<String, dynamic> request; Map<String, dynamic> request;
@ -258,6 +294,60 @@ class DoctorsListService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future<Map> insertLiveCareScheduleAppointment(int docID, int clinicID, int projectID, int serviceID,
String selectedTime, String selectedDate, BuildContext context) async {
Map<String, dynamic> request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson(
await this.sharedPref.getObject(USER_PROFILE));
authUser = data;
}
var languageID = await sharedPref.getString(APP_LANGUAGE);
Request req = appGlobal.getPublicRequest();
request = {
"IsForLiveCare": true,
"ProjectID": projectID,
"ClinicID": clinicID,
"DoctorID": docID,
"ServiceID": serviceID,
"StartTime": selectedTime,
"SelectedTime": selectedTime,
"EndTime": selectedTime,
"InitialSlotDuration": 0,
"StrAppointmentDate": selectedDate,
"IsVirtual": false,
"DeviceType": Platform.isIOS ? 'iOS' : 'Android',
"BookedBy": 102,
"VisitType": 1,
"VisitFor": 1,
"VersionID": req.VersionID,
"Channel": req.Channel,
"LanguageID": languageID == 'ar' ? 1 : 2,
"IPAdress": req.IPAdress,
"generalid": req.generalid,
"PatientOutSA": authUser.outSA,
"SessionID": "YckwoXhUmWBsnHKEKig",
"isDentalAllowedBackend": false,
"DeviceTypeID": req.DeviceTypeID,
"PatientID": authUser.patientID,
"TokenID": "@dm!n",
"PatientTypeID": authUser.patientType,
"PatientType": authUser.patientType
};
dynamic localRes;
await baseAppClient.post(INSERT_LIVECARE_SCHEDULE_APPOINTMENT,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> getPatientShare( Future<Map> getPatientShare(
String appoID, int clinicID, int projectID, BuildContext context) async { String appoID, int clinicID, int projectID, BuildContext context) async {
Map<String, dynamic> request; Map<String, dynamic> request;
@ -302,6 +392,51 @@ class DoctorsListService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future<Map> getLiveCareAppointmentPatientShare(
String appoID, int clinicID, int projectID, BuildContext context) async {
Map<String, dynamic> request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson(
await this.sharedPref.getObject(USER_PROFILE));
authUser = data;
}
var languageID = await sharedPref.getString(APP_LANGUAGE);
Request req = appGlobal.getPublicRequest();
request = {
"ProjectID": projectID,
"ClinicID": clinicID,
"AppointmentNo": appoID,
"IsActiveAppointment": true,
"IsForLiveCare": true,
"VersionID": req.VersionID,
"Channel": req.Channel,
"LanguageID": languageID == 'ar' ? 1 : 2,
"IPAdress": req.IPAdress,
"generalid": req.generalid,
"PatientOutSA": authUser.outSA,
"SessionID": "YckwoXhUmWBsnHKEKig",
"isDentalAllowedBackend": false,
"DeviceTypeID": req.DeviceTypeID,
"PatientID": authUser.patientID,
"TokenID": "@dm!n",
"PatientTypeID": authUser.patientType,
"PatientType": authUser.patientType
};
dynamic localRes;
await baseAppClient.post(GET_PATIENT_SHARE_LIVECARE,
onSuccess: (response, statusCode) async {
localRes = response['OnlineCheckInAppointments'][0];
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> getPatientAppointmentHistory( Future<Map> getPatientAppointmentHistory(
bool isActiveAppointment, BuildContext context) async { bool isActiveAppointment, BuildContext context) async {
Map<String, dynamic> request; Map<String, dynamic> request;

@ -53,6 +53,81 @@ class LiveCareService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future<Map> getLiveCareScheduledClinics(BuildContext context) async {
Map<String, dynamic> request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson(
await this.sharedPref.getObject(USER_PROFILE));
authUser = data;
}
var languageID = await sharedPref.getString(APP_LANGUAGE);
Request req = appGlobal.getPublicRequest();
request = {
"LanguageID": languageID == 'ar' ? 1 : 2,
"IPAdress": "10.20.10.20",
"VersionID": req.VersionID,
"Channel": req.Channel,
"generalid": 'Cs2020@2016\$2958',
"PatientOutSA": 0,
"TokenID": "",
"DeviceTypeID": req.DeviceTypeID,
"SessionID": "YckwoXhUmWBsnHKEKig",
"Age": authUser.age != null ? authUser.age : 0,
"PatientID": authUser.patientID != null ? authUser.patientID : 0,
"Gender": authUser.gender != null ? authUser.gender : 0
};
dynamic localRes;
await baseAppClient.post(GET_LIVECARE_SCHEDULE_CLINICS,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> getLiveCareScheduledDoctorList(BuildContext context, int serviceID) async {
Map<String, dynamic> request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson(
await this.sharedPref.getObject(USER_PROFILE));
authUser = data;
}
var languageID = await sharedPref.getString(APP_LANGUAGE);
Request req = appGlobal.getPublicRequest();
request = {
"LanguageID": languageID == 'ar' ? 1 : 2,
"IPAdress": "10.20.10.20",
"VersionID": req.VersionID,
"Channel": req.Channel,
"generalid": 'Cs2020@2016\$2958',
"PatientOutSA": 0,
"TokenID": "",
"DeviceTypeID": req.DeviceTypeID,
"ServiceID": serviceID,
"SessionID": "YckwoXhUmWBsnHKEKig",
"Age": authUser.age != null ? authUser.age : 0,
"PatientID": authUser.patientID != null ? authUser.patientID : 0,
"Gender": authUser.gender != null ? authUser.gender : 0
};
dynamic localRes;
await baseAppClient.post(GET_LIVECARE_SCHEDULE_CLINIC_DOCTOR_LIST,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> getLivecareHistory(BuildContext context) async { Future<Map> getLivecareHistory(BuildContext context) async {
Map<String, dynamic> request; Map<String, dynamic> request;

@ -95,6 +95,8 @@ class TranslationBase {
String get confirm => localizedValues['confirm'][locale.languageCode]; String get confirm => localizedValues['confirm'][locale.languageCode];
String get confirmLiveCare => localizedValues['confirmLiveCare'][locale.languageCode];
String get confirmLater => String get confirmLater =>
localizedValues['confirmLater'][locale.languageCode]; localizedValues['confirmLater'][locale.languageCode];

Loading…
Cancel
Save