diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 6eae388..752200a 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -423,6 +423,7 @@ "skip": "يتخطى", "typeCurrentPasswordBelow": "اكتب كلمة المرور الحاليه", "currentPassword": "كلمة المرور الحاليه", + "concurrentReports": "التقارير المتزامنه", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 2a7945c..c176c5d 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -423,6 +423,7 @@ "skip": "skip", "typeCurrentPasswordBelow": "Type Your Current password below", "currentPassword": "Current password", + "concurrentReports": "Concurrent Reports", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/api/my_requests_api_client.dart b/lib/api/my_requests_api_client.dart index 391e297..c9507b9 100644 --- a/lib/api/my_requests_api_client.dart +++ b/lib/api/my_requests_api_client.dart @@ -6,6 +6,7 @@ import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_ccp_dff_structure_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_ccp_output_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_ccp_transactions_model.dart'; +import 'package:mohem_flutter_app/models/my_requests/get_ccp_transations_list_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_concurrent_programs_model.dart'; class MyRequestsApiClient { @@ -59,4 +60,38 @@ class MyRequestsApiClient { }, url, postParams); } + Future getSubmitNewRequest(List> list) async + { + String url = "${ApiConsts.erpRest}SUBMIT_CCP_TRANSACTION"; + Map postParams = { + "P_MENU_TYPE": "E", + "P_SELECTED_RESP_ID": -999, + "P_DESC_FLEX_NAME": "HMG_EMP_BUS_TRIP_SET_SS", + }; + + postParams.addAll(AppState().postParamsJson); + postParams["EITTransactionTBL"] = list; + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.submitCcpTransactionList; + }, url, postParams); + } + + Future> getCcpTransactions(List> list) async + { + String url = "${ApiConsts.erpRest}GET_CCP_TRANSACTIONS"; + Map postParams = { + "P_MENU_TYPE": "E", + "P_SELECTED_RESP_ID": -999, + "P_DESC_FLEX_NAME": "HMG_EMP_BUS_TRIP_SET_SS", + }; + + postParams.addAll(AppState().postParamsJson); + postParams["EITTransactionTBL"] = list; + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getCCPTransactionsModel ?? []; + }, url, postParams); + } + } diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 5824fe1..e9aeff4 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -435,8 +435,11 @@ class CodegenLoader extends AssetLoader{ "adult": "بالغ", "updateMember": "هل انت متأكد تريد تحديث بيانات هذا العضو؟", "fieldIsEmpty": "'{data}' الحقل فارغ. الرجاء التحديد", + "pleaseEnterComments": "الرجاء إدخال التعليقات", + "skip": "يتخطى", "typeCurrentPasswordBelow": "اكتب كلمة المرور الحاليه", "currentPassword": "كلمة المرور الحاليه", + "concurrentReports": "التقارير المتزامنه", "profile": { "reset_password": { "label": "Reset Password", @@ -906,8 +909,11 @@ static const Map en_US = { "adult": "Adult", "updateMember": "Are You Sure You Want to Update this Member?", "fieldIsEmpty": "'{data}' Field is empty. Please select", + "pleaseEnterComments": "Please enter comments", + "skip": "skip", "typeCurrentPasswordBelow": "Type Your Current password below", "currentPassword": "Current password", + "concurrentReports": "Concurrent Reports", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 8e45025..4ca2275 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -424,6 +424,7 @@ abstract class LocaleKeys { static const skip = 'skip'; static const typeCurrentPasswordBelow = 'typeCurrentPasswordBelow'; static const currentPassword = 'currentPassword'; + static const concurrentReports = 'concurrentReports'; static const profile_reset_password_label = 'profile.reset_password.label'; static const profile_reset_password_username = 'profile.reset_password.username'; static const profile_reset_password_password = 'profile.reset_password.password'; diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 2374fbc..753d2c2 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -61,6 +61,7 @@ import 'package:mohem_flutter_app/models/mowadhafhi/get_tickets_list.dart'; import 'package:mohem_flutter_app/models/my_requests/get_ccp_dff_structure_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_ccp_output_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_ccp_transactions_model.dart'; +import 'package:mohem_flutter_app/models/my_requests/get_ccp_transations_list_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_concurrent_programs_model.dart'; import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; import 'package:mohem_flutter_app/models/my_team/get_subordinates_leaves_total_vacations_list_model.dart'; @@ -342,7 +343,7 @@ class GenericResponseModel { SubmitAddressTransaction? submitAddressTransactionList; SubmitBasicDetailsTransactionList? submitBasicDetTransactionList; String? submitCEITransactionList; - String? submitCcpTransactionList; + SubmitCcpTransactionList? submitCcpTransactionList; SubmitContactTransactionList? submitContactTransactionList; SubmitEITTransactionList? submitEITTransactionList; String? submitHrTransactionList; @@ -1298,7 +1299,10 @@ class GenericResponseModel { submitAddressTransactionList = json['SubmitAddressTransactionList'] != null ? SubmitAddressTransaction.fromJson(json['SubmitAddressTransactionList']) : null; submitBasicDetTransactionList = json['SubmitBasicDetTransactionList'] != null ? SubmitBasicDetailsTransactionList.fromJson(json['SubmitBasicDetTransactionList']) : null; submitCEITransactionList = json['SubmitCEITransactionList']; - submitCcpTransactionList = json['SubmitCcpTransactionList']; + submitCcpTransactionList = json['SubmitCcpTransactionList'] != null + ? new SubmitCcpTransactionList.fromJson( + json['SubmitCcpTransactionList']) + : null; submitContactTransactionList = json['SubmitContactTransactionList'] != null ? SubmitContactTransactionList.fromJson(json['SubmitContactTransactionList']) : null; submitEITTransactionList = json['SubmitEITTransactionList'] != null ? SubmitEITTransactionList.fromJson(json['SubmitEITTransactionList']) : null; @@ -1753,7 +1757,10 @@ class GenericResponseModel { } data['SubmitCEITransactionList'] = this.submitCEITransactionList; - data['SubmitCcpTransactionList'] = this.submitCcpTransactionList; + if (this.submitCcpTransactionList != null) { + data['SubmitCcpTransactionList'] = + this.submitCcpTransactionList!.toJson(); + } data['SubmitContactTransactionList'] = this.submitContactTransactionList; if (this.submitEITTransactionList != null) { diff --git a/lib/models/my_requests/get_ccp_transations_list_model.dart b/lib/models/my_requests/get_ccp_transations_list_model.dart new file mode 100644 index 0000000..2e5191b --- /dev/null +++ b/lib/models/my_requests/get_ccp_transations_list_model.dart @@ -0,0 +1,24 @@ + + +class SubmitCcpTransactionList { + int? pREQUESTID; + String? pRETURNMSG; + String? pRETURNSTATUS; + + SubmitCcpTransactionList( + {this.pREQUESTID, this.pRETURNMSG, this.pRETURNSTATUS}); + + SubmitCcpTransactionList.fromJson(Map json) { + pREQUESTID = json['P_REQUEST_ID']; + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + } + + Map toJson() { + Map data = new Map(); + data['P_REQUEST_ID'] = this.pREQUESTID; + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + return data; + } +} \ No newline at end of file diff --git a/lib/ui/profile/add_update_family_member.dart b/lib/ui/profile/add_update_family_member.dart index 00ad7fc..61b6639 100644 --- a/lib/ui/profile/add_update_family_member.dart +++ b/lib/ui/profile/add_update_family_member.dart @@ -392,7 +392,7 @@ class _AddUpdateFamilyMemberState extends State { } void submitUpdateForm() async { - // try { + try { List> values1 = getBasicDetDffStructureList!.map((e) { String? dateVal = ''; String? vatcherVal = ''; @@ -463,9 +463,9 @@ class _AddUpdateFamilyMemberState extends State { Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams(LocaleKeys.profile_familyDetails.tr(), transactionId!.toInt(), itemKey.toString(), 'family_member')); setState(() {}); - // } catch (ex) { - // Utils.hideLoading(context); - // Utils.handleException(ex, context, null); - // } + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } } } diff --git a/lib/ui/screens/my_requests/my_requests.dart b/lib/ui/screens/my_requests/my_requests.dart index 65aa534..f9d8d39 100644 --- a/lib/ui/screens/my_requests/my_requests.dart +++ b/lib/ui/screens/my_requests/my_requests.dart @@ -47,7 +47,7 @@ class _MyRequestsState extends State { backgroundColor: Colors.white, appBar: AppBarWidget( context, - title: "Concurrent Reports", + title: LocaleKeys.concurrentReports, ), body: Column( children: [ diff --git a/lib/ui/screens/my_requests/new_request.dart b/lib/ui/screens/my_requests/new_request.dart index b476ecc..d04382d 100644 --- a/lib/ui/screens/my_requests/new_request.dart +++ b/lib/ui/screens/my_requests/new_request.dart @@ -5,11 +5,15 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/my_requests_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/validate_eit_transaction_model.dart'; import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; +import 'package:mohem_flutter_app/models/my_requests/get_ccp_transactions_model.dart'; +import 'package:mohem_flutter_app/models/my_requests/get_ccp_transations_list_model.dart'; import 'package:mohem_flutter_app/models/my_requests/get_concurrent_programs_model.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; @@ -25,7 +29,8 @@ class NewRequest extends StatefulWidget { class _NewRequestState extends State { List getConcurrentProgramsList = []; GetConcurrentProgramsModel? selectedConcurrentProgramList; - + SubmitCcpTransactionList? submitCcpTransactionList; + List getCCPTransactionsList = []; List? getCCPDFFStructureModelList; DateTime selectedDate = DateTime.now(); @@ -42,7 +47,7 @@ class _NewRequestState extends State { backgroundColor: Colors.white, appBar: AppBarWidget( context, - title: "Concurrent Reports", + title: LocaleKeys.concurrentReports, ), body: Column( children: [ @@ -84,7 +89,7 @@ class _NewRequestState extends State { 1.divider, DefaultButton(LocaleKeys.submit.tr(), () { // todo need to add submit method - // openNewRequest(); + openNewRequest(); }) .insideContainer, ], @@ -92,6 +97,40 @@ class _NewRequestState extends State { ); } + + void openNewRequest() async { + try { + List> values = getCCPDFFStructureModelList!.map((e) { + String? dateVal = ''; + String? vatcherVal = ''; + int? numberVal; + if (e!.fORMATTYPE == 'N') { + dateVal = null; + vatcherVal = e.eSERVICESDV!.pIDCOLUMNNAME; + numberVal = null; + } else if (e.fORMATTYPE == 'X') { + dateVal = null; + vatcherVal = e.eSERVICESDV!.pIDCOLUMNNAME; + numberVal = null; + } else { + dateVal = null; + numberVal = null; + vatcherVal = null; + } + return ValidateEitTransactionModel(dATEVALUE: dateVal, nAME: e.aPPLICATIONCOLUMNNAME, nUMBERVALUE: numberVal, tRANSACTIONNUMBER: 1, vARCHAR2VALUE: vatcherVal.toString()).toJson(); + }).toList(); + Utils.showLoading(context); + submitCcpTransactionList = await MyRequestsApiClient().getSubmitNewRequest(values); + getCCPTransactionsList = await MyRequestsApiClient().getCcpTransactions(values); + Utils.hideLoading(context); + Navigator.pushNamed(context, AppRoutes.myRequests,); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + void getConcurrentPrograms() async { try { Utils.showLoading(context);