Merge branch 'master' into dev_aamir
# Conflicts: # lib/main.dart # lib/presentation/home/landing_page.dart # lib/theme/colors.dart # lib/widgets/buttons/custom_button.dartpull/8/head
commit
23a4035117
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 45 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@ -0,0 +1,34 @@
|
||||
class GenericApiModel<T> {
|
||||
final int? messageStatus;
|
||||
final String? errorMessage;
|
||||
final int? statusCode;
|
||||
final T? data;
|
||||
|
||||
GenericApiModel({
|
||||
this.messageStatus,
|
||||
this.errorMessage,
|
||||
this.statusCode,
|
||||
this.data,
|
||||
});
|
||||
|
||||
factory GenericApiModel.fromJson(
|
||||
Map<String, dynamic> json,
|
||||
T Function(Object? json)? fromJsonT,
|
||||
) {
|
||||
return GenericApiModel<T>(
|
||||
messageStatus: json['messageStatus'] as int?,
|
||||
errorMessage: json['errorMessage'] as String?,
|
||||
statusCode: json['statusCode'] as int?,
|
||||
data: fromJsonT != null ? fromJsonT(json['data']) : json['data'] as T?,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson(Object Function(T value)? toJsonT) {
|
||||
return {
|
||||
'messageStatus': messageStatus,
|
||||
'errorMessage': errorMessage,
|
||||
'statusCode': statusCode,
|
||||
'data': toJsonT != null && data != null ? toJsonT(data as T) : data,
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
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';
|
||||
|
||||
class RequestUtils {
|
||||
static dynamic getCommonRequestWelcome({
|
||||
required String phoneNumber,
|
||||
required OTPTypeEnum otpTypeEnum,
|
||||
required String? deviceToken,
|
||||
required bool patientOutSA,
|
||||
required String? loginTokenID,
|
||||
required var registeredData,
|
||||
required int? patientId,
|
||||
required String nationIdText,
|
||||
required String countryCode,
|
||||
}) {
|
||||
bool fileNo = false;
|
||||
if (nationIdText.isNotEmpty) {
|
||||
fileNo = nationIdText.length < 10;
|
||||
}
|
||||
var request = SendActivationRequest();
|
||||
request.patientMobileNumber = int.parse(phoneNumber);
|
||||
request.mobileNo = '0$phoneNumber';
|
||||
request.deviceToken = deviceToken;
|
||||
request.projectOutSA = patientOutSA;
|
||||
request.loginType = otpTypeEnum.toInt();
|
||||
request.oTPSendType = otpTypeEnum.toInt(); // could map OTPTypeEnum if needed
|
||||
request.zipCode = countryCode; // or countryCode if defined elsewhere
|
||||
request.logInTokenID = loginTokenID ?? "";
|
||||
|
||||
if (registeredData != null) {
|
||||
request.searchType = registeredData.searchType ?? 1;
|
||||
request.patientID = registeredData.patientID ?? 0;
|
||||
request.patientIdentificationID = request.nationalID = registeredData.patientIdentificationID ?? '0';
|
||||
request.dob = registeredData.dob;
|
||||
request.isRegister = registeredData.isRegister;
|
||||
} else {
|
||||
if (fileNo) {
|
||||
request.patientID = patientId ?? int.parse(nationIdText);
|
||||
request.patientIdentificationID = request.nationalID = "";
|
||||
request.searchType = 2;
|
||||
} else {
|
||||
request.patientID = 0;
|
||||
request.searchType = 1;
|
||||
request.patientIdentificationID = request.nationalID = nationIdText.isNotEmpty ? nationIdText : '0';
|
||||
}
|
||||
request.isRegister = false;
|
||||
}
|
||||
|
||||
request.deviceTypeID = request.searchType;
|
||||
return request;
|
||||
}
|
||||
|
||||
static getCommonRequestAuthProvider({
|
||||
required OTPTypeEnum otpTypeEnum,
|
||||
required registeredData,
|
||||
required deviceToken,
|
||||
required mobileNumber,
|
||||
required zipCode,
|
||||
required patientOutSA,
|
||||
required loginTokenID,
|
||||
required selectedOption,
|
||||
required int? patientId,
|
||||
}) {
|
||||
var request = SendActivationRequest();
|
||||
request.patientMobileNumber = mobileNumber;
|
||||
request.mobileNo = '0$mobileNumber';
|
||||
request.deviceToken = deviceToken;
|
||||
request.projectOutSA = patientOutSA == true ? true : false;
|
||||
request.loginType = selectedOption;
|
||||
request.oTPSendType = otpTypeEnum.toInt(); //this.selectedOption == 1 ? 1 : 2;
|
||||
request.zipCode = zipCode;
|
||||
|
||||
request.logInTokenID = loginTokenID ?? "";
|
||||
|
||||
if (registeredData != null) {
|
||||
request.searchType = registeredData.searchType ?? 1;
|
||||
request.patientID = registeredData.patientID ?? 0;
|
||||
request.patientIdentificationID = request.nationalID = registeredData.patientIdentificationID ?? '0';
|
||||
request.dob = registeredData.dob;
|
||||
request.isRegister = registeredData.isRegister;
|
||||
} else {
|
||||
request.searchType = request.searchType ?? 2;
|
||||
request.patientID = patientId ?? 0;
|
||||
request.nationalID = request.nationalID ?? '0';
|
||||
request.patientIdentificationID = request.patientIdentificationID ?? '0';
|
||||
request.isRegister = false;
|
||||
}
|
||||
request.deviceTypeID = request.searchType;
|
||||
return request;
|
||||
}
|
||||
}
|
||||
@ -1,47 +1,135 @@
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
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/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/core/enums.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/request_utils.dart';
|
||||
import 'package:hmg_patient_app_new/features/authentication/authentication_repo.dart';
|
||||
import 'package:hmg_patient_app_new/features/authentication/models/check_activation_code_request_register.dart';
|
||||
import 'package:hmg_patient_app_new/features/authentication/models/request_models/check_patient_authentication_request_model.dart';
|
||||
import 'package:hmg_patient_app_new/services/dialog_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
|
||||
|
||||
class AuthenticationViewModel extends ChangeNotifier {
|
||||
AuthenticationRepo authenticationRepo;
|
||||
AppState appState;
|
||||
ErrorHandlerService errorHandlerService;
|
||||
DialogService dialogService;
|
||||
|
||||
AuthenticationViewModel({
|
||||
required this.appState,
|
||||
required this.authenticationRepo,
|
||||
required this.errorHandlerService,
|
||||
required this.dialogService,
|
||||
});
|
||||
|
||||
final TextEditingController nationalIdController = TextEditingController();
|
||||
final TextEditingController phoneNumberController = TextEditingController();
|
||||
|
||||
Future<void> selectDeviceImei({
|
||||
Function(dynamic)? onSuccess,
|
||||
Function(String)? onError
|
||||
}) async {
|
||||
final String firebaseToken =
|
||||
"cIkkB7h7Q7uoFkC4Qv82xG:APA91bEb53Z9XzqymCIctaLxCoMX6bm9fuKlWILQ59uUqfwhCoD42AOP1-jWGB1WYd9BVN5PT2pUUFxrT07vcNg1KH9OH39mrPgCl0m21XVIgWrzNnCkufg";
|
||||
|
||||
final resultEither =
|
||||
await authenticationRepo.selectDeviceByImei(firebaseToken: firebaseToken);
|
||||
|
||||
resultEither.fold(
|
||||
(failure) {
|
||||
notifyListeners();
|
||||
if (onError != null) onError(failure.message);
|
||||
},
|
||||
(data) {
|
||||
|
||||
log("resultEither: ${data.toString()} ");
|
||||
Future<void> selectDeviceImei({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
||||
String firebaseToken =
|
||||
"dOGRRszQQMGe_9wA5Hx3kO:APA91bFV5IcIJXvcCXXk0tc2ddtZgWwCPq7sGSuPr-YW7iiJpQZKgFGN9GAzCVOWL8MfheaP1slE8MdxB7lczdPBGdONQ7WbMmhgHcsUCUktq-hsapGXXqc";
|
||||
final result = await authenticationRepo.selectDeviceByImei(firebaseToken: firebaseToken);
|
||||
|
||||
notifyListeners();
|
||||
if (onSuccess != null) onSuccess(data);
|
||||
result.fold(
|
||||
(failure) async => await errorHandlerService.handleError(failure: failure),
|
||||
(apiResponse) {
|
||||
if (apiResponse.messageStatus == 2) {
|
||||
dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
|
||||
} else if (apiResponse.messageStatus == 1) {
|
||||
//todo: move to next api call
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// Future<void> checkUserAuthentication({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
||||
// CheckPatientAuthenticationReq checkPatientAuthenticationReq = RequestUtils.getCommonRequestWelcome(
|
||||
// phoneNumber: '0567184134',
|
||||
// otpTypeEnum: OTPTypeEnum.sms,
|
||||
// deviceToken: 'dummyDeviceToken123',
|
||||
// patientOutSA: true,
|
||||
// loginTokenID: 'dummyLoginToken456',
|
||||
// registeredData: null,
|
||||
// patientId: 12345,
|
||||
// nationIdText: '1234567890',
|
||||
// countryCode: 'SA',
|
||||
// );
|
||||
//
|
||||
// final result = await authenticationRepo.checkPatientAuthentication(checkPatientAuthenticationReq: checkPatientAuthenticationReq);
|
||||
// result.fold(
|
||||
// (failure) async => await errorHandlerService.handleError(failure: failure),
|
||||
// (apiResponse) {
|
||||
// if (apiResponse.data['isSMSSent']) {
|
||||
// // TODO: set this in AppState
|
||||
// // sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']);
|
||||
// // loginTokenID = value['LogInTokenID'],
|
||||
// // sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request),
|
||||
// sendActivationCode(type);
|
||||
// } else {
|
||||
// if (apiResponse.data['IsAuthenticated']) {
|
||||
// checkActivationCode(onWrongActivationCode: (String? message) {});
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
// Future<void> sendActivationCode({required OTPTypeEnum otpTypeEnum}) async {
|
||||
// var request = RequestUtils.getCommonRequestAuthProvider(
|
||||
// otpTypeEnum: otpTypeEnum,
|
||||
// registeredData: null,
|
||||
// deviceToken: "dummyLoginToken456",
|
||||
// mobileNumber: "0567184134",
|
||||
// zipCode: "SA",
|
||||
// patientOutSA: true,
|
||||
// loginTokenID: "dummyLoginToken456",
|
||||
// selectedOption: selectedOption,
|
||||
// patientId: 12345,
|
||||
// );
|
||||
//
|
||||
// request.sMSSignature = await SMSOTP.getSignature();
|
||||
// selectedOption = type;
|
||||
// // GifLoaderDialogUtils.showMyDialog(context);
|
||||
// if (healthId != null || isDubai) {
|
||||
// if (!isDubai) {
|
||||
// request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob));
|
||||
// }
|
||||
// request.healthId = healthId;
|
||||
// request.isHijri = isHijri;
|
||||
// await this.apiClient.sendActivationCodeRegister(request).then((result) {
|
||||
// // GifLoaderDialogUtils.hideDialog(context);
|
||||
// if (result != null && result['isSMSSent'] == true) {
|
||||
// this.startSMSService(type);
|
||||
// }
|
||||
// }).catchError((r) {
|
||||
// GifLoaderDialogUtils.hideDialog(context);
|
||||
// context.showBottomSheet(
|
||||
// child: ExceptionBottomSheet(
|
||||
// message: r.toString(),
|
||||
// onOkPressed: () {
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// ));
|
||||
// // AppToast.showErrorToast(message: r);
|
||||
// });
|
||||
// } else {
|
||||
// request.dob = "";
|
||||
// request.healthId = "";
|
||||
// request.isHijri = 0;
|
||||
// await this.authService.sendActivationCode(request).then((result) {
|
||||
// GifLoaderDialogUtils.hideDialog(context);
|
||||
// if (result != null && result['isSMSSent'] == true) {
|
||||
// this.startSMSService(type);
|
||||
// }
|
||||
// }).catchError((r) {
|
||||
// GifLoaderDialogUtils.hideDialog(context);
|
||||
// context.showBottomSheet(
|
||||
// child: ExceptionBottomSheet(
|
||||
// message: r.toString(),
|
||||
// onOkPressed: () {
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// ));
|
||||
// // AppToast.showErrorToast(message: r.toString());
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@ -1,121 +0,0 @@
|
||||
class CheckActivationCodeRegisterReq {
|
||||
int? patientMobileNumber;
|
||||
String? mobileNo;
|
||||
String? deviceToken;
|
||||
bool? projectOutSA;
|
||||
int? loginType;
|
||||
String? zipCode;
|
||||
bool? isRegister;
|
||||
String? logInTokenID;
|
||||
int? searchType;
|
||||
int? patientID;
|
||||
String? nationalID;
|
||||
String? patientIdentificationID;
|
||||
String? activationCode;
|
||||
bool? isSilentLogin;
|
||||
double? versionID;
|
||||
int? channel;
|
||||
int? languageID;
|
||||
String? iPAdress;
|
||||
String? generalid;
|
||||
int? patientOutSA;
|
||||
dynamic sessionID;
|
||||
bool? isDentalAllowedBackend;
|
||||
int? deviceTypeID;
|
||||
bool? forRegisteration;
|
||||
String? dob;
|
||||
int? isHijri;
|
||||
String? healthId;
|
||||
|
||||
CheckActivationCodeRegisterReq({
|
||||
this.patientMobileNumber,
|
||||
this.mobileNo,
|
||||
this.deviceToken,
|
||||
this.projectOutSA,
|
||||
this.loginType,
|
||||
this.zipCode,
|
||||
this.isRegister,
|
||||
this.logInTokenID,
|
||||
this.searchType,
|
||||
this.patientID,
|
||||
this.nationalID,
|
||||
this.patientIdentificationID,
|
||||
this.activationCode,
|
||||
this.isSilentLogin,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.languageID,
|
||||
this.iPAdress,
|
||||
this.generalid,
|
||||
this.patientOutSA,
|
||||
this.sessionID,
|
||||
this.isDentalAllowedBackend,
|
||||
this.deviceTypeID,
|
||||
this.forRegisteration,
|
||||
this.dob,
|
||||
this.isHijri,
|
||||
this.healthId,
|
||||
});
|
||||
|
||||
CheckActivationCodeRegisterReq.fromJson(Map<String, dynamic> json) {
|
||||
patientMobileNumber = json['PatientMobileNumber'];
|
||||
mobileNo = json['MobileNo'];
|
||||
deviceToken = json['DeviceToken'];
|
||||
projectOutSA = json['ProjectOutSA'];
|
||||
loginType = json['LoginType'];
|
||||
zipCode = json['ZipCode'];
|
||||
isRegister = json['isRegister'];
|
||||
logInTokenID = json['LogInTokenID'];
|
||||
searchType = json['SearchType'];
|
||||
patientID = json['PatientID'];
|
||||
nationalID = json['NationalID'];
|
||||
patientIdentificationID = json['PatientIdentificationID'];
|
||||
activationCode = json['activationCode'];
|
||||
isSilentLogin = json['IsSilentLogin'];
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
languageID = json['LanguageID'];
|
||||
iPAdress = json['IPAdress'];
|
||||
generalid = json['generalid'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
sessionID = json['SessionID'];
|
||||
isDentalAllowedBackend = json['isDentalAllowedBackend'];
|
||||
deviceTypeID = json['DeviceTypeID'];
|
||||
forRegisteration = json['ForRegisteration'];
|
||||
dob = json['DOB'];
|
||||
isHijri = json['IsHijri'];
|
||||
healthId = json['HealthId'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['PatientMobileNumber'] = this.patientMobileNumber;
|
||||
data['MobileNo'] = this.mobileNo;
|
||||
data['DeviceToken'] = this.deviceToken;
|
||||
data['ProjectOutSA'] = this.projectOutSA;
|
||||
data['LoginType'] = this.loginType;
|
||||
data['ZipCode'] = this.zipCode;
|
||||
data['isRegister'] = this.isRegister;
|
||||
data['LogInTokenID'] = this.logInTokenID;
|
||||
data['SearchType'] = this.searchType;
|
||||
data['PatientID'] = this.patientID;
|
||||
data['NationalID'] = this.nationalID;
|
||||
data['PatientIdentificationID'] = this.patientIdentificationID;
|
||||
data['activationCode'] = this.activationCode;
|
||||
data['IsSilentLogin'] = this.isSilentLogin;
|
||||
data['VersionID'] = this.versionID;
|
||||
data['Channel'] = this.channel;
|
||||
data['LanguageID'] = this.languageID;
|
||||
data['IPAdress'] = this.iPAdress;
|
||||
data['generalid'] = this.generalid;
|
||||
data['PatientOutSA'] = this.patientOutSA;
|
||||
data['SessionID'] = this.sessionID;
|
||||
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
|
||||
data['DeviceTypeID'] = this.deviceTypeID;
|
||||
data['ForRegisteration'] = this.forRegisteration;
|
||||
data['DOB'] = dob;
|
||||
data['IsHijri'] = isHijri;
|
||||
data['HealthId'] = healthId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,121 @@
|
||||
// class CheckActivationCodeRegisterReq {
|
||||
// int? patientMobileNumber;
|
||||
// String? mobileNo;
|
||||
// String? deviceToken;
|
||||
// bool? projectOutSA;
|
||||
// int? loginType;
|
||||
// String? zipCode;
|
||||
// bool? isRegister;
|
||||
// String? logInTokenID;
|
||||
// int? searchType;
|
||||
// int? patientID;
|
||||
// String? nationalID;
|
||||
// String? patientIdentificationID;
|
||||
// String? activationCode;
|
||||
// bool? isSilentLogin;
|
||||
// double? versionID;
|
||||
// int? channel;
|
||||
// int? languageID;
|
||||
// String? iPAdress;
|
||||
// String? generalid;
|
||||
// int? patientOutSA;
|
||||
// dynamic sessionID;
|
||||
// bool? isDentalAllowedBackend;
|
||||
// int? deviceTypeID;
|
||||
// bool? forRegisteration;
|
||||
// String? dob;
|
||||
// int? isHijri;
|
||||
// String? healthId;
|
||||
//
|
||||
// CheckActivationCodeRegisterReq({
|
||||
// this.patientMobileNumber,
|
||||
// this.mobileNo,
|
||||
// this.deviceToken,
|
||||
// this.projectOutSA,
|
||||
// this.loginType,
|
||||
// this.zipCode,
|
||||
// this.isRegister,
|
||||
// this.logInTokenID,
|
||||
// this.searchType,
|
||||
// this.patientID,
|
||||
// this.nationalID,
|
||||
// this.patientIdentificationID,
|
||||
// this.activationCode,
|
||||
// this.isSilentLogin,
|
||||
// this.versionID,
|
||||
// this.channel,
|
||||
// this.languageID,
|
||||
// this.iPAdress,
|
||||
// this.generalid,
|
||||
// this.patientOutSA,
|
||||
// this.sessionID,
|
||||
// this.isDentalAllowedBackend,
|
||||
// this.deviceTypeID,
|
||||
// this.forRegisteration,
|
||||
// this.dob,
|
||||
// this.isHijri,
|
||||
// this.healthId,
|
||||
// });
|
||||
//
|
||||
// CheckActivationCodeRegisterReq.fromJson(Map<String, dynamic> json) {
|
||||
// patientMobileNumber = json['PatientMobileNumber'];
|
||||
// mobileNo = json['MobileNo'];
|
||||
// deviceToken = json['DeviceToken'];
|
||||
// projectOutSA = json['ProjectOutSA'];
|
||||
// loginType = json['LoginType'];
|
||||
// zipCode = json['ZipCode'];
|
||||
// isRegister = json['isRegister'];
|
||||
// logInTokenID = json['LogInTokenID'];
|
||||
// searchType = json['SearchType'];
|
||||
// patientID = json['PatientID'];
|
||||
// nationalID = json['NationalID'];
|
||||
// patientIdentificationID = json['PatientIdentificationID'];
|
||||
// activationCode = json['activationCode'];
|
||||
// isSilentLogin = json['IsSilentLogin'];
|
||||
// versionID = json['VersionID'];
|
||||
// channel = json['Channel'];
|
||||
// languageID = json['LanguageID'];
|
||||
// iPAdress = json['IPAdress'];
|
||||
// generalid = json['generalid'];
|
||||
// patientOutSA = json['PatientOutSA'];
|
||||
// sessionID = json['SessionID'];
|
||||
// isDentalAllowedBackend = json['isDentalAllowedBackend'];
|
||||
// deviceTypeID = json['DeviceTypeID'];
|
||||
// forRegisteration = json['ForRegisteration'];
|
||||
// dob = json['DOB'];
|
||||
// isHijri = json['IsHijri'];
|
||||
// healthId = json['HealthId'];
|
||||
// }
|
||||
//
|
||||
// Map<String, dynamic> toJson() {
|
||||
// final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
// data['PatientMobileNumber'] = this.patientMobileNumber;
|
||||
// data['MobileNo'] = this.mobileNo;
|
||||
// data['DeviceToken'] = this.deviceToken;
|
||||
// data['ProjectOutSA'] = this.projectOutSA;
|
||||
// data['LoginType'] = this.loginType;
|
||||
// data['ZipCode'] = this.zipCode;
|
||||
// data['isRegister'] = this.isRegister;
|
||||
// data['LogInTokenID'] = this.logInTokenID;
|
||||
// data['SearchType'] = this.searchType;
|
||||
// data['PatientID'] = this.patientID;
|
||||
// data['NationalID'] = this.nationalID;
|
||||
// data['PatientIdentificationID'] = this.patientIdentificationID;
|
||||
// data['activationCode'] = this.activationCode;
|
||||
// data['IsSilentLogin'] = this.isSilentLogin;
|
||||
// data['VersionID'] = this.versionID;
|
||||
// data['Channel'] = this.channel;
|
||||
// data['LanguageID'] = this.languageID;
|
||||
// data['IPAdress'] = this.iPAdress;
|
||||
// data['generalid'] = this.generalid;
|
||||
// data['PatientOutSA'] = this.patientOutSA;
|
||||
// data['SessionID'] = this.sessionID;
|
||||
// data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
|
||||
// data['DeviceTypeID'] = this.deviceTypeID;
|
||||
// data['ForRegisteration'] = this.forRegisteration;
|
||||
// data['DOB'] = dob;
|
||||
// data['IsHijri'] = isHijri;
|
||||
// data['HealthId'] = healthId;
|
||||
// return data;
|
||||
// }
|
||||
// }
|
||||
@ -0,0 +1,88 @@
|
||||
class CheckPatientAuthenticationReq {
|
||||
int? patientMobileNumber;
|
||||
String? zipCode;
|
||||
bool? isRegister;
|
||||
String? tokenID;
|
||||
int? searchType;
|
||||
String? patientIdentificationID;
|
||||
int? patientID;
|
||||
double? versionID;
|
||||
int? channel;
|
||||
int? languageID;
|
||||
String? iPAdress;
|
||||
String? generalid;
|
||||
int? patientOutSA;
|
||||
dynamic sessionID;
|
||||
bool? isDentalAllowedBackend;
|
||||
int? deviceTypeID;
|
||||
String? dob;
|
||||
int? isHijri;
|
||||
String? healthId;
|
||||
|
||||
CheckPatientAuthenticationReq(
|
||||
{this.patientMobileNumber,
|
||||
this.zipCode,
|
||||
this.isRegister,
|
||||
this.tokenID,
|
||||
this.searchType,
|
||||
this.patientIdentificationID,
|
||||
this.patientID,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.languageID,
|
||||
this.iPAdress,
|
||||
this.generalid,
|
||||
this.patientOutSA,
|
||||
this.sessionID,
|
||||
this.isDentalAllowedBackend,
|
||||
this.deviceTypeID,
|
||||
this.dob,
|
||||
this.isHijri,
|
||||
this.healthId});
|
||||
|
||||
CheckPatientAuthenticationReq.fromJson(Map<String, dynamic> json) {
|
||||
patientMobileNumber = json['PatientMobileNumber'];
|
||||
zipCode = json['ZipCode'];
|
||||
isRegister = json['isRegister'];
|
||||
tokenID = json['TokenID'];
|
||||
searchType = json['SearchType'];
|
||||
patientIdentificationID = json['PatientIdentificationID'];
|
||||
patientID = json['PatientID'];
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
languageID = json['LanguageID'];
|
||||
iPAdress = json['IPAdress'];
|
||||
generalid = json['generalid'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
sessionID = json['SessionID'];
|
||||
isDentalAllowedBackend = json['isDentalAllowedBackend'];
|
||||
deviceTypeID = json['DeviceTypeID'];
|
||||
dob = json['dob'];
|
||||
isHijri = json['isHijri'];
|
||||
healthId = json['HealthId'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['PatientMobileNumber'] = patientMobileNumber;
|
||||
data['ZipCode'] = zipCode;
|
||||
data['isRegister'] = isRegister;
|
||||
data['TokenID'] = tokenID;
|
||||
data['SearchType'] = searchType;
|
||||
data['PatientIdentificationID'] = patientIdentificationID;
|
||||
data['PatientID'] = patientID;
|
||||
data['VersionID'] = versionID;
|
||||
data['Channel'] = channel;
|
||||
data['LanguageID'] = languageID;
|
||||
data['IPAdress'] = iPAdress;
|
||||
data['generalid'] = generalid;
|
||||
data['PatientOutSA'] = patientOutSA;
|
||||
data['SessionID'] = sessionID;
|
||||
data['isDentalAllowedBackend'] = isDentalAllowedBackend;
|
||||
data['DeviceTypeID'] = deviceTypeID;
|
||||
data['dob'] = dob;
|
||||
data['isHijri'] = isHijri;
|
||||
data['HealthId'] = healthId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,132 @@
|
||||
class SendActivationRequest {
|
||||
int? patientMobileNumber;
|
||||
String? mobileNo;
|
||||
String? deviceToken;
|
||||
bool? projectOutSA;
|
||||
int? loginType;
|
||||
String? zipCode;
|
||||
bool? isRegister;
|
||||
String? logInTokenID;
|
||||
int? searchType;
|
||||
int? patientID;
|
||||
String? nationalID;
|
||||
String? patientIdentificationID;
|
||||
int? oTPSendType;
|
||||
int? languageID;
|
||||
double? versionID;
|
||||
int? channel;
|
||||
String? iPAdress;
|
||||
String? generalid;
|
||||
int? patientOutSA;
|
||||
dynamic sessionID;
|
||||
bool? isDentalAllowedBackend;
|
||||
int? deviceTypeID;
|
||||
String? sMSSignature;
|
||||
String? dob;
|
||||
int? isHijri;
|
||||
String? healthId;
|
||||
int? responseID;
|
||||
int? status;
|
||||
int? familyRegionID;
|
||||
bool? isPatientExcluded;
|
||||
SendActivationRequest(
|
||||
{this.patientMobileNumber,
|
||||
this.mobileNo,
|
||||
this.deviceToken,
|
||||
this.projectOutSA,
|
||||
this.loginType,
|
||||
this.zipCode,
|
||||
this.isRegister,
|
||||
this.logInTokenID,
|
||||
this.searchType,
|
||||
this.patientID,
|
||||
this.nationalID,
|
||||
this.patientIdentificationID,
|
||||
this.oTPSendType,
|
||||
this.languageID,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.iPAdress,
|
||||
this.generalid,
|
||||
this.patientOutSA,
|
||||
this.sessionID,
|
||||
this.isDentalAllowedBackend,
|
||||
this.deviceTypeID,
|
||||
this.sMSSignature,
|
||||
this.dob,
|
||||
this.isHijri,
|
||||
this.healthId,
|
||||
this.responseID,
|
||||
this.status,
|
||||
this.familyRegionID,
|
||||
this.isPatientExcluded
|
||||
});
|
||||
|
||||
SendActivationRequest.fromJson(Map<String, dynamic> json) {
|
||||
patientMobileNumber = json['PatientMobileNumber'];
|
||||
mobileNo = json['MobileNo'];
|
||||
deviceToken = json['DeviceToken'];
|
||||
projectOutSA = json['ProjectOutSA'];
|
||||
loginType = json['LoginType'];
|
||||
zipCode = json['ZipCode'];
|
||||
isRegister = json['isRegister'];
|
||||
logInTokenID = json['LogInTokenID'];
|
||||
searchType = json['SearchType'];
|
||||
patientID = json['PatientID'];
|
||||
nationalID = json['NationalID'];
|
||||
patientIdentificationID = json['PatientIdentificationID'];
|
||||
oTPSendType = json['OTP_SendType'];
|
||||
languageID = json['LanguageID'];
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
iPAdress = json['IPAdress'];
|
||||
generalid = json['generalid'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
sessionID = json['SessionID'];
|
||||
isDentalAllowedBackend = json['isDentalAllowedBackend'];
|
||||
deviceTypeID = json['DeviceTypeID'];
|
||||
sMSSignature = json['SMSSignature'];
|
||||
dob = json['DOB'];
|
||||
isHijri = json['IsHijri'];
|
||||
healthId = json['HealthId'];
|
||||
responseID = json['ReponseID'];
|
||||
status = json['Status'];
|
||||
familyRegionID = json['FamilyRegionID'];
|
||||
isPatientExcluded = json['IsPatientExcluded'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['PatientMobileNumber'] = patientMobileNumber;
|
||||
data['MobileNo'] = mobileNo;
|
||||
data['DeviceToken'] = deviceToken;
|
||||
data['ProjectOutSA'] = projectOutSA;
|
||||
data['LoginType'] = loginType;
|
||||
data['ZipCode'] = zipCode;
|
||||
data['isRegister'] = isRegister;
|
||||
data['LogInTokenID'] = logInTokenID;
|
||||
data['SearchType'] = searchType;
|
||||
data['PatientID'] = patientID;
|
||||
data['NationalID'] = nationalID;
|
||||
data['PatientIdentificationID'] = patientIdentificationID;
|
||||
data['OTP_SendType'] = oTPSendType;
|
||||
data['LanguageID'] = languageID;
|
||||
data['VersionID'] = versionID;
|
||||
data['Channel'] = channel;
|
||||
data['IPAdress'] = iPAdress;
|
||||
data['generalid'] = generalid;
|
||||
data['PatientOutSA'] = patientOutSA;
|
||||
data['SessionID'] = sessionID;
|
||||
data['isDentalAllowedBackend'] = isDentalAllowedBackend;
|
||||
data['DeviceTypeID'] = deviceTypeID;
|
||||
data['SMSSignature'] = sMSSignature;
|
||||
data['DOB'] = dob;
|
||||
data['IsHijri'] = isHijri;
|
||||
data['HealthId'] = healthId;
|
||||
data['ResponseID'] = responseID;
|
||||
data['Status'] = status;
|
||||
data['FamilyRegionID'] = familyRegionID;
|
||||
data['IsPatientExcluded'] = isPatientExcluded;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,546 @@
|
||||
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart';
|
||||
|
||||
class CheckActivationCode {
|
||||
dynamic date;
|
||||
int? languageID;
|
||||
int? serviceName;
|
||||
dynamic time;
|
||||
dynamic androidLink;
|
||||
String? authenticationTokenID;
|
||||
dynamic data;
|
||||
bool? dataw;
|
||||
int? dietType;
|
||||
dynamic errorCode;
|
||||
dynamic errorEndUserMessage;
|
||||
dynamic errorEndUserMessageN;
|
||||
dynamic errorMessage;
|
||||
int? errorType;
|
||||
int? foodCategory;
|
||||
dynamic iOSLink;
|
||||
bool? isAuthenticated;
|
||||
int? mealOrderStatus;
|
||||
int? mealType;
|
||||
int? messageStatus;
|
||||
int? numberOfResultRecords;
|
||||
dynamic patientBlodType;
|
||||
dynamic successMsg;
|
||||
dynamic successMsgN;
|
||||
dynamic doctorInformationList;
|
||||
dynamic getAllPendingRecordsList;
|
||||
dynamic getAllSharedRecordsByStatusList;
|
||||
dynamic getResponseFileList;
|
||||
bool? isHMGPatient;
|
||||
bool? isLoginSuccessfully;
|
||||
bool? isNeedUpdateIdintificationNo;
|
||||
bool? kioskSendSMS;
|
||||
AuthenticatedUser? list;
|
||||
dynamic listAskHabibMobileLoginInfo;
|
||||
dynamic listAskHabibPatientFile;
|
||||
dynamic listMergeFiles;
|
||||
dynamic listMobileLoginInfo;
|
||||
dynamic listPatientCount;
|
||||
dynamic logInTokenID;
|
||||
dynamic mohemmPrivilegeList;
|
||||
int? pateintID;
|
||||
String? patientBloodType;
|
||||
bool? patientHasFile;
|
||||
dynamic patientMergedIDs;
|
||||
bool? patientOutSA;
|
||||
int? patientShareRequestID;
|
||||
int? patientType;
|
||||
int? projectIDOut;
|
||||
dynamic returnMessage;
|
||||
bool? sMSLoginRequired;
|
||||
dynamic servicePrivilegeList;
|
||||
dynamic sharePatientName;
|
||||
dynamic verificationCode;
|
||||
dynamic email;
|
||||
dynamic errorList;
|
||||
bool? hasFile;
|
||||
bool? isActiveCode;
|
||||
bool? isMerged;
|
||||
bool? isNeedUserAgreement;
|
||||
bool? isSMSSent;
|
||||
dynamic memberList;
|
||||
dynamic message;
|
||||
int? statusCode;
|
||||
|
||||
CheckActivationCode(
|
||||
{this.date,
|
||||
this.languageID,
|
||||
this.serviceName,
|
||||
this.time,
|
||||
this.androidLink,
|
||||
this.authenticationTokenID,
|
||||
this.data,
|
||||
this.dataw,
|
||||
this.dietType,
|
||||
this.errorCode,
|
||||
this.errorEndUserMessage,
|
||||
this.errorEndUserMessageN,
|
||||
this.errorMessage,
|
||||
this.errorType,
|
||||
this.foodCategory,
|
||||
this.iOSLink,
|
||||
this.isAuthenticated,
|
||||
this.mealOrderStatus,
|
||||
this.mealType,
|
||||
this.messageStatus,
|
||||
this.numberOfResultRecords,
|
||||
this.patientBlodType,
|
||||
this.successMsg,
|
||||
this.successMsgN,
|
||||
this.doctorInformationList,
|
||||
this.getAllPendingRecordsList,
|
||||
this.getAllSharedRecordsByStatusList,
|
||||
this.getResponseFileList,
|
||||
this.isHMGPatient,
|
||||
this.isLoginSuccessfully,
|
||||
this.isNeedUpdateIdintificationNo,
|
||||
this.kioskSendSMS,
|
||||
this.list,
|
||||
this.listAskHabibMobileLoginInfo,
|
||||
this.listAskHabibPatientFile,
|
||||
this.listMergeFiles,
|
||||
this.listMobileLoginInfo,
|
||||
this.listPatientCount,
|
||||
this.logInTokenID,
|
||||
this.mohemmPrivilegeList,
|
||||
this.pateintID,
|
||||
this.patientBloodType,
|
||||
this.patientHasFile,
|
||||
this.patientMergedIDs,
|
||||
this.patientOutSA,
|
||||
this.patientShareRequestID,
|
||||
this.patientType,
|
||||
this.projectIDOut,
|
||||
this.returnMessage,
|
||||
this.sMSLoginRequired,
|
||||
this.servicePrivilegeList,
|
||||
this.sharePatientName,
|
||||
this.verificationCode,
|
||||
this.email,
|
||||
this.errorList,
|
||||
this.hasFile,
|
||||
this.isActiveCode,
|
||||
this.isMerged,
|
||||
this.isNeedUserAgreement,
|
||||
this.isSMSSent,
|
||||
this.memberList,
|
||||
this.message,
|
||||
this.statusCode});
|
||||
|
||||
CheckActivationCode.fromJson(Map<String, dynamic> json) {
|
||||
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() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['Date'] = date;
|
||||
data['LanguageID'] = languageID;
|
||||
data['ServiceName'] = serviceName;
|
||||
data['Time'] = time;
|
||||
data['AndroidLink'] = androidLink;
|
||||
data['AuthenticationTokenID'] = authenticationTokenID;
|
||||
data['Data'] = this.data;
|
||||
data['Dataw'] = dataw;
|
||||
data['DietType'] = dietType;
|
||||
data['ErrorCode'] = errorCode;
|
||||
data['ErrorEndUserMessage'] = errorEndUserMessage;
|
||||
data['ErrorEndUserMessageN'] = errorEndUserMessageN;
|
||||
data['ErrorMessage'] = errorMessage;
|
||||
data['ErrorType'] = errorType;
|
||||
data['FoodCategory'] = foodCategory;
|
||||
data['IOSLink'] = iOSLink;
|
||||
data['IsAuthenticated'] = isAuthenticated;
|
||||
data['MealOrderStatus'] = mealOrderStatus;
|
||||
data['MealType'] = mealType;
|
||||
data['MessageStatus'] = messageStatus;
|
||||
data['NumberOfResultRecords'] = numberOfResultRecords;
|
||||
data['PatientBlodType'] = patientBlodType;
|
||||
data['SuccessMsg'] = successMsg;
|
||||
data['SuccessMsgN'] = successMsgN;
|
||||
data['DoctorInformation_List'] = doctorInformationList;
|
||||
data['GetAllPendingRecordsList'] = getAllPendingRecordsList;
|
||||
data['GetAllSharedRecordsByStatusList'] = getAllSharedRecordsByStatusList;
|
||||
data['GetResponseFileList'] = getResponseFileList;
|
||||
data['IsHMGPatient'] = isHMGPatient;
|
||||
data['IsLoginSuccessfully'] = isLoginSuccessfully;
|
||||
data['IsNeedUpdateIdintificationNo'] = isNeedUpdateIdintificationNo;
|
||||
data['KioskSendSMS'] = kioskSendSMS;
|
||||
if (list != null) {
|
||||
data['List'] = list;
|
||||
}
|
||||
data['List_AskHabibMobileLoginInfo'] = listAskHabibMobileLoginInfo;
|
||||
data['List_AskHabibPatientFile'] = listAskHabibPatientFile;
|
||||
data['List_MergeFiles'] = listMergeFiles;
|
||||
data['List_MobileLoginInfo'] = listMobileLoginInfo;
|
||||
data['List_PatientCount'] = listPatientCount;
|
||||
data['LogInTokenID'] = logInTokenID;
|
||||
data['MohemmPrivilege_List'] = mohemmPrivilegeList;
|
||||
data['PateintID'] = pateintID;
|
||||
data['PatientBloodType'] = patientBloodType;
|
||||
data['PatientHasFile'] = patientHasFile;
|
||||
data['PatientMergedIDs'] = patientMergedIDs;
|
||||
data['PatientOutSA'] = patientOutSA;
|
||||
data['PatientShareRequestID'] = patientShareRequestID;
|
||||
data['PatientType'] = patientType;
|
||||
data['ProjectIDOut'] = projectIDOut;
|
||||
data['ReturnMessage'] = returnMessage;
|
||||
data['SMSLoginRequired'] = sMSLoginRequired;
|
||||
data['ServicePrivilege_List'] = servicePrivilegeList;
|
||||
data['SharePatientName'] = sharePatientName;
|
||||
data['VerificationCode'] = verificationCode;
|
||||
data['email'] = email;
|
||||
data['errorList'] = errorList;
|
||||
data['hasFile'] = hasFile;
|
||||
data['isActiveCode'] = isActiveCode;
|
||||
data['isMerged'] = isMerged;
|
||||
data['isNeedUserAgreement'] = isNeedUserAgreement;
|
||||
data['isSMSSent'] = isSMSSent;
|
||||
data['memberList'] = memberList;
|
||||
data['message'] = message;
|
||||
data['statusCode'] = statusCode;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class List {
|
||||
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;
|
||||
dynamic phoneResi;
|
||||
dynamic phoneOffice;
|
||||
String? mobileNumber;
|
||||
dynamic faxNumber;
|
||||
String? emailAddress;
|
||||
dynamic bloodGroup;
|
||||
dynamic rHFactor;
|
||||
bool? isEmailAlertRequired;
|
||||
bool? isSMSAlertRequired;
|
||||
String? preferredLanguage;
|
||||
bool? isPrivilegedMember;
|
||||
dynamic memberID;
|
||||
dynamic expiryDate;
|
||||
dynamic isHmgEmployee;
|
||||
dynamic employeeID;
|
||||
dynamic emergencyContactName;
|
||||
dynamic 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? createdBy;
|
||||
String? genderDescription;
|
||||
dynamic iR;
|
||||
dynamic iSOCityID;
|
||||
dynamic iSOCountryID;
|
||||
ListPrivilege? listPrivilege;
|
||||
dynamic marital;
|
||||
int? outSA;
|
||||
dynamic pOBox;
|
||||
bool? receiveHealthSummaryReport;
|
||||
int? sourceType;
|
||||
dynamic strDateofBirth;
|
||||
dynamic tempAddress;
|
||||
dynamic zipCode;
|
||||
|
||||
List({
|
||||
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.createdBy,
|
||||
this.genderDescription,
|
||||
this.iR,
|
||||
this.iSOCityID,
|
||||
this.iSOCountryID,
|
||||
this.listPrivilege,
|
||||
this.marital,
|
||||
this.outSA,
|
||||
this.pOBox,
|
||||
this.receiveHealthSummaryReport,
|
||||
this.sourceType,
|
||||
this.strDateofBirth,
|
||||
this.tempAddress,
|
||||
this.zipCode,
|
||||
});
|
||||
|
||||
List.fromJson(Map<String, dynamic> json) {
|
||||
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'];
|
||||
createdBy = json['CreatedBy'];
|
||||
genderDescription = json['GenderDescription'];
|
||||
iR = json['IR'];
|
||||
iSOCityID = json['ISOCityID'];
|
||||
iSOCountryID = json['ISOCountryID'];
|
||||
if (json['ListPrivilege'] != null) {
|
||||
listPrivilege = ListPrivilege.fromJson(json['ListPrivilege']);
|
||||
}
|
||||
marital = json['Marital'];
|
||||
outSA = json['OutSA'];
|
||||
pOBox = json['POBox'];
|
||||
receiveHealthSummaryReport = json['ReceiveHealthSummaryReport'];
|
||||
sourceType = json['SourceType'];
|
||||
strDateofBirth = json['StrDateofBirth'];
|
||||
tempAddress = json['TempAddress'];
|
||||
zipCode = json['ZipCode'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['SetupID'] = setupID;
|
||||
data['PatientType'] = patientType;
|
||||
data['PatientID'] = patientID;
|
||||
data['FirstName'] = firstName;
|
||||
data['MiddleName'] = middleName;
|
||||
data['LastName'] = lastName;
|
||||
data['FirstNameN'] = firstNameN;
|
||||
data['MiddleNameN'] = middleNameN;
|
||||
data['LastNameN'] = lastNameN;
|
||||
data['RelationshipID'] = relationshipID;
|
||||
data['Gender'] = gender;
|
||||
data['DateofBirth'] = dateofBirth;
|
||||
data['DateofBirthN'] = dateofBirthN;
|
||||
data['NationalityID'] = nationalityID;
|
||||
data['PhoneResi'] = phoneResi;
|
||||
data['PhoneOffice'] = phoneOffice;
|
||||
data['MobileNumber'] = mobileNumber;
|
||||
data['FaxNumber'] = faxNumber;
|
||||
data['EmailAddress'] = emailAddress;
|
||||
data['BloodGroup'] = bloodGroup;
|
||||
data['RHFactor'] = rHFactor;
|
||||
data['IsEmailAlertRequired'] = isEmailAlertRequired;
|
||||
data['IsSMSAlertRequired'] = isSMSAlertRequired;
|
||||
data['PreferredLanguage'] = preferredLanguage;
|
||||
data['IsPrivilegedMember'] = isPrivilegedMember;
|
||||
data['MemberID'] = memberID;
|
||||
data['ExpiryDate'] = expiryDate;
|
||||
data['IsHmgEmployee'] = isHmgEmployee;
|
||||
data['EmployeeID'] = employeeID;
|
||||
data['EmergencyContactName'] = emergencyContactName;
|
||||
data['EmergencyContactNo'] = emergencyContactNo;
|
||||
data['PatientPayType'] = patientPayType;
|
||||
data['DHCCPatientRefID'] = dHCCPatientRefID;
|
||||
data['IsPatientDummy'] = isPatientDummy;
|
||||
data['Status'] = status;
|
||||
data['IsStatusCleared'] = isStatusCleared;
|
||||
data['PatientIdentificationType'] = patientIdentificationType;
|
||||
data['PatientIdentificationNo'] = patientIdentificationNo;
|
||||
data['ProjectID'] = projectID;
|
||||
data['InfoSourceID'] = infoSourceID;
|
||||
data['Address'] = address;
|
||||
data['Age'] = age;
|
||||
data['AgeDesc'] = ageDesc;
|
||||
data['AreaID'] = areaID;
|
||||
data['CreatedBy'] = createdBy;
|
||||
data['GenderDescription'] = genderDescription;
|
||||
data['IR'] = iR;
|
||||
data['ISOCityID'] = iSOCityID;
|
||||
data['ISOCountryID'] = iSOCountryID;
|
||||
if (listPrivilege != null) {
|
||||
data['ListPrivilege'] = listPrivilege;
|
||||
}
|
||||
data['Marital'] = marital;
|
||||
data['OutSA'] = outSA;
|
||||
data['POBox'] = pOBox;
|
||||
data['ReceiveHealthSummaryReport'] = receiveHealthSummaryReport;
|
||||
data['SourceType'] = sourceType;
|
||||
data['StrDateofBirth'] = strDateofBirth;
|
||||
data['TempAddress'] = tempAddress;
|
||||
data['ZipCode'] = zipCode;
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ListPrivilege {
|
||||
int? iD;
|
||||
String? serviceName;
|
||||
bool? previlege;
|
||||
dynamic region;
|
||||
|
||||
ListPrivilege({this.iD, this.serviceName, this.previlege, this.region});
|
||||
|
||||
ListPrivilege.fromJson(Map<String, dynamic> json) {
|
||||
iD = json['ID'];
|
||||
serviceName = json['ServiceName'];
|
||||
previlege = json['Previlege'];
|
||||
region = json['Region'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['ID'] = iD;
|
||||
data['ServiceName'] = serviceName;
|
||||
data['Previlege'] = previlege;
|
||||
data['Region'] = region;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
import 'dart:convert';
|
||||
|
||||
Map<String, dynamic> selectDeviceByImeiRespModelFromJson(String str) => Map<String, dynamic>.from(json.decode(str));
|
||||
|
||||
String selectDeviceByImeiRespModelToJson(Map<String, dynamic> data) => json.encode(Map<String, dynamic>.from(data));
|
||||
|
||||
class SelectDeviceByImeiRespModelElement {
|
||||
int? id;
|
||||
String? imei;
|
||||
int? logInType;
|
||||
int? patientId;
|
||||
bool? outSa;
|
||||
String? mobile;
|
||||
String? identificationNo;
|
||||
String? name;
|
||||
String? nameN;
|
||||
String? createdOn;
|
||||
String? editedOn;
|
||||
bool? biometricEnabled;
|
||||
int? patientType;
|
||||
int? preferredLanguage;
|
||||
|
||||
SelectDeviceByImeiRespModelElement({
|
||||
this.id,
|
||||
this.imei,
|
||||
this.logInType,
|
||||
this.patientId,
|
||||
this.outSa,
|
||||
this.mobile,
|
||||
this.identificationNo,
|
||||
this.name,
|
||||
this.nameN,
|
||||
this.createdOn,
|
||||
this.editedOn,
|
||||
this.biometricEnabled,
|
||||
this.patientType,
|
||||
this.preferredLanguage,
|
||||
});
|
||||
|
||||
factory SelectDeviceByImeiRespModelElement.fromJson(Map<String, dynamic> json) => SelectDeviceByImeiRespModelElement(
|
||||
id: json["ID"] as int?,
|
||||
imei: json["IMEI"] as String?,
|
||||
logInType: json["LogInType"] as int?,
|
||||
patientId: json["PatientID"] as int?,
|
||||
outSa: json["OutSA"] as bool?,
|
||||
mobile: json["Mobile"] as String?,
|
||||
identificationNo: json["IdentificationNo"] as String?,
|
||||
name: json["Name"] as String?,
|
||||
nameN: json["NameN"] as String?,
|
||||
createdOn: json["CreatedOn"] as String?,
|
||||
editedOn: json["EditedOn"] as String?,
|
||||
biometricEnabled: json["BiometricEnabled"] as bool?,
|
||||
patientType: json["PatientType"] as int?,
|
||||
preferredLanguage: json["PreferredLanguage"] as int?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"ID": id,
|
||||
"IMEI": imei,
|
||||
"LogInType": logInType,
|
||||
"PatientID": patientId,
|
||||
"OutSA": outSa,
|
||||
"Mobile": mobile,
|
||||
"IdentificationNo": identificationNo,
|
||||
"Name": name,
|
||||
"NameN": nameN,
|
||||
"CreatedOn": createdOn,
|
||||
"EditedOn": editedOn,
|
||||
"BiometricEnabled": biometricEnabled,
|
||||
"PatientType": patientType,
|
||||
"PreferredLanguage": preferredLanguage,
|
||||
};
|
||||
}
|
||||
@ -1,77 +0,0 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final selectDeviceByImeiRespModel = selectDeviceByImeiRespModelFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
Map<String, dynamic> selectDeviceByImeiRespModelFromJson(String str) => Map.from(json.decode(str)).map((k, v) => MapEntry<String, dynamic>(k, v));
|
||||
|
||||
String selectDeviceByImeiRespModelToJson(Map<String, dynamic> data) => json.encode(Map.from(data).map((k, v) => MapEntry<String, dynamic>(k, v)));
|
||||
|
||||
class SelectDeviceByImeiRespModelElement {
|
||||
int id;
|
||||
String imei;
|
||||
int logInType;
|
||||
int patientId;
|
||||
bool outSa;
|
||||
String mobile;
|
||||
String identificationNo;
|
||||
String name;
|
||||
String nameN;
|
||||
String createdOn;
|
||||
String editedOn;
|
||||
bool biometricEnabled;
|
||||
int patientType;
|
||||
int preferredLanguage;
|
||||
|
||||
SelectDeviceByImeiRespModelElement({
|
||||
required this.id,
|
||||
required this.imei,
|
||||
required this.logInType,
|
||||
required this.patientId,
|
||||
required this.outSa,
|
||||
required this.mobile,
|
||||
required this.identificationNo,
|
||||
required this.name,
|
||||
required this.nameN,
|
||||
required this.createdOn,
|
||||
required this.editedOn,
|
||||
required this.biometricEnabled,
|
||||
required this.patientType,
|
||||
required this.preferredLanguage,
|
||||
});
|
||||
|
||||
factory SelectDeviceByImeiRespModelElement.fromJson(Map<String, dynamic> json) => SelectDeviceByImeiRespModelElement(
|
||||
id: json["ID"],
|
||||
imei: json["IMEI"],
|
||||
logInType: json["LogInType"],
|
||||
patientId: json["PatientID"],
|
||||
outSa: json["OutSA"],
|
||||
mobile: json["Mobile"],
|
||||
identificationNo: json["IdentificationNo"],
|
||||
name: json["Name"],
|
||||
nameN: json["NameN"],
|
||||
createdOn: json["CreatedOn"],
|
||||
editedOn: json["EditedOn"],
|
||||
biometricEnabled: json["BiometricEnabled"],
|
||||
patientType: json["PatientType"],
|
||||
preferredLanguage: json["PreferredLanguage"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"ID": id,
|
||||
"IMEI": imei,
|
||||
"LogInType": logInType,
|
||||
"PatientID": patientId,
|
||||
"OutSA": outSa,
|
||||
"Mobile": mobile,
|
||||
"IdentificationNo": identificationNo,
|
||||
"Name": name,
|
||||
"NameN": nameN,
|
||||
"CreatedOn": createdOn,
|
||||
"EditedOn": editedOn,
|
||||
"BiometricEnabled": biometricEnabled,
|
||||
"PatientType": patientType,
|
||||
"PreferredLanguage": preferredLanguage,
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,127 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_assets.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/extensions/string_extensions.dart';
|
||||
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/widgets/buttons/custom_button.dart';
|
||||
|
||||
class HabibWalletCard extends StatelessWidget {
|
||||
const HabibWalletCard({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
"My Balance".toText16(isBold: true),
|
||||
Row(
|
||||
children: [
|
||||
"View all services".toText12(color: AppColors.primaryRedColor),
|
||||
SizedBox(width: 2.h),
|
||||
Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
Container(
|
||||
// height: 150.h,
|
||||
width: double.infinity,
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.whiteColor,
|
||||
borderRadius: 24,
|
||||
),
|
||||
child: Stack(children: [
|
||||
Positioned(
|
||||
right: 0,
|
||||
child: ClipRRect(borderRadius: BorderRadius.circular(24.0), child: Utils.buildSvgWithAssets(icon: AppAssets.habib_background_icon, width: 150.h, height: 150.h)),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(14.h),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
"Habib Wallet".toText15(isBold: true),
|
||||
Container(
|
||||
height: 40.h,
|
||||
width: 40.h,
|
||||
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
||||
color: AppColors.textColor,
|
||||
borderRadius: 8.h,
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(8.h),
|
||||
child: Utils.buildSvgWithAssets(
|
||||
icon: AppAssets.show_icon,
|
||||
width: 12.h,
|
||||
height: 12.h,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 4.h),
|
||||
Row(
|
||||
children: [
|
||||
Utils.buildSvgWithAssets(
|
||||
icon: AppAssets.saudi_riyal_icon,
|
||||
iconColor: AppColors.dividerColor,
|
||||
width: 24.h,
|
||||
height: 24.h,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
SizedBox(width: 8.h),
|
||||
"200.18".toText32(isBold: true),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 50.h),
|
||||
child: Row(
|
||||
children: [
|
||||
"View details".toText12(color: AppColors.primaryRedColor),
|
||||
SizedBox(width: 2.h),
|
||||
Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 150.h,
|
||||
child: Utils.getPaymentMethods(),
|
||||
),
|
||||
CustomButton(
|
||||
icon: AppAssets.recharge_icon,
|
||||
iconSize: 18.h,
|
||||
text: "Recharge",
|
||||
onPressed: () {},
|
||||
backgroundColor: AppColors.infoColor,
|
||||
borderColor: AppColors.infoColor,
|
||||
textColor: AppColors.whiteColor,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
borderRadius: 12,
|
||||
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
height: 35.h,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/route_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/services/navigation_service.dart';
|
||||
|
||||
abstract class DialogService {
|
||||
Future<void> showErrorDialog({required String message, Function()? onOkPressed});
|
||||
}
|
||||
|
||||
class DialogServiceImp implements DialogService {
|
||||
final NavigationService navigationService;
|
||||
|
||||
DialogServiceImp({required this.navigationService});
|
||||
|
||||
@override
|
||||
Future<void> showErrorDialog({required String message, Function()? onOkPressed}) async {
|
||||
final context = navigationService.navigatorKey.currentContext;
|
||||
if (context == null) return;
|
||||
|
||||
await showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: false,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||
),
|
||||
builder: (_) => _ErrorBottomSheet(message: message, onOkPressed: onOkPressed),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ErrorBottomSheet extends StatelessWidget {
|
||||
final String message;
|
||||
final Function()? onOkPressed;
|
||||
|
||||
const _ErrorBottomSheet({required this.message, this.onOkPressed});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.error_outline, color: Colors.red, size: 40),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
"Error",
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
message,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
if (onOkPressed != null) {
|
||||
onOkPressed!();
|
||||
} else {
|
||||
context.pop();
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: const Text("OK"),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:hmg_patient_app_new/core/exceptions/api_exception.dart';
|
||||
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
|
||||
import 'package:hmg_patient_app_new/services/dialog_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/logger_service.dart';
|
||||
import 'package:hmg_patient_app_new/services/navigation_service.dart';
|
||||
|
||||
abstract class ErrorHandlerService {
|
||||
Future<void> handleError({required Failure failure, Function() onOkPressed});
|
||||
}
|
||||
|
||||
class ErrorHandlerServiceImp implements ErrorHandlerService {
|
||||
final DialogService dialogService;
|
||||
final LoggerService loggerService;
|
||||
final NavigationService navigationService;
|
||||
|
||||
ErrorHandlerServiceImp({
|
||||
required this.dialogService,
|
||||
required this.loggerService,
|
||||
required this.navigationService,
|
||||
});
|
||||
|
||||
@override
|
||||
Future<void> handleError({required Failure failure, Function()? onOkPressed}) async {
|
||||
if (failure is APIException) {
|
||||
loggerService.errorLogs("API Exception: ${failure.message}");
|
||||
} else if (failure is ServerFailure) {
|
||||
loggerService.errorLogs("Server Failure: ${failure.message}");
|
||||
await _showDialog(failure);
|
||||
} else if (failure is DataParsingFailure) {
|
||||
loggerService.errorLogs("Data Parsing Failure: ${failure.message}");
|
||||
await _showDialog(failure, title: "Data Error");
|
||||
} else if (failure is StatusCodeFailure) {
|
||||
loggerService.errorLogs("StatusCode Failure: ${failure.message}");
|
||||
await _showDialog(failure, title: "Status Code Failure Error");
|
||||
} else if (failure is HttpException) {
|
||||
loggerService.errorLogs("Http Exception: ${failure.message}");
|
||||
await _showDialog(failure, title: "Network Error");
|
||||
} else if (failure is UnknownFailure) {
|
||||
loggerService.errorLogs("Unknown Failure: ${failure.message}");
|
||||
await _showDialog(failure, title: "Unknown Error");
|
||||
} else if (failure is InvalidCredentials) {
|
||||
loggerService.errorLogs("Invalid Credentials : ${failure.message}");
|
||||
await _showDialog(failure, title: "Unknown Error");
|
||||
} else {
|
||||
loggerService.errorLogs("Unhandled failure type: $failure");
|
||||
await _showDialog(failure, title: "Error");
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showDialog(Failure failure, {String title = "Error", Function()? onOkPressed}) async {
|
||||
await dialogService.showErrorDialog(message: failure.message, onOkPressed: onOkPressed);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NavigationService {
|
||||
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
||||
|
||||
BuildContext? get context => navigatorKey.currentContext;
|
||||
|
||||
Future<T?> push<T>(Route<T> route) {
|
||||
return navigatorKey.currentState!.push(route);
|
||||
}
|
||||
|
||||
void pop<T extends Object?>([T? result]) {
|
||||
navigatorKey.currentState!.pop(result);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue