diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 132ad69..6d2f83f 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -8,13 +8,13 @@ - + - + diff --git a/android/gradle.properties b/android/gradle.properties index fbdc0de..8df3fe9 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,4 +1,5 @@ -org.gradle.jvmargs=-Xmx2048M +org.gradle.jvmargs=-Xmx4096m +kotlin.daemon.jvmargs=-Xmx4096m android.useAndroidX=true android.enableJetifier=true apmsInstrumentationEnabled=false diff --git a/assets/images/drawer/car_parking_icon.svg b/assets/images/drawer/car_parking_icon.svg new file mode 100644 index 0000000..f77afa0 --- /dev/null +++ b/assets/images/drawer/car_parking_icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index fd27267..aded425 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -642,7 +642,6 @@ "yearsUsed": "سنوات الاستخدام", "faRequest": "طلب التخلص من FA", "showMore": "عرض المزيد", - "buyerDetails": "تفاصيل المشتري", "ticketDetails": "تفاصيل التذكرة", "currentTicketBalance": "رصيد التذكرة الحالي", "ticketHistory": "تاريخ التذكرة", @@ -652,9 +651,10 @@ "status": "الحالة", "deadline": "الموعد النهائي", "overdue": "متأخر", - "open": "فتح", "noCoursesAvailable": "لا توجد دورات متاحة", "pullToRefresh": "اسحب للتحديث", "courseUrlNotAvailable": "رابط الدورة غير متوفر" + "buyerDetails": "تفاصيل المشتري", + "parkingQr": "وقوف السيارات QR" } diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 9cb0be2..faa29f1 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -640,7 +640,6 @@ "yearsUsed": "Years Used", "faRequest":"FA Disposal Request", "showMore": "Show More", - "buyerDetails": "Buyer Details", "ticketDetails": "Ticket Details", "currentTicketBalance": "Current Ticket Balance", "ticketHistory": "Ticket History", @@ -650,8 +649,9 @@ "status": "Status", "deadline": "Deadline", "overdue": "Overdue", - "open": "Open", "noCoursesAvailable": "No Courses Available", "pullToRefresh": "Pull to refresh", - "courseUrlNotAvailable": "Course URL not available" + "courseUrlNotAvailable": "Course URL not available", + "buyerDetails": "Buyer Details", + "parkingQr": "Parking QR" } \ No newline at end of file diff --git a/lib/api/dashboard_api_client.dart b/lib/api/dashboard_api_client.dart index 20fdf93..cd8abee 100644 --- a/lib/api/dashboard_api_client.dart +++ b/lib/api/dashboard_api_client.dart @@ -5,6 +5,7 @@ import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:http/http.dart' as http; import 'package:device_info_plus/device_info_plus.dart'; +import 'package:mobile_device_identifier/mobile_device_identifier.dart'; import 'package:mohem_flutter_app/api/api_client.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/consts.dart'; @@ -16,13 +17,11 @@ import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; import 'package:mohem_flutter_app/models/dashboard/list_menu.dart'; import 'package:mohem_flutter_app/models/dashboard/courses_response_model.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/get_employee_parking_details_model.dart'; import 'package:mohem_flutter_app/models/itg/itg_main_response.dart'; import 'package:mohem_flutter_app/models/itg/itg_response_model.dart'; import 'package:mohem_flutter_app/models/sso_auth_model.dart'; -import 'package:platform_device_id_plus/platform_device_id.dart'; -// import 'package:platform_device_id/platform_device_id.dart'; -// import 'package:platform_device_id/platform_device_id.dart'; import 'package:uuid/uuid.dart'; class DashboardApiClient { @@ -229,9 +228,10 @@ class DashboardApiClient { } Future getBookingSSOFinalRedirection({required String token}) async { - 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')); + // 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')); + var request = http.MultipartRequest('POST', Uri.parse('https://Paxes-release.techmaster.in/SSO/HMG')); request.fields.addAll({'JWTToken': token}); // request.headers.addAll(headers); @@ -256,13 +256,17 @@ class DashboardApiClient { String QRValue = "", String payrollCode = "", }) async { + var _mobileDeviceIdentifierPlugin = MobileDeviceIdentifier(); + Codec stringToBase64 = utf8.fuse(base64); String url = "${ApiConsts.swpRest}AuthenticateAndSwipeUserSupportNFC"; var uuid = Uuid(); String? deviceId = ""; // Generate a v4 (random) id if (Platform.isAndroid) { AndroidDeviceInfo androidInfo = await DeviceInfoPlugin().androidInfo; - deviceId = androidInfo.id; + deviceId = await _mobileDeviceIdentifierPlugin.getDeviceId() ?? androidInfo.id; + deviceId = stringToBase64.encode(deviceId); + deviceId = deviceId.length >= 50 ? deviceId.substring(0, 48) : deviceId; } else if (Platform.isIOS) { IosDeviceInfo iosInfo = await DeviceInfoPlugin().iosInfo; deviceId = iosInfo.identifierForVendor; @@ -413,6 +417,20 @@ class DashboardApiClient { // ); // } + Future getEmployeeParkingQrCode() async { + String url = "${ApiConsts.erpRest}GET_Employee_Parking"; + Map postParams = {}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject( + (json) { + GetEmployeeParking responseData = GetEmployeeParking.fromJson(json); + return responseData; + }, + url, + postParams, + ); + } + //Fetch All Courses Status Future fetchAllCoursesStatus() async { String url = "https://elearning.hmg.com/moodle_dev/api/Fetch_All_Courses_Status.php"; diff --git a/lib/app_state/app_state.dart b/lib/app_state/app_state.dart index e68e169..799bcb5 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: 31, versionID: 9.3, mobileType: Platform.isAndroid ? "android" : "ios"); + final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 9.5, mobileType: Platform.isAndroid ? "android" : "ios"); void setPostParamsInitConfig() { isAuthenticated = false; diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index cfc240f..a6b7173 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -5,14 +5,14 @@ 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"; diff --git a/lib/config/routes.dart b/lib/config/routes.dart index ca4d30f..a864e32 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -40,6 +40,7 @@ import 'package:mohem_flutter_app/ui/my_team/profile_details.dart'; import 'package:mohem_flutter_app/ui/my_team/subordinate_leave.dart'; import 'package:mohem_flutter_app/ui/my_team/team_members.dart'; import 'package:mohem_flutter_app/ui/my_team/view_attendance.dart'; +import 'package:mohem_flutter_app/ui/parking_qr/parking_qr.dart'; import 'package:mohem_flutter_app/ui/payslip/monthly_pay_slip_screen.dart'; import 'package:mohem_flutter_app/ui/performance/performance_appraisal_screen.dart'; import 'package:mohem_flutter_app/ui/profile/add_update_family_member.dart'; @@ -215,6 +216,9 @@ class AppRoutes { static const String activityScreen = "/activityScreen"; + //Parking QR + static const String parkingQr = "/parkingQrScreen"; + static final Map routes = { login: (BuildContext context) => LoginScreen(), verifyLogin: (BuildContext context) => VerifyLoginScreen(), @@ -335,6 +339,10 @@ class AppRoutes { unsafeDeviceScreen: (BuildContext context) => const UnsafeDeviceScreen(), appUpdateScreen: (BuildContext context) => const AppUpdateScreen(), childEducation: (BuildContext context) => ChildEducationAssistance(), - activityScreen:(BuildContext context) => const EventActivityScreen() + activityScreen:(BuildContext context) => const EventActivityScreen(), + + //Parking QR + parkingQr: (BuildContext context) => const ParkingQrScreen(), + }; } diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index ee1ed0e..e2de580 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -563,7 +563,7 @@ class CodegenLoader extends AssetLoader{ "addAtLeastOneAttachment": "الرجاء إضافة مرفق واحد على الأقل.", "pleaseClickButtonToJoinMarathon": "الرجاء الضغط على الزر أدناه للانضمام إلى الماراثون", "youCannotJoinTheMarathon": "لا يمكنك الانضمام إلى الماراثون لأنك تجاوزت الحد الزمني", - "open": "فتح", + "open": "يفتح", "paymentRequest": "طلب الدفع", "paymentDetails": "تفاصيل الدفع", "requestNo": "رقم الطلب", @@ -666,7 +666,8 @@ class CodegenLoader extends AssetLoader{ "deadline": "الموعد النهائي", "noCoursesAvailable": "لا توجد دورات متاحة", "pullToRefresh": "اسحب للتحديث", - "courseUrlNotAvailable": "رابط الدورة غير متوفر" + "courseUrlNotAvailable": "رابط الدورة غير متوفر", + "parkingQr": "وقوف السيارات QR" }; static const Map _en_US = { "mohemm": "Mohemm", @@ -1231,7 +1232,7 @@ static const Map _en_US = { "userSearch": "User Search", "userName": "User Name", "userId": "UserID", - "open": "Open", + "open": "open", "addAtLeastOneAttachment": "Please add at least one attachment.", "pleaseClickButtonToJoinMarathon": "Press the button below to join the Marathon.", "youCannotJoinTheMarathon": "You cannot join the Marathon because you have exceeded the time limit.", @@ -1310,6 +1311,7 @@ static const Map _en_US = { "faRequest": "FA Disposal Request", "showMore": "Show More", "buyerDetails": "Buyer Details", + "parkingQr": "Parking QR", "ticketDetails": "Ticket Details", "currentTicketBalance": "Current Ticket Balance", "ticketHistory": "Ticket History", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index b9a3cfc..37d0b60 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -640,5 +640,6 @@ abstract class LocaleKeys { static const noCoursesAvailable = 'noCoursesAvailable'; static const pullToRefresh = 'pullToRefresh'; static const courseUrlNotAvailable = 'courseUrlNotAvailable'; + static const parkingQr = 'parkingQr'; } diff --git a/lib/main.dart b/lib/main.dart index 39f19e5..263ed8e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -82,18 +82,22 @@ class MyApp extends StatelessWidget { List> delegates = context.localizationDelegates; // delegates.add(GlobalMaterialLocalizations.delegate); delegates.add(MonthYearPickerLocalizations.delegate); - return MaterialApp( - navigatorKey: AppRoutes.navigatorKey, - builder: (BuildContext context, Widget? child) { - return MediaQuery(data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0), child: child!); - }, - theme: AppTheme.getTheme(EasyLocalization.of(context)?.locale.languageCode == "ar"), - debugShowCheckedModeBanner: false, - localizationsDelegates: delegates, - supportedLocales: context.supportedLocales, - locale: context.locale, - initialRoute: AppRoutes.initialRoute, - routes: AppRoutes.routes, + return SafeArea( + top: false, // Set to true if you want to avoid the notch area as well + bottom: Platform.isIOS ? false : true, + child: MaterialApp( + navigatorKey: AppRoutes.navigatorKey, + builder: (BuildContext context, Widget? child) { + return MediaQuery(data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0), child: child!); + }, + theme: AppTheme.getTheme(EasyLocalization.of(context)?.locale.languageCode == "ar"), + debugShowCheckedModeBanner: false, + localizationsDelegates: delegates, + supportedLocales: context.supportedLocales, + locale: context.locale, + initialRoute: AppRoutes.initialRoute, + routes: AppRoutes.routes, + ), ); }, ); diff --git a/lib/models/get_employee_parking_details_model.dart b/lib/models/get_employee_parking_details_model.dart new file mode 100644 index 0000000..4a385c8 --- /dev/null +++ b/lib/models/get_employee_parking_details_model.dart @@ -0,0 +1,61 @@ +import 'dart:convert'; + +class GetEmployeeParking { + GetEmployeeParkingClass? getEmployeeParking; + + GetEmployeeParking({ + this.getEmployeeParking, + }); + + factory GetEmployeeParking.fromRawJson(String str) => GetEmployeeParking.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); + + factory GetEmployeeParking.fromJson(Map json) => GetEmployeeParking( + getEmployeeParking: json["GET_Employee_Parking"] == null ? null : GetEmployeeParkingClass.fromJson(json["GET_Employee_Parking"]), + ); + + Map toJson() => { + "GET_Employee_Parking": getEmployeeParking?.toJson(), + }; +} + +class GetEmployeeParkingClass { + DateTime? createdAt; + String? employeeCode; + String? isNewQrCode; + String? qrCode; + String? qrCodeImageBase64; + bool? success; + + GetEmployeeParkingClass({ + this.createdAt, + this.employeeCode, + this.isNewQrCode, + this.qrCode, + this.qrCodeImageBase64, + this.success, + }); + + factory GetEmployeeParkingClass.fromRawJson(String str) => GetEmployeeParkingClass.fromJson(json.decode(str)); + + String toRawJson() => json.encode(toJson()); + + factory GetEmployeeParkingClass.fromJson(Map json) => GetEmployeeParkingClass( + createdAt: json["createdAt"] == null ? null : DateTime.parse(json["createdAt"]), + employeeCode: json["employeeCode"], + isNewQrCode: json["isNewQRCode"], + qrCode: json["qrCode"], + qrCodeImageBase64: json["qrCodeImageBase64"], + success: json["success"], + ); + + Map toJson() => { + "createdAt": createdAt?.toIso8601String(), + "employeeCode": employeeCode, + "isNewQRCode": isNewQrCode, + "qrCode": qrCode, + "qrCodeImageBase64": qrCodeImageBase64, + "success": success, + }; +} diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index 00f339d..0799aef 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -126,6 +126,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { DrawerMenuItem("assets/images/drawer/my_profile.svg", LocaleKeys.myProfile.tr(), AppRoutes.profile), DrawerMenuItem("assets/images/drawer/performance_evaluation.svg", LocaleKeys.performanceEvaluation.tr(), AppRoutes.performanceEvaluation), DrawerMenuItem("assets/images/drawer/mowadhafi.svg", LocaleKeys.mowadhafhi.tr(), AppRoutes.mowadhafhi), + DrawerMenuItem("assets/images/drawer/car_parking_icon.svg", LocaleKeys.parkingQr.tr(), AppRoutes.parkingQr), DrawerMenuItem("assets/images/drawer/pending_trasactions.svg", LocaleKeys.pendingTransactions.tr(), AppRoutes.pendingTransactions), DrawerMenuItem("assets/images/drawer/courses.svg", "courses".tr(), AppRoutes.courses), // DrawerMenuItem("assets/images/drawer/drawer_marathon.svg", LocaleKeys.brainMarathon.tr(), AppRoutes.marathonIntroScreen), @@ -333,8 +334,6 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { 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; @@ -347,8 +346,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { Future fetchSSOAuthRedirection({String? clientID}) async { try { SSOAuthModel? ssoResponse = await DashboardApiClient().getBookingSSOAuthRedirection(clientID: clientID!); - logger.d("SSO Response: ${ssoResponse!.toJson()}"); - if (ssoResponse.status == "Success") { + if (ssoResponse!.status == "Success") { return ssoResponse; } else { Utils.showToast(ssoResponse.message!.first ?? "Failed to fetch SSO Auth Token"); @@ -368,18 +366,12 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { dynamic res = await DashboardApiClient().getBookingSSOFinalRedirection(token: token); logger.d("SSO URL: $res"); return res; - // if (ssoResponse.status == "Success") { - // return ssoResponse; - // } else { - // Utils.showToast(ssoResponse.message!.first ?? "Failed to fetch SSO Auth Token"); - // return null; - // } } catch (ex) { logger.wtf(ex); isEventLoadingLoading = false; notifyListeners(); Utils.handleException(ex, null, null); - return null; // Ensure a return value in case of an exception + return null; } } diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 8b14f2c..3122d17 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -164,7 +164,8 @@ class _DashboardScreenState extends State with WidgetsBindingOb if (!cProvider.disbaleChatForThisUser && !isFromInit) checkHubCon(); _refreshController.refreshCompleted(); - await data.fetchTicketBooking(); + // await data.fetchTicketBooking(); + // if (data.ticketBookingResponse != null && !data.ticketBookingResponse!.success) { // // data.fetchTicketBalance(); // } diff --git a/lib/ui/landing/widget/services_widget.dart b/lib/ui/landing/widget/services_widget.dart index deea7e9..879173b 100644 --- a/lib/ui/landing/widget/services_widget.dart +++ b/lib/ui/landing/widget/services_widget.dart @@ -257,9 +257,9 @@ class ServicesWidget extends StatelessWidget { } } else { if (menuEntry.menuName == "HMG_TICKET_REQUESTS") { - Utils.showLoading(context); //Ticket Work if (pro.ticketBookingResponse != null && pro.ticketBookingResponse!.success) { + Utils.showLoading(context); SSOAuthModel? ssoToken = await pro.fetchSSOAuthRedirection(clientID: pro.ticketBookingResponse!.clientId); if (ssoToken != null) { dynamic url = await pro.fetchURLRedirection(token: ssoToken.data!.accessToken!); diff --git a/lib/ui/parking_qr/parking_qr.dart b/lib/ui/parking_qr/parking_qr.dart new file mode 100644 index 0000000..641f84a --- /dev/null +++ b/lib/ui/parking_qr/parking_qr.dart @@ -0,0 +1,106 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/dashboard_api_client.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/get_employee_parking_details_model.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; + +class ParkingQrScreen extends StatefulWidget { + const ParkingQrScreen({Key? key}) : super(key: key); + + @override + _RequestDetailsState createState() => _RequestDetailsState(); +} + +class _RequestDetailsState extends State { + GetEmployeeParking? qrData; + + @override + void initState() { + super.initState(); + getTicketDetails(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget(context, title: LocaleKeys.parkingQr.tr()), + body: + qrData?.getEmployeeParking == null + ? Center(child: Text(LocaleKeys.noDataAvailable.tr())) + : SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Center( + child: Container( + padding: const EdgeInsets.all(20.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + boxShadow: [BoxShadow(color: Colors.grey.withValues(alpha: 0.2), spreadRadius: 5, blurRadius: 10, offset: const Offset(0, 3))], + ), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // QR Code Image + if (qrData!.getEmployeeParking!.qrCodeImageBase64 != null && qrData!.getEmployeeParking!.qrCodeImageBase64!.isNotEmpty) + Image.memory(Utils.dataFromBase64String(qrData!.getEmployeeParking!.qrCodeImageBase64!), width: 300, height: 300, fit: BoxFit.contain) + else + Container( + width: 300, + height: 300, + color: MyColors.lightGreyEFColor, + child: Center(child: Text(LocaleKeys.noDataAvailable.tr(), style: const TextStyle(color: MyColors.grey67Color))), + ), + 10.height, + Container(height: 1, color: MyColors.lightGreyE3Color, margin: const EdgeInsets.symmetric(vertical: 10)), + 20.height, + SizedBox( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Employee Code + if (qrData!.getEmployeeParking!.employeeCode != null && qrData!.getEmployeeParking!.employeeCode!.isNotEmpty) ...[ + Text(LocaleKeys.employeeNumber.tr(), style: const TextStyle(fontSize: 14, color: MyColors.grey67Color, fontWeight: FontWeight.w400)), + 8.height, + Text(qrData!.getEmployeeParking!.employeeCode!, style: const TextStyle(fontSize: 18, color: MyColors.darkTextColor, fontWeight: FontWeight.w600)), + 8.height, + ], + if (qrData!.getEmployeeParking!.createdAt != null) ...[ + Text(LocaleKeys.creationDate.tr(), style: const TextStyle(fontSize: 14, color: MyColors.grey67Color, fontWeight: FontWeight.w400)), + 8.height, + Text( + DateFormat('dd MMM yyyy, hh:mm a').format(qrData!.getEmployeeParking!.createdAt!), + style: const TextStyle(fontSize: 16, color: MyColors.darkTextColor, fontWeight: FontWeight.w500), + ), + ], + ], + ), + ), + ], + ), + ), + ), + ), + ), + ); + } + + void getTicketDetails() async { + try { + Utils.showLoading(context); + qrData = await DashboardApiClient().getEmployeeParkingQrCode(); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } +} diff --git a/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart b/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart index 44b3833..e7d2fde 100644 --- a/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart +++ b/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart @@ -150,7 +150,9 @@ class _MowadhafhiHRRequestState extends State { isReadOnly: false, onChange: (String value) { debugPrint(value); - description = value; + setState(() { + description = value; + }); }, ), ], @@ -171,7 +173,7 @@ class _MowadhafhiHRRequestState extends State { } bool checkValidation() { - if (selectedServiceType == null || selectedDepartment == null || selectedSection == null || selectedTopic == null) { + if (selectedServiceType == null || selectedDepartment == null || selectedSection == null || selectedTopic == null || description == "") { return false; } else { return true; diff --git a/lib/ui/work_list/itg_fragments/approval_level_fragment.dart b/lib/ui/work_list/itg_fragments/approval_level_fragment.dart index d7d9c7e..61681eb 100644 --- a/lib/ui/work_list/itg_fragments/approval_level_fragment.dart +++ b/lib/ui/work_list/itg_fragments/approval_level_fragment.dart @@ -21,7 +21,11 @@ class ApprovalLevelfragment extends StatelessWidget { @override Widget build(BuildContext context) { - if (wFHistory.isNotEmpty) wFHistory = wFHistory.reversed.toList(); + if (wFHistory.isNotEmpty) { + //TODO: This COde is Written For Future. If Needed Enable to Filter The Empty Action Requests. + // wFHistory = wFHistory.where((item) => item.action != null && item.action!.isNotEmpty).toList(); + wFHistory = wFHistory.reversed.toList(); + } return Container( width: double.infinity, height: double.infinity, diff --git a/lib/ui/work_list/sheets/delegate_sheet.dart b/lib/ui/work_list/sheets/delegate_sheet.dart index ef38ce0..d72b041 100644 --- a/lib/ui/work_list/sheets/delegate_sheet.dart +++ b/lib/ui/work_list/sheets/delegate_sheet.dart @@ -1,5 +1,4 @@ import 'dart:collection'; -import 'dart:convert'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; @@ -33,16 +32,8 @@ class DelegateSheet extends StatefulWidget { VoidCallback callBackFunc; List getNotificationRespondAttributes; - DelegateSheet({ - super.key, - required this.title, - required this.apiMode, - this.notificationID, - this.actionHistoryList, - this.wFHistory, - required this.callBackFunc, - this.getNotificationRespondAttributes = const [], - }); + DelegateSheet( + {required this.title, required this.apiMode, this.notificationID, this.actionHistoryList, this.wFHistory, required this.callBackFunc, this.getNotificationRespondAttributes = const []}); @override State createState() => _DelegateSheetState(); @@ -55,8 +46,8 @@ class _DelegateSheetState extends State { String? selectedFavLetter; String selectedType = "Workflow"; String inputRes = ""; + List? favLetters; List? favUsersList; - List? filteredFavUsersList = []; List? replacementList; bool isImageLoaded = false; @@ -66,14 +57,14 @@ class _DelegateSheetState extends State { super.initState(); if (widget.wFHistory != null) { widget.wFHistory = widget.wFHistory!.reversed.toList(); - Set ids = widget.wFHistory!.map((WFHistory e) => e.employeeID).toSet(); - widget.wFHistory!.retainWhere((WFHistory x) => ids.remove(x.employeeID)); + var ids = widget.wFHistory!.map((e) => e.employeeID).toSet(); + widget.wFHistory!.retainWhere((x) => ids.remove(x.employeeID)); } if (widget.actionHistoryList != null) { widget.actionHistoryList = widget.actionHistoryList!.reversed.toList(); - Set ids = widget.actionHistoryList!.map((GetActionHistoryList e) => e.uSERNAME).toSet(); - widget.actionHistoryList!.retainWhere((GetActionHistoryList x) => ids.remove(x.uSERNAME)); + var ids = widget.actionHistoryList!.map((e) => e.uSERNAME).toSet(); + widget.actionHistoryList!.retainWhere((x) => ids.remove(x.uSERNAME)); } } @@ -82,96 +73,36 @@ class _DelegateSheetState extends State { super.dispose(); } - Future fetchFavUsers({bool isNeedLoading = true}) async { - favUsersList = []; - filteredFavUsersList = []; - + Future fetchFavLetters({bool isNeedLoading = true}) async { + favLetters = []; if (isNeedLoading) Utils.showLoading(context); - - 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(() {}); - } + 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; } - 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 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 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); - filteredFavUsersList = await WorkListApiClient().getFavoriteReplacementWithImageNew(selectedFavLetter ?? ""); + favUsersList = await WorkListApiClient().getFavoriteReplacementWithImageNew(selectedFavLetter ?? ""); if (isNeedLoading) Utils.hideLoading(context); setState(() { isImageLoaded = true; @@ -181,10 +112,18 @@ 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); - GenericResponseModel model = await WorkListApiClient().changeFavoriteReplacements(email: email, employeName: employeName, image: image, userName: userName, isFav: isFav); + favLetters = null; + selectedFavLetter = null; + GenericResponseModel model = await WorkListApiClient().changeFavoriteReplacements( + email: email, + employeName: employeName, + image: image, + userName: userName, + isFav: isFav, + ); if (isNeedToRefresh) { - await fetchFavUsers(isNeedLoading: false); - // if (favUsersList != null) await fetchFavUsersList(isNeedLoading: false); + await fetchFavLetters(isNeedLoading: false); + if (favLetters != null) await fetchFavUsersList(isNeedLoading: false); } Utils.hideLoading(context); @@ -198,58 +137,44 @@ 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 SizedBox( + return Container( 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: 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)), + 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, + ), + ), child: Row( - children: [ + children: [ Expanded( child: InputWidget( "Search By " + selectedType, @@ -260,18 +185,29 @@ class _DelegateSheetState extends State { verticalPadding: 3, isInputTypeNum: selectedType == "Employee ID" ? true : false, isEnable: isNeedEnableTextField, - onChange: (String v) { + onChange: (v) { inputRes = v; - if (selectedType == "Favorites") { - searchFavUser(); - } }, ), ), - Container(height: 36, width: 1, color: const Color(0xffE5E5E5)), Container( - padding: const EdgeInsets.all(8), - child: Row(children: [selectedType.toText12(), 4.width, const Icon(Icons.keyboard_arrow_down, color: Colors.black, size: 16)]), + 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, + ), + ], + ), ).onPress(() { showMyBottomSheet( context, @@ -283,17 +219,19 @@ class _DelegateSheetState extends State { if (value == "Workflow") { setState(() { isNeedEnableTextField = false; - // selectedFavLetter = null; - filteredFavUsersList = null; + selectedFavLetter = null; + favLetters = null; + favUsersList = null; }); } else if (value == "Favorites") { - isNeedEnableTextField = true; - fetchFavUsers(); + isNeedEnableTextField = false; + fetchFavLetters(); } else { setState(() { isNeedEnableTextField = true; - // selectedFavLetter = null; - filteredFavUsersList = null; + selectedFavLetter = null; + favLetters = null; + favUsersList = null; }); } }, @@ -303,105 +241,143 @@ class _DelegateSheetState extends State { ], ), ), - if (isNeedEnableTextField && selectedType != "Favorites") + if (isNeedEnableTextField) 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: SizedBox( + child: Container( width: double.infinity, - 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: (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!.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), - )), + child: selectedFavLetter == null && favLetters != null + ? Container( + width: double.infinity, + alignment: Alignment.center, + child: "Please select letter to see Fav results".toText12(), + ) + : favUsersList != null + ? 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), + ) + : 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), + )), ), ), - // 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, - // ), - // ), + 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, + ), + ), ], ), ], @@ -409,15 +385,22 @@ 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: const [Color(0xffE6E6E6), Color(0xffE6E6E6)], - ).insideContainer, + colors: [ + Color(0xffE6E6E6), + Color(0xffE6E6E6), + ], + ).insideContainer ], ), ); @@ -427,22 +410,25 @@ 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( @@ -458,8 +444,12 @@ 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, + ), + ) ], ), ); @@ -469,18 +459,25 @@ 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, - ), - ); + showMyBottomSheet(context, + callBackFunc: widget.callBackFunc, + child: SelectedItgItemSheet( + "Comment", + apiMode: widget.apiMode, + wfHistory: wfHistory, + // notificationID: widget.notificationID, + )); }, - child: Row(children: [CircularAvatar(height: 30, width: 30), 9.width, (wfHistory.name ?? "").toText12().expanded]), + child: Row( + children: [ + CircularAvatar( + height: 30, + width: 30, + ), + 9.width, + (wfHistory.name ?? "").toText12().expanded, + ], + ), ); } @@ -488,31 +485,47 @@ 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 != "" && actionHistory.employeeImage != null - ? CircularAvatar(url: actionHistory.employeeImage, height: 40, width: 40, isImageBase64: (actionHistory.employeeImage != null || actionHistory.employeeImage!.isNotEmpty) ? true : false) + children: [ + actionHistory.employeeImage != "" + ? 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) + ? 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(), - ), + 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( @@ -524,8 +537,12 @@ class _DelegateSheetState extends State { isNeedToRefresh: true, ); }, - icon: const Icon(Icons.star, size: 16, color: MyColors.yellowColor), - ), + icon: Icon( + Icons.star, + size: 16, + color: MyColors.yellowColor, + ), + ) ], ), ); @@ -535,24 +552,29 @@ 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); @@ -565,8 +587,12 @@ 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/widgets/bottom_sheet.dart b/lib/widgets/bottom_sheet.dart index 7db0935..d5cb271 100644 --- a/lib/widgets/bottom_sheet.dart +++ b/lib/widgets/bottom_sheet.dart @@ -2,6 +2,7 @@ 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}) { @@ -65,14 +66,7 @@ void showMyBottomSheet(BuildContext context, {required Widget child, required Vo Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - title ?? "Details", - style: const TextStyle( - color: Color(0xff2BB8A6), - fontSize: 14, - fontWeight: FontWeight.bold, - ), - ), + (title ?? "Details").toText14(isBold: true, color: Color(0xff2BB8A6)), IconButton( icon: const Icon(Icons.close, color: Colors.black54, size: 20), onPressed: () { @@ -83,20 +77,12 @@ void showMyBottomSheet(BuildContext context, {required Widget child, required Vo ), const Divider(height: 1, color: Colors.grey), const SizedBox(height: 12), - // ---- Scrollable Content ---- Expanded( child: SingleChildScrollView( - child: Text( - (val?.isEmpty ?? true) - ? "--" - : val.toString(), - style: TextStyle( - color: MyColors.normalTextColor, - fontSize: 14, - height: 1.4, - ), - ), + child: ((val?.isEmpty ?? true) + ? "--" + : val.toString()).toText14(), ), ), SizedBox( @@ -112,7 +98,7 @@ void showMyBottomSheet(BuildContext context, {required Widget child, required Vo onPressed: () { Navigator.pop(context); }, - child: Text( + child: Text( LocaleKeys.close.tr(), style: const TextStyle( color: Colors.white, diff --git a/lib/widgets/sso_webview_widget.dart b/lib/widgets/sso_webview_widget.dart index 070f270..5877a63 100644 --- a/lib/widgets/sso_webview_widget.dart +++ b/lib/widgets/sso_webview_widget.dart @@ -46,7 +46,7 @@ class _SsoLoginWebViewState extends State { -
+

Redirecting...

diff --git a/pubspec.yaml b/pubspec.yaml index 7e97774..6abe6fc 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.8+300078 -#version: 3.9.1+1 +#version: 3.7.1+300081 +version: 3.9.3+1 environment: sdk: ^3.7.0 @@ -56,7 +56,8 @@ dependencies: logger: ^1.1.0 flutter_countdown_timer: ^4.1.0 - platform_device_id_plus: ^1.0.7 +# platform_device_id_plus: ^1.0.7 + mobile_device_identifier: ^0.0.3 device_info_plus: ^11.5.0 image_picker: ^1.1.2 file_picker: ^8.3.1 @@ -139,12 +140,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