no message

master
Sultan khan 2 weeks ago
parent 518c766756
commit e21738cf5f

@ -704,7 +704,7 @@
"done": "تم",
"linkCopied": "تم نسخ الرابط بنجاح",
"mazayaAccessRevoked": "تم إلغاء الوصول لمزايا",
"mazayaAccessRevokedDesc": "قام الكفيل بإلغاء وصول التابع. لم يعد بالإمكان فتح العروض أو تسجيل الدخول بالبصمة.",
"mazayaAccessRevokedDesc": "أنت غير مصرح لك بالوصول إلى برنامج مزايا.",
"contactYourSponsor": "تواصل مع الكفيل",
"contactYourSponsorDesc": "اطلب من كفيلك السماح بالوصول لمزايا مرة أخرى من تفاصيل التابعين. يمكن للكفيل فقط استعادة الوصول.",
"dependentAccessBlocked": "تم حظر وصول التابع",

@ -704,7 +704,7 @@
"done": "Done",
"linkCopied": "Link copied to clipboard",
"mazayaAccessRevoked": "Mazaya access revoked",
"mazayaAccessRevokedDesc": "Your sponsor has revoked your dependent access. You can no longer open offers or sign in with biometrics.",
"mazayaAccessRevokedDesc": "You are not authorized to access the Mazaya Program.",
"contactYourSponsor": "Contact your sponsor",
"contactYourSponsorDesc": "Ask your sponsor to allow Mazaya access again from Dependent Details. Only the sponsor can restore access.",
"dependentAccessBlocked": "Dependent access blocked",

