fixes and updates

pull/280/head
Sultan khan 7 hours ago
parent a9d34bc22c
commit d9b6e9fed8

@ -131,13 +131,17 @@ class CalenderUtilsNew {
print("the frequency is $frequencyNumber");
frequencyNumber ??= 2; //Some time frequency number is null so by default will be 2
int interval = calculateIntervalAsPerFrequency(frequencyNumber);
// int remainingDays = days - (Jiffy.parseFromDateTime(DateTime.now()).diff(Jiffy.parseFromDateTime(DateUtil.convertStringToDate(orderDate)), unit: Unit.day) as int);
Duration difference = (actualDate.difference(DateUtil.convertStringToDate(orderDate)));
int remainingDays = 5;
// if (remainingDays.isNegative) {
// onFailure?.call("Prescription date has been already passed you can not add a reminder for this prescription.");
// return false;
// }
// Calculate remaining days based on prescription days and order date
DateTime orderDateTime = DateUtil.convertStringToDate(orderDate);
int daysSinceOrder = DateTime.now().difference(orderDateTime).inDays;
int remainingDays = days - daysSinceOrder;
// Validate that prescription is still active
if (remainingDays <= 0) {
onFailure?.call("Prescription date has already passed. You cannot add a reminder for this prescription.");
return false;
}
bool statusOfOperation = false;
@ -156,7 +160,7 @@ class CalenderUtilsNew {
actualDate = actualDate.add(Duration(hours: interval));
// if (actualDate.difference(currentDay).inDays == 1) break;
}
// actualDate = actualDate.add(Duration(days: 1));
actualDate = actualDate.add(Duration(days: 1));
}
return statusOfOperation;

