Todo list implemented, Appointment details implemented, Appointment Reschedule implemented, Appointment Confirmed implemented

merge-requests/34/merge
haroon amjad 4 years ago
parent 7f4fbadfab
commit f5ddfabf50

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

@ -31,6 +31,9 @@ const GET_PATIENT_SHARE = "Services/Doctors.svc/REST/GetCheckinScreenAppointment
//URL to get patient appointment history
const GET_PATIENT_APPOINTMENT_HISTORY = "Services/Doctors.svc/REST/PateintHasAppoimentHistory";
//URL to confirm appointment
const CONFIRM_APPOINTMENT = "Services/MobileNotifications.svc/REST/ConfirmAppointment";
const GET_PHARMCY_ITEMS = "/Lists.svc/REST/GetPharmcyItems_Region";
const GET_PHARMACY_LIST = "/Patients.svc/REST/GetPharmcyList";

@ -11,6 +11,7 @@ const Map<String, Map<String, String>> localizedValues = {
'services': {'en': 'SERVICES', 'ar': 'الخدمات'},
'mySchedule': {'en': 'My Schedule', 'ar': 'جدولي'},
'logout': {'en': 'Logout', 'ar': 'تسجيل خروج'},
'bookAppo': {'en': 'Book Appointment', 'ar': 'حجز موعد'},
'searchBy': {'en': 'Search By:', 'ar': 'البحث عن طريق:'},
'clinic': {'en': 'Clinic', 'ar': 'العيادة'},
@ -43,7 +44,20 @@ const Map<String, Map<String, String>> localizedValues = {
'appoActions': {'en': 'Appointment Actions', 'ar': 'إجراءات الموعد'},
'date': {'en': 'Date', 'ar': 'التاريخ'},
'time': {'en': 'Time', 'ar': 'الوقت'},
'pendingPayment': {'en': 'Pending for payment', 'ar': 'في انتظار الدفع'},
'payNow': {'en': 'Pay Now', 'ar': 'ادفع الآن'},
'viewQR': {'en': 'View QR Code', 'ar': 'عرض رمز الاستجابة السريعة'},
'instruction': {'en': 'Instructions', 'ar': 'تعليمات'},
'livecare': {'en': 'LiveCare', 'ar': 'لايف كير'},
'upcoming-noAction': {'en': 'No Action Required', 'ar': 'لا يوجد إجراء مطلوب'},
'upcoming-confirm': {'en': 'Please confirm the appointment to avoid cancellation', 'ar': 'يرجى تأكيد الموعد لتفادي الإلغاء'},
'upcoming-payment-pending': {'en': 'Online Payment will be Activated before 24 Hours of Appointment Time', 'ar': 'سيتم تفعيل خدمة الدفع الالكتروني قبل 24 ساعة من موعد الحجز'},
'upcoming-payment-now': {'en': 'Pay Online now to avoid long waiting queue', 'ar': 'ادفع الآن لتفادي الانتظار'},
'upcoming-QR': {'en': 'Use the QR Code to Check-In in hospital', 'ar': 'استخدم الرمز لتسجيل الحضور في المستشفى'},
'upcoming-virtual': {'en': 'This is a virtual appointment, Please adhere to the instructions for a seamless experience.', 'ar': 'هذا موعد اتصال مرئي عن بعد ، يرجى اتباع تعليمات الخدمة.'},
'upcoming-livecare': {'en': 'This is a LiveCare appointment', 'ar': 'هذا موعد لايف كير'},
'upcoming-details': {'en': 'More Details', 'ar': 'المزيد'},
'login': {'en': 'Login', 'ar': 'تسجيل الدخول'},
'loginregister': {'en': 'Login / Register', 'ar': 'دخولتسجيل'},

@ -3,7 +3,7 @@ class AppoitmentAllHistoryResultList {
int projectID;
int appointmentNo;
String appointmentDate;
Null appointmentDateN;
dynamic appointmentDateN;
int appointmentType;
String bookDate;
int patientType;
@ -20,18 +20,18 @@ class AppoitmentAllHistoryResultList {
int companyID;
int bookedBy;
String bookedOn;
Null confirmedBy;
Null confirmedOn;
Null arrivalChangedBy;
Null arrivedOn;
Null editedBy;
Null editedOn;
Null doctorName;
Null doctorNameN;
dynamic confirmedBy;
dynamic confirmedOn;
dynamic arrivalChangedBy;
dynamic arrivedOn;
dynamic editedBy;
dynamic editedOn;
dynamic doctorName;
dynamic doctorNameN;
String statusDesc;
Null statusDescN;
dynamic statusDescN;
bool vitalStatus;
Null vitalSignAppointmentNo;
dynamic vitalSignAppointmentNo;
int episodeID;
int actualDoctorRate;
String clinicName;
@ -53,8 +53,8 @@ class AppoitmentAllHistoryResultList {
bool isMedicalReportRequested;
bool isOnlineCheckedIN;
String latitude;
Null listHISGetContactLensPerscription;
Null listHISGetGlassPerscription;
dynamic listHISGetContactLensPerscription;
dynamic listHISGetGlassPerscription;
String longitude;
int nextAction;
int noOfPatientsRate;

@ -28,7 +28,7 @@ class DoctorList {
String nationalityName;
Null nearestFreeSlot;
int noOfPatientsRate;
Null originalClinicID;
int originalClinicID;
int personRate;
int projectDistanceInKiloMeters;
String qR;

@ -1,17 +1,26 @@
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/BookConfirm.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/components/DocAvailableAppointments.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart';
import 'Components/AppointmentActions.dart';
import 'Components/AppointmentActions.dart';
class AppointmentDetails extends StatefulWidget {
AppoitmentAllHistoryResultList appo;
AppointmentDetails({@required this.appo});
@override
_AppointmentDetailsState createState() => _AppointmentDetailsState();
}
class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTickerProviderStateMixin {
class _AppointmentDetailsState extends State<AppointmentDetails>
with SingleTickerProviderStateMixin {
TabController _tabController;
bool showFooterButton = false;
@ -23,10 +32,32 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Eyad Ismail Abu-Jayab"),
),
return AppScaffold(
appBarTitle: widget.appo.doctorNameObj,
isShowAppBar: true,
bottomSheet: showFooterButton
? 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: goToBookConfirm,
child: Text(TranslationBase.of(context).bookNow,
style: TextStyle(fontSize: 18.0)),
),
),
)
: null,
body: Container(
color: new Color(0xFFf6f6f6),
child: SingleChildScrollView(
@ -43,17 +74,17 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
alignment: Alignment.center,
child: ClipRRect(
borderRadius: BorderRadius.circular(100.0),
child: Image.network(
"https://hmgwebservices.com/Images/MobileImages/OALAY/2477.png",
fit: BoxFit.fill,
height: 120.0,
width: 120.0),
child: Image.network(widget.appo.doctorImageURL,
fit: BoxFit.fill, height: 120.0, width: 120.0),
),
),
Container(
margin: EdgeInsets.only(top: 10.0),
alignment: Alignment.center,
child: Text("Dr. EYAD ISMAIL ABU-JAYAD",
child: Text(
widget.appo.doctorTitle +
" " +
widget.appo.doctorNameObj,
style: TextStyle(
fontSize: 20.0,
color: Colors.grey[900],
@ -62,7 +93,7 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
Container(
margin: EdgeInsets.only(top: 10.0),
alignment: Alignment.center,
child: Text("INTERNAL MEDICINE CLINIC",
child: Text(widget.appo.clinicName,
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[900],
@ -72,7 +103,7 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
margin: EdgeInsets.only(top: 5.0),
alignment: Alignment.center,
child: RatingBar.readOnly(
initialRating: 4.0,
initialRating: widget.appo.actualDoctorRate.toDouble(),
size: 35.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
@ -85,7 +116,10 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
Container(
margin: EdgeInsets.only(top: 5.0),
alignment: Alignment.center,
child: Text("(2322 Reviews)",
child: Text(
"(" +
widget.appo.noOfPatientsRate.toString() +
" Reviews)",
style: TextStyle(
fontSize: 14.0,
color: Colors.blue[800],
@ -126,7 +160,10 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
height: MediaQuery.of(context).size.height * 0.8,
child: TabBarView(
physics: NeverScrollableScrollPhysics(),
children: [AppointmentActions(), DocAvailableAppointments()],
children: [
AppointmentActions(),
DocAvailableAppointments(doctor: getDoctorObject())
],
controller: _tabController,
),
),
@ -136,4 +173,36 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
),
);
}
void goToBookConfirm() {
if (DocAvailableAppointments.areSlotsAvailable)
navigateToBookConfirm(context);
else
AppToast.showErrorToast(message: "Please select Time Slot to continue");
}
Future navigateToBookConfirm(context) async {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BookConfirm(
doctor: getDoctorObject(),
selectedDate: DocAvailableAppointments.selectedDate,
selectedTime: DocAvailableAppointments.selectedTime)));
}
DoctorList getDoctorObject() {
DoctorList docObj = new DoctorList();
docObj.doctorID = widget.appo.doctorID;
docObj.clinicID = widget.appo.clinicID;
docObj.projectID = widget.appo.projectID;
docObj.doctorTitle = widget.appo.doctorTitle;
docObj.name = widget.appo.doctorNameObj;
docObj.clinicName = widget.appo.clinicName;
docObj.speciality = widget.appo.doctorSpeciality;
docObj.actualDoctorRate = widget.appo.actualDoctorRate;
docObj.projectName = widget.appo.projectName;
docObj.originalClinicID = widget.appo.originalClinicID;
return docObj;
}
}

@ -4,7 +4,6 @@ import 'package:diplomaticquarterapp/models/Appointments/appoDetailsButtons.dart
import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentModel.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtons.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
class AppointmentActions extends StatefulWidget {
@ -178,8 +177,8 @@ class _AppointmentActionsState extends State<AppointmentActions> {
}
Future<List<AppoDetailsButton>> _getBookedCheckInAppoActionsList() async {
// BookedButtons.getContext(context);
print("_getBookedCheckInAppoActionsList");
print(BookedButtons.buttons);
List<AppoDetailsButton> buttonsList = [];
for (var i = 0; i < BookedButtons.buttons.length; i++) {
buttonsList.add(AppoDetailsButton(

@ -1,12 +1,12 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
class BookedButtons {
static var context;
static var buttons = [
{
"title": TranslationBase.of(context).confirm,
"subtitle": TranslationBase.of(context).appointment,
"title": TranslationBase.of(AppGlobal.context).confirm,
"subtitle": TranslationBase.of(AppGlobal.context).appointment,
"icon": "assets/images/new-design/confirm_icon.png",
"caller": "confirmAppointment"
},
@ -53,8 +53,4 @@ class BookedButtons {
"caller": "goToTodoList(31)"
}
];
static setContext(context) {
BookedButtons.context = context;
}
}

@ -1,22 +1,33 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/widgets/upcomingCard.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.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/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart';
class ToDo extends StatefulWidget {
DoctorsListService service;
List<AppoitmentAllHistoryResultList> appoList = [];
var languageID;
@override
_ToDoState createState() => _ToDoState();
}
class _ToDoState extends State<ToDo> {
AppSharedPreferences sharedPref = AppSharedPreferences();
bool isLoading = false;
@override
void initState() {
print("initState");
widget.service = new DoctorsListService();
getPatientAppointmentHistory();
super.initState();
@ -26,29 +37,383 @@ class _ToDoState extends State<ToDo> {
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).todoList,
body: SingleChildScrollView(
child: Container(
child: ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
padding: EdgeInsets.all(0.0),
itemCount: widget.appoList.length,
itemBuilder: (context, index) {
return TodoListCard(
appo: widget.appoList[index],
);
},
),
),
),
body: isLoading == false
? SingleChildScrollView(
child: Container(
child: ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
padding: EdgeInsets.all(0.0),
itemCount: widget.appoList.length,
itemBuilder: (context, index) {
return Container(
margin: EdgeInsets.all(10.0),
child: Card(
margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0),
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Row(
children: <Widget>[
Image.asset(
"assets/images/new-design/time_icon.png",
width: 20.0,
height: 20.0),
Container(
margin: EdgeInsets.only(
left: 10.0, right: 30.0),
child: Text(
getDate(widget
.appoList[index].appointmentDate),
style: TextStyle(fontSize: 12.0)),
),
Image.asset(
"assets/images/new-design/hospital_address_icon.png",
width: 20.0,
height: 20.0),
Container(
margin: EdgeInsets.only(
left: 10.0, right: 10.0),
child: Text(
widget.appoList[index].projectName,
style: TextStyle(fontSize: 12.0)),
),
],
),
Container(
margin: EdgeInsets.only(top: 5.0),
child: Divider(
color: Colors.grey[500],
),
),
Flex(
direction: Axis.horizontal,
children: <Widget>[
Expanded(
flex: 1,
child: Container(
height:
MediaQuery.of(context).size.height *
0.1,
margin: EdgeInsets.only(top: 5.0),
child: ClipRRect(
borderRadius:
BorderRadius.circular(100.0),
child: Image.network(
widget
.appoList[index].doctorImageURL,
fit: BoxFit.fill),
),
),
),
Expanded(
flex: 3,
child: Container(
margin: EdgeInsets.only(
top: 20.0, left: 20.0, right: 20.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Text(
widget.appoList[index]
.doctorTitle +
" " +
widget.appoList[index]
.doctorNameObj,
style: TextStyle(
fontSize: 14.0,
color: Colors.black,
fontWeight: FontWeight.bold,
letterSpacing: 1.0)),
Container(
margin: EdgeInsets.only(
top: 3.0, bottom: 3.0),
child: Text(
getDoctorSpeciality(widget
.appoList[index]
.doctorSpeciality)
.trim(),
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[600],
letterSpacing: 1.0)),
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
RatingBar.readOnly(
initialRating: widget.appoList[index].actualDoctorRate.toDouble(),
size: 20.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
],
),
],
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () => performNextAction(
widget.appoList[index]),
child: Container(
margin: EdgeInsets.only(top: 20.0),
child: Column(
children: <Widget>[
Image.asset(
getNextActionImage(widget
.appoList[index]
.nextAction),
width: 50.0,
height: 50.0),
Container(
margin: EdgeInsets.only(top: 5.0),
child: Text(
getNextActionText(widget
.appoList[index]
.nextAction),
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12.0)),
)
],
),
),
),
)
],
),
Divider(
color: Colors.grey[500],
),
Flex(
direction: Axis.horizontal,
children: <Widget>[
Expanded(
flex: 2,
child: Container(
child: Text(
getNextActionDescription(widget
.appoList[index].nextAction),
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[700])),
),
),
Expanded(
flex: 1,
child: GestureDetector(
onTap: () {
navigateToAppointmentDetails(
context, widget.appoList[index]);
},
child: Container(
child: Text(
TranslationBase.of(context)
.upcomingDetails,
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 12.0,
color: Colors.red[600],
decoration:
TextDecoration.underline)),
),
),
)
],
)
],
),
),
),
);
},
),
),
)
: AppCircularProgressIndicator(),
);
}
String getNextActionImage(nextAction) {
switch (nextAction) {
case 0:
return "No Action";
break;
case 10:
return "assets/images/new-design/confirm_button.png";
break;
case 15:
return widget.languageID == 'ar'
? "assets/images/new-design/pay_online_button_arabic_disabled.png"
: "assets/images/new-design/pay_online_button_disabled.png";
break;
case 20:
return widget.languageID == 'ar'
? "assets/images/new-design/pay_online_button_arabic.png"
: "assets/images/new-design/pay_online_button.png";
break;
case 30:
return "assets/images/new-design/qr_code_button.png";
break;
case 40:
return "assets/images/new-design/video_call_instruction.png";
break;
case 50:
return "assets/images/new-design/liveCare_logo_icon.png";
break;
default:
return "";
}
}
performNextAction(AppoitmentAllHistoryResultList appo) {
switch (appo.nextAction) {
case 10:
confirmAppointment(appo);
break;
}
}
String getNextActionText(nextAction) {
switch (nextAction) {
case 0:
return "No Action";
break;
case 10:
return TranslationBase.of(context).confirm;
break;
case 15:
return TranslationBase.of(context).pendingPayment;
break;
case 20:
return TranslationBase.of(context).payNow;
break;
case 30:
return TranslationBase.of(context).viewQR;
break;
case 40:
return TranslationBase.of(context).instruction;
break;
case 50:
return TranslationBase.of(context).livecare;
break;
default:
return "";
}
}
String getNextActionDescription(nextAction) {
switch (nextAction) {
case 0:
return "No Action";
break;
case 10:
return TranslationBase.of(context).upcomingConfirm;
break;
case 15:
return TranslationBase.of(context).upcomingPaymentPending;
break;
case 20:
return TranslationBase.of(context).upcomingPaymentNow;
break;
case 30:
return TranslationBase.of(context).upcomingQR;
break;
case 40:
return TranslationBase.of(context).upcomingVirtual;
break;
case 50:
return TranslationBase.of(context).upcomingLivecare;
break;
default:
return "";
}
}
getLanguageID() async {
var languageID = await sharedPref.getString(APP_LANGUAGE);
setState(() {
widget.languageID = languageID;
});
}
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();
}
}
String getDoctorSpeciality(List<String> docSpecial) {
String docSpeciality = "";
docSpecial.forEach((v) {
docSpeciality = docSpeciality + v + "\n";
});
return docSpeciality;
}
Future navigateToAppointmentDetails(context, appo) async {
Navigator.push(
context, MaterialPageRoute(builder: (context) => AppointmentDetails(appo: appo)));
}
getPatientAppointmentHistory() {
loading(true);
widget.service.getPatientAppointmentHistory(true).then((res) {
print(res['AppoimentAllHistoryResultList']);
if (res['MessageStatus'] == 1) {
setState(() {
if (res['AppoimentAllHistoryResultList'].length != 0) {
@ -59,12 +424,39 @@ class _ToDoState extends State<ToDo> {
});
} else {}
});
print(widget.appoList.length);
loading(false);
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
loading(false);
}
}).catchError((err) {
print(err);
loading(false);
});
}
confirmAppointment(AppoitmentAllHistoryResultList appo) {
loading(true);
widget.service
.confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID)
.then((res) {
if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
loading(false);
getPatientAppointmentHistory();
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
loading(false);
}
}).catchError((err) {
print(err);
loading(false);
});
}
loading(bool flag) {
setState(() {
isLoading = flag;
});
}
}