@ -112,7 +112,7 @@ class AppState {
String? _dependentName;
String? get dependentName => _dependentName ?? _walaplusDepInfoModel?.pDependentName;
String? get dependentName => _dependentName;
set setDependentName(String? name) => _dependentName = name;

@ -107,12 +107,20 @@ class Utils {
lower.contains("grant request") ||
lower.contains("grant was found") ||
lower.contains("grant_request") ||
lower.contains("authorized to access") ||
lower.contains("not authorized") ||
lower.contains("e4:") ||
lower.contains("e4 -") ||
lower.contains("e4 :")) {
return true;
}
if (str.contains("طلب منح") || str.contains("منح نشط") || str.contains("لا يوجد طلب منح") || str.contains("تم إلغاء وصول مزايا") || str.contains("إلغاء مزايا")) {
if (str.contains("طلب منح") ||
str.contains("منح نشط") ||
str.contains("لا يوجد طلب منح") ||
str.contains("تم إلغاء وصول مزايا") ||
str.contains("إلغاء مزايا") ||
str.contains("غير مصرح لك بالوصول") ||
str.contains("غير مصرح")) {
return true;
}
return false;

@ -716,7 +716,7 @@ class CodegenLoader extends AssetLoader{
"done": "تم",
"linkCopied": "تم نسخ الرابط بنجاح",
"mazayaAccessRevoked": "تم إلغاء الوصول لمزايا",
"mazayaAccessRevokedDesc": "قام الكفيل بإلغاء وصول التابع. لم يعد بالإمكان فتح العروض أو تسجيل الدخول بالبصمة.",
"mazayaAccessRevokedDesc": "أنت غير مصرح لك بالوصول إلى برنامج مزايا.",
"contactYourSponsor": "تواصل مع الكفيل",
"contactYourSponsorDesc": "اطلب من كفيلك السماح بالوصول لمزايا مرة أخرى من تفاصيل التابعين. يمكن للكفيل فقط استعادة الوصول.",
"dependentAccessBlocked": "تم حظر وصول التابع",
@ -1525,7 +1525,7 @@ static const Map<String,dynamic> _en_US = {
"done": "Done",
"linkCopied": "Link copied to clipboard",
"mazayaAccessRevoked": "Mazaya access revoked",
"mazayaAccessRevokedDesc": "Your sponsor has revoked your dependent access. You can no longer open offers or sign in with biometrics.",
"mazayaAccessRevokedDesc": "You are not authorized to access the Mazaya Program.",
"contactYourSponsor": "Contact your sponsor",
"contactYourSponsorDesc": "Ask your sponsor to allow Mazaya access again from Dependent Details. Only the sponsor can restore access.",
"dependentAccessBlocked": "Dependent access blocked",

@ -5,12 +5,17 @@ class WalaPlusCategoryModel {
String? name;
String? parentId;
String? countryNameAr;
String? countryNameEn;
WalaPlusCategoryModel({
this.id,
this.image,
this.imageThumb,
this.name,
this.parentId,
this.countryNameAr,
this.countryNameEn,
}) {
if ((image == null || image!.isEmpty) && id != null && id!.trim().isNotEmpty && id != "all" && id != "0") {
String cleanId = id!.trim();
@ -26,6 +31,8 @@ class WalaPlusCategoryModel {
name = (json['name'] ?? json['Name'])?.toString();
parentId = (json['parent_id'] ?? json['Parent_Id'] ?? json['parentId'])?.toString();
imageThumb = (json['image_thumb'] ?? json['Image_Thumb'] ?? json['imageThumb'])?.toString();
countryNameAr = (json['country_name_ar'] ?? json['countryNameAr'] ?? json['category_name_ar'])?.toString();
countryNameEn = (json['country_name_en'] ?? json['countryNameEn'] ?? json['category_name_en'])?.toString();
// Use category image URL from HMG middleware using ID from WalaPlus_Categories API:
// https://epharmacy.hmg.com/middleware/images/category/{id}.png
@ -47,6 +54,8 @@ class WalaPlusCategoryModel {
data['image_thumb'] = imageThumb;
data['name'] = name;
data['parent_id'] = parentId;
data['country_name_ar'] = countryNameAr;
data['country_name_en'] = countryNameEn;
return data;
}

@ -9,8 +9,10 @@ class WalaPlusRetailersResponse {
int? pagesCount;
int? perPage;
List<WalaPlusRetailerModel>? retailers;
String? countryNameAr;
String? countryNameEn;
WalaPlusRetailersResponse({this.page, this.pagesCount, this.perPage, this.retailers});
WalaPlusRetailersResponse({this.page, this.pagesCount, this.perPage, this.retailers, this.countryNameAr, this.countryNameEn});
factory WalaPlusRetailersResponse.fromJson(Map<String, dynamic> json) {
List<WalaPlusRetailerModel> retailersList = [];
@ -35,6 +37,8 @@ class WalaPlusRetailersResponse {
pagesCount: json['pages_count'] is int ? json['pages_count'] : int.tryParse(json['pages_count']?.toString() ?? json['pagesCount']?.toString() ?? json['totalPages']?.toString() ?? '1'),
perPage: json['per_page'] is int ? json['per_page'] : int.tryParse(json['per_page']?.toString() ?? json['perPage']?.toString() ?? json['WP_Per_page']?.toString() ?? '10'),
retailers: retailersList,
countryNameAr: WalaPlusRetailerModel.decodeUnicodeString(json['country_name_ar'] ?? json['countryNameAr'] ?? json['country_ar']),
countryNameEn: WalaPlusRetailerModel.decodeUnicodeString(json['country_name_en'] ?? json['countryNameEn'] ?? json['country_en']),
);
}
@ -43,6 +47,8 @@ class WalaPlusRetailersResponse {
data['page'] = page;
data['pages_count'] = pagesCount;
data['per_page'] = perPage;
data['country_name_ar'] = countryNameAr;
data['country_name_en'] = countryNameEn;
if (retailers != null) {
data['retailers'] = retailers!.map((v) => v.toJson()).toList();
}
@ -156,6 +162,8 @@ class WalaPlusRetailerModel {
String? duration;
String? email;
String? phone;
String? countryNameAr;
String? countryNameEn;
WalaPlusRetailerModel({
this.id,
@ -191,6 +199,8 @@ class WalaPlusRetailerModel {
this.duration,
this.email,
this.phone,
this.countryNameAr,
this.countryNameEn,
});
static List<WalaPlusOfferModel> parseOffersList(data) {
@ -343,6 +353,8 @@ class WalaPlusRetailerModel {
duration: targetJson['duration']?.toString(),
email: targetJson['email']?.toString() ?? targetJson['contact_email']?.toString() ?? contactObj?.primaryEmail,
phone: targetJson['phone']?.toString() ?? targetJson['contact_phone']?.toString() ?? targetJson['mobile']?.toString() ?? contactObj?.primaryPhone,
countryNameAr: decodeUnicodeString(targetJson['country_name_ar'] ?? targetJson['countryNameAr'] ?? targetJson['country_ar']),
countryNameEn: decodeUnicodeString(targetJson['country_name_en'] ?? targetJson['countryNameEn'] ?? targetJson['country_en']),
);
}
@ -424,6 +436,8 @@ class WalaPlusRetailerModel {
data['duration'] = duration;
data['email'] = email;
data['phone'] = phone;
data['country_name_ar'] = countryNameAr;
data['country_name_en'] = countryNameEn;
if (offers != null) {
data['offers'] = offers!.map((v) => v.toJson()).toList();
}

@ -16,6 +16,7 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/main.dart';
import 'package:mohem_flutter_app/models/offers_and_discounts/wala_plus_category_model.dart';
import 'package:mohem_flutter_app/models/offers_and_discounts/wala_plus_retailer_model.dart';
import 'package:mohem_flutter_app/models/post_params_model.dart';
import 'package:mohem_flutter_app/widgets/bottom_sheets/confirm_bottom_sheet.dart';
import 'package:mohem_flutter_app/widgets/info_chip_widget.dart';
import 'package:shimmer/shimmer.dart';
@ -426,6 +427,35 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
);
}
Future<void> _changeLanguage(Locale newLocale) async {
if (context.locale == newLocale) return;
await context.setLocale(newLocale);
PostParamsModel? obj = AppState().postParamsObject;
if (obj != null) {
obj.languageID = (newLocale.languageCode == "ar" ? 1 : 2);
AppState().setPostParamsModel(obj);
}
if (mounted) {
setState(() {});
await fetchCategories();
await fetchOffers(categoryId: currentCategoryId.isEmpty ? "all" : currentCategoryId);
}
}
Widget _buildLanguageIconButton(bool isAr) {
return IconButton(
icon: const Icon(Icons.language_rounded, size: 24, color: Color(0xFF1E293B)),
tooltip: isAr ? 'English' : 'العربية',
onPressed: () {
if (isAr) {
_changeLanguage(const Locale("en", "US"));
} else {
_changeLanguage(const Locale("ar", "SA"));
}
},
);
}
@override
Widget build(BuildContext context) {
bool isAr = AppState().isArabic(context);
@ -444,6 +474,7 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisSize: MainAxisSize.min,
children: [
if (!ApiConsts.isDependetLogin) ...[
InkWell(
@ -462,12 +493,13 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
),
const SizedBox(width: 8),
],
SvgPicture.asset("assets/icons/mazaya_brand.svg", height: 48, fit: BoxFit.contain),
SvgPicture.asset("assets/icons/mazaya_brand.svg", height: 40, fit: BoxFit.contain),
],
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
_buildLanguageIconButton(isAr),
if (!ApiConsts.isDependetLogin) ...[
IconButton(
icon: Image.asset(
@ -495,7 +527,10 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
}
},
),
if (ApiConsts.isDependetLogin) InkWell(onTap: _performLogout, child: SvgPicture.asset('assets/images/drawer/logout.svg', height: 20, width: 20)),
if (ApiConsts.isDependetLogin) ...[
const SizedBox(width: 4),
InkWell(onTap: _performLogout, child: SvgPicture.asset('assets/images/drawer/logout.svg', height: 20, width: 20)),
],
],
),
],

@ -594,7 +594,7 @@ class _LoginScreenState extends State<LoginScreen> {
return "";
}
void _navigateToMazayaAccessRevoked([String? depName]) async {
void _navigateToMazayaAccessRevoked([String? depName, String? message]) async {
await Utils.removeStringFromPrefs("P_DEP_IS_LOGGED_IN");
await Utils.removeStringFromPrefs("P_DEP_NATIONAL_ID");
@ -618,7 +618,7 @@ class _LoginScreenState extends State<LoginScreen> {
name = await Utils.getStringFromPrefs("P_DEPENDENT_NAME");
}
if (!mounted) return;
Navigator.push(context, MaterialPageRoute(builder: (_) => MazayaAccessResultScreen(isGranted: false, dependentName: name)));
Navigator.push(context, MaterialPageRoute(builder: (_) => MazayaAccessResultScreen(isGranted: false, dependentName: name, message: message)));
}
void performDependentLogin() async {

@ -1,4 +1,3 @@
import 'dart:developer';
import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
@ -20,8 +19,9 @@ class MazayaAccessResultParams {
final String? downloadUrl;
final String? nationalId;
final String? dateOfBirth;
final String? message;
const MazayaAccessResultParams({required this.isGranted, required this.dependentName, this.dependentInitials, this.downloadUrl, this.nationalId, this.dateOfBirth});
const MazayaAccessResultParams({required this.isGranted, required this.dependentName, this.dependentInitials, this.downloadUrl, this.nationalId, this.dateOfBirth, this.message});
}
class _ShieldPainter extends CustomPainter {
@ -79,8 +79,9 @@ class MazayaAccessResultScreen extends StatelessWidget {
final String? downloadUrl;
final String? nationalId;
final String? dateOfBirth;
final String? message;
const MazayaAccessResultScreen({Key? key, this.isGranted = true, this.dependentName = "", this.dependentInitials, this.downloadUrl, this.nationalId, this.dateOfBirth}) : super(key: key);
const MazayaAccessResultScreen({Key? key, this.isGranted = true, this.dependentName = "", this.dependentInitials, this.downloadUrl, this.nationalId, this.dateOfBirth, this.message}) : super(key: key);
static String getDownloadLink() {
int channel = AppState().postParamsObject?.channel ?? 31;
@ -119,6 +120,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
String? effectiveUrl = downloadUrl;
String? effectiveNationalId = nationalId;
String? effectiveDateOfBirth = dateOfBirth;
String? effectiveMessage = message;
if (routeArgs is MazayaAccessResultParams) {
effectiveGranted = routeArgs.isGranted;
@ -127,6 +129,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
effectiveUrl = routeArgs.downloadUrl;
effectiveNationalId = routeArgs.nationalId;
effectiveDateOfBirth = routeArgs.dateOfBirth;
effectiveMessage = routeArgs.message ?? message;
} else if (routeArgs is Map<String, dynamic>) {
effectiveGranted = routeArgs['isGranted'] ?? isGranted;
effectiveName = routeArgs['dependentName'] ?? dependentName;
@ -134,6 +137,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
effectiveUrl = routeArgs['downloadUrl'] ?? downloadUrl;
effectiveNationalId = routeArgs['nationalId'] ?? nationalId;
effectiveDateOfBirth = routeArgs['dateOfBirth'] ?? dateOfBirth;
effectiveMessage = routeArgs['message'] ?? message;
}
effectiveName = isAr ? "التابع" : "Dependent";
// if (effectiveName.trim().isEmpty) {
@ -183,7 +187,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
child: SingleChildScrollView(
padding: const EdgeInsets.fromLTRB(20, 16, 20, 20),
child:
effectiveGranted ? _buildGrantedContent(context, isAr, fontFamily, effectiveName, initials, linkToShare) : _buildRevokedContent(context, isAr, fontFamily, effectiveName, initials),
effectiveGranted ? _buildGrantedContent(context, isAr, fontFamily, effectiveName, initials, linkToShare) : _buildRevokedContent(context, isAr, fontFamily, effectiveName, initials, effectiveMessage),
),
),
_buildBottomButtons(context, isAr, fontFamily, effectiveGranted, linkToShare, effectiveNationalId ?? "", effectiveDateOfBirth ?? ""),
@ -332,7 +336,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
);
}
Widget _buildRevokedContent(BuildContext context, bool isAr, String fontFamily, String name, String initials) {
Widget _buildRevokedContent(BuildContext context, bool isAr, String fontFamily, String name, String initials, [String? message]) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
@ -354,7 +358,7 @@ class MazayaAccessResultScreen extends StatelessWidget {
const SizedBox(height: 8),
// Description
LocaleKeys.mazayaAccessRevokedDesc.tr().toText14(isCenter: true, color: const Color(0xFF64748B)),
(message != null && message.trim().isNotEmpty ? message.trim() : LocaleKeys.mazayaAccessRevokedDesc.tr()).toText14(isCenter: true, color: const Color(0xFF64748B)),
const SizedBox(height: 22),

Loading…
Cancel
Save