diff --git a/lib/config/config.dart b/lib/config/config.dart index b73b0c16..0ad2285e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,9 +21,9 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:4422/'; -// var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; - var BASE_URL = 'http://10.20.200.111:1010/'; +// var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -344,7 +344,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnari var CHANNEL = 3; var GENERAL_ID = 'Cs2020@2016\$2958'; var IP_ADDRESS = '10.20.10.20'; -var VERSION_ID = 12.5; +var VERSION_ID = 12.6; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index ac1eb6f8..1c4c111b 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -100,6 +100,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { _tabController = TabController(length: 2, vsync: this); WidgetsBinding.instance.addPostFrameCallback((_) { getPatientAppointmentHistory(); + getAncillaryOrders(); }); super.initState(); imagesInfo @@ -831,6 +832,36 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { obGyneProcedureListResponse: obGyneProcedureListResponse))); } + getAncillaryOrders() { + DoctorsListService service = new DoctorsListService(); + service.getAncillaryOrders().then((res) { + if (res['MessageStatus'] == 1) { + if (res['AncillaryOrderList'].length != 0) { + res['AncillaryOrderList'].forEach((v) { + ancillaryLists.add(new AncillaryOrdersListModel.fromJson(v)); + }); + } + // if (res['AncillaryOrderList'].length != 0) { + // res['AncillaryOrderList'].forEach((item) { + // ancillaryLists.add(AncillaryOrdersListModel.fromJson(item)); + // }); + // } + // dataLoaded = true; + // if (widget.isFromMyAppointments) { + // performNextAction(widget.appointment); + // widget.isFromMyAppointments = false; + // } + setState(() {}); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + err != null ?? AppToast.showErrorToast(message: err); + }); + } + getPatientAppointmentHistory() async { int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); @@ -845,11 +876,11 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); }); } - if (res['AncillaryOrderList'].length != 0) { - res['AncillaryOrderList'].forEach((item) { - ancillaryLists.add(AncillaryOrdersListModel.fromJson(item)); - }); - } + // if (res['AncillaryOrderList'].length != 0) { + // res['AncillaryOrderList'].forEach((item) { + // ancillaryLists.add(AncillaryOrdersListModel.fromJson(item)); + // }); + // } dataLoaded = true; if (widget.isFromMyAppointments) { performNextAction(widget.appointment); diff --git a/lib/pages/medical/medical_profile_page_new.dart b/lib/pages/medical/medical_profile_page_new.dart index e505e47e..f8f6499e 100644 --- a/lib/pages/medical/medical_profile_page_new.dart +++ b/lib/pages/medical/medical_profile_page_new.dart @@ -46,7 +46,7 @@ class _MedicalProfilePageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - TimeLineView(model.isLogin, projectViewModel.isArabic, model.appoitmentAllHistoryResultList), + TimeLineView(model.isLogin, projectViewModel.isArabic, model.appoitmentAllHistoryResultList, model), SizedBox( height: 20, ), diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index b85ec599..f5022dc5 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -175,7 +175,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorsRating(int docID,int languageID, context) async { + Future getDoctorsRating(int docID, int languageID, context) async { Map request; Request req = appGlobal.getPublicRequest(); @@ -226,7 +226,7 @@ class DoctorsListService extends BaseService { return Future.value(images); } - Future getDoctorsRatingDetails(int docID,int languageID, context) async { + Future getDoctorsRatingDetails(int docID, int languageID, context) async { Map request; Request req = appGlobal.getPublicRequest(); @@ -1790,6 +1790,21 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future getAncillaryOrders() async { + Map body = Map(); + + hasError = false; + dynamic localRes; + await baseAppClient.post(GET_ANCILLARY_ORDERS, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + + return Future.value(localRes); + } + Future getPayfortSDKTokenForPayment(String deviceID, String signatureValue, {bool isTest = true}) async { Map request; request = {"service_command": "SDK_TOKEN", "access_code": "BsM6He4FMBaZ86W64kjZ", "merchant_identifier": "ipxnRXXq", "language": "en", "device_id": deviceID, "signature": signatureValue}; diff --git a/lib/widgets/data_display/medical/time_line_new_widget.dart b/lib/widgets/data_display/medical/time_line_new_widget.dart index 0f5f9195..a15eecd4 100644 --- a/lib/widgets/data_display/medical/time_line_new_widget.dart +++ b/lib/widgets/data_display/medical/time_line_new_widget.dart @@ -2,6 +2,7 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; @@ -25,8 +26,9 @@ import 'package:provider/provider.dart'; class TimeLineView extends StatefulWidget { bool isLogged, isArabic; List appoitmentAllHistoryResultList; + MedicalViewModel medicalViewModel; - TimeLineView(this.isLogged, this.isArabic, this.appoitmentAllHistoryResultList); + TimeLineView(this.isLogged, this.isArabic, this.appoitmentAllHistoryResultList, this.medicalViewModel); @override _TimeLineViewState createState() => _TimeLineViewState(); @@ -38,17 +40,31 @@ class _TimeLineViewState extends State { DateObj selectedDateObj = null; final authService = new auth.AuthProvider(); + static const _scrollThreshold = 1.00; + ScrollController _scrollController; + + bool isAllAppointmentsLoaded = false; + + @override + void dispose() { + _scrollController.removeListener(_scrollListener); + _scrollController.dispose(); + super.dispose(); + } + @override void initState() { super.initState(); + _scrollController = ScrollController(); + _scrollController.addListener(_scrollListener); dateObjs.add(new DateObj(0, 0, widget.isArabic ? "الكل" : "All")); - for (int i = 0; i < widget.appoitmentAllHistoryResultList.length; i++) { - tempList.add(widget.appoitmentAllHistoryResultList[i]); + for (int i = 0; i < widget.medicalViewModel.appoitmentAllHistoryResultList.length; i++) { + tempList.add(widget.medicalViewModel.appoitmentAllHistoryResultList[i]); dateObjs.add(new DateObj( - DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate).month, - DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate).year, + DateUtil.convertStringToDate(widget.medicalViewModel.appoitmentAllHistoryResultList[i].appointmentDate).month, + DateUtil.convertStringToDate(widget.medicalViewModel.appoitmentAllHistoryResultList[i].appointmentDate).year, DateUtil.getMonthYearLangDateFormatted( - DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate), + DateUtil.convertStringToDate(widget.medicalViewModel.appoitmentAllHistoryResultList[i].appointmentDate), widget.isArabic ? "ar" : "en", ))); } @@ -61,20 +77,31 @@ class _TimeLineViewState extends State { // } } + void _scrollListener() async { + if (_scrollController.offset >= _scrollController.position.maxScrollExtent * _scrollThreshold && !_scrollController.position.outOfRange) { + print('Scroll position is at ${_scrollThreshold * 100}%.'); + if(!isAllAppointmentsLoaded) { + await sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL); + widget.medicalViewModel.getAppointmentHistory(isForTimeLine: false); + isAllAppointmentsLoaded = true; + } + } + } + applyFilter(bool isAll) { tempList.clear(); if (isAll) { - for (int i = 0; i < widget.appoitmentAllHistoryResultList.length; i++) { - tempList.add(widget.appoitmentAllHistoryResultList[i]); + for (int i = 0; i < widget.medicalViewModel.appoitmentAllHistoryResultList.length; i++) { + tempList.add(widget.medicalViewModel.appoitmentAllHistoryResultList[i]); } } else { - for (int i = 0; i < widget.appoitmentAllHistoryResultList.length; i++) { + for (int i = 0; i < widget.medicalViewModel.appoitmentAllHistoryResultList.length; i++) { if (DateUtil.getMonthYearLangDateFormatted( - DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate), + DateUtil.convertStringToDate(widget.medicalViewModel.appoitmentAllHistoryResultList[i].appointmentDate), widget.isArabic ? "ar" : "en", ) == selectedDateObj.monthYear) { - tempList.add(widget.appoitmentAllHistoryResultList[i]); + tempList.add(widget.medicalViewModel.appoitmentAllHistoryResultList[i]); } } } @@ -182,6 +209,7 @@ class _TimeLineViewState extends State { scrollDirection: Axis.horizontal, shrinkWrap: false, physics: BouncingScrollPhysics(), + controller: _scrollController, separatorBuilder: (BuildContext context, int index) { return mWidth(8); }, @@ -244,9 +272,9 @@ class _TimeLineViewState extends State { height: MediaQuery.of(context).size.width / 14, width: MediaQuery.of(context).size.width / (widget.isArabic ? 4 : 6), child: CustomTextButton( - shape: cardRadiusNew(8), - elevation: 0, - backgroundColor: Color(0xFFFBF2E31), + shape: cardRadiusNew(8), + elevation: 0, + backgroundColor: Color(0xFFFBF2E31), onPressed: () { // onLoginClick(); login();