diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index c4d6d65..d51e724 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -424,6 +424,9 @@ "typeCurrentPasswordBelow": "اكتب كلمة المرور الحاليه", "currentPassword": "كلمة المرور الحاليه", "concurrentReports": "التقارير المتزامنه", + "EnterNewAddressMoved" : "أدخل عنوان جديد إذا كنت قد انتقلت", + "CorrectAddress": "تصحيح أو تعديل هذا العنوان", + "SelectChangeWantToMake": " حدد نوع التغيير الذي تريد القيام به.", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 48a1db5..97e8c5c 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -424,6 +424,9 @@ "typeCurrentPasswordBelow": "Type Your Current password below", "currentPassword": "Current password", "concurrentReports": "Concurrent Reports", + "EnterNewAddressMoved" : "Enter a new address if you have moved", + "CorrectAddress": "Correct or amend this address", + "SelectChangeWantToMake": "Select the type of change you want to make", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/api/dashboard_api_client.dart b/lib/api/dashboard_api_client.dart index e30af91..3eab65b 100644 --- a/lib/api/dashboard_api_client.dart +++ b/lib/api/dashboard_api_client.dart @@ -65,10 +65,13 @@ class DashboardApiClient { }, url, postParams); } - Future> getAccrualBalances(String effectiveDate) async { + Future> getAccrualBalances(String effectiveDate, {String? empID}) async { String url = "${ApiConsts.erpRest}GET_ACCRUAL_BALANCES"; Map postParams = {"P_EFFECTIVE_DATE": effectiveDate}; postParams.addAll(AppState().postParamsJson); + if (empID!.isNotEmpty) { + postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; + } return await ApiClient().postJsonForObject((json) { GenericResponseModel responseData = GenericResponseModel.fromJson(json); return responseData.getAccrualBalancesList ?? []; diff --git a/lib/api/leave_balance_api_client.dart b/lib/api/leave_balance_api_client.dart index cd577ba..f9c5e21 100644 --- a/lib/api/leave_balance_api_client.dart +++ b/lib/api/leave_balance_api_client.dart @@ -17,27 +17,33 @@ class LeaveBalanceApiClient { factory LeaveBalanceApiClient() => _instance; - Future> getAbsenceTransactions(int pSelectedResopID) async { + Future> getAbsenceTransactions(int pSelectedResopID, {String? empID}) async { String url = "${ApiConsts.erpRest}GET_ABSENCE_TRANSACTIONS"; Map postParams = {"P_PAGE_LIMIT": 50, "P_PAGE_NUM": 1, "P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": pSelectedResopID}; postParams.addAll(AppState().postParamsJson); + if (empID!.isNotEmpty) { + postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; + } return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); return responseData.getAbsenceTransactionList ?? []; }, url, postParams); } - Future> getAbsenceAttendanceTypes() async { + Future> getAbsenceAttendanceTypes({String? empID}) async { String url = "${ApiConsts.erpRest}GET_ABSENCE_ATTENDANCE_TYPES"; Map postParams = {}; postParams.addAll(AppState().postParamsJson); + if (empID!.isNotEmpty) { + postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; + } return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); return responseData.getAbsenceAttendanceTypesList ?? []; }, url, postParams); } - Future calculateAbsenceDuration(int pAbsenceAttendanceTypeID, String pDateStart, String pDateEnd, int pSelectedResopID) async { + Future calculateAbsenceDuration(int pAbsenceAttendanceTypeID, String pDateStart, String pDateEnd, int pSelectedResopID, {String? empID}) async { String url = "${ApiConsts.erpRest}CALCULATE_ABSENCE_DURATION"; Map postParams = { "P_ABSENCE_ATTENDANCE_TYPE_ID": pAbsenceAttendanceTypeID, @@ -49,16 +55,22 @@ class LeaveBalanceApiClient { "P_TIME_START": null, }; postParams.addAll(AppState().postParamsJson); + if (empID!.isNotEmpty) { + postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; + } return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); return responseData.calculateAbsenceDuration!; }, url, postParams); } - Future> getAbsenceDffStructure(String pDescFlexContextCode, String pFunctionName, int pSelectedResopID) async { + Future> getAbsenceDffStructure(String pDescFlexContextCode, String pFunctionName, int pSelectedResopID, {String? empID}) async { String url = "${ApiConsts.erpRest}GET_ABSENCE_DFF_STRUCTURE"; Map postParams = {"P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode, "P_FUNCTION_NAME": pFunctionName, "P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": pSelectedResopID}; postParams.addAll(AppState().postParamsJson); + if (empID!.isNotEmpty) { + postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; + } return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); return responseData.getAbsenceDffStructureList ?? []; @@ -67,7 +79,7 @@ class LeaveBalanceApiClient { Future validateAbsenceTransaction( String pDescFlexContextCode, String pFunctionName, int pAbsenceAttendanceTypeID, String pReplacementUserName, String pDateStart, String pDateEnd, int pSelectedResopID, Map data, - {String comments = ""}) async { + {String comments = "", String? empID}) async { String url = "${ApiConsts.erpRest}VALIDATE_ABSENCE_TRANSACTION"; Map postParams = { "P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode, @@ -86,6 +98,9 @@ class LeaveBalanceApiClient { }; postParams.addAll(data); postParams.addAll(AppState().postParamsJson); + if (empID!.isNotEmpty) { + postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; + } return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); return responseData; @@ -94,7 +109,7 @@ class LeaveBalanceApiClient { Future submitAbsenceTransaction( String pDescFlexContextCode, String pFunctionName, int pAbsenceAttendanceTypeID, String pReplacementUserName, String pDateStart, String pDateEnd, int pSelectedResopID, Map data, - {String comments = ""}) async { + {String comments = "", String? empID}) async { String url = "${ApiConsts.erpRest}SUBMIT_ABSENCE_TRANSACTION"; Map postParams = { "P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode, @@ -113,6 +128,9 @@ class LeaveBalanceApiClient { }; postParams.addAll(data); postParams.addAll(AppState().postParamsJson); + if (empID!.isNotEmpty) { + postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; + } return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); return responseData.sumbitAbsenceTransactionList!; @@ -129,7 +147,7 @@ class LeaveBalanceApiClient { }, url, postParams); } - Future startAbsenceApprovalProcess(int pTransactionID, String comments, int pSelectedResopID) async { + Future startAbsenceApprovalProcess(int pTransactionID, String comments, int pSelectedResopID,{String? empID}) async { String url = "${ApiConsts.erpRest}START_ABSENCE_APPROVAL_PROCESS"; Map postParams = { "P_TRANSACTION_ID": pTransactionID, @@ -138,6 +156,9 @@ class LeaveBalanceApiClient { "P_MENU_TYPE": "E", }; postParams.addAll(AppState().postParamsJson); + if (empID!.isNotEmpty) { + postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; + } return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); return responseData.startAbsenceApprovalProccess!; diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index a54ff37..95f1d94 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -440,6 +440,9 @@ class CodegenLoader extends AssetLoader{ "typeCurrentPasswordBelow": "اكتب كلمة المرور الحاليه", "currentPassword": "كلمة المرور الحاليه", "concurrentReports": "التقارير المتزامنه", + "EnterNewAddressMoved": "أدخل عنوان جديد إذا كنت قد انتقلت", + "CorrectAddress": "تصحيح أو تعديل هذا العنوان", + "SelectChangeWantToMake": " حدد نوع التغيير الذي تريد القيام به.", "profile": { "reset_password": { "label": "Reset Password", @@ -516,7 +519,10 @@ class CodegenLoader extends AssetLoader{ "codeExpire": "انتهت صلاحية رمز التحقق", "typeheretoreply": "اكتب هنا للرد", "favorite": "مفضلتي", - "searchfromchat": "البحث من الدردشة" + "searchfromchat": "البحث من الدردشة", + "yourAnswerCorrect": "إجابتك صحيحة", + "youMissedTheQuestion": "فاتك !! أنت خارج اللعبة. لكن يمكنك المتابعة.", + "wrongAnswer": "إجابة خاطئة! أنت خارج اللعبة. لكن يمكنك المتابعة." }; static const Map en_US = { "mohemm": "Mohemm", @@ -944,6 +950,9 @@ static const Map en_US = { "typeCurrentPasswordBelow": "Type Your Current password below", "currentPassword": "Current password", "concurrentReports": "Concurrent Reports", + "EnterNewAddressMoved": "Enter a new address if you have moved", + "CorrectAddress": "Correct or amend this address", + "SelectChangeWantToMake": "Select the type of change you want to make", "profile": { "reset_password": { "label": "Reset Password", @@ -1020,7 +1029,10 @@ static const Map en_US = { "allQuestionsCorrect": "You have answered all questions correct", "typeheretoreply": "Type here to reply", "favorite": "My Favorites", - "searchfromchat": "Search from chat" + "searchfromchat": "Search from chat", + "yourAnswerCorrect": "Your answer is correct", + "youMissedTheQuestion": "You Missed !! You are out of the game. But you can follow up.", + "wrongAnswer": "Wrong Answer! You are out of the game. But you can follow up." }; 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 1d28232..c862385 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -425,6 +425,9 @@ abstract class LocaleKeys { static const typeCurrentPasswordBelow = 'typeCurrentPasswordBelow'; static const currentPassword = 'currentPassword'; static const concurrentReports = 'concurrentReports'; + static const EnterNewAddressMoved = 'EnterNewAddressMoved'; + static const CorrectAddress = 'CorrectAddress'; + static const SelectChangeWantToMake = 'SelectChangeWantToMake'; static const profile_reset_password_label = 'profile.reset_password.label'; static const profile_reset_password_username = 'profile.reset_password.username'; static const profile_reset_password_password = 'profile.reset_password.password'; diff --git a/lib/ui/leave_balance/add_leave_balance_screen.dart b/lib/ui/leave_balance/add_leave_balance_screen.dart index d1b7d77..4df7233 100644 --- a/lib/ui/leave_balance/add_leave_balance_screen.dart +++ b/lib/ui/leave_balance/add_leave_balance_screen.dart @@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/leave_balance_api_client.dart'; +import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/date_uitl.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/config/routes.dart'; @@ -24,7 +25,8 @@ import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; class AddLeaveBalanceScreen extends StatefulWidget { - AddLeaveBalanceScreen({Key? key}) : super(key: key); + final String selectedEmp; + AddLeaveBalanceScreen({this.selectedEmp = '', Key? key}) : super(key: key); @override _AddLeaveBalanceScreenState createState() { @@ -42,19 +44,21 @@ class _AddLeaveBalanceScreenState extends State { int? totalDays; String comment = ""; ReplacementList? selectedReplacementEmployee; + dynamic dynamicParams; + String selectedEmp = ""; DateTime selectedDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day); @override void initState() { super.initState(); - getAbsenceAttendanceTypes(); + //getAbsenceAttendanceTypes(); } void getAbsenceAttendanceTypes() async { try { Utils.showLoading(context); - absenceList = await LeaveBalanceApiClient().getAbsenceAttendanceTypes(); + absenceList = await LeaveBalanceApiClient().getAbsenceAttendanceTypes(empID: selectedEmp); Utils.hideLoading(context); setState(() {}); } catch (ex) { @@ -67,7 +71,7 @@ class _AddLeaveBalanceScreenState extends State { try { Utils.showLoading(context); getabsenceDffStructureList.clear(); - getabsenceDffStructureList = await LeaveBalanceApiClient().getAbsenceDffStructure(selectedAbsenceType!.dESCFLEXCONTEXTCODE!, "HR_LOA_SS", -999); + getabsenceDffStructureList = await LeaveBalanceApiClient().getAbsenceDffStructure(selectedAbsenceType!.dESCFLEXCONTEXTCODE!, "HR_LOA_SS", -999, empID: selectedEmp); Utils.hideLoading(context); setState(() {}); } catch (ex) { @@ -80,7 +84,7 @@ class _AddLeaveBalanceScreenState extends State { try { Utils.showLoading(context); CalculateAbsenceDuration duration = await LeaveBalanceApiClient() - .calculateAbsenceDuration(selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, Utils.getMonthNamedFormat(startDateTime!), Utils.getMonthNamedFormat(endDateTime!), -999); + .calculateAbsenceDuration(selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, Utils.getMonthNamedFormat(startDateTime!), Utils.getMonthNamedFormat(endDateTime!), -999, empID: selectedEmp); totalDays = duration.pABSENCEDAYS?.toInt(); Utils.hideLoading(context); @@ -91,58 +95,60 @@ class _AddLeaveBalanceScreenState extends State { } } - void validateAbsenceTransaction() async { - try { - Utils.showLoading(context); - Map dffDataMap = {}; - for (int i = 1; i <= 20; i++) { - dffDataMap["P_ATTRIBUTE$i"] = null; - for (int dffIndex = 0; dffIndex < getabsenceDffStructureList.length; dffIndex++) { - if ("ATTRIBUTE$i" == getabsenceDffStructureList[dffIndex].aPPLICATIONCOLUMNNAME) { - if (getabsenceDffStructureList[dffIndex].fORMATTYPE == "X") { - dffDataMap["P_ATTRIBUTE$i"] = - getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME != null ? Utils.formatDate(getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME!) : ""; - } else { - dffDataMap["P_ATTRIBUTE$i"] = getabsenceDffStructureList[dffIndex].eSERVICESDV?.pIDCOLUMNNAME; - } - break; + void validateAbsenceTransaction(selectedID) async { + //try { + Utils.showLoading(context); + Map dffDataMap = {}; + for (int i = 1; i <= 20; i++) { + dffDataMap["P_ATTRIBUTE$i"] = null; + for (int dffIndex = 0; dffIndex < getabsenceDffStructureList.length; dffIndex++) { + if ("ATTRIBUTE$i" == getabsenceDffStructureList[dffIndex].aPPLICATIONCOLUMNNAME) { + if (getabsenceDffStructureList[dffIndex].fORMATTYPE == "X") { + dffDataMap["P_ATTRIBUTE$i"] = + getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME != null ? Utils.formatDate(getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME!) : ""; + } else { + dffDataMap["P_ATTRIBUTE$i"] = getabsenceDffStructureList[dffIndex].eSERVICESDV?.pIDCOLUMNNAME; } + break; } } - await LeaveBalanceApiClient().validateAbsenceTransaction( - selectedAbsenceType!.dESCFLEXCONTEXTCODE!, - "HR_LOA_SS", - selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, - selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "", - DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), - DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), - -999, - dffDataMap, - comments: comment); + } + await LeaveBalanceApiClient().validateAbsenceTransaction( + selectedAbsenceType!.dESCFLEXCONTEXTCODE!, + "HR_LOA_SS", + selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, + selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "", + DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), + DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), + -999, + dffDataMap, + comments: comment, + empID: selectedEmp); - SumbitAbsenceTransactionList submit = await LeaveBalanceApiClient().submitAbsenceTransaction( - selectedAbsenceType!.dESCFLEXCONTEXTCODE!, - "HR_LOA_SS", - selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, - selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "", - DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), - DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), - -999, - dffDataMap, - comments: comment); + SumbitAbsenceTransactionList submit = await LeaveBalanceApiClient().submitAbsenceTransaction( + selectedAbsenceType!.dESCFLEXCONTEXTCODE!, + "HR_LOA_SS", + selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, + selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "", + DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), + DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), + -999, + dffDataMap, + comments: comment, + empID: selectedEmp); - Utils.hideLoading(context); + Utils.hideLoading(context); - var res = await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submit.pTRANSACTIONID!, "", "add_leave_balance")); - if (res != null && res == true) { - Utils.showLoading(context); - } - await LeaveBalanceApiClient().cancelHrTransaction(submit.pTRANSACTIONID!); - Utils.hideLoading(context); - } catch (ex) { - Utils.hideLoading(context); - Utils.handleException(ex, context, null); + var res = await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submit.pTRANSACTIONID!, "", "add_leave_balance")); + if (res != null && res == true) { + Utils.showLoading(context); } + await LeaveBalanceApiClient().cancelHrTransaction(submit.pTRANSACTIONID!); + Utils.hideLoading(context); + // } catch (ex) { + // Utils.hideLoading(context); + // Utils.handleException(ex, context, null); + // } } @override @@ -152,6 +158,16 @@ class _AddLeaveBalanceScreenState extends State { @override Widget build(BuildContext context) { + if (dynamicParams == null) { + dynamicParams = ModalRoute.of(context)!.settings.arguments; + if (dynamicParams.isNotEmpty) { + AppState().postParamsJson['P_SELECTED_EMPLOYEE_NUMBER'] = dynamicParams; + selectedEmp = dynamicParams; + getAbsenceAttendanceTypes(); + } else { + getAbsenceAttendanceTypes(); + } + } return Scaffold( backgroundColor: Colors.white, appBar: AppBarWidget( @@ -269,7 +285,7 @@ class _AddLeaveBalanceScreenState extends State { validateFieldData() ? null : () { - validateAbsenceTransaction(); + validateAbsenceTransaction(selectedEmp); }, ).insideContainer ], diff --git a/lib/ui/leave_balance/leave_balance_screen.dart b/lib/ui/leave_balance/leave_balance_screen.dart index 548ca99..07d6a7c 100644 --- a/lib/ui/leave_balance/leave_balance_screen.dart +++ b/lib/ui/leave_balance/leave_balance_screen.dart @@ -1,6 +1,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/leave_balance_api_client.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/utils.dart'; import 'package:mohem_flutter_app/config/routes.dart'; @@ -13,7 +14,8 @@ import 'package:mohem_flutter_app/widgets/balances_dashboard_widget.dart'; import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; class LeaveBalance extends StatefulWidget { - LeaveBalance({Key? key}) : super(key: key); + final String selectedEmp; + LeaveBalance({this.selectedEmp = '', Key? key}) : super(key: key); @override _LeaveBalanceState createState() { @@ -25,12 +27,13 @@ class _LeaveBalanceState extends State { List? absenceTransList; DateTime accrualDateTime = DateTime.now(); + dynamic dynamicParams; + String selectedEmp = ""; @override void initState() { super.initState(); - - getAbsenceTransactions(); + absenceTransList = []; } @override @@ -40,9 +43,9 @@ class _LeaveBalanceState extends State { void getAbsenceTransactions() async { try { - Utils.showLoading(context); - absenceTransList = await LeaveBalanceApiClient().getAbsenceTransactions(-999); - Utils.hideLoading(context); + // Utils.showLoading(context); + absenceTransList = await LeaveBalanceApiClient().getAbsenceTransactions(-999, empID: selectedEmp); + //Utils.hideLoading(context); setState(() {}); } catch (ex) { Utils.hideLoading(context); @@ -52,6 +55,16 @@ class _LeaveBalanceState extends State { @override Widget build(BuildContext context) { + if (dynamicParams == null) { + dynamicParams = ModalRoute.of(context)!.settings.arguments; + if (dynamicParams.isNotEmpty) { + AppState().postParamsJson['P_SELECTED_EMPLOYEE_NUMBER'] = dynamicParams; + selectedEmp = dynamicParams; + getAbsenceTransactions(); + } else { + getAbsenceTransactions(); + } + } return Scaffold( backgroundColor: Colors.white, appBar: AppBarWidget( @@ -111,7 +124,7 @@ class _LeaveBalanceState extends State { ), child: const Icon(Icons.add, color: Colors.white, size: 30), ).onPress(() { - Navigator.pushNamed(context, AppRoutes.addLeaveBalance); + Navigator.pushNamed(context, AppRoutes.addLeaveBalance, arguments: selectedEmp ?? ''); }), ); } diff --git a/lib/ui/misc/request_submit_screen.dart b/lib/ui/misc/request_submit_screen.dart index f05bacb..170e288 100644 --- a/lib/ui/misc/request_submit_screen.dart +++ b/lib/ui/misc/request_submit_screen.dart @@ -8,6 +8,7 @@ import 'package:mohem_flutter_app/api/leave_balance_api_client.dart'; import 'package:mohem_flutter_app/api/my_attendance_api_client.dart'; import 'package:mohem_flutter_app/api/profile_api_client.dart'; import 'package:mohem_flutter_app/api/termination_dff_api_client.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/utils.dart'; import 'package:mohem_flutter_app/config/routes.dart'; @@ -35,7 +36,8 @@ class RequestSubmitScreenParams { } class RequestSubmitScreen extends StatefulWidget { - RequestSubmitScreen({Key? key}) : super(key: key); + final String selectedEmp; + RequestSubmitScreen({this.selectedEmp ='',Key? key}) : super(key: key); @override _RequestSubmitScreenState createState() { @@ -50,6 +52,8 @@ class _RequestSubmitScreenState extends State { List approverList = []; List attachmentFiles = []; List attachments = []; + dynamic dynamicParams; + String selectedEmp =""; @override void initState() { @@ -123,6 +127,7 @@ class _RequestSubmitScreenState extends State { params!.transactionId, comments.text, -999, + empID: widget.selectedEmp ); } else if (params!.approvalFlag == 'eit') { await MyAttendanceApiClient().startEitApprovalProcess( 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 5c4053c..a670cbb 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart @@ -102,8 +102,8 @@ class _DynamicListViewScreenState extends State { itemBuilder: (cxt, int parentIndex) => getEITTransactionList![parentIndex].collectionTransaction!.isEmpty ? const SizedBox() : GridView( - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 1.9 / 0.75), - padding: const EdgeInsets.all(12.0), + 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(), diff --git a/lib/ui/my_attendance/services_menu_list_screen.dart b/lib/ui/my_attendance/services_menu_list_screen.dart index cd76132..7a61029 100644 --- a/lib/ui/my_attendance/services_menu_list_screen.dart +++ b/lib/ui/my_attendance/services_menu_list_screen.dart @@ -54,7 +54,7 @@ class ServicesMenuListScreen extends StatelessWidget { } return; } else if (servicesMenuData.list[index].requestType == "ABSENCE") { - Navigator.pushNamed(context, AppRoutes.leaveBalance); + Navigator.pushNamed(context, AppRoutes.leaveBalance, arguments: servicesMenuData?.selectedEmp ??''); return; } if (servicesMenuData.list[index].requestType == "EIT") { diff --git a/lib/ui/profile/contact_details.dart b/lib/ui/profile/contact_details.dart index 78afc1c..4d28a81 100644 --- a/lib/ui/profile/contact_details.dart +++ b/lib/ui/profile/contact_details.dart @@ -177,13 +177,13 @@ class _ContactDetailsState extends State { void addUpdateAddress() { Widget cancelButton = TextButton( - child: Text("Cancel"), + child: Text(LocaleKeys.cancel.tr()), onPressed: () { Navigator.pop(context); }, ); Widget continueButton = TextButton( - child: Text("Next"), + child: Text(LocaleKeys.next.tr()), onPressed: () { continueDynamicForms(); }, @@ -191,7 +191,7 @@ class _ContactDetailsState extends State { StatefulBuilder alert = StatefulBuilder(builder: (context, setState) { return AlertDialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10.0))), - title: Text("Confirm"), + title: Text(LocaleKeys.confirm.tr()), content: Builder(builder: (context) { // Get available height and width of the build area of this widget. Make a choice depending on the size. var height = MediaQuery.of(context).size.height * .5; @@ -199,14 +199,14 @@ class _ContactDetailsState extends State { height: height, child: Column(children: [ Text( - "Select the type of change you want to make.", + LocaleKeys.SelectChangeWantToMake.tr(), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), ), Divider(), Column( children: [ ListTile( - title: Text("Correct or amend this address"), + title: Text(LocaleKeys.CorrectAddress.tr()), leading: Radio( value: 1, groupValue: correctOrNew, @@ -219,7 +219,7 @@ class _ContactDetailsState extends State { ), ), ListTile( - title: Text("Enter a new address if you have moved"), + title: Text(LocaleKeys.EnterNewAddressMoved.tr()), leading: Radio( value: 2, groupValue: correctOrNew, diff --git a/lib/widgets/balances_dashboard_widget.dart b/lib/widgets/balances_dashboard_widget.dart index e546acf..2c56c7e 100644 --- a/lib/widgets/balances_dashboard_widget.dart +++ b/lib/widgets/balances_dashboard_widget.dart @@ -45,11 +45,14 @@ class _BalancesDashboardWidgetState extends State { late DateTime accrualDateTime; GetAccrualBalancesList? leaveBalanceAccrual; List? ticketBalanceAccrualList; + dynamic dynamicParams; + String selectedEmp = ""; @override void initState() { super.initState(); accrualDateTime = DateTime.now(); + changeAccrualDate(); } @override @@ -60,7 +63,7 @@ class _BalancesDashboardWidgetState extends State { void changeAccrualDate() async { try { Utils.showLoading(context); - List accrualList = await DashboardApiClient().getAccrualBalances(DateFormat("MM/dd/yyyy").format(accrualDateTime)); + List accrualList = await DashboardApiClient().getAccrualBalances(DateFormat("MM/dd/yyyy").format(accrualDateTime), empID: selectedEmp); if (accrualList.isNotEmpty) { if (widget.isLeaveBalance) { leaveBalanceAccrual = accrualList[0];