diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 79bc3dc4..1a3d4cfe 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -10,6 +10,7 @@ + diff --git a/assets/images/new-design/video.png b/assets/images/new-design/video.png new file mode 100644 index 00000000..2962aade Binary files /dev/null and b/assets/images/new-design/video.png differ diff --git a/assets/images/new-design/view_more.png b/assets/images/new-design/view_more.png new file mode 100644 index 00000000..8b52a7e7 Binary files /dev/null and b/assets/images/new-design/view_more.png differ diff --git a/assets/images/new-design/walkin.png b/assets/images/new-design/walkin.png new file mode 100644 index 00000000..248c8788 Binary files /dev/null and b/assets/images/new-design/walkin.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index 1a34e96d..66655e83 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -231,6 +231,8 @@ const SEND_LIVECARE_INVOICE_EMAIL = 'Services/Notifications.svc/REST/SendInvoice const GET_USER_TERMS = 'Services/Patients.svc/REST/GetUserTermsAndConditions'; const UPDATE_HEALTH_TERMS = 'services/Patients.svc/REST/UpdatePateintHealthSummaryReport'; +const GET_PATIENT_HEALTH_STATS = 'Services/Patients.svc/REST/Med_GetTransactionsSts'; + //URL to get medicine and pharmacies list const CHANNEL = 3; const GENERAL_ID = 'Cs2020@2016\$2958'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index ee1dd7a7..f57e01f1 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1625,5 +1625,13 @@ const Map localizedValues = { "en": "To view the terms and conditions", "ar": "لعرض الشروط والأحكام" }, + "WalkinAppo": { + "en": "Hospital Visit Appointment", + "ar": "موعد زيارة للمستشفى" + }, + "videoAppo": { + "en": "Video Call Appointment", + "ar": "موعد اتصال فيديو" + }, // "visit": {"en" : "Visit", "ar": "الزيارة"}, }; diff --git a/lib/models/SmartWatch/HealthData.dart b/lib/models/SmartWatch/HealthData.dart new file mode 100644 index 00000000..f01c3bf8 --- /dev/null +++ b/lib/models/SmartWatch/HealthData.dart @@ -0,0 +1,8 @@ +class healthData { + int MedCategoryID; + int MedSubCategoryID; + String Value; + String Notes; + String MachineDate; + int TransactionsListID; +} diff --git a/lib/models/SmartWatch/YearlyStepsResModel.dart b/lib/models/SmartWatch/YearlyStepsResModel.dart new file mode 100644 index 00000000..728633d9 --- /dev/null +++ b/lib/models/SmartWatch/YearlyStepsResModel.dart @@ -0,0 +1,36 @@ +class YearlyStepsResModel { + double valueSum; + int medCategoryID; + int month; + String monthName; + int patientID; + int year; + + YearlyStepsResModel( + {this.valueSum, + this.medCategoryID, + this.month, + this.monthName, + this.patientID, + this.year}); + + YearlyStepsResModel.fromJson(Map json) { + valueSum = json['ValueSum']; + medCategoryID = json['MedCategoryID']; + month = json['Month']; + monthName = json['MonthName']; + patientID = json['PatientID']; + year = json['Year']; + } + + Map toJson() { + final Map data = new Map(); + data['ValueSum'] = this.valueSum; + data['MedCategoryID'] = this.medCategoryID; + data['Month'] = this.month; + data['MonthName'] = this.monthName; + data['PatientID'] = this.patientID; + data['Year'] = this.year; + return data; + } +} diff --git a/lib/pages/Blood/confirm_payment_page.dart b/lib/pages/Blood/confirm_payment_page.dart index 75282190..c384b7b5 100644 --- a/lib/pages/Blood/confirm_payment_page.dart +++ b/lib/pages/Blood/confirm_payment_page.dart @@ -2,7 +2,6 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; -import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; @@ -166,7 +165,7 @@ class ConfirmPaymentPage extends StatelessWidget { patientID: int.parse(advanceModel.fileNumber), projectID: advanceModel.hospitalsModel.iD) .then((value) { - GifLoaderDialogUtils.hideDialog(context); + GifLoaderDialogUtils.hideDialog(context); if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) showSMSDialog(); }); @@ -218,7 +217,8 @@ class ConfirmPaymentPage extends StatelessWidget { authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, - browser); + browser, + false); } onBrowserLoadStart(String url) { @@ -277,8 +277,8 @@ class ConfirmPaymentPage extends StatelessWidget { String paymentReference = res['Fort_id'].toString(); GifLoaderDialogUtils.showMyDialog(AppGlobal.context); service - .createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], - res['PaymentMethod'], AppGlobal.context) + .createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], + res['Fort_id'], res['PaymentMethod'], AppGlobal.context) .then((res) { GifLoaderDialogUtils.hideDialog(AppGlobal.context); print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); @@ -315,5 +315,4 @@ class ConfirmPaymentPage extends StatelessWidget { Future navigateToHome(context) async { Navigator.of(context).pushNamed(HOME); } - } diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index d7e08a66..03a28d90 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -187,27 +187,29 @@ class _BookConfirmState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0), - child: Image.asset( - "assets/images/new-design/icon_hospital.png"), - ), - Container( - margin: EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0), - child: Text( - TranslationBase.of(context).hospital + - ": " + - widget.doctor.projectName, - style: TextStyle( - fontSize: 14.0, - color: Colors.grey[700], - letterSpacing: 1.0)), - ), - ], - ), + !widget.isLiveCareAppointment ? Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + margin: + EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0), + child: Image.asset( + "assets/images/new-design/icon_hospital.png"), + ), + Container( + margin: + EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0), + child: Text( + TranslationBase.of(context).hospital + + ": " + + widget.doctor.projectName, + style: TextStyle( + fontSize: 14.0, + color: Colors.grey[700], + letterSpacing: 1.0)), + ), + ], + ) : Container(), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ @@ -325,7 +327,8 @@ class _BookConfirmState extends State { Container( margin: EdgeInsets.only(top: 5.0), child: Text( - TranslationBase.of(context).gender + ": " + + TranslationBase.of(context).gender + + ": " + widget.authUser.genderDescription, style: TextStyle( fontSize: 12.0, @@ -335,7 +338,9 @@ class _BookConfirmState extends State { Container( margin: EdgeInsets.only(top: 5.0, bottom: 3.0), child: Text( - TranslationBase.of(context).age + ": " + widget.authUser.age.toString(), + TranslationBase.of(context).age + + ": " + + widget.authUser.age.toString(), style: TextStyle( fontSize: 12.0, color: Colors.grey[600], @@ -423,7 +428,8 @@ class _BookConfirmState extends State { context) .then((res) { if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); + AppToast.showSuccessToast( + message: TranslationBase.of(context).bookedSuccess); print(res['AppointmentNo']); Future.delayed(new Duration(milliseconds: 500), () { @@ -543,13 +549,13 @@ class _BookConfirmState extends State { getLiveCareAppointmentPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { - GifLoaderDialogUtils.hideDialog(context); widget.service .getLiveCareAppointmentPatientShare( appointmentNo, clinicID, projectID, context) .then((res) { print(res); widget.patientShareResponse = new PatientShareResponse.fromJson(res); + GifLoaderDialogUtils.hideDialog(context); navigateToBookSuccess(context, docObject, widget.patientShareResponse); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index f513c434..bd6c242c 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -255,7 +255,7 @@ class _BookSuccessState extends State { minWidth: MediaQuery.of(context).size.width * 0.7, height: 45.0, child: RaisedButton( - color: new Color(0xFF40ACC9), + color: new Color(0xffc5272d), textColor: Colors.white, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), @@ -318,7 +318,7 @@ class _BookSuccessState extends State { minWidth: MediaQuery.of(context).size.width * 0.7, height: 45.0, child: RaisedButton( - color: new Color(0xFF40ACC9), + color: new Color(0xFFc5272d), textColor: Colors.white, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), @@ -637,7 +637,12 @@ class _BookSuccessState extends State { authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, - widget.browser); + widget.browser, + widget.patientShareResponse.isLiveCareAppointment, + widget.patientShareResponse.appointmentDate, + widget.patientShareResponse.appointmentNo, + widget.patientShareResponse.clinicID, + widget.patientShareResponse.doctorID); } } diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index d419e4af..1562c5f7 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -61,7 +61,7 @@ class DoctorView extends StatelessWidget { letterSpacing: 1.0)), Container( margin: EdgeInsets.only(top: 3.0), - child: Text(this.doctor.clinicName, + child: Text(this.doctor.clinicName != null ? this.doctor.clinicName : "", style: TextStyle( fontSize: 12.0, color: Colors.grey[600], diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index 3e58b657..f21a9718 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.da 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/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -469,9 +470,7 @@ class _CovidTimeSlotsState extends State } bookCovidTestAppointment() { -// Navigator.push(context, -// MaterialPageRoute(builder: (context) => CovidPaymentAlert())); - + GifLoaderDialogUtils.showMyDialog(context); DoctorList docObject = new DoctorList(); docObject.doctorID = widget.selectedDoctorID; docObject.clinicID = widget.selectedClinicID; @@ -494,11 +493,12 @@ class _CovidTimeSlotsState extends State print(res); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: "Appointment Booked Successfully"); - Future.delayed(new Duration(milliseconds: 1800), () { - getPatientShare(context, res['AppointmentNo'], docObject.clinicID, - docObject.projectID, docObject); - }); + // Future.delayed(new Duration(milliseconds: 1800), () { + getPatientShare(context, res['AppointmentNo'], docObject.clinicID, + docObject.projectID, docObject); + // }); } else { + GifLoaderDialogUtils.hideDialog(context); appo = new AppoitmentAllHistoryResultList(); appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo']; appo.clinicID = res['SameClinicApptList'][0]['DoctorID']; @@ -529,14 +529,16 @@ class _CovidTimeSlotsState extends State cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); ConfirmDialog.closeAlertDialog(context); DoctorsListService service = new DoctorsListService(); service.cancelAppointment(appo, context).then((res) { if (res['MessageStatus'] == 1) { - Future.delayed(new Duration(milliseconds: 1500), () { - insertAppointmentCovidTest(context, docObject); - }); + // Future.delayed(new Duration(milliseconds: 1500), () { + insertAppointmentCovidTest(context, docObject); + // }); } else { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { @@ -592,6 +594,7 @@ class _CovidTimeSlotsState extends State }); } else {} } else { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { diff --git a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart index c4299e33..0d3ac2e5 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart @@ -166,7 +166,7 @@ class _ApointmentCardState extends State { ), Container( transform: - Matrix4.translationValues(15.0, -40.0, 0.0), + Matrix4.translationValues(15.0, -40.0, 0.0), child: projectViewModel.isArabic ? Image.asset( "assets/images/new-design/arrow_menu_black-ar.png", diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 1066ca15..383bedb3 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -13,7 +13,6 @@ import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/widgets/paymentDialog.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; -import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -26,7 +25,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_countdown_timer/countdown_timer_controller.dart'; import 'package:flutter_countdown_timer/current_remaining_time.dart'; import 'package:flutter_countdown_timer/flutter_countdown_timer.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; @@ -95,249 +93,315 @@ class _ToDoState extends State { 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: [ - Row( - children: [ - Image.asset( - "assets/images/new-design/time_icon.png", - width: 20.0, - height: 20.0), - Container( - margin: - EdgeInsets.only(left: 10.0, right: 10.0), - child: Text( - DateUtil.getWeekDayMonthDayYearDateFormatted( - DateUtil.convertStringToDate( - widget.appoList[index] - .appointmentDate), - projectViewModel.isArabic - ? "ar" - : "en") + - " " + - widget.appoList[index].startTime - .substring(0, 5), - style: TextStyle(fontSize: 10.0)), - ), - widget.appoList[index].isLiveCareAppointment - ? SvgPicture.asset( - "assets/images/new-design/liveCare_logo_icon.svg", - width: 20.0, - height: 20.0) - : Image.asset( - "assets/images/new-design/hospital_address_icon.png", - width: 20.0, - height: 20.0), - Container( - margin: - EdgeInsets.only(left: 5.0, right: 5.0), - child: widget - .appoList[index].isLiveCareAppointment - ? Text( - TranslationBase.of(context) - .liveCareAppo, - style: TextStyle(fontSize: 12.0)) - : Text( - widget.appoList[index].projectName != - null - ? widget - .appoList[index].projectName - : "-", - overflow: TextOverflow.clip, - maxLines: 2, - style: TextStyle(fontSize: 10.0)), - ), - ], - ), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Divider( - color: Colors.grey[500], - ), + child: Column( + children: [ + Container( + child: Card( + margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - height: MediaQuery.of(context).size.height * - 0.1, + child: Container( + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Row( + children: [ + Image.asset( + "assets/images/new-design/time_icon.png", + width: 20.0, + height: 20.0), + Container( + margin: EdgeInsets.only( + left: 10.0, right: 10.0), + child: Text( + DateUtil.getWeekDayMonthDayYearDateFormatted( + DateUtil.convertStringToDate( + widget.appoList[index] + .appointmentDate), + projectViewModel.isArabic + ? "ar" + : "en") + + " " + + widget.appoList[index].startTime + .substring(0, 5), + style: TextStyle(fontSize: 10.0)), + ), + !widget.appoList[index] + .isLiveCareAppointment + ? Image.asset( + "assets/images/new-design/hospital_address_icon.png", + width: 20.0, + height: 20.0) + : Container(), + Container( + margin: EdgeInsets.only( + left: 5.0, right: 5.0), + child: widget.appoList[index] + .isLiveCareAppointment + ? Container() + : Text( + widget.appoList[index] + .projectName != + null + ? widget.appoList[index] + .projectName + : "-", + overflow: TextOverflow.clip, + maxLines: 2, + style: + TextStyle(fontSize: 10.0)), + ), + ], + ), + Container( margin: EdgeInsets.only(top: 5.0), - child: ClipRRect( - borderRadius: - BorderRadius.circular(100.0), - child: Image.network( - widget.appoList[index].doctorImageURL, - fit: BoxFit.fill), + child: Divider( + color: Colors.grey[500], ), ), - ), - Expanded( - flex: 3, - child: Container( - margin: EdgeInsets.only( - top: 10.0, left: 20.0, right: 20.0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - widget.appoList[index].doctorTitle + - " " + + Flex( + direction: Axis.horizontal, + children: [ + 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] - .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)), + .doctorImageURL, + fit: BoxFit.fill), + ), ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, - children: [ - 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: 3, + child: Container( + margin: EdgeInsets.only( + top: 10.0, + left: 20.0, + right: 20.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + 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: [ + 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, + ), + ], + ), + Container( + child: CountdownTimer( + controller: new CountdownTimerController( + endTime: DateTime.now() + .millisecondsSinceEpoch + + (widget + .appoList[ + index] + .remaniningHoursTocanPay * + 1000) * + 60), + widgetBuilder: (_, + CurrentRemainingTime + time) { + return time != null + ? Text( + '${time.days != null ? time.days : "0"}:${time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours}:${time.min}:${time.sec} ' + + TranslationBase.of( + context) + .upcomingTimeLeft, + style: TextStyle( + fontSize: 12.0, + color: Color( + 0xff40ACC9))) + : Container(); + }, + ), + ), + ], + ), ), - Container( - child: CountdownTimer( - controller: new CountdownTimerController( - endTime: DateTime.now() - .millisecondsSinceEpoch + - (widget.appoList[index] - .remaniningHoursTocanPay * - 1000) * - 60), - widgetBuilder: - (_, CurrentRemainingTime time) { - return time != null - ? Text( - '${time.days}:${time.hours}:${time.min}:${time.sec} ' + - TranslationBase.of( - context) - .upcomingTimeLeft, + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () => performNextAction( + widget.appoList[index]), + child: Container( + margin: EdgeInsets.only(top: 20.0), + child: Column( + children: [ + 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, - color: Color( - 0xff40ACC9))) - : Container(); - }, + fontSize: 12.0)), + ) + ], + ), ), ), - ], - ), + ) + ], ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => performNextAction( - widget.appoList[index]), - child: Container( - margin: EdgeInsets.only(top: 20.0), - child: Column( - children: [ - Image.asset( - getNextActionImage(widget + Divider( + color: Colors.grey[500], + ), + Flex( + direction: Axis.horizontal, + children: [ + Expanded( + flex: 2, + child: Container( + child: Text( + getNextActionDescription(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)), - ) - ], + 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: + new Color(0xFF40ACC9), + decoration: TextDecoration + .underline)), + ), + ), + ) + ], ), - ) - ], - ), - Divider( - color: Colors.grey[500], + ], + ), ), - Flex( - direction: Axis.horizontal, - children: [ - 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: new Color(0xFF40ACC9), - decoration: - TextDecoration.underline)), + ), + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(10.0), + bottomRight: Radius.circular(10.0)), + color: Color(0xff20bc44), + ), + height: 30.0, + margin: projectViewModel.isArabic ? EdgeInsets.fromLTRB(160.0, 0.0, 30.0, 0.0) : EdgeInsets.fromLTRB(30.0, 0.0, 160.0, 0.0), + transform: Matrix4.translationValues(0.0, -8.0, 0.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + widget.appoList[index].isLiveCareAppointment + ? Container( + margin: EdgeInsets.fromLTRB( + 5.0, 0.0, 5.0, 0.0), + child: Image.asset( + "assets/images/new-design/video.png"), + ) + : Container( + margin: EdgeInsets.fromLTRB( + 5.0, 0.0, 5.0, 0.0), + child: Image.asset( + "assets/images/new-design/walkin.png"), ), - ), - ) - ], - ), - ], + widget.appoList[index].isLiveCareAppointment + ? Container( + child: Text(TranslationBase.of(context).videoAppo, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12.0)), + ) + : Container( + child: Text(TranslationBase.of(context).walkinAppo, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12.0)), + ) + ], + ), ), - ), + ], ), ); }, @@ -567,12 +631,34 @@ class _ToDoState extends State { } getPatientShare(context, AppoitmentAllHistoryResultList appo) { - GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); + if (appo.isLiveCareAppointment) { + getLiveCareAppointmentPatientShare(context, service, appo); + } else { + GifLoaderDialogUtils.showMyDialog(context); + service + .getPatientShare(appo.appointmentNo.toString(), appo.clinicID, + appo.projectID, context) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + widget.patientShareResponse = new PatientShareResponse.fromJson(res); + openPaymentDialog(appo, widget.patientShareResponse); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + } + + getLiveCareAppointmentPatientShare(context, DoctorsListService service, + AppoitmentAllHistoryResultList appo) { + GifLoaderDialogUtils.showMyDialog(context); service - .getPatientShare(appo.appointmentNo.toString(), appo.clinicID, - appo.projectID, context) + .getLiveCareAppointmentPatientShare(appo.appointmentNo.toString(), + appo.clinicID, appo.projectID, context) .then((res) { + print(res); GifLoaderDialogUtils.hideDialog(context); widget.patientShareResponse = new PatientShareResponse.fromJson(res); openPaymentDialog(appo, widget.patientShareResponse); @@ -674,7 +760,12 @@ class _ToDoState extends State { authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, - widget.browser); + widget.browser, + appo.isLiveCareAppointment, + appo.appointmentDate, + appo.appointmentNo, + appo.clinicID, + appo.doctorID); } onBrowserLoadStart(String url) { diff --git a/lib/pages/ToDoList/widgets/upcomingCard.dart b/lib/pages/ToDoList/widgets/upcomingCard.dart index 04930e59..3fefe616 100644 --- a/lib/pages/ToDoList/widgets/upcomingCard.dart +++ b/lib/pages/ToDoList/widgets/upcomingCard.dart @@ -197,7 +197,7 @@ class _TodoListCardState extends State { ), ) ], - ) + ), ], ), ), diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index eabff77a..01a50fda 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -326,6 +326,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { Permission.notification, Permission.accessMediaLocation, Permission.calendar, + Permission.activityRecognition ].request(); var permissionsGranted = await deviceCalendarPlugin.hasPermissions(); diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart index fc5c4eab..1974753f 100644 --- a/lib/pages/livecare/livecare_home.dart +++ b/lib/pages/livecare/livecare_home.dart @@ -49,6 +49,7 @@ class _LiveCareHomeState extends State child: Column(children: [ /// this is will not colored with theme data TabBar( + labelColor: Colors.black, tabs: [ Tab(text: TranslationBase.of(context).consultation), Tab(text: TranslationBase.of(context).logs), diff --git a/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart b/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart index 4309cc62..19144263 100644 --- a/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart +++ b/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart @@ -21,7 +21,7 @@ class _ScheduleClinicCardState extends State { return Container( child: Card( margin: EdgeInsets.fromLTRB(15.0, 10.0, 15.0, 8.0), - color: widget.isSelected ? Colors.blue : Colors.white, + color: widget.isSelected ? Color(0xff06b806) : Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), @@ -35,8 +35,8 @@ class _ScheduleClinicCardState extends State { Container( child: Text( widget.languageID == 'ar' - ? widget.clinicsHaveScheduleList.clinicDescN - : widget.clinicsHaveScheduleList.clinicDesc, + ? widget.clinicsHaveScheduleList.clinicDescN != null ? widget.clinicsHaveScheduleList.clinicDescN: "" + : widget.clinicsHaveScheduleList.clinicDesc != null ? widget.clinicsHaveScheduleList.clinicDesc: "Dermatology", style: TextStyle( fontSize: 16.0, color: diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index 25ec8514..15c14557 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -42,10 +42,11 @@ class _LiveCareHistoryCardState extends State { ), child: Container( width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height * 0.22, + // height: MediaQuery.of(context).size.height * 0.22, padding: EdgeInsets.all(10.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ Text("Requested date:", style: diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index fc27d92b..195d8879 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -283,7 +283,8 @@ class _clinic_listState extends State { authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, - browser); + browser, + false); } onBrowserLoadStart(String url) { diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 8a69bf5d..eecb6abd 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -225,7 +225,8 @@ class ConfirmPaymentPage extends StatelessWidget { advanceModel.patientName, advanceModel.fileNumber, authenticatedUser, - browser); + browser, + false); } onBrowserLoadStart(String url) { diff --git a/lib/pages/medical/smart_watch_health_data/stepsTracker.dart b/lib/pages/medical/smart_watch_health_data/stepsTracker.dart new file mode 100644 index 00000000..467242e8 --- /dev/null +++ b/lib/pages/medical/smart_watch_health_data/stepsTracker.dart @@ -0,0 +1,248 @@ +import 'package:charts_flutter/flutter.dart' as charts; +import 'package:diplomaticquarterapp/models/SmartWatch/YearlyStepsResModel.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class StepsTracker extends StatefulWidget { + @override + _StepsTrackerState createState() => _StepsTrackerState(); +} + +class _StepsTrackerState extends State + with SingleTickerProviderStateMixin { + TabController _tabController; + + int weeklyStatsAvgValue = 0; + int monthlyStatsAvgValue = 0; + int yearlyStatsAvgValue = 0; + + int avgStepsValue = 0; + int dataLength = 0; + + List yearlyStepsList = List(); + + List yearlyTimeSeriesData = []; + + bool isDataLoaded = false; + + @override + void initState() { + _tabController = new TabController(length: 3, vsync: this); + WidgetsBinding.instance.addPostFrameCallback((_) { + getYearlyStepsData(); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarTitle: "Steps", + isShowDecPage: false, + body: Container( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TabBar( + tabs: [ + Tab(text: TranslationBase.of(context).weekly), + Tab(text: TranslationBase.of(context).monthly), + Tab(text: TranslationBase.of(context).yearly), + ], + controller: _tabController, + ), + Expanded( + child: new TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + isDataLoaded ? getWeeklyStepsDetails() : Container(), + isDataLoaded ? getMonthlyStepsDetails() : Container(), + isDataLoaded ? getYearlyStepsDetails() : Container() + ], + controller: _tabController, + ), + ), + ], + ), + ), + ); + } + + getYearlyStepsData() { + avgStepsValue = 0; + dataLength = 0; + + DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getPatientHealthDataStats(6, 3, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res['Med_GetYearStepsTransactionsStsList']); + yearlyStepsList.clear(); + res['Med_GetYearStepsTransactionsStsList'].forEach((element) { + yearlyStepsList.add(new YearlyStepsResModel.fromJson(element)); + if (element['ValueSum'] != null) { + double value = element['ValueSum']; + avgStepsValue += value.toInt(); + dataLength++; + } + }); + + print(avgStepsValue); + print(dataLength); + setState(() { + yearlyStatsAvgValue = avgStepsValue ~/ dataLength; + isDataLoaded = true; + }); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + // AppToast.showErrorToast(message: err); + print(err); + }); + } + + generateData() { + if (yearlyStepsList.length > 0) { + yearlyTimeSeriesData.clear(); + yearlyStepsList.forEach( + (element) { + yearlyTimeSeriesData.add( + TimeSeriesSales( + new DateTime(element.year, element.month, 1), + element.valueSum != null ? element.valueSum.toInt() : 0, + ), + ); + }, + ); + yearlyTimeSeriesData.forEach((element) { + print(element.sales); + print(element.time); + }); + } + return [ + new charts.Series( + id: 'Sales', + colorFn: (_, __) => charts.MaterialPalette.red.shadeDefault, + domainFn: (TimeSeriesSales sales, _) => sales.time, + measureFn: (TimeSeriesSales sales, _) => sales.sales, + data: yearlyTimeSeriesData, + ) + ]; + } + + getWeeklyStepsDetails() { + return Container( + child: Text("Weekly"), + ); + } + + getMonthlyStepsDetails() { + return Container( + child: Text("Monthly"), + ); + } + + getYearlyStepsDetails() { + return Container( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: AppTimeSeriesChart( + seriesList: generateData(), + chartName: "Steps", + startDate: DateTime( + yearlyStepsList[0].year, yearlyStepsList[0].month, 1), + endDate: DateTime( + yearlyStepsList[yearlyStepsList.length - 1].year, + yearlyStepsList[yearlyStepsList.length - 1].month, + 1), + ), + ), + Container( + margin: EdgeInsets.only(top: 5.0), + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide(color: Colors.grey[400], width: 0.6)), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 15.0), + child: + Text("Average Steps", style: TextStyle(fontSize: 18.0)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Text(yearlyStatsAvgValue.toString() + " Steps", + style: TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ], + ), + ), + ), + Container( + margin: EdgeInsets.all(10.0), + child: Divider( + color: Colors.grey[500], + ), + ), + Container( + transform: Matrix4.translationValues(0.0, -10.0, 0.0), + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text("History", style: TextStyle(fontSize: 14.0)), + Row( + children: [ + Text("view more", style: TextStyle(fontSize: 14.0)), + Container( + margin: EdgeInsets.only(left: 3.0, right: 3.0), + transform: Matrix4.translationValues(0.0, 1.5, 0.0), + width: 30.0, + height: 30.0, + child: Image.asset( + "assets/images/new-design/view_more.png", + fit: BoxFit.contain), + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 5.0), + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide(color: Colors.grey[400], width: 0.6)), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.fromLTRB(30.0, 15.0, 30.0, 15.0), + child: Text("Date", + style: TextStyle( + fontSize: 18.0, fontWeight: FontWeight.bold)), + ), + Container( + padding: EdgeInsets.fromLTRB(30.0, 0.0, 30.0, 0.0), + child: Text("Steps", style: TextStyle(fontSize: 18.0)), + ), + ], + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index d26c74ad..72f18979 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -41,7 +41,8 @@ class DoctorsListService extends BaseService { long = await this.sharedPref.getDouble(USER_LONG); } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -105,7 +106,8 @@ class DoctorsListService extends BaseService { long = await this.sharedPref.getDouble(USER_LONG); } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -145,7 +147,8 @@ class DoctorsListService extends BaseService { Future getDoctorsProfile( int docID, int clinicID, int projectID, context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -177,10 +180,10 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorsRating( - int docID, context) async { + Future getDoctorsRating(int docID, context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -203,17 +206,17 @@ class DoctorsListService extends BaseService { await baseAppClient.post(GET_DOCTOR_RATING_NOTES, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } - Future getDoctorsRatingDetails( - int docID, context) async { + Future getDoctorsRatingDetails(int docID, context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "LanguageID": languageID == 'ar' ? 1 : 2, @@ -236,17 +239,18 @@ class DoctorsListService extends BaseService { await baseAppClient.post(GET_DOCTOR_RATING_DETAILS, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } Future getDoctorFreeSlots( int docID, int clinicID, int projectID, BuildContext context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "DoctorID": docID, @@ -281,7 +285,8 @@ class DoctorsListService extends BaseService { Future getDoctorScheduledFreeSlots(int docID, int clinicID, int projectID, int serviceID, BuildContext context) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "DoctorID": docID, @@ -324,7 +329,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsForLiveCare": false, @@ -383,7 +389,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsForLiveCare": true, @@ -437,7 +444,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -481,7 +489,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -526,7 +535,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -560,7 +570,8 @@ class DoctorsListService extends BaseService { Future getPatientAppointmentCurfewHistory( bool isActiveAppointment) async { Map request; - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -601,7 +612,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -654,7 +666,8 @@ class DoctorsListService extends BaseService { long = await this.sharedPref.getDouble(USER_LONG); } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -701,7 +714,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -751,7 +765,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -802,7 +817,8 @@ class DoctorsListService extends BaseService { authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -847,7 +863,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "ClientRequestID": transactionID, @@ -886,7 +903,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "AdvanceNumber": advanceNumber, @@ -923,7 +941,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "IsForAskYourDoctor": true, @@ -963,7 +982,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "VersionID": req.VersionID, @@ -999,7 +1019,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -1058,7 +1079,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "AppointmentNo": appoNo, @@ -1133,7 +1155,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "AppointmentNo": appo.appointmentNo, @@ -1174,7 +1197,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "AppointmentDate": appoDate, @@ -1223,7 +1247,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { "ProjectID": projectID, @@ -1282,7 +1307,8 @@ class DoctorsListService extends BaseService { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageID = + await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); Request req = appGlobal.getPublicRequest(); request = { @@ -1320,4 +1346,42 @@ class DoctorsListService extends BaseService { }, body: request); return Future.value(localRes); } + + Future getPatientHealthDataStats( + int medCategoryId, int medCategoryStsId, BuildContext context) async { + Map 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.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); + request = { + "MedCategoryID": medCategoryId, + "MedGetStsID": medCategoryStsId, + "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_HEALTH_STATS, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 9f7b09cf..4a43f32c 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1375,6 +1375,9 @@ class TranslationBase { localizedValues["bloodD-enter-desc"][locale.languageCode]; String get viewTermsConditions => localizedValues["viewTermsConditions"][locale.languageCode]; + String get walkinAppo => localizedValues["WalkinAppo"][locale.languageCode]; + String get videoAppo => localizedValues["videoAppo"][locale.languageCode]; + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index c46b5616..ba7dfd8b 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -1,8 +1,6 @@ import 'dart:convert'; -import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; @@ -13,14 +11,14 @@ class MyInAppBrowser extends InAppBrowser { // static String SERVICE_URL = // 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = - 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + static String SERVICE_URL = + 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE // static String PREAUTH_SERVICE_URL = // 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT - static String PREAUTH_SERVICE_URL = - 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store + static String PREAUTH_SERVICE_URL = + 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store static List successURLS = [ 'success', @@ -42,6 +40,9 @@ class MyInAppBrowser extends InAppBrowser { String deviceToken; + double lat = 0.0; + double long = 0.0; + static bool isPaymentDone = false; MyInAppBrowser({this.onExitCallback, this.appo, this.onLoadStartCallback}); @@ -98,6 +99,11 @@ class MyInAppBrowser extends InAppBrowser { await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } + if (await this.sharedPref.getDouble(USER_LAT) != null && + await this.sharedPref.getDouble(USER_LONG) != null) { + lat = await this.sharedPref.getDouble(USER_LAT); + long = await this.sharedPref.getDouble(USER_LONG); + } } openPaymentBrowser( @@ -111,12 +117,33 @@ class MyInAppBrowser extends InAppBrowser { String patientName, dynamic patientID, AuthenticatedUser authenticatedUser, - InAppBrowser browser) { - getDeviceToken(); + InAppBrowser browser, + bool isLiveCareAppo, + [var appoDate, + var appoNo, + var clinicID, + var doctorID]) { this.browser = browser; - this.browser.openUrl( - url: generateURL(amount, orderDesc, transactionID, projId, emailId, - paymentMethod, patientType, patientName, patientID, authenticatedUser)); + getPatientData(); + generateURL( + amount, + orderDesc, + transactionID, + projId, + emailId, + paymentMethod, + patientType, + patientName, + patientID, + authenticatedUser, + isLiveCareAppo, + appoDate, + appoNo, + clinicID, + doctorID) + .then((value) { + this.browser.openUrl(url: value); + }); } openBrowser(String url) { @@ -124,7 +151,7 @@ class MyInAppBrowser extends InAppBrowser { this.browser.openUrl(url: url); } - String generateURL( + Future generateURL( double amount, String orderDesc, String transactionID, @@ -135,18 +162,19 @@ class MyInAppBrowser extends InAppBrowser { String patientName, dynamic patientID, AuthenticatedUser authUser, - [var patientData, + bool isLiveCareAppo, + [var appoDate, + var appoNo, + var clinicID, + var doctorID, + var patientData, var servID, - var LiveServID]) { - getPatientData(); + var LiveServID]) async { + getDeviceToken(); String currentLanguageID = getLanguageID() == 'ar' ? 'AR' : 'EN'; - String form = getForm(); + String form = isLiveCareAppo ? getLiveCareForm() : getForm(); - // if (authUser != null) { - // form = form.replaceFirst("EMAIL_VALUE", authUser.emailAddress); - // } else { - form = form.replaceFirst("EMAIL_VALUE", emailId); - // } + form = form.replaceFirst("EMAIL_VALUE", emailId); form = form.replaceFirst('AMOUNT_VALUE', amount.toString()); form = form.replaceFirst('ORDER_DESCRIPTION_VALUE', orderDesc); @@ -157,12 +185,13 @@ class MyInAppBrowser extends InAppBrowser { form = form.replaceFirst('LANG_VALUE', currentLanguageID); form = form.replaceFirst('PATIENT_OUT_SA', authUser.outSA == 0 ? false.toString() : true.toString()); - form = form.replaceFirst('PATIENT_TYPE_ID', - patientData == null ? patientType.toString() : "1"); + form = form.replaceFirst( + 'PATIENT_TYPE_ID', patientData == null ? patientType.toString() : "1"); -// form = form.replaceFirst('DEVICE_TOKEN', this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false) + "," + this.cs.sharedService.getSharedData(AuthenticationService.APNS_TOKEN, false)); -// form = form.replaceFirst('LATITUDE_VALUE', this.cs.sharedService.getSharedData('userLat', false)); -// form = form.replaceFirst('LONGITUDE_VALUE', this.cs.sharedService.getSharedData('userLong', false)); + form = form.replaceFirst( + 'DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); + form = form.replaceFirst('LATITUDE_VALUE', this.lat.toString()); + form = form.replaceFirst('LONGITUDE_VALUE', this.long.toString()); if (servID == "4") form = form.replaceFirst( @@ -178,17 +207,16 @@ class MyInAppBrowser extends InAppBrowser { form = form.replaceFirst('LIVE_SERVICE_ID', "2"); } - // if (patientData == null) { - form = form.replaceFirst('CUSTNAME_VALUE', patientName); - form = form.replaceFirst('CUSTID_VALUE', patientID.toString()); - // } else { - // form = form.replaceFirst('CUSTNAME_VALUE', patientData.depositorName); - // form = form.replaceFirst('CUSTID_VALUE', patientData.fileNumber); - // } + form = form.replaceFirst('CUSTNAME_VALUE', patientName); + form = form.replaceFirst('CUSTID_VALUE', patientID.toString()); - form = form.replaceFirst('LATITUDE_VALUE', "24.708488"); - form = form.replaceFirst('LONGITUDE_VALUE', "46.665925"); - form = form.replaceFirst('DEVICE_TOKEN', DEVICE_TOKEN); + if (isLiveCareAppo) { + form = form.replaceFirst('IS_SCHEDULE_VALUE', "true"); + form = form.replaceFirst('APPOINTMENT_DATE_VALUE', appoDate); + form = form.replaceFirst('APPOINTMENT_NO_VALUE', appoNo.toString()); + form = form.replaceFirst('DOCTOR_ID_VALUE', doctorID.toString()); + form = form.replaceFirst('CLINIC_ID_VALUE', clinicID.toString()); + } var bytes = utf8.encode(form); var base64Str = base64.encode(bytes); @@ -228,6 +256,42 @@ class MyInAppBrowser extends InAppBrowser { '' + ''; } + + String getLiveCareForm() { + return ' ' + + '' + + '' + + '
' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
' + + '' + + '' + + ''; + } } class MyChromeSafariBrowser extends ChromeSafariBrowser {