diff --git a/android/app/build.gradle b/android/app/build.gradle index 255ebd4..992e2a2 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -18,14 +18,9 @@ if (keystorePropertiesFile.exists()) { android { namespace 'hmg.cloudSolutions.mohem' - compileSdk 36 // Changed from 36 to a supported version + compileSdk 36 ndkVersion '28.2.13676358' - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - coreLibraryDesugaringEnabled true - } kotlinOptions { jvmTarget = '1.8' @@ -38,14 +33,18 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.cloudsolutions.alhabibmohemm" - minSdkVersion 28 -// targetSdk = flutter.targetSdkVersion + minSdkVersion 30 targetSdk 35 + targetSdk = flutter.targetSdkVersion versionCode flutter.versionCode versionName flutter.versionName multiDexEnabled true } + compileOptions { + coreLibraryDesugaringEnabled true + } + buildFeatures{ buildConfig true } @@ -77,6 +76,7 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.20" + implementation 'androidx.multidex:multidex:2.0.1' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5' implementation 'com.huawei.hms:push:6.11.0.300' diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 563251c..8b84ab9 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -8,10 +8,10 @@ - + - + diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 2bf458a..27a5434 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -617,5 +617,27 @@ "mazaya": "مازيا", "benefits": "فوائد", "mazayaDesc": "اكتشف الخصومات والعروض الخاصة المتاحة للموظفين", - "viewallofferMazaya" : "أعرض كل المزايا" + "viewallofferMazaya" : "أعرض كل المزايا", + "buyerName": "اسم المشتري", + "buyerNumber": "رقم المشتري", + "highestBidder": "أعلى مزايد", + "remarks": "ملاحظات", + "faHeader": "تفاصيل رأس الصفحة FA", + "bookTypeCode": "رمز نوع الكتاب", + "categoryCode": "رمز الفئة", + "categoryGroup": "مجموعة الفئات", + "faLINES": "تفاصيل الأصول", + "assetNumber": "رقم الأصول", + "assetDescription": "وصف الأصول", + "barCodeNumber": "رقم الباركود", + "datePlaceInService": "تاريخ وضعه في الخدمة", + "serialNumber": "رقم سري", + "disposedDate": "تاريخ التخلص", + "netBookValue": "القيمة الدفترية الصافية", + "purchasedPrice": "سعر الشراء", + "usefulLife": "العمر الإنتاجي", + "yearsUsed": "سنوات الاستخدام", + "faRequest": "طلب التخلص من FA", + "showMore": "عرض المزيد", + "buyerDetails": "تفاصيل المشتري" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 1012d5a..ce0fcac 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -617,6 +617,27 @@ "mazaya": "MAZAYA", "benefits": "Benefits", "mazayaDesc": "Discover special Discounts and offers available to Employees", - "viewallofferMazaya" : "View All Offers" - + "viewallofferMazaya" : "View All Offers", + "buyerName": "Buyer Name", + "buyerNumber": "Buyer Number", + "highestBidder": "Highest Bidder", + "remarks": "Remarks", + "faHeader": "FA Header Details", + "bookTypeCode": "Book Type Code", + "categoryCode": "Category Code", + "categoryGroup": "Category Group", + "faLINES": "Asset Details", + "assetNumber": "Asset Number", + "assetDescription": "Asset Description", + "barCodeNumber": "BarCode Number", + "datePlaceInService": "Date place In Service", + "serialNumber": "Serial Number", + "disposedDate": "Disposed Date", + "netBookValue": "Net Book Value", + "purchasedPrice": "Purchased Price", + "usefulLife": "Useful Life", + "yearsUsed": "Years Used", + "faRequest":"FA Disposal Request", + "showMore": "Show More", + "buyerDetails": "Buyer Details" } \ No newline at end of file diff --git a/lib/api/api_client.dart b/lib/api/api_client.dart index fb415d4..91fd28a 100644 --- a/lib/api/api_client.dart +++ b/lib/api/api_client.dart @@ -6,6 +6,8 @@ import 'package:flutter/foundation.dart'; import 'package:http/http.dart'; import 'package:http/io_client.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/exceptions/api_exception.dart'; import 'package:mohem_flutter_app/main.dart'; // ignore_for_file: avoid_annotating_with_dynamic @@ -13,7 +15,7 @@ import 'package:mohem_flutter_app/main.dart'; typedef FactoryConstructor = U Function(dynamic); class APIError { - int? errorCode; + dynamic errorCode; int? errorType; String? errorMessage; int? errorStatusCode; @@ -102,7 +104,10 @@ class ApiClient { if (jsonData["ErrorMessage"] == null) { return factoryConstructor(jsonData); - } else { + } else if (jsonData["MessageStatus"] == 2 && jsonData["IsOTPMaxLimitExceed"] == true) { + await Utils.performLogout(AppRoutes.navigatorKey.currentContext, null); + throw const APIException(APIException.UNAUTHORIZED, error: null); + } else { APIError? apiError; apiError = APIError(jsonData['ErrorCode'], jsonData['ErrorEndUserMessage'], jsonData['ErrorType'] ?? 0, jsonData['ErrorStatusCode']); throw APIException(APIException.BAD_REQUEST, error: apiError); diff --git a/lib/api/dashboard_api_client.dart b/lib/api/dashboard_api_client.dart index b2ee4c2..ae5fda8 100644 --- a/lib/api/dashboard_api_client.dart +++ b/lib/api/dashboard_api_client.dart @@ -10,6 +10,7 @@ import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/classes/date_uitl.dart'; import 'package:mohem_flutter_app/models/dashboard/get_accrual_balances_list_model.dart'; +import 'package:mohem_flutter_app/models/dashboard/get_accural_ticket_balance_model.dart'; import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart'; import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; import 'package:mohem_flutter_app/models/dashboard/list_menu.dart'; @@ -101,6 +102,21 @@ class DashboardApiClient { ); } + Future> getTicketAccuralBalance(String effectiveDate, {String? empID}) async { + String url = "${ApiConsts.erpRest}GET_TICKET_ACCRUAL_BALANCES"; + Map postParams = {"P_EFFECTIVE_DATE": effectiveDate}; + postParams.addAll(AppState().postParamsJson); + if (empID != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = empID; + return await ApiClient().postJsonForObject( + (json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.getAccrualBalancesTicketList ?? []; + }, + url, + postParams, + ); + } + Future getOpenMissingSwipes() async { String url = "${ApiConsts.erpRest}GET_OPEN_MISSING_SWIPES"; Map postParams = {}; @@ -173,6 +189,21 @@ class DashboardApiClient { ); } + Future getTicketBalance() async { + String url = "${ApiConsts.erpRest}GET_TICKET_BALANCE"; + Map postParams = {"P_USER_NAME": AppState().memberInformationList?.eMPLOYEENUMBER}; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject( + (json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData; + }, + url, + postParams, + ); + } + Future getBookingSSOAuthRedirection({required String clientID}) async { String url = "${ApiConsts.ssoAuthRedirection}?grantType=mohemm"; //https://sso-uat.hmg.com/api/auth/connect?grantType=mohemm' @@ -183,6 +214,7 @@ class DashboardApiClient { "PersonId": AppState().memberInformationList?.eMPLOYEENUMBER, "Username": AppState().memberInformationList?.eMPLOYEENUMBER, "Language": "US", + "SessionId": AppState().postParamsObject?.pSessionId, }; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject( @@ -196,7 +228,8 @@ class DashboardApiClient { } Future getBookingSSOFinalRedirection({required String token}) async { - token = "eyJhbGciOiJSUzI1NiIsImtpZCI6IjhjZTE2OWM0YjIwYjQ2ZWM5YTQyOTU3Y2ZhODUzNzQ1IiwidHlwIjoiSldUIn0.eyJ0ZW5hbnRfaWQiOiJhOWY0ZDFhMDU5NmQ0YWVhOGY4MzA5OTJlYzRiZGFjMSIsImVpZCI6IjExNzkzMCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL3NpZCI6Ijk2MDI0OGM1NzA3YzQ3MmFhYTEzM2I1N2ZhODE1ZmVhIiwibGFuZ3VhZ2UiOiJVUyIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL2VtYWlsYWRkcmVzcyI6IjExNzkzMEBobWcuY29tIiwiZXhwIjoxNzgyNDc1NzY5LCJpc3MiOiJodHRwczovL3Nzby11YXQuaG1nLmNvbSIsImF1ZCI6ImE5ZjRkMWEwNTk2ZDRhZWE4ZjgzMDk5MmVjNGJkYWMxIn0.rJcLVsG8D0XECyLERCTD2uqGeWyvp-OBVGE9uL2qKrX4etFUHgdFt_5kYF6edFTtGy-0PIZadHDmv7e-IOhVWHm5HVMClaukiXoRXR8cDN8XA1wfme3Kd-U5PXN-IRh49AyRTzLO0rYNPvH81ScosWGlsFSkOvA-0hJNa2adHdtvgNvB8wJshSU5p7sAmF8mjdDY6aInG19etu2iEuUDwHHA4ZY_ts4hboHo8fE392hFaYGonExoD7bpW5RMx5xKWeRCmWpG_PK8Aw_z1jGzdB9PANus4pteRGuln1J-kmo2lQC9pVrSyZATAKp1HfgfyZ_vUhaHEfM69cMWaCslJQ"; + token = + "eyJhbGciOiJSUzI1NiIsImtpZCI6IjhjZTE2OWM0YjIwYjQ2ZWM5YTQyOTU3Y2ZhODUzNzQ1IiwidHlwIjoiSldUIn0.eyJ0ZW5hbnRfaWQiOiJhOWY0ZDFhMDU5NmQ0YWVhOGY4MzA5OTJlYzRiZGFjMSIsImVpZCI6IjExNzkzMCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL3NpZCI6Ijk2MDI0OGM1NzA3YzQ3MmFhYTEzM2I1N2ZhODE1ZmVhIiwibGFuZ3VhZ2UiOiJVUyIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL2VtYWlsYWRkcmVzcyI6IjExNzkzMEBobWcuY29tIiwiZXhwIjoxNzgyNDc1NzY5LCJpc3MiOiJodHRwczovL3Nzby11YXQuaG1nLmNvbSIsImF1ZCI6ImE5ZjRkMWEwNTk2ZDRhZWE4ZjgzMDk5MmVjNGJkYWMxIn0.rJcLVsG8D0XECyLERCTD2uqGeWyvp-OBVGE9uL2qKrX4etFUHgdFt_5kYF6edFTtGy-0PIZadHDmv7e-IOhVWHm5HVMClaukiXoRXR8cDN8XA1wfme3Kd-U5PXN-IRh49AyRTzLO0rYNPvH81ScosWGlsFSkOvA-0hJNa2adHdtvgNvB8wJshSU5p7sAmF8mjdDY6aInG19etu2iEuUDwHHA4ZY_ts4hboHo8fE392hFaYGonExoD7bpW5RMx5xKWeRCmWpG_PK8Aw_z1jGzdB9PANus4pteRGuln1J-kmo2lQC9pVrSyZATAKp1HfgfyZ_vUhaHEfM69cMWaCslJQ"; var request = http.MultipartRequest('POST', Uri.parse('https://ek.techmaster.in/SSO/HMG')); request.fields.addAll({'JWTToken': token}); diff --git a/lib/api/eit_api_client.dart b/lib/api/eit_api_client.dart index 9e4f292..d473aaf 100644 --- a/lib/api/eit_api_client.dart +++ b/lib/api/eit_api_client.dart @@ -19,13 +19,26 @@ class EITApiClient { factory EITApiClient() => _instance; - Future?> getEITTransactions(String functionName) async { + Future getEITTransactions(String functionName, {bool isCompleteList = false}) async { String url = "${ApiConsts.erpRest}GET_EIT_TRANSACTIONS"; Map postParams = {'P_FUNCTION_NAME': functionName, "P_MENU_TYPE": "E", "P_PAGE_LIMIT": 50, "P_PAGE_NUM": 1}; postParams.addAll(AppState().postParamsJson); - return await ApiClient().postJsonForObject((json) { - List? responseData = GetEitTransactionsModel.fromJson(json['GetEITTransactionList'][0]).collectionTransaction; - return responseData; - }, url, postParams); + return await ApiClient().postJsonForObject( + (json) { + if (isCompleteList) { + List> responseData = []; + json['GetEITTransactionList'].forEach((element) { + var transactionList = GetEitTransactionsModel.fromJson(element).collectionTransaction; + if (transactionList != null) responseData.add(transactionList); + }); + return responseData; + } else { + List? responseData = GetEitTransactionsModel.fromJson(json['GetEITTransactionList'][0]).collectionTransaction; + return responseData; + } + }, + url, + postParams, + ); } } diff --git a/lib/api/worklist/worklist_api_client.dart b/lib/api/worklist/worklist_api_client.dart index 51a47bb..10d9472 100644 --- a/lib/api/worklist/worklist_api_client.dart +++ b/lib/api/worklist/worklist_api_client.dart @@ -28,6 +28,7 @@ import 'package:mohem_flutter_app/models/notification_get_respond_attributes_lis import 'package:mohem_flutter_app/models/termination/termination_notification_body.dart'; import 'package:mohem_flutter_app/models/update_user_item_type_list.dart'; import 'package:mohem_flutter_app/models/worklist/GetRFCEmployeeList.dart'; +import 'package:mohem_flutter_app/models/worklist/get_fad_notifications.dart'; import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/eit_otification_body_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_address_notification_body_list.dart'; @@ -216,9 +217,24 @@ class WorkListApiClient { ); } - Future getUserInformation(int pSelectedResopID, String selectedEmployeeNumber) async { - String url = "${ApiConsts.erpRest}Get_UserInformation"; - Map postParams = {"P_SELECTED_RESP_ID": pSelectedResopID, "P_PAGE_LIMIT": 100, "P_PAGE_NUM": 1}; + // Future getUserInformation(int pSelectedResopID, String selectedEmployeeNumber) async { + // String url = "${ApiConsts.erpRest}Get_UserInformation"; + // Map postParams = {"P_SELECTED_RESP_ID": pSelectedResopID, "P_PAGE_LIMIT": 100, "P_PAGE_NUM": 1}; + // postParams.addAll(AppState().postParamsJson); + // if (selectedEmployeeNumber != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = selectedEmployeeNumber; + // return await ApiClient().postJsonForObject( + // (json) { + // GenericResponseModel responseData = GenericResponseModel.fromJson(json); + // return responseData.memberInformationList![0]; + // }, + // url, + // postParams, + // ); + // } + + Future getNotificationUserInformation(int pSelectedResopID, String selectedEmployeeNumber, int pNotificationID) async { + String url = "${ApiConsts.erpRest}Get_Notification_UserInformation"; + Map postParams = {"P_SELECTED_RESP_ID": pSelectedResopID, "P_PAGE_LIMIT": 100, "P_PAGE_NUM": 1, "P_NOTIFICATION_ID": pNotificationID}; postParams.addAll(AppState().postParamsJson); if (selectedEmployeeNumber != null) postParams["P_SELECTED_EMPLOYEE_NUMBER"] = selectedEmployeeNumber; return await ApiClient().postJsonForObject( @@ -831,4 +847,19 @@ class WorkListApiClient { postParams, ); } + + + Future getFADNotificationBody(int? notificationId) async { + String url = "${ApiConsts.erpRest}GetFADisposalNtfDetails"; + Map postParams = {"P_NOTIFICATION_ID": notificationId, "P_PAGE_LIMIT": 100, "P_PAGE_NUM": 1}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject( + (json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.getFADisposalNtfDetails; + }, + url, + postParams, + ); + } } diff --git a/lib/app_state/app_state.dart b/lib/app_state/app_state.dart index 1f045f4..8840b39 100644 --- a/lib/app_state/app_state.dart +++ b/lib/app_state/app_state.dart @@ -90,7 +90,7 @@ class AppState { String get getHuaweiPushToken => _huaweiPushToken; - final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 33, versionID: 9.2, mobileType: Platform.isAndroid ? "android" : "ios"); + final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 33, versionID: 9.4, mobileType: Platform.isAndroid ? "android" : "ios"); void setPostParamsInitConfig() { isAuthenticated = false; diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 12635a6..dbec87d 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -5,17 +5,17 @@ class ApiConsts { // static String baseUrl = "https://erptstapp.srca.org.sa"; // SRCA server // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver - // static String baseUrl = "http://10.201.204.101:2024"; + // static String baseUrl = "http://10.201.204.101:2024"; // static String baseUrl = "https://webservices.hmg.com"; // PreProd // static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrl = "https://mohemm.hmg.com"; // New Live server // - // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver - // static String baseUrl = "http://10.20.200.111:1010/"; + // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver + // static String baseUrl = "http://10.20.200.111:1010/"; // static String baseUrl = "https://webservices.hmg.com"; // PreProd - // static String baseUrl = "https://mohemm.hmg.com"; + // static String baseUrl = "https://mohemm.hmg.com"; // static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrlServices = baseUrl + "/Services/"; // server diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index 0245bbf..6a9b16b 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -16,6 +16,7 @@ import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart'; import 'package:mohem_flutter_app/widgets/loading_dialog.dart'; import 'package:nfc_manager/nfc_manager.dart'; @@ -386,4 +387,16 @@ class Utils { return false; } } + + static Future performLogout(BuildContext? context, ChatProviderModel? chatData) async { + AppState().isAuthenticated = false; + AppState().isLogged = false; + AppState().setPostParamsInitConfig(); + if (chatData != null) { + chatData.disposeData(); + } + // SharedPreferences prefs = await SharedPreferences.getInstance(); + // await prefs.clear(); + Navigator.pushNamedAndRemoveUntil(context!, AppRoutes.login, (Route route) => false, arguments: null); + } } diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 91ded82..93a6cf8 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -81,28 +81,30 @@ extension EmailValidator on String { ), ); - Widget toText12({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int maxLine = 0}) => Text( + Widget toText12({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int? maxLine, TextOverflow? overflow}) => Text( this, textAlign: isCenter ? TextAlign.center : null, - maxLines: (maxLine > 0) ? maxLine : null, + maxLines: maxLine == 0 ? null : maxLine, style: TextStyle( fontSize: 12, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.72, decoration: isUnderLine ? TextDecoration.underline : null, + overflow: TextOverflow.visible ), ); - Widget toText12Auto({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int maxLine = 0}) => AutoSizeText( + Widget toText12Auto({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, int? maxLine,TextOverflow? overflow}) => AutoSizeText( this, textAlign: isCenter ? TextAlign.center : null, - maxLines: (maxLine > 0) ? maxLine : null, + maxLines: maxLine == 0 ? null : maxLine, minFontSize: 8, style: TextStyle( fontSize: 12, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, + overflow: overflow, letterSpacing: -0.72, decoration: isUnderLine ? TextDecoration.underline : null, ), diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index f3fda6a..6feb438 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -633,7 +633,29 @@ class CodegenLoader extends AssetLoader{ "mazaya": "مازيا", "benefits": "فوائد", "mazayaDesc": "اكتشف الخصومات والعروض الخاصة المتاحة للموظفين", - "viewallofferMazaya": "أعرض كل المزايا" + "viewallofferMazaya": "أعرض كل المزايا", + "buyerName": "اسم المشتري", + "buyerNumber": "رقم المشتري", + "highestBidder": "أعلى مزايد", + "remarks": "ملاحظات", + "faHeader": "تفاصيل رأس الصفحة FA", + "bookTypeCode": "رمز نوع الكتاب", + "categoryCode": "رمز الفئة", + "categoryGroup": "مجموعة الفئات", + "faLINES": "تفاصيل الأصول", + "assetNumber": "رقم الأصول", + "assetDescription": "وصف الأصول", + "barCodeNumber": "رقم الباركود", + "datePlaceInService": "تاريخ وضعه في الخدمة", + "serialNumber": "رقم سري", + "disposedDate": "تاريخ التخلص", + "netBookValue": "القيمة الدفترية الصافية", + "purchasedPrice": "سعر الشراء", + "usefulLife": "العمر الإنتاجي", + "yearsUsed": "سنوات الاستخدام", + "faRequest": "طلب التخلص من FA", + "showMore": "عرض المزيد", + "buyerDetails": "تفاصيل المشتري" }; static const Map _en_US = { "mohemm": "Mohemm", @@ -1254,7 +1276,29 @@ static const Map _en_US = { "mazaya": "MAZAYA", "benefits": "Benefits", "mazayaDesc": "Discover special Discounts and offers available to Employees", - "viewallofferMazaya": "View All Offers" + "viewallofferMazaya": "View All Offers", + "buyerName": "Buyer Name", + "buyerNumber": "Buyer Number", + "highestBidder": "Highest Bidder", + "remarks": "Remarks", + "faHeader": "FA Header Details", + "bookTypeCode": "Book Type Code", + "categoryCode": "Category Code", + "categoryGroup": "Category Group", + "faLINES": "Asset Details", + "assetNumber": "Asset Number", + "assetDescription": "Asset Description", + "barCodeNumber": "BarCode Number", + "datePlaceInService": "Date place In Service", + "serialNumber": "Serial Number", + "disposedDate": "Disposed Date", + "netBookValue": "Net Book Value", + "purchasedPrice": "Purchased Price", + "usefulLife": "Useful Life", + "yearsUsed": "Years Used", + "faRequest": "FA Disposal Request", + "showMore": "Show More", + "buyerDetails": "Buyer Details" }; 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 b748380..1a1cf95 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -606,5 +606,27 @@ abstract class LocaleKeys { static const benefits = 'benefits'; static const mazayaDesc = 'mazayaDesc'; static const viewallofferMazaya = 'viewallofferMazaya'; + static const buyerName = 'buyerName'; + static const buyerNumber = 'buyerNumber'; + static const highestBidder = 'highestBidder'; + static const remarks = 'remarks'; + static const faHeader = 'faHeader'; + static const bookTypeCode = 'bookTypeCode'; + static const categoryCode = 'categoryCode'; + static const categoryGroup = 'categoryGroup'; + static const faLINES = 'faLINES'; + static const assetNumber = 'assetNumber'; + static const assetDescription = 'assetDescription'; + static const barCodeNumber = 'barCodeNumber'; + static const datePlaceInService = 'datePlaceInService'; + static const serialNumber = 'serialNumber'; + static const disposedDate = 'disposedDate'; + static const netBookValue = 'netBookValue'; + static const purchasedPrice = 'purchasedPrice'; + static const usefulLife = 'usefulLife'; + static const yearsUsed = 'yearsUsed'; + static const faRequest = 'faRequest'; + static const showMore = 'showMore'; + static const buyerDetails = 'buyerDetails'; } diff --git a/lib/models/dashboard/get_accural_ticket_balance_model.dart b/lib/models/dashboard/get_accural_ticket_balance_model.dart new file mode 100644 index 0000000..cc6520d --- /dev/null +++ b/lib/models/dashboard/get_accural_ticket_balance_model.dart @@ -0,0 +1,25 @@ +import 'dart:convert'; + +class GetTicketAccuralBalanceModel { + int? accrualNetEntitlement; + String? accuralPlanCode; + + GetTicketAccuralBalanceModel({ + this.accrualNetEntitlement, + this.accuralPlanCode, + }); + + factory GetTicketAccuralBalanceModel.fromRawJson(String str) => GetTicketAccuralBalanceModel.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); + + factory GetTicketAccuralBalanceModel.fromJson(Map json) => GetTicketAccuralBalanceModel( + accrualNetEntitlement: json["ACCRUAL_NET_ENTITLEMENT"], + accuralPlanCode: json["ACCURAL_PLAN_CODE"], + ); + + Map toJson() => { + "ACCRUAL_NET_ENTITLEMENT": accrualNetEntitlement, + "ACCURAL_PLAN_CODE": accuralPlanCode, + }; +} diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 74cef13..df94c8b 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -5,6 +5,7 @@ import 'package:mohem_flutter_app/models/add_attachment_list_model.dart'; import 'package:mohem_flutter_app/models/basic_member_information_model.dart'; import 'package:mohem_flutter_app/models/dashboard/event_activity.dart'; import 'package:mohem_flutter_app/models/dashboard/get_accrual_balances_list_model.dart'; +import 'package:mohem_flutter_app/models/dashboard/get_accural_ticket_balance_model.dart'; import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart'; import 'package:mohem_flutter_app/models/dashboard/get_open_missing_swipes_list_model.dart'; import 'package:mohem_flutter_app/models/dashboard/get_open_notifications_list.dart'; @@ -107,6 +108,7 @@ import 'package:mohem_flutter_app/models/vacation_rule/vr_item_types_list_model. import 'package:mohem_flutter_app/models/vacation_rule/wf_look_up_list_model.dart'; import 'package:mohem_flutter_app/models/validate_eit_transaction_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/GetRFCEmployeeList.dart'; +import 'package:mohem_flutter_app/models/worklist/get_fad_notifications.dart'; import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/eit_otification_body_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_address_notification_body_list.dart'; @@ -177,6 +179,7 @@ class GenericResponseModel { List? getAbsenceDffStructureList; List? getAbsenceTransactionList; List? getAccrualBalancesList; + List? getAccrualBalancesTicketList; List? getActionHistoryList; List? getPRActionHistoryList; List? getAddressDffStructureList; @@ -386,6 +389,7 @@ class GenericResponseModel { String? validatePhonesTransactionList; List? vrItemTypesList; List? wFLookUpList; + GetFaDisposalNtfDetails? getFADisposalNtfDetails; String? eLearningGETEMPLOYEEPROFILEList; String? eLearningLOGINList; String? eLearningValidateLoginList; @@ -451,6 +455,7 @@ class GenericResponseModel { this.getAbsenceDffStructureList, this.getAbsenceTransactionList, this.getAccrualBalancesList, + this.getAccrualBalancesTicketList, this.getActionHistoryList, this.getPRActionHistoryList, this.getAddressDffStructureList, @@ -664,6 +669,7 @@ class GenericResponseModel { this.ePharmacyGetItemOnHandList, this.isActiveCode, this.isSMSSent, + this.getFADisposalNtfDetails }); GenericResponseModel.fromJson(Map json) { @@ -782,6 +788,8 @@ class GenericResponseModel { } getAccrualBalancesList = json["GetAccrualBalancesList"] == null ? null : List.from(json["GetAccrualBalancesList"].map((x) => GetAccrualBalancesList.fromJson(x))); + getAccrualBalancesTicketList = + json["GetAccrualBalancesTicketList"] == null ? null : List.from(json["GetAccrualBalancesTicketList"].map((x) => GetTicketAccuralBalanceModel.fromJson(x))); if (json['GetActionHistoryList'] != null) { getActionHistoryList = []; @@ -933,6 +941,9 @@ class GenericResponseModel { }); } + getFADisposalNtfDetails = json['GetFADisposalNtfDetails'] != null ? GetFaDisposalNtfDetails.fromJson(json['GetFADisposalNtfDetails']) : null; + + if (json['GetEarningsList'] != null) { getEarningsList = []; json['GetEarningsList'].forEach((v) { @@ -1545,10 +1556,12 @@ class GenericResponseModel { data['GetAbsenceTransactionList'] = this.getAbsenceTransactionList!.map((v) => v.toJson()).toList(); } data['GetAccrualBalancesList'] = this.getAccrualBalancesList; + data['GetAccrualBalancesTicketList'] = this.getAccrualBalancesTicketList; if (this.getActionHistoryList != null) { data['GetActionHistoryList'] = this.getActionHistoryList!.map((v) => v.toJson()).toList(); } + data['GetFADisposalNtfDetails'] =this.getFADisposalNtfDetails; data['GetAddressDffStructureList'] = this.getAddressDffStructureList; data['GetAddressNotificationBodyList'] = this.getAddressNotificationBodyList; @@ -1955,9 +1968,9 @@ class PortalDirectionData { Map toJson() => {"P_REDIRECTION": pRedirection, "ClientID": clientID}; } - class TicketBookingResult { final bool success; final String? clientId; + TicketBookingResult(this.success, this.clientId); -} \ No newline at end of file +} diff --git a/lib/models/worklist/get_fad_notifications.dart b/lib/models/worklist/get_fad_notifications.dart new file mode 100644 index 0000000..3a7ed2d --- /dev/null +++ b/lib/models/worklist/get_fad_notifications.dart @@ -0,0 +1,233 @@ +import 'dart:convert'; + +class GetFaDisposalNtfDetails { + List? pFaBuyers; + List? pFaHeader; + List? pFaLines; + String? pInformation; + dynamic pQuestion; + + GetFaDisposalNtfDetails({ + this.pFaBuyers, + this.pFaHeader, + this.pFaLines, + this.pInformation, + this.pQuestion, + }); + + factory GetFaDisposalNtfDetails.fromRawJson(String str) => GetFaDisposalNtfDetails.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); + + factory GetFaDisposalNtfDetails.fromJson(Map json) => GetFaDisposalNtfDetails( + pFaBuyers: json["P_FA_BUYERS"] == null ? [] : List.from(json["P_FA_BUYERS"]!.map((x) => PFaBuyer.fromJson(x))), + pFaHeader: json["P_FA_HEADER"] == null ? [] : List.from(json["P_FA_HEADER"]!.map((x) => PFaHeader.fromJson(x))), + pFaLines: json["P_FA_LINES"] == null ? [] : List.from(json["P_FA_LINES"]!.map((x) => PFaLine.fromJson(x))), + pInformation: json["P_INFORMATION"], + pQuestion: json["P_QUESTION"], + ); + + Map toJson() => { + "P_FA_BUYERS": pFaBuyers == null ? [] : List.from(pFaBuyers!.map((x) => x.toJson())), + "P_FA_HEADER": pFaHeader == null ? [] : List.from(pFaHeader!.map((x) => x.toJson())), + "P_FA_LINES": pFaLines == null ? [] : List.from(pFaLines!.map((x) => x.toJson())), + "P_INFORMATION": pInformation, + "P_QUESTION": pQuestion, + }; +} + +class PFaBuyer { + int? amount; + String? buyerName; + String? buyerNumber; + int? fromRowNum; + String? highestBidder; + int? noOfRows; + String? receiptNumber; + String? remarks; + int? requestNo; + int? rowNum; + int? toRowNum; + + PFaBuyer({ + this.amount, + this.buyerName, + this.buyerNumber, + this.fromRowNum, + this.highestBidder, + this.noOfRows, + this.receiptNumber, + this.remarks, + this.requestNo, + this.rowNum, + this.toRowNum, + }); + + factory PFaBuyer.fromRawJson(String str) => PFaBuyer.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); + + factory PFaBuyer.fromJson(Map json) => PFaBuyer( + amount: json["AMOUNT"], + buyerName: json["BUYER_NAME"], + buyerNumber: json["BUYER_NUMBER"], + fromRowNum: json["FROM_ROW_NUM"], + highestBidder: json["HIGHEST_BIDDER"], + noOfRows: json["NO_OF_ROWS"], + receiptNumber: json["RECEIPT_NUMBER"], + remarks: json["REMARKS"], + requestNo: json["REQUEST_NO"], + rowNum: json["ROW_NUM"], + toRowNum: json["TO_ROW_NUM"], + ); + + Map toJson() => { + "AMOUNT": amount, + "BUYER_NAME": buyerName, + "BUYER_NUMBER": buyerNumber, + "FROM_ROW_NUM": fromRowNum, + "HIGHEST_BIDDER": highestBidder, + "NO_OF_ROWS": noOfRows, + "RECEIPT_NUMBER": receiptNumber, + "REMARKS": remarks, + "REQUEST_NO": requestNo, + "ROW_NUM": rowNum, + "TO_ROW_NUM": toRowNum, + }; +} + +class PFaHeader { + String? bookTypeCode; + String? categoryCode; + String? categoryGroup; + String? comments; + int? requestNo; + String? status; + + PFaHeader({ + this.bookTypeCode, + this.categoryCode, + this.categoryGroup, + this.comments, + this.requestNo, + this.status, + }); + + factory PFaHeader.fromRawJson(String str) => PFaHeader.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); + + factory PFaHeader.fromJson(Map json) => PFaHeader( + bookTypeCode: json["BOOK_TYPE_CODE"], + categoryCode: json["CATEGORY_CODE"], + categoryGroup: json["CATEGORY_GROUP"], + comments: json["COMMENTS"], + requestNo: json["REQUEST_NO"], + status: json["STATUS"], + ); + + Map toJson() => { + "BOOK_TYPE_CODE": bookTypeCode, + "CATEGORY_CODE": categoryCode, + "CATEGORY_GROUP": categoryGroup, + "COMMENTS": comments, + "REQUEST_NO": requestNo, + "STATUS": status, + }; +} + +class PFaLine { + String? action; + String? assetDescription; + int? assetNumber; + String? barcodeNumber; + String? bme; + String? datePlacedInService; + String? department; + String? disposedDate; + int? fromRowNum; + double? netBookValue; + int? noOfRows; + String? poNumber; + double? purchasePrice; + int? quantity; + int? requestNo; + int? rowNum; + String? serialNumber; + int? toRowNum; + int? usefulLife; + String? yearsUsed; + + PFaLine({ + this.action, + this.assetDescription, + this.assetNumber, + this.barcodeNumber, + this.bme, + this.datePlacedInService, + this.department, + this.disposedDate, + this.fromRowNum, + this.netBookValue, + this.noOfRows, + this.poNumber, + this.purchasePrice, + this.quantity, + this.requestNo, + this.rowNum, + this.serialNumber, + this.toRowNum, + this.usefulLife, + this.yearsUsed, + }); + + factory PFaLine.fromRawJson(String str) => PFaLine.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); + + factory PFaLine.fromJson(Map json) => PFaLine( + action: json["ACTION"], + assetDescription: json["ASSET_DESCRIPTION"], + assetNumber: json["ASSET_NUMBER"], + barcodeNumber: json["BARCODE_NUMBER"], + bme: json["BME"], + datePlacedInService: json["DATE_PLACED_IN_SERVICE"], + department: json["DEPARTMENT"], + disposedDate: json["DISPOSED_DATE"], + fromRowNum: json["FROM_ROW_NUM"], + netBookValue: json["NET_BOOK_VALUE"]?.toDouble(), + noOfRows: json["NO_OF_ROWS"], + poNumber: json["PO_NUMBER"], + purchasePrice: json["PURCHASE_PRICE"]?.toDouble(), + quantity: json["QUANTITY"], + requestNo: json["REQUEST_NO"], + rowNum: json["ROW_NUM"], + serialNumber: json["SERIAL_NUMBER"], + toRowNum: json["TO_ROW_NUM"], + usefulLife: json["USEFUL_LIFE"], + yearsUsed: json["YEARS_USED"], + ); + + Map toJson() => { + "ACTION": action, + "ASSET_DESCRIPTION": assetDescription, + "ASSET_NUMBER": assetNumber, + "BARCODE_NUMBER": barcodeNumber, + "BME": bme, + "DATE_PLACED_IN_SERVICE": datePlacedInService, + "DEPARTMENT": department, + "DISPOSED_DATE": disposedDate, + "FROM_ROW_NUM": fromRowNum, + "NET_BOOK_VALUE": netBookValue, + "NO_OF_ROWS": noOfRows, + "PO_NUMBER": poNumber, + "PURCHASE_PRICE": purchasePrice, + "QUANTITY": quantity, + "REQUEST_NO": requestNo, + "ROW_NUM": rowNum, + "SERIAL_NUMBER": serialNumber, + "TO_ROW_NUM": toRowNum, + "USEFUL_LIFE": usefulLife, + "YEARS_USED": yearsUsed, + }; +} diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index fc53773..05c9ebb 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -11,6 +11,7 @@ import 'package:mohem_flutter_app/main.dart'; import 'package:mohem_flutter_app/models/dashboard/drawer_menu_item_model.dart'; import 'package:mohem_flutter_app/models/dashboard/event_activity.dart'; import 'package:mohem_flutter_app/models/dashboard/get_accrual_balances_list_model.dart'; +import 'package:mohem_flutter_app/models/dashboard/get_accural_ticket_balance_model.dart'; import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart'; import 'package:mohem_flutter_app/models/dashboard/get_open_notifications_list.dart'; import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; @@ -18,6 +19,7 @@ import 'package:mohem_flutter_app/models/dashboard/list_menu.dart'; import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/dashboard/menus.dart'; import 'package:mohem_flutter_app/models/dashboard/mohemm_itg_pending_task_responseitem.dart'; +import 'package:mohem_flutter_app/models/eit/get_eit_transaction_model.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/itg/itg_response_model.dart'; import 'package:mohem_flutter_app/models/offers_and_discounts/get_offers_list.dart'; @@ -44,10 +46,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { //Leave and Ticket Balance bool isLeaveTicketBalanceLoading = true; List? accrualList; + List? accrualTicketBalanceList; GetAccrualBalancesList? leaveBalanceAccrual; double get leaveBalance => leaveBalanceAccrual?.accrualNetEntitlement ?? 0; double ticketBalance = 0; + double walletBalance = 0; //Menu Entries bool isServicesMenusLoading = true; @@ -56,6 +60,8 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { List? getMenuEntriesList; EventActivityList? eventActivity; + TicketBookingResult? ticketBookingResponse; + List>? ticketHistoryTransactionList = []; //Offers And Discounts bool isOffersLoading = true; @@ -99,6 +105,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { isLeaveTicketBalanceLoading = true; accrualList = null; + accrualTicketBalanceList = null; leaveBalanceAccrual = null; ticketBalance = 0; @@ -201,6 +208,20 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { isLeaveTicketBalanceLoading = false; leaveBalanceAccrual = accrualList![0]; ticketBalance = (accrualList![1].accrualNetEntitlement ?? 0.0) + (accrualList![2].accrualNetEntitlement ?? 0.0) + (accrualList![3].accrualNetEntitlement ?? 0.0); + walletBalance = (accrualList![4].accrualNetEntitlement ?? 0.0); + notifyListeners(); + } catch (ex) { + isLeaveTicketBalanceLoading = false; + logger.wtf(ex); + notifyListeners(); + Utils.handleException(ex, context, null); + } + } + + Future fetchTicketAccuralBalance(context, DateTime date) async { + try { + accrualTicketBalanceList = await DashboardApiClient().getTicketAccuralBalance(DateFormat("MM/dd/yyyy", "en_US").format(date)); + isLeaveTicketBalanceLoading = false; notifyListeners(); } catch (ex) { isLeaveTicketBalanceLoading = false; @@ -285,19 +306,34 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } } - Future fetchTicketBooking() async { + Future fetchTicketBooking() async { try { GenericResponseModel? genericResponseModel = await DashboardApiClient().getTicketBookingRedirection(); if (genericResponseModel?.portalDirectionData?.pRedirection!.toLowerCase() == "alma") { - return TicketBookingResult(true, genericResponseModel?.portalDirectionData?.clientID); + ticketBookingResponse = TicketBookingResult(true, genericResponseModel?.portalDirectionData?.clientID); + return; } - return TicketBookingResult(false, null); + ticketBookingResponse = TicketBookingResult(false, null); + } catch (ex) { + logger.wtf(ex); + isEventLoadingLoading = false; + notifyListeners(); + Utils.handleException(ex, null, null); + ticketBookingResponse = TicketBookingResult(false, null); // Ensure a return value in case of an exception + } + } + + void fetchTicketBalance() async { + try { + GenericResponseModel? ticketResponse = await DashboardApiClient().getTicketBalance(); + logger.d("Ticket Balance Response: ${ticketResponse?.toJson()}"); + print(" ========= Ticket Balance Response ======= "); } catch (ex) { logger.wtf(ex); isEventLoadingLoading = false; notifyListeners(); Utils.handleException(ex, null, null); - return TicketBookingResult(false, null); // Ensure a return value in case of an exception + // ticketBookingResponse = TicketBookingResult(false, null); // Ensure a return value in case of an exception } } diff --git a/lib/provider/eit_provider_model.dart b/lib/provider/eit_provider_model.dart index 1543184..75a210f 100644 --- a/lib/provider/eit_provider_model.dart +++ b/lib/provider/eit_provider_model.dart @@ -18,6 +18,7 @@ import 'package:mohem_flutter_app/widgets/Updater.dart'; class EITProviderModel with ChangeNotifier, DiagnosticableTreeMixin { List? eitTransactionList; late bool isEitLoaded = false; + void getEITList(String functionName) async { try { eitTransactionList = await EITApiClient().getEITTransactions(functionName); diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index d3ecb9f..3122d17 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -56,6 +56,8 @@ class _DashboardScreenState extends State with WidgetsBindingOb int currentIndex = 0; + bool isDisplayMazaya = false; + @override void initState() { WidgetsBinding.instance.addObserver(this); @@ -149,10 +151,11 @@ class _DashboardScreenState extends State with WidgetsBindingOb data.fetchAttendanceTracking(context); data.fetchWorkListCounter(context); data.fetchMissingSwipe(context); + data.fetchLeaveTicketBalance(context, DateTime.now()); data.fetchMenuEntries(); data.fetchEventActivity(); - // data.getCategoryOffersListAPI(context); + data.getCategoryOffersListAPI(context); marathonProvider.getMarathonDetailsFromApi(); marathonProvider.getMarathonTutorial(); if (isFromInit) { @@ -160,6 +163,13 @@ class _DashboardScreenState extends State with WidgetsBindingOb } if (!cProvider.disbaleChatForThisUser && !isFromInit) checkHubCon(); _refreshController.refreshCompleted(); + + // await data.fetchTicketBooking(); + + // if (data.ticketBookingResponse != null && !data.ticketBookingResponse!.success) { + // // data.fetchTicketBalance(); + // } + //continue here } int ermIndex = 0; @@ -305,103 +315,103 @@ class _DashboardScreenState extends State with WidgetsBindingOb child: Consumer( builder: (BuildContext context, DashboardProviderModel model, Widget? child) { return (model.isAttendanceTrackingLoading - ? GetAttendanceTrackingShimmer() - : Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - gradient: const LinearGradient( - transform: GradientRotation(.46), - begin: Alignment.topRight, - end: Alignment.bottomLeft, - colors: [MyColors.gradiantEndColor, MyColors.gradiantStartColor], - ), - ), - child: Stack( - alignment: Alignment.center, - children: [ - if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true), - if (model.isTimeRemainingInSeconds == 0) DateTime.now().toString().split(" ")[0].toText12(color: Colors.white), - if (model.isTimeRemainingInSeconds != 0) - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - 9.height, - Directionality( - textDirection: ui.TextDirection.ltr, - child: CountdownTimer( - endTime: model.endTime, - onEnd: null, - endWidget: "00:00:00".toText14(color: Colors.white, isBold: true), - textStyle: const TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold), - ), - ), - LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white), - 9.height, - ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(20)), - child: LinearProgressIndicator( - value: model.progress, - minHeight: 8, - valueColor: const AlwaysStoppedAnimation(Colors.white), - backgroundColor: const Color(0xff196D73), - ), - ), - ], - ), - ], - ).paddingOnly(top: 12, right: 15, left: 12), - ), - Row( + ? GetAttendanceTrackingShimmer() + : Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + gradient: const LinearGradient( + transform: GradientRotation(.46), + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [MyColors.gradiantEndColor, MyColors.gradiantStartColor], + ), + ), + child: Stack( + alignment: Alignment.center, + children: [ + if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true), + if (model.isTimeRemainingInSeconds == 0) DateTime.now().toString().split(" ")[0].toText12(color: Colors.white), + if (model.isTimeRemainingInSeconds != 0) + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.checkIn.tr().toText12(color: Colors.white), - (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn).toString().toText14( - color: Colors.white, - isBold: true, - ), - 4.height, - ], - ).paddingOnly(left: 12, right: 12), + 9.height, + Directionality( + textDirection: ui.TextDirection.ltr, + child: CountdownTimer( + endTime: model.endTime, + onEnd: null, + endWidget: "00:00:00".toText14(color: Colors.white, isBold: true), + textStyle: const TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold), + ), ), - Container( - margin: EdgeInsets.only(top: AppState().isArabic(context) ? 6 : 0), - width: 45, - height: 45, - padding: const EdgeInsets.only(left: 10, right: 10), - decoration: BoxDecoration( - color: const Color(0xff259EA4), - borderRadius: BorderRadius.only( - bottomRight: AppState().isArabic(context) ? const Radius.circular(0) : const Radius.circular(15), - bottomLeft: AppState().isArabic(context) ? const Radius.circular(15) : const Radius.circular(0), - ), + LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white), + 9.height, + ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(20)), + child: LinearProgressIndicator( + value: model.progress, + minHeight: 8, + valueColor: const AlwaysStoppedAnimation(Colors.white), + backgroundColor: const Color(0xff196D73), ), - child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/biometrics.svg" : "assets/images/biometrics.svg"), - ).onPress(() { - showMyBottomSheet(context, callBackFunc: () {}, child: MarkAttendanceWidget(model, isFromDashboard: true)); - }), + ), ], ), - ], + ], + ).paddingOnly(top: 12, right: 15, left: 12), + ), + Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.checkIn.tr().toText12(color: Colors.white), + (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn).toString().toText14( + color: Colors.white, + isBold: true, + ), + 4.height, + ], + ).paddingOnly(left: 12, right: 12), ), + Container( + margin: EdgeInsets.only(top: AppState().isArabic(context) ? 6 : 0), + width: 45, + height: 45, + padding: const EdgeInsets.only(left: 10, right: 10), + decoration: BoxDecoration( + color: const Color(0xff259EA4), + borderRadius: BorderRadius.only( + bottomRight: AppState().isArabic(context) ? const Radius.circular(0) : const Radius.circular(15), + bottomLeft: AppState().isArabic(context) ? const Radius.circular(15) : const Radius.circular(0), + ), + ), + child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/biometrics.svg" : "assets/images/biometrics.svg"), + ).onPress(() { + showMyBottomSheet(context, callBackFunc: () {}, child: MarkAttendanceWidget(model, isFromDashboard: true)); + }), ], ), - ).onPress(() { - Navigator.pushNamed(context, AppRoutes.todayAttendance); - })) + ], + ), + ], + ), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.todayAttendance); + })) .animatedSwither(); }, ), @@ -414,116 +424,238 @@ class _DashboardScreenState extends State with WidgetsBindingOb ], ).paddingOnly(left: 21, right: 21, top: 7, bottom: 21), eventActivityWidget(context), + + if (isDisplayMazaya) ...[ + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Directionality( + textDirection: AppState().isArabic(context) ? ui.TextDirection.rtl : ui.TextDirection.ltr, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + gradient: const LinearGradient(colors: [Color(0xFF91C481), Color(0xFF7CCED7)], begin: Alignment.centerLeft, end: Alignment.centerRight), + ), + child: Padding( + padding: const EdgeInsets.all(3.0), // This creates the border width + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(17), // Slightly less than outer radius + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + flex: 4, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + flex: 2, + child: RichText( + text: + AppState().isArabic(context) + ? TextSpan( + children: [ + TextSpan( + text: 'اطلع على مميزات', + style: TextStyle( + fontSize: 16, + letterSpacing: -0.2, + fontFamily: AppState().isArabic(context) ? 'Cairo' : 'Poppins', + fontWeight: FontWeight.w700, + height: 24 / 16, + color: Color(0xFF5D5E5E), + ), + ), + TextSpan( + text: ' مزايا', + style: TextStyle( + fontSize: 16, + fontFamily: AppState().isArabic(context) ? 'Cairo' : 'Poppins', + fontWeight: FontWeight.w700, + letterSpacing: -0.2, + height: 24 / 16, + color: MyColors.mazayaRedColor, // Use your MAZAYA red color here if defined, e.g. MyColors.mazayaRed + ), + ), + ], + ) + : TextSpan( + children: [ + TextSpan( + text: LocaleKeys.explore.tr() + ' ', + style: const TextStyle( + fontSize: 16, + letterSpacing: -0.2, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + height: 24 / 16, + color: Color(0xFF5D5E5E), + ), + ), + TextSpan( + text: LocaleKeys.mazaya.tr(), + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.w700, + fontFamily: 'Poppins', + letterSpacing: -0.2, + height: 24 / 16, + color: MyColors.mazayaRedColor, // Use your MAZAYA red color here if defined, e.g. MyColors.mazayaRed + ), + ), + TextSpan( + text: ' ' + LocaleKeys.benefits.tr(), + style: const TextStyle( + fontSize: 16, + letterSpacing: -0.2, + fontFamily: 'Poppins', + fontWeight: FontWeight.w700, + height: 24 / 16, + color: Color(0xFF5D5E5E), + ), + ), + ], + ), + ), + ), + const Expanded(flex: 1, child: SizedBox()), + ], + ), + const SizedBox(height: 8), + LocaleKeys.mazayaDesc.tr().toText11(color: const Color(0xFF5D5E5E)), + ], + ), + ), + Expanded( + flex: 2, + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + SvgPicture.asset("assets/icons/mazaya_brand.svg", width: 90, height: 47), + const SizedBox(height: 28), + LocaleKeys.viewallofferMazaya.tr().toText12(isUnderLine: true, color: const Color(0xFF3B3D4A)).onPress(() { + Navigator.pushNamed(context, AppRoutes.offersAndDiscounts); + }), + ], + ), + ), + ], + ).paddingOnly(left: 21, right: 21, top: 14, bottom: 14), + ), + ), + ).paddingOnly(left: 21, right: 21, top: 0, bottom: 21), + ), + ], + ), + ], + Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Directionality( - textDirection: AppState().isArabic(context) ? ui.TextDirection.rtl : ui.TextDirection.ltr, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - gradient: const LinearGradient(colors: [Color(0xFF91C481), Color(0xFF7CCED7)], begin: Alignment.centerLeft, end: Alignment.centerRight), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + LocaleKeys.offers.tr().toText12(), + Row( + children: [ + LocaleKeys.discounts.tr().toText24(isBold: true), + 6.width, + Container( + padding: const EdgeInsets.only(left: 8, right: 8), + decoration: BoxDecoration( + color: MyColors.yellowColor, + borderRadius: BorderRadius.circular(10), + ), + child: LocaleKeys.newString.tr().toText10(isBold: true)), + ], + ), + ], + ), ), - child: Padding( - padding: const EdgeInsets.all(3.0), // This creates the border width - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(17), // Slightly less than outer radius - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - flex: 4, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Row( - children: [ - Expanded( - flex: 2, - child: RichText( - text: - AppState().isArabic(context) - ? TextSpan( - children: [ - TextSpan( - text: 'اطلع على مميزات', - style: TextStyle(fontSize: 16, letterSpacing: -0.2, fontFamily: AppState().isArabic(context) ? 'Cairo' : 'Poppins', fontWeight: FontWeight.w700, height: 24 / 16, color: Color(0xFF5D5E5E)), - ), - TextSpan( - text: ' مزايا', - style: TextStyle( - fontSize: 16, - fontFamily: AppState().isArabic(context) ? 'Cairo' : 'Poppins', - fontWeight: FontWeight.w700, - letterSpacing: -0.2, - height: 24 / 16, - color: MyColors.mazayaRedColor, // Use your MAZAYA red color here if defined, e.g. MyColors.mazayaRed - ), - ), - ], - ) - : TextSpan( - children: [ - TextSpan( - text: LocaleKeys.explore.tr() + ' ', - style: const TextStyle(fontSize: 16, letterSpacing: -0.2, fontFamily: 'Poppins', fontWeight: FontWeight.w700, height: 24 / 16, color: Color(0xFF5D5E5E)), - ), - TextSpan( - text: LocaleKeys.mazaya.tr(), - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.w700, - fontFamily: 'Poppins', - letterSpacing: -0.2, - height: 24 / 16, - color: MyColors.mazayaRedColor, // Use your MAZAYA red color here if defined, e.g. MyColors.mazayaRed - ), - ), - TextSpan( - text: ' ' + LocaleKeys.benefits.tr(), - style: const TextStyle(fontSize: 16, letterSpacing: -0.2, - fontFamily: 'Poppins',fontWeight: FontWeight.w700, height: 24 / 16, color: Color(0xFF5D5E5E)), - ), - ], - ), + LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true).onPress(() { + Navigator.pushNamed(context, AppRoutes.offersAndDiscounts); + }) + ], + ).paddingOnly(left: 21, right: 21), + Consumer( + builder: (BuildContext context, DashboardProviderModel model, Widget? child) { + return SizedBox( + height: 103 + 33, + child: ListView.separated( + shrinkWrap: true, + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.only(left: 21, right: 21, top: 13), + scrollDirection: Axis.horizontal, + itemBuilder: (BuildContext cxt, int index) { + return model.isOffersLoading + ? const OffersShimmerWidget() + : InkWell( + onTap: () { + navigateToDetails(data.getOffersList[index]); + }, + child: SizedBox( + width: 73, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 73, + height: 73, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: const BorderRadius.all( + Radius.circular(100), ), + border: Border.all(color: MyColors.lightGreyE3Color, width: 1), ), - const Expanded(flex: 1, child: SizedBox()), - ], - ), - const SizedBox(height: 8), - LocaleKeys.mazayaDesc.tr().toText11(color: const Color(0xFF5D5E5E)), - ], - ), - ), - Expanded( - flex: 2, - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - SvgPicture.asset("assets/icons/mazaya_brand.svg", width: 90, height: 47), - const SizedBox(height: 28), - LocaleKeys.viewallofferMazaya.tr().toText12(isUnderLine: true, color: const Color(0xFF3B3D4A)).onPress(() { - Navigator.pushNamed(context, AppRoutes.offersAndDiscounts); - }), - ], + child: ClipRRect( + borderRadius: const BorderRadius.all( + Radius.circular(50), + ), + child: Hero( + tag: "ItemImage" + data.getOffersList[index].offersDiscountId.toString()!, + transitionOnUserGestures: true, + child: Image.network( + data.getOffersList[index].logo ?? "", + fit: BoxFit.contain, + ), + ), + ), + ), + 4.height, + Expanded( + child: AppState().isArabic(context) + ? data.getOffersList[index].titleAr!.toText12(isCenter: true, maxLine: 1) + : data.getOffersList[index].titleEn!.toText12(isCenter: true, maxLine: 1), + ), + ], + ), ), - ), - ], - ).paddingOnly(left: 21, right: 21, top: 14, bottom: 14), - ), - ), - ).paddingOnly(left: 21, right: 21, top: 0, bottom: 21), + ); + }, + separatorBuilder: (BuildContext cxt, int index) => 8.width, + itemCount: 9), + ); + }, ), ], ), + Container( width: double.infinity, padding: const EdgeInsets.only(top: 31), @@ -595,7 +727,10 @@ class _DashboardScreenState extends State with WidgetsBindingOb height: Platform.isAndroid ? 70 : 100, child: BottomNavigationBar( items: [ - BottomNavigationBarItem(icon: SvgPicture.asset("assets/icons/home.svg", color: currentIndex == 0 ? MyColors.grey3AColor : MyColors.grey98Color).paddingAll(4), label: LocaleKeys.home.tr()), + BottomNavigationBarItem( + icon: SvgPicture.asset("assets/icons/home.svg", color: currentIndex == 0 ? MyColors.grey3AColor : MyColors.grey98Color).paddingAll(4), + label: LocaleKeys.home.tr(), + ), BottomNavigationBarItem( icon: SvgPicture.asset("assets/icons/create_req.svg", color: currentIndex == 1 ? MyColors.grey3AColor : MyColors.grey98Color).paddingAll(4), label: LocaleKeys.mowadhafhiRequest.tr(), @@ -637,28 +772,28 @@ class _DashboardScreenState extends State with WidgetsBindingOb SvgPicture.asset( "assets/icons/chat/chat.svg", color: - !checkIfPrivilegedForChat() - ? MyColors.lightGreyE3Color - : currentIndex == 4 - ? MyColors.grey3AColor - : cProvider.disbaleChatForThisUser - ? MyColors.lightGreyE3Color - : MyColors.grey98Color, + !checkIfPrivilegedForChat() + ? MyColors.lightGreyE3Color + : currentIndex == 4 + ? MyColors.grey3AColor + : cProvider.disbaleChatForThisUser + ? MyColors.lightGreyE3Color + : MyColors.grey98Color, ).paddingAll(4), Consumer( builder: (BuildContext cxt, ChatProviderModel data, Widget? child) { return !checkIfPrivilegedForChat() ? const SizedBox() : Positioned( - right: 0, - top: 0, - child: Container( - padding: const EdgeInsets.only(left: 4, right: 4), - alignment: Alignment.center, - decoration: BoxDecoration(color: cProvider.disbaleChatForThisUser ? MyColors.pinkDarkColor : MyColors.redColor, borderRadius: BorderRadius.circular(17)), - child: data.chatUConvCounter.toString().toText10(color: Colors.white), - ), - ); + right: 0, + top: 0, + child: Container( + padding: const EdgeInsets.only(left: 4, right: 4), + alignment: Alignment.center, + decoration: BoxDecoration(color: cProvider.disbaleChatForThisUser ? MyColors.pinkDarkColor : MyColors.redColor, borderRadius: BorderRadius.circular(17)), + child: data.chatUConvCounter.toString().toText10(color: Colors.white), + ), + ); }, ), ], @@ -729,4 +864,4 @@ class _DashboardScreenState extends State with WidgetsBindingOb } return false; } -} +} \ No newline at end of file diff --git a/lib/ui/landing/itg/its_add_screen_video_image.dart b/lib/ui/landing/itg/its_add_screen_video_image.dart index 103fde1..2076d7c 100644 --- a/lib/ui/landing/itg/its_add_screen_video_image.dart +++ b/lib/ui/landing/itg/its_add_screen_video_image.dart @@ -146,7 +146,7 @@ class _ITGAdsScreenState extends State { centerTitle: true, automaticallyImplyLeading: false, backgroundColor: Colors.white, - title: (AppState().isArabic(context) ? advertisementData!.advertisementTitleAr! : advertisementData!.advertisementTitleAr!).toText24(color: MyColors.darkTextColor, isBold: true), + title: (AppState().isArabic(context) ? advertisementData!.advertisementTitleAr! : advertisementData!.advertisementTitle!).toText24(color: MyColors.darkTextColor, isBold: true), //advertisementData!.viewAttachFileColl!.first.base64String!.toText24(color: MyColors.darkTextColor, isBold: true), ) diff --git a/lib/ui/landing/widget/app_drawer.dart b/lib/ui/landing/widget/app_drawer.dart index f754e1b..e18518b 100644 --- a/lib/ui/landing/widget/app_drawer.dart +++ b/lib/ui/landing/widget/app_drawer.dart @@ -120,7 +120,7 @@ class _AppDrawerState extends State { menuItem("assets/images/drawer/employee_id.svg", LocaleKeys.employeeDigitalID.tr(), "", closeDrawer: false, onPress: () => showMDialog(context, child: EmployeeDigitialIdDialog())), if (AppState().businessCardPrivilege) menuItem("assets/images/drawer/view_business_card.svg", LocaleKeys.viewBusinessCard.tr(), "", closeDrawer: false, onPress: () => showMDialog(context, child: BusinessCardDialog(), isBusniessCard: true)), - menuItem("assets/images/drawer/logout.svg", LocaleKeys.logout.tr(), "", color: MyColors.redA3Color, closeDrawer: false, onPress: performLogout), + menuItem("assets/images/drawer/logout.svg", LocaleKeys.logout.tr(), "", color: MyColors.redA3Color, closeDrawer: false, onPress: (){Utils.performLogout(context, chatData);}), // menuItem("assets/images/drawer/logout.svg", LocaleKeys.logout.tr(), "", color: MyColors.redA3Color, closeDrawer: false, onPress: () {Navigator.pushNamed(context, AppRoutes.survey,); ], ).expanded, @@ -171,13 +171,13 @@ class _AppDrawerState extends State { setState(() {}); } - void performLogout() async { - AppState().isAuthenticated = false; - AppState().isLogged = false; - AppState().setPostParamsInitConfig(); - // chatData.disposeData(); - // SharedPreferences prefs = await SharedPreferences.getInstance(); - // await prefs.clear(); - Navigator.pushNamedAndRemoveUntil(context, AppRoutes.login, (Route route) => false, arguments: null); - } + // void performLogout() async { + // // AppState().isAuthenticated = false; + // // AppState().isLogged = false; + // // AppState().setPostParamsInitConfig(); + // // chatData.disposeData(); + // // // SharedPreferences prefs = await SharedPreferences.getInstance(); + // // // await prefs.clear(); + // // Navigator.pushNamedAndRemoveUntil(context, AppRoutes.login, (Route route) => false, arguments: null); + // } } diff --git a/lib/ui/landing/widget/menus_widget.dart b/lib/ui/landing/widget/menus_widget.dart index 64855ee..bc5dceb 100644 --- a/lib/ui/landing/widget/menus_widget.dart +++ b/lib/ui/landing/widget/menus_widget.dart @@ -27,114 +27,99 @@ class MenusWidget extends StatelessWidget { children: [ data.isWorkListLoading ? MenuShimmer().onPress(() { - data.fetchWorkListCounter(context, showLoading: true); - }) + data.fetchWorkListCounter(context, showLoading: true); + }) : Container( - decoration: BoxDecoration( - color: Color(namesColor[0]), - borderRadius: BorderRadius.circular(10), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.workList.tr().toText12(color: Colors.white), - Row( - children: [ - Expanded( - child: data.workListCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), - ), - RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), - ], - ) - ], - ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), - ).onPress(() { - Navigator.pushNamed(context, AppRoutes.workList); - }), + decoration: BoxDecoration(color: Color(namesColor[0]), borderRadius: BorderRadius.circular(10)), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.workList.tr().toText12(color: Colors.white), + Row( + children: [ + Expanded(child: data.workListCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1)), + RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), + ], + ), + ], + ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.workList); + }), data.isMissingSwipeLoading ? MenuShimmer().onPress(() { - data.fetchWorkListCounter(context); - }) + data.fetchWorkListCounter(context); + }) : Container( - decoration: BoxDecoration( - color: Color(namesColor[1]), - borderRadius: BorderRadius.circular(10), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.missingSwipes.tr().toText12(color: Colors.white), - Row( - children: [ - Expanded( - child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), - ), - RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), - ], - ) - ], - ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), - ).onPress(() { - Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.missingSwipes.tr(), "HMG_OTL_MISSING_SWIPE_EIT_SS")); - }), + decoration: BoxDecoration(color: Color(namesColor[1]), borderRadius: BorderRadius.circular(10)), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.missingSwipes.tr().toText12(color: Colors.white), + Row( + children: [ + Expanded(child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1)), + RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), + ], + ), + ], + ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.missingSwipes.tr(), "HMG_OTL_MISSING_SWIPE_EIT_SS")); + }), data.isLeaveTicketBalanceLoading ? MenuShimmer().onPress(() { - data.fetchWorkListCounter(context); - }) + data.fetchWorkListCounter(context); + }) : Container( - decoration: BoxDecoration( - color: Color(namesColor[2]), - borderRadius: BorderRadius.circular(10), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.leaveBalance.tr().toText12(color: Colors.white), - Row( - children: [ - Expanded( - child: data.leaveBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1), - ), - RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), - ], - ) - ], - ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), - ).onPress(() { - Navigator.pushNamed(context, AppRoutes.leaveBalance); - }), + decoration: BoxDecoration(color: Color(namesColor[2]), borderRadius: BorderRadius.circular(10)), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.leaveBalance.tr().toText12(color: Colors.white), + Row( + children: [ + Expanded(child: data.leaveBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1)), + RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), + ], + ), + ], + ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.leaveBalance); + }), data.isLeaveTicketBalanceLoading ? MenuShimmer().onPress(() { - data.fetchWorkListCounter(context); - }) + data.fetchWorkListCounter(context); + }) : Container( - decoration: BoxDecoration( - color: Color(namesColor[3]), - borderRadius: BorderRadius.circular(10), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.ticketBalance.tr().toText12(color: Colors.white), - Row( - children: [ - Expanded( - child: data.ticketBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1), - ), - RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), - ], - ) - ], - ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), - ).onPress( - () { - Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.ticketBalance.tr(), "HMG_TKT_NEW_EIT_SS")); - }, - ) + decoration: BoxDecoration(color: Color(namesColor[3]), borderRadius: BorderRadius.circular(10)), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + data.ticketBookingResponse != null && data.ticketBookingResponse!.success + ? "Wallet Balance".toText12(color: Colors.white) + : LocaleKeys.ticketBalance.tr().toText12(color: Colors.white), + Row( + children: [ + Expanded( + child: + data.ticketBookingResponse != null && data.ticketBookingResponse!.success + ? data.walletBalance.toStringAsFixed(0).toText16(color: Colors.white, isBold: true, maxlines: 1) + : data.ticketBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1), + ), + RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), + ], + ), + ], + ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.ticketBalance.tr(), "HMG_TKT_NEW_EIT_SS")); + }), ], ); }, diff --git a/lib/ui/landing/widget/services_widget.dart b/lib/ui/landing/widget/services_widget.dart index 7d2c2b2..879173b 100644 --- a/lib/ui/landing/widget/services_widget.dart +++ b/lib/ui/landing/widget/services_widget.dart @@ -5,6 +5,7 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:mohem_flutter_app/api/eit_api_client.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/inAppWebView.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; @@ -14,12 +15,14 @@ import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/main.dart'; +import 'package:mohem_flutter_app/models/dashboard/get_accural_ticket_balance_model.dart'; import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/sso_auth_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/services_menu_list_screen.dart'; +import 'package:mohem_flutter_app/ui/screens/ticket/ticket_detailed_screen.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; import 'package:mohem_flutter_app/widgets/sso_webview_widget.dart'; import 'package:provider/provider.dart'; @@ -254,16 +257,19 @@ class ServicesWidget extends StatelessWidget { } } else { if (menuEntry.menuName == "HMG_TICKET_REQUESTS") { - Utils.showLoading(context); - TicketBookingResult response = await pro.fetchTicketBooking(); - Utils.hideLoading(context); - if (response.success) { - SSOAuthModel? ssoToken = await pro.fetchSSOAuthRedirection(clientID: response.clientId); + //Ticket Work + if (pro.ticketBookingResponse != null && pro.ticketBookingResponse!.success) { + Utils.showLoading(context); + SSOAuthModel? ssoToken = await pro.fetchSSOAuthRedirection(clientID: pro.ticketBookingResponse!.clientId); if (ssoToken != null) { - logger.d(ssoToken.data!.toJson()); - logger.d(ssoToken.data!.accessToken); dynamic url = await pro.fetchURLRedirection(token: ssoToken.data!.accessToken!); - Navigator.push(context, MaterialPageRoute(builder: (context) => SsoLoginWebView(url: url ?? "", jwtToken: ssoToken.data!.accessToken!))); + await pro.fetchTicketAccuralBalance(context, DateTime.now()); + pro.ticketHistoryTransactionList = await EITApiClient().getEITTransactions("HMG_TICKET_ITENARY_HR_EIT_SS", isCompleteList: true); + + + Utils.hideLoading(context); + // Here Need Work + Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) => TicketDetailedScreen(url: url, jwtToken: ssoToken.data!.accessToken))); } } else { List _menuList = diff --git a/lib/ui/screens/offers_and_discounts/offers_and_discounts_home.dart b/lib/ui/screens/offers_and_discounts/offers_and_discounts_home.dart index f67a835..dbc2366 100644 --- a/lib/ui/screens/offers_and_discounts/offers_and_discounts_home.dart +++ b/lib/ui/screens/offers_and_discounts/offers_and_discounts_home.dart @@ -39,7 +39,7 @@ class _OffersAndDiscountsHomeState extends State { Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, - appBar: AppBarWidget(context, title: LocaleKeys.offerAndDiscounts.tr(), showHomeButton: true, showLogo: true, logoPath: "assets/icons/mazaya_brand.svg"), + appBar: AppBarWidget(context, title: LocaleKeys.offerAndDiscounts.tr(), showHomeButton: true, showLogo: false, logoPath: "assets/icons/mazaya_brand.svg"), body: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/ui/screens/ticket/ticket_detailed_screen.dart b/lib/ui/screens/ticket/ticket_detailed_screen.dart new file mode 100644 index 0000000..d406153 --- /dev/null +++ b/lib/ui/screens/ticket/ticket_detailed_screen.dart @@ -0,0 +1,187 @@ +import 'dart:convert'; + +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.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/date_uitl.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/models/dashboard/get_accural_ticket_balance_model.dart'; +import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:mohem_flutter_app/widgets/balances_dashboard_widget.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; +import 'package:mohem_flutter_app/widgets/sso_webview_widget.dart'; +import 'package:provider/provider.dart'; + +class TicketDetailedScreen extends StatefulWidget { + final String? url; + final String? jwtToken; + + const TicketDetailedScreen({super.key, this.url, this.jwtToken}); + + @override + State createState() => _TicketDetailedScreenState(); +} + +class _TicketDetailedScreenState extends State { + DashboardProviderModel? dashboardProviderModel; + late DateTime accrualDateTime; + + @override + void initState() { + dashboardProviderModel = Provider.of(context, listen: false); + accrualDateTime = DateTime.now(); + super.initState(); + } + + void changeAccrualDate(bool showLoading) async { + try { + if (showLoading) Utils.showLoading(context); + await dashboardProviderModel?.fetchTicketAccuralBalance(context, accrualDateTime); + if (showLoading) Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + if (showLoading) Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget(context, title: "Ticket Details"), + body: Column( + children: [ + ListView( + padding: const EdgeInsets.all(21), + physics: const BouncingScrollPhysics(), + children: [ + if (dashboardProviderModel == null && dashboardProviderModel?.accrualTicketBalanceList == null) ...[Utils.getNoDataWidget(context).paddingOnly(top: 50)] else ...[ + Container( + padding: const EdgeInsets.all(16.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12.0), + boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.2), spreadRadius: 2, blurRadius: 5, offset: const Offset(0, 3))], + ), + child: Column( + children: [ + Row( + children: [ + "Current Ticket Balance".toText20().expanded, + Row( + children: [ + const Icon(Icons.calendar_month_rounded, color: MyColors.darkIconColor, size: 16), + 5.width, + DateUtil.formatDateToDate(accrualDateTime, AppState().isArabic(context)).toText13(isUnderLine: true), + 8.width, + ], + ).onPress(() async { + DateTime selectedDate = await Utils.selectDate(context, accrualDateTime); + if (selectedDate != accrualDateTime) { + accrualDateTime = selectedDate; + changeAccrualDate(true); + } + }), + ], + ), + 8.height, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: + dashboardProviderModel!.accrualTicketBalanceList!.map((GetTicketAccuralBalanceModel item) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 6.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + item.accuralPlanCode.toString().replaceAll('_', ' ').toCamelCase.toText14(), + item.accrualNetEntitlement.toString().toText16(color: MyColors.textMixColor, isBold: true), + ], + ), + ); + }).toList(), + ), + ], + ), + ), + const SizedBox(height: 21), + dashboardProviderModel == null && dashboardProviderModel!.ticketHistoryTransactionList == null + ? const SizedBox() + : ListView( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + children: [ + "Tickets History".toText20().expanded, + 12.height, + ListView.separated( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.zero, + itemBuilder: (BuildContext cxt, int cardIndex) { + var transactionDetails = dashboardProviderModel!.ticketHistoryTransactionList![cardIndex]; + const allowedSegmentNames = { + "TICKETS_ROUTE", + "TRAVELER_NAME", + "TICKETS_EFFECTIVE_DATE", + "TICKET_ARRIVAL", + "TICKET_AMOUNT", + "TICKET_COMP_SHARE", + "TICKET_EMP_SHARE", + }; + var uniqueDetails = + transactionDetails + .where((item) => item.dISPLAYFLAG != 'N' && item.sEGMENTPROMPT != null && item.sEGMENTPROMPT!.isNotEmpty && allowedSegmentNames.contains(item.sEGMENTNAME)) + .toList(); + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ListView.builder( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: (uniqueDetails.length / 2).ceil(), + itemBuilder: (context, rowIndex) { + int firstIndex = rowIndex * 2; + int? secondIndex = (firstIndex + 1 < uniqueDetails.length) ? firstIndex + 1 : null; + bool isLastRow = (rowIndex == (uniqueDetails.length / 2).ceil() - 1); + var item1 = uniqueDetails[firstIndex]; + var child1 = ItemDetailViewCol(item1.sEGMENTPROMPT!, item1.vARCHAR2VALUE ?? item1.nUMBERVALUE?.toString() ?? ""); + Widget child2; + if (secondIndex != null) { + var item2 = uniqueDetails[secondIndex]; + child2 = ItemDetailViewCol(item2.sEGMENTPROMPT!, item2.vARCHAR2VALUE ?? item2.nUMBERVALUE?.toString() ?? ""); + } else { + child2 = const SizedBox(); // Empty widget if there is no second item + } + return ItemDetailGrid(child1, child2, isItLast: isLastRow); + }, + ), + ], + ).objectContainerView(); + }, + separatorBuilder: (BuildContext cxt, int index) => 12.height, + itemCount: dashboardProviderModel!.ticketHistoryTransactionList!.length, + ), + ], + ), + ], + ], + ).expanded, + DefaultButton("Proceed For Booking", () { + if (widget.url != null && widget.jwtToken != null) { + Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) => SsoLoginWebView(url: widget.url, jwtToken: widget.jwtToken))); + } + }).insideContainer, + ], + ), + ); + } +} diff --git a/lib/ui/work_list/sheets/delegate_sheet.dart b/lib/ui/work_list/sheets/delegate_sheet.dart index d505099..ef38ce0 100644 --- a/lib/ui/work_list/sheets/delegate_sheet.dart +++ b/lib/ui/work_list/sheets/delegate_sheet.dart @@ -1,4 +1,5 @@ import 'dart:collection'; +import 'dart:convert'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; @@ -32,8 +33,16 @@ class DelegateSheet extends StatefulWidget { VoidCallback callBackFunc; List getNotificationRespondAttributes; - DelegateSheet( - {required this.title, required this.apiMode, this.notificationID, this.actionHistoryList, this.wFHistory, required this.callBackFunc, this.getNotificationRespondAttributes = const []}); + DelegateSheet({ + super.key, + required this.title, + required this.apiMode, + this.notificationID, + this.actionHistoryList, + this.wFHistory, + required this.callBackFunc, + this.getNotificationRespondAttributes = const [], + }); @override State createState() => _DelegateSheetState(); @@ -46,8 +55,8 @@ class _DelegateSheetState extends State { String? selectedFavLetter; String selectedType = "Workflow"; String inputRes = ""; - List? favLetters; List? favUsersList; + List? filteredFavUsersList = []; List? replacementList; bool isImageLoaded = false; @@ -57,14 +66,14 @@ class _DelegateSheetState extends State { super.initState(); if (widget.wFHistory != null) { widget.wFHistory = widget.wFHistory!.reversed.toList(); - var ids = widget.wFHistory!.map((e) => e.employeeID).toSet(); - widget.wFHistory!.retainWhere((x) => ids.remove(x.employeeID)); + Set ids = widget.wFHistory!.map((WFHistory e) => e.employeeID).toSet(); + widget.wFHistory!.retainWhere((WFHistory x) => ids.remove(x.employeeID)); } if (widget.actionHistoryList != null) { widget.actionHistoryList = widget.actionHistoryList!.reversed.toList(); - var ids = widget.actionHistoryList!.map((e) => e.uSERNAME).toSet(); - widget.actionHistoryList!.retainWhere((x) => ids.remove(x.uSERNAME)); + Set ids = widget.actionHistoryList!.map((GetActionHistoryList e) => e.uSERNAME).toSet(); + widget.actionHistoryList!.retainWhere((GetActionHistoryList x) => ids.remove(x.uSERNAME)); } } @@ -73,36 +82,96 @@ class _DelegateSheetState extends State { super.dispose(); } - Future fetchFavLetters({bool isNeedLoading = true}) async { - favLetters = []; + Future fetchFavUsers({bool isNeedLoading = true}) async { + favUsersList = []; + filteredFavUsersList = []; + if (isNeedLoading) Utils.showLoading(context); - List? favList = await WorkListApiClient().getFavoriteReplacementWithoutImage(); - List result = []; - favList!.forEach((element) { - result.add(element.employeeDisplayName![0]); - }); - favLetters = LinkedHashSet.from(result).toList(); - if (isNeedLoading) Utils.hideLoading(context); - setState(() { - favLetters!.sort((a, b) { - return a.toLowerCase().compareTo(b.toLowerCase()); - }); - }); - return null; + + try { + List? favList = await WorkListApiClient().getFavoriteReplacementWithoutImage(); + favUsersList = favList; + + if (favUsersList != null && favUsersList!.isNotEmpty) { + favUsersList!.sort((GetFavoriteReplacements a, GetFavoriteReplacements b) => (a.employeeDisplayName ?? '').toLowerCase().compareTo((b.employeeDisplayName ?? '').toLowerCase())); + filteredFavUsersList = favUsersList; + + if (isNeedLoading) Utils.hideLoading(context); + setState(() {}); + _fetchAndAttachUserImages(); + } else { + if (isNeedLoading) Utils.hideLoading(context); + setState(() {}); + } + } catch (e) { + if (isNeedLoading) Utils.hideLoading(context); + setState(() {}); + } } - Future fetchFavUsersList({bool isNeedLoading = true}) async { - if (isNeedLoading) Utils.showLoading(context); - favUsersList = await WorkListApiClient().getFavoriteReplacementWithImage(selectedFavLetter ?? ""); - if (isNeedLoading) Utils.hideLoading(context); - setState(() {}); - fetchFavUsersListNew(isNeedLoading: false); - return null; + Future _fetchAndAttachUserImages() async { + try { + List? tempList = await WorkListApiClient().getFavoriteReplacementWithImageNew(""); + + if (tempList != null && tempList.isNotEmpty && favUsersList != null) { + for (GetFavoriteReplacements element in favUsersList!) { + for (GetFavoriteReplacements element2 in tempList) { + if (element.userName == element2.userName && element2.employeeImage != null && element2.employeeImage!.isNotEmpty) { + element.employeeImage = element2.employeeImage; + } + } + } + filteredFavUsersList = favUsersList; + setState(() {}); + } + } catch (e) {} } + // Future fetchFavUsers({bool isNeedLoading = true}) async { + // favUsersList = []; + // if (isNeedLoading) Utils.showLoading(context); + // + // try { + // List? favList = await WorkListApiClient().getFavoriteReplacementWithoutImage(); + // favUsersList = favList; + // + // if (favUsersList != null && favUsersList!.isNotEmpty) { + // setState(() { + // favUsersList!.sort((GetFavoriteReplacements a, GetFavoriteReplacements b) => (a.employeeDisplayName ?? '').toLowerCase().compareTo((b.employeeDisplayName ?? '').toLowerCase())); + // }); + // if (isNeedLoading) Utils.hideLoading(context); + // + // List? tempList = await WorkListApiClient().getFavoriteReplacementWithImageNew(""); + // if (tempList != null && tempList.isNotEmpty) { + // for (GetFavoriteReplacements element in favUsersList!) { + // for (GetFavoriteReplacements element2 in tempList) { + // if (element.userName == element2.userName) { + // if (element2.employeeImage != null && element2.employeeImage!.isNotEmpty) { + // element.employeeImage = element2.employeeImage; + // } + // } + // } + // } + // setState(() {}); + // } + // } + // } catch (e) { + // // if (isNeedLoading) Utils.hideLoading(context); + // } + // } + + // Future fetchFavUsersList({bool isNeedLoading = true}) async { + // if (isNeedLoading) Utils.showLoading(context); + // favUsersList = await WorkListApiClient().getFavoriteReplacementWithImage(selectedFavLetter ?? ""); + // if (isNeedLoading) Utils.hideLoading(context); + // setState(() {}); + // fetchFavUsersListNew(isNeedLoading: false); + // return null; + // } + Future fetchFavUsersListNew({bool isNeedLoading = true}) async { if (isNeedLoading) Utils.showLoading(context); - favUsersList = await WorkListApiClient().getFavoriteReplacementWithImageNew(selectedFavLetter ?? ""); + filteredFavUsersList = await WorkListApiClient().getFavoriteReplacementWithImageNew(selectedFavLetter ?? ""); if (isNeedLoading) Utils.hideLoading(context); setState(() { isImageLoaded = true; @@ -112,18 +181,10 @@ class _DelegateSheetState extends State { void fetchChangeFav({required String email, required String employeName, required String image, required String userName, bool isFav = false, bool isNeedToRefresh = false}) async { Utils.showLoading(context); - favLetters = null; - selectedFavLetter = null; - GenericResponseModel model = await WorkListApiClient().changeFavoriteReplacements( - email: email, - employeName: employeName, - image: image, - userName: userName, - isFav: isFav, - ); + GenericResponseModel model = await WorkListApiClient().changeFavoriteReplacements(email: email, employeName: employeName, image: image, userName: userName, isFav: isFav); if (isNeedToRefresh) { - await fetchFavLetters(isNeedLoading: false); - if (favLetters != null) await fetchFavUsersList(isNeedLoading: false); + await fetchFavUsers(isNeedLoading: false); + // if (favUsersList != null) await fetchFavUsersList(isNeedLoading: false); } Utils.hideLoading(context); @@ -137,44 +198,58 @@ class _DelegateSheetState extends State { userName: selectedType == "Employee Name" ? inputRes : "", email: selectedType == "Employee Email" ? inputRes : "", ); + if (isNeedLoading) Utils.hideLoading(context); setState(() {}); return null; } + Future searchFavUser() async { + if (favUsersList != null && favUsersList!.isNotEmpty) { + // if (inputRes.length > 0) { + filteredFavUsersList = + favUsersList!.where((GetFavoriteReplacements element) { + String query = inputRes.toLowerCase(); + return (element.employeeDisplayName != null && element.employeeDisplayName!.toLowerCase().startsWith(query)) || + (element.userName != null && element.userName!.toLowerCase().contains(query)) || + (element.emailAddress != null && element.emailAddress!.toLowerCase().contains(query)); + }).toList(); + // } else { + // filteredFavUsersList = favUsersList; + // } + } else { + filteredFavUsersList = []; + } + + setState(() {}); + } + @override Widget build(BuildContext context) { - return Container( + return SizedBox( width: double.infinity, height: MediaQuery.of(context).size.height - 80, child: Column( - children: [ + children: [ Expanded( child: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(21), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ widget.title.toText24(isBold: true), 21.height, LocaleKeys.search.tr().toText16(), 11.height, Column( crossAxisAlignment: CrossAxisAlignment.end, - children: [ + children: [ Container( - padding: EdgeInsets.only(left: 8, right: 4, top: 6, bottom: 6), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Colors.transparent, - border: Border.all( - color: Color(0xffefefef), - width: 1, - ), - ), + padding: const EdgeInsets.only(left: 8, right: 4, top: 6, bottom: 6), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(15), color: Colors.transparent, border: Border.all(color: const Color(0xffefefef), width: 1)), child: Row( - children: [ + children: [ Expanded( child: InputWidget( "Search By " + selectedType, @@ -185,29 +260,18 @@ class _DelegateSheetState extends State { verticalPadding: 3, isInputTypeNum: selectedType == "Employee ID" ? true : false, isEnable: isNeedEnableTextField, - onChange: (v) { + onChange: (String v) { inputRes = v; + if (selectedType == "Favorites") { + searchFavUser(); + } }, ), ), + Container(height: 36, width: 1, color: const Color(0xffE5E5E5)), Container( - height: 36, - width: 1, - color: Color(0xffE5E5E5), - ), - Container( - padding: EdgeInsets.all(8), - child: Row( - children: [ - selectedType.toText12(), - 4.width, - const Icon( - Icons.keyboard_arrow_down, - color: Colors.black, - size: 16, - ), - ], - ), + padding: const EdgeInsets.all(8), + child: Row(children: [selectedType.toText12(), 4.width, const Icon(Icons.keyboard_arrow_down, color: Colors.black, size: 16)]), ).onPress(() { showMyBottomSheet( context, @@ -219,19 +283,17 @@ class _DelegateSheetState extends State { if (value == "Workflow") { setState(() { isNeedEnableTextField = false; - selectedFavLetter = null; - favLetters = null; - favUsersList = null; + // selectedFavLetter = null; + filteredFavUsersList = null; }); } else if (value == "Favorites") { - isNeedEnableTextField = false; - fetchFavLetters(); + isNeedEnableTextField = true; + fetchFavUsers(); } else { setState(() { isNeedEnableTextField = true; - selectedFavLetter = null; - favLetters = null; - favUsersList = null; + // selectedFavLetter = null; + filteredFavUsersList = null; }); } }, @@ -241,143 +303,105 @@ class _DelegateSheetState extends State { ], ), ), - if (isNeedEnableTextField) + if (isNeedEnableTextField && selectedType != "Favorites") TextButton( onPressed: () { fetchUserByInput(); }, - child: const Text( - "Search", - style: TextStyle( - color: Colors.blue, - decoration: TextDecoration.underline, - ), - ), - ) + child: const Text("Search", style: TextStyle(color: Colors.blue, decoration: TextDecoration.underline)), + ), ], ), if (!isNeedEnableTextField) 12.height, Row( - children: [ + children: [ Expanded( - child: Container( + child: SizedBox( width: double.infinity, - child: selectedFavLetter == null && favLetters != null - ? Container( - width: double.infinity, - alignment: Alignment.center, - child: "Please select letter to see Fav results".toText12(), - ) - : favUsersList != null + child: + // selectedFavLetter == null && favLetters != null + // ? Container(width: double.infinity, alignment: Alignment.center, child: "Please select letter to see Fav results".toText12()) + // : + filteredFavUsersList != null && selectedType == "Favorites" ? ListView.separated( - itemBuilder: (context, index) { - return showFavUserItem(favUsersList![index]); - }, - separatorBuilder: (context, index) { - return Container( - color: MyColors.borderColor, - width: double.infinity, - height: 1, - margin: EdgeInsets.only(top: 8, bottom: 8), - ).onPress(() {}); - }, - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: favUsersList!.length, - padding: EdgeInsets.only(top: 8, bottom: 8), - ) + itemBuilder: (BuildContext context, int index) { + return showFavUserItem(filteredFavUsersList![index]); + }, + separatorBuilder: (BuildContext context, int index) { + return Container(color: MyColors.borderColor, width: double.infinity, height: 1, margin: const EdgeInsets.only(top: 8, bottom: 8)).onPress(() {}); + }, + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: filteredFavUsersList!.length, + padding: const EdgeInsets.only(top: 8, bottom: 8), + ) : isNeedEnableTextField && replacementList == null - ? Container( - width: double.infinity, - alignment: Alignment.center, - child: "Search User".toText12(), - ) - : isNeedEnableTextField && replacementList!.length == 0 - ? Container( - width: double.infinity, - alignment: Alignment.center, - child: "No Data Found".toText12(), - ) - : isNeedEnableTextField - ? ListView.separated( - itemBuilder: (context, index) { - return showInputUserItem(replacementList![index]); - }, - separatorBuilder: (context, index) { - return Container( - color: MyColors.borderE3Color, - width: double.infinity, - height: 1, - margin: EdgeInsets.only(top: 8, bottom: 8), - ); - }, - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: replacementList!.length, - padding: EdgeInsets.only(top: 8, bottom: 8), - ) - : (widget.wFHistory != null - ? ListView.separated( - itemBuilder: (context, index) { - return showItgItem(widget.wFHistory![index]); - }, - separatorBuilder: (context, index) { - return Container( - color: MyColors.borderE3Color, - width: double.infinity, - height: 1, - margin: EdgeInsets.only(top: 8, bottom: 8), - ); - }, - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: widget.wFHistory!.length, - padding: EdgeInsets.only(top: 8, bottom: 8), - ) - : ListView.separated( - itemBuilder: (context, index) { - return showItem(widget.actionHistoryList![index]); - }, - separatorBuilder: (context, index) { - return Container( - color: MyColors.borderE3Color, - width: double.infinity, - height: 1, - margin: EdgeInsets.only(top: 8, bottom: 8), - ); - }, - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: widget.actionHistoryList!.length, - padding: EdgeInsets.only(top: 8, bottom: 8), - )), + ? Container(width: double.infinity, alignment: Alignment.center, child: "Search User".toText12()) + : isNeedEnableTextField && replacementList!.isEmpty + ? Container(width: double.infinity, alignment: Alignment.center, child: "No Data Found".toText12()) + : isNeedEnableTextField + ? ListView.separated( + itemBuilder: (BuildContext context, int index) { + return showInputUserItem(replacementList![index]); + }, + separatorBuilder: (BuildContext context, int index) { + return Container(color: MyColors.borderE3Color, width: double.infinity, height: 1, margin: const EdgeInsets.only(top: 8, bottom: 8)); + }, + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: replacementList!.length, + padding: const EdgeInsets.only(top: 8, bottom: 8), + ) + : (widget.wFHistory != null + ? ListView.separated( + itemBuilder: (BuildContext context, int index) { + return showItgItem(widget.wFHistory![index]); + }, + separatorBuilder: (BuildContext context, int index) { + return Container(color: MyColors.borderE3Color, width: double.infinity, height: 1, margin: const EdgeInsets.only(top: 8, bottom: 8)); + }, + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: widget.wFHistory!.length, + padding: const EdgeInsets.only(top: 8, bottom: 8), + ) + : ListView.separated( + itemBuilder: (BuildContext context, int index) { + return showItem(widget.actionHistoryList![index]); + }, + separatorBuilder: (BuildContext context, int index) { + return Container(color: MyColors.borderE3Color, width: double.infinity, height: 1, margin: const EdgeInsets.only(top: 8, bottom: 8)); + }, + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: widget.actionHistoryList!.length, + padding: const EdgeInsets.only(top: 8, bottom: 8), + )), ), ), - if (favLetters != null) - Container( - width: 30, - // color: Colors.red, - child: ListView.separated( - itemBuilder: (context, index) { - return Container( - padding: EdgeInsets.all(8), - alignment: Alignment.center, - child: favLetters![index].toText14(color: selectedFavLetter == favLetters![index] ? MyColors.gradiantStartColor : Colors.black), - ).onPress(() { - selectedFavLetter = favLetters![index].toUpperCase(); - fetchFavUsersList(); - }); - }, - separatorBuilder: (context, index) { - return SizedBox( - height: 0, - ); - }, - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: favLetters!.length, - ), - ), + // if (favLetters != null) + // SizedBox( + // width: 30, + // // color: Colors.red, + // child: ListView.separated( + // itemBuilder: (BuildContext context, int index) { + // return Container( + // padding: const EdgeInsets.all(8), + // alignment: Alignment.center, + // child: favLetters![index].toText14(color: selectedFavLetter == favLetters![index] ? MyColors.gradiantStartColor : Colors.black), + // ).onPress(() { + // selectedFavLetter = favLetters![index].toUpperCase(); + // fetchFavUsersList(); + // }); + // }, + // separatorBuilder: (BuildContext context, int index) { + // return const SizedBox(height: 0); + // }, + // physics: const NeverScrollableScrollPhysics(), + // shrinkWrap: true, + // itemCount: favLetters!.length, + // ), + // ), ], ), ], @@ -385,22 +409,15 @@ class _DelegateSheetState extends State { ), ), ), - Container( - width: double.infinity, - height: 1, - color: MyColors.borderColor, - ), + Container(width: double.infinity, height: 1, color: MyColors.borderColor), DefaultButton( "Cancel", () { Navigator.pop(context); }, textColor: Colors.black, - colors: [ - Color(0xffE6E6E6), - Color(0xffE6E6E6), - ], - ).insideContainer + colors: const [Color(0xffE6E6E6), Color(0xffE6E6E6)], + ).insideContainer, ], ), ); @@ -410,25 +427,22 @@ class _DelegateSheetState extends State { return InkWell( onTap: () { Navigator.pop(context); - showMyBottomSheet(context, - callBackFunc: widget.callBackFunc, - child: SelectedItemSheet( - "Comment", - apiMode: widget.apiMode, - actionHistoryList: actionHistory, - notificationID: widget.notificationID, - isITGRequest: widget.wFHistory != null, - getNotificationRespondAttributes: widget.getNotificationRespondAttributes, - )); + showMyBottomSheet( + context, + callBackFunc: widget.callBackFunc, + child: SelectedItemSheet( + "Comment", + apiMode: widget.apiMode, + actionHistoryList: actionHistory, + notificationID: widget.notificationID, + isITGRequest: widget.wFHistory != null, + getNotificationRespondAttributes: widget.getNotificationRespondAttributes, + ), + ); }, child: Row( - children: [ - CircularAvatar( - url: actionHistory.eMPLOYEEIMAGE ?? "", - height: 30, - width: 30, - isImageBase64: true, - ), + children: [ + CircularAvatar(url: actionHistory.eMPLOYEEIMAGE ?? "", height: 30, width: 30, isImageBase64: true), 9.width, (actionHistory.nAME ?? "").toText12().expanded, IconButton( @@ -444,12 +458,8 @@ class _DelegateSheetState extends State { isFav: true, ); }, - icon: Icon( - Icons.star, - size: 16, - color: (actionHistory.isFavorite ?? false) ? MyColors.yellowColor : MyColors.borderColor, - ), - ) + icon: Icon(Icons.star, size: 16, color: (actionHistory.isFavorite ?? false) ? MyColors.yellowColor : MyColors.borderColor), + ), ], ), ); @@ -459,25 +469,18 @@ class _DelegateSheetState extends State { return InkWell( onTap: () { Navigator.pop(context); - showMyBottomSheet(context, - callBackFunc: widget.callBackFunc, - child: SelectedItgItemSheet( - "Comment", - apiMode: widget.apiMode, - wfHistory: wfHistory, - // notificationID: widget.notificationID, - )); - }, - child: Row( - children: [ - CircularAvatar( - height: 30, - width: 30, + showMyBottomSheet( + context, + callBackFunc: widget.callBackFunc, + child: SelectedItgItemSheet( + "Comment", + apiMode: widget.apiMode, + wfHistory: wfHistory, + // notificationID: widget.notificationID, ), - 9.width, - (wfHistory.name ?? "").toText12().expanded, - ], - ), + ); + }, + child: Row(children: [CircularAvatar(height: 30, width: 30), 9.width, (wfHistory.name ?? "").toText12().expanded]), ); } @@ -485,47 +488,31 @@ class _DelegateSheetState extends State { return InkWell( onTap: () { Navigator.pop(context); - showMyBottomSheet(context, - callBackFunc: widget.callBackFunc, - child: SelectedItemSheet( - "Comment", - apiMode: widget.apiMode, - favoriteReplacements: actionHistory, - notificationID: widget.notificationID, - isITGRequest: widget.wFHistory != null, - getNotificationRespondAttributes: widget.getNotificationRespondAttributes, - )); + showMyBottomSheet( + context, + callBackFunc: widget.callBackFunc, + child: SelectedItemSheet( + "Comment", + apiMode: widget.apiMode, + favoriteReplacements: actionHistory, + notificationID: widget.notificationID, + isITGRequest: widget.wFHistory != null, + getNotificationRespondAttributes: widget.getNotificationRespondAttributes, + ), + ); }, child: Row( - children: [ - actionHistory.employeeImage != "" - ? CircularAvatar( - url: actionHistory.employeeImage, - height: 40, - width: 40, - isImageBase64: (actionHistory.employeeImage != null || actionHistory.employeeImage!.isNotEmpty) ? true : false, - ) + children: [ + actionHistory.employeeImage != "" && actionHistory.employeeImage != null + ? CircularAvatar(url: actionHistory.employeeImage, height: 40, width: 40, isImageBase64: (actionHistory.employeeImage != null || actionHistory.employeeImage!.isNotEmpty) ? true : false) : isImageLoaded - ? CircularAvatar( - height: 40, - width: 40, - isImageBase64: false, - ) - : ClipRRect( - borderRadius: const BorderRadius.all( - Radius.circular(50), - ), - child: Image.network( - "https://play-lh.googleusercontent.com/NPo88ojmhah4HDiposucJmfQIop4z4xc8kqJK9ITO9o-yCab2zxIp7PPB_XPj2iUojo", - fit: BoxFit.cover, - height: 40, - width: 40, - ).toShimmer(), - ), + ? CircularAvatar(height: 40, width: 40, isImageBase64: false) + : ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(50)), + child: Image.network("https://play-lh.googleusercontent.com/NPo88ojmhah4HDiposucJmfQIop4z4xc8kqJK9ITO9o-yCab2zxIp7PPB_XPj2iUojo", fit: BoxFit.cover, height: 40, width: 40).toShimmer(), + ), 16.width, - Expanded( - child: (actionHistory.employeeDisplayName ?? "").toText12(), - ), + Expanded(child: (actionHistory.employeeDisplayName ?? "").toText12()), IconButton( onPressed: () { fetchChangeFav( @@ -537,12 +524,8 @@ class _DelegateSheetState extends State { isNeedToRefresh: true, ); }, - icon: Icon( - Icons.star, - size: 16, - color: MyColors.yellowColor, - ), - ) + icon: const Icon(Icons.star, size: 16, color: MyColors.yellowColor), + ), ], ), ); @@ -552,29 +535,24 @@ class _DelegateSheetState extends State { return InkWell( onTap: () { Navigator.pop(context); - showMyBottomSheet(context, - callBackFunc: widget.callBackFunc, - child: SelectedItemSheet( - LocaleKeys.comments.tr(), - apiMode: widget.apiMode, - replacementList: actionHistory, - notificationID: widget.notificationID, - isITGRequest: widget.wFHistory != null, - getNotificationRespondAttributes: widget.getNotificationRespondAttributes, - )); + showMyBottomSheet( + context, + callBackFunc: widget.callBackFunc, + child: SelectedItemSheet( + LocaleKeys.comments.tr(), + apiMode: widget.apiMode, + replacementList: actionHistory, + notificationID: widget.notificationID, + isITGRequest: widget.wFHistory != null, + getNotificationRespondAttributes: widget.getNotificationRespondAttributes, + ), + ); }, child: Row( - children: [ - CircularAvatar( - url: actionHistory.employeeImage, - height: 30, - width: 30, - isImageBase64: actionHistory.employeeImage != null ? true : false, - ), + children: [ + CircularAvatar(url: actionHistory.employeeImage, height: 30, width: 30, isImageBase64: actionHistory.employeeImage != null ? true : false), 16.width, - Expanded( - child: (actionHistory.employeeDisplayName ?? "").toText12(), - ), + Expanded(child: (actionHistory.employeeDisplayName ?? "").toText12()), IconButton( onPressed: () { actionHistory.isFavorite = !(actionHistory.isFavorite ?? false); @@ -587,12 +565,8 @@ class _DelegateSheetState extends State { isNeedToRefresh: false, ); }, - icon: Icon( - Icons.star, - size: 16, - color: (actionHistory.isFavorite ?? false) ? MyColors.yellowColor : MyColors.borderColor, - ), - ) + icon: Icon(Icons.star, size: 16, color: (actionHistory.isFavorite ?? false) ? MyColors.yellowColor : MyColors.borderColor), + ), ], ), ); diff --git a/lib/ui/work_list/sheets/selected_item_sheet.dart b/lib/ui/work_list/sheets/selected_item_sheet.dart index 2efe88b..9b98c8b 100644 --- a/lib/ui/work_list/sheets/selected_item_sheet.dart +++ b/lib/ui/work_list/sheets/selected_item_sheet.dart @@ -175,7 +175,7 @@ class SelectedItemSheet extends StatelessWidget { if (favoriteReplacements != null) empID = favoriteReplacements!.userName; if (replacementList != null) empID = replacementList!.userName; try { - memberInformationListModel = await WorkListApiClient().getUserInformation(-999, empID!); + memberInformationListModel = await WorkListApiClient().getNotificationUserInformation(-999, empID!, notificationID!); if (actionHistoryList != null) empID = actionHistoryList!.eMPLOYEEIMAGE = memberInformationListModel!.eMPLOYEEIMAGE ?? AppState().getBase64ImageEmp; if (favoriteReplacements != null) empID = favoriteReplacements!.employeeImage = memberInformationListModel!.eMPLOYEEIMAGE ?? AppState().getBase64ImageEmp; if (replacementList != null) empID = replacementList!.employeeImage = memberInformationListModel!.eMPLOYEEIMAGE ?? AppState().getBase64ImageEmp; diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index 7637cd1..d659ea6 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -125,6 +125,17 @@ class _WorkListScreenState extends State { key: 'PAY_REQ', disable: false, ), + WorkListItemTypeModelData( + value: 0, + name: 'FA Disposal Request ', + fullName: LocaleKeys.faRequest.tr(), + active: false, + color: [Color(0xff42d7bf), Color(0xff42d7bf)], + icon: "assets/images/miss_swipe.svg", + key: 'HMG_FA_D', + disable: false, + ), + ]; int? workListItemIndex; diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index f1a7a3e..6bf8ea9 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -25,6 +25,7 @@ import 'package:mohem_flutter_app/models/member_information_list_model.dart'; import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; import 'package:mohem_flutter_app/models/termination/termination_notification_body.dart'; import 'package:mohem_flutter_app/models/worklist/GetRFCEmployeeList.dart'; +import 'package:mohem_flutter_app/models/worklist/get_fad_notifications.dart'; import 'package:mohem_flutter_app/models/worklist/hr/eit_otification_body_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_address_notification_body_list.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_basic_det_ntf_body_list_model.dart'; @@ -92,7 +93,7 @@ class _WorkListDetailScreenState extends State { GetPrNotificationBodyList? getPrNotificationBody; GetItemCreationNtfBodyList? getItemCreationNtfBody; GetPaymentNotificationBodyList? getPaymentNotificationBodyList; - + GetFaDisposalNtfDetails? getFADNotificationBody; bool isCloseAvailable = false; bool isApproveAvailable = false; bool isRejectAvailable = false; @@ -177,6 +178,9 @@ class _WorkListDetailScreenState extends State { if (workListData!.iTEMTYPE == "PAY_REQ") { getPaymentNotification(); } + if (workListData!.iTEMTYPE == "HMG_FA_D") { + getFADNotification(); + } if (controller.hasClients) { controller.jumpToPage(0); @@ -272,6 +276,7 @@ class _WorkListDetailScreenState extends State { getPrNotificationBodyList: getPrNotificationBody, getTerminationNotificationBodyList: getTerminationNotificationBodyList, getPaymentNotificationBodyList: getPaymentNotificationBodyList, + getFADNotificationBodyList: getFADNotificationBody ), (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP" || workListData!.iTEMTYPE == "PAY_REQ") ? DetailFragment(workListData, memberInformationListModel) @@ -813,7 +818,7 @@ class _WorkListDetailScreenState extends State { if (apiCallCount == 0) Utils.showLoading(context); apiCallCount++; memberInformationListModel = null; - memberInformationListModel = await WorkListApiClient().getUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!); + memberInformationListModel = await WorkListApiClient().getNotificationUserInformation(-999, workListData!.sELECTEDEMPLOYEENUMBER!, workListData!.nOTIFICATIONID!); apiCallCount--; if (apiCallCount == 0) { Utils.hideLoading(context); @@ -1036,6 +1041,23 @@ class _WorkListDetailScreenState extends State { } } + Future getFADNotification() async { + try { + if (apiCallCount == 0) Utils.showLoading(context); + apiCallCount++; + getFADNotificationBody = await WorkListApiClient().getFADNotificationBody(workListData!.nOTIFICATIONID); + apiCallCount--; + if (apiCallCount == 0) { + Utils.hideLoading(context); + setState(() {}); + } + } catch (ex) { + apiCallCount--; + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + void notificationGetRespondAttributes() async { try { if (apiCallCount == 0) Utils.showLoading(context); diff --git a/lib/ui/work_list/worklist_fragments/info_fragments.dart b/lib/ui/work_list/worklist_fragments/info_fragments.dart index 73a87f7..541d347 100644 --- a/lib/ui/work_list/worklist_fragments/info_fragments.dart +++ b/lib/ui/work_list/worklist_fragments/info_fragments.dart @@ -12,6 +12,7 @@ import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dar import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart'; +import 'package:mohem_flutter_app/models/worklist/get_fad_notifications.dart'; import 'package:mohem_flutter_app/models/worklist/hr/eit_otification_body_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_address_notification_body_list.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_basic_det_ntf_body_list_model.dart'; @@ -39,7 +40,7 @@ class InfoFragment extends StatelessWidget { List? getAddressNotificationBodyList = []; List? getTerminationNotificationBodyList = []; GetPaymentNotificationBodyList? getPaymentNotificationBodyList; - + GetFaDisposalNtfDetails? getFADNotificationBodyList; InfoFragment( {this.workListData, this.poHeaderList = const [], @@ -54,7 +55,9 @@ class InfoFragment extends StatelessWidget { this.getPrNotificationBodyList, this.getAddressNotificationBodyList, this.getTerminationNotificationBodyList, - this.getPaymentNotificationBodyList}); + this.getPaymentNotificationBodyList, + this.getFADNotificationBodyList + }); double itemHeight = 0; double itemWidth = 0; @@ -129,7 +132,10 @@ class InfoFragment extends StatelessWidget { getTerminationNotificationBodyList!), if (getPaymentNotificationBodyList != null) getPaymentNotificationBodyListWidget(getPaymentNotificationBodyList ?? - GetPaymentNotificationBodyList()) + GetPaymentNotificationBodyList()), + if (getFADNotificationBodyList != null) + getFANotificationBodyListWidget(getFADNotificationBodyList ?? + GetFaDisposalNtfDetails()) .objectContainerView(), ]; return Container( @@ -922,5 +928,125 @@ class InfoFragment extends StatelessWidget { ], ); + } + + Widget getFANotificationBodyListWidget( + GetFaDisposalNtfDetails? data) { + return Column( + children: [ + 12.height, + + if (data!.pFaHeader!.isNotEmpty) + Column( + children: [ + LocaleKeys.faHeader.tr().toText14(color: MyColors.textMixColor), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.requestNo.tr(), + data.pFaHeader![0].requestNo.toString() ?? ""), + ItemDetailViewCol( + LocaleKeys.stats.tr(), data.pFaHeader![0].status ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol( + LocaleKeys.bookTypeCode.tr(), data.pFaHeader![0].bookTypeCode ?? ""), + ItemDetailViewCol(LocaleKeys.categoryCode.tr(), + data.pFaHeader![0].categoryCode ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.categoryGroup.tr(), + data.pFaHeader![0].categoryGroup ?? ""), + ItemDetailViewCol( + LocaleKeys.comments.tr(), data.pFaHeader![0].comments ?? ""), + ), + + + ], + ).objectContainerView(), + if (data!.pFaLines!.isNotEmpty) + Column( + children: [ + LocaleKeys.faLINES.tr().toText14(color: MyColors.textMixColor), + ItemDetailGrid( + ItemDetailViewCol( LocaleKeys.requestNo.tr(), + data.pFaLines![0].requestNo.toString() ?? ""), + ItemDetailViewCol( + LocaleKeys.quantity.tr(), data.pFaLines![0].quantity.toString() ?? "" ), + + ), + ItemDetailGrid( + ItemDetailViewCol( + LocaleKeys.assetNumber.tr(), data.pFaLines![0].assetNumber.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.assetDescription.tr(), + data.pFaLines![0].assetDescription ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.barCodeNumber.tr(), + data.pFaLines![0] .barcodeNumber.toString() ?? ""), + ItemDetailViewCol( + LocaleKeys.datePlaceInService.tr(), DateUtil.formatDateToDate( + DateUtil.convertStringToDate( data.pFaLines![0].datePlacedInService ?? ""), false)), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.departmentName.tr(), + data.pFaLines![0].department ?? ""), + ItemDetailViewCol(LocaleKeys.serialNumber.tr(), + data.pFaLines![0].serialNumber ?? "") , + ), + ItemDetailGrid( + ItemDetailViewCol( + LocaleKeys.disposedDate.tr(), DateUtil.formatDateToDate( + DateUtil.convertStringToDate( data.pFaLines![0].disposedDate ?? ""), false)), + ItemDetailViewCol(LocaleKeys.netBookValue.tr(), + data.pFaLines![0].netBookValue.toString() ?? ""), + + ), + ItemDetailGrid( + ItemDetailViewCol( + LocaleKeys.poNumber.tr(), data.pFaLines![0].poNumber.toString() ?? "" ), + ItemDetailViewCol(LocaleKeys.purchasedPrice.tr(), + data.pFaLines![0].purchasePrice.toString() ?? ""), + + ), + ItemDetailGrid( + ItemDetailViewCol( + LocaleKeys.usefulLife.tr(), data.pFaLines![0].usefulLife.toString() ?? "" ), + ItemDetailViewCol(LocaleKeys.yearsUsed.tr(), + data.pFaLines![0].yearsUsed.toString() ?? ""), + + ), + ], + ).objectContainerView(), + + if (data!.pFaBuyers!.isNotEmpty) + Column( + children: [ + LocaleKeys.buyer.tr().toText14(color: MyColors.textMixColor), + ItemDetailGrid( + ItemDetailViewCol( + LocaleKeys.requestNo.tr(), data.pFaBuyers![0].requestNo.toString() ?? ""), + ItemDetailViewCol( LocaleKeys.amount.tr(), + data.pFaBuyers![0].amount.toString() ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol(LocaleKeys.buyerNumber.tr(), + data.pFaBuyers![0].buyerName!), + ItemDetailViewCol( + LocaleKeys.buyerNumber.tr(), data.pFaBuyers![0].buyerNumber ?? ""), + ), + ItemDetailGrid( + ItemDetailViewCol( LocaleKeys.highestBidder.tr(), + data.pFaBuyers![0].highestBidder ?? ""), + ItemDetailViewCol( + LocaleKeys.remarks.tr(), data.pFaBuyers![0].remarks ?? ""), + ), + + ], + ).objectContainerView(), + + ]); + + + + } } diff --git a/lib/widgets/bottom_sheet.dart b/lib/widgets/bottom_sheet.dart index 4101746..d5cb271 100644 --- a/lib/widgets/bottom_sheet.dart +++ b/lib/widgets/bottom_sheet.dart @@ -1,5 +1,9 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; void showMyBottomSheet(BuildContext context, {required Widget child, required VoidCallback callBackFunc, String? type}) { showModalBottomSheet( @@ -49,6 +53,67 @@ void showMyBottomSheet(BuildContext context, {required Widget child, required Vo }); } + + Widget openWorkListBottomSheet(BuildContext context, String? val, String? title){ + return SafeArea( + child: Container( + padding: const EdgeInsets.all(16), + height: MediaQuery.of(context).size.height * 0.3 , // half-screen height + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // ---- Top Row with Title & Close Button ---- + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + (title ?? "Details").toText14(isBold: true, color: Color(0xff2BB8A6)), + IconButton( + icon: const Icon(Icons.close, color: Colors.black54, size: 20), + onPressed: () { + Navigator.pop(context); + }, + ), + ], + ), + const Divider(height: 1, color: Colors.grey), + const SizedBox(height: 12), + // ---- Scrollable Content ---- + Expanded( + child: SingleChildScrollView( + child: ((val?.isEmpty ?? true) + ? "--" + : val.toString()).toText14(), + ), + ), + SizedBox( + width: double.infinity, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xff2BB8A6), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + padding: const EdgeInsets.symmetric(vertical: 12), + ), + onPressed: () { + Navigator.pop(context); + }, + child: Text( + LocaleKeys.close.tr(), + style: const TextStyle( + color: Colors.white, + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ], + ), + ), + ); +} + class BottomSheetItem extends StatelessWidget { final Function onTap; final IconData icon; diff --git a/lib/widgets/item_detail_view_widget.dart b/lib/widgets/item_detail_view_widget.dart index 64bbd01..de82afe 100644 --- a/lib/widgets/item_detail_view_widget.dart +++ b/lib/widgets/item_detail_view_widget.dart @@ -1,11 +1,14 @@ import 'dart:convert'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/itg_forms_models/itg_worklist_table_model.dart'; +import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; class ItemDetailView extends StatelessWidget { final String title; @@ -40,7 +43,7 @@ class ItemDetailViewCol extends StatelessWidget { children: [ "$title:".toText12(isBold: true, color: const Color(0xff2BB8A6), maxLine: 2), 4.width, - (value.isEmpty ? "--" : value).toText12(color: MyColors.normalTextColor, maxLine: 5), + Flexible(child: (value.isEmpty ? "--" : value).toText12(color: MyColors.normalTextColor, maxLine: null)), ], ); } @@ -84,18 +87,51 @@ class ItemDetailViewGridItem extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ - title != null ? Flexible(child: "$title:".toText12Auto(isBold: true, color: const Color(0xff2BB8A6))) : Container(), + title != null ? Flexible(child: "$title:".toText12(isBold: true, color: const Color(0xff2BB8A6))) : Container(), 4.width, - type != null - ? type!.toLowerCase() == "table" - ? getStringFromJSON(value!) - // : Flexible(child: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: 5)) - : (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: maxLine) - : Container(), + type != null + ? type!.toLowerCase() == "table" + ? getStringFromJSON(value!) + // : Flexible(child: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: 5)) + : (value!.isEmpty ? "--" : value).toString().toText12(color: MyColors.normalTextColor, maxLine: 2) + : Container(), + if (value!.length > 100) + GestureDetector( + onTap: () { + showModalBottomSheet( + context: context, + enableDrag: true, + isDismissible: true, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12)), + ), + backgroundColor: Colors.white, + builder: (context) { + return openWorkListBottomSheet(context, value, title); + }, + ); + + }, + child: Padding( + padding: const EdgeInsets.only(top: 4), + child: Text( + LocaleKeys.showMore.tr(), + textAlign: TextAlign.right, + style: const TextStyle( + color: Color(0xff2BB8A6), + fontSize: 12, + fontWeight: FontWeight.w600, + + ), + ), + ), + ), ], - ).paddingOnly(top: showSpaceAfterLine ? 16 : 0), + + ).paddingOnly(top: showSpaceAfterLine ? 16 : 0, left: 2, right: 2), ); } + } class ItemDetailGrid extends StatelessWidget { @@ -153,3 +189,4 @@ Widget getStringFromJSON(String jsonString) { return Flexible(child: ("-").toString().toText12Auto(color: MyColors.normalTextColor)); } } + diff --git a/lib/widgets/sso_webview_widget.dart b/lib/widgets/sso_webview_widget.dart index e5f2759..070f270 100644 --- a/lib/widgets/sso_webview_widget.dart +++ b/lib/widgets/sso_webview_widget.dart @@ -4,10 +4,10 @@ import 'package:flutter/material.dart'; import 'package:webview_flutter/webview_flutter.dart'; class SsoLoginWebView extends StatefulWidget { - final String url; - final String jwtToken; + final String? url; + final String? jwtToken; - SsoLoginWebView({required this.url, required this.jwtToken}); + SsoLoginWebView({this.url, this.jwtToken}); @override State createState() => _SsoLoginWebViewState(); diff --git a/pubspec.yaml b/pubspec.yaml index 31d5682..0a7d6cb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,8 +17,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 3.6.7+300077 -#version: 3.9.0+1 +#version: 3.6.8+300078 +version: 3.7.992+1 environment: sdk: ^3.7.0 @@ -95,8 +95,8 @@ dependencies: logging: ^1.0.1 swipe_to: ^1.0.2 flutter_webrtc: ^0.12.11 - camera: ^0.11.2 # camera: ^0.10.3 + camera: ^0.11.2 flutter_local_notifications: ^18.0.1 #firebase_analytics: any @@ -142,12 +142,13 @@ dependencies: #todo its for temporary purpose, later will remove this. dotted_border: ^2.0.0+3 webview_flutter: ^4.13.0 + nfc_manager: ^3.2.0 # saf: ^1.0.3+4 dependency_overrides: - nfc_manager: ^3.2.0 +# nfc_manager: 3.2.0 # firebase_core_platform_interface: 4.5.1