patient profile settings page integration implementation contd.

pull/67/head
haroon amjad 1 month ago
parent 5f43063f2d
commit 1af2db5c09

@ -177,7 +177,7 @@ class ApiClientImp implements ApiClient {
}
// body['TokenID'] = "@dm!n";
// body['PatientID'] = 4767477;
// body['PatientID'] = 1018977;
}
body.removeWhere((key, value) => value == null);

@ -727,7 +727,7 @@ const FAMILY_FILES= 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatu
class ApiConsts {
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

@ -12,6 +12,8 @@ class InsuranceViewModel extends ChangeNotifier {
bool isInsuranceDetailsLoading = false;
bool isInsuranceUpdateDetailsLoading = false;
bool isInsuranceDataToBeLoaded = true;
InsuranceRepo insuranceRepo;
ErrorHandlerService errorHandlerService;
@ -23,13 +25,15 @@ class InsuranceViewModel extends ChangeNotifier {
InsuranceViewModel({required this.insuranceRepo, required this.errorHandlerService});
initInsuranceProvider() {
if (isInsuranceDataToBeLoaded) {
patientInsuranceList.clear();
patientInsuranceCardHistoryList.clear();
isInsuranceLoading = true;
getPatientInsuranceDetails();
}
patientInsuranceCardHistoryList.clear();
isInsuranceHistoryLoading = true;
isInsuranceDetailsLoading = true;
isInsuranceUpdateDetailsLoading = true;
getPatientInsuranceDetails();
notifyListeners();
}
@ -48,7 +52,14 @@ class InsuranceViewModel extends ChangeNotifier {
notifyListeners();
}
setIsInsuranceDataToBeLoaded(bool val) {
isInsuranceDataToBeLoaded = val;
notifyListeners();
}
Future<void> getPatientInsuranceDetails({Function(dynamic)? onSuccess, Function(String)? onError}) async {
if (!isInsuranceDataToBeLoaded) return;
final result = await insuranceRepo.getPatientInsuranceDetails();
result.fold(
@ -62,6 +73,7 @@ class InsuranceViewModel extends ChangeNotifier {
} else if (apiResponse.messageStatus == 1) {
patientInsuranceList = apiResponse.data!;
isInsuranceLoading = false;
isInsuranceDataToBeLoaded = false;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);

@ -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/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/insurance/insurance_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/my_appointments_view_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart';
@ -61,6 +62,8 @@ class _LandingPageState extends State<LandingPage> {
late PrescriptionsViewModel prescriptionsViewModel;
final CacheService cacheService = GetIt.instance<CacheService>();
late InsuranceViewModel insuranceViewModel;
final SwiperController _controller = SwiperController();
@override
@ -81,6 +84,7 @@ class _LandingPageState extends State<LandingPage> {
myAppointmentsViewModel.getPatientAppointments(true, false);
myAppointmentsViewModel.getPatientMyDoctors();
prescriptionsViewModel.initPrescriptionsViewModel();
insuranceViewModel.initInsuranceProvider();
}
});
super.initState();
@ -92,6 +96,7 @@ class _LandingPageState extends State<LandingPage> {
NavigationService navigationService = getIt.get<NavigationService>();
myAppointmentsViewModel = Provider.of<MyAppointmentsViewModel>(context, listen: false);
prescriptionsViewModel = Provider.of<PrescriptionsViewModel>(context, listen: false);
insuranceViewModel = Provider.of<InsuranceViewModel>(context, listen: false);
return Scaffold(
backgroundColor: AppColors.bgScaffoldColor,
body: SingleChildScrollView(

@ -55,7 +55,7 @@ class PatientInsuranceCard extends StatelessWidget {
icon: isInsuranceExpired ? AppAssets.cancel_circle_icon : AppAssets.insurance_active_icon,
iconColor: isInsuranceExpired ? AppColors.primaryRedColor : AppColors.successColor,
iconSize: 13.h,
text: isInsuranceExpired ? "Insurance Expired" : "Insurance Active",
text: isInsuranceExpired ? "Insurance Expired".needTranslation : "Insurance Active".needTranslation,
onPressed: () {},
backgroundColor: isInsuranceExpired ? AppColors.primaryRedColor.withOpacity(0.15) : AppColors.successColor.withOpacity(0.15),
borderColor: isInsuranceExpired ? AppColors.primaryRedColor.withOpacity(0.01) : AppColors.successColor.withOpacity(0.01),

@ -3,12 +3,16 @@ import 'package:flutter/material.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_export.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.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/string_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/insurance/insurance_view_model.dart';
import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.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/widgets/appbar/collapsing_list_view.dart';
@ -21,6 +25,8 @@ import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart';
import 'package:provider/provider.dart';
import '../../core/dependencies.dart' show getIt;
class ProfileSettings extends StatefulWidget {
ProfileSettings({Key? key}) : super(key: key);
@ -75,7 +81,7 @@ class _ProfileSettingsState extends State<ProfileSettings> {
builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor),
),
itemBuilder: (BuildContext context, int index) {
return FamilyCardWidget().paddingOnly(right: 16);
return FamilyCardWidget(isRootUser: true).paddingOnly(right: 16);
},
),
GridView(
@ -224,10 +230,14 @@ class _ProfileSettingsState extends State<ProfileSettings> {
}
class FamilyCardWidget extends StatelessWidget {
FamilyCardWidget();
FamilyCardWidget({this.isRootUser = true, Key? key}) : super(key: key);
bool isRootUser;
late AppState appState;
@override
Widget build(BuildContext context) {
appState = getIt.get<AppState>();
return Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
@ -243,17 +253,18 @@ class FamilyCardWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 8.h,
children: [
Image.asset(true ? AppAssets.male_img : AppAssets.femaleImg, width: 56.h, height: 56.h),
Image.asset(appState.getAuthenticatedUser()?.gender == 1 ? AppAssets.male_img : AppAssets.femaleImg, width: 56.h, height: 56.h),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 0.h,
mainAxisSize: MainAxisSize.min,
children: [
"Mahmoud Shrouf Shrouf".toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1),
"${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}"
.toText18(isBold: true, weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1),
AppCustomChipWidget(
icon: AppAssets.file_icon,
labelText: "File no: 3423443",
iconSize: 14,
labelText: "${LocaleKeys.fileNo.tr(context: context)}: ${appState.getAuthenticatedUser()!.patientId}",
iconSize: 12,
),
],
).expanded,
@ -266,22 +277,52 @@ class FamilyCardWidget extends StatelessWidget {
alignment: WrapAlignment.start,
spacing: 8.h,
children: [
AppCustomChipWidget(labelText: "35 Years Old"),
AppCustomChipWidget(labelText: "Blood: A+"),
AppCustomChipWidget(labelText: "${appState.getAuthenticatedUser()!.age} Years Old"),
AppCustomChipWidget(
icon: AppAssets.insurance_active_icon,
labelText: "Insurance Active",
iconColor: AppColors.bgGreenColor,
iconSize: 14,
backgroundColor: AppColors.bgGreenColor.withValues(alpha: 0.15),
icon: AppAssets.blood_icon,
labelText: "${LocaleKeys.bloodType.tr(context: context)}: ${appState.getUserBloodGroup}",
iconColor: AppColors.primaryRedColor,
),
Consumer<InsuranceViewModel>(builder: (context, insuranceVM, child) {
return AppCustomChipWidget(
icon: insuranceVM.isInsuranceLoading
? AppAssets.cancel_circle_icon
: (DateTime.now().isAfter(
DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo),
))
? AppAssets.cancel_circle_icon
: AppAssets.insurance_active_icon,
labelText: insuranceVM.isInsuranceLoading
? "Insurance"
: (DateTime.now().isAfter(
DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo),
)
? "Insurance Expired".needTranslation
: "Insurance Active".needTranslation),
iconColor: insuranceVM.isInsuranceLoading
? AppColors.primaryRedColor
: (DateTime.now().isAfter(
DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo),
))
? AppColors.primaryRedColor
: AppColors.successColor,
iconSize: 14,
backgroundColor: insuranceVM.isInsuranceLoading
? AppColors.primaryRedColor
: (DateTime.now().isAfter(
DateUtil.convertStringToDate(insuranceVM.patientInsuranceList.first.cardValidTo),
))
? AppColors.primaryRedColor.withValues(alpha: 0.15)
: AppColors.successColor.withValues(alpha: 0.15),
).toShimmer2(isShow: insuranceVM.isInsuranceLoading);
}),
],
),
),
],
).paddingOnly(top: 16, right: 16, left: 16, bottom: 12).expanded,
1.divider,
CustomButton(icon: AppAssets.add_family, text: "Add a new family member".needTranslation, onPressed: () {}).paddingOnly(top: 12, right: 16, left: 16, bottom: 16),
CustomButton(icon: AppAssets.add_family, text: "Add a new family member".needTranslation, height: 40.h, fontSize: 14, onPressed: () {}).paddingOnly(top: 12, right: 16, left: 16, bottom: 16),
],
),
);

Loading…
Cancel
Save