Merge branch 'haroon_dev' into Main_App_Replacement

# Conflicts:
#	lib/core/api_consts.dart
#	lib/features/habib_wallet/habib_wallet_view_model.dart
#	pubspec.yaml
Main_App_Replacement
Haroon Amjad 4 weeks ago
commit b2e8f5909c

@ -211,7 +211,7 @@ class ApiClientImp implements ApiClient {
}
// body['TokenID'] = "@dm!n";
// body['PatientID'] = 1307867;
// body['PatientID'] = 226077;
// body['PatientID'] = 53320;
// body['PatientTypeID'] = 1;
// body['PatientOutSA'] = 0;

@ -48,7 +48,6 @@ class ApiConsts {
switch (appEnvironmentType) {
case AppEnvironmentTypeEnum.prod:
baseUrl = "https://hmgwebservices.com/";
// baseUrl = "http://10.200.204.42/";
payFortEnvironment = FortEnvironment.production;
payFortEnvironmentType = EnvironmentType.production;
applePayMerchantId = "merchant.com.hmgwebservices";

@ -31,6 +31,7 @@ class HabibWalletViewModel extends ChangeNotifier {
num walletRechargeAmount = 0;
String notesText = "";
bool isWalletAmountToBeLoaded = false;
bool isLakumInfoToBeLoaded = false;
// ── Balance visibility (show/hide like a password field) ──────────────────
bool isWalletAmountHidden = true;
@ -55,7 +56,7 @@ class HabibWalletViewModel extends ChangeNotifier {
notifyListeners();
// On first unhide, fetch the data if not already fetched.
if (!isLakumPointsHidden && !isLakumInfoFetched) {
isWalletAmountToBeLoaded = true;
isLakumInfoToBeLoaded = true;
getLakumAccountInformation();
}
}
@ -358,6 +359,8 @@ class HabibWalletViewModel extends ChangeNotifier {
if (isWalletAmountToBeLoaded) {
isWalletAmountLoading = true;
habibWalletAmount = 0;
}
if (isLakumInfoToBeLoaded) {
isLakumAccountInfoLoading = true;
yahalaAccountNumber = "";
}
@ -429,6 +432,11 @@ class HabibWalletViewModel extends ChangeNotifier {
notifyListeners();
}
setIsLakumInfoToBeLoaded(bool value) {
isLakumInfoToBeLoaded = value;
notifyListeners();
}
String getSelectedRechargeTypeValue() {
switch (selectedRechargeType) {
case 1:
@ -571,7 +579,7 @@ class HabibWalletViewModel extends ChangeNotifier {
}
Future<void> getLakumAccountInformation({Function(dynamic)? onSuccess, Function(String)? onError}) async {
if (!isWalletAmountToBeLoaded) {
if (!isLakumInfoToBeLoaded) {
return;
}
@ -586,6 +594,8 @@ class HabibWalletViewModel extends ChangeNotifier {
(failure) async {
yahalaAccountNumber = "0";
isLakumAccountInfoLoading = false;
isLakumInfoFetched = true;
isLakumInfoToBeLoaded = false;
notifyListeners(); // 675534
},
(apiResponse) async {
@ -613,6 +623,7 @@ class HabibWalletViewModel extends ChangeNotifier {
}
isLakumAccountInfoLoading = false;
isLakumInfoFetched = true;
isLakumInfoToBeLoaded = false;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);

@ -11,7 +11,7 @@ import 'package:hmg_patient_app_new/features/insurance/models/resp_models/upload
import 'package:hmg_patient_app_new/services/logger_service.dart';
abstract class InsuranceRepo {
Future<Either<Failure, GenericApiModel<List<PatientInsuranceDetailsResponseModel>>>> getPatientInsuranceDetails();
Future<Either<Failure, GenericApiModel<List<PatientInsuranceDetailsResponseModel>>>> getPatientInsuranceDetails({bool isFromHomePage = false});
Future<Either<Failure, GenericApiModel<List<PatientInsuranceCardHistoryResponseModel>>>> getPatientInsuranceCardHistory();
@ -35,8 +35,10 @@ class InsuranceRepoImp implements InsuranceRepo {
InsuranceRepoImp({required this.loggerService, required this.apiClient});
@override
Future<Either<Failure, GenericApiModel<List<PatientInsuranceDetailsResponseModel>>>> getPatientInsuranceDetails() async {
Map<String, dynamic> mapDevice = {};
Future<Either<Failure, GenericApiModel<List<PatientInsuranceDetailsResponseModel>>>> getPatientInsuranceDetails({bool isFromHomePage = false}) async {
Map<String, dynamic> mapDevice = {
"IsFromHomePage": isFromHomePage
};
try {
GenericApiModel<List<PatientInsuranceDetailsResponseModel>>? apiResponse;

@ -32,11 +32,11 @@ class InsuranceViewModel extends ChangeNotifier {
InsuranceViewModel({required this.insuranceRepo, required this.errorHandlerService});
initInsuranceProvider() {
initInsuranceProvider({bool isFromHomePage = false}) {
if (isInsuranceDataToBeLoaded) {
patientInsuranceList.clear();
isInsuranceLoading = true;
getPatientInsuranceDetails();
getPatientInsuranceDetails(isFromHomePage: isFromHomePage);
}
patientInsuranceCardHistoryList.clear();
isInsuranceHistoryLoading = true;
@ -76,12 +76,12 @@ class InsuranceViewModel extends ChangeNotifier {
notifyListeners();
}
Future<void> getPatientInsuranceDetails({Function(dynamic)? onSuccess, Function(String)? onError}) async {
Future<void> getPatientInsuranceDetails({bool isFromHomePage = false, Function(dynamic)? onSuccess, Function(String)? onError}) async {
if (!isInsuranceDataToBeLoaded) {
return;
}
final result = await insuranceRepo.getPatientInsuranceDetails();
final result = await insuranceRepo.getPatientInsuranceDetails(isFromHomePage: isFromHomePage);
result.fold(
// (failure) async => await errorHandlerService.handleError(failure: failure),

@ -172,7 +172,10 @@ class _LandingPageState extends State<LandingPage> {
emergencyServicesViewModel.checkPatientERAdvanceBalance();
// myAppointmentsViewModel.getPatientAppointmentQueueDetails();
notificationsViewModel.initNotificationsViewModel();
insuranceViewModel.initInsuranceProvider();
if (Utils.havePrivilege(122)) {
insuranceViewModel.initInsuranceProvider(isFromHomePage: true);
}
if (!appState.isRatedVisible) {
appointmentRatingViewModel.getLastRatingAppointment(

@ -110,7 +110,7 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
appState = getIt.get<AppState>();
scheduleMicrotask(() {
if (appState.isAuthenticated) {
insuranceViewModel.initInsuranceProvider();
// insuranceViewModel.initInsuranceProvider();
// Load vital signs
hmgServicesViewModel.getPatientVitalSign();
@ -495,6 +495,9 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
medicalFileViewModel.setIsPatientMedicalReportsLoading(true);
medicalFileViewModel.getPatientMedicalReportList();
}
if (index == 2 && isExpanded) {
insuranceViewModel.initInsuranceProvider();
}
},
items: [
ExpandableListItem(

@ -76,6 +76,7 @@ class _AppLanguageChangeState extends State<AppLanguageChange> {
myAppointmentsViewModel.getPatientAppointments(true, false);
habibWalletVM.setIsWalletAmountToBeLoaded(true);
habibWalletVM.setIsLakumInfoToBeLoaded(true);
habibWalletVM.initHabibWalletProvider();
habibWalletVM.getPatientBalanceAmount();
habibWalletVM.getLakumAccountInformation();

Loading…
Cancel
Save