Merge pull request 'dev_sultan' (#14) from dev_sultan into master

Reviewed-on: #14
pull/17/head
Haroon6138 2 months ago
commit 30d3751052

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

@ -806,5 +806,10 @@
"loginBy": "تسجيل الدخول بواسطة", "loginBy": "تسجيل الدخول بواسطة",
"loginByOTP": "تسجيل الدخول بواسطة OTP", "loginByOTP": "تسجيل الدخول بواسطة OTP",
"guest": "زائر", "guest": "زائر",
"switchAccount": "تبديل الحساب" "switchAccount": "تبديل الحساب",
"lastLoginBy":"آخر تسجيل دخول بواسطة",
"allSet": "جاهز! الآن يمكنك تسجيل الدخول باستخدام Face ID / Biometric أو البصمة",
"enableQuickLogin":"تمكين تسجيل الدخول السريع",
"enableMsg":"تمكين تسجيل الدخول السريع سيسمح بالتحقق من خلال Face ID / Biometric الخاص بجهازك الحالي",
"notNow": "ليس الآن"
} }

@ -802,5 +802,10 @@
"loginBy": "Login By", "loginBy": "Login By",
"loginByOTP": "Login By OTP", "loginByOTP": "Login By OTP",
"guest": "Guest", "guest": "Guest",
"switchAccount": "Switch Account" "switchAccount": "Switch Account",
"lastloginBy": "Last login by",
"allSet": "All Set! Now you can login with Face ID or Biometric",
"enableQuickLogin": "Enable Quick Login",
"enableMsg": "Enabling the quick login will verify through your existing device Face ID / Biometric",
"notNow": "Not Now"
} }

@ -106,7 +106,7 @@ class ApiClientImp implements ApiClient {
} }
} }
try { try {
var user = _appState.getAuthenticatedUser; var user = _appState.getAuthenticatedUser();
Map<String, String> headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}; Map<String, String> headers = {'Content-Type': 'application/json', 'Accept': 'application/json'};
if (!isExternal) { if (!isExternal) {
String? token = _appState.appAuthToken; String? token = _appState.appAuthToken;
@ -136,10 +136,12 @@ class ApiClientImp implements ApiClient {
// TODO : These should be from the appState // TODO : These should be from the appState
if (user != null) { if (user != null) {
body['TokenID'] = body['TokenID'] ?? token; body['TokenID'] = body['TokenID'] ?? token;
body['PatientID'] = body['PatientID'] ?? user.patientID; body['PatientID'] = body['PatientID'] ?? user.patientId;
body['PatientOutSA'] = body.containsKey('PatientOutSA') ? body['PatientOutSA'] ?? user.outSA : user.outSA; body['PatientOutSA'] = body.containsKey('PatientOutSA') ? body['PatientOutSA'] ?? user.outSa : user.outSa;
body['SessionID'] = getSessionId(body['TokenID'] ?? ""); //getSe // body['SessionID'] = body['TokenID'] == null
// ? ApiConsts.sessionID //Added By Aamir
// : getSessionId(body['TokenID'] ?? ""); //getSe
} }
} }
} }

@ -793,10 +793,13 @@ class ApiConsts {
static final String sendActivationCodeRegister = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationTypeForRegistration'; static final String sendActivationCodeRegister = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationTypeForRegistration';
static final String checkActivationCode = 'Services/Authentication.svc/REST/CheckActivationCode'; static final String checkActivationCode = 'Services/Authentication.svc/REST/CheckActivationCode';
static final String checkActivationCodeRegister = 'Services/Authentication.svc/REST/CheckActivationCodeForRegistration'; static final String checkActivationCodeRegister = 'Services/Authentication.svc/REST/CheckActivationCodeForRegistration';
static final String checkUsageAgreement = 'Services/Patients.svc/REST/CheckForUsageAgreement';
static final String getUserAgreementContent = 'Services/Patients.svc/REST/GetUsageAgreementText';
// static values for Api // static values for Api
static final double appVersionID = 18.7; static final double appVersionID = 18.7;
static final int appChannelId = 3; static final int appChannelId = 3;
static final String appIpAddress = "10.20.10.20"; static final String appIpAddress = "10.20.10.20";
static final String appGeneralId = "Cs2020@2016\$2958"; static final String appGeneralId = "Cs2020@2016\$2958";
static final String sessionID = 'TMRhVmkGhOsvamErw';
} }

@ -84,6 +84,8 @@ class AppAssets {
static const String uae_dirham_symbol = '$svgBasePath/uae_dirham_symbol.svg'; static const String uae_dirham_symbol = '$svgBasePath/uae_dirham_symbol.svg';
static const String directions_icon = '$svgBasePath/directions_icon.svg'; static const String directions_icon = '$svgBasePath/directions_icon.svg';
static const String apple_pay_button = '$svgBasePath/pay_with_apple_pay.svg'; static const String apple_pay_button = '$svgBasePath/pay_with_apple_pay.svg';
static const String bell = '$svgBasePath/bell.svg';
//bottom navigation// //bottom navigation//
static const String homeBottom = '$svgBasePath/home_bottom.svg'; static const String homeBottom = '$svgBasePath/home_bottom.svg';
@ -97,12 +99,13 @@ class AppAssets {
static const String hmg_logo = '$pngBasePath/hmg_logo.png'; static const String hmg_logo = '$pngBasePath/hmg_logo.png';
static const String livecare_service = '$pngBasePath/livecare_service.png'; static const String livecare_service = '$pngBasePath/livecare_service.png';
static const String male_img = '$pngBasePath/male_img.png'; static const String male_img = '$pngBasePath/male_img.png';
static const String femaleImg = '$pngBasePath/female_img.png';
static const String apple_pay = '$pngBasePath/Apple_Pay.png'; static const String apple_pay = '$pngBasePath/Apple_Pay.png';
static const String mada = '$pngBasePath/Mada.png'; static const String mada = '$pngBasePath/Mada.png';
static const String Mastercard = '$pngBasePath/Mastercard.png'; static const String Mastercard = '$pngBasePath/Mastercard.png';
static const String tamara_en = '$pngBasePath/tamara_en.png'; static const String tamara_en = '$pngBasePath/tamara_en.png';
static const String visa = '$pngBasePath/visa.png'; static const String visa = '$pngBasePath/visa.png';
static const String lockIcon = '$pngBasePath/lock-icon.png';
} }
class AppAnimations { class AppAnimations {

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:hmg_patient_app_new/core/common_models/VidaPlusProjectListModel.dart'; import 'package:hmg_patient_app_new/core/common_models/VidaPlusProjectListModel.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart';
@ -21,15 +23,35 @@ class AppState {
int getLanguageID() => EasyLocalization.of(navigationService.navigatorKey.currentContext!)?.locale.languageCode == "ar" ? 1 : 2; int getLanguageID() => EasyLocalization.of(navigationService.navigatorKey.currentContext!)?.locale.languageCode == "ar" ? 1 : 2;
int getDeviceTypeID() => Platform.isIOS ? 1 : 2;
String? getLanguageCode() => EasyLocalization.of(navigationService.navigatorKey.currentContext!)?.locale.languageCode; String? getLanguageCode() => EasyLocalization.of(navigationService.navigatorKey.currentContext!)?.locale.languageCode;
AuthenticatedUser? _authenticatedUser; AuthenticatedUser? _authenticatedRootUser;
AuthenticatedUser? _authenticatedChildUser;
void setAuthenticatedUser(AuthenticatedUser authenticatedUser, {bool isFamily = false}) {
if (isFamily) {
_authenticatedChildUser = authenticatedUser;
} else {
setIsAuthenticated = true;
_authenticatedRootUser = authenticatedUser;
}
}
void setAuthenticatedUser(AuthenticatedUser authenticatedUser) { AuthenticatedUser? getAuthenticatedUser({bool isFamily = false}) {
_authenticatedUser = authenticatedUser; if (isFamily) {
return _authenticatedChildUser;
} else {
return _authenticatedRootUser;
}
} }
AuthenticatedUser? get getAuthenticatedUser => _authenticatedUser; String _userBloodGroup = "";
String get getUserBloodGroup => _userBloodGroup;
set setUserBloodGroup(String value) => _userBloodGroup = value;
SelectDeviceByImeiRespModelElement? _selectDeviceByImeiRespModelElement; SelectDeviceByImeiRespModelElement? _selectDeviceByImeiRespModelElement;
@ -59,7 +81,7 @@ class AppState {
set setSessionId(v) => sessionId = v; set setSessionId(v) => sessionId = v;
bool isAuthenticated = true; bool isAuthenticated = false;
set setIsAuthenticated(v) => isAuthenticated = v; set setIsAuthenticated(v) => isAuthenticated = v;

@ -24,8 +24,10 @@ import 'package:hmg_patient_app_new/services/cache_service.dart';
import 'package:hmg_patient_app_new/services/dialog_service.dart'; import 'package:hmg_patient_app_new/services/dialog_service.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart';
import 'package:hmg_patient_app_new/services/firebase_service.dart'; import 'package:hmg_patient_app_new/services/firebase_service.dart';
import 'package:hmg_patient_app_new/services/localauth_service.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart'; import 'package:hmg_patient_app_new/services/logger_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:local_auth/local_auth.dart';
import 'package:logger/web.dart'; import 'package:logger/web.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -52,6 +54,8 @@ class AppDependencies {
)); ));
getIt.registerLazySingleton<NavigationService>(() => NavigationService()); getIt.registerLazySingleton<NavigationService>(() => NavigationService());
getIt.registerLazySingleton<LocalAuthentication>(() => LocalAuthentication());
getIt.registerLazySingleton<GAnalytics>(() => GAnalytics()); getIt.registerLazySingleton<GAnalytics>(() => GAnalytics());
getIt.registerLazySingleton<AppState>(() => AppState(navigationService: getIt())); getIt.registerLazySingleton<AppState>(() => AppState(navigationService: getIt()));
getIt.registerLazySingleton<LocationUtils>(() => LocationUtils( getIt.registerLazySingleton<LocationUtils>(() => LocationUtils(
@ -80,6 +84,7 @@ class AppDependencies {
getIt.registerLazySingleton<PrescriptionsRepo>(() => PrescriptionsRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt())); getIt.registerLazySingleton<PrescriptionsRepo>(() => PrescriptionsRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
getIt.registerLazySingleton<InsuranceRepo>(() => InsuranceRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt())); getIt.registerLazySingleton<InsuranceRepo>(() => InsuranceRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
getIt.registerLazySingleton<PayfortRepo>(() => PayfortRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt())); getIt.registerLazySingleton<PayfortRepo>(() => PayfortRepoImp(loggerService: getIt<LoggerService>(), apiClient: getIt()));
getIt.registerLazySingleton<LocalAuthService>(() => LocalAuthService(loggerService: getIt<LoggerService>(), localAuth: getIt<LocalAuthentication>()));
// ViewModels // ViewModels
// Global/shared VMs LazySingleton // Global/shared VMs LazySingleton
@ -134,6 +139,7 @@ class AppDependencies {
dialogService: getIt(), dialogService: getIt(),
appState: getIt(), appState: getIt(),
errorHandlerService: getIt(), errorHandlerService: getIt(),
localAuthService: getIt()
), ),
); );

@ -32,7 +32,7 @@ enum MaritalStatusTypeEnum { single, married, divorced, widowed }
enum ChipTypeEnum { success, error, alert, info, warning } enum ChipTypeEnum { success, error, alert, info, warning }
enum OTPTypeEnum { sms, whatsapp } enum OTPTypeEnum { sms, whatsapp, faceIDFingerprint }
enum LoginTypeEnum { sms, whatsapp, face, fingerprint } enum LoginTypeEnum { sms, whatsapp, face, fingerprint }
@ -89,6 +89,8 @@ extension OTPTypeEnumExtension on OTPTypeEnum {
return 1; return 1;
case OTPTypeEnum.whatsapp: case OTPTypeEnum.whatsapp:
return 2; return 2;
case OTPTypeEnum.faceIDFingerprint:
return 0;
} }
} }

@ -1,5 +1,9 @@
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/features/authentication/models/request_models/send_activation_request_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/request_models/send_activation_request_model.dart';
import 'package:hmg_patient_app_new/features/common/models/commong_authanticated_req_model.dart';
class RequestUtils { class RequestUtils {
static dynamic getPatientAuthenticationRequest({ static dynamic getPatientAuthenticationRequest({
@ -50,7 +54,7 @@ class RequestUtils {
required bool patientOutSA, required bool patientOutSA,
required String? loginTokenID, required String? loginTokenID,
required var registeredData, required var registeredData,
required int? patientId, int? patientId,
required String nationIdText, required String nationIdText,
required String countryCode, required String countryCode,
}) { }) {
@ -128,4 +132,24 @@ class RequestUtils {
request.deviceTypeID = request.searchType; request.deviceTypeID = request.searchType;
return request; return request;
} }
static getAuthanticatedCommonRequest() {
AppState _appState = getIt.get<AppState>();
var request = CommonAuthanticatedRequest();
request.sessionId = ApiConsts.sessionID;
request.latitude = _appState.userLat;
request.longitude = _appState.userLong;
request.languageId = _appState.getLanguageID();
request.versionId = ApiConsts.appVersionID;
request.ipAdress = ApiConsts.appIpAddress;
request.deviceTypeId = _appState.getDeviceTypeID();
request.patientTypeId = _appState.getAuthenticatedUser()?.patientType;
request.patientType = _appState.getAuthenticatedUser()?.patientType;
request.generalid = ApiConsts.appGeneralId;
request.channel = ApiConsts.appChannelId;
request.patientId = _appState.getAuthenticatedUser()!.patientId;
request.patientOutSa = _appState.getAuthenticatedUser()!.outSa;
request.tokenId = null;
return request;
}
} }

@ -5,6 +5,11 @@ extension ContextUtils on BuildContext {
double get screenWidth => MediaQuery.of(this).size.width; double get screenWidth => MediaQuery.of(this).size.width;
EdgeInsets get padding => MediaQuery.of(this).padding;
bool get safeInsets => padding.top > 0 || padding.bottom > 0 || padding.left > 0 || padding.right > 0;
ThemeData get theme => Theme.of(this); ThemeData get theme => Theme.of(this);
TextTheme get textTheme => theme.textTheme; TextTheme get textTheme => theme.textTheme;

@ -5,27 +5,25 @@ import 'package:hmg_patient_app_new/core/api/api_client.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart'; import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart'; import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart'; import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
import 'package:hmg_patient_app_new/features/authentication/models/request_models/check_activation_code_register_request_model.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart';
import 'package:hmg_patient_app_new/services/logger_service.dart'; import 'package:hmg_patient_app_new/services/logger_service.dart';
abstract class AuthenticationRepo { abstract class AuthenticationRepo {
Future<Either<Failure, GenericApiModel<SelectDeviceByImeiRespModelElement>>> selectDeviceByImei({ Future<Either<Failure, GenericApiModel<SelectDeviceByImeiRespModelElement>>> selectDeviceByImei({required String firebaseToken});
required String firebaseToken,
});
Future<Either<Failure, GenericApiModel<dynamic>>> checkPatientAuthentication({required dynamic checkPatientAuthenticationReq}); Future<Either<Failure, GenericApiModel<dynamic>>> checkPatientAuthentication({required dynamic checkPatientAuthenticationReq});
Future<Either<Failure, GenericApiModel<dynamic>>> sendActivationCodeRepo({ Future<Either<Failure, GenericApiModel<dynamic>>> sendActivationCodeRepo({required dynamic sendActivationCodeReq, String? languageID, bool isRegister = false});
required dynamic sendActivationCodeReq,
String? languageID,
bool isRegister = false,
});
Future<Either<Failure, GenericApiModel<dynamic>>> checkActivationCodeRepo({ Future<Either<Failure, GenericApiModel<dynamic>>> checkActivationCodeRepo(
required dynamic newRequest, // could be CheckActivationCodeReq or CheckActivationCodeRegisterReq {required dynamic newRequest, // could be CheckActivationCodeReq or CheckActivationCodeRegisterReq
required String? activationCode, required String? activationCode,
required bool isRegister, required bool isRegister});
});
Future<Either<Failure, GenericApiModel<dynamic>>> checkIfUserAgreed({required dynamic commonAuthanticatedRequest});
Future<Either<Failure, GenericApiModel<dynamic>>> getUserAgreementContent({required dynamic commonAuthanticatedRequest});
} }
class AuthenticationRepoImp implements AuthenticationRepo { class AuthenticationRepoImp implements AuthenticationRepo {
@ -198,4 +196,74 @@ class AuthenticationRepoImp implements AuthenticationRepo {
return Left(UnknownFailure(e.toString())); return Left(UnknownFailure(e.toString()));
} }
} }
@override
Future<Either<Failure, GenericApiModel<dynamic>>> checkIfUserAgreed({required dynamic commonAuthanticatedRequest}) async {
commonAuthanticatedRequest['Region'] = 1;
print("dsfsdd");
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
ApiConsts.checkUsageAgreement,
body: commonAuthanticatedRequest,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: errorMessage,
data: response,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel<dynamic>>> getUserAgreementContent({required dynamic commonAuthanticatedRequest}) async {
commonAuthanticatedRequest['Region'] = 1;
print("dsfsdd");
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
ApiConsts.getUserAgreementContent,
body: commonAuthanticatedRequest,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: errorMessage,
data: response,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
} }

@ -10,13 +10,16 @@ import 'package:hmg_patient_app_new/core/utils/request_utils.dart';
import 'package:hmg_patient_app_new/core/utils/validation_utils.dart'; import 'package:hmg_patient_app_new/core/utils/validation_utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_repo.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_repo.dart';
import 'package:hmg_patient_app_new/features/authentication/models/request_models/check_activation_code_register_request_model.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_activation_code_resp_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_activation_code_resp_model.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart';
import 'package:hmg_patient_app_new/presentation/authentication/login.dart'; import 'package:hmg_patient_app_new/presentation/authentication/login.dart';
import 'package:hmg_patient_app_new/presentation/authentication/saved_login_screen.dart';
import 'package:hmg_patient_app_new/routes/app_routes.dart'; import 'package:hmg_patient_app_new/routes/app_routes.dart';
import 'package:hmg_patient_app_new/services/cache_service.dart'; import 'package:hmg_patient_app_new/services/cache_service.dart';
import 'package:hmg_patient_app_new/services/dialog_service.dart'; import 'package:hmg_patient_app_new/services/dialog_service.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart';
import 'package:hmg_patient_app_new/services/localauth_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart';
class AuthenticationViewModel extends ChangeNotifier { class AuthenticationViewModel extends ChangeNotifier {
@ -25,7 +28,7 @@ class AuthenticationViewModel extends ChangeNotifier {
final ErrorHandlerService _errorHandlerService; final ErrorHandlerService _errorHandlerService;
final DialogService _dialogService; final DialogService _dialogService;
final NavigationService _navigationService; final NavigationService _navigationService;
final LocalAuthService _localAuthService;
AuthenticationViewModel({ AuthenticationViewModel({
required AppState appState, required AppState appState,
required AuthenticationRepo authenticationRepo, required AuthenticationRepo authenticationRepo,
@ -33,11 +36,13 @@ class AuthenticationViewModel extends ChangeNotifier {
required DialogService dialogService, required DialogService dialogService,
required NavigationService navigationService, required NavigationService navigationService,
required CacheService cacheService, required CacheService cacheService,
required LocalAuthService localAuthService,
}) : _navigationService = navigationService, }) : _navigationService = navigationService,
_dialogService = dialogService, _dialogService = dialogService,
_errorHandlerService = errorHandlerService, _errorHandlerService = errorHandlerService,
_appState = appState, _appState = appState,
_authenticationRepo = authenticationRepo; _authenticationRepo = authenticationRepo,
_localAuthService = localAuthService;
final TextEditingController nationalIdController = TextEditingController(), phoneNumberController = TextEditingController(), dobController = TextEditingController(); final TextEditingController nationalIdController = TextEditingController(), phoneNumberController = TextEditingController(), dobController = TextEditingController();
CountryEnum selectedCountrySignup = CountryEnum.saudiArabia; CountryEnum selectedCountrySignup = CountryEnum.saudiArabia;
@ -72,7 +77,7 @@ class AuthenticationViewModel extends ChangeNotifier {
try { try {
LoadingUtils.showFullScreenLoader(); LoadingUtils.showFullScreenLoader();
//TODO: We will remove this delay //TODO: We will remove this delay
await Future.delayed(Duration(seconds: 3)); // await Future.delayed(Duration(seconds: 3));
var data = _appState.getSelectDeviceByImeiRespModelElement; var data = _appState.getSelectDeviceByImeiRespModelElement;
log("Cached IMEI data: ${data?.toJson()}"); log("Cached IMEI data: ${data?.toJson()}");
if (data != null) { if (data != null) {
@ -87,7 +92,7 @@ class AuthenticationViewModel extends ChangeNotifier {
} }
} }
void clearDefaults() { void clearDefaultInputValues() {
nationalIdController.clear(); nationalIdController.clear();
phoneNumberController.clear(); phoneNumberController.clear();
dobController.clear(); dobController.clear();
@ -165,8 +170,8 @@ class AuthenticationViewModel extends ChangeNotifier {
if (savedData != null) { if (savedData != null) {
// TODO: Navigate to SavedLogin when available // TODO: Navigate to SavedLogin when available
_navigationService.pushPage(page: LoginScreen()); //_navigationService.pushPage(page: LoginScreen());
// navigationService.pushPage(page: SavedLogin(savedData)); _navigationService.pushPage(page: SavedLogin());
} }
} catch (e) { } catch (e) {
log("Error handling existing IMEI data: $e"); log("Error handling existing IMEI data: $e");
@ -186,8 +191,8 @@ class AuthenticationViewModel extends ChangeNotifier {
// TODO: Navigate to SavedLogin when available // TODO: Navigate to SavedLogin when available
// SelectDeviceByImeiRespModelElement savedData = // SelectDeviceByImeiRespModelElement savedData =
// SelectDeviceByImeiRespModelElement.fromJson(respData); // SelectDeviceByImeiRespModelElement.fromJson(respData);
// navigationService.pushPage(page: SavedLogin(savedData)); _navigationService.pushPage(page: SavedLogin());
_navigationService.pushPage(page: LoginScreen()); // _navigationService.pushPage(page: LoginScreen());
} else { } else {
LoadingUtils.hideFullScreenLoader(); LoadingUtils.hideFullScreenLoader();
_navigationService.pushPage(page: LoginScreen()); _navigationService.pushPage(page: LoginScreen());
@ -227,7 +232,7 @@ class AuthenticationViewModel extends ChangeNotifier {
patientOutSA: false, patientOutSA: false,
otpTypeEnum: otpTypeEnum, otpTypeEnum: otpTypeEnum,
patientId: 0, patientId: 0,
zipCode: '966', zipCode: selectedCountrySignup.countryCode,
); );
final result = await _authenticationRepo.checkPatientAuthentication(checkPatientAuthenticationReq: checkPatientAuthenticationReq); final result = await _authenticationRepo.checkPatientAuthentication(checkPatientAuthenticationReq: checkPatientAuthenticationReq);
@ -248,6 +253,7 @@ class AuthenticationViewModel extends ChangeNotifier {
} else { } else {
if (apiResponse.data['IsAuthenticated']) { if (apiResponse.data['IsAuthenticated']) {
await checkActivationCode( await checkActivationCode(
otpTypeEnum: otpTypeEnum,
onWrongActivationCode: (String? message) {}, onWrongActivationCode: (String? message) {},
activationCode: 0000, activationCode: 0000,
); );
@ -267,7 +273,7 @@ class AuthenticationViewModel extends ChangeNotifier {
otpTypeEnum: otpTypeEnum, otpTypeEnum: otpTypeEnum,
mobileNumber: phoneNumber, mobileNumber: phoneNumber,
selectedLoginType: otpTypeEnum.toInt(), selectedLoginType: otpTypeEnum.toInt(),
zipCode: "966", zipCode: selectedCountrySignup.countryCode,
nationalId: nationalIdOrFileNumber, nationalId: nationalIdOrFileNumber,
isFileNo: false, isFileNo: false,
patientId: 0, patientId: 0,
@ -317,18 +323,18 @@ class AuthenticationViewModel extends ChangeNotifier {
Future<void> checkActivationCode({ Future<void> checkActivationCode({
required int activationCode, required int activationCode,
required OTPTypeEnum otpTypeEnum,
required Function(String? message) onWrongActivationCode, required Function(String? message) onWrongActivationCode,
}) async { }) async {
final request = RequestUtils.getCommonRequestWelcome( final request = RequestUtils.getCommonRequestWelcome(
phoneNumber: '0567184134', phoneNumber: phoneNumberController.text,
otpTypeEnum: OTPTypeEnum.sms, otpTypeEnum: otpTypeEnum,
deviceToken: 'dummyDeviceToken123', deviceToken: _appState.deviceToken,
patientOutSA: true, patientOutSA: true,
loginTokenID: 'dummyLoginToken456', loginTokenID: _appState.appLoginTokenID,
registeredData: null, registeredData: null,
patientId: 12345, nationIdText: nationalIdController.text,
nationIdText: '1234567890', countryCode: selectedCountrySignup.countryCode,
countryCode: 'SA',
).toJson(); ).toJson();
bool isForRegister = healthId != null || isDubai; bool isForRegister = healthId != null || isDubai;
@ -337,11 +343,7 @@ class AuthenticationViewModel extends ChangeNotifier {
request['HealthId'] = healthId; request['HealthId'] = healthId;
request['IsHijri'] = isHijri; request['IsHijri'] = isHijri;
final resultEither = await _authenticationRepo.checkActivationCodeRepo( final resultEither = await _authenticationRepo.checkActivationCodeRepo(newRequest: request, activationCode: activationCode.toString(), isRegister: true);
newRequest: request,
activationCode: activationCode.toString(),
isRegister: true,
);
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) { resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) {
final activation = CheckActivationCode.fromJson(apiResponse.data as Map<String, dynamic>); final activation = CheckActivationCode.fromJson(apiResponse.data as Map<String, dynamic>);
@ -353,23 +355,42 @@ class AuthenticationViewModel extends ChangeNotifier {
}); });
} else { } else {
final resultEither = await _authenticationRepo.checkActivationCodeRepo( final resultEither = await _authenticationRepo.checkActivationCodeRepo(
newRequest: request, newRequest: CheckActivationCodeRegisterReq.fromJson(request),
activationCode: activationCode.toString(), activationCode: activationCode.toString(),
isRegister: false, isRegister: false,
); );
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) { resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async {
final activation = CheckActivationCode.fromJson(resultEither as Map<String, dynamic>); final activation = CheckActivationCode.fromJson(apiResponse.data as Map<String, dynamic>);
if (activation.errorCode == '699') { if (activation.errorCode == '699') {
// Todo: Hide Loader // Todo: Hide Loader
// GifLoaderDialogUtils.hideDialog(context); // GifLoaderDialogUtils.hideDialog(context);
onWrongActivationCode(activation.errorEndUserMessage); onWrongActivationCode(activation.errorEndUserMessage);
return; return;
} else if(activation.messageStatus ==2){
onWrongActivationCode(activation.errorEndUserMessage);
return;
} else if (registerd_data?.isRegister == true) { } else if (registerd_data?.isRegister == true) {
_navigationService.popUntilNamed(AppRoutes.registerNewScreen); _navigationService.popUntilNamed(AppRoutes.registerNewScreen);
// Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)); // Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew));
return; return;
} else { } else {
if (activation.list != null && activation.list!.isNotEmpty) {
_appState.setAuthenticatedUser(activation.list!.first);
}
_appState.setUserBloodGroup = (activation.patientBlodType ?? "");
_appState.setAppLoginTokenID = activation.authenticationTokenId;
final request = RequestUtils.getAuthanticatedCommonRequest().toJson();
bool isUserAgreedBefore = await checkIfUserAgreedBefore(request: request);
clearDefaultInputValues();
if (isUserAgreedBefore) {
navigateToHomeScreen();
} else {
navigateToHomeScreen();
//Agreement page not designed yet so we are navigating to home screen directly
// getUserAgreementContent(request: request);
}
// TODO: setPreferences and stuff // TODO: setPreferences and stuff
// sharedPref.remove(FAMILY_FILE); // sharedPref.remove(FAMILY_FILE);
// activation.list!.isFamily = false; // activation.list!.isFamily = false;
@ -382,29 +403,96 @@ class AuthenticationViewModel extends ChangeNotifier {
// loginTokenID = activation.logInTokenID; // loginTokenID = activation.logInTokenID;
// await sharedPref.setObject(LOGIN_TOKEN_ID, activation.logInTokenID); // await sharedPref.setObject(LOGIN_TOKEN_ID, activation.logInTokenID);
// await sharedPref.setString(TOKEN, activation.authenticationTokenID!); // await sharedPref.setString(TOKEN, activation.authenticationTokenID!);
// checkIfUserAgreedBefore(activation);
// projectViewModel.analytics.loginRegistration.login_successful(); // projectViewModel.analytics.loginRegistration.login_successful();
} }
}); });
} }
} }
Future<bool> checkIfUserAgreedBefore({required dynamic request}) async {
bool isAgreed = false;
if (havePrivilege(109)) {
final resultEither = await _authenticationRepo.checkIfUserAgreed(commonAuthanticatedRequest: request);
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) {
if (apiResponse.data['IsPatientAlreadyAgreed']) {
return true;
}
});
}
return isAgreed;
}
Future<void> getUserAgreementContent({required dynamic request}) async {
final resultEither = await _authenticationRepo.getUserAgreementContent(commonAuthanticatedRequest: request);
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async {
// _navigationService.pushAndReplace(routeName)
//TODO: Add User Agreement Page Here
});
}
bool havePrivilege(int id) {
bool isHavePrivilege = false;
try {
for (var element in _appState.getAuthenticatedUser()!.listPrivilege!) {
if (element.id == id) isHavePrivilege = element.previlege!;
}
} catch (e) {
print(e);
}
return isHavePrivilege;
}
Future<void> navigateToHomeScreen() async {
_navigationService.pushAndReplace(AppRoutes.landingScreen);
}
Future<void> navigateToOTPScreen({required OTPTypeEnum otpTypeEnum, required String phoneNumber}) async { Future<void> navigateToOTPScreen({required OTPTypeEnum otpTypeEnum, required String phoneNumber}) async {
_navigationService.pushToOtpScreen( _navigationService.pushToOtpScreen(
phoneNumber: phoneNumber, phoneNumber: phoneNumber,
checkActivationCode: (int activationCode) async { checkActivationCode: (int activationCode) async {
await checkActivationCode( await checkActivationCode(
activationCode: activationCode, activationCode: activationCode,
otpTypeEnum: otpTypeEnum,
onWrongActivationCode: (String? value) { onWrongActivationCode: (String? value) {
onWrongActivationCode(message: value); onWrongActivationCode(message: value);
}); });
// Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => RegisterNewStep2(null, {"nationalID": "12345678654321"})));
}, },
onResendOTPPressed: (String phoneNumber) {}, onResendOTPPressed: (String phoneNumber) {},
); );
} }
Future<void> onWrongActivationCode({String? message}) async { Future<void> onWrongActivationCode({String? message}) async {
// TODO: HANDLE THIS VIA BOTTOM SHEET await _dialogService.showErrorBottomSheet(message: message ?? "Something went wrong. ", onOkPressed: () {});
}
loginWithFingerPrintFace(int selectedOption) async {
_localAuthService.authenticate().then((value) {
if (value) {
// we have to handle this if verification true;
checkActivationCode(otpTypeEnum: OTPTypeEnum.faceIDFingerprint, activationCode: 0000, onWrongActivationCode: (String? message) { });
// authenticated = true;
notifyListeners();
// navigateToHomeScreen();
} else {
//authenticated = false;
notifyListeners();
}
});
this.selectedOption = selectedOption;
notifyListeners();
}
checkLastLoginStatus(Function() onSuccess) async {
if(_appState.getSelectDeviceByImeiRespModelElement !=null && (_appState.getSelectDeviceByImeiRespModelElement!.logInType ==1 || _appState.getSelectDeviceByImeiRespModelElement!.logInType ==4)){
Future.delayed(Duration(seconds: 1),(){
onSuccess();
});
}
} }
@override @override

@ -1,292 +1,321 @@
import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'dart:convert';
class AuthenticatedUser { class AuthenticatedUser {
String? setupID; String? setupId;
int? patientType; int? patientType;
int? patientID; int? patientId;
String? firstName; String? firstName;
String? middleName; String? middleName;
String? lastName; String? lastName;
String? firstNameN; String? firstNameN;
String? middleNameN; String? middleNameN;
String? lastNameN; String? lastNameN;
int? relationshipID; int? relationshipId;
int? gender; int? gender;
String? dateofBirth; String? dateofBirth;
DateTime? dateofBirthDataTime;
dynamic dateofBirthN; dynamic dateofBirthN;
String? nationalityID; String? nationalityId;
dynamic phoneResi; String? phoneResi;
dynamic phoneOffice; String? phoneOffice;
String? mobileNumber; String? mobileNumber;
dynamic faxNumber; String? faxNumber;
String? emailAddress; String? emailAddress;
dynamic bloodGroup; dynamic bloodGroup;
dynamic rHFactor; dynamic rhFactor;
bool? isEmailAlertRequired; bool? isEmailAlertRequired;
bool? isSMSAlertRequired; bool? isSmsAlertRequired;
String? preferredLanguage; String? preferredLanguage;
bool? isPrivilegedMember; bool? isPrivilegedMember;
dynamic memberID; dynamic memberId;
dynamic expiryDate; dynamic expiryDate;
dynamic isHmgEmployee; dynamic isHmgEmployee;
dynamic employeeID; dynamic employeeId;
dynamic emergencyContactName; String? emergencyContactName;
dynamic emergencyContactNo; String? emergencyContactNo;
int? patientPayType; int? patientPayType;
dynamic dHCCPatientRefID; dynamic dhccPatientRefId;
bool? isPatientDummy; bool? isPatientDummy;
int? status; int? status;
dynamic isStatusCleared; dynamic isStatusCleared;
int? patientIdentificationType; int? patientIdentificationType;
String? patientIdentificationNo; String? patientIdentificationNo;
int? projectID; int? projectId;
int? infoSourceID; int? infoSourceId;
dynamic address; dynamic address;
int? age; int? age;
String? ageDesc; String? ageDesc;
int? areaID; int? areaId;
int? crsVerificationStatus;
String? crsVerificationStatusDesc;
String? crsVerificationStatusDescN;
int? createdBy; int? createdBy;
String? genderDescription; String? genderDescription;
dynamic iR; String? healthIdFromNhicViaVida;
dynamic iSOCityID; dynamic ir;
dynamic iSOCountryID; dynamic isoCityId;
dynamic isoCountryId;
bool? isVerfiedFromNhic;
List<ListPrivilege>? listPrivilege; List<ListPrivilege>? listPrivilege;
dynamic marital; dynamic marital;
int? outSA; dynamic occupationId;
dynamic pOBox; int? outSa;
dynamic poBox;
bool? receiveHealthSummaryReport; bool? receiveHealthSummaryReport;
int? sourceType; int? sourceType;
dynamic strDateofBirth; dynamic strDateofBirth;
dynamic tempAddress; dynamic tempAddress;
dynamic zipCode; dynamic zipCode;
dynamic isFamily; dynamic eHealthIdField;
dynamic cRSVerificationStatus; dynamic authenticatedUserPatientPayType;
// dynamic patientPayType; dynamic authenticatedUserPatientType;
// dynamic patientType; dynamic authenticatedUserStatus;
// dynamic status;
AuthenticatedUser( AuthenticatedUser({
{this.setupID, this.setupId,
this.patientType, this.patientType,
this.patientID, this.patientId,
this.firstName, this.firstName,
this.middleName, this.middleName,
this.lastName, this.lastName,
this.firstNameN, this.firstNameN,
this.middleNameN, this.middleNameN,
this.lastNameN, this.lastNameN,
this.relationshipID, this.relationshipId,
this.gender, this.gender,
this.dateofBirth, this.dateofBirth,
this.dateofBirthN, this.dateofBirthN,
this.nationalityID, this.nationalityId,
this.phoneResi, this.phoneResi,
this.phoneOffice, this.phoneOffice,
this.mobileNumber, this.mobileNumber,
this.faxNumber, this.faxNumber,
this.emailAddress, this.emailAddress,
this.bloodGroup, this.bloodGroup,
this.rHFactor, this.rhFactor,
this.isEmailAlertRequired, this.isEmailAlertRequired,
this.isSMSAlertRequired, this.isSmsAlertRequired,
this.preferredLanguage, this.preferredLanguage,
this.isPrivilegedMember, this.isPrivilegedMember,
this.memberID, this.memberId,
this.expiryDate, this.expiryDate,
this.isHmgEmployee, this.isHmgEmployee,
this.employeeID, this.employeeId,
this.emergencyContactName, this.emergencyContactName,
this.emergencyContactNo, this.emergencyContactNo,
this.patientPayType, this.patientPayType,
this.dHCCPatientRefID, this.dhccPatientRefId,
this.isPatientDummy, this.isPatientDummy,
this.status, this.status,
this.isStatusCleared, this.isStatusCleared,
this.patientIdentificationType, this.patientIdentificationType,
this.patientIdentificationNo, this.patientIdentificationNo,
this.projectID, this.projectId,
this.infoSourceID, this.infoSourceId,
this.address, this.address,
this.age, this.age,
this.ageDesc, this.ageDesc,
this.areaID, this.areaId,
this.createdBy, this.crsVerificationStatus,
this.genderDescription, this.crsVerificationStatusDesc,
this.iR, this.crsVerificationStatusDescN,
this.iSOCityID, this.createdBy,
this.iSOCountryID, this.genderDescription,
this.listPrivilege, this.healthIdFromNhicViaVida,
this.marital, this.ir,
this.outSA, this.isoCityId,
this.pOBox, this.isoCountryId,
this.receiveHealthSummaryReport, this.isVerfiedFromNhic,
this.sourceType, this.listPrivilege,
this.strDateofBirth, this.marital,
this.tempAddress, this.occupationId,
this.zipCode, this.outSa,
this.isFamily, this.poBox,
this.cRSVerificationStatus}); this.receiveHealthSummaryReport,
this.sourceType,
this.strDateofBirth,
this.tempAddress,
this.zipCode,
this.eHealthIdField,
this.authenticatedUserPatientPayType,
this.authenticatedUserPatientType,
this.authenticatedUserStatus,
});
AuthenticatedUser.fromJson(Map<String, dynamic> json) { factory AuthenticatedUser.fromRawJson(String str) => AuthenticatedUser.fromJson(json.decode(str));
setupID = json['SetupID'];
patientType = json['PatientType'];
patientID = json['PatientID'];
firstName = json['FirstName'];
middleName = json['MiddleName'];
lastName = json['LastName'];
firstNameN = json['FirstNameN'];
middleNameN = json['MiddleNameN'];
lastNameN = json['LastNameN'];
relationshipID = json['RelationshipID'];
gender = json['Gender'];
dateofBirth = json['DateofBirth'];
dateofBirthDataTime = DateUtil.convertStringToDate(json['DateofBirth']);
dateofBirthN = json['DateofBirthN'];
nationalityID = json['NationalityID'];
phoneResi = json['PhoneResi'];
phoneOffice = json['PhoneOffice'];
mobileNumber = json['MobileNumber'];
faxNumber = json['FaxNumber'];
emailAddress = json['EmailAddress'];
bloodGroup = json['BloodGroup'];
rHFactor = json['RHFactor'];
isEmailAlertRequired = json['IsEmailAlertRequired'];
isSMSAlertRequired = json['IsSMSAlertRequired'];
preferredLanguage = json['PreferredLanguage'];
isPrivilegedMember = json['IsPrivilegedMember'];
memberID = json['MemberID'];
expiryDate = json['ExpiryDate'];
isHmgEmployee = json['IsHmgEmployee'];
employeeID = json['EmployeeID'];
emergencyContactName = json['EmergencyContactName'];
emergencyContactNo = json['EmergencyContactNo'];
patientPayType = json['PatientPayType'];
dHCCPatientRefID = json['DHCCPatientRefID'];
isPatientDummy = json['IsPatientDummy'];
status = json['Status'];
isStatusCleared = json['IsStatusCleared'];
patientIdentificationType = json['PatientIdentificationType'];
patientIdentificationNo = json['PatientIdentificationNo'];
projectID = json['ProjectID'];
infoSourceID = json['InfoSourceID'];
address = json['Address'];
age = json['Age'];
ageDesc = json['AgeDesc'];
areaID = json['AreaID'];
createdBy = json['CreatedBy'];
genderDescription = json['GenderDescription'];
iR = json['IR'];
iSOCityID = json['ISOCityID'];
iSOCountryID = json['ISOCountryID'];
if (json['ListPrivilege'] != null) {
listPrivilege = [];
json['ListPrivilege'].forEach((v) {
listPrivilege!.add(new ListPrivilege.fromJson(v));
});
}
marital = json['Marital'];
outSA = json['OutSA'];
pOBox = json['POBox'];
receiveHealthSummaryReport = json['ReceiveHealthSummaryReport'];
sourceType = json['SourceType'];
strDateofBirth = json['StrDateofBirth'];
tempAddress = json['TempAddress'];
zipCode = json['ZipCode'];
isFamily = json['IsFamily'];
cRSVerificationStatus = json['CRSVerificationStatus'];
}
Map<String, dynamic> toJson() { String toRawJson() => json.encode(toJson());
final Map<String, dynamic> data = new Map<String, dynamic>();
data['SetupID'] = this.setupID; factory AuthenticatedUser.fromJson(Map<String, dynamic> json) => AuthenticatedUser(
data['PatientType'] = this.patientType; setupId: json["SetupID"],
data['PatientID'] = this.patientID; patientType: json["PatientType"],
data['FirstName'] = this.firstName; patientId: json["PatientID"],
data['MiddleName'] = this.middleName; firstName: json["FirstName"],
data['LastName'] = this.lastName; middleName: json["MiddleName"],
data['FirstNameN'] = this.firstNameN; lastName: json["LastName"],
data['MiddleNameN'] = this.middleNameN; firstNameN: json["FirstNameN"],
data['LastNameN'] = this.lastNameN; middleNameN: json["MiddleNameN"],
data['RelationshipID'] = this.relationshipID; lastNameN: json["LastNameN"],
data['Gender'] = this.gender; relationshipId: json["RelationshipID"],
data['DateofBirth'] = this.dateofBirth; gender: json["Gender"],
data['DateofBirthN'] = this.dateofBirthN; dateofBirth: json["DateofBirth"],
data['NationalityID'] = this.nationalityID; dateofBirthN: json["DateofBirthN"],
data['PhoneResi'] = this.phoneResi; nationalityId: json["NationalityID"],
data['PhoneOffice'] = this.phoneOffice; phoneResi: json["PhoneResi"],
data['MobileNumber'] = this.mobileNumber; phoneOffice: json["PhoneOffice"],
data['FaxNumber'] = this.faxNumber; mobileNumber: json["MobileNumber"],
data['EmailAddress'] = this.emailAddress; faxNumber: json["FaxNumber"],
data['BloodGroup'] = this.bloodGroup; emailAddress: json["EmailAddress"],
data['RHFactor'] = this.rHFactor; bloodGroup: json["BloodGroup"],
data['IsEmailAlertRequired'] = this.isEmailAlertRequired; rhFactor: json["RHFactor"],
data['IsSMSAlertRequired'] = this.isSMSAlertRequired; isEmailAlertRequired: json["IsEmailAlertRequired"],
data['PreferredLanguage'] = this.preferredLanguage; isSmsAlertRequired: json["IsSMSAlertRequired"],
data['IsPrivilegedMember'] = this.isPrivilegedMember; preferredLanguage: json["PreferredLanguage"],
data['MemberID'] = this.memberID; isPrivilegedMember: json["IsPrivilegedMember"],
data['ExpiryDate'] = this.expiryDate; memberId: json["MemberID"],
data['IsHmgEmployee'] = this.isHmgEmployee; expiryDate: json["ExpiryDate"],
data['EmployeeID'] = this.employeeID; isHmgEmployee: json["IsHmgEmployee"],
data['EmergencyContactName'] = this.emergencyContactName; employeeId: json["EmployeeID"],
data['EmergencyContactNo'] = this.emergencyContactNo; emergencyContactName: json["EmergencyContactName"],
data['PatientPayType'] = this.patientPayType; emergencyContactNo: json["EmergencyContactNo"],
data['DHCCPatientRefID'] = this.dHCCPatientRefID; patientPayType: json["PatientPayType"],
data['IsPatientDummy'] = this.isPatientDummy; dhccPatientRefId: json["DHCCPatientRefID"],
data['Status'] = this.status; isPatientDummy: json["IsPatientDummy"],
data['IsStatusCleared'] = this.isStatusCleared; status: json["Status"],
data['PatientIdentificationType'] = this.patientIdentificationType; isStatusCleared: json["IsStatusCleared"],
data['PatientIdentificationNo'] = this.patientIdentificationNo; patientIdentificationType: json["PatientIdentificationType"],
data['ProjectID'] = this.projectID; patientIdentificationNo: json["PatientIdentificationNo"],
data['InfoSourceID'] = this.infoSourceID; projectId: json["ProjectID"],
data['Address'] = this.address; infoSourceId: json["InfoSourceID"],
data['Age'] = this.age; address: json["Address"],
data['AgeDesc'] = this.ageDesc; age: json["Age"],
data['AreaID'] = this.areaID; ageDesc: json["AgeDesc"],
data['CreatedBy'] = this.createdBy; areaId: json["AreaID"],
data['GenderDescription'] = this.genderDescription; crsVerificationStatus: json["CRSVerificationStatus"],
data['IR'] = this.iR; crsVerificationStatusDesc: json["CRSVerificationStatusDesc"],
data['ISOCityID'] = this.iSOCityID; crsVerificationStatusDescN: json["CRSVerificationStatusDescN"],
data['ISOCountryID'] = this.iSOCountryID; createdBy: json["CreatedBy"],
if (this.listPrivilege != null) { genderDescription: json["GenderDescription"],
data['ListPrivilege'] = healthIdFromNhicViaVida: json["HealthIDFromNHICViaVida"],
this.listPrivilege!.map((v) => v.toJson()).toList(); ir: json["IR"],
} isoCityId: json["ISOCityID"],
data['Marital'] = this.marital; isoCountryId: json["ISOCountryID"],
data['OutSA'] = this.outSA; isVerfiedFromNhic: json["IsVerfiedFromNHIC"],
data['POBox'] = this.pOBox; listPrivilege: json["ListPrivilege"] == null ? [] : List<ListPrivilege>.from(json["ListPrivilege"]!.map((x) => ListPrivilege.fromJson(x))),
data['ReceiveHealthSummaryReport'] = this.receiveHealthSummaryReport; marital: json["Marital"],
data['SourceType'] = this.sourceType; occupationId: json["OccupationID"],
data['StrDateofBirth'] = this.strDateofBirth; outSa: json["OutSA"],
data['TempAddress'] = this.tempAddress; poBox: json["POBox"],
data['ZipCode'] = this.zipCode; receiveHealthSummaryReport: json["ReceiveHealthSummaryReport"],
data['IsFamily'] = this.isFamily; sourceType: json["SourceType"],
data['CRSVerificationStatus'] = this.cRSVerificationStatus; strDateofBirth: json["StrDateofBirth"],
return data; tempAddress: json["TempAddress"],
} zipCode: json["ZipCode"],
eHealthIdField: json["eHealthIDField"],
authenticatedUserPatientPayType: json["patientPayType"],
authenticatedUserPatientType: json["patientType"],
authenticatedUserStatus: json["status"],
);
Map<String, dynamic> toJson() => {
"SetupID": setupId,
"PatientType": patientType,
"PatientID": patientId,
"FirstName": firstName,
"MiddleName": middleName,
"LastName": lastName,
"FirstNameN": firstNameN,
"MiddleNameN": middleNameN,
"LastNameN": lastNameN,
"RelationshipID": relationshipId,
"Gender": gender,
"DateofBirth": dateofBirth,
"DateofBirthN": dateofBirthN,
"NationalityID": nationalityId,
"PhoneResi": phoneResi,
"PhoneOffice": phoneOffice,
"MobileNumber": mobileNumber,
"FaxNumber": faxNumber,
"EmailAddress": emailAddress,
"BloodGroup": bloodGroup,
"RHFactor": rhFactor,
"IsEmailAlertRequired": isEmailAlertRequired,
"IsSMSAlertRequired": isSmsAlertRequired,
"PreferredLanguage": preferredLanguage,
"IsPrivilegedMember": isPrivilegedMember,
"MemberID": memberId,
"ExpiryDate": expiryDate,
"IsHmgEmployee": isHmgEmployee,
"EmployeeID": employeeId,
"EmergencyContactName": emergencyContactName,
"EmergencyContactNo": emergencyContactNo,
"PatientPayType": patientPayType,
"DHCCPatientRefID": dhccPatientRefId,
"IsPatientDummy": isPatientDummy,
"Status": status,
"IsStatusCleared": isStatusCleared,
"PatientIdentificationType": patientIdentificationType,
"PatientIdentificationNo": patientIdentificationNo,
"ProjectID": projectId,
"InfoSourceID": infoSourceId,
"Address": address,
"Age": age,
"AgeDesc": ageDesc,
"AreaID": areaId,
"CRSVerificationStatus": crsVerificationStatus,
"CRSVerificationStatusDesc": crsVerificationStatusDesc,
"CRSVerificationStatusDescN": crsVerificationStatusDescN,
"CreatedBy": createdBy,
"GenderDescription": genderDescription,
"HealthIDFromNHICViaVida": healthIdFromNhicViaVida,
"IR": ir,
"ISOCityID": isoCityId,
"ISOCountryID": isoCountryId,
"IsVerfiedFromNHIC": isVerfiedFromNhic,
"ListPrivilege": listPrivilege == null ? [] : List<dynamic>.from(listPrivilege!.map((x) => x.toJson())),
"Marital": marital,
"OccupationID": occupationId,
"OutSA": outSa,
"POBox": poBox,
"ReceiveHealthSummaryReport": receiveHealthSummaryReport,
"SourceType": sourceType,
"StrDateofBirth": strDateofBirth,
"TempAddress": tempAddress,
"ZipCode": zipCode,
"eHealthIDField": eHealthIdField,
"patientPayType": authenticatedUserPatientPayType,
"patientType": authenticatedUserPatientType,
"status": authenticatedUserStatus,
};
} }
class ListPrivilege { class ListPrivilege {
int? iD; int? id;
String? serviceName; String? serviceName;
bool? previlege; bool? previlege;
dynamic region; dynamic region;
ListPrivilege({this.iD, this.serviceName, this.previlege, this.region}); ListPrivilege({
this.id,
this.serviceName,
this.previlege,
this.region,
});
factory ListPrivilege.fromRawJson(String str) => ListPrivilege.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
ListPrivilege.fromJson(Map<String, dynamic> json) { factory ListPrivilege.fromJson(Map<String, dynamic> json) => ListPrivilege(
iD = json['ID']; id: json["ID"],
serviceName = json['ServiceName']; serviceName: json["ServiceName"],
previlege = json['Previlege']; previlege: json["Previlege"],
region = json['Region']; region: json["Region"],
} );
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() => {
final Map<String, dynamic> data = new Map<String, dynamic>(); "ID": id,
data['ID'] = this.iD; "ServiceName": serviceName,
data['ServiceName'] = this.serviceName; "Previlege": previlege,
data['Previlege'] = this.previlege; "Region": region,
data['Region'] = this.region; };
return data;
}
} }

@ -1,22 +1,26 @@
import 'dart:convert';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart';
class CheckActivationCode { class CheckActivationCode {
dynamic date; dynamic date;
int? languageID; int? languageId;
int? serviceName; int? serviceName;
dynamic time; dynamic time;
dynamic androidLink; dynamic androidLink;
String? authenticationTokenID; String? authenticationTokenId;
dynamic data; dynamic data;
bool? dataw; bool? dataw;
int? dietType; int? dietType;
int? dietTypeId;
dynamic errorCode; dynamic errorCode;
dynamic errorEndUserMessage; dynamic errorEndUserMessage;
dynamic errorEndUserMessageN; dynamic errorEndUserMessageN;
dynamic errorMessage; dynamic errorMessage;
int? errorStatusCode;
int? errorType; int? errorType;
int? foodCategory; int? foodCategory;
dynamic iOSLink; dynamic iosLink;
bool? isAuthenticated; bool? isAuthenticated;
int? mealOrderStatus; int? mealOrderStatus;
int? mealType; int? mealType;
@ -25,34 +29,46 @@ class CheckActivationCode {
dynamic patientBlodType; dynamic patientBlodType;
dynamic successMsg; dynamic successMsg;
dynamic successMsgN; dynamic successMsgN;
dynamic vidaUpdatedResponse;
dynamic doctorInformationList; dynamic doctorInformationList;
dynamic getAllPendingRecordsList; dynamic getAllPendingRecordsList;
dynamic getAllSharedRecordsByStatusList; dynamic getAllSharedRecordsByStatusList;
dynamic getMaritalstatusLst;
dynamic getOccupationLst;
dynamic getResponseFileList; dynamic getResponseFileList;
bool? isHMGPatient; dynamic hisPatientModelVpPortal;
bool? isHmgPatient;
bool? isLoginSuccessfully; bool? isLoginSuccessfully;
bool? isNeedUpdateIdintificationNo; bool? isNeedUpdateIdintificationNo;
bool? kioskSendSMS; bool? isPatientAuthorized;
AuthenticatedUser? list; bool? isVidaPlus;
bool? kioskSendSms;
List<AuthenticatedUser>? list;
dynamic listAskHabibMobileLoginInfo; dynamic listAskHabibMobileLoginInfo;
dynamic listAskHabibPatientFile; dynamic listAskHabibPatientFile;
dynamic listFamilyRelationships;
dynamic listMergeFiles; dynamic listMergeFiles;
dynamic listMobileLoginInfo; dynamic listMobileLoginInfo;
dynamic listPatientCount; dynamic listPatientCount;
dynamic logInTokenID; dynamic logInTokenId;
dynamic mohemmPrivilegeList; dynamic mohemmPrivilegeList;
int? pateintID; int? pateintId;
String? patientBloodType; dynamic patientBloodType;
dynamic patientErAdminDriverFileList;
dynamic patientErAdminFile;
dynamic patientErDriverFile;
dynamic patientErDriverFileList;
bool? patientHasFile; bool? patientHasFile;
dynamic patientMergedIDs; dynamic patientMergedIDs;
bool? patientOutSA; bool? patientOutSa;
int? patientShareRequestID; int? patientShareRequestId;
int? patientType; int? patientType;
int? projectIDOut; int? projectIdOut;
dynamic returnMessage; dynamic returnMessage;
bool? sMSLoginRequired; bool? smsLoginRequired;
dynamic servicePrivilegeList; dynamic servicePrivilegeList;
dynamic sharePatientName; dynamic sharePatientName;
bool? userAccountIsActivated;
dynamic verificationCode; dynamic verificationCode;
dynamic email; dynamic email;
dynamic errorList; dynamic errorList;
@ -60,236 +76,572 @@ class CheckActivationCode {
bool? isActiveCode; bool? isActiveCode;
bool? isMerged; bool? isMerged;
bool? isNeedUserAgreement; bool? isNeedUserAgreement;
bool? isSMSSent; bool? isSmsSent;
dynamic memberList; dynamic memberList;
dynamic message; dynamic message;
int? statusCode; int? statusCode;
CheckActivationCode( CheckActivationCode({
{this.date, this.date,
this.languageID, this.languageId,
this.serviceName, this.serviceName,
this.time, this.time,
this.androidLink, this.androidLink,
this.authenticationTokenID, this.authenticationTokenId,
this.data, this.data,
this.dataw, this.dataw,
this.dietType, this.dietType,
this.errorCode, this.dietTypeId,
this.errorEndUserMessage, this.errorCode,
this.errorEndUserMessageN, this.errorEndUserMessage,
this.errorMessage, this.errorEndUserMessageN,
this.errorType, this.errorMessage,
this.foodCategory, this.errorStatusCode,
this.iOSLink, this.errorType,
this.isAuthenticated, this.foodCategory,
this.mealOrderStatus, this.iosLink,
this.mealType, this.isAuthenticated,
this.messageStatus, this.mealOrderStatus,
this.numberOfResultRecords, this.mealType,
this.patientBlodType, this.messageStatus,
this.successMsg, this.numberOfResultRecords,
this.successMsgN, this.patientBlodType,
this.doctorInformationList, this.successMsg,
this.getAllPendingRecordsList, this.successMsgN,
this.getAllSharedRecordsByStatusList, this.vidaUpdatedResponse,
this.getResponseFileList, this.doctorInformationList,
this.isHMGPatient, this.getAllPendingRecordsList,
this.isLoginSuccessfully, this.getAllSharedRecordsByStatusList,
this.isNeedUpdateIdintificationNo, this.getMaritalstatusLst,
this.kioskSendSMS, this.getOccupationLst,
this.list, this.getResponseFileList,
this.listAskHabibMobileLoginInfo, this.hisPatientModelVpPortal,
this.listAskHabibPatientFile, this.isHmgPatient,
this.listMergeFiles, this.isLoginSuccessfully,
this.listMobileLoginInfo, this.isNeedUpdateIdintificationNo,
this.listPatientCount, this.isPatientAuthorized,
this.logInTokenID, this.isVidaPlus,
this.mohemmPrivilegeList, this.kioskSendSms,
this.pateintID, this.list,
this.patientBloodType, this.listAskHabibMobileLoginInfo,
this.patientHasFile, this.listAskHabibPatientFile,
this.patientMergedIDs, this.listFamilyRelationships,
this.patientOutSA, this.listMergeFiles,
this.patientShareRequestID, this.listMobileLoginInfo,
this.patientType, this.listPatientCount,
this.projectIDOut, this.logInTokenId,
this.returnMessage, this.mohemmPrivilegeList,
this.sMSLoginRequired, this.pateintId,
this.servicePrivilegeList, this.patientBloodType,
this.sharePatientName, this.patientErAdminDriverFileList,
this.verificationCode, this.patientErAdminFile,
this.email, this.patientErDriverFile,
this.errorList, this.patientErDriverFileList,
this.hasFile, this.patientHasFile,
this.isActiveCode, this.patientMergedIDs,
this.isMerged, this.patientOutSa,
this.isNeedUserAgreement, this.patientShareRequestId,
this.isSMSSent, this.patientType,
this.memberList, this.projectIdOut,
this.message, this.returnMessage,
this.statusCode}); this.smsLoginRequired,
this.servicePrivilegeList,
this.sharePatientName,
this.userAccountIsActivated,
this.verificationCode,
this.email,
this.errorList,
this.hasFile,
this.isActiveCode,
this.isMerged,
this.isNeedUserAgreement,
this.isSmsSent,
this.memberList,
this.message,
this.statusCode,
});
factory CheckActivationCode.fromRawJson(String str) => CheckActivationCode.fromJson(json.decode(str));
CheckActivationCode.fromJson(Map<String, dynamic> json) { String toRawJson() => json.encode(toJson());
date = json['Date'];
languageID = json['LanguageID'];
serviceName = json['ServiceName'];
time = json['Time'];
androidLink = json['AndroidLink'];
authenticationTokenID = json['AuthenticationTokenID'];
data = json['Data'];
dataw = json['Dataw'];
dietType = json['DietType'];
errorCode = json['ErrorCode'];
errorEndUserMessage = json['ErrorEndUserMessage'];
errorEndUserMessageN = json['ErrorEndUserMessageN'];
errorMessage = json['ErrorMessage'];
errorType = json['ErrorType'];
foodCategory = json['FoodCategory'];
iOSLink = json['IOSLink'];
isAuthenticated = json['IsAuthenticated'];
mealOrderStatus = json['MealOrderStatus'];
mealType = json['MealType'];
messageStatus = json['MessageStatus'];
numberOfResultRecords = json['NumberOfResultRecords'];
patientBlodType = json['PatientBlodType'];
successMsg = json['SuccessMsg'];
successMsgN = json['SuccessMsgN'];
doctorInformationList = json['DoctorInformation_List'];
getAllPendingRecordsList = json['GetAllPendingRecordsList'];
getAllSharedRecordsByStatusList = json['GetAllSharedRecordsByStatusList'];
getResponseFileList = json['GetResponseFileList'];
isHMGPatient = json['IsHMGPatient'];
isLoginSuccessfully = json['IsLoginSuccessfully'];
isNeedUpdateIdintificationNo = json['IsNeedUpdateIdintificationNo'];
kioskSendSMS = json['KioskSendSMS'];
if (json['List'] != null) {
list = AuthenticatedUser.fromJson(json['List'][0]);
}
listAskHabibMobileLoginInfo = json['List_AskHabibMobileLoginInfo'];
listAskHabibPatientFile = json['List_AskHabibPatientFile'];
listMergeFiles = json['List_MergeFiles'];
listMobileLoginInfo = json['List_MobileLoginInfo'];
listPatientCount = json['List_PatientCount'];
logInTokenID = json['LogInTokenID'];
mohemmPrivilegeList = json['MohemmPrivilege_List'];
pateintID = json['PateintID'];
patientBloodType = json['PatientBloodType'];
patientHasFile = json['PatientHasFile'];
patientMergedIDs = json['PatientMergedIDs'];
patientOutSA = json['PatientOutSA'];
patientShareRequestID = json['PatientShareRequestID'];
patientType = json['PatientType'];
projectIDOut = json['ProjectIDOut'];
returnMessage = json['ReturnMessage'];
sMSLoginRequired = json['SMSLoginRequired'];
servicePrivilegeList = json['ServicePrivilege_List'];
sharePatientName = json['SharePatientName'];
verificationCode = json['VerificationCode'];
email = json['email'];
errorList = json['errorList'];
hasFile = json['hasFile'];
isActiveCode = json['isActiveCode'];
isMerged = json['isMerged'];
isNeedUserAgreement = json['isNeedUserAgreement'];
isSMSSent = json['isSMSSent'];
memberList = json['memberList'];
message = json['message'];
statusCode = json['statusCode'];
}
Map<String, dynamic> toJson() { factory CheckActivationCode.fromJson(Map<String, dynamic> json) => CheckActivationCode(
final Map<String, dynamic> data = <String, dynamic>{}; date: json["Date"],
data['Date'] = date; languageId: json["LanguageID"],
data['LanguageID'] = languageID; serviceName: json["ServiceName"],
data['ServiceName'] = serviceName; time: json["Time"],
data['Time'] = time; androidLink: json["AndroidLink"],
data['AndroidLink'] = androidLink; authenticationTokenId: json["AuthenticationTokenID"],
data['AuthenticationTokenID'] = authenticationTokenID; data: json["Data"],
data['Data'] = this.data; dataw: json["Dataw"],
data['Dataw'] = dataw; dietType: json["DietType"],
data['DietType'] = dietType; dietTypeId: json["DietTypeID"],
data['ErrorCode'] = errorCode; errorCode: json["ErrorCode"],
data['ErrorEndUserMessage'] = errorEndUserMessage; errorEndUserMessage: json["ErrorEndUserMessage"],
data['ErrorEndUserMessageN'] = errorEndUserMessageN; errorEndUserMessageN: json["ErrorEndUserMessageN"],
data['ErrorMessage'] = errorMessage; errorMessage: json["ErrorMessage"],
data['ErrorType'] = errorType; errorStatusCode: json["ErrorStatusCode"],
data['FoodCategory'] = foodCategory; errorType: json["ErrorType"],
data['IOSLink'] = iOSLink; foodCategory: json["FoodCategory"],
data['IsAuthenticated'] = isAuthenticated; iosLink: json["IOSLink"],
data['MealOrderStatus'] = mealOrderStatus; isAuthenticated: json["IsAuthenticated"],
data['MealType'] = mealType; mealOrderStatus: json["MealOrderStatus"],
data['MessageStatus'] = messageStatus; mealType: json["MealType"],
data['NumberOfResultRecords'] = numberOfResultRecords; messageStatus: json["MessageStatus"],
data['PatientBlodType'] = patientBlodType; numberOfResultRecords: json["NumberOfResultRecords"],
data['SuccessMsg'] = successMsg; patientBlodType: json["PatientBlodType"],
data['SuccessMsgN'] = successMsgN; successMsg: json["SuccessMsg"],
data['DoctorInformation_List'] = doctorInformationList; successMsgN: json["SuccessMsgN"],
data['GetAllPendingRecordsList'] = getAllPendingRecordsList; vidaUpdatedResponse: json["VidaUpdatedResponse"],
data['GetAllSharedRecordsByStatusList'] = getAllSharedRecordsByStatusList; doctorInformationList: json["DoctorInformation_List"],
data['GetResponseFileList'] = getResponseFileList; getAllPendingRecordsList: json["GetAllPendingRecordsList"],
data['IsHMGPatient'] = isHMGPatient; getAllSharedRecordsByStatusList: json["GetAllSharedRecordsByStatusList"],
data['IsLoginSuccessfully'] = isLoginSuccessfully; getMaritalstatusLst: json["GetMaritalstatusLst"],
data['IsNeedUpdateIdintificationNo'] = isNeedUpdateIdintificationNo; getOccupationLst: json["GetOccupationLst"],
data['KioskSendSMS'] = kioskSendSMS; getResponseFileList: json["GetResponseFileList"],
if (list != null) { hisPatientModelVpPortal: json["HIS_PatientModel_VPPortal"],
data['List'] = list; isHmgPatient: json["IsHMGPatient"],
} isLoginSuccessfully: json["IsLoginSuccessfully"],
data['List_AskHabibMobileLoginInfo'] = listAskHabibMobileLoginInfo; isNeedUpdateIdintificationNo: json["IsNeedUpdateIdintificationNo"],
data['List_AskHabibPatientFile'] = listAskHabibPatientFile; isPatientAuthorized: json["IsPatientAuthorized"],
data['List_MergeFiles'] = listMergeFiles; isVidaPlus: json["IsVidaPlus"],
data['List_MobileLoginInfo'] = listMobileLoginInfo; kioskSendSms: json["KioskSendSMS"],
data['List_PatientCount'] = listPatientCount; list: json["List"] == null ? [] : List<AuthenticatedUser>.from(json["List"]!.map((x) => AuthenticatedUser.fromJson(x))),
data['LogInTokenID'] = logInTokenID; listAskHabibMobileLoginInfo: json["List_AskHabibMobileLoginInfo"],
data['MohemmPrivilege_List'] = mohemmPrivilegeList; listAskHabibPatientFile: json["List_AskHabibPatientFile"],
data['PateintID'] = pateintID; listFamilyRelationships: json["List_FamilyRelationships"],
data['PatientBloodType'] = patientBloodType; listMergeFiles: json["List_MergeFiles"],
data['PatientHasFile'] = patientHasFile; listMobileLoginInfo: json["List_MobileLoginInfo"],
data['PatientMergedIDs'] = patientMergedIDs; listPatientCount: json["List_PatientCount"],
data['PatientOutSA'] = patientOutSA; logInTokenId: json["LogInTokenID"],
data['PatientShareRequestID'] = patientShareRequestID; mohemmPrivilegeList: json["MohemmPrivilege_List"],
data['PatientType'] = patientType; pateintId: json["PateintID"],
data['ProjectIDOut'] = projectIDOut; patientBloodType: json["PatientBloodType"],
data['ReturnMessage'] = returnMessage; patientErAdminDriverFileList: json["PatientER_AdminDriverFileList"],
data['SMSLoginRequired'] = sMSLoginRequired; patientErAdminFile: json["PatientER_AdminFile"],
data['ServicePrivilege_List'] = servicePrivilegeList; patientErDriverFile: json["PatientER_DriverFile"],
data['SharePatientName'] = sharePatientName; patientErDriverFileList: json["PatientER_DriverFileList"],
data['VerificationCode'] = verificationCode; patientHasFile: json["PatientHasFile"],
data['email'] = email; patientMergedIDs: json["PatientMergedIDs"],
data['errorList'] = errorList; patientOutSa: json["PatientOutSA"],
data['hasFile'] = hasFile; patientShareRequestId: json["PatientShareRequestID"],
data['isActiveCode'] = isActiveCode; patientType: json["PatientType"],
data['isMerged'] = isMerged; projectIdOut: json["ProjectIDOut"],
data['isNeedUserAgreement'] = isNeedUserAgreement; returnMessage: json["ReturnMessage"],
data['isSMSSent'] = isSMSSent; smsLoginRequired: json["SMSLoginRequired"],
data['memberList'] = memberList; servicePrivilegeList: json["ServicePrivilege_List"],
data['message'] = message; sharePatientName: json["SharePatientName"],
data['statusCode'] = statusCode; userAccountIsActivated: json["UserAccountIsActivated"],
return data; verificationCode: json["VerificationCode"],
} email: json["email"],
errorList: json["errorList"],
hasFile: json["hasFile"],
isActiveCode: json["isActiveCode"],
isMerged: json["isMerged"],
isNeedUserAgreement: json["isNeedUserAgreement"],
isSmsSent: json["isSMSSent"],
memberList: json["memberList"],
message: json["message"],
statusCode: json["statusCode"],
);
Map<String, dynamic> toJson() => {
"Date": date,
"LanguageID": languageId,
"ServiceName": serviceName,
"Time": time,
"AndroidLink": androidLink,
"AuthenticationTokenID": authenticationTokenId,
"Data": data,
"Dataw": dataw,
"DietType": dietType,
"DietTypeID": dietTypeId,
"ErrorCode": errorCode,
"ErrorEndUserMessage": errorEndUserMessage,
"ErrorEndUserMessageN": errorEndUserMessageN,
"ErrorMessage": errorMessage,
"ErrorStatusCode": errorStatusCode,
"ErrorType": errorType,
"FoodCategory": foodCategory,
"IOSLink": iosLink,
"IsAuthenticated": isAuthenticated,
"MealOrderStatus": mealOrderStatus,
"MealType": mealType,
"MessageStatus": messageStatus,
"NumberOfResultRecords": numberOfResultRecords,
"PatientBlodType": patientBlodType,
"SuccessMsg": successMsg,
"SuccessMsgN": successMsgN,
"VidaUpdatedResponse": vidaUpdatedResponse,
"DoctorInformation_List": doctorInformationList,
"GetAllPendingRecordsList": getAllPendingRecordsList,
"GetAllSharedRecordsByStatusList": getAllSharedRecordsByStatusList,
"GetMaritalstatusLst": getMaritalstatusLst,
"GetOccupationLst": getOccupationLst,
"GetResponseFileList": getResponseFileList,
"HIS_PatientModel_VPPortal": hisPatientModelVpPortal,
"IsHMGPatient": isHmgPatient,
"IsLoginSuccessfully": isLoginSuccessfully,
"IsNeedUpdateIdintificationNo": isNeedUpdateIdintificationNo,
"IsPatientAuthorized": isPatientAuthorized,
"IsVidaPlus": isVidaPlus,
"KioskSendSMS": kioskSendSms,
"List": list == null ? [] : List<AuthenticatedUser>.from(list!.map((x) => x.toJson())),
"List_AskHabibMobileLoginInfo": listAskHabibMobileLoginInfo,
"List_AskHabibPatientFile": listAskHabibPatientFile,
"List_FamilyRelationships": listFamilyRelationships,
"List_MergeFiles": listMergeFiles,
"List_MobileLoginInfo": listMobileLoginInfo,
"List_PatientCount": listPatientCount,
"LogInTokenID": logInTokenId,
"MohemmPrivilege_List": mohemmPrivilegeList,
"PateintID": pateintId,
"PatientBloodType": patientBloodType,
"PatientER_AdminDriverFileList": patientErAdminDriverFileList,
"PatientER_AdminFile": patientErAdminFile,
"PatientER_DriverFile": patientErDriverFile,
"PatientER_DriverFileList": patientErDriverFileList,
"PatientHasFile": patientHasFile,
"PatientMergedIDs": patientMergedIDs,
"PatientOutSA": patientOutSa,
"PatientShareRequestID": patientShareRequestId,
"PatientType": patientType,
"ProjectIDOut": projectIdOut,
"ReturnMessage": returnMessage,
"SMSLoginRequired": smsLoginRequired,
"ServicePrivilege_List": servicePrivilegeList,
"SharePatientName": sharePatientName,
"UserAccountIsActivated": userAccountIsActivated,
"VerificationCode": verificationCode,
"email": email,
"errorList": errorList,
"hasFile": hasFile,
"isActiveCode": isActiveCode,
"isMerged": isMerged,
"isNeedUserAgreement": isNeedUserAgreement,
"isSMSSent": isSmsSent,
"memberList": memberList,
"message": message,
"statusCode": statusCode,
};
}
class ListElement {
String? setupId;
int? patientType;
int? patientId;
String? firstName;
String? middleName;
String? lastName;
String? firstNameN;
String? middleNameN;
String? lastNameN;
int? relationshipId;
int? gender;
String? dateofBirth;
dynamic dateofBirthN;
String? nationalityId;
String? phoneResi;
String? phoneOffice;
String? mobileNumber;
String? faxNumber;
String? emailAddress;
dynamic bloodGroup;
dynamic rhFactor;
bool? isEmailAlertRequired;
bool? isSmsAlertRequired;
String? preferredLanguage;
bool? isPrivilegedMember;
dynamic memberId;
dynamic expiryDate;
dynamic isHmgEmployee;
dynamic employeeId;
String? emergencyContactName;
String? emergencyContactNo;
int? patientPayType;
dynamic dhccPatientRefId;
bool? isPatientDummy;
int? status;
dynamic isStatusCleared;
int? patientIdentificationType;
String? patientIdentificationNo;
int? projectId;
int? infoSourceId;
dynamic address;
int? age;
String? ageDesc;
int? areaId;
int? crsVerificationStatus;
String? crsVerificationStatusDesc;
String? crsVerificationStatusDescN;
int? createdBy;
String? genderDescription;
String? healthIdFromNhicViaVida;
dynamic ir;
dynamic isoCityId;
dynamic isoCountryId;
bool? isVerfiedFromNhic;
List<ListPrivilege>? listPrivilege;
dynamic marital;
dynamic occupationId;
int? outSa;
dynamic poBox;
bool? receiveHealthSummaryReport;
int? sourceType;
dynamic strDateofBirth;
dynamic tempAddress;
dynamic zipCode;
dynamic eHealthIdField;
dynamic listPatientPayType;
dynamic listPatientType;
dynamic listStatus;
ListElement({
this.setupId,
this.patientType,
this.patientId,
this.firstName,
this.middleName,
this.lastName,
this.firstNameN,
this.middleNameN,
this.lastNameN,
this.relationshipId,
this.gender,
this.dateofBirth,
this.dateofBirthN,
this.nationalityId,
this.phoneResi,
this.phoneOffice,
this.mobileNumber,
this.faxNumber,
this.emailAddress,
this.bloodGroup,
this.rhFactor,
this.isEmailAlertRequired,
this.isSmsAlertRequired,
this.preferredLanguage,
this.isPrivilegedMember,
this.memberId,
this.expiryDate,
this.isHmgEmployee,
this.employeeId,
this.emergencyContactName,
this.emergencyContactNo,
this.patientPayType,
this.dhccPatientRefId,
this.isPatientDummy,
this.status,
this.isStatusCleared,
this.patientIdentificationType,
this.patientIdentificationNo,
this.projectId,
this.infoSourceId,
this.address,
this.age,
this.ageDesc,
this.areaId,
this.crsVerificationStatus,
this.crsVerificationStatusDesc,
this.crsVerificationStatusDescN,
this.createdBy,
this.genderDescription,
this.healthIdFromNhicViaVida,
this.ir,
this.isoCityId,
this.isoCountryId,
this.isVerfiedFromNhic,
this.listPrivilege,
this.marital,
this.occupationId,
this.outSa,
this.poBox,
this.receiveHealthSummaryReport,
this.sourceType,
this.strDateofBirth,
this.tempAddress,
this.zipCode,
this.eHealthIdField,
this.listPatientPayType,
this.listPatientType,
this.listStatus,
});
factory ListElement.fromRawJson(String str) => ListElement.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory ListElement.fromJson(Map<String, dynamic> json) => ListElement(
setupId: json["SetupID"],
patientType: json["PatientType"],
patientId: json["PatientID"],
firstName: json["FirstName"],
middleName: json["MiddleName"],
lastName: json["LastName"],
firstNameN: json["FirstNameN"],
middleNameN: json["MiddleNameN"],
lastNameN: json["LastNameN"],
relationshipId: json["RelationshipID"],
gender: json["Gender"],
dateofBirth: json["DateofBirth"],
dateofBirthN: json["DateofBirthN"],
nationalityId: json["NationalityID"],
phoneResi: json["PhoneResi"],
phoneOffice: json["PhoneOffice"],
mobileNumber: json["MobileNumber"],
faxNumber: json["FaxNumber"],
emailAddress: json["EmailAddress"],
bloodGroup: json["BloodGroup"],
rhFactor: json["RHFactor"],
isEmailAlertRequired: json["IsEmailAlertRequired"],
isSmsAlertRequired: json["IsSMSAlertRequired"],
preferredLanguage: json["PreferredLanguage"],
isPrivilegedMember: json["IsPrivilegedMember"],
memberId: json["MemberID"],
expiryDate: json["ExpiryDate"],
isHmgEmployee: json["IsHmgEmployee"],
employeeId: json["EmployeeID"],
emergencyContactName: json["EmergencyContactName"],
emergencyContactNo: json["EmergencyContactNo"],
patientPayType: json["PatientPayType"],
dhccPatientRefId: json["DHCCPatientRefID"],
isPatientDummy: json["IsPatientDummy"],
status: json["Status"],
isStatusCleared: json["IsStatusCleared"],
patientIdentificationType: json["PatientIdentificationType"],
patientIdentificationNo: json["PatientIdentificationNo"],
projectId: json["ProjectID"],
infoSourceId: json["InfoSourceID"],
address: json["Address"],
age: json["Age"],
ageDesc: json["AgeDesc"],
areaId: json["AreaID"],
crsVerificationStatus: json["CRSVerificationStatus"],
crsVerificationStatusDesc: json["CRSVerificationStatusDesc"],
crsVerificationStatusDescN: json["CRSVerificationStatusDescN"],
createdBy: json["CreatedBy"],
genderDescription: json["GenderDescription"],
healthIdFromNhicViaVida: json["HealthIDFromNHICViaVida"],
ir: json["IR"],
isoCityId: json["ISOCityID"],
isoCountryId: json["ISOCountryID"],
isVerfiedFromNhic: json["IsVerfiedFromNHIC"],
listPrivilege: json["ListPrivilege"] == null ? [] : List<ListPrivilege>.from(json["ListPrivilege"]!.map((x) => ListPrivilege.fromJson(x))),
marital: json["Marital"],
occupationId: json["OccupationID"],
outSa: json["OutSA"],
poBox: json["POBox"],
receiveHealthSummaryReport: json["ReceiveHealthSummaryReport"],
sourceType: json["SourceType"],
strDateofBirth: json["StrDateofBirth"],
tempAddress: json["TempAddress"],
zipCode: json["ZipCode"],
eHealthIdField: json["eHealthIDField"],
listPatientPayType: json["patientPayType"],
listPatientType: json["patientType"],
listStatus: json["status"],
);
Map<String, dynamic> toJson() => {
"SetupID": setupId,
"PatientType": patientType,
"PatientID": patientId,
"FirstName": firstName,
"MiddleName": middleName,
"LastName": lastName,
"FirstNameN": firstNameN,
"MiddleNameN": middleNameN,
"LastNameN": lastNameN,
"RelationshipID": relationshipId,
"Gender": gender,
"DateofBirth": dateofBirth,
"DateofBirthN": dateofBirthN,
"NationalityID": nationalityId,
"PhoneResi": phoneResi,
"PhoneOffice": phoneOffice,
"MobileNumber": mobileNumber,
"FaxNumber": faxNumber,
"EmailAddress": emailAddress,
"BloodGroup": bloodGroup,
"RHFactor": rhFactor,
"IsEmailAlertRequired": isEmailAlertRequired,
"IsSMSAlertRequired": isSmsAlertRequired,
"PreferredLanguage": preferredLanguage,
"IsPrivilegedMember": isPrivilegedMember,
"MemberID": memberId,
"ExpiryDate": expiryDate,
"IsHmgEmployee": isHmgEmployee,
"EmployeeID": employeeId,
"EmergencyContactName": emergencyContactName,
"EmergencyContactNo": emergencyContactNo,
"PatientPayType": patientPayType,
"DHCCPatientRefID": dhccPatientRefId,
"IsPatientDummy": isPatientDummy,
"Status": status,
"IsStatusCleared": isStatusCleared,
"PatientIdentificationType": patientIdentificationType,
"PatientIdentificationNo": patientIdentificationNo,
"ProjectID": projectId,
"InfoSourceID": infoSourceId,
"Address": address,
"Age": age,
"AgeDesc": ageDesc,
"AreaID": areaId,
"CRSVerificationStatus": crsVerificationStatus,
"CRSVerificationStatusDesc": crsVerificationStatusDesc,
"CRSVerificationStatusDescN": crsVerificationStatusDescN,
"CreatedBy": createdBy,
"GenderDescription": genderDescription,
"HealthIDFromNHICViaVida": healthIdFromNhicViaVida,
"IR": ir,
"ISOCityID": isoCityId,
"ISOCountryID": isoCountryId,
"IsVerfiedFromNHIC": isVerfiedFromNhic,
"ListPrivilege": listPrivilege == null ? [] : List<dynamic>.from(listPrivilege!.map((x) => x.toJson())),
"Marital": marital,
"OccupationID": occupationId,
"OutSA": outSa,
"POBox": poBox,
"ReceiveHealthSummaryReport": receiveHealthSummaryReport,
"SourceType": sourceType,
"StrDateofBirth": strDateofBirth,
"TempAddress": tempAddress,
"ZipCode": zipCode,
"eHealthIDField": eHealthIdField,
"patientPayType": listPatientPayType,
"patientType": listPatientType,
"status": listStatus,
};
} }
class ListPrivilege { class ListPrivilege {
int? iD; int? id;
String? serviceName; String? serviceName;
bool? previlege; bool? previlege;
dynamic region; dynamic region;
ListPrivilege({this.iD, this.serviceName, this.previlege, this.region}); ListPrivilege({
this.id,
this.serviceName,
this.previlege,
this.region,
});
factory ListPrivilege.fromRawJson(String str) => ListPrivilege.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
ListPrivilege.fromJson(Map<String, dynamic> json) { factory ListPrivilege.fromJson(Map<String, dynamic> json) => ListPrivilege(
iD = json['ID']; id: json["ID"],
serviceName = json['ServiceName']; serviceName: json["ServiceName"],
previlege = json['Previlege']; previlege: json["Previlege"],
region = json['Region']; region: json["Region"],
} );
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() => {
final Map<String, dynamic> data = <String, dynamic>{}; "ID": id,
data['ID'] = iD; "ServiceName": serviceName,
data['ServiceName'] = serviceName; "Previlege": previlege,
data['Previlege'] = previlege; "Region": region,
data['Region'] = region; };
return data;
}
} }

@ -218,11 +218,12 @@ class _OTPVerificationScreenState extends State<OTPVerificationScreen> {
final otp = _controllers.map((c) => c.text).join(); final otp = _controllers.map((c) => c.text).join();
debugPrint('Verifying OTP: $otp'); debugPrint('Verifying OTP: $otp');
ScaffoldMessenger.of(context).showSnackBar( widget.checkActivationCode(int.parse(otp));
SnackBar(content: Text('Verifying OTP: $otp')), // ScaffoldMessenger.of(context).showSnackBar(
); // SnackBar(content: Text('Verifying OTP: $otp')),
// );
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => RegisterNewStep2(null, {"nationalID": "12345678654321"}))); // Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => RegisterNewStep2(null, {"nationalID": "12345678654321"})));
} }
/// Auto fill OTP into text fields /// Auto fill OTP into text fields

@ -0,0 +1,73 @@
import 'dart:convert';
class CommonAuthanticatedRequest {
String? sessionId;
double? versionId;
int? channel;
int? languageId;
String? ipAdress;
String? generalid;
double? latitude;
double? longitude;
int? deviceTypeId;
int? patientType;
int? patientTypeId;
String? tokenId;
int? patientId;
int? patientOutSa;
CommonAuthanticatedRequest({
this.sessionId,
this.versionId,
this.channel,
this.languageId,
this.ipAdress,
this.generalid,
this.latitude,
this.longitude,
this.deviceTypeId,
this.patientType,
this.patientTypeId,
this.tokenId,
this.patientId,
this.patientOutSa,
});
factory CommonAuthanticatedRequest.fromRawJson(String str) => CommonAuthanticatedRequest.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory CommonAuthanticatedRequest.fromJson(Map<String, dynamic> json) => CommonAuthanticatedRequest(
sessionId: json["SessionID"],
versionId: json["VersionID"]?.toDouble(),
channel: json["Channel"],
languageId: json["LanguageID"],
ipAdress: json["IPAdress"],
generalid: json["generalid"],
latitude: json["Latitude"],
longitude: json["Longitude"],
deviceTypeId: json["DeviceTypeID"],
patientType: json["PatientType"],
patientTypeId: json["PatientTypeID"],
tokenId: json["TokenID"],
patientId: json["PatientID"],
patientOutSa: json["PatientOutSA"],
);
Map<String, dynamic> toJson() => {
"SessionID": sessionId,
"VersionID": versionId,
"Channel": channel,
"LanguageID": languageId,
"IPAdress": ipAdress,
"generalid": generalid,
"Latitude": latitude,
"Longitude": longitude,
"DeviceTypeID": deviceTypeId,
"PatientType": patientType,
"PatientTypeID": patientTypeId,
"TokenID": tokenId,
"PatientID": patientId,
"PatientOutSA": patientOutSa,
};
}

@ -11,7 +11,8 @@ class LabViewModel extends ChangeNotifier {
ErrorHandlerService errorHandlerService; ErrorHandlerService errorHandlerService;
List<PatientLabOrdersResponseModel> patientLabOrders = []; List<PatientLabOrdersResponseModel> patientLabOrders = [];
List<PatientLabOrdersResponseModel> filteredLabOrders = [];
List<PatientLabOrdersResponseModel> tempLabOrdersList = [];
late List<String> _labSuggestionsList = []; late List<String> _labSuggestionsList = [];
List<String> get labSuggestions => _labSuggestionsList; List<String> get labSuggestions => _labSuggestionsList;
@ -20,6 +21,7 @@ class LabViewModel extends ChangeNotifier {
initLabProvider() { initLabProvider() {
patientLabOrders.clear(); patientLabOrders.clear();
filteredLabOrders.clear();
isLabOrdersLoading = true; isLabOrdersLoading = true;
isLabResultsLoading = true; isLabResultsLoading = true;
getPatientLabOrders(); getPatientLabOrders();
@ -36,6 +38,8 @@ class LabViewModel extends ChangeNotifier {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {}); // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) { } else if (apiResponse.messageStatus == 1) {
patientLabOrders = apiResponse.data!; patientLabOrders = apiResponse.data!;
filteredLabOrders = List.from(patientLabOrders);
tempLabOrdersList = apiResponse.data!;
isLabOrdersLoading = false; isLabOrdersLoading = false;
isLabResultsLoading = false; isLabResultsLoading = false;
filterSuggestions(); filterSuggestions();
@ -48,14 +52,27 @@ class LabViewModel extends ChangeNotifier {
); );
} }
filterSuggestions(){ filterSuggestions() {
final List<String> labels = patientLabOrders final List<String> labels = patientLabOrders
.expand((order) => order.testDetails!) // flatten testDetails .expand((order) => order.testDetails!)
.map((detail) => detail.description) // pick description .map((detail) => detail.description)
.whereType<String>() // remove nulls if any .whereType<String>()
.toList(); .toList();
_labSuggestionsList = labels.toSet().toList(); // remove duplicates by converting to a set and back to a list _labSuggestionsList = labels.toSet().toList();
notifyListeners();
}
filterLabReports(String query) {
if (query.isEmpty) {
filteredLabOrders = List.from(patientLabOrders); // reset
} else {
filteredLabOrders = patientLabOrders.where((order) {
final descriptions = order.testDetails?.map((d) => d.description?.toLowerCase()).toList() ?? [];
return descriptions.any((desc) => desc != null && desc.contains(query.toLowerCase()));
}).toList();
patientLabOrders = filteredLabOrders;
}
notifyListeners(); notifyListeners();
} }
} }

@ -805,5 +805,9 @@ abstract class LocaleKeys {
static const checkAvailability = 'checkAvailability'; static const checkAvailability = 'checkAvailability';
static const readInstructions = 'readInstructions'; static const readInstructions = 'readInstructions';
static const searchLabReport = 'searchLabReport'; static const searchLabReport = 'searchLabReport';
static const lastloginBy = 'lastloginBy';
static const allSet ='allSet';
static const enableQuickLogin = 'enableQuickLogin';
static const enableMsg = 'enableMsg';
static const notNow = 'notNow';
} }

@ -117,6 +117,7 @@ void main() async {
errorHandlerService: getIt(), errorHandlerService: getIt(),
navigationService: getIt(), navigationService: getIt(),
cacheService: getIt(), cacheService: getIt(),
localAuthService: getIt(),
), ),
), ),
], child: MyApp()), ], child: MyApp()),

@ -335,7 +335,7 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
// } // }
} else { } else {
showCommonBottomSheet(context, showCommonBottomSheet(context,
child: Utils.getLoadingWidget(), callBackFunc: () {}, title: "", height: ResponsiveExtension.screenHeight * 0.3, isCloseButtonVisible: false, isDismissible: false, isFullScreen: false); child: Utils.getLoadingWidget(), callBackFunc: (str) {}, title: "", height: ResponsiveExtension.screenHeight * 0.3, isCloseButtonVisible: false, isDismissible: false, isFullScreen: false);
await payfortViewModel.checkPaymentStatus( await payfortViewModel.checkPaymentStatus(
transactionID: transID, transactionID: transID,
onSuccess: (apiResponse) async { onSuccess: (apiResponse) async {
@ -399,7 +399,7 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
"1", "1",
"Haroon Amjad", "Haroon Amjad",
"3628599", "3628599",
AuthenticatedUser(outSA: 0, mobileNumber: "0593233758"), AuthenticatedUser(outSa: 0, mobileNumber: "0593233758"),
browser!, browser!,
widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false, widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false,
"2", "2",

@ -0,0 +1,136 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
class QuickLogin extends StatefulWidget {
final VoidCallback onPressed;
final bool isDone;
const QuickLogin({super.key, required this.onPressed, this.isDone = false});
@override
_QuickLogin createState() => _QuickLogin();
}
class _QuickLogin extends State<QuickLogin> {
@override
Widget build(BuildContext context) {
return Container(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
topRight: Radius.circular(24),
),
),
padding: const EdgeInsets.all(24),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
widget.isDone
? Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
InkWell(
onTap: () {
Navigator.pop(context, true);
},
child: Utils.buildSvgWithAssets(icon: AppAssets.cross_circle)),
],
),
Utils.showLottie(context: context, assetPath: AppAnimations.checkmark, width: 120, height: 120, repeat: true),
LocaleKeys.allSet.tr().toText16(textAlign:
TextAlign.center, weight: FontWeight.w500)
// Text(
// ' TranslationBase.of(context).allSet',
// textAlign: TextAlign.center,
// style: context.dynamicTextStyle(
// fontSize: 16,
// fontWeight: FontWeight.w500,
// color: Colors.black,
// ),
// ),
],
)
: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
AppAssets.lockIcon,
height: 101,
),
const SizedBox(height: 10),
LocaleKeys.enableQuickLogin.tr().toText26(isBold: true),
// Text(
// ' TranslationBase.of(context).enableQuickLogin',
// style: context.dynamicTextStyle(
// fontSize: 26,
// fontWeight: FontWeight.bold,
// color: Colors.black,
// ),
// ),
const SizedBox(height: 5),
LocaleKeys.enableQuickLogin.tr().toText16(color: AppColors.quickLoginColor),
// Description
// Text(
// 'TranslationBase.of(context).enableMsg',
// style: context.dynamicTextStyle(
// fontSize: 16,
// color: Color(0xFF666666),
// height: 1.5,
// ),
//),
const SizedBox(height: 24),
// Buttons
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
child: CustomButton(
text:LocaleKeys.enableQuickLogin.tr(),
onPressed: () {
widget.onPressed();
},
backgroundColor: Color(0xffED1C2B),
borderColor: Color(0xffED1C2B),
textColor: Colors.white,
icon:AppAssets.apple_finder,
)),
],
),
SizedBox(
height: 16,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
child: CustomButton(
text: LocaleKeys.notNow.tr(),
onPressed: () {
Navigator.pop(context, true);
},
backgroundColor: Color(0xffFEE9EA),
borderColor: Color(0xffFEE9EA),
textColor: Colors.red,
// icon: "assets/images/svg/apple-finder.svg",
)),
],
),
],
)
],
),
);
}
}

@ -43,7 +43,7 @@ class _RegisterNew extends State<RegisterNewStep2> {
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
authVM!.clearDefaults(); authVM!.clearDefaultInputValues();
} }
@override @override
@ -53,7 +53,7 @@ class _RegisterNew extends State<RegisterNewStep2> {
appBar: CustomAppBar( appBar: CustomAppBar(
onBackPressed: () { onBackPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
authVM!.clearDefaults(); authVM!.clearDefaultInputValues();
}, },
onLanguageChanged: (lang) {}, onLanguageChanged: (lang) {},
hideLogoAndLang: true, hideLogoAndLang: true,
@ -263,7 +263,7 @@ class _RegisterNew extends State<RegisterNewStep2> {
icon: AppAssets.cancel, icon: AppAssets.cancel,
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
authVM!.clearDefaults(); authVM!.clearDefaultInputValues();
}, },
backgroundColor: AppColors.secondaryLightRedColor, backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor,

@ -2,37 +2,51 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/authentication/login.dart'; import 'package:hmg_patient_app_new/presentation/authentication/login.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart'; import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart';
import 'package:hmg_patient_app_new/widgets/bottomsheet/generic_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/bottomsheet/generic_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:provider/provider.dart';
class SavedLogin extends StatefulWidget { class SavedLogin extends StatefulWidget {
// final SelectDeviceIMEIRES savedLoginData;
// const SavedLogin(this.savedLoginData, {Key? key}) : super(key: key);
const SavedLogin(); const SavedLogin({Key? key}) : super(key: key);
@override @override
_SavedLogin createState() => _SavedLogin(); _SavedLogin createState() => _SavedLogin();
} }
class _SavedLogin extends State<SavedLogin> { class _SavedLogin extends State<SavedLogin> {
LoginTypeEnum loginType = LoginTypeEnum.sms;
LoginTypeEnum loginType = LoginTypeEnum.sms;
late AuthenticationViewModel authVm;
late AppState appState;
@override @override
void initState() { void initState() {
authVm = context.read<AuthenticationViewModel>();
appState = getIt.get<AppState>();
authVm.phoneNumberController.text = appState.getSelectDeviceByImeiRespModelElement!.mobile!;
authVm.nationalIdController.text = appState.getSelectDeviceByImeiRespModelElement!.identificationNo!;
super.initState(); super.initState();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(
onBackPressed: () {}, onBackPressed: () {},
@ -48,7 +62,7 @@ class _SavedLogin extends State<SavedLogin> {
// Welcome back text // Welcome back text
LocaleKeys.welcomeBack.tr().toText16(color: AppColors.inputLabelTextColor), LocaleKeys.welcomeBack.tr().toText16(color: AppColors.inputLabelTextColor),
SizedBox(height: 16.h), SizedBox(height: 16.h),
("widget.savedLoginData.name!.toLowerCase().capitalizeFirstofEach").toText26(isBold: true, height: 26 / 36, color: AppColors.textColor), appState.getSelectDeviceByImeiRespModelElement!.name!.toCamelCase.toText26(isBold: true, height: 26 / 36, color: AppColors.textColor),
SizedBox(height: 24.h), SizedBox(height: 24.h),
Container( Container(
padding: EdgeInsets.all(16.h), padding: EdgeInsets.all(16.h),
@ -63,22 +77,25 @@ class _SavedLogin extends State<SavedLogin> {
child: Column( child: Column(
children: [ children: [
// Last login info // Last login info
('LocaleKeys.lastloginBy.tr()' + ' {getType(widget.savedLoginData.logInType!, context)}').toText14(isBold: true, color: AppColors.greyTextColor),
('widget.savedLoginData.createdOn != null ? DateUtil.getFormattedDate(DateUtil.convertStringToDate(widget.savedLoginData.createdOn!), "d MMMM, y at HH:mm") : --') ("${LocaleKeys.lastloginBy.tr() } ${LoginTypeExtension.fromValue(appState.getSelectDeviceByImeiRespModelElement!.logInType!)!.displayName}"
).toText14(isBold: true, color: AppColors.greyTextColor),
(appState.getSelectDeviceByImeiRespModelElement!.createdOn != null ? DateUtil.getFormattedDate(DateUtil.convertStringToDate(appState.getSelectDeviceByImeiRespModelElement!.createdOn!), "d MMMM, y at HH:mm") : '--')
.toText16(isBold: true, color: AppColors.textColor), .toText16(isBold: true, color: AppColors.textColor),
Container(margin: EdgeInsets.all(16.h), child: Utils.buildSvgWithAssets(icon: getTypeIcons(loginType.toInt), iconColor: loginType.toInt == 4 ? null : AppColors.primaryRedColor)), Container(margin: EdgeInsets.all(16.h), child: Utils.buildSvgWithAssets(icon: getTypeIcons(loginType.toInt), height: 54, width: 54, iconColor: loginType.toInt == 4 ? null : AppColors.primaryRedColor)),
// Face ID login button // Face ID login button
Container( SizedBox(
height: 45, height: 45,
child: CustomButton( child: CustomButton(
text: "${LocaleKeys.loginBy.tr()} ${loginType.displayName}", text: "${LocaleKeys.loginBy.tr()} ${loginType.displayName}",
onPressed: () { onPressed: () {
if (loginType == LoginTypeEnum.fingerprint || loginType == LoginTypeEnum.face) { if (loginType == LoginTypeEnum.fingerprint || loginType == LoginTypeEnum.face) {
// loginWithFingerPrintFace(loginType.toInt, widget.savedLoginData.iMEI!); authVm.loginWithFingerPrintFace(loginType.toInt);
} else { }
int? val = loginType.toInt; else {
//checkUserAuthentication(val); // int? val = loginType.toInt;
authVm.checkUserAuthentication(otpTypeEnum: loginType == LoginTypeEnum.sms ? OTPTypeEnum.sms : OTPTypeEnum.whatsapp);
} }
}, },
backgroundColor: Color(0xffED1C2B), backgroundColor: Color(0xffED1C2B),
@ -104,7 +121,7 @@ class _SavedLogin extends State<SavedLogin> {
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
// OTP login button // OTP login button
loginType != null && loginType.toInt != 1 loginType.toInt != 1
? Column( ? Column(
children: [ children: [
loginType.toInt != 1 loginType.toInt != 1
@ -140,7 +157,7 @@ class _SavedLogin extends State<SavedLogin> {
Navigator.of(context).pop(); Navigator.of(context).pop();
loginType = LoginTypeEnum.sms; loginType = LoginTypeEnum.sms;
int? val = loginType.toInt; int? val = loginType.toInt;
// checkUserAuthentication(val); authVm.checkUserAuthentication(otpTypeEnum:OTPTypeEnum.sms );
}, },
backgroundColor: AppColors.primaryRedColor, backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedBorderColor, borderColor: AppColors.primaryRedBorderColor,
@ -163,7 +180,7 @@ class _SavedLogin extends State<SavedLogin> {
Navigator.of(context).pop(); Navigator.of(context).pop();
loginType = LoginTypeEnum.whatsapp; loginType = LoginTypeEnum.whatsapp;
int? val = loginType.toInt; int? val = loginType.toInt;
// checkUserAuthentication(val); authVm.checkUserAuthentication(otpTypeEnum:OTPTypeEnum.whatsapp );
}, },
backgroundColor: AppColors.transparent, backgroundColor: AppColors.transparent,
borderColor: AppColors.textColor, borderColor: AppColors.textColor,
@ -195,11 +212,12 @@ class _SavedLogin extends State<SavedLogin> {
text: "${LocaleKeys.loginBy.tr()} ${LoginTypeEnum.whatsapp.displayName}", text: "${LocaleKeys.loginBy.tr()} ${LoginTypeEnum.whatsapp.displayName}",
onPressed: () { onPressed: () {
if (loginType == LoginTypeEnum.fingerprint || loginType == LoginTypeEnum.face) { if (loginType == LoginTypeEnum.fingerprint || loginType == LoginTypeEnum.face) {
// loginWithFingerPrintFace(loginType.toInt, "iMEI"); authVm.loginWithFingerPrintFace(loginType.toInt);
} else { } else {
loginType = LoginTypeEnum.whatsapp; loginType = LoginTypeEnum.whatsapp;
int? val = loginType.toInt; int? val = loginType.toInt;
// checkUserAuthentication(val); authVm.checkUserAuthentication(otpTypeEnum:OTPTypeEnum.whatsapp );
} }
}, },
backgroundColor: AppColors.whiteColor, backgroundColor: AppColors.whiteColor,

@ -11,14 +11,17 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/authentication/quick_login.dart';
import 'package:hmg_patient_app_new/presentation/home/data/landing_page_data.dart'; import 'package:hmg_patient_app_new/presentation/home/data/landing_page_data.dart';
import 'package:hmg_patient_app_new/presentation/home/widgets/habib_wallet_card.dart'; import 'package:hmg_patient_app_new/presentation/home/widgets/habib_wallet_card.dart';
import 'package:hmg_patient_app_new/presentation/home/widgets/large_service_card.dart'; import 'package:hmg_patient_app_new/presentation/home/widgets/large_service_card.dart';
import 'package:hmg_patient_app_new/presentation/home/widgets/small_service_card.dart'; import 'package:hmg_patient_app_new/presentation/home/widgets/small_service_card.dart';
import 'package:hmg_patient_app_new/presentation/home/widgets/welcome_widget.dart';
import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart' show CustomTabBar; import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart' show CustomTabBar;
import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -31,11 +34,25 @@ class LandingPage extends StatefulWidget {
} }
class _LandingPageState extends State<LandingPage> { class _LandingPageState extends State<LandingPage> {
late final AuthenticationViewModel authVM;
@override
void initState() {
authVM = context.read<AuthenticationViewModel>();
if(mounted) {
authVM.checkLastLoginStatus(() {
showQuickLogin(context, false);
});
}
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppState appState = getIt.get<AppState>(); AppState appState = getIt.get<AppState>();
NavigationService navigationService = getIt.get<NavigationService>(); NavigationService navigationService = getIt.get<NavigationService>();
final AuthenticationViewModel authenticationViewModel = context.read<AuthenticationViewModel>();
return Scaffold( return Scaffold(
backgroundColor: AppColors.bgScaffoldColor, backgroundColor: AppColors.bgScaffoldColor,
body: SingleChildScrollView( body: SingleChildScrollView(
@ -46,32 +63,54 @@ class _LandingPageState extends State<LandingPage> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
CustomButton( appState.isAuthenticated
text: LocaleKeys.loginOrRegister.tr(context: context), ? WelcomeWidget(
onPressed: () async { onTap: () {},
await authenticationViewModel.onLoginPressed(); name: ('${appState.getAuthenticatedUser()!.firstName!} ${appState.getAuthenticatedUser()!.lastName!}'),
}, imageUrl: appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg,
backgroundColor: Color(0xffFEE9EA), )
borderColor: Color(0xffFEE9EA), : CustomButton(
textColor: Color(0xffED1C2B), text: LocaleKeys.loginOrRegister.tr(context: context),
fontSize: 16, onPressed: () async {
fontWeight: FontWeight.w500, await authVM.onLoginPressed();
borderRadius: 12, },
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), backgroundColor: Color(0xffFEE9EA),
height: 50, borderColor: Color(0xffFEE9EA),
), textColor: Color(0xffED1C2B),
Utils.buildSvgWithAssets( fontSize: 16,
icon: AppAssets.contact_icon, fontWeight: FontWeight.w500,
width: 24, borderRadius: 12,
height: 24, padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
).onPress(() { height: 50,
Navigator.of(context).push( ),
FadePage( Row(
page: MedicalFilePage(), children: [
// page: LoginScreen(), Utils.buildSvgWithAssets(icon: AppAssets.bell, height: 20, width: 20).onPress(() {
), Navigator.of(context).push(
); FadePage(
}), page: MedicalFilePage(),
// page: LoginScreen(),
),
);
}).paddingSymmetrical(8.h, 0),
Utils.buildSvgWithAssets(icon: AppAssets.search_icon, height: 20, width: 20).onPress(() {
Navigator.of(context).push(
FadePage(
page: MedicalFilePage(),
// page: LoginScreen(),
),
);
}).paddingSymmetrical(8.h, 0),
Utils.buildSvgWithAssets(icon: AppAssets.contact_icon, height: 20, width: 20).onPress(() {
Navigator.of(context).push(
FadePage(
page: MedicalFilePage(),
// page: LoginScreen(),
),
);
}).paddingSymmetrical(8.h, 0),
],
)
], ],
).paddingSymmetrical(24.h, 0.h), ).paddingSymmetrical(24.h, 0.h),
), ),
@ -281,4 +320,21 @@ class _LandingPageState extends State<LandingPage> {
), ),
); );
} }
void showQuickLogin(BuildContext context, bool isDone) {
showCommonBottomSheet(
context,
title: "",
child: QuickLogin(
isDone: isDone,
onPressed: () {
// sharedPref.setBool(HAS_ENABLED_QUICK_LOGIN, true);
// loginWithFingerPrintFace(3, 1, user, deviceToken);
},
),
height: 400,
isFullScreen: false,
callBackFunc: (str) {},
);
}
} }

@ -0,0 +1,56 @@
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
class WelcomeWidget extends StatelessWidget {
final String name;
final String imageUrl;
final VoidCallback? onTap;
const WelcomeWidget({
super.key,
required this.name,
required this.imageUrl,
this.onTap,
});
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(30),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
// Profile image
Image.asset(imageUrl, width: 40, height: 40),
const SizedBox(width: 10),
// Text column
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"Welcome".toText14(color: AppColors.greyTextColor),
Row(
children: [
name.toText16(isBold: true),
const SizedBox(width: 4),
const Icon(Icons.keyboard_arrow_down, size: 20, color: Colors.black),
],
),
],
),
],
),
);
}
}

@ -64,7 +64,7 @@ class _InsuranceHomePageState extends State<InsuranceHomePage> {
insuranceVM.setIsInsuranceHistoryLoading(true); insuranceVM.setIsInsuranceHistoryLoading(true);
insuranceVM.getPatientInsuranceCardHistory(); insuranceVM.getPatientInsuranceCardHistory();
showCommonBottomSheet(context, showCommonBottomSheet(context,
child: InsuranceHistory(), callBackFunc: () {}, title: "", height: ResponsiveExtension.screenHeight * 0.65, isCloseButtonVisible: false, isFullScreen: false); child: InsuranceHistory(), callBackFunc: (str){}, title: "", height: ResponsiveExtension.screenHeight * 0.65, isCloseButtonVisible: false, isFullScreen: false);
}, },
backgroundColor: AppColors.primaryRedColor.withOpacity(0.1), backgroundColor: AppColors.primaryRedColor.withOpacity(0.1),
borderColor: AppColors.primaryRedColor.withOpacity(0.0), borderColor: AppColors.primaryRedColor.withOpacity(0.0),

@ -120,7 +120,7 @@ class PatientInsuranceCard extends StatelessWidget {
insuranceViewModel.setIsInsuranceUpdateDetailsLoading(true); insuranceViewModel.setIsInsuranceUpdateDetailsLoading(true);
insuranceViewModel.getPatientInsuranceDetailsForUpdate(); insuranceViewModel.getPatientInsuranceDetailsForUpdate();
showCommonBottomSheet(context, showCommonBottomSheet(context,
child: PatientInsuranceCardUpdateCard(), callBackFunc: () {}, title: "", height: ResponsiveExtension.screenHeight * 0.42, isCloseButtonVisible: false, isFullScreen: false); child: PatientInsuranceCardUpdateCard(), callBackFunc: (str) {}, title: "", height: ResponsiveExtension.screenHeight * 0.42, isCloseButtonVisible: false, isFullScreen: false);
}, },
backgroundColor: AppColors.bgGreenColor.withOpacity(0.20), backgroundColor: AppColors.bgGreenColor.withOpacity(0.20),
borderColor: AppColors.bgGreenColor.withOpacity(0.0), borderColor: AppColors.bgGreenColor.withOpacity(0.0),

@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart';
@ -15,6 +16,7 @@ import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
import 'package:hmg_patient_app_new/presentation/lab/search_lab_report.dart'; import 'package:hmg_patient_app_new/presentation/lab/search_lab_report.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/shimmer/movies_shimmer_widget.dart'; import 'package:hmg_patient_app_new/widgets/shimmer/movies_shimmer_widget.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -30,7 +32,7 @@ class _LabOrdersPageState extends State<LabOrdersPage> {
late LabViewModel labProvider; late LabViewModel labProvider;
List<List<TestDetails>?> labSuggestions = []; List<List<TestDetails>?> labSuggestions = [];
int? expandedIndex; int? expandedIndex;
String? selectedFilterText='';
@override @override
void initState() { void initState() {
scheduleMicrotask(() { scheduleMicrotask(() {
@ -63,10 +65,13 @@ class _LabOrdersPageState extends State<LabOrdersPage> {
Utils.buildSvgWithAssets(icon: AppAssets.search_icon).onPress(() { Utils.buildSvgWithAssets(icon: AppAssets.search_icon).onPress(() {
if (model.isLabOrdersLoading) { if (model.isLabOrdersLoading) {
return; return;
} else { }else {
showCommonBottomSheet(context,
child: SearchLabResultsContent(labSuggestionsList: model.labSuggestions), showCommonBottomSheet(context, child: SearchLabResultsContent(labSuggestionsList: model.labSuggestions),
callBackFunc: () {}, callBackFunc: (value) {
selectedFilterText = value;
model.filterLabReports(value!);
},
title: LocaleKeys.searchLabReport.tr(), title: LocaleKeys.searchLabReport.tr(),
height: ResponsiveExtension.screenHeight, height: ResponsiveExtension.screenHeight,
isFullScreen: true, isFullScreen: true,
@ -79,6 +84,8 @@ class _LabOrdersPageState extends State<LabOrdersPage> {
// Build Tab Bar // Build Tab Bar
SizedBox(height: 16.h), SizedBox(height: 16.h),
// Expandable list // Expandable list
selectedFilterText!.isNotEmpty ? CustomChipWidget(chipText: selectedFilterText!, chipType: ChipTypeEnum.alert, isSelected: true, ) : SizedBox(),
ListView.builder( ListView.builder(
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),

@ -1,14 +1,17 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/presentation/authentication/login.dart'; import 'package:hmg_patient_app_new/presentation/authentication/login.dart';
import 'package:hmg_patient_app_new/presentation/home/landing_page.dart';
import 'package:hmg_patient_app_new/splashPage.dart'; import 'package:hmg_patient_app_new/splashPage.dart';
class AppRoutes { class AppRoutes {
static const String initialRoute = '/initialRoute'; static const String initialRoute = '/initialRoute';
static const String loginScreen = '/loginScreen'; static const String loginScreen = '/loginScreen';
static const String registerNewScreen = '/registerNewScreen'; static const String registerNewScreen = '/registerNewScreen';
static const String landingScreen = '/landingScreen';
static Map<String, WidgetBuilder> get routes => { static Map<String, WidgetBuilder> get routes => {
initialRoute: (context) => SplashPage(), initialRoute: (context) => SplashPage(),
loginScreen: (context) => LoginScreen(), loginScreen: (context) => LoginScreen(),
landingScreen: (context) => LandingPage(),
}; };
} }

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; import 'package:hmg_patient_app_new/extensions/route_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart';
abstract class DialogService { abstract class DialogService {
@ -70,7 +71,9 @@ class _ErrorBottomSheet extends StatelessWidget {
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
), ),
child: const Text("OK"), child: const Text("OK", style: TextStyle(color: Colors.white)).onPress((){
Navigator.of(context).pop();
}),
), ),
], ],
), ),

@ -0,0 +1,40 @@
import 'package:local_auth/local_auth.dart';
import 'logger_service.dart';
class LocalAuthService {
final LocalAuthentication localAuth;
final LoggerService loggerService;
LocalAuthService({required this.localAuth, required this.loggerService});
Future<bool> authenticate() async {
try {
bool isAuthenticated = await localAuth.authenticate(
localizedReason: 'Please authenticate to proceed',
options: const AuthenticationOptions(
biometricOnly: true,
stickyAuth: true,
),
);
return isAuthenticated;
} catch (e) {
return false;
}
}
Future<bool> canCheckBiometrics() async {
try {
return await localAuth.canCheckBiometrics;
} catch (e) {
return false;
}
}
Future<List<BiometricType>> getAvailableBiometrics() async {
try {
return await localAuth.getAvailableBiometrics();
} catch (e) {
return [];
}
}
}

@ -18,6 +18,10 @@ class NavigationService {
navigatorKey.currentState?.popUntil(ModalRoute.withName(routeName)); navigatorKey.currentState?.popUntil(ModalRoute.withName(routeName));
} }
void pushAndReplace(String routeName) {
navigatorKey.currentState?.pushReplacementNamed(routeName);
}
Future<T?> pushToOtpScreen<T>({ Future<T?> pushToOtpScreen<T>({
required String phoneNumber, required String phoneNumber,
required Function(int code) checkActivationCode, required Function(int code) checkActivationCode,

@ -58,4 +58,6 @@ static const Color warningLightColor = Color(0xFFFFCC00);
static const Color greyLightColor = Color(0xFFEFEFF0); static const Color greyLightColor = Color(0xFFEFEFF0);
static const Color bottomNAVBorder = Color(0xFFEEEEEE); static const Color bottomNAVBorder = Color(0xFFEEEEEE);
static const Color quickLoginColor = Color(0xFF666666);
} }

@ -7,7 +7,7 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
void showCommonBottomSheet(BuildContext context, void showCommonBottomSheet(BuildContext context,
{required Widget child, required VoidCallback callBackFunc, String? title, required double height, bool isCloseButtonVisible = true, bool isFullScreen = true, bool isDismissible = true}) { {required Widget child, Function(String?)? callBackFunc, String? title, required double height, bool isCloseButtonVisible = true, bool isFullScreen = true, bool isDismissible = true}) {
showModalBottomSheet<String>( showModalBottomSheet<String>(
sheetAnimationStyle: AnimationStyle( sheetAnimationStyle: AnimationStyle(
duration: Duration(milliseconds: 500), // Custom animation duration duration: Duration(milliseconds: 500), // Custom animation duration
@ -30,7 +30,9 @@ void showCommonBottomSheet(BuildContext context,
), ),
); );
}).then((value) { }).then((value) {
callBackFunc(); if(value != null) {
callBackFunc!(value);
}
}); });
} }
@ -64,12 +66,14 @@ class ButtonSheetContent extends StatelessWidget {
// Close button // Close button
isCloseButtonVisible && isFullScreen isCloseButtonVisible && isFullScreen
? Padding( ? Column(children: [
padding: EdgeInsets.symmetric(horizontal: 16), SizedBox(height: 40.h,),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16,),
child: Utils.buildSvgWithAssets(icon: AppAssets.closeBottomNav, width: 32, height: 32).onPress(() { child: Utils.buildSvgWithAssets(icon: AppAssets.closeBottomNav, width: 32, height: 32).onPress(() {
Navigator.of(context).pop(); Navigator.of(context).pop();
}), }),
) )])
: SizedBox(), : SizedBox(),
isFullScreen isFullScreen

@ -207,7 +207,7 @@ class MyInAppBrowser extends InAppBrowser {
tamaraRequestModel.appointmentNo = (appoNo != null && appoNo != "") ? appoNo.toString() : "0"; tamaraRequestModel.appointmentNo = (appoNo != null && appoNo != "") ? appoNo.toString() : "0";
tamaraRequestModel.customerName = patientName; tamaraRequestModel.customerName = patientName;
tamaraRequestModel.fileNumber = patientID.toString(); tamaraRequestModel.fileNumber = patientID.toString();
tamaraRequestModel.patientOutSA = authenticatedUser.outSA == 1 ? true : false; tamaraRequestModel.patientOutSA = authenticatedUser.outSa == 1 ? true : false;
tamaraRequestModel.deviceToken = await Utils.getStringFromPrefs(CacheConst.pushToken); tamaraRequestModel.deviceToken = await Utils.getStringFromPrefs(CacheConst.pushToken);
tamaraRequestModel.latitude = appState.userLat.toString(); tamaraRequestModel.latitude = appState.userLat.toString();
tamaraRequestModel.longitude = appState.userLong.toString(); tamaraRequestModel.longitude = appState.userLong.toString();
@ -276,7 +276,7 @@ class MyInAppBrowser extends InAppBrowser {
form = form.replaceFirst('PROJECT_ID_VALUE', projId); form = form.replaceFirst('PROJECT_ID_VALUE', projId);
form = form.replaceFirst('PAYMENT_OPTION_VALUE', paymentMethod); form = form.replaceFirst('PAYMENT_OPTION_VALUE', paymentMethod);
form = form.replaceFirst('LANG_VALUE', currentLanguageID); form = form.replaceFirst('LANG_VALUE', currentLanguageID);
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");
Platform.isIOS Platform.isIOS
@ -338,10 +338,10 @@ class MyInAppBrowser extends InAppBrowser {
form = form.replaceFirst('INSTALLMENTS_VALUE', installments); form = form.replaceFirst('INSTALLMENTS_VALUE', installments);
form = form.replaceFirst('CUSTNATIONALID_VALUE', authUser.patientIdentificationNo!); form = form.replaceFirst('CUSTNATIONALID_VALUE', authUser.patientIdentificationNo!);
form = form.replaceFirst('CUSTMOBILE_VALUE', authUser.mobileNumber!); form = form.replaceFirst('CUSTMOBILE_VALUE', authUser.mobileNumber!);
form = form.replaceFirst('CUSTDOB_VALUE', DateUtil.getDayMonthYearDateFormatted(authUser.dateofBirthDataTime!)); form = form.replaceFirst('CUSTDOB_VALUE', DateUtil.getDayMonthYearDateFormatted(authUser.strDateofBirth!));
form = form.replaceFirst('CURRENCY_VALUE', authUser.outSA == 0 ? "SAR" : "AED"); form = form.replaceFirst('CURRENCY_VALUE', authUser.outSa == 0 ? "SAR" : "AED");
form = form.replaceFirst('COUNTRY_CODE_VALUE', authUser.outSA == 0 ? "966" : "971"); form = form.replaceFirst('COUNTRY_CODE_VALUE', authUser.outSa == 0 ? "966" : "971");
form = form.replaceFirst('CUSTNAME_VALUE', patientName); form = form.replaceFirst('CUSTNAME_VALUE', patientName);
form = form.replaceFirst('CUSTLASTNAME_VALUE', patientName); form = form.replaceFirst('CUSTLASTNAME_VALUE', patientName);
form = form.replaceFirst('CUSTID_VALUE', patientID.toString()); form = form.replaceFirst('CUSTID_VALUE', patientID.toString());

@ -65,7 +65,7 @@ dependencies:
google_api_availability: ^5.0.1 google_api_availability: ^5.0.1
firebase_analytics: ^11.5.1 firebase_analytics: ^11.5.1
jiffy: ^6.4.3 jiffy: ^6.4.3
hijri_gregorian_calendar: ^0.0.4 hijri_gregorian_calendar: ^0.1.0
web: any web: any
flutter_staggered_animations: ^1.1.1 flutter_staggered_animations: ^1.1.1
@ -84,6 +84,7 @@ flutter:
uses-material-design: true uses-material-design: true
assets: assets:
- assets/ - assets/
- assets/json/
- assets/fonts/ - assets/fonts/
- assets/langs/ - assets/langs/
- assets/images/ - assets/images/

Loading…
Cancel
Save