diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index b52fede..636b090 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -843,7 +843,7 @@ "travelEssentials": "أساسيات السفر", "fromEverydayCareToYourNextAdventure": "من العناية اليومية إلى مغامرتك القادمة.", "homeAndKitchen": "المنزل والمطبخ", - "curatedPicksForYourHomeAndKitchen": "اختيارات مميزة لمنزلك ومطبخك.", + "curatedPicksForYourHomeAndKitchen": "اختيارات مميزة لأنشطتك.", "discover": "اكتشف", "saved": "المحفوظات", "myFamily": "عائلتي", @@ -886,5 +886,6 @@ "initializingChatPleaseWait": "يرجى الانتظار، جاري تهيئة المحادثة...", "am": "ص", "pm": "م", - "carServices": "خدمات السيارات" + "carServices": "خدمات السيارات", + "activities": "أنشطة" } diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 0c2be04..14f083e 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -845,7 +845,7 @@ "carServices": "Car Services", "fromEverydayCareToYourNextAdventure": "From everyday care to your next adventure.", "homeAndKitchen": "Home & Kitchen", - "curatedPicksForYourHomeAndKitchen": "Curated picks for your home and kitchen.", + "curatedPicksForYourHomeAndKitchen": "Curated picks for your activities.", "discover": "Discover", "saved": "Saved", "myFamily": "My Family", @@ -890,6 +890,7 @@ "typeAMessage": "Type a message..", "initializingChatPleaseWait": "Please wait, initializing chat...", "am": "AM", - "pm": "PM" + "pm": "PM", + "activities": "Activities" } diff --git a/lib/api/profile_api_client.dart b/lib/api/profile_api_client.dart index 7d58478..8f84bae 100644 --- a/lib/api/profile_api_client.dart +++ b/lib/api/profile_api_client.dart @@ -482,6 +482,38 @@ class ProfileApiClient { ); } + Future startContactApprovalProcess( + String action, + String comments, + String itemKey, + int transactionId, { + dynamic relationId, + }) async { + String url = "${ApiConsts.erpRest}START_CONTACT_APPROVAL_PROCESS"; + Map postParams = { + "P_SELECTED_RESP_ID": -999, + "P_MENU_TYPE": "E", + "P_FUNCTION_NAME": "HR_PERINFO_SS", + "P_ACTION_MODE": action, + "P_ACTION": action, + "P_COMMENTS": comments, + "P_ITEM_KEY": itemKey, + "P_TRANSACTION_ID": transactionId, + }; + if (relationId != null) { + postParams["P_CONTACT_RELATIONSHIP_ID"] = relationId; + } + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject( + (json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.startContactApprovalProcessList ?? responseData; + }, + url, + postParams, + ); + } + Future> getPerformanceAppraisal() async { String url = "${ApiConsts.erpRest}GET_Performance_Appraisal"; Map postParams = {}; diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index 9e5bfb2..613666c 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -9,6 +9,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_api_availability/google_api_availability.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/exceptions/api_exception.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; @@ -125,27 +126,31 @@ 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 ((lower.contains("authorized to access") || lower.contains("not authorized")) && + (lower.contains("mazaya") || lower.contains("program"))) { + return true; + } if (str.contains("طلب منح") || str.contains("منح نشط") || str.contains("لا يوجد طلب منح") || str.contains("تم إلغاء وصول مزايا") || - str.contains("إلغاء مزايا") || - str.contains("غير مصرح لك بالوصول") || - str.contains("غير مصرح")) { + str.contains("إلغاء مزايا")) { + return true; + } + if ((str.contains("غير مصرح لك بالوصول") || str.contains("غير مصرح")) && + (str.contains("مزايا") || str.contains("برنامج"))) { return true; } return false; } static void handleException(dynamic exception, cxt, Function(String)? onErrorMessage) { - if (isMazayaAccessRevoked(exception)) { + if (ApiConsts.ISDependetLogin && isMazayaAccessRevoked(exception)) { String depName = AppState().dependentName ?? ""; if (depName.isEmpty) { depName = AppState().walaplusDepInfoModel?.pDependentName ?? ""; diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 04e0495..3f4caa3 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -859,7 +859,7 @@ class CodegenLoader extends AssetLoader{ "travelEssentials": "أساسيات السفر", "fromEverydayCareToYourNextAdventure": "من العناية اليومية إلى مغامرتك القادمة.", "homeAndKitchen": "المنزل والمطبخ", - "curatedPicksForYourHomeAndKitchen": "اختيارات مميزة لمنزلك ومطبخك.", + "curatedPicksForYourHomeAndKitchen": "اختيارات مميزة لأنشطتك.", "discover": "اكتشف", "saved": "المحفوظات", "myFamily": "عائلتي", @@ -898,7 +898,8 @@ class CodegenLoader extends AssetLoader{ "initializingChatPleaseWait": "يرجى الانتظار، جاري تهيئة المحادثة...", "am": "ص", "pm": "م", - "carServices": "خدمات السيارات" + "carServices": "خدمات السيارات", + "activities": "أنشطة" }; static const Map _en_US = { "mohemm": "Mohemm", @@ -1743,7 +1744,7 @@ static const Map _en_US = { "carServices": "Car Services", "fromEverydayCareToYourNextAdventure": "From everyday care to your next adventure.", "homeAndKitchen": "Home & Kitchen", - "curatedPicksForYourHomeAndKitchen": "Curated picks for your home and kitchen.", + "curatedPicksForYourHomeAndKitchen": "Curated picks for your activities.", "discover": "Discover", "saved": "Saved", "myFamily": "My Family", @@ -1784,7 +1785,8 @@ static const Map _en_US = { "typeAMessage": "Type a message..", "initializingChatPleaseWait": "Please wait, initializing chat...", "am": "AM", - "pm": "PM" + "pm": "PM", + "activities": "Activities" }; static const Map> mapLocales = {"ar_SA": _ar_SA, "en_US": _en_US}; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 6834c4d..18a7339 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -871,5 +871,6 @@ abstract class LocaleKeys { static const am = 'am'; static const pm = 'pm'; static const carServices = 'carServices'; + static const activities = 'activities'; } diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 540d3d8..cc6a6b4 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -356,7 +356,7 @@ class GenericResponseModel { StartAddressApprovalProcess? startAddressApprovalProcessList; StartAddressApprovalProcess? startBasicDetApprProcessList; String? startCeiApprovalProcess; - String? startContactApprovalProcessList; + dynamic startContactApprovalProcessList; StartEitApprovalProcess? startEitApprovalProcess; String? startHrApprovalProcessList; StartPhoneApprovalProcess? startPhonesApprovalProcessList; diff --git a/lib/ui/mazaya/mazaya_discover_screen.dart b/lib/ui/mazaya/mazaya_discover_screen.dart index c0d2d98..ba6ee05 100644 --- a/lib/ui/mazaya/mazaya_discover_screen.dart +++ b/lib/ui/mazaya/mazaya_discover_screen.dart @@ -67,8 +67,8 @@ class _MazayaDiscoverScreenState extends State { // Fixed-category sections - to point a section at a different category, change only the id // passed here. Everything else (fetch, title, UI) reads off the _MazayaCategorySection object. final _MazayaCategorySection _travelSection = _MazayaCategorySection('p03'); - final _MazayaCategorySection _homeKitchenSection = _MazayaCategorySection( - 'Bw', + final _MazayaCategorySection _activitiesSection = _MazayaCategorySection( + 'jk0', ); @override @@ -99,7 +99,7 @@ class _MazayaDiscoverScreenState extends State { if (mounted) { _fetchLatestOnMazaya(); _fetchCategorySection(_travelSection); - _fetchCategorySection(_homeKitchenSection); + _fetchCategorySection(_activitiesSection); } } @@ -305,7 +305,7 @@ class _MazayaDiscoverScreenState extends State { setState(() => selectedCity = AppState().selectedMazayaCity); _fetchLatestOnMazaya(); _fetchCategorySection(_travelSection); - _fetchCategorySection(_homeKitchenSection); + _fetchCategorySection(_activitiesSection); } } @@ -325,7 +325,7 @@ class _MazayaDiscoverScreenState extends State { setState(() => selectedCity = AppState().selectedMazayaCity); _fetchLatestOnMazaya(); _fetchCategorySection(_travelSection); - _fetchCategorySection(_homeKitchenSection); + _fetchCategorySection(_activitiesSection); } } @@ -349,7 +349,7 @@ class _MazayaDiscoverScreenState extends State { setState(() => selectedCity = AppState().selectedMazayaCity); _fetchLatestOnMazaya(); _fetchCategorySection(_travelSection); - _fetchCategorySection(_homeKitchenSection); + _fetchCategorySection(_activitiesSection); } } @@ -358,7 +358,7 @@ class _MazayaDiscoverScreenState extends State { _fetchCategories(), _fetchLatestOnMazaya(), _fetchCategorySection(_travelSection), - _fetchCategorySection(_homeKitchenSection), + _fetchCategorySection(_activitiesSection), _fetchExclusiveOffers(), ]); } @@ -550,17 +550,17 @@ class _MazayaDiscoverScreenState extends State { ), _buildBrandSection( title: _sectionTitle( - _homeKitchenSection, + _activitiesSection, LocaleKeys.homeAndKitchen.tr(), ), subtitle: LocaleKeys.curatedPicksForYourHomeAndKitchen.tr(), - isLoading: _homeKitchenSection.isLoading, - retailers: _homeKitchenSection.retailers, + isLoading: _activitiesSection.isLoading, + retailers: _activitiesSection.retailers, backgroundColor: Colors.white, onSeeAll: () => _openRetailersGrid( category: _categoryForSection( - _homeKitchenSection, + _activitiesSection, LocaleKeys.homeAndKitchen.tr(), ), ), @@ -650,7 +650,7 @@ class _MazayaDiscoverScreenState extends State { setState(() => selectedCity = newCity); _fetchLatestOnMazaya(); _fetchCategorySection(_travelSection); - _fetchCategorySection(_homeKitchenSection); + _fetchCategorySection(_activitiesSection); }, ), child: Row( diff --git a/lib/ui/misc/request_submit_screen.dart b/lib/ui/misc/request_submit_screen.dart index 472e3c6..31aaa70 100644 --- a/lib/ui/misc/request_submit_screen.dart +++ b/lib/ui/misc/request_submit_screen.dart @@ -114,11 +114,11 @@ class _RequestSubmitScreenState extends State { params!.transactionId, ); } else if (params!.approvalFlag == 'family_member') { - await ProfileApiClient().getApproves( + await ProfileApiClient().startContactApprovalProcess( "SUBMIT", comments.text, - params!.transactionId!.toInt(), - params!.pItemId.toString(), + params!.pItemId, + params!.transactionId, ); } else if (params!.approvalFlag == 'basicDetails') { await ProfileApiClient().startBasicDetailsApprovalProcess( diff --git a/lib/ui/profile/add_dependent_verify_screen.dart b/lib/ui/profile/add_dependent_verify_screen.dart index 8fb72a3..77c0d60 100644 --- a/lib/ui/profile/add_dependent_verify_screen.dart +++ b/lib/ui/profile/add_dependent_verify_screen.dart @@ -1803,33 +1803,19 @@ class _AddDependentVerifyScreenState extends State { SubmitContactTransactionList? submitResult = await ProfileApiClient().submitContactTransactionAddAndUpdate("ADD", null, valuesFinal); - Utils.hideLoading(context); - if (submitResult != null && submitResult.pTRANSACTIONID != null) { - await Navigator.pushNamed( - context, - AppRoutes.requestSubmitScreen, - arguments: RequestSubmitScreenParams( - LocaleKeys.profile_familyDetails.tr(), - submitResult.pTRANSACTIONID!, - submitResult.pITEMKEY ?? '', - 'family_member', - ), + await ProfileApiClient().startContactApprovalProcess( + "SUBMIT", + "", + submitResult.pITEMKEY ?? '', + submitResult.pTRANSACTIONID!, ); - - if (!AppState().cancelRequestTrancsection) { - Navigator.pop(context); - return; - } - - Utils.showLoading(context); - await LeaveBalanceApiClient().cancelHrTransaction(submitResult.pTRANSACTIONID!); - Utils.hideLoading(context); - Navigator.pop(context); - } else { - Utils.showToast(LocaleKeys.dependentAddedSuccessfully.tr(), isSuccess: true); - Navigator.pop(context); } + + if (!mounted) return; + Utils.hideLoading(context); + Utils.showToast(LocaleKeys.yourRequestHasBeenSubmittedForApprovals.tr(), isSuccess: true, longDuration: true); + Navigator.pop(context); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); diff --git a/lib/ui/work_list/sheets/selected_item_sheet.dart b/lib/ui/work_list/sheets/selected_item_sheet.dart index 2a85fa4..a9f02a9 100644 --- a/lib/ui/work_list/sheets/selected_item_sheet.dart +++ b/lib/ui/work_list/sheets/selected_item_sheet.dart @@ -213,17 +213,17 @@ class SelectedItemSheet extends StatelessWidget { if (apiMode == "Delegate") { await WorkListApiClient().delegateITGRequest(requestDetails.requestType!, requestDetails.iD, requestDetails.itemID, AppState().memberInformationList?.eMPLOYEENUMBER ?? "", //commented the previous one because we need the replacement in both cases - favoriteReplacements !=null ? favoriteReplacements!.userName! : actionHistoryList!.uSERNAME!, comment); + favoriteReplacements !=null ? favoriteReplacements!.userName! :actionHistoryList !=null? actionHistoryList!.uSERNAME!: userId!, comment); // isITGRequest ? favoriteReplacements!.userName! : actionHistoryList!.uSERNAME!, comment); } else if (apiMode == "RequestInformation") { await WorkListApiClient().informationITGRequest(requestDetails.requestType!, requestDetails.iD, requestDetails.itemID, AppState().memberInformationList?.eMPLOYEENUMBER ?? "", //commented the previous one because we need the replacement in both cases // isITGRequest ? favoriteReplacements!.userName! : actionHistoryList!.uSERNAME!, comment); - favoriteReplacements !=null ? favoriteReplacements!.userName! : actionHistoryList!.uSERNAME!, comment); + favoriteReplacements !=null ? favoriteReplacements!.userName! :actionHistoryList !=null? actionHistoryList!.uSERNAME!: userId!, comment); } else if (apiMode == "Answer") { await WorkListApiClient().answerITGRequest(requestDetails.requestType!, requestDetails.iD, requestDetails.itemID, AppState().memberInformationList?.eMPLOYEENUMBER ?? "", //commented the previous one because we need the replacement in both cases - favoriteReplacements !=null ? favoriteReplacements!.userName! : actionHistoryList!.uSERNAME!, comment); + favoriteReplacements !=null ? favoriteReplacements!.userName! :actionHistoryList !=null? actionHistoryList!.uSERNAME!: userId!, comment); //favoriteReplacements!.userName! : actionHistoryList!.uSERNAME!, comment); } Utils.hideLoading(context);