diff --git a/lib/api/api_client.dart b/lib/api/api_client.dart index 3263bf4..258b2af 100644 --- a/lib/api/api_client.dart +++ b/lib/api/api_client.dart @@ -89,7 +89,7 @@ class ApiClient { return factoryConstructor(jsonData); } else { APIError? apiError; - apiError = APIError(jsonData['ErrorCode'], jsonData['ErrorMessage']); + apiError = APIError(jsonData['ErrorCode'], jsonData['ErrorEndUserMessage']); throw APIException(APIException.BAD_REQUEST, error: apiError); } // } catch (ex) { diff --git a/lib/api/mowadhafhi/mowadhafhi_api_client.dart b/lib/api/mowadhafhi/mowadhafhi_api_client.dart new file mode 100644 index 0000000..935a22f --- /dev/null +++ b/lib/api/mowadhafhi/mowadhafhi_api_client.dart @@ -0,0 +1,136 @@ +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/mowadhafhi/get_department_sections.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_project_departments.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_projects.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_section_topics.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_details.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_transactions.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_types.dart'; + +import '../../models/mowadhafhi/get_tickets_list.dart'; + +class MowadhafhiApiClient { + static final MowadhafhiApiClient _instance = MowadhafhiApiClient._internal(); + + MowadhafhiApiClient._internal(); + + factory MowadhafhiApiClient() => _instance; + + Future> getTicketsByEmployee() async { + String url = "${ApiConsts.cocRest}Mohemm_ITG_GetTicketsByEmployee"; + Map postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgPageSize": 10, "ItgPageNo": 1}; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getTicketsByEmployeeList ?? []; + }, url, postParams); + } + + Future> getTicketDetailsByEmployee(String? itgTicketID) async { + String url = "${ApiConsts.cocRest}Mohemm_ITG_GetTicketDetails"; + Map postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgTicketId": itgTicketID}; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getTicketDetailsByEmployee ?? []; + }, url, postParams); + } + + Future> getTicketTransactions(String? itgTicketID) async { + String url = "${ApiConsts.cocRest}Mohemm_ITG_GetTicketTransaction"; + Map postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgTicketId": itgTicketID}; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getTicketTransactions ?? []; + }, url, postParams); + } + + Future> getTicketTypes() async { + String url = "${ApiConsts.cocRest}Mohemm_ITG_GetTicketTypes"; + Map postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER}; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getTicketTypes ?? []; + }, url, postParams); + } + + Future> getProjects() async { + String url = "${ApiConsts.cocRest}Mohemm_ITG_GetProjects"; + Map postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgProjectCode": AppState().memberInformationList?.pAYROLLCODE}; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getMowadhafhiProjects ?? []; + }, url, postParams); + } + + Future> getProjectDepartments(int projectID) async { + String url = "${ApiConsts.cocRest}Mohemm_ITG_GetProjectDepartments"; + Map postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgProjectId": projectID}; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getProjectDepartments ?? []; + }, url, postParams); + } + + Future> getDepartmentSections(int? projectDepartmentID) async { + String url = "${ApiConsts.cocRest}Mohemm_ITG_GetDepartmentSections"; + Map postParams = { + "EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, + "ItgDepartmentSectionId": projectDepartmentID, + "ItgProjectDepartmentId": projectDepartmentID + }; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getDepartmentSections ?? []; + }, url, postParams); + } + + Future> getSectionTopics(int? departmentSectionID) async { + String url = "${ApiConsts.cocRest}Mohemm_ITG_GetSectionTopics"; + Map postParams = {"EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, "ItgDepartmentSectionId": departmentSectionID}; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getSectionTopics ?? []; + }, url, postParams); + } + + Future submitRequest(int? departmentID, String description, int? projectID, String? sectionID, String? sectionTopicID, int? ticketTypeID, List> attachmentList) async { + String url = "${ApiConsts.cocRest}Mohemm_ITG_CreateTicketMobile"; + Map postParams = { + "EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, + "ItgImageCollList" : attachmentList, + "channelId": 3, + "departmentId": departmentID, + "description": description, + "employeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, + "projectId": projectID, + "sectionId": sectionID, + "sectionTopicId": sectionTopicID, + "ticketStatus": "new", + "ticketTypeId": ticketTypeID + }; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.messageStatus; + }, url, postParams); + } +} diff --git a/lib/api/my_attendance_api_client.dart b/lib/api/my_attendance_api_client.dart index 60247dc..afae637 100644 --- a/lib/api/my_attendance_api_client.dart +++ b/lib/api/my_attendance_api_client.dart @@ -83,8 +83,12 @@ class MyAttendanceApiClient { "P_MENU_TYPE": "E", "P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode, "P_FUNCTION_NAME": pFunctionName, - "EITTransactionTBL": list, + // "EITTransactionTBL": list, }; + print(postParams); + postParams["EITTransactionTBL"] =list; + + postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); diff --git a/lib/api/profile_api_client.dart b/lib/api/profile_api_client.dart index 827a625..c631f7c 100644 --- a/lib/api/profile_api_client.dart +++ b/lib/api/profile_api_client.dart @@ -3,7 +3,6 @@ import 'dart:async'; 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/get_approves_list_model.dart'; import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; import 'package:mohem_flutter_app/models/get_employee_address_model.dart'; import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; @@ -11,6 +10,8 @@ import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart'; import 'package:mohem_flutter_app/models/get_employee_phones_model.dart'; import 'package:mohem_flutter_app/models/profile/phone_number_types_modek.dart'; import 'package:mohem_flutter_app/models/profile/submit_contact_transaction_list_model.dart'; +import 'package:mohem_flutter_app/models/profile/submit_phone_transactions.dart'; +import 'package:mohem_flutter_app/models/start_eit_approval_process_model.dart'; import 'api_client.dart'; class ProfileApiClient { @@ -174,4 +175,39 @@ class ProfileApiClient { return (responseData.getApprovesList?.length ?? 0) > 0 ? responseData.getApprovesList!.first : null; }, url, postParams); } + + Future submitPhoneNumbers(List empList) async { + String url = "${ApiConsts.erpRest}SUBMIT_PHONES_TRANSACTION"; + Map postParams = { + "P_MENU_TYPE": "E", + "P_SELECTED_RESP_ID": -999, + "P_FUNCTION_NAME": "HR_PERINFO_SS", + "P_MBL_PHONES_TBL": empList.map((element) { + return element.toJson(); + }).toList() + }; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return SubmitPhonesTransactionList.fromJson(responseData.submitPhonesTransactionList ?? {}); + }, url, postParams); + } + + Future startPhoneApprovalProcess(String action, String comments, String itemKey, int transactionId) async { + String url = "${ApiConsts.erpRest}START_PHONES_APPROVAL_PROCESS"; + Map postParams = { + "P_SELECTED_RESP_ID": -999, + "P_MENU_TYPE": "E", + "P_ACTION_MODE": action, + "P_COMMENTS": comments, + "P_ITEM_KEY": itemKey, + "P_TRANSACTION_ID": transactionId, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.startEitApprovalProcess; + }, url, postParams); + } } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 3872d51..2f52a11 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -21,6 +21,8 @@ import 'package:mohem_flutter_app/ui/profile/personal_info.dart'; // import 'package:mohem_flutter_app/ui/my_attendance/work_from_home_screen.dart'; import 'package:mohem_flutter_app/ui/screens/eit/add_eit.dart'; +import 'package:mohem_flutter_app/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart'; +import 'package:mohem_flutter_app/ui/screens/mowadhafhi/request_details.dart'; import 'package:mohem_flutter_app/ui/screens/profile/profile_screen.dart'; import 'package:mohem_flutter_app/ui/screens/submenu_screen.dart'; import 'package:mohem_flutter_app/ui/work_list/item_history_screen.dart'; @@ -28,6 +30,8 @@ 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 '../ui/screens/mowadhafhi/mowadhafhi_home.dart'; + class AppRoutes { static const String splash = "/splash"; static const String registerSelection = "/registerSelection"; @@ -74,6 +78,11 @@ class AppRoutes { static const String familyMembers = "/familyMembers"; static const String deleteFamilyMember = "/deleteFamilyMember"; + // Mowadhafhi + static const String mowadhafhi = "/mowadhafhi"; + static const String mowadhafhiDetails = "/mowadhafhiDetails"; + static const String mowadhafhiHRRequest = "/mowadhafhiHRRequest"; + static final Map routes = { login: (context) => LoginScreen(), verifyLogin: (context) => VerifyLoginScreen(), @@ -116,5 +125,10 @@ class AppRoutes { addDynamicInputProfile: (context) => DynamicInputScreenProfile(), deleteFamilyMember: (context) => DeleteFamilyMember(ModalRoute.of(context)!.settings.arguments as int), requestSubmitScreen: (context) => RequestSubmitScreen(), + + //mowadhafhi + mowadhafhi: (context) => MowadhafhiHome(), + mowadhafhiDetails: (context) => MowadhafhiRequestDetails(), + mowadhafhiHRRequest: (context) => MowadhafhiHRRequest(), }; } diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index f850249..8f3e8a8 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -4,11 +4,10 @@ import 'package:mohem_flutter_app/models/get_absence_collection_notification_bod import 'package:mohem_flutter_app/models/get_action_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_approves_list_model.dart'; import 'package:mohem_flutter_app/models/get_attachement_list_model.dart'; +import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart'; import 'package:mohem_flutter_app/models/get_default_value_list_model.dart'; -import 'package:mohem_flutter_app/models/worklist/hr/get_basic_det_ntf_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; import 'package:mohem_flutter_app/models/get_eit_transaction_list_model.dart'; -import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart'; import 'package:mohem_flutter_app/models/get_employee_address_model.dart'; import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart'; @@ -25,20 +24,30 @@ 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/member_login_list_model.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_department_sections.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_project_departments.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_projects.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_section_topics.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_details.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_transactions.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_types.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_tickets_list.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/profile/basic_details_cols_structions.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; import 'package:mohem_flutter_app/models/profile/phone_number_types_modek.dart'; +import 'package:mohem_flutter_app/models/profile/submit_phone_transactions.dart'; import 'package:mohem_flutter_app/models/start_eit_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/worklist/hr/eit_otification_body_model.dart'; +import 'package:mohem_flutter_app/models/validate_eit_transaction_list_model.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/validate_eit_transaction_list_model.dart'; import 'package:mohem_flutter_app/models/worklist_response_model.dart'; import 'package:mohem_flutter_app/models/profile/submit_contact_transaction_list_model.dart'; @@ -187,6 +196,14 @@ class GenericResponseModel { List? getTermDffStructureList; List? getTermNotificationBodyList; List? getTimeCardSummaryList; + List? getTicketsByEmployeeList; + List? getTicketDetailsByEmployee; + List? getTicketTransactions; + List? getTicketTypes; + List? getSectionTopics; + List? getMowadhafhiProjects; + List? getProjectDepartments; + List? getDepartmentSections; List? getUserItemTypesList; List? getVacationRulesList; List? getVaccinationOnHandList; @@ -277,7 +294,7 @@ class GenericResponseModel { SubmitContactTransactionList? submitContactTransactionList; SubmitEITTransactionList? submitEITTransactionList; String? submitHrTransactionList; - String? submitPhonesTransactionList; + Map? submitPhonesTransactionList; String? submitSITTransactionList; String? submitTermTransactionList; List? subordinatesOnLeavesList; @@ -440,6 +457,14 @@ class GenericResponseModel { this.getTermDffStructureList, this.getTermNotificationBodyList, this.getTimeCardSummaryList, + this.getTicketsByEmployeeList, + this.getTicketDetailsByEmployee, + this.getTicketTransactions, + this.getTicketTypes, + this.getSectionTopics, + this.getMowadhafhiProjects, + this.getProjectDepartments, + this.getDepartmentSections, this.getUserItemTypesList, this.getVacationRulesList, this.getVaccinationOnHandList, @@ -681,7 +706,7 @@ class GenericResponseModel { getContactColsStructureList = json['GetContactColsStructureList']; getContactDetailsList = json['GetContactDetailsList']; getContactDffStructureList = json['GetContactDffStructureList']; - getContactNotificationBodyList= json["GetContactNotificationBodyList"] == null ? null : GetContactNotificationBodyList.fromJson(json["GetContactNotificationBodyList"]); + getContactNotificationBodyList = json["GetContactNotificationBodyList"] == null ? null : GetContactNotificationBodyList.fromJson(json["GetContactNotificationBodyList"]); getCountriesList = json['GetCountriesList']; if (json['GetDayHoursTypeDetailsList'] != null) { getDayHoursTypeDetailsList = []; @@ -780,7 +805,8 @@ class GenericResponseModel { getPendingReqDetailsList = json['GetPendingReqDetailsList']; getPendingReqFunctionsList = json['GetPendingReqFunctionsList']; getPerformanceAppraisalList = json['GetPerformanceAppraisalList']; - getPhonesNotificationBodyList= json["GetPhonesNotificationBodyList"] == null ? null : List.from(json["GetPhonesNotificationBodyList"].map((x) => GetPhonesNotificationBodyList.fromJson(x))); + getPhonesNotificationBodyList = + json["GetPhonesNotificationBodyList"] == null ? null : List.from(json["GetPhonesNotificationBodyList"].map((x) => GetPhonesNotificationBodyList.fromJson(x))); if (json['GetPoItemHistoryList'] != null) { getPoItemHistoryList = []; json['GetPoItemHistoryList'].forEach((v) { @@ -843,6 +869,63 @@ class GenericResponseModel { getTimeCardSummaryList!.add(new GetTimeCardSummaryList.fromJson(v)); }); } + + if (json['Mohemm_ITG_TicketsByEmployeeList'] != null) { + getTicketsByEmployeeList = []; + json['Mohemm_ITG_TicketsByEmployeeList'].forEach((v) { + getTicketsByEmployeeList!.add(new GetTicketsByEmployeeList.fromJson(v)); + }); + } + + if (json['Mohemm_ITG_TicketDetailsList'] != null) { + getTicketDetailsByEmployee = []; + json['Mohemm_ITG_TicketDetailsList'].forEach((v) { + getTicketDetailsByEmployee!.add(new GetTicketDetailsByEmployee.fromJson(v)); + }); + } + + if (json['Mohemm_ITG_TicketTransactionsList'] != null) { + getTicketTransactions = []; + json['Mohemm_ITG_TicketTransactionsList'].forEach((v) { + getTicketTransactions!.add(new GetTicketTransactions.fromJson(v)); + }); + } + + if (json['Mohemm_Itg_TicketTypesList'] != null) { + getTicketTypes = []; + json['Mohemm_Itg_TicketTypesList'].forEach((v) { + getTicketTypes!.add(new GetTicketTypes.fromJson(v)); + }); + } + + if (json['Mohemm_Itg_ProjectsList'] != null) { + getMowadhafhiProjects = []; + json['Mohemm_Itg_ProjectsList'].forEach((v) { + getMowadhafhiProjects!.add(new GetMowadhafhiProjects.fromJson(v)); + }); + } + + if (json['Mohemm_ITG_ProjectDepartmentsList'] != null) { + getProjectDepartments = []; + json['Mohemm_ITG_ProjectDepartmentsList'].forEach((v) { + getProjectDepartments!.add(new GetProjectDepartments.fromJson(v)); + }); + } + + if (json['Mohemm_ITG_DepartmentSectionsList'] != null) { + getDepartmentSections = []; + json['Mohemm_ITG_DepartmentSectionsList'].forEach((v) { + getDepartmentSections!.add(new GetDepartmentSections.fromJson(v)); + }); + } + + if (json['Mohemm_ITG_SectionTopicsList'] != null) { + getSectionTopics = []; + json['Mohemm_ITG_SectionTopicsList'].forEach((v) { + getSectionTopics!.add(new GetSectionTopics.fromJson(v)); + }); + } + getUserItemTypesList = json['GetUserItemTypesList']; getVacationRulesList = json['GetVacationRulesList']; getVaccinationOnHandList = json['GetVaccinationOnHandList']; @@ -983,6 +1066,7 @@ class GenericResponseModel { submitHrTransactionList = json['SubmitHrTransactionList']; submitPhonesTransactionList = json['SubmitPhonesTransactionList']; + submitSITTransactionList = json['SubmitSITTransactionList']; submitTermTransactionList = json['SubmitTermTransactionList']; diff --git a/lib/models/mowadhafhi/get_department_sections.dart b/lib/models/mowadhafhi/get_department_sections.dart new file mode 100644 index 0000000..2d534ba --- /dev/null +++ b/lib/models/mowadhafhi/get_department_sections.dart @@ -0,0 +1,44 @@ +class GetDepartmentSections { + int? departmentId; + String? departmentName; + int? departmentSectionId; + String? projectCode; + int? projectId; + String? projectName; + int? sectionId; + String? sectionName; + + GetDepartmentSections( + {this.departmentId, + this.departmentName, + this.departmentSectionId, + this.projectCode, + this.projectId, + this.projectName, + this.sectionId, + this.sectionName}); + + GetDepartmentSections.fromJson(Map json) { + departmentId = json['departmentId']; + departmentName = json['departmentName']; + departmentSectionId = json['departmentSectionId']; + projectCode = json['projectCode']; + projectId = json['projectId']; + projectName = json['projectName']; + sectionId = json['sectionId']; + sectionName = json['sectionName']; + } + + Map toJson() { + final Map data = new Map(); + data['departmentId'] = this.departmentId; + data['departmentName'] = this.departmentName; + data['departmentSectionId'] = this.departmentSectionId; + data['projectCode'] = this.projectCode; + data['projectId'] = this.projectId; + data['projectName'] = this.projectName; + data['sectionId'] = this.sectionId; + data['sectionName'] = this.sectionName; + return data; + } +} diff --git a/lib/models/mowadhafhi/get_project_departments.dart b/lib/models/mowadhafhi/get_project_departments.dart new file mode 100644 index 0000000..436399d --- /dev/null +++ b/lib/models/mowadhafhi/get_project_departments.dart @@ -0,0 +1,32 @@ +class GetProjectDepartments { + int? departmentId; + String? departmentName; + String? projectCode; + int? projectDepartmentId; + String? projectName; + + GetProjectDepartments( + {this.departmentId, + this.departmentName, + this.projectCode, + this.projectDepartmentId, + this.projectName}); + + GetProjectDepartments.fromJson(Map json) { + departmentId = json['departmentId']; + departmentName = json['departmentName']; + projectCode = json['projectCode']; + projectDepartmentId = json['projectDepartmentId']; + projectName = json['projectName']; + } + + Map toJson() { + final Map data = new Map(); + data['departmentId'] = this.departmentId; + data['departmentName'] = this.departmentName; + data['projectCode'] = this.projectCode; + data['projectDepartmentId'] = this.projectDepartmentId; + data['projectName'] = this.projectName; + return data; + } +} diff --git a/lib/models/mowadhafhi/get_projects.dart b/lib/models/mowadhafhi/get_projects.dart new file mode 100644 index 0000000..62b99c3 --- /dev/null +++ b/lib/models/mowadhafhi/get_projects.dart @@ -0,0 +1,18 @@ +class GetMowadhafhiProjects { + int? projectId; + String? projectName; + + GetMowadhafhiProjects({this.projectId, this.projectName}); + + GetMowadhafhiProjects.fromJson(Map json) { + projectId = json['projectId']; + projectName = json['projectName']; + } + + Map toJson() { + final Map data = new Map(); + data['projectId'] = this.projectId; + data['projectName'] = this.projectName; + return data; + } +} diff --git a/lib/models/mowadhafhi/get_section_topics.dart b/lib/models/mowadhafhi/get_section_topics.dart new file mode 100644 index 0000000..c596527 --- /dev/null +++ b/lib/models/mowadhafhi/get_section_topics.dart @@ -0,0 +1,60 @@ +class GetSectionTopics { + int? departmentId; + String? departmentName; + String? projectCode; + int? projectDepartmentId; + int? projectId; + String? projectName; + int? sectionId; + String? sectionName; + int? sectionTopicId; + int? tatInHours; + int? topicId; + String? topicName; + + GetSectionTopics( + {this.departmentId, + this.departmentName, + this.projectCode, + this.projectDepartmentId, + this.projectId, + this.projectName, + this.sectionId, + this.sectionName, + this.sectionTopicId, + this.tatInHours, + this.topicId, + this.topicName}); + + GetSectionTopics.fromJson(Map json) { + departmentId = json['departmentId']; + departmentName = json['departmentName']; + projectCode = json['projectCode']; + projectDepartmentId = json['projectDepartmentId']; + projectId = json['projectId']; + projectName = json['projectName']; + sectionId = json['sectionId']; + sectionName = json['sectionName']; + sectionTopicId = json['sectionTopicId']; + tatInHours = json['tatInHours']; + topicId = json['topicId']; + topicName = json['topicName']; + } + + Map toJson() { + final Map data = new Map(); + data['departmentId'] = this.departmentId; + data['departmentName'] = this.departmentName; + data['projectCode'] = this.projectCode; + data['projectDepartmentId'] = this.projectDepartmentId; + data['projectId'] = this.projectId; + data['projectName'] = this.projectName; + data['sectionId'] = this.sectionId; + data['sectionName'] = this.sectionName; + data['sectionTopicId'] = this.sectionTopicId; + data['tatInHours'] = this.tatInHours; + data['topicId'] = this.topicId; + data['topicName'] = this.topicName; + return data; + } +} diff --git a/lib/models/mowadhafhi/get_ticket_details.dart b/lib/models/mowadhafhi/get_ticket_details.dart new file mode 100644 index 0000000..5f896bd --- /dev/null +++ b/lib/models/mowadhafhi/get_ticket_details.dart @@ -0,0 +1,80 @@ +class GetTicketDetailsByEmployee { + String? closedBy; + String? created; + int? departmentId; + String? departmentName; + String? description; + String? positionTitle; + int? projectId; + String? projectName; + int? sectionId; + String? sectionName; + String? ticketId; + String? ticketReferenceNo; + String? ticketStatusInternalName; + String? ticketStatusName; + int? ticketTypeId; + int? topicId; + String? topicName; + + GetTicketDetailsByEmployee( + {this.closedBy, + this.created, + this.departmentId, + this.departmentName, + this.description, + this.positionTitle, + this.projectId, + this.projectName, + this.sectionId, + this.sectionName, + this.ticketId, + this.ticketReferenceNo, + this.ticketStatusInternalName, + this.ticketStatusName, + this.ticketTypeId, + this.topicId, + this.topicName}); + + GetTicketDetailsByEmployee.fromJson(Map json) { + closedBy = json['closedBy']; + created = json['created']; + departmentId = json['departmentId']; + departmentName = json['departmentName']; + description = json['description']; + positionTitle = json['positionTitle']; + projectId = json['projectId']; + projectName = json['projectName']; + sectionId = json['sectionId']; + sectionName = json['sectionName']; + ticketId = json['ticketId']; + ticketReferenceNo = json['ticketReferenceNo']; + ticketStatusInternalName = json['ticketStatusInternalName']; + ticketStatusName = json['ticketStatusName']; + ticketTypeId = json['ticketTypeId']; + topicId = json['topicId']; + topicName = json['topicName']; + } + + Map toJson() { + final Map data = new Map(); + data['closedBy'] = this.closedBy; + data['created'] = this.created; + data['departmentId'] = this.departmentId; + data['departmentName'] = this.departmentName; + data['description'] = this.description; + data['positionTitle'] = this.positionTitle; + data['projectId'] = this.projectId; + data['projectName'] = this.projectName; + data['sectionId'] = this.sectionId; + data['sectionName'] = this.sectionName; + data['ticketId'] = this.ticketId; + data['ticketReferenceNo'] = this.ticketReferenceNo; + data['ticketStatusInternalName'] = this.ticketStatusInternalName; + data['ticketStatusName'] = this.ticketStatusName; + data['ticketTypeId'] = this.ticketTypeId; + data['topicId'] = this.topicId; + data['topicName'] = this.topicName; + return data; + } +} diff --git a/lib/models/mowadhafhi/get_ticket_transactions.dart b/lib/models/mowadhafhi/get_ticket_transactions.dart new file mode 100644 index 0000000..9091761 --- /dev/null +++ b/lib/models/mowadhafhi/get_ticket_transactions.dart @@ -0,0 +1,40 @@ +class GetTicketTransactions { + String? actionBy; + String? actionDate; + String? comments; + String? statusDisplayText; + String? statusName; + String? ticketId; + int? ticketTransactionId; + + GetTicketTransactions( + {this.actionBy, + this.actionDate, + this.comments, + this.statusDisplayText, + this.statusName, + this.ticketId, + this.ticketTransactionId}); + + GetTicketTransactions.fromJson(Map json) { + actionBy = json['actionBy']; + actionDate = json['actionDate']; + comments = json['comments']; + statusDisplayText = json['statusDisplayText']; + statusName = json['statusName']; + ticketId = json['ticketId']; + ticketTransactionId = json['ticketTransactionId']; + } + + Map toJson() { + final Map data = new Map(); + data['actionBy'] = this.actionBy; + data['actionDate'] = this.actionDate; + data['comments'] = this.comments; + data['statusDisplayText'] = this.statusDisplayText; + data['statusName'] = this.statusName; + data['ticketId'] = this.ticketId; + data['ticketTransactionId'] = this.ticketTransactionId; + return data; + } +} diff --git a/lib/models/mowadhafhi/get_ticket_types.dart b/lib/models/mowadhafhi/get_ticket_types.dart new file mode 100644 index 0000000..ae68e2d --- /dev/null +++ b/lib/models/mowadhafhi/get_ticket_types.dart @@ -0,0 +1,21 @@ +class GetTicketTypes { + String? ticketIdPrefix; + int? ticketTypeId; + String? typeName; + + GetTicketTypes({this.ticketIdPrefix, this.ticketTypeId, this.typeName}); + + GetTicketTypes.fromJson(Map json) { + ticketIdPrefix = json['ticketIdPrefix']; + ticketTypeId = json['ticketTypeId']; + typeName = json['typeName']; + } + + Map toJson() { + final Map data = new Map(); + data['ticketIdPrefix'] = this.ticketIdPrefix; + data['ticketTypeId'] = this.ticketTypeId; + data['typeName'] = this.typeName; + return data; + } +} diff --git a/lib/models/mowadhafhi/get_tickets_list.dart b/lib/models/mowadhafhi/get_tickets_list.dart new file mode 100644 index 0000000..34005df --- /dev/null +++ b/lib/models/mowadhafhi/get_tickets_list.dart @@ -0,0 +1,184 @@ +class GetTicketsByEmployeeList { + dynamic agentRating; + dynamic assignedSpecialist; + String? assignedSpecialistName; + String? assignedToSpecialistAt; + int? channelId; + String? channelName; + String? closedBy; + String? closedDate; + String? created; + int? departmentId; + String? departmentName; + String? description; + String? employeeEmail; + String? employeeName; + int? employeeNumber; + String? firstName; + dynamic isActive; + bool? isClosedDirectly; + dynamic isEscalated; + bool? isExceedTAT; + String? lastName; + String? mobileNumber; + dynamic pageNo; + dynamic pageSize; + String? positionTitle; + int? projectId; + String? projectManager; + String? projectName; + String? providedSolution; + int? sectionId; + String? sectionName; + dynamic serviceRating; + String? specialistDeadline; + String? ticketId; + String? ticketReferenceNo; + int? ticketStatusId; + String? ticketStatusInternalName; + String? ticketStatusName; + int? ticketTypeId; + String? ticketTypeName; + int? topicId; + String? topicName; + int? totalItemsCount; + + GetTicketsByEmployeeList( + {this.agentRating, + this.assignedSpecialist, + this.assignedSpecialistName, + this.assignedToSpecialistAt, + this.channelId, + this.channelName, + this.closedBy, + this.closedDate, + this.created, + this.departmentId, + this.departmentName, + this.description, + this.employeeEmail, + this.employeeName, + this.employeeNumber, + this.firstName, + this.isActive, + this.isClosedDirectly, + this.isEscalated, + this.isExceedTAT, + this.lastName, + this.mobileNumber, + this.pageNo, + this.pageSize, + this.positionTitle, + this.projectId, + this.projectManager, + this.projectName, + this.providedSolution, + this.sectionId, + this.sectionName, + this.serviceRating, + this.specialistDeadline, + this.ticketId, + this.ticketReferenceNo, + this.ticketStatusId, + this.ticketStatusInternalName, + this.ticketStatusName, + this.ticketTypeId, + this.ticketTypeName, + this.topicId, + this.topicName, + this.totalItemsCount}); + + GetTicketsByEmployeeList.fromJson(Map json) { + agentRating = json['agentRating']; + assignedSpecialist = json['assignedSpecialist']; + assignedSpecialistName = json['assignedSpecialistName']; + assignedToSpecialistAt = json['assignedToSpecialistAt']; + channelId = json['channelId']; + channelName = json['channelName']; + closedBy = json['closedBy']; + closedDate = json['closedDate']; + created = json['created']; + departmentId = json['departmentId']; + departmentName = json['departmentName']; + description = json['description']; + employeeEmail = json['employeeEmail']; + employeeName = json['employeeName']; + employeeNumber = json['employeeNumber']; + firstName = json['firstName']; + isActive = json['isActive']; + isClosedDirectly = json['isClosedDirectly']; + isEscalated = json['isEscalated']; + isExceedTAT = json['isExceedTAT']; + lastName = json['lastName']; + mobileNumber = json['mobileNumber']; + pageNo = json['pageNo']; + pageSize = json['pageSize']; + positionTitle = json['positionTitle']; + projectId = json['projectId']; + projectManager = json['projectManager']; + projectName = json['projectName']; + providedSolution = json['providedSolution']; + sectionId = json['sectionId']; + sectionName = json['sectionName']; + serviceRating = json['serviceRating']; + specialistDeadline = json['specialistDeadline']; + ticketId = json['ticketId']; + ticketReferenceNo = json['ticketReferenceNo']; + ticketStatusId = json['ticketStatusId']; + ticketStatusInternalName = json['ticketStatusInternalName']; + ticketStatusName = json['ticketStatusName']; + ticketTypeId = json['ticketTypeId']; + ticketTypeName = json['ticketTypeName']; + topicId = json['topicId']; + topicName = json['topicName']; + totalItemsCount = json['totalItemsCount']; + } + + Map toJson() { + final Map data = {}; + data['agentRating'] = agentRating; + data['assignedSpecialist'] = assignedSpecialist; + data['assignedSpecialistName'] = assignedSpecialistName; + data['assignedToSpecialistAt'] = assignedToSpecialistAt; + data['channelId'] = channelId; + data['channelName'] = channelName; + data['closedBy'] = closedBy; + data['closedDate'] = closedDate; + data['created'] = created; + data['departmentId'] = departmentId; + data['departmentName'] = departmentName; + data['description'] = description; + data['employeeEmail'] = employeeEmail; + data['employeeName'] = employeeName; + data['employeeNumber'] = employeeNumber; + data['firstName'] = firstName; + data['isActive'] = isActive; + data['isClosedDirectly'] = isClosedDirectly; + data['isEscalated'] = isEscalated; + data['isExceedTAT'] = isExceedTAT; + data['lastName'] = lastName; + data['mobileNumber'] = mobileNumber; + data['pageNo'] = pageNo; + data['pageSize'] = pageSize; + data['positionTitle'] = positionTitle; + data['projectId'] = projectId; + data['projectManager'] = projectManager; + data['projectName'] = projectName; + data['providedSolution'] = providedSolution; + data['sectionId'] = sectionId; + data['sectionName'] = sectionName; + data['serviceRating'] = serviceRating; + data['specialistDeadline'] = specialistDeadline; + data['ticketId'] = ticketId; + data['ticketReferenceNo'] = ticketReferenceNo; + data['ticketStatusId'] = ticketStatusId; + data['ticketStatusInternalName'] = ticketStatusInternalName; + data['ticketStatusName'] = ticketStatusName; + data['ticketTypeId'] = ticketTypeId; + data['ticketTypeName'] = ticketTypeName; + data['topicId'] = topicId; + data['topicName'] = topicName; + data['totalItemsCount'] = totalItemsCount; + return data; + } +} diff --git a/lib/models/mowadhafhi/mowadhafhi_attachement_request.dart b/lib/models/mowadhafhi/mowadhafhi_attachement_request.dart new file mode 100644 index 0000000..a72bd16 --- /dev/null +++ b/lib/models/mowadhafhi/mowadhafhi_attachement_request.dart @@ -0,0 +1,22 @@ +class MowadhafhiRequestAttachment { + String? base64Data; + String? fileName; + String? contentType; + + MowadhafhiRequestAttachment( + {this.base64Data, this.fileName, this.contentType}); + + MowadhafhiRequestAttachment.fromJson(Map json) { + base64Data = json['Base64Data']; + fileName = json['FileName']; + contentType = json['ContentType']; + } + + Map toJson() { + final Map data = new Map(); + data['Base64Data'] = this.base64Data; + data['FileName'] = this.fileName; + data['ContentType'] = this.contentType; + return data; + } +} diff --git a/lib/models/profile/submit_phone_transactions.dart b/lib/models/profile/submit_phone_transactions.dart new file mode 100644 index 0000000..6b7afd1 --- /dev/null +++ b/lib/models/profile/submit_phone_transactions.dart @@ -0,0 +1,24 @@ +class SubmitPhonesTransactionList { + String? pITEMKEY; + String? pRETURNMSG; + String? pRETURNSTATUS; + int? pTRANSACTIONID; + + SubmitPhonesTransactionList({this.pITEMKEY, this.pRETURNMSG, this.pRETURNSTATUS, this.pTRANSACTIONID}); + + SubmitPhonesTransactionList.fromJson(Map json) { + pITEMKEY = json['P_ITEM_KEY']; + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + pTRANSACTIONID = json['P_TRANSACTION_ID']; + } + + Map toJson() { + final Map data = new Map(); + data['P_ITEM_KEY'] = this.pITEMKEY; + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + data['P_TRANSACTION_ID'] = this.pTRANSACTIONID; + return data; + } +} diff --git a/lib/ui/landing/widget/app_drawer.dart b/lib/ui/landing/widget/app_drawer.dart index 4ef5eb4..4732d36 100644 --- a/lib/ui/landing/widget/app_drawer.dart +++ b/lib/ui/landing/widget/app_drawer.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/ui/landing/widget/drawer_item.dart'; -import 'package:provider/provider.dart'; class AppDrawer extends StatefulWidget { @override @@ -21,16 +20,26 @@ class _AppDrawerState extends State { ), Expanded( child: ListView(padding: const EdgeInsets.all(21), physics: const BouncingScrollPhysics(), children: [ - Divider(), + const Divider(), InkWell( - child: DrawerItem( + child: const DrawerItem( 'My Profile', icon: Icons.person, color: Colors.grey, ), onTap: () { drawerNavigator(context, AppRoutes.profile); - }) + }), + const Divider(), + InkWell( + child: const DrawerItem( + 'Mowadhafhi', + icon: Icons.person, + color: Colors.grey, + ), + onTap: () { + drawerNavigator(context, AppRoutes.mowadhafhi); + }) ])) ]))); } diff --git a/lib/ui/misc/request_submit_screen.dart b/lib/ui/misc/request_submit_screen.dart index a0722da..a4d0052 100644 --- a/lib/ui/misc/request_submit_screen.dart +++ b/lib/ui/misc/request_submit_screen.dart @@ -5,6 +5,7 @@ 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/my_attendance_api_client.dart'; +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'; @@ -25,8 +26,8 @@ class RequestSubmitScreenParams { String title; int transactionId; String pItemId; - - RequestSubmitScreenParams(this.title, this.transactionId, this.pItemId); + String approvalFlag; + RequestSubmitScreenParams(this.title, this.transactionId, this.pItemId, this.approvalFlag); } class RequestSubmitScreen extends StatefulWidget { @@ -83,12 +84,23 @@ class _RequestSubmitScreenState extends State { }); } await MyAttendanceApiClient().addAttachment(list); - await MyAttendanceApiClient().startEitApprovalProcess( - "SUBMIT", - comments.text, - params!.pItemId, - params!.transactionId, - ); + + if (params!.approvalFlag == 'phone_numbers') { + await ProfileApiClient().startPhoneApprovalProcess( + "SUBMIT", + comments.text, + params!.pItemId, + params!.transactionId, + ); + } else { + await MyAttendanceApiClient().startEitApprovalProcess( + "SUBMIT", + comments.text, + params!.pItemId, + params!.transactionId, + ); + } + Utils.hideLoading(context); Utils.showToast(LocaleKeys.yourRequestHasBeenSubmittedForApprovals.tr(), longDuration: true); Navigator.of(context).popUntil((route) { 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 ec129c8..62b07c8 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -44,6 +44,8 @@ class _DynamicInputScreenState extends State { try { Utils.showLoading(context); genericResponseModel = await MyAttendanceApiClient().getEitDffStructure(dynamicParams!.dynamicId); + dESCFLEXCONTEXTCODE = genericResponseModel!.pDESCFLEXCONTEXTCODE ?? ""; + descFlexConTextTitle = genericResponseModel!.pDESCFLEXCONTEXTNAME ?? ""; getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? []; //getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList(); Utils.hideLoading(context); @@ -79,7 +81,7 @@ class _DynamicInputScreenState extends State { genericResponseModel = await MyAttendanceApiClient().validateEitTransaction(dESCFLEXCONTEXTCODE, dynamicParams!.dynamicId, values); SubmitEITTransactionList submitEITTransactionList = await MyAttendanceApiClient().submitEitTransaction(dESCFLEXCONTEXTCODE, dynamicParams!.dynamicId, values); Utils.hideLoading(context); - Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams("title", submitEITTransactionList.pTRANSACTIONID!, submitEITTransactionList.pITEMKEY!)); + Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams("title", submitEITTransactionList.pTRANSACTIONID!, submitEITTransactionList.pITEMKEY!, 'eit')); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); @@ -87,12 +89,13 @@ class _DynamicInputScreenState extends State { } String dESCFLEXCONTEXTCODE = ""; + String descFlexConTextTitle = ""; void calGetValueSetValues(GetEITDFFStructureList structureList) async { try { Utils.showLoading(context); String segmentId = structureList.cHILDSEGMENTSVS!; - dESCFLEXCONTEXTCODE = structureList.dESCFLEXCONTEXTCODE!; + if (dESCFLEXCONTEXTCODE.isEmpty) dESCFLEXCONTEXTCODE = structureList.dESCFLEXCONTEXTCODE!; List filteredList = getEitDffStructureList?.where((element) => element.cHILDSEGMENTSVS == segmentId).toList() ?? []; List> values = filteredList @@ -202,6 +205,10 @@ class _DynamicInputScreenState extends State { isReadOnly: model.rEADONLY == "Y", onChange: (text) { model.fieldAnswer = text; + if (model.eSERVICESDV == null) { + model.eSERVICESDV = ESERVICESDV(); + } + model.eSERVICESDV!.pIDCOLUMNNAME = text; }, ).paddingOnly(bottom: 12); } else if (model.fORMATTYPE == "N") { @@ -212,6 +219,10 @@ class _DynamicInputScreenState extends State { isInputTypeNum: true, onChange: (text) { model.fieldAnswer = text; + if (model.eSERVICESDV == null) { + model.eSERVICESDV = ESERVICESDV(); + } + model.eSERVICESDV!.pIDCOLUMNNAME = text; }, ).paddingOnly(bottom: 12); } else if (model.fORMATTYPE == "X") { @@ -239,12 +250,21 @@ class _DynamicInputScreenState extends State { } DateTime date = await _selectDate(context); DateTime date1 = DateTime(date.year, date.month, date.day); - getEitDffStructureList![index].fieldAnswer = date.toString(); - ESERVICESDV eservicesdv = ESERVICESDV( - pIDCOLUMNNAME: DateFormat('yyyy-MM-dd').format(date1), - pRETURNMSG: "null", - pRETURNSTATUS: getEitDffStructureList![index].dEFAULTVALUE, - pVALUECOLUMNNAME: getEitDffStructureList![index].isDefaultTypeIsCDPS ? DateFormat('yyyy-MM-dd hh:mm:ss').format(date) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + // getEitDffStructureList![index].fieldAnswer = date.toString(); + ESERVICESDV eservicesdv; + if (getEitDffStructureList![index].isDefaultTypeIsCDPS) { + eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: DateFormat('yyyy/MM/dd HH:MM:SS').format(date1), + pRETURNMSG: "null", + pRETURNSTATUS: getEitDffStructureList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: getEitDffStructureList![index].isDefaultTypeIsCDPS ? DateFormat('yyyy/MM/dd HH:MM:SS').format(date) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + } else { + eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: DateFormat('yyyy-MM-dd').format(date1), + pRETURNMSG: "null", + pRETURNSTATUS: getEitDffStructureList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: getEitDffStructureList![index].isDefaultTypeIsCDPS ? DateFormat('yyyy-MM-dd hh:mm:ss').format(date) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + } getEitDffStructureList![index].eSERVICESDV = eservicesdv; setState(() {}); if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { @@ -270,23 +290,39 @@ class _DynamicInputScreenState extends State { onTap: () async { if ((getEitDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { if (getEitDffStructureList![index].isDefaultTypeIsCDPS) { - selectedDate = DateFormat("yyyy-MM-dd").parse(getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", "")); + String tempDate = getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!; + if (tempDate.contains("00:00:00")) { + tempDate = tempDate.replaceAll("00:00:00", '').trim(); + } + selectedDate = DateFormat("yyyy/MM/dd").parse(tempDate); } else { selectedDate = DateTime.parse(getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!); } } DateTime date = await _selectDate(context); DateTime date1 = DateTime(date.year, date.month, date.day); - getEitDffStructureList![index].fieldAnswer = date.toString(); - ESERVICESDV eservicesdv = ESERVICESDV( - pIDCOLUMNNAME: DateFormat('yyyy-MM-dd').format(date1), - pRETURNMSG: "null", - pRETURNSTATUS: getEitDffStructureList![index].dEFAULTVALUE, - pVALUECOLUMNNAME: getEitDffStructureList![index].isDefaultTypeIsCDPS ? DateFormat('yyyy-MM-dd hh:mm:ss').format(date) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + // getEitDffStructureList![index].fieldAnswer = date.toString(); + ESERVICESDV eservicesdv; + if (getEitDffStructureList![index].isDefaultTypeIsCDPS) { + eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: DateFormat('yyyy/MM/dd HH:MM:SS').format(date1), + pRETURNMSG: "null", + pRETURNSTATUS: getEitDffStructureList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: getEitDffStructureList![index].isDefaultTypeIsCDPS ? DateFormat('yyyy-MM-dd HH:MM:SS').format(date) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + } else { + eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: DateFormat('yyyy-MM-dd').format(date1), + pRETURNMSG: "null", + pRETURNSTATUS: getEitDffStructureList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: getEitDffStructureList![index].isDefaultTypeIsCDPS ? DateFormat('yyyy-MM-dd hh:mm:ss').format(date) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + } + getEitDffStructureList![index].eSERVICESDV = eservicesdv; setState(() {}); if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { - calGetValueSetValues(model); + if (getEitDffStructureList![index].isDefaultTypeIsCDPS) { + calGetValueSetValues(model); + } else {} } }, ).paddingOnly(bottom: 12); diff --git a/lib/ui/my_attendance/my_attendance_screen.dart b/lib/ui/my_attendance/my_attendance_screen.dart index cb347a1..e1db55c 100644 --- a/lib/ui/my_attendance/my_attendance_screen.dart +++ b/lib/ui/my_attendance/my_attendance_screen.dart @@ -32,13 +32,14 @@ class MyAttendanceScreen extends StatelessWidget { ? LocaleKeys.noDataAvailable.tr().toText16().center : Column( children: [ - itemView( - "assets/images/pdf.svg", - LocaleKeys.missingSwipes.tr(), - ).onPress(() { - Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.missingSwipes.tr(), "HMG_OTL_MISSING_SWIPE_EIT_SS")); - }), - 12.height, + //commenting this because missing wipe coming as duplicate in the screen + // itemView( + // "assets/images/pdf.svg", + // LocaleKeys.missingSwipes.tr(), + // ).onPress(() { + // Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.missingSwipes.tr(), "HMG_OTL_MISSING_SWIPE_EIT_SS")); + // }), + // 12.height, ListView.separated( padding: const EdgeInsets.all(21), itemBuilder: (cxt, index) => itemView( diff --git a/lib/ui/profile/basic_details.dart b/lib/ui/profile/basic_details.dart index e74d21d..795563e 100644 --- a/lib/ui/profile/basic_details.dart +++ b/lib/ui/profile/basic_details.dart @@ -74,29 +74,13 @@ class _BasicDetailsState extends State { context, title: LocaleKeys.profile_basicDetails.tr(), ), - // appBar: AppBar( - // backgroundColor: MyColors.white, - // leading: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // IconButton( - // icon: const Icon( - // Icons.arrow_back_ios, - // color: MyColors.backgroundBlackColor, - // ), - // onPressed: () => Navigator.pop(context), - // ), - // "Basic Details".toText24(isBold: true, color: MyColors.blackColor), - // ], - // ), - // ), backgroundColor: MyColors.backgroundColor, bottomSheet: footer(), body: Column( children: [ Container( width: double.infinity, - margin: EdgeInsets.only(top: 20, left: 21, right: 21,bottom: 20), + 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( diff --git a/lib/ui/profile/contact_details.dart b/lib/ui/profile/contact_details.dart index d4927cf..9dbc462 100644 --- a/lib/ui/profile/contact_details.dart +++ b/lib/ui/profile/contact_details.dart @@ -84,7 +84,7 @@ class _ContactDetailsState extends State { left: 26, right: 26, ), - padding: EdgeInsets.only(left: 14, right: 14, top: 5, bottom: 20), + padding: EdgeInsets.all(15), ///height: 200, decoration: BoxDecoration( @@ -99,7 +99,7 @@ class _ContactDetailsState extends State { color: Colors.white, borderRadius: BorderRadius.circular(10.0), ), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + child: Stack(children: [ Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -122,17 +122,7 @@ class _ContactDetailsState extends State { "${e.pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor), ])) .toList()) - ]) - - // [ - // "${getEmployeePhonesList[0].pHONETYPEMEANING}".toText13(color: MyColors.lightGrayColor), - // "${getEmployeePhonesList[0].pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor), - // SizedBox( - // height: 20,), - // "${getEmployeePhonesList[1].pHONETYPEMEANING}".toText13(color: MyColors.lightGrayColor), - // "${getEmployeePhonesList[1].pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor), - // ] - ), + ])), Container( width: double.infinity, margin: EdgeInsets.only( @@ -140,8 +130,8 @@ class _ContactDetailsState extends State { left: 26, right: 26, ), - padding: EdgeInsets.only(left: 14, right: 14, top: 5, bottom: 20), - height: 400, + padding: EdgeInsets.all(15), + // height: 400, decoration: BoxDecoration( boxShadow: [ BoxShadow( @@ -154,7 +144,7 @@ class _ContactDetailsState extends State { color: Colors.white, borderRadius: BorderRadius.circular(10.0), ), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + child: Stack(children: [ Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -179,36 +169,6 @@ class _ContactDetailsState extends State { ])) .toList()) ])) - // "${getEmployeeAddressList[0].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), - // "${getEmployeeAddressList[0].sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), - // SizedBox( - // height: 20, - // ), - // "${getEmployeeAddressList[2].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), - // "${getEmployeeAddressList[2].sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), - // SizedBox( - // height: 20, - // ), - // "${getEmployeeAddressList[3].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), - // "${getEmployeeAddressList[3].sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), - // SizedBox( - // height: 20, - // ), - // "${getEmployeeAddressList[4].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), - // "${getEmployeeAddressList[4].sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), - // SizedBox( - // height: 20, - // ), - // "${getEmployeeAddressList[5].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), - // "${getEmployeeAddressList[5].sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), - // SizedBox( - // height: 20, - // ), - // "${getEmployeeAddressList[6].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), - // "${getEmployeeAddressList[6].sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), - //]), - //), - //], ]))); } diff --git a/lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart index 3e25917..95d80a9 100644 --- a/lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart +++ b/lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart @@ -1,23 +1,25 @@ 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/my_attendance_api_client.dart'; import 'package:mohem_flutter_app/api/profile_api_client.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/dyanmic_forms/get_set_values_request_model.dart'; +import 'package:mohem_flutter_app/models/dyanmic_forms/validate_eit_transaction_model.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_cols_structions.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; +import 'package:mohem_flutter_app/ui/misc/request_submit_screen.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'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; @@ -31,7 +33,6 @@ class DynamicProfileParams { String colsURL; List? getEmployeeBasicDetailsList; - DynamicProfileParams(this.title, this.dynamicId, {this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = '', this.colsURL = '', this.getEmployeeBasicDetailsList = const []}); } @@ -51,6 +52,7 @@ class _DynamicInputScreenState extends State { List? getBasicDetColsStructureList; DynamicProfileParams? dynamicParams; + String dESCFLEXCONTEXTCODE = ""; @override void initState() { super.initState(); @@ -153,11 +155,7 @@ class _DynamicInputScreenState extends State { // 12.height, DefaultButton( LocaleKeys.next.tr(), - (getBasicDetDffStructureList ?? []).isEmpty - ? null - : () => { - //Navigator.of(context).pushNamed(LOGIN_TYPE) - }, + (getBasicDetDffStructureList ?? []).isEmpty ? null : () => {validateTransaction()}, ).insideContainer, ], ), @@ -194,7 +192,6 @@ class _DynamicInputScreenState extends State { isReadOnly: model.rEADONLY == "Y", onChange: (text) { getBasicDetDffStructureList![index].userBasicDetail!.sEGMENTVALUEDSP = text; - }, ).paddingOnly(bottom: 12); } else if (model.fORMATTYPE == "X") { @@ -326,4 +323,47 @@ class _DynamicInputScreenState extends State { } return time; } + + void validateTransaction() async { + try { + Utils.showLoading(context); + List> values = getBasicDetDffStructureList!.map((e) { + String tempVar = e.eSERVICESDV?.pIDCOLUMNNAME ?? ""; + if (e.fORMATTYPE == "X") { + // for date format type, date format is changed + tempVar = e.eSERVICESDV?.pVALUECOLUMNNAME ?? ""; + if (tempVar.isNotEmpty) { + DateTime date = DateFormat('yyyy-MM-dd').parse(tempVar); + tempVar = DateFormat('yyyy/MM/dd HH:mm:ss').format(date); + } + } + return ValidateEitTransactionModel(dATEVALUE: null, nAME: e.aPPLICATIONCOLUMNNAME, nUMBERVALUE: null, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: tempVar.toString()).toJson(); + }).toList(); + + values.add(ValidateEitTransactionModel(dATEVALUE: null, nAME: "PEI_ACTION", nUMBERVALUE: null, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: "NEW_ROW").toJson()); + values.add(ValidateEitTransactionModel(dATEVALUE: null, nAME: "PEI_EXTRA_INFO_ID", nUMBERVALUE: -1, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: null).toJson()); + values.add(ValidateEitTransactionModel(dATEVALUE: null, nAME: "PEI_OBJECT_VERSION_NUMBER", nUMBERVALUE: 0, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: null).toJson()); + List> valuesCols = getBasicDetColsStructureList!.map((e) { + String tempVar = e.userBasicDetail!.vARCHAR2VALUE ?? ""; + if (e.dATATYPE == "DATE") { + // for date format type, date format is changed + tempVar = e.userBasicDetail!.dATEVALUE ?? ""; + if (tempVar.isNotEmpty) { + DateTime date = DateFormat('yyyy-MM-dd').parse(tempVar); + tempVar = DateFormat('yyyy/MM/dd HH:mm:ss').format(date); + } + } + return ValidateEitTransactionModel(dATEVALUE: tempVar, nAME: e.aPPLICATIONCOLUMNNAME, nUMBERVALUE: null, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: tempVar.toString()).toJson(); + }).toList(); + List> transactionValues = new List.from(values)..addAll(valuesCols); + print(transactionValues); + //genericResponseModel = await MyAttendanceApiClient().validateEitTransaction(dESCFLEXCONTEXTCODE, dynamicParams!.dynamicId, values); + // SubmitEITTransactionList submitEITTransactionList = await MyAttendanceApiClient().submitEitTransaction(dESCFLEXCONTEXTCODE, dynamicParams!.dynamicId, values); + Utils.hideLoading(context); + // Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams("title", submitEITTransactionList.pTRANSACTIONID!, submitEITTransactionList.pITEMKEY!, 'eit')); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } } diff --git a/lib/ui/profile/phone_numbers.dart b/lib/ui/profile/phone_numbers.dart index cba17d5..14ce3ff 100644 --- a/lib/ui/profile/phone_numbers.dart +++ b/lib/ui/profile/phone_numbers.dart @@ -1,8 +1,11 @@ +import 'dart:convert'; + import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; 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'; @@ -11,6 +14,8 @@ import 'package:mohem_flutter_app/models/get_employee_address_model.dart'; import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; import 'package:mohem_flutter_app/models/get_employee_phones_model.dart'; import 'package:mohem_flutter_app/models/profile/phone_number_types_modek.dart'; +import 'package:mohem_flutter_app/models/profile/submit_phone_transactions.dart'; +import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart'; import 'package:mohem_flutter_app/ui/profile/profile.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; @@ -27,6 +32,7 @@ class PhoneNumbers extends StatefulWidget { class _PhoneNumbersState extends State { List getPhoneNumberTypesList = []; + SubmitPhonesTransactionList submitPhoneNumbers = SubmitPhonesTransactionList(); @override void initState() { super.initState(); @@ -155,7 +161,6 @@ class _PhoneNumbersState extends State { footer() { return Container( decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(10), color: MyColors.white, boxShadow: [ BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), @@ -163,14 +168,28 @@ class _PhoneNumbersState extends State { ), child: DefaultButton(LocaleKeys.update.tr(), () async { updatePhone(); - // context.setLocale(const Locale("en", "US")); // to change Loacle - // Profile(); }).insideContainer, ); } - void updatePhone() { - print(widget.getEmployeePhonesList); + void updatePhone() async { + Utils.showLoading(context); + setUpdateStatus(); + submitPhoneNumbers = await ProfileApiClient().submitPhoneNumbers(widget.getEmployeePhonesList); + + Utils.hideLoading(context); + Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, + arguments: RequestSubmitScreenParams(LocaleKeys.profile_contactDetails.tr(), submitPhoneNumbers.pTRANSACTIONID!, submitPhoneNumbers.pITEMKEY!, 'phone_numbers')); + } + + void setUpdateStatus() { + widget.getEmployeePhonesList.forEach((element) { + if (element.aCTION == null) { + element.aCTION = 'UPDATE_ROW'; + element.dATEFROM = ''; + element.dATETO = ''; + } + }); } void addNewRow() { diff --git a/lib/ui/screens/mowadhafhi/mowadhafhi_home.dart b/lib/ui/screens/mowadhafhi/mowadhafhi_home.dart new file mode 100644 index 0000000..6dd0f0d --- /dev/null +++ b/lib/ui/screens/mowadhafhi/mowadhafhi_home.dart @@ -0,0 +1,146 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:mohem_flutter_app/api/mowadhafhi/mowadhafhi_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/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_tickets_list.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; + +import '../../../widgets/app_bar_widget.dart'; + +class MowadhafhiHome extends StatefulWidget { + const MowadhafhiHome({Key? key}) : super(key: key); + + @override + _MowadhafhiHomeState createState() => _MowadhafhiHomeState(); +} + +class _MowadhafhiHomeState extends State { + List getTicketsByEmployeeList = []; + + @override + void initState() { + getOpenTickets(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget( + context, + title: "Mowadhafhi Request", + ), + body: Container( + margin: const EdgeInsets.only(top: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: ListView.separated( + physics: const BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (BuildContext context, int index) { + return InkWell( + onTap: () { + openRequestDetails(getTicketsByEmployeeList[index].ticketId!); + }, + child: Container( + width: double.infinity, + // height: 100.0, + padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), + margin: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + getTicketsByEmployeeList[index].ticketTypeName!.toText14(color: MyColors.grey57Color), + getTicketsByEmployeeList[index].created!.split(" ")[0].toText12(color: MyColors.grey70Color), + ], + ), + Container( + padding: const EdgeInsets.only(top: 10.0), + child: getTicketsByEmployeeList[index].description!.toText12(color: MyColors.grey57Color), + ), + Container( + padding: const EdgeInsets.only(top: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + getTicketsByEmployeeList[index].ticketStatusInternalName!.toText14(color: MyColors.gradiantEndColor), + SvgPicture.asset( + "assets/images/arrow_next.svg", + color: MyColors.darkIconColor, + ) + ], + ), + ), + ], + ), + ), + ); + }, + separatorBuilder: (BuildContext context, int index) => 12.height, + itemCount: getTicketsByEmployeeList.length ?? 0)), + 80.height + ], + ), + ), + bottomSheet: Container( + decoration: const BoxDecoration( + color: MyColors.white, + boxShadow: [ + BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), + ], + ), + child: DefaultButton(LocaleKeys.createRequest.tr(), () async { + openHRRequest(); + }).insideContainer, + ) + ); + } + + void openRequestDetails(String itgTicketID) async { + await Navigator.pushNamed(context, AppRoutes.mowadhafhiDetails, arguments: itgTicketID); + } + + void openHRRequest() async { + await Navigator.pushNamed(context, AppRoutes.mowadhafhiHRRequest).then((value) { + getOpenTickets(); + }); + } + + void getOpenTickets() async { + try { + Utils.showLoading(context); + getTicketsByEmployeeList.clear(); + getTicketsByEmployeeList = await MowadhafhiApiClient().getTicketsByEmployee(); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } +} diff --git a/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart b/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart new file mode 100644 index 0000000..6ed9cb5 --- /dev/null +++ b/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart @@ -0,0 +1,387 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:file_picker/file_picker.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/mowadhafhi/mowadhafhi_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/models/mowadhafhi/get_department_sections.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_project_departments.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_projects.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_section_topics.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_types.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/mowadhafhi_attachement_request.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/button/simple_button.dart'; +import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; +import 'package:mohem_flutter_app/widgets/radio/show_radio.dart'; + +class MowadhafhiHRRequest extends StatefulWidget { + const MowadhafhiHRRequest({Key? key}) : super(key: key); + + @override + _MowadhafhiHRRequestState createState() => _MowadhafhiHRRequestState(); +} + +class _MowadhafhiHRRequestState extends State { + List getTicketTypesList = []; + List getMowadhafhiProjectsList = []; + List getProjectDepartmentsList = []; + List getDepartmentSectionsList = []; + List getSectionTopicsList = []; + + GetProjectDepartments? selectedDepartment; + GetDepartmentSections? selectedSection; + GetSectionTopics? selectedTopic; + List attachmentFiles = []; + + String selectedServiceType = ""; + String description = ""; + int? projectID; + + @override + void initState() { + getTicketTypes(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget( + context, + title: "Mowadhafhi Request", + ), + body: SingleChildScrollView( + child: getTicketTypesList.isNotEmpty + ? Container( + width: double.infinity, + padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), + margin: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Service Type: ".toText16(), + 12.height, + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SizedBox( + height: 40, + child: ListView.separated( + itemBuilder: (context, index) { + return Container( + padding: const EdgeInsets.only(right: 6, top: 8, bottom: 8), + child: ShowRadio( + title: getTicketTypesList[index].typeName!, + value: getTicketTypesList[index].ticketTypeId!.toString(), + groupValue: selectedServiceType, + selectedColor: MyColors.gradiantStartColor), + ).onPress(() { + debugPrint(getTicketTypesList[index].typeName!); + selectedServiceType = getTicketTypesList[index].ticketTypeId!.toString(); + setState(() {}); + }); + }, + separatorBuilder: (context, index) => 1.width, + shrinkWrap: true, + itemCount: getTicketTypesList.length ?? 0, + scrollDirection: Axis.horizontal, + ), + ), + ], + ), + 12.height, + "Department Name: ".toText16(), + 12.height, + PopupMenuButton( + child: DynamicTextFieldWidget( + "Select Department", + selectedDepartment?.departmentName ?? "", + isEnable: false, + isPopup: true, + isInputTypeNum: true, + isReadOnly: false, + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + for (int i = 0; i < getProjectDepartmentsList!.length; i++) PopupMenuItem(child: Text(getProjectDepartmentsList![i].departmentName!), value: i), + ], + onSelected: (int popupIndex) { + selectedDepartment = getProjectDepartmentsList![popupIndex]; + getDepartmentSections(selectedDepartment?.projectDepartmentId); + setState(() {}); + }), + 12.height, + "Related Section: ".toText16(), + 12.height, + PopupMenuButton( + child: DynamicTextFieldWidget( + "Select Section", + selectedSection?.sectionName ?? "", + isEnable: false, + isPopup: true, + isInputTypeNum: true, + isReadOnly: false, + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + for (int i = 0; i < getDepartmentSectionsList!.length; i++) PopupMenuItem(child: Text(getDepartmentSectionsList![i].sectionName!), value: i), + ], + onSelected: (int popupIndex) { + selectedSection = getDepartmentSectionsList![popupIndex]; + getSectionTopics(selectedSection?.departmentSectionId); + setState(() {}); + }), + 12.height, + "Related Topic: ".toText16(), + 12.height, + PopupMenuButton( + child: DynamicTextFieldWidget( + "Select Topic", + selectedTopic?.topicName ?? "", + isEnable: false, + isPopup: true, + isInputTypeNum: true, + isReadOnly: false, + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + for (int i = 0; i < getSectionTopicsList!.length; i++) PopupMenuItem(child: Text(getSectionTopicsList![i].topicName!), value: i), + ], + onSelected: (int popupIndex) { + selectedTopic = getSectionTopicsList![popupIndex]; + // getDepartmentSections(selectedSection?.departmentSectionId); + setState(() {}); + }), + 12.height, + "Supporting Document: ".toText16(), + 12.height, + attachmentView("Attachments"), + 12.height, + "Description: ".toText16(), + 12.height, + DynamicTextFieldWidget( + "", + "", + isEnable: true, + isPopup: false, + lines: 4, + isInputTypeNum: false, + isReadOnly: false, + onChange: (String value) { + debugPrint(value); + description = value; + }, + ), + 50.height + ], + ), + ) + : Container(), + ), + bottomSheet: Container( + padding: const EdgeInsets.only(top: 8.0, bottom: 8.0), + decoration: const BoxDecoration( + color: MyColors.white, + ), + child: Row( + children: [ + 12.width, + Expanded( + child: DefaultButton( + "Submit", + !checkValidation() + ? null + : () { + submitHRRequest(); + }, + color: const Color(0xFFD02127), + ), + ), + 12.width, + ], + ), + ), + ); + } + + bool checkValidation() { + if (selectedServiceType == "" || selectedDepartment == null || selectedSection == null || selectedTopic == null) { + return false; + } else { + return true; + } + } + + Widget attachmentView(String title) { + return Container( + padding: const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + title.toText16().expanded, + 6.width, + SimpleButton("Add", () async { + FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true); + if (result != null) { + attachmentFiles = attachmentFiles + result.paths.map((path) => File(path!)).toList(); + attachmentFiles = attachmentFiles.toSet().toList(); + setState(() {}); + } + }, fontSize: 14), + ], + ), + if (attachmentFiles.isNotEmpty) 12.height, + if (attachmentFiles.isNotEmpty) + ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) { + String fileName = attachmentFiles[index].path.split('/').last; + + return Row( + children: [ + fileName.toText13().expanded, + 6.width, + IconButton( + padding: EdgeInsets.zero, + iconSize: 20, + icon: const Icon(Icons.cancel_rounded), + color: MyColors.redColor, + constraints: const BoxConstraints(), + onPressed: () async { + attachmentFiles.removeAt(index); + setState(() {}); + }, + ) + ], + ); + }, + separatorBuilder: (cxt, index) => 6.height, + itemCount: attachmentFiles.length), + ], + ), + ); + } + + void getTicketTypes() async { + try { + Utils.showLoading(context); + getTicketTypesList = await MowadhafhiApiClient().getTicketTypes(); + Utils.hideLoading(context); + getMowadhafhiProjects(); + // setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + void getMowadhafhiProjects() async { + try { + Utils.showLoading(context); + getMowadhafhiProjectsList = await MowadhafhiApiClient().getProjects(); + Utils.hideLoading(context); + getProjectDepartments(getMowadhafhiProjectsList[0].projectId!); + projectID = getMowadhafhiProjectsList[0].projectId!; + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + void getProjectDepartments(int projectID) async { + try { + Utils.showLoading(context); + getProjectDepartmentsList = await MowadhafhiApiClient().getProjectDepartments(projectID); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + void getDepartmentSections(int? projectDepartmentID) async { + try { + Utils.showLoading(context); + getDepartmentSectionsList = await MowadhafhiApiClient().getDepartmentSections(projectDepartmentID); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + void getSectionTopics(int? departmentSectionID) async { + try { + Utils.showLoading(context); + getSectionTopicsList = await MowadhafhiApiClient().getSectionTopics(departmentSectionID); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + void submitHRRequest() async { + try { + Utils.showLoading(context); + List> list = []; + if (attachmentFiles.isNotEmpty) { + for (int i = 0; i < attachmentFiles.length; i++) { + String type = attachmentFiles[i].path.split('.').last; + String name = attachmentFiles[i].path.split('/').last; + List fileContent = await attachmentFiles[i].readAsBytes(); + String encodedFile = base64Encode(fileContent); + list.add(MowadhafhiRequestAttachment( + contentType: "image/" + type, + fileName: name, + base64Data: encodedFile, + ).toJson()); + } + } + int? messageStatus = await MowadhafhiApiClient().submitRequest(selectedDepartment?.projectDepartmentId, description, projectID, selectedSection?.departmentSectionId.toString(), + selectedTopic?.sectionTopicId.toString(), int.parse(selectedServiceType), list); + Utils.showToast("Request created successfully"); + Utils.hideLoading(context); + Navigator.pop(context); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } +} diff --git a/lib/ui/screens/mowadhafhi/request_details.dart b/lib/ui/screens/mowadhafhi/request_details.dart new file mode 100644 index 0000000..ec7db4b --- /dev/null +++ b/lib/ui/screens/mowadhafhi/request_details.dart @@ -0,0 +1,213 @@ +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/mowadhafhi/mowadhafhi_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/models/mowadhafhi/get_ticket_details.dart'; +import 'package:mohem_flutter_app/models/mowadhafhi/get_ticket_transactions.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; + +class MowadhafhiRequestDetails extends StatefulWidget { + const MowadhafhiRequestDetails({Key? key}) : super(key: key); + + @override + _RequestDetailsState createState() => _RequestDetailsState(); +} + +class _RequestDetailsState extends State { + String? itgTicketID; + List getTicketsByEmployeeList = []; + List getTicketTransactionsList = []; + + @override + void initState() { + // TODO: implement initState + super.initState(); + } + + getRequestID() { + if (itgTicketID == null) { + itgTicketID = ModalRoute.of(context)?.settings.arguments as String; + debugPrint(itgTicketID); + getTicketDetails(); + } + } + + @override + Widget build(BuildContext context) { + getRequestID(); + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget( + context, + title: "Mowadhafhi Request", + ), + body: SingleChildScrollView( + child: getTicketsByEmployeeList.length != 0 + ? Column( + children: [ + Container( + width: double.infinity, + padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), + margin: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + getTicketsByEmployeeList![0].ticketStatusName!.toText14(color: MyColors.gradiantEndColor), + getTicketsByEmployeeList![0].created!.split(" ")[0].toText12(color: MyColors.grey70Color), + ], + ), + 8.height, + "Ticket Reference: ".toText12(color: MyColors.grey98Color), + getTicketsByEmployeeList![0].ticketReferenceNo!.toText14(color: MyColors.grey57Color), + 8.height, + "Section: ".toText12(color: MyColors.grey98Color), + getTicketsByEmployeeList![0].sectionName!.toText14(color: MyColors.grey57Color), + 8.height, + "Topic: ".toText12(color: MyColors.grey98Color), + getTicketsByEmployeeList![0].topicName!.toText14(color: MyColors.grey57Color), + 8.height, + "Description: ".toText12(color: MyColors.grey98Color), + getTicketsByEmployeeList![0].description!.toText14(color: MyColors.grey57Color), + ], + ), + ), + Container( + width: double.infinity, + padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), + margin: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListView.builder( + shrinkWrap: true, + physics: const ScrollPhysics(), + itemBuilder: (BuildContext context, int index) { + return Stack( + children: [ + Padding( + padding: const EdgeInsets.only(left: 50.0), + child: Card( + elevation: 0.0, + margin: const EdgeInsets.fromLTRB(0.0, 20.0, 20.0, 10.0), + child: Container( + padding: const EdgeInsets.all(12.0), + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + "Action By: ".toText14(color: MyColors.grey57Color), + getTicketTransactionsList![index].actionBy!.toText14(color: MyColors.grey57Color), + ], + ), + getTicketTransactionsList![index].comments!.toText14(color: MyColors.grey98Color), + 12.height, + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + getTicketTransactionsList![0].actionDate!.split(" ")[0].toText12(color: MyColors.grey70Color), + ], + ), + ], + ), + ), + ), + ), + Positioned( + top: 0.0, + bottom: 0.0, + left: 28.0, + child: Container( + height: double.infinity, + width: 3.0, + color: MyColors.lightTextColor.withOpacity(0.5), + ), + ), + Positioned( + top: 0.0, + left: 15.0, + child: Container( + height: 30.0, + width: 30.0, + decoration: const BoxDecoration( + shape: BoxShape.circle, + color: Colors.white, + ), + child: Container( + margin: const EdgeInsets.all(5.0), + height: 30.0, + width: 30.0, + decoration: const BoxDecoration(shape: BoxShape.circle, color: MyColors.gradiantEndColor), + ), + ), + ) + ], + ); + }, + itemCount: getTicketTransactionsList.length ?? 0, + ) + ], + ), + ), + ], + ) + : Container(), + ), + ); + } + + void getTicketDetails() async { + try { + Utils.showLoading(context); + getTicketsByEmployeeList = await MowadhafhiApiClient().getTicketDetailsByEmployee(itgTicketID); + Utils.hideLoading(context); + setState(() {}); + getTicketTransactions(); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + void getTicketTransactions() async { + try { + Utils.showLoading(context); + getTicketTransactionsList = await MowadhafhiApiClient().getTicketTransactions(itgTicketID); + debugPrint(getTicketTransactionsList![0].actionDate); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } +} diff --git a/lib/ui/screens/profile/profile_screen.dart b/lib/ui/screens/profile/profile_screen.dart index 76f8a20..8b015b0 100644 --- a/lib/ui/screens/profile/profile_screen.dart +++ b/lib/ui/screens/profile/profile_screen.dart @@ -27,7 +27,10 @@ class _ProfileScreenState extends State { @override void initState() { super.initState(); + memberInformationList = AppState().memberInformationList!; + + setState(() {}); //getEmployeeBasicDetails(); }