@ -1,22 +1,30 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart';
class TodoListCard extends StatefulWidget {
AppoitmentAllHistoryResultList appo;
var languageID;
final VoidCallback onListUpdated;
TodoListCard({@required this.appo});
TodoListCard({@required this.appo, this.onListUpdated});
@override
_TodoListCardState createState() => _TodoListCardState();
}
class _TodoListCardState extends State<TodoListCard> {
AppSharedPreferences sharedPref = AppSharedPreferences();
@override
void initState() {
// widget.onListUpdated();
super.initState();
}
@ -25,7 +33,7 @@ class _TodoListCardState extends State<TodoListCard> {
return Container(
margin: EdgeInsets.all(10.0),
child: Card(
margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0),
margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0),
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
@ -43,7 +51,7 @@ class _TodoListCardState extends State<TodoListCard> {
width: 20.0, height: 20.0),
Container(
margin: EdgeInsets.only(left: 10.0, right: 30.0),
child: Text("Monday, 31 August 2020 09:30",
child: Text(getDate(widget.appo.appointmentDate),
style: TextStyle(fontSize: 12.0)),
),
Image.asset(
@ -73,8 +81,7 @@ class _TodoListCardState extends State<TodoListCard> {
margin: EdgeInsets.only(top: 5.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(100.0),
child: Image.network(
widget.appo.doctorImageURL,
child: Image.network(widget.appo.doctorImageURL,
fit: BoxFit.fill),
),
),
@ -87,7 +94,10 @@ class _TodoListCardState extends State<TodoListCard> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(widget.appo.doctorTitle + " " + widget.appo.doctorNameObj,
Text(
widget.appo.doctorTitle +
" " +
widget.appo.doctorNameObj,
style: TextStyle(
fontSize: 14.0,
color: Colors.black,
@ -95,7 +105,7 @@ class _TodoListCardState extends State<TodoListCard> {
letterSpacing: 1.0)),
Container(
margin: EdgeInsets.only(top: 3.0, bottom: 3.0),
child: Text("General Practioner",
child: Text(getDoctorSpeciality(widget.appo.doctorSpeciality).trim(),
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[600],
@ -124,17 +134,17 @@ class _TodoListCardState extends State<TodoListCard> {
Expanded(
flex: 1,
child: Container(
// height: MediaQuery.of(context).size.height * 0.12,
margin: EdgeInsets.only(top: 20.0),
child: Column(
children: <Widget>[
Image.asset(
"assets/images/new-design/confirm_button.png",
getNextActionImage(widget.appo.nextAction),
width: 50.0,
height: 50.0),
Container(
margin: EdgeInsets.only(top: 5.0),
child: Text("Confirm",
child: Text(
getNextActionText(widget.appo.nextAction),
textAlign: TextAlign.center,
style: TextStyle(fontSize: 12.0)),
)
@ -154,7 +164,7 @@ class _TodoListCardState extends State<TodoListCard> {
flex: 2,
child: Container(
child: Text(
"Please confirm the appointment to avoid cancellation",
getNextActionDescription(widget.appo.nextAction),
style: TextStyle(
fontSize: 12.0, color: Colors.grey[700])),
),
@ -166,7 +176,7 @@ class _TodoListCardState extends State<TodoListCard> {
navigateToAppointmentDetails(context);
},
child: Container(
child: Text("More Details",
child: Text(TranslationBase.of(context).upcomingDetails,
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 12.0,
@ -184,9 +194,153 @@ class _TodoListCardState extends State<TodoListCard> {
);
}
String getNextActionImage(nextAction) {
switch (nextAction) {
case 0:
return "No Action";
break;
case 10:
return "assets/images/new-design/confirm_button.png";
break;
case 15:
return widget.languageID == 'ar'
? "assets/images/new-design/pay_online_button_arabic_disabled.png"
: "assets/images/new-design/pay_online_button_disabled.png";
break;
case 20:
return widget.languageID == 'ar'
? "assets/images/new-design/pay_online_button_arabic.png"
: "assets/images/new-design/pay_online_button.png";
break;
case 30:
return "assets/images/new-design/qr_code_button.png";
break;
case 40:
return "assets/images/new-design/video_call_instruction.png";
break;
case 50:
return "assets/images/new-design/liveCare_logo_icon.png";
break;
default:
return "";
}
}
String getNextActionText(nextAction) {
switch (nextAction) {
case 0:
return "No Action";
break;
case 10:
return TranslationBase.of(context).confirm;
break;
case 15:
return TranslationBase.of(context).pendingPayment;
break;
case 20:
return TranslationBase.of(context).payNow;
break;
case 30:
return TranslationBase.of(context).viewQR;
break;
case 40:
return TranslationBase.of(context).instruction;
break;
case 50:
return TranslationBase.of(context).livecare;
break;
default:
return "";
}
}
String getNextActionDescription(nextAction) {
switch (nextAction) {
case 0:
return "No Action";
break;
case 10:
return TranslationBase.of(context).upcomingConfirm;
break;
case 15:
return TranslationBase.of(context).upcomingPaymentPending;
break;
case 20:
return TranslationBase.of(context).upcomingPaymentNow;
break;
case 30:
return TranslationBase.of(context).upcomingQR;
break;
case 40:
return TranslationBase.of(context).upcomingVirtual;
break;
case 50:
return TranslationBase.of(context).upcomingLivecare;
break;
default:
return "";
}
}
getLanguageID() async {
var languageID = await sharedPref.getString(APP_LANGUAGE);
setState(() {
widget.languageID = languageID;
});
}
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();
}
}
String getDoctorSpeciality(List<String> docSpecial) {
String docSpeciality = "";
docSpecial.forEach((v) {
docSpeciality = docSpeciality + v + "\n";
});
return docSpeciality;
}
Future navigateToAppointmentDetails(context) async {
Navigator.push(
context, MaterialPageRoute(builder: (context) => AppointmentDetails()));
}
}

@ -1,7 +1,6 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/models/Appointments/InsertAppointmentRequest.dart';
import 'package:diplomaticquarterapp/models/Request.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
@ -270,4 +269,40 @@ class DoctorsListService extends BaseService {
return Future.value(localRes);
}
Future<Map> confirmAppointment(int appoNo, int clinicID, int projectID) async {
Map<String, dynamic> request;
var languageID = await sharedPref.getString(APP_LANGUAGE);
Request req = appGlobal.getPublicRequest();
request = {
"AppointmentNumber": appoNo,
"ClinicID": clinicID,
"ProjectID": projectID,
"ConfirmationBy": 102,
"VersionID": req.VersionID,
"Channel": req.Channel,
"LanguageID": languageID == 'ar' ? 1 : 2,
"IPAdress": req.IPAdress,
"generalid": req.generalid,
"PatientOutSA": 0,
"SessionID": "YckwoXhUmWBsnHKEKig",
"isDentalAllowedBackend": false,
"DeviceTypeID": 1,
"PatientID": 1231755,
"TokenID": "@dm!n",
"PatientTypeID": 1,
"PatientType": 1
};
dynamic localRes;
await baseAppClient.post(CONFIRM_APPOINTMENT,
onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
}

@ -155,10 +155,46 @@ class TranslationBase {
String get gregorianDate =>
localizedValues['gregorian-date'][locale.languageCode];
String get searchMedicine =>
localizedValues['searchMedicine'][locale.languageCode];
String get searchMedicineHere =>
localizedValues['searchMedicineHere'][locale.languageCode];
String get pendingPayment =>
localizedValues['pendingPayment'][locale.languageCode];
String get payNow => localizedValues['payNow'][locale.languageCode];
String get viewQR => localizedValues['viewQR'][locale.languageCode];
String get instruction => localizedValues['instruction'][locale.languageCode];
String get livecare => localizedValues['livecare'][locale.languageCode];
String get upcomingNoAction =>
localizedValues['upcoming-noAction'][locale.languageCode];
String get upcomingConfirm =>
localizedValues['upcoming-confirm'][locale.languageCode];
String get upcomingPaymentPending =>
localizedValues['upcoming-payment-pending'][locale.languageCode];
String get upcomingPaymentNow =>
localizedValues['upcoming-payment-now'][locale.languageCode];
String get upcomingQR => localizedValues['upcoming-QR'][locale.languageCode];
String get upcomingVirtual =>
localizedValues['upcoming-virtual'][locale.languageCode];
String get upcomingLivecare =>
localizedValues['upcoming-livecare'][locale.languageCode];
String get upcomingDetails =>
localizedValues['upcoming-details'][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -97,7 +97,7 @@ class _BottomNavBarState extends State<BottomNavBar> {
changeIndex: _changeIndex,
index: _index,
currentIndex: 3,
name: TranslationBase.of(context).services,
name: TranslationBase.of(context).todoList,
)
],
),

@ -1,4 +1,3 @@
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

Loading…
Cancel
Save