@ -262,7 +262,7 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
Expanded(
child: CollapsingListView(
title: LocaleKeys.appointmentDetails.tr(context: context),
report: AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel) || widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment! || widget.patientAppointmentHistoryResponseModel.isClinicReBookingAllowed! ==false || widget.patientAppointmentHistoryResponseModel.isActiveDoctor! == false
report: AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel) && widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment==false && widget.patientAppointmentHistoryResponseModel.isClinicReBookingAllowed! ==true && widget.patientAppointmentHistoryResponseModel.isActiveDoctor! == true
? () {
contactUsViewModel.setSelectedFeedbackType(FeedbackType(id: 1, nameEN: "Complaint for appointment", nameAR: 'شكوى على موعد'));
contactUsViewModel.setPatientFeedbackSelectedAppointment(widget.patientAppointmentHistoryResponseModel);

@ -2,6 +2,7 @@ import 'package:easy_localization/easy_localization.dart' show tr, StringTransla
import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/location_util.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
@ -27,6 +28,34 @@ class _NearestErPageState extends State<NearestErPage> {
final TextEditingController searchText = TextEditingController();
final Debouncer debouncer = Debouncer(milliseconds: 500);
@override
void initState() {
super.initState();
_checkLocationAndFetchER();
}
void _checkLocationAndFetchER() {
final emergencyServicesViewModel = context.read<EmergencyServicesViewModel>();
// Check if location utils is available and get location with permission check
if (emergencyServicesViewModel.locationUtils != null) {
emergencyServicesViewModel.locationUtils!.getLocation(
isShowConfirmDialog: true,
onSuccess: (position) {
// Location permission granted and location received
emergencyServicesViewModel.getNearestER();
},
onFailure: () {
// Location permission denied or failed, still fetch ER list without location sorting
emergencyServicesViewModel.getNearestER();
},
);
} else {
// No location utils available, just fetch the ER list
emergencyServicesViewModel.getNearestER();
}
}
@override
void dispose() {
debouncer.dispose();

@ -86,9 +86,7 @@ class _HabibWalletState extends State<HabibWalletPage> {
SizedBox(height: 4.h),
Consumer<HabibWalletViewModel>(builder: (context, habibWalletVM, child) {
return Utils.getPaymentAmountWithSymbol2(
num.parse(
NumberFormat.decimalPattern().format(habibWalletVM.habibWalletAmount),
),
habibWalletVM.habibWalletAmount,
textColor: Colors.white,
iconColor: Colors.white,
iconSize: 16,
@ -104,28 +102,30 @@ class _HabibWalletState extends State<HabibWalletPage> {
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomButton(
height: 40.h,
icon: AppAssets.recharge_icon,
iconSize: 24.w,
backgroundColor: AppColors.infoColor,
textColor: Colors.white,
text: LocaleKeys.recharge.tr(context: context),
borderWidth: 0.w,
fontWeight: FontWeight.w600,
borderColor: Colors.transparent,
padding: EdgeInsets.fromLTRB(4, 0, 12, 0),
fontSize: 14.f,
onPressed: () {
Navigator.of(context)
.push(CustomPageRoute(
page: RechargeWalletPage(),
))
.then((val) {
habibWalletVM.initHabibWalletProvider();
habibWalletVM.getPatientBalanceAmount();
});
},
Flexible(
child: CustomButton(
height: 40.h,
icon: AppAssets.recharge_icon,
iconSize: 24.w,
backgroundColor: AppColors.infoColor,
textColor: Colors.white,
text: LocaleKeys.recharge.tr(context: context),
borderWidth: 0.w,
fontWeight: FontWeight.w600,
borderColor: Colors.transparent,
padding: EdgeInsets.fromLTRB(4, 0, 12, 0),
fontSize: 14.f,
onPressed: () {
Navigator.of(context)
.push(CustomPageRoute(
page: RechargeWalletPage(),
))
.then((val) {
habibWalletVM.initHabibWalletProvider();
habibWalletVM.getPatientBalanceAmount();
});
},
),
),
],
),
@ -147,7 +147,7 @@ class _HabibWalletState extends State<HabibWalletPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: habibWalletVM.habibWalletBalanceList[index].projectDescription!.toText16(isBold: true, color: AppColors.textColor)),
Utils.getPaymentAmountWithSymbol2(num.parse(NumberFormat.decimalPattern().format(habibWalletVM.habibWalletBalanceList[index].patientAdvanceBalanceAmount!)),
Utils.getPaymentAmountWithSymbol2(habibWalletVM.habibWalletBalanceList[index].patientAdvanceBalanceAmount!, //did the changes because of negative value
textColor: AppColors.textColor, iconColor: AppColors.textColor, iconSize: 18.h, isExpanded: false, fontSize: 28.f, fontWeight: FontWeight.w600, letterSpacing: -1),
],
).paddingSymmetrical(0, 12.h);

@ -18,6 +18,7 @@ import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_v
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart';
import 'package:hmg_patient_app_new/presentation/appointments/widgets/region_bottomsheet/region_list_widget.dart';
import 'package:hmg_patient_app_new/presentation/emergency_services/nearest_er_page.dart';
import 'package:hmg_patient_app_new/presentation/symptoms_checker/widgets/condition_card.dart';
import 'package:hmg_patient_app_new/services/dialog_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
@ -92,10 +93,28 @@ class PossibleConditionsPage extends StatelessWidget {
separatorBuilder: (context, index) => SizedBox(height: 16.h),
itemBuilder: (context, index) {
final condition = conditions[index];
// Create temporary card to access severity enum
final conditionCard = ConditionCard(
condition: condition,
symptoms: symptoms,
);
return ConditionCard(
condition: condition,
symptoms: symptoms,
onActionPressed: () {
// Check if condition is Emergency - redirect to Nearest ER page
if (conditionCard.severityEnum == PossibleConditionsSeverityEnum.emergency) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => NearestErPage(),
),
);
return;
}
// For non-emergency cases, continue with normal booking flow
LoaderBottomSheet.showLoader();
symptomsCheckerViewModel.getClinicConditionsFromCategory(
categoryName: (condition.conditionDetails!.category!.name) ?? "Other",

@ -140,12 +140,10 @@ class CollapsingListView extends StatelessWidget {
// trailing: trailing,
// ),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) => child,
childCount: 1,
if (child != null)
SliverToBoxAdapter(
child: child!,
),
),
],
).expanded,
if (bottomChild != null) bottomChild!

Loading…
Cancel
Save