diff --git a/assets/images/call.svg b/assets/images/call.svg new file mode 100644 index 0000000..f98d059 --- /dev/null +++ b/assets/images/call.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/create_request.svg b/assets/images/create_request.svg new file mode 100644 index 0000000..c5bdeea --- /dev/null +++ b/assets/images/create_request.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/profile_details.svg b/assets/images/profile_details.svg new file mode 100644 index 0000000..9daf5ad --- /dev/null +++ b/assets/images/profile_details.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/images/team.svg b/assets/images/team.svg new file mode 100644 index 0000000..aff9c19 --- /dev/null +++ b/assets/images/team.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/user.svg b/assets/images/user.svg new file mode 100644 index 0000000..13d9aed --- /dev/null +++ b/assets/images/user.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/view_attendance.svg b/assets/images/view_attendance.svg new file mode 100644 index 0000000..256bf7a --- /dev/null +++ b/assets/images/view_attendance.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 0c6ce54..1ba7218 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -339,6 +339,25 @@ "pleaseSelectEmployeeForReplacement": "الرجاء تحديد موظف للاستبدال", "pleaseSelectAction": "الرجاء تحديد الإجراء", "pleaseSelectDate": "الرجاء تحديد التاريخ", + "todayAttendance": "حضور اليوم", + "viewAttendance": "عرض الحضور", + "teamMembers":"اعضاءالفريق", + "profileDetails": "الملف الشخصي", + "noResultsFound" : "لايوجد نتائج", + "searchBy": "بحث بواسطة", + "myTeamMembers": "اعضاء فريقي", + "save": "حفظ", + "itemType": "نوع العنصر", + "TurnNotificationsFor": "تفعيل الاشعارات", + "worklistSettings": "اعدادات الاشعارات", + "absenceType": "نوع الغياب", + "absenceCategory": "فئة الغياب", + "days": "أيام", + "hours": "ساعات", + "approvalStatus": "حالة القبول", + "absenceStatus": "حالة الغياب", + "subordinateLeave": "إجازة التابعيين", + "numberDays": "عدد الأيام", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 812fa49..47d33b9 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -339,6 +339,25 @@ "pleaseSelectEmployeeForReplacement": "Please select employee for replacement", "pleaseSelectAction": "Please select action", "pleaseSelectDate": "Please select date", + "todayAttendance": "Today's Attendance", + "viewAttendance": "View Attendance", + "teamMembers":"Team Members", + "profileDetails": "Profile Details", + "noResultsFound" : "No Results Found", + "searchBy": "Search by", + "myTeamMembers": "My Team Members", + "save": "Save", + "itemType": "Item Type", + "TurnNotificationsFor": "Turn on notifications for", + "worklistSettings": "Worklist Settings", + "absenceType": "Absence Type", + "absenceCategory": "Absence Category", + "days": "Days", + "hours": "Hours", + "approvalStatus": "Approval Status", + "absenceStatus": "Absence Status", + "subordinateLeave": "Subordinate Leave", + "numberDays": "Number of days", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/api/leave_balance_api_client.dart b/lib/api/leave_balance_api_client.dart new file mode 100644 index 0000000..cd577ba --- /dev/null +++ b/lib/api/leave_balance_api_client.dart @@ -0,0 +1,146 @@ +import 'package:mohem_flutter_app/api/api_client.dart'; +import 'package:mohem_flutter_app/app_state/app_state.dart'; +import 'package:mohem_flutter_app/classes/consts.dart'; +import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/calculate_absence_duration_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/cancel_hr_transaction_list_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/get_absence_attendance_types_list_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/get_absence_dff_structure_list_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/get_absence_transaction_list_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/start_absence_approval_proccess_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/sumbit_absence_transaction_list_model.dart'; + +class LeaveBalanceApiClient { + static final LeaveBalanceApiClient _instance = LeaveBalanceApiClient._internal(); + + LeaveBalanceApiClient._internal(); + + factory LeaveBalanceApiClient() => _instance; + + Future> getAbsenceTransactions(int pSelectedResopID) 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); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getAbsenceTransactionList ?? []; + }, url, postParams); + } + + Future> getAbsenceAttendanceTypes() async { + String url = "${ApiConsts.erpRest}GET_ABSENCE_ATTENDANCE_TYPES"; + Map postParams = {}; + postParams.addAll(AppState().postParamsJson); + 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 { + String url = "${ApiConsts.erpRest}CALCULATE_ABSENCE_DURATION"; + Map postParams = { + "P_ABSENCE_ATTENDANCE_TYPE_ID": pAbsenceAttendanceTypeID, + "P_DATE_START": pDateStart, + "P_DATE_END": pDateEnd, + "P_SELECTED_RESP_ID": pSelectedResopID, + "P_MENU_TYPE": "E", + "P_TIME_END": null, + "P_TIME_START": null, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.calculateAbsenceDuration!; + }, url, postParams); + } + + Future> getAbsenceDffStructure(String pDescFlexContextCode, String pFunctionName, int pSelectedResopID) 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); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getAbsenceDffStructureList ?? []; + }, url, postParams); + } + + Future validateAbsenceTransaction( + String pDescFlexContextCode, String pFunctionName, int pAbsenceAttendanceTypeID, String pReplacementUserName, String pDateStart, String pDateEnd, int pSelectedResopID, Map data, + {String comments = ""}) async { + String url = "${ApiConsts.erpRest}VALIDATE_ABSENCE_TRANSACTION"; + Map postParams = { + "P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode, + "P_FUNCTION_NAME": pFunctionName, + "P_REPLACEMENT_USER_NAME": pReplacementUserName, + "P_ABSENCE_ACTION": "CREATE", + "P_ABSENCE_COMMENTS": comments, + "P_ABSENCE_ATTENDANCE_ID": pAbsenceAttendanceTypeID, + "P_ABSENCE_ATTENDANCE_TYPE_ID": pAbsenceAttendanceTypeID, + "P_DATE_START": pDateStart, + "P_DATE_END": pDateEnd, //"29-Sep-2022", + "P_SELECTED_RESP_ID": pSelectedResopID, + "P_MENU_TYPE": "E", + "P_TIME_END": null, + "P_TIME_START": null, + }; + postParams.addAll(data); + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } + + Future submitAbsenceTransaction( + String pDescFlexContextCode, String pFunctionName, int pAbsenceAttendanceTypeID, String pReplacementUserName, String pDateStart, String pDateEnd, int pSelectedResopID, Map data, + {String comments = ""}) async { + String url = "${ApiConsts.erpRest}SUBMIT_ABSENCE_TRANSACTION"; + Map postParams = { + "P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode, + "P_FUNCTION_NAME": pFunctionName, + "P_REPLACEMENT_USER_NAME": pReplacementUserName, + "P_ABSENCE_ACTION": "CREATE", + "P_ABSENCE_COMMENTS": comments, + "P_ABSENCE_ATTENDANCE_ID": pAbsenceAttendanceTypeID, + "P_ABSENCE_ATTENDANCE_TYPE_ID": pAbsenceAttendanceTypeID, + "P_DATE_START": pDateStart, + "P_DATE_END": pDateEnd, //"29-Sep-2022", + "P_SELECTED_RESP_ID": pSelectedResopID, + "P_MENU_TYPE": "E", + "P_TIME_END": null, + "P_TIME_START": null, + }; + postParams.addAll(data); + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.sumbitAbsenceTransactionList!; + }, url, postParams); + } + + Future cancelHrTransaction(int pTransactionID) async { + String url = "${ApiConsts.erpRest}CANCEL_HR_TRANSACTION"; + Map postParams = {"P_TRANSACTION_ID": pTransactionID}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.cancelHRTransactionLIst!; + }, url, postParams); + } + + Future startAbsenceApprovalProcess(int pTransactionID, String comments, int pSelectedResopID) async { + String url = "${ApiConsts.erpRest}START_ABSENCE_APPROVAL_PROCESS"; + Map postParams = { + "P_TRANSACTION_ID": pTransactionID, + "P_SELECTED_RESP_ID": pSelectedResopID, + "P_COMMENTS": comments, + "P_MENU_TYPE": "E", + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.startAbsenceApprovalProccess!; + }, url, postParams); + } +} diff --git a/lib/api/monthly_attendance_api_client.dart b/lib/api/monthly_attendance_api_client.dart index 543addb..00d444f 100644 --- a/lib/api/monthly_attendance_api_client.dart +++ b/lib/api/monthly_attendance_api_client.dart @@ -10,7 +10,6 @@ import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model. import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/api/api_client.dart'; -// todo '@fatima' change file name according to structure class MonthlyAttendanceApiClient { static final MonthlyAttendanceApiClient _instance = MonthlyAttendanceApiClient._internal(); diff --git a/lib/api/my_team/my_team_api_client.dart b/lib/api/my_team/my_team_api_client.dart new file mode 100644 index 0000000..c5a78c6 --- /dev/null +++ b/lib/api/my_team/my_team_api_client.dart @@ -0,0 +1,163 @@ + + +import 'package:mohem_flutter_app/api/api_client.dart'; +import 'package:mohem_flutter_app/app_state/app_state.dart'; +import 'package:mohem_flutter_app/classes/consts.dart'; +import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart'; +import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; +import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart'; +import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; +import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; +import 'package:mohem_flutter_app/models/my_team/get_subordinates_leaves_total_vacations_list_model.dart'; +import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart'; + +class MyTeamApiClient { + static final MyTeamApiClient _instance = MyTeamApiClient._internal(); + + MyTeamApiClient._internal(); + + factory MyTeamApiClient() => _instance; + + + Future> getEmployeeSubordinates(String searchEmpEmail, String searchEmpName, String searchEmpNo) async { + String url = "${ApiConsts.erpRest}GET_EMPLOYEE_SUBORDINATES"; + Map postParams = { + "P_PAGE_LIMIT": 50, + "P_PAGE_NUM": 1, + "P_SEARCH_EMAIL_ADDRESS": searchEmpEmail, + "P_SEARCH_EMPLOYEE_DISPLAY_NAME": searchEmpName, + "P_SEARCH_EMPLOYEE_NUMBER": searchEmpNo, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getEmployeeSubordinatesList ?? []; + }, url, postParams); + } + + Future getTimeCardSummary(String month, int year, String? empID) async { + String url = "${ApiConsts.erpRest}GET_TIME_CARD_SUMMARY"; + Map postParams = { + "P_MENU_TYPE": "M", + "P_SELECTED_RESP_ID": -999, + "SearchMonth": month, + "SearchYear": year, + }; + + postParams.addAll(AppState().postParamsJson); + postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return (responseData.getTimeCardSummaryList?.length ?? 0) > 0 ? responseData.getTimeCardSummaryList!.first : null; + }, url, postParams); + } + + Future> getDayHoursTypeDetails(String month, int year, String? empID) async { + String url = "${ApiConsts.erpRest}GET_DAY_HOURS_TYPE_DETAILS"; + Map postParams = { + "P_MENU_TYPE": "M", + "P_PAGE_LIMIT": 100, + "P_PAGE_NUM": 1, + "P_SELECTED_RESP_ID": -999, + "SearchMonth": month, + "SearchYear": year, + }; + postParams.addAll(AppState().postParamsJson); + 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); + } + + + Future getAttendanceTracking(String? empID) async { + String url = "${ApiConsts.erpRest}GET_Attendance_Tracking"; + Map postParams = {}; + postParams.addAll(AppState().postParamsJson); + postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + print(responseData.getAttendanceTrackingList); + return responseData.getAttendanceTrackingList; + }, url, postParams); + } + + Future> employeeSubordinates(String searchEmpEmail, String searchEmpName, String searchEmpNo, String? empID) async { + String url = "${ApiConsts.erpRest}GET_EMPLOYEE_SUBORDINATES"; + Map postParams = { + "P_PAGE_LIMIT": 50, + "P_PAGE_NUM": 1, + "P_SEARCH_EMAIL_ADDRESS": searchEmpEmail, + "P_SEARCH_EMPLOYEE_DISPLAY_NAME": searchEmpName, + "P_SEARCH_EMPLOYEE_NUMBER": searchEmpNo, + }; + postParams.addAll(AppState().postParamsJson); + postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getEmployeeSubordinatesList ?? []; + }, url, postParams); + } + + Future> employeeSubordinatesRequest(String? empID) async { + String url = "${ApiConsts.erpRest}GET_MENU_ENTRIES"; + Map postParams = { + "P_MENU_TYPE": "M", + "P_SELECTED_RESP_ID": -999, + }; + postParams.addAll(AppState().postParamsJson); + postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getMenuEntriesList ?? []; + }, url, postParams); + } + + Future?> getFavoriteReplacement() async { + String url = "${ApiConsts.erpRest}Mohemm_GetFavoriteReplacements"; + Map postParams = { + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.mohemmGetFavoriteReplacementsList; + }, url, postParams); + } + + Future changeFavoriteReplacements({required String email, required String employeName, required String image, required String userName, bool isFav = false}) async { + String url = "${ApiConsts.erpRest}Mohemm_ChangeFavoriteReplacements"; + Map postParamsObj = { + "EMAIL_ADDRESS": email, + "EMPLOYEE_DISPLAY_NAME": employeName, + "EMPLOYEE_IMAGE": image, + "IsFavorite": isFav, + "USER_NAME": userName, + }; + Map postParams = { + "Mohemm_ChangeReplacementsInputList": [postParamsObj], + //postParams["Mohemm_ChangeReplacementsInputList"] = list; + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } + + Future> getSubordinatesLeavesList(String dateFrom, String dateTo) async { + String url = "${ApiConsts.erpRest}GET_SUBORDINATES_LEAVES_TOTAL_VACATIONS"; + Map postParams = { + "P_DATE_FROM": dateFrom, + "P_DATE_TO": dateTo, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.getSubordinatesLeavesTotalVacationsList ?? []; + }, url, postParams); + } +} + diff --git a/lib/api/worklist/worklist_api_client.dart b/lib/api/worklist/worklist_api_client.dart index bc05627..f1f9408 100644 --- a/lib/api/worklist/worklist_api_client.dart +++ b/lib/api/worklist/worklist_api_client.dart @@ -17,15 +17,18 @@ import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dar import 'package:mohem_flutter_app/models/get_quotation_analysis_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart'; +import 'package:mohem_flutter_app/models/get_user_item_type_list.dart'; import 'package:mohem_flutter_app/models/itg_forms_models/itg_request_model.dart'; 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/update_user_item_type_list.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_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'; import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart'; +import 'package:mohem_flutter_app/models/worklist/update_user_type_list.dart'; import 'package:mohem_flutter_app/models/worklist_response_model.dart'; class WorkListApiClient { @@ -445,4 +448,31 @@ class WorkListApiClient { return responseData; }, url, postParams); } + + + Future> getUserItemTypes() async { + String url = "${ApiConsts.erpRest}GET_USER_ITEM_TYPES"; + Map postParams = { + + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.getUserItemTypesList ?? []; + }, url, postParams); + } + + Future updateUserItemTypes(List> itemList) async { + String url = "${ApiConsts.erpRest}UPDATE_USER_ITEM_TYPES"; + Map postParams = { + "UpdateItemTypeList": itemList + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.updateUserItemTypesList; + }, url, postParams); + } + + } diff --git a/lib/classes/colors.dart b/lib/classes/colors.dart index 6c24f7e..3469681 100644 --- a/lib/classes/colors.dart +++ b/lib/classes/colors.dart @@ -43,4 +43,10 @@ class MyColors { static const Color darkColor = Color(0xff000015); static const Color lightGrayColor = Color(0xff808080); static const Color DarkRedColor = Color(0xffD02127); + static const Color lightGreyColor = Color(0xffC7C7C7); + static const Color green69Color = Color(0xff1FA169); + static const Color redA3Color = Color(0xffCA3332); + static const Color green9CColor = Color(0xff259CB8); + static const Color green2DColor = Color(0xff32D892); + static const Color greyC4Color = Color(0xffC4C4C4); } diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index e2ae38e..7977598 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -217,4 +217,66 @@ class Utils { ], ); } + + /// EIT Forms date formats + + static String getMonthNamedFormat(DateTime date) { + /// it will return like "29-Sep-2022" + return DateFormat('dd-MMM-yyyy').format(date); + } + + static String reverseFormatDate(String date) { + String formattedDate; + if (date.isNotEmpty) { + formattedDate = date.replaceAll('/', '-'); + formattedDate = formattedDate.replaceAll(' 00:00:00', ''); + } else { + formattedDate = date; + } + return formattedDate; + } + + static String formatStandardDate(String date) { + String formattedDate; + if (date.isNotEmpty) { + formattedDate = date.replaceAll('-', '/'); + } else { + formattedDate = date; + } + return formattedDate; + } + + static String reverseFormatStandardDate(String date) { + String formattedDate; + if (date.isNotEmpty) { + formattedDate = date.replaceAll('/', '-'); + } else { + formattedDate = date; + } + return formattedDate; + } + + static String formatDate(String date) { + String formattedDate; + + if (date.isNotEmpty) { + date = date.substring(0, 10); + formattedDate = date.replaceAll('-', '/'); + formattedDate = formattedDate + ' 00:00:00'; + } else { + formattedDate = date; + } + return formattedDate; + } + + static String formatDateNew(String date) { + String formattedDate; + if (date.isNotEmpty) { + formattedDate = date.split('T')[0]; + formattedDate = formattedDate + ' 00:00:00'; + } else { + formattedDate = date; + } + return formattedDate; + } } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 5147bde..4917314 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -5,6 +5,8 @@ import 'package:mohem_flutter_app/ui/attendance/vacation_rule_screen.dart'; import 'package:mohem_flutter_app/ui/bottom_sheets/attendence_details_bottom_sheet.dart'; import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart'; import 'package:mohem_flutter_app/ui/landing/today_attendance_screen.dart'; +import 'package:mohem_flutter_app/ui/leave_balance/add_leave_balance_screen.dart'; +import 'package:mohem_flutter_app/ui/leave_balance/leave_balance_screen.dart'; import 'package:mohem_flutter_app/ui/login/forgot_password_screen.dart'; import 'package:mohem_flutter_app/ui/login/login_screen.dart'; import 'package:mohem_flutter_app/ui/login/new_password_screen.dart'; @@ -14,6 +16,14 @@ import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/services_menu_list_screen.dart'; +// import 'package:mohem_flutter_app/ui/my_attendance/my_attendance_screen.dart'; +import 'package:mohem_flutter_app/ui/my_team/create_request.dart'; +import 'package:mohem_flutter_app/ui/my_team/employee_details.dart'; +import 'package:mohem_flutter_app/ui/my_team/my_team.dart'; +import 'package:mohem_flutter_app/ui/my_team/profile_details.dart'; +import 'package:mohem_flutter_app/ui/my_team/subordinate_leave.dart'; +import 'package:mohem_flutter_app/ui/my_team/team_members.dart'; +import 'package:mohem_flutter_app/ui/my_team/view_attendance.dart'; import 'package:mohem_flutter_app/ui/payslip/monthly_pay_slip_screen.dart'; import 'package:mohem_flutter_app/ui/profile/add_update_family_member.dart'; import 'package:mohem_flutter_app/ui/profile/basic_details.dart'; @@ -46,6 +56,9 @@ import 'package:mohem_flutter_app/ui/work_list/item_history_screen.dart'; import 'package:mohem_flutter_app/ui/work_list/itg_detail_screen.dart'; import 'package:mohem_flutter_app/ui/work_list/work_list_screen.dart'; import 'package:mohem_flutter_app/ui/work_list/worklist_detail_screen.dart'; +import 'package:mohem_flutter_app/ui/my_team/my_team.dart'; +import 'package:mohem_flutter_app/ui/my_team/create_request.dart'; +import 'package:mohem_flutter_app/ui/work_list/worklist_settings.dart'; class AppRoutes { static const String splash = "/splash"; @@ -68,6 +81,11 @@ class AppRoutes { static const String workListDetail = "/workListDetail"; static const String itgDetail = "/itgDetail"; static const String itemHistory = "/itemHistory"; + static const String worklistSettings = "/worklistSettings"; + + // Leave Balance + static const String leaveBalance = "/leaveBalance"; + static const String addLeaveBalance = "/addLeaveBalance"; static const String servicesMenuListScreen = "/servicesMenuListScreen"; static const String dynamicScreen = "/dynamicScreen"; @@ -126,6 +144,16 @@ class AppRoutes { //Pay slip static const String monthlyPaySlip = "/monthlyPaySlip"; + //My Team + static const String myTeam = "/myTeam"; + static const String employeeDetails = "/employeeDetails"; + static const String profileDetails = "/profileDetails"; + static const String viewAttendance = "/viewAttendance"; + static const String teamMembers = "/teamMembers"; + static const String createRequest = "/createRequest"; + static const String subordinateLeave = "/subordinateLeave"; + + static final Map routes = { login: (context) => LoginScreen(), verifyLogin: (context) => VerifyLoginScreen(), @@ -145,6 +173,12 @@ class AppRoutes { workListDetail: (context) => WorkListDetailScreen(), itgDetail: (context) => ItgDetailScreen(), itemHistory: (context) => ItemHistoryScreen(), + worklistSettings: (context) => WorklistSettings(), + + // Leave Balance + + leaveBalance: (context) => LeaveBalance(), + addLeaveBalance: (context) => AddLeaveBalanceScreen(), servicesMenuListScreen: (context) => ServicesMenuListScreen(), // workFromHome: (context) => WorkFromHomeScreen(), @@ -200,5 +234,18 @@ class AppRoutes { //pay slip monthlyPaySlip: (context) => MonthlyPaySlipScreen(), + + //My Team + myTeam: (context) => MyTeam(), + employeeDetails: (context) => EmployeeDetails(), + profileDetails: (context) => ProfileDetails(), + viewAttendance: (context) => ViewAttendance(), + teamMembers: (context) => TeamMembers(), + createRequest: (context) => CreateRequest(), + subordinateLeave: (context) => SubordinateLeave(), + + + + }; } \ No newline at end of file diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 57323da..7452524 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -355,6 +355,24 @@ class CodegenLoader extends AssetLoader{ "pleaseSelectEmployeeForReplacement": "الرجاء تحديد موظف للاستبدال", "pleaseSelectAction": "الرجاء تحديد الإجراء", "pleaseSelectDate": "الرجاء تحديد التاريخ", + "todayAttendance": "حضور اليوم", + "viewAttendance": "عرض الحضور", + "teamMembers": "اعضاءالفريق", + "profileDetails": "الملف الشخصي", + "noResultsFound": "لايوجد نتائج", + "searchBy": "بحث بواسطة", + "myTeamMembers": "اعضاء فريقي", + "save": "حفظ", + "TurnNotificationsFor": "تفعيل الاشعارات", + "worklistSettings": "اعدادات الاشعارات", + "absenceType": "نوع الغياب", + "absenceCategory": "فئة الغياب", + "days": "أيام", + "hours": "ساعات", + "approvalStatus": "حالة القبول", + "absenceStatus": "حالة الغياب", + "subordinateLeave": "إجازة التابعيين", + "numberDays": "عدد الأيام", "profile": { "reset_password": { "label": "Reset Password", @@ -730,6 +748,24 @@ static const Map en_US = { "pleaseSelectEmployeeForReplacement": "Please select employee for replacement", "pleaseSelectAction": "Please select action", "pleaseSelectDate": "Please select date", + "todayAttendance": "Today's Attendance", + "viewAttendance": "View Attendance", + "teamMembers": "Team Members", + "profileDetails": "Profile Details", + "noResultsFound": "No Results Found", + "searchBy": "Search by", + "myTeamMembers": "My Team Members", + "save": "Save", + "TurnNotificationsFor": "Turn on notifications for", + "worklistSettings": "Worklist Settings", + "absenceType": "Absence Type", + "absenceCategory": "Absence Category", + "days": "Days", + "hours": "Hours", + "approvalStatus": "Approval Status", + "absenceStatus": "Absence Status", + "subordinateLeave": "Subordinate Leave", + "numberDays": "Number of days", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index d736c34..12fb29a 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -340,6 +340,24 @@ abstract class LocaleKeys { static const pleaseSelectEmployeeForReplacement = 'pleaseSelectEmployeeForReplacement'; static const pleaseSelectAction = 'pleaseSelectAction'; static const pleaseSelectDate = 'pleaseSelectDate'; + static const todayAttendance = 'todayAttendance'; + static const viewAttendance = 'viewAttendance'; + static const teamMembers = 'teamMembers'; + static const profileDetails = 'profileDetails'; + static const noResultsFound = 'noResultsFound'; + static const searchBy = 'searchBy'; + static const myTeamMembers = 'myTeamMembers'; + static const save = 'save'; + static const TurnNotificationsFor = 'TurnNotificationsFor'; + static const worklistSettings = 'worklistSettings'; + static const absenceType = 'absenceType'; + static const absenceCategory = 'absenceCategory'; + static const days = 'days'; + static const hours = 'hours'; + static const approvalStatus = 'approvalStatus'; + static const absenceStatus = 'absenceStatus'; + static const subordinateLeave = 'subordinateLeave'; + static const numberDays = 'numberDays'; 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/main.dart b/lib/main.dart index b1e74db..3ccb876 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,6 @@ import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; - import 'package:flutter/material.dart'; import 'package:logger/logger.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; @@ -61,7 +60,6 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return Sizer( builder: (context, orientation, deviceType) { - print(AppState().postParamsObject?.toJson()); var obj = AppState().postParamsObject; obj?.languageID = EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2; AppState().setPostParamsModel(obj!); diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 5d08161..11d7ec2 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -32,6 +32,15 @@ import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model. 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/get_time_card_summary_list_model.dart'; +import 'package:mohem_flutter_app/models/get_user_item_type_list.dart'; +import 'package:mohem_flutter_app/models/leave_balance/calculate_absence_duration_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/cancel_hr_transaction_list_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/get_absence_attendance_types_list_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/get_absence_dff_structure_list_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/get_absence_transaction_list_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/start_absence_approval_proccess_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/sumbit_absence_transaction_list_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/validate_absence_transaction_list_model.dart'; import 'package:mohem_flutter_app/models/member_information_list_model.dart'; import 'package:mohem_flutter_app/models/member_login_list_model.dart'; import 'package:mohem_flutter_app/models/monthly_pay_slip/get_deductions_List_model.dart'; @@ -51,6 +60,8 @@ import 'package:mohem_flutter_app/models/my_requests/get_ccp_dff_structure_model import 'package:mohem_flutter_app/models/my_requests/get_ccp_output_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_ccp_transactions_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_concurrent_programs_model.dart'; +import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; +import 'package:mohem_flutter_app/models/my_team/get_subordinates_leaves_total_vacations_list_model.dart'; import 'package:mohem_flutter_app/models/notification_action_model.dart'; import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; import 'package:mohem_flutter_app/models/pending_transactions/get_pending_transactions_details.dart'; @@ -71,6 +82,8 @@ import 'package:mohem_flutter_app/models/start_eit_approval_process_model.dart'; import 'package:mohem_flutter_app/models/start_phone_approval_process_model.dart'; import 'package:mohem_flutter_app/models/submit_eit_transaction_list_model.dart'; import 'package:mohem_flutter_app/models/subordinates_on_leaves_model.dart'; +import 'package:mohem_flutter_app/models/update_item_type_success_list.dart'; +import 'package:mohem_flutter_app/models/update_user_item_type_list.dart'; import 'package:mohem_flutter_app/models/vacation_rule/create_vacation_rule_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/get_item_type_notifications_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/get_notification_reassign_mode_list_model.dart'; @@ -120,8 +133,8 @@ class GenericResponseModel { String? bCLogo; BasicMemberInformationModel? basicMemberInformation; bool? businessCardPrivilege; - String? calculateAbsenceDuration; - String? cancelHRTransactionLIst; + CalculateAbsenceDuration? calculateAbsenceDuration; + CancelHRTransactionLIst? cancelHRTransactionLIst; String? chatEmployeeLoginList; String? companyBadge; String? companyImage; @@ -138,10 +151,10 @@ class GenericResponseModel { List? getCcpTransactionsListNew; List? getConcurrentProgramsList; List? getAbsenceAttachmentsList; - List? getAbsenceAttendanceTypesList; + List? getAbsenceAttendanceTypesList; List? getAbsenceCollectionNotificationBodyList; - List? getAbsenceDffStructureList; - List? getAbsenceTransactionList; + List? getAbsenceDffStructureList; + List? getAbsenceTransactionList; List? getAccrualBalancesList; List? getActionHistoryList; List? getAddressDffStructureList; @@ -172,7 +185,7 @@ class GenericResponseModel { List? getEmployeeBasicDetailsList; List? getEmployeeContactsList; List? getEmployeePhonesList; - List? getEmployeeSubordinatesList; + List? getEmployeeSubordinatesList; List? getFliexfieldStructureList; List? getHrCollectionNotificationBodyList; List? getHrTransactionList; @@ -214,7 +227,7 @@ class GenericResponseModel { List? getCCPDFFStructureModel; List? getSubordinatesAttdStatusList; List? getSubordinatesLeavesList; - List? getSubordinatesLeavesTotalVacationsList; + List?getSubordinatesLeavesTotalVacationsList; List? getSummaryOfPaymentList; List? getSwipesList; List? getTermColsStructureList; @@ -231,7 +244,7 @@ class GenericResponseModel { List? getDepartmentSections; List? getPendingTransactionsFunctions; List? getPendingTransactionsDetails; - List? getUserItemTypesList; + List? getUserItemTypesList; List? getVacationRulesList; List? getVaccinationOnHandList; List? getVaccinationsList; @@ -286,7 +299,7 @@ class GenericResponseModel { String? pForm; String? pINFORMATION; int? pMBLID; - String? pNUMOFSUBORDINATES; + int? pNUMOFSUBORDINATES; int? pOPENNTFNUMBER; String? pQUESTION; int? pSESSIONID; @@ -304,7 +317,7 @@ class GenericResponseModel { String? resubmitHrTransactionList; String? sFHGetPoNotificationBodyList; String? sFHGetPrNotificationBodyList; - String? startAbsenceApprovalProccess; + StartAbsenceApprovalProccess? startAbsenceApprovalProccess; StartAddressApprovalProcess? startAddressApprovalProcessList; String? startBasicDetApprProcessList; String? startCeiApprovalProcess; @@ -325,19 +338,19 @@ class GenericResponseModel { String? submitSITTransactionList; String? submitTermTransactionList; List? subordinatesOnLeavesList; - String? sumbitAbsenceTransactionList; + SumbitAbsenceTransactionList? sumbitAbsenceTransactionList; String? tokenID; String? updateAttachmentList; String? updateEmployeeImageList; - String? updateItemTypeSuccessList; - String? updateUserItemTypesList; + List? updateItemTypeSuccessList; + UpdateUserItemTypesList? updateUserItemTypesList; String? updateVacationRuleList; String? vHREmployeeLoginList; String? vHRGetEmployeeDetailsList; String? vHRGetManagersDetailsList; String? vHRGetProjectByCodeList; bool? vHRIsVerificationCodeValid; - String? validateAbsenceTransactionList; + ValidateAbsenceTransactionList? validateAbsenceTransactionList; ValidateEITTransactionList? validateEITTransactionList; String? validatePhonesTransactionList; List? vrItemTypesList; @@ -643,16 +656,16 @@ class GenericResponseModel { if (json['AddAttSuccessList'] != null) { addAttSuccessList = []; json['AddAttSuccessList'].forEach((v) { - addAttSuccessList!.add(new AddAttSuccessList.fromJson(v)); + addAttSuccessList!.add(AddAttSuccessList.fromJson(v)); }); } - addAttachmentList = json['AddAttachment_List'] != null ? new AddAttachmentList.fromJson(json['AddAttachment_List']) : null; + addAttachmentList = json['AddAttachment_List'] != null ? AddAttachmentList.fromJson(json['AddAttachment_List']) : null; bCDomain = json['BC_Domain']; bCLogo = json['BC_Logo']; - basicMemberInformation = json['BasicMemberInformation'] != null ? new BasicMemberInformationModel.fromJson(json['BasicMemberInformation']) : null; + basicMemberInformation = json['BasicMemberInformation'] != null ? BasicMemberInformationModel.fromJson(json['BasicMemberInformation']) : null; businessCardPrivilege = json['BusinessCardPrivilege']; - calculateAbsenceDuration = json['CalculateAbsenceDuration']; - cancelHRTransactionLIst = json['CancelHRTransactionLIst']; + calculateAbsenceDuration = json['CalculateAbsenceDuration'] != null ? new CalculateAbsenceDuration.fromJson(json['CalculateAbsenceDuration']) : null; + cancelHRTransactionLIst = json['CancelHRTransactionLIst'] != null ? new CancelHRTransactionLIst.fromJson(json['CancelHRTransactionLIst']) : null; chatEmployeeLoginList = json['Chat_EmployeeLoginList']; companyBadge = json['CompanyBadge']; companyImage = json['CompanyImage']; @@ -663,28 +676,46 @@ class GenericResponseModel { if (json['CountryList'] != null) { countryList = []; json['CountryList'].forEach((v) { - countryList!.add(new GetCountriesListModel.fromJson(v)); + countryList!.add(GetCountriesListModel.fromJson(v)); }); } - createVacationRuleList = json['CreateVacationRuleList'] != null ? new CreateVacationRuleList.fromJson(json['CreateVacationRuleList']) : null; + createVacationRuleList = json['CreateVacationRuleList'] != null ? CreateVacationRuleList.fromJson(json['CreateVacationRuleList']) : null; deleteAttachmentList = json['DeleteAttachmentList']; deleteVacationRuleList = json['DeleteVacationRuleList']; disableSessionList = json['DisableSessionList']; employeeQR = json['EmployeeQR']; forgetPasswordTokenID = json['ForgetPasswordTokenID']; getAbsenceAttachmentsList = json['GetAbsenceAttachmentsList']; - getAbsenceAttendanceTypesList = json['GetAbsenceAttendanceTypesList']; + + if (json['GetAbsenceAttendanceTypesList'] != null) { + getAbsenceAttendanceTypesList = []; + json['GetAbsenceAttendanceTypesList'].forEach((v) { + getAbsenceAttendanceTypesList!.add(GetAbsenceAttendanceTypesList.fromJson(v)); + }); + } if (json['GetAbsenceCollectionNotificationBodyList'] != null) { getAbsenceCollectionNotificationBodyList = []; json['GetAbsenceCollectionNotificationBodyList'].forEach((v) { - getAbsenceCollectionNotificationBodyList!.add(new GetAbsenceCollectionNotificationBodyList.fromJson(v)); + getAbsenceCollectionNotificationBodyList!.add(GetAbsenceCollectionNotificationBodyList.fromJson(v)); + }); + } + + if (json['GetAbsenceDffStructureList'] != null) { + getAbsenceDffStructureList = []; + json['GetAbsenceDffStructureList'].forEach((v) { + getAbsenceDffStructureList!.add(GetAbsenceDffStructureList.fromJson(v)); + }); + } + + if (json['GetAbsenceTransactionList'] != null) { + getAbsenceTransactionList = []; + json['GetAbsenceTransactionList'].forEach((v) { + getAbsenceTransactionList!.add(GetAbsenceTransactionList.fromJson(v)); }); } - getAbsenceDffStructureList = json['GetAbsenceDffStructureList']; - getAbsenceTransactionList = json['GetAbsenceTransactionList']; getAccrualBalancesList = json["GetAccrualBalancesList"] == null ? null : List.from(json["GetAccrualBalancesList"].map((x) => GetAccrualBalancesList.fromJson(x))); if (json['GetActionHistoryList'] != null) { @@ -697,7 +728,7 @@ class GenericResponseModel { if (json['GetAddressDffStructureList'] != null) { getAddressDffStructureList = []; json['GetAddressDffStructureList'].forEach((v) { - getAddressDffStructureList!.add(new GetAddressDffStructureList.fromJson(v)); + getAddressDffStructureList!.add(GetAddressDffStructureList.fromJson(v)); }); } getAddressNotificationBodyList = json['GetAddressNotificationBodyList']; @@ -705,41 +736,41 @@ class GenericResponseModel { if (json['GetApprovesList'] != null) { getApprovesList = []; json['GetApprovesList'].forEach((v) { - getApprovesList!.add(new GetApprovesList.fromJson(v)); + getApprovesList!.add(GetApprovesList.fromJson(v)); }); } if (json['GetAttachementList'] != null) { getAttachementList = []; json['GetAttachementList'].forEach((v) { - getAttachementList!.add(new GetAttachementList.fromJson(v)); + getAttachementList!.add(GetAttachementList.fromJson(v)); }); } getAttendanceTrackingList = json["GetAttendanceTrackingList"] == null ? null : GetAttendanceTracking.fromMap(json["GetAttendanceTrackingList"]); if (json['GetBasicDetColsStructureList'] != null) { getBasicDetColsStructureList = []; json['GetBasicDetColsStructureList'].forEach((v) { - getBasicDetColsStructureList!.add(new GetBasicDetColsStructureList.fromJson(v)); + getBasicDetColsStructureList!.add(GetBasicDetColsStructureList.fromJson(v)); }); } // getBasicDetDffStructureList = json['GetBasicDetDffStructureList']; if (json['GetBasicDetDffStructureList'] != null) { getBasicDetDffStructureList = []; json['GetBasicDetDffStructureList'].forEach((v) { - getBasicDetDffStructureList!.add(new GetBasicDetDffStructureList.fromJson(v)); + getBasicDetDffStructureList!.add(GetBasicDetDffStructureList.fromJson(v)); }); } if (json['GetContactDffStructureList'] != null) { getContactDffStructureList = []; json['GetContactDffStructureList'].forEach((v) { - getContactDffStructureList!.add(new GetContactDffStructureList.fromJson(v)); + getContactDffStructureList!.add(GetContactDffStructureList.fromJson(v)); }); } if (json['GetBasicDetNtfBodyList'] != null) { getBasicDetNtfBodyList = []; json['GetBasicDetNtfBodyList'].forEach((v) { - getBasicDetNtfBodyList!.add(new GetBasicDetNtfBodyList.fromJson(v)); + getBasicDetNtfBodyList!.add(GetBasicDetNtfBodyList.fromJson(v)); }); } @@ -750,13 +781,13 @@ class GenericResponseModel { if (json['GetContactDetailsList'] != null) { getContactDetailsList = []; json['GetContactDetailsList'].forEach((v) { - getContactDetailsList!.add(new GetContactDetailsList.fromJson(v)); + getContactDetailsList!.add(GetContactDetailsList.fromJson(v)); }); } if (json['GetContactColsStructureList'] != null) { getContactColsStructureList = []; json['GetContactColsStructureList'].forEach((v) { - getContactColsStructureList!.add(new GetContactColsStructureList.fromJson(v)); + getContactColsStructureList!.add(GetContactColsStructureList.fromJson(v)); }); } getContactColsStructureList = json['GetContactColsStructureList']; @@ -767,21 +798,21 @@ class GenericResponseModel { if (json['GetCountriesList'] != null) { getCountriesList = []; json['GetCountriesList'].forEach((v) { - getCountriesList!.add(new GetCountriesListModel.fromJson(v)); + getCountriesList!.add(GetCountriesListModel.fromJson(v)); }); } if (json['GetDayHoursTypeDetailsList'] != null) { getDayHoursTypeDetailsList = []; json['GetDayHoursTypeDetailsList'].forEach((v) { - getDayHoursTypeDetailsList!.add(new GetDayHoursTypeDetailsList.fromJson(v)); + getDayHoursTypeDetailsList!.add(GetDayHoursTypeDetailsList.fromJson(v)); }); } if (json['GetDeductionsList'] != null) { getDeductionsList = []; json['GetDeductionsList'].forEach((v) { - getDeductionsList!.add(new GetDeductionsList.fromJson(v)); + getDeductionsList!.add(GetDeductionsList.fromJson(v)); }); } getDefaultValueList = json['GetDefaultValueList'] != null ? GetDefaultValueList.fromJson(json['GetDefaultValueList']) : null; @@ -791,57 +822,62 @@ class GenericResponseModel { if (json['GetEITDFFStructureList'] != null) { getEITDFFStructureList = []; json['GetEITDFFStructureList'].forEach((v) { - getEITDFFStructureList!.add(new GetEITDFFStructureList.fromJson(v)); + getEITDFFStructureList!.add(GetEITDFFStructureList.fromJson(v)); }); } if (json['GetEITTransactionList'] != null) { getEITTransactionList = []; json['GetEITTransactionList'].forEach((v) { - getEITTransactionList!.add(new GetEITTransactionList.fromJson(v)); + getEITTransactionList!.add(GetEITTransactionList.fromJson(v)); }); } if (json['GetEarningsList'] != null) { getEarningsList = []; json['GetEarningsList'].forEach((v) { - getEarningsList!.add(new GetEarningsList.fromJson(v)); + getEarningsList!.add(GetEarningsList.fromJson(v)); }); } if (json['GetEmployeeAddressList'] != null) { getEmployeeAddressList = []; json['GetEmployeeAddressList'].forEach((v) { - getEmployeeAddressList!.add(new GetEmployeeAddressList.fromJson(v)); + getEmployeeAddressList!.add(GetEmployeeAddressList.fromJson(v)); }); } if (json['GetEmployeeBasicDetailsList'] != null) { getEmployeeBasicDetailsList = []; json['GetEmployeeBasicDetailsList'].forEach((v) { - getEmployeeBasicDetailsList!.add(new GetEmployeeBasicDetailsList.fromJson(v)); + getEmployeeBasicDetailsList!.add(GetEmployeeBasicDetailsList.fromJson(v)); }); } if (json['GetEmployeeContactsList'] != null) { getEmployeeContactsList = []; json['GetEmployeeContactsList'].forEach((v) { - getEmployeeContactsList!.add(new GetEmployeeContactsList.fromJson(v)); + getEmployeeContactsList!.add(GetEmployeeContactsList.fromJson(v)); }); } if (json['GetEmployeePhonesList'] != null) { getEmployeePhonesList = []; json['GetEmployeePhonesList'].forEach((v) { - getEmployeePhonesList!.add(new GetEmployeePhonesList.fromJson(v)); + getEmployeePhonesList!.add(GetEmployeePhonesList.fromJson(v)); + }); + } + if (json['GetEmployeeSubordinatesList'] != null) { + getEmployeeSubordinatesList = []; + json['GetEmployeeSubordinatesList'].forEach((v) { + getEmployeeSubordinatesList!.add(new GetEmployeeSubordinatesList.fromJson(v)); }); } - getEmployeeSubordinatesList = json['GetEmployeeSubordinatesList']; getFliexfieldStructureList = json['GetFliexfieldStructureList']; getHrCollectionNotificationBodyList = json['GetHrCollectionNotificationBodyList']; getHrTransactionList = json['GetHrTransactionList']; - getItemCreationNtfBodyList = json['GetItemCreationNtfBodyList'] != null ? new GetItemCreationNtfBodyList.fromJson(json['GetItemCreationNtfBodyList']) : null; + getItemCreationNtfBodyList = json['GetItemCreationNtfBodyList'] != null ? GetItemCreationNtfBodyList.fromJson(json['GetItemCreationNtfBodyList']) : null; if (json['GetItemTypeNotificationsList'] != null) { getItemTypeNotificationsList = []; json['GetItemTypeNotificationsList'].forEach((v) { - getItemTypeNotificationsList!.add(new GetItemTypeNotificationsList.fromJson(v)); + getItemTypeNotificationsList!.add(GetItemTypeNotificationsList.fromJson(v)); }); } @@ -851,14 +887,14 @@ class GenericResponseModel { if (json['GetMoItemHistoryList'] != null) { getMoItemHistoryList = []; json['GetMoItemHistoryList'].forEach((v) { - getMoItemHistoryList!.add(new GetMoItemHistoryList.fromJson(v)); + getMoItemHistoryList!.add(GetMoItemHistoryList.fromJson(v)); }); } if (json['GetMoNotificationBodyList'] != null) { getMoNotificationBodyList = []; json['GetMoNotificationBodyList'].forEach((v) { - getMoNotificationBodyList!.add(new GetMoNotificationBodyList.fromJson(v)); + getMoNotificationBodyList!.add(GetMoNotificationBodyList.fromJson(v)); }); } @@ -892,14 +928,14 @@ class GenericResponseModel { if (json['GetPaymentInformationList'] != null) { getPaymentInformationList = []; json['GetPaymentInformationList'].forEach((v) { - getPaymentInformationList!.add(new GetPaymentInformationList.fromJson(v)); + getPaymentInformationList!.add(GetPaymentInformationList.fromJson(v)); }); } if (json['GetPayslipList'] != null) { getPayslipList = []; json['GetPayslipList'].forEach((v) { - getPayslipList!.add(new GetPayslipList.fromJson(v)); + getPayslipList!.add(GetPayslipList.fromJson(v)); }); } // getPendingReqDetailsList = json['GetPendingReqDetailsList']; @@ -910,15 +946,15 @@ class GenericResponseModel { if (json['GetPoItemHistoryList'] != null) { getPoItemHistoryList = []; json['GetPoItemHistoryList'].forEach((v) { - getPoItemHistoryList!.add(new GetPoItemHistoryList.fromJson(v)); + getPoItemHistoryList!.add(GetPoItemHistoryList.fromJson(v)); }); } - getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null ? new GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) : null; + getPoNotificationBodyList = json['GetPoNotificationBodyList'] != null ? GetPoNotificationBodyList.fromJson(json['GetPoNotificationBodyList']) : null; getPrNotificationBodyList = json['GetPrNotificationBodyList']; if (json['GetQuotationAnalysisList'] != null) { getQuotationAnalysisList = []; json['GetQuotationAnalysisList'].forEach((v) { - getQuotationAnalysisList!.add(new GetQuotationAnalysisList.fromJson(v)); + getQuotationAnalysisList!.add(GetQuotationAnalysisList.fromJson(v)); }); } getRFCEmployeeListList = json['GetRFCEmployeeListList']; @@ -929,7 +965,7 @@ class GenericResponseModel { if (json['GetScheduleShiftsDetailsList'] != null) { getScheduleShiftsDetailsList = []; json['GetScheduleShiftsDetailsList'].forEach((v) { - getScheduleShiftsDetailsList!.add(new GetScheduleShiftsDetailsList.fromJson(v)); + getScheduleShiftsDetailsList!.add(GetScheduleShiftsDetailsList.fromJson(v)); }); } getShiftTypesList = json['GetShiftTypesList']; @@ -937,13 +973,13 @@ class GenericResponseModel { if (json['GetStampMsNotificationBodyList'] != null) { getStampMsNotificationBodyList = []; json['GetStampMsNotificationBodyList'].forEach((v) { - getStampMsNotificationBodyList!.add(new GetStampMsNotificationBodyList.fromJson(v)); + getStampMsNotificationBodyList!.add(GetStampMsNotificationBodyList.fromJson(v)); }); } if (json['GetStampNsNotificationBodyList'] != null) { getStampNsNotificationBodyList = []; json['GetStampNsNotificationBodyList'].forEach((v) { - getStampNsNotificationBodyList!.add(new GetStampNsNotificationBodyList.fromJson(v)); + getStampNsNotificationBodyList!.add(GetStampNsNotificationBodyList.fromJson(v)); }); } @@ -956,11 +992,18 @@ class GenericResponseModel { }); } - getSubordinatesLeavesTotalVacationsList = json['GetSubordinatesLeavesTotalVacationsList']; + if (json['GetSubordinatesLeavesTotalVacationsList'] != null) { + getSubordinatesLeavesTotalVacationsList = + []; + json['GetSubordinatesLeavesTotalVacationsList'].forEach((v) { + getSubordinatesLeavesTotalVacationsList! + .add(new GetSubordinatesLeavesTotalVacationsList.fromJson(v)); + }); + } if (json['GetSummaryOfPaymentList'] != null) { getSummaryOfPaymentList = []; json['GetSummaryOfPaymentList'].forEach((v) { - getSummaryOfPaymentList!.add(new GetSummaryOfPaymentList.fromJson(v)); + getSummaryOfPaymentList!.add(GetSummaryOfPaymentList.fromJson(v)); }); } getSwipesList = json['GetSwipesList']; @@ -1070,7 +1113,12 @@ class GenericResponseModel { getCCPOutputModel = GetCCPOutputModel.fromJson(json['GetCcpOutputList']); } - getUserItemTypesList = json['GetUserItemTypesList']; + if (json['GetUserItemTypesList'] != null) { + getUserItemTypesList = []; + json['GetUserItemTypesList'].forEach((v) { + getUserItemTypesList!.add(new GetUserItemTypesList.fromJson(v)); + }); + } if (json['GetVacationRulesList'] != null) { getVacationRulesList = []; json['GetVacationRulesList'].forEach((v) { @@ -1189,7 +1237,7 @@ class GenericResponseModel { if (json['RespondAttributesList'] != null) { respondAttributesList = []; json['RespondAttributesList'].forEach((v) { - respondAttributesList!.add(new RespondAttributesList.fromJson(v)); + respondAttributesList!.add(RespondAttributesList.fromJson(v)); }); } if (json['RespondRolesList'] != null) { @@ -1203,26 +1251,26 @@ class GenericResponseModel { resubmitHrTransactionList = json['ResubmitHrTransactionList']; sFHGetPoNotificationBodyList = json['SFH_GetPoNotificationBodyList']; sFHGetPrNotificationBodyList = json['SFH_GetPrNotificationBodyList']; - startAbsenceApprovalProccess = json['StartAbsenceApprovalProccess']; - startAddressApprovalProcessList = json['StartAddressApprovalProcessList'] != null ? new StartAddressApprovalProcess.fromJson(json['StartAddressApprovalProcessList']) : null; + startAbsenceApprovalProccess = json['StartAbsenceApprovalProccess'] != null ? StartAbsenceApprovalProccess.fromJson(json['StartAbsenceApprovalProccess']) : null; + startAddressApprovalProcessList = json['StartAddressApprovalProcessList'] != null ? StartAddressApprovalProcess.fromJson(json['StartAddressApprovalProcessList']) : null; startBasicDetApprProcessList = json['StartBasicDetApprProcessList']; startCeiApprovalProcess = json['StartCeiApprovalProcess']; startContactApprovalProcessList = json['StartContactApprovalProcessList']; - startEitApprovalProcess = json['StartEitApprovalProcess'] != null ? new StartEitApprovalProcess.fromJson(json['StartEitApprovalProcess']) : null; + startEitApprovalProcess = json['StartEitApprovalProcess'] != null ? StartEitApprovalProcess.fromJson(json['StartEitApprovalProcess']) : null; startHrApprovalProcessList = json['StartHrApprovalProcessList']; - startPhonesApprovalProcessList = json['StartPhonesApprovalProcessList'] != null ? new StartPhoneApprovalProcess.fromJson(json['startPhonesApprovalProcessList']) : null; + startPhonesApprovalProcessList = json['StartPhonesApprovalProcessList'] != null ? StartPhoneApprovalProcess.fromJson(json['startPhonesApprovalProcessList']) : null; startSitApprovalProcess = json['StartSitApprovalProcess']; startTermApprovalProcessList = json['StartTermApprovalProcessList']; - submitAddressTransactionList = json['SubmitAddressTransactionList'] != null ? new SubmitAddressTransaction.fromJson(json['SubmitAddressTransactionList']) : null; - submitBasicDetTransactionList = json['SubmitBasicDetTransactionList'] != null ? new SubmitBasicDetailsTransactionList.fromJson(json['SubmitBasicDetTransactionList']) : null; + submitAddressTransactionList = json['SubmitAddressTransactionList'] != null ? SubmitAddressTransaction.fromJson(json['SubmitAddressTransactionList']) : null; + submitBasicDetTransactionList = json['SubmitBasicDetTransactionList'] != null ? SubmitBasicDetailsTransactionList.fromJson(json['SubmitBasicDetTransactionList']) : null; submitCEITransactionList = json['SubmitCEITransactionList']; submitCcpTransactionList = json['SubmitCcpTransactionList']; - submitContactTransactionList = json['SubmitContactTransactionList'] != null ? new SubmitContactTransactionList.fromJson(json['SubmitContactTransactionList']) : null; - submitEITTransactionList = json['SubmitEITTransactionList'] != null ? new SubmitEITTransactionList.fromJson(json['SubmitEITTransactionList']) : null; + submitContactTransactionList = json['SubmitContactTransactionList'] != null ? SubmitContactTransactionList.fromJson(json['SubmitContactTransactionList']) : null; + submitEITTransactionList = json['SubmitEITTransactionList'] != null ? SubmitEITTransactionList.fromJson(json['SubmitEITTransactionList']) : null; submitHrTransactionList = json['SubmitHrTransactionList']; submitPhonesTransactionList = json['SubmitPhonesTransactionList']; @@ -1237,21 +1285,28 @@ class GenericResponseModel { }); } - sumbitAbsenceTransactionList = json['SumbitAbsenceTransactionList']; + sumbitAbsenceTransactionList = json['SumbitAbsenceTransactionList'] != null ? new SumbitAbsenceTransactionList.fromJson(json['SumbitAbsenceTransactionList']) : null; + tokenID = json['TokenID']; updateAttachmentList = json['UpdateAttachmentList']; updateEmployeeImageList = json['UpdateEmployeeImageList']; - updateItemTypeSuccessList = json['UpdateItemTypeSuccessList']; - updateUserItemTypesList = json['UpdateUserItemTypesList']; + if (json['UpdateItemTypeSuccessList'] != null) { + updateItemTypeSuccessList = []; + json['UpdateItemTypeSuccessList'].forEach((v) { + updateItemTypeSuccessList!.add(new UpdateItemTypeSuccessList.fromJson(v)); + }); + } + updateUserItemTypesList = json['UpdateUserItemTypesList'] != null ? new UpdateUserItemTypesList.fromJson(json['UpdateUserItemTypesList']) : null; updateVacationRuleList = json['UpdateVacationRuleList']; vHREmployeeLoginList = json['VHR_EmployeeLoginList']; vHRGetEmployeeDetailsList = json['VHR_GetEmployeeDetailsList']; vHRGetManagersDetailsList = json['VHR_GetManagersDetailsList']; vHRGetProjectByCodeList = json['VHR_GetProjectByCodeList']; vHRIsVerificationCodeValid = json['VHR_IsVerificationCodeValid']; - validateAbsenceTransactionList = json['ValidateAbsenceTransactionList']; - validateEITTransactionList = json['ValidateEITTransactionList'] != null ? new ValidateEITTransactionList.fromJson(json['ValidateEITTransactionList']) : null; + validateAbsenceTransactionList = json['ValidateAbsenceTransactionList'] != null ? ValidateAbsenceTransactionList.fromJson(json['ValidateAbsenceTransactionList']) : null; + + validateEITTransactionList = json['ValidateEITTransactionList'] != null ? ValidateEITTransactionList.fromJson(json['ValidateEITTransactionList']) : null; validatePhonesTransactionList = json['ValidatePhonesTransactionList']; if (json['VrItemTypesList'] != null) { @@ -1263,7 +1318,7 @@ class GenericResponseModel { if (json['WFLookUpList'] != null) { wFLookUpList = []; json['WFLookUpList'].forEach((v) { - wFLookUpList!.add(new WFLookUpList.fromJson(v)); + wFLookUpList!.add(WFLookUpList.fromJson(v)); }); } eLearningGETEMPLOYEEPROFILEList = json['eLearning_GET_EMPLOYEE_PROFILEList']; @@ -1276,7 +1331,7 @@ class GenericResponseModel { } Map toJson() { - Map data = new Map(); + Map data = Map(); data['Date'] = this.date; data['LanguageID'] = this.languageID; data['ServiceName'] = this.serviceName; @@ -1317,8 +1372,12 @@ class GenericResponseModel { data['BasicMemberInformation'] = this.basicMemberInformation!.toJson(); } data['BusinessCardPrivilege'] = this.businessCardPrivilege; - data['CalculateAbsenceDuration'] = this.calculateAbsenceDuration; - data['CancelHRTransactionLIst'] = this.cancelHRTransactionLIst; + if (this.calculateAbsenceDuration != null) { + data['CalculateAbsenceDuration'] = this.calculateAbsenceDuration!.toJson(); + } + if (this.cancelHRTransactionLIst != null) { + data['CancelHRTransactionLIst'] = this.calculateAbsenceDuration!.toJson(); + } data['Chat_EmployeeLoginList'] = this.chatEmployeeLoginList; data['CompanyBadge'] = this.companyBadge; data['CompanyImage'] = this.companyImage; @@ -1338,14 +1397,22 @@ class GenericResponseModel { data['EmployeeQR'] = this.employeeQR; data['ForgetPasswordTokenID'] = this.forgetPasswordTokenID; data['GetAbsenceAttachmentsList'] = this.getAbsenceAttachmentsList; - data['GetAbsenceAttendanceTypesList'] = this.getAbsenceAttendanceTypesList; + + if (this.getAbsenceAttendanceTypesList != null) { + data['GetAbsenceAttendanceTypesList'] = this.getAbsenceAttendanceTypesList!.map((v) => v.toJson()).toList(); + } if (this.getAbsenceCollectionNotificationBodyList != null) { data['GetAbsenceCollectionNotificationBodyList'] = this.getAbsenceCollectionNotificationBodyList!.map((v) => v.toJson()).toList(); } - data['GetAbsenceDffStructureList'] = this.getAbsenceDffStructureList; - data['GetAbsenceTransactionList'] = this.getAbsenceTransactionList; + if (this.getAbsenceDffStructureList != null) { + data['GetAbsenceDffStructureList'] = this.getAbsenceDffStructureList!.map((v) => v.toJson()).toList(); + } + + if (this.getAbsenceTransactionList != null) { + data['GetAbsenceTransactionList'] = this.getAbsenceTransactionList!.map((v) => v.toJson()).toList(); + } data['GetAccrualBalancesList'] = this.getAccrualBalancesList; if (this.getActionHistoryList != null) { @@ -1422,7 +1489,9 @@ class GenericResponseModel { if (this.getEmployeePhonesList != null) { data['GetEmployeePhonesList'] = this.getEmployeePhonesList!.map((v) => v.toJson()).toList(); } - data['GetEmployeeSubordinatesList'] = this.getEmployeeSubordinatesList; + if (this.getEmployeeSubordinatesList != null) { + data['GetEmployeeSubordinatesList'] = this.getEmployeeSubordinatesList!.map((v) => v.toJson()).toList(); + } data['GetFliexfieldStructureList'] = this.getFliexfieldStructureList; data['GetHrCollectionNotificationBodyList'] = this.getHrCollectionNotificationBodyList; data['GetHrTransactionList'] = this.getHrTransactionList; @@ -1507,7 +1576,12 @@ class GenericResponseModel { data['GetSubordinatesLeavesList'] = this.getSubordinatesLeavesList!.map((v) => v.toJson()).toList(); } - data['GetSubordinatesLeavesTotalVacationsList'] = this.getSubordinatesLeavesTotalVacationsList; + if (this.getSubordinatesLeavesTotalVacationsList != null) { + data['GetSubordinatesLeavesTotalVacationsList'] = this + .getSubordinatesLeavesTotalVacationsList! + .map((v) => v.toJson()) + .toList(); + } if (this.getSummaryOfPaymentList != null) { data['GetSummaryOfPaymentList'] = this.getSummaryOfPaymentList!.map((v) => v.toJson()).toList(); } @@ -1616,7 +1690,9 @@ class GenericResponseModel { data['ResubmitHrTransactionList'] = this.resubmitHrTransactionList; data['SFH_GetPoNotificationBodyList'] = this.sFHGetPoNotificationBodyList; data['SFH_GetPrNotificationBodyList'] = this.sFHGetPrNotificationBodyList; - data['StartAbsenceApprovalProccess'] = this.startAbsenceApprovalProccess; + if (this.startAbsenceApprovalProccess != null) { + data['StartAbsenceApprovalProccess'] = this.startAbsenceApprovalProccess!.toJson(); + } data['StartAddressApprovalProcessList'] = this.startAddressApprovalProcessList; data['StartBasicDetApprProcessList'] = this.startBasicDetApprProcessList; data['StartCeiApprovalProcess'] = this.startCeiApprovalProcess; @@ -1655,20 +1731,28 @@ class GenericResponseModel { data['SubordinatesOnLeavesList'] = this.subordinatesOnLeavesList!.map((v) => v.toJson()).toList(); } - data['SumbitAbsenceTransactionList'] = this.sumbitAbsenceTransactionList; + if (this.sumbitAbsenceTransactionList != null) { + data['SumbitAbsenceTransactionList'] = this.sumbitAbsenceTransactionList!.toJson(); + } data['TokenID'] = this.tokenID; data['UpdateAttachmentList'] = this.updateAttachmentList; data['UpdateEmployeeImageList'] = this.updateEmployeeImageList; - data['UpdateItemTypeSuccessList'] = this.updateItemTypeSuccessList; - data['UpdateUserItemTypesList'] = this.updateUserItemTypesList; + if (this.updateItemTypeSuccessList != null) { + data['UpdateItemTypeSuccessList'] = this.updateItemTypeSuccessList!.map((v) => v.toJson()).toList(); + } + if (this.updateUserItemTypesList != null) { + data['UpdateUserItemTypesList'] = this.updateUserItemTypesList!.toJson(); + } data['UpdateVacationRuleList'] = this.updateVacationRuleList; data['VHR_EmployeeLoginList'] = this.vHREmployeeLoginList; data['VHR_GetEmployeeDetailsList'] = this.vHRGetEmployeeDetailsList; data['VHR_GetManagersDetailsList'] = this.vHRGetManagersDetailsList; data['VHR_GetProjectByCodeList'] = this.vHRGetProjectByCodeList; data['VHR_IsVerificationCodeValid'] = this.vHRIsVerificationCodeValid; - data['ValidateAbsenceTransactionList'] = this.validateAbsenceTransactionList; + if (validateAbsenceTransactionList != null) { + data['ValidateAbsenceTransactionList'] = validateAbsenceTransactionList!.toJson(); + } if (validateEITTransactionList != null) { data['ValidateEITTransactionList'] = validateEITTransactionList!.toJson(); } diff --git a/lib/models/get_user_item_type_list.dart b/lib/models/get_user_item_type_list.dart new file mode 100644 index 0000000..b21748e --- /dev/null +++ b/lib/models/get_user_item_type_list.dart @@ -0,0 +1,35 @@ + + +class GetUserItemTypesList { + String? fYAENABLEDFALG; + String? fYIENABLEDFLAG; + String? iTEMTYPE; + int? uSERITEMTYPEID; + bool? isFYI; + bool? isFYA; + + GetUserItemTypesList( + {this.fYAENABLEDFALG, + this.fYIENABLEDFLAG, + this.iTEMTYPE, + this.uSERITEMTYPEID, + this.isFYI, + this.isFYA + }); + + GetUserItemTypesList.fromJson(Map json) { + fYAENABLEDFALG = json['FYA_ENABLED_FALG']; + fYIENABLEDFLAG = json['FYI_ENABLED_FLAG']; + iTEMTYPE = json['ITEM_TYPE']; + uSERITEMTYPEID = json['USER_ITEM_TYPE_ID']; + } + + Map toJson() { + Map data = new Map(); + data['FYA_ENABLED_FALG'] = this.fYAENABLEDFALG; + data['FYI_ENABLED_FLAG'] = this.fYIENABLEDFLAG; + data['ITEM_TYPE'] = this.iTEMTYPE; + data['USER_ITEM_TYPE_ID'] = this.uSERITEMTYPEID; + return data; + } +} \ No newline at end of file diff --git a/lib/models/leave_balance/calculate_absence_duration_model.dart b/lib/models/leave_balance/calculate_absence_duration_model.dart new file mode 100644 index 0000000..b16b4c3 --- /dev/null +++ b/lib/models/leave_balance/calculate_absence_duration_model.dart @@ -0,0 +1,24 @@ +class CalculateAbsenceDuration { + int? pABSENCEDAYS; + int? pABSENCEHOURS; + String? pRETURNMSG; + String? pRETURNSTATUS; + + CalculateAbsenceDuration({this.pABSENCEDAYS, this.pABSENCEHOURS, this.pRETURNMSG, this.pRETURNSTATUS}); + + CalculateAbsenceDuration.fromJson(Map json) { + pABSENCEDAYS = json['P_ABSENCE_DAYS']; + pABSENCEHOURS = json['P_ABSENCE_HOURS']; + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + } + + Map toJson() { + Map data = new Map(); + data['P_ABSENCE_DAYS'] = this.pABSENCEDAYS; + data['P_ABSENCE_HOURS'] = this.pABSENCEHOURS; + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + return data; + } +} diff --git a/lib/models/leave_balance/cancel_hr_transaction_list_model.dart b/lib/models/leave_balance/cancel_hr_transaction_list_model.dart new file mode 100644 index 0000000..86383ee --- /dev/null +++ b/lib/models/leave_balance/cancel_hr_transaction_list_model.dart @@ -0,0 +1,18 @@ +class CancelHRTransactionLIst { + String? pRETURNMSG; + String? pRETURNSTATUS; + + CancelHRTransactionLIst({this.pRETURNMSG, this.pRETURNSTATUS}); + + CancelHRTransactionLIst.fromJson(Map json) { + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + } + + Map toJson() { + Map data = new Map(); + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + return data; + } +} diff --git a/lib/models/leave_balance/get_absence_attendance_types_list_model.dart b/lib/models/leave_balance/get_absence_attendance_types_list_model.dart new file mode 100644 index 0000000..ccfb0dc --- /dev/null +++ b/lib/models/leave_balance/get_absence_attendance_types_list_model.dart @@ -0,0 +1,24 @@ +class GetAbsenceAttendanceTypesList { + int? aBSENCEATTENDANCETYPEID; + String? aBSENCEATTENDANCETYPENAME; + String? dESCFLEXCONTEXTCODE; + String? hOURSORDAYS; + + GetAbsenceAttendanceTypesList({this.aBSENCEATTENDANCETYPEID, this.aBSENCEATTENDANCETYPENAME, this.dESCFLEXCONTEXTCODE, this.hOURSORDAYS}); + + GetAbsenceAttendanceTypesList.fromJson(Map json) { + aBSENCEATTENDANCETYPEID = json['ABSENCE_ATTENDANCE_TYPE_ID']; + aBSENCEATTENDANCETYPENAME = json['ABSENCE_ATTENDANCE_TYPE_NAME']; + dESCFLEXCONTEXTCODE = json['DESC_FLEX_CONTEXT_CODE']; + hOURSORDAYS = json['HOURS_OR_DAYS']; + } + + Map toJson() { + Map data = new Map(); + data['ABSENCE_ATTENDANCE_TYPE_ID'] = this.aBSENCEATTENDANCETYPEID; + data['ABSENCE_ATTENDANCE_TYPE_NAME'] = this.aBSENCEATTENDANCETYPENAME; + data['DESC_FLEX_CONTEXT_CODE'] = this.dESCFLEXCONTEXTCODE; + data['HOURS_OR_DAYS'] = this.hOURSORDAYS; + return data; + } +} diff --git a/lib/models/leave_balance/get_absence_dff_structure_list_model.dart b/lib/models/leave_balance/get_absence_dff_structure_list_model.dart new file mode 100644 index 0000000..81bc671 --- /dev/null +++ b/lib/models/leave_balance/get_absence_dff_structure_list_model.dart @@ -0,0 +1,195 @@ +import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; + +class GetAbsenceDffStructureList { + String? aLPHANUMERICALLOWEDFLAG; + String? aPPLICATIONCOLUMNNAME; + String? cHILDSEGMENTSDV; + List? cHILDSEGMENTSDVSplited; + String? cHILDSEGMENTSVS; + List? cHILDSEGMENTSVSSplited; + String? dEFAULTTYPE; + String? dEFAULTVALUE; + String? dESCFLEXCONTEXTCODE; + String? dESCFLEXCONTEXTNAME; + String? dESCFLEXNAME; + String? dISPLAYFLAG; + String? eNABLEDFLAG; + ESERVICESDV? eSERVICESDV; + List? eSERVICESVS; + String? fLEXVALUESETNAME; + String? fORMATTYPE; + String? fORMATTYPEDSP; + bool? isEmptyOption; + String? lONGLISTFLAG; + int? mAXIMUMSIZE; + String? mAXIMUMVALUE; + String? mINIMUMVALUE; + String? mOBILEENABLED; + String? nUMBERPRECISION; + String? nUMERICMODEENABLEDFLAG; + String? pARENTSEGMENTSDV; + List? pARENTSEGMENTSDVSplited; + String? pARENTSEGMENTSVS; + List? pARENTSEGMENTSVSSplitedVS; + String? rEADONLY; + String? rEQUIREDFLAG; + String? sEGMENTNAME; + String? sEGMENTPROMPT; + int? sEGMENTSEQNUM; + String? uPPERCASEONLYFLAG; + String? uSEDFLAG; + String? vALIDATIONTYPE; + String? vALIDATIONTYPEDSP; + + GetAbsenceDffStructureList( + {this.aLPHANUMERICALLOWEDFLAG, + this.aPPLICATIONCOLUMNNAME, + this.cHILDSEGMENTSDV, + this.cHILDSEGMENTSDVSplited, + this.cHILDSEGMENTSVS, + this.cHILDSEGMENTSVSSplited, + this.dEFAULTTYPE, + this.dEFAULTVALUE, + this.dESCFLEXCONTEXTCODE, + this.dESCFLEXCONTEXTNAME, + this.dESCFLEXNAME, + this.dISPLAYFLAG, + this.eNABLEDFLAG, + this.eSERVICESDV, + this.eSERVICESVS, + this.fLEXVALUESETNAME, + this.fORMATTYPE, + this.fORMATTYPEDSP, + this.isEmptyOption, + this.lONGLISTFLAG, + this.mAXIMUMSIZE, + this.mAXIMUMVALUE, + this.mINIMUMVALUE, + this.mOBILEENABLED, + this.nUMBERPRECISION, + this.nUMERICMODEENABLEDFLAG, + this.pARENTSEGMENTSDV, + this.pARENTSEGMENTSDVSplited, + this.pARENTSEGMENTSVS, + this.pARENTSEGMENTSVSSplitedVS, + this.rEADONLY, + this.rEQUIREDFLAG, + this.sEGMENTNAME, + this.sEGMENTPROMPT, + this.sEGMENTSEQNUM, + this.uPPERCASEONLYFLAG, + this.uSEDFLAG, + this.vALIDATIONTYPE, + this.vALIDATIONTYPEDSP}); + + GetAbsenceDffStructureList.fromJson(Map json) { + aLPHANUMERICALLOWEDFLAG = json['ALPHANUMERIC_ALLOWED_FLAG']; + aPPLICATIONCOLUMNNAME = json['APPLICATION_COLUMN_NAME']; + cHILDSEGMENTSDV = json['CHILD_SEGMENTS_DV']; + cHILDSEGMENTSDVSplited = json['CHILD_SEGMENTS_DV_Splited'] == null ? [] : json['CHILD_SEGMENTS_DV_Splited'].cast(); + cHILDSEGMENTSVS = json['CHILD_SEGMENTS_VS']; + cHILDSEGMENTSVSSplited = json['CHILD_SEGMENTS_VS_Splited']== null ? [] : json['CHILD_SEGMENTS_VS_Splited'].cast(); + dEFAULTTYPE = json['DEFAULT_TYPE']; + dEFAULTVALUE = json['DEFAULT_VALUE']; + dESCFLEXCONTEXTCODE = json['DESC_FLEX_CONTEXT_CODE']; + dESCFLEXCONTEXTNAME = json['DESC_FLEX_CONTEXT_NAME']; + dESCFLEXNAME = json['DESC_FLEX_NAME']; + dISPLAYFLAG = json['DISPLAY_FLAG']; + eNABLEDFLAG = json['ENABLED_FLAG']; + eSERVICESDV = json['E_SERVICES_DV'] != null ? new ESERVICESDV.fromJson(json['E_SERVICES_DV']) : null; + if (json['E_SERVICES_VS'] != null) { + eSERVICESVS = []; + json['E_SERVICES_VS'].forEach((v) { + eSERVICESVS!.add(new ESERVICESVS.fromJson(v)); + }); + } + fLEXVALUESETNAME = json['FLEX_VALUE_SET_NAME']; + fORMATTYPE = json['FORMAT_TYPE']; + fORMATTYPEDSP = json['FORMAT_TYPE_DSP']; + isEmptyOption = json['IsEmptyOption']; + lONGLISTFLAG = json['LONGLIST_FLAG']; + mAXIMUMSIZE = json['MAXIMUM_SIZE']; + mAXIMUMVALUE = json['MAXIMUM_VALUE']; + mINIMUMVALUE = json['MINIMUM_VALUE']; + mOBILEENABLED = json['MOBILE_ENABLED']; + nUMBERPRECISION = json['NUMBER_PRECISION']; + nUMERICMODEENABLEDFLAG = json['NUMERIC_MODE_ENABLED_FLAG']; + pARENTSEGMENTSDV = json['PARENT_SEGMENTS_DV']; + if (json['PARENT_SEGMENTS_DV_Splited'] != null) { + pARENTSEGMENTSDVSplited = []; + json['PARENT_SEGMENTS_DV_Splited'].forEach((v) { + pARENTSEGMENTSDVSplited!.add(PARENTSEGMENTSDVSplited.fromJson(v)); + }); + } + pARENTSEGMENTSVS = json['PARENT_SEGMENTS_VS']; + if (json['PARENT_SEGMENTS_VS_SplitedVS'] != null) { + pARENTSEGMENTSVSSplitedVS = []; + json['PARENT_SEGMENTS_VS_SplitedVS'].forEach((v) { + pARENTSEGMENTSVSSplitedVS!.add(new PARENTSEGMENTSVSSplitedVS.fromJson(v)); + }); + } + rEADONLY = json['READ_ONLY']; + rEQUIREDFLAG = json['REQUIRED_FLAG']; + sEGMENTNAME = json['SEGMENT_NAME']; + sEGMENTPROMPT = json['SEGMENT_PROMPT']; + sEGMENTSEQNUM = json['SEGMENT_SEQ_NUM']; + uPPERCASEONLYFLAG = json['UPPERCASE_ONLY_FLAG']; + uSEDFLAG = json['USED_FLAG']; + vALIDATIONTYPE = json['VALIDATION_TYPE']; + vALIDATIONTYPEDSP = json['VALIDATION_TYPE_DSP']; + } + + Map toJson() { + Map data = new Map(); + data['ALPHANUMERIC_ALLOWED_FLAG'] = this.aLPHANUMERICALLOWEDFLAG; + data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; + data['CHILD_SEGMENTS_DV'] = this.cHILDSEGMENTSDV; + data['CHILD_SEGMENTS_DV_Splited'] = this.cHILDSEGMENTSDVSplited; + data['CHILD_SEGMENTS_VS'] = this.cHILDSEGMENTSVS; + data['CHILD_SEGMENTS_VS_Splited'] = this.cHILDSEGMENTSVSSplited; + data['DEFAULT_TYPE'] = this.dEFAULTTYPE; + data['DEFAULT_VALUE'] = this.dEFAULTVALUE; + data['DESC_FLEX_CONTEXT_CODE'] = this.dESCFLEXCONTEXTCODE; + data['DESC_FLEX_CONTEXT_NAME'] = this.dESCFLEXCONTEXTNAME; + data['DESC_FLEX_NAME'] = this.dESCFLEXNAME; + data['DISPLAY_FLAG'] = this.dISPLAYFLAG; + data['ENABLED_FLAG'] = this.eNABLEDFLAG; + if (this.eSERVICESDV != null) { + data['E_SERVICES_DV'] = this.eSERVICESDV!.toJson(); + } + if (this.eSERVICESVS != null) { + data['E_SERVICES_VS'] = this.eSERVICESVS!.map((v) => v.toJson()).toList(); + } + data['FLEX_VALUE_SET_NAME'] = this.fLEXVALUESETNAME; + data['FORMAT_TYPE'] = this.fORMATTYPE; + data['FORMAT_TYPE_DSP'] = this.fORMATTYPEDSP; + data['IsEmptyOption'] = this.isEmptyOption; + data['LONGLIST_FLAG'] = this.lONGLISTFLAG; + data['MAXIMUM_SIZE'] = this.mAXIMUMSIZE; + data['MAXIMUM_VALUE'] = this.mAXIMUMVALUE; + data['MINIMUM_VALUE'] = this.mINIMUMVALUE; + data['MOBILE_ENABLED'] = this.mOBILEENABLED; + data['NUMBER_PRECISION'] = this.nUMBERPRECISION; + data['NUMERIC_MODE_ENABLED_FLAG'] = this.nUMERICMODEENABLEDFLAG; + data['PARENT_SEGMENTS_DV'] = this.pARENTSEGMENTSDV; + if (this.pARENTSEGMENTSDVSplited != null) { + data['PARENT_SEGMENTS_DV_Splited'] = this.pARENTSEGMENTSDVSplited!.map((v) => v.toJson()).toList(); + } + data['PARENT_SEGMENTS_VS'] = this.pARENTSEGMENTSVS; + if (this.pARENTSEGMENTSVSSplitedVS != null) { + data['PARENT_SEGMENTS_VS_SplitedVS'] = this.pARENTSEGMENTSVSSplitedVS!.map((v) => v.toJson()).toList(); + } + data['READ_ONLY'] = this.rEADONLY; + data['REQUIRED_FLAG'] = this.rEQUIREDFLAG; + data['SEGMENT_NAME'] = this.sEGMENTNAME; + data['SEGMENT_PROMPT'] = this.sEGMENTPROMPT; + data['SEGMENT_SEQ_NUM'] = this.sEGMENTSEQNUM; + data['UPPERCASE_ONLY_FLAG'] = this.uPPERCASEONLYFLAG; + data['USED_FLAG'] = this.uSEDFLAG; + data['VALIDATION_TYPE'] = this.vALIDATIONTYPE; + data['VALIDATION_TYPE_DSP'] = this.vALIDATIONTYPEDSP; + return data; + } + + bool get isDefaultTypeIsCDPS => (dEFAULTTYPE == "C" || dEFAULTTYPE == "D" || dEFAULTTYPE == "P" || dEFAULTTYPE == "S"); +} diff --git a/lib/models/leave_balance/get_absence_transaction_list_model.dart b/lib/models/leave_balance/get_absence_transaction_list_model.dart new file mode 100644 index 0000000..74fb733 --- /dev/null +++ b/lib/models/leave_balance/get_absence_transaction_list_model.dart @@ -0,0 +1,80 @@ +class GetAbsenceTransactionList { + int? aBSENCEATTENDANCEID; + int? aBSENCEATTENDANCETYPEID; + String? aBSENCECATEGORY; + double? aBSENCEDAYS; + double? aBSENCEHOURS; + String? aBSENCESTATUS; + String? aBSENCETYPE; + String? aPPROVALSTATUS; + String? aTTACHMENTEXIST; + String? dELETEBUTTON; + String? eNDDATE; + int? fROMROWNUM; + int? nOOFROWS; + int? rOWNUM; + String? sTARTDATE; + int? tOROWNUM; + String? uPDATEBUTTON; + + GetAbsenceTransactionList( + {this.aBSENCEATTENDANCEID, + this.aBSENCEATTENDANCETYPEID, + this.aBSENCECATEGORY, + this.aBSENCEDAYS, + this.aBSENCEHOURS, + this.aBSENCESTATUS, + this.aBSENCETYPE, + this.aPPROVALSTATUS, + this.aTTACHMENTEXIST, + this.dELETEBUTTON, + this.eNDDATE, + this.fROMROWNUM, + this.nOOFROWS, + this.rOWNUM, + this.sTARTDATE, + this.tOROWNUM, + this.uPDATEBUTTON}); + + GetAbsenceTransactionList.fromJson(Map json) { + aBSENCEATTENDANCEID = json['ABSENCE_ATTENDANCE_ID']; + aBSENCEATTENDANCETYPEID = json['ABSENCE_ATTENDANCE_TYPE_ID']; + aBSENCECATEGORY = json['ABSENCE_CATEGORY']; + aBSENCEDAYS = double.parse(json['ABSENCE_DAYS'].toString() ?? "0.0"); + aBSENCEHOURS = json['ABSENCE_HOURS']; + aBSENCESTATUS = json['ABSENCE_STATUS']; + aBSENCETYPE = json['ABSENCE_TYPE']; + aPPROVALSTATUS = json['APPROVAL_STATUS']; + aTTACHMENTEXIST = json['ATTACHMENT_EXIST']; + dELETEBUTTON = json['DELETE_BUTTON']; + eNDDATE = json['END_DATE']; + fROMROWNUM = json['FROM_ROW_NUM']; + nOOFROWS = json['NO_OF_ROWS']; + rOWNUM = json['ROW_NUM']; + sTARTDATE = json['START_DATE']; + tOROWNUM = json['TO_ROW_NUM']; + uPDATEBUTTON = json['UPDATE_BUTTON']; + } + + Map toJson() { + Map data = new Map(); + data['ABSENCE_ATTENDANCE_ID'] = this.aBSENCEATTENDANCEID; + data['ABSENCE_ATTENDANCE_TYPE_ID'] = this.aBSENCEATTENDANCETYPEID; + data['ABSENCE_CATEGORY'] = this.aBSENCECATEGORY; + data['ABSENCE_DAYS'] = this.aBSENCEDAYS; + data['ABSENCE_HOURS'] = this.aBSENCEHOURS; + data['ABSENCE_STATUS'] = this.aBSENCESTATUS; + data['ABSENCE_TYPE'] = this.aBSENCETYPE; + data['APPROVAL_STATUS'] = this.aPPROVALSTATUS; + data['ATTACHMENT_EXIST'] = this.aTTACHMENTEXIST; + data['DELETE_BUTTON'] = this.dELETEBUTTON; + data['END_DATE'] = this.eNDDATE; + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['ROW_NUM'] = this.rOWNUM; + data['START_DATE'] = this.sTARTDATE; + data['TO_ROW_NUM'] = this.tOROWNUM; + data['UPDATE_BUTTON'] = this.uPDATEBUTTON; + return data; + } +} diff --git a/lib/models/leave_balance/start_absence_approval_proccess_model.dart b/lib/models/leave_balance/start_absence_approval_proccess_model.dart new file mode 100644 index 0000000..ca27cb1 --- /dev/null +++ b/lib/models/leave_balance/start_absence_approval_proccess_model.dart @@ -0,0 +1,18 @@ +class StartAbsenceApprovalProccess { + String? pRETURNMSG; + String? pRETURNSTATUS; + + StartAbsenceApprovalProccess({this.pRETURNMSG, this.pRETURNSTATUS}); + + StartAbsenceApprovalProccess.fromJson(Map json) { + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + } + + Map toJson() { + Map data = new Map(); + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + return data; + } +} diff --git a/lib/models/leave_balance/sumbit_absence_transaction_list_model.dart b/lib/models/leave_balance/sumbit_absence_transaction_list_model.dart new file mode 100644 index 0000000..3f5a2c4 --- /dev/null +++ b/lib/models/leave_balance/sumbit_absence_transaction_list_model.dart @@ -0,0 +1,22 @@ +class SumbitAbsenceTransactionList { + String? pRETURNMSG; + String? pRETURNSTATUS; + int? pTRANSACTIONID; + + SumbitAbsenceTransactionList( + {this.pRETURNMSG, this.pRETURNSTATUS, this.pTRANSACTIONID}); + + SumbitAbsenceTransactionList.fromJson(Map json) { + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + pTRANSACTIONID = json['P_TRANSACTION_ID']; + } + + Map toJson() { + Map data = new Map(); + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + data['P_TRANSACTION_ID'] = this.pTRANSACTIONID; + return data; + } +} \ No newline at end of file diff --git a/lib/models/leave_balance/validate_absence_transaction_list_model.dart b/lib/models/leave_balance/validate_absence_transaction_list_model.dart new file mode 100644 index 0000000..e75d18e --- /dev/null +++ b/lib/models/leave_balance/validate_absence_transaction_list_model.dart @@ -0,0 +1,18 @@ +class ValidateAbsenceTransactionList { + String? pRETURNMSG; + String? pRETURNSTATUS; + + ValidateAbsenceTransactionList({this.pRETURNMSG, this.pRETURNSTATUS}); + + ValidateAbsenceTransactionList.fromJson(Map json) { + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + } + + Map toJson() { + Map data = new Map(); + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + return data; + } +} \ No newline at end of file diff --git a/lib/models/my_team/get_attendance_tracking_list_model.dart b/lib/models/my_team/get_attendance_tracking_list_model.dart new file mode 100644 index 0000000..10d9d52 --- /dev/null +++ b/lib/models/my_team/get_attendance_tracking_list_model.dart @@ -0,0 +1,58 @@ + + +class GetAttendanceTrackingList { + String? pBREAKHOURS; + String? pLATEINHOURS; + String? pREMAININGHOURS; + String? pRETURNMSG; + String? pRETURNSTATUS; + String? pSCHEDULEDHOURS; + String? pSHTNAME; + String? pSPENTHOURS; + String? pSWIPESEXEMPTEDFLAG; + Null? pSWIPEIN; + Null? pSWIPEOUT; + + GetAttendanceTrackingList( + {this.pBREAKHOURS, + this.pLATEINHOURS, + this.pREMAININGHOURS, + this.pRETURNMSG, + this.pRETURNSTATUS, + this.pSCHEDULEDHOURS, + this.pSHTNAME, + this.pSPENTHOURS, + this.pSWIPESEXEMPTEDFLAG, + this.pSWIPEIN, + this.pSWIPEOUT}); + + GetAttendanceTrackingList.fromJson(Map json) { + pBREAKHOURS = json['P_BREAK_HOURS']; + pLATEINHOURS = json['P_LATE_IN_HOURS']; + pREMAININGHOURS = json['P_REMAINING_HOURS']; + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + pSCHEDULEDHOURS = json['P_SCHEDULED_HOURS']; + pSHTNAME = json['P_SHT_NAME']; + pSPENTHOURS = json['P_SPENT_HOURS']; + pSWIPESEXEMPTEDFLAG = json['P_SWIPES_EXEMPTED_FLAG']; + pSWIPEIN = json['P_SWIPE_IN']; + pSWIPEOUT = json['P_SWIPE_OUT']; + } + + Map toJson() { + Map data = new Map(); + data['P_BREAK_HOURS'] = this.pBREAKHOURS; + data['P_LATE_IN_HOURS'] = this.pLATEINHOURS; + data['P_REMAINING_HOURS'] = this.pREMAININGHOURS; + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + data['P_SCHEDULED_HOURS'] = this.pSCHEDULEDHOURS; + data['P_SHT_NAME'] = this.pSHTNAME; + data['P_SPENT_HOURS'] = this.pSPENTHOURS; + data['P_SWIPES_EXEMPTED_FLAG'] = this.pSWIPESEXEMPTEDFLAG; + data['P_SWIPE_IN'] = this.pSWIPEIN; + data['P_SWIPE_OUT'] = this.pSWIPEOUT; + return data; + } +} \ No newline at end of file diff --git a/lib/models/my_team/get_employee_subordinates_list.dart b/lib/models/my_team/get_employee_subordinates_list.dart new file mode 100644 index 0000000..e0178eb --- /dev/null +++ b/lib/models/my_team/get_employee_subordinates_list.dart @@ -0,0 +1,312 @@ +class GetEmployeeSubordinatesList { + String? aCTUALTERMINATIONDATE; + String? aSSIGNMENTENDDATE; + int? aSSIGNMENTID; + String? aSSIGNMENTNUMBER; + String? aSSIGNMENTSTARTDATE; + int? aSSIGNMENTSTATUSTYPEID; + String? aSSIGNMENTTYPE; + int? bUSINESSGROUPID; + String? bUSINESSGROUPNAME; + String? cURRENTEMPLOYEEFLAG; + String? eMPLOYEEDISPLAYNAME; + String? eMPLOYEEEMAILADDRESS; + String? eMPLOYEEIMAGE; + String? eMPLOYEEMOBILENUMBER; + String? eMPLOYEENAME; + String? eMPLOYEENUMBER; + String? eMPLOYEEWORKNUMBER; + String? eMPLOYMENTCATEGORY; + String? eMPLOYMENTCATEGORYMEANING; + String? fREQUENCY; + String? fREQUENCYMEANING; + int? fROMROWNUM; + dynamic? gRADEID; + dynamic? gRADENAME; + dynamic? genderCode; + dynamic? genderMeaning; + String? hIREDATE; + bool? isFavorite; + int? jOBID; + String? jOBNAME; + int? lOCATIONID; + String? lOCATIONNAME; + String? mANUALTIMECARDFLAG; + String? mANUALTIMECARDMEANING; + String? nATIONALITYCODE; + String? nATIONALITYMEANING; + String? nATIONALIDENTIFIER; + dynamic? nORMALHOURS; + int? nOOFROWS; + int? nUMOFSUBORDINATES; + int? oRGANIZATIONID; + String? oRGANIZATIONNAME; + String? pAYROLLCODE; + int? pAYROLLID; + String? pAYROLLNAME; + int? pERSONID; + String? pERSONTYPE; + int? pERSONTYPEID; + String? pERINFORMATIONCATEGORY; + int? pOSITIONID; + String? pOSITIONNAME; + String? pRIMARYFLAG; + int? rOWNUM; + int? sERVICEDAYS; + int? sERVICEMONTHS; + int? sERVICEYEARS; + String? sUPERVISORASSIGNMENTID; + String? sUPERVISORDISPLAYNAME; + String? sUPERVISOREMAILADDRESS; + int? sUPERVISORID; + String? sUPERVISORMOBILENUMBER; + String? sUPERVISORNAME; + String? sUPERVISORNUMBER; + String? sUPERVISORWORKNUMBER; + String? sWIPESEXEMPTEDFLAG; + String? sWIPESEXEMPTEDMEANING; + String? sYSTEMPERSONTYPE; + String? tKEMAILADDRESS; + String? tKEMPLOYEEDISPLAYNAME; + String? tKEMPLOYEENAME; + String? tKEMPLOYEENUMBER; + int? tKPERSONID; + int? tOROWNUM; + String? uNITNUMBER; + String? uSERSTATUS; + + GetEmployeeSubordinatesList( + {this.aCTUALTERMINATIONDATE, + this.aSSIGNMENTENDDATE, + this.aSSIGNMENTID, + this.aSSIGNMENTNUMBER, + this.aSSIGNMENTSTARTDATE, + this.aSSIGNMENTSTATUSTYPEID, + this.aSSIGNMENTTYPE, + this.bUSINESSGROUPID, + this.bUSINESSGROUPNAME, + this.cURRENTEMPLOYEEFLAG, + this.eMPLOYEEDISPLAYNAME, + this.eMPLOYEEEMAILADDRESS, + this.eMPLOYEEIMAGE, + this.eMPLOYEEMOBILENUMBER, + this.eMPLOYEENAME, + this.eMPLOYEENUMBER, + this.eMPLOYEEWORKNUMBER, + this.eMPLOYMENTCATEGORY, + this.eMPLOYMENTCATEGORYMEANING, + this.fREQUENCY, + this.fREQUENCYMEANING, + this.fROMROWNUM, + this.gRADEID, + this.gRADENAME, + this.genderCode, + this.genderMeaning, + this.hIREDATE, + this.isFavorite, + this.jOBID, + this.jOBNAME, + this.lOCATIONID, + this.lOCATIONNAME, + this.mANUALTIMECARDFLAG, + this.mANUALTIMECARDMEANING, + this.nATIONALITYCODE, + this.nATIONALITYMEANING, + this.nATIONALIDENTIFIER, + this.nORMALHOURS, + this.nOOFROWS, + this.nUMOFSUBORDINATES, + this.oRGANIZATIONID, + this.oRGANIZATIONNAME, + this.pAYROLLCODE, + this.pAYROLLID, + this.pAYROLLNAME, + this.pERSONID, + this.pERSONTYPE, + this.pERSONTYPEID, + this.pERINFORMATIONCATEGORY, + this.pOSITIONID, + this.pOSITIONNAME, + this.pRIMARYFLAG, + this.rOWNUM, + this.sERVICEDAYS, + this.sERVICEMONTHS, + this.sERVICEYEARS, + this.sUPERVISORASSIGNMENTID, + this.sUPERVISORDISPLAYNAME, + this.sUPERVISOREMAILADDRESS, + this.sUPERVISORID, + this.sUPERVISORMOBILENUMBER, + this.sUPERVISORNAME, + this.sUPERVISORNUMBER, + this.sUPERVISORWORKNUMBER, + this.sWIPESEXEMPTEDFLAG, + this.sWIPESEXEMPTEDMEANING, + this.sYSTEMPERSONTYPE, + this.tKEMAILADDRESS, + this.tKEMPLOYEEDISPLAYNAME, + this.tKEMPLOYEENAME, + this.tKEMPLOYEENUMBER, + this.tKPERSONID, + this.tOROWNUM, + this.uNITNUMBER, + this.uSERSTATUS}); + + GetEmployeeSubordinatesList.fromJson(Map json) { + aCTUALTERMINATIONDATE = json['ACTUAL_TERMINATION_DATE']; + aSSIGNMENTENDDATE = json['ASSIGNMENT_END_DATE']; + aSSIGNMENTID = json['ASSIGNMENT_ID']; + aSSIGNMENTNUMBER = json['ASSIGNMENT_NUMBER']; + aSSIGNMENTSTARTDATE = json['ASSIGNMENT_START_DATE']; + aSSIGNMENTSTATUSTYPEID = json['ASSIGNMENT_STATUS_TYPE_ID']; + aSSIGNMENTTYPE = json['ASSIGNMENT_TYPE']; + bUSINESSGROUPID = json['BUSINESS_GROUP_ID']; + bUSINESSGROUPNAME = json['BUSINESS_GROUP_NAME']; + cURRENTEMPLOYEEFLAG = json['CURRENT_EMPLOYEE_FLAG']; + eMPLOYEEDISPLAYNAME = json['EMPLOYEE_DISPLAY_NAME']; + eMPLOYEEEMAILADDRESS = json['EMPLOYEE_EMAIL_ADDRESS']; + eMPLOYEEIMAGE = json['EMPLOYEE_IMAGE']; + eMPLOYEEMOBILENUMBER = json['EMPLOYEE_MOBILE_NUMBER']; + eMPLOYEENAME = json['EMPLOYEE_NAME']; + eMPLOYEENUMBER = json['EMPLOYEE_NUMBER']; + eMPLOYEEWORKNUMBER = json['EMPLOYEE_WORK_NUMBER']; + eMPLOYMENTCATEGORY = json['EMPLOYMENT_CATEGORY']; + eMPLOYMENTCATEGORYMEANING = json['EMPLOYMENT_CATEGORY_MEANING']; + fREQUENCY = json['FREQUENCY']; + fREQUENCYMEANING = json['FREQUENCY_MEANING']; + fROMROWNUM = json['FROM_ROW_NUM']; + gRADEID = json['GRADE_ID']; + gRADENAME = json['GRADE_NAME']; + genderCode = json['GenderCode']; + genderMeaning = json['GenderMeaning']; + hIREDATE = json['HIRE_DATE']; + isFavorite = json['IsFavorite']; + jOBID = json['JOB_ID']; + jOBNAME = json['JOB_NAME']; + lOCATIONID = json['LOCATION_ID']; + lOCATIONNAME = json['LOCATION_NAME']; + mANUALTIMECARDFLAG = json['MANUAL_TIMECARD_FLAG']; + mANUALTIMECARDMEANING = json['MANUAL_TIMECARD_MEANING']; + nATIONALITYCODE = json['NATIONALITY_CODE']; + nATIONALITYMEANING = json['NATIONALITY_MEANING']; + nATIONALIDENTIFIER = json['NATIONAL_IDENTIFIER']; + nORMALHOURS = json['NORMAL_HOURS']; + nOOFROWS = json['NO_OF_ROWS']; + nUMOFSUBORDINATES = json['NUM_OF_SUBORDINATES']; + oRGANIZATIONID = json['ORGANIZATION_ID']; + oRGANIZATIONNAME = json['ORGANIZATION_NAME']; + pAYROLLCODE = json['PAYROLL_CODE']; + pAYROLLID = json['PAYROLL_ID']; + pAYROLLNAME = json['PAYROLL_NAME']; + pERSONID = json['PERSON_ID']; + pERSONTYPE = json['PERSON_TYPE']; + pERSONTYPEID = json['PERSON_TYPE_ID']; + pERINFORMATIONCATEGORY = json['PER_INFORMATION_CATEGORY']; + pOSITIONID = json['POSITION_ID']; + pOSITIONNAME = json['POSITION_NAME']; + pRIMARYFLAG = json['PRIMARY_FLAG']; + rOWNUM = json['ROW_NUM']; + sERVICEDAYS = json['SERVICE_DAYS']; + sERVICEMONTHS = json['SERVICE_MONTHS']; + sERVICEYEARS = json['SERVICE_YEARS']; + sUPERVISORASSIGNMENTID = json['SUPERVISOR_ASSIGNMENT_ID']; + sUPERVISORDISPLAYNAME = json['SUPERVISOR_DISPLAY_NAME']; + sUPERVISOREMAILADDRESS = json['SUPERVISOR_EMAIL_ADDRESS']; + sUPERVISORID = json['SUPERVISOR_ID']; + sUPERVISORMOBILENUMBER = json['SUPERVISOR_MOBILE_NUMBER']; + sUPERVISORNAME = json['SUPERVISOR_NAME']; + sUPERVISORNUMBER = json['SUPERVISOR_NUMBER']; + sUPERVISORWORKNUMBER = json['SUPERVISOR_WORK_NUMBER']; + sWIPESEXEMPTEDFLAG = json['SWIPES_EXEMPTED_FLAG']; + sWIPESEXEMPTEDMEANING = json['SWIPES_EXEMPTED_MEANING']; + sYSTEMPERSONTYPE = json['SYSTEM_PERSON_TYPE']; + tKEMAILADDRESS = json['TK_EMAIL_ADDRESS']; + tKEMPLOYEEDISPLAYNAME = json['TK_EMPLOYEE_DISPLAY_NAME']; + tKEMPLOYEENAME = json['TK_EMPLOYEE_NAME']; + tKEMPLOYEENUMBER = json['TK_EMPLOYEE_NUMBER']; + tKPERSONID = json['TK_PERSON_ID']; + tOROWNUM = json['TO_ROW_NUM']; + uNITNUMBER = json['UNIT_NUMBER']; + uSERSTATUS = json['USER_STATUS']; + } + + Map toJson() { + Map data = new Map(); + data['ACTUAL_TERMINATION_DATE'] = this.aCTUALTERMINATIONDATE; + data['ASSIGNMENT_END_DATE'] = this.aSSIGNMENTENDDATE; + data['ASSIGNMENT_ID'] = this.aSSIGNMENTID; + data['ASSIGNMENT_NUMBER'] = this.aSSIGNMENTNUMBER; + data['ASSIGNMENT_START_DATE'] = this.aSSIGNMENTSTARTDATE; + data['ASSIGNMENT_STATUS_TYPE_ID'] = this.aSSIGNMENTSTATUSTYPEID; + data['ASSIGNMENT_TYPE'] = this.aSSIGNMENTTYPE; + data['BUSINESS_GROUP_ID'] = this.bUSINESSGROUPID; + data['BUSINESS_GROUP_NAME'] = this.bUSINESSGROUPNAME; + data['CURRENT_EMPLOYEE_FLAG'] = this.cURRENTEMPLOYEEFLAG; + data['EMPLOYEE_DISPLAY_NAME'] = this.eMPLOYEEDISPLAYNAME; + data['EMPLOYEE_EMAIL_ADDRESS'] = this.eMPLOYEEEMAILADDRESS; + data['EMPLOYEE_IMAGE'] = this.eMPLOYEEIMAGE; + data['EMPLOYEE_MOBILE_NUMBER'] = this.eMPLOYEEMOBILENUMBER; + data['EMPLOYEE_NAME'] = this.eMPLOYEENAME; + data['EMPLOYEE_NUMBER'] = this.eMPLOYEENUMBER; + data['EMPLOYEE_WORK_NUMBER'] = this.eMPLOYEEWORKNUMBER; + data['EMPLOYMENT_CATEGORY'] = this.eMPLOYMENTCATEGORY; + data['EMPLOYMENT_CATEGORY_MEANING'] = this.eMPLOYMENTCATEGORYMEANING; + data['FREQUENCY'] = this.fREQUENCY; + data['FREQUENCY_MEANING'] = this.fREQUENCYMEANING; + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['GRADE_ID'] = this.gRADEID; + data['GRADE_NAME'] = this.gRADENAME; + data['GenderCode'] = this.genderCode; + data['GenderMeaning'] = this.genderMeaning; + data['HIRE_DATE'] = this.hIREDATE; + data['IsFavorite'] = this.isFavorite; + data['JOB_ID'] = this.jOBID; + data['JOB_NAME'] = this.jOBNAME; + data['LOCATION_ID'] = this.lOCATIONID; + data['LOCATION_NAME'] = this.lOCATIONNAME; + data['MANUAL_TIMECARD_FLAG'] = this.mANUALTIMECARDFLAG; + data['MANUAL_TIMECARD_MEANING'] = this.mANUALTIMECARDMEANING; + data['NATIONALITY_CODE'] = this.nATIONALITYCODE; + data['NATIONALITY_MEANING'] = this.nATIONALITYMEANING; + data['NATIONAL_IDENTIFIER'] = this.nATIONALIDENTIFIER; + data['NORMAL_HOURS'] = this.nORMALHOURS; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['NUM_OF_SUBORDINATES'] = this.nUMOFSUBORDINATES; + data['ORGANIZATION_ID'] = this.oRGANIZATIONID; + data['ORGANIZATION_NAME'] = this.oRGANIZATIONNAME; + data['PAYROLL_CODE'] = this.pAYROLLCODE; + data['PAYROLL_ID'] = this.pAYROLLID; + data['PAYROLL_NAME'] = this.pAYROLLNAME; + data['PERSON_ID'] = this.pERSONID; + data['PERSON_TYPE'] = this.pERSONTYPE; + data['PERSON_TYPE_ID'] = this.pERSONTYPEID; + data['PER_INFORMATION_CATEGORY'] = this.pERINFORMATIONCATEGORY; + data['POSITION_ID'] = this.pOSITIONID; + data['POSITION_NAME'] = this.pOSITIONNAME; + data['PRIMARY_FLAG'] = this.pRIMARYFLAG; + data['ROW_NUM'] = this.rOWNUM; + data['SERVICE_DAYS'] = this.sERVICEDAYS; + data['SERVICE_MONTHS'] = this.sERVICEMONTHS; + data['SERVICE_YEARS'] = this.sERVICEYEARS; + data['SUPERVISOR_ASSIGNMENT_ID'] = this.sUPERVISORASSIGNMENTID; + data['SUPERVISOR_DISPLAY_NAME'] = this.sUPERVISORDISPLAYNAME; + data['SUPERVISOR_EMAIL_ADDRESS'] = this.sUPERVISOREMAILADDRESS; + data['SUPERVISOR_ID'] = this.sUPERVISORID; + data['SUPERVISOR_MOBILE_NUMBER'] = this.sUPERVISORMOBILENUMBER; + data['SUPERVISOR_NAME'] = this.sUPERVISORNAME; + data['SUPERVISOR_NUMBER'] = this.sUPERVISORNUMBER; + data['SUPERVISOR_WORK_NUMBER'] = this.sUPERVISORWORKNUMBER; + data['SWIPES_EXEMPTED_FLAG'] = this.sWIPESEXEMPTEDFLAG; + data['SWIPES_EXEMPTED_MEANING'] = this.sWIPESEXEMPTEDMEANING; + data['SYSTEM_PERSON_TYPE'] = this.sYSTEMPERSONTYPE; + data['TK_EMAIL_ADDRESS'] = this.tKEMAILADDRESS; + data['TK_EMPLOYEE_DISPLAY_NAME'] = this.tKEMPLOYEEDISPLAYNAME; + data['TK_EMPLOYEE_NAME'] = this.tKEMPLOYEENAME; + data['TK_EMPLOYEE_NUMBER'] = this.tKEMPLOYEENUMBER; + data['TK_PERSON_ID'] = this.tKPERSONID; + data['TO_ROW_NUM'] = this.tOROWNUM; + data['UNIT_NUMBER'] = this.uNITNUMBER; + data['USER_STATUS'] = this.uSERSTATUS; + return data; + } +} diff --git a/lib/models/my_team/get_subordinates_leaves_total_vacations_list_model.dart b/lib/models/my_team/get_subordinates_leaves_total_vacations_list_model.dart new file mode 100644 index 0000000..04837d8 --- /dev/null +++ b/lib/models/my_team/get_subordinates_leaves_total_vacations_list_model.dart @@ -0,0 +1,62 @@ + + +class GetSubordinatesLeavesTotalVacationsList { + String? aBSENCEATTENDANCETYPENAME; + String? cALENDARENTRYDESC; + String? dATEEND; + String? dATESTART; + String? eMPLOYEENAME; + String? eMPLOYEENUMBER; + String? lEAVETYPE; + int? oRGANIZATIONID; + String? oRGANIZATIONNAME; + String? pOSITIONTITLE; + String? rEPLACEMENTNAME; + String? sTATUS; + + GetSubordinatesLeavesTotalVacationsList( + {this.aBSENCEATTENDANCETYPENAME, + this.cALENDARENTRYDESC, + this.dATEEND, + this.dATESTART, + this.eMPLOYEENAME, + this.eMPLOYEENUMBER, + this.lEAVETYPE, + this.oRGANIZATIONID, + this.oRGANIZATIONNAME, + this.pOSITIONTITLE, + this.rEPLACEMENTNAME, + this.sTATUS}); + + GetSubordinatesLeavesTotalVacationsList.fromJson(Map json) { + aBSENCEATTENDANCETYPENAME = json['ABSENCE_ATTENDANCE_TYPE_NAME']; + cALENDARENTRYDESC = json['CALENDAR_ENTRY_DESC']; + dATEEND = json['DATE_END']; + dATESTART = json['DATE_START']; + eMPLOYEENAME = json['EMPLOYEE_NAME']; + eMPLOYEENUMBER = json['EMPLOYEE_NUMBER']; + lEAVETYPE = json['LEAVE_TYPE']; + oRGANIZATIONID = json['ORGANIZATION_ID']; + oRGANIZATIONNAME = json['ORGANIZATION_NAME']; + pOSITIONTITLE = json['POSITION_TITLE']; + rEPLACEMENTNAME = json['REPLACEMENT_NAME']; + sTATUS = json['STATUS']; + } + + Map toJson() { + Map data = new Map(); + data['ABSENCE_ATTENDANCE_TYPE_NAME'] = this.aBSENCEATTENDANCETYPENAME; + data['CALENDAR_ENTRY_DESC'] = this.cALENDARENTRYDESC; + data['DATE_END'] = this.dATEEND; + data['DATE_START'] = this.dATESTART; + data['EMPLOYEE_NAME'] = this.eMPLOYEENAME; + data['EMPLOYEE_NUMBER'] = this.eMPLOYEENUMBER; + data['LEAVE_TYPE'] = this.lEAVETYPE; + data['ORGANIZATION_ID'] = this.oRGANIZATIONID; + data['ORGANIZATION_NAME'] = this.oRGANIZATIONNAME; + data['POSITION_TITLE'] = this.pOSITIONTITLE; + data['REPLACEMENT_NAME'] = this.rEPLACEMENTNAME; + data['STATUS'] = this.sTATUS; + return data; + } +} \ No newline at end of file diff --git a/lib/models/profile_menu.model.dart b/lib/models/profile_menu.model.dart index b8039ad..0fdfb6b 100644 --- a/lib/models/profile_menu.model.dart +++ b/lib/models/profile_menu.model.dart @@ -2,6 +2,6 @@ class ProfileMenu { final String name; final String icon; final String route; - - ProfileMenu({this.name = '', this.icon = '', this.route = ''}); + final dynamic arguments; + ProfileMenu({this.name = '', this.icon = '', this.route = '', this.arguments = ''}); } diff --git a/lib/models/update_item_type_success_list.dart b/lib/models/update_item_type_success_list.dart new file mode 100644 index 0000000..81d0132 --- /dev/null +++ b/lib/models/update_item_type_success_list.dart @@ -0,0 +1,25 @@ + + +class UpdateItemTypeSuccessList { + int? itemID; + String? updateError; + bool? updateSuccess; + + UpdateItemTypeSuccessList( + {this.itemID, this.updateError, this.updateSuccess}); + + UpdateItemTypeSuccessList.fromJson(Map json) { + itemID = json['ItemID']; + updateError = json['UpdateError']; + updateSuccess = json['UpdateSuccess']; + } + + Map toJson() { + Map data = new Map(); + data['ItemID'] = this.itemID; + data['UpdateError'] = this.updateError; + data['UpdateSuccess'] = this.updateSuccess; + return data; + } +} + diff --git a/lib/models/update_user_item_type_list.dart b/lib/models/update_user_item_type_list.dart new file mode 100644 index 0000000..c6e938c --- /dev/null +++ b/lib/models/update_user_item_type_list.dart @@ -0,0 +1,18 @@ +class UpdateUserItemTypesList { + String? pRETURNMSG; + String? pRETURNSTATUS; + + UpdateUserItemTypesList({this.pRETURNMSG, this.pRETURNSTATUS}); + + UpdateUserItemTypesList.fromJson(Map json) { + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + } + + Map toJson() { + Map data = new Map(); + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + return data; + } +} \ No newline at end of file diff --git a/lib/models/worklist/update_user_type_list.dart b/lib/models/worklist/update_user_type_list.dart new file mode 100644 index 0000000..1637880 --- /dev/null +++ b/lib/models/worklist/update_user_type_list.dart @@ -0,0 +1,24 @@ +class UpdateUserTypesList { + int? itemID; + String? pFYAENABLEDFALG; + String? pFYIENABLEDFALG; + String? pITEMTYPE; + + UpdateUserTypesList({this.itemID, this.pFYAENABLEDFALG, this.pFYIENABLEDFALG, this.pITEMTYPE}); + + UpdateUserTypesList.fromJson(Map json) { + itemID = json['ItemID']; + pFYAENABLEDFALG = json['P_FYAENABLED_FALG']; + pFYIENABLEDFALG = json['P_FYIENABLED_FALG']; + pITEMTYPE = json['P_ITEM_TYPE']; + } + + Map toJson() { + Map data = new Map(); + data['ItemID'] = this.itemID; + data['P_FYAENABLED_FALG'] = this.pFYAENABLEDFALG; + data['P_FYIENABLED_FALG'] = this.pFYIENABLEDFALG; + data['P_ITEM_TYPE'] = this.pITEMTYPE; + return data; + } +} diff --git a/lib/ui/attendance/monthly_attendance_screen.dart b/lib/ui/attendance/monthly_attendance_screen.dart index caaf65c..93525a9 100644 --- a/lib/ui/attendance/monthly_attendance_screen.dart +++ b/lib/ui/attendance/monthly_attendance_screen.dart @@ -113,8 +113,8 @@ class _MonthlyAttendanceScreenState extends State { LocaleKeys.attendance.tr().toText24(isBold: true, color: MyColors.darkIconColor), Row( children: [ - "${DateFormat("MMMM-yyyy").format(formattedDate)}".toText16(color: MyColors.greyACColor), - const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor), + "${DateFormat("MMMM-yyyy").format(formattedDate)}".toText16(color: MyColors.grey3AColor), + const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.grey3AColor), ], ).onPress(() async { showMonthPicker( diff --git a/lib/ui/landing/today_attendance_screen.dart b/lib/ui/landing/today_attendance_screen.dart index 83c3f06..cde099d 100644 --- a/lib/ui/landing/today_attendance_screen.dart +++ b/lib/ui/landing/today_attendance_screen.dart @@ -1,23 +1,16 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter_countdown_timer/flutter_countdown_timer.dart'; -import 'package:flutter_svg/flutter_svg.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:mohem_flutter_app/api/dashboard_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/date_uitl.dart'; -import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; -import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/widgets/circular_step_progress_bar.dart'; -import 'package:mohem_flutter_app/widgets/location/Location.dart'; -import 'package:mohem_flutter_app/widgets/nfc/nfc_reader_sheet.dart'; -import 'package:mohem_flutter_app/widgets/qr_scanner_dialog.dart'; +import 'package:mohem_flutter_app/widgets/mark_attendance_widget.dart'; import 'package:nfc_manager/nfc_manager.dart'; import 'package:provider/provider.dart'; import 'package:wifi_iot/wifi_iot.dart'; @@ -183,62 +176,62 @@ class _TodayAttendanceScreenState extends State { ), ), //.expanded, - // MarkAttendanceWidget(model), - Container( - width: double.infinity, - decoration: BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), - // margin: EdgeInsets.only(top: 187 - 31), - padding: EdgeInsets.only(left: 21, right: 21, top: 24, bottom: 24), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - LocaleKeys.markAttendance.tr().toSectionHeading(), - LocaleKeys.selectMethodOfAttendance.tr().tr().toText11(color: Color(0xff535353)), - 24.height, - GridView( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - padding: EdgeInsets.zero, - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8), - children: [ - if (isNfcEnabled) - attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () { - if (isNfcLocationEnabled) { - Location.getCurrentLocation((LatLng? latlng) { - performNfcAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); - }); - } else { - performNfcAttendance(model); - } - }), - if (isWifiEnabled) - attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, () { - if (isWifiLocationEnabled) { - Location.getCurrentLocation((LatLng? latlng) { - performWifiAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); - }); - } else { - performWifiAttendance(model); - } - // connectWifi(); - }), - if (isQrEnabled) - attendanceMethod("QR", "assets/images/ic_qr.svg", isQrEnabled, () async { - if (isQrLocationEnabled) { - Location.getCurrentLocation((LatLng? latlng) { - performQrCodeAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); - }); - } else { - performQrCodeAttendance(model); - } - // performQrCodeAttendance(model); - }), - ], - ) - ], - ), - ), + MarkAttendanceWidget(model, topPadding: 24), + // Container( + // width: double.infinity, + // decoration: BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), + // // margin: EdgeInsets.only(top: 187 - 31), + // padding: EdgeInsets.only(left: 21, right: 21, top: 24, bottom: 24), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisSize: MainAxisSize.min, + // children: [ + // LocaleKeys.markAttendance.tr().toSectionHeading(), + // LocaleKeys.selectMethodOfAttendance.tr().tr().toText11(color: Color(0xff535353)), + // 24.height, + // GridView( + // physics: const NeverScrollableScrollPhysics(), + // shrinkWrap: true, + // padding: EdgeInsets.zero, + // gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8), + // children: [ + // if (isNfcEnabled) + // attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () { + // if (isNfcLocationEnabled) { + // Location.getCurrentLocation((LatLng? latlng) { + // performNfcAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + // }); + // } else { + // performNfcAttendance(model); + // } + // }), + // if (isWifiEnabled) + // attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, () { + // if (isWifiLocationEnabled) { + // Location.getCurrentLocation((LatLng? latlng) { + // performWifiAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + // }); + // } else { + // performWifiAttendance(model); + // } + // // connectWifi(); + // }), + // if (isQrEnabled) + // attendanceMethod("QR", "assets/images/ic_qr.svg", isQrEnabled, () async { + // if (isQrLocationEnabled) { + // Location.getCurrentLocation((LatLng? latlng) { + // performQrCodeAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + // }); + // } else { + // performQrCodeAttendance(model); + // } + // // performQrCodeAttendance(model); + // }), + // ], + // ) + // ], + // ), + // ), // Positioned( // top: 187 - 21, // child: Container( @@ -269,59 +262,59 @@ class _TodayAttendanceScreenState 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"); - } - - 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); - bool status = await model.fetchAttendanceTracking(context); - Utils.hideLoading(context); - } catch (ex) { - print(ex); - Utils.hideLoading(context); - Utils.handleException(ex, context, (msg) { - Utils.confirmDialog(context, msg); - }); - } - }); - } - - Future performWifiAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { - if (isWifiLocationEnabled) { - print("wifi location enabled"); - } else { - print("wifi not location enabled"); - } - - bool v = await WiFiForIoTPlugin.connect(AppState().mohemmWifiSSID ?? "", password: AppState().mohemmWifiPassword ?? "", joinOnce: true, security: NetworkSecurity.WPA, withInternet: false); - if (v) { - await WiFiForIoTPlugin.forceWifiUsage(true); - print("connected"); - Utils.showLoading(context); - try { - GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 3, nfcValue: "", isGpsRequired: isWifiLocationEnabled, lat: lat, long: lng); - bool status = await model.fetchAttendanceTracking(context); - Utils.hideLoading(context); - await closeWifiRequest(); - } catch (ex) { - print(ex); - await closeWifiRequest(); - Utils.hideLoading(context); - Utils.handleException(ex, context, (msg) { - Utils.confirmDialog(context, msg); - }); - } - } else { - Utils.confirmDialog(context, LocaleKeys.comeNearHMGWifi.tr()); - } - } + // Future performNfcAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { + // if (isNfcLocationEnabled) { + // print("nfc location enabled"); + // } else { + // print("nfc not location enabled"); + // } + // + // 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); + // bool status = await model.fetchAttendanceTracking(context); + // Utils.hideLoading(context); + // } catch (ex) { + // print(ex); + // Utils.hideLoading(context); + // Utils.handleException(ex, context, (msg) { + // Utils.confirmDialog(context, msg); + // }); + // } + // }); + // } + // + // Future performWifiAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { + // if (isWifiLocationEnabled) { + // print("wifi location enabled"); + // } else { + // print("wifi not location enabled"); + // } + // + // bool v = await WiFiForIoTPlugin.connect(AppState().mohemmWifiSSID ?? "", password: AppState().mohemmWifiPassword ?? "", joinOnce: true, security: NetworkSecurity.WPA, withInternet: false); + // if (v) { + // await WiFiForIoTPlugin.forceWifiUsage(true); + // print("connected"); + // Utils.showLoading(context); + // try { + // GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 3, nfcValue: "", isGpsRequired: isWifiLocationEnabled, lat: lat, long: lng); + // bool status = await model.fetchAttendanceTracking(context); + // Utils.hideLoading(context); + // await closeWifiRequest(); + // } catch (ex) { + // print(ex); + // await closeWifiRequest(); + // Utils.hideLoading(context); + // Utils.handleException(ex, context, (msg) { + // Utils.confirmDialog(context, msg); + // }); + // } + // } else { + // Utils.confirmDialog(context, LocaleKeys.comeNearHMGWifi.tr()); + // } + // } Future closeWifiRequest() async { await WiFiForIoTPlugin.forceWifiUsage(false); @@ -329,62 +322,62 @@ class _TodayAttendanceScreenState extends State { return v; } - Future performQrCodeAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { - var qrCodeValue = await Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => QrScannerDialog(), - ), - ); - 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); - bool status = await model.fetchAttendanceTracking(context); - Utils.hideLoading(context); - } 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), - gradient: const LinearGradient(transform: GradientRotation(.64), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ - MyColors.gradiantEndColor, - MyColors.gradiantStartColor, - ]), - ), - clipBehavior: Clip.antiAlias, - child: Stack( - children: [ - Container( - padding: const EdgeInsets.only(left: 10, right: 10, top: 14, bottom: 14), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SvgPicture.asset( - image, - color: Colors.white, - ).expanded, - title.toText17(isBold: true, color: Colors.white), - ], - ), - ), - if (!isEnabled) - Container( - width: double.infinity, - height: double.infinity, - color: Colors.grey.withOpacity(0.7), - ) - ], - ), - ).onPress(onPress); + // Future performQrCodeAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { + // var qrCodeValue = await Navigator.of(context).push( + // MaterialPageRoute( + // builder: (context) => QrScannerDialog(), + // ), + // ); + // 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); + // bool status = await model.fetchAttendanceTracking(context); + // Utils.hideLoading(context); + // } 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), + // gradient: const LinearGradient(transform: GradientRotation(.64), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ + // MyColors.gradiantEndColor, + // MyColors.gradiantStartColor, + // ]), + // ), + // clipBehavior: Clip.antiAlias, + // child: Stack( + // children: [ + // Container( + // padding: const EdgeInsets.only(left: 10, right: 10, top: 14, bottom: 14), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // SvgPicture.asset( + // image, + // color: Colors.white, + // ).expanded, + // title.toText17(isBold: true, color: Colors.white), + // ], + // ), + // ), + // if (!isEnabled) + // Container( + // width: double.infinity, + // height: double.infinity, + // color: Colors.grey.withOpacity(0.7), + // ) + // ], + // ), + // ).onPress(onPress); Widget commonStatusView(String title, String time) => Expanded( child: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/ui/landing/widget/app_drawer.dart b/lib/ui/landing/widget/app_drawer.dart index ffba945..70fc38f 100644 --- a/lib/ui/landing/widget/app_drawer.dart +++ b/lib/ui/landing/widget/app_drawer.dart @@ -3,7 +3,10 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.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'; import 'package:mohem_flutter_app/ui/landing/widget/drawer_item.dart'; +import 'package:mohem_flutter_app/widgets/dialogs/dialogs.dart'; class AppDrawer extends StatefulWidget { @override @@ -56,6 +59,17 @@ class _AppDrawerState extends State { drawerNavigator(context, AppRoutes.pendingTransactions); }, ), + const Divider(), + InkWell( + child: DrawerItem( + "My Team", + icon: Icons.person, + color: Colors.grey, + ), + onTap: () { + drawerNavigator(context, AppRoutes.myTeam); + }, + ), Divider(), InkWell( child: const DrawerItem( @@ -65,138 +79,39 @@ class _AppDrawerState extends State { ), onTap: () { drawerNavigator(context, AppRoutes.myRequests); - }) + }), + InkWell( + child: DrawerItem( + LocaleKeys.employeeDigitalID.tr(), + icon: Icons.insert_drive_file_outlined, + color: Colors.grey, + ), + onTap: () { + showMDialog(context, child: EmployeeDigitialIdDialog()); + }, + ), + Divider(), + InkWell( + child: DrawerItem( + LocaleKeys.businessCard.tr(), + icon: Icons.insert_drive_file_outlined, + color: Colors.grey, + ), + onTap: () { + showMDialog(context, child: BusinessCardDialog()); + }, + ), ])) ]))); } -// , -// -// ) -// -// , -// -// InkWell -// -// ( -// -// child -// -// : -// -// DrawerItem -// -// ( -// -// LocaleKeys.employeeDigitalID.tr -// -// ( -// -// ) -// -// , -// -// icon -// -// : -// -// Icons.insert_drive_file_outlined -// -// , -// -// color -// -// : -// -// Colors.grey -// -// , -// -// ) -// -// , -// -// onTap -// -// : () { -// showMDialog(context, child: EmployeeDigitialIdDialog()); -// }, -// -// ) -// -// , -// -// Divider() -// -// , -// -// InkWell -// -// ( -// -// child -// -// : -// -// DrawerItem -// -// ( -// -// LocaleKeys.businessCard.tr -// -// ( -// -// ) -// -// , -// -// icon -// -// : -// -// Icons.insert_drive_file_outlined -// -// , -// -// color -// -// : -// -// Colors.grey -// -// , -// -// ) -// -// , -// -// onTap -// -// : () { -// showMDialog(context, child: BusinessCardDialog()); -// }, -// ), -// ], -// ), -// ) -// ], -// ) -// -// , -// -// ) -// -// , -// -// ); -} - -void drawerNavigator(context, routeName) { - Navigator.of(context).pushNamed(routeName); -} + void drawerNavigator(context, routeName) { + Navigator.of(context).pushNamed(routeName); + } -String capitalizeOnlyFirstLater(String text) { - if (text.trim().isEmpty) return ""; + String capitalizeOnlyFirstLater(String text) { + if (text.trim().isEmpty) return ""; - return "${text[0].toUpperCase()}${text.substring(1)}"; + return "${text[0].toUpperCase()}${text.substring(1)}"; + } } diff --git a/lib/ui/landing/widget/menus_widget.dart b/lib/ui/landing/widget/menus_widget.dart index e386295..91723ee 100644 --- a/lib/ui/landing/widget/menus_widget.dart +++ b/lib/ui/landing/widget/menus_widget.dart @@ -6,6 +6,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/provider/dashboard_provider_model.dart'; +import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; import 'package:provider/provider.dart'; @@ -14,125 +15,128 @@ class MenusWidget extends StatelessWidget { Widget build(BuildContext context) { List namesColor = [0xff125765, 0xff239D8F, 0xff2BB8A8, 0xff1D92AA]; - return Consumer(builder: (cxt, data, child) { - return GridView( - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 2 / 2, crossAxisSpacing: 9, mainAxisSpacing: 9), - padding: EdgeInsets.zero, - shrinkWrap: true, - primary: false, - physics: const NeverScrollableScrollPhysics(), - children: [ - data.isWorkListLoading - ? MenuShimmer().onPress(() { - data.fetchWorkListCounter(context, showLoading: true); - }) - : Container( - decoration: BoxDecoration( - color: Color(namesColor[0]), - borderRadius: BorderRadius.circular(10), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.workList.tr().toText12(color: Colors.white), - Row( - children: [ - Expanded( - child: data.workListCounter.toString().toText16(color: Colors.white, isBold: true,maxlines: 1), - ), - SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) - ], - ) - ], - ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), - ).onPress(() async { - //await data.fetchWorkListCounter(context, showLoading: true); - Navigator.pushNamed(context, AppRoutes.workList); - }), - data.isMissingSwipeLoading - ? MenuShimmer().onPress(() { - data.fetchWorkListCounter(context); - }) - : Container( - decoration: BoxDecoration( - color: Color(namesColor[1]), - borderRadius: BorderRadius.circular(10), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.missingSwipes.tr().toText12(color: Colors.white), - Row( - children: [ - Expanded( - child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true,maxlines: 1), - ), - SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) - ], - ) - ], - ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), - ).onPress(() { - Navigator.pushNamed(context, AppRoutes.workList); - }), - data.isLeaveTicketBalanceLoading - ? MenuShimmer().onPress(() { - data.fetchWorkListCounter(context); - }) - : Container( - decoration: BoxDecoration( - color: Color(namesColor[2]), - borderRadius: BorderRadius.circular(10), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.leaveBalance.tr().toText12(color: Colors.white), - Row( - children: [ - Expanded( - child: data.leaveBalance.toString().toText16(color: Colors.white, isBold: true,maxlines: 1), - ), - SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) - ], - ) - ], - ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), - ).onPress(() { - Navigator.pushNamed(context, AppRoutes.workList); - }), - data.isLeaveTicketBalanceLoading - ? MenuShimmer().onPress(() { - data.fetchWorkListCounter(context); - }) - : Container( - decoration: BoxDecoration( - color: Color(namesColor[3]), - borderRadius: BorderRadius.circular(10), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.ticketBalance.tr().toText12(color: Colors.white), - Row( - children: [ - Expanded( - child: data.ticketBalance.toString().toText16(color: Colors.white, isBold: true,maxlines: 1), - ), - SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) - ], - ) - ], - ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), - ).onPress(() { - Navigator.pushNamed(context, AppRoutes.workList); - }) - ], - ); - }); + return Consumer( + builder: (cxt, data, child) { + return GridView( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 2 / 2, crossAxisSpacing: 9, mainAxisSpacing: 9), + padding: EdgeInsets.zero, + shrinkWrap: true, + primary: false, + physics: const NeverScrollableScrollPhysics(), + children: [ + data.isWorkListLoading + ? MenuShimmer().onPress(() { + data.fetchWorkListCounter(context, showLoading: true); + }) + : Container( + decoration: BoxDecoration( + color: Color(namesColor[0]), + borderRadius: BorderRadius.circular(10), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.workList.tr().toText12(color: Colors.white), + Row( + children: [ + Expanded( + child: data.workListCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), + ), + SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + ], + ) + ], + ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.workList); + }), + data.isMissingSwipeLoading + ? MenuShimmer().onPress(() { + data.fetchWorkListCounter(context); + }) + : Container( + decoration: BoxDecoration( + color: Color(namesColor[1]), + borderRadius: BorderRadius.circular(10), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.missingSwipes.tr().toText12(color: Colors.white), + Row( + children: [ + Expanded( + child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), + ), + SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + ], + ) + ], + ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.missingSwipes.tr(), "HMG_OTL_MISSING_SWIPE_EIT_SS")); + }), + data.isLeaveTicketBalanceLoading + ? MenuShimmer().onPress(() { + data.fetchWorkListCounter(context); + }) + : Container( + decoration: BoxDecoration( + color: Color(namesColor[2]), + borderRadius: BorderRadius.circular(10), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.leaveBalance.tr().toText12(color: Colors.white), + Row( + children: [ + Expanded( + child: data.leaveBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), + ), + SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + ], + ) + ], + ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.leaveBalance); + }), + data.isLeaveTicketBalanceLoading + ? MenuShimmer().onPress(() { + data.fetchWorkListCounter(context); + }) + : Container( + decoration: BoxDecoration( + color: Color(namesColor[3]), + borderRadius: BorderRadius.circular(10), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.ticketBalance.tr().toText12(color: Colors.white), + Row( + children: [ + Expanded( + child: data.ticketBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), + ), + SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) + ], + ) + ], + ).paddingOnly(left: 10, right: 10, bottom: 6, top: 6), + ).onPress( + () { + Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.ticketBalance.tr(), "HMG_TKT_NEW_EIT_SS")); + }, + ) + ], + ); + }, + ); } } diff --git a/lib/ui/leave_balance/add_leave_balance_screen.dart b/lib/ui/leave_balance/add_leave_balance_screen.dart new file mode 100644 index 0000000..dc44085 --- /dev/null +++ b/lib/ui/leave_balance/add_leave_balance_screen.dart @@ -0,0 +1,637 @@ +import 'dart:io'; + +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/classes/date_uitl.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/config/routes.dart'; +import 'package:mohem_flutter_app/extensions/int_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/get_eit_dff_structure_list_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/calculate_absence_duration_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/get_absence_attendance_types_list_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/get_absence_dff_structure_list_model.dart'; +import 'package:mohem_flutter_app/models/leave_balance/sumbit_absence_transaction_list_model.dart'; +import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart'; +import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; +import 'package:mohem_flutter_app/widgets/bottom_sheets/search_employee_bottom_sheet.dart'; +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); + + @override + _AddLeaveBalanceScreenState createState() { + return _AddLeaveBalanceScreenState(); + } +} + +class _AddLeaveBalanceScreenState extends State { + List getabsenceDffStructureList = []; + List absenceList = []; + + GetAbsenceAttendanceTypesList? selectedAbsenceType; + DateTime? startDateTime; + DateTime? endDateTime; + int? totalDays; + String comment = ""; + ReplacementList? selectedReplacementEmployee; + + DateTime selectedDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day); + + @override + void initState() { + super.initState(); + getAbsenceAttendanceTypes(); + } + + void getAbsenceAttendanceTypes() async { + try { + Utils.showLoading(context); + absenceList = await LeaveBalanceApiClient().getAbsenceAttendanceTypes(); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + void getAbsenceDffStructure() async { + try { + Utils.showLoading(context); + getabsenceDffStructureList.clear(); + getabsenceDffStructureList = await LeaveBalanceApiClient().getAbsenceDffStructure(selectedAbsenceType!.dESCFLEXCONTEXTCODE!, "HR_LOA_SS", -999); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + void getCalculatedAbsenceDuration() async { + try { + Utils.showLoading(context); + CalculateAbsenceDuration duration = await LeaveBalanceApiClient() + .calculateAbsenceDuration(selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, Utils.getMonthNamedFormat(startDateTime!), Utils.getMonthNamedFormat(endDateTime!), -999); + print(duration.toJson()); + totalDays = duration.pABSENCEDAYS; + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + 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"] = 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!.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!.userName!, + DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), + DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), + -999, + dffDataMap, + comments: comment); + + Utils.hideLoading(context); + + await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submit.pTRANSACTIONID!, "", "add_leave_balance")); + Utils.showLoading(context); + await LeaveBalanceApiClient().cancelHrTransaction(submit.pTRANSACTIONID!); + Utils.hideLoading(context); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget( + context, + title: LocaleKeys.leaveBalance.tr(), + ), + body: Column( + children: [ + ListView( + padding: const EdgeInsets.all(21), + children: [ + PopupMenuButton( + child: DynamicTextFieldWidget( + LocaleKeys.absenceType.tr() + "*", + selectedAbsenceType == null ? LocaleKeys.selectTypeT.tr() : selectedAbsenceType!.aBSENCEATTENDANCETYPENAME!, + isEnable: false, + isPopup: true, + ), + itemBuilder: (_) => >[ + for (int i = 0; i < absenceList.length; i++) PopupMenuItem(value: i, child: Text(absenceList[i].aBSENCEATTENDANCETYPENAME!)), + ], + onSelected: (int popupIndex) { + if (selectedAbsenceType == absenceList[popupIndex]) { + return; + } + selectedAbsenceType = absenceList[popupIndex]; + setState(() {}); + getAbsenceDffStructure(); + }, + ), + 12.height, + DynamicTextFieldWidget( + LocaleKeys.startDateT.tr() + "*", + startDateTime == null ? "Select date" : startDateTime.toString().split(' ')[0], + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + var start = await _selectDate(context); + if (start != startDateTime) { + startDateTime = start; + setState(() {}); + } + }, + ), + 12.height, + DynamicTextFieldWidget( + LocaleKeys.endDateT.tr() + "*", + endDateTime == null ? "Select date" : endDateTime.toString().split(' ')[0], + suffixIconData: Icons.calendar_today, + isEnable: false, + isReadOnly: selectedAbsenceType == null || startDateTime == null, + onTap: () async { + if (selectedAbsenceType == null || startDateTime == null) return; + var end = await _selectDate(context); + if (end != endDateTime) { + endDateTime = end; + setState(() {}); + getCalculatedAbsenceDuration(); + } + }, + ), + 12.height, + DynamicTextFieldWidget( + "Total Days", + totalDays?.toString() ?? "Calculated days", + isInputTypeNum: true, + isEnable: false, + onChange: (input) { + totalDays = int.parse(input); + }, + ), + 12.height, + DynamicTextFieldWidget( + LocaleKeys.selectEmployee.tr(), + selectedReplacementEmployee == null ? LocaleKeys.searchForEmployee.tr() : selectedReplacementEmployee!.employeeDisplayName ?? "", + isEnable: false, + onTap: () { + showMyBottomSheet( + context, + child: SearchEmployeeBottomSheet( + title: LocaleKeys.searchForEmployee.tr(), + apiMode: LocaleKeys.delegate.tr(), + onSelectEmployee: (_selectedEmployee) { + // Navigator.pop(context); + selectedReplacementEmployee = _selectedEmployee; + setState(() {}); + }, + ), + ); + }, + ), + 12.height, + DynamicTextFieldWidget( + LocaleKeys.comments.tr(), + LocaleKeys.writeComment.tr(), + lines: 2, + onChange: (input) { + comment = input; + }, + ), + ListView.separated( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: const EdgeInsets.only(top: 12), + itemBuilder: (cxt, int parentIndex) => parseDynamicFormatType(getabsenceDffStructureList[parentIndex], parentIndex), + separatorBuilder: (cxt, index) => 0.height, + itemCount: getabsenceDffStructureList.length, + ) + ], + ).expanded, + DefaultButton( + LocaleKeys.next.tr(), + validateFieldData() + ? null + : () { + validateAbsenceTransaction(); + }, + ).insideContainer + ], + ), + ); + } + + bool validateFieldData() { + List filteredList = getabsenceDffStructureList.where((element) => element.rEQUIREDFLAG == "Y" && (element.eSERVICESDV?.pVALUECOLUMNNAME) == null).toList(); + return (selectedAbsenceType == null || startDateTime == null || endDateTime == null || filteredList.isNotEmpty); + } + + Widget parseDynamicFormatType(GetAbsenceDffStructureList model, int index) { + if (model.dISPLAYFLAG != "N") { + if (model.vALIDATIONTYPE == "N") { + if (model.fORMATTYPE == "C") { + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pIDCOLUMNNAME ?? "", + isReadOnly: model.rEADONLY == "Y", + onChange: (text) { + model.eSERVICESDV ??= ESERVICESDV(); + model.eSERVICESDV!.pIDCOLUMNNAME = text; + }, + ).paddingOnly(bottom: 12); + } else if (model.fORMATTYPE == "N") { + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pIDCOLUMNNAME ?? "", + isReadOnly: model.rEADONLY == "Y", + isInputTypeNum: true, + onChange: (text) { + model.eSERVICESDV ??= ESERVICESDV(); + model.eSERVICESDV!.pIDCOLUMNNAME = text; + }, + ).paddingOnly(bottom: 12); + } else if (model.fORMATTYPE == "X") { + String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? ""; + + if (getabsenceDffStructureList[index].isDefaultTypeIsCDPS) { + if (displayText.contains(" 00:00:00")) { + displayText = displayText.replaceAll(" 00:00:00", ""); + } + if (displayText.contains("/")) { + displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText)); + } + } + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + displayText, + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { + if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) { + selectedDate = DateFormat("yyyy/MM/dd").parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", "")); + } else { + selectedDate = DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!); + } + } + DateTime date = await _selectDate(context); + String dateString = date.toString().split(' ').first; + // DateTime date1 = DateTime(date.year, date.month, date.day); + // getabsenceDffStructureList![index].fieldAnswer = date.toString(); + ESERVICESDV eservicesdv; + if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) { + eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: Utils.formatDate(dateString), + pRETURNMSG: "null", + pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: + getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + } else { + eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: dateString, + pRETURNMSG: "null", + pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: + getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + } + getabsenceDffStructureList![index].eSERVICESDV = eservicesdv; + setState(() {}); + // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + // await calGetValueSetValues(model); + // } + // if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + // await getDefaultValues(model); + // } + }, + ).paddingOnly(bottom: 12); + } else if (model.fORMATTYPE == "Y") { + String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? ""; + if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) { + displayText = Utils.reverseFormatDate(displayText); + // if (displayText.contains(" 00:00:00")) { + // displayText = displayText.replaceAll(" 00:00:00", ""); + // } + // if (!displayText.contains("-")) { + // displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText)); + // } + } + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + displayText, + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { + if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) { + String tempDate = getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!; + if (tempDate.contains("00:00:00")) { + tempDate = tempDate.replaceAll("00:00:00", '').trim(); + } + if (tempDate.contains("/")) { + selectedDate = DateFormat("yyyy/MM/dd").parse(tempDate); + } else { + selectedDate = DateFormat("yyyy-MM-dd").parse(tempDate); + } + } else { + selectedDate = DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!); + } + } + DateTime date = await _selectDate(context); + String dateString = date.toString().split(' ').first; + // getabsenceDffStructureList![index].fieldAnswer = date.toString(); + ESERVICESDV eservicesdv; + if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) { + eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: Utils.formatDate(dateString), + pRETURNMSG: "null", + pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: + getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + } else { + eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: dateString, + pRETURNMSG: "null", + pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: + getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + } + + getabsenceDffStructureList![index].eSERVICESDV = eservicesdv; + setState(() {}); + // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + // await calGetValueSetValues(model); + // } + // if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + // await getDefaultValues(model); + // } + }, + ).paddingOnly(bottom: 12); + } + } else { + return PopupMenuButton( + child: DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pVALUECOLUMNNAME ?? "", + isEnable: false, + isPopup: true, + isInputTypeNum: true, + isReadOnly: model.rEADONLY == "Y", + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + if (model.rEADONLY != "Y") + for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem(child: Text(model.eSERVICESVS![i].vALUECOLUMNNAME!), value: i), + ], + onSelected: (int popipIndex) async { + ESERVICESDV eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: model.eSERVICESVS![popipIndex].iDCOLUMNNAME, + pRETURNMSG: "null", + pRETURNSTATUS: "null", //getabsenceDffStructureList![popipIndex].dEFAULTVALUE, + pVALUECOLUMNNAME: model.eSERVICESVS![popipIndex].vALUECOLUMNNAME); + getabsenceDffStructureList![index].eSERVICESDV = eservicesdv; + setState(() {}); + // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + // await calGetValueSetValues(model); + // } + // if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + // await getDefaultValues(model); + // } + }); + } + } else { + return const SizedBox(); + } + if (model.fORMATTYPE == "N") { + if (model.eSERVICESVS?.isNotEmpty ?? false) { + return PopupMenuButton( + child: DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pVALUECOLUMNNAME ?? "", + isEnable: false, + isPopup: true, + isInputTypeNum: true, + isReadOnly: model.rEADONLY == "Y", + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + if (model.rEADONLY != "Y") + for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem(value: i, child: Text(model.eSERVICESVS![i].vALUECOLUMNNAME!)), + ], + onSelected: (int popipIndex) async { + ESERVICESDV eservicesdv = + ESERVICESDV(pIDCOLUMNNAME: model.eSERVICESVS![popipIndex].iDCOLUMNNAME, pRETURNMSG: "null", pRETURNSTATUS: "null", pVALUECOLUMNNAME: model.eSERVICESVS![popipIndex].vALUECOLUMNNAME); + getabsenceDffStructureList![index].eSERVICESDV = eservicesdv; + setState(() {}); + // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + // await calGetValueSetValues(model); + // } + // if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + // await getDefaultValues(model); + // } + }); + } + + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pIDCOLUMNNAME ?? "", + isReadOnly: model.rEADONLY == "Y", + onChange: (text) { + //model.fieldAnswer = text; + }, + ).paddingOnly(bottom: 12); + } else if (model.fORMATTYPE == "X" || model.fORMATTYPE == "Y") { + String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? ""; + if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) { + if (displayText.contains(" 00:00:00")) { + displayText = displayText.replaceAll(" 00:00:00", ""); + } + if (!displayText.contains("-")) { + displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText)); + } + } + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + displayText, + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { + if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) { + selectedDate = DateFormat("yyyy/MM/dd").parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", "")); + } else { + selectedDate = DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!); + } + } + DateTime date = await _selectDate(context); + String dateString = date.toString().split(' ').first; + // getabsenceDffStructureList![index].fieldAnswer = date.toString(); + ESERVICESDV eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: dateString, + pRETURNMSG: "null", + pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: + getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + getabsenceDffStructureList![index].eSERVICESDV = eservicesdv; + setState(() {}); + // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + // await calGetValueSetValues(model); + // } + // if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + // await getDefaultValues(model); + // } + }, + ).paddingOnly(bottom: 12); + } else if (model.fORMATTYPE == "I") { + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pIDCOLUMNNAME ?? "", + suffixIconData: Icons.access_time_filled_rounded, + isEnable: false, + onTap: () async { + if (getabsenceDffStructureList[index].mOBILEENABLED != "Y") return; + + if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { + var timeString = getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.split(":"); + selectedDate = DateTime(0, 0, 0, int.parse(timeString[0]), int.parse(timeString[1])); + + //DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!); + } + TimeOfDay _time = await _selectTime(context); + DateTime tempTime = DateTime(0, 1, 1, _time.hour, _time.minute); + String time = DateFormat('HH:mm').format(tempTime).trim(); + + // DateTime date1 = DateTime(date.year, date.month, date.day); + // getabsenceDffStructureList![index].fieldAnswer = date.toString(); + ESERVICESDV eservicesdv = ESERVICESDV(pIDCOLUMNNAME: time, pRETURNMSG: "null", pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE, pVALUECOLUMNNAME: time); + getabsenceDffStructureList![index].eSERVICESDV = eservicesdv; + setState(() {}); + // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + // await calGetValueSetValues(model); + // } + // if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + // await getDefaultValues(model); + // } + }, + ).paddingOnly(bottom: 12); + } + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [], + ).objectContainerView(); + } + + Future _selectDate(BuildContext context) async { + DateTime time = selectedDate; + if (Platform.isIOS) { + await showCupertinoModalPopup( + context: context, + builder: (cxt) => Container( + height: 250, + color: Colors.white, + child: CupertinoDatePicker( + backgroundColor: Colors.white, + mode: CupertinoDatePickerMode.date, + onDateTimeChanged: (value) { + if (value != null && value != selectedDate) { + time = value; + } + }, + initialDateTime: selectedDate, + ), + ), + ); + } else { + DateTime? picked = await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + if (picked != null && picked != selectedDate) { + time = picked; + } + } + time = DateTime(time.year, time.month, time.day); + return time; + } + + Future _selectTime(BuildContext context) async { + TimeOfDay time = TimeOfDay(hour: selectedDate.hour, minute: selectedDate.minute); + if (Platform.isIOS) { + await showCupertinoModalPopup( + context: context, + builder: (cxt) => Container( + height: 250, + color: Colors.white, + child: CupertinoDatePicker( + backgroundColor: Colors.white, + mode: CupertinoDatePickerMode.time, + use24hFormat: true, + onDateTimeChanged: (value) { + if (value != null && value != selectedDate) { + time = TimeOfDay(hour: value.hour, minute: value.minute); + } + }, + initialDateTime: selectedDate, + ), + ), + ); + } else { + TimeOfDay? picked = await showTimePicker( + context: context, + initialTime: time, + builder: (cxt, child) { + return MediaQuery(data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: true), child: child ?? Container()); + }); + + if (picked != null && picked != time) { + time = picked; + } + // final DateTime? picked = + // await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + // if (picked != null && picked != selectedDate) { + // time = picked; + // } + } + return time; + } +} diff --git a/lib/ui/leave_balance/leave_balance_screen.dart b/lib/ui/leave_balance/leave_balance_screen.dart new file mode 100644 index 0000000..52d2613 --- /dev/null +++ b/lib/ui/leave_balance/leave_balance_screen.dart @@ -0,0 +1,96 @@ +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/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/config/routes.dart'; +import 'package:mohem_flutter_app/extensions/int_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/leave_balance/get_absence_transaction_list_model.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; + +class LeaveBalance extends StatefulWidget { + LeaveBalance({Key? key}) : super(key: key); + + @override + _LeaveBalanceState createState() { + return _LeaveBalanceState(); + } +} + +class _LeaveBalanceState extends State { + List? absenceTransList; + + @override + void initState() { + super.initState(); + getAbsenceTransactions(); + } + + @override + void dispose() { + super.dispose(); + } + + void getAbsenceTransactions() async { + try { + Utils.showLoading(context); + absenceTransList = await LeaveBalanceApiClient().getAbsenceTransactions(-999); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget( + context, + title: LocaleKeys.leaveBalance.tr(), + ), + body: absenceTransList == null + ? const SizedBox() + : (absenceTransList!.isEmpty + ? Utils.getNoDataWidget(context) + : ListView.separated( + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.all(21), + itemBuilder: (cxt, int index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ItemDetailView(LocaleKeys.startDateT.tr(), absenceTransList![index].sTARTDATE ?? ""), + ItemDetailView(LocaleKeys.endDateT.tr(), absenceTransList![index].eNDDATE ?? ""), + ItemDetailView(LocaleKeys.absenceType.tr(), absenceTransList![index].aBSENCETYPE ?? ""), + ItemDetailView(LocaleKeys.absenceCategory.tr(), absenceTransList![index].aBSENCECATEGORY ?? ""), + ItemDetailView(LocaleKeys.days.tr(), absenceTransList![index].aBSENCEDAYS?.toString() ?? ""), + ItemDetailView(LocaleKeys.hours.tr(), absenceTransList![index].aBSENCEHOURS?.toString() ?? ""), + ItemDetailView(LocaleKeys.approvalStatus.tr(), absenceTransList![index].aPPROVALSTATUS ?? ""), + ItemDetailView(LocaleKeys.absenceStatus.tr(), absenceTransList![index].aBSENCESTATUS ?? ""), + ], + ).objectContainerView(), + separatorBuilder: (cxt, index) => 12.height, + itemCount: absenceTransList!.length)), + floatingActionButton: Container( + height: 54, + width: 54, + decoration: const BoxDecoration( + shape: BoxShape.circle, + gradient: LinearGradient(transform: GradientRotation(.83), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ]), + ), + child: const Icon(Icons.add, color: Colors.white, size: 30), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.addLeaveBalance); + }), + ); + } +} diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index a2ef87a..7cccca8 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -135,7 +135,7 @@ class _LoginScreenState extends State { @override Widget build(BuildContext context) { username.text = "15153"; - password.text = "Abcd@1234"; + password.text = "Abcd@12345"; // username.text = "15444"; return Scaffold( diff --git a/lib/ui/misc/request_submit_screen.dart b/lib/ui/misc/request_submit_screen.dart index 63874c7..ba69ee8 100644 --- a/lib/ui/misc/request_submit_screen.dart +++ b/lib/ui/misc/request_submit_screen.dart @@ -4,6 +4,7 @@ import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; +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/classes/colors.dart'; @@ -27,6 +28,7 @@ class RequestSubmitScreenParams { int transactionId; String pItemId; String approvalFlag; + RequestSubmitScreenParams(this.title, this.transactionId, this.pItemId, this.approvalFlag); } @@ -113,20 +115,24 @@ class _RequestSubmitScreenState extends State { params!.pItemId, params!.transactionId, ); - } else { + } else if (params!.approvalFlag == 'add_leave_balance') { + await LeaveBalanceApiClient().startAbsenceApprovalProcess( + params!.transactionId, + comments.text, + -999, + ); + } else if (params!.approvalFlag == 'eit') { await MyAttendanceApiClient().startEitApprovalProcess( LocaleKeys.submit.tr(), comments.text, params!.pItemId, params!.transactionId, ); - } + } else {} Utils.hideLoading(context); Utils.showToast(LocaleKeys.yourRequestHasBeenSubmittedForApprovals.tr(), longDuration: true); - Navigator.of(context).popUntil((route) { - return route.settings.name == AppRoutes.dashboard; - }); + Navigator.of(context).popUntil((route) => route.settings.name == AppRoutes.dashboard); Navigator.pushNamed(context, AppRoutes.workList); } catch (ex) { Utils.hideLoading(context); @@ -147,17 +153,16 @@ class _RequestSubmitScreenState extends State { } return Scaffold( backgroundColor: Colors.white, - appBar: AppBarWidget( - context, - title: params!.title, - ), + appBar: AppBarWidget(context, title: params!.title), body: Column( children: [ ListView( padding: const EdgeInsets.all(21).copyWith(top: 14), physics: const BouncingScrollPhysics(), children: [ - attachmentView(LocaleKeys.attachments.tr(),), + attachmentView( + LocaleKeys.attachments.tr(), + ), 14.height, InputWidget( LocaleKeys.comments.tr(), @@ -207,15 +212,15 @@ class _RequestSubmitScreenState extends State { return Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - CircularAvatar(url: approver.eMPLOYEEIMAGE, isImageBase64: true, height: 40, width: 40), + CircularAvatar(url: approver.eMPLOYEEIMAGE, isImageBase64: approver.eMPLOYEEIMAGE != null, height: 40, width: 40), 9.width, Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - approver.aPPROVER!.toText16(), - approver.pOSITIONTITLE!.toText12(color: MyColors.lightTextColor), + (approver.aPPROVER ?? "").toText16(), + (approver.pOSITIONTITLE ?? "").toText12(color: MyColors.lightTextColor), ], ), ) 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 72b0567..4f6e527 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -281,7 +281,7 @@ class _DynamicInputScreenState extends State { // idColName = DateFormat('yyyy/MM/dd HH:mm:ss').format(DateTime(date.year, date.month, date.day)); // } - idColName = formatStandardDate(idColName!); + idColName = Utils.formatStandardDate(idColName!); } } else { val = getEitDffStructureList![j].eSERVICESDV?.pVALUECOLUMNNAME; @@ -293,7 +293,7 @@ class _DynamicInputScreenState extends State { idColName = val; if (getEitDffStructureList![j].fORMATTYPE == "X") { - idColName = formatDateNew(idColName!); + idColName = Utils.formatDateNew(idColName!); // commenting to test // DateTime date = DateFormat('yyyy-MM-dd').parse(idColName!); // idColName = DateFormat('yyyy-MM-dd HH:mm:ss').format(date); @@ -406,7 +406,8 @@ class _DynamicInputScreenState extends State { padding: const EdgeInsets.all(21), itemBuilder: (cxt, int parentIndex) => parseDynamicFormatType(getEitDffStructureList![parentIndex], parentIndex), separatorBuilder: (cxt, index) => 0.height, - itemCount: getEitDffStructureList!.length))) + itemCount: getEitDffStructureList!.length, + ))) .expanded, // 12.height, DefaultButton( @@ -481,16 +482,18 @@ class _DynamicInputScreenState extends State { ESERVICESDV eservicesdv; if (getEitDffStructureList![index].isDefaultTypeIsCDPS) { eservicesdv = ESERVICESDV( - pIDCOLUMNNAME: formatDate(dateString), + pIDCOLUMNNAME: Utils.formatDate(dateString), pRETURNMSG: "null", pRETURNSTATUS: getEitDffStructureList![index].dEFAULTVALUE, - pVALUECOLUMNNAME: getEitDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + pVALUECOLUMNNAME: + getEitDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); } else { eservicesdv = ESERVICESDV( pIDCOLUMNNAME: dateString, pRETURNMSG: "null", pRETURNSTATUS: getEitDffStructureList![index].dEFAULTVALUE, - pVALUECOLUMNNAME: getEitDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + pVALUECOLUMNNAME: + getEitDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); } getEitDffStructureList![index].eSERVICESDV = eservicesdv; setState(() {}); @@ -505,7 +508,7 @@ class _DynamicInputScreenState extends State { } else if (model.fORMATTYPE == "Y") { String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? (getEitDffStructureList![index].fieldAnswer ?? ""); if (getEitDffStructureList![index].isDefaultTypeIsCDPS) { - displayText = reverseFormatDate(displayText); + displayText = Utils.reverseFormatDate(displayText); // if (displayText.contains(" 00:00:00")) { // displayText = displayText.replaceAll(" 00:00:00", ""); // } @@ -540,16 +543,18 @@ class _DynamicInputScreenState extends State { ESERVICESDV eservicesdv; if (getEitDffStructureList![index].isDefaultTypeIsCDPS) { eservicesdv = ESERVICESDV( - pIDCOLUMNNAME: formatDate(dateString), + pIDCOLUMNNAME: Utils.formatDate(dateString), pRETURNMSG: "null", pRETURNSTATUS: getEitDffStructureList![index].dEFAULTVALUE, - pVALUECOLUMNNAME: getEitDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + pVALUECOLUMNNAME: + getEitDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); } else { eservicesdv = ESERVICESDV( pIDCOLUMNNAME: dateString, pRETURNMSG: "null", pRETURNSTATUS: getEitDffStructureList![index].dEFAULTVALUE, - pVALUECOLUMNNAME: getEitDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + pVALUECOLUMNNAME: + getEitDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); } getEitDffStructureList![index].eSERVICESDV = eservicesdv; @@ -663,7 +668,7 @@ class _DynamicInputScreenState extends State { pIDCOLUMNNAME: dateString, pRETURNMSG: "null", pRETURNSTATUS: getEitDffStructureList![index].dEFAULTVALUE, - pVALUECOLUMNNAME: getEitDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + pVALUECOLUMNNAME: getEitDffStructureList![index].isDefaultTypeIsCDPS ? Utils.reverseFormatStandardDate(Utils.formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); getEitDffStructureList![index].eSERVICESDV = eservicesdv; setState(() {}); if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { @@ -736,8 +741,7 @@ class _DynamicInputScreenState extends State { ), ); } else { - DateTime? picked = - await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + DateTime? picked = await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); if (picked != null && picked != selectedDate) { time = picked; } @@ -786,59 +790,4 @@ class _DynamicInputScreenState extends State { } return time; } - - String reverseFormatDate(String date) { - String formattedDate; - if (date.isNotEmpty) { - formattedDate = date.replaceAll('/', '-'); - formattedDate = formattedDate.replaceAll(' 00:00:00', ''); - } else { - formattedDate = date; - } - return formattedDate; - } - - String formatStandardDate(String date) { - String formattedDate; - if (date.isNotEmpty) { - formattedDate = date.replaceAll('-', '/'); - } else { - formattedDate = date; - } - return formattedDate; - } - - String reverseFormatStandardDate(String date) { - String formattedDate; - if (date.isNotEmpty) { - formattedDate = date.replaceAll('/', '-'); - } else { - formattedDate = date; - } - return formattedDate; - } - - String formatDate(String date) { - String formattedDate; - - if (date.isNotEmpty) { - date = date.substring(0, 10); - formattedDate = date.replaceAll('-', '/'); - formattedDate = formattedDate + ' 00:00:00'; - } else { - formattedDate = date; - } - return formattedDate; - } - - String formatDateNew(String date) { - String formattedDate; - if (date.isNotEmpty) { - formattedDate = date.split('T')[0]; - formattedDate = formattedDate + ' 00:00:00'; - } else { - formattedDate = date; - } - return formattedDate; - } } diff --git a/lib/ui/my_team/create_request.dart b/lib/ui/my_team/create_request.dart new file mode 100644 index 0000000..5044c22 --- /dev/null +++ b/lib/ui/my_team/create_request.dart @@ -0,0 +1,95 @@ + +import 'dart:ui'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:mohem_flutter_app/api/my_team/my_team_api_client.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'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; +import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; +import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; +import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; + +class CreateRequest extends StatefulWidget { + const CreateRequest ({Key? key}) : super(key: key); + + @override + _CreateRequestState createState() => _CreateRequestState(); +} + +class _CreateRequestState extends State { + String searchEmpEmail =""; + String searchEmpName =""; + String searchEmpNo = ""; + String? empId; + List getEmployeeSubordinatesList = []; +// late DashboardProviderModel data; + List getMenuEntriesList = []; + GetEmployeeSubordinatesList? getEmployeeSubordinates; + + @override + void initState() { + super.initState(); + // data.fetchMenuEntries(); + employeeSubRequest(); + } + + void employeeSubRequest() async { + try { + Utils.showLoading(context); + getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString()); + getMenuEntriesList = await MyTeamApiClient().employeeSubordinatesRequest(getEmployeeSubordinates?.eMPLOYEENUMBER); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + @override + Widget build(BuildContext context) { + getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList; + print(getMenuEntriesList.length); + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget( + context, + title: LocaleKeys.createRequest.tr(), + ), + body: SizedBox( + width: double.infinity, + height: double.infinity, + child: getMenuEntriesList.isEmpty + ? Utils.getNoDataWidget(context) + : ListView.separated( + padding: const EdgeInsets.all(21), + itemBuilder: (cxt, index) => itemView("assets/images/pdf.svg", getMenuEntriesList[index].prompt!, index).onPress(() { + Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(getMenuEntriesList[index].prompt!, getMenuEntriesList[index].functionName!)); + }), + separatorBuilder: (cxt, index) => 12.height, + itemCount: getMenuEntriesList.length), + ), + + ); + } + + Widget itemView(String icon, String title, index) { + return getMenuEntriesList[index].parentMenuName !=""? Row( + children: [ + (title).toText16().expanded, 12.width, + SvgPicture.asset( + "assets/images/arrow_next.svg", + color: MyColors.darkIconColor, + ) + ], + ).objectContainerView() : SizedBox(); + } +} diff --git a/lib/ui/my_team/employee_details.dart b/lib/ui/my_team/employee_details.dart new file mode 100644 index 0000000..26c844f --- /dev/null +++ b/lib/ui/my_team/employee_details.dart @@ -0,0 +1,321 @@ +import 'dart:collection'; +import 'dart:ui'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_html/html_parser.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:mohem_flutter_app/api/my_team/my_team_api_client.dart'; +import 'package:mohem_flutter_app/api/worklist/worklist_api_client.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'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; +import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; +import 'package:mohem_flutter_app/models/profile_menu.model.dart'; +import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart'; +import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart'; +import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; +import 'package:mohem_flutter_app/widgets/circular_avatar.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class EmployeeDetails extends StatefulWidget { + EmployeeDetails(); + + @override + _EmployeeDetailsState createState() => _EmployeeDetailsState(); + +} + +class _EmployeeDetailsState extends State { + GetEmployeeSubordinatesList? getEmployeeSubordinates; + static List menuData = []; + List menu =[]; + String? selectedFavLetter; + List? favLetters; + List? favUsersList; + List? replacementList; + + @override + void initState() { + super.initState(); + // setState(() {}); + } + + //favorite + void fetchChangeFav({required String email, required String employeName, required String image, required String userName, bool isFav = false, bool isNeedToRefresh = false}) async { + Utils.showLoading(context); + getEmployeeSubordinates = ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList; + GenericResponseModel model = await MyTeamApiClient().changeFavoriteReplacements( + email: email, + employeName: employeName, + image: image, + userName: userName, + isFav: isFav, + ); + getEmployeeSubordinates!.isFavorite = isFav; + Utils.hideLoading(context); + setState(() {}); + } + + + @override + Widget build(BuildContext context) { + if(getEmployeeSubordinates == null) { + getEmployeeSubordinates = ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList; + setMenu(); + } + + + return Scaffold( + extendBody: true, + backgroundColor: MyColors.lightGreyEFColor, + body: Stack(children: [ + Container( + height: 200, + margin: EdgeInsets.only(top: 30), + decoration: BoxDecoration(image: DecorationImage(image: MemoryImage(Utils.getPostBytes(getEmployeeSubordinates!.eMPLOYEEIMAGE)), fit: BoxFit.cover)), + child: new BackdropFilter( + filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), + child: new Container( + decoration: new BoxDecoration(color: Colors.white.withOpacity(0.0)), + ), + ), + ), + SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 80.height, + Container( + padding: EdgeInsets.only(left: 15, right: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton( + onPressed: () { + Navigator.pop(context); + }, + icon: Icon( + Icons.arrow_back_ios, + color: Colors.white, + ), + ), + ], + ), + ), + myTeamInfo() + ], + ), + ) + ])); + } + + Widget myTeamInfo() { + Uri phoneNumber = Uri.parse('tel:${getEmployeeSubordinates?.eMPLOYEEMOBILENUMBER}'); + double _width = MediaQuery + .of(context) + .size + .width; + return Column( + children: [ + Container( + margin: EdgeInsets.fromLTRB(21, 0, 21, 10), + child: Stack(children: [ + Container( + width: _width, + margin: EdgeInsets.only(top: 50), + //padding: EdgeInsets.only(right: 17, left: 17), + decoration: BoxDecoration( + color: MyColors.whiteColor, + borderRadius: const BorderRadius.all(Radius.circular(15)), + boxShadow: [BoxShadow(color: MyColors.lightGreyColor, blurRadius: 15, spreadRadius: 3)], + ), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton( + onPressed: (){ + if(getEmployeeSubordinates!.isFavorite != true){ + showFavoriteAlertDialog(context); + setState(() {}); + }else{ + fetchChangeFav( + email: getEmployeeSubordinates?.eMPLOYEEEMAILADDRESS ?? "", + employeName: getEmployeeSubordinates!.eMPLOYEENAME ?? "", + image: getEmployeeSubordinates!.eMPLOYEEIMAGE ?? "", + userName: getEmployeeSubordinates!.eMPLOYEENUMBER ?? "", + isFav: false,); + setState(() {}); + } }, + icon: getEmployeeSubordinates!.isFavorite != true + ? Icon( + Icons.star_outline, + size: 35, + color: MyColors.green9CColor, + ) + : Icon( + Icons.star_outlined, + size: 35, + color: MyColors.green9CColor, + ), + ), + InkWell( + onTap:() { + launchUrl(phoneNumber); + }, + child: SvgPicture.asset("assets/images/call.svg"), + ), + ], + ).paddingOnly(left:6, right: 17, top: 16), + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + /// card header + customLabel(getEmployeeSubordinates!.eMPLOYEENAME.toString(), 21, MyColors.grey3AColor, true), + customLabel(getEmployeeSubordinates!.eMPLOYEENUMBER.toString() + ' | ' + getEmployeeSubordinates!.jOBNAME.toString(), 13, MyColors.grey80Color, true), + customLabel(getEmployeeSubordinates!.eMPLOYEEEMAILADDRESS.toString(), 13, MyColors.grey3AColor, true), + ], + ).paddingOnly(bottom: 10, left: 35,right: 31), + ], + ), + ), + Container(height: 100, alignment: Alignment.center, child: ProfileImage()), + ]) + ), + Container( + margin: EdgeInsets.fromLTRB(21, 8, 21, 10), + height: 260, + padding: EdgeInsets.only(top: 15, bottom: 15), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: const BorderRadius.all(Radius.circular(15)), + boxShadow: [BoxShadow(color: MyColors.lightGreyColor, blurRadius: 15, spreadRadius: 3)], + ), + child: Column( + children: menu.map((ProfileMenu i) => rowItem(i, context)).toList(), + ), + ), + ], + ); + } + + Widget ProfileImage() => + CircleAvatar( + radius: 70, + backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSubordinates?.eMPLOYEEIMAGE)), + backgroundColor: Colors.black, + ); + + Widget customLabel(String label, double size, Color color, bool isBold, {double padding = 0.0}) => + Container( + padding: EdgeInsets.all(padding), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, + children: [Text(label, style: TextStyle(color: color, fontSize: size, fontWeight: isBold ? FontWeight.bold : FontWeight.normal))])); + + Widget rowItem(obj, context) { + return InkWell( + onTap: () { + + Navigator.pushNamed(context, obj.route, arguments:obj.arguments); + + }, + child: ListTile( + leading: SvgPicture.asset('assets/images/' + obj.icon), + title: Text(obj.name, + style: TextStyle(color: MyColors.grey3AColor, + fontWeight: FontWeight.w600, + fontSize: 16)), + trailing: Icon(Icons.arrow_forward, + color: MyColors.grey3AColor,), + ), + ); + } + void setMenu(){ + menu = [ + ProfileMenu(name: "Profile Details", icon: "profile_details.svg", route: AppRoutes.profileDetails, arguments:getEmployeeSubordinates), + ProfileMenu(name: "Create Request", icon: "create_request.svg", route: AppRoutes.createRequest,arguments: getEmployeeSubordinates), + ProfileMenu(name: "View Attendance", icon: "view_attendance.svg", route: AppRoutes.viewAttendance, arguments: getEmployeeSubordinates), + ProfileMenu(name: "Team Members", icon: "team.svg", route: AppRoutes.teamMembers, arguments: getEmployeeSubordinates), + ]; + } + + void showFavoriteAlertDialog(BuildContext context) { + Widget cancelButton = TextButton( + child: Text( + LocaleKeys.cancel.tr(), + ), + onPressed: () { + Navigator.pop(context); + }, + ); + Widget continueButton = TextButton( + child: Text( + LocaleKeys.ok.tr(), + ), + onPressed: () { + fetchChangeFav( + email: getEmployeeSubordinates?.eMPLOYEEEMAILADDRESS ?? "", + employeName: getEmployeeSubordinates!.eMPLOYEENAME ?? "", + image: getEmployeeSubordinates!.eMPLOYEEIMAGE ?? "", + userName: getEmployeeSubordinates!.eMPLOYEENUMBER ?? "", + isFav: true, + ); + setState(() {}); + Navigator.pop(context); + }, + ); + AlertDialog alert = AlertDialog( + title: Text( + LocaleKeys.confirm.tr(), + ), + content: Container( + height: 150, + child: Column( + children: [ + Text("Do you want to add" + "${getEmployeeSubordinates!.eMPLOYEENAME.toString()}" + "in your favorite list "), + CircularAvatar( + url: getEmployeeSubordinates!.eMPLOYEEIMAGE ?? "", + height: 50, + width: 50, + isImageBase64: true, + ).paddingOnly(top: 21), + // 16.width, + ], + ), + ), + actions: [ + cancelButton, + continueButton, + ], + ); + showDialog( + context: context, + builder: (BuildContext context) { + return alert; + }, + ); + } +} + + GetMenuEntriesList getMenuEntries(String type) { + List data = _EmployeeDetailsState.menuData.where((GetMenuEntriesList test) => test.functionName == type).toList(); + if (data.isNotEmpty) { + return data[0]; + } else { + return GetMenuEntriesList(); + } + + +} + + diff --git a/lib/ui/my_team/my_team.dart b/lib/ui/my_team/my_team.dart new file mode 100644 index 0000000..15ce3d2 --- /dev/null +++ b/lib/ui/my_team/my_team.dart @@ -0,0 +1,199 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:mohem_flutter_app/api/my_team/my_team_api_client.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'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class MyTeam extends StatefulWidget { + const MyTeam({Key? key}) : super(key: key); + + @override + _MyTeamState createState() => _MyTeamState(); +} + +class _MyTeamState extends State { + String searchEmpEmail = ""; + String searchEmpName = ""; + String searchEmpNo = ""; + String? empId; + List getEmployeeSubordinatesList = []; + TextEditingController? _textEditingController = TextEditingController(); + List getEmployeeSListOnSearch = []; + + String dropdownValue = 'Name'; + + void initState() { + super.initState(); + getEmployeeSubordinates(); + } + + void getEmployeeSubordinates() async { + try { + Utils.showLoading(context); + getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString()); + getEmployeeSListOnSearch = getEmployeeSubordinatesList; + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBarWidget( + context, + title: LocaleKeys.myTeamMembers.tr(), + showMemberButton: true, + ), + backgroundColor: MyColors.backgroundColor, + body: SingleChildScrollView( + child: Column( + children: [ + Container( + margin: EdgeInsets.only(left: 21, right: 21, top: 20, bottom: 6), + padding: EdgeInsets.only(left: 14, right: 14, top: 21, bottom: 21), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Color(0xffFFFFFF), + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: Row( + children: [ + Expanded( + child: TextField( + onChanged: dropdownValue == "Name" + ? (String value) { + getEmployeeSListOnSearch = + getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEENAME!.toLowerCase().contains(value.toLowerCase())).toList(); + setState(() {}); + } + : (String value) { + getEmployeeSListOnSearch = + getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element) => element.eMPLOYEEEMAILADDRESS!.toLowerCase().contains(value.toLowerCase())).toList(); + setState(() {}); + }, + controller: _textEditingController, + decoration: InputDecoration( + filled: true, + fillColor: Colors.white, + border: InputBorder.none, + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + // contentPadding: EdgeInsets.fromLTRB(10, 15, 10, 15), + hintText: LocaleKeys.searchBy.tr() + " $dropdownValue", + hintStyle: TextStyle(fontSize: 14.0, color: MyColors.grey57Color, fontWeight: FontWeight.w600), + ), + )), + Container( + height: 36, + width: 1, + color: Color(0xffC4C4C4), + ), + 10.width, + dropDown(), + ], + ), + ), + Container( + margin: EdgeInsets.only(left: 21, right: 21), + width: MediaQuery.of(context).size.width, + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + children: [ + _textEditingController!.text.isNotEmpty && getEmployeeSListOnSearch.isEmpty + ? Container( + child: LocaleKeys.noResultsFound.tr().toText16(color: MyColors.blackColor), + ).paddingOnly(top: 10) + : ListView.separated( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + separatorBuilder: (cxt, index) => 12.height, + itemCount: _textEditingController!.text.isNotEmpty ? getEmployeeSListOnSearch.length : getEmployeeSubordinatesList.length, + itemBuilder: (context, index) { + var phoneNumber = Uri.parse('tel:${getEmployeeSListOnSearch[index].eMPLOYEEMOBILENUMBER}'); + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CircleAvatar( + radius: 25, + backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSListOnSearch[index].eMPLOYEEIMAGE)), + backgroundColor: Colors.black, + ), + 10.width, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // "Present".toText13(color: MyColors.greenColor), + "${getEmployeeSListOnSearch[index].eMPLOYEENAME}".toText16(isBold: true, color: MyColors.grey3AColor), + "${getEmployeeSListOnSearch[index].pOSITIONNAME}".toText10(isBold: true, color: MyColors.grey57Color), + ], + ).expanded, + Column( + children: [ + InkWell( + onTap: () { + launchUrl(phoneNumber); + }, + child: SvgPicture.asset("assets/images/call.svg"), + ), + 21.height, + InkWell( + onTap: () async { + Navigator.pushNamed(context, AppRoutes.employeeDetails, arguments: getEmployeeSListOnSearch[index]); + }, + child: Icon(Icons.arrow_forward_outlined, color: MyColors.grey3AColor), + ), + ], + ), + ], + ).objectContainerView(); + }) + ], + ), + ), + ) + ], + ), + )); + } + + Widget dropDown() { + return + DropdownButton( + value: dropdownValue, + icon: const Icon(Icons.keyboard_arrow_down, + color: MyColors.grey57Color).paddingOnly(left: 4), + elevation: 16, + onChanged: (String? newValue) { + setState(() { + dropdownValue = newValue!; + }); + }, + items: ['Name', 'Email'].map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + style: TextStyle(fontSize: 14.0, color: MyColors.grey57Color, + fontWeight: FontWeight.w600), + ); + } +} diff --git a/lib/ui/my_team/profile_details.dart b/lib/ui/my_team/profile_details.dart new file mode 100644 index 0000000..cfc1730 --- /dev/null +++ b/lib/ui/my_team/profile_details.dart @@ -0,0 +1,79 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; + + +class ProfileDetails extends StatefulWidget { + const ProfileDetails({Key? key}) : super(key: key); + + @override + _ProfileDetailsState createState() => _ProfileDetailsState(); +} + +class _ProfileDetailsState extends State { + GetEmployeeSubordinatesList? getEmployeeSubordinates; + + + + @override + void initState() { + super.initState(); + } + + Widget build(BuildContext context) { + getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList; + return Scaffold( + appBar: AppBarWidget( + context, + title: LocaleKeys.profileDetails.tr(), + ), + backgroundColor: MyColors.backgroundColor, + body: Column( + children: [ + Container( + width: double.infinity, + margin: EdgeInsets.only( + top: 20, + left: 21, + right: 21, + ), + padding: EdgeInsets.only(left: 14, right: 14, top: 13, bottom: 20), + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 5, + blurRadius: 26, + offset: Offset(0, 3), + ), + ], + color: Colors.white, + borderRadius: BorderRadius.circular(10.0), + ), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + LocaleKeys.category.tr().toText13(color: MyColors.lightGrayColor), + "${getEmployeeSubordinates?.eMPLOYMENTCATEGORYMEANING}".toText16(isBold: true, color: MyColors.darkTextColor), + 23.height, + LocaleKeys.address.tr().toText13(color: MyColors.lightGrayColor), + "${getEmployeeSubordinates?.lOCATIONNAME}".toText16(isBold: true, color: MyColors.darkTextColor), + 23.height, + LocaleKeys.phoneNumber.tr().toText13(color: MyColors.lightGrayColor), + "${getEmployeeSubordinates?.eMPLOYEEMOBILENUMBER}".toText16(isBold: true, color: MyColors.darkTextColor), + 23.height, + LocaleKeys.businessGroup.tr().toText13(color: MyColors.lightGrayColor), + "${getEmployeeSubordinates?.bUSINESSGROUPNAME}".toText16(isBold: true, color: MyColors.darkTextColor), + 23.height, + LocaleKeys.Payroll.tr().toText13(color: MyColors.lightGrayColor), + "${getEmployeeSubordinates?.pAYROLLNAME}".toText16(isBold: true, color: MyColors.darkTextColor), + ]), + ), + ], + )); + } + +} diff --git a/lib/ui/my_team/subordinate_leave.dart b/lib/ui/my_team/subordinate_leave.dart new file mode 100644 index 0000000..9e69fdc --- /dev/null +++ b/lib/ui/my_team/subordinate_leave.dart @@ -0,0 +1,187 @@ + +import 'dart:io'; + +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:mohem_flutter_app/api/my_team/my_team_api_client.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/date_uitl.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/config/routes.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/my_team/get_subordinates_leaves_total_vacations_list_model.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; + + +class SubordinateLeave extends StatefulWidget { + const SubordinateLeave({Key? key}) : super(key: key); + + @override + _SubordinateLeaveState createState() => _SubordinateLeaveState(); +} + +class _SubordinateLeaveState extends State { + List getSubordinatesLeavesTotalList = []; + DateTime selectedDateFrom = DateTime.now(); + DateTime selectedDateTo = DateTime.now(); + bool showList = false; + + + + + @override + void initState() { + super.initState(); + } + + void getSubordinatesLeaves()async { + try { + Utils.showLoading(context); + getSubordinatesLeavesTotalList = await MyTeamApiClient().getSubordinatesLeavesList(DateUtil.convertDateToStringLocation(selectedDateFrom), DateUtil.convertDateToStringLocation(selectedDateTo)); + showList= true; + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBarWidget( + context, + title: LocaleKeys.subordinateLeave.tr(), + ), + backgroundColor: MyColors.backgroundColor, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + children: [ + Column( + children: [ + DynamicTextFieldWidget( + LocaleKeys.dateFrom.tr(), + selectedDateFrom.toString().split(" ")[0], + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + selectedDateFrom = await _selectDate(context, DateTime.now()); + setState(() {}); + }, + ), + 12.height, + DynamicTextFieldWidget( + LocaleKeys.dateTo.tr(), + selectedDateTo.toString().split(" ")[0], + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + selectedDateTo = await _selectDate(context, DateTime.now()); + setState(() {}); + }, + ) + ], + ).objectContainerView(), + Container( + margin: EdgeInsets.only(left: 21, right: 21), + width: MediaQuery.of(context).size.width, + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + children: [ + showList? ListView.separated( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + separatorBuilder: (BuildContext cxt,int index) => 12.height, + itemCount: getSubordinatesLeavesTotalList.length, + itemBuilder: (BuildContext context,int index) { + var diffDays = DateUtil.convertStringToDate(getSubordinatesLeavesTotalList[index].dATEEND!).difference(DateUtil.convertStringToDate(getSubordinatesLeavesTotalList[index].dATESTART!)).inDays; + return getSubordinatesLeavesTotalList.isEmpty + ? Utils.getNoDataWidget(context) + : Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset("assets/images/user.svg"), + 14.width, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "${getSubordinatesLeavesTotalList[index].eMPLOYEENAME}".toText16(isBold: true, color: MyColors.grey3AColor), + 10.height, + Row( + children: [ + (LocaleKeys.from.tr() + ': ${DateUtil.getFormattedDate(DateUtil.convertStringToDate(getSubordinatesLeavesTotalList[index].dATESTART!), "MMM dd yyyy")}').toText10(isBold: true, color: MyColors.grey57Color), + 14.width, + (LocaleKeys.to.tr() + ': ${DateUtil.getFormattedDate(DateUtil.convertStringToDate(getSubordinatesLeavesTotalList[index].dATEEND!), "MMM dd yyyy")}').toText10(isBold: true, color: MyColors.grey57Color), + ], + ), + (LocaleKeys.numberDays.tr()+ ": $diffDays").toText10(color: MyColors.grey3AColor), + ], + ).expanded + ], + ).objectContainerView(); + } + ) + :Container(), + ], + ), + ), + ), + ], + ), + ), + ), + DefaultButton( + LocaleKeys.submit.tr(), () async { + getSubordinatesLeaves(); + }).insideContainer + ], + ), + ); + } + + + + Future _selectDate(BuildContext context, DateTime selectedDate) async { + DateTime time = selectedDate; + if (!Platform.isIOS) { + await showCupertinoModalPopup( + context: context, + builder: (cxt) => Container( + height: 250, + color: Colors.white, + child: CupertinoDatePicker( + backgroundColor: Colors.white, + mode: CupertinoDatePickerMode.date, + onDateTimeChanged: (value) { + if (value != null && value != selectedDate) { + time = value; + } + }, + initialDateTime: selectedDate, + ), + ), + ); + } else { + DateTime? picked = await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + if (picked != null && picked != selectedDate) { + time = picked; + } + } + return time; + } +} diff --git a/lib/ui/my_team/team_members.dart b/lib/ui/my_team/team_members.dart new file mode 100644 index 0000000..37a779d --- /dev/null +++ b/lib/ui/my_team/team_members.dart @@ -0,0 +1,111 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/my_team/my_team_api_client.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'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class TeamMembers extends StatefulWidget { + const TeamMembers({Key? key}) : super(key: key); + + @override + _TeamMembersState createState() => _TeamMembersState(); +} + +class _TeamMembersState extends State { + String searchEmpEmail =""; + String searchEmpName =""; + String searchEmpNo = ""; + String? empId; + List getEmployeeSubordinatesList = []; + GetEmployeeSubordinatesList? getEmployeeSubordinates; + + void initState() { + super.initState(); + employeeSubordinates(); + } + + void employeeSubordinates() async { + try { + Utils.showLoading(context); + getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString()); + getEmployeeSubordinatesList = await MyTeamApiClient().employeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString(),getEmployeeSubordinates?.eMPLOYEENUMBER); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + @override + Widget build(BuildContext context) { + getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList; + return Scaffold( + appBar: AppBarWidget( + context, + title: LocaleKeys.teamMembers.tr(), + ), + backgroundColor: MyColors.backgroundColor, + body: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + children: [ + getEmployeeSubordinatesList.isEmpty + ? Utils.getNoDataWidget(context): + ListView.separated( + scrollDirection: Axis.vertical, + shrinkWrap: true, + padding: EdgeInsets.all(21), + physics: ScrollPhysics(), + separatorBuilder: (cxt, index) => 12.height, + itemCount: getEmployeeSubordinatesList.length, + itemBuilder: (BuildContext context, int index) { + var phoneNumber = Uri.parse('tel:${getEmployeeSubordinatesList[index].eMPLOYEEMOBILENUMBER}'); + return Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CircleAvatar( + radius: 25, + backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSubordinatesList[index].eMPLOYEEIMAGE)), + backgroundColor: Colors.black, + ), + SizedBox(width: 10,), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // "Present".toText13(color: MyColors.greenColor), + "${getEmployeeSubordinatesList[index].eMPLOYEENAME}".toText16(isBold: true, color: MyColors.grey3AColor), + "${getEmployeeSubordinatesList[index].pOSITIONNAME}".toText10(isBold: true, color: MyColors.grey57Color), + ], + ).expanded, + Column( + children: [ + IconButton( + onPressed: () { + launchUrl(phoneNumber); + }, + icon: Icon( + Icons.whatsapp, + color: Colors.green, + ), + ), + ], + ), + ], + ), + ).objectContainerView(); + }), + ], + ) + )); + } +} diff --git a/lib/ui/my_team/view_attendance.dart b/lib/ui/my_team/view_attendance.dart new file mode 100644 index 0000000..28ab0f6 --- /dev/null +++ b/lib/ui/my_team/view_attendance.dart @@ -0,0 +1,557 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/my_team/my_team_api_client.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/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/get_attendance_tracking_list_model.dart'; +import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart'; +import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; +import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:month_picker_dialog/month_picker_dialog.dart'; +import 'package:pie_chart/pie_chart.dart'; +import 'package:syncfusion_flutter_calendar/calendar.dart'; + +class ViewAttendance extends StatefulWidget { + const ViewAttendance({Key? key}) : super(key: key); + + @override + _ViewAttendanceState createState() => _ViewAttendanceState(); +} + +class _ViewAttendanceState extends State { + bool isPresent = false; + bool isAbsent = false; + bool isMissing = false; + bool isOff = false; + DateTime date = DateTime.now(); + late DateTime formattedDate; + var currentMonth = DateTime.now().month; + String searchMonth = getMonth(DateTime.now().month); + int searchYear = DateTime.now().year; + int? pRTPID; + + String searchEmpEmail =""; + String searchEmpName =""; + String searchEmpNo = ""; + String? empId; + List getEmployeeSubordinatesList = []; + List getDayHoursTypeDetailsList = []; + GetTimeCardSummaryList? getTimeCardSummaryList; + GetAttendanceTracking? attendanceTracking; + GetEmployeeSubordinatesList? getEmployeeSubordinates; + + @override + void initState() { + super.initState(); + formattedDate = date; + callTimeCardAndHourDetails(date.day, searchMonth, searchYear); + } + + + void callTimeCardAndHourDetails(index, searchMonth, searchYear) async { + try { + Utils.showLoading(context); + getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString()); + getTimeCardSummaryList = await MyTeamApiClient().getTimeCardSummary(searchMonth, searchYear,getEmployeeSubordinates?.eMPLOYEENUMBER); + getDayHoursTypeDetailsList = await MyTeamApiClient().getDayHoursTypeDetails(searchMonth, searchYear, getEmployeeSubordinates?.eMPLOYEENUMBER); + attendanceTracking = await MyTeamApiClient().getAttendanceTracking(getEmployeeSubordinates?.eMPLOYEENUMBER); + Utils.hideLoading(context); + _calendarController.displayDate = formattedDate; + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + + + final CalendarController _calendarController = CalendarController(); + final List _colorList = [Color(0xff2AB2AB), Color(0xff202529)]; + + @override + Widget build(BuildContext context) { + getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList; + Map dataMap = { + "Present": getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList!.aTTENDEDDAYS!.toDouble() : 0, + "Absent": getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList!.aBSENTDAYS!.toDouble() : 0, + }; + + return Scaffold( + appBar: AppBarWidget( + context, + title: LocaleKeys.viewAttendance.tr(), + ), + backgroundColor: MyColors.backgroundColor, + body: SingleChildScrollView( + child: Column(children: [ + Container( + width: double.infinity, + margin: EdgeInsets.only( + top: 21, + left: 21, + right: 21, + ), + padding: EdgeInsets.only(left: 14, right: 14, top: 15, bottom: 15), + // height: 120, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 5, + blurRadius: 26, + offset: Offset(0, 3), + ), + ], + color: Colors.white, + borderRadius: BorderRadius.circular(10.0), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.todayAttendance.tr().toText16(isBold: true, color: MyColors.darkColor), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + children: [ + LocaleKeys.checkIn.tr().toText10(isBold: true, color: MyColors.green69Color), + "${(attendanceTracking?.pSwipeIn)?? "- - : - -"}".toText14(isBold: true, color: MyColors.grey57Color), + ], + ), + Column( + children: [ + LocaleKeys.checkOut.tr().toText10(isBold: true, color: MyColors.redA3Color), + "${(attendanceTracking?.pSwipeOut)?? "- - : - -"}".toText14(isBold: true, color: MyColors.grey57Color), + ], + ), + Column( + children: [ + LocaleKeys.lateIn.tr().toText10(isBold: true, color: MyColors.darkGreyColor), + "${(attendanceTracking?.pLateInHours)?? "- - : - -"}".toText14(isBold: true, color: MyColors.grey57Color), + ], + ), + ], + ) + ], + ), + ), + Container( + width: double.infinity, + margin: EdgeInsets.only( + top: 18, + left: 18, + right: 18, + bottom: 28, + ), + padding: EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 16), + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 5, + blurRadius: 26, + offset: Offset(0, 3), + ), + ], + color: Colors.white, + borderRadius: BorderRadius.circular(10.0), + ), + child: Column( + children: [ + //20.height, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + "${DateFormat("MMMM-yyyy").format(formattedDate)}".toText16(color: MyColors.grey3AColor), + const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.grey3AColor), + ], + ).onPress(() async { + showMonthPicker( + context: context, //locale: EasyLocalization.of(context)?.locale, + initialDate: formattedDate, + firstDate: DateTime(searchYear - 2), + lastDate: DateTime.now(), + ).then((selectedDate) { + if (selectedDate != null) { + searchMonth = getMonth(selectedDate.month); + searchYear = selectedDate.year; + formattedDate = selectedDate; //DateFormat('MMMM-yyyy').format(selectedDate); + callTimeCardAndHourDetails(selectedDate.day, searchMonth, searchYear); + } + }); + }) + ], + ), + 18.height, + AspectRatio(aspectRatio: 333 / 270, child: calendarWidget()), + Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + children: [ + LocaleKeys.attendance.tr().toText12(isBold: true, color: MyColors.grey3AColor), + LocaleKeys.stats.tr().toText24(isBold: true, color: MyColors.grey3AColor), + ], + ), + 30.height, + Row( + children: [ + Container( + height: 8, + width: 8, + decoration: BoxDecoration( + color: MyColors.lightGreenColor, + borderRadius: BorderRadius.circular(100), + ), + ), + Container( + margin: const EdgeInsets.only(left: 5, right: 5), + child: "${LocaleKeys.present.tr()} ${getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList?.aTTENDEDDAYS : 0}".toText16(isBold: true, color: MyColors.lightGreenColor), + ), + ], + ), + 8.height, + Row( + children: [ + Container( + height: 9, + width: 9, + decoration: BoxDecoration( + color: MyColors.backgroundBlackColor, + borderRadius: BorderRadius.circular(100), + ), + ), + Container( + margin: const EdgeInsets.only(left: 5, right: 5), + child: "${LocaleKeys.absent.tr()} ${getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList?.aBSENTDAYS : 0 }".toText16( + isBold: true, + color: MyColors.backgroundBlackColor, + ), + ) + ], + ), + ], + ), + SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 170, + height: 170, + child: PieChart( + dataMap: dataMap, + animationDuration: const Duration(milliseconds: 800), + chartLegendSpacing: 0, + chartRadius: MediaQuery.of(context).size.width / 5.2, + colorList: _colorList, + initialAngleInDegree: 0, + chartType: ChartType.ring, + ringStrokeWidth: 80, + legendOptions: const LegendOptions( + showLegendsInRow: false, + showLegends: false, + ), + chartValuesOptions: const ChartValuesOptions( + showChartValueBackground: false, + showChartValues: true, + showChartValuesInPercentage: true, + showChartValuesOutside: false, + decimalPlaces: 1, + chartValueStyle: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + color: MyColors.white, + )), + ), + ), + ], + ).paddingOnly(left: 21, right: 21, bottom: 21), + ], + ), + ], + ), + ), + ]), + ), + ); + } + + Widget calendarWidget() { + return SfCalendar( + view: CalendarView.month, + showDatePickerButton: false, + controller: _calendarController, + backgroundColor: Colors.white, + headerHeight: 0, + viewNavigationMode: ViewNavigationMode.none, + todayHighlightColor: MyColors.grey3AColor, + showNavigationArrow: false, + showCurrentTimeIndicator: false, + showWeekNumber: false, + cellBorderColor: Colors.white, + selectionDecoration: BoxDecoration( + border: Border.all(color: MyColors.white, width: 10), + borderRadius: const BorderRadius.all(Radius.circular(100)), + shape: BoxShape.circle, + ), + dataSource: MeetingDataSource(_getDataSource()), + monthViewSettings: const MonthViewSettings( + dayFormat: 'EEE', + showTrailingAndLeadingDates: false, + showAgenda: false, + monthCellStyle: MonthCellStyle( + textStyle: TextStyle( + fontStyle: FontStyle.normal, + fontSize: 13, + color: Colors.white, + ), + ), + ), + viewHeaderStyle: const ViewHeaderStyle( + dayTextStyle: TextStyle(color: MyColors.grey3AColor, fontSize: 13, fontWeight: FontWeight.w600), + ), + monthCellBuilder: (build, details) { + if (details.date.month == formattedDate.month && details.date.year == formattedDate.year) { + int val = details.date.day; + //check day is off + if (getDayHoursTypeDetailsList.isNotEmpty) { + if (getDayHoursTypeDetailsList?[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList?[val - 1].dAYTYPE == 'OFF') { + return Container( + margin: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: MyColors.greyACColor.withOpacity(.12), + shape: BoxShape.circle, + ), + alignment: Alignment.center, + child: Text( + "$val", + style: const TextStyle( + fontSize: 13, + fontWeight: FontWeight.w500, + color: MyColors.greyA5Color, + ), + ), + ); + } + //check day is Present + else if (getDayHoursTypeDetailsList?[val - 1].aTTENDEDFLAG == 'Y') { + return Container( + margin: const EdgeInsets.all(4), + decoration: BoxDecoration( + gradient: const LinearGradient( + transform: GradientRotation(.46), + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [MyColors.gradiantEndColor, MyColors.gradiantStartColor], + ), + shape: BoxShape.circle, + boxShadow: [ + BoxShadow( + offset: const Offset(0, 2), + blurRadius: 26, + color: MyColors.blackColor.withOpacity(0.100), + ), + ], + ), + alignment: Alignment.center, + child: Text( + "$val", + style: const TextStyle( + fontSize: 13, + fontWeight: FontWeight.w500, + color: MyColors.white, + ), + ), + ); + } + //check day is Absent + else if (getDayHoursTypeDetailsList?[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList?[val - 1].aBSENTFLAG == 'Y') { + return Container( + margin: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: MyColors.backgroundBlackColor, + shape: BoxShape.circle, + boxShadow: [ + BoxShadow( + offset: const Offset(0, 2), + blurRadius: 26, + color: MyColors.blackColor.withOpacity(0.100), + ), + ], + ), + alignment: Alignment.center, + child: Text( + "$val", + style: const TextStyle( + fontSize: 13, + fontWeight: FontWeight.w500, + color: MyColors.white, + ), + ), + ); + } + } + return Container( + margin: const EdgeInsets.all(4), + decoration: BoxDecoration( + border: Border.all(color: MyColors.backgroundBlackColor, width: 2.0, style: BorderStyle.solid), //Border.all + shape: BoxShape.circle, + boxShadow: [ + BoxShadow( + offset: const Offset(0, 2), + blurRadius: 26, + color: MyColors.blackColor.withOpacity(0.100), + ), + ], + ), + alignment: Alignment.center, + child: Text( + "$val", + style: const TextStyle( + fontSize: 13, + fontWeight: FontWeight.w500, + color: Color(0xff1F2428), + ), + ), + ); + } else { + return const SizedBox(); + } + }, + ); + } + + + List _getDataSource() { + List meetings = []; + return meetings; + } + + static String getMonth(int month) { + switch (month) { + case 1: + return "January"; + case 2: + return "February"; + case 3: + return "March"; + case 4: + return "April"; + case 5: + return "May"; + case 6: + return "June"; + case 7: + return "July"; + case 8: + return "August"; + case 9: + return "September"; + case 10: + return "October"; + case 11: + return "November"; + case 12: + return "December"; + default: + return ""; + } + } + + static String getMonthAr(int month) { + switch (month) { + case 1: + return 'يناير'; + case 2: + return ' فبراير'; + case 3: + return 'مارس'; + case 4: + return 'أبريل'; + case 5: + return 'مايو'; + case 6: + return 'يونيو'; + case 7: + return 'يوليو'; + case 8: + return 'أغسطس'; + case 9: + return 'سبتمبر'; + case 10: + return ' اكتوبر'; + case 11: + return ' نوفمبر'; + case 12: + return 'ديسمبر'; + default: + return ""; + } + } +} + +class MeetingDataSource extends CalendarDataSource { + MeetingDataSource(List source) { + appointments = source; + } + + @override + DateTime getStartTime(int index) { + return _getMeetingData(index).from; + } + + @override + DateTime getEndTime(int index) { + return _getMeetingData(index).to; + } + + @override + String getSubject(int index) { + return _getMeetingData(index).eventName; + } + + @override + Color getColor(int index) { + return _getMeetingData(index).background; + } + + @override + bool isAllDay(int index) { + return _getMeetingData(index).isAllDay; + } + + Meeting _getMeetingData(int index) { + dynamic meeting = appointments; + Meeting meetingData; + if (meeting is Meeting) { + meetingData = meeting; + } + return meeting; + } +} + +class Meeting { + Meeting(this.eventName, this.from, this.to, this.background, this.isAllDay); + + String eventName; + DateTime from; + DateTime to; + Color background; + bool isAllDay; +} diff --git a/lib/ui/profile/add_update_family_member.dart b/lib/ui/profile/add_update_family_member.dart index 6ad82d0..224bfce 100644 --- a/lib/ui/profile/add_update_family_member.dart +++ b/lib/ui/profile/add_update_family_member.dart @@ -19,6 +19,7 @@ import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'dart:io'; import 'package:flutter/cupertino.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; import 'package:easy_localization/src/public_ext.dart'; @@ -37,13 +38,12 @@ class _AddUpdateFamilyMemberState extends State { SubmitContactTransactionList? submitContactTransactionList; dynamic args; String? date = "MM/DD/YYYY"; - // String actionType = "UPDATE"; + GetApprovesList? getApprovesList; @override void initState() { - // super.initState(); } @@ -89,15 +89,12 @@ class _AddUpdateFamilyMemberState extends State { Widget build(BuildContext context) { if (args == null) { args = ModalRoute.of(context)!.settings.arguments; - callAddAndUpdateFamilyMember(); - } + callAddAndUpdateFamilyMember();} return Scaffold( appBar: AppBarWidget( context, - title: LocaleKeys.profile_familyDetails.tr(), - ), + title: LocaleKeys.profile_familyDetails.tr(),), backgroundColor: MyColors.backgroundColor, - bottomSheet: footer(), body: args['flag'] == 1 ? Column( children: [ @@ -128,9 +125,11 @@ class _AddUpdateFamilyMemberState extends State { separatorBuilder: (cxt, index) => 0.height, itemCount: getContactDffStructureList!.length), ]).expanded, - SizedBox( - height: 50, - ), + DefaultButton( + LocaleKeys.next.tr(), () async { + submitUpdateForm(); + } + ).insideContainer, ], ) : args['flag'] == 2 @@ -165,9 +164,11 @@ class _AddUpdateFamilyMemberState extends State { separatorBuilder: (cxt, index) => 0.height, itemCount: getContactDffStructureList!.length), ]).expanded, - SizedBox( - height: 50, - ), + DefaultButton( + LocaleKeys.next.tr(), () async { + submitUpdateForm(); + } + ).insideContainer, ], ) : Container(), @@ -405,7 +406,6 @@ class _AddUpdateFamilyMemberState extends State { return ValidateEitTransactionModel(dATEVALUE: dateVal, nAME: e.aPPLICATIONCOLUMNNAME, nUMBERVALUE: numberVal, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: vatcherVal.toString()).toJson(); }).toList(); List> values2 = getContactDffStructureList!.map((e) { - //String tempVar = e!.getContactDetailsList!.vARCHAR2VALUE ?? ""; String? dateVal = ''; String? vatcherVal = ''; int? numberVal; diff --git a/lib/ui/profile/basic_details.dart b/lib/ui/profile/basic_details.dart index eae5c3d..a2896a5 100644 --- a/lib/ui/profile/basic_details.dart +++ b/lib/ui/profile/basic_details.dart @@ -5,7 +5,9 @@ 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'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; @@ -32,9 +34,11 @@ class _BasicDetailsState extends State { String? emailAddress = ""; String? employeeNo = ""; int correctOrNew = 1; - List getEmployeeBasicDetailsList = []; + List? getEmployeeBasicDetailsList; + late MemberInformationListModel memberInformationList; GetMenuEntriesList menuEntries = GetMenuEntriesList(); + @override void initState() { super.initState(); @@ -43,7 +47,6 @@ class _BasicDetailsState extends State { menuEntries = menuData.where((e) => e.requestType == 'BASIC_DETAILS').toList()[0]; getEmployeeBasicDetails(); - basicDetails(); } void getEmployeeBasicDetails() async { @@ -51,7 +54,6 @@ class _BasicDetailsState extends State { Utils.showLoading(context); getEmployeeBasicDetailsList = await ProfileApiClient().getEmployeeBasicDetails(); Utils.hideLoading(context); - basicDetails(); setState(() {}); } catch (ex) { Utils.hideLoading(context); @@ -59,24 +61,6 @@ class _BasicDetailsState extends State { } } - void basicDetails() { - for (int i = 0; i < getEmployeeBasicDetailsList.length; i++) { - if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'FULL_NAME') { - fullName = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP; - } else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'MARITAL_STATUS') { - maritalStatus = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP; - } else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'DATE_OF_BIRTH') { - birthDate = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP; - } else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'NATIONAL_IDENTIFIER') { - civilIdentityNumber = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP; - } else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'EMAIL_ADDRESS') { - emailAddress = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP; - } else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'EMPLOYEE_NUMBER') { - employeeNo = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP; - } - } - } - Widget build(BuildContext context) { return Scaffold( appBar: AppBarWidget( @@ -84,70 +68,45 @@ class _BasicDetailsState extends State { title: LocaleKeys.profile_basicDetails.tr(), ), backgroundColor: MyColors.backgroundColor, - bottomSheet: footer(), body: Column( children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only(top: 20, left: 21, right: 21, bottom: 20), - padding: EdgeInsets.only(left: 14, right: 14, top: 13, bottom: 5), - height: 280, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 5, - blurRadius: 26, - offset: Offset(0, 3), - ), - ], - color: Colors.white, - borderRadius: BorderRadius.circular(10.0), - ), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.fullName.tr().toText13(color: MyColors.lightGrayColor), - "$fullName".toText16(isBold: true, color: MyColors.blackColor), - SizedBox( - height: 20, - ), - LocaleKeys.maritalStatus.tr().toText13(color: MyColors.lightGrayColor), - "$maritalStatus".toText16(isBold: true, color: MyColors.blackColor), - SizedBox( - height: 20, - ), - LocaleKeys.dateOfBirth.tr().toText13(color: MyColors.lightGrayColor), - "$birthDate".toText16(isBold: true, color: MyColors.blackColor), - SizedBox( - height: 20, - ), - LocaleKeys.civilIdentityNumber.tr().toText13(color: MyColors.lightGrayColor), - "$civilIdentityNumber".toText16(isBold: true, color: MyColors.blackColor), - ]), - ), + ListView( + padding: const EdgeInsets.all(21), + children: [ + getEmployeeBasicDetailsList == null + ? const SizedBox().expanded + : (getEmployeeBasicDetailsList!.isEmpty + ? Utils.getNoDataWidget(context).expanded + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: getEmployeeBasicDetailsList! + .map((e) => Column( + children: [ + e.dISPLAYFLAG == "Y" + ? Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + "${e.sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), + "${e.sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), + 12.height + ]) + : Container(), + ], + )) + .toList()) + .objectContainerView()) + ], + ).expanded, + DefaultButton( + LocaleKeys.update.tr(), + menuEntries.updateButton == 'Y' + ? () async { + showAlertDialog(context); + } + : null) + .insideContainer, ], )); } - Widget footer() { - return Container( - decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(10), - color: MyColors.white, - boxShadow: [ - BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), - ], - ), - child: DefaultButton( - LocaleKeys.update.tr(), - menuEntries.updateButton == 'Y' - ? () async { - showAlertDialog(context); - } - : null) - .insideContainer, - ); - } - void showAlertDialog(BuildContext context) { Widget cancelButton = TextButton( child: Text(LocaleKeys.cancel.tr()), diff --git a/lib/ui/profile/contact_details.dart b/lib/ui/profile/contact_details.dart index c0af0c5..4bc3fa1 100644 --- a/lib/ui/profile/contact_details.dart +++ b/lib/ui/profile/contact_details.dart @@ -4,7 +4,9 @@ import 'package:mohem_flutter_app/api/profile_api_client.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'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/get_employee_address_model.dart'; @@ -13,9 +15,7 @@ import 'package:mohem_flutter_app/models/get_employee_phones_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_address_screen.dart'; import 'package:mohem_flutter_app/ui/profile/phone_numbers.dart'; -import 'package:mohem_flutter_app/ui/profile/profile_screen.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; -import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:provider/provider.dart'; class ContactDetails extends StatefulWidget { @@ -47,26 +47,12 @@ class _ContactDetailsState extends State { menuEntriesPhone = menuData.where((GetMenuEntriesList e) => e.requestType == 'PHONE_NUMBERS').toList()[0]; menuEntriesAddress = menuData.where((GetMenuEntriesList e) => e.requestType == 'ADDRESS').toList()[0]; getEmployeePhones(); - - setState(() {}); } void getEmployeePhones() async { try { Utils.showLoading(context); getEmployeePhonesList = await ProfileApiClient().getEmployeePhones(); - getEmployeeAddress(); - Utils.hideLoading(context); - setState(() {}); - } catch (ex) { - Utils.hideLoading(context); - Utils.handleException(ex, context, null); - } - } - - void getEmployeeAddress() async { - try { - Utils.showLoading(context); getEmployeeAddressList = await ProfileApiClient().getEmployeeAddress(); Utils.hideLoading(context); setState(() {}); @@ -78,37 +64,18 @@ class _ContactDetailsState extends State { Widget build(BuildContext context) { return Scaffold( - appBar: AppBarWidget( - context, - title: LocaleKeys.profile_contactDetails.tr(), - ), - backgroundColor: MyColors.backgroundColor, - // bottomSheet: footer(), - body: SingleChildScrollView( - child: Column(children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only( - top: 20, - left: 26, - right: 26, - ), - padding: EdgeInsets.all(15), - - ///height: 200, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 5, - blurRadius: 26, - offset: Offset(0, 3), - ), - ], - color: Colors.white, - borderRadius: BorderRadius.circular(10.0), - ), - child: Stack(children: [ + appBar: AppBarWidget( + context, + title: LocaleKeys.profile_contactDetails.tr(), + ), + backgroundColor: MyColors.backgroundColor, + // bottomSheet: footer(), + body: ListView( + padding: const EdgeInsets.all(21), + children: [ + if (getEmployeePhonesList.isNotEmpty) + Stack( + children: [ Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -125,37 +92,33 @@ class _ContactDetailsState extends State { : Container() ], ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: getEmployeePhonesList - .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - "${e.pHONETYPEMEANING}".toText13(color: MyColors.lightGrayColor), - "${e.pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor), - ])) - .toList()) - ])), - Container( - width: double.infinity, - margin: EdgeInsets.only( - top: 20, - left: 26, - right: 26, - ), - padding: EdgeInsets.all(15), - // height: 400, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 5, - blurRadius: 26, - offset: Offset(0, 3), - ), - ], - color: Colors.white, - borderRadius: BorderRadius.circular(10.0), - ), - child: Stack(children: [ + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.zero, + itemBuilder: (cxt, index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "${getEmployeePhonesList[index].pHONETYPEMEANING}".toText13(color: MyColors.lightGrayColor), + ("${getEmployeePhonesList[index].pHONENUMBER}" ?? "").toText16(isBold: true, color: MyColors.blackColor), + ], + ), + separatorBuilder: (cxt, index) => 12.height, + itemCount: getEmployeePhonesList.length), + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: getEmployeePhonesList + // .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + // "${e.pHONETYPEMEANING}".toText13(color: MyColors.lightGrayColor), + // "${e.pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor), + // ])) + // .toList()) + ], + ).objectContainerView(), + 12.height, + if (getEmployeeAddressList.isNotEmpty) + Stack( + children: [ Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -172,34 +135,31 @@ class _ContactDetailsState extends State { : Container() ], ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: getEmployeeAddressList - .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - "${e.sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), - "${e.sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), - SizedBox( - height: 20, - ), - ])) - .toList()) - ])) - ]))); - } - - Widget footer() { - return Container( - decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(10), - color: MyColors.white, - boxShadow: [ - BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.zero, + itemBuilder: (cxt, index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "${getEmployeeAddressList[index].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), + ("${getEmployeeAddressList[index].sEGMENTVALUEDSP}" ?? "").toText16(isBold: true, color: MyColors.blackColor), + ], + ), + separatorBuilder: (cxt, index) => 12.height, + itemCount: getEmployeeAddressList.length), + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: getEmployeeAddressList + // .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + // "${e.sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), + // "${e.sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), + // ])) + // .toList()) + ], + ).objectContainerView() ], ), - child: DefaultButton(LocaleKeys.update.tr(), () async { - // context.setLocale(const Locale("en", "US")); // to change Loacle - ProfileScreen(); - }).insideContainer, ); } diff --git a/lib/ui/profile/delete_family_member.dart b/lib/ui/profile/delete_family_member.dart index af4601d..73c44de 100644 --- a/lib/ui/profile/delete_family_member.dart +++ b/lib/ui/profile/delete_family_member.dart @@ -12,6 +12,7 @@ import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'dart:io'; import 'package:flutter/cupertino.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; class DeleteFamilyMember extends StatefulWidget { @@ -66,25 +67,29 @@ class _DeleteFamilyMemberState extends State { title: LocaleKeys.profile_familyDetails.tr(), ), backgroundColor: MyColors.backgroundColor, - bottomSheet: footer(), body: Column( children: [ - DynamicTextFieldWidget( - LocaleKeys.endDate.tr(), date.toString(), - // suffixIconData: Icons.calendar_today, - isEnable: false, - onTap: () async { - DateTime dateValue = await _selectDate(context); - // DateTime date1 = DateTime(dateValue.year, dateValue.month, dateValue.day); - date = DateFormat('yyyy/MM/dd').format(dateValue); - datePar = DateFormat('yyyy/MM/dd hh:mm:ss').format(dateValue); - setState(() {}); - // if (date !=null) { - // print(datePar); - // deleteFamilyMember(datePar); - // } - }, - ).paddingOnly(bottom: 12) + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DynamicTextFieldWidget( + LocaleKeys.endDate.tr(), date.toString(), + isEnable: false, + onTap: () async { + DateTime dateValue = await _selectDate(context); + date = DateFormat('yyyy/MM/dd').format(dateValue); + datePar = DateFormat('yyyy/MM/dd hh:mm:ss').format(dateValue); + setState(() {}); + }, + ).paddingOnly(bottom: 12), + ], + ), + ), + DefaultButton( + LocaleKeys.next.tr(), () async { + deleteFamilyMember(datePar);} + ).insideContainer, ], )); } diff --git a/lib/ui/profile/family_members.dart b/lib/ui/profile/family_members.dart index 4f38531..f81a288 100644 --- a/lib/ui/profile/family_members.dart +++ b/lib/ui/profile/family_members.dart @@ -4,13 +4,17 @@ import 'package:mohem_flutter_app/api/profile_api_client.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'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart'; -import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_familyMembers_screen.dart'; +import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/ui/profile/profile_screen.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:provider/provider.dart'; class FamilyMembers extends StatefulWidget { const FamilyMembers({Key? key}) : super(key: key); @@ -24,9 +28,13 @@ class _FamilyMembersState extends State { int? relationId; int? flag; + GetMenuEntriesList menuEntries = GetMenuEntriesList(); + @override void initState() { super.initState(); + List menuData = Provider.of(context, listen: false).getMenuEntriesList!; + menuEntries = menuData.where((GetMenuEntriesList e) => e.requestType == 'CONTACT').toList()[0]; getEmployeeContacts(); } @@ -49,57 +57,47 @@ class _FamilyMembersState extends State { title: LocaleKeys.profile_familyDetails.tr(), ), backgroundColor: MyColors.backgroundColor, - bottomSheet: footer(), - body: Container( - width: MediaQuery.of(context).size.width, - child: getEmployeeContactsList.length != 0 - ? SingleChildScrollView( - scrollDirection: Axis.vertical, - child: Column( - children: [ - ListView.builder( + body: Column( + children: [ + 20.height, + Expanded( + child: getEmployeeContactsList.length != 0 + ? SingleChildScrollView( + scrollDirection: Axis.vertical, + child: ListView.separated( scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), + separatorBuilder: (cxt, index) => 12.height, itemCount: getEmployeeContactsList.length, itemBuilder: (context, index) { - return Container( - child: Column( - children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only( - top: 20, - left: 21, - right: 21, - ), - padding: EdgeInsets.only( - left: 14, - right: 14, - top: 13, + return Container( + width: double.infinity, + margin: EdgeInsets.only(left: 21, right: 21, + ), + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 5, + blurRadius: 26, + offset: Offset(0, 3), ), - height: 110, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 5, - blurRadius: 26, - offset: Offset(0, 3), - ), - ], - color: Colors.white, - borderRadius: BorderRadius.circular(10.0), - ), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - "${getEmployeeContactsList[index].cONTACTNAME}".toText16(color: MyColors.blackColor), + ], + color: Colors.white, + borderRadius: BorderRadius.circular(10.0), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "${getEmployeeContactsList[index].cONTACTNAME}".toText16(isBold: true, color: MyColors.grey3AColor), "${getEmployeeContactsList[index].rELATIONSHIP}".toText11(isBold: true, color: MyColors.textMixColor), - SizedBox( - height: 5, - ), - Divider( - color: MyColors.lightGreyEFColor, - height: 20, + ]).paddingOnly(left: 14, right: 14, top: 13, bottom: 11), + const Divider( + color: Color(0xffEFEFEF), thickness: 1, indent: 0, endIndent: 0, @@ -107,115 +105,106 @@ class _FamilyMembersState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Container( - child: InkWell( - onTap: () { - relationId = getEmployeeContactsList[index]!.cONTACTRELATIONSHIPID!.toInt(); - showUpdateAlertDialog(context, relationId!.toInt(), 2, LocaleKeys.update.tr()); + menuEntries.updateButton == 'Y' + ? InkWell( + onTap: () async{ + relationId = getEmployeeContactsList[index]!.cONTACTRELATIONSHIPID!.toInt(); + showUpdateAlertDialog(context, relationId!.toInt(), 2, LocaleKeys.update.tr()); }, - child: RichText( - text: TextSpan( - children: [ - WidgetSpan( - child: Icon( - Icons.edit, - size: 15, - color: MyColors.grey67Color, - ), - ), - TextSpan( - text: LocaleKeys.update.tr(), - style: TextStyle( - color: MyColors.grey67Color, - fontSize: 12, - fontWeight: FontWeight.bold, - ), - ), - ], + child: RichText( + text: TextSpan( + children: [ + WidgetSpan( + child: Icon( + Icons.edit, + size: 15, + color: MyColors.grey67Color, + ), ), - ), - )), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: SizedBox( - child: Container( - width: 3, - color: MyColors.lightGreyEFColor, + TextSpan( + text: LocaleKeys.update.tr(), + style: TextStyle( + color: MyColors.grey67Color, + fontSize: 12, + fontWeight: FontWeight.bold, + ), ), + ], + ), + ), + ) + : RichText( + text: TextSpan( + children: [ + WidgetSpan( + child: Icon( + Icons.edit, + size: 15, + color: MyColors.lightGreyColor, + ), + ), + TextSpan( + text: LocaleKeys.update.tr(), + style: TextStyle( + color: MyColors.lightGreyColor, + fontSize: 12, + fontWeight: FontWeight.bold, + ), + ), + ], ), ), Container( - child: InkWell( + height: 35, + width: 1, + color: Color(0xffEFEFEF), + ), + InkWell( onTap: () { - relationId = getEmployeeContactsList[index]!.cONTACTRELATIONSHIPID!.toInt(); - showRemoveAlertDialog(context, relationId!.toInt()); + relationId = getEmployeeContactsList[index]!.cONTACTRELATIONSHIPID!.toInt(); + showRemoveAlertDialog(context, relationId!.toInt()); }, child: RichText( - text: TextSpan( - children: [ - WidgetSpan( - child: Icon( - Icons.delete, - size: 15, - color: Color(0x99FF0000), - ), - ), - TextSpan( - text: LocaleKeys.remove.tr(), - style: TextStyle( - color: MyColors.DarkRedColor, - fontSize: 12, - fontWeight: FontWeight.bold, - ), - ), - ], + text: TextSpan( + children: [ + WidgetSpan( + child: Icon( + Icons.delete, + size: 15, + color: MyColors.redColor, + ), + ), + TextSpan( + text: LocaleKeys.remove.tr(), + style: TextStyle( + color: MyColors.redColor, + fontSize: 12, + fontWeight: FontWeight.bold, + ), ), + ], + ), ), - )), - // ElevatedButton.icon( - // icon: Icon( - // Icons.delete, - // size: 15, - // color: Color(0x99FF0000), - // ), - // style: ElevatedButton.styleFrom( - // shadowColor: Colors.white, - // primary: Colors.white, - // ), - // label: "remove".toText12(color: MyColors.DarkRedColor), - // onPressed: (){}, - // ), + ), ], - ), - ]), - ), - ], - )); - }) - ], - ), - ) - : Container(), - // SizedBox(height: 20), + ).paddingOnly(left: 14, right: 14), + ], + ), + ); + }), + ) + : Container(), + ), + DefaultButton( + LocaleKeys.addNewFamilyMember.tr(), () async { + Navigator.pushNamed(context, AppRoutes.addUpdateFamilyMember, arguments: {"relationID": relationId, "flag": 1, "actionType": "ADD"}); + ProfileScreen(); + } + ).insideContainer, + ], )); } - Widget footer() { - return Container( - decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(10), - color: MyColors.white, - boxShadow: [ - BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), - ], - ), - child: DefaultButton(LocaleKeys.addNewFamilyMember.tr(), () async { - Navigator.pushNamed(context, AppRoutes.addUpdateFamilyMember, arguments: {"relationID": relationId, "flag": 1, "actionType": "ADD"}); - // context.setLocale(const Locale("en", "US")); // to change Loacle - ProfileScreen(); - }).insideContainer, - ); - } void showUpdateAlertDialog(BuildContext context, int relationId, int flag, String actionType) { Widget cancelButton = TextButton( @@ -292,7 +281,5 @@ class _FamilyMembersState extends State { ); } - // void continueDynamicForms() { - // Navigator.pushNamed(context, AppRoutes.addDynamicInputProfile, arguments: DynamicFamilyMembersParams(LocaleKeys.profile_familyDetails.tr(), getEmployeeContactsList: getEmployeeContactsList)); - // } + } diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index eb2ba05..a1a8e8a 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -121,6 +121,7 @@ class _WorkListScreenState extends State { appBar: AppBarWidget( context, title: LocaleKeys.workList.tr(), + showNotificationButton: true, ), body: SizedBox( width: double.infinity, diff --git a/lib/ui/work_list/worklist_settings.dart b/lib/ui/work_list/worklist_settings.dart new file mode 100644 index 0000000..47771ee --- /dev/null +++ b/lib/ui/work_list/worklist_settings.dart @@ -0,0 +1,178 @@ + +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/worklist/worklist_api_client.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'; +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/get_user_item_type_list.dart'; +import 'package:mohem_flutter_app/models/update_user_item_type_list.dart'; +import 'package:mohem_flutter_app/models/worklist/update_user_type_list.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; + +class WorklistSettings extends StatefulWidget { + const WorklistSettings({Key? key}) : super(key: key); + + @override + _WorklistSettingsState createState() => _WorklistSettingsState(); +} + +class _WorklistSettingsState extends State { + List getUserItemTypesList = []; + UpdateUserItemTypesList? updateUserItemTypesList; + + + void initState() { + super.initState(); + userItemTypesList(); + } + + void userItemTypesList() async { + try { + Utils.showLoading(context); + getUserItemTypesList = await WorkListApiClient().getUserItemTypes(); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + void updateUserItem() async { + try { + Utils.showLoading(context); + List> itemList=[]; + for (var element in getUserItemTypesList) { + itemList.add(UpdateUserTypesList(itemID: element.uSERITEMTYPEID, pITEMTYPE: element.iTEMTYPE,pFYAENABLEDFALG: element.fYAENABLEDFALG, pFYIENABLEDFALG: element.fYIENABLEDFLAG).toJson()); + + } + updateUserItemTypesList = await WorkListApiClient().updateUserItemTypes(itemList); + Utils.hideLoading(context); + Navigator.pushNamed(context, AppRoutes.workList); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold(backgroundColor: Colors.white, + appBar: AppBarWidget( + context, + title: LocaleKeys.worklistSettings.tr(), + ), + body:Column( + children: [ + Expanded( + child: Container( + margin: const EdgeInsets.only(top: 21, left: 21, right: 21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: LocaleKeys.TurnNotificationsFor.tr().toText22(color: MyColors.blackColor), + ).paddingOnly(top: 10, bottom: 50), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + child: LocaleKeys.itemType.tr().toText14(color: MyColors.blackColor) , + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + child: "FYA".tr().toText14(color: MyColors.blackColor) , + ), + Container( + child: "FYI".tr().toText14(color: MyColors.blackColor) , + ).paddingOnly(left: 30, right: 30), + ], + ) + ], + ), + Divider(color: MyColors.greyA5Color,), + SingleChildScrollView( + scrollDirection: Axis.vertical, + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: getUserItemTypesList == null ? 0 : getUserItemTypesList.length, + itemBuilder: (BuildContext context,int index) { + return Column( + children:[ + customSwitch(getUserItemTypesList[index]), + Divider( + color: MyColors.greyC4Color, + thickness: 0.5,), + ]); + } + ), + ), + ], + ), + ), + ), + DefaultButton( + LocaleKeys.save.tr(), () async { + updateUserItem(); + }).insideContainer, + ], + ) + + ); + } + + + Widget customSwitch(GetUserItemTypesList list){ + return Padding( + padding: const EdgeInsets.only(top: 21), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(list.iTEMTYPE.toString(), style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + color: MyColors.blackColor + ),), + const Spacer(), + Row( + children: [ + CupertinoSwitch( + trackColor: Colors.grey, + activeColor: MyColors.gradiantEndColor, + value: list?.fYAENABLEDFALG =='Y' ?true : false, + onChanged: (value){ + setState(() { + list?.fYAENABLEDFALG = value == true ? 'Y': 'N'; + }); + } + ), + CupertinoSwitch( + trackColor: Colors.grey, + activeColor: MyColors.gradiantEndColor, + value: list?.fYIENABLEDFLAG =='Y' ?true : false, + onChanged: (value){ + setState(() { + // list.isFYI = value; + list?.fYIENABLEDFLAG = value ==true ? 'Y': 'N'; + }); + } + ), + ], + ) + ], + ), + ); + } + +} diff --git a/lib/widgets/app_bar_widget.dart b/lib/widgets/app_bar_widget.dart index 5f021d1..770494e 100644 --- a/lib/widgets/app_bar_widget.dart +++ b/lib/widgets/app_bar_widget.dart @@ -1,10 +1,11 @@ import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; -AppBar AppBarWidget(BuildContext context, {required String title, bool showHomeButton = false}) { +AppBar AppBarWidget(BuildContext context, {required String title, bool showHomeButton = false, bool showNotificationButton = false, bool showMemberButton = false}) { return AppBar( leadingWidth: 0, // leading: GestureDetector( @@ -39,6 +40,20 @@ AppBar AppBarWidget(BuildContext context, {required String title, bool showHomeB }, icon: const Icon(Icons.home, color: MyColors.darkIconColor), ), + if (showNotificationButton) + IconButton( + onPressed: () { + Navigator.pushNamed(context, AppRoutes.worklistSettings); + }, + icon: const Icon(Icons.notifications, color: MyColors.textMixColor), + ), + if(showMemberButton) + IconButton( + onPressed: () { + Navigator.pushNamed(context, AppRoutes.subordinateLeave); + }, + icon: const Icon(Icons.people, color: MyColors.textMixColor), + ), ], ); } diff --git a/lib/widgets/mark_attendance_widget.dart b/lib/widgets/mark_attendance_widget.dart index c534dee..449fd97 100644 --- a/lib/widgets/mark_attendance_widget.dart +++ b/lib/widgets/mark_attendance_widget.dart @@ -19,8 +19,9 @@ import 'package:wifi_iot/wifi_iot.dart'; class MarkAttendanceWidget extends StatefulWidget { DashboardProviderModel model; + double topPadding; - MarkAttendanceWidget(this.model, {Key? key}) : super(key: key); + MarkAttendanceWidget(this.model, {Key? key, this.topPadding = 0}) : super(key: key); @override _MarkAttendanceWidgetState createState() { @@ -70,9 +71,8 @@ class _MarkAttendanceWidgetState extends State { @override Widget build(BuildContext context) { return Container( - padding: EdgeInsets.only(left: 21, right: 21, bottom: 21), - decoration: BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), - + 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), width: double.infinity, child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -85,16 +85,16 @@ class _MarkAttendanceWidgetState extends State { padding: const EdgeInsets.only(bottom: 14, top: 21), gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8), children: [ - 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() ?? ""); - }); - } else { - performNfcAttendance(widget.model); - } - }), + // 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() ?? ""); + }); + } else { + performNfcAttendance(widget.model); + } + }), if (isWifiEnabled) attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, () { if (isWifiLocationEnabled) { @@ -180,8 +180,7 @@ class _MarkAttendanceWidgetState extends State { Future closeWifiRequest() async { await WiFiForIoTPlugin.forceWifiUsage(false); - bool v = await WiFiForIoTPlugin.disconnect(); - return v; + return await WiFiForIoTPlugin.disconnect(); } Future performQrCodeAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { @@ -210,40 +209,30 @@ class _MarkAttendanceWidgetState extends State { Widget attendanceMethod(String title, String image, bool isEnabled, VoidCallback onPress) => Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), - gradient: const LinearGradient( - transform: GradientRotation(.64), - begin: Alignment.topRight, - end: Alignment.bottomLeft, - colors: [ - MyColors.gradiantEndColor, - MyColors.gradiantStartColor, - ], - ), + color: isEnabled ? null : Colors.grey.withOpacity(.5), + gradient: isEnabled + ? const LinearGradient( + transform: GradientRotation(.64), + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ], + ) + : null, ), clipBehavior: Clip.antiAlias, - child: Stack( + padding: const EdgeInsets.only(left: 10, right: 10, top: 14, bottom: 14), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - padding: const EdgeInsets.only(left: 10, right: 10, top: 14, bottom: 14), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: SvgPicture.asset( - image, - color: Colors.white, - )), - title.toText17(isBold: true, color: Colors.white), - ], - ), - ), - if (!isEnabled) - Container( - width: double.infinity, - height: double.infinity, - color: Colors.grey.withOpacity(0.7), - ) + SvgPicture.asset(image, color: Colors.white).expanded, + title.toText17(isBold: true, color: Colors.white), ], ), - ).onPress(onPress); + ).onPress(() { + if (!isEnabled) return; + onPress(); + }); }