From e60d2566d979a96bb079fb1bc381f354398b0067 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 9 Apr 2026 15:11:41 +0300 Subject: [PATCH 1/2] Updates --- .../lab/lab_result_via_clinic/LabResultByClinic.dart | 4 ++-- .../lab/lab_results/lab_result_details.dart | 4 ++-- lib/presentation/radiology/radiology_result_page.dart | 11 +++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart b/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart index cd1718bd..62910f47 100644 --- a/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart +++ b/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart @@ -136,7 +136,7 @@ class LabResultByClinic extends StatelessWidget { ).paddingAll(24.h), )), ), - Container( + Utils.havePrivilege(115) ? Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 24.h, @@ -183,7 +183,7 @@ class LabResultByClinic extends StatelessWidget { context.pop(); }); }), - ), + ) : SizedBox.shrink(), ], ), ); diff --git a/lib/presentation/lab/lab_results/lab_result_details.dart b/lib/presentation/lab/lab_results/lab_result_details.dart index feb1596a..fb5fd583 100644 --- a/lib/presentation/lab/lab_results/lab_result_details.dart +++ b/lib/presentation/lab/lab_results/lab_result_details.dart @@ -156,7 +156,7 @@ class _LabResultDetailsState extends State { ), ), ), - labVM.labOrderResponseByAi == null ? Container( + Utils.havePrivilege(115) ? labVM.labOrderResponseByAi == null ? Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 24.h, @@ -203,7 +203,7 @@ class _LabResultDetailsState extends State { context.pop(); }); }), - ) : SizedBox.shrink(), + ) : SizedBox.shrink() : SizedBox.shrink(), ], ); }), diff --git a/lib/presentation/radiology/radiology_result_page.dart b/lib/presentation/radiology/radiology_result_page.dart index 39a268ad..445bbd45 100644 --- a/lib/presentation/radiology/radiology_result_page.dart +++ b/lib/presentation/radiology/radiology_result_page.dart @@ -196,8 +196,7 @@ class _RadiologyResultPageState extends State { ), ), ), - radVM.radiologyAiAnalysisResponse == null - ? Container( + Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 24.h, @@ -230,7 +229,8 @@ class _RadiologyResultPageState extends State { iconSize: 20.h, ).paddingSymmetrical(24.h, 0.h) : SizedBox.shrink(), - Container( + Utils.havePrivilege(116) ? radVM.radiologyAiAnalysisResponse == null + ? Container( height: 56.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(12.r), @@ -274,11 +274,10 @@ class _RadiologyResultPageState extends State { context.pop(); }, ); - }), + }) : SizedBox.shrink() : SizedBox(height: 24.h), ], ), - ) - : SizedBox.shrink(), + ), ], ); }), From 408c0c83d9a5064ffdadba853a57595de06e76e1 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 9 Apr 2026 16:15:48 +0300 Subject: [PATCH 2/2] updates --- assets/images/svg/online_checkin_icon.svg | 5 ++ assets/langs/ar-SA.json | 3 +- assets/langs/en-US.json | 3 +- lib/core/api_consts.dart | 2 +- lib/core/app_assets.dart | 1 + lib/core/utils/utils.dart | 79 +++++++++++++++++++ lib/generated/locale_keys.g.dart | 1 + .../appointment_details_page.dart | 22 ++++-- .../widgets/appointment_card.dart | 1 + 9 files changed, 109 insertions(+), 8 deletions(-) create mode 100644 assets/images/svg/online_checkin_icon.svg diff --git a/assets/images/svg/online_checkin_icon.svg b/assets/images/svg/online_checkin_icon.svg new file mode 100644 index 00000000..4f21533f --- /dev/null +++ b/assets/images/svg/online_checkin_icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index b0d67521..4ac9878c 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -1708,5 +1708,6 @@ "profilePicture": "صورة الملف الشخصي", "aiDisclaimerRad": "سيتم مشاركة بيانات نتائج الأشعة الخاصة بك بشكل آمن مع محلل الذكاء الاصطناعي لدينا لتحليلها. يساعد هذا في توفير رؤى صحية مخصصة. هل ترغب في المتابعة؟", "sendingAskDrRequest": "جارٍ إرسال الطلب...", - "askDrRequestSentSuccess": "تم إرسال الطلب بنجاح، وسيتواصل معك الطبيب قريباً." + "askDrRequestSentSuccess": "تم إرسال الطلب بنجاح، وسيتواصل معك الطبيب قريباً.", + "onlineCheckIn24HoursOnly": "لا تتوفر خدمة تسجيل الوصول عبر الإنترنت إلا خلال 4 ساعات من موعد الحجز.لا تتوفر خدمة تسجيل الوصول عبر الإنترنت إلا خلال 4 ساعات من موعد الحجز." } diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 38ce9662..84d51a6c 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -1700,5 +1700,6 @@ "profilePicture": "Profile Picture", "aiDisclaimerRad": "Your radiology result data will be securely shared with our AI Analyzer for analysis. This helps provide personalized health insights. Do you want to proceed?", "sendingAskDrRequest": "Sending Request...", - "askDrRequestSentSuccess": "Request has been sent successfully, The doctor will get back to you soon." + "askDrRequestSentSuccess": "Request has been sent successfully, The doctor will get back to you soon.", + "onlineCheckIn24HoursOnly": "Online Check-In is only available within 4 hours of the appointment time." } diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index 2b5abbe9..bf9144fa 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -4,7 +4,7 @@ import 'package:hmg_patient_app_new/core/enums.dart'; class ApiConsts { static const maxSmallScreen = 660; - static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.preProd; + static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod; // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT diff --git a/lib/core/app_assets.dart b/lib/core/app_assets.dart index 5adc0cd5..8c57598e 100644 --- a/lib/core/app_assets.dart +++ b/lib/core/app_assets.dart @@ -361,6 +361,7 @@ class AppAssets { static const String open_camera = '$svgBasePath/open_camera.svg'; static const String gallery = '$svgBasePath/gallery.svg'; static const String files = '$svgBasePath/files.svg'; + static const String online_checkin_icon = '$svgBasePath/online_checkin_icon.svg'; // PNGS // static const String hmgLogo = '$pngBasePath/hmg_logo.png'; diff --git a/lib/core/utils/utils.dart b/lib/core/utils/utils.dart index feca055a..ac7af39d 100644 --- a/lib/core/utils/utils.dart +++ b/lib/core/utils/utils.dart @@ -404,6 +404,85 @@ class Utils { ).center; } + static Widget getOnlineCheckInWidget({ + String? loadingText, + bool isShowActionButtons = false, + bool showOkButton = false, + Widget? bodyWidget, + Function? onConfirmTap, + Function? onCancelTap, + String? cancelText, + String? confirmText, + }) { + return Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Utils.buildSvgWithAssets(icon: AppAssets.online_checkin_icon, width: 80.h, height: 80.h, applyThemeColor: false), + SizedBox(height: 16.h), + (loadingText ?? LocaleKeys.loadingText.tr()).toText16(color: AppColors.blackColor, letterSpacing: 0, weight: FontWeight.w600), + SizedBox(height: 16.h), + bodyWidget ?? SizedBox.shrink(), + SizedBox(height: 16.h), + isShowActionButtons + ? Row( + children: [ + Expanded( + child: CustomButton( + text: cancelText ?? LocaleKeys.cancel.tr(), + onPressed: () { + if (onCancelTap != null) { + onCancelTap(); + } + }, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + // icon: AppAssets.cancel, + // iconColor: AppColors.whiteColor, + ), + ), + SizedBox(width: 8.h), + Expanded( + child: CustomButton( + text: confirmText ?? LocaleKeys.confirm.tr(), + onPressed: () async { + if (onConfirmTap != null) { + onConfirmTap(); + } + }, + backgroundColor: AppColors.bgGreenColor, + borderColor: AppColors.bgGreenColor, + textColor: Colors.white, + // icon: AppAssets.confirm, + ), + ), + ], + ) + : showOkButton + ? Row( + children: [ + Expanded( + child: CustomButton( + text: LocaleKeys.ok.tr(), + onPressed: () async { + if (onConfirmTap != null) { + onConfirmTap(); + } + }, + backgroundColor: AppColors.bgGreenColor, + borderColor: AppColors.bgGreenColor, + textColor: Colors.white, + // icon: AppAssets.confirm, + ), + ), + ], + ) + : SizedBox.shrink(), + ], + ).center; + } + static Widget getWarningWidget({ String? loadingText, bool isShowActionButtons = false, diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 2c0d5194..1e9b1349 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -1699,5 +1699,6 @@ abstract class LocaleKeys { static const profilePicture = 'profilePicture'; static const sendingAskDrRequest = 'sendingAskDrRequest'; static const askDrRequestSentSuccess = 'askDrRequestSentSuccess'; + static const onlineCheckIn24HoursOnly = 'onlineCheckIn24HoursOnly'; } diff --git a/lib/presentation/appointments/appointment_details_page.dart b/lib/presentation/appointments/appointment_details_page.dart index c668ebff..c0b469b4 100644 --- a/lib/presentation/appointments/appointment_details_page.dart +++ b/lib/presentation/appointments/appointment_details_page.dart @@ -72,6 +72,8 @@ class _AppointmentDetailsPageState extends State { String mapURL = ""; + bool isAppointmentWithin4Hours = false; + @override void initState() { scheduleMicrotask(() async { @@ -81,8 +83,14 @@ class _AppointmentDetailsPageState extends State { clinicID: widget.patientAppointmentHistoryResponseModel.clinicID, projectID: widget.patientAppointmentHistoryResponseModel.projectID, appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo); + } else { + Duration difference = DateUtil.convertStringToDate(widget.patientAppointmentHistoryResponseModel.appointmentDate).difference(DateTime.now()); + if (difference.inMinutes > 240) { + isAppointmentWithin4Hours = false; + } else { + isAppointmentWithin4Hours = true; + } } - }); super.initState(); } @@ -1127,10 +1135,14 @@ class _AppointmentDetailsPageState extends State { case 90: showCommonBottomSheetWithoutHeight(context, title: LocaleKeys.onlineCheckIn.tr(context: context), - child: AppointmentCheckinBottomSheet( - patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel, - myAppointmentsViewModel: myAppointmentsViewModel, - ), + child: isAppointmentWithin4Hours + ? AppointmentCheckinBottomSheet( + patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel, + myAppointmentsViewModel: myAppointmentsViewModel, + ) + : Utils.getOnlineCheckInWidget( + loadingText: LocaleKeys.onlineCheckIn24HoursOnly.tr(context: context), + ), callBackFunc: () {}, isFullScreen: false); default: diff --git a/lib/presentation/appointments/widgets/appointment_card.dart b/lib/presentation/appointments/widgets/appointment_card.dart index 0542f76d..db08c923 100644 --- a/lib/presentation/appointments/widgets/appointment_card.dart +++ b/lib/presentation/appointments/widgets/appointment_card.dart @@ -40,6 +40,7 @@ class AppointmentCard extends StatelessWidget { final ContactUsViewModel? contactUsViewModel; final BookAppointmentsViewModel bookAppointmentsViewModel; final bool isForRate; + // bool isAppointmentWithin4Hours = false; const AppointmentCard( {super.key,