Merge branch 'development_v2.5' into zik_webrtc_dev_v2.5

* development_v2.5:
  Google analytics events update
  Updates
  Updates & fixes
  DateTime Fixes
  HHC Fixes
  updates & fixes
  Updates & fixes

# Conflicts:
#	lib/config/config.dart
#	lib/pages/landing/fragments/home_page_fragment2.dart
merge-requests/599/head
Zohaib Iqbal Kambrani 4 years ago
commit fb4fb8d29e

@ -79,4 +79,20 @@ class AdvancePayments{
'transaction_currency' : txn_currency 'transaction_currency' : txn_currency
}); });
} }
// New
payment_fail({@required String appointment_type, clinic, hospital, payment_method, payment_type, txn_amount, txn_currency, error_code, error_message}){
logger('payment_fail', parameters: {
'appointment_type' : appointment_type,
'clinic_type_online' : clinic,
'payment_method' : payment_method,
'payment_type' : payment_type,
'hospital_name' : hospital,
'transaction_number' : "",
'transaction_amount' : txn_amount,
'transaction_currency' : txn_currency,
"error_code" : error_code,
"error_message" : error_message,
});
}
} }

@ -232,14 +232,17 @@ class Appointment{
// R036 // R036
payment_success({@required String appointment_type, clinic, hospital, payment_method, payment_type, txn_number, txn_amount, txn_currency}){ payment_success({@required String appointment_type, clinic, hospital, payment_method, payment_type, txn_number, txn_amount, txn_currency}){
// appointment_type
// clinic_type_online logger('payment_success', parameters: {
// payment_method 'appointment_type' : appointment_type,
// payment_type: 'appointment' 'clinic_type_online' : clinic,
// hospital_name 'payment_method' : payment_method,
// transaction_number 'payment_type' : payment_type,
// transaction_amount 'hospital_name' : hospital,
// transaction_currency 'transaction_number' : txn_number,
'transaction_amount' : txn_amount,
'transaction_currency' : txn_currency,
});
} }

@ -9,7 +9,7 @@ import 'package:diplomaticquarterapp/analytics/flows/offers_promotions.dart';
import 'package:diplomaticquarterapp/analytics/flows/todo_list.dart'; import 'package:diplomaticquarterapp/analytics/flows/todo_list.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/services/permission/permission_service.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:firebase_analytics/firebase_analytics.dart'; import 'package:firebase_analytics/firebase_analytics.dart';
@ -22,86 +22,79 @@ import 'package:geolocator/geolocator.dart';
import 'flows/app_nav.dart'; import 'flows/app_nav.dart';
import 'flows/hmg_services.dart'; import 'flows/hmg_services.dart';
typedef GALogger = Function(String name, {Map<String, dynamic> parameters});
typedef GALogger = Function(String name, {Map<String,dynamic> parameters});
var _analytics = FirebaseAnalytics(); var _analytics = FirebaseAnalytics();
_logger(String name, {Map<String,dynamic> parameters}) async {
_logger(String name, {Map<String, dynamic> parameters}) async {
// return;
if (name != null && name.isNotEmpty) { if (name != null && name.isNotEmpty) {
if(name.contains(' ')) if (name.contains(' ')) name = name.replaceAll(' ', '_');
name = name.replaceAll(' ','_');
// To LowerCase // To LowerCase
if(parameters != null && parameters.isNotEmpty) if (parameters != null && parameters.isNotEmpty)
parameters = parameters.map((key, value) { parameters = parameters.map((key, value) {
final key_ = key.toLowerCase(); final key_ = key.toLowerCase();
var value_ = value; var value_ = value;
if(value is String) if (value is String) value_ = value.toLowerCase();
value_ = value.toLowerCase();
return MapEntry(key_, value_); return MapEntry(key_, value_);
}); });
try{ try {
_analytics _analytics.logEvent(name: name.trim().toLowerCase(), parameters: parameters).then((value) {
.logEvent(name: name.trim().toLowerCase(), parameters: parameters)
.then((value) {
debugPrint('SUCCESS: Google analytics event "$name" sent with parameters $parameters'); debugPrint('SUCCESS: Google analytics event "$name" sent with parameters $parameters');
}).catchError((error) { }).catchError((error) {
debugPrint('ERROR: Google analytics event "$name" sent failed'); debugPrint('ERROR: Google analytics event "$name" sent failed');
}); });
}catch(e){ } catch (e) {
print(e); print(e);
} }
} }
} }
class GAnalytics { class GAnalytics {
static String TREATMENT_TYPE; static String TREATMENT_TYPE;
static String APPOINTMENT_DETAIL_FLOW_TYPE; static String APPOINTMENT_DETAIL_FLOW_TYPE;
static String PAYMENT_TYPE; static String PAYMENT_TYPE;
setUser(AuthenticatedUser user) async{ setUser(AuthenticatedUser user) async {
try{ try {
_analytics.setUserProperty(name: 'user_language', value: user.preferredLanguage == '1' ? 'arabic' : 'english'); _analytics.setUserProperty(name: 'user_language', value: user.preferredLanguage == '1' ? 'arabic' : 'english');
_analytics.setUserProperty(name: 'userid', value: Utils.generateMd5Hash(user.emailAddress)); _analytics.setUserProperty(name: 'userid', value: Utils.generateMd5Hash(user.emailAddress));
_analytics.setUserProperty(name: 'login_status', value: user == null ? 'guest' : 'loggedin'); _analytics.setUserProperty(name: 'login_status', value: user == null ? 'guest' : 'loggedin');
final location = await Geolocator.getCurrentPosition(); if (await PermissionService.isLocationEnabled()) {
if(location != null && !location.isMocked){ final location = await Geolocator.getCurrentPosition();
final places = await placemarkFromCoordinates(location.latitude, location.longitude, localeIdentifier: 'en_US'); if (location != null && !location.isMocked) {
final countryCode = places.first.isoCountryCode; final places = await placemarkFromCoordinates(location.latitude, location.longitude, localeIdentifier: 'en_US');
_analytics.setUserProperty(name: 'user_country', value: countryCode); final countryCode = places.first.isoCountryCode;
_analytics.setUserProperty(name: 'user_country', value: countryCode);
}
} else {
_analytics.setUserProperty(name: 'user_country', value: "N/A");
} }
}catch(e){ } catch (e) {}
}
} }
NavObserver navObserver() => NavObserver(); NavObserver navObserver() => NavObserver();
final hamburgerMenu = HamburgerMenu(_logger); final hamburgerMenu = HamburgerMenu(_logger);
final bottomTabNavigation = AppNav(_logger); final bottomTabNavigation = AppNav(_logger);
final hmgServices = HMGServices(_logger); final hmgServices = HMGServices(_logger);
final loginRegistration = LoginRegistration(_logger); final loginRegistration = LoginRegistration(_logger);
final appointment = Appointment(_logger); final appointment = Appointment(_logger);
final liveCare = LiveCare(_logger); final liveCare = LiveCare(_logger);
final todoList = TodoList(_logger); final todoList = TodoList(_logger);
final advancePayments = AdvancePayments(_logger); final advancePayments = AdvancePayments(_logger);
final offerPackages = OfferAndPromotion(_logger); final offerPackages = OfferAndPromotion(_logger);
final errorTracking = ErrorTracking(_logger); final errorTracking = ErrorTracking(_logger);
} }
// adb shell setprop debug.firebase.analytics.app com.ejada.hmg -> Android // adb shell setprop debug.firebase.analytics.app com.ejada.hmg -> Android
class NavObserver extends RouteObserver<PageRoute<dynamic>> { class NavObserver extends RouteObserver<PageRoute<dynamic>> {
_sendScreenView(PageRoute route) async { _sendScreenView(PageRoute route) async {
log(String className) { log(String className) {
var event = AnalyticEvents.get(className); var event = AnalyticEvents.get(className);
if (event.active != null) { if (event.active != null) {
_analytics _analytics.setCurrentScreen(screenName: event.flutterName(), screenClassOverride: className).catchError(
.setCurrentScreen(
screenName: event.flutterName(), screenClassOverride: className)
.catchError(
(Object error) { (Object error) {
print('$FirebaseAnalyticsObserver: $error'); print('$FirebaseAnalyticsObserver: $error');
}, },
@ -112,9 +105,7 @@ class NavObserver extends RouteObserver<PageRoute<dynamic>> {
} }
} }
if (route.settings.name != null && if (route.settings.name != null && route.settings.name.isNotEmpty && route.settings.name != "null") {
route.settings.name.isNotEmpty &&
route.settings.name != "null") {
var class_ = routes[route.settings.name](0); var class_ = routes[route.settings.name](0);
if (class_ != null) log(class_.toStringShort()); if (class_ != null) log(class_.toStringShort());
} else if (route is FadePage) { } else if (route is FadePage) {

@ -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;
}

@ -351,6 +351,9 @@ var INSERT_LIVECARE_SCHEDULE_APPOINTMENT =
var GET_PATIENT_SHARE_LIVECARE = var GET_PATIENT_SHARE_LIVECARE =
"Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForLiveCare"; "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForLiveCare";
var SET_ONLINE_CHECKIN_FOR_APPOINTMENT =
"Services/Patients.svc/REST/SetOnlineCheckInForAppointment";
var GET_LIVECARE_CLINIC_TIMING = var GET_LIVECARE_CLINIC_TIMING =
'Services/ER_VirtualCall.svc/REST/PatientER_GetClinicsServiceTimingsSchedule'; 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinicsServiceTimingsSchedule';
@ -396,7 +399,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnar
var CHANNEL = 3; var CHANNEL = 3;
var GENERAL_ID = 'Cs2020@2016\$2958'; var GENERAL_ID = 'Cs2020@2016\$2958';
var IP_ADDRESS = '10.20.10.20'; var IP_ADDRESS = '10.20.10.20';
var VERSION_ID = 9.0; var VERSION_ID = 8.3;
var SETUP_ID = '91877'; var SETUP_ID = '91877';
var LANGUAGE = 2; var LANGUAGE = 2;
var PATIENT_OUT_SA = 0; var PATIENT_OUT_SA = 0;

@ -268,12 +268,12 @@ const Map localizedValues = {
"myMedicalFileSubTitle": {"en": "All your medical records", 'ar': 'جميع سجلاتك الطبية'}, "myMedicalFileSubTitle": {"en": "All your medical records", 'ar': 'جميع سجلاتك الطبية'},
"viewMore": {"en": "View More", 'ar': 'عرض المزيد'}, "viewMore": {"en": "View More", 'ar': 'عرض المزيد'},
"homeHealthCareService": {"en": "Home Health Care Service", 'ar': 'الرعاية الصحية المنزلية'}, "homeHealthCareService": {"en": "Home Health Care Service", 'ar': 'الرعاية الصحية المنزلية'},
"OnlinePharmacy": {"en": "Online Pharmacy", 'ar': 'الصيدلية االلكترونية'}, "OnlinePharmacy": {"en": "Online Pharmacy", 'ar': 'الصيدلية الإلكترونية'},
"EmergencyService": {"en": "Emergency Service", 'ar': 'الفحص الطبي الشامل'}, "EmergencyService": {"en": "Emergency Service", 'ar': 'الفحص الطبي الشامل'},
"OnlinePaymentService": {"en": "Online Payment Service", 'ar': 'خدمة الدفع الإلكتروني'}, "OnlinePaymentService": {"en": "Online Payment Service", 'ar': 'خدمة الدفع الإلكتروني'},
"OffersAndPackages": {"en": "Online transfer request", 'ar': 'طلب التحويل الالكتروني'}, "OffersAndPackages": {"en": "Online transfer request", 'ar': 'طلب التحويل الالكتروني'},
"ComprehensiveMedicalCheckup": {"en": "Comprehensive Medical Check-up", 'ar': 'فحص طبي شامل'}, "ComprehensiveMedicalCheckup": {"en": "Comprehensive Medical Check-up", 'ar': 'فحص طبي شامل'},
"HMGService": {"en": "HMG Service", 'ar': 'الخدمات االلكترونية'}, "HMGService": {"en": "HMG Service", 'ar': 'الخدمات الإلكترونية'},
"ViewAllHabibMedicalService": {"en": "View All Habib Medical Service", 'ar': 'عرض خدمات الحبيب الطبية'}, "ViewAllHabibMedicalService": {"en": "View All Habib Medical Service", 'ar': 'عرض خدمات الحبيب الطبية'},
"viewAll": {"en": "View All", 'ar': 'عرض الكل'}, "viewAll": {"en": "View All", 'ar': 'عرض الكل'},
"view": {"en": "View", 'ar': 'عرض'}, "view": {"en": "View", 'ar': 'عرض'},
@ -541,11 +541,11 @@ const Map localizedValues = {
"refferal": {"en": "E-Refferal", "ar": "الإحالة الإلكترونية"}, "refferal": {"en": "E-Refferal", "ar": "الإحالة الإلكترونية"},
"refferalTitle": {"en": "E-Refferal", "ar": "خدمات"}, "refferalTitle": {"en": "E-Refferal", "ar": "خدمات"},
"refferalSubTitle": {"en": "Service", "ar": "الإحالة الإلكترونية"}, "refferalSubTitle": {"en": "Service", "ar": "الإحالة الإلكترونية"},
"healthCare": {"en": "Health Care", "ar": "الصحية المزلية"}, "healthCare": {"en": "Health Care", "ar": "الصحية المنزلية"},
"emergency": {"en": "Emergency", "ar": "الطوارئ"}, "emergency": {"en": "Emergency", "ar": "الطوارئ"},
"erservices": {"en": "Emergency", "ar": "الطوارئ"}, "erservices": {"en": "Emergency", "ar": "الطوارئ"},
"services2": {"en": "Services", "ar": "خدمات"}, "services2": {"en": "Services", "ar": "خدمات"},
"cantSeeProfile": {"en": "To view your medical profile, please log in or register now", "ar": "للتصفح ملفك الطبي الرجاء تسجيل الدخول أو التسجيل االن"}, "cantSeeProfile": {"en": "To view your medical profile, please log in or register now", "ar": "للتصفح ملفك الطبي الرجاء تسجيل الدخول أو التسجيل الآن"},
"loginRegisterNow": {"en": "Login or Register Now", "ar": "تسجيل الدخول أو التسجيل الآن"}, "loginRegisterNow": {"en": "Login or Register Now", "ar": "تسجيل الدخول أو التسجيل الآن"},
"HMGPharmacy": {"en": "HMG Pharmacy", "ar": "صيدلية HMG"}, "HMGPharmacy": {"en": "HMG Pharmacy", "ar": "صيدلية HMG"},
"ecommerceSolution": {"en": "Ecommerce Solution", "ar": "حل التجارة الإلكترونية"}, "ecommerceSolution": {"en": "Ecommerce Solution", "ar": "حل التجارة الإلكترونية"},
@ -1811,5 +1811,9 @@ const Map localizedValues = {
"recordAudioPermission": { "en": "Dr. Al Habib app needs audio permission to enable voice command features.", "ar": "يحتاج تطبيق دكتور الحبيب إلى صلاحية الوصول الى الصوت لتفعيل خدمة الأوامر الصوتية." }, "recordAudioPermission": { "en": "Dr. Al Habib app needs audio permission to enable voice command features.", "ar": "يحتاج تطبيق دكتور الحبيب إلى صلاحية الوصول الى الصوت لتفعيل خدمة الأوامر الصوتية." },
"wifiPermission": { "en": "Dr. Al Habib app needs to access WiFi state permission to connect to the HMG WiFi network from within the app when you visit the hospital.", "ar": "يحتاج تطبيق دكتور الحبيب إلى الوصول إلى الواي فاي للاتصال بشبكة الواي فاي في المجموعة عند زيارة المستشفى." }, "wifiPermission": { "en": "Dr. Al Habib app needs to access WiFi state permission to connect to the HMG WiFi network from within the app when you visit the hospital.", "ar": "يحتاج تطبيق دكتور الحبيب إلى الوصول إلى الواي فاي للاتصال بشبكة الواي فاي في المجموعة عند زيارة المستشفى." },
"physicalActivityPermission": { "en": "Dr. Al Habib app collects physical activity data to read heart rate, steps & distance from your smartwatch & send it to your doctor.", "ar": "يحتاج تطبيق دكتور الحبيب إلى الوصول إلى بيانات النشاط البدني لقراءة معدل ضربات القلب والخطوات والمسافة من ساعتك الذكية وتحميلها على ملفك الطبي حتى يتمكن الطبيب من الاطلاع عليها." }, "physicalActivityPermission": { "en": "Dr. Al Habib app collects physical activity data to read heart rate, steps & distance from your smartwatch & send it to your doctor.", "ar": "يحتاج تطبيق دكتور الحبيب إلى الوصول إلى بيانات النشاط البدني لقراءة معدل ضربات القلب والخطوات والمسافة من ساعتك الذكية وتحميلها على ملفك الطبي حتى يتمكن الطبيب من الاطلاع عليها." },
"bluetoothPermission": { "en": "Dr. Al Habib app needs to access Bluetooth permission to connect blood pressure & blood sugar devices with the app to analyze the data", "ar": "يحتاج تطبيق دكتور الحبيب إلى الوصول إلى البلوتوث لربط أجهزة ضغط الدم وسكر الدم بالتطبيق لتحليل البيانات وتحميلها على ملفك الطبي حتى يتمكن الطبيب من الاطلاع عليها." } "bluetoothPermission": { "en": "Dr. Al Habib app needs to access Bluetooth permission to connect blood pressure & blood sugar devices with the app to analyze the data", "ar": "يحتاج تطبيق دكتور الحبيب إلى الوصول إلى البلوتوث لربط أجهزة ضغط الدم وسكر الدم بالتطبيق لتحليل البيانات وتحميلها على ملفك الطبي حتى يتمكن الطبيب من الاطلاع عليها." },
"privacyPolicy": {"en": "Privacy Policy", "ar": "سياسة الخصوصية"},
"termsConditions": {"en": "Terms & Conditions", "ar": "الأحكام والشروط"},
"prescriptionDeliveryError": {"en": "This clinic does not support refill & delivery.", "ar": "هذه العيادة لا تدعم إعادة التعبئة والتسليم."},
"liveCarePermissions": {"en": "LiveCare required Camera & Microphone permissions, Please allow these to proceed.", "ar": "هذه العيادة لا تدعم خدمة إعادة التعبئة والتسليم."},
}; };

@ -2,6 +2,7 @@ const TOKEN = 'token';
const APP_LANGUAGE = 'language'; const APP_LANGUAGE = 'language';
const USER_PROFILE = 'user-profile'; const USER_PROFILE = 'user-profile';
const PUSH_TOKEN = 'push-token'; const PUSH_TOKEN = 'push-token';
const APNS_TOKEN = 'apns-token';
const REGISTER_DATA_FOR_REGISTER = 'register-data-for-register'; const REGISTER_DATA_FOR_REGISTER = 'register-data-for-register';
const LOGIN_TOKEN_ID = 'register-data-for-register'; const LOGIN_TOKEN_ID = 'register-data-for-register';
const REGISTER_DATA_FOR_LOGIIN = 'register-data-for-login'; const REGISTER_DATA_FOR_LOGIIN = 'register-data-for-login';

@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffers
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
import 'package:diplomaticquarterapp/pages/appUpdatePage/app_update_page.dart'; import 'package:diplomaticquarterapp/pages/appUpdatePage/app_update_page.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
@ -62,6 +63,9 @@ class BaseAppClient {
if (!isExternal) { if (!isExternal) {
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
if (endPoint == SEND_ACTIVATION_CODE) {
languageID = 'en';
}
if (body.containsKey('SetupID')) { if (body.containsKey('SetupID')) {
body['SetupID'] = body.containsKey('SetupID') body['SetupID'] = body.containsKey('SetupID')
? body['SetupID'] != null ? body['SetupID'] != null
@ -85,7 +89,7 @@ class BaseAppClient {
: IS_DENTAL_ALLOWED_BACKEND; : IS_DENTAL_ALLOWED_BACKEND;
} }
body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; body['DeviceTypeID'] = Platform.isIOS ? 1 : 2;
if (!body.containsKey('IsPublicRequest')) { if (!body.containsKey('IsPublicRequest')) {
body['PatientType'] = body.containsKey('PatientType') body['PatientType'] = body.containsKey('PatientType')
@ -128,7 +132,7 @@ class BaseAppClient {
// body['IdentificationNo'] = 2076117163; // body['IdentificationNo'] = 2076117163;
// body['MobileNo'] = "966503109207"; // body['MobileNo'] = "966503109207";
// body['PatientID'] = 3628809; //3844083 // body['PatientID'] = 50121262; //3844083
// body['TokenID'] = "@dm!n"; // body['TokenID'] = "@dm!n";
// Patient ID: 3027574 // Patient ID: 3027574
@ -146,7 +150,6 @@ class BaseAppClient {
if (await Utils.checkConnection(bypassConnectionCheck: bypassConnectionCheck)) { if (await Utils.checkConnection(bypassConnectionCheck: bypassConnectionCheck)) {
final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers); final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers);
final int statusCode = response.statusCode; final int statusCode = response.statusCode;
// print("statusCode :$statusCode");
if (statusCode < 200 || statusCode >= 400 || json == null) { if (statusCode < 200 || statusCode >= 400 || json == null) {
onFailure('Error While Fetching data', statusCode); onFailure('Error While Fetching data', statusCode);
logApiEndpointError(endPoint, 'Error While Fetching data', statusCode); logApiEndpointError(endPoint, 'Error While Fetching data', statusCode);
@ -261,72 +264,65 @@ class BaseAppClient {
if (!isExternal) { if (!isExternal) {
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); 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') // if (body.containsKey('SetupID')) {
? body['PatientTypeID'] != null // body['SetupID'] = body.containsKey('SetupID')
? body['PatientTypeID'] // ? body['SetupID'] != null
: user['PatientType'] != null // ? body['SetupID']
? user['PatientType'] // : SETUP_ID
: PATIENT_TYPE_ID // : SETUP_ID;
: PATIENT_TYPE_ID; // }
if (user != null) { //
body['TokenID'] = token; // body['VersionID'] = VERSION_ID;
body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID']; // body['Channel'] = CHANNEL;
body['PatientOutSA'] = user['OutSA']; // body['LanguageID'] = languageID == 'ar' ? 1 : 2;
body['SessionID'] = SESSION_ID; //getSe //
// headers = { // body['IPAdress'] = IP_ADDRESS;
// 'Content-Type': 'application/json', // body['generalid'] = GENERAL_ID;
// 'Accept': 'application/json', // body['PatientOutSA'] = body.containsKey('PatientOutSA')
// 'Authorization': pharmacyToken, // ? body['PatientOutSA'] != null
// 'Mobilenumber': user['MobileNumber'].toString(), // ? body['PatientOutSA']
// 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', // : PATIENT_OUT_SA
// 'Username': user['PatientID'].toString(), // : 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("URL : $url");
// print("Body : ${json.encode(body)}"); print("Body : ${json.encode(body)}");
// print("Headers : ${json.encode(headers)}"); print("Headers : ${json.encode(headers)}");
if (await Utils.checkConnection()) { if (await Utils.checkConnection()) {
final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers); final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers);
@ -492,7 +488,7 @@ class BaseAppClient {
'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "", 'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "",
'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
'Username': user != null ? user['PatientID'].toString() : "", 'Username': user != null ? user['PatientID'].toString() : "",
'Host': "mdlaboratories.com", // 'Host': "mdlaboratories.com",
}); });
final int statusCode = response.statusCode; final int statusCode = response.statusCode;
// print("statusCode :$statusCode"); // print("statusCode :$statusCode");

@ -124,9 +124,9 @@ class HomeHealthCareViewModel extends BaseViewModel {
Future addAddressInfo({AddNewAddressRequestModel addNewAddressRequestModel}) async { Future addAddressInfo({AddNewAddressRequestModel addNewAddressRequestModel}) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _pharmacyModuleService.generatePharmacyToken().then((value) async { // await _pharmacyModuleService.generatePharmacyToken().then((value) async {
await _customerAddressesService.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); await _customerAddressesService.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel);
}); // });
if (_customerAddressesService.hasError) { if (_customerAddressesService.hasError) {
error = _customerAddressesService.error; error = _customerAddressesService.error;

@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/privilege/PrivilegeModel.dart'; import 'package:diplomaticquarterapp/core/model/privilege/PrivilegeModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/locator.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/PlatformBridge.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -47,6 +48,9 @@ class ProjectViewModel extends BaseViewModel {
List<PrivilegeModel> get privileges => List<PrivilegeModel> get privileges =>
isLoginChild ? privilegeChildUser : privilegeChildUser; isLoginChild ? privilegeChildUser : privilegeChildUser;
List<LaserBodyPart> selectedBodyPartList = [];
int laserSelectionDuration = 0;
StreamSubscription subscription; StreamSubscription subscription;
ProjectViewModel() { ProjectViewModel() {

@ -74,7 +74,7 @@ class _MyApp extends State<MyApp> {
// var font = projectProvider.isArabic ? 'Cairo' : 'WorkSans'; // var font = projectProvider.isArabic ? 'Cairo' : 'WorkSans';
// Re-enable once going live // Re-enable once going live
// if (Platform.isAndroid) checkForUpdate(); if (Platform.isAndroid) checkForUpdate();
ThemeNotifier(defaultTheme()); ThemeNotifier(defaultTheme());
super.initState(); super.initState();

@ -0,0 +1,23 @@
class LocationDetails {
double _lat;
double _long;
String _formattedAddress;
double get lat => _lat;
set lat(double lat) {
_lat = lat;
}
double get long => _long;
set long(double long) {
_long = long;
}
String get formattedAddress => _formattedAddress;
set formattedAddress(String formattedAddress) {
_formattedAddress = formattedAddress;
}
}

@ -1,18 +1,28 @@
import 'dart:io';
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.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/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/app_map/google_huawei_map.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart';
import 'package:geocoding/geocoding.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -23,7 +33,6 @@ class CMCLocationPage extends StatefulWidget {
final double longitude; final double longitude;
final dynamic model; final dynamic model;
const CMCLocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) : super(key: key); const CMCLocationPage({Key key, this.onPick, this.latitude, this.longitude, this.model}) : super(key: key);
@override @override
@ -35,10 +44,40 @@ class _CMCLocationPageState extends State<CMCLocationPage> {
double longitude = 0; double longitude = 0;
bool showCurrentLocation = false; bool showCurrentLocation = false;
Function onPick; Function onPick;
bool isHuawei = false;
Placemark selectedPlace;
AppMap appMap;
static CameraPosition _kGooglePlex = CameraPosition(
target: LatLng(37.42796133580664, -122.085749655962),
zoom: 14.4746,
);
LatLng currentPostion;
AppSharedPreferences sharedPref = AppSharedPreferences();
@override @override
void initState() { void initState() {
onPick=widget.onPick; checkIsHuawei();
appMap = AppMap(
_kGooglePlex.toMap(),
onCameraMove: (camera) {
_updatePosition(camera);
},
onMapCreated: () {
currentPostion = LatLng(widget.latitude, widget.longitude);
latitude = widget.latitude;
longitude = widget.longitude;
_getUserLocation();
setState(() {});
},
onCameraIdle: () async {
List<Placemark> placemarks = await placemarkFromCoordinates(latitude, longitude);
selectedPlace = placemarks[0];
print(selectedPlace);
},
);
onPick = widget.onPick;
latitude = widget.latitude; latitude = widget.latitude;
longitude = widget.longitude; longitude = widget.longitude;
if (latitude == 0.0 && longitude == 0.0) { if (latitude == 0.0 && longitude == 0.0) {
@ -47,6 +86,12 @@ class _CMCLocationPageState extends State<CMCLocationPage> {
super.initState(); super.initState();
} }
checkIsHuawei() async {
isHuawei = await FlutterHmsGmsAvailability.isHmsAvailable;
print(isHuawei);
setState(() {});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
@ -65,89 +110,194 @@ class _CMCLocationPageState extends State<CMCLocationPage> {
ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png'), ImagesInfo(imageAr: 'https://hmgwebservices.com/Images/MobileApp/CMC/ar/0.png', imageEn: 'https://hmgwebservices.com/Images/MobileApp/CMC/en/0.png'),
], ],
appBarTitle: TranslationBase.of(context).addNewAddress, appBarTitle: TranslationBase.of(context).addNewAddress,
body: PlacePicker( body: isHuawei
apiKey: GOOGLE_API_KEY, ? Column(
enableMyLocationButton: true, children: [
automaticallyImplyAppBarLeading: false, Expanded(
autocompleteOnTrailingWhitespace: true, child: Stack(
selectInitialPosition: true, alignment: Alignment.center,
autocompleteLanguage: projectViewModel.currentLanguage, children: [
enableMapTypeButton: true, if (appMap != null) appMap,
searchForInitialValue: false, Container(
onPlacePicked: (PickResult result) { margin: EdgeInsets.only(bottom: 50.0),
print(result.adrAddress); child: Icon(
}, Icons.place,
selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { color: CustomColors.accentColor,
print("state: $state, isSearchBarFocused: $isSearchBarFocused"); size: 50,
),
return isSearchBarFocused ),
? Container() ],
: FloatingCard( ),
bottomPosition: 0.0, ),
leftPosition: 0.0, Container(
rightPosition: 0.0, padding: const EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14),
width: 500, child: DefaultButton(TranslationBase.of(context).addNewAddress, () async {
borderRadius: BorderRadius.circular(12.0), AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel(
child: state == SearchingState.Searching customer: Customer(addresses: [
? Center(child: CircularProgressIndicator()) Addresses(
: Container( address1: selectedPlace.street,
margin: EdgeInsets.all(12), address2: selectedPlace.street,
child: Column( customerAttributes: "",
children: [ city: selectedPlace.administrativeArea,
SecondaryButton( createdOnUtc: "",
color: CustomColors.accentColor, id: "0",
textColor: Colors.white, faxNumber: "",
onTap: () async { phoneNumber: projectViewModel.user.mobileNumber,
print(selectedPlace); province: selectedPlace.administrativeArea,
AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel( countryId: 69,
customer: Customer( latLong: latitude.toStringAsFixed(6) + "," + longitude.toStringAsFixed(6),
addresses: [ country: selectedPlace.country,
Addresses( zipPostalCode: selectedPlace.postalCode,
address1: selectedPlace.formattedAddress, email: projectViewModel.user.emailAddress)
address2: selectedPlace.formattedAddress, ]),
customerAttributes: "", );
city: "", await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel);
createdOnUtc: "", if (model.state == ViewState.ErrorLocal) {
id: "0", Utils.showErrorToast(model.error);
latLong: selectedPlace.geometry.location.lat.toString() + "," + selectedPlace.geometry.location.lng.toString(), } else {
email: "", AppToast.showSuccessToast(message: "Address Added Successfully");
) }
], Navigator.of(context).pop(addNewAddressRequestModel);
}),
),
],
)
: 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) {
print("state: $state, isSearchBarFocused: $isSearchBarFocused");
return isSearchBarFocused
? Container()
: FloatingCard(
bottomPosition: 0.0,
leftPosition: 0.0,
rightPosition: 0.0,
width: 500,
borderRadius: BorderRadius.circular(12.0),
child: state == SearchingState.Searching
? Center(child: CircularProgressIndicator())
: Container(
margin: EdgeInsets.all(12),
child: Column(
children: [
SecondaryButton(
color: CustomColors.accentColor,
textColor: Colors.white,
onTap: () async {
print(selectedPlace);
AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel(
customer: Customer(
addresses: [
Addresses(
address1: selectedPlace.formattedAddress,
address2: selectedPlace.formattedAddress,
customerAttributes: "",
city: "",
createdOnUtc: "",
id: "0",
latLong: selectedPlace.geometry.location.lat.toString() + "," + selectedPlace.geometry.location.lng.toString(),
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 {
onPick();
AppToast.showSuccessToast(message: "Address Added Successfully");
}
Navigator.of(context).pop();
},
label: TranslationBase.of(context).addNewAddress,
), ),
); ],
),
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 {
onPick();
AppToast.showSuccessToast(message: "Address Added Successfully");
}
Navigator.of(context).pop();
},
label: TranslationBase.of(context).addNewAddress,
), ),
], );
), },
), initialPosition: LatLng(latitude, longitude),
); useCurrentLocation: showCurrentLocation,
}, ),
initialPosition: LatLng(latitude, longitude),
useCurrentLocation: showCurrentLocation,
),
), ),
); );
} }
void _getUserLocation() async {
if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) {
var lat = await this.sharedPref.getDouble(USER_LAT);
var long = await this.sharedPref.getDouble(USER_LONG);
latitude = lat;
longitude = long;
currentPostion = LatLng(lat, long);
setMap();
} else {
if (await PermissionService.isLocationEnabled()) {
Geolocator.getLastKnownPosition().then((value) {
latitude = value.latitude;
longitude = value.longitude;
currentPostion = LatLng(latitude, longitude);
setMap();
});
} else {
if (Platform.isAndroid) {
Utils.showPermissionConsentDialog(context, TranslationBase.of(context).locationPermissionDialog, () {
Geolocator.getLastKnownPosition().then((value) {
latitude = value.latitude;
longitude = value.longitude;
currentPostion = LatLng(latitude, longitude);
setMap();
});
});
} else {
Geolocator.getLastKnownPosition().then((value) {
latitude = value.latitude;
longitude = value.longitude;
setMap();
});
}
}
}
}
setMap() {
setState(() {
_kGooglePlex = CameraPosition(
target: currentPostion,
zoom: 14.4746,
);
appMap.moveTo(cameraPostion: _kGooglePlex);
});
}
void _updatePosition(CameraPosition _position) {
print(_position);
latitude = _position.target.latitude;
longitude = _position.target.longitude;
}
} }

@ -1,11 +1,14 @@
import 'dart:async'; import 'dart:io';
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_health_care_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.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_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -15,7 +18,9 @@ import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart';
import 'package:geocoding/geocoding.dart'; import 'package:geocoding/geocoding.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -37,6 +42,10 @@ class _LocationPageState extends State<LocationPage> {
double longitude = 0; double longitude = 0;
bool showCurrentLocation = false; bool showCurrentLocation = false;
GoogleMapController mapController;
bool isHuawei = false;
AppMap appMap; AppMap appMap;
AppSharedPreferences sharedPref = AppSharedPreferences(); AppSharedPreferences sharedPref = AppSharedPreferences();
static CameraPosition _kGooglePlex = CameraPosition( static CameraPosition _kGooglePlex = CameraPosition(
@ -44,13 +53,15 @@ class _LocationPageState extends State<LocationPage> {
zoom: 14.4746, zoom: 14.4746,
); );
LatLng currentPostion; LatLng currentPostion;
Completer<GoogleMapController> mapController = Completer();
// Completer<GoogleMapController> mapController = Completer();
Placemark selectedPlace; Placemark selectedPlace;
@override @override
void initState() { void initState() {
latitude = widget.latitude; latitude = widget.latitude;
longitude = widget.longitude; longitude = widget.longitude;
checkIsHuawei();
if (latitude == 0.0 && longitude == 0.0) { if (latitude == 0.0 && longitude == 0.0) {
showCurrentLocation = true; showCurrentLocation = true;
} }
@ -63,12 +74,13 @@ class _LocationPageState extends State<LocationPage> {
currentPostion = LatLng(widget.latitude, widget.longitude); currentPostion = LatLng(widget.latitude, widget.longitude);
latitude = widget.latitude; latitude = widget.latitude;
longitude = widget.longitude; longitude = widget.longitude;
setMap(); _getUserLocation();
setState(() {}); setState(() {});
}, },
onCameraIdle: () async { onCameraIdle: () async {
List<Placemark> placemarks = await placemarkFromCoordinates(latitude, longitude); List<Placemark> placemarks = await placemarkFromCoordinates(latitude, longitude);
selectedPlace = placemarks[0]; selectedPlace = placemarks[0];
print(selectedPlace);
}, },
); );
super.initState(); super.initState();
@ -86,136 +98,173 @@ class _LocationPageState extends State<LocationPage> {
baseViewModel: model, baseViewModel: model,
showNewAppBarTitle: true, showNewAppBarTitle: true,
showNewAppBar: true, showNewAppBar: true,
body: body: isHuawei
// Column( ? Column(
// children: [ children: [
// Expanded( Expanded(
// child: Stack( child: Stack(
// alignment: Alignment.center, alignment: Alignment.center,
// children: [ children: [
// if (appMap != null) appMap, if (appMap != null) appMap,
// Container( Container(
// margin: EdgeInsets.only(bottom: 50.0), margin: EdgeInsets.only(bottom: 50.0),
// child: Icon( child: Icon(
// Icons.place, Icons.place,
// color: CustomColors.accentColor, color: CustomColors.accentColor,
// size: 50, size: 50,
// ), ),
// ), ),
// ], ],
// ), ),
// ), ),
// Container( Container(
// padding: const EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14), padding: const EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14),
// child: DefaultButton(TranslationBase.of(context).addNewAddress, () async { child: DefaultButton(TranslationBase.of(context).addNewAddress, () async {
// AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel( AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel(
// customer: Customer(addresses: [ customer: Customer(addresses: [
// Addresses( Addresses(
// address1: selectedPlace.name, address1: selectedPlace.street,
// address2: selectedPlace.street, address2: selectedPlace.street,
// customerAttributes: "", customerAttributes: "",
// city: selectedPlace.locality, city: selectedPlace.administrativeArea,
// createdOnUtc: "", createdOnUtc: "",
// id: "0", id: "0",
// faxNumber: "", faxNumber: "",
// phoneNumber: projectViewModel.user.mobileNumber, phoneNumber: projectViewModel.user.mobileNumber,
// province: selectedPlace.locality, province: selectedPlace.administrativeArea,
// countryId: 69, countryId: 69,
// latLong: "$latitude,$longitude", latLong: latitude.toStringAsFixed(6) + "," + longitude.toStringAsFixed(6),
// country: selectedPlace.country, country: selectedPlace.country,
// zipPostalCode: selectedPlace.postalCode, zipPostalCode: selectedPlace.postalCode,
// email: projectViewModel.user.emailAddress) email: projectViewModel.user.emailAddress)
// ]), ]),
// ); );
// await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel);
// if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
// Utils.showErrorToast(model.error); Utils.showErrorToast(model.error);
// } else { } else {
// AppToast.showSuccessToast(message: "Address Added Successfully"); AppToast.showSuccessToast(message: "Address Added Successfully");
// } }
// Navigator.of(context).pop(addNewAddressRequestModel); Navigator.of(context).pop(addNewAddressRequestModel);
// }), }),
// ), ),
// ], ],
// ), )
: PlacePicker(
PlacePicker( apiKey: GOOGLE_API_KEY,
apiKey: GOOGLE_API_KEY, enableMyLocationButton: true,
enableMyLocationButton: true, automaticallyImplyAppBarLeading: false,
automaticallyImplyAppBarLeading: false, autocompleteOnTrailingWhitespace: true,
autocompleteOnTrailingWhitespace: true, selectInitialPosition: true,
selectInitialPosition: true, autocompleteLanguage: projectViewModel.currentLanguage,
autocompleteLanguage: projectViewModel.currentLanguage, enableMapTypeButton: true,
enableMapTypeButton: true, searchForInitialValue: false,
searchForInitialValue: false, onMapCreated: (GoogleMapController controller) {
onPlacePicked: (PickResult result) { mapController = controller;
print(result.adrAddress); },
}, onPlacePicked: (PickResult result) {
selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) { print(result.adrAddress);
return isSearchBarFocused },
? Container() selectedPlaceWidgetBuilder: (_, selectedPlace, state, isSearchBarFocused) {
: FloatingCard( print("state: $state, isSearchBarFocused: $isSearchBarFocused");
bottomPosition: 0.0, return isSearchBarFocused
leftPosition: 0.0, ? Container()
rightPosition: 0.0, : FloatingCard(
width: 500, bottomPosition: 0.0,
borderRadius: BorderRadius.circular(0.0), leftPosition: 0.0,
child: state == SearchingState.Searching rightPosition: 0.0,
? SizedBox(height: 43, child: Center(child: CircularProgressIndicator())).insideContainer width: 500,
: DefaultButton(TranslationBase.of(context).addNewAddress, () async { borderRadius: BorderRadius.circular(0.0),
AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel( child: state == SearchingState.Searching
customer: Customer(addresses: [ ? SizedBox(height: 43, child: Center(child: CircularProgressIndicator())).insideContainer
Addresses( : DefaultButton(TranslationBase.of(context).addNewAddress, () async {
address1: selectedPlace.formattedAddress, AddNewAddressRequestModel addNewAddressRequestModel = new AddNewAddressRequestModel(
address2: selectedPlace.formattedAddress, customer: Customer(addresses: [
customerAttributes: "", Addresses(
createdOnUtc: "", address1: selectedPlace.formattedAddress,
id: "0", address2: selectedPlace.formattedAddress,
faxNumber: "", customerAttributes: "",
phoneNumber: projectViewModel.user.mobileNumber, createdOnUtc: "",
countryId: 69, id: "0",
latLong: "$latitude,$longitude", faxNumber: "",
email: projectViewModel.user.emailAddress) phoneNumber: projectViewModel.user.mobileNumber,
// Addresses( countryId: 69,
// address1: selectedPlace.formattedAddress, latLong: selectedPlace.geometry.location.lat.toString() + "," + selectedPlace.geometry.location.lng.toString(),
// address2: selectedPlace.formattedAddress, email: projectViewModel.user.emailAddress)
// customerAttributes: "", ]),
// city: "", );
// createdOnUtc: "",
// id: "0", selectedPlace.addressComponents.forEach((e) {
// latLong: "${selectedPlace.geometry.location}", if (e.types.contains("country")) {
// email: "") addNewAddressRequestModel.customer.addresses[0].country = e.longName;
]), }
); if (e.types.contains("postal_code")) {
addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName;
selectedPlace.addressComponents.forEach((e) { }
if (e.types.contains("country")) { if (e.types.contains("locality")) {
addNewAddressRequestModel.customer.addresses[0].country = e.longName; addNewAddressRequestModel.customer.addresses[0].city = e.longName;
} }
if (e.types.contains("postal_code")) { });
addNewAddressRequestModel.customer.addresses[0].zipPostalCode = e.longName;
} await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel);
if (e.types.contains("locality")) { if (model.state == ViewState.ErrorLocal) {
addNewAddressRequestModel.customer.addresses[0].city = e.longName; Utils.showErrorToast(model.error);
} } else {
}); AppToast.showSuccessToast(message: "Address Added Successfully");
}
await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel); Navigator.of(context).pop(addNewAddressRequestModel);
if (model.state == ViewState.ErrorLocal) { }).insideContainer);
Utils.showErrorToast(model.error); },
} else { initialPosition: LatLng(latitude, longitude),
AppToast.showSuccessToast(message: "Address Added Successfully"); useCurrentLocation: showCurrentLocation,
} ),
Navigator.of(context).pop(addNewAddressRequestModel);
}).insideContainer);
},
initialPosition: LatLng(latitude, longitude),
useCurrentLocation: showCurrentLocation,
),
), ),
); );
} }
checkIsHuawei() async {
isHuawei = await FlutterHmsGmsAvailability.isHmsAvailable;
print(isHuawei);
setState(() {});
}
void _getUserLocation() async {
if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) {
var lat = await this.sharedPref.getDouble(USER_LAT);
var long = await this.sharedPref.getDouble(USER_LONG);
latitude = lat;
longitude = long;
currentPostion = LatLng(lat, long);
setMap();
} else {
if (await PermissionService.isLocationEnabled()) {
Geolocator.getLastKnownPosition().then((value) {
latitude = value.latitude;
longitude = value.longitude;
currentPostion = LatLng(latitude, longitude);
setMap();
});
} else {
if (Platform.isAndroid) {
Utils.showPermissionConsentDialog(context, TranslationBase.of(context).locationPermissionDialog, () {
Geolocator.getLastKnownPosition().then((value) {
latitude = value.latitude;
longitude = value.longitude;
currentPostion = LatLng(latitude, longitude);
setMap();
});
});
} else {
Geolocator.getLastKnownPosition().then((value) {
latitude = value.latitude;
longitude = value.longitude;
setMap();
});
}
}
}
}
setMap() { setMap() {
setState(() { setState(() {
_kGooglePlex = CameraPosition( _kGooglePlex = CameraPosition(
@ -227,6 +276,7 @@ class _LocationPageState extends State<LocationPage> {
} }
void _updatePosition(CameraPosition _position) { void _updatePosition(CameraPosition _position) {
print(_position);
latitude = _position.target.latitude; latitude = _position.target.latitude;
longitude = _position.target.longitude; longitude = _position.target.longitude;
} }

@ -66,6 +66,9 @@ class _NewHomeHealthCareStepTowPageState extends State<NewHomeHealthCareStepTowP
_getUserLocation(); _getUserLocation();
setState(() {}); setState(() {});
}, },
onCameraIdle: () {
print("onCameraIdle");
},
); );
super.initState(); super.initState();
} }
@ -194,7 +197,10 @@ class _NewHomeHealthCareStepTowPageState extends State<NewHomeHealthCareStepTowP
longitude: longitude, longitude: longitude,
), ),
), ),
); ).then((value) {
print(value);
widget.model.getCustomerAddresses();
});
}, },
child: Padding( child: Padding(
padding: EdgeInsets.only(left: 12, right: 12, bottom: 16, top: 8), padding: EdgeInsets.only(left: 12, right: 12, bottom: 16, top: 8),
@ -214,30 +220,6 @@ class _NewHomeHealthCareStepTowPageState extends State<NewHomeHealthCareStepTowP
), ),
), ),
), ),
// Expanded(
// child: Stack(
// alignment: Alignment.center,
// children: [
// GoogleMap(
// mapType: MapType.normal,
// zoomControlsEnabled: false,
// myLocationButtonEnabled: true,
// myLocationEnabled: true,
// initialCameraPosition: _kGooglePlex,
// onCameraMove: ((_position) => _updatePosition(_position)),
// onMapCreated: (GoogleMapController controller) {
// googleMapController = controller;
// _controller.complete(controller);
// },
// ),
// Icon(
// Icons.place,
// color: CustomColors.accentColor,
// size: 50,
// ),
// ],
// ),
// ),
Expanded( Expanded(
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,

@ -382,7 +382,7 @@ class _AnicllaryOrdersState extends State<AnicllaryOrdersDetails> with SingleTic
makePayment() { makePayment() {
showDraggableDialog(context, PaymentMethod( showDraggableDialog(context, PaymentMethod(
onSelectedMethod: (String method) { onSelectedMethod: (String method, [String selectedInstallmentPlan]) {
selectedPaymentMethod = method; selectedPaymentMethod = method;
print(selectedPaymentMethod); print(selectedPaymentMethod);
openPayment(selectedPaymentMethod, projectViewModel.authenticatedUserObject.user, double.parse(getTotalValue()), null); openPayment(selectedPaymentMethod, projectViewModel.authenticatedUserObject.user, double.parse(getTotalValue()), null);

@ -1,7 +1,6 @@
import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -52,12 +51,18 @@ class _IdealBodyState extends State<IdealBody> {
List<PopupMenuItem> _heightPopupList = List(); List<PopupMenuItem> _heightPopupList = List();
List<PopupMenuItem> _weightPopupList = List(); List<PopupMenuItem> _weightPopupList = List();
void calculateIdealWeight() { void calculateIdealWeight() {
heightInches = int.parse(_heightController.text) * .39370078740157477; var height = int.parse(_heightController.text);
heightFeet = heightInches / 12; var weight = double.parse(_weightController.text);
idealWeight = (50 + 2.3 * (heightInches - 60)); var inchesVal = ((height) * .39370078740157477);
var meters = height / 100;
var feetVal = (inchesVal / 12).floor().round();
inchesVal = (inchesVal % 12).roundToDouble();
var kgValue = (weight * 2.2).floor();
var heightFeet = feetVal;
var heightInches = inchesVal;
weight = kgValue.floorToDouble();
var idealWeight = (((((heightFeet * 12) + heightInches) - 60) * 6) + 106);
if (dropdownValue == TranslationBase.of(context).smallFinger) { if (dropdownValue == TranslationBase.of(context).smallFinger) {
idealWeight = idealWeight - 10; idealWeight = idealWeight - 10;
} else if (dropdownValue == TranslationBase.of(context).mediumFinger) { } else if (dropdownValue == TranslationBase.of(context).mediumFinger) {
@ -65,18 +70,22 @@ class _IdealBodyState extends State<IdealBody> {
} else if (dropdownValue == TranslationBase.of(context).largeFinger) { } else if (dropdownValue == TranslationBase.of(context).largeFinger) {
idealWeight = idealWeight + 10; idealWeight = idealWeight + 10;
} }
var maxIdealWeight = (((idealWeight).floorToDouble() * 1.1) * 100).round() / 100;
maxIdealWeight = (((idealWeight) * 1.1).round() * 100) / 100; var overWeightBy = ((weight - double.parse(maxIdealWeight.toString())) * 100).round() / 100;
overWeightBy = weight - maxIdealWeight.roundToDouble(); var difference = (((overWeightBy / 2.2) * 100) / 100).round(); //+ Loc.healthCalPage.IBWKg; Loc.healthCalPage.IBWRange
minRange = ((idealWeight / 1.1) * 10).round() / 10; var minRange = ((idealWeight / 2.2) * 10).round() / 10;
maxRange = maxIdealWeight; var maxRange = ((maxIdealWeight / 2.2) * 100).round() / 100; //+ //Loc.healthCalPage.IBWKg;
idealWeight = idealWeight; idealWeight = weight / idealWeight;
idealWeight = (idealWeight * 100).round() / 100;
this.overWeightBy = overWeightBy;
this.minRange = minRange;
this.maxRange = maxIdealWeight;
this.idealWeight = idealWeight;
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if(dropdownValue==null) if (dropdownValue == null) dropdownValue = TranslationBase.of(context).mediumFinger;
dropdownValue=TranslationBase.of(context).mediumFinger;
_weightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)]; _weightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)];
_heightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)]; _heightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)];
@ -200,7 +209,8 @@ class _IdealBodyState extends State<IdealBody> {
child: DropdownButtonHideUnderline( child: DropdownButtonHideUnderline(
child: DropdownButton<String>( child: DropdownButton<String>(
value: dropdownValue, value: dropdownValue,
icon: Icon(Icons.arrow_downward), key: clinicDropdownKey, icon: Icon(Icons.arrow_downward),
key: clinicDropdownKey,
iconSize: 0, iconSize: 0,
elevation: 16, elevation: 16,
isExpanded: true, isExpanded: true,
@ -500,5 +510,3 @@ class CommonDropDownView extends StatelessWidget {
); );
} }
} }

@ -5,7 +5,6 @@ import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -33,7 +32,6 @@ class IdealBodyResult extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(20.0), padding: const EdgeInsets.all(20.0),
child: Column( child: Column(
@ -60,7 +58,7 @@ class IdealBodyResult extends StatelessWidget {
Padding( Padding(
padding: EdgeInsets.only(top: 8.0, left: 4.0), padding: EdgeInsets.only(top: 8.0, left: 4.0),
child: Text( child: Text(
" "+TranslationBase.of(context).kg+" ", " " + TranslationBase.of(context).kg + " ",
style: TextStyle(color: Colors.red), style: TextStyle(color: Colors.red),
), ),
), ),
@ -74,13 +72,13 @@ class IdealBodyResult extends StatelessWidget {
Row( Row(
children: [ children: [
Texts( Texts(
mixRange.toStringAsFixed(1), (mixRange / 2.2).toStringAsFixed(1),
fontSize: 30.0, fontSize: 30.0,
), ),
Padding( Padding(
padding: EdgeInsets.only(top: 8.0, left: 4.0), padding: EdgeInsets.only(top: 8.0, left: 4.0),
child: Text( child: Text(
" "+TranslationBase.of(context).kg+" ", " " + TranslationBase.of(context).kg + " ",
style: TextStyle(color: Colors.red), style: TextStyle(color: Colors.red),
), ),
), ),
@ -93,7 +91,7 @@ class IdealBodyResult extends StatelessWidget {
? Column( ? Column(
children: [ children: [
Texts( Texts(
TranslationBase.of(context).currentWeightPerfect, TranslationBase.of(context).currentWeightPerfect,
fontSize: 20.0, fontSize: 20.0,
), ),
], ],
@ -108,7 +106,6 @@ class IdealBodyResult extends StatelessWidget {
) )
: overWeightBy >= 18 : overWeightBy >= 18
? Container( ? Container(
child: Column( child: Column(
children: [ children: [
Texts( Texts(
@ -117,13 +114,21 @@ class IdealBodyResult extends StatelessWidget {
SizedBox( SizedBox(
height: 12.0, height: 12.0,
), ),
Text( Row(
overWeightBy.toStringAsFixed(1), mainAxisAlignment: MainAxisAlignment.center,
style: TextStyle( children: [
fontSize: 17, Texts(
fontWeight: FontWeight.bold, (overWeightBy / 2.2).toStringAsFixed(1),
letterSpacing: -1.34, fontSize: 30.0,
), ),
Padding(
padding: EdgeInsets.only(top: 8.0, left: 4.0),
child: Text(
" " + TranslationBase.of(context).kg + " ",
style: TextStyle(color: Colors.red),
),
),
],
), ),
SizedBox( SizedBox(
height: 12.0, height: 12.0,
@ -139,7 +144,7 @@ class IdealBodyResult extends StatelessWidget {
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Texts( child: Texts(
TranslationBase.of(context).underWeight, TranslationBase.of(context).underWeight,
fontSize: 18.0, fontSize: 18.0,
), ),
), ),
@ -157,7 +162,6 @@ class IdealBodyResult extends StatelessWidget {
], ],
) )
: Container( : Container(
child: Column( child: Column(
children: [ children: [
Text( Text(

@ -1,397 +0,0 @@
// import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
// import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
// import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
// import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart';
// import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart';
// import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart';
// import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
// import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
// import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart';
// import 'package:diplomaticquarterapp/pages/base/base_view.dart';
// import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectHospitalDialog.dart';
// import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
// import 'package:diplomaticquarterapp/uitl/app_toast.dart';
// import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
// import 'package:diplomaticquarterapp/uitl/utils.dart';
// import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
// import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
// import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
// import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
// import 'package:flutter/cupertino.dart';
// import 'package:flutter/material.dart';
// import 'package:smart_progress_bar/smart_progress_bar.dart';
//
// //import '../../../core/model/my_balance/AdvanceModel.dart';
// import 'confirm_payment_page.dart';
// import 'dialogs/SelectBeneficiaryDialog.dart';
// import 'dialogs/SelectPatientFamilyDialog.dart';
// import 'dialogs/SelectPatientInfoDialog.dart';
// import 'new_text_Field.dart';
//
// enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON }
//
// class AdvancePaymentPage extends StatefulWidget {
// @override
// _AdvancePaymentPageState createState() => _AdvancePaymentPageState();
// }
//
// class _AdvancePaymentPageState extends State<AdvancePaymentPage> {
// TextEditingController _fileTextController = TextEditingController();
// TextEditingController _notesTextController = TextEditingController();
// BeneficiaryType beneficiaryType = BeneficiaryType.NON;
// HospitalsModel _selectedHospital;
// String amount = "";
// String email;
// PatientInfo _selectedPatientInfo;
// AuthenticatedUser authenticatedUser;
// GetAllSharedRecordsByStatusList selectedPatientFamily;
// AdvanceModel advanceModel = AdvanceModel();
//
// AppSharedPreferences sharedPref = AppSharedPreferences();
// AuthenticatedUser authUser;
//
// @override
// void initState() {
// super.initState();
// getAuthUser();
// }
//
// @override
// Widget build(BuildContext context) {
// return BaseView<MyBalanceViewModel>(
// onModelReady: (model) => model.getHospitals(),
// builder: (_, model, w) => AppScaffold(
// isShowAppBar: true,
// appBarTitle: TranslationBase.of(context).advancePayment,
// body: SingleChildScrollView(
// physics: ScrollPhysics(),
// child: Container(
// margin: EdgeInsets.all(12),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Texts(
// TranslationBase.of(context).advancePaymentLabel,
// textAlign: TextAlign.center,
// ),
// SizedBox(
// height: 12,
// ),
// InkWell(
// onTap: () => confirmSelectBeneficiaryDialog(model),
// child: Container(
// padding: EdgeInsets.all(12),
// width: double.infinity,
// height: 65,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(12),
// color: Colors.white),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Texts(getBeneficiaryType()),
// Icon(Icons.arrow_drop_down)
// ],
// ),
// ),
// ),
// if (beneficiaryType == BeneficiaryType.MyFamilyFiles)
// SizedBox(
// height: 12,
// ),
// if (beneficiaryType == BeneficiaryType.MyFamilyFiles)
// InkWell(
// onTap: () {
// model.getFamilyFiles().then((value) {
// confirmSelectFamilyDialog(model
// .getAllSharedRecordsByStatusResponse
// .getAllSharedRecordsByStatusList);
// }).showProgressBar(
// text: "Loading",
// backgroundColor: Colors.blue.withOpacity(0.6));
// },
// child: Container(
// padding: EdgeInsets.all(12),
// width: double.infinity,
// height: 65,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(12),
// color: Colors.white),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Texts(getFamilyMembersName()),
// Icon(Icons.arrow_drop_down)
// ],
// ),
// ),
// ),
// SizedBox(
// height: 12,
// ),
// NewTextFields(
// hintText: TranslationBase.of(context).fileNumber,
// controller: _fileTextController,
// ),
// if (beneficiaryType == BeneficiaryType.OtherAccount)
// SizedBox(
// height: 12,
// ),
// if (beneficiaryType == BeneficiaryType.OtherAccount)
// InkWell(
// onTap: () {
// if (_fileTextController.text.isNotEmpty)
// model
// .getPatientInfoByPatientID(
// id: _fileTextController.text)
// .then((value) {
// confirmSelectPatientDialog(model.patientInfoList);
// }).showProgressBar(
// text: "Loading",
// backgroundColor:
// Colors.blue.withOpacity(0.6));
// else
// AppToast.showErrorToast(
// message: 'Please Enter The File Number');
// },
// child: Container(
// padding: EdgeInsets.all(12),
// width: double.infinity,
// height: 65,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(12),
// color: Colors.white),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Texts(getPatientName()),
// Icon(Icons.arrow_drop_down)
// ],
// ),
// ),
// ),
// SizedBox(
// height: 12,
// ),
// InkWell(
// onTap: () => confirmSelectHospitalDialog(model.hospitals),
// child: Container(
// padding: EdgeInsets.all(12),
// width: double.infinity,
// height: 65,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(12),
// color: Colors.white),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Texts(getHospitalName()),
// Icon(Icons.arrow_drop_down)
// ],
// ),
// ),
// ),
// SizedBox(
// height: 12,
// ),
// NewTextFields(
// hintText: TranslationBase.of(context).amount,
// keyboardType: TextInputType.number,
// onChanged: (value) {
// setState(() {
// amount = value;
// });
// },
// ),
// SizedBox(
// height: 12,
// ),
// NewTextFields(
// hintText: TranslationBase.of(context).depositorEmail,
// initialValue: model.user.emailAddress,
// onChanged: (value) {
// email = value;
// },
// ),
// SizedBox(
// height: 12,
// ),
// NewTextFields(
// hintText: TranslationBase.of(context).notes,
// controller: _notesTextController,
// ),
// SizedBox(
// height: MediaQuery.of(context).size.height * 0.15,
// )
// ],
// ),
// ),
// ),
// bottomSheet: Container(
// height: MediaQuery.of(context).size.height * 0.1,
// width: double.infinity,
// padding: EdgeInsets.all(12),
// child: SecondaryButton(
// textColor: Colors.white,
// label: TranslationBase.of(context).submit,
// disabled: amount.isEmpty ||
// _fileTextController.text.isEmpty ||
// _selectedHospital == null,
// onTap: () {
// advanceModel.fileNumber = _fileTextController.text;
// advanceModel.hospitalsModel = _selectedHospital;
// advanceModel.note = _notesTextController.text;
// advanceModel.email = email ?? model.user.emailAddress;
// advanceModel.amount = amount;
//
// model.getPatientInfoByPatientIDAndMobileNumber().then((value) {
// if (model.state != ViewState.Error &&
// model.state != ViewState.ErrorLocal) {
// Utils.hideKeyboard(context);
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => PaymentMethod())).then(
// (value) {
// Navigator.push(
// context,
// FadePage(
// page: ConfirmPaymentPage(
// advanceModel: advanceModel,
// selectedPaymentMethod: value,
// patientInfoAndMobileNumber:
// model.patientInfoAndMobileNumber,
// authenticatedUser: authUser,
// ),
// ),
// );
// },
// );
// }
// }).showProgressBar(
// text: "Loading",
// backgroundColor: Colors.blue.withOpacity(0.6));
// },
// ),
// )),
// );
// }
//
// void confirmSelectBeneficiaryDialog(MyBalanceViewModel model) {
// showDialog(
// context: context,
// child: SelectBeneficiaryDialog(
// beneficiaryType: beneficiaryType,
// onValueSelected: (value) {
// setState(() {
// if (value == BeneficiaryType.MyAccount) {
// _fileTextController.text = model.user.patientID.toString();
// advanceModel.depositorName =
// model.user.firstName + " " + model.user.lastName;
// } else
// _fileTextController.text = "";
//
// beneficiaryType = value;
// });
// },
// ),
// );
// }
//
// void confirmSelectHospitalDialog(List<HospitalsModel> hospitals) {
// showDialog(
// context: context,
// child: SelectHospitalDialog(
// hospitals: hospitals,
// selectedHospital: _selectedHospital,
// onValueSelected: (value) {
// setState(() {
// _selectedHospital = value;
// });
// },
// ),
// );
// }
//
// void confirmSelectPatientDialog(List<PatientInfo> patientInfoList) {
// showDialog(
// context: context,
// child: SelectPatientInfoDialog(
// patientInfoList: patientInfoList,
// selectedPatientInfo: _selectedPatientInfo,
// onValueSelected: (value) {
// setState(() {
// advanceModel.depositorName = value.fullName;
// _selectedPatientInfo = value;
// });
// },
// ),
// );
// }
//
// void confirmSelectFamilyDialog(
// List<GetAllSharedRecordsByStatusList> getAllSharedRecordsByStatusList) {
// showDialog(
// context: context,
// child: SelectPatientFamilyDialog(
// getAllSharedRecordsByStatusList: getAllSharedRecordsByStatusList,
// selectedPatientFamily: selectedPatientFamily,
// onValueSelected: (value) {
// setState(() {
// selectedPatientFamily = value;
// _fileTextController.text =
// selectedPatientFamily.patientID.toString();
// advanceModel.depositorName = value.patientName;
// });
// },
// ),
// );
// }
//
// String getBeneficiaryType() {
// switch (beneficiaryType) {
// case BeneficiaryType.MyAccount:
// return TranslationBase.of(context).myAccount;
// case BeneficiaryType.MyFamilyFiles:
// return TranslationBase.of(context).myFamilyFiles;
// break;
// case BeneficiaryType.OtherAccount:
// return TranslationBase.of(context).otherAccount;
// break;
// case BeneficiaryType.NON:
// return TranslationBase.of(context).selectBeneficiary;
// }
// return TranslationBase.of(context).selectBeneficiary;
// }
//
// String getHospitalName() {
// if (_selectedHospital != null)
// return _selectedHospital.name;
// else
// return TranslationBase.of(context).selectHospital;
// }
//
// String getPatientName() {
// if (_selectedPatientInfo != null)
// return _selectedPatientInfo.fullName;
// else
// return TranslationBase.of(context).selectPatientName;
// }
//
// getAuthUser() async {
// if (await this.sharedPref.getObject(USER_PROFILE) != null) {
// var data = AuthenticatedUser.fromJson(
// await this.sharedPref.getObject(USER_PROFILE));
// setState(() {
// authUser = data;
// });
// }
// }
//
// String getFamilyMembersName() {
// if (selectedPatientFamily != null)
// return selectedPatientFamily.patientName;
// else
// return TranslationBase.of(context).selectFamilyPatientName;
// }
// }

@ -10,7 +10,6 @@ import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
@ -23,7 +22,6 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'book_reminder_page.dart'; import 'book_reminder_page.dart';
@ -37,8 +35,9 @@ class BookConfirm extends StatefulWidget {
String appoDateFormatted = ""; String appoDateFormatted = "";
String appoTimeFormatted = ""; String appoTimeFormatted = "";
bool isLiveCareAppointment; bool isLiveCareAppointment;
int initialSlotDuration;
BookConfirm({@required this.doctor, @required this.selectedDate, @required this.isLiveCareAppointment, @required this.selectedTime}); BookConfirm({@required this.doctor, @required this.selectedDate, @required this.isLiveCareAppointment, @required this.selectedTime, @required this.initialSlotDuration});
DoctorsListService service; DoctorsListService service;
PatientShareResponse patientShareResponse; PatientShareResponse patientShareResponse;
@ -208,7 +207,7 @@ class _BookConfirmState extends State<BookConfirm> {
if (isLiveCareSchedule != null && isLiveCareSchedule) { if (isLiveCareSchedule != null && isLiveCareSchedule) {
insertLiveCareScheduledAppointment(context, widget.doctor); insertLiveCareScheduledAppointment(context, widget.doctor);
} else { } 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)), child: Text(TranslationBase.of(context).bookAppo, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)),
@ -246,18 +245,19 @@ class _BookConfirmState extends State<BookConfirm> {
); );
} }
cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) { cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) async {
ConfirmDialog.closeAlertDialog(context); ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT);
service.cancelAppointment(appo, context).then((res) { service.cancelAppointment(appo, context).then((res) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
Future.delayed(new Duration(milliseconds: 1500), () async { Future.delayed(new Duration(milliseconds: 1500), () async {
if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) != null && !await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { if (isLiveCareSchedule != null && isLiveCareSchedule) {
insertAppointment(context, widget.doctor);
} else {
insertLiveCareScheduledAppointment(context, widget.doctor); insertLiveCareScheduledAppointment(context, widget.doctor);
} else {
insertAppointment(context, widget.doctor, widget.initialSlotDuration);
} }
}); });
} else { } else {
@ -269,13 +269,13 @@ class _BookConfirmState extends State<BookConfirm> {
}); });
} }
insertAppointment(context, DoctorList docObject) { insertAppointment(context, DoctorList docObject, int initialSlotDuration) {
final timeSlot = DocAvailableAppointments.selectedAppoDateTime; final timeSlot = DocAvailableAppointments.selectedAppoDateTime;
projectViewModel.analytics.appointment.book_appointment_click_confirm(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor); projectViewModel.analytics.appointment.book_appointment_click_confirm(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor);
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
AppoitmentAllHistoryResultList appo; 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) { if (res['MessageStatus'] == 1) {
projectViewModel.analytics.appointment.book_appointment_confirmation_success(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor); projectViewModel.analytics.appointment.book_appointment_confirmation_success(appointment_type: 'regular', dateTime: timeSlot, doctor: widget.doctor);
AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess);

@ -47,6 +47,17 @@ class _BookSuccessState extends State<BookSuccess> {
ProjectViewModel projectViewModel; ProjectViewModel projectViewModel;
@override
initState() {
WidgetsBinding.instance.addPostFrameCallback((_) async {
if (widget.patientShareResponse.isLiveCareAppointment &&
(widget.patientShareResponse.patientShareWithTax.toString() == "0" || widget.patientShareResponse.patientShareWithTax.toString() == "0.0")) {
setOnlineCheckInForAppointment();
}
});
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectViewModel = Provider.of<ProjectViewModel>(context); projectViewModel = Provider.of<ProjectViewModel>(context);
@ -403,6 +414,24 @@ class _BookSuccessState extends State<BookSuccess> {
return Container(); return Container();
} }
setOnlineCheckInForAppointment() {
DoctorsListService service = new DoctorsListService();
service.setOnlineCheckInForAppointment(widget.patientShareResponse.appointmentNo.toString(), widget.patientShareResponse.projectID, context).then((res) {
AppoitmentAllHistoryResultList appo = new AppoitmentAllHistoryResultList();
appo.clinicID = widget.docObject.clinicID;
appo.projectID = widget.docObject.projectID;
appo.appointmentNo = widget.patientShareResponse.appointmentNo;
appo.serviceID = widget.patientShareResponse.serviceID;
appo.isLiveCareAppointment = widget.patientShareResponse.isLiveCareAppointment;
appo.doctorID = widget.patientShareResponse.doctorID;
insertLiveCareVIDARequest(appo, isMoveHome: false);
}).catchError((err) {
// GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err);
print(err);
});
}
confirmAppointment(AppoitmentAllHistoryResultList appo) { confirmAppointment(AppoitmentAllHistoryResultList appo) {
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
@ -425,14 +454,13 @@ class _BookSuccessState extends State<BookSuccess> {
}); });
} }
insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) { insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo, {bool isMoveHome = true}) {
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
service.insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, context).then((res) { service.insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, context).then((res) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); if (isMoveHome) navigateToHome(context);
navigateToHome(context);
} else { } else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']); AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
} }
@ -516,6 +544,9 @@ class _BookSuccessState extends State<BookSuccess> {
}); });
} }
String _paymentMethod;
String _amount;
openPayment(List<String> paymentMethod, AuthenticatedUser authenticatedUser, double amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async { openPayment(List<String> paymentMethod, AuthenticatedUser authenticatedUser, double amount, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async {
widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); widget.browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context);
@ -539,6 +570,7 @@ class _BookSuccessState extends State<BookSuccess> {
widget.patientShareResponse.clinicID, widget.patientShareResponse.clinicID,
widget.patientShareResponse.doctorID, widget.patientShareResponse.doctorID,
paymentMethod[1]); paymentMethod[1]);
_paymentMethod = paymentMethod.first;
// } // }
} }
@ -572,24 +604,33 @@ class _BookSuccessState extends State<BookSuccess> {
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) { service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) {
String paymentInfo = res['Response_Message']; String paymentInfo = res['Response_Message'];
if (paymentInfo == 'Success') { if (paymentInfo == 'Success') {
createAdvancePayment(res, appo);
String txn_ref = res['Merchant_Reference']; String txn_ref = res['Merchant_Reference'];
String amount = res['Amount']; String amount = res['Amount'].toString();
String payment_method = res['PaymentMethod']; String payment_method = res['PaymentMethod'];
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed'; final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
projectViewModel.analytics.appointment.payment_success( projectViewModel.analytics.appointment.payment_success(
appointment_type: 'regular', payment_method: payment_method, clinic: appo.clinicName, hospital: appo.projectName, txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref); appointment_type: 'regular', payment_method: payment_method, clinic: appo.clinicName, hospital: appo.projectName, txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref);
createAdvancePayment(res, appo);
} else { } else {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: res['Response_Message']); AppToast.showErrorToast(message: res['Response_Message']);
paymentFail("400", res['Response_Message']);
} }
}).catchError((err) { }).catchError((err) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err); AppToast.showErrorToast(message: err);
paymentFail("400", err.toString());
print(err); print(err);
}); });
} }
paymentFail(String errorCode, errorMessage){
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
projectViewModel.analytics.advancePayments.payment_fail(
appointment_type: 'livecare', payment_method: _paymentMethod, payment_type: 'appointment', clinic: widget.patientShareResponse.clinicName, hospital: "", txn_amount: widget.patientShareResponse.patientShareWithTax.toString(), txn_currency: currency, error_code: errorCode, error_message: errorMessage
);
}
getApplePayAPQ(AppoitmentAllHistoryResultList appo) { getApplePayAPQ(AppoitmentAllHistoryResultList appo) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();

@ -154,7 +154,7 @@ class _DoctorProfileState extends State<DoctorProfile> with TickerProviderStateM
onTap: (index) { onTap: (index) {
setState(() { setState(() {
if (index == 1) { 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; _tabController.index = _tabController.previousIndex;
showFooterButton = false; showFooterButton = false;
} else { } else {
@ -529,6 +529,7 @@ class _DoctorProfileState extends State<DoctorProfile> with TickerProviderStateM
isLiveCareAppointment: widget.isLiveCareAppointment, isLiveCareAppointment: widget.isLiveCareAppointment,
selectedDate: DocAvailableAppointments.selectedDate, selectedDate: DocAvailableAppointments.selectedDate,
selectedTime: DocAvailableAppointments.selectedTime, selectedTime: DocAvailableAppointments.selectedTime,
initialSlotDuration: DocAvailableAppointments.initialSlotDuration,
), ),
), ),
); );

@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:jiffy/jiffy.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart';
@ -27,6 +28,7 @@ class DocAvailableAppointments extends StatefulWidget {
static String selectedTime; static String selectedTime;
bool isLiveCareAppointment; bool isLiveCareAppointment;
final dynamic doctorSchedule; final dynamic doctorSchedule;
static int initialSlotDuration;
DocAvailableAppointments({@required this.doctor, this.doctorSchedule, @required this.isLiveCareAppointment}); DocAvailableAppointments({@required this.doctor, this.doctorSchedule, @required this.isLiveCareAppointment});
@ -231,13 +233,18 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
final DateFormat formatter = DateFormat('HH:mm'); final DateFormat formatter = DateFormat('HH:mm');
final DateFormat dateFormatter = DateFormat('yyyy-MM-dd'); final DateFormat dateFormatter = DateFormat('yyyy-MM-dd');
for (var i = 0; i < freeSlotsResponse.length; i++) { for (var i = 0; i < freeSlotsResponse.length; i++) {
date = DateUtil.convertStringToDate(freeSlotsResponse[i]); if ((widget.doctor.projectID == 2 && DateTime.now().timeZoneName == "+04") || widget.doctor.projectID == 3 && DateTime.now().timeZoneName == "+04") {
date = Jiffy(DateUtil.convertStringToDate(freeSlotsResponse[i])).subtract(hours: 1).dateTime;
} else {
date = DateUtil.convertStringToDate(freeSlotsResponse[i]);
}
slotsList.add(FreeSlot(date, ['slot'])); slotsList.add(FreeSlot(date, ['slot']));
docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date)); docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date));
} }
_eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); _eventsParsed = Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event);
setState(() { setState(() {
DocAvailableAppointments.selectedDate = dateFormatter.format(DateUtil.convertStringToDate(freeSlotsResponse[0])); DocAvailableAppointments.selectedDate = dateFormatter.format(DateUtil.convertStringToDate(freeSlotsResponse[0]));
DocAvailableAppointments.selectedAppoDateTime = DateUtil.convertStringToDate(freeSlotsResponse[0]);
selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(DateUtil.convertStringToDate(freeSlotsResponse[0]), language); selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(DateUtil.convertStringToDate(freeSlotsResponse[0]), language);
selectedDateJSON = freeSlotsResponse[0]; selectedDateJSON = freeSlotsResponse[0];
}); });
@ -291,9 +298,9 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
if (res['FreeTimeSlots'].length != 0) { if (res['FreeTimeSlots'].length != 0) {
DocAvailableAppointments.initialSlotDuration = res['InitialSlotDuration'];
DocAvailableAppointments.areAppointmentsAvailable = true; DocAvailableAppointments.areAppointmentsAvailable = true;
freeSlotsResponse = res['FreeTimeSlots']; freeSlotsResponse = res['FreeTimeSlots'];
_getJSONSlots().then((value) { _getJSONSlots().then((value) {
setState(() => { setState(() => {
_events.clear(), _events.clear(),

@ -184,9 +184,11 @@ class _LaserClinicState extends State<LaserClinic> with SingleTickerProviderStat
Expanded( Expanded(
child: DefaultButton( child: DefaultButton(
TranslationBase.of(context).continues, TranslationBase.of(context).continues,
getDuration() != 0 ? () { getDuration() != 0
callDoctorsSearchAPI(); ? () {
} : null, callDoctorsSearchAPI();
}
: null,
color: CustomColors.green, color: CustomColors.green,
disabledColor: CustomColors.grey2, disabledColor: CustomColors.grey2,
), ),
@ -208,6 +210,7 @@ class _LaserClinicState extends State<LaserClinic> with SingleTickerProviderStat
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital = List(); List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital = List();
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
projectViewModel.selectedBodyPartList = _selectedBodyPartList;
service.getDoctorsList(253, 0, false, context).then((res) { service.getDoctorsList(253, 0, false, context).then((res) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
@ -270,33 +273,14 @@ class _LaserClinicState extends State<LaserClinic> with SingleTickerProviderStat
if (_selectedBodyPartList.length > 0) { if (_selectedBodyPartList.length > 0) {
duration = _selectedBodyPartList.fold(0, (previousValue, element) => previousValue + int.parse(element.timeDuration)); duration = _selectedBodyPartList.fold(0, (previousValue, element) => previousValue + int.parse(element.timeDuration));
} }
print("duration:$duration");
if (lowerUpperLegsList.length == 2) { if (lowerUpperLegsList.length == 2) {
duration -= 30; duration -= 30;
} }
print("duration1:$duration");
if (upperLowerArmsList.length == 2) { if (upperLowerArmsList.length == 2) {
duration -= 15; 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; _duration = duration;
projectViewModel.laserSelectionDuration = duration;
return duration; return duration;
} }
@ -378,6 +362,9 @@ class _LaserClinicState extends State<LaserClinic> with SingleTickerProviderStat
setState(() { setState(() {
if (value) { if (value) {
_selectedBodyPartList.clear(); _selectedBodyPartList.clear();
_selectedBodyPartList.add(fullBody);
} else {
_selectedBodyPartList.clear();
} }
_isFullBody = !_isFullBody; _isFullBody = !_isFullBody;
}); });

@ -534,7 +534,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: LiveCareBookAppointment(clinicName: "Family Medicine", liveCareClinicID: dropdownValue.split("-")[2], liveCareServiceID: dropdownValue.split("-")[3]), page: LiveCareBookAppointment(clinicName: dropdownTitle, liveCareClinicID: dropdownValue.split("-")[2], liveCareServiceID: dropdownValue.split("-")[3]),
), ),
).then((value) { ).then((value) {
setState(() { setState(() {

@ -22,7 +22,7 @@ Future<Map<Permission, PermissionStatus>> requestPermissions() async {
showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted,
{Function onSuccess, String title, String description, Function(int) onMultiDateSuccess}) async { {Function onSuccess, String title, String description, Function(int) onMultiDateSuccess}) async {
if (Platform.isAndroid) { if (Platform.isAndroid) {
if (await PermissionService.isCameraEnabled()) { if (await PermissionService.isCalendarPermissionEnabled()) {
_showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess); onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess);
} else { } else {

@ -435,7 +435,7 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots> with TickerProviderStat
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
AppoitmentAllHistoryResultList appo; AppoitmentAllHistoryResultList appo;
service 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) widget.selectedProject.testTypeEnum, widget.selectedProject.testProcedureEnum)
.then((res) { .then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {

@ -12,6 +12,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
class CovidPaymentDetails extends StatefulWidget { class CovidPaymentDetails extends StatefulWidget {
CovidPaymentInfoResponse covidPaymentInfoResponse; CovidPaymentInfoResponse covidPaymentInfoResponse;
@ -193,14 +194,19 @@ class _CovidPaymentDetailsState extends State<CovidPaymentDetails> {
), ),
), ),
mWidth(3), mWidth(3),
Text( InkWell(
TranslationBase.of(context).termsConditoins, onTap: () {
style: TextStyle( launch("https://hmg.com/en/Pages/Privacy.aspx");
fontSize: 12, },
letterSpacing: -0.48, child: Text(
color: CustomColors.accentColor, TranslationBase.of(context).termsConditoins,
fontWeight: FontWeight.w600, style: TextStyle(
decoration: TextDecoration.underline, fontSize: 12,
letterSpacing: -0.48,
color: CustomColors.accentColor,
fontWeight: FontWeight.w600,
decoration: TextDecoration.underline,
),
), ),
), ),
], ],

@ -33,6 +33,7 @@ class NotificationsDetailsPage extends StatelessWidget {
isShowAppBar: true, isShowAppBar: true,
showNewAppBar: true, showNewAppBar: true,
showNewAppBarTitle: true, showNewAppBarTitle: true,
isShowDecPage: false,
appBarTitle: TranslationBase.of(context).notificationDetails, appBarTitle: TranslationBase.of(context).notificationDetails,
body: ListView( body: ListView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -49,7 +50,6 @@ class NotificationsDetailsPage extends StatelessWidget {
letterSpacing: -0.64, letterSpacing: -0.64,
), ),
), ),
if (notification.messageTypeData.length != 0) if (notification.messageTypeData.length != 0)
Padding( Padding(
padding: const EdgeInsets.only(top: 18), padding: const EdgeInsets.only(top: 18),
@ -64,7 +64,6 @@ class NotificationsDetailsPage extends StatelessWidget {
); );
}, fit: BoxFit.fill), }, fit: BoxFit.fill),
), ),
SizedBox(height: 18), SizedBox(height: 18),
Text( Text(
notification.message.trim(), notification.message.trim(),
@ -75,7 +74,6 @@ class NotificationsDetailsPage extends StatelessWidget {
letterSpacing: -0.48, letterSpacing: -0.48,
), ),
), ),
], ],
), ),
); );

@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/model/er/PatientER_RC.dart';
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/er/am_request_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/ambulanceRequest/locationDetails.dart';
import 'package:diplomaticquarterapp/pages/ErService/widgets/AppointmentCard.dart'; import 'package:diplomaticquarterapp/pages/ErService/widgets/AppointmentCard.dart';
import 'package:diplomaticquarterapp/uitl/ProgressDialog.dart'; import 'package:diplomaticquarterapp/uitl/ProgressDialog.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
@ -11,7 +12,6 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/pickupLocation/PickupLocationFromMap.dart'; import 'package:diplomaticquarterapp/widgets/pickupLocation/PickupLocationFromMap.dart';
@ -19,7 +19,6 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart';
import '../AvailableAppointmentsPage.dart'; import '../AvailableAppointmentsPage.dart';
@ -44,7 +43,7 @@ class _PickupLocationState extends State<PickupLocation> {
double _longitude; double _longitude;
AppoitmentAllHistoryResultList myAppointment; AppoitmentAllHistoryResultList myAppointment;
HospitalsModel _selectedHospital; HospitalsModel _selectedHospital;
PickResult _result; LocationDetails _result;
@override @override
void initState() { void initState() {
@ -496,15 +495,15 @@ class _PickupLocationState extends State<PickupLocation> {
setState(() { setState(() {
widget.patientER_RC.transportationDetails.pickupSpot = _isInsideHome ? 1 : 0; widget.patientER_RC.transportationDetails.pickupSpot = _isInsideHome ? 1 : 0;
if (widget.patientER_RC.transportationDetails.direction == 0) { if (widget.patientER_RC.transportationDetails.direction == 0) {
widget.patientER_RC.transportationDetails.dropoffLatitude = _result.geometry.location.lat.toString(); widget.patientER_RC.transportationDetails.dropoffLatitude = _result.lat.toStringAsFixed(6);
widget.patientER_RC.transportationDetails.dropoffLongitude = _result.geometry.location.lng.toString(); widget.patientER_RC.transportationDetails.dropoffLongitude = _result.long.toStringAsFixed(6);
widget.patientER_RC.transportationDetails.pickupLatitude = _selectedHospital.latitude; widget.patientER_RC.transportationDetails.pickupLatitude = _selectedHospital.latitude;
widget.patientER_RC.transportationDetails.pickupLongitude = _selectedHospital.longitude; widget.patientER_RC.transportationDetails.pickupLongitude = _selectedHospital.longitude;
} else { } else {
widget.patientER_RC.transportationDetails.pickupLatitude = _selectedHospital.latitude; widget.patientER_RC.transportationDetails.pickupLatitude = _selectedHospital.latitude;
widget.patientER_RC.transportationDetails.pickupLongitude = _selectedHospital.longitude; widget.patientER_RC.transportationDetails.pickupLongitude = _selectedHospital.longitude;
widget.patientER_RC.transportationDetails.dropoffLatitude = _result.geometry.location.lat.toString(); widget.patientER_RC.transportationDetails.dropoffLatitude = _result.lat.toStringAsFixed(6);
widget.patientER_RC.transportationDetails.dropoffLongitude = _result.geometry.location.lng.toString(); widget.patientER_RC.transportationDetails.dropoffLongitude = _result.long.toStringAsFixed(6);
} }
// widget.patientER.latitude = // widget.patientER.latitude =

@ -1,3 +1,6 @@
import 'dart:collection';
import 'package:device_calendar/device_calendar.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
@ -11,6 +14,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/SchedulePage.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
@ -94,23 +98,30 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
children: <Widget>[ children: <Widget>[
DoctorHeader( DoctorHeader(
headerModel: HeaderModel( headerModel: HeaderModel(
widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, widget.appo.doctorTitle + " " + widget.appo.doctorNameObj,
widget.appo.doctorID, widget.appo.doctorID,
widget.appo.doctorImageURL, widget.appo.doctorImageURL,
widget.appo.doctorSpeciality, widget.appo.doctorSpeciality,
"", "",
widget.appo.projectName, widget.appo.projectName,
DateUtil.convertStringToDate(widget.appo.appointmentDate), DateUtil.convertStringToDate(widget.appo.appointmentDate),
widget.appo.startTime.substring(0, 5), widget.appo.startTime.substring(0, 5),
null, null,
widget.appo.doctorRate, widget.appo.doctorRate,
widget.appo.actualDoctorRate, widget.appo.actualDoctorRate,
widget.appo.noOfPatientsRate, widget.appo.noOfPatientsRate,
"", "",
decimalDoctorRate: widget.appo.decimalDoctorRate.toString() decimalDoctorRate: widget.appo.decimalDoctorRate.toString()
//model.user.emailAddress, //model.user.emailAddress,
), ),
isNeedToShowButton: (widget.appo.clinicID == 17 || widget.appo.clinicID == 47 || widget.appo.clinicID == 23 || widget.appo.clinicID == 265 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) ? false : true, isNeedToShowButton: (widget.appo.clinicID == 17 ||
widget.appo.clinicID == 47 ||
widget.appo.clinicID == 23 ||
widget.appo.clinicID == 265 ||
widget.appo.isExecludeDoctor ||
widget.appo.isLiveCareAppointment)
? false
: true,
buttonTitle: TranslationBase.of(context).schedule, buttonTitle: TranslationBase.of(context).schedule,
buttonIcon: 'assets/images/new/Boo_ Appointment.svg', buttonIcon: 'assets/images/new/Boo_ Appointment.svg',
showConfirmMessageDialog: false, showConfirmMessageDialog: false,
@ -139,7 +150,12 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
onTap: (index) { onTap: (index) {
setState(() { setState(() {
if (index == 1) { if (index == 1) {
if (widget.appo.clinicID == 17 || widget.appo.clinicID == 47 || widget.appo.clinicID == 23 || widget.appo.clinicID == 265 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) { if (widget.appo.clinicID == 17 ||
widget.appo.clinicID == 47 ||
widget.appo.clinicID == 23 ||
widget.appo.clinicID == 265 ||
widget.appo.isExecludeDoctor ||
widget.appo.isLiveCareAppointment) {
_tabController.index = _tabController.previousIndex; _tabController.index = _tabController.previousIndex;
AppointmentDetails.showFooterButton = false; AppointmentDetails.showFooterButton = false;
} else { } else {
@ -150,7 +166,12 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
}, },
tabs: [ tabs: [
Tab(child: Text(TranslationBase.of(context).appoActions, style: TextStyle(color: Colors.black))), Tab(child: Text(TranslationBase.of(context).appoActions, style: TextStyle(color: Colors.black))),
widget.appo.clinicID == 17 || widget.appo.clinicID == 23 || widget.appo.clinicID == 47 || widget.appo.clinicID == 265 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment widget.appo.clinicID == 17 ||
widget.appo.clinicID == 23 ||
widget.appo.clinicID == 47 ||
widget.appo.clinicID == 265 ||
widget.appo.isExecludeDoctor ||
widget.appo.isLiveCareAppointment
? Tab( ? Tab(
child: Text(TranslationBase.of(context).availableAppo, style: TextStyle(color: Colors.grey)), child: Text(TranslationBase.of(context).availableAppo, style: TextStyle(color: Colors.grey)),
) )
@ -563,15 +584,31 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
}); });
} }
checkIfHasReminder() async {
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
DateTime startEventsDate = DateUtil.convertStringToDate(widget.appo.appointmentDate);
DateTime endEventsDate = DateUtil.convertStringToDate(widget.appo.appointmentDate);
RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate);
await calendarUtils.retrieveEvents(calendarUtils.calendars[0].id, params).then((value) {
Result<UnmodifiableListView<Event>> events = value;
events.data.forEach((element) {
if (element.title.contains(widget.appo.doctorNameObj)) calendarUtils.deleteEvent(calendarUtils.calendars[0], element);
});
});
}
cancelAppointment() { cancelAppointment() {
ConfirmDialog.closeAlertDialog(context); ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
service.cancelAppointment(widget.appo, context).then((res) { service.cancelAppointment(widget.appo, context).then((res) {
projectViewModel.analytics.appointment.appointment_details_cancel(appointment: widget.appo); projectViewModel.analytics.appointment.appointment_details_cancel(appointment: widget.appo);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
checkIfHasReminder();
getToDoCount(); getToDoCount();
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
Navigator.of(context).pop(); Navigator.of(context).pop();

@ -359,7 +359,7 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
AppoitmentAllHistoryResultList appo; AppoitmentAllHistoryResultList appo;
service service
.insertAppointment( .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) { .then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess);

@ -214,7 +214,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
), ),
child: Text( child: Text(
getNextActionText(widget.appoList[index].nextAction), getNextActionText(widget.appoList[index].nextAction), textAlign: TextAlign.center,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4),
), ),
), ),
@ -247,7 +247,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
children: <Widget>[ children: <Widget>[
MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName, projectViewModel.isArabic), MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName, projectViewModel.isArabic),
MyRichText(TranslationBase.of(context).appointmentDate + ": ", MyRichText(TranslationBase.of(context).appointmentDate + ": ",
DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)), projectViewModel.isArabic), DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) + " " + widget.appoList[index].startTime.substring(0, 5), projectViewModel.isArabic),
MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName, projectViewModel.isArabic), MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName, projectViewModel.isArabic),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,

@ -1,6 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'package:diplomaticquarterapp/core/model/my_balance/tamara_installment_details.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/tamara_installment_details.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
@ -9,6 +10,7 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
class PaymentMethod extends StatefulWidget { class PaymentMethod extends StatefulWidget {
Function onSelectedMethod; Function onSelectedMethod;
@ -27,6 +29,7 @@ class _PaymentMethodState extends State<PaymentMethod> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return AppScaffold(
appBarTitle: TranslationBase.of(context).paymentMethod, appBarTitle: TranslationBase.of(context).paymentMethod,
isShowAppBar: true, isShowAppBar: true,
@ -45,153 +48,157 @@ class _PaymentMethodState extends State<PaymentMethod> {
margin: EdgeInsets.fromLTRB(4, 15.0, 4, 0.0), margin: EdgeInsets.fromLTRB(4, 15.0, 4, 0.0),
child: Text(TranslationBase.of(context).selectPaymentOption, style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold)), child: Text(TranslationBase.of(context).selectPaymentOption, style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold)),
), ),
Container( if (projectViewModel.havePrivilege(86))
width: double.infinity, Container(
child: InkWell( width: double.infinity,
onTap: () { child: InkWell(
updateSelectedPaymentMethod("MADA"); onTap: () {
}, updateSelectedPaymentMethod("MADA");
child: Card( },
elevation: 0.0, child: Card(
margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), elevation: 0.0,
color: Colors.white, margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0),
shape: RoundedRectangleBorder( color: Colors.white,
borderRadius: BorderRadius.circular(10), shape: RoundedRectangleBorder(
side: selectedPaymentMethod == "MADA" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), borderRadius: BorderRadius.circular(10),
), side: selectedPaymentMethod == "MADA" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0),
child: Padding( ),
padding: const EdgeInsets.all(12.0), child: Padding(
child: Row( padding: const EdgeInsets.all(12.0),
children: [ child: Row(
Container( children: [
width: 24,
height: 24,
decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "MADA" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5),
),
mWidth(12),
Container(
height: 70.0,
width: 70.0,
padding: EdgeInsets.all(7.0),
child: Image.asset("assets/images/new/payment/Mada.png"),
),
mFlex(1),
if (selectedPaymentMethod == "MADA")
Container( Container(
decoration: containerRadius(CustomColors.green, 200), width: 24,
padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), height: 24,
child: Text( decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "MADA" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5),
TranslationBase.of(context).paymentSelected, ),
style: TextStyle( mWidth(12),
color: Colors.white, Container(
fontSize: 11, height: 70.0,
width: 70.0,
padding: EdgeInsets.all(7.0),
child: Image.asset("assets/images/new/payment/Mada.png"),
),
mFlex(1),
if (selectedPaymentMethod == "MADA")
Container(
decoration: containerRadius(CustomColors.green, 200),
padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12),
child: Text(
TranslationBase.of(context).paymentSelected,
style: TextStyle(
color: Colors.white,
fontSize: 11,
),
), ),
), ),
), ],
], ),
), ),
), ),
), ),
), ),
), if (projectViewModel.havePrivilege(87))
Container( Container(
width: double.infinity, width: double.infinity,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
updateSelectedPaymentMethod("VISA"); updateSelectedPaymentMethod("VISA");
}, },
child: Card( child: Card(
elevation: 0.0, elevation: 0.0,
margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0),
color: Colors.white, color: Colors.white,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
side: selectedPaymentMethod == "VISA" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), side: selectedPaymentMethod == "VISA" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Row( child: Row(
children: [ children: [
Container(
width: 24,
height: 24,
decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "VISA" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5),
),
mWidth(12),
Container(
height: 60.0,
padding: EdgeInsets.all(7.0),
width: 60,
child: Image.asset("assets/images/new/payment/visa.png"),
),
mFlex(1),
if (selectedPaymentMethod == "VISA")
Container( Container(
decoration: containerRadius(CustomColors.green, 200), width: 24,
padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), height: 24,
child: Text( decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "VISA" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5),
TranslationBase.of(context).paymentSelected, ),
style: TextStyle( mWidth(12),
color: Colors.white, Container(
fontSize: 11, height: 60.0,
padding: EdgeInsets.all(7.0),
width: 60,
child: Image.asset("assets/images/new/payment/visa.png"),
),
mFlex(1),
if (selectedPaymentMethod == "VISA")
Container(
decoration: containerRadius(CustomColors.green, 200),
padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12),
child: Text(
TranslationBase.of(context).paymentSelected,
style: TextStyle(
color: Colors.white,
fontSize: 11,
),
), ),
), ),
), ],
], ),
), ),
), ),
), ),
), ),
), if (projectViewModel.havePrivilege(88))
Container( Container(
width: double.infinity, width: double.infinity,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
updateSelectedPaymentMethod("MASTERCARD"); updateSelectedPaymentMethod("MASTERCARD");
}, },
child: Card( child: Card(
elevation: 0.0, elevation: 0.0,
margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0), margin: EdgeInsets.fromLTRB(8.0, 16.0, 8.0, 8.0),
color: Colors.white, color: Colors.white,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
side: selectedPaymentMethod == "MASTERCARD" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), side: selectedPaymentMethod == "MASTERCARD" ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Row( child: Row(
children: [ children: [
Container(
width: 24,
height: 24,
decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "MASTERCARD" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5),
),
mWidth(12),
Container(
height: 60.0,
padding: EdgeInsets.all(7.0),
width: 60,
child: Image.asset("assets/images/new/payment/Mastercard.png"),
),
mFlex(1),
if (selectedPaymentMethod == "MASTERCARD")
Container( Container(
decoration: containerRadius(CustomColors.green, 200), width: 24,
padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), height: 24,
child: Text( decoration: containerColorRadiusBorderWidth(selectedPaymentMethod == "MASTERCARD" ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5),
TranslationBase.of(context).paymentSelected, ),
style: TextStyle( mWidth(12),
color: Colors.white, Container(
fontSize: 11, height: 60.0,
padding: EdgeInsets.all(7.0),
width: 60,
child: Image.asset("assets/images/new/payment/Mastercard.png"),
),
mFlex(1),
if (selectedPaymentMethod == "MASTERCARD")
Container(
decoration: containerRadius(CustomColors.green, 200),
padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12),
child: Text(
TranslationBase.of(context).paymentSelected,
style: TextStyle(
color: Colors.white,
fontSize: 11,
),
), ),
), ),
), ],
], ),
), ),
), ),
), ),
), ),
), if (projectViewModel.havePrivilege(90))
// Container( // Container(
// width: double.infinity, // width: double.infinity,
// child: InkWell( // child: InkWell(
@ -241,7 +248,7 @@ class _PaymentMethodState extends State<PaymentMethod> {
// ), // ),
// ), // ),
// ), // ),
if (widget.isShowInstallments) if (widget.isShowInstallments && projectViewModel.havePrivilege(91))
Container( Container(
width: double.infinity, width: double.infinity,
child: InkWell( child: InkWell(
@ -292,7 +299,7 @@ class _PaymentMethodState extends State<PaymentMethod> {
), ),
), ),
), ),
Platform.isIOS (Platform.isIOS && projectViewModel.havePrivilege(89))
? Container( ? Container(
width: double.infinity, width: double.infinity,
child: InkWell( child: InkWell(
@ -321,7 +328,9 @@ class _PaymentMethodState extends State<PaymentMethod> {
height: 60.0, height: 60.0,
padding: EdgeInsets.all(7.0), padding: EdgeInsets.all(7.0),
width: 60, width: 60,
child: Image.asset("assets/images/new/payment/Apple_Pay.png"), child: SvgPicture.asset(
"assets/images/new/payment/Apple_Pay.svg",
),
), ),
mFlex(1), mFlex(1),
if (selectedPaymentMethod == "ApplePay") if (selectedPaymentMethod == "ApplePay")

@ -6,19 +6,18 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/services/permission/permission_service.dart';
import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/floating_button_search.dart'; import 'package:diplomaticquarterapp/widgets/others/floating_button_search.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -32,6 +31,7 @@ import 'package:speech_to_text/speech_to_text.dart' as stt;
class SendFeedbackPage extends StatefulWidget { class SendFeedbackPage extends StatefulWidget {
final AppoitmentAllHistoryResultList appointment; final AppoitmentAllHistoryResultList appointment;
final MessageType messageType; final MessageType messageType;
const SendFeedbackPage({Key key, this.appointment, this.messageType = MessageType.NON}) : super(key: key); const SendFeedbackPage({Key key, this.appointment, this.messageType = MessageType.NON}) : super(key: key);
@override @override
@ -93,11 +93,11 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
this.messageType = widget.messageType; this.messageType = widget.messageType;
this.appointHistory = widget.appointment; this.appointHistory = widget.appointment;
}); });
requestPermissions(); // requestPermissions();
event.controller.stream.listen((p) { event.controller.stream.listen((p) {
if (p['isIOSFeedback'] == 'true') { if (p['isIOSFeedback'] == 'true') {
if (this.mounted) { if (this.mounted) {
this.titleController.value = p['data']; this.titleController.value = p['data'];
} }
} }
}); });
@ -217,8 +217,18 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
), ),
inputWidget(TranslationBase.of(context).subject, "", titleController), inputWidget(TranslationBase.of(context).subject, "", titleController),
SizedBox(height: 12), SizedBox(height: 12),
inputWidget(TranslationBase.of(context).message, "", messageController, lines: 11, suffixTap: () { inputWidget(TranslationBase.of(context).message, "", messageController, lines: 11, suffixTap: () async {
openSpeechReco(); if (Platform.isAndroid) {
if (await PermissionService.isMicrophonePermissionEnabled()) {
openSpeechReco();
} else {
Utils.showPermissionConsentDialog(context, TranslationBase.of(context).recordAudioPermission, () {
openSpeechReco();
});
}
} else {
openSpeechReco();
}
}), }),
SizedBox(height: 12), SizedBox(height: 12),
InkWell( InkWell(
@ -536,7 +546,6 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
Map<Permission, PermissionStatus> statuses = await [ Map<Permission, PermissionStatus> statuses = await [
Permission.microphone, Permission.microphone,
].request(); ].request();
print(statuses);
} }
void resultListener(result) { void resultListener(result) {
@ -548,7 +557,6 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
messageController.text += reconizedWord + '\n'; messageController.text += reconizedWord + '\n';
RoboSearch.closeAlertDialog(context); RoboSearch.closeAlertDialog(context);
speech.stop(); speech.stop();
}); });
} }
} }

