Merge branch 'master' into development_haroon

merge-requests/97/head
haroon amjad 3 years ago
commit af2cbd8c50

@ -424,6 +424,9 @@
"typeCurrentPasswordBelow": "اكتب كلمة المرور الحاليه", "typeCurrentPasswordBelow": "اكتب كلمة المرور الحاليه",
"currentPassword": "كلمة المرور الحاليه", "currentPassword": "كلمة المرور الحاليه",
"concurrentReports": "التقارير المتزامنه", "concurrentReports": "التقارير المتزامنه",
"EnterNewAddressMoved" : "أدخل عنوان جديد إذا كنت قد انتقلت",
"CorrectAddress": "تصحيح أو تعديل هذا العنوان",
"SelectChangeWantToMake": " حدد نوع التغيير الذي تريد القيام به.",
"profile": { "profile": {
"reset_password": { "reset_password": {
"label": "Reset Password", "label": "Reset Password",

@ -424,6 +424,9 @@
"typeCurrentPasswordBelow": "Type Your Current password below", "typeCurrentPasswordBelow": "Type Your Current password below",
"currentPassword": "Current password", "currentPassword": "Current password",
"concurrentReports": "Concurrent Reports", "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": { "profile": {
"reset_password": { "reset_password": {
"label": "Reset Password", "label": "Reset Password",

@ -65,10 +65,13 @@ class DashboardApiClient {
}, url, postParams); }, url, postParams);
} }
Future<List<GetAccrualBalancesList>> getAccrualBalances(String effectiveDate) async { Future<List<GetAccrualBalancesList>> getAccrualBalances(String effectiveDate, {String? empID}) async {
String url = "${ApiConsts.erpRest}GET_ACCRUAL_BALANCES"; String url = "${ApiConsts.erpRest}GET_ACCRUAL_BALANCES";
Map<String, dynamic> postParams = {"P_EFFECTIVE_DATE": effectiveDate}; Map<String, dynamic> postParams = {"P_EFFECTIVE_DATE": effectiveDate};
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
GenericResponseModel responseData = GenericResponseModel.fromJson(json); GenericResponseModel responseData = GenericResponseModel.fromJson(json);
return responseData.getAccrualBalancesList ?? []; return responseData.getAccrualBalancesList ?? [];

@ -17,27 +17,33 @@ class LeaveBalanceApiClient {
factory LeaveBalanceApiClient() => _instance; factory LeaveBalanceApiClient() => _instance;
Future<List<GetAbsenceTransactionList>> getAbsenceTransactions(int pSelectedResopID) async { Future<List<GetAbsenceTransactionList>> getAbsenceTransactions(int pSelectedResopID, {String? empID}) async {
String url = "${ApiConsts.erpRest}GET_ABSENCE_TRANSACTIONS"; String url = "${ApiConsts.erpRest}GET_ABSENCE_TRANSACTIONS";
Map<String, dynamic> postParams = {"P_PAGE_LIMIT": 50, "P_PAGE_NUM": 1, "P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": pSelectedResopID}; Map<String, dynamic> postParams = {"P_PAGE_LIMIT": 50, "P_PAGE_NUM": 1, "P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": pSelectedResopID};
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json); GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getAbsenceTransactionList ?? []; return responseData.getAbsenceTransactionList ?? [];
}, url, postParams); }, url, postParams);
} }
Future<List<GetAbsenceAttendanceTypesList>> getAbsenceAttendanceTypes() async { Future<List<GetAbsenceAttendanceTypesList>> getAbsenceAttendanceTypes({String? empID}) async {
String url = "${ApiConsts.erpRest}GET_ABSENCE_ATTENDANCE_TYPES"; String url = "${ApiConsts.erpRest}GET_ABSENCE_ATTENDANCE_TYPES";
Map<String, dynamic> postParams = {}; Map<String, dynamic> postParams = {};
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json); GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getAbsenceAttendanceTypesList ?? []; return responseData.getAbsenceAttendanceTypesList ?? [];
}, url, postParams); }, url, postParams);
} }
Future<CalculateAbsenceDuration> calculateAbsenceDuration(int pAbsenceAttendanceTypeID, String pDateStart, String pDateEnd, int pSelectedResopID) async { Future<CalculateAbsenceDuration> calculateAbsenceDuration(int pAbsenceAttendanceTypeID, String pDateStart, String pDateEnd, int pSelectedResopID, {String? empID}) async {
String url = "${ApiConsts.erpRest}CALCULATE_ABSENCE_DURATION"; String url = "${ApiConsts.erpRest}CALCULATE_ABSENCE_DURATION";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"P_ABSENCE_ATTENDANCE_TYPE_ID": pAbsenceAttendanceTypeID, "P_ABSENCE_ATTENDANCE_TYPE_ID": pAbsenceAttendanceTypeID,
@ -49,16 +55,22 @@ class LeaveBalanceApiClient {
"P_TIME_START": null, "P_TIME_START": null,
}; };
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json); GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.calculateAbsenceDuration!; return responseData.calculateAbsenceDuration!;
}, url, postParams); }, url, postParams);
} }
Future<List<GetAbsenceDffStructureList>> getAbsenceDffStructure(String pDescFlexContextCode, String pFunctionName, int pSelectedResopID) async { Future<List<GetAbsenceDffStructureList>> getAbsenceDffStructure(String pDescFlexContextCode, String pFunctionName, int pSelectedResopID, {String? empID}) async {
String url = "${ApiConsts.erpRest}GET_ABSENCE_DFF_STRUCTURE"; String url = "${ApiConsts.erpRest}GET_ABSENCE_DFF_STRUCTURE";
Map<String, dynamic> postParams = {"P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode, "P_FUNCTION_NAME": pFunctionName, "P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": pSelectedResopID}; Map<String, dynamic> postParams = {"P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode, "P_FUNCTION_NAME": pFunctionName, "P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": pSelectedResopID};
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json); GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getAbsenceDffStructureList ?? []; return responseData.getAbsenceDffStructureList ?? [];
@ -67,7 +79,7 @@ class LeaveBalanceApiClient {
Future<GenericResponseModel> validateAbsenceTransaction( Future<GenericResponseModel> validateAbsenceTransaction(
String pDescFlexContextCode, String pFunctionName, int pAbsenceAttendanceTypeID, String pReplacementUserName, String pDateStart, String pDateEnd, int pSelectedResopID, Map<String, String?> data, String pDescFlexContextCode, String pFunctionName, int pAbsenceAttendanceTypeID, String pReplacementUserName, String pDateStart, String pDateEnd, int pSelectedResopID, Map<String, String?> data,
{String comments = ""}) async { {String comments = "", String? empID}) async {
String url = "${ApiConsts.erpRest}VALIDATE_ABSENCE_TRANSACTION"; String url = "${ApiConsts.erpRest}VALIDATE_ABSENCE_TRANSACTION";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode, "P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode,
@ -86,6 +98,9 @@ class LeaveBalanceApiClient {
}; };
postParams.addAll(data); postParams.addAll(data);
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json); GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData; return responseData;
@ -94,7 +109,7 @@ class LeaveBalanceApiClient {
Future<SumbitAbsenceTransactionList> submitAbsenceTransaction( Future<SumbitAbsenceTransactionList> submitAbsenceTransaction(
String pDescFlexContextCode, String pFunctionName, int pAbsenceAttendanceTypeID, String pReplacementUserName, String pDateStart, String pDateEnd, int pSelectedResopID, Map<String, String?> data, String pDescFlexContextCode, String pFunctionName, int pAbsenceAttendanceTypeID, String pReplacementUserName, String pDateStart, String pDateEnd, int pSelectedResopID, Map<String, String?> data,
{String comments = ""}) async { {String comments = "", String? empID}) async {
String url = "${ApiConsts.erpRest}SUBMIT_ABSENCE_TRANSACTION"; String url = "${ApiConsts.erpRest}SUBMIT_ABSENCE_TRANSACTION";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode, "P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode,
@ -113,6 +128,9 @@ class LeaveBalanceApiClient {
}; };
postParams.addAll(data); postParams.addAll(data);
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json); GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.sumbitAbsenceTransactionList!; return responseData.sumbitAbsenceTransactionList!;
@ -129,7 +147,7 @@ class LeaveBalanceApiClient {
}, url, postParams); }, url, postParams);
} }
Future<StartAbsenceApprovalProccess> startAbsenceApprovalProcess(int pTransactionID, String comments, int pSelectedResopID) async { Future<StartAbsenceApprovalProccess> startAbsenceApprovalProcess(int pTransactionID, String comments, int pSelectedResopID,{String? empID}) async {
String url = "${ApiConsts.erpRest}START_ABSENCE_APPROVAL_PROCESS"; String url = "${ApiConsts.erpRest}START_ABSENCE_APPROVAL_PROCESS";
Map<String, dynamic> postParams = { Map<String, dynamic> postParams = {
"P_TRANSACTION_ID": pTransactionID, "P_TRANSACTION_ID": pTransactionID,
@ -138,6 +156,9 @@ class LeaveBalanceApiClient {
"P_MENU_TYPE": "E", "P_MENU_TYPE": "E",
}; };
postParams.addAll(AppState().postParamsJson); postParams.addAll(AppState().postParamsJson);
if (empID!.isNotEmpty) {
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
}
return await ApiClient().postJsonForObject((json) { return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json); GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.startAbsenceApprovalProccess!; return responseData.startAbsenceApprovalProccess!;

@ -440,6 +440,9 @@ class CodegenLoader extends AssetLoader{
"typeCurrentPasswordBelow": "اكتب كلمة المرور الحاليه", "typeCurrentPasswordBelow": "اكتب كلمة المرور الحاليه",
"currentPassword": "كلمة المرور الحاليه", "currentPassword": "كلمة المرور الحاليه",
"concurrentReports": "التقارير المتزامنه", "concurrentReports": "التقارير المتزامنه",
"EnterNewAddressMoved": "أدخل عنوان جديد إذا كنت قد انتقلت",
"CorrectAddress": "تصحيح أو تعديل هذا العنوان",
"SelectChangeWantToMake": " حدد نوع التغيير الذي تريد القيام به.",
"profile": { "profile": {
"reset_password": { "reset_password": {
"label": "Reset Password", "label": "Reset Password",
@ -516,7 +519,10 @@ class CodegenLoader extends AssetLoader{
"codeExpire": "انتهت صلاحية رمز التحقق", "codeExpire": "انتهت صلاحية رمز التحقق",
"typeheretoreply": "اكتب هنا للرد", "typeheretoreply": "اكتب هنا للرد",
"favorite": "مفضلتي", "favorite": "مفضلتي",
"searchfromchat": "البحث من الدردشة" "searchfromchat": "البحث من الدردشة",
"yourAnswerCorrect": "إجابتك صحيحة",
"youMissedTheQuestion": "فاتك !! أنت خارج اللعبة. لكن يمكنك المتابعة.",
"wrongAnswer": "إجابة خاطئة! أنت خارج اللعبة. لكن يمكنك المتابعة."
}; };
static const Map<String,dynamic> en_US = { static const Map<String,dynamic> en_US = {
"mohemm": "Mohemm", "mohemm": "Mohemm",
@ -944,6 +950,9 @@ static const Map<String,dynamic> en_US = {
"typeCurrentPasswordBelow": "Type Your Current password below", "typeCurrentPasswordBelow": "Type Your Current password below",
"currentPassword": "Current password", "currentPassword": "Current password",
"concurrentReports": "Concurrent Reports", "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": { "profile": {
"reset_password": { "reset_password": {
"label": "Reset Password", "label": "Reset Password",
@ -1020,7 +1029,10 @@ static const Map<String,dynamic> en_US = {
"allQuestionsCorrect": "You have answered all questions correct", "allQuestionsCorrect": "You have answered all questions correct",
"typeheretoreply": "Type here to reply", "typeheretoreply": "Type here to reply",
"favorite": "My Favorites", "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<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
} }

@ -425,6 +425,9 @@ abstract class LocaleKeys {
static const typeCurrentPasswordBelow = 'typeCurrentPasswordBelow'; static const typeCurrentPasswordBelow = 'typeCurrentPasswordBelow';
static const currentPassword = 'currentPassword'; static const currentPassword = 'currentPassword';
static const concurrentReports = 'concurrentReports'; 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_label = 'profile.reset_password.label';
static const profile_reset_password_username = 'profile.reset_password.username'; static const profile_reset_password_username = 'profile.reset_password.username';
static const profile_reset_password_password = 'profile.reset_password.password'; static const profile_reset_password_password = 'profile.reset_password.password';

@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/leave_balance_api_client.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/date_uitl.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.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'; import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart';
class AddLeaveBalanceScreen extends StatefulWidget { class AddLeaveBalanceScreen extends StatefulWidget {
AddLeaveBalanceScreen({Key? key}) : super(key: key); final String selectedEmp;
AddLeaveBalanceScreen({this.selectedEmp = '', Key? key}) : super(key: key);
@override @override
_AddLeaveBalanceScreenState createState() { _AddLeaveBalanceScreenState createState() {
@ -42,19 +44,21 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
int? totalDays; int? totalDays;
String comment = ""; String comment = "";
ReplacementList? selectedReplacementEmployee; ReplacementList? selectedReplacementEmployee;
dynamic dynamicParams;
String selectedEmp = "";
DateTime selectedDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day); DateTime selectedDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day);
@override @override
void initState() { void initState() {
super.initState(); super.initState();
getAbsenceAttendanceTypes(); //getAbsenceAttendanceTypes();
} }
void getAbsenceAttendanceTypes() async { void getAbsenceAttendanceTypes() async {
try { try {
Utils.showLoading(context); Utils.showLoading(context);
absenceList = await LeaveBalanceApiClient().getAbsenceAttendanceTypes(); absenceList = await LeaveBalanceApiClient().getAbsenceAttendanceTypes(empID: selectedEmp);
Utils.hideLoading(context); Utils.hideLoading(context);
setState(() {}); setState(() {});
} catch (ex) { } catch (ex) {
@ -67,7 +71,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
try { try {
Utils.showLoading(context); Utils.showLoading(context);
getabsenceDffStructureList.clear(); 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); Utils.hideLoading(context);
setState(() {}); setState(() {});
} catch (ex) { } catch (ex) {
@ -80,7 +84,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
try { try {
Utils.showLoading(context); Utils.showLoading(context);
CalculateAbsenceDuration duration = await LeaveBalanceApiClient() 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(); totalDays = duration.pABSENCEDAYS?.toInt();
Utils.hideLoading(context); Utils.hideLoading(context);
@ -91,58 +95,60 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
} }
} }
void validateAbsenceTransaction() async { void validateAbsenceTransaction(selectedID) async {
try { //try {
Utils.showLoading(context); Utils.showLoading(context);
Map<String, String?> dffDataMap = {}; Map<String, String?> dffDataMap = {};
for (int i = 1; i <= 20; i++) { for (int i = 1; i <= 20; i++) {
dffDataMap["P_ATTRIBUTE$i"] = null; dffDataMap["P_ATTRIBUTE$i"] = null;
for (int dffIndex = 0; dffIndex < getabsenceDffStructureList.length; dffIndex++) { for (int dffIndex = 0; dffIndex < getabsenceDffStructureList.length; dffIndex++) {
if ("ATTRIBUTE$i" == getabsenceDffStructureList[dffIndex].aPPLICATIONCOLUMNNAME) { if ("ATTRIBUTE$i" == getabsenceDffStructureList[dffIndex].aPPLICATIONCOLUMNNAME) {
if (getabsenceDffStructureList[dffIndex].fORMATTYPE == "X") { if (getabsenceDffStructureList[dffIndex].fORMATTYPE == "X") {
dffDataMap["P_ATTRIBUTE$i"] = dffDataMap["P_ATTRIBUTE$i"] =
getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME != null ? Utils.formatDate(getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME!) : ""; getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME != null ? Utils.formatDate(getabsenceDffStructureList[dffIndex].eSERVICESDV!.pIDCOLUMNNAME!) : "";
} else { } else {
dffDataMap["P_ATTRIBUTE$i"] = getabsenceDffStructureList[dffIndex].eSERVICESDV?.pIDCOLUMNNAME; dffDataMap["P_ATTRIBUTE$i"] = getabsenceDffStructureList[dffIndex].eSERVICESDV?.pIDCOLUMNNAME;
}
break;
} }
break;
} }
} }
await LeaveBalanceApiClient().validateAbsenceTransaction( }
selectedAbsenceType!.dESCFLEXCONTEXTCODE!, await LeaveBalanceApiClient().validateAbsenceTransaction(
"HR_LOA_SS", selectedAbsenceType!.dESCFLEXCONTEXTCODE!,
selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, "HR_LOA_SS",
selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "", selectedAbsenceType!.aBSENCEATTENDANCETYPEID!,
DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "",
DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"),
-999, DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"),
dffDataMap, -999,
comments: comment); dffDataMap,
comments: comment,
empID: selectedEmp);
SumbitAbsenceTransactionList submit = await LeaveBalanceApiClient().submitAbsenceTransaction( SumbitAbsenceTransactionList submit = await LeaveBalanceApiClient().submitAbsenceTransaction(
selectedAbsenceType!.dESCFLEXCONTEXTCODE!, selectedAbsenceType!.dESCFLEXCONTEXTCODE!,
"HR_LOA_SS", "HR_LOA_SS",
selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, selectedAbsenceType!.aBSENCEATTENDANCETYPEID!,
selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "", selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "",
DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"),
DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"),
-999, -999,
dffDataMap, dffDataMap,
comments: comment); 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")); var res = await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submit.pTRANSACTIONID!, "", "add_leave_balance"));
if (res != null && res == true) { if (res != null && res == true) {
Utils.showLoading(context); Utils.showLoading(context);
}
await LeaveBalanceApiClient().cancelHrTransaction(submit.pTRANSACTIONID!);
Utils.hideLoading(context);
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
} }
await LeaveBalanceApiClient().cancelHrTransaction(submit.pTRANSACTIONID!);
Utils.hideLoading(context);
// } catch (ex) {
// Utils.hideLoading(context);
// Utils.handleException(ex, context, null);
// }
} }
@override @override
@ -152,6 +158,16 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
@override @override
Widget build(BuildContext context) { 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( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: AppBarWidget( appBar: AppBarWidget(
@ -269,7 +285,7 @@ class _AddLeaveBalanceScreenState extends State<AddLeaveBalanceScreen> {
validateFieldData() validateFieldData()
? null ? null
: () { : () {
validateAbsenceTransaction(); validateAbsenceTransaction(selectedEmp);
}, },
).insideContainer ).insideContainer
], ],

@ -1,6 +1,7 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/leave_balance_api_client.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/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.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'; import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';
class LeaveBalance extends StatefulWidget { class LeaveBalance extends StatefulWidget {
LeaveBalance({Key? key}) : super(key: key); final String selectedEmp;
LeaveBalance({this.selectedEmp = '', Key? key}) : super(key: key);
@override @override
_LeaveBalanceState createState() { _LeaveBalanceState createState() {
@ -25,12 +27,13 @@ class _LeaveBalanceState extends State<LeaveBalance> {
List<GetAbsenceTransactionList>? absenceTransList; List<GetAbsenceTransactionList>? absenceTransList;
DateTime accrualDateTime = DateTime.now(); DateTime accrualDateTime = DateTime.now();
dynamic dynamicParams;
String selectedEmp = "";
@override @override
void initState() { void initState() {
super.initState(); super.initState();
absenceTransList = [];
getAbsenceTransactions();
} }
@override @override
@ -40,9 +43,9 @@ class _LeaveBalanceState extends State<LeaveBalance> {
void getAbsenceTransactions() async { void getAbsenceTransactions() async {
try { try {
Utils.showLoading(context); // Utils.showLoading(context);
absenceTransList = await LeaveBalanceApiClient().getAbsenceTransactions(-999); absenceTransList = await LeaveBalanceApiClient().getAbsenceTransactions(-999, empID: selectedEmp);
Utils.hideLoading(context); //Utils.hideLoading(context);
setState(() {}); setState(() {});
} catch (ex) { } catch (ex) {
Utils.hideLoading(context); Utils.hideLoading(context);
@ -52,6 +55,16 @@ class _LeaveBalanceState extends State<LeaveBalance> {
@override @override
Widget build(BuildContext context) { 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( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: AppBarWidget( appBar: AppBarWidget(
@ -111,7 +124,7 @@ class _LeaveBalanceState extends State<LeaveBalance> {
), ),
child: const Icon(Icons.add, color: Colors.white, size: 30), child: const Icon(Icons.add, color: Colors.white, size: 30),
).onPress(() { ).onPress(() {
Navigator.pushNamed(context, AppRoutes.addLeaveBalance); Navigator.pushNamed(context, AppRoutes.addLeaveBalance, arguments: selectedEmp ?? '');
}), }),
); );
} }

@ -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/my_attendance_api_client.dart';
import 'package:mohem_flutter_app/api/profile_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/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/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/config/routes.dart';
@ -35,7 +36,8 @@ class RequestSubmitScreenParams {
} }
class RequestSubmitScreen extends StatefulWidget { class RequestSubmitScreen extends StatefulWidget {
RequestSubmitScreen({Key? key}) : super(key: key); final String selectedEmp;
RequestSubmitScreen({this.selectedEmp ='',Key? key}) : super(key: key);
@override @override
_RequestSubmitScreenState createState() { _RequestSubmitScreenState createState() {
@ -50,6 +52,8 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
List<GetApprovesList> approverList = []; List<GetApprovesList> approverList = [];
List<File> attachmentFiles = []; List<File> attachmentFiles = [];
List<String> attachments = []; List<String> attachments = [];
dynamic dynamicParams;
String selectedEmp ="";
@override @override
void initState() { void initState() {
@ -123,6 +127,7 @@ class _RequestSubmitScreenState extends State<RequestSubmitScreen> {
params!.transactionId, params!.transactionId,
comments.text, comments.text,
-999, -999,
empID: widget.selectedEmp
); );
} else if (params!.approvalFlag == 'eit') { } else if (params!.approvalFlag == 'eit') {
await MyAttendanceApiClient().startEitApprovalProcess( await MyAttendanceApiClient().startEitApprovalProcess(

@ -102,8 +102,8 @@ class _DynamicListViewScreenState extends State<DynamicListViewScreen> {
itemBuilder: (cxt, int parentIndex) => getEITTransactionList![parentIndex].collectionTransaction!.isEmpty itemBuilder: (cxt, int parentIndex) => getEITTransactionList![parentIndex].collectionTransaction!.isEmpty
? const SizedBox() ? const SizedBox()
: GridView( : GridView(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 1.9 / 0.75), gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 1.0 / 0.75),
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.only(left: 12,right: 21,top: 12),
shrinkWrap: true, shrinkWrap: true,
primary: false, primary: false,
physics: const ScrollPhysics(), physics: const ScrollPhysics(),

@ -54,7 +54,7 @@ class ServicesMenuListScreen extends StatelessWidget {
} }
return; return;
} else if (servicesMenuData.list[index].requestType == "ABSENCE") { } else if (servicesMenuData.list[index].requestType == "ABSENCE") {
Navigator.pushNamed(context, AppRoutes.leaveBalance); Navigator.pushNamed(context, AppRoutes.leaveBalance, arguments: servicesMenuData?.selectedEmp ??'');
return; return;
} }
if (servicesMenuData.list[index].requestType == "EIT") { if (servicesMenuData.list[index].requestType == "EIT") {

@ -177,13 +177,13 @@ class _ContactDetailsState extends State<ContactDetails> {
void addUpdateAddress() { void addUpdateAddress() {
Widget cancelButton = TextButton( Widget cancelButton = TextButton(
child: Text("Cancel"), child: Text(LocaleKeys.cancel.tr()),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
); );
Widget continueButton = TextButton( Widget continueButton = TextButton(
child: Text("Next"), child: Text(LocaleKeys.next.tr()),
onPressed: () { onPressed: () {
continueDynamicForms(); continueDynamicForms();
}, },
@ -191,7 +191,7 @@ class _ContactDetailsState extends State<ContactDetails> {
StatefulBuilder alert = StatefulBuilder(builder: (context, setState) { StatefulBuilder alert = StatefulBuilder(builder: (context, setState) {
return AlertDialog( return AlertDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10.0))), shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10.0))),
title: Text("Confirm"), title: Text(LocaleKeys.confirm.tr()),
content: Builder(builder: (context) { content: Builder(builder: (context) {
// Get available height and width of the build area of this widget. Make a choice depending on the size. // 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; var height = MediaQuery.of(context).size.height * .5;
@ -199,14 +199,14 @@ class _ContactDetailsState extends State<ContactDetails> {
height: height, height: height,
child: Column(children: [ child: Column(children: [
Text( Text(
"Select the type of change you want to make.", LocaleKeys.SelectChangeWantToMake.tr(),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
), ),
Divider(), Divider(),
Column( Column(
children: [ children: [
ListTile( ListTile(
title: Text("Correct or amend this address"), title: Text(LocaleKeys.CorrectAddress.tr()),
leading: Radio( leading: Radio(
value: 1, value: 1,
groupValue: correctOrNew, groupValue: correctOrNew,
@ -219,7 +219,7 @@ class _ContactDetailsState extends State<ContactDetails> {
), ),
), ),
ListTile( ListTile(
title: Text("Enter a new address if you have moved"), title: Text(LocaleKeys.EnterNewAddressMoved.tr()),
leading: Radio( leading: Radio(
value: 2, value: 2,
groupValue: correctOrNew, groupValue: correctOrNew,

@ -45,11 +45,14 @@ class _BalancesDashboardWidgetState extends State<BalancesDashboardWidget> {
late DateTime accrualDateTime; late DateTime accrualDateTime;
GetAccrualBalancesList? leaveBalanceAccrual; GetAccrualBalancesList? leaveBalanceAccrual;
List<GetAccrualBalancesList>? ticketBalanceAccrualList; List<GetAccrualBalancesList>? ticketBalanceAccrualList;
dynamic dynamicParams;
String selectedEmp = "";
@override @override
void initState() { void initState() {
super.initState(); super.initState();
accrualDateTime = DateTime.now(); accrualDateTime = DateTime.now();
changeAccrualDate();
} }
@override @override
@ -60,7 +63,7 @@ class _BalancesDashboardWidgetState extends State<BalancesDashboardWidget> {
void changeAccrualDate() async { void changeAccrualDate() async {
try { try {
Utils.showLoading(context); Utils.showLoading(context);
List<GetAccrualBalancesList> accrualList = await DashboardApiClient().getAccrualBalances(DateFormat("MM/dd/yyyy").format(accrualDateTime)); List<GetAccrualBalancesList> accrualList = await DashboardApiClient().getAccrualBalances(DateFormat("MM/dd/yyyy").format(accrualDateTime), empID: selectedEmp);
if (accrualList.isNotEmpty) { if (accrualList.isNotEmpty) {
if (widget.isLeaveBalance) { if (widget.isLeaveBalance) {
leaveBalanceAccrual = accrualList[0]; leaveBalanceAccrual = accrualList[0];

Loading…
Cancel
Save