family screen & widgets

pull/76/head
aamir-csol 3 weeks ago
parent e5488299b8
commit d918b6e464

@ -0,0 +1,3 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.9375 9C0.9375 13.4528 4.54725 17.0625 9 17.0625C13.4528 17.0625 17.0625 13.4528 17.0625 9C17.0625 4.54725 13.4528 0.9375 9 0.9375C4.54725 0.9375 0.9375 4.54725 0.9375 9ZM12.507 6.19724C12.8123 6.47699 12.8325 6.95173 12.5528 7.25698L8.42776 11.757C8.28976 11.9077 8.0955 11.9955 7.8915 12C7.68675 12.0045 7.4895 11.925 7.34475 11.7803L5.46975 9.90527C5.1765 9.61277 5.1765 9.13723 5.46975 8.84473C5.76225 8.55148 6.23776 8.55148 6.53026 8.84473L7.85175 10.1655L11.4472 6.24302C11.727 5.93777 12.2018 5.91749 12.507 6.19724Z" fill="#8F9AA3"/>
</svg>

After

Width:  |  Height:  |  Size: 697 B

@ -0,0 +1,3 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.04288 1.3125C10.6859 1.31249 11.9764 1.31248 12.984 1.44795C14.0165 1.58676 14.8357 1.87704 15.4793 2.52069C16.123 3.16433 16.4132 3.98352 16.5521 5.01602C16.6875 6.02358 16.6875 7.31408 16.6875 8.9571V9.04288C16.6875 10.6859 16.6875 11.9764 16.5521 12.984C16.4132 14.0165 16.123 14.8357 15.4793 15.4793C14.8357 16.123 14.0165 16.4132 12.984 16.5521C11.9764 16.6875 10.6859 16.6875 9.0429 16.6875H8.95712C7.3141 16.6875 6.02358 16.6875 5.01602 16.5521C3.98352 16.4132 3.16433 16.123 2.52068 15.4793C1.87704 14.8357 1.58676 14.0165 1.44795 12.984C1.31248 11.9764 1.31249 10.6859 1.3125 9.04288V8.95712C1.31249 7.31409 1.31248 6.02358 1.44795 5.01602C1.58676 3.98352 1.87704 3.16433 2.52068 2.52069C3.16433 1.87704 3.98352 1.58676 5.01602 1.44795C6.02358 1.31248 7.31409 1.31249 8.95712 1.3125H9.04288ZM8.25 12.375C8.25 11.9608 8.58428 11.625 8.99665 11.625H9.00335C9.41571 11.625 9.75 11.9608 9.75 12.375C9.75 12.7892 9.41571 13.125 9.00335 13.125H8.99665C8.58428 13.125 8.25 12.7892 8.25 12.375ZM8.25009 9.375C8.25009 9.78921 8.58588 10.125 9.00009 10.125C9.4143 10.125 9.75009 9.78921 9.75009 9.375V6.375C9.75009 5.96079 9.4143 5.625 9.00009 5.625C8.58588 5.625 8.25009 5.96079 8.25009 6.375V9.375Z" fill="#ED1C2B"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1,3 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.41841 13.0471C6.53944 12.9557 6.90075 12.6828 7.10903 12.5202C7.52619 12.1947 8.08051 11.7498 8.63318 11.27C9.18864 10.7877 9.72961 10.2811 10.1273 9.83098C10.3267 9.6053 10.4782 9.40705 10.5769 9.24345C10.6696 9.08959 10.6889 8.9987 10.6889 8.9987C10.6889 8.9987 10.6696 8.91048 10.5769 8.75662C10.4782 8.59303 10.3267 8.39477 10.1273 8.16909C9.72961 7.71901 9.18864 7.21237 8.63317 6.73009C8.08049 6.25024 7.52617 5.80541 7.10901 5.47985C6.90072 5.31731 6.53992 5.04475 6.41889 4.95334C6.16875 4.76911 6.1148 4.41661 6.29902 4.16647C6.48325 3.91633 6.83537 3.86289 7.08551 4.04711L7.08742 4.04855C7.21436 4.14443 7.58862 4.42711 7.80114 4.59296C8.22772 4.92586 8.7984 5.38369 9.37073 5.8806C9.94026 6.37509 10.5243 6.91935 10.9704 7.42418C11.1928 7.67596 11.3929 7.93118 11.5403 8.1758C11.6785 8.40499 11.8144 8.69516 11.8144 9.00004C11.8144 9.30492 11.6785 9.59509 11.5403 9.82427C11.3929 10.0689 11.1928 10.3241 10.9704 10.5759C10.5243 11.0807 9.94027 11.625 9.37074 12.1195C8.79842 12.6164 8.22775 13.0742 7.80117 13.4071C7.5885 13.5731 7.21423 13.8558 7.08755 13.9515L7.08591 13.9527C6.83577 14.1369 6.48329 14.0837 6.29906 13.8336C6.11484 13.5835 6.16829 13.2313 6.41841 13.0471Z" fill="#161616"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1,3 @@
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11 0.25C5.06294 0.25 0.25 5.06294 0.25 11C0.25 16.9371 5.06294 21.75 11 21.75C16.9371 21.75 21.75 16.9371 21.75 11C21.75 5.06294 16.9371 0.25 11 0.25ZM7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12H15C15.5523 12 16 11.5523 16 11C16 10.4477 15.5523 10 15 10H7Z" fill="#ED1C2B"/>
</svg>

After

Width:  |  Height:  |  Size: 441 B

@ -18,25 +18,25 @@ abstract class ApiClient {
static final NavigationService _navigationService = getIt.get<NavigationService>(); static final NavigationService _navigationService = getIt.get<NavigationService>();
Future<void> post( Future<void> post(
String endPoint, { String endPoint, {
required Map<String, dynamic> body, required Map<String, dynamic> body,
required Function(dynamic response, int statusCode, {int? messageStatus, String? errorMessage}) onSuccess, required Function(dynamic response, int statusCode, {int? messageStatus, String? errorMessage}) onSuccess,
required Function(String error, int statusCode, {int? messageStatus, Failure? failureType}) onFailure, required Function(String error, int statusCode, {int? messageStatus, Failure? failureType}) onFailure,
bool isAllowAny, bool isAllowAny,
bool isExternal, bool isExternal,
bool isRCService, bool isRCService,
bool isPaymentServices, bool isPaymentServices,
bool bypassConnectionCheck, bool bypassConnectionCheck,
}); });
Future<void> get( Future<void> get(
String endPoint, { String endPoint, {
required Function(dynamic response, int statusCode) onSuccess, required Function(dynamic response, int statusCode) onSuccess,
required Function(String error, int statusCode) onFailure, required Function(String error, int statusCode) onFailure,
Map<String, dynamic>? queryParams, Map<String, dynamic>? queryParams,
bool isExternal, bool isExternal,
bool isRCService, bool isRCService,
}); });
String getSessionId(String id); String getSessionId(String id);
@ -87,16 +87,16 @@ class ApiClientImp implements ApiClient {
@override @override
post( post(
String endPoint, { String endPoint, {
required Map<String, dynamic> body, required Map<String, dynamic> body,
required Function(dynamic response, int statusCode, {int? messageStatus, String? errorMessage}) onSuccess, required Function(dynamic response, int statusCode, {int? messageStatus, String? errorMessage}) onSuccess,
required Function(String error, int statusCode, {int? messageStatus, Failure? failureType}) onFailure, required Function(String error, int statusCode, {int? messageStatus, Failure? failureType}) onFailure,
bool isAllowAny = false, bool isAllowAny = false,
bool isExternal = false, bool isExternal = false,
bool isRCService = false, bool isRCService = false,
bool isPaymentServices = false, bool isPaymentServices = false,
bool bypassConnectionCheck = false, bool bypassConnectionCheck = false,
}) async { }) async {
String url; String url;
if (isExternal) { if (isExternal) {
url = endPoint; url = endPoint;
@ -322,10 +322,10 @@ class ApiClientImp implements ApiClient {
@override @override
get(String endPoint, get(String endPoint,
{required Function(dynamic response, int statusCode) onSuccess, {required Function(dynamic response, int statusCode) onSuccess,
required Function(String error, int statusCode) onFailure, required Function(String error, int statusCode) onFailure,
Map<String, dynamic>? queryParams, Map<String, dynamic>? queryParams,
bool isExternal = false, bool isExternal = false,
bool isRCService = false}) async { bool isRCService = false}) async {
String url; String url;
if (isExternal) { if (isExternal) {
url = endPoint; url = endPoint;

@ -727,7 +727,7 @@ const FAMILY_FILES= 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatu
class ApiConsts { class ApiConsts {
static const maxSmallScreen = 660; static const maxSmallScreen = 660;
static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat; static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT
@ -812,6 +812,8 @@ class ApiConsts {
static final String checkActivationCodeForFamily = 'Services/Authentication.svc/REST/CheckActivationCodeForFamilyFile'; static final String checkActivationCodeForFamily = 'Services/Authentication.svc/REST/CheckActivationCodeForFamilyFile';
static final String getAllPendingRecordsByResponseId = 'Services/Authentication.svc/REST/GetAllPendingRecordsByResponseId'; static final String getAllPendingRecordsByResponseId = 'Services/Authentication.svc/REST/GetAllPendingRecordsByResponseId';
static final String getAllSharedRecordsByStatus = 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatus'; static final String getAllSharedRecordsByStatus = 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatus';
static final String removeFileFromFamilyMembers = 'Services/Authentication.svc/REST/ActiveDeactive_PatientFile';
static final String acceptAndRejectFamilyFile = 'Services/Authentication.svc/REST/Update_FileStatus';
// static values for Api // static values for Api

@ -146,6 +146,8 @@ class AppAssets {
static const String ic_low_result = '$svgBasePath/low_result.svg'; static const String ic_low_result = '$svgBasePath/low_result.svg';
static const String ic_critical_low_result = '$svgBasePath/critical_low_result.svg'; static const String ic_critical_low_result = '$svgBasePath/critical_low_result.svg';
static const String switch_user = '$svgBasePath/switch_user.svg'; static const String switch_user = '$svgBasePath/switch_user.svg';
static const String activeCheck = '$svgBasePath/active-check.svg';
static const String deleteIcon = '$svgBasePath/delete_icon.svg';
//bottom navigation// //bottom navigation//
static const String homeBottom = '$svgBasePath/home_bottom.svg'; static const String homeBottom = '$svgBasePath/home_bottom.svg';
@ -157,6 +159,8 @@ class AppAssets {
static const String feedback = '$svgBasePath/feedback.svg'; static const String feedback = '$svgBasePath/feedback.svg';
static const String news = '$svgBasePath/news.svg'; static const String news = '$svgBasePath/news.svg';
static const String heart = '$svgBasePath/heart.svg'; static const String heart = '$svgBasePath/heart.svg';
static const String alertSquare = '$svgBasePath/alert-square.svg';
static const String arrowRight = '$svgBasePath/arrow-right.svg';
// PNGS // // PNGS //
static const String hmg_logo = '$pngBasePath/hmg_logo.png'; static const String hmg_logo = '$pngBasePath/hmg_logo.png';

@ -38,15 +38,15 @@ class AppState {
AuthenticatedUser? _authenticatedChildUser; AuthenticatedUser? _authenticatedChildUser;
int? _superUserID; int? _superUserID;
bool isChildLoggedIn = false;
void setAuthenticatedUser(AuthenticatedUser authenticatedUser, {bool isFamily = false}) { void setAuthenticatedUser(AuthenticatedUser? authenticatedUser, {bool isFamily = false}) {
if (isFamily) { if (isFamily) {
_authenticatedChildUser = authenticatedUser; _authenticatedChildUser = authenticatedUser;
} else { } else {
setIsAuthenticated = true; setIsAuthenticated = true;
_authenticatedRootUser = authenticatedUser; _authenticatedRootUser = authenticatedUser;
} }
} }
AuthenticatedUser? getAuthenticatedUser({bool isFamily = false}) { AuthenticatedUser? getAuthenticatedUser({bool isFamily = false}) {
@ -59,8 +59,12 @@ class AppState {
int? get getSuperUserID => _superUserID; int? get getSuperUserID => _superUserID;
bool get getIsChildLoggedIn => isChildLoggedIn;
set setSuperUserID(int? value) => _superUserID = value; set setSuperUserID(int? value) => _superUserID = value;
set setIsChildLoggedIn(bool value) => isChildLoggedIn = value;
String _userBloodGroup = ""; String _userBloodGroup = "";
String get getUserBloodGroup => _userBloodGroup; String get getUserBloodGroup => _userBloodGroup;
@ -103,8 +107,6 @@ class AppState {
set setDeviceTypeID(v) => deviceTypeID = v; set setDeviceTypeID(v) => deviceTypeID = v;
String _familyFileTokenID = ""; String _familyFileTokenID = "";
String get getFamilyFileTokenID => _familyFileTokenID; String get getFamilyFileTokenID => _familyFileTokenID;
@ -151,9 +153,8 @@ class AppState {
} }
///this will be called if there is any problem in getting the user location ///this will be called if there is any problem in getting the user location
void resetLocation(){ void resetLocation() {
userLong = 0.0; userLong = 0.0;
userLong = 0.0; userLong = 0.0;
} }
} }

@ -97,11 +97,7 @@ class AppDependencies {
// Global/shared VMs LazySingleton // Global/shared VMs LazySingleton
getIt.registerLazySingleton<LabViewModel>( getIt.registerLazySingleton<LabViewModel>(
() => LabViewModel( () => LabViewModel(labRepo: getIt(), errorHandlerService: getIt(), navigationService: getIt()),
labRepo: getIt(),
errorHandlerService: getIt(),
navigationService: getIt()
),
); );
getIt.registerLazySingleton<RadiologyViewModel>( getIt.registerLazySingleton<RadiologyViewModel>(

@ -30,7 +30,7 @@ enum LoginTypeEnum { sms, whatsapp, face, fingerprint }
enum AppEnvironmentTypeEnum { dev, uat, preProd, qa, staging, prod } enum AppEnvironmentTypeEnum { dev, uat, preProd, qa, staging, prod }
enum FamilyFileEnum { active, inactive, blocked, deleted, pending } enum FamilyFileEnum { active, inactive, blocked, deleted, pending, rejected }
extension CalenderExtension on CalenderEnum { extension CalenderExtension on CalenderEnum {
int get toInt { int get toInt {
@ -152,6 +152,8 @@ extension FamilyFileEnumExtenshion on FamilyFileEnum {
case FamilyFileEnum.pending: case FamilyFileEnum.pending:
return 2; return 2;
case FamilyFileEnum.inactive: case FamilyFileEnum.inactive:
return 6;
case FamilyFileEnum.rejected:
return 4; return 4;
} }
} }
@ -170,6 +172,8 @@ extension FamilyFileEnumExtenshion on FamilyFileEnum {
return isArabic ? 'محذوف' : 'Deleted'; return isArabic ? 'محذوف' : 'Deleted';
case FamilyFileEnum.pending: case FamilyFileEnum.pending:
return isArabic ? 'قيد الانتظار' : 'Pending'; return isArabic ? 'قيد الانتظار' : 'Pending';
case FamilyFileEnum.rejected:
return isArabic ? 'مرفوض' : 'Rejected';
} }
} }

@ -262,7 +262,7 @@ class RequestUtils {
static Future<FamilyFileRequest> getAddFamilyRequest({required String nationalIDorFile, required String mobileNo, required String countryCode}) async { static Future<FamilyFileRequest> getAddFamilyRequest({required String nationalIDorFile, required String mobileNo, required String countryCode}) async {
FamilyFileRequest request = FamilyFileRequest(); FamilyFileRequest request = FamilyFileRequest();
int? loginType = 0; // Default to National ID int? loginType = 0;
if (countryCode == CountryEnum.saudiArabia.countryCode || countryCode == '+966') { if (countryCode == CountryEnum.saudiArabia.countryCode || countryCode == '+966') {
loginType = (nationalIDorFile.length == 10) ? 1 : 2; loginType = (nationalIDorFile.length == 10) ? 1 : 2;

@ -627,8 +627,17 @@ class Utils {
double width = 24, double width = 24,
double height = 24, double height = 24,
BoxFit fit = BoxFit.cover, BoxFit fit = BoxFit.cover,
double? border,
double? borderRadius,
}) { }) {
return Image.asset(icon, width: width, height: height, fit: fit); return Container(
decoration: BoxDecoration(
border: border != null ? Border.all(color: AppColors.whiteColor, width: border) : null,
borderRadius: border != null ? BorderRadius.circular(borderRadius ?? 0) : null,
),
child: Image.asset(icon, width: width, height: height, fit: fit),
);
// return Image.asset(icon, width: width, height: height, fit: fit, );
} }
/// Widget to build an SVG from network /// Widget to build an SVG from network

@ -206,38 +206,93 @@ class AuthenticationRepoImp implements AuthenticationRepo {
int? patientID, int? patientID,
int? loginType}) async { int? loginType}) async {
AppState appState = getIt.get<AppState>(); AppState appState = getIt.get<AppState>();
// if (isRegister) {
// newRequest["activationCode"] = activationCode ?? "0000";
// newRequest["isSilentLogin"] = activationCode != null ? false : true;
// } else {
// newRequest.activationCode = activationCode ?? "0000";
// newRequest.isSilentLogin = activationCode != null ? false : true;
// newRequest.projectOutSA = newRequest.zipCode == '966' ? false : true;
// newRequest.isDentalAllowedBackend = false;
// newRequest.forRegisteration = newRequest.isRegister ?? false;
// newRequest.isRegister = false;
// }
// Map<String, dynamic> familyRequest = {};
// if (isFormFamilyFile) {
// AppState appState = getIt.get<AppState>();
// familyRequest = {};
// familyRequest['PatientShareRequestID'] = patientShareRequestID;
// familyRequest['ResponseID'] = responseID;
// familyRequest['Status'] = 3;
// familyRequest["PatientID"] = appState.getAuthenticatedUser()!.patientId ?? 0;
// familyRequest["LogInTokenID"] = appState.getFamilyFileTokenID;
// familyRequest["activationCode"] = activationCode ?? "0000";
// familyRequest["PatientMobileNumber"] = newRequest.patientMobileNumber;
// familyRequest["PatientIdentificationID"] = newRequest.patientIdentificationID;
// }
// Map<String, dynamic> switchRequest = {};
// if (isSwitchUser) {
// switchRequest = newRequest.toJson();
//
// switchRequest['PatientID'] = responseID;
// switchRequest['IsSilentLogin'] = true;
// switchRequest['LogInTokenID'] = null;
// switchRequest['SearchType'] = 2;
// if (loginType != 0) {
// switchRequest['SuperUser'] = patientID;
// switchRequest['DeviceToken'] = null;
// } else {
// switchRequest["LoginType"] = 2;
// }
//
// if (appState.getSuperUserID == responseID) {
// // switchRequest['LoginType'] = 3;
// switchRequest['PatientIdentificationID'] = "";
// // switchRequest['ProjectOutSA'] = newRequest.zipCode == '966' ? false : true;
// switchRequest.remove('NationalID');
// switchRequest.remove('isDentalAllowedBackend');
// switchRequest.remove('ProjectOutSA');
// switchRequest.remove('ForRegisteration');
// appState.setSuperUserID = null;
// }
// }
if (isRegister) { if (isRegister) {
newRequest["activationCode"] = activationCode ?? "0000"; newRequest["activationCode"] = activationCode ?? "0000";
newRequest["isSilentLogin"] = activationCode != null ? false : true; newRequest["isSilentLogin"] = activationCode == null;
} else { } else {
newRequest.activationCode = activationCode ?? "0000"; newRequest.activationCode = activationCode ?? "0000";
newRequest.isSilentLogin = activationCode != null ? false : true; newRequest.isSilentLogin = activationCode == null;
newRequest.projectOutSA = newRequest.zipCode == '966' ? false : true; newRequest.projectOutSA = newRequest.zipCode != '966';
newRequest.isDentalAllowedBackend = false; newRequest.isDentalAllowedBackend = false;
newRequest.forRegisteration = newRequest.isRegister ?? false; newRequest.forRegisteration = newRequest.isRegister ?? false;
newRequest.isRegister = false; newRequest.isRegister = false;
} }
Map<String, dynamic> familyRequest = {}; Map<String, dynamic> familyRequest = {};
if (isFormFamilyFile) { if (isFormFamilyFile) {
AppState appState = getIt.get<AppState>(); familyRequest = {
familyRequest = {}; 'PatientShareRequestID': patientShareRequestID,
familyRequest['PatientShareRequestID'] = patientShareRequestID; 'ResponseID': responseID,
familyRequest['ResponseID'] = responseID; 'Status': 3,
familyRequest['Status'] = 3; 'PatientID': appState.getAuthenticatedUser()?.patientId ?? 0,
familyRequest["PatientID"] = appState.getAuthenticatedUser()!.patientId ?? 0; 'LogInTokenID': appState.getFamilyFileTokenID,
familyRequest["LogInTokenID"] = appState.getFamilyFileTokenID; 'activationCode': activationCode ?? "0000",
familyRequest["activationCode"] = activationCode ?? "0000"; 'PatientMobileNumber': newRequest.patientMobileNumber,
familyRequest["PatientMobileNumber"] = newRequest.patientMobileNumber; 'PatientIdentificationID': newRequest.patientIdentificationID,
familyRequest["PatientIdentificationID"] = newRequest.patientIdentificationID; };
} }
Map<String, dynamic> switchRequest = {}; Map<String, dynamic> switchRequest = {};
if (isSwitchUser) { if (isSwitchUser) {
switchRequest = newRequest.toJson(); switchRequest = newRequest.toJson();
switchRequest.addAll({
'PatientID': responseID,
'IsSilentLogin': true,
'LogInTokenID': null,
'SearchType': 2,
});
switchRequest['PatientID'] = responseID;
switchRequest['IsSilentLogin'] = true;
switchRequest['LogInTokenID'] = null;
switchRequest['SearchType'] = 2;
if (loginType != 0) { if (loginType != 0) {
switchRequest['SuperUser'] = patientID; switchRequest['SuperUser'] = patientID;
switchRequest['DeviceToken'] = null; switchRequest['DeviceToken'] = null;
@ -246,13 +301,8 @@ class AuthenticationRepoImp implements AuthenticationRepo {
} }
if (appState.getSuperUserID == responseID) { if (appState.getSuperUserID == responseID) {
switchRequest['LoginType'] = 3;
switchRequest['PatientIdentificationID'] = ""; switchRequest['PatientIdentificationID'] = "";
// switchRequest['ProjectOutSA'] = newRequest.zipCode == '966' ? false : true; switchRequest.removeWhere((key, value) => ['NationalID', 'isDentalAllowedBackend', 'ProjectOutSA', 'ForRegisteration'].contains(key));
switchRequest.remove('NationalID');
switchRequest.remove('isDentalAllowedBackend');
switchRequest.remove('ProjectOutSA');
switchRequest.remove('ForRegisteration');
} }
} }
@ -303,7 +353,6 @@ class AuthenticationRepoImp implements AuthenticationRepo {
@override @override
Future<Either<Failure, GenericApiModel<dynamic>>> checkIfUserAgreed({required dynamic commonAuthanticatedRequest}) async { Future<Either<Failure, GenericApiModel<dynamic>>> checkIfUserAgreed({required dynamic commonAuthanticatedRequest}) async {
commonAuthanticatedRequest['Region'] = 1; commonAuthanticatedRequest['Region'] = 1;
print("dsfsdd");
try { try {
GenericApiModel<dynamic>? apiResponse; GenericApiModel<dynamic>? apiResponse;
Failure? failure; Failure? failure;
@ -338,7 +387,6 @@ class AuthenticationRepoImp implements AuthenticationRepo {
@override @override
Future<Either<Failure, GenericApiModel<dynamic>>> getUserAgreementContent({required dynamic commonAuthanticatedRequest}) async { Future<Either<Failure, GenericApiModel<dynamic>>> getUserAgreementContent({required dynamic commonAuthanticatedRequest}) async {
commonAuthanticatedRequest['Region'] = 1; commonAuthanticatedRequest['Region'] = 1;
print("dsfsdd");
try { try {
GenericApiModel<dynamic>? apiResponse; GenericApiModel<dynamic>? apiResponse;
Failure? failure; Failure? failure;

@ -366,7 +366,7 @@ class AuthenticationViewModel extends ChangeNotifier {
isForRegister: isForRegister, isForRegister: isForRegister,
patientOutSA: isForRegister patientOutSA: isForRegister
? isPatientOutsideSA(request: payload) ? isPatientOutsideSA(request: payload)
: selectedCountrySignup.countryCode == CountryEnum.saudiArabia : selectedCountrySignup.countryCode == CountryEnum.saudiArabia.countryCode
? false ? false
: true, : true,
payload: payload, payload: payload,
@ -374,9 +374,6 @@ class AuthenticationViewModel extends ChangeNotifier {
isFormFamilyFile: isFormFamilyFile, isFormFamilyFile: isFormFamilyFile,
responseID: responseID); responseID: responseID);
// TODO: GET APP SMS SIGNATURE HERE // TODO: GET APP SMS SIGNATURE HERE
request.sMSSignature = await getSignature(); request.sMSSignature = await getSignature();
@ -434,18 +431,17 @@ class AuthenticationViewModel extends ChangeNotifier {
return isUserComingForRegister; return isUserComingForRegister;
} }
Future<void> checkActivationCode( Future<void> checkActivationCode({
{required String? activationCode, required String? activationCode,
required OTPTypeEnum otpTypeEnum, required OTPTypeEnum otpTypeEnum,
required Function(String? message) onWrongActivationCode, required Function(String? message) onWrongActivationCode,
Function()? onResendActivation, Function()? onResendActivation,
bool isFormFamilyFile = false, bool isFormFamilyFile = false,
dynamic patientShareRequestID, dynamic patientShareRequestID,
dynamic responseID, dynamic responseID,
bool isSwitchUser =false, bool isSwitchUser = false,
int? patientID, int? patientID,
}) async {
}) async {
bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true || _appState.getUserRegistrationPayload.patientOutSa == 1); bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true || _appState.getUserRegistrationPayload.patientOutSa == 1);
final request = RequestUtils.getCommonRequestWelcome( final request = RequestUtils.getCommonRequestWelcome(
@ -508,15 +504,15 @@ class AuthenticationViewModel extends ChangeNotifier {
}); });
} else { } else {
final resultEither = await _authenticationRepo.checkActivationCodeRepo( final resultEither = await _authenticationRepo.checkActivationCodeRepo(
newRequest: CheckActivationCodeRegisterReq.fromJson(request), newRequest: CheckActivationCodeRegisterReq.fromJson(request),
activationCode: activationCode, activationCode: activationCode,
isRegister: false, isRegister: false,
isFormFamilyFile: isFormFamilyFile, isFormFamilyFile: isFormFamilyFile,
patientShareRequestID: patientShareRequestID, patientShareRequestID: patientShareRequestID,
responseID: responseID, responseID: responseID,
isSwitchUser: isSwitchUser, isSwitchUser: isSwitchUser,
patientID: patientID, patientID: patientID,
loginType: _appState.getSuperUserID != null ? 0 : 2, loginType: _appState.getSuperUserID != null ? 0 : 2,
); );
resultEither.fold( resultEither.fold(
@ -531,8 +527,6 @@ class AuthenticationViewModel extends ChangeNotifier {
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
await _dialogService.showCommonBottomSheetWithoutH(message: failure.message, label: LocaleKeys.notice.tr(), onOkPressed: () {}); await _dialogService.showCommonBottomSheetWithoutH(message: failure.message, label: LocaleKeys.notice.tr(), onOkPressed: () {});
}), (apiResponse) async { }), (apiResponse) async {
print("API Response Data: ${apiResponse.data}");
final activation = CheckActivationCode.fromJson(apiResponse.data as Map<String, dynamic>); final activation = CheckActivationCode.fromJson(apiResponse.data as Map<String, dynamic>);
if (activation.errorCode == '699') { if (activation.errorCode == '699') {
@ -551,17 +545,27 @@ class AuthenticationViewModel extends ChangeNotifier {
return; return;
} else { } else {
if (isFormFamilyFile) { if (isFormFamilyFile) {
await navigateToFamilyFilePage(); // await navigateToFamilyFilePage();
// _dialogService.showCommonBottomSheetWithoutH( MedicalFileViewModel medicalVm = getIt<MedicalFileViewModel>();
// message: "Family File Added Successfully", if (!_appState.getIsChildLoggedIn) {
// onOkPressed: () async { await medicalVm.getFamilyFiles(status: 0);
// print("navigating to family file page"); await medicalVm.getAllPendingRecordsByResponseId();
// _navigationService.popUntilNamed(AppRoutes.medicalFilePage);
// }); }
} else { } else {
if (activation.list != null && activation.list!.isNotEmpty) { if (activation.list != null && activation.list!.isNotEmpty) {
if(isSwitchUser){ if (isSwitchUser) {
_appState.setSuperUserID = _appState.getAuthenticatedUser()?.patientId; if (_appState.getIsChildLoggedIn) {
_appState.setSuperUserID = null;
_appState.setIsChildLoggedIn = false;
activation.list!.first.isParentUser = true;
} else {
_appState.setSuperUserID = _appState.getAuthenticatedUser()?.patientId;
_appState.setIsChildLoggedIn = true;
activation.list!.first.isParentUser = false;
}
} else {
activation.list!.first.isParentUser = true;
} }
_appState.setAuthenticatedUser(activation.list!.first); _appState.setAuthenticatedUser(activation.list!.first);
_appState.setPrivilegeModelList(activation.list!.first.listPrivilege!); _appState.setPrivilegeModelList(activation.list!.first.listPrivilege!);
@ -576,7 +580,14 @@ class AuthenticationViewModel extends ChangeNotifier {
_appState.getSelectDeviceByImeiRespModelElement!.logInType = loginTypeEnum.toInt; _appState.getSelectDeviceByImeiRespModelElement!.logInType = loginTypeEnum.toInt;
} }
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
insertPatientIMEIData(loginTypeEnum.toInt); //
if (!isSwitchUser && !_appState.getIsChildLoggedIn) {
MedicalFileViewModel medicalVm = getIt<MedicalFileViewModel>();
insertPatientIMEIData(loginTypeEnum.toInt);
await medicalVm.getFamilyFiles(status: 0); //TODO: Remove status: 1 by Aamir Need to Discuss With Sultan
// medicalVm.getAllPendingRecordsByResponseId();
}
await clearDefaultInputValues(); await clearDefaultInputValues();
if (isUserAgreedBefore) { if (isUserAgreedBefore) {
navigateToHomeScreen(); navigateToHomeScreen();

@ -70,6 +70,8 @@ class AuthenticatedUser {
dynamic authenticatedUserPatientType; dynamic authenticatedUserPatientType;
dynamic authenticatedUserStatus; dynamic authenticatedUserStatus;
int? superUser; int? superUser;
bool? isParentUser;
AuthenticatedUser({ AuthenticatedUser({
this.setupId, this.setupId,
this.patientType, this.patientType,
@ -139,7 +141,8 @@ class AuthenticatedUser {
this.authenticatedUserPatientPayType, this.authenticatedUserPatientPayType,
this.authenticatedUserPatientType, this.authenticatedUserPatientType,
this.authenticatedUserStatus, this.authenticatedUserStatus,
this.superUser this.superUser,
this.isParentUser,
}); });
factory AuthenticatedUser.fromRawJson(String str) => AuthenticatedUser.fromJson(json.decode(str)); factory AuthenticatedUser.fromRawJson(String str) => AuthenticatedUser.fromJson(json.decode(str));
@ -147,148 +150,150 @@ class AuthenticatedUser {
String toRawJson() => json.encode(toJson()); String toRawJson() => json.encode(toJson());
factory AuthenticatedUser.fromJson(Map<String, dynamic> json) => AuthenticatedUser( factory AuthenticatedUser.fromJson(Map<String, dynamic> json) => AuthenticatedUser(
setupId: json["SetupID"], setupId: json["SetupID"],
patientType: json["PatientType"], patientType: json["PatientType"],
patientId: json["PatientID"], patientId: json["PatientID"],
firstName: json["FirstName"], firstName: json["FirstName"],
middleName: json["MiddleName"], middleName: json["MiddleName"],
lastName: json["LastName"], lastName: json["LastName"],
firstNameN: json["FirstNameN"], firstNameN: json["FirstNameN"],
middleNameN: json["MiddleNameN"], middleNameN: json["MiddleNameN"],
lastNameN: json["LastNameN"], lastNameN: json["LastNameN"],
relationshipId: json["RelationshipID"], relationshipId: json["RelationshipID"],
gender: json["Gender"], gender: json["Gender"],
dateofBirth: json["DateofBirth"], dateofBirth: json["DateofBirth"],
dateofBirthN: json["DateofBirthN"], dateofBirthN: json["DateofBirthN"],
nationalityId: json["NationalityID"], nationalityId: json["NationalityID"],
phoneResi: json["PhoneResi"], phoneResi: json["PhoneResi"],
phoneOffice: json["PhoneOffice"], phoneOffice: json["PhoneOffice"],
mobileNumber: json["MobileNumber"], mobileNumber: json["MobileNumber"],
faxNumber: json["FaxNumber"], faxNumber: json["FaxNumber"],
emailAddress: json["EmailAddress"], emailAddress: json["EmailAddress"],
bloodGroup: json["BloodGroup"], bloodGroup: json["BloodGroup"],
rhFactor: json["RHFactor"], rhFactor: json["RHFactor"],
isEmailAlertRequired: json["IsEmailAlertRequired"], isEmailAlertRequired: json["IsEmailAlertRequired"],
isSmsAlertRequired: json["IsSMSAlertRequired"], isSmsAlertRequired: json["IsSMSAlertRequired"],
preferredLanguage: json["PreferredLanguage"], preferredLanguage: json["PreferredLanguage"],
isPrivilegedMember: json["IsPrivilegedMember"], isPrivilegedMember: json["IsPrivilegedMember"],
memberId: json["MemberID"], memberId: json["MemberID"],
expiryDate: json["ExpiryDate"], expiryDate: json["ExpiryDate"],
isHmgEmployee: json["IsHmgEmployee"], isHmgEmployee: json["IsHmgEmployee"],
employeeId: json["EmployeeID"], employeeId: json["EmployeeID"],
emergencyContactName: json["EmergencyContactName"], emergencyContactName: json["EmergencyContactName"],
emergencyContactNo: json["EmergencyContactNo"], emergencyContactNo: json["EmergencyContactNo"],
patientPayType: json["PatientPayType"], patientPayType: json["PatientPayType"],
dhccPatientRefId: json["DHCCPatientRefID"], dhccPatientRefId: json["DHCCPatientRefID"],
isPatientDummy: json["IsPatientDummy"], isPatientDummy: json["IsPatientDummy"],
status: json["Status"], status: json["Status"],
isStatusCleared: json["IsStatusCleared"], isStatusCleared: json["IsStatusCleared"],
patientIdentificationType: json["PatientIdentificationType"], patientIdentificationType: json["PatientIdentificationType"],
patientIdentificationNo: json["PatientIdentificationNo"], patientIdentificationNo: json["PatientIdentificationNo"],
projectId: json["ProjectID"], projectId: json["ProjectID"],
infoSourceId: json["InfoSourceID"], infoSourceId: json["InfoSourceID"],
address: json["Address"], address: json["Address"],
age: json["Age"], age: json["Age"],
ageDesc: json["AgeDesc"], ageDesc: json["AgeDesc"],
areaId: json["AreaID"], areaId: json["AreaID"],
crsVerificationStatus: json["CRSVerificationStatus"], crsVerificationStatus: json["CRSVerificationStatus"],
crsVerificationStatusDesc: json["CRSVerificationStatusDesc"], crsVerificationStatusDesc: json["CRSVerificationStatusDesc"],
crsVerificationStatusDescN: json["CRSVerificationStatusDescN"], crsVerificationStatusDescN: json["CRSVerificationStatusDescN"],
createdBy: json["CreatedBy"], createdBy: json["CreatedBy"],
genderDescription: json["GenderDescription"], genderDescription: json["GenderDescription"],
healthIdFromNhicViaVida: json["HealthIDFromNHICViaVida"], healthIdFromNhicViaVida: json["HealthIDFromNHICViaVida"],
ir: json["IR"], ir: json["IR"],
isoCityId: json["ISOCityID"], isoCityId: json["ISOCityID"],
isoCountryId: json["ISOCountryID"], isoCountryId: json["ISOCountryID"],
isVerfiedFromNhic: json["IsVerfiedFromNHIC"], isVerfiedFromNhic: json["IsVerfiedFromNHIC"],
listPrivilege: json["ListPrivilege"] == null ? [] : List<ListPrivilege>.from(json["ListPrivilege"]!.map((x) => ListPrivilege.fromJson(x))), listPrivilege: json["ListPrivilege"] == null ? [] : List<ListPrivilege>.from(json["ListPrivilege"]!.map((x) => ListPrivilege.fromJson(x))),
marital: json["Marital"], marital: json["Marital"],
occupationId: json["OccupationID"], occupationId: json["OccupationID"],
outSa: json["OutSA"], outSa: json["OutSA"],
poBox: json["POBox"], poBox: json["POBox"],
receiveHealthSummaryReport: json["ReceiveHealthSummaryReport"], receiveHealthSummaryReport: json["ReceiveHealthSummaryReport"],
sourceType: json["SourceType"], sourceType: json["SourceType"],
strDateofBirth: json["StrDateofBirth"], strDateofBirth: json["StrDateofBirth"],
tempAddress: json["TempAddress"], tempAddress: json["TempAddress"],
zipCode: json["ZipCode"], zipCode: json["ZipCode"],
eHealthIdField: json["eHealthIDField"], eHealthIdField: json["eHealthIDField"],
authenticatedUserPatientPayType: json["patientPayType"], authenticatedUserPatientPayType: json["patientPayType"],
authenticatedUserPatientType: json["patientType"], authenticatedUserPatientType: json["patientType"],
authenticatedUserStatus: json["status"], authenticatedUserStatus: json["status"],
superUser: json["superUser"], superUser: json["superUser"],
); isParentUser: json["isParentUser"] ?? false,
);
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"SetupID": setupId, "SetupID": setupId,
"PatientType": patientType, "PatientType": patientType,
"PatientID": patientId, "PatientID": patientId,
"FirstName": firstName, "FirstName": firstName,
"MiddleName": middleName, "MiddleName": middleName,
"LastName": lastName, "LastName": lastName,
"FirstNameN": firstNameN, "FirstNameN": firstNameN,
"MiddleNameN": middleNameN, "MiddleNameN": middleNameN,
"LastNameN": lastNameN, "LastNameN": lastNameN,
"RelationshipID": relationshipId, "RelationshipID": relationshipId,
"Gender": gender, "Gender": gender,
"DateofBirth": dateofBirth, "DateofBirth": dateofBirth,
"DateofBirthN": dateofBirthN, "DateofBirthN": dateofBirthN,
"NationalityID": nationalityId, "NationalityID": nationalityId,
"PhoneResi": phoneResi, "PhoneResi": phoneResi,
"PhoneOffice": phoneOffice, "PhoneOffice": phoneOffice,
"MobileNumber": mobileNumber, "MobileNumber": mobileNumber,
"FaxNumber": faxNumber, "FaxNumber": faxNumber,
"EmailAddress": emailAddress, "EmailAddress": emailAddress,
"BloodGroup": bloodGroup, "BloodGroup": bloodGroup,
"RHFactor": rhFactor, "RHFactor": rhFactor,
"IsEmailAlertRequired": isEmailAlertRequired, "IsEmailAlertRequired": isEmailAlertRequired,
"IsSMSAlertRequired": isSmsAlertRequired, "IsSMSAlertRequired": isSmsAlertRequired,
"PreferredLanguage": preferredLanguage, "PreferredLanguage": preferredLanguage,
"IsPrivilegedMember": isPrivilegedMember, "IsPrivilegedMember": isPrivilegedMember,
"MemberID": memberId, "MemberID": memberId,
"ExpiryDate": expiryDate, "ExpiryDate": expiryDate,
"IsHmgEmployee": isHmgEmployee, "IsHmgEmployee": isHmgEmployee,
"EmployeeID": employeeId, "EmployeeID": employeeId,
"EmergencyContactName": emergencyContactName, "EmergencyContactName": emergencyContactName,
"EmergencyContactNo": emergencyContactNo, "EmergencyContactNo": emergencyContactNo,
"PatientPayType": patientPayType, "PatientPayType": patientPayType,
"DHCCPatientRefID": dhccPatientRefId, "DHCCPatientRefID": dhccPatientRefId,
"IsPatientDummy": isPatientDummy, "IsPatientDummy": isPatientDummy,
"Status": status, "Status": status,
"IsStatusCleared": isStatusCleared, "IsStatusCleared": isStatusCleared,
"PatientIdentificationType": patientIdentificationType, "PatientIdentificationType": patientIdentificationType,
"PatientIdentificationNo": patientIdentificationNo, "PatientIdentificationNo": patientIdentificationNo,
"ProjectID": projectId, "ProjectID": projectId,
"InfoSourceID": infoSourceId, "InfoSourceID": infoSourceId,
"Address": address, "Address": address,
"Age": age, "Age": age,
"AgeDesc": ageDesc, "AgeDesc": ageDesc,
"AreaID": areaId, "AreaID": areaId,
"CRSVerificationStatus": crsVerificationStatus, "CRSVerificationStatus": crsVerificationStatus,
"CRSVerificationStatusDesc": crsVerificationStatusDesc, "CRSVerificationStatusDesc": crsVerificationStatusDesc,
"CRSVerificationStatusDescN": crsVerificationStatusDescN, "CRSVerificationStatusDescN": crsVerificationStatusDescN,
"CreatedBy": createdBy, "CreatedBy": createdBy,
"GenderDescription": genderDescription, "GenderDescription": genderDescription,
"HealthIDFromNHICViaVida": healthIdFromNhicViaVida, "HealthIDFromNHICViaVida": healthIdFromNhicViaVida,
"IR": ir, "IR": ir,
"ISOCityID": isoCityId, "ISOCityID": isoCityId,
"ISOCountryID": isoCountryId, "ISOCountryID": isoCountryId,
"IsVerfiedFromNHIC": isVerfiedFromNhic, "IsVerfiedFromNHIC": isVerfiedFromNhic,
"ListPrivilege": listPrivilege == null ? [] : List<dynamic>.from(listPrivilege!.map((x) => x.toJson())), "ListPrivilege": listPrivilege == null ? [] : List<dynamic>.from(listPrivilege!.map((x) => x.toJson())),
"Marital": marital, "Marital": marital,
"OccupationID": occupationId, "OccupationID": occupationId,
"OutSA": outSa, "OutSA": outSa,
"POBox": poBox, "POBox": poBox,
"ReceiveHealthSummaryReport": receiveHealthSummaryReport, "ReceiveHealthSummaryReport": receiveHealthSummaryReport,
"SourceType": sourceType, "SourceType": sourceType,
"StrDateofBirth": strDateofBirth, "StrDateofBirth": strDateofBirth,
"TempAddress": tempAddress, "TempAddress": tempAddress,
"ZipCode": zipCode, "ZipCode": zipCode,
"eHealthIDField": eHealthIdField, "eHealthIDField": eHealthIdField,
"patientPayType": authenticatedUserPatientPayType, "patientPayType": authenticatedUserPatientPayType,
"patientType": authenticatedUserPatientType, "patientType": authenticatedUserPatientType,
"status": authenticatedUserStatus, "status": authenticatedUserStatus,
"superUser": superUser, "superUser": superUser,
}; "isParentUser": isParentUser,
};
} }
class ListPrivilege { class ListPrivilege {
@ -309,16 +314,16 @@ class ListPrivilege {
String toRawJson() => json.encode(toJson()); String toRawJson() => json.encode(toJson());
factory ListPrivilege.fromJson(Map<String, dynamic> json) => ListPrivilege( 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() => {
"ID": id, "ID": id,
"ServiceName": serviceName, "ServiceName": serviceName,
"Previlege": previlege, "Previlege": previlege,
"Region": region, "Region": region,
}; };
} }

@ -29,6 +29,10 @@ abstract class MedicalFileRepo {
Future<Either<Failure, GenericApiModel<List<FamilyFileResponseModelLists>>>> getAllPendingRecordsByResponseId({required Map<String, dynamic> request}); Future<Either<Failure, GenericApiModel<List<FamilyFileResponseModelLists>>>> getAllPendingRecordsByResponseId({required Map<String, dynamic> request});
Future<Either<Failure, GenericApiModel<dynamic>>> addFamilyFile({required dynamic request}); Future<Either<Failure, GenericApiModel<dynamic>>> addFamilyFile({required dynamic request});
Future<Either<Failure, GenericApiModel<dynamic>>> removeFamilyFile({required int? id});
Future<Either<Failure, GenericApiModel<dynamic>>> acceptRejectFamilyFile({required int? id, required int? status});
} }
class MedicalFileRepoImp implements MedicalFileRepo { class MedicalFileRepoImp implements MedicalFileRepo {
@ -328,10 +332,6 @@ class MedicalFileRepoImp implements MedicalFileRepo {
onSuccess: (response, statusCode, {messageStatus, errorMessage}) { onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try { try {
final list = response['GetAllPendingRecordsList']; final list = response['GetAllPendingRecordsList'];
// if (list == null || list.isEmpty) {
// throw Exception("lab list is empty");
// }
final familyLists = list.map((item) => FamilyFileResponseModelLists.fromJson(item as Map<String, dynamic>)).toList().cast<FamilyFileResponseModelLists>(); final familyLists = list.map((item) => FamilyFileResponseModelLists.fromJson(item as Map<String, dynamic>)).toList().cast<FamilyFileResponseModelLists>();
apiResponse = GenericApiModel<List<FamilyFileResponseModelLists>>( apiResponse = GenericApiModel<List<FamilyFileResponseModelLists>>(
@ -384,4 +384,74 @@ class MedicalFileRepoImp implements MedicalFileRepo {
return Left(UnknownFailure(e.toString())); return Left(UnknownFailure(e.toString()));
} }
} }
@override
Future<Either<Failure, GenericApiModel<dynamic>>> removeFamilyFile({required int? id}) async {
Map<String, dynamic> request = {};
request["ID"] = id;
request['IsActive'] = false;
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
ApiConsts.removeFileFromFamilyMembers,
body: request,
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>>> acceptRejectFamilyFile({required int? id, required int? status}) async {
Map<String, dynamic> request = {};
request["ID"] = id;
request['Status'] = status;
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
ApiConsts.acceptAndRejectFamilyFile,
body: request,
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()));
}
}
} }

@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/app_state.dart';
@ -83,7 +84,7 @@ class MedicalFileViewModel extends ChangeNotifier {
void onFamilyFileTabChange(int index) { void onFamilyFileTabChange(int index) {
setSelectedFamilyFileTabIndex = index; setSelectedFamilyFileTabIndex = index;
if (index == 1) { if (index == 1) {
getAllPendingRecordsByResponseId(); // getAllPendingRecordsByResponseId();
} }
notifyListeners(); notifyListeners();
} }
@ -270,148 +271,50 @@ class MedicalFileViewModel extends ChangeNotifier {
if (apiResponse.messageStatus == 2) { if (apiResponse.messageStatus == 2) {
_dialogService.showErrorBottomSheet(message: apiResponse.errorMessage!, onOkPressed: () {}); _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) { } else if (apiResponse.messageStatus == 1) {
patientFamilyFiles = apiResponse.data!;
if (apiResponse.data != null) { if (apiResponse.data != null) {
patientFamilyFiles.insert( // Add current user as the first active family file
0, final currentUser = _appState.getAuthenticatedUser()!;
FamilyFileResponseModelLists( final currentUserFamilyFile = FamilyFileResponseModelLists(
patientId: _appState.getAuthenticatedUser()!.patientId, patientId: currentUser.patientId,
patientName: '${_appState.getAuthenticatedUser()!.firstName!} ${_appState.getAuthenticatedUser()!.lastName!}', patientName: '${currentUser.firstName!} ${currentUser.lastName!}',
isActive: true, isActive: true,
gender: _appState.getAuthenticatedUser()!.gender!, gender: currentUser.gender!,
responseId: _appState.getAuthenticatedUser()!.patientId, responseId: currentUser.patientId,
age: _appState.getAuthenticatedUser()!.age, age: currentUser.age,
mobileNumber: _appState.getAuthenticatedUser()!.mobileNumber, mobileNumber: currentUser.mobileNumber,
patientIdenficationNumber: _appState.getAuthenticatedUser()!.patientIdentificationNo, patientIdenficationNumber: currentUser.patientIdentificationNo,
emaiLAddress: _appState.getAuthenticatedUser()!.emailAddress, emaiLAddress: currentUser.emailAddress,
genderDescription: _appState.getAuthenticatedUser()!.genderDescription, genderDescription: currentUser.genderDescription,
),
); );
// final List<FamilyFileResponseModelLists> activeFamilyFiles = []; // Clear and start fresh with current user
// final List<FamilyFileResponseModelLists> tempPendingFamilyFiles = []; patientFamilyFiles.clear();
// for (var element in apiResponse.data!) { patientFamilyFiles.add(currentUserFamilyFile);
// if (element.status != null && element.status == FamilyFileEnum.active.toInt) {
// activeFamilyFiles.add(FamilyFileResponseModelLists(
// patientId: element.patientId,
// patientName: element.patientName!,
// isActive: element.status == FamilyFileEnum.active.toInt ? true : false,
// gender: element.gender!,
// responseId: element.patientId,
// mobileNumber: element.mobileNumber,
// age: element.age,
// patientIdenficationNumber: element.patientIdenficationNumber,
// relationship: element.relationship,
// relationshipId: element.relationshipId,
// relationshipN: element.relationshipN,
// status: element.status,
// statusDescription: element.statusDescription,
// createdOn: element.createdOn,
// editedOn: element.editedOn,
// patientDataVerified: element.patientDataVerified,
// regionId: element.regionId,
// familyRegionId: element.familyRegionId,
// genderDescription: element.genderDescription,
// genderImage: element.genderImage,
// emaiLAddress: element.emaiLAddress));
// }
//
// if (element.status != null && element.status == FamilyFileEnum.pending.toInt) {
// tempPendingFamilyFiles.add(FamilyFileResponseModelLists(
// patientId: element.patientId,
// patientName: element.patientName!,
// isActive: element.status == FamilyFileEnum.active.toInt ? true : false,
// gender: element.gender!,
// responseId: element.patientId,
// mobileNumber: element.mobileNumber,
// age: element.age,
// patientIdenficationNumber: element.patientIdenficationNumber,
// relationship: element.relationship,
// relationshipId: element.relationshipId,
// relationshipN: element.relationshipN,
// status: element.status,
// statusDescription: element.statusDescription,
// createdOn: element.createdOn,
// editedOn: element.editedOn,
// patientDataVerified: element.patientDataVerified,
// regionId: element.regionId,
// familyRegionId: element.familyRegionId,
// genderDescription: element.genderDescription,
// genderImage: element.genderImage,
// emaiLAddress: element.emaiLAddress));
// }
// }
// patientFamilyFiles.addAll(activeFamilyFiles.where((element) => !patientFamilyFiles.any((e) => e.patientId == element.patientId)));
// pendingFamilyFiles.addAll(tempPendingFamilyFiles);
final List<FamilyFileResponseModelLists> activeFamilyFiles = []; final List<FamilyFileResponseModelLists> activeFamilyFiles = [];
final List<FamilyFileResponseModelLists> tempPendingFamilyFiles = []; final List<FamilyFileResponseModelLists> pendingFamilyFiles = [];
// final Set<dynamic> pendingIds = {};
// for (var element in apiResponse.data!) {
// if (element.status != null && element.status == FamilyFileEnum.pending.toInt) {
// tempPendingFamilyFiles.add(FamilyFileResponseModelLists(
// patientId: element.patientId,
// patientName: element.patientName!,
// isActive: false,
// gender: element.gender!,
// responseId: element.patientId,
// mobileNumber: element.mobileNumber,
// age: element.age,
// patientIdenficationNumber: element.patientIdenficationNumber,
// relationship: element.relationship,
// relationshipId: element.relationshipId,
// relationshipN: element.relationshipN,
// status: element.status,
// statusDescription: element.statusDescription,
// createdOn: element.createdOn,
// editedOn: element.editedOn,
// patientDataVerified: element.patientDataVerified,
// regionId: element.regionId,
// familyRegionId: element.familyRegionId,
// genderDescription: element.genderDescription,
// genderImage: element.genderImage,
// emaiLAddress: element.emaiLAddress));
// } else if (element.status != null && element.status == FamilyFileEnum.active.toInt) {
// activeFamilyFiles.add(FamilyFileResponseModelLists(
// patientId: element.patientId,
// patientName: element.patientName!,
// isActive: element.status == FamilyFileEnum.active.toInt ? true : false,
// gender: element.gender!,
// responseId: element.patientId,
// mobileNumber: element.mobileNumber,
// age: element.age,
// patientIdenficationNumber: element.patientIdenficationNumber,
// relationship: element.relationship,
// relationshipId: element.relationshipId,
// relationshipN: element.relationshipN,
// status: element.status,
// statusDescription: element.statusDescription,
// createdOn: element.createdOn,
// editedOn: element.editedOn,
// patientDataVerified: element.patientDataVerified,
// regionId: element.regionId,
// familyRegionId: element.familyRegionId,
// genderDescription: element.genderDescription,
// genderImage: element.genderImage,
// emaiLAddress: element.emaiLAddress));
// }
// }
for (var element in apiResponse.data!) { for (var element in apiResponse.data!) {
if (element.status == null) continue; if (element.status == null) {
continue;
}
final isPending = element.status == FamilyFileEnum.pending.toInt; final isPending = element.status == FamilyFileEnum.pending.toInt || element.status == FamilyFileEnum.rejected.toInt;
final isActive = element.status == FamilyFileEnum.active.toInt; final isActive = element.status == FamilyFileEnum.active.toInt;
if (!isPending && !isActive) continue; print("====== Element Status: ${element.status}, isPending: $isPending, isActive: $isActive ============");
if (!isPending && !isActive) {
continue;
}
final familyFile = FamilyFileResponseModelLists( final familyFile = FamilyFileResponseModelLists(
id: element.id,
patientId: element.patientId, patientId: element.patientId,
patientName: element.patientName!, patientName: element.patientName!,
isActive: isActive, isActive: element.isActive,
gender: element.gender!, gender: element.gender!,
responseId: element.patientId, responseId: element.responseId,
mobileNumber: element.mobileNumber, mobileNumber: element.mobileNumber,
age: element.age, age: element.age,
patientIdenficationNumber: element.patientIdenficationNumber, patientIdenficationNumber: element.patientIdenficationNumber,
@ -431,14 +334,22 @@ class MedicalFileViewModel extends ChangeNotifier {
); );
if (isPending) { if (isPending) {
tempPendingFamilyFiles.add(familyFile); familyFile.isRequestFromMySide = true;
} else if (isActive) { pendingFamilyFiles.add(familyFile);
}
if (isActive) {
activeFamilyFiles.add(familyFile); activeFamilyFiles.add(familyFile);
} }
} }
patientFamilyFiles.addAll(activeFamilyFiles.where((element) => patientFamilyFiles.every((e) => e.patientId != element.patientId || e.status != FamilyFileEnum.active.toInt))); for (var activeFile in activeFamilyFiles) {
pendingFamilyFiles.addAll(tempPendingFamilyFiles.where((element) => pendingFamilyFiles.every((e) => e.patientId != element.patientId))); if (!patientFamilyFiles.any((e) => e.responseId == activeFile.responseId)) {
patientFamilyFiles.add(activeFile);
}
}
this.pendingFamilyFiles.clear();
this.pendingFamilyFiles.addAll(pendingFamilyFiles);
} }
notifyListeners(); notifyListeners();
@ -463,11 +374,12 @@ class MedicalFileViewModel extends ChangeNotifier {
if (apiResponse.data != null) { if (apiResponse.data != null) {
final List<FamilyFileResponseModelLists> tempPendingFamilyFiles = []; final List<FamilyFileResponseModelLists> tempPendingFamilyFiles = [];
for (var element in apiResponse.data!) { for (var element in apiResponse.data!) {
if (element.status != null && element.status == FamilyFileEnum.pending.toInt) { if (element.status != null && element.status == FamilyFileEnum.pending.toInt || element.status == FamilyFileEnum.active.toInt) {
tempPendingFamilyFiles.add(FamilyFileResponseModelLists( tempPendingFamilyFiles.add(FamilyFileResponseModelLists(
id: element.id,
patientId: element.patientId, patientId: element.patientId,
patientName: element.patientName!, patientName: element.patientName!,
isActive: element.status == FamilyFileEnum.active.toInt ? true : false, isActive: element.status,
gender: element.gender, gender: element.gender,
responseId: element.patientId, responseId: element.patientId,
mobileNumber: element.mobileNumber, mobileNumber: element.mobileNumber,
@ -488,7 +400,11 @@ class MedicalFileViewModel extends ChangeNotifier {
emaiLAddress: element.emaiLAddress)); emaiLAddress: element.emaiLAddress));
} }
} }
// pendingFamilyFiles.addAll(tempPendingFamilyFiles.where((element) => !pendingFamilyFiles.any((e) => e.responseId == element.responseId)));
pendingFamilyFiles.addAll(tempPendingFamilyFiles.where((element) => !pendingFamilyFiles.any((e) => e.patientId == element.patientId))); pendingFamilyFiles.addAll(tempPendingFamilyFiles.where((element) => !pendingFamilyFiles.any((e) => e.patientId == element.patientId)));
print("====== Pending Family Length: ${pendingFamilyFiles.length} ============");
print("====== Pending Family Files: ${jsonEncode(pendingFamilyFiles)} ============");
} }
notifyListeners(); notifyListeners();
} }
@ -496,42 +412,6 @@ class MedicalFileViewModel extends ChangeNotifier {
); );
} }
// Future<void> switchFamilyFiles({Function(dynamic)? onSuccess, Function(String)? onError}) async {
// // final result = await medicalFileRepo.getPatientFamilyFiles();
// final result = await medicalFileRepo.getPatientFamilyFiles(3, _appState.superUserID != null ? _appState.superUserID! : _appState.getAuthenticatedUser()!.patientId!);
//
// result.fold(
// (failure) async => await errorHandlerService.handleError(
// failure: failure,
// onOkPressed: () {
// onError!(failure.message);
// },
// ),
// (apiResponse) {
// if (apiResponse.messageStatus == 2) {
// _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage!, onOkPressed: () {});
// } else if (apiResponse.messageStatus == 1) {
// patientFamilyFiles = apiResponse.data!;
// patientFamilyFiles.insert(
// 0,
// FamilyFileResponseModelLists(
// patientId: _appState.getAuthenticatedUser()!.patientId,
// patientName: '${_appState.getAuthenticatedUser()!.firstName!} ${_appState.getAuthenticatedUser()!.lastName!}',
// isActive: true,
// gender: _appState.getAuthenticatedUser()!.gender!,
// age: _appState.getAuthenticatedUser()!.age,
// mobileNumber: _appState.getAuthenticatedUser()!.mobileNumber,
// responseId: _appState.getAuthenticatedUser()!.patientId),
// );
// notifyListeners();
// if (onSuccess != null) {
// onSuccess(apiResponse);
// }
// }
// },
// );
// }
Future<void> switchFamilyFiles({Function(dynamic)? onSuccess, int? responseID, int? patientID, String? phoneNumber, Function(String)? onError}) async { Future<void> switchFamilyFiles({Function(dynamic)? onSuccess, int? responseID, int? patientID, String? phoneNumber, Function(String)? onError}) async {
authVM.phoneNumberController.text = phoneNumber!.startsWith("0") ? phoneNumber.replaceFirst("0", "") : phoneNumber; authVM.phoneNumberController.text = phoneNumber!.startsWith("0") ? phoneNumber.replaceFirst("0", "") : phoneNumber;
@ -555,34 +435,107 @@ class MedicalFileViewModel extends ChangeNotifier {
final resultEither = await medicalFileRepo.addFamilyFile(request: request.toJson()); final resultEither = await medicalFileRepo.addFamilyFile(request: request.toJson());
resultEither.fold((failure) async => await errorHandlerService.handleError(failure: failure), (apiResponse) async { resultEither.fold((failure) async => await errorHandlerService.handleError(failure: failure), (apiResponse) async {
if (apiResponse != null && apiResponse.data != null) { if (apiResponse.messageStatus == 2) {
request.isPatientExcluded = apiResponse.data["IsPatientExcluded"];
request.responseID = apiResponse.data["ReponseID"];
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
_dialogService.showExceptionBottomSheet( _dialogService.showErrorBottomSheet(
message: apiResponse.data['Message'], message: apiResponse.errorMessage!,
onOkPressed: () { onOkPressed: () {
LoaderBottomSheet.showLoader();
authVM.sendActivationCode(
otpTypeEnum: otpTypeEnum,
nationalIdOrFileNumber: request.sharedPatientIdentificationId!,
phoneNumber: request.sharedPatientMobileNumber!,
isForRegister: false,
isExcludedUser: apiResponse.data['IsPatientExcluded'],
responseID: apiResponse.data["ReponseID"],
isFormFamilyFile: true);
},
onCancelPressed: () {
navigationService.pop(); navigationService.pop();
}); });
} else if (apiResponse.messageStatus == 1) {
if (apiResponse.data != null) {
request.isPatientExcluded = apiResponse.data["IsPatientExcluded"];
request.responseID = apiResponse.data["ReponseID"];
LoaderBottomSheet.hideLoader();
_dialogService.showExceptionBottomSheet(
message: apiResponse.data["Message"],
onOkPressed: () {
LoaderBottomSheet.showLoader();
authVM.sendActivationCode(
otpTypeEnum: otpTypeEnum,
nationalIdOrFileNumber: request.sharedPatientIdentificationId!,
phoneNumber: request.sharedPatientMobileNumber!,
isForRegister: false,
isExcludedUser: apiResponse.data['IsPatientExcluded'],
responseID: apiResponse.data["ReponseID"],
isFormFamilyFile: true);
},
onCancelPressed: () {
navigationService.pop();
});
}
} }
}); });
} }
Future<void> handleFamilyFileRequestOTPVerification() async { Future<void> handleFamilyFileRequestOTPVerification() async {
LoaderBottomSheet.showLoader(); LoaderBottomSheet.showLoader();
await getFamilyFiles(); if (!_appState.getIsChildLoggedIn) {
await getAllPendingRecordsByResponseId(); await getFamilyFiles(status: 0);
await getAllPendingRecordsByResponseId();
}
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
} }
Future<void> removeFileFromFamilyMembers({int? id}) async {
NavigationService navigationService = getIt.get<NavigationService>();
_dialogService.showExceptionBottomSheet(
message: "Remove this member?",
onOkPressed: () async {
LoaderBottomSheet.showLoader();
final result = await medicalFileRepo.removeFamilyFile(id: id);
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) {
if (apiResponse.messageStatus == 2) {
LoaderBottomSheet.hideLoader();
_dialogService.showErrorBottomSheet(
message: apiResponse.errorMessage!,
onOkPressed: () {
navigationService.pop();
});
} else if (apiResponse.messageStatus == 1) {
patientFamilyFiles.removeWhere((element) => element.id == id);
LoaderBottomSheet.hideLoader();
notifyListeners();
navigationService.pop();
}
},
);
},
onCancelPressed: () {
navigationService.pop();
});
}
Future<void> acceptRejectFileFromFamilyMembers({int? id, int? status}) async {
NavigationService navigationService = getIt.get<NavigationService>();
LoaderBottomSheet.showLoader();
final result = await medicalFileRepo.acceptRejectFamilyFile(id: id, status: status);
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) {
if (apiResponse.messageStatus == 2) {
LoaderBottomSheet.hideLoader();
_dialogService.showErrorBottomSheet(
message: apiResponse.errorMessage!,
onOkPressed: () {
navigationService.pop();
});
} else if (apiResponse.messageStatus == 1) {
// FamilyFileResponseModelLists moveProfile = pendingFamilyFiles.firstWhere((element) => element.id == patientID);
// moveProfile.status = 3;
// moveProfile.statusDescription = "Approved";
// patientFamilyFiles.add(moveProfile);
pendingFamilyFiles.removeWhere((element) => element.id == id);
//TODO: Call Api Here To Load Family Members
getFamilyFiles(status: 0);
getAllPendingRecordsByResponseId();
LoaderBottomSheet.hideLoader();
onFamilyFileTabChange(0);
}
},
);
}
} }

@ -23,83 +23,90 @@ class FamilyFileResponseModelLists {
String? patientIdenficationNumber; String? patientIdenficationNumber;
String? patientName; String? patientName;
String? statusDescription; String? statusDescription;
bool? isSuperUser = false;
bool? isRequestFromMySide;
FamilyFileResponseModelLists({ FamilyFileResponseModelLists(
this.id, {this.id,
this.patientId, this.patientId,
this.responseId, this.responseId,
this.relationshipId, this.relationshipId,
this.relationship, this.relationship,
this.relationshipN, this.relationshipN,
this.regionId, this.regionId,
this.familyRegionId, this.familyRegionId,
this.status, this.status,
this.isActive, this.isActive,
this.editedOn, this.editedOn,
this.createdOn, this.createdOn,
this.age, this.age,
this.emaiLAddress, this.emaiLAddress,
this.gender, this.gender,
this.genderDescription, this.genderDescription,
this.genderImage, this.genderImage,
this.mobileNumber, this.mobileNumber,
this.patientDataVerified, this.patientDataVerified,
this.patientIdenficationNumber, this.patientIdenficationNumber,
this.patientName, this.patientName,
this.statusDescription, this.statusDescription,
}); this.isSuperUser,
this.isRequestFromMySide});
factory FamilyFileResponseModelLists.fromRawJson(String str) => FamilyFileResponseModelLists.fromJson(json.decode(str)); factory FamilyFileResponseModelLists.fromRawJson(String str) => FamilyFileResponseModelLists.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson()); String toRawJson() => json.encode(toJson());
factory FamilyFileResponseModelLists.fromJson(Map<String, dynamic> json) => FamilyFileResponseModelLists( factory FamilyFileResponseModelLists.fromJson(Map<String, dynamic> json) => FamilyFileResponseModelLists(
id: json["ID"], id: json["ID"],
patientId: json["PatientID"], patientId: json["PatientID"],
responseId: json["ResponseID"], responseId: json["ResponseID"],
relationshipId: json["RelationshipID"], relationshipId: json["RelationshipID"],
relationship: json["Relationship"], relationship: json["Relationship"],
relationshipN: json["RelationshipN"], relationshipN: json["RelationshipN"],
regionId: json["RegionID"], regionId: json["RegionID"],
familyRegionId: json["FamilyRegionID"], familyRegionId: json["FamilyRegionID"],
status: json["Status"], status: json["Status"],
isActive: json["IsActive"], isActive: json["IsActive"],
editedOn: json["EditedOn"], editedOn: json["EditedOn"],
createdOn: json["CreatedOn"], createdOn: json["CreatedOn"],
age: json["Age"], age: json["Age"],
emaiLAddress: json["EmaiLAddress"], emaiLAddress: json["EmaiLAddress"],
gender: json["Gender"], gender: json["Gender"],
genderDescription: json["GenderDescription"], genderDescription: json["GenderDescription"],
genderImage: json["GenderImage"], genderImage: json["GenderImage"],
mobileNumber: json["MobileNumber"], mobileNumber: json["MobileNumber"],
patientDataVerified: json["PatientDataVerified"], patientDataVerified: json["PatientDataVerified"],
patientIdenficationNumber: json["PatientIdenficationNumber"], patientIdenficationNumber: json["PatientIdenficationNumber"],
patientName: json["PatientName"], patientName: json["PatientName"],
statusDescription: json["StatusDescription"], statusDescription: json["StatusDescription"],
); isSuperUser: json["isSuperUser"] ?? false,
isRequestFromMySide: json["isRequestFromMySide"] ?? false,
);
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"ID": id, "ID": id,
"PatientID": patientId, "PatientID": patientId,
"ResponseID": responseId, "ResponseID": responseId,
"RelationshipID": relationshipId, "RelationshipID": relationshipId,
"Relationship": relationship, "Relationship": relationship,
"RelationshipN": relationshipN, "RelationshipN": relationshipN,
"RegionID": regionId, "RegionID": regionId,
"FamilyRegionID": familyRegionId, "FamilyRegionID": familyRegionId,
"Status": status, "Status": status,
"IsActive": isActive, "IsActive": isActive,
"EditedOn": editedOn, "EditedOn": editedOn,
"CreatedOn": createdOn, "CreatedOn": createdOn,
"Age": age, "Age": age,
"EmaiLAddress": emaiLAddress, "EmaiLAddress": emaiLAddress,
"Gender": gender, "Gender": gender,
"GenderDescription": genderDescription, "GenderDescription": genderDescription,
"GenderImage": genderImage, "GenderImage": genderImage,
"MobileNumber": mobileNumber, "MobileNumber": mobileNumber,
"PatientDataVerified": patientDataVerified, "PatientDataVerified": patientDataVerified,
"PatientIdenficationNumber": patientIdenficationNumber, "PatientIdenficationNumber": patientIdenficationNumber,
"PatientName": patientName, "PatientName": patientName,
"StatusDescription": statusDescription, "StatusDescription": statusDescription,
}; "isSuperUser": isSuperUser,
"isRequestFromMySide": isRequestFromMySide,
};
} }

@ -16,6 +16,7 @@ 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/features/habib_wallet/habib_wallet_view_model.dart'; import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart'; import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart';
@ -81,6 +82,7 @@ class _LandingPageState extends State<LandingPage> {
myAppointmentsViewModel.getPatientAppointments(true, false); myAppointmentsViewModel.getPatientAppointments(true, false);
myAppointmentsViewModel.getPatientMyDoctors(); myAppointmentsViewModel.getPatientMyDoctors();
prescriptionsViewModel.initPrescriptionsViewModel(); prescriptionsViewModel.initPrescriptionsViewModel();
} }
}); });
super.initState(); super.initState();

@ -29,6 +29,7 @@ import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointme
import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appointment_calendar.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appointment_calendar.dart';
import 'package:hmg_patient_app_new/presentation/insurance/insurance_home_page.dart'; import 'package:hmg_patient_app_new/presentation/insurance/insurance_home_page.dart';
import 'package:hmg_patient_app_new/presentation/insurance/widgets/patient_insurance_card.dart'; import 'package:hmg_patient_app_new/presentation/insurance/widgets/patient_insurance_card.dart';
import 'package:hmg_patient_app_new/services/dialog_service.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/presentation/medical_file/medical_reports_page.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/medical_reports_page.dart';
import 'package:hmg_patient_app_new/presentation/medical_file/patient_sickleaves_list_page.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/patient_sickleaves_list_page.dart';
@ -80,7 +81,7 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
medicalFileViewModel.setIsPatientSickLeaveListLoading(true); medicalFileViewModel.setIsPatientSickLeaveListLoading(true);
medicalFileViewModel.getPatientSickLeaveList(); medicalFileViewModel.getPatientSickLeaveList();
if (appState.getSuperUserID == null) { if (appState.getSuperUserID == null) {
medicalFileViewModel.getFamilyFiles(status: 3); //TODO: Remove status: 1 by Aamir Need to Discuss With Sultan medicalFileViewModel.getFamilyFiles(status: 0); //TODO: Remove status: 1 by Aamir Need to Discuss With Sultan
medicalFileViewModel.getAllPendingRecordsByResponseId(); //TODO: Added By Aamir medicalFileViewModel.getAllPendingRecordsByResponseId(); //TODO: Added By Aamir
} }
@ -97,121 +98,139 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
medicalFileViewModel = Provider.of<MedicalFileViewModel>(context, listen: false); medicalFileViewModel = Provider.of<MedicalFileViewModel>(context, listen: false);
bookAppointmentsViewModel = Provider.of<BookAppointmentsViewModel>(context, listen: false); bookAppointmentsViewModel = Provider.of<BookAppointmentsViewModel>(context, listen: false);
NavigationService navigationService = getIt.get<NavigationService>(); NavigationService navigationService = getIt.get<NavigationService>();
return Scaffold( return CollapsingListView(
backgroundColor: AppColors.bgScaffoldColor, title: "Medical File".needTranslation,
body: CollapsingListView( trailing: Row(
title: LocaleKeys.medicalFile.tr(context: context), children: [
isLeading: false, Wrap(spacing: -15, children: [
child: SingleChildScrollView( Utils.buildImgWithAssets(icon: AppAssets.babyGirlImg, width: 32.h, height: 32.h, border: 1.5.h, borderRadius: 50.h),
child: Column( Utils.buildImgWithAssets(icon: AppAssets.femaleImg, width: 32.h, height: 32.h, border: 1.5.h, borderRadius: 50.h),
crossAxisAlignment: CrossAxisAlignment.start, Utils.buildImgWithAssets(icon: AppAssets.male_img, width: 32.h, height: 32.h, border: 1.5.h, borderRadius: 50.h),
children: [ ]),
SizedBox(height: 16.h), SizedBox(width: 4.h),
TextInputWidget( Utils.buildSvgWithAssets(icon: AppAssets.arrow_down)
labelText: LocaleKeys.search.tr(context: context), ],
hintText: "Type any record", ).onPress(() {
controller: TextEditingController(), DialogService dialogService = getIt.get<DialogService>();
keyboardType: TextInputType.number, dialogService.showFamilyBottomSheetWithoutH(
isEnable: true, label: "Who do you want to book for?".needTranslation,
prefix: null, message: "This clinic or doctor is only available for the below eligible profiles.".needTranslation,
autoFocus: false, onSwitchPress: (FamilyFileResponseModelLists profile) {
isBorderAllowed: false, medicalFileViewModel.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber);
isAllowLeadingIcon: true, },
padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 8.h), profiles: medicalFileViewModel.patientFamilyFiles);
leadingIcon: AppAssets.student_card, }),
).paddingSymmetrical(24.h, 0.0), isLeading: false,
SizedBox(height: 16.h), child: SingleChildScrollView(
Container( child: Column(
width: double.infinity, crossAxisAlignment: CrossAxisAlignment.start,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24), children: [
child: Padding( SizedBox(height: 16.h),
padding: EdgeInsets.all(16.h), TextInputWidget(
child: Column( labelText: LocaleKeys.search.tr(context: context),
crossAxisAlignment: CrossAxisAlignment.start, hintText: "Type any record".needTranslation,
children: [ controller: TextEditingController(),
Row( keyboardType: TextInputType.number,
crossAxisAlignment: CrossAxisAlignment.start, isEnable: true,
children: [ prefix: null,
Image.asset(appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg, width: 56.h, height: 56.h), autoFocus: false,
SizedBox(width: 8.h), isBorderAllowed: false,
Column( isAllowLeadingIcon: true,
crossAxisAlignment: CrossAxisAlignment.start, padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 8.h),
children: [ leadingIcon: AppAssets.student_card,
"${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}".toText18(isBold: true), ).paddingSymmetrical(24.h, 0.0),
SizedBox(height: 4.h), SizedBox(height: 16.h),
Wrap( Container(
direction: Axis.horizontal, width: double.infinity,
spacing: 4.h, decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24),
runSpacing: 4.h, child: Padding(
children: [ padding: EdgeInsets.all(16.h),
AppCustomChipWidget( child: Column(
icon: AppAssets.file_icon, crossAxisAlignment: CrossAxisAlignment.start,
labelText: "${LocaleKeys.fileNo.tr(context: context)}: ${appState.getAuthenticatedUser()!.patientId}",
onChipTap: () {
navigationService.pushPage(
page: FamilyMedicalScreen(
profiles: medicalFileViewModel.patientFamilyFiles,
onSelect: (FamilyFileResponseModelLists p1) {},
));
},
),
AppCustomChipWidget(
icon: AppAssets.checkmark_icon,
labelText: LocaleKeys.verified.tr(context: context),
iconColor: AppColors.successColor,
),
],
),
],
)
],
),
SizedBox(height: 16.h),
Divider(color: AppColors.dividerColor, height: 1.h),
SizedBox(height: 16.h),
Wrap(
direction: Axis.horizontal,
spacing: 4.h,
runSpacing: 4.h,
children: [
AppCustomChipWidget(
labelText: "${appState.getAuthenticatedUser()!.age} Years Old",
),
AppCustomChipWidget(
icon: AppAssets.blood_icon,
labelText: "${LocaleKeys.bloodType.tr(context: context)}: ${appState.getUserBloodGroup}",
iconColor: AppColors.primaryRedColor,
),
],
),
],
),
),
).paddingSymmetrical(24.h, 0.0),
SizedBox(height: 16.h),
Consumer<MedicalFileViewModel>(builder: (context, medicalFileVM, child) {
return Column(
children: [ children: [
CustomTabBar( Row(
activeTextColor: Color(0xffED1C2B), crossAxisAlignment: CrossAxisAlignment.start,
activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), children: [
tabs: [ Image.asset(appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg, width: 56.h, height: 56.h),
CustomTabBarModel(AppAssets.myFilesBottom, LocaleKeys.general.tr(context: context).needTranslation), SizedBox(width: 8.h),
CustomTabBarModel(AppAssets.insurance, LocaleKeys.insurance.tr(context: context)), Column(
CustomTabBarModel(AppAssets.requests, LocaleKeys.request.tr(context: context).needTranslation), crossAxisAlignment: CrossAxisAlignment.start,
CustomTabBarModel(AppAssets.more, "More".needTranslation), children: [
"${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}"
.toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1),
SizedBox(height: 4.h),
Wrap(
direction: Axis.horizontal,
spacing: 4.h,
runSpacing: 4.h,
children: [
AppCustomChipWidget(
icon: AppAssets.file_icon,
labelText: "${LocaleKeys.fileNo.tr(context: context)}: ${appState.getAuthenticatedUser()!.patientId}",
onChipTap: () {
navigationService.pushPage(
page: FamilyMedicalScreen(
profiles: medicalFileViewModel.patientFamilyFiles,
onSelect: (FamilyFileResponseModelLists p1) {},
));
},
),
AppCustomChipWidget(
icon: AppAssets.checkmark_icon,
labelText: LocaleKeys.verified.tr(context: context),
iconColor: AppColors.successColor,
),
],
),
],
)
],
),
SizedBox(height: 16.h),
Divider(color: AppColors.dividerColor, height: 1.h),
SizedBox(height: 16.h),
Wrap(
direction: Axis.horizontal,
spacing: 4.h,
runSpacing: 4.h,
children: [
AppCustomChipWidget(
labelText: "${appState.getAuthenticatedUser()!.age} Years Old",
),
AppCustomChipWidget(
icon: AppAssets.blood_icon,
labelText: "${LocaleKeys.bloodType.tr(context: context)}: ${appState.getUserBloodGroup}",
iconColor: AppColors.primaryRedColor,
),
], ],
onTabChange: (index) { ),
medicalFileVM.onTabChanged(index);
},
).paddingSymmetrical(24.h, 0.0),
SizedBox(height: 24.h),
getSelectedTabData(medicalFileVM.selectedTabIndex),
], ],
); ),
}), ),
], ).paddingSymmetrical(24.h, 0.0),
), SizedBox(height: 16.h),
Consumer<MedicalFileViewModel>(builder: (context, medicalFileVM, child) {
return Column(
children: [
CustomTabBar(
activeTextColor: Color(0xffED1C2B),
activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1),
tabs: [
CustomTabBarModel(AppAssets.myFilesBottom, LocaleKeys.general.tr(context: context).needTranslation),
CustomTabBarModel(AppAssets.insurance, LocaleKeys.insurance.tr(context: context)),
CustomTabBarModel(AppAssets.requests, LocaleKeys.request.tr(context: context).needTranslation),
CustomTabBarModel(AppAssets.more, "More".needTranslation),
],
onTabChange: (index) {
medicalFileVM.onTabChanged(index);
},
).paddingSymmetrical(24.h, 0.0),
SizedBox(height: 24.h),
getSelectedTabData(medicalFileVM.selectedTabIndex),
],
);
}),
],
), ),
), ),
); );
@ -576,28 +595,28 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
horizontalOffset: 100.0, horizontalOffset: 100.0,
child: FadeInAnimation( child: FadeInAnimation(
child: SizedBox( child: SizedBox(
width: 80.h, width: 80.h,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Image.network( Image.network(
myAppointmentsVM.patientMyDoctorsList[index].doctorImageURL!, myAppointmentsVM.patientMyDoctorsList[index].doctorImageURL!,
width: 64.h, width: 64.h,
height: 64.h, height: 64.h,
fit: BoxFit.fill, fit: BoxFit.fill,
).circle(100).toShimmer2(isShow: false, radius: 50.h), ).circle(100).toShimmer2(isShow: false, radius: 50.h),
SizedBox(height: 8.h), SizedBox(height: 8.h),
Expanded( Expanded(
child: (myAppointmentsVM.patientMyDoctorsList[index].doctorName) child: (myAppointmentsVM.patientMyDoctorsList[index].doctorName)
.toString() .toString()
.toText12(fontWeight: FontWeight.w500, isCenter: true, maxLine: 2) .toText12(fontWeight: FontWeight.w500, isCenter: true, maxLine: 2)
.toShimmer2(isShow: false), .toShimmer2(isShow: false),
),
],
), ),
], ),
), ),
), ),
),
),
) )
: Utils.getNoDataWidget(context, noDataText: "You don't have any completed visits yet.".needTranslation, isSmallWidget: true, width: 62, height: 62) : Utils.getNoDataWidget(context, noDataText: "You don't have any completed visits yet.".needTranslation, isSmallWidget: true, width: 62, height: 62)
.paddingSymmetrical(24.h, 0.h); .paddingSymmetrical(24.h, 0.h);

@ -1,7 +1,10 @@
import 'dart:convert';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.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_export.dart'; import 'package:hmg_patient_app_new/core/app_export.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/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/validation_utils.dart'; import 'package:hmg_patient_app_new/core/utils/validation_utils.dart';
@ -11,10 +14,10 @@ import 'package:hmg_patient_app_new/features/authentication/authentication_view_
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_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/lab/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/presentation/my_family/widget/family_cards.dart'; import 'package:hmg_patient_app_new/presentation/my_family/widget/family_cards.dart';
import 'package:hmg_patient_app_new/services/dialog_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/appbar/app_bar_widget.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.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/common_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart';
@ -48,100 +51,75 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( AppState appState = getIt.get<AppState>();
body: CollapsingListView( return CollapsingListView(
title: "My Medical File".needTranslation, title: "My Medical File".needTranslation,
child: Column( bottomChild: appState.getAuthenticatedUser()!.isParentUser!
mainAxisSize: MainAxisSize.min, ? Container(
crossAxisAlignment: CrossAxisAlignment.start, decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
children: [ color: AppColors.whiteColor,
CustomTabBar( customBorder: BorderRadius.only(topLeft: Radius.circular(24), topRight: Radius.circular(24)),
tabs: tabs,
onTabChange: (index) {
medicalVM!.onFamilyFileTabChange(index);
},
), ),
SizedBox(height: 25.h), padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 20.h),
Consumer<MedicalFileViewModel>(builder: (context, medicalVM, child) => getFamilyTabs(index: medicalVM.getSelectedFamilyFileTabIndex)), child: CustomButton(
SizedBox(height: 20.h), text: "Add a new family member".needTranslation,
], onPressed: () {
).paddingSymmetrical(20, 0)), DialogService dialogService = getIt.get<DialogService>();
bottomSheet: Container( dialogService.showAddFamilyFileSheet(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( label: "Add Family Member".needTranslation,
color: AppColors.whiteColor, message: "Please fill the below field to add a new family member to your profile".needTranslation,
customBorder: BorderRadius.only(topLeft: Radius.circular(24), topRight: Radius.circular(24)), onVerificationPress: () {
medicalVM?.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms, isExcludedUser: true);
});
},
icon: AppAssets.add_icon,
height: 56.h,
fontWeight: FontWeight.w600))
: SizedBox(),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomTabBar(
tabs: tabs,
onTabChange: (index) {
medicalVM!.onFamilyFileTabChange(index);
},
), ),
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 20.h), SizedBox(height: 25.h),
child: CustomButton( Consumer<MedicalFileViewModel>(builder: (context, medicalVM, child) => getFamilyTabs(index: medicalVM.getSelectedFamilyFileTabIndex)),
text: "Add a new family member", SizedBox(height: 20.h),
onPressed: () { ],
showModelSheet(); ).paddingSymmetrical(20, 0),
},
icon: AppAssets.add_icon,
height: 56.h,
fontWeight: FontWeight.w600)),
); );
// return Scaffold(
// backgroundColor: AppColors.scaffoldBgColor,
// appBar: CustomAppBar(
// onBackPressed: () {
// Navigator.of(context).pop();
// },
// onLanguageChanged: (lang) {},
// hideLogoAndLang: true,
// ),
// body: SingleChildScrollView(
// child: Column(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// LocaleKeys.myMedicalFile.tr().toText26(color: AppColors.textColor, weight: FontWeight.w600, letterSpacing: -2),
// SizedBox(height: 25.h),
// CustomTabBar(
// tabs: tabs,
// onTabChange: (index) {
// medicalVM!.onFamilyFileTabChange(index);
// },
// ),
// SizedBox(height: 25.h),
// Consumer<MedicalFileViewModel>(builder: (context, medicalVM, child) => getFamilyTabs(index: medicalVM.getSelectedFamilyFileTabIndex)),
// SizedBox(height: 20.h),
// ],
// ).paddingSymmetrical(20, 0),
// ),
// bottomSheet: Container(
// decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
// color: AppColors.whiteColor,
// customBorder: BorderRadius.only(topLeft: Radius.circular(24), topRight: Radius.circular(24)),
// ),
// padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 20.h),
// child: CustomButton(
// text: "Add a new family member",
// onPressed: () {
// showModelSheet();
// },
// icon: AppAssets.add_icon,
// height: 56.h,
// fontWeight: FontWeight.w600,
// )),
// );
} }
Widget getFamilyTabs({required int index}) { Widget getFamilyTabs({required int index}) {
switch (index) { switch (index) {
case 0: case 0:
print(jsonEncode(medicalVM!.patientFamilyFiles));
return FamilyCards( return FamilyCards(
profiles: medicalVM!.patientFamilyFiles, profiles: medicalVM!.patientFamilyFiles,
onSelect: (FamilyFileResponseModelLists profile) { onSelect: (FamilyFileResponseModelLists profile) {
medicalVM!.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber); medicalVM!.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber);
}, },
onRemove: (FamilyFileResponseModelLists profile) {
medicalVM!.removeFileFromFamilyMembers(id: profile.id);
},
isLeftAligned: true,
isShowDetails: true, isShowDetails: true,
isShowRemoveButton: true,
); );
case 1: case 1:
print(jsonEncode(medicalVM!.pendingFamilyFiles));
return FamilyCards( return FamilyCards(
profiles: medicalVM!.pendingFamilyFiles, profiles: medicalVM!.pendingFamilyFiles,
isRequestDesign: true,
onSelect: (FamilyFileResponseModelLists profile) { onSelect: (FamilyFileResponseModelLists profile) {
// medicalVM!.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber); medicalVM!.acceptRejectFileFromFamilyMembers(id: profile.id, status: 3);
},
onRemove: (FamilyFileResponseModelLists profile) {
medicalVM!.acceptRejectFileFromFamilyMembers(id: profile.id, status: 4);
}, },
isShowDetails: true, isShowDetails: true,
); );
@ -149,85 +127,4 @@ class _FamilyMedicalScreenState extends State<FamilyMedicalScreen> {
return SizedBox.shrink(); return SizedBox.shrink();
} }
} }
Future<void> showModelSheet() async {
AuthenticationViewModel authVm = getIt.get<AuthenticationViewModel>();
return await showCommonBottomSheetWithoutHeight(context,
title: "Add Family Member",
useSafeArea: true,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
"Please fill the below field to add a new family member to your profile".toText16(color: AppColors.textColor, weight: FontWeight.w500),
SizedBox(height: 20.h),
Container(
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(24)),
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h),
child: Column(
children: [
CustomCountryDropdown(
countryList: CountryEnum.values,
onCountryChange: authVm.onCountryChange,
).paddingOnly(top: 8.h, bottom: 16.h),
Divider(height: 1.h, color: AppColors.spacerLineColor),
TextInputWidget(
labelText: LocaleKeys.nationalIdNumber.tr(),
hintText: "xxxxxxxxx",
controller: authVm.nationalIdController,
// focusNode: _nationalIdFocusNode,
isEnable: true,
prefix: null,
isAllowRadius: true,
isBorderAllowed: false,
isAllowLeadingIcon: true,
autoFocus: true,
keyboardType: TextInputType.number,
padding: EdgeInsets.symmetric(vertical: 8.h),
leadingIcon: AppAssets.student_card,
).paddingOnly(top: 8.h, bottom: 8.h),
Divider(height: 1.h, color: AppColors.spacerLineColor),
TextInputWidget(
labelText: LocaleKeys.phoneNumber.tr(),
hintText: "",
controller: authVm.phoneNumberController,
isEnable: true,
prefix: authVm.selectedCountrySignup.countryCode,
isAllowRadius: true,
isBorderAllowed: false,
isAllowLeadingIcon: true,
autoFocus: true,
keyboardType: TextInputType.number,
padding: EdgeInsets.symmetric(vertical: 8.h),
leadingIcon: AppAssets.smart_phone,
).paddingOnly(top: 8.h, bottom: 4.h),
],
),
),
SizedBox(height: 20.h),
CustomButton(
text: "Verify the member",
onPressed: () {
FocusScope.of(context).unfocus();
if (ValidationUtils.isValidatedIdAndPhoneWithCountryValidation(
nationalId: authVm.nationalIdController.text,
selectedCountry: authVm.selectedCountrySignup,
phoneNumber: authVm.phoneNumberController.text,
onOkPress: () {
Navigator.of(context).pop();
},
)) {
// authVm.addFamilyMember(otpTypeEnum: OTPTypeEnum.sms, isExcludedUser: true);
medicalVM?.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms, isExcludedUser: true);
}
},
icon: AppAssets.add_icon,
height: 56.h,
fontWeight: FontWeight.w600),
SizedBox(height: 20.h),
],
),
callBackFunc: () {});
}
} }

@ -17,10 +17,23 @@ import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart';
class FamilyCards extends StatefulWidget { class FamilyCards extends StatefulWidget {
final List<FamilyFileResponseModelLists> profiles; final List<FamilyFileResponseModelLists> profiles;
final Function(FamilyFileResponseModelLists) onSelect; final Function(FamilyFileResponseModelLists) onSelect;
final Function(FamilyFileResponseModelLists) onRemove;
final bool isShowDetails; final bool isShowDetails;
final bool isBottomSheet; final bool isBottomSheet;
final bool isRequestDesign;
final bool isLeftAligned;
final bool isShowRemoveButton;
const FamilyCards({super.key, required this.profiles, required this.onSelect, this.isShowDetails = false, this.isBottomSheet = false}); const FamilyCards(
{super.key,
required this.profiles,
required this.onSelect,
required this.onRemove,
this.isShowDetails = false,
this.isBottomSheet = false,
this.isRequestDesign = false,
this.isLeftAligned = false,
this.isShowRemoveButton = false});
@override @override
State<FamilyCards> createState() => _FamilyCardsState(); State<FamilyCards> createState() => _FamilyCardsState();
@ -29,91 +42,315 @@ class FamilyCards extends StatefulWidget {
class _FamilyCardsState extends State<FamilyCards> { class _FamilyCardsState extends State<FamilyCards> {
AppState appState = getIt<AppState>(); AppState appState = getIt<AppState>();
// bool isShowActions = true;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GridView.builder( if (widget.isRequestDesign) {
shrinkWrap: true, return Column(
physics: NeverScrollableScrollPhysics(), children: [
itemCount: widget.profiles.length, Row(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( children: [
crossAxisCount: 2, Utils.buildSvgWithAssets(icon: AppAssets.alertSquare),
crossAxisSpacing: 10.h, SizedBox(width: 8.h),
mainAxisSpacing: 10.h, "Sent Requests".needTranslation.toText14(color: AppColors.textColor, isUnderLine: true, weight: FontWeight.w500),
childAspectRatio: widget.isShowDetails ? 0.56.h : 0.74.h, SizedBox(width: 4.h),
), Utils.buildSvgWithAssets(icon: AppAssets.arrowRight),
padding: EdgeInsets.only(bottom: 80.h), ],
itemBuilder: (context, index) { ),
final profile = widget.profiles[index]; SizedBox(height: 24.h),
final isActive = (profile.responseId == appState.getAuthenticatedUser()?.patientId); ListView.builder(
return Container( shrinkWrap: true,
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.h), physics: NeverScrollableScrollPhysics(),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24), padding: EdgeInsets.zero,
child: Opacity( itemCount: widget.profiles.where((profile) => profile.isRequestFromMySide ?? false).length,
opacity: isActive || profile.status == FamilyFileEnum.pending.toInt ? 0.4 : 1.0, // Fade all content if active itemBuilder: (context, index) {
child: Column( final mySideProfiles = widget.profiles.where((profile) => profile.isRequestFromMySide ?? false).toList();
mainAxisSize: MainAxisSize.min, FamilyFileResponseModelLists profile = mySideProfiles[index];
children: [
SizedBox(height: 5.h), return Container(
Utils.buildImgWithAssets( margin: EdgeInsets.only(
icon: profile.gender == null bottom: 12.h,
? AppAssets.dummy_user ),
: profile.gender == 1 padding: EdgeInsets.symmetric(
? ((profile.age ?? 0) < 7 ? AppAssets.babyBoyImg : AppAssets.male_img) vertical: 15.h,
: (profile.age! < 7 ? AppAssets.babyGirlImg : AppAssets.femaleImg), horizontal: 15.h,
width: 80.h, ),
height: 78.h), decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24),
SizedBox(height: 8.h), child: Opacity(
(profile.patientName ?? "Unknown").toText16(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600), opacity: 1.0,
SizedBox(height: 4.h), child: Column(
CustomChipWidget( mainAxisSize: MainAxisSize.min,
chipType: ChipTypeEnum.alert, crossAxisAlignment: CrossAxisAlignment.start,
backgroundColor: AppColors.lightGrayBGColor, mainAxisAlignment: MainAxisAlignment.start,
chipText: "Relation: ${profile.relationship ?? "N/A"}", children: [
iconAsset: AppAssets.heart, CustomChipWidget(
isShowBorder: false, height: 30.h,
borderRadius: 8.h, chipType: ChipTypeEnum.alert,
textColor: AppColors.textColor), backgroundColor: profile.status == FamilyFileEnum.pending.toInt
widget.isShowDetails ? SizedBox(height: 4.h) : SizedBox(), ? AppColors.alertLightColor.withValues(alpha: 0.20)
widget.isShowDetails : profile.status == FamilyFileEnum.rejected.toInt
? CustomChipWidget( ? AppColors.primaryRedColor.withValues(alpha: 0.20)
: profile.status == FamilyFileEnum.active.toInt
? AppColors.lightGreenColor
: AppColors.lightGrayBGColor,
chipText: profile.statusDescription ?? "N/A",
iconAsset: null,
isShowBorder: false,
borderRadius: 8.h,
textColor: profile.status == FamilyFileEnum.pending.toInt
? AppColors.alertLightColor
: profile.status == FamilyFileEnum.rejected.toInt
? AppColors.primaryRedColor
: profile.status == FamilyFileEnum.active.toInt
? AppColors.textGreenColor
: AppColors.alertColor,
),
Wrap(
alignment: WrapAlignment.start,
children: [
(profile.patientName ?? "").toText16(
isBold: false,
isCenter: true,
maxlines: 1,
weight: FontWeight.w600,
),
("has ${(profile.statusDescription ?? "").toLowerCase()} your family member request").toText14(
isBold: false,
isCenter: true,
maxlines: 1,
weight: FontWeight.w500,
color: AppColors.greyTextColor,
),
],
),
SizedBox(height: 4.h),
CustomChipWidget(
height: 30.h,
chipType: ChipTypeEnum.alert, chipType: ChipTypeEnum.alert,
backgroundColor: AppColors.lightGrayBGColor, backgroundColor: AppColors.lightGrayBGColor,
chipText: "Age: ${profile.age ?? "N/A"} Years", chipText: "Medical File: ${profile.responseId ?? "N/A"}",
iconAsset: null,
isShowBorder: false, isShowBorder: false,
borderRadius: 8.h, borderRadius: 8.h,
textColor: AppColors.textColor, textColor: AppColors.textColor,
) ),
: SizedBox(), ],
widget.isShowDetails ? SizedBox(height: 8.h) : SizedBox(), ),
Spacer(), ),
if (isActive) );
CustomButton( },
height: 40.h, ),
onPressed: () {}, SizedBox(height: 20.h),
text: LocaleKeys.active.tr(), if (widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).isNotEmpty)
backgroundColor: Colors.grey.shade200, Row(
borderColor: Colors.grey.shade200, children: [
textColor: AppColors.greyTextColor, Utils.buildSvgWithAssets(icon: AppAssets.alertSquare),
fontSize: 13.h, SizedBox(width: 8.h),
).paddingOnly(top: 0, bottom: 0) "Users who want to view your profile".needTranslation.toText14(color: AppColors.textColor, isUnderLine: true, weight: FontWeight.w500),
else SizedBox(width: 4.h),
CustomButton( Utils.buildSvgWithAssets(icon: AppAssets.arrowRight),
height: 40.h,
onPressed: () => widget.onSelect(profile),
text: LocaleKeys.switchAccount.tr(),
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
fontSize: 13.h,
icon: widget.isBottomSheet ? null : AppAssets.switch_user,
iconColor: AppColors.primaryRedColor,
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0),
).paddingOnly(top: 0, bottom: 0),
], ],
), ),
// Items for second group (requests from others)
ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).length,
itemBuilder: (context, index) {
final otherProfiles = widget.profiles.where((profile) => !(profile.isRequestFromMySide ?? false)).toList();
FamilyFileResponseModelLists profile = otherProfiles[index];
return Container(
margin: EdgeInsets.only(bottom: 12.h),
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24),
child: Opacity(
opacity: 1.0,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
CustomChipWidget(
height: 30.h,
chipType: ChipTypeEnum.alert,
backgroundColor: profile.status == FamilyFileEnum.pending.toInt
? AppColors.alertLightColor.withValues(alpha: 0.20)
: profile.status == FamilyFileEnum.rejected.toInt
? AppColors.primaryRedColor.withValues(alpha: 0.20)
: profile.status == FamilyFileEnum.active.toInt
? AppColors.lightGreenColor
: AppColors.lightGrayBGColor,
chipText: profile.statusDescription ?? "N/A",
iconAsset: null,
isShowBorder: false,
borderRadius: 8.h,
textColor: profile.status == FamilyFileEnum.pending.toInt
? AppColors.alertLightColor
: profile.status == FamilyFileEnum.rejected.toInt
? AppColors.primaryRedColor
: profile.status == FamilyFileEnum.active.toInt
? AppColors.textGreenColor
: AppColors.alertColor,
),
Wrap(
alignment: WrapAlignment.start,
children: [
(profile.patientName ?? "").toText16(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600),
(profile.status == FamilyFileEnum.active.toInt ? "can view your family".needTranslation : "wants to add you as their family member".needTranslation).toText14(
isBold: false,
isCenter: true,
maxlines: 1,
weight: FontWeight.w500,
color: AppColors.greyTextColor,
),
],
),
SizedBox(height: 4.h),
CustomChipWidget(
height: 30.h,
chipType: ChipTypeEnum.alert,
backgroundColor: AppColors.lightGrayBGColor,
chipText: "Medical File: ${profile.patientId ?? "N/A".needTranslation}",
iconAsset: null,
isShowBorder: false,
borderRadius: 8.h,
textColor: AppColors.textColor,
),
SizedBox(height: 16.h),
Row(
children: [
profile.status == FamilyFileEnum.active.toInt
? SizedBox()
: Expanded(
child: CustomButton(
height: 40.h,
text: LocaleKeys.confirm.tr(),
onPressed: () {
widget.onSelect(profile);
},
backgroundColor: AppColors.lightGreenButtonColor,
borderColor: AppColors.lightGreenButtonColor,
textColor: AppColors.textGreenColor,
icon: null,
),
),
profile.status == FamilyFileEnum.active.toInt ? SizedBox() : SizedBox(width: 8.h),
Expanded(
child: CustomButton(
height: 40.h,
text: profile.status == FamilyFileEnum.active.toInt ? LocaleKeys.removeMember.tr() : LocaleKeys.cancel.tr(),
onPressed: () {
widget.onRemove(profile);
},
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
icon: null,
iconColor: AppColors.primaryRedColor,
),
),
],
),
],
),
),
);
},
), ),
); ],
}, );
); } else {
return GridView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: widget.profiles.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 10.h,
mainAxisSpacing: 10.h,
childAspectRatio: widget.isShowDetails ? 0.56.h : 0.66.h,
),
padding: EdgeInsets.only(bottom: 20.h),
itemBuilder: (context, index) {
final profile = widget.profiles[index];
final isActive = (profile.responseId == appState.getAuthenticatedUser()?.patientId);
final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false;
final canSwitch = isParentUser || (!isParentUser && profile.responseId == appState.getSuperUserID);
return Container(
padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24),
child: Opacity(
opacity: isActive || profile.status == FamilyFileEnum.pending.toInt || !canSwitch ? 0.4 : 1.0, // Fade all content if active
child: Stack(
children: [
Column(
mainAxisSize: MainAxisSize.min,
children: [
Utils.buildImgWithAssets(
icon: profile.gender == null
? AppAssets.dummy_user
: profile.gender == 1
? ((profile.age ?? 0) < 7 ? AppAssets.babyBoyImg : AppAssets.male_img)
: (profile.age! < 7 ? AppAssets.babyGirlImg : AppAssets.femaleImg),
width: 80.h,
height: 78.h),
SizedBox(height: 8.h),
(profile.patientName ?? "Unknown").toText16(isBold: false, isCenter: true, maxlines: 1, weight: FontWeight.w600),
SizedBox(height: 4.h),
CustomChipWidget(
chipType: ChipTypeEnum.alert,
backgroundColor: AppColors.lightGrayBGColor,
chipText: "Relation:${profile.relationship ?? "N/A"}",
iconAsset: AppAssets.heart,
isShowBorder: false,
borderRadius: 8.h,
textColor: AppColors.textColor),
widget.isShowDetails ? SizedBox(height: 4.h) : SizedBox(),
widget.isShowDetails
? CustomChipWidget(
chipType: ChipTypeEnum.alert,
backgroundColor: AppColors.lightGrayBGColor,
chipText: "Age:${profile.age ?? "N/A"} Years",
isShowBorder: false,
borderRadius: 8.h,
textColor: AppColors.textColor,
)
: SizedBox(),
widget.isShowDetails ? SizedBox(height: 8.h) : SizedBox(),
Spacer(),
CustomButton(
height: 40.h,
onPressed: () {
if (canSwitch) widget.onSelect(profile);
},
text: isActive ? "Active".needTranslation : "Switch".needTranslation,
backgroundColor: isActive || !canSwitch ? Colors.grey.shade200 : AppColors.secondaryLightRedColor,
borderColor: isActive || !canSwitch ? Colors.grey.shade200 : AppColors.secondaryLightRedColor,
textColor: isActive || !canSwitch ? AppColors.greyTextColor : AppColors.primaryRedColor,
fontSize: 13.h,
icon: isActive ? AppAssets.activeCheck : AppAssets.switch_user,
iconColor: isActive || !canSwitch ? (isActive ? null : AppColors.greyTextColor) : AppColors.primaryRedColor,
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0),
).paddingOnly(top: 0, bottom: 0),
],
),
if (widget.isShowRemoveButton) ...[
Positioned(
top: 0,
right: 0,
child: Utils.buildSvgWithAssets(icon: AppAssets.deleteIcon).onPress(() {
if (!isActive) widget.onRemove(profile);
}),
),
],
],
),
),
);
},
);
}
} }
} }

@ -7,7 +7,7 @@ import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
class MyFamilySheet { class MyFamilySheet {
static Future<void> show(BuildContext context, List<FamilyFileResponseModelLists> familyLists, Function(FamilyFileResponseModelLists) onSelect) async { static Future<void> show(BuildContext context, List<FamilyFileResponseModelLists> familyLists, Function(FamilyFileResponseModelLists) onSelect) async {
return await showCommonBottomSheetWithoutHeight( return showCommonBottomSheetWithoutHeight(
context, context,
titleWidget: Column( titleWidget: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -22,6 +22,7 @@ class MyFamilySheet {
Navigator.of(context).pop(); // Close the bottom sheet Navigator.of(context).pop(); // Close the bottom sheet
onSelect(profile); // Call the onSelect callback onSelect(profile); // Call the onSelect callback
}, },
onRemove: (profile) {},
isBottomSheet: true), isBottomSheet: true),
callBackFunc: () {}, callBackFunc: () {},
); );

@ -1,16 +1,25 @@
import 'dart:convert';
import 'dart:developer';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_swiper_view/flutter_swiper_view.dart'; import 'package:flutter_swiper_view/flutter_swiper_view.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_export.dart'; import 'package:hmg_patient_app_new/core/app_export.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/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/int_extensions.dart'; import 'package:hmg_patient_app_new/extensions/int_extensions.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/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart'; import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart';
import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart'; import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart';
import 'package:hmg_patient_app_new/presentation/habib_wallet/habib_wallet_page.dart'; import 'package:hmg_patient_app_new/presentation/habib_wallet/habib_wallet_page.dart';
import 'package:hmg_patient_app_new/presentation/habib_wallet/recharge_wallet_page.dart'; import 'package:hmg_patient_app_new/presentation/habib_wallet/recharge_wallet_page.dart';
import 'package:hmg_patient_app_new/services/dialog_service.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.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/app_language_change.dart'; import 'package:hmg_patient_app_new/widgets/app_language_change.dart';
@ -48,6 +57,7 @@ class _ProfileSettingsState extends State<ProfileSettings> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final MedicalFileViewModel medicalFileViewModel = getIt.get<MedicalFileViewModel>();
return CollapsingListView( return CollapsingListView(
title: "Profile & Settings".needTranslation, title: "Profile & Settings".needTranslation,
logout: () {}, logout: () {},
@ -57,11 +67,12 @@ class _ProfileSettingsState extends State<ProfileSettings> {
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
child: Consumer<ProfileSettingsViewModel>( child: Consumer<ProfileSettingsViewModel>(
builder: (context, model, child) { builder: (context, model, child) {
print(jsonEncode(medicalFileViewModel.patientFamilyFiles));
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Swiper( Swiper(
itemCount: length, itemCount: medicalFileViewModel.patientFamilyFiles.length,
layout: SwiperLayout.STACK, layout: SwiperLayout.STACK,
loop: true, loop: true,
itemWidth: MediaQuery.of(context).size.width - 42, itemWidth: MediaQuery.of(context).size.width - 42,
@ -75,7 +86,21 @@ class _ProfileSettingsState extends State<ProfileSettings> {
builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor), builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor),
), ),
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return FamilyCardWidget().paddingOnly(right: 16); return FamilyCardWidget(
profile: medicalFileViewModel.patientFamilyFiles[index],
onAddFamilyMemberPress: () {
DialogService dialogService = getIt.get<DialogService>();
dialogService.showAddFamilyFileSheet(
label: "Add Family Member".needTranslation,
message: "Please fill the below field to add a new family member to your profile".needTranslation,
onVerificationPress: () {
medicalFileViewModel.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms, isExcludedUser: true);
});
},
onFamilySwitchPress: (FamilyFileResponseModelLists profile) {
medicalFileViewModel.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber);
},
).paddingOnly(right: 16);
}, },
), ),
GridView( GridView(
@ -224,16 +249,20 @@ class _ProfileSettingsState extends State<ProfileSettings> {
} }
class FamilyCardWidget extends StatelessWidget { class FamilyCardWidget extends StatelessWidget {
FamilyCardWidget(); final Function() onAddFamilyMemberPress;
final Function(FamilyFileResponseModelLists member) onFamilySwitchPress;
final FamilyFileResponseModelLists profile;
const FamilyCardWidget({required this.onAddFamilyMemberPress, required this.profile, required this.onFamilySwitchPress(FamilyFileResponseModelLists member)});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppState appState = getIt.get<AppState>();
final isActive = (profile.responseId == appState.getAuthenticatedUser()?.patientId);
final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false;
final canSwitch = isParentUser || (!isParentUser && profile.responseId == appState.getSuperUserID);
return Container( return Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true),
color: AppColors.whiteColor,
borderRadius: 20.h,
hasShadow: true,
),
child: Column( child: Column(
children: [ children: [
Column( Column(
@ -243,16 +272,16 @@ class FamilyCardWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
spacing: 8.h, spacing: 8.h,
children: [ children: [
Image.asset(true ? AppAssets.male_img : AppAssets.femaleImg, width: 56.h, height: 56.h), Image.asset((profile.gender == 1) ? AppAssets.male_img : AppAssets.femaleImg, width: 56.h, height: 56.h),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
spacing: 0.h, spacing: 0.h,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
"Mahmoud Shrouf Shrouf".toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1), (profile.patientName ?? "").toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1),
AppCustomChipWidget( AppCustomChipWidget(
icon: AppAssets.file_icon, icon: AppAssets.file_icon,
labelText: "File no: 3423443", labelText: "File no: ${profile.patientId}",
iconSize: 14, iconSize: 14,
), ),
], ],
@ -266,11 +295,11 @@ class FamilyCardWidget extends StatelessWidget {
alignment: WrapAlignment.start, alignment: WrapAlignment.start,
spacing: 8.h, spacing: 8.h,
children: [ children: [
AppCustomChipWidget(labelText: "35 Years Old"), AppCustomChipWidget(labelText: "${profile.age} Years Old"),
AppCustomChipWidget(labelText: "Blood: A+"), AppCustomChipWidget(labelText: "Blood: N/A"),
AppCustomChipWidget( AppCustomChipWidget(
icon: AppAssets.insurance_active_icon, icon: AppAssets.insurance_active_icon,
labelText: "Insurance Active", labelText: "Insurance N/A",
iconColor: AppColors.bgGreenColor, iconColor: AppColors.bgGreenColor,
iconSize: 14, iconSize: 14,
backgroundColor: AppColors.bgGreenColor.withValues(alpha: 0.15), backgroundColor: AppColors.bgGreenColor.withValues(alpha: 0.15),
@ -281,9 +310,92 @@ class FamilyCardWidget extends StatelessWidget {
], ],
).paddingOnly(top: 16, right: 16, left: 16, bottom: 12).expanded, ).paddingOnly(top: 16, right: 16, left: 16, bottom: 12).expanded,
1.divider, 1.divider,
CustomButton(icon: AppAssets.add_family, text: "Add a new family member".needTranslation, onPressed: () {}).paddingOnly(top: 12, right: 16, left: 16, bottom: 16), _buildActionButton(appState),
// if (appState.getAuthenticatedUser()!.isParentUser ?? false) ...[
// if (member!.responseId != appState.getAuthenticatedUser()!.patientId) ...[
// CustomButton(
// icon: AppAssets.switch_user,
// text: "Switch Family File".needTranslation,
// onPressed: () {
// onFamilySwitchPress(member!);
// },
// ).paddingOnly(top: 12, right: 16, left: 16, bottom: 16),
// ] else
// ...[
// CustomButton(
// icon: AppAssets.add_family,
// text: "Add a new family member".needTranslation,
// onPressed: () {
// onAddFamilyMemberPress();
// },
// ).paddingOnly(top: 12, right: 16, left: 16, bottom: 16),
// ]
// ] else
// ...[
// if (appState.getSuperUserID != null && appState.getSuperUserID == member!.responseId) ...[
// CustomButton(
// icon: AppAssets.switch_user,
// text: "Switch Back To Family File".needTranslation,
// onPressed: () {
// onFamilySwitchPress(member!);
// },
// ).paddingOnly(top: 12, right: 16, left: 16, bottom: 16),
// ] else
// ...[
// CustomButton(
// icon: AppAssets.switch_user,
// text: "Disabled".needTranslation,
// backgroundColor: Colors.grey.shade200,
// borderColor: Colors.grey.shade200,
// textColor: AppColors.greyTextColor,
// onPressed: () {},
// iconColor: AppColors.greyTextColor,
// ).paddingOnly(top: 12, right: 16, left: 16, bottom: 16),
// ]
// ]
], ],
), ),
); );
} }
Widget _buildActionButton(AppState appState) {
final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false;
final int? currentUserId = appState.getAuthenticatedUser()?.patientId;
final int? superUserId = appState.getSuperUserID;
if (isParentUser) {
return _buildParentUserButton(currentUserId);
} else {
return _buildNonParentUserButton(superUserId);
}
}
Widget _buildParentUserButton(int? currentUserId) {
final canSwitch = profile.responseId != currentUserId;
return CustomButton(
icon: canSwitch ? AppAssets.switch_user : AppAssets.add_family,
text: canSwitch ? "Switch Family File".needTranslation : "Add a new family member".needTranslation,
onPressed: canSwitch ? () => onFamilySwitchPress(profile) : onAddFamilyMemberPress,
backgroundColor: canSwitch ? AppColors.secondaryLightRedColor : AppColors.primaryRedColor,
borderColor: canSwitch ? AppColors.secondaryLightRedColor : AppColors.primaryRedColor,
textColor: canSwitch ? AppColors.primaryRedColor : AppColors.whiteColor,
iconColor: canSwitch ? AppColors.primaryRedColor : AppColors.whiteColor,
).paddingOnly(top: 12, right: 16, left: 16, bottom: 16);
}
Widget _buildNonParentUserButton(int? superUserId) {
final canSwitchBack = superUserId != null && superUserId == profile.responseId;
return CustomButton(
icon: AppAssets.switch_user,
text: canSwitchBack ? "Switch Back To Family File".needTranslation : "Switch".needTranslation,
backgroundColor: canSwitchBack ? AppColors.primaryRedColor : Colors.grey.shade200,
borderColor: canSwitchBack ? AppColors.primaryRedColor : Colors.grey.shade200,
textColor: canSwitchBack ? AppColors.whiteColor : AppColors.greyTextColor,
iconColor: canSwitchBack ? AppColors.whiteColor : AppColors.greyTextColor,
onPressed: canSwitchBack ? () => onFamilySwitchPress(profile) : () {},
).paddingOnly(top: 12, right: 16, left: 16, bottom: 16);
}
} }

@ -4,12 +4,15 @@ 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/size_utils.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/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_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/my_family/widget/family_cards.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/bottomsheet/exception_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/bottomsheet/exception_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: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/family_files/family_file_add_widget.dart';
abstract class DialogService { abstract class DialogService {
Future<void> showErrorBottomSheet({String title = "", required String message, Function()? onOkPressed, Function()? onCancelPressed}); Future<void> showErrorBottomSheet({String title = "", required String message, Function()? onOkPressed, Function()? onCancelPressed});
@ -18,7 +21,12 @@ abstract class DialogService {
Future<void> showCommonBottomSheetWithoutH({String? label, required String message, required Function() onOkPressed, Function()? onCancelPressed}); Future<void> showCommonBottomSheetWithoutH({String? label, required String message, required Function() onOkPressed, Function()? onCancelPressed});
Future<void> showFamilyBottomSheetWithoutH(
{String? label, required String message, required Function(FamilyFileResponseModelLists response) onSwitchPress, required List<FamilyFileResponseModelLists> profiles});
Future<void> showPhoneNumberPickerSheet({String? label, String? message, required Function() onSMSPress, required Function() onWhatsappPress}); Future<void> showPhoneNumberPickerSheet({String? label, String? message, required Function() onSMSPress, required Function() onWhatsappPress});
Future<void> showAddFamilyFileSheet({String? label, String? message, required Function() onVerificationPress});
// TODO : Need to be Fixed showPhoneNumberPickerSheet ( From Login ADn Signup Bottom Sheet Move Here // TODO : Need to be Fixed showPhoneNumberPickerSheet ( From Login ADn Signup Bottom Sheet Move Here
} }
@ -93,6 +101,24 @@ class DialogServiceImp implements DialogService {
title: label ?? "", child: exceptionBottomSheetWidget(context: context, message: message, onOkPressed: onOkPressed, onCancelPressed: onCancelPressed), callBackFunc: () {}); title: label ?? "", child: exceptionBottomSheetWidget(context: context, message: message, onOkPressed: onOkPressed, onCancelPressed: onCancelPressed), callBackFunc: () {});
} }
@override
Future<void> showFamilyBottomSheetWithoutH(
{String? label, required String message, required Function(FamilyFileResponseModelLists response) onSwitchPress, required List<FamilyFileResponseModelLists> profiles}) async {
final context = navigationService.navigatorKey.currentContext;
if (context == null) return;
showCommonBottomSheetWithoutHeight(context,
title: label ?? "",
child: FamilyCards(
profiles: profiles,
onSelect: (FamilyFileResponseModelLists profile) {
onSwitchPress(profile);
},
onRemove: (FamilyFileResponseModelLists profile) {},
isShowDetails: false,
),
callBackFunc: () {});
}
@override @override
Future<void> showPhoneNumberPickerSheet({String? label, String? message, required Function() onSMSPress, required Function() onWhatsappPress}) async { Future<void> showPhoneNumberPickerSheet({String? label, String? message, required Function() onSMSPress, required Function() onWhatsappPress}) async {
final context = navigationService.navigatorKey.currentContext; final context = navigationService.navigatorKey.currentContext;
@ -100,6 +126,18 @@ class DialogServiceImp implements DialogService {
showCommonBottomSheetWithoutHeight(context, showCommonBottomSheetWithoutHeight(context,
title: label ?? "", child: showPhoneNumberPickerWidget(context: context, message: message, onSMSPress: onSMSPress, onWhatsappPress: onWhatsappPress), callBackFunc: () {}); title: label ?? "", child: showPhoneNumberPickerWidget(context: context, message: message, onSMSPress: onSMSPress, onWhatsappPress: onWhatsappPress), callBackFunc: () {});
} }
@override
Future<void> showAddFamilyFileSheet({String? label, String? message, required Function() onVerificationPress}) async {
final context = navigationService.navigatorKey.currentContext;
if (context == null) return;
showCommonBottomSheetWithoutHeight(context,
title: label ?? "",
child: FamilyFileAddWidget(() {
onVerificationPress();
}, message ?? ""),
callBackFunc: () {});
}
} }
Widget exceptionBottomSheetWidget({required BuildContext context, required String message, required Function() onOkPressed, Function()? onCancelPressed}) { Widget exceptionBottomSheetWidget({required BuildContext context, required String message, required Function() onOkPressed, Function()? onCancelPressed}) {
@ -216,3 +254,12 @@ Widget showPhoneNumberPickerWidget({required BuildContext context, String? messa
// ); // );
}); });
} }
// Widget familyMemberAddWidget() {
// AuthenticationViewModel authVm = getIt.get<AuthenticationViewModel>();
// return showCommonBottomSheetWithoutHeight(context,
// title: "Add Family Member".needTranslation,
// useSafeArea: true,
// child:
// callBackFunc: () {});
// }

@ -22,10 +22,11 @@ class CollapsingListView extends StatelessWidget {
VoidCallback? logout; VoidCallback? logout;
VoidCallback? history; VoidCallback? history;
Widget? bottomChild; Widget? bottomChild;
Widget? trailing;
bool isClose; bool isClose;
bool isLeading; bool isLeading;
CollapsingListView({required this.title, this.child, this.search, this.isClose = false, this.bottomChild, this.report, this.logout, this.history, this.isLeading = true}); CollapsingListView({required this.title, this.child, this.search, this.isClose = false, this.bottomChild, this.report, this.logout, this.history, this.isLeading = true, this.trailing});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -97,7 +98,8 @@ class CollapsingListView extends StatelessWidget {
if (logout != null) actionButton(context, t, title: "Logout".needTranslation, icon: AppAssets.logout).onPress(logout!), if (logout != null) actionButton(context, t, title: "Logout".needTranslation, icon: AppAssets.logout).onPress(logout!),
if (report != null) actionButton(context, t, title: "Report".needTranslation, icon: AppAssets.report_icon).onPress(report!), if (report != null) actionButton(context, t, title: "Report".needTranslation, icon: AppAssets.report_icon).onPress(report!),
if (history != null) actionButton(context, t, title: "History".needTranslation, icon: AppAssets.insurance_history_icon).onPress(history!), if (history != null) actionButton(context, t, title: "History".needTranslation, icon: AppAssets.insurance_history_icon).onPress(history!),
if (search != null) Utils.buildSvgWithAssets(icon: AppAssets.search_icon).onPress(search!).paddingOnly(right: 24) if (search != null) Utils.buildSvgWithAssets(icon: AppAssets.search_icon).onPress(search!).paddingOnly(right: 24),
if (trailing != null) trailing!,
], ],
)), )),
), ),

@ -23,28 +23,30 @@ class CustomButton extends StatelessWidget {
final double? width; final double? width;
final double iconSize; final double iconSize;
final TextOverflow? textOverflow; final TextOverflow? textOverflow;
final BorderSide? borderSide;
CustomButton({ CustomButton(
Key? key, {Key? key,
required this.text, required this.text,
required this.onPressed, required this.onPressed,
this.backgroundColor = const Color(0xFFED1C2B), this.backgroundColor = const Color(0xFFED1C2B),
this.borderColor = const Color(0xFFED1C2B), this.borderColor = const Color(0xFFED1C2B),
this.textColor = Colors.white, this.textColor = Colors.white,
this.borderRadius = 12, this.borderRadius = 12,
this.borderWidth = 2, this.borderWidth = 2,
this.padding = const EdgeInsets.fromLTRB(8, 10, 8, 10), this.padding = const EdgeInsets.fromLTRB(8, 10, 8, 10),
this.fontSize = 16, this.fontSize = 16,
this.fontFamily, this.fontFamily,
this.fontWeight = FontWeight.w500, this.fontWeight = FontWeight.w500,
this.isDisabled = false, this.isDisabled = false,
this.icon, this.icon,
this.iconColor = Colors.white, this.iconColor = Colors.white,
this.height = 56, this.height = 56,
this.width, this.width,
this.iconSize = 24, this.iconSize = 24,
this.textOverflow, this.textOverflow,
}) : super(key: key); this.borderSide})
: super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -57,17 +59,15 @@ class CustomButton extends StatelessWidget {
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: isDisabled ? Colors.transparent : backgroundColor, color: isDisabled ? Colors.transparent : backgroundColor,
borderRadius: borderRadius, borderRadius: borderRadius,
side: BorderSide( customBorder: BorderRadius.circular(borderRadius),
width: borderWidth.h, side: borderSide ?? BorderSide(width: borderWidth.h, color: isDisabled ? borderColor.withValues(alpha: 0.5) : borderColor)),
color: isDisabled ? borderColor.withOpacity(0.5) : borderColor,
)),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
if (icon != null) if (icon != null)
Padding( Padding(
padding: const EdgeInsets.only(right: 8.0, left: 8.0), padding: EdgeInsets.only(right: 8.h, left: 8.h),
child: Utils.buildSvgWithAssets(icon: icon!, iconColor: iconColor, isDisabled: isDisabled, width: iconSize, height: iconSize), child: Utils.buildSvgWithAssets(icon: icon!, iconColor: iconColor, isDisabled: isDisabled, width: iconSize, height: iconSize),
), ),
Padding( Padding(
@ -85,17 +85,6 @@ class CustomButton extends StatelessWidget {
), ),
], ],
), ),
) ));
// .toSmoothContainer(
// smoothness: 1,
// side: BorderSide(width: borderWidth, color: backgroundColor),
// borderRadius: BorderRadius.circular(borderRadius * 1.2),
// foregroundDecoration: BoxDecoration(
// color: isDisabled ? backgroundColor.withOpacity(0.5) : Colors.transparent,
// borderRadius: BorderRadius.circular(borderRadius),
// ),
// ),
);
} }
} }

@ -17,6 +17,7 @@ class CustomChipWidget extends StatelessWidget {
final Color? textColor; final Color? textColor;
final Color? borderColor; final Color? borderColor;
final bool isShowBorder; final bool isShowBorder;
final double? height;
const CustomChipWidget({ const CustomChipWidget({
super.key, super.key,
@ -31,6 +32,7 @@ class CustomChipWidget extends StatelessWidget {
this.textColor, this.textColor,
this.borderColor, this.borderColor,
this.isShowBorder = false, this.isShowBorder = false,
this.height,
}); });
@override @override
@ -39,6 +41,7 @@ class CustomChipWidget extends StatelessWidget {
final hasOnTap = onTap != null || hasIcon; final hasOnTap = onTap != null || hasIcon;
return Container( return Container(
height: height,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(borderRadius), borderRadius: BorderRadius.circular(borderRadius),
color: isSelected ? chipType.color : backgroundColor ?? chipType.backgroundColor, color: isSelected ? chipType.color : backgroundColor ?? chipType.backgroundColor,

@ -0,0 +1,105 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.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/utils/size_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/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.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';
import 'package:hmg_patient_app_new/widgets/dropdown/country_dropdown_widget.dart';
import 'package:hmg_patient_app_new/widgets/input_widget.dart';
class FamilyFileAddWidget extends StatelessWidget {
final Function()? onVerificationPress;
final String message;
const FamilyFileAddWidget(this.onVerificationPress, this.message, {super.key});
@override
Widget build(BuildContext context) {
AuthenticationViewModel authVm = getIt.get<AuthenticationViewModel>();
MedicalFileViewModel? medicalVM = getIt.get<MedicalFileViewModel>();
// TODO: implement build
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
message.toText16(color: AppColors.textColor, weight: FontWeight.w500),
SizedBox(height: 20.h),
Container(
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(24)),
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h),
child: Column(
children: [
CustomCountryDropdown(
countryList: CountryEnum.values,
onCountryChange: authVm.onCountryChange,
).paddingOnly(top: 8.h, bottom: 16.h),
Divider(height: 1.h, color: AppColors.spacerLineColor),
TextInputWidget(
labelText: LocaleKeys.nationalIdNumber.tr(),
hintText: "xxxxxxxxx",
controller: authVm.nationalIdController,
isEnable: true,
prefix: null,
isAllowRadius: true,
isBorderAllowed: false,
isAllowLeadingIcon: true,
autoFocus: true,
keyboardType: TextInputType.number,
padding: EdgeInsets.symmetric(vertical: 8.h),
leadingIcon: AppAssets.student_card,
).paddingOnly(top: 8.h, bottom: 8.h),
Divider(height: 1.h, color: AppColors.spacerLineColor),
TextInputWidget(
labelText: LocaleKeys.phoneNumber.tr(),
hintText: "",
controller: authVm.phoneNumberController,
isEnable: true,
prefix: authVm.selectedCountrySignup.countryCode,
isAllowRadius: true,
isBorderAllowed: false,
isAllowLeadingIcon: true,
autoFocus: true,
keyboardType: TextInputType.number,
padding: EdgeInsets.symmetric(vertical: 8.h),
leadingIcon: AppAssets.smart_phone,
).paddingOnly(top: 8.h, bottom: 4.h),
],
),
),
SizedBox(height: 20.h),
CustomButton(
text: "Verify the member".needTranslation,
onPressed: () {
FocusScope.of(context).unfocus();
if (ValidationUtils.isValidatedIdAndPhoneWithCountryValidation(
nationalId: authVm.nationalIdController.text,
selectedCountry: authVm.selectedCountrySignup,
phoneNumber: authVm.phoneNumberController.text,
onOkPress: () {
Navigator.of(context).pop();
},
)) {
// authVm.addFamilyMember(otpTypeEnum: OTPTypeEnum.sms, isExcludedUser: true);
if (onVerificationPress != null) {
onVerificationPress!();
}
}
},
icon: AppAssets.add_icon,
height: 56.h,
fontWeight: FontWeight.w600),
SizedBox(height: 20.h),
],
);
}
}
Loading…
Cancel
Save