diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 071374e6..958a4902 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -1585,5 +1585,6 @@ "darkMode": "المظهر الداكن", "generateAiAnalysisResult": "قم بإجراء تحليل لهذا المختبر AI", "ratings": "التقييمات", - "hmgPharmacyText": "صيدلية الحبيب، المتجر الصيدلاني الإلكتروني المتكامل الذي تقدمه لكم مجموعة خدمات الدكتور سليمان الحبيب الطبية." + "hmgPharmacyText": "صيدلية الحبيب، المتجر الصيدلاني الإلكتروني المتكامل الذي تقدمه لكم مجموعة خدمات الدكتور سليمان الحبيب الطبية.", + "insuranceRequestSubmittedSuccessfully": "تم إرسال طلب تحديث بيانات التأمين بنجاح. سيتم إعلامك بمجرد الانتهاء." } diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index a76898ba..cea0082a 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -1579,5 +1579,6 @@ "darkMode": "Dark Mode", "generateAiAnalysisResult": "Generate AI analysis for this result", "ratings": "Ratings", - "hmgPharmacyText": "Al Habib Pharmacy, the complete online Pharmaceutical store brought to you by Dr. Sulaiman Al Habib Medical Services Group." + "hmgPharmacyText": "Al Habib Pharmacy, the complete online Pharmaceutical store brought to you by Dr. Sulaiman Al Habib Medical Services Group.", + "insuranceRequestSubmittedSuccessfully": "Your insurance update request has been successfully submitted. You will be notified once completed." } diff --git a/lib/core/api/api_client.dart b/lib/core/api/api_client.dart index f415d8ac..0131a938 100644 --- a/lib/core/api/api_client.dart +++ b/lib/core/api/api_client.dart @@ -200,7 +200,7 @@ class ApiClientImp implements ApiClient { } // body['TokenID'] = "@dm!n"; - // body['PatientID'] = 2007395; + // body['PatientID'] = 4774402; // body['PatientTypeID'] = 1; // body['PatientOutSA'] = 0; // body['SessionID'] = "45786230487560q"; @@ -359,7 +359,8 @@ class ApiClientImp implements ApiClient { onFailure( parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode, - failureType: ServerFailure("Error While Fetching data"), + // failureType: ServerFailure("Error While Fetching data"), + failureType: ServerFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']), ); logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } diff --git a/lib/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart index 64672f5f..5e4d4e1f 100644 --- a/lib/extensions/widget_extensions.dart +++ b/lib/extensions/widget_extensions.dart @@ -152,6 +152,7 @@ extension SmoothContainerExtension on ShapeBorder { BorderSide? side, BorderRadius? customBorder, bool hasShadow = false, + bool hasDenseShadow = false, }) { final bgColor = backgroundColor ?? color; return ShapeDecoration( @@ -161,17 +162,17 @@ extension SmoothContainerExtension on ShapeBorder { smoothness: 1, side: side ?? BorderSide.none, ), - shadows: - // hasShadow - // ? [ - // BoxShadow( - // color: const Color(0xff000000).withOpacity(.05), - // blurRadius: 32, - // offset: const Offset(0, 0), - // ) - // ] - // : - [], + shadows: hasShadow + ? [ + BoxShadow( + color: hasDenseShadow ? const Color(0xff000000).withOpacity(.30) : const Color(0xff000000).withOpacity(.1), + // color: AppColors.primaryRedColor.withOpacity(.5), + blurRadius: 10, + spreadRadius: 0, + offset: const Offset(0, 0), + ) + ] + : [], ); } } diff --git a/lib/features/insurance/insurance_view_model.dart b/lib/features/insurance/insurance_view_model.dart index 515743c6..d66a7a22 100644 --- a/lib/features/insurance/insurance_view_model.dart +++ b/lib/features/insurance/insurance_view_model.dart @@ -214,7 +214,7 @@ class InsuranceViewModel extends ChangeNotifier { (failure) async { notifyListeners(); if (onError != null) { - onError(failure.toString()); + onError(failure.message.toString()); } }, (apiResponse) { diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 951dbf90..2aeb87f1 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -1580,5 +1580,6 @@ abstract class LocaleKeys { static const generateAiAnalysisResult = 'generateAiAnalysisResult'; static const ratings = 'ratings'; static const hmgPharmacyText = 'hmgPharmacyText'; + static const insuranceRequestSubmittedSuccessfully = 'insuranceRequestSubmittedSuccessfully'; } diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index 5d068b6c..3012876f 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -331,7 +331,6 @@ class _LandingPageState extends State { ).paddingSymmetrical(24.h, 0.h).onPress(() { Navigator.of(context).push(CustomPageRoute(page: MyAppointmentsPage())); }), - SizedBox(height: 16.h), Consumer3( builder: (context, myAppointmentsVM, immediateLiveCareVM, todoSectionVM, child) { return myAppointmentsVM.isMyAppointmentsLoading @@ -348,7 +347,7 @@ class _LandingPageState extends State { isLoading: true, isFromHomePage: true, ), - ).paddingSymmetrical(24.h, 0.h) + ).paddingSymmetrical(24.h, 16.h) : myAppointmentsVM.patientAppointmentsHistoryList.isNotEmpty ? myAppointmentsVM.patientAppointmentsHistoryList.length == 1 ? Container( @@ -399,27 +398,34 @@ class _LandingPageState extends State { ), ), ) - : Swiper( - itemCount: myAppointmentsVM.isMyAppointmentsLoading - ? 3 - : myAppointmentsVM.patientAppointmentsHistoryList.length < 3 - ? myAppointmentsVM.patientAppointmentsHistoryList.length - : 3, - layout: SwiperLayout.STACK, - loop: true, - itemWidth: MediaQuery.of(context).size.width - 48.h, - indicatorLayout: PageIndicatorLayout.COLOR, - axisDirection: AxisDirection.right, - controller: _controller, - itemHeight: 255.h, - pagination: SwiperPagination( - alignment: Alignment.bottomCenter, - margin: EdgeInsets.only(top: 240.h + 8 + 24), - builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor), + : SizedBox( + height: 255.h + 20 + 30, // itemHeight + shadow padding (10 top + 10 bottom) + pagination dots space + child: Swiper( + itemCount: myAppointmentsVM.isMyAppointmentsLoading + ? 3 + : myAppointmentsVM.patientAppointmentsHistoryList.length < 3 + ? myAppointmentsVM.patientAppointmentsHistoryList.length + : 3, + layout: SwiperLayout.STACK, + loop: true, + itemWidth: MediaQuery.of(context).size.width - 48.h, + indicatorLayout: PageIndicatorLayout.COLOR, + axisDirection: AxisDirection.right, + controller: _controller, + itemHeight: 255.h + 20, + // extra space for shadow + pagination: SwiperPagination( + alignment: Alignment.bottomCenter, + margin: EdgeInsets.only(top: 220.h + 20 + 8 + 24), + builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor), + ), + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 10), + child: getIndexSwiperCard(index), + ); + }, ), - itemBuilder: (BuildContext context, int index) { - return getIndexSwiperCard(index); - }, ) : Container( width: double.infinity, @@ -451,7 +457,7 @@ class _LandingPageState extends State { ], ), ), - ).paddingSymmetrical(24.h, 0.h); + ).paddingSymmetrical(24.h, 16.h); }, ), @@ -466,7 +472,7 @@ class _LandingPageState extends State { decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 20.r, - hasShadow: true, + hasShadow: false, side: BorderSide(color: AppColors.primaryRedColor, width: 3.h), ), width: double.infinity, @@ -775,7 +781,7 @@ class _LandingPageState extends State { decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 20.h, - hasShadow: false, + hasShadow: true, side: BorderSide( color: Utils.getCardBorderColor(currentStatus), width: 2.w, @@ -1006,6 +1012,7 @@ class _LandingPageState extends State { color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true, + hasDenseShadow: true ), child: AppointmentCard( patientAppointmentHistoryResponseModel: appointment, diff --git a/lib/presentation/insurance/widgets/insurance_update_details_card.dart b/lib/presentation/insurance/widgets/insurance_update_details_card.dart index bf86671e..59a4dd97 100644 --- a/lib/presentation/insurance/widgets/insurance_update_details_card.dart +++ b/lib/presentation/insurance/widgets/insurance_update_details_card.dart @@ -9,6 +9,7 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -105,38 +106,47 @@ class PatientInsuranceCardUpdateCard extends StatelessWidget { text: "${LocaleKeys.updateInsurance.tr(context: context)} ${LocaleKeys.updateInsuranceSubtitle.tr(context: context)}", onPressed: () { LoaderBottomSheet.showLoader(); - insuranceViewModel.updatePatientInsuranceCard( - patientID: appState.getAuthenticatedUser()!.patientId!, - patientType: appState.getAuthenticatedUser()!.patientType!, - patientIdentificationID: appState.getAuthenticatedUser()!.patientIdentificationNo!, - mobileNo: appState.getAuthenticatedUser()!.mobileNumber!, - insuranceCardImage: "", - onSuccess: (val) { - LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight( - title: LocaleKeys.success.tr(context: context), - context, - child: Utils.getSuccessWidget(loadingText: LocaleKeys.success.tr(context: context)), - callBackFunc: () { + getIt().sendPatientUpdateRequest(onSuccess: (val) { + LoaderBottomSheet.hideLoader(); + insuranceViewModel.setIsInsuranceDataToBeLoaded(true); + insuranceViewModel.initInsuranceProvider(); + }, onError: (err) { + insuranceViewModel.updatePatientInsuranceCard( + patientID: appState.getAuthenticatedUser()!.patientId!, + patientType: appState.getAuthenticatedUser()!.patientType!, + patientIdentificationID: appState.getAuthenticatedUser()!.patientIdentificationNo!, + mobileNo: appState.getAuthenticatedUser()!.mobileNumber!, + insuranceCardImage: "", + onSuccess: (val) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.success.tr(context: context), + context, + child: Utils.getSuccessWidget(loadingText: LocaleKeys.insuranceRequestSubmittedSuccessfully.tr(context: context)), + callBackFunc: () { + Navigator.pop(context); + }, + isFullScreen: false, + isCloseButtonVisible: false, + ); + Future.delayed(Duration(milliseconds: 2000)).then((value) async { Navigator.pop(context); - }, - isFullScreen: false, - isCloseButtonVisible: true, - ); - }, - onError: (err) { - LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight( - title: LocaleKeys.notice.tr(context: context), - context, - child: Utils.getErrorWidget(loadingText: err.toString()), - callBackFunc: () { - Navigator.pop(context); - }, - isFullScreen: false, - isCloseButtonVisible: true, - ); - }); + }); + }, + onError: (err) { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.notice.tr(context: context), + context, + child: Utils.getErrorWidget(loadingText: err.toString()), + callBackFunc: () { + Navigator.pop(context); + }, + isFullScreen: false, + isCloseButtonVisible: true, + ); + }); + }); }, backgroundColor: insuranceViewModel.patientInsuranceUpdateResponseModel != null ? AppColors.successColor : AppColors.lightGrayBGColor, borderColor: AppColors.successColor.withOpacity(0.01), diff --git a/lib/presentation/profile_settings/profile_settings.dart b/lib/presentation/profile_settings/profile_settings.dart index 7d6af196..e975d6f4 100644 --- a/lib/presentation/profile_settings/profile_settings.dart +++ b/lib/presentation/profile_settings/profile_settings.dart @@ -98,46 +98,53 @@ class ProfileSettingsState extends State { }, isClose: true, child: SingleChildScrollView( - padding: EdgeInsets.only(top: 24.h, bottom: 24.h), + padding: EdgeInsets.only(top: 0.h, bottom: 24.h), physics: NeverScrollableScrollPhysics(), child: Consumer2( builder: (context, profileVm, medicalVm, child) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Swiper( - itemCount: medicalVm.patientFamilyFiles.length, - layout: SwiperLayout.STACK, - loop: true, - itemHeight: dynamicItemHeight(context), - itemWidth: SizeUtils.width - 30.w, - indicatorLayout: PageIndicatorLayout.COLOR, - axisDirection: AxisDirection.right, - controller: _controller, - pagination: SwiperPagination( - alignment: Alignment.bottomCenter, - margin: EdgeInsets.only(top: (210.h + 8.h + 24.h)), - builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor), + SizedBox( + height: dynamicItemHeight(context) + 20 + 30, // itemHeight + shadow padding (10 top + 10 bottom) + pagination dots space + child: Swiper( + itemCount: medicalVm.patientFamilyFiles.length, + layout: SwiperLayout.STACK, + loop: true, + itemHeight: dynamicItemHeight(context) + 20, + // extra space for shadow + itemWidth: SizeUtils.width - 30.w, + indicatorLayout: PageIndicatorLayout.COLOR, + axisDirection: AxisDirection.right, + controller: _controller, + pagination: SwiperPagination( + alignment: Alignment.bottomCenter, + margin: EdgeInsets.only(top: (180.h + 20 + 8.h + 24.h)), + builder: DotSwiperPaginationBuilder(color: Color(0xffD9D9D9), activeColor: AppColors.blackBgColor), + ), + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 10), + child: FamilyCardWidget( + profile: medicalVm.patientFamilyFiles[index], + onAddFamilyMemberPress: () { + DialogService dialogService = getIt.get(); + dialogService.showAddFamilyFileSheet( + label: LocaleKeys.addFamilyMember.tr(context: context), + message: LocaleKeys.pleaseFillBelowFieldToAddNewFamilyMember.tr(context: context), + onVerificationPress: () { + medicalVm.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms); + }); + }, + onFamilySwitchPress: (FamilyFileResponseModelLists profile) { + medicalVm.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber); + }, + ).paddingOnly(right: 16.w, left: 8.w), + ); + }, ), - itemBuilder: (BuildContext context, int index) { - return FamilyCardWidget( - profile: medicalVm.patientFamilyFiles[index], - onAddFamilyMemberPress: () { - DialogService dialogService = getIt.get(); - dialogService.showAddFamilyFileSheet( - label: LocaleKeys.addFamilyMember.tr(context: context), - message: LocaleKeys.pleaseFillBelowFieldToAddNewFamilyMember.tr(context: context), - onVerificationPress: () { - medicalVm.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms); - }); - }, - onFamilySwitchPress: (FamilyFileResponseModelLists profile) { - medicalVm.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber); - }, - ).paddingOnly(right: 16.w, left: 8.w); - }, ), - SizedBox(height: 5.h), + SizedBox(height: 16.h), GridView( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: isTablet ? 3 : 2), physics: const NeverScrollableScrollPhysics(), @@ -362,9 +369,7 @@ class FamilyCardWidget extends StatelessWidget { return Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, - borderRadius: 24.r, - hasShadow: true, - ), + borderRadius: 24.r, hasShadow: true, hasDenseShadow: true), child: Column( children: [ Column( @@ -409,10 +414,11 @@ class FamilyCardWidget extends StatelessWidget { iconColor: AppColors.primaryRedColor) : SizedBox(), Consumer(builder: (context, insuranceVM, child) { - return AppCustomChipWidget( - icon: insuranceVM.isInsuranceExpired - ? AppAssets.cancel_circle_icon - : insuranceVM.isInsuranceActive + return isActive + ? AppCustomChipWidget( + icon: insuranceVM.isInsuranceExpired + ? AppAssets.cancel_circle_icon + : insuranceVM.isInsuranceActive ? AppAssets.insurance_active_icon : AppAssets.alertSquare, labelText: insuranceVM.isInsuranceExpired @@ -468,7 +474,8 @@ class FamilyCardWidget extends StatelessWidget { ? AppColors.successColor.withOpacity(0.1) : AppColors.warningColorYellow.withOpacity(0.1), labelPadding: EdgeInsetsDirectional.only(start: -4.w, end: insuranceVM.isInsuranceActive ? 6.w : 0.w), - ).toShimmer2(isShow: insuranceVM.isInsuranceLoading); + ).toShimmer2(isShow: insuranceVM.isInsuranceLoading) + : SizedBox.shrink(); }), ], ),