From a14103b859aff937d72ae2ba4463eb249e5b446e Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 29 Aug 2022 10:17:59 +0300 Subject: [PATCH] leave balance cont3. --- lib/api/leave_balance_api_client.dart | 11 + lib/models/generic_response_model.dart | 138 +++++++------ .../get_absence_dff_structure_list_model.dart | 193 ++++++++++++++++++ .../add_leave_balance_screen.dart | 15 ++ 4 files changed, 292 insertions(+), 65 deletions(-) create mode 100644 lib/models/leave_balance/get_absence_dff_structure_list_model.dart diff --git a/lib/api/leave_balance_api_client.dart b/lib/api/leave_balance_api_client.dart index d6f087b..186c730 100644 --- a/lib/api/leave_balance_api_client.dart +++ b/lib/api/leave_balance_api_client.dart @@ -3,6 +3,7 @@ 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/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'; class LeaveBalanceApiClient { @@ -31,4 +32,14 @@ class LeaveBalanceApiClient { return responseData.getAbsenceAttendanceTypesList ?? []; }, 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); + } } diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 3b60887..219a80b 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -33,6 +33,7 @@ import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_mod 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/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/member_information_list_model.dart'; import 'package:mohem_flutter_app/models/member_login_list_model.dart'; @@ -136,7 +137,7 @@ class GenericResponseModel { List? getAbsenceAttachmentsList; List? getAbsenceAttendanceTypesList; List? getAbsenceCollectionNotificationBodyList; - List? getAbsenceDffStructureList; + List? getAbsenceDffStructureList; List? getAbsenceTransactionList; List? getAccrualBalancesList; List? getActionHistoryList; @@ -642,13 +643,13 @@ 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']; @@ -662,11 +663,11 @@ 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']; @@ -677,23 +678,28 @@ class GenericResponseModel { if (json['GetAbsenceAttendanceTypesList'] != null) { getAbsenceAttendanceTypesList = []; json['GetAbsenceAttendanceTypesList'].forEach((v) { - getAbsenceAttendanceTypesList!.add(new GetAbsenceAttendanceTypesList.fromJson(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)); }); } - getAbsenceDffStructureList = json['GetAbsenceDffStructureList']; + 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(new GetAbsenceTransactionList.fromJson(v)); + getAbsenceTransactionList!.add(GetAbsenceTransactionList.fromJson(v)); }); } @@ -709,7 +715,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']; @@ -717,41 +723,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)); }); } @@ -766,13 +772,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)); }); } getContactNotificationBodyList = json["GetContactNotificationBodyList"] == null ? null : GetContactNotificationBodyList.fromJson(json["GetContactNotificationBodyList"]); @@ -780,21 +786,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; @@ -804,44 +810,44 @@ 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)); }); } getEmployeeSubordinatesList = json['GetEmployeeSubordinatesList']; @@ -849,12 +855,12 @@ class GenericResponseModel { 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)); }); } @@ -864,14 +870,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)); }); } @@ -905,14 +911,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']; @@ -923,15 +929,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']; @@ -942,7 +948,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']; @@ -950,13 +956,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)); }); } @@ -973,7 +979,7 @@ class GenericResponseModel { if (json['GetSummaryOfPaymentList'] != null) { getSummaryOfPaymentList = []; json['GetSummaryOfPaymentList'].forEach((v) { - getSummaryOfPaymentList!.add(new GetSummaryOfPaymentList.fromJson(v)); + getSummaryOfPaymentList!.add(GetSummaryOfPaymentList.fromJson(v)); }); } getSwipesList = json['GetSwipesList']; @@ -984,77 +990,77 @@ class GenericResponseModel { if (json['GetTimeCardSummaryList'] != null) { getTimeCardSummaryList = []; json['GetTimeCardSummaryList'].forEach((v) { - getTimeCardSummaryList!.add(new GetTimeCardSummaryList.fromJson(v)); + getTimeCardSummaryList!.add(GetTimeCardSummaryList.fromJson(v)); }); } if (json['Mohemm_ITG_TicketsByEmployeeList'] != null) { getTicketsByEmployeeList = []; json['Mohemm_ITG_TicketsByEmployeeList'].forEach((v) { - getTicketsByEmployeeList!.add(new GetTicketsByEmployeeList.fromJson(v)); + getTicketsByEmployeeList!.add(GetTicketsByEmployeeList.fromJson(v)); }); } if (json['Mohemm_ITG_TicketDetailsList'] != null) { getTicketDetailsByEmployee = []; json['Mohemm_ITG_TicketDetailsList'].forEach((v) { - getTicketDetailsByEmployee!.add(new GetTicketDetailsByEmployee.fromJson(v)); + getTicketDetailsByEmployee!.add(GetTicketDetailsByEmployee.fromJson(v)); }); } if (json['Mohemm_ITG_TicketTransactionsList'] != null) { getTicketTransactions = []; json['Mohemm_ITG_TicketTransactionsList'].forEach((v) { - getTicketTransactions!.add(new GetTicketTransactions.fromJson(v)); + getTicketTransactions!.add(GetTicketTransactions.fromJson(v)); }); } if (json['Mohemm_Itg_TicketTypesList'] != null) { getTicketTypes = []; json['Mohemm_Itg_TicketTypesList'].forEach((v) { - getTicketTypes!.add(new GetTicketTypes.fromJson(v)); + getTicketTypes!.add(GetTicketTypes.fromJson(v)); }); } if (json['Mohemm_Itg_ProjectsList'] != null) { getMowadhafhiProjects = []; json['Mohemm_Itg_ProjectsList'].forEach((v) { - getMowadhafhiProjects!.add(new GetMowadhafhiProjects.fromJson(v)); + getMowadhafhiProjects!.add(GetMowadhafhiProjects.fromJson(v)); }); } if (json['Mohemm_ITG_ProjectDepartmentsList'] != null) { getProjectDepartments = []; json['Mohemm_ITG_ProjectDepartmentsList'].forEach((v) { - getProjectDepartments!.add(new GetProjectDepartments.fromJson(v)); + getProjectDepartments!.add(GetProjectDepartments.fromJson(v)); }); } if (json['Mohemm_ITG_DepartmentSectionsList'] != null) { getDepartmentSections = []; json['Mohemm_ITG_DepartmentSectionsList'].forEach((v) { - getDepartmentSections!.add(new GetDepartmentSections.fromJson(v)); + getDepartmentSections!.add(GetDepartmentSections.fromJson(v)); }); } if (json['Mohemm_ITG_SectionTopicsList'] != null) { getSectionTopics = []; json['Mohemm_ITG_SectionTopicsList'].forEach((v) { - getSectionTopics!.add(new GetSectionTopics.fromJson(v)); + getSectionTopics!.add(GetSectionTopics.fromJson(v)); }); } if (json['GetPendingReqFunctionsList'] != null) { getPendingTransactionsFunctions = []; json['GetPendingReqFunctionsList'].forEach((v) { - getPendingTransactionsFunctions!.add(new GetPendingTransactionsFunctions.fromJson(v)); + getPendingTransactionsFunctions!.add(GetPendingTransactionsFunctions.fromJson(v)); }); } if (json['GetPendingReqDetailsList'] != null) { getPendingTransactionsDetails = []; json['GetPendingReqDetailsList'].forEach((v) { - getPendingTransactionsDetails!.add(new GetPendingTransactionsDetails.fromJson(v)); + getPendingTransactionsDetails!.add(GetPendingTransactionsDetails.fromJson(v)); }); } @@ -1177,7 +1183,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) { @@ -1192,25 +1198,25 @@ class GenericResponseModel { sFHGetPoNotificationBodyList = json['SFH_GetPoNotificationBodyList']; sFHGetPrNotificationBodyList = json['SFH_GetPrNotificationBodyList']; startAbsenceApprovalProccess = json['StartAbsenceApprovalProccess']; - startAddressApprovalProcessList = json['StartAddressApprovalProcessList'] != null ? new StartAddressApprovalProcess.fromJson(json['StartAddressApprovalProcessList']) : 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']; @@ -1239,7 +1245,7 @@ class GenericResponseModel { vHRIsVerificationCodeValid = json['VHR_IsVerificationCodeValid']; validateAbsenceTransactionList = json['ValidateAbsenceTransactionList']; - validateEITTransactionList = json['ValidateEITTransactionList'] != null ? new ValidateEITTransactionList.fromJson(json['ValidateEITTransactionList']) : null; + validateEITTransactionList = json['ValidateEITTransactionList'] != null ? ValidateEITTransactionList.fromJson(json['ValidateEITTransactionList']) : null; validatePhonesTransactionList = json['ValidatePhonesTransactionList']; if (json['VrItemTypesList'] != null) { @@ -1251,7 +1257,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']; @@ -1264,7 +1270,7 @@ class GenericResponseModel { } Map toJson() { - Map data = new Map(); + Map data = Map(); data['Date'] = this.date; data['LanguageID'] = this.languageID; data['ServiceName'] = this.serviceName; @@ -1335,7 +1341,9 @@ class GenericResponseModel { data['GetAbsenceCollectionNotificationBodyList'] = this.getAbsenceCollectionNotificationBodyList!.map((v) => v.toJson()).toList(); } - data['GetAbsenceDffStructureList'] = this.getAbsenceDffStructureList; + 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(); 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..a7d04bb --- /dev/null +++ b/lib/models/leave_balance/get_absence_dff_structure_list_model.dart @@ -0,0 +1,193 @@ +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'].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; + } +} diff --git a/lib/ui/leave_balance/add_leave_balance_screen.dart b/lib/ui/leave_balance/add_leave_balance_screen.dart index b4278af..be0e3b5 100644 --- a/lib/ui/leave_balance/add_leave_balance_screen.dart +++ b/lib/ui/leave_balance/add_leave_balance_screen.dart @@ -4,6 +4,7 @@ import 'package:mohem_flutter_app/api/leave_balance_api_client.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.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/widgets/app_bar_widget.dart'; class AddLeaveBalanceScreen extends StatefulWidget { @@ -16,6 +17,7 @@ class AddLeaveBalanceScreen extends StatefulWidget { } class _AddLeaveBalanceScreenState extends State { + List absenceDff = []; List absenceList = []; @override @@ -36,6 +38,19 @@ class _AddLeaveBalanceScreenState extends State { } } + void getAbsenceDffStructure(String flexCode) async { + try { + Utils.showLoading(context); + absenceDff.clear(); + absenceDff = await LeaveBalanceApiClient().getAbsenceDffStructure(flexCode, "HR_LOA_SS", -999); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + @override void dispose() { super.dispose();