From a9e48e487fd9cf84a8a5c6acb5269698228871d5 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 1 Jun 2022 11:42:33 +0300 Subject: [PATCH] HHC Fixes --- lib/app_state/app_state.dart | 13 + lib/core/service/client/base_app_client.dart | 123 ++++---- .../home_health_care_view_model.dart | 4 +- lib/core/viewModels/project_view_model.dart | 4 + .../NewHomeHealthCare/location_page.dart | 297 +++++++++--------- .../new_Home_health_care_step_tow_page.dart | 5 +- lib/pages/BookAppointment/BookConfirm.dart | 13 +- lib/pages/BookAppointment/DoctorProfile.dart | 3 +- .../components/DocAvailableAppointments.dart | 4 +- .../components/LaserClinic.dart | 33 +- .../Covid-DriveThru/Covid-TimeSlots.dart | 2 +- .../ToDoList/ObGyne/ObGyne-TimeSlots.dart | 2 +- .../appointment_services/GetDoctorsList.dart | 18 +- lib/uitl/push-notification-handler.dart | 1 + lib/widgets/in_app_browser/InAppBrowser.dart | 8 +- 15 files changed, 275 insertions(+), 255 deletions(-) create mode 100644 lib/app_state/app_state.dart diff --git a/lib/app_state/app_state.dart b/lib/app_state/app_state.dart new file mode 100644 index 00000000..0fd54e74 --- /dev/null +++ b/lib/app_state/app_state.dart @@ -0,0 +1,13 @@ +class AppState { + static final AppState _instance = AppState._internal(); + + AppState._internal(); + + factory AppState() => _instance; + + bool isLogged = false; + + set setLogged(v) => isLogged = v; + + bool get getIsLogged => isLogged; +} diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 43208626..dae465ca 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -141,11 +141,11 @@ class BaseAppClient { body.removeWhere((key, value) => key == null || value == null); - if (BASE_URL == "https://uat.hmgwebservices.com/") { + // if (BASE_URL == "https://uat.hmgwebservices.com/") { print("URL : $url"); final jsonBody = json.encode(body); print(jsonBody); - } + // } if (await Utils.checkConnection(bypassConnectionCheck: bypassConnectionCheck)) { final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers); @@ -264,72 +264,65 @@ class BaseAppClient { if (!isExternal) { String token = await sharedPref.getString(TOKEN); var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - if (body.containsKey('SetupID')) { - body['SetupID'] = body.containsKey('SetupID') - ? body['SetupID'] != null - ? body['SetupID'] - : SETUP_ID - : SETUP_ID; - } - - body['VersionID'] = VERSION_ID; - body['Channel'] = CHANNEL; - body['LanguageID'] = languageID == 'ar' ? 1 : 2; - - body['IPAdress'] = IP_ADDRESS; - body['generalid'] = GENERAL_ID; - body['PatientOutSA'] = body.containsKey('PatientOutSA') - ? body['PatientOutSA'] != null - ? body['PatientOutSA'] - : PATIENT_OUT_SA - : PATIENT_OUT_SA; - - if (body.containsKey('isDentalAllowedBackend')) { - body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') - ? body['isDentalAllowedBackend'] != null - ? body['isDentalAllowedBackend'] - : IS_DENTAL_ALLOWED_BACKEND - : IS_DENTAL_ALLOWED_BACKEND; - } - - body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; - - if (!body.containsKey('IsPublicRequest')) { - body['PatientType'] = body.containsKey('PatientType') - ? body['PatientType'] != null - ? body['PatientType'] - : user['PatientType'] != null - ? user['PatientType'] - : PATIENT_TYPE - : PATIENT_TYPE; - body['PatientTypeID'] = body.containsKey('PatientTypeID') - ? body['PatientTypeID'] != null - ? body['PatientTypeID'] - : user['PatientType'] != null - ? user['PatientType'] - : PATIENT_TYPE_ID - : PATIENT_TYPE_ID; - if (user != null) { - body['TokenID'] = token; - body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID']; - body['PatientOutSA'] = user['OutSA']; - body['SessionID'] = SESSION_ID; //getSe - // headers = { - // 'Content-Type': 'application/json', - // 'Accept': 'application/json', - // 'Authorization': pharmacyToken, - // 'Mobilenumber': user['MobileNumber'].toString(), - // 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', - // 'Username': user['PatientID'].toString(), - // }; - } - } + // if (body.containsKey('SetupID')) { + // body['SetupID'] = body.containsKey('SetupID') + // ? body['SetupID'] != null + // ? body['SetupID'] + // : SETUP_ID + // : SETUP_ID; + // } + // + // body['VersionID'] = VERSION_ID; + // body['Channel'] = CHANNEL; + // body['LanguageID'] = languageID == 'ar' ? 1 : 2; + // + // body['IPAdress'] = IP_ADDRESS; + // body['generalid'] = GENERAL_ID; + // body['PatientOutSA'] = body.containsKey('PatientOutSA') + // ? body['PatientOutSA'] != null + // ? body['PatientOutSA'] + // : PATIENT_OUT_SA + // : PATIENT_OUT_SA; + // + // if (body.containsKey('isDentalAllowedBackend')) { + // body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') + // ? body['isDentalAllowedBackend'] != null + // ? body['isDentalAllowedBackend'] + // : IS_DENTAL_ALLOWED_BACKEND + // : IS_DENTAL_ALLOWED_BACKEND; + // } + // + // body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; + // + // if (!body.containsKey('IsPublicRequest')) { + // body['PatientType'] = body.containsKey('PatientType') + // ? body['PatientType'] != null + // ? body['PatientType'] + // : user['PatientType'] != null + // ? user['PatientType'] + // : PATIENT_TYPE + // : PATIENT_TYPE; + // + // body['PatientTypeID'] = body.containsKey('PatientTypeID') + // ? body['PatientTypeID'] != null + // ? body['PatientTypeID'] + // : user['PatientType'] != null + // ? user['PatientType'] + // : PATIENT_TYPE_ID + // : PATIENT_TYPE_ID; + // if (user != null) { + // body['TokenID'] = token; + // body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID']; + // body['PatientOutSA'] = user['OutSA']; + // body['SessionID'] = SESSION_ID; //getSe + // } + // } } - // print("URL : $url"); - // print("Body : ${json.encode(body)}"); - // print("Headers : ${json.encode(headers)}"); + print("URL : $url"); + print("Body : ${json.encode(body)}"); + print("Headers : ${json.encode(headers)}"); if (await Utils.checkConnection()) { final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers); diff --git a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart index 41683165..d48e214e 100644 --- a/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart @@ -124,9 +124,9 @@ class HomeHealthCareViewModel extends BaseViewModel { Future addAddressInfo({AddNewAddressRequestModel addNewAddressRequestModel}) async { setState(ViewState.Busy); - await _pharmacyModuleService.generatePharmacyToken().then((value) async { + // await _pharmacyModuleService.generatePharmacyToken().then((value) async { await _customerAddressesService.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); - }); + // }); if (_customerAddressesService.hasError) { error = _customerAddressesService.error; diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index 78ed83b4..dd3d3a62 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/privilege/PrivilegeModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/models/Appointments/laser_body_parts.dart'; import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/cupertino.dart'; @@ -47,6 +48,9 @@ class ProjectViewModel extends BaseViewModel { List get privileges => isLoginChild ? privilegeChildUser : privilegeChildUser; + List selectedBodyPartList = []; + int laserSelectionDuration = 0; + StreamSubscription subscription; ProjectViewModel() { diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart index 09e0e19e..ee039d47 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart @@ -9,7 +9,6 @@ import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; -import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -42,6 +41,8 @@ class _LocationPageState extends State { double longitude = 0; bool showCurrentLocation = false; + GoogleMapController mapController; + AppMap appMap; AppSharedPreferences sharedPref = AppSharedPreferences(); static CameraPosition _kGooglePlex = CameraPosition( @@ -49,7 +50,7 @@ class _LocationPageState extends State { zoom: 14.4746, ); LatLng currentPostion; - Completer mapController = Completer(); + // Completer mapController = Completer(); Placemark selectedPlace; @override @@ -145,152 +146,156 @@ class _LocationPageState extends State { // ], // ), - // PlacePicker( - // apiKey: GOOGLE_API_KEY, - // enableMyLocationButton: true, - // automaticallyImplyAppBarLeading: false, - // autocompleteOnTrailingWhitespace: true, - // selectInitialPosition: true, - // autocompleteLanguage: projectViewModel.currentLanguage, - // enableMapTypeButton: true, - // searchForInitialValue: false, - // onPlacePicked: (PickResult result) { - // print(result.adrAddress); - // }, - // selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { - // return isSearchBarFocused - // ? Container() - // : FloatingCard( - // bottomPosition: 0.0, - // leftPosition: 0.0, - // rightPosition: 0.0, - // width: 500, - // borderRadius: BorderRadius.circular(0.0), - // child: state == SearchingState.Searching - // ? SizedBox(height: 43, child: Center(child: CircularProgressIndicator())).insideContainer - // : DefaultButton(TranslationBase.of(context).addNewAddress, () async { - // AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel( - // customer: Customer(addresses: [ - // Addresses( - // address1: selectedPlace.formattedAddress, - // address2: selectedPlace.formattedAddress, - // customerAttributes: "", - // createdOnUtc: "", - // id: "0", - // faxNumber: "", - // phoneNumber: projectViewModel.user.mobileNumber, - // countryId: 69, - // latLong: "$latitude,$longitude", - // email: projectViewModel.user.emailAddress) - // // Addresses( - // // address1: selectedPlace.formattedAddress, - // // address2: selectedPlace.formattedAddress, - // // customerAttributes: "", - // // city: "", - // // createdOnUtc: "", - // // id: "0", - // // latLong: "${selectedPlace.geometry.location}", - // // email: "") - // ]), - // ); - // - // selectedPlace.addressComponents.forEach((e) { - // if (e.types.contains("country")) { - // addNewAddressRequestModel.customer.addresses[0].country = e.longName; - // } - // if (e.types.contains("postal_code")) { - // addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName; - // } - // if (e.types.contains("locality")) { - // addNewAddressRequestModel.customer.addresses[0].city = e.longName; - // } - // }); - // - // await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); - // if (model.state == ViewState.ErrorLocal) { - // Utils.showErrorToast(model.error); - // } else { - // AppToast.showSuccessToast(message: "Address Added Successfully"); - // } - // Navigator.of(context).pop(addNewAddressRequestModel); - // }).insideContainer); - // }, - // initialPosition: LatLng(latitude, longitude), - // useCurrentLocation: showCurrentLocation, - // ), + PlacePicker( + apiKey: GOOGLE_API_KEY, + enableMyLocationButton: true, + automaticallyImplyAppBarLeading: false, + autocompleteOnTrailingWhitespace: true, + selectInitialPosition: true, + autocompleteLanguage: projectViewModel.currentLanguage, + enableMapTypeButton: true, + searchForInitialValue: false, + onMapCreated: (GoogleMapController controller) { + mapController = controller; + }, + onPlacePicked: (PickResult result) { + print(result.adrAddress); + }, + selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { + print("state: $state, isSearchBarFocused: $isSearchBarFocused"); + return isSearchBarFocused + ? Container() + : FloatingCard( + bottomPosition: 0.0, + leftPosition: 0.0, + rightPosition: 0.0, + width: 500, + borderRadius: BorderRadius.circular(0.0), + child: state == SearchingState.Searching + ? SizedBox(height: 43, child: Center(child: CircularProgressIndicator())).insideContainer + : DefaultButton(TranslationBase.of(context).addNewAddress, () async { + AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel( + customer: Customer(addresses: [ + Addresses( + address1: selectedPlace.formattedAddress, + address2: selectedPlace.formattedAddress, + customerAttributes: "", + createdOnUtc: "", + id: "0", + faxNumber: "", + phoneNumber: projectViewModel.user.mobileNumber, + countryId: 69, + latLong: selectedPlace.geometry.location.lat.toString() + "," + selectedPlace.geometry.location.lng.toString(), + email: projectViewModel.user.emailAddress) + // Addresses( + // address1: selectedPlace.formattedAddress, + // address2: selectedPlace.formattedAddress, + // customerAttributes: "", + // city: "", + // createdOnUtc: "", + // id: "0", + // latLong: "${selectedPlace.geometry.location}", + // email: "") + ]), + ); - Expanded( - child: Stack( - alignment: Alignment.center, - children: [ - if (appMap != null) appMap, - Container( - margin: EdgeInsets.only(bottom: 50.0), - child: Icon( - Icons.place, - color: CustomColors.accentColor, - size: 50, - ), - ), - // FloatingCard( - // bottomPosition: 0.0, - // leftPosition: 0.0, - // rightPosition: 0.0, - // width: 500, - // borderRadius: BorderRadius.circular(0.0), - // // child: state == SearchingState.Searching - // // ? SizedBox(height: 43, child: Center(child: CircularProgressIndicator())).insideContainer - // // : - // child: DefaultButton(TranslationBase.of(context).addNewAddress, () async { - // AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel( - // customer: Customer(addresses: [ - // // Addresses( - // // address1: selectedPlace.formattedAddress, - // // address2: selectedPlace.formattedAddress, - // // customerAttributes: "", - // // createdOnUtc: "", - // // id: "0", - // // faxNumber: "", - // // phoneNumber: projectViewModel.user.mobileNumber, - // // countryId: 69, - // // latLong: "$latitude,$longitude", - // // email: projectViewModel.user.emailAddress) - // - // // Addresses( - // // address1: selectedPlace.formattedAddress, - // // address2: selectedPlace.formattedAddress, - // // customerAttributes: "", - // // city: "", - // // createdOnUtc: "", - // // id: "0", - // // latLong: "${selectedPlace.geometry.location}", - // // email: "") - // ]), - // ); - // - // // selectedPlace.addressComponents.forEach((e) { - // // if (e.types.contains("country")) { - // // addNewAddressRequestModel.customer.addresses[0].country = e.longName; - // // } - // // if (e.types.contains("postal_code")) { - // // addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName; - // // } - // // if (e.types.contains("locality")) { - // // addNewAddressRequestModel.customer.addresses[0].city = e.longName; - // // } - // // }); - // - // await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); - // if (model.state == ViewState.ErrorLocal) { - // Utils.showErrorToast(model.error); - // } else { - // AppToast.showSuccessToast(message: "Address Added Successfully"); - // } - // Navigator.of(context).pop(addNewAddressRequestModel); - // }).insideContainer), - ], - ), + selectedPlace.addressComponents.forEach((e) { + if (e.types.contains("country")) { + addNewAddressRequestModel.customer.addresses[0].country = e.longName; + } + if (e.types.contains("postal_code")) { + addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName; + } + if (e.types.contains("locality")) { + addNewAddressRequestModel.customer.addresses[0].city = e.longName; + } + }); + + await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + AppToast.showSuccessToast(message: "Address Added Successfully"); + } + Navigator.of(context).pop(addNewAddressRequestModel); + }).insideContainer); + }, + initialPosition: LatLng(latitude, longitude), + useCurrentLocation: showCurrentLocation, ), + + // Expanded( + // child: Stack( + // alignment: Alignment.center, + // children: [ + // if (appMap != null) appMap, + // Container( + // margin: EdgeInsets.only(bottom: 50.0), + // child: Icon( + // Icons.place, + // color: CustomColors.accentColor, + // size: 50, + // ), + // ), + // // FloatingCard( + // // bottomPosition: 0.0, + // // leftPosition: 0.0, + // // rightPosition: 0.0, + // // width: 500, + // // borderRadius: BorderRadius.circular(0.0), + // // // child: state == SearchingState.Searching + // // // ? SizedBox(height: 43, child: Center(child: CircularProgressIndicator())).insideContainer + // // // : + // // child: DefaultButton(TranslationBase.of(context).addNewAddress, () async { + // // AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel( + // // customer: Customer(addresses: [ + // // // Addresses( + // // // address1: selectedPlace.formattedAddress, + // // // address2: selectedPlace.formattedAddress, + // // // customerAttributes: "", + // // // createdOnUtc: "", + // // // id: "0", + // // // faxNumber: "", + // // // phoneNumber: projectViewModel.user.mobileNumber, + // // // countryId: 69, + // // // latLong: "$latitude,$longitude", + // // // email: projectViewModel.user.emailAddress) + // // + // // // Addresses( + // // // address1: selectedPlace.formattedAddress, + // // // address2: selectedPlace.formattedAddress, + // // // customerAttributes: "", + // // // city: "", + // // // createdOnUtc: "", + // // // id: "0", + // // // latLong: "${selectedPlace.geometry.location}", + // // // email: "") + // // ]), + // // ); + // // + // // // selectedPlace.addressComponents.forEach((e) { + // // // if (e.types.contains("country")) { + // // // addNewAddressRequestModel.customer.addresses[0].country = e.longName; + // // // } + // // // if (e.types.contains("postal_code")) { + // // // addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName; + // // // } + // // // if (e.types.contains("locality")) { + // // // addNewAddressRequestModel.customer.addresses[0].city = e.longName; + // // // } + // // // }); + // // + // // await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); + // // if (model.state == ViewState.ErrorLocal) { + // // Utils.showErrorToast(model.error); + // // } else { + // // AppToast.showSuccessToast(message: "Address Added Successfully"); + // // } + // // Navigator.of(context).pop(addNewAddressRequestModel); + // // }).insideContainer), + // ], + // ), + // ), ), ); } diff --git a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart index 8614f521..0c59f10e 100644 --- a/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart +++ b/lib/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/new_Home_health_care_step_tow_page.dart @@ -194,7 +194,10 @@ class _NewHomeHealthCareStepTowPageState extends State { if (isLiveCareSchedule != null && isLiveCareSchedule) { insertLiveCareScheduledAppointment(context, widget.doctor); } else { - insertAppointment(context, widget.doctor); + insertAppointment(context, widget.doctor, widget.initialSlotDuration); } }, child: Text(TranslationBase.of(context).bookAppo, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)), @@ -255,7 +254,7 @@ class _BookConfirmState extends State { if (res['MessageStatus'] == 1) { Future.delayed(new Duration(milliseconds: 1500), () async { if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) != null && !await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { - insertAppointment(context, widget.doctor); + insertAppointment(context, widget.doctor, widget.initialSlotDuration); } else { insertLiveCareScheduledAppointment(context, widget.doctor); } @@ -269,13 +268,13 @@ class _BookConfirmState extends State { }); } - insertAppointment(context, DoctorList docObject) { + insertAppointment(context, DoctorList docObject, int initialSlotDuration) { final timeSlot = DocAvailableAppointments.selectedAppoDateTime; projectViewModel.analytics.appointment.book_appointment_click_confirm(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor); GifLoaderDialogUtils.showMyDialog(context); AppoitmentAllHistoryResultList appo; - widget.service.insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate, context).then((res) { + widget.service.insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate, initialSlotDuration, context, null, null, null, projectViewModel).then((res) { if (res['MessageStatus'] == 1) { projectViewModel.analytics.appointment.book_appointment_confirmation_success(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor); AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 033d360b..eea41c4d 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -154,7 +154,7 @@ class _DoctorProfileState extends State with TickerProviderStateM onTap: (index) { setState(() { if (index == 1) { - if (widget.doctor.clinicID == 17 || widget.doctor.clinicID == 23 || widget.doctor.clinicID == 47 || widget.isLiveCareAppointment) { + if (widget.doctor.clinicID == 23 || widget.doctor.clinicID == 47 || widget.isLiveCareAppointment) { _tabController.index = _tabController.previousIndex; showFooterButton = false; } else { @@ -529,6 +529,7 @@ class _DoctorProfileState extends State with TickerProviderStateM isLiveCareAppointment: widget.isLiveCareAppointment, selectedDate: DocAvailableAppointments.selectedDate, selectedTime: DocAvailableAppointments.selectedTime, + initialSlotDuration: DocAvailableAppointments.initialSlotDuration, ), ), ); diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 7ba2a286..8a2ccc8d 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -28,6 +28,7 @@ class DocAvailableAppointments extends StatefulWidget { static String selectedTime; bool isLiveCareAppointment; final dynamic doctorSchedule; + static int initialSlotDuration; DocAvailableAppointments({@required this.doctor, this.doctorSchedule, @required this.isLiveCareAppointment}); @@ -239,6 +240,7 @@ class _DocAvailableAppointmentsState extends State wit _eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); setState(() { DocAvailableAppointments.selectedDate = dateFormatter.format(DateUtil.convertStringToDate(freeSlotsResponse[0])); + DocAvailableAppointments.selectedAppoDateTime = DateUtil.convertStringToDate(freeSlotsResponse[0]); selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(DateUtil.convertStringToDate(freeSlotsResponse[0]), language); selectedDateJSON = freeSlotsResponse[0]; }); @@ -292,9 +294,9 @@ class _DocAvailableAppointmentsState extends State wit GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['FreeTimeSlots'].length != 0) { + DocAvailableAppointments.initialSlotDuration = res['InitialSlotDuration']; DocAvailableAppointments.areAppointmentsAvailable = true; freeSlotsResponse = res['FreeTimeSlots']; - _getJSONSlots().then((value) { setState(() => { _events.clear(), diff --git a/lib/pages/BookAppointment/components/LaserClinic.dart b/lib/pages/BookAppointment/components/LaserClinic.dart index 37ec070a..8522a915 100644 --- a/lib/pages/BookAppointment/components/LaserClinic.dart +++ b/lib/pages/BookAppointment/components/LaserClinic.dart @@ -184,9 +184,11 @@ class _LaserClinicState extends State with SingleTickerProviderStat Expanded( child: DefaultButton( TranslationBase.of(context).continues, - getDuration() != 0 ? () { - callDoctorsSearchAPI(); - } : null, + getDuration() != 0 + ? () { + callDoctorsSearchAPI(); + } + : null, color: CustomColors.green, disabledColor: CustomColors.grey2, ), @@ -208,6 +210,7 @@ class _LaserClinicState extends State with SingleTickerProviderStat List _patientDoctorAppointmentListHospital = List(); DoctorsListService service = new DoctorsListService(); + projectViewModel.selectedBodyPartList = _selectedBodyPartList; service.getDoctorsList(253, 0, false, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { @@ -270,33 +273,14 @@ class _LaserClinicState extends State with SingleTickerProviderStat if (_selectedBodyPartList.length > 0) { duration = _selectedBodyPartList.fold(0, (previousValue, element) => previousValue + int.parse(element.timeDuration)); } - print("duration:$duration"); if (lowerUpperLegsList.length == 2) { duration -= 30; } - print("duration1:$duration"); if (upperLowerArmsList.length == 2) { duration -= 15; } - print("duration2:$duration"); - // for (int i = 0; i < _selectedBodyPartList.length; i++) { - // if ( - // - // (lowerUpperLegsList.length == 2 && (_selectedBodyPartList[i].mappingCode == "47" || _selectedBodyPartList[i].mappingCode == "48")) || - // (upperLowerArmsList.length == 2 && (_selectedBodyPartList[i].mappingCode == "40" || _selectedBodyPartList[i].mappingCode == "41")) - // - // - // ) { - // print("duration:$duration"); - // - // duration += 15; - // print("duration1:$duration"); - // } else { - // duration += int.parse(_selectedBodyPartList[i].timeDuration); - // } - // } - print(duration); _duration = duration; + projectViewModel.laserSelectionDuration = duration; return duration; } @@ -378,6 +362,9 @@ class _LaserClinicState extends State with SingleTickerProviderStat setState(() { if (value) { _selectedBodyPartList.clear(); + _selectedBodyPartList.add(fullBody); + } else { + _selectedBodyPartList.clear(); } _isFullBody = !_isFullBody; }); diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index b4db054d..f4f73d49 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -435,7 +435,7 @@ class _CovidTimeSlotsState extends State with TickerProviderStat DoctorsListService service = new DoctorsListService(); AppoitmentAllHistoryResultList appo; service - .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, CovidTimeSlots.selectedTime, CovidTimeSlots.selectedDate, context, widget.selectedProcedure.procedureID, + .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, CovidTimeSlots.selectedTime, CovidTimeSlots.selectedDate, 0, context, widget.selectedProcedure.procedureID, widget.selectedProject.testTypeEnum, widget.selectedProject.testProcedureEnum) .then((res) { if (res['MessageStatus'] == 1) { diff --git a/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart b/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart index 477d0736..f1b97146 100644 --- a/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart +++ b/lib/pages/ToDoList/ObGyne/ObGyne-TimeSlots.dart @@ -359,7 +359,7 @@ class _CovidTimeSlotsState extends State with TickerProviderSta AppoitmentAllHistoryResultList appo; service .insertAppointment( - docObject.doctorID, docObject.clinicID, docObject.projectID, ObGyneTimeSlots.selectedTime, ObGyneTimeSlots.selectedDate, context, widget.obGyneProcedureListResponse.procedureId) + docObject.doctorID, docObject.clinicID, docObject.projectID, ObGyneTimeSlots.selectedTime, ObGyneTimeSlots.selectedDate, 0, context, widget.obGyneProcedureListResponse.procedureId) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 606d9486..90c2be46 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -3,10 +3,12 @@ import 'dart:io'; 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/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Appointments/doctor_pre_post_image.dart'; +import 'package:diplomaticquarterapp/models/Appointments/laser_body_parts.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/models/apple_pay_request.dart'; @@ -28,6 +30,7 @@ class DoctorsListService extends BaseService { double long; String deviceToken; String tokenID; + List selectedBodyPartList = []; Future getDoctorsList(int clinicID, int projectID, bool isNearest, BuildContext context, {doctorId, doctorName, isContinueDentalPlan = false}) async { Map request; @@ -317,8 +320,8 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, BuildContext context, - [String procedureID, num testTypeEnum, num testProcedureEnum]) async { + Future insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, int initialSlotDuration, BuildContext context, + [String procedureID, num testTypeEnum, num testProcedureEnum, ProjectViewModel projectViewModel]) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -339,13 +342,14 @@ class DoctorsListService extends BaseService { "ProcedureID": procedureID, "TestTypeEnum": testTypeEnum, "TestProcedureEnum": testProcedureEnum, - "InitialSlotDuration": 0, + "InitialSlotDuration": initialSlotDuration, "StrAppointmentDate": selectedDate, "IsVirtual": false, "DeviceType": Platform.isIOS ? 'iOS' : 'Android', "BookedBy": 102, "VisitType": 1, "VisitFor": 1, + "GenderID": authUser.gender, "VersionID": req.VersionID, "Channel": req.Channel, "LanguageID": languageID == 'ar' ? 1 : 2, @@ -360,10 +364,18 @@ class DoctorsListService extends BaseService { "PatientType": authUser.patientType }; + if(clinicID == 253) { + List procedureID = projectViewModel.selectedBodyPartList.map((element) => element.id.toString()).toList(); + request["GeneralProcedureList"] = procedureID; + request["InitialSlotDuration"] = projectViewModel.laserSelectionDuration; + } + dynamic localRes; await baseAppClient.post(INSERT_SPECIFIC_APPOINTMENT, onSuccess: (response, statusCode) async { localRes = response; + projectViewModel.selectedBodyPartList.clear(); + projectViewModel.laserSelectionDuration = 0; }, onFailure: (String error, int statusCode) { throw error; }, body: request); diff --git a/lib/uitl/push-notification-handler.dart b/lib/uitl/push-notification-handler.dart index c12a08ad..3eadea1f 100644 --- a/lib/uitl/push-notification-handler.dart +++ b/lib/uitl/push-notification-handler.dart @@ -142,6 +142,7 @@ class PushNotificationHandler { newMessage(message); }); else + // if(message != null) newMessage(message); }); diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 5ccffc59..66d26ed6 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -32,13 +32,13 @@ class MyInAppBrowser extends InAppBrowser { static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWeb/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + 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/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 String PRESCRIPTION_PAYMENT_WITH_ORDERID = // 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID=';