diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 2adb2ba..ac320f7 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -513,5 +513,6 @@ "ourSponsor": "راعينا:", "startingIn": "يبدأ في", "youAreOutOfContest": "أنت خارج المسابقة.", - "winners": "الفائزين!!!" + "winners": "الفائزين!!!", + "fakeLocation": ".لقد تتبعنا أنك تحاول استخدام موقع مزيف! يعتبر هذا مخالفة وقد تم إخطار الموارد البشرية" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 46ede79..1e6025c 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -513,6 +513,6 @@ "ourSponsor": "Our Sponsor:", "startingIn": "Starting in", "youAreOutOfContest": "You are out of the contest.", - "winners": "WINNERS!!!" - + "winners": "WINNERS!!!", + "fakeLocation": "We traced out that you try to use a fake location! This is considered a violation, and HR has been notified." } \ No newline at end of file diff --git a/lib/api/chat/chat_api_client.dart b/lib/api/chat/chat_api_client.dart index 3ef8fba..35e4f79 100644 --- a/lib/api/chat/chat_api_client.dart +++ b/lib/api/chat/chat_api_client.dart @@ -60,17 +60,6 @@ class ChatApiClient { json.decode(response.body), ); } catch (e) { - // if (e.message == "api_common_unauthorized") { - // user.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken(); - // if (userLoginResponse.response != null) { - // AppState().setchatUserDetails = userLoginResponse; - // getRecentChats(); - // } else { - // Utils.showToast( - // userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr", - // ); - // } - // } throw e; } } @@ -97,16 +86,6 @@ class ChatApiClient { } return response; } catch (e) { - // e as APIException; - // if (e.message == "api_common_unauthorized") { - // user.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken(); - // if (userLoginResponse.response != null) { - // AppState().setchatUserDetails = userLoginResponse; - // getSingleUserChatHistory(senderUID: senderUID, receiverUID: receiverUID, loadMore: loadMore, paginationVal: paginationVal); - // } else { - // Utils.showToast(userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr"); - // } - // } throw e; } } @@ -135,15 +114,6 @@ class ChatApiClient { return favoriteChatUser; } catch (e) { e as APIException; - // if (e.message == "api_common_unauthorized") { - // user.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken(); - // if (userLoginResponse.response != null) { - // AppState().setchatUserDetails = userLoginResponse; - // unFavUser(userID: userID, targetUserID: targetUserID); - // } else { - // Utils.showToast(userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr"); - // } - // } throw e; } } diff --git a/lib/api/dashboard_api_client.dart b/lib/api/dashboard_api_client.dart index ace0881..5f2ad7e 100644 --- a/lib/api/dashboard_api_client.dart +++ b/lib/api/dashboard_api_client.dart @@ -133,6 +133,28 @@ class DashboardApiClient { }, url, postParams); } + //Mark Fake Location + Future markFakeLocation({String lat = "0", String? long = "0", required String sourceName}) async { + String url = "${ApiConsts.swpRest}CreateIssueInfo"; + var uuid = Uuid(); + // Generate a v4 (random) id + + Map postParams = { + "UID": uuid.v4(), //Mobile Id + "Latitude": lat, + "Longitude": long, + "QRValue": '', + "NFCValue": sourceName == 'NFC' ? sourceName : '', + "WifiValue": sourceName == 'WIFI' ? sourceName : '', + "EmployeeID": AppState().memberInformationList!.eMPLOYEENUMBER, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } + //Check ITG Type Future getITGPageNotification() async { String url = "${ApiConsts.cocRest}Mohemm_ITG_GetPageNotification"; diff --git a/lib/api/monthly_attendance_api_client.dart b/lib/api/monthly_attendance_api_client.dart index 00d444f..e462373 100644 --- a/lib/api/monthly_attendance_api_client.dart +++ b/lib/api/monthly_attendance_api_client.dart @@ -29,7 +29,6 @@ class MonthlyAttendanceApiClient { postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); - print(responseData); return (responseData.getTimeCardSummaryList?.length ?? 0) > 0 ? responseData.getTimeCardSummaryList!.first : null; }, url, postParams); } @@ -49,7 +48,6 @@ class MonthlyAttendanceApiClient { // postParams["DeviceType"] = deviceType; return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); - print(responseData.getDayHoursTypeDetailsList!.length); return responseData.getDayHoursTypeDetailsList ?? []; }, url, postParams); } diff --git a/lib/api/monthly_pay_slip_api_client.dart b/lib/api/monthly_pay_slip_api_client.dart index 95bf847..e3071a4 100644 --- a/lib/api/monthly_pay_slip_api_client.dart +++ b/lib/api/monthly_pay_slip_api_client.dart @@ -19,7 +19,6 @@ class MonthlyPaySlipApiClient { String url = "${ApiConsts.erpRest}GET_PAYSLIP"; Map postParams = {"P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": -999}; postParams.addAll(AppState().postParamsJson); - print(postParams); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); return responseData.getPayslipList ?? []; diff --git a/lib/api/my_attendance_api_client.dart b/lib/api/my_attendance_api_client.dart index 5833413..0f078a2 100644 --- a/lib/api/my_attendance_api_client.dart +++ b/lib/api/my_attendance_api_client.dart @@ -26,7 +26,6 @@ class MyAttendanceApiClient { if (empID!.isNotEmpty) { postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; // AppState().postParamsJson['P_SELECTED_EMPLOYEE_NUMBER'] = empID; - print(empID); } return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); diff --git a/lib/api/my_team/my_team_api_client.dart b/lib/api/my_team/my_team_api_client.dart index 17a0a90..df635b0 100644 --- a/lib/api/my_team/my_team_api_client.dart +++ b/lib/api/my_team/my_team_api_client.dart @@ -64,7 +64,6 @@ class MyTeamApiClient { postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); - print(responseData.getDayHoursTypeDetailsList!.length); return responseData.getDayHoursTypeDetailsList ?? []; }, url, postParams); } @@ -76,7 +75,6 @@ class MyTeamApiClient { postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); - print(responseData.getAttendanceTrackingList); return responseData.getAttendanceTrackingList; }, url, postParams); } diff --git a/lib/api/profile_api_client.dart b/lib/api/profile_api_client.dart index 210d179..6a8cfb0 100644 --- a/lib/api/profile_api_client.dart +++ b/lib/api/profile_api_client.dart @@ -41,7 +41,6 @@ class ProfileApiClient { postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); - print(responseData); return responseData.getEmployeeContactsList ?? []; }, url, postParams); } @@ -258,7 +257,6 @@ class ProfileApiClient { // "EITTransactionTBLModel": list, }; postParams.addAll(AppState().postParamsJson); - print("postParams:$postParams"); postParams["EITTransactionTBL"] = list; postParams["EITTransactionTBLModel"] = list; return await ApiClient().postJsonForObject((json) { @@ -300,7 +298,6 @@ class ProfileApiClient { // "EITTransactionTBLModel": list, }; postParams.addAll(AppState().postParamsJson); - print("postParams:$postParams"); postParams["EITTransactionTBL"] = list; // postParams["EITTransactionTBLModel"] = list; return await ApiClient().postJsonForObject((json) { @@ -389,12 +386,7 @@ class ProfileApiClient { }; postParams.addAll(AppState().postParamsJson); - print("postParam:${json.encode(postParams)}"); postParams["EITTransactionTBL"] = list; - list.forEach((element) { - print(json.encode(element)); - - }); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); return responseData.submitContactTransactionList; diff --git a/lib/api/termination_dff_api_client.dart b/lib/api/termination_dff_api_client.dart index 0933dea..0d5864f 100644 --- a/lib/api/termination_dff_api_client.dart +++ b/lib/api/termination_dff_api_client.dart @@ -46,9 +46,6 @@ class TerminationDffApiClient { }; postParams.addAll(AppState().postParamsJson); - for (var abc in list) { - print(abc); - } return await ApiClient().postJsonForObject((json) { GenericResponseModel genericResponseModel = GenericResponseModel.fromJson(json); return genericResponseModel.submitTermTransactionList!; diff --git a/lib/api/worklist/worklist_api_client.dart b/lib/api/worklist/worklist_api_client.dart index 75992e7..dcbb415 100644 --- a/lib/api/worklist/worklist_api_client.dart +++ b/lib/api/worklist/worklist_api_client.dart @@ -26,6 +26,7 @@ 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_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'; import 'package:mohem_flutter_app/models/worklist/hr/get_basic_det_ntf_body_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_contact_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_phones_notification_body_list_model.dart'; @@ -509,6 +510,20 @@ class WorkListApiClient { }, url, postParams); } + Future?> getAddressNotificationBodyList(int? notificationId) async { + String url = "${ApiConsts.erpRest}GET_ADDRESS_NOTIFICATION_BODY"; + 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.getAddressNotificationBodyList; + }, url, postParams); + } + Future?> getFavoriteReplacementWithoutImage() async { String url = "${ApiConsts.erpRest}Mohemm_GetFavoriteReplacementsWithoutImage"; Map postParams = {}; diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index 3be8356..57bb888 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -9,7 +9,6 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:fluttertoast/fluttertoast.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/config/routes.dart'; import 'package:mohem_flutter_app/exceptions/api_exception.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; @@ -66,6 +65,7 @@ class Utils { showDialog( context: context, barrierColor: Colors.black.withOpacity(0.5), + useRootNavigator: false, builder: (BuildContext context) => LoadingDialog(), ).then((value) { _isLoadingVisible = false; @@ -121,8 +121,11 @@ class Utils { ), ); } else { - showToast(errorMessage); - // confirmDialog(cxt, errorMessage); + if (cxt != null) { + confirmDialog(cxt, errorMessage); + } else { + showToast(errorMessage); + } } } } @@ -340,7 +343,6 @@ class Utils { static void readNFc({required Function(String) onRead}) { NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async { - print(tag.data); var f; if (Platform.isAndroid) { f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22); diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 8e1637e..e9e7e93 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -102,13 +102,14 @@ extension EmailValidator on String { decoration: isUnderLine ? TextDecoration.underline : null), ); - Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines}) => Text( + Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines, double? height}) => Text( this, maxLines: maxlines, style: TextStyle( color: color ?? MyColors.darkTextColor, fontSize: 16, letterSpacing: -0.64, + height: height, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, decoration: isUnderLine ? TextDecoration.underline : null, ), diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index b2a92ad..67408b3 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -528,7 +528,9 @@ class CodegenLoader extends AssetLoader{ "youWantToLeaveMarathon": "هل أنت متأكد أنك تريد العودة؟ سوف تخرج من المسابقة.", "ourSponsor": "راعينا:", "startingIn": "يبدأ في", - "youAreOutOfContest": "أنت خارج المسابقة." + "youAreOutOfContest": "أنت خارج المسابقة.", + "winners": "الفائزين!!!", + "fakeLocation": ".لقد تتبعنا أنك تحاول استخدام موقع مزيف! يعتبر هذا مخالفة وقد تم إخطار الموارد البشرية" }; static const Map en_US = { "mohemm": "Mohemm", @@ -1044,7 +1046,9 @@ static const Map en_US = { "youWantToLeaveMarathon": "Are you sure you want to go back? You will be out of the contest.", "ourSponsor": "Our Sponsor:", "startingIn": "Starting in", - "youAreOutOfContest": "You are out of the contest." + "youAreOutOfContest": "You are out of the contest.", + "winners": "WINNERS!!!", + "fakeLocation": "We traced out that you try to use a fake location! This is considered a violation, and HR has been notified." }; 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 8960278..e4c6ffb 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -500,5 +500,6 @@ abstract class LocaleKeys { static const startingIn = 'startingIn'; static const youAreOutOfContest = 'youAreOutOfContest'; static const winners = 'winners'; + static const fakeLocation = 'fakeLocation'; } diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index cd7043c..ed00de4 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -102,6 +102,7 @@ import 'package:mohem_flutter_app/models/validate_eit_transaction_list_model.dar import 'package:mohem_flutter_app/models/worklist/GetRFCEmployeeList.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'; import 'package:mohem_flutter_app/models/worklist/hr/get_basic_det_ntf_body_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_contact_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_phones_notification_body_list_model.dart'; @@ -163,12 +164,12 @@ class GenericResponseModel { List? getAbsenceAttachmentsList; List? getAbsenceAttendanceTypesList; List? getAbsenceCollectionNotificationBodyList; + List? getAddressNotificationBodyList; List? getAbsenceDffStructureList; List? getAbsenceTransactionList; List? getAccrualBalancesList; List? getActionHistoryList; List? getAddressDffStructureList; - List? getAddressNotificationBodyList; List? getApprovesList; List? getAttachementList; GetAttendanceTracking? getAttendanceTrackingList; @@ -717,6 +718,13 @@ class GenericResponseModel { }); } + if (json['GetAddressNotificationBodyList'] != null) { + getAddressNotificationBodyList = []; + json['GetAddressNotificationBodyList'].forEach((v) { + getAddressNotificationBodyList!.add(GetAddressNotificationBodyList.fromJson(v)); + }); + } + if (json['GetAbsenceDffStructureList'] != null) { getAbsenceDffStructureList = []; json['GetAbsenceDffStructureList'].forEach((v) { @@ -746,7 +754,7 @@ class GenericResponseModel { getAddressDffStructureList!.add(GetAddressDffStructureList.fromJson(v)); }); } - getAddressNotificationBodyList = json['GetAddressNotificationBodyList']; + // getAddressNotificationBodyList = json['GetAddressNotificationBodyList']; if (json['GetApprovesList'] != null) { getApprovesList = []; diff --git a/lib/models/worklist/hr/get_address_notification_body_list.dart b/lib/models/worklist/hr/get_address_notification_body_list.dart new file mode 100644 index 0000000..28ee516 --- /dev/null +++ b/lib/models/worklist/hr/get_address_notification_body_list.dart @@ -0,0 +1,28 @@ +class GetAddressNotificationBodyList { + String? pREVSEGMENTVALUEDSP; + String? sEGMENTPROMPT; + String? sEGMENTVALUEDSP; + String? uPDATEDFLAG; + + GetAddressNotificationBodyList( + {this.pREVSEGMENTVALUEDSP, + this.sEGMENTPROMPT, + this.sEGMENTVALUEDSP, + this.uPDATEDFLAG}); + + GetAddressNotificationBodyList.fromJson(Map json) { + pREVSEGMENTVALUEDSP = json['PREV_SEGMENT_VALUE_DSP']; + sEGMENTPROMPT = json['SEGMENT_PROMPT']; + sEGMENTVALUEDSP = json['SEGMENT_VALUE_DSP']; + uPDATEDFLAG = json['UPDATED_FLAG']; + } + + Map toJson() { + Map data = new Map(); + data['PREV_SEGMENT_VALUE_DSP'] = this.pREVSEGMENTVALUEDSP; + data['SEGMENT_PROMPT'] = this.sEGMENTPROMPT; + data['SEGMENT_VALUE_DSP'] = this.sEGMENTVALUEDSP; + data['UPDATED_FLAG'] = this.uPDATEDFLAG; + return data; + } +} diff --git a/lib/provider/chat_provider_model.dart b/lib/provider/chat_provider_model.dart index 67899c5..a62016f 100644 --- a/lib/provider/chat_provider_model.dart +++ b/lib/provider/chat_provider_model.dart @@ -36,6 +36,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { String chatCID = ''; bool isLoading = true; bool isChatScreenActive = false; + int receiverID = 0; + late File selectedFile; bool isFileSelected = false; String sFileType = ""; @@ -46,7 +48,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { bool currentUserTyping = false; int? cTypingUserId = 0; - //Chat + //Chat Home Page Counter int chatUConvCounter = 0; Future getUserAutoLoginToken() async { @@ -142,6 +144,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { if (isNewChat) userChatHistory = []; if (!loadMore) paginationVal = 0; isChatScreenActive = true; + receiverID = receiverUID; Response response = await ChatApiClient().getSingleUserChatHistory(senderUID: senderUID, receiverUID: receiverUID, loadMore: loadMore, paginationVal: paginationVal); if (response.statusCode == 204) { if (isNewChat) { @@ -160,7 +163,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { isLoading = false; notifyListeners(); - markRead(userChatHistory, receiverUID); + if (isChatScreenActive && receiverUID == receiverID) { + markRead(userChatHistory, receiverUID); + } generateConvId(); } @@ -286,14 +291,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { void chatNotDelivered(List? args) { dynamic items = args!.toList(); for (dynamic item in items[0]) { - searchedChats!.forEach( - (ChatUser element) { - if (element.id == item["currentUserId"]) { - int? val = element.unreadMessageCount ?? 0; - element.unreadMessageCount = val! + 1; - } - }, - ); + for (ChatUser element in searchedChats!) { + if (element.id == item["currentUserId"]) { + int? val = element.unreadMessageCount ?? 0; + element.unreadMessageCount = val! + 1; + } + } } notifyListeners(); } @@ -371,20 +374,27 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } } setMsgTune(); - userChatHistory.insert(0, data.first); - - if (searchedChats != null && !isChatScreenActive) { - for (ChatUser user in searchedChats!) { - if (user.id == data.first.currentUserId) { - int tempCount = user.unreadMessageCount ?? 0; - user.unreadMessageCount = tempCount + 1; + if (isChatScreenActive && data.first.currentUserId == receiverID) { + userChatHistory.insert(0, data.first); + } else { + if (searchedChats != null) { + for (ChatUser user in searchedChats!) { + if (user.id == data.first.currentUserId) { + int tempCount = user.unreadMessageCount ?? 0; + user.unreadMessageCount = tempCount + 1; + } } + sort(); } - sort(); } - List list = [ - {"userChatHistoryId": data.first.userChatHistoryId, "TargetUserId": temp.first.targetUserId, "isDelivered": true, "isSeen": isChatScreenActive ? true : false} + List list = [ + { + "userChatHistoryId": data.first.userChatHistoryId, + "TargetUserId": temp.first.targetUserId, + "isDelivered": true, + "isSeen": isChatScreenActive && data.first.currentUserId == receiverID ? true : false + } ]; updateUserChatHistoryOnMsg(list); invokeChatCounter(userId: AppState().chatDetails!.response!.id!); @@ -393,9 +403,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { void sort() { searchedChats!.sort( - (ChatUser a, ChatUser b) => b.unreadMessageCount!.compareTo( - a.unreadMessageCount!, - ), + (ChatUser a, ChatUser b) => b.unreadMessageCount!.compareTo(a.unreadMessageCount!), ); } @@ -533,28 +541,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } void sendChatMessage(BuildContext context, {required int targetUserId, required int userStatus, required String userEmail, required String targetUserName}) async { - dynamic contain = searchedChats!.where((ChatUser element) => element.id == targetUserId); - if (contain.isEmpty) { - List emails = []; - emails.add(await EmailImageEncryption().encrypt(val: userEmail)); - List chatImages = await ChatApiClient().getUsersImages(encryptedEmails: emails); - searchedChats!.add( - ChatUser( - id: targetUserId, - userName: targetUserName, - unreadMessageCount: 0, - email: userEmail, - isImageLoading: false, - image: chatImages.first.profilePicture ?? "", - isImageLoaded: true, - isTyping: false, - isFav: false, - userStatus: userStatus, - userLocalDownlaodedImage: await downloadImageLocal(chatImages.first.profilePicture, targetUserId.toString()), - ), - ); - notifyListeners(); - } if (!isFileSelected && !isMsgReply) { print("Normal Text Msg"); if (message.text == null || message.text.isEmpty) { @@ -614,6 +600,51 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { isImageLoaded: true, image: selectedFile.readAsBytesSync()); } + + if (searchedChats != null) { + dynamic contain = searchedChats!.where((ChatUser element) => element.id == targetUserId); + if (contain.isEmpty) { + List emails = []; + emails.add(await EmailImageEncryption().encrypt(val: userEmail)); + List chatImages = await ChatApiClient().getUsersImages(encryptedEmails: emails); + searchedChats!.add( + ChatUser( + id: targetUserId, + userName: targetUserName, + unreadMessageCount: 0, + email: userEmail, + isImageLoading: false, + image: chatImages.first.profilePicture ?? "", + isImageLoaded: true, + isTyping: false, + isFav: false, + userStatus: userStatus, + userLocalDownlaodedImage: await downloadImageLocal(chatImages.first.profilePicture, targetUserId.toString()), + ), + ); + notifyListeners(); + } + } else { + List emails = []; + emails.add(await EmailImageEncryption().encrypt(val: userEmail)); + List chatImages = await ChatApiClient().getUsersImages(encryptedEmails: emails); + searchedChats!.add( + ChatUser( + id: targetUserId, + userName: targetUserName, + unreadMessageCount: 0, + email: userEmail, + isImageLoading: false, + image: chatImages.first.profilePicture ?? "", + isImageLoaded: true, + isTyping: false, + isFav: false, + userStatus: userStatus, + userLocalDownlaodedImage: await downloadImageLocal(chatImages.first.profilePicture, targetUserId.toString()), + ), + ); + notifyListeners(); + } } void selectImageToUpload(BuildContext context) { @@ -718,7 +749,10 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { for (ChatUser user in searchedChats!) { if (user.id == favoriteChatUser.response!.targetUserId!) { user.isFav = favoriteChatUser.response!.isFav; - favUsersList.add(user); + dynamic contain = favUsersList!.where((ChatUser element) => element.id == favoriteChatUser.response!.targetUserId!); + if (contain.isEmpty) { + favUsersList.add(user); + } } } } @@ -746,6 +780,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { searchedChats = pChatHistory; search.clear(); isChatScreenActive = false; + receiverID = 0; paginationVal = 0; message.text = ''; isFileSelected = false; @@ -756,14 +791,47 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } void clearAll() { + print("----------------- Disposed ---------------------------"); searchedChats = pChatHistory; search.clear(); isChatScreenActive = false; + receiverID = 0; + paginationVal = 0; + message.text = ''; + isFileSelected = false; + repliedMsg = []; + sFileType = ""; + } + + void disposeData() { + search.clear(); + isChatScreenActive = false; + receiverID = 0; paginationVal = 0; message.text = ''; isFileSelected = false; repliedMsg = []; sFileType = ""; + deleteData(); + favUsersList.clear(); + searchedChats!.clear(); + pChatHistory!.clear(); + chatHubConnection.stop(); + AppState().chatDetails = null; + } + + void deleteData() { + List exists = [], unique = []; + exists.addAll(searchedChats!); + exists.addAll(favUsersList!); + Map profileMap = {}; + for (ChatUser item in exists) { + profileMap[item.email!] = item; + } + unique = profileMap.values.toList(); + for (ChatUser element in unique!) { + deleteFile(element.id.toString()); + } } void getUserImages() async { @@ -868,7 +936,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { void onNewChatConversion(List? params) { dynamic items = params!.toList(); - logger.d(items); chatUConvCounter = items[0]["singleChatCount"] ?? 0; notifyListeners(); } @@ -877,4 +944,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { await chatHubConnection.invoke("GetChatCounversationCount", args: [userId]); return ""; } + + void userTypingInvoke({required int currentUser, required int reciptUser}) async { + logger.d([reciptUser, currentUser]); + await chatHubConnection.invoke("UserTypingAsync", args: [reciptUser, currentUser]); + } } diff --git a/lib/ui/chat/chat_bubble.dart b/lib/ui/chat/chat_bubble.dart index c79c66b..8978ff1 100644 --- a/lib/ui/chat/chat_bubble.dart +++ b/lib/ui/chat/chat_bubble.dart @@ -101,21 +101,29 @@ class ChatBubble extends StatelessWidget { ], ), ), - ).paddingOnly(right: 5, bottom: 7), + ).paddingOnly(bottom: 7), if (fileTypeID == 12 || fileTypeID == 4 || fileTypeID == 3) - showImage(isReplyPreview: false, fileName: cItem.contant!, fileTypeDescription: cItem.fileTypeResponse!.fileTypeDescription).paddingOnly(right: 5).onPress(() { - showDialog( - context: context, - anchorPoint: screenOffset, - builder: (BuildContext context) => ChatImagePreviewScreen(imgTitle: cItem.contant!, img: cItem.image!), - ); - }) + ClipRRect( + borderRadius: BorderRadius.circular(5.0), + child: SizedBox( + height: 140, + width: 227, + child: showImage(isReplyPreview: false, fileName: cItem.contant!, fileTypeDescription: cItem.fileTypeResponse!.fileTypeDescription).onPress(() { + showDialog( + context: context, + anchorPoint: screenOffset, + builder: (BuildContext context) => ChatImagePreviewScreen(imgTitle: cItem.contant!, img: cItem.image!), + ); + }), + ), + ).paddingOnly(bottom: 4) else Row( children: [ if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8 || fileTypeID == 2) SvgPicture.asset(data.getType(fileTypeName ?? ""), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 0, right: 10), (cItem.contant ?? "").toText12().expanded, + if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8 || fileTypeID == 2) const Icon(Icons.remove_red_eye, size: 16) ], ), Align( @@ -132,12 +140,12 @@ class ChatBubble extends StatelessWidget { ), ), ], - ).paddingOnly(top: 11, left: 13, right: 7, bottom: 5).objectContainerView(disablePadding: true).paddingOnly(left: MediaQuery.of(context).size.width * 0.3); + ).paddingOnly(top: 11, left: 13, right: 13, bottom: 5).objectContainerView(disablePadding: true).paddingOnly(left: MediaQuery.of(context).size.width * 0.3); } Widget receiptUser(BuildContext context) { return Container( - padding: const EdgeInsets.only(top: 11, left: 13, right: 7, bottom: 5), + padding: const EdgeInsets.only(top: 11, left: 13, right: 13, bottom: 5), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), gradient: const LinearGradient( @@ -190,29 +198,36 @@ class ChatBubble extends StatelessWidget { ], ), ), - ).paddingOnly(right: 5, bottom: 7), + ).paddingOnly(bottom: 7), if (fileTypeID == 12 || fileTypeID == 4 || fileTypeID == 3) - showImage(isReplyPreview: false, fileName: cItem.contant ?? "", fileTypeDescription: cItem.fileTypeResponse!.fileTypeDescription ?? "image/jpg").paddingOnly(right: 5).onPress(() { - showDialog( - context: context, - anchorPoint: screenOffset, - builder: (BuildContext context) => ChatImagePreviewScreen(imgTitle: cItem.contant ?? "", img: cItem.image!), - ); - }) + ClipRRect( + borderRadius: BorderRadius.circular(5.0), + child: SizedBox( + height: 140, + width: 227, + child: showImage(isReplyPreview: false, fileName: cItem.contant ?? "", fileTypeDescription: cItem.fileTypeResponse!.fileTypeDescription ?? "image/jpg").onPress(() { + showDialog( + context: context, + anchorPoint: screenOffset, + builder: (BuildContext context) => ChatImagePreviewScreen(imgTitle: cItem.contant ?? "", img: cItem.image!), + ); + }), + ), + ).paddingOnly(bottom: 4) else Row( children: [ if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8 || fileTypeID == 2) - SvgPicture.asset(data.getType(fileTypeName ?? ""), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly( - left: 0, - right: 10, - ), + SvgPicture.asset(data.getType(fileTypeName ?? ""), height: 30, width: 22, alignment: Alignment.center, fit: BoxFit.cover).paddingOnly(left: 0, right: 10), (cItem.contant ?? "").toText12(color: Colors.white).expanded, + if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8 || fileTypeID == 2) const Icon(Icons.remove_red_eye, color: Colors.white, size: 16) ], ), Align( alignment: Alignment.centerRight, - child: dateTime.toText10(color: Colors.white.withOpacity(.71),), + child: dateTime.toText10( + color: Colors.white.withOpacity(.71), + ), ), ], ), @@ -220,12 +235,15 @@ class ChatBubble extends StatelessWidget { } Widget showImage({required bool isReplyPreview, required String fileName, required String fileTypeDescription}) { + if (isReplyPreview) {} + if (cItem.isImageLoaded! && cItem.image != null) { return Image.memory( cItem.image!, height: isReplyPreview ? 32 : 140, width: isReplyPreview ? 32 : 227, fit: BoxFit.cover, + alignment: Alignment.center, ); } else { return FutureBuilder( @@ -233,7 +251,7 @@ class ChatBubble extends StatelessWidget { builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.connectionState != ConnectionState.waiting) { if (snapshot.data == null) { - return SizedBox(); + return const SizedBox(); } else { cItem.image = snapshot.data; cItem.isImageLoaded = true; @@ -242,6 +260,7 @@ class ChatBubble extends StatelessWidget { height: isReplyPreview ? 32 : 140, width: isReplyPreview ? 32 : 227, fit: BoxFit.cover, + alignment: Alignment.center, ); } } else { diff --git a/lib/ui/chat/chat_detailed_screen.dart b/lib/ui/chat/chat_detailed_screen.dart index be685df..379fe2b 100644 --- a/lib/ui/chat/chat_detailed_screen.dart +++ b/lib/ui/chat/chat_detailed_screen.dart @@ -85,14 +85,14 @@ class _ChatDetailScreenState extends State { showTyping: true, chatUser: params!.chatUser, actions: [ - SvgPicture.asset("assets/icons/chat/call.svg", width: 21, height: 23).onPress(() { - // makeCall(callType: "AUDIO", con: hubConnection); - }), - 24.width, - SvgPicture.asset("assets/icons/chat/video_call.svg", width: 21, height: 18).onPress(() { - // makeCall(callType: "VIDEO", con: hubConnection); - }), - 21.width, + // SvgPicture.asset("assets/icons/chat/call.svg", width: 21, height: 23).onPress(() { + // // makeCall(callType: "AUDIO", con: hubConnection); + // }), + // 24.width, + // SvgPicture.asset("assets/icons/chat/video_call.svg", width: 21, height: 18).onPress(() { + // // makeCall(callType: "VIDEO", con: hubConnection); + // }), + // 21.width, ], ), body: SafeArea( @@ -233,6 +233,9 @@ class _ChatDetailScreenState extends State { ), ).paddingOnly(right: 21), ), + onChanged: (val) { + m.userTypingInvoke(currentUser: AppState().chatDetails!.response!.id!, reciptUser: params!.chatUser!.id!); + }, ), ], )); diff --git a/lib/ui/chat/chat_home.dart b/lib/ui/chat/chat_home.dart index 330242a..af243e5 100644 --- a/lib/ui/chat/chat_home.dart +++ b/lib/ui/chat/chat_home.dart @@ -47,6 +47,7 @@ class _ChatHomeState extends State { return; } if (data.searchedChats == null || data.searchedChats!.isEmpty) { + data.isLoading = true; data.getUserRecentChats(); } } diff --git a/lib/ui/chat/chat_home_screen.dart b/lib/ui/chat/chat_home_screen.dart index a9814ee..395556a 100644 --- a/lib/ui/chat/chat_home_screen.dart +++ b/lib/ui/chat/chat_home_screen.dart @@ -1,5 +1,3 @@ -import 'dart:convert'; -import 'package:animated_text_kit/animated_text_kit.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -139,11 +137,11 @@ class _ChatHomeScreenState extends State { children: [ (m.searchedChats![index].userName!.replaceFirst(".", " ").capitalizeFirstofEach ?? "").toText14(color: MyColors.darkTextColor).paddingOnly(left: 11, top: 13), m.searchedChats![index].isTyping! - ? AnimatedTextKit( - animatedTexts: [ - ScaleAnimatedText('Typing...', textStyle: const TextStyle(color: MyColors.textMixColor, fontSize: 10, letterSpacing: -0.4, fontStyle: FontStyle.normal)), - ], - ).paddingOnly(left: 11) + ? 'Typing...' + .toText10( + color: MyColors.textMixColor, + ) + .paddingOnly(left: 11.0) : const SizedBox() //(m.searchedChats![index].isTyping! ? "Typing ..." : "").toText10(color: MyColors.textMixColor).paddingOnly(left: 11, top: 0), ], diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index b1dac53..22768e6 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -200,7 +200,7 @@ class _DashboardScreenState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.goodMorning.tr().toText14(color: MyColors.grey77Color), + LocaleKeys.welcomeBack.tr().toText14(color: MyColors.grey77Color), (AppState().memberInformationList!.eMPLOYEENAME ?? "").toText24(isBold: true), 16.height, Row( diff --git a/lib/ui/landing/today_attendance_screen.dart b/lib/ui/landing/today_attendance_screen.dart index d23fa10..ea3ae24 100644 --- a/lib/ui/landing/today_attendance_screen.dart +++ b/lib/ui/landing/today_attendance_screen.dart @@ -41,8 +41,6 @@ class _TodayAttendanceScreenState extends State { bool isAvailable = await NfcManager.instance.isAvailable(); setState(() { AppState().privilegeListModel!.forEach((element) { - print(element.serviceName.toString() + " " + element.previlege.toString()); // Check availability - if (element.serviceName == "enableNFC") { if (isAvailable) if (element.previlege ?? false) isNfcEnabled = true; } else if (element.serviceName == "enableQR") { diff --git a/lib/ui/landing/widget/app_drawer.dart b/lib/ui/landing/widget/app_drawer.dart index 4160fde..4b4219d 100644 --- a/lib/ui/landing/widget/app_drawer.dart +++ b/lib/ui/landing/widget/app_drawer.dart @@ -11,6 +11,7 @@ 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/dashboard/drawer_menu_item_model.dart'; +import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/ui/dialogs/id/business_card_dialog.dart'; import 'package:mohem_flutter_app/ui/dialogs/id/employee_digital_id_dialog.dart'; @@ -28,6 +29,13 @@ class AppDrawer extends StatefulWidget { class _AppDrawerState extends State { List drawerMenuItemList = []; + late ChatProviderModel chatData; + + @override + void initState() { + super.initState(); + chatData = Provider.of(context, listen: false); + } @override Widget build(BuildContext context) { @@ -171,6 +179,7 @@ class _AppDrawerState extends State { 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/login/verify_last_login_screen.dart b/lib/ui/login/verify_last_login_screen.dart index 81d1ba2..cfa808a 100644 --- a/lib/ui/login/verify_last_login_screen.dart +++ b/lib/ui/login/verify_last_login_screen.dart @@ -289,7 +289,7 @@ class _VerifyLastLoginScreenState extends State { width: 38, color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null, ), - _title.toText16() + _title.toText16(height: 20/16) ], ), ), diff --git a/lib/ui/login/verify_login_screen.dart b/lib/ui/login/verify_login_screen.dart index b5eb7df..0ba486b 100644 --- a/lib/ui/login/verify_login_screen.dart +++ b/lib/ui/login/verify_login_screen.dart @@ -572,7 +572,7 @@ class _VerifyLoginScreenState extends State { width: 38, color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null, ), - _title.toText16() + _title.toText16(height: 20/16) ], ), ), @@ -636,9 +636,6 @@ class _VerifyLoginScreenState extends State { AppState().setPrivilegeListModel = genericResponseModel!.privilegeList ?? []; AppState().setMemberInformationListModel = genericResponseModel.memberInformationList?.first; MemberInformationListModel.saveToPrefs(genericResponseModel.memberInformationList ?? []); - genericResponseModel.privilegeList!.forEach((element) { - print(element.serviceName.toString() + " " + element.previlege.toString()); // Check availability - }); PrivilegeListModel.saveToPrefs(genericResponseModel.privilegeList ?? []); AppState().setMohemmWifiSSID = genericResponseModel.mohemmWifiSSID; AppState().setMohemmWifiPassword = genericResponseModel.mohemmWifiPassword; diff --git a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart index 2461e4b..228f1d6 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -110,9 +110,9 @@ class _DynamicInputScreenState extends State { String dESCFLEXCONTEXTCODE = ""; String descFlexConTextTitle = ""; - Future calGetValueSetValues(GetEITDFFStructureList structureList) async { + Future calGetValueSetValues(GetEITDFFStructureList structureList, {bool showLoading = true}) async { try { - Utils.showLoading(context); + if (showLoading) Utils.showLoading(context); for (int i = 0; i < (structureList.cHILDSEGMENTSVSSplited?.length ?? 0); i++) { List> values = []; String segmentId = structureList.cHILDSEGMENTSVSSplited![i]; @@ -140,18 +140,21 @@ class _DynamicInputScreenState extends State { // getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? []; //getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList(); } - await Future.delayed(const Duration(seconds: 1)); - Utils.hideLoading(context); + if (showLoading) { + await Future.delayed(const Duration(seconds: 1)); + Utils.hideLoading(context); + } + setState(() {}); } catch (ex) { - Utils.hideLoading(context); + if (showLoading) Utils.hideLoading(context); Utils.handleException(ex, context, null); } } - Future getDefaultValues(GetEITDFFStructureList structureList) async { + Future getDefaultValues(GetEITDFFStructureList structureList, {bool showLoading = true}) async { try { - Utils.showLoading(context); + if (showLoading) Utils.showLoading(context); for (int i = 0; i < (structureList.cHILDSEGMENTSDVSplited?.length ?? 0); i++) { String segmentId = structureList.cHILDSEGMENTSDVSplited![i]; GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId); @@ -176,8 +179,7 @@ class _DynamicInputScreenState extends State { GetEITDFFStructureList defaultValueCheck = getEitDffStructureList!.where((GetEITDFFStructureList element) => element.sEGMENTNAME == segmentId).toList().first; if (defaultValueCheck.cHILDSEGMENTSDVSplited!.isNotEmpty && defaultValueCheck.rEADONLY == 'Y') { - getDefaultValues(defaultValueCheck); - Utils.hideLoading(context); + await getDefaultValues(defaultValueCheck, showLoading: false); // GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId); // List> getSetList = getDefaultValuesIonicLogic(parent); @@ -185,19 +187,23 @@ class _DynamicInputScreenState extends State { // int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId); // getEitDffStructureList![index].eSERVICESDV = defaultValue; } else if (defaultValueCheck.cHILDSEGMENTSVSSplited!.isNotEmpty && defaultValueCheck.rEADONLY == 'Y') { - calGetValueSetValues(defaultValueCheck); - Utils.hideLoading(context); + await calGetValueSetValues(defaultValueCheck, showLoading: false); + // Utils.hideLoading(context); } } else if (values.isNotEmpty) { ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values); int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId); + getEitDffStructureList![index].eSERVICESDV = defaultValue; } } - await Future.delayed(const Duration(seconds: 1)); - Utils.hideLoading(context); + if (showLoading) { + await Future.delayed(const Duration(seconds: 1)); + Utils.hideLoading(context); + } + setState(() {}); } catch (ex) { - Utils.hideLoading(context); + if (showLoading) Utils.hideLoading(context); Utils.handleException(ex, context, null); } } @@ -331,7 +337,7 @@ class _DynamicInputScreenState extends State { idColName = val; if (getEitDffStructureList![j].fORMATTYPE == "X") { - idColName = Utils.formatDateNew(idColName!); + idColName = Utils.formatDateDefault(idColName!); // commenting to test // DateTime date = DateFormat('yyyy-MM-dd').parse(idColName!); // idColName = DateFormat('yyyy-MM-dd HH:mm:ss').format(date); diff --git a/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart index d1c21e1..68727e5 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_layout_grid/flutter_layout_grid.dart'; import 'package:mohem_flutter_app/api/my_attendance_api_client.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; @@ -22,7 +23,8 @@ class DynamicListViewParams { List? collectionNotificationList; final String selectedEmp; - DynamicListViewParams(this.title, this.dynamicId, {this.selectedEmp ='', this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = '', this.colsURL = '', this.isUpdate = false, this.collectionNotificationList}); + DynamicListViewParams(this.title, this.dynamicId, + {this.selectedEmp = '', this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = '', this.colsURL = '', this.isUpdate = false, this.collectionNotificationList}); } class DynamicListViewScreen extends StatefulWidget { @@ -37,6 +39,7 @@ class DynamicListViewScreen extends StatefulWidget { class _DynamicListViewScreenState extends State { List? getEITTransactionList; DynamicListViewParams? dynamicParams; + // String? empId; @override @@ -99,47 +102,19 @@ class _DynamicListViewScreenState extends State { : ListView.separated( physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, - itemBuilder: (cxt, int parentIndex) => getEITTransactionList![parentIndex].collectionTransaction!.isEmpty - ? const SizedBox() - : GridView( - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 1.0 / 0.75), - padding: const EdgeInsets.only(left: 12,right: 21,top: 12), - shrinkWrap: true, - primary: false, - physics: const ScrollPhysics(), - children: getEITWidgetsList(getEITTransactionList![parentIndex].collectionTransaction), - ).objectContainerView(), - // Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisSize: MainAxisSize.min, - // children: [ - // for (int t = 0; t < (getEITTransactionList![parentIndex].collectionTransaction ?? []).length; t++) - // if (getEITTransactionList![parentIndex].collectionTransaction![t].dISPLAYFLAG == "Y") - // // ItemDetailView(getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTPROMPT!, - // // getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTVALUEDSP ?? ""), - // // GridView( - // // gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2), - // // padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21, top: 12), - // // shrinkWrap: true, - // // primary: false, - // // physics: const ScrollPhysics(), - // // children: getEITWidgetsList(getEITTransactionList![parentIndex].collectionTransaction), - // // ) - // // ItemDetailViewCol(getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTPROMPT!, - // // getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTVALUEDSP ?? ""), - // - // // GridView( - // // gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2), - // // padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21, top: 12), - // // shrinkWrap: true, - // // primary: false, - // // physics: const ScrollPhysics(), - // // children: getEITWidgetsList(getEITTransactionList![parentIndex].collectionTransaction), - // // ) - // // ItemDetailView(getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTPROMPT!, - // // getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTVALUEDSP ?? ""), - // ], - // ).objectContainerView(), + itemBuilder: (cxt, int parentIndex) { + if (getEITTransactionList![parentIndex].collectionTransaction!.isEmpty) { + return const SizedBox(); + } + int count = getEITTransactionList![parentIndex].collectionTransaction!.length; + return LayoutGrid( + columnSizes: [1.fr, 1.fr], + rowSizes: [for (int i = 0; i < (count / 2).round(); i++) auto], + columnGap: 8, + rowGap: 12, + children: getEITWidgetsList(getEITTransactionList![parentIndex].collectionTransaction), + ).objectContainerView(); + }, separatorBuilder: (cxt, index) => 12.height, itemCount: getEITTransactionList!.length)), ], diff --git a/lib/ui/profile/basic_details.dart b/lib/ui/profile/basic_details.dart index c91adb5..42ecf1d 100644 --- a/lib/ui/profile/basic_details.dart +++ b/lib/ui/profile/basic_details.dart @@ -44,13 +44,12 @@ class _BasicDetailsState extends State { super.initState(); memberInformationList = AppState().memberInformationList!; List menuData = Provider.of(context, listen: false).getMenuEntriesList!; - for( int i=0;i e.requestType == 'BASIC_DETAILS').toList(); - if(filterList.isNotEmpty) { + if (filterList.isNotEmpty) { menuEntries = filterList.first; } diff --git a/lib/ui/profile/delete_family_member.dart b/lib/ui/profile/delete_family_member.dart index 73c44de..16052f8 100644 --- a/lib/ui/profile/delete_family_member.dart +++ b/lib/ui/profile/delete_family_member.dart @@ -37,7 +37,6 @@ class _DeleteFamilyMemberState extends State { //int? relationId; @override void initState() { - print(widget.relationId); super.initState(); } diff --git a/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart index a233839..77b2abd 100644 --- a/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart +++ b/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart @@ -294,7 +294,6 @@ class _DynamicInputScreenState extends State { countryCode, effectiveDate.isEmpty ? DateFormat('dd-MMM-yyy').format(DateTime.now()) : effectiveDate, ); - print(values); Utils.hideLoading(context); Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, diff --git a/lib/ui/screens/items_for_sale/fragments/items_for_sale.dart b/lib/ui/screens/items_for_sale/fragments/items_for_sale.dart index 50a89cc..ae715fe 100644 --- a/lib/ui/screens/items_for_sale/fragments/items_for_sale.dart +++ b/lib/ui/screens/items_for_sale/fragments/items_for_sale.dart @@ -39,7 +39,6 @@ class _ItemsForSaleFragmentState extends State { if (gridScrollController.position.atEdge) { bool isTop = gridScrollController.position.pixels == 0; if (!isTop && getItemsForSaleList.length == currentPageNo * 10) { - print('At the bottom'); currentPageNo++; getItemsForSale(currentPageNo, currentCategoryID); } diff --git a/lib/ui/screens/items_for_sale/fragments/my_posted_ads_fragment.dart b/lib/ui/screens/items_for_sale/fragments/my_posted_ads_fragment.dart index f477672..64b8bf9 100644 --- a/lib/ui/screens/items_for_sale/fragments/my_posted_ads_fragment.dart +++ b/lib/ui/screens/items_for_sale/fragments/my_posted_ads_fragment.dart @@ -193,7 +193,6 @@ class _MyPostedAdsFragmentState extends State { Utils.hideLoading(context); Utils.handleException(e, context, null); }); - print(response.statusCode); Utils.hideLoading(context); getAdsByEmployee(); } diff --git a/lib/ui/termination/end_employement.dart b/lib/ui/termination/end_employement.dart index 6fbfa61..73e8f79 100644 --- a/lib/ui/termination/end_employement.dart +++ b/lib/ui/termination/end_employement.dart @@ -255,7 +255,6 @@ class _EndEmploymentScreenState extends State { ], onSelected: (int popipIndex) async { termColObject.selectedObjectValue = termColObject.objectValuesList![popipIndex]; - print(termColObject.selectedObjectValue?.toJson()); setState(() {}); }); } diff --git a/lib/ui/work_list/itg_detail_screen.dart b/lib/ui/work_list/itg_detail_screen.dart index e123d22..05e542e 100644 --- a/lib/ui/work_list/itg_detail_screen.dart +++ b/lib/ui/work_list/itg_detail_screen.dart @@ -352,7 +352,6 @@ class _ItgDetailScreenState extends State { } void handleFabAction(AllowedActions action) { - print(action.toJson()); switch (action.action) { case "Delegate": showMyBottomSheet(context, @@ -461,7 +460,6 @@ class _ItgDetailScreenState extends State { } void performAction(String actionMode) { - print(actionMode); showDialog( context: context, builder: (cxt) => ITGCommentsDialog( @@ -535,7 +533,7 @@ class _ItgDetailScreenState extends State { Utils.hideLoading(context); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); // Navigator.pop(context, "delegate_reload"); - animationIndex=animationIndex+1; + animationIndex = animationIndex + 1; AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!); if (AppState().requestAllList!.isEmpty) { Navigator.pop(context, "delegate_reload"); diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index da1b60f..69fb7f3 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -215,11 +215,7 @@ class _WorkListScreenState extends State { Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, - appBar: AppBarWidget( - context, - title: LocaleKeys.workList.tr(), - showNotificationButton: true, - ), + appBar: AppBarWidget(context, title: LocaleKeys.workList.tr(), showWorkListSettingButton: true), body: SizedBox( width: double.infinity, height: double.infinity, @@ -284,31 +280,33 @@ class _WorkListScreenState extends State { physics: const BouncingScrollPhysics(), child: itgRequestTypeIndex != null ? Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 40, - child: ListView.separated( - itemBuilder: (context, index) { - RequestType type = itgFormsModel!.requestType![index]; - return Container( - padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8), - alignment: Alignment.center, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: itgRequestTypeIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor), - child: ("${type.requestTypeName}").toText12(color: itgRequestTypeIndex == index ? MyColors.white : MyColors.black), - ).onPress(() { - if (itgRequestTypeIndex != index) { - itgRequestTypeIndex = index; - setState(() {}); - } - }); - }, - separatorBuilder: (context, index) => 8.width, - shrinkWrap: true, - itemCount: itgFormsModel?.requestType?.length ?? 0, - scrollDirection: Axis.horizontal, - padding: const EdgeInsets.only(left: 21, right: 21), - ), - ).paddingOnly(top: 16, bottom: 16), + // todo this is commented for temporary purpose, have issue when selecting any itg category and click any item showing wrong details + // SizedBox( + // height: 40, + // child: ListView.separated( + // itemBuilder: (context, index) { + // RequestType type = itgFormsModel!.requestType![index]; + // return Container( + // padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8), + // alignment: Alignment.center, + // decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: itgRequestTypeIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor), + // child: ("${type.requestTypeName}").toText12(color: itgRequestTypeIndex == index ? MyColors.white : MyColors.black), + // ).onPress(() { + // if (itgRequestTypeIndex != index) { + // itgRequestTypeIndex = index; + // setState(() {}); + // } + // }); + // }, + // separatorBuilder: (context, index) => 8.width, + // shrinkWrap: true, + // itemCount: itgFormsModel?.requestType?.length ?? 0, + // scrollDirection: Axis.horizontal, + // padding: const EdgeInsets.only(left: 21, right: 21), + // ), + // ).paddingOnly(top: 16, bottom: 16), ListView.separated( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), @@ -429,7 +427,7 @@ class _WorkListScreenState extends State { void openBottomSheet(BuildContext context) { showMyBottomSheet( context, - callBackFunc: (){}, + callBackFunc: () {}, child: WorkListAdvanceSearch((selectedViewID, selectedItemTypeID, searchByInput, searchByDate) async { itgRequestTypeIndex = null; pNotificationType = selectedViewID; diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index b5129a5..1f62d4e 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/worklist/GetRFCEmployeeList.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'; import 'package:mohem_flutter_app/models/worklist/hr/get_contact_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_phones_notification_body_list_model.dart'; @@ -78,6 +79,8 @@ class _WorkListDetailScreenState extends State { List? getBasicDetNtfBodyList = []; List? getAbsenceCollectionNotificationBodyList = []; GetContactNotificationBodyList? getContactNotificationBodyList; + List? getAddressNotificationBodyList = []; + GenericResponseModel? getBasicNTFBody; GenericResponseModel? getICBody; @@ -118,6 +121,7 @@ class _WorkListDetailScreenState extends State { getBasicDetNtfBodyList!.clear(); getAbsenceCollectionNotificationBodyList!.clear(); getContactNotificationBodyList = null; + getAddressNotificationBodyList!.clear(); if (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") { getUserInformation(); @@ -139,6 +143,8 @@ class _WorkListDetailScreenState extends State { getAbsenceNotificationBody(); } else if (workListData!.rEQUESTTYPE == "CONTACT") { getContactNotificationBody(); + } else if (workListData!.rEQUESTTYPE == "ADDRESS") { + getAddressNotificationBody(); } // getBasicNTFBody = await WorkListApiClient().getBasicDetNTFBody(workListData!.nOTIFICATIONID!, -999); // getAbsenceCollectionNotifications = await WorkListApiClient().getAbsenceNotificationBody(workListData!.nOTIFICATIONID!, -999); @@ -271,6 +277,7 @@ class _WorkListDetailScreenState extends State { getEitCollectionNotificationBodyList: getEitCollectionNotificationBodyList, getPhonesNotificationBodyList: getPhonesNotificationBodyList, getBasicDetNtfBodyList: getBasicDetNtfBodyList, + getAddressNotificationBodyList: getAddressNotificationBodyList, getAbsenceCollectionNotificationBodyList: getAbsenceCollectionNotificationBodyList, getContactNotificationBodyList: getContactNotificationBodyList, getPrNotificationBodyList: getPrNotificationBody, @@ -429,6 +436,12 @@ class _WorkListDetailScreenState extends State { case "DELEGATE": returnActionImage = "assets/images/delegate.svg"; break; + case "APPROVE": + returnActionImage = "assets/images/worklist/approve.svg"; + break; + case "REJECT": + returnActionImage = "assets/images/worklist/reject.svg"; + break; case "REQUEST_INFO": returnActionImage = "assets/images/request_info.svg"; break; @@ -841,6 +854,23 @@ class _WorkListDetailScreenState extends State { } } + void getAddressNotificationBody() async { + try { + if (apiCallCount == 0) Utils.showLoading(context); + apiCallCount++; + getAddressNotificationBodyList = await WorkListApiClient().getAddressNotificationBodyList(workListData!.nOTIFICATIONID); + apiCallCount--; + if (apiCallCount == 0) { + Utils.hideLoading(context); + setState(() {}); + } + } catch (ex) { + apiCallCount--; + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + void getStampNotificationBody() 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 7cf8aa9..d2c64f3 100644 --- a/lib/ui/work_list/worklist_fragments/info_fragments.dart +++ b/lib/ui/work_list/worklist_fragments/info_fragments.dart @@ -13,6 +13,7 @@ import 'package:mohem_flutter_app/models/get_pr_notification_body_list_model.dar 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/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'; import 'package:mohem_flutter_app/models/worklist/hr/get_contact_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_phones_notification_body_list_model.dart'; @@ -31,6 +32,7 @@ class InfoFragment extends StatelessWidget { List? getAbsenceCollectionNotificationBodyList; GetContactNotificationBodyList? getContactNotificationBodyList; GetPrNotificationBodyList? getPrNotificationBodyList; + List? getAddressNotificationBodyList = []; InfoFragment( {this.workListData, @@ -43,7 +45,8 @@ class InfoFragment extends StatelessWidget { this.getBasicDetNtfBodyList, this.getAbsenceCollectionNotificationBodyList, this.getContactNotificationBodyList, - this.getPrNotificationBodyList}); + this.getPrNotificationBodyList, + this.getAddressNotificationBodyList}); double itemHeight = 0; double itemWidth = 0; @@ -89,6 +92,7 @@ class InfoFragment extends StatelessWidget { if (getBasicDetNtfBodyList?.isNotEmpty ?? false) getBasicDetNtfBodyListWidget(getBasicDetNtfBodyList ?? []).objectContainerView(title: "Basic Information"), if (getAbsenceCollectionNotificationBodyList?.isNotEmpty ?? false) getAbsenceCollectionNotificationBodyListWidget(getAbsenceCollectionNotificationBodyList ?? []), if (getContactNotificationBodyList != null) getContactNotificationBodyListWidget(getContactNotificationBodyList ?? GetContactNotificationBodyList()).objectContainerView(), + if (getAddressNotificationBodyList?.isNotEmpty ?? false) getAddressNotificationBodyListWidget(getAddressNotificationBodyList!), ]; return Container( width: double.infinity, @@ -160,7 +164,7 @@ class InfoFragment extends StatelessWidget { ), ItemDetailGrid( ItemDetailViewCol(LocaleKeys.otherCharges.tr(), poHeaderList[index].oTHERCHARGES?.toString() ?? ""), - ItemDetailViewCol(LocaleKeys.totalPOAmountWithVAT.tr(), poHeaderList[index].qUOTATIONDATE ?? ""), + ItemDetailViewCol(LocaleKeys.totalPOAmountWithVAT.tr(), poHeaderList[index].tOTPOAMT.toString() ?? ""), ), ItemDetailGrid( ItemDetailViewCol(LocaleKeys.totalPOAmountInWords.tr(), poHeaderList[index].tOTPOAMTWORD ?? ""), @@ -465,6 +469,36 @@ class InfoFragment extends StatelessWidget { ); } + Widget getAddressNotificationBodyListWidget(List getAddressNotificationBodyList) { + bool isOdd = false; + try { + if (getAddressNotificationBodyList.length % 2 != 0) { + isOdd = true; + getAddressNotificationBodyList.add(GetAddressNotificationBodyList(sEGMENTPROMPT: "--", sEGMENTVALUEDSP: "--")); + } + } catch (e) {} + + return GridView.builder( + itemCount: getAddressNotificationBodyList!.length, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (context, index) => ItemDetailViewGridItem( + index, + getAddressNotificationBodyList[index].sEGMENTPROMPT, + getAddressNotificationBodyList[index].sEGMENTVALUEDSP, + isNeedToShowEmptyDivider: (getAddressNotificationBodyList.length == index + 1) + ? isOdd + ? true + : false + : false, + ), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + childAspectRatio: (itemWidth / itemHeight), + ), + ).objectContainerView(); + } + List getPRHeaderValues() { List pRHeaders = []; getPrNotificationBodyList!.pRHeader!.forEach((element) { @@ -478,7 +512,7 @@ class InfoFragment extends StatelessWidget { try { if (data.contactNotificationBody!.length % 2 != 0) { isOdd = true; - data.contactNotificationBody!.add(new ContactNotificationBody()); + data.contactNotificationBody!.add(ContactNotificationBody(segmentPrompt: "--", segmentValueDsp: "--")); } } catch (e) {} diff --git a/lib/ui/work_list/worklist_fragments/request_fragment.dart b/lib/ui/work_list/worklist_fragments/request_fragment.dart index b86bb1a..a13f91f 100644 --- a/lib/ui/work_list/worklist_fragments/request_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/request_fragment.dart @@ -58,10 +58,10 @@ class RequestFragment extends StatelessWidget { children: [ ItemDetailGrid( ItemDetailViewCol(LocaleKeys.code.tr(), poLinesList[index].iTEMCODE ?? ""), - ItemDetailViewCol(LocaleKeys.mfg.tr(), poLinesList[index].uOM ?? ""), + ItemDetailViewCol(LocaleKeys.mfg.tr(), poLinesList[index].mFG ?? ""), ), ItemDetailGrid( - ItemDetailViewCol(LocaleKeys.lineType.tr(), poLinesList[index].qUANTITY?.toString() ?? ""), + ItemDetailViewCol(LocaleKeys.lineType.tr(), poLinesList[index].lINETYPE?.toString() ?? ""), ItemDetailViewCol(LocaleKeys.unit.tr(), poLinesList[index].uOM ?? ""), ), ItemDetailGrid( @@ -78,10 +78,10 @@ class RequestFragment extends StatelessWidget { ), ItemDetailGrid( ItemDetailViewCol(LocaleKeys.deliverToLocation.tr(), poLinesList[index].dELIVERTOLOCATION ?? ""), - ItemDetailViewCol(LocaleKeys.requisitionNumber.tr(), poLinesList[index].rEQUESTOR ?? ""), + ItemDetailViewCol(LocaleKeys.requisitionNumber.tr(), poLinesList[index].pRNUM ?? ""), ), ItemDetailGrid( - ItemDetailViewCol(LocaleKeys.requester.tr(), poLinesList[index].pRNUM ?? ""), + ItemDetailViewCol(LocaleKeys.requester.tr(), poLinesList[index].rEQUESTOR ?? ""), Container(), ), 12.height, diff --git a/lib/widgets/app_bar_widget.dart b/lib/widgets/app_bar_widget.dart index 8bca3f3..1096f24 100644 --- a/lib/widgets/app_bar_widget.dart +++ b/lib/widgets/app_bar_widget.dart @@ -12,7 +12,7 @@ import 'package:provider/provider.dart'; AppBar AppBarWidget(BuildContext context, {required String title, bool showHomeButton = true, - bool showNotificationButton = false, + bool showWorkListSettingButton = false, bool showMemberButton = false, List? actions, void Function()? onHomeTapped, @@ -43,12 +43,12 @@ AppBar AppBarWidget(BuildContext context, }, icon: const Icon(Icons.home, color: MyColors.darkIconColor), ), - if (showNotificationButton) + if (showWorkListSettingButton) IconButton( onPressed: () { Navigator.pushNamed(context, AppRoutes.worklistSettings); }, - icon: const Icon(Icons.notifications, color: MyColors.textMixColor), + icon: const Icon(Icons.settings_rounded, color: MyColors.darkIconColor), ), if (showMemberButton) IconButton( diff --git a/lib/widgets/chat_app_bar_widge.dart b/lib/widgets/chat_app_bar_widge.dart index 0feac6c..a67ae7d 100644 --- a/lib/widgets/chat_app_bar_widge.dart +++ b/lib/widgets/chat_app_bar_widge.dart @@ -1,4 +1,3 @@ -import 'package:animated_text_kit/animated_text_kit.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; @@ -51,12 +50,7 @@ AppBar ChatAppBarWidget(BuildContext context, Consumer( builder: (BuildContext cxt, ChatProviderModel data, Widget? child) { if (chatUser!.isTyping!) { - // return ("Typing ...").toText10(color: MyColors.textMixColor); - return AnimatedTextKit( - animatedTexts: [ - ScaleAnimatedText('Typing...', textStyle: const TextStyle(color: MyColors.textMixColor, fontSize: 10, letterSpacing: -0.4, fontStyle: FontStyle.normal)), - ], - ); + return ("Typing ...").toText10(color: MyColors.textMixColor); } else { return const SizedBox(); } diff --git a/lib/widgets/dynamic_forms/dynamic_textfield_widget.dart b/lib/widgets/dynamic_forms/dynamic_textfield_widget.dart index 299ef7a..ec4146b 100644 --- a/lib/widgets/dynamic_forms/dynamic_textfield_widget.dart +++ b/lib/widgets/dynamic_forms/dynamic_textfield_widget.dart @@ -68,11 +68,7 @@ class DynamicTextFieldWidget extends StatelessWidget { enabled: isEnable, scrollPadding: EdgeInsets.zero, readOnly: isReadOnly, - keyboardType: (isInputTypeNum) - ? isInputTypeNumSigned - ? const TextInputType.numberWithOptions(signed: true) - : TextInputType.number - : TextInputType.text, + keyboardType: (isInputTypeNum) ? (isInputTypeNumSigned ? const TextInputType.numberWithOptions(signed: true, decimal: true) : TextInputType.numberWithOptions(signed: true, decimal: true)) : TextInputType.text, textInputAction: TextInputAction.done, //controller: controller, maxLines: lines, diff --git a/lib/widgets/item_detail_view_widget.dart b/lib/widgets/item_detail_view_widget.dart index ccdedea..68b245a 100644 --- a/lib/widgets/item_detail_view_widget.dart +++ b/lib/widgets/item_detail_view_widget.dart @@ -36,10 +36,11 @@ class ItemDetailViewCol extends StatelessWidget { Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ "$title:".toText12(isBold: true, color: const Color(0xff2BB8A6), maxLine: 2), 4.width, - (value.isEmpty ? "--" : value).toText12(color: MyColors.normalTextColor, maxLine: 2), + (value.isEmpty ? "--" : value).toText12(color: MyColors.normalTextColor, maxLine: 5), ], ); } diff --git a/lib/widgets/location/Location.dart b/lib/widgets/location/Location.dart index 0ddca1c..d407c1c 100644 --- a/lib/widgets/location/Location.dart +++ b/lib/widgets/location/Location.dart @@ -46,12 +46,12 @@ class Location { }); } - static void getCurrentLocation(Function(LatLng?) callback, BuildContext context) { + static void getCurrentLocation(Function(LatLng?, bool isMocked) callback, BuildContext context) { void done(Position position) { //AppStorage.sp.saveLocation(position); - + bool isMocked = position.isMocked; LatLng? myCurrentLocation = LatLng(position.latitude, position.longitude); - callback(myCurrentLocation); + callback(myCurrentLocation, isMocked); } AppPermissions.location((granted) { diff --git a/lib/widgets/mark_attendance_widget.dart b/lib/widgets/mark_attendance_widget.dart index a6b6cfc..cbf70ad 100644 --- a/lib/widgets/mark_attendance_widget.dart +++ b/lib/widgets/mark_attendance_widget.dart @@ -48,8 +48,6 @@ class _MarkAttendanceWidgetState extends State { bool isAvailable = await NfcManager.instance.isAvailable(); setState(() { AppState().privilegeListModel!.forEach((element) { - print(element.serviceName.toString() + " " + element.previlege.toString()); // Check availability - if (element.serviceName == "enableNFC") { if (isAvailable) if (element.previlege ?? false) isNfcEnabled = true; } else if (element.serviceName == "enableQR") { @@ -76,7 +74,6 @@ class _MarkAttendanceWidgetState extends State { @override Widget build(BuildContext context) { - print(MediaQuery.of(context).size.width); return Container( padding: EdgeInsets.only(left: 21, right: 21, bottom: 21, top: widget.topPadding), decoration: const BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), @@ -97,8 +94,12 @@ class _MarkAttendanceWidgetState extends State { // if (isNfcEnabled) attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () { if (isNfcLocationEnabled) { - Location.getCurrentLocation((LatLng? latlng) { - performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + Location.getCurrentLocation((LatLng? latlng, bool isMocked) { + if (isMocked) { + markFakeAttendance("NFC", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? ""); + } else { + performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + } }, context); } else { performNfcAttendance(widget.model); @@ -107,8 +108,12 @@ class _MarkAttendanceWidgetState extends State { if (isWifiEnabled) attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, () { if (isWifiLocationEnabled) { - Location.getCurrentLocation((LatLng? latlng) { - performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + Location.getCurrentLocation((LatLng? latlng, bool isMocked) { + if (isMocked) { + markFakeAttendance("WIFI", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? ""); + } else { + performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + } }, context); } else { performWifiAttendance(widget.model); @@ -118,8 +123,12 @@ class _MarkAttendanceWidgetState extends State { if (isQrEnabled) attendanceMethod("QR", "assets/images/ic_qr.svg", isQrEnabled, () async { if (isQrLocationEnabled) { - Location.getCurrentLocation((LatLng? latlng) { - performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + Location.getCurrentLocation((LatLng? latlng, bool isMocked) { + if (isMocked) { + markFakeAttendance("QR", latlng?.latitude.toString() ?? "", latlng?.longitude.toString() ?? ""); + } else { + performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + } }, context); } else { performQrCodeAttendance(widget.model); @@ -134,18 +143,12 @@ class _MarkAttendanceWidgetState extends State { } Future performNfcAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { - if (isNfcLocationEnabled) { - print("nfc location enabled"); - } else { - print("nfc not location enabled"); - } - if (Platform.isIOS) { Utils.readNFc(onRead: (String nfcId) async { Utils.showLoading(context); try { GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId, isGpsRequired: isNfcLocationEnabled, lat: lat, long: lng); - if(g?.messageStatus != 1) { + if (g?.messageStatus != 1) { Utils.hideLoading(context); showDialog( context: context, @@ -166,7 +169,6 @@ class _MarkAttendanceWidgetState extends State { child: SuccessDialog(widget.isFromDashboard), ); } - } catch (ex) { print(ex); Utils.hideLoading(context); @@ -177,11 +179,10 @@ class _MarkAttendanceWidgetState extends State { }); } else { showNfcReader(context, onNcfScan: (String? nfcId) async { - print(nfcId); Utils.showLoading(context); try { GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId ?? "", isGpsRequired: isNfcLocationEnabled, lat: lat, long: lng); - if(g?.messageStatus != 1) { + if (g?.messageStatus != 1) { Utils.hideLoading(context); showDialog( context: context, @@ -214,12 +215,6 @@ class _MarkAttendanceWidgetState extends State { } Future performWifiAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { - if (isWifiLocationEnabled) { - print("wifi location enabled"); - } else { - print("wifi not location enabled"); - } - Utils.showLoading(context); bool isConnected = await WiFiForIoTPlugin.connect(AppState().getMohemmWifiSSID ?? "", password: AppState().getMohemmWifiPassword ?? "", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false); @@ -271,7 +266,6 @@ class _MarkAttendanceWidgetState extends State { ), ); if (qrCodeValue != null) { - print("qrCode: " + qrCodeValue); Utils.showLoading(context); try { GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 1, isGpsRequired: isQrLocationEnabled, lat: lat, long: lng, QRValue: qrCodeValue); @@ -293,6 +287,21 @@ class _MarkAttendanceWidgetState extends State { } } + void markFakeAttendance(String sourceName, String lat, String long) async { + Utils.showLoading(context); + try { + await DashboardApiClient().markFakeLocation(sourceName: sourceName, lat: lat, long: long); + Utils.hideLoading(context); + Utils.confirmDialog(context, LocaleKeys.fakeLocation.tr()); + } catch (ex) { + print(ex); + Utils.hideLoading(context); + Utils.handleException(ex, context, (msg) { + Utils.confirmDialog(context, msg); + }); + } + } + Widget attendanceMethod(String title, String image, bool isEnabled, VoidCallback onPress) => Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), diff --git a/lib/widgets/nfc/nfc_reader_sheet.dart b/lib/widgets/nfc/nfc_reader_sheet.dart index 4ac055b..b7b97a7 100644 --- a/lib/widgets/nfc/nfc_reader_sheet.dart +++ b/lib/widgets/nfc/nfc_reader_sheet.dart @@ -41,7 +41,6 @@ class _NfcLayoutState extends State { super.initState(); NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async { - print(tag.data); var f; if (Platform.isAndroid) { f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22); diff --git a/pubspec.yaml b/pubspec.yaml index 2e3c4c2..baa5e9f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -68,7 +68,7 @@ dependencies: month_picker_dialog_2: 0.5.5 open_file: ^3.2.1 wifi_iot: ^0.3.16 - flutter_html: ^2.2.1 + flutter_html: ^3.0.0-alpha.6 # flutter_barcode_scanner: ^2.0.0 qr_code_scanner: ^1.0.0 qr_flutter: ^4.0.0 @@ -92,7 +92,7 @@ dependencies: swipe_to: ^1.0.2 flutter_webrtc: ^0.9.16 camera: ^0.10.0+4 - animated_text_kit: ^4.2.2 +# animated_text_kit: ^4.2.2 #Encryption flutter_des: ^2.1.0 @@ -100,6 +100,7 @@ dependencies: video_player: ^2.4.7 just_audio: ^0.9.30 safe_device: ^1.1.2 + flutter_layout_grid: ^2.0.1 dev_dependencies: flutter_test: