haroon_dev
haroon amjad 22 hours ago
parent 9986729ba5
commit 469479d7cb

@ -1848,5 +1848,7 @@
"submitEReferral": "تقديم الطلب", "submitEReferral": "تقديم الطلب",
"redeem": "استبدال", "redeem": "استبدال",
"points": "نقاط", "points": "نقاط",
"transactions": "المعاملات" "transactions": "المعاملات",
"pharmacy": "الصيدلية",
"visitsOrders": "الزيارات/الطلبات"
} }

@ -1838,7 +1838,9 @@
"submitEReferral": "Submit", "submitEReferral": "Submit",
"redeem": "Redeem", "redeem": "Redeem",
"points": "Points", "points": "Points",
"transactions": "Transactions" "transactions": "Transactions",
"pharmacy": "Pharmacy",
"visitsOrders": "Visits/Orders"
} }

@ -99,7 +99,11 @@ class Utils {
static bool isArabicText(String inputText) { static bool isArabicText(String inputText) {
bool isArabicText = false; bool isArabicText = false;
final arabic = RegExp(r'^[\u0621-\u064A]+'); // Updated regex to include:
// - Arabic letters: \u0621-\u064A
// - Arabic numerals: \u0660-\u0669 (٠-٩)
// - Persian numerals: \u06F0-\u06F9 (۰-۹)
final arabic = RegExp(r'[\u0621-\u064A\u0660-\u0669\u06F0-\u06F9]');
if (arabic.hasMatch(inputText)) { if (arabic.hasMatch(inputText)) {
isArabicText = true; isArabicText = true;
} else { } else {

@ -1479,6 +1479,9 @@ class BookAppointmentsViewModel extends ChangeNotifier {
result.fold( result.fold(
(failure) async { (failure) async {
if(onError != null) {
onError(failure.message);
}
onError!(LocaleKeys.noDoctorFound.tr()); onError!(LocaleKeys.noDoctorFound.tr());
}, },
(apiResponse) { (apiResponse) {

@ -30,6 +30,8 @@ class MyInvoicesViewModel extends ChangeNotifier {
String? downloadInvoicePDFBase64 = ""; String? downloadInvoicePDFBase64 = "";
int selectedTabIndex = 0;
MyInvoicesViewModel({required this.myInvoicesRepo, required this.errorHandlerService, required this.navServices}); MyInvoicesViewModel({required this.myInvoicesRepo, required this.errorHandlerService, required this.navServices});
setInvoicesListLoading() { setInvoicesListLoading() {
@ -45,6 +47,11 @@ class MyInvoicesViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
void onTabChanged(int index) {
selectedTabIndex = index;
notifyListeners();
}
Future<void> getAllInvoicesList({Function(dynamic)? onSuccess, Function(String)? onError}) async { Future<void> getAllInvoicesList({Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await myInvoicesRepo.getAllInvoicesList(); final result = await myInvoicesRepo.getAllInvoicesList();

@ -1841,5 +1841,7 @@ abstract class LocaleKeys {
static const redeem = 'redeem'; static const redeem = 'redeem';
static const points = 'points'; static const points = 'points';
static const transactions = 'transactions'; static const transactions = 'transactions';
static const pharmacy = 'pharmacy';
static const visitsOrders = 'visitsOrders';
} }

@ -186,7 +186,6 @@ class LoginScreenState extends State<LoginScreen> {
constraints: BoxConstraints(maxWidth: MediaQuery.of(context).size.width), constraints: BoxConstraints(maxWidth: MediaQuery.of(context).size.width),
backgroundColor: AppColors.transparent, backgroundColor: AppColors.transparent,
child: StatefulBuilder(builder: (BuildContext context, StateSetter setModalState) { child: StatefulBuilder(builder: (BuildContext context, StateSetter setModalState) {
// Helper function to validate phone number with error handling // Helper function to validate phone number with error handling
void validatePhoneAndProceed(OTPTypeEnum otpType) { void validatePhoneAndProceed(OTPTypeEnum otpType) {
// Use ViewModel validation method // Use ViewModel validation method

@ -22,6 +22,14 @@ class ClinicCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppState appState = getIt.get<AppState>(); AppState appState = getIt.get<AppState>();
// Get clinic icon path with fallback
String getClinicIconPath() {
final clinicId = clinicsListResponseModel.clinicID ?? 1;
// Try to use specific clinic icon, fallback to default if not found
return "assets/images/clinicIcons/$clinicId.svg";
}
return Container( return Container(
padding: EdgeInsets.all(16.h), padding: EdgeInsets.all(16.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
@ -32,7 +40,19 @@ class ClinicCard extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Utils.buildSvgWithAssets(icon: "assets/images/clinicIcons/${clinicsListResponseModel.clinicID ?? 1}.svg", width: 24.w, height: 24.h, fit: BoxFit.contain).toShimmer2(isShow: isLoading), // Use Image.asset with error builder for fallback
SizedBox(
width: 24.w,
height: 24.h,
child: Utils.buildSvgWithAssets(
icon: getClinicIconPath(),
width: 24.w,
height: 24.h,
fit: BoxFit.contain,
// Note: Add error handling in the Utils.buildSvgWithAssets if possible
// or use a try-catch wrapper
),
).toShimmer2(isShow: isLoading),
(clinicsListResponseModel.isLiveCareClinicAndOnline ?? true) (clinicsListResponseModel.isLiveCareClinicAndOnline ?? true)
? Utils.buildSvgWithAssets(icon: AppAssets.livecare_clinic_icon, width: 32.w, height: 32.h, fit: BoxFit.contain, applyThemeColor: false).toShimmer2(isShow: isLoading) ? Utils.buildSvgWithAssets(icon: AppAssets.livecare_clinic_icon, width: 32.w, height: 32.h, fit: BoxFit.contain, applyThemeColor: false).toShimmer2(isShow: isLoading)
: SizedBox.shrink(), : SizedBox.shrink(),

@ -18,6 +18,7 @@ import 'package:hmg_patient_app_new/presentation/my_invoices/widgets/invoice_lis
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart';
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:open_filex/open_filex.dart'; import 'package:open_filex/open_filex.dart';
@ -122,6 +123,21 @@ class _MyInvoicesListState extends State<MyInvoicesList> {
child: Consumer<MyInvoicesViewModel>(builder: (context, myInvoicesVM, child) { child: Consumer<MyInvoicesViewModel>(builder: (context, myInvoicesVM, child) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 16.h),
CustomTabBar(
activeTextColor: Color(0xffED1C2B),
activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1),
initialIndex: 0,
tabs: [
CustomTabBarModel(null, LocaleKeys.visitsOrders.tr(context: context)),
CustomTabBarModel(null, LocaleKeys.pharmacy.tr(context: context)),
],
onTabChange: (index) {
myInvoicesVM.onTabChanged(index);
},
).paddingSymmetrical(24.h, 0.h),
myInvoicesVM.selectedTabIndex == 0 ? Column(
children: [ children: [
SizedBox(height: 16.h), SizedBox(height: 16.h),
Row( Row(
@ -313,6 +329,8 @@ class _MyInvoicesListState extends State<MyInvoicesList> {
: Utils.getNoDataWidget(context); : Utils.getNoDataWidget(context);
}).paddingSymmetrical(24.w, 0.h), }).paddingSymmetrical(24.w, 0.h),
], ],
) : Container(),
],
); );
}), }),
), ),

@ -150,6 +150,9 @@ class GenericBottomSheetState extends State<GenericBottomSheet> {
keyboardType: widget.isForEmail ? TextInputType.emailAddress : TextInputType.number, keyboardType: widget.isForEmail ? TextInputType.emailAddress : TextInputType.number,
onChange: (value) { onChange: (value) {
if (widget.onChange != null) { if (widget.onChange != null) {
if (Utils.isArabicText(value!)) {
value = Utils.toEnglishNumbers(value);
}
widget.onChange!(value); widget.onChange!(value);
} }
}, },

Loading…
Cancel
Save