@ -284,7 +284,7 @@ class _HomePageFragment2State extends State<HomePageFragment2> {
} }
Widget offersButton() { Widget offersButton() {
final bypassPrivilageCheck = true; final bypassPrivilageCheck = false;
return Expanded( return Expanded(
flex: 1, flex: 1,
child: InkWell( child: InkWell(

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
@ -21,9 +23,9 @@ import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart' as family; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart' as family;
import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart';
import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/HMGNetworkConnectivity.dart';
import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart';
import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart'; import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart';
@ -37,6 +39,9 @@ import 'package:diplomaticquarterapp/widgets/others/not_auh_page.dart';
import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_app_icon_badge/flutter_app_icon_badge.dart';
import 'package:flutter_ios_voip_kit/call_state_type.dart';
import 'package:flutter_ios_voip_kit/flutter_ios_voip_kit.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
@ -91,6 +96,35 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
var event = RobotProvider(); var event = RobotProvider();
var familyFileProvider = family.FamilyFilesProvider(); var familyFileProvider = family.FamilyFilesProvider();
// VoIPKit
final voIPKit = FlutterIOSVoIPKit.instance;
var dummyCallId = '123456';
var dummyCallerName = 'Dummy Tester';
Timer timeOutTimer;
bool isTalking = false;
var sharedPref = new AppSharedPreferences();
var data = {
"AppointmentNo": "2016059247",
"ProjectID": "15",
"NotificationType": "10",
"background": "0",
"doctorname": "Call from postman",
"clinicname": "LIVECARE FAMILY MEDICINE AND GP",
"speciality": "General Practioner",
"appointmentdate": "2022-01-19",
"appointmenttime": "12:10",
"PatientName": "Testing",
"session_id": "1_MX40NjIwOTk2Mn5-MTY0NzI1NjYxNDI2OX5ySXhlVjZjam13RFdMVmdleWVsSDhzQkx-fg",
"token":
"T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9OGMyY2IyYWFiZmZmMzI4ZmEwMjgxNDdmMGFhZGI0N2JiZjdmZWY4MjpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWTBOekkxTmpZeE5ESTJPWDV5U1hobFZqWmphbTEzUkZkTVZtZGxlV1ZzU0RoelFreC1mZyZjcmVhdGVfdGltZT0xNjQ3MjU2NjE0Jm5vbmNlPTAuMjgzNDgyNjM1NDczNjQ2OCZyb2xlPW1vZGVyYXRvciZleHBpcmVfdGltZT0xNjQ3MjU4NDE0JmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9",
"DoctorImageURL": "https://image.shutterstock.com/image-vector/sample-stamp-square-grunge-sign-260nw-1474408826.jpg",
"callerID": "9920",
"PatientID": "1231755",
"is_call": "true"
};
void _requestIOSPermissions() { void _requestIOSPermissions() {
flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<IOSFlutterLocalNotificationsPlugin>()?.requestPermissions( flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<IOSFlutterLocalNotificationsPlugin>()?.requestPermissions(
alert: true, alert: true,
@ -99,6 +133,24 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
); );
} }
void _showRequestAuthLocalNotification() async {
await voIPKit.requestAuthLocalNotification();
}
void _timeOut({
int seconds = 15,
}) async {
timeOutTimer = Timer(Duration(seconds: seconds), () async {
print('🎈 example: timeOut');
final incomingCallerName = await voIPKit.getIncomingCallerName();
voIPKit.unansweredIncomingCall(
skipLocalNotification: false,
missedCallTitle: '📞 Missed call',
missedCallBody: 'There was a call from $incomingCallerName',
);
});
}
bool isPageNavigated = false; bool isPageNavigated = false;
LocationUtils locationUtils; LocationUtils locationUtils;
@ -232,12 +284,81 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
void initState() { void initState() {
super.initState(); super.initState();
PushNotificationHandler.getInstance().onResume(); PushNotificationHandler.getInstance().onResume();
// // VoIP Callbacks
// voIPKit.getVoIPToken().then((value) {
// print('🎈 example: getVoIPToken: $value');
// sharedPref.setString("VOIPToken", value);
// });
//
// voIPKit.onDidReceiveIncomingPush = (
// Map<String, dynamic> payload,
// ) async {
// print('🎈 example: onDidReceiveIncomingPush $payload');
// _timeOut();
// };
//
// voIPKit.onDidRejectIncomingCall = (
// String uuid,
// String callerId,
// ) {
// if (isTalking) {
// return;
// }
//
// print('🎈 example: onDidRejectIncomingCall $uuid, $callerId');
// voIPKit.endCall();
// timeOutTimer?.cancel();
//
// setState(() {
// isTalking = false;
// });
// };
//
// voIPKit.onDidAcceptIncomingCall = (
// String uuid,
// String callerId,
// ) {
// // print('🎈 example: isTalking $isTalking');
// // if (isTalking) {
// // return;
// // }
//
// print('🎈 example: onDidAcceptIncomingCall $uuid, $callerId');
//
// var sessionID;
// var token;
//
// // String sessionID = callerId.split("*")[0];
// // String identity = callerId.split("*")[1];
// // String name = callerId.split("*")[2];
// //
// // print("🎈 SessionID: $sessionID");
// // print("🎈 Identity: $identity");
// // print("🎈 Name: $name");
//
// voIPKit.acceptIncomingCall(callerState: CallStateType.calling);
// voIPKit.callConnected();
// timeOutTimer?.cancel();
//
// print("🎈 CALL ACCEPTED!!!");
// // print("🎈 Identity: $identity");
// // print("🎈 Name: $name");
//
// setState(() {
// isTalking = true;
// });
// };
//
// _showRequestAuthLocalNotification();
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
AppGlobal.context = context; AppGlobal.context = context;
_requestIOSPermissions(); _requestIOSPermissions();
pageController = PageController(keepPage: true); pageController = PageController(keepPage: true);
_firebaseMessaging.setAutoInitEnabled(true); _firebaseMessaging.setAutoInitEnabled(true);
// locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context); // locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context);
@ -249,7 +370,8 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
// HMG (Guest/Internet) Wifi Access [Zohaib Kambrani] // HMG (Guest/Internet) Wifi Access [Zohaib Kambrani]
// for now commented to reduce this call will enable it when needed // for now commented to reduce this call will enable it when needed
HMGNetworkConnectivity(context).start(); // HMGNetworkConnectivity(context).start();
_firebaseMessaging.getToken().then((String token) { _firebaseMessaging.getToken().then((String token) {
print("Firebase Token: " + token); print("Firebase Token: " + token);
sharedPref.setString(PUSH_TOKEN, token); sharedPref.setString(PUSH_TOKEN, token);
@ -572,6 +694,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString();
model.setState(model.count, true, notificationCount); model.setState(model.count, true, notificationCount);
sharedPref.setString(NOTIFICATION_COUNT, notificationCount); sharedPref.setString(NOTIFICATION_COUNT, notificationCount);
FlutterAppIconBadge.updateBadge(num.parse(notificationCount));
} }
}), }),
}); });

@ -281,7 +281,6 @@ class ServicesView extends StatelessWidget {
showCovidDialog(BuildContext context) { showCovidDialog(BuildContext context) {
if (Platform.isAndroid) { if (Platform.isAndroid) {
// Utils.showPermissionConsentDialog(context, "", () {});
showDialog( showDialog(
context: context, context: context,
builder: (cxt) => CovidConsentDialog( builder: (cxt) => CovidConsentDialog(

@ -39,11 +39,6 @@ class _IncomingCallState extends State<IncomingCall> with SingleTickerProviderSt
isCameraReady = false; isCameraReady = false;
WidgetsBinding.instance.addPostFrameCallback((_) => _runAnimation()); WidgetsBinding.instance.addPostFrameCallback((_) => _runAnimation());
//
// print(widget.incomingCallData.doctorname);
// print(widget.incomingCallData.clinicname);
// print(widget.incomingCallData.speciality);
super.initState(); super.initState();
} }

@ -1,14 +1,20 @@
import 'dart:io';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart'; import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart';
import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
class LiveCarePatmentPage extends StatefulWidget { class LiveCarePatmentPage extends StatefulWidget {
GetERAppointmentFeesList getERAppointmentFeesList; GetERAppointmentFeesList getERAppointmentFeesList;
@ -40,7 +46,6 @@ class _LiveCarePatmentPageState extends State<LiveCarePatmentPage> {
description: TranslationBase.of(context).erConsultation, description: TranslationBase.of(context).erConsultation,
body: Container( body: Container(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
child: Column( child: Column(
children: [ children: [
@ -226,13 +231,18 @@ class _LiveCarePatmentPageState extends State<LiveCarePatmentPage> {
), ),
), ),
mWidth(4), mWidth(4),
Text( InkWell(
TranslationBase.of(context).termsConditoins, onTap: () {
style: new TextStyle( launch("https://hmg.com/en/Pages/Privacy.aspx");
fontSize: 12.0, },
fontWeight: FontWeight.w600, child: Text(
letterSpacing: -0.48, TranslationBase.of(context).termsConditoins,
color: CustomColors.accentColor, style: new TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
color: CustomColors.accentColor,
),
), ),
), ),
], ],
@ -251,8 +261,6 @@ class _LiveCarePatmentPageState extends State<LiveCarePatmentPage> {
margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0), margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0),
child: getPaymentMethods(), child: getPaymentMethods(),
), ),
], ],
), ),
), ),
@ -266,7 +274,7 @@ class _LiveCarePatmentPageState extends State<LiveCarePatmentPage> {
Expanded( Expanded(
child: DefaultButton( child: DefaultButton(
TranslationBase.of(context).cancel, TranslationBase.of(context).cancel,
() { () {
Navigator.pop(context, false); Navigator.pop(context, false);
}, },
), ),
@ -275,12 +283,24 @@ class _LiveCarePatmentPageState extends State<LiveCarePatmentPage> {
Expanded( Expanded(
child: DefaultButton( child: DefaultButton(
TranslationBase.of(context).next, TranslationBase.of(context).next,
() { () {
if (_selected == 0) { if (_selected == 0) {
AppToast.showErrorToast(message: TranslationBase.of(context).pleaseAcceptTerms); AppToast.showErrorToast(message: TranslationBase.of(context).pleaseAcceptTerms);
} else { } else {
projectViewModel.analytics.liveCare.livecare_immediate_consultation_TnC(clinic: widget.clinicName); askVideoCallPermission().then((value) async {
Navigator.pop(context, true); if (value) {
if (Platform.isAndroid && !(await PlatformBridge.shared().isDrawOverAppsPermissionAllowed())) {
await drawOverAppsMessageDialog(context).then((value) {
return false;
});
} else {
projectViewModel.analytics.liveCare.livecare_immediate_consultation_TnC(clinic: widget.clinicName);
Navigator.pop(context, true);
}
} else {
openPermissionsDialog();
}
});
} }
}, },
color: CustomColors.green, color: CustomColors.green,
@ -295,6 +315,41 @@ class _LiveCarePatmentPageState extends State<LiveCarePatmentPage> {
); );
} }
Future<bool> askVideoCallPermission() async {
if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted)) {
return false;
}
return true;
}
openPermissionsDialog() {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: TranslationBase.of(context).liveCarePermissions,
okText: TranslationBase.of(context).settings,
cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () async {
openAppSettings();
Navigator.pop(context);
},
cancelFunction: () => {});
dialog.showAlertDialog(context);
}
Future drawOverAppsMessageDialog(BuildContext context) async {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: TranslationBase.of(context).drawOverAppsPermission,
okText: TranslationBase.of(context).confirm,
cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () async {
await PlatformBridge.shared().askDrawOverAppsPermission();
Navigator.pop(context);
},
cancelFunction: () => {});
dialog.showAlertDialog(context);
}
void onRadioChanged(int value) { void onRadioChanged(int value) {
setState(() { setState(() {
_selected = value; _selected = value;

@ -1,3 +1,4 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart';
@ -5,6 +6,7 @@ import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePendingReque
import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_list.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_list.dart';
import 'package:diplomaticquarterapp/pages/livecare/widgets/livecare_logs.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/livecare_logs.dart';
import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -31,12 +33,13 @@ class _LiveCareHomeState extends State<LiveCareHome> with SingleTickerProviderSt
ErRequestHistoryList pendingERRequestHistoryList; ErRequestHistoryList pendingERRequestHistoryList;
ProjectViewModel projectViewModel; ProjectViewModel projectViewModel;
AppSharedPreferences sharedPref = AppSharedPreferences();
@override @override
void initState() { void initState() {
_tabController = new TabController(length: 2, vsync: this); _tabController = new TabController(length: 2, vsync: this);
erRequestHistoryList = List(); erRequestHistoryList = List();
LiveCareHome.isLiveCareTypeSelected = false;
pendingERRequestHistoryList = new ErRequestHistoryList(); pendingERRequestHistoryList = new ErRequestHistoryList();
imagesInfo.add(ImagesInfo( imagesInfo.add(ImagesInfo(
imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/er-consultation_en/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/er-consultation_ar/ar/0.png')); imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/er-consultation_en/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/er-consultation_ar/ar/0.png'));
@ -47,6 +50,13 @@ class _LiveCareHomeState extends State<LiveCareHome> with SingleTickerProviderSt
super.initState(); super.initState();
} }
@override
void dispose() {
LiveCareHome.isLiveCareTypeSelected = false;
sharedPref.remove(LIVECARE_CLINIC_DATA);
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);

@ -122,7 +122,7 @@ class _LiveCareTypeSelectState extends State<LiveCareTypeSelect> {
} }
}, },
child: Container( child: Container(
padding: EdgeInsets.only(left: 20, right: 20, bottom: 15, top: 28), padding: EdgeInsets.only(left: 20, right: 20, bottom: 3, top: 28),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
color: Colors.white, color: Colors.white,

@ -59,7 +59,7 @@ class _clinic_listState extends State<ClinicList> {
var languageID; var languageID;
var currentSelectedLiveCareType; var currentSelectedLiveCareType;
int selectedClinicID = 1; int selectedClinicID;
String selectedClinicName = "-"; String selectedClinicName = "-";
AppSharedPreferences sharedPref = AppSharedPreferences(); AppSharedPreferences sharedPref = AppSharedPreferences();
@ -190,15 +190,21 @@ class _clinic_listState extends State<ClinicList> {
navigateTo(context, LiveCarePatmentPage(getERAppointmentFeesList: getERAppointmentFeesList, waitingTime: waitingTime, clinicName: selectedClinicName)).then( navigateTo(context, LiveCarePatmentPage(getERAppointmentFeesList: getERAppointmentFeesList, waitingTime: waitingTime, clinicName: selectedClinicName)).then(
(value) { (value) {
if (value) { if (value) {
askVideoCallPermission().then((value) { if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") {
if (value) { addNewCallForPatientER(projectViewModel.user.patientID.toString() + "" + DateTime.now().millisecondsSinceEpoch.toString());
if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { } else {
showLiveCareInfoDialog(getERAppointmentFeesList); navigateToPaymentMethod(getERAppointmentFeesList, context);
} else { }
navigateToPaymentMethod(getERAppointmentFeesList, context);
} // askVideoCallPermission().then((value) {
} // if (value) {
}); // if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") {
// addNewCallForPatientER(projectViewModel.user.patientID.toString() + "" + DateTime.now().millisecondsSinceEpoch.toString());
// } else {
// navigateToPaymentMethod(getERAppointmentFeesList, context);
// }
// }
// });
} }
}, },
); );
@ -290,11 +296,15 @@ class _clinic_listState extends State<ClinicList> {
}); });
} }
String _paymentMethod;
String _amount;
openPayment(List<String> paymentMethod, AuthenticatedUser authenticatedUser, double amount, AppoitmentAllHistoryResultList appo) { openPayment(List<String> paymentMethod, AuthenticatedUser authenticatedUser, double amount, AppoitmentAllHistoryResultList appo) {
_paymentMethod = paymentMethod.first;
_amount = amount.toString();
browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context); browser = new MyInAppBrowser(onExitCallback: onBrowserExit, appo: appo, onLoadStartCallback: onBrowserLoadStart, context: context);
browser.openPaymentBrowser(amount, "LiveCare Payment", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), "12", authenticatedUser.emailAddress, paymentMethod[0], browser.openPaymentBrowser(amount, "LiveCare Payment", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), "12", authenticatedUser.emailAddress, paymentMethod[0],
authenticatedUser.patientType, authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, browser, false, "4", selectedClinicID.toString(), "", "", "", "", paymentMethod[1]); authenticatedUser.patientType, authenticatedUser.firstName, authenticatedUser.patientID, authenticatedUser, browser, false, "4", selectedClinicID, "", "", "", "", paymentMethod[1]);
} }
onBrowserLoadStart(String url) { onBrowserLoadStart(String url) {
@ -328,21 +338,33 @@ class _clinic_listState extends State<ClinicList> {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) { service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
print("Printing Payment Status Reponse!!!!");
print(res);
String paymentInfo = res['Response_Message']; String paymentInfo = res['Response_Message'];
if (paymentInfo == 'Success') { if (paymentInfo == 'Success') {
addNewCallForPatientER(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo)); addNewCallForPatientER(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo));
String txn_ref = res['Merchant_Reference'];
String amount = res['Amount'].toString();
String payment_method = res['PaymentMethod'];
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
projectViewModel.analytics.appointment.payment_success(
appointment_type: 'livecare', payment_method: payment_method, clinic: selectedClinicName, hospital: "", payment_type: 'appointment', txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref);
} else { } else {
AppToast.showErrorToast(message: res['Response_Message']); AppToast.showErrorToast(message: res['Response_Message']);
paymentFail("400", res['Response_Message'], _amount);
} }
}).catchError((err) { }).catchError((err) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: err); AppToast.showErrorToast(message: err);
print(err); paymentFail("400", err.toString(),_amount);
}); });
} }
paymentFail(String errorCode, errorMessage, String amount,){
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
projectViewModel.analytics.advancePayments.payment_fail(
appointment_type: 'livecare', payment_method: _paymentMethod, payment_type: 'appointment', clinic: selectedClinicName, hospital: "", txn_amount: "$amount", txn_currency: currency, error_code: errorCode, error_message: errorMessage
);
}
addNewCallForPatientER(String clientRequestID) { addNewCallForPatientER(String clientRequestID) {
LiveCareService service = new LiveCareService(); LiveCareService service = new LiveCareService();
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
@ -380,9 +402,13 @@ class _clinic_listState extends State<ClinicList> {
liveCareOfflineClinicsListResponse.add(clinic); liveCareOfflineClinicsListResponse.add(clinic);
} }
}); });
if(liveCareClinicIDs != null) {
selectedClinicID = liveCareClinicsListResponse.patientERGetClinicsList[0].serviceID; selectedClinicID = int.parse(liveCareClinicIDs.split("-")[2]);
selectedClinicName = liveCareClinicsListResponse.patientERGetClinicsList[0].serviceName; selectedClinicName = liveCareClinicIDs.split("-")[0];
} else {
selectedClinicID = liveCareClinicsListResponse.patientERGetClinicsList[0].serviceID;
selectedClinicName = liveCareClinicsListResponse.patientERGetClinicsList[0].serviceName;
}
isDataLoaded = true; isDataLoaded = true;
}); });
} else { } else {

@ -376,5 +376,11 @@ class _Login extends State<Login> {
this.mobileNo = registerData['PatientMobileNumber'].toString(); this.mobileNo = registerData['PatientMobileNumber'].toString();
}); });
} }
// var voipToken = await sharedPref.getString("VOIPToken");
// setState(() {
// nationalIDorFile.text = voipToken;
// });
} }
} }

@ -44,7 +44,7 @@ class ViewDoctorResponsesPage extends StatelessWidget {
itemBuilder: (context, _index) { itemBuilder: (context, _index) {
return Container( return Container(
padding: const EdgeInsets.only(left: 20, right: 12, top: 12, bottom: 12), padding: const EdgeInsets.only(left: 20, right: 12, top: 12, bottom: 12),
height: 110, height: 130,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(10.0), Radius.circular(10.0),
@ -86,7 +86,7 @@ class ViewDoctorResponsesPage extends StatelessWidget {
Container( Container(
margin: EdgeInsets.only(top: 10.0), margin: EdgeInsets.only(top: 10.0),
child: Text( child: Text(
doctorResponse.transactions[_index]['DoctorResponse'], doctorResponse.transactions[_index]['InfoStatusDescription'],
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
color: Color(0xff2E303A), color: Color(0xff2E303A),

@ -33,11 +33,7 @@ class AskDoctorPage extends StatelessWidget {
return Container( return Container(
margin: EdgeInsets.only(left: 50.0, right: 50.0), margin: EdgeInsets.only(left: 50.0, right: 50.0),
child: Center( child: Center(
child: Text(TranslationBase.of(context).askDocEmpty, textAlign: TextAlign.center, style: TextStyle( child: Text(TranslationBase.of(context).askDocEmpty, textAlign: TextAlign.center, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: CustomColors.accentColor)),
fontSize: 14,
fontWeight: FontWeight.w400,
color: CustomColors.accentColor
)),
), ),
); );
} }
@ -81,23 +77,20 @@ class AskDoctorPage extends StatelessWidget {
return DoctorView( return DoctorView(
doctor: doctorList, doctor: doctorList,
isLiveCareAppointment: false, isLiveCareAppointment: false,
isShowFlag: false,
onTap: () { onTap: () {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
service.getCallInfoHoursResult(doctorId: _doctor.doctorID, projectId: _doctor.projectID).then((res) { service.getCallInfoHoursResult(doctorId: _doctor.doctorID, projectId: _doctor.projectID).then((res) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (res['ErrorEndUserMessage'] == null) { Navigator.push(
Navigator.push( context,
context, FadePage(
FadePage( page: RequestTypePage(doctorList: _doctor),
page: RequestTypePage(doctorList: _doctor), ),
), );
);
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
}).catchError((err) { }).catchError((err) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (err != null) AppToast.showErrorToast(message: err); if (err != null) AppToast.showErrorToast(message: err.toString());
print(err); print(err);
}); });
}, },

@ -71,7 +71,7 @@ class DoctorResponse extends StatelessWidget {
); );
}, },
child: Container( child: Container(
height: 75, height: 100,
margin: EdgeInsets.only(top: 8, bottom: 8), margin: EdgeInsets.only(top: 8, bottom: 8),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
@ -101,8 +101,8 @@ class DoctorResponse extends StatelessWidget {
Padding( Padding(
padding: const EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), padding: const EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0),
child: Icon(projectViewModel.isArabic child: Icon(projectViewModel.isArabic
? Icons.arrow_back_ios ? Icons.arrow_forward_ios
: Icons.arrow_forward_ios), : Icons.arrow_back_ios),
) )
], ],
), ),
@ -144,7 +144,7 @@ class DoctorResponse extends StatelessWidget {
return InkWell( return InkWell(
onTap: () {}, onTap: () {},
child: Container( child: Container(
height: 70, height: 85,
margin: EdgeInsets.only(top: 8, bottom: 8), margin: EdgeInsets.only(top: 8, bottom: 8),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
@ -171,9 +171,12 @@ class DoctorResponse extends StatelessWidget {
), ),
), ),
), ),
Icon(projectViewModel.isArabic Padding(
? Icons.arrow_forward padding: const EdgeInsets.all(8.0),
: Icons.arrow_back_ios) child: Icon(projectViewModel.isArabic
? Icons.arrow_forward_ios
: Icons.arrow_back_ios),
)
], ],
), ),
), ),

@ -24,6 +24,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:pay/pay.dart'; import 'package:pay/pay.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -128,7 +129,11 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
height: 100.0, height: 100.0,
padding: EdgeInsets.all(7.0), padding: EdgeInsets.all(7.0),
width: MediaQuery.of(context).size.width * 0.30, width: MediaQuery.of(context).size.width * 0.30,
child: Image.asset(getImagePath(widget.selectedPaymentMethod)), child: widget.selectedPaymentMethod == "ApplePay"
? SvgPicture.asset(
getImagePath(widget.selectedPaymentMethod),
)
: Image.asset(getImagePath(widget.selectedPaymentMethod)),
), ),
Text( Text(
'${widget.advanceModel.amount} ' + TranslationBase.of(context).sar, '${widget.advanceModel.amount} ' + TranslationBase.of(context).sar,
@ -206,16 +211,16 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
() { () {
projectViewModel.analytics.advancePayments.payment_confirm(method: widget.selectedPaymentMethod.toLowerCase(), type: 'wallet'); projectViewModel.analytics.advancePayments.payment_confirm(method: widget.selectedPaymentMethod.toLowerCase(), type: 'wallet');
GifLoaderDialogUtils.showMyDialog(context); if (widget.advanceModel.fileNumber == projectViewModel.user.patientID.toString()) {
model openPayment(widget.selectedPaymentMethod, widget.authenticatedUser, double.parse(widget.advanceModel.amount), null);
.sendActivationCodeForAdvancePayment( } else {
patientID: int.parse(widget.advanceModel.fileNumber), GifLoaderDialogUtils.showMyDialog(context);
projectID: widget.advanceModel.hospitalsModel.iD) model.sendActivationCodeForAdvancePayment(patientID: int.parse(widget.advanceModel.fileNumber), projectID: widget.advanceModel.hospitalsModel.iD).then((value) {
.then((value) { GifLoaderDialogUtils.hideDialog(context);
GifLoaderDialogUtils.hideDialog(context); if (model.state != ViewState.ErrorLocal && model.state != ViewState.Error) showSMSDialog(model);
if (model.state != ViewState.ErrorLocal && });
model.state != ViewState.Error) showSMSDialog(model); }
});
// startApplePay(); // startApplePay();
// if() // if()
// GifLoaderDialogUtils.showMyDialog(context); // GifLoaderDialogUtils.showMyDialog(context);
@ -232,7 +237,6 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
} }
startApplePay() { startApplePay() {
// GifLoaderDialogUtils.showMyDialog(context);
ApplePayResponse applePayResponse; ApplePayResponse applePayResponse;
var _paymentItems = [ var _paymentItems = [
PaymentItem( PaymentItem(
@ -332,7 +336,8 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
return 'assets/images/new/payment/installments.png'; return 'assets/images/new/payment/installments.png';
break; break;
case "ApplePay": case "ApplePay":
return 'assets/images/new/payment/Apple_Pay.png'; return 'assets/images/new/payment/Apple_Pay.svg';
// return 'assets/images/new/payment/Apple_Pay.png';
break; break;
case "TAMARA": case "TAMARA":
return 'assets/images/new/payment/tamara.png'; return 'assets/images/new/payment/tamara.png';
@ -347,8 +352,26 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
transID = Utils.getAdvancePaymentTransID(widget.advanceModel.hospitalsModel.iD, int.parse(widget.advanceModel.fileNumber)); transID = Utils.getAdvancePaymentTransID(widget.advanceModel.hospitalsModel.iD, int.parse(widget.advanceModel.fileNumber));
browser.openPaymentBrowser(amount, "Advance Payment", transID, widget.advanceModel.hospitalsModel.iD.toString(), widget.advanceModel.email, paymentMethod, browser.openPaymentBrowser(
widget.patientInfoAndMobileNumber.patientType, widget.advanceModel.patientName, widget.advanceModel.fileNumber, authenticatedUser, browser, false, "3", "", "", "", "", "", widget.installmentPlan); amount,
"Advance Payment",
transID,
widget.advanceModel.hospitalsModel.iD.toString(),
widget.advanceModel.email,
paymentMethod,
widget.patientInfoAndMobileNumber.patientType,
widget.advanceModel.patientName,
widget.advanceModel.fileNumber,
authenticatedUser,
browser,
false,
"3",
"0",
"",
"",
"",
"",
widget.installmentPlan);
} }
onBrowserLoadStart(String url) { onBrowserLoadStart(String url) {
@ -384,17 +407,39 @@ class _ConfirmPaymentPageState extends State<ConfirmPaymentPage> {
String paymentInfo = res['Response_Message']; String paymentInfo = res['Response_Message'];
if (paymentInfo == 'Success') { if (paymentInfo == 'Success') {
createAdvancePayment(res, appo); createAdvancePayment(res, appo);
String txn_ref = res['Merchant_Reference'];
String amount = res['Amount'].toString();
String payment_method = res['PaymentMethod'];
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
final hospital = widget.advanceModel.hospitalsModel.name;
projectViewModel.analytics.advancePayments.payment_success(
appointment_type: '', payment_method: payment_method, payment_type: 'wallet', clinic: '', hospital: hospital, txn_amount: "$amount", txn_currency: currency, txn_number: txn_ref
);
} else { } else {
GifLoaderDialogUtils.hideDialog(AppGlobal.context); GifLoaderDialogUtils.hideDialog(AppGlobal.context);
AppToast.showErrorToast(message: res['Response_Message']); AppToast.showErrorToast(message: res['Response_Message']);
paymentFail("400", paymentInfo);
} }
}).catchError((err) { }).catchError((err) {
GifLoaderDialogUtils.hideDialog(AppGlobal.context); GifLoaderDialogUtils.hideDialog(AppGlobal.context);
AppToast.showErrorToast(message: err); AppToast.showErrorToast(message: err);
print(err); paymentFail("400", err.toString());
}); });
} }
paymentFail(String errorCode, errorMessage){
final hospital = widget.advanceModel.hospitalsModel.name;
final amount = widget.advanceModel.amount;
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
projectViewModel.analytics.advancePayments.payment_fail(
appointment_type: '', payment_method: widget.selectedPaymentMethod, payment_type: 'wallet', clinic: '', hospital: hospital, txn_amount: "$amount", txn_currency: currency, error_code: errorCode, error_message: errorMessage
);
}
createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { createAdvancePayment(res, AppoitmentAllHistoryResultList appo) {
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
String paymentReference = res['Fort_id'].toString(); String paymentReference = res['Fort_id'].toString();

@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/models/header_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_inp.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_inp.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart';
@ -384,22 +385,23 @@ class PrescriptionItemsPage extends StatelessWidget {
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
child: DefaultButton( child: DefaultButton(
TranslationBase.of(context).resendOrder, TranslationBase.of(context).resendOrder,
// ((!projectViewModel.havePrivilege(62)) || projectViewModel.user.outSA == 1 || model.isMedDeliveryAllowed == false) () {
// ? null if (model.isMedDeliveryAllowed == false) {
// : AppToast.showErrorToast(message: TranslationBase.of(context).prescriptionDeliveryError);
() => { } else {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: PrescriptionDeliveryAddressPage( page: PrescriptionDeliveryAddressPage(
prescriptions: prescriptions, prescriptions: prescriptions,
prescriptionReportList: model.prescriptionReportList, prescriptionReportList: model.prescriptionReportList,
prescriptionReportEnhList: model.prescriptionReportEnhList, prescriptionReportEnhList: model.prescriptionReportEnhList,
), ),
), ),
) );
}, }
color: Color(0xff359846), },
color: model.isMedDeliveryAllowed == false ? Color(0xff575757) : Color(0xff359846),
disabledColor: Color(0xff575757), disabledColor: Color(0xff575757),
), ),
), ),

@ -51,14 +51,14 @@ class _syncHealthDataButtonState extends State<syncHealthDataButton> {
if (Platform.isAndroid) { if (Platform.isAndroid) {
if (await PermissionService.isHealthDataPermissionEnabled()) { if (await PermissionService.isHealthDataPermissionEnabled()) {
await health.requestAuthorization(types).then((value) { await health.requestAuthorization(types).then((value) {
if(value) { if (value) {
readAll(); readAll();
} }
}); });
} else { } else {
Utils.showPermissionConsentDialog(context, TranslationBase.of(context).physicalActivityPermission, () async { Utils.showPermissionConsentDialog(context, TranslationBase.of(context).physicalActivityPermission, () async {
await health.requestAuthorization(types).then((value) { await health.requestAuthorization(types).then((value) {
if(value) { if (value) {
readAll(); readAll();
} }
}); });
@ -66,7 +66,7 @@ class _syncHealthDataButtonState extends State<syncHealthDataButton> {
} }
} else { } else {
await health.requestAuthorization(types).then((value) { await health.requestAuthorization(types).then((value) {
if(value) { if (value) {
readAll(); readAll();
} }
}); });
@ -82,8 +82,6 @@ class _syncHealthDataButtonState extends State<syncHealthDataButton> {
Med_InsertTransactionsInputsList.clear(); Med_InsertTransactionsInputsList.clear();
DateTime startDate = DateTime.now().subtract(new Duration(days: 30)); DateTime startDate = DateTime.now().subtract(new Duration(days: 30));
await checkPermissions();
try { try {
List<HealthDataPoint> healthData = await health.getHealthDataFromTypes(startDate, DateTime.now(), types); List<HealthDataPoint> healthData = await health.getHealthDataFromTypes(startDate, DateTime.now(), types);
_healthDataList.addAll(healthData); _healthDataList.addAll(healthData);

@ -10,6 +10,7 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_ios_voip_kit/flutter_ios_voip_kit.dart';
import 'OpenTokPlatformBridge.dart'; import 'OpenTokPlatformBridge.dart';
@ -36,6 +37,7 @@ class OpenTokState extends State<OpenTokConnectCallPage>{
var audioMute = false; var audioMute = false;
var videoMute = false; var videoMute = false;
final voIPKit = FlutterIOSVoIPKit.instance;
initOpenTok(){ initOpenTok(){
openTokPlatform = OpenTokPlatformBridge.init( openTokPlatform = OpenTokPlatformBridge.init(
@ -196,6 +198,7 @@ class OpenTokState extends State<OpenTokConnectCallPage>{
Future<void> _onHangup() async { Future<void> _onHangup() async {
print('onHangup'); print('onHangup');
await openTokPlatform.hangupCall(); await openTokPlatform.hangupCall();
voIPKit.endCall();
endCallAPI(); endCallAPI();
Navigator.of(context).pop(); Navigator.of(context).pop();
} }

@ -3,10 +3,12 @@ import 'dart:io';
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/service/base_service.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/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart';
import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart';
import 'package:diplomaticquarterapp/models/Appointments/doctor_pre_post_image.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/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/models/Request.dart';
import 'package:diplomaticquarterapp/models/apple_pay_request.dart'; import 'package:diplomaticquarterapp/models/apple_pay_request.dart';
@ -28,6 +30,7 @@ class DoctorsListService extends BaseService {
double long; double long;
String deviceToken; String deviceToken;
String tokenID; String tokenID;
List<LaserBodyPart> selectedBodyPartList = [];
Future<Map> getDoctorsList(int clinicID, int projectID, bool isNearest, BuildContext context, {doctorId, doctorName, isContinueDentalPlan = false}) async { Future<Map> getDoctorsList(int clinicID, int projectID, bool isNearest, BuildContext context, {doctorId, doctorName, isContinueDentalPlan = false}) async {
Map<String, dynamic> request; Map<String, dynamic> request;
@ -317,8 +320,8 @@ class DoctorsListService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future<Map> insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, BuildContext context, Future<Map> insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, int initialSlotDuration, BuildContext context,
[String procedureID, num testTypeEnum, num testProcedureEnum]) async { [String procedureID, num testTypeEnum, num testProcedureEnum, ProjectViewModel projectViewModel]) async {
Map<String, dynamic> request; Map<String, dynamic> request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) { if (await this.sharedPref.getObject(USER_PROFILE) != null) {
@ -339,13 +342,14 @@ class DoctorsListService extends BaseService {
"ProcedureID": procedureID, "ProcedureID": procedureID,
"TestTypeEnum": testTypeEnum, "TestTypeEnum": testTypeEnum,
"TestProcedureEnum": testProcedureEnum, "TestProcedureEnum": testProcedureEnum,
"InitialSlotDuration": 0, "InitialSlotDuration": initialSlotDuration,
"StrAppointmentDate": selectedDate, "StrAppointmentDate": selectedDate,
"IsVirtual": false, "IsVirtual": false,
"DeviceType": Platform.isIOS ? 'iOS' : 'Android', "DeviceType": Platform.isIOS ? 'iOS' : 'Android',
"BookedBy": 102, "BookedBy": 102,
"VisitType": 1, "VisitType": 1,
"VisitFor": 1, "VisitFor": 1,
"GenderID": authUser.gender,
"VersionID": req.VersionID, "VersionID": req.VersionID,
"Channel": req.Channel, "Channel": req.Channel,
"LanguageID": languageID == 'ar' ? 1 : 2, "LanguageID": languageID == 'ar' ? 1 : 2,
@ -360,10 +364,18 @@ class DoctorsListService extends BaseService {
"PatientType": authUser.patientType "PatientType": authUser.patientType
}; };
if(clinicID == 253) {
List<String> procedureID = projectViewModel.selectedBodyPartList.map((element) => element.id.toString()).toList();
request["GeneralProcedureList"] = procedureID;
request["InitialSlotDuration"] = projectViewModel.laserSelectionDuration;
}
dynamic localRes; dynamic localRes;
await baseAppClient.post(INSERT_SPECIFIC_APPOINTMENT, onSuccess: (response, statusCode) async { await baseAppClient.post(INSERT_SPECIFIC_APPOINTMENT, onSuccess: (response, statusCode) async {
localRes = response; localRes = response;
projectViewModel.selectedBodyPartList.clear();
projectViewModel.laserSelectionDuration = 0;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
throw error; throw error;
}, body: request); }, body: request);
@ -461,6 +473,28 @@ class DoctorsListService extends BaseService {
return Future.value(localRes); return Future.value(localRes);
} }
Future<Map> setOnlineCheckInForAppointment(String appoID, int projectID, BuildContext context) async {
Map<String, dynamic> request;
if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE));
authUser = data;
}
request = {
"ProjectID": projectID,
"AppointmentNo": appoID
};
dynamic localRes;
await baseAppClient.post(SET_ONLINE_CHECKIN_FOR_APPOINTMENT, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
return Future.value(localRes);
}
Future<Map> getLiveCareAppointmentPatientShare(String appoID, int clinicID, int projectID, BuildContext context) async { Future<Map> getLiveCareAppointmentPatientShare(String appoID, int clinicID, int projectID, BuildContext context) async {
Map<String, dynamic> request; Map<String, dynamic> request;

@ -201,6 +201,7 @@ class LiveCareService extends BaseService {
Map<String, dynamic> request; Map<String, dynamic> request;
String deviceToken; String deviceToken;
String voipToken = await sharedPref.getString(APNS_TOKEN);
getDeviceToken().then((value) { getDeviceToken().then((value) {
print(value); print(value);
deviceToken = value; deviceToken = value;
@ -215,8 +216,8 @@ class LiveCareService extends BaseService {
"ErServiceID": serviceID, "ErServiceID": serviceID,
"ClientRequestID": clientRequestID, "ClientRequestID": clientRequestID,
"DeviceToken": deviceToken, "DeviceToken": deviceToken,
"VoipToken": "", "VoipToken": voipToken,
// "IsFlutter": true, "IsFlutter": true,
"Latitude": await this.sharedPref.getDouble(USER_LAT), "Latitude": await this.sharedPref.getDouble(USER_LAT),
"Longitude": await this.sharedPref.getDouble(USER_LONG), "Longitude": await this.sharedPref.getDouble(USER_LONG),
"DeviceType": Platform.isIOS ? 'iOS' : 'Android', "DeviceType": Platform.isIOS ? 'iOS' : 'Android',

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:ui'; import 'dart:ui';
import 'package:device_calendar/device_calendar.dart'; import 'package:device_calendar/device_calendar.dart';
import 'package:timezone/timezone.dart';
final DeviceCalendarPlugin deviceCalendarPlugin = DeviceCalendarPlugin(); final DeviceCalendarPlugin deviceCalendarPlugin = DeviceCalendarPlugin();
@ -52,8 +53,17 @@ class CalendarUtils {
// daysOfWeek: daysOfWeek, // daysOfWeek: daysOfWeek,
endDate: scheduleDateTime, endDate: scheduleDateTime,
); );
Location _currentLocation;
if (DateTime.now().timeZoneName == "+04")
_currentLocation = getLocation('Asia/Dubai');
else
_currentLocation = getLocation('Asia/Riyadh');
TZDateTime scheduleDateTimeUTZ = TZDateTime.from(scheduleDateTime, _currentLocation);
print("eventId " + eventId); print("eventId " + eventId);
Event event = Event(writableCalendars.id, recurrenceRule: recurrenceRule, start: scheduleDateTime, end: scheduleDateTime.add(Duration(minutes: 30)), title: title, description: description); Event event = Event(writableCalendars.id, recurrenceRule: recurrenceRule, start: scheduleDateTimeUTZ, end: scheduleDateTimeUTZ.add(Duration(minutes: 30)), title: title, description: description);
deviceCalendarPlugin.createOrUpdateEvent(event).catchError((e) { deviceCalendarPlugin.createOrUpdateEvent(event).catchError((e) {
print("catchError " + e.toString()); print("catchError " + e.toString());
}).whenComplete(() { }).whenComplete(() {

@ -5,7 +5,6 @@ class DateUtil {
/// convert String To Date function /// convert String To Date function
/// [date] String we want to convert /// [date] String we want to convert
static DateTime convertStringToDate(String date) { static DateTime convertStringToDate(String date) {
// /Date(1585774800000+0300)/
if (date != null) { if (date != null) {
const start = "/Date("; const start = "/Date(";
const end = "+0300)"; const end = "+0300)";
@ -14,7 +13,7 @@ class DateUtil {
return DateTime.fromMillisecondsSinceEpoch( return DateTime.fromMillisecondsSinceEpoch(
int.parse( int.parse(
date.substring(startIndex + start.length, endIndex), date.substring(startIndex + start.length, endIndex),
), )
); );
} else } else
return DateTime.now(); return DateTime.now();

@ -1,35 +1,53 @@
import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_response_model.dart';
import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart';
import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notification_details_page.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart';
import 'package:diplomaticquarterapp/pages/webRTC/OpenTok/OpenTok.dart';
import 'package:diplomaticquarterapp/uitl/app-permissions.dart'; import 'package:diplomaticquarterapp/uitl/app-permissions.dart';
import 'package:flutter/cupertino.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:flutter/material.dart';
import 'package:huawei_push/huawei_push.dart' as h_push;
import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:firebase_messaging/firebase_messaging.dart' as fir; import 'package:firebase_messaging/firebase_messaging.dart' as fir;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart'; import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_ios_voip_kit/call_state_type.dart';
import 'package:flutter_ios_voip_kit/flutter_ios_voip_kit.dart';
import 'package:huawei_push/huawei_push.dart' as h_push;
import 'app_shared_preferences.dart'; import 'app_shared_preferences.dart';
import 'navigation_service.dart'; import 'navigation_service.dart';
// |--> Push Notification Background // |--> Push Notification Background
Future<dynamic> backgroundMessageHandler(dynamic message) async { Future<dynamic> backgroundMessageHandler(dynamic message) async {
print("Firebase backgroundMessageHandler!!!");
fir.RemoteMessage message_; fir.RemoteMessage message_;
if (message is h_push.RemoteMessage) { if (message is h_push.RemoteMessage) {
// if huawei remote message convert it to Firebase Remote Message // if huawei remote message convert it to Firebase Remote Message
message_ = toFirebaseRemoteMessage(message); message_ = toFirebaseRemoteMessage(message);
h_push.Push.localNotification({h_push.HMSLocalNotificationAttr.TITLE: 'Background Message', h_push.HMSLocalNotificationAttr.MESSAGE: "By: BackgroundMessageHandler"});
} }
if (message.data != null && message.data['is_call'] == 'true') { if (message.data != null && (message.data['is_call'] == 'true' || message.data['is_call'] == true)) {
_incomingCall(message.data); _incomingCall(message.data);
return; return;
} else {
GetNotificationsResponseModel notification = new GetNotificationsResponseModel();
notification.createdOn = DateUtil.convertDateToString(DateTime.now());
notification.messageTypeData = message.data['picture'];
notification.message = message.data['message'];
await NavigationService.navigateToPage(NotificationsDetailsPage(
notification: notification,
));
} }
h_push.Push.localNotification({h_push.HMSLocalNotificationAttr.TITLE: 'Background Message', h_push.HMSLocalNotificationAttr.MESSAGE: "By: BackgroundMessageHandler"});
} }
// Push Notification Background <--| // Push Notification Background <--|
@ -67,6 +85,10 @@ RemoteMessage toFirebaseRemoteMessage(h_push.RemoteMessage message) {
return fire_message; return fire_message;
} }
callPage(String sessionID, String token) async {
await NavigationService.navigateToPage(OpenTokConnectCallPage(apiKey: OPENTOK_API_KEY, sessionId: sessionID, token: token));
}
_incomingCall(Map data) async { _incomingCall(Map data) async {
LandingPage.incomingCallData = IncomingCallData.fromJson(data); LandingPage.incomingCallData = IncomingCallData.fromJson(data);
if (LandingPage.isOpenCallPage == false) { if (LandingPage.isOpenCallPage == false) {
@ -82,6 +104,30 @@ _incomingCall(Map data) async {
class PushNotificationHandler { class PushNotificationHandler {
final BuildContext context; final BuildContext context;
static PushNotificationHandler _instance; static PushNotificationHandler _instance;
final voIPKit = FlutterIOSVoIPKit.instance;
Timer timeOutTimer;
bool isTalking = false;
var data = {
"AppointmentNo": "2016059247",
"ProjectID": "15",
"NotificationType": "10",
"background": "0",
"doctorname": "Call from postman",
"clinicname": "LIVECARE FAMILY MEDICINE AND GP",
"speciality": "General Practioner",
"appointmentdate": "2022-01-19",
"appointmenttime": "12:10",
"PatientName": "Testing",
"session_id": "1_MX40NjIwOTk2Mn5-MTY1NDE2NDQxMjc2Mn5xc3NCZkNIejJOdzgzTkg2TmlXblhQdnl-fg",
"token":
"T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9MTliNTA3NDAxYmU0MjI5OGY5NTcxZTdhNzQyMTcyZjRjMjBhNjljZTpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWTFOREUyTkRReE1qYzJNbjV4YzNOQ1prTkllakpPZHpnelRrZzJUbWxYYmxoUWRubC1mZyZjcmVhdGVfdGltZT0xNjU0MTY0NDEzJm5vbmNlPTAuNjM3ODkzNDk4NDQ2NTIxOSZyb2xlPW1vZGVyYXRvciZleHBpcmVfdGltZT0xNjU0MjUwODEzJmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9",
"DoctorImageURL": "https://image.shutterstock.com/image-vector/sample-stamp-square-grunge-sign-260nw-1474408826.jpg",
"callerID": "9920",
"PatientID": "1231755",
"is_call": "true"
};
PushNotificationHandler(this.context) { PushNotificationHandler(this.context) {
PushNotificationHandler._instance = this; PushNotificationHandler._instance = this;
@ -89,7 +135,90 @@ class PushNotificationHandler {
static PushNotificationHandler getInstance() => _instance; static PushNotificationHandler getInstance() => _instance;
void _timeOut({
int seconds = 15,
}) async {
timeOutTimer = Timer(Duration(seconds: seconds), () async {
print('🎈 example: timeOut');
final incomingCallerName = await voIPKit.getIncomingCallerName();
voIPKit.unansweredIncomingCall(
skipLocalNotification: false,
missedCallTitle: '📞 Missed call',
missedCallBody: 'There was a call from $incomingCallerName',
);
});
}
init() async { init() async {
// VoIP Callbacks
voIPKit.getVoIPToken().then((value) {
print('🎈 example: getVoIPToken: $value');
AppSharedPreferences().setString(APNS_TOKEN, value);
});
voIPKit.onDidUpdatePushToken = (
String token,
) {
print('🎈 example: onDidUpdatePushToken: $token');
AppSharedPreferences().setString(APNS_TOKEN, token);
};
voIPKit.onDidReceiveIncomingPush = (
Map<String, dynamic> payload,
) async {
print('🎈 example: onDidReceiveIncomingPush $payload');
_timeOut();
};
voIPKit.onDidRejectIncomingCall = (
String uuid,
String callerId,
) {
if (isTalking) {
return;
}
print('🎈 example: onDidRejectIncomingCall $uuid, $callerId');
voIPKit.endCall();
timeOutTimer?.cancel();
};
voIPKit.onDidAcceptIncomingCall = (
String uuid,
String callerId,
) {
print('🎈 example: onDidAcceptIncomingCall $uuid, $callerId');
String sessionID = callerId.split("*")[0];
String token = callerId.split("*")[1];
print("🎈 SessionID: $sessionID");
print("🎈 Token: $token");
voIPKit.acceptIncomingCall(callerState: CallStateType.calling);
voIPKit.callConnected();
timeOutTimer?.cancel();
print("🎈 CALL ACCEPTED!!!");
Future.delayed(new Duration(milliseconds: 2000)).then((value) async {
print("🎈 Incoming Call!!!");
callPage(sessionID, token);
});
// print("🎈 Identity: $identity");
// print("🎈 Name: $name");
// setState(() {
// isTalking = true;
// });
};
if (Platform.isAndroid && (!await FlutterHmsGmsAvailability.isHmsAvailable)) {
final fcmToken = await FirebaseMessaging.instance.getToken();
if (fcmToken != null) onToken(fcmToken);
}
if (Platform.isIOS) { if (Platform.isIOS) {
final permission = await FirebaseMessaging.instance.requestPermission(); final permission = await FirebaseMessaging.instance.requestPermission();
if (permission.authorizationStatus == AuthorizationStatus.denied) return; if (permission.authorizationStatus == AuthorizationStatus.denied) return;
@ -116,14 +245,40 @@ class PushNotificationHandler {
h_push.Push.registerBackgroundMessageHandler(backgroundMessageHandler); h_push.Push.registerBackgroundMessageHandler(backgroundMessageHandler);
} else { } else {
// 'Android GMS or iOS' (Handle Firebase Messaging Streams) // 'Android GMS or iOS' (Handle Firebase Messaging Streams
FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage message) async {
print("Firebase getInitialMessage!!!");
subscribeFCMTopic();
if (Platform.isIOS)
await Future.delayed(Duration(milliseconds: 3000)).then((value) {
if (message != null) newMessage(message);
});
else if (message != null) newMessage(message);
});
FirebaseMessaging.onMessage.listen((RemoteMessage message) async { FirebaseMessaging.onMessage.listen((RemoteMessage message) async {
newMessage(message); print("Firebase onMessage!!!");
// Utils.showPermissionConsentDialog(context, "onMessage", (){});
// newMessage(message);
if (Platform.isIOS)
await Future.delayed(Duration(milliseconds: 3000)).then((value) {
newMessage(message);
});
else
newMessage(message);
}); });
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) { FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) async {
newMessage(message); print("Firebase onMessageOpenedApp!!!");
// Utils.showPermissionConsentDialog(context, "onMessageOpenedApp", (){});
// newMessage(message);
if (Platform.isIOS)
await Future.delayed(Duration(milliseconds: 3000)).then((value) {
newMessage(message);
});
else
newMessage(message);
}); });
FirebaseMessaging.instance.onTokenRefresh.listen((fcm_token) { FirebaseMessaging.instance.onTokenRefresh.listen((fcm_token) {
@ -131,14 +286,31 @@ class PushNotificationHandler {
}); });
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler); FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
final fcmToken = await FirebaseMessaging.instance.getToken();
if (fcmToken != null) onToken(fcmToken);
} }
} }
newMessage(RemoteMessage remoteMessage) { subscribeFCMTopic() async {
if (remoteMessage.data['is_call'] == 'true' || remoteMessage.data['is_call'] == true) _incomingCall(remoteMessage.data); print("subscribeFCMTopic!!!");
await FirebaseMessaging.instance.unsubscribeFromTopic('all_hmg_patients').then((value) async {
await FirebaseMessaging.instance.subscribeToTopic('all_hmg_patients');
});
}
newMessage(RemoteMessage remoteMessage) async {
print("Remote Message: " + remoteMessage.data.toString());
if (remoteMessage.data['is_call'] == 'true' || remoteMessage.data['is_call'] == true) {
_incomingCall(remoteMessage.data);
} else {
GetNotificationsResponseModel notification = new GetNotificationsResponseModel();
notification.createdOn = DateUtil.convertDateToString(DateTime.now());
notification.messageTypeData = remoteMessage.data['picture'];
notification.message = remoteMessage.data['message'];
await NavigationService.navigateToPage(NotificationsDetailsPage(
notification: notification,
));
}
} }
onToken(String token) async { onToken(String token) async {

@ -2849,6 +2849,11 @@ class TranslationBase {
String get wifiPermission => localizedValues["wifiPermission"][locale.languageCode]; String get wifiPermission => localizedValues["wifiPermission"][locale.languageCode];
String get physicalActivityPermission => localizedValues["physicalActivityPermission"][locale.languageCode]; String get physicalActivityPermission => localizedValues["physicalActivityPermission"][locale.languageCode];
String get bluetoothPermission => localizedValues["bluetoothPermission"][locale.languageCode]; String get bluetoothPermission => localizedValues["bluetoothPermission"][locale.languageCode];
String get privacyPolicy => localizedValues["privacyPolicy"][locale.languageCode];
String get termsConditions => localizedValues["termsConditions"][locale.languageCode];
String get liveCarePermissions => localizedValues["liveCarePermissions"][locale.languageCode];
String get prescriptionDeliveryError => localizedValues["prescriptionDeliveryError"][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -165,7 +165,7 @@ class Utils {
} }
String loginIDPattern(loginType) { String loginIDPattern(loginType) {
var length = loginType == 1 ? 10 : 4; var length = loginType == 1 ? 10 : 1;
return "([0-9]{" + length.toString() + "})"; return "([0-9]{" + length.toString() + "})";
} }

@ -88,6 +88,10 @@ class AppMapState extends State<AppMap> {
_huaweiMapControllerComp.complete(controller); _huaweiMapControllerComp.complete(controller);
widget.onMapCreated(); widget.onMapCreated();
}, },
onCameraIdle: () {
print("onCameraIdle");
widget.onCameraIdle();
},
); );
} }
} }

@ -72,7 +72,7 @@ class BottomNavigationItem extends StatelessWidget {
), ),
], ],
) )
: (authenticatedUserObject.isLogin && model.isShowBadge && !projectViewModel.isLoginChild) : (authenticatedUserObject.isLogin && model.isShowBadge)
? Stack( ? Stack(
alignment: AlignmentDirectional.center, alignment: AlignmentDirectional.center,
children: [ children: [

@ -13,6 +13,7 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart';
import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart';
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
import 'package:diplomaticquarterapp/pages/Blood/user_agreement_page.dart';
import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notifications_page.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notifications_page.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart';
@ -39,6 +40,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:in_app_review/in_app_review.dart'; import 'package:in_app_review/in_app_review.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../config/size_config.dart'; import '../../config/size_config.dart';
import '../../locator.dart'; import '../../locator.dart';
@ -427,16 +429,21 @@ class _AppDrawerState extends State<AppDrawer> {
login(); login();
}, },
), ),
// InkWell( InkWell(
// child: DrawerItem( child: DrawerItem(TranslationBase.of(context).privacyPolicy, Icons.web, letterSpacing: -0.84, fontSize: 14, bottomLine: false),
// TranslationBase.of(context).appsetting, onTap: () {
// Icons.settings_input_composite), if (projectProvider.isArabic)
// onTap: () { launch("https://hmg.com/ar/Pages/Privacy.aspx");
// Navigator.of(context).pushNamed( else
// SETTINGS, launch("https://hmg.com/en/Pages/Privacy.aspx");
// ); },
// }, ),
// ) InkWell(
child: DrawerItem(TranslationBase.of(context).termsConditions, Icons.web, letterSpacing: -0.84, fontSize: 14, bottomLine: false),
onTap: () {
Navigator.of(context).push(FadePage(page: UserAgreementPage()));
},
)
], ],
)) ))
], ],

@ -24,13 +24,14 @@ var _InAppBrowserOptions = InAppBrowserClassOptions(
crossPlatform: InAppBrowserOptions(hideUrlBar: true), crossPlatform: InAppBrowserOptions(hideUrlBar: true),
ios: IOSInAppBrowserOptions( ios: IOSInAppBrowserOptions(
hideToolbarBottom: false, hideToolbarBottom: false,
toolbarBottomBackgroundColor: Colors.white,
)); ));
class MyInAppBrowser extends InAppBrowser { class MyInAppBrowser extends InAppBrowser {
_PAYMENT_TYPE paymentType; _PAYMENT_TYPE paymentType;
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/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 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
@ -147,6 +148,7 @@ class MyInAppBrowser extends InAppBrowser {
this.browser = browser; this.browser = browser;
await getPatientData(); await getPatientData();
if (paymentMethod == "ApplePay") { if (paymentMethod == "ApplePay") {
getDeviceToken();
MyChromeSafariBrowser safariBrowser = new MyChromeSafariBrowser(new MyInAppBrowser(), onExitCallback: browser.onExit, onLoadStartCallback: this.browser.onLoadStart, appo: this.appo); MyChromeSafariBrowser safariBrowser = new MyChromeSafariBrowser(new MyInAppBrowser(), onExitCallback: browser.onExit, onLoadStartCallback: this.browser.onLoadStart, appo: this.appo);
if (context != null) GifLoaderDialogUtils.showMyDialog(context); if (context != null) GifLoaderDialogUtils.showMyDialog(context);
@ -155,28 +157,28 @@ class MyInAppBrowser extends InAppBrowser {
ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest(); ApplePayInsertRequest applePayInsertRequest = new ApplePayInsertRequest();
applePayInsertRequest.clientRequestID = transactionID; applePayInsertRequest.clientRequestID = transactionID;
applePayInsertRequest.clinicID = clinicID != null ? clinicID : 0; applePayInsertRequest.clinicID = (clinicID != null && clinicID != "") ? clinicID : 0;
applePayInsertRequest.currency = authenticatedUser.outSA == 1 ? "AED" : "SAR"; applePayInsertRequest.currency = authenticatedUser.outSA == 1 ? "AED" : "SAR";
applePayInsertRequest.customerEmail = emailId; applePayInsertRequest.customerEmail = emailId;
applePayInsertRequest.customerID = authenticatedUser.patientID; applePayInsertRequest.customerID = authenticatedUser.patientID;
applePayInsertRequest.customerName = authenticatedUser.firstName; applePayInsertRequest.customerName = authenticatedUser.firstName;
applePayInsertRequest.deviceToken = deviceToken; applePayInsertRequest.deviceToken = await sharedPref.getString(PUSH_TOKEN);
applePayInsertRequest.doctorID = doctorID != null ? doctorID : 0; applePayInsertRequest.doctorID = (doctorID != null && doctorID != "") ? doctorID : 0;
applePayInsertRequest.projectID = projId; applePayInsertRequest.projectID = projId;
applePayInsertRequest.serviceID = servID; applePayInsertRequest.serviceID = servID;
applePayInsertRequest.channelID = 3; applePayInsertRequest.channelID = 3;
applePayInsertRequest.patientID = authenticatedUser.patientID; applePayInsertRequest.patientID = authenticatedUser.patientID;
applePayInsertRequest.patientTypeID = authenticatedUser.patientType; applePayInsertRequest.patientTypeID = authenticatedUser.patientType;
applePayInsertRequest.patientOutSA = authenticatedUser.outSA; applePayInsertRequest.patientOutSA = authenticatedUser.outSA;
applePayInsertRequest.appointmentDate = appoDate != null ? appoDate : null; applePayInsertRequest.appointmentDate = (appoDate != null && appoDate != "") ? appoDate : null;
applePayInsertRequest.appointmentNo = appoNo != null ? appoNo : 0; applePayInsertRequest.appointmentNo = (appoNo != null && appoNo != "") ? appoNo : 0;
applePayInsertRequest.orderDescription = orderDesc; applePayInsertRequest.orderDescription = orderDesc;
applePayInsertRequest.liveServiceID = LiveServID; applePayInsertRequest.liveServiceID = LiveServID.toString() == "" ? "0" : LiveServID.toString();
applePayInsertRequest.latitude = this.lat.toString(); applePayInsertRequest.latitude = this.lat.toString();
applePayInsertRequest.longitude = this.long.toString(); applePayInsertRequest.longitude = this.long.toString();
applePayInsertRequest.amount = amount.toString(); applePayInsertRequest.amount = amount.toString();
applePayInsertRequest.isSchedule = "0"; applePayInsertRequest.isSchedule = ((appoNo != null && appoNo != "") && (appoDate != null && appoDate != "")) ? "1" : "0";
applePayInsertRequest.language = await getLanguageID() == 'ar' ? 'AR' : 'EN'; applePayInsertRequest.language = await getLanguageID() == 'ar' ? 'ar' : 'en';
applePayInsertRequest.userName = authenticatedUser.patientID; applePayInsertRequest.userName = authenticatedUser.patientID;
applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html"; applePayInsertRequest.responseContinueURL = "http://hmg.com/Documents/success.html";
applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html"; applePayInsertRequest.backClickUrl = "http://hmg.com/Documents/success.html";
@ -247,6 +249,7 @@ class MyInAppBrowser extends InAppBrowser {
form = form.replaceFirst('PATIENT_OUT_SA', authUser.outSA == 0 ? false.toString() : true.toString()); 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', await sharedPref.getString(PUSH_TOKEN) + "," + await sharedPref.getString(APNS_TOKEN));
form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN));
form = form.replaceFirst('LATITUDE_VALUE', this.lat.toString()); form = form.replaceFirst('LATITUDE_VALUE', this.lat.toString());
form = form.replaceFirst('LONGITUDE_VALUE', this.long.toString()); form = form.replaceFirst('LONGITUDE_VALUE', this.long.toString());
@ -258,7 +261,7 @@ class MyInAppBrowser extends InAppBrowser {
if (servID != null) { if (servID != null) {
form = form.replaceFirst('SERV_ID', servID); form = form.replaceFirst('SERV_ID', servID);
form = form.replaceFirst('LIVE_SERVICE_ID', LiveServID); form = form.replaceFirst('LIVE_SERVICE_ID', LiveServID.toString());
} else { } else {
form = form.replaceFirst('SERV_ID', "2"); form = form.replaceFirst('SERV_ID', "2");
form = form.replaceFirst('LIVE_SERVICE_ID', "2"); form = form.replaceFirst('LIVE_SERVICE_ID', "2");

@ -7,15 +7,19 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:sms_retriever/sms_retriever.dart'; import 'package:sms_otp_auto_verify/sms_otp_auto_verify.dart';
import '../otp_widget.dart'; import '../otp_widget.dart';
class SMSOTP { class SMSOTP {
final type; final type;
final mobileNo; final mobileNo;
final Function onSuccess; final Function onSuccess;
final Function onFailure; final Function onFailure;
final context; final context;
int remainingTime = 120; int remainingTime = 120;
@ -39,8 +43,11 @@ class SMSOTP {
final TextEditingController _pinPutController = TextEditingController(); final TextEditingController _pinPutController = TextEditingController();
TextEditingController digit1 = TextEditingController(text: ""); TextEditingController digit1 = TextEditingController(text: "");
TextEditingController digit2 = TextEditingController(text: ""); TextEditingController digit2 = TextEditingController(text: "");
TextEditingController digit3 = TextEditingController(text: ""); TextEditingController digit3 = TextEditingController(text: "");
TextEditingController digit4 = TextEditingController(text: ""); TextEditingController digit4 = TextEditingController(text: "");
Map verifyAccountFormValue = { Map verifyAccountFormValue = {
@ -49,23 +56,44 @@ class SMSOTP {
'digit3': '', 'digit3': '',
'digit4': '', 'digit4': '',
}; };
final focusD1 = FocusNode(); final focusD1 = FocusNode();
final focusD2 = FocusNode(); final focusD2 = FocusNode();
final focusD3 = FocusNode(); final focusD3 = FocusNode();
final focusD4 = FocusNode(); final focusD4 = FocusNode();
String errorMsg; String errorMsg;
ProjectViewModel projectProvider; ProjectViewModel projectProvider;
String displayTime = ''; String displayTime = '';
String _code; String _code;
dynamic setState; dynamic setState;
static String signature; static String signature;
displayDialog(BuildContext context) async { displayDialog(BuildContext context) async {
// var signature = await checkSignature();
// print(signature);
// if (signature) {
// onSuccess(signature);
// }
return showDialog( return showDialog(
context: context, context: context,
barrierColor: Colors.black.withOpacity(0.63), barrierColor: Colors.black.withOpacity(0.63),
builder: (context) { builder: (context) {
projectProvider = Provider.of(context); projectProvider = Provider.of(context);
return Dialog( return Dialog(
backgroundColor: Colors.white, backgroundColor: Colors.white,
shape: RoundedRectangleBorder(), shape: RoundedRectangleBorder(),
@ -73,6 +101,9 @@ class SMSOTP {
child: StatefulBuilder(builder: (context, setState) { child: StatefulBuilder(builder: (context, setState) {
if (displayTime == '') { if (displayTime == '') {
startTimer(setState); startTimer(setState);
// startLister();
if (Platform.isAndroid) checkSignature();
} }
return Container( return Container(
@ -96,6 +127,7 @@ class SMSOTP {
constraints: BoxConstraints(), constraints: BoxConstraints(),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
this.onFailure(); this.onFailure();
}, },
) )
@ -162,20 +194,26 @@ class SMSOTP {
InputDecoration buildInputDecoration(BuildContext context) { InputDecoration buildInputDecoration(BuildContext context) {
return InputDecoration( return InputDecoration(
counterText: " ", counterText: " ",
// ts/images/password_icon.png // ts/images/password_icon.png
// contentPadding: EdgeInsets.only(top: 20, bottom: 20), // contentPadding: EdgeInsets.only(top: 20, bottom: 20),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(color: Colors.black),
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)), borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).primaryColor), borderSide: BorderSide(color: Theme.of(context).primaryColor),
), ),
errorBorder: OutlineInputBorder( errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)), borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).errorColor), borderSide: BorderSide(color: Theme.of(context).errorColor),
), ),
focusedErrorBorder: OutlineInputBorder( focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)), borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).errorColor), borderSide: BorderSide(color: Theme.of(context).errorColor),
@ -195,6 +233,7 @@ class SMSOTP {
checkValue() { checkValue() {
//print(verifyAccountFormValue); //print(verifyAccountFormValue);
if (verifyAccountForm.currentState.validate()) { if (verifyAccountForm.currentState.validate()) {
onSuccess(digit1.text.toString() + digit2.text.toString() + digit3.text.toString() + digit4.text.toString()); onSuccess(digit1.text.toString() + digit2.text.toString() + digit3.text.toString() + digit4.text.toString());
} }
@ -202,18 +241,27 @@ class SMSOTP {
getSecondsAsDigitalClock(int inputSeconds) { getSecondsAsDigitalClock(int inputSeconds) {
var sec_num = int.parse(inputSeconds.toString()); // don't forget the second param var sec_num = int.parse(inputSeconds.toString()); // don't forget the second param
var hours = (sec_num / 3600).floor(); var hours = (sec_num / 3600).floor();
var minutes = ((sec_num - hours * 3600) / 60).floor(); var minutes = ((sec_num - hours * 3600) / 60).floor();
var seconds = sec_num - hours * 3600 - minutes * 60; var seconds = sec_num - hours * 3600 - minutes * 60;
var minutesString = ""; var minutesString = "";
var secondsString = ""; var secondsString = "";
minutesString = minutes < 10 ? "0" + minutes.toString() : minutes.toString(); minutesString = minutes < 10 ? "0" + minutes.toString() : minutes.toString();
secondsString = seconds < 10 ? "0" + seconds.toString() : seconds.toString(); secondsString = seconds < 10 ? "0" + seconds.toString() : seconds.toString();
return minutesString + ":" + secondsString; return minutesString + ":" + secondsString;
} }
startTimer(setState) { startTimer(setState) {
this.remainingTime--; this.remainingTime--;
setState(() { setState(() {
displayTime = this.getSecondsAsDigitalClock(this.remainingTime); displayTime = this.getSecondsAsDigitalClock(this.remainingTime);
}); });
@ -237,9 +285,26 @@ class SMSOTP {
} }
} }
checkSignature() async {
SmsVerification.startListeningSms().then((message) {
// setState(() {
final intRegex = RegExp(r'\d+', multiLine: true);
var otp = SmsVerification.getCode(message, intRegex);
_pinPutController.text = otp;
onSuccess(otp);
// });
});
}
// startLister() {
// var signature = checkSignature();
//
// print(signature);
// }
static getSignature() async { static getSignature() async {
if (Platform.isAndroid) { if (Platform.isAndroid) {
return await SmsRetriever.getAppSignature(); return await SmsVerification.getAppSignature();
} else { } else {
return null; return null;
} }

@ -1,18 +1,22 @@
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/ambulanceRequest/locationDetails.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart'; import 'package:diplomaticquarterapp/widgets/app_map/google_huawei_map.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/close_back.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart';
import 'package:geocoding/geocoding.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class PickupLocationFromMap extends StatelessWidget { class PickupLocationFromMap extends StatefulWidget {
final Function(PickResult) onPick; final Function(LocationDetails) onPick;
final double latitude; final double latitude;
final double longitude; final double longitude;
final bool isWithAppBar; final bool isWithAppBar;
@ -21,6 +25,54 @@ class PickupLocationFromMap extends StatelessWidget {
const PickupLocationFromMap({Key key, this.onPick, this.latitude, this.longitude, this.isWithAppBar = true, this.buttonLabel, this.buttonColor}) : super(key: key); const PickupLocationFromMap({Key key, this.onPick, this.latitude, this.longitude, this.isWithAppBar = true, this.buttonLabel, this.buttonColor}) : super(key: key);
@override
State<PickupLocationFromMap> createState() => _PickupLocationFromMapState();
}
class _PickupLocationFromMapState extends State<PickupLocationFromMap> {
bool isHuawei = false;
Placemark selectedPlace;
AppMap appMap;
LatLng currentPostion;
AppSharedPreferences sharedPref = AppSharedPreferences();
double latitude = 0;
double longitude = 0;
static CameraPosition kGooglePlex = CameraPosition(
target: LatLng(37.42796133580664, -122.085749655962),
zoom: 14.4746,
);
@override
void initState() {
checkIsHuawei();
appMap = AppMap(
kGooglePlex.toMap(),
onCameraMove: (camera) {
_updatePosition(camera);
},
onMapCreated: () {
currentPostion = LatLng(widget.latitude, widget.longitude);
latitude = widget.latitude;
longitude = widget.longitude;
setState(() {});
},
onCameraIdle: () async {
List<Placemark> placemarks = await placemarkFromCoordinates(latitude, longitude);
selectedPlace = placemarks[0];
print(selectedPlace);
},
);
super.initState();
}
checkIsHuawei() async {
isHuawei = await FlutterHmsGmsAvailability.isHmsAvailable;
print(isHuawei);
setState(() {});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
@ -29,58 +81,92 @@ class PickupLocationFromMap extends StatelessWidget {
showNewAppBarTitle: true, showNewAppBarTitle: true,
showNewAppBar: true, showNewAppBar: true,
appBarTitle: TranslationBase.of(context).selectLocation, appBarTitle: TranslationBase.of(context).selectLocation,
// appBar: isWithAppBar body: isHuawei
// ? AppBar( ? Column(
// elevation: 0, children: [
// textTheme: TextTheme( Expanded(
// headline6: child: Stack(
// TextStyle(color: Colors.white, fontWeight: FontWeight.bold), alignment: Alignment.center,
// ), children: [
// title: Text('Location'), if (appMap != null) appMap,
// leading: CloseBack(), Container(
// centerTitle: true, margin: EdgeInsets.only(bottom: 50.0),
// ) child: Icon(
// : null, Icons.place,
body: PlacePicker( color: CustomColors.accentColor,
apiKey: GOOGLE_API_KEY, size: 50,
enableMyLocationButton: true,
automaticallyImplyAppBarLeading: false,
autocompleteLanguage: projectViewModel.currentLanguage,
enableMapTypeButton: true,
selectInitialPosition: true,
region: "SA",
onPlacePicked: (PickResult result) {
print(result.adrAddress);
onPick(result);
Navigator.of(context).pop();
},
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(12.0),
child: state == SearchingState.Searching
? Center(child: CircularProgressIndicator())
: Container(
margin: EdgeInsets.all(12),
child: DefaultButton(
TranslationBase.of(context).next,
() {
onPick(selectedPlace);
Navigator.of(context).pop();
},
),
), ),
); ),
}, ],
initialPosition: LatLng(latitude, longitude), ),
useCurrentLocation: true, ),
), Container(
padding: const EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14),
child: DefaultButton(TranslationBase.of(context).next, () async {
LocationDetails locationDetails = new LocationDetails();
locationDetails.lat = latitude;
locationDetails.long = longitude;
locationDetails.formattedAddress = selectedPlace.street;
widget.onPick(locationDetails);
Navigator.of(context).pop();
}),
),
],
)
: PlacePicker(
apiKey: GOOGLE_API_KEY,
enableMyLocationButton: true,
automaticallyImplyAppBarLeading: false,
autocompleteLanguage: projectViewModel.currentLanguage,
enableMapTypeButton: true,
selectInitialPosition: true,
region: "SA",
onPlacePicked: (PickResult result) {
LocationDetails locationDetails = new LocationDetails();
locationDetails.lat = latitude;
locationDetails.long = longitude;
locationDetails.formattedAddress = result.formattedAddress;
print(result.adrAddress);
widget.onPick(locationDetails);
Navigator.of(context).pop();
},
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(12.0),
child: state == SearchingState.Searching
? Center(child: CircularProgressIndicator())
: Container(
margin: EdgeInsets.all(12),
child: DefaultButton(
TranslationBase.of(context).next,
() {
LocationDetails locationDetails = new LocationDetails();
locationDetails.lat = latitude;
locationDetails.long = longitude;
locationDetails.formattedAddress = selectedPlace.formattedAddress;
widget.onPick(locationDetails);
Navigator.of(context).pop();
},
),
),
);
},
initialPosition: LatLng(widget.latitude, widget.longitude),
useCurrentLocation: true,
),
); );
} }
void _updatePosition(CameraPosition _position) {
print(_position);
latitude = _position.target.latitude;
longitude = _position.target.longitude;
}
} }

@ -1,8 +1,7 @@
name: diplomaticquarterapp name: diplomaticquarterapp
description: A new Flutter application. description: A new Flutter application.
version: 4.4.94+404094
version: 4.4.3+1
environment: environment:
sdk: ">=2.7.0 <3.0.0" sdk: ">=2.7.0 <3.0.0"
@ -180,6 +179,7 @@ dependencies:
in_app_review: ^2.0.3 in_app_review: ^2.0.3
badges: ^2.0.1 badges: ^2.0.1
flutter_app_icon_badge: ^2.0.0
syncfusion_flutter_sliders: ^19.3.55 syncfusion_flutter_sliders: ^19.3.55
searchable_dropdown: ^1.1.3 searchable_dropdown: ^1.1.3
dropdown_search: 0.4.9 dropdown_search: 0.4.9
@ -199,6 +199,10 @@ dependencies:
signalr_core: ^1.1.1 signalr_core: ^1.1.1
wave: ^0.2.0 wave: ^0.2.0
sms_retriever: ^1.0.0 sms_retriever: ^1.0.0
sms_otp_auto_verify: ^2.1.0
flutter_ios_voip_kit: ^0.0.5
payfort_plugin: ^0.3.1
dependency_overrides: dependency_overrides:
provider : ^5.0.0 provider : ^5.0.0

Loading…
Cancel
Save