My requests & CCP
							parent
							
								
									6d1b942dca
								
							
						
					
					
						commit
						c63844dcf7
					
				| @ -0,0 +1,62 @@ | ||||
| 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/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_concurrent_programs_model.dart'; | ||||
| 
 | ||||
| class MyRequestsApiClient { | ||||
|   static final MyRequestsApiClient _instance = MyRequestsApiClient._internal(); | ||||
| 
 | ||||
|   MyRequestsApiClient._internal(); | ||||
| 
 | ||||
|   factory MyRequestsApiClient() => _instance; | ||||
| 
 | ||||
|   Future<List<GetConcurrentProgramsModel>> getConcurrentPrograms() async { | ||||
|     String url = "${ApiConsts.erpRest}GET_CONCURRENT_PROGRAMS"; | ||||
|     Map<String, dynamic> postParams = {"P_REQUEST_GROUP_ID": 3290}; | ||||
| 
 | ||||
|     postParams.addAll(AppState().postParamsJson); | ||||
|     return await ApiClient().postJsonForObject((json) { | ||||
|       GenericResponseModel? responseData = GenericResponseModel.fromJson(json); | ||||
|       return responseData.getConcurrentProgramsModel ?? []; | ||||
|     }, url, postParams); | ||||
|   } | ||||
| 
 | ||||
|   Future<List<GetCCPTransactionsModel>> getCCPTransactions(String? templateName) async { | ||||
|     String url = "${ApiConsts.erpRest}GET_CCP_TRANSACTIONS"; | ||||
|     Map<String, dynamic> postParams = {"P_DESC_FLEX_NAME": templateName}; | ||||
| 
 | ||||
|     postParams.addAll(AppState().postParamsJson); | ||||
|     return await ApiClient().postJsonForObject((json) { | ||||
|       GenericResponseModel? responseData = GenericResponseModel.fromJson(json); | ||||
|       return responseData.getCCPTransactionsModel ?? []; | ||||
|     }, url, postParams); | ||||
|   } | ||||
| 
 | ||||
|   Future<GetCCPOutputModel> getCCPOutput(String? requestID) async { | ||||
|     String url = "${ApiConsts.erpRest}GET_CCP_OUTPUT"; | ||||
|     Map<String, dynamic> postParams = {"P_REQUEST_ID": requestID}; | ||||
| 
 | ||||
|     postParams.addAll(AppState().postParamsJson); | ||||
|     return await ApiClient().postJsonForObject((json) { | ||||
|       GenericResponseModel? responseData = GenericResponseModel.fromJson(json); | ||||
|       return responseData.getCCPOutputModel!; | ||||
|     }, url, postParams); | ||||
|   } | ||||
| 
 | ||||
|   Future<List<GetEITDFFStructureList>> getCCPDFFStructure(String? templateName) async { | ||||
|     String url = "${ApiConsts.erpRest}GET_CCP_DFF_STRUCTURE"; | ||||
|     Map<String, dynamic> postParams = {"P_DESC_FLEX_NAME": templateName}; | ||||
| 
 | ||||
|     postParams.addAll(AppState().postParamsJson); | ||||
|     return await ApiClient().postJsonForObject((json) { | ||||
|       GenericResponseModel? responseData = GenericResponseModel.fromJson(json); | ||||
|       return responseData.getEITDFFStructureList ?? []; | ||||
|     }, url, postParams); | ||||
|   } | ||||
| 
 | ||||
| } | ||||
| @ -0,0 +1,40 @@ | ||||
| import 'dart:convert'; | ||||
| import 'dart:io'; | ||||
| import 'dart:typed_data'; | ||||
| 
 | ||||
| import 'package:open_file/open_file.dart'; | ||||
| import 'package:path_provider/path_provider.dart'; | ||||
| 
 | ||||
| class FileProcess { | ||||
|   static bool isFolderCreated = false; | ||||
|   static Directory? directory; | ||||
| 
 | ||||
|   static checkDocumentFolder() async { | ||||
|     try { | ||||
|       if (!isFolderCreated) { | ||||
|         directory = await getApplicationDocumentsDirectory(); | ||||
|         await directory!.exists().then((value) { | ||||
|           if (value) directory!.create(); | ||||
|           isFolderCreated = true; | ||||
|         }); | ||||
|       } | ||||
|     } catch (e) { | ||||
|       print(e.toString()); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   static void openFile(String fileName) { | ||||
|     String dir = directory!.path + "/${fileName}.pdf"; | ||||
|     OpenFile.open(dir); | ||||
|   } | ||||
| 
 | ||||
|   static Future<File> downloadFile(String base64Content, String fileName) async { | ||||
|     Uint8List bytes = base64.decode(base64Content); | ||||
|     await checkDocumentFolder(); | ||||
|     String dir = directory!.path + "/" + fileName + ".pdf"; | ||||
|     File file = File(dir); | ||||
|     if (!file.existsSync()) file.create(); | ||||
|     await file.writeAsBytes(bytes); | ||||
|     return file; | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,220 @@ | ||||
| class GetCCPDFFStructureModel { | ||||
|   String? aLPHANUMERICALLOWEDFLAG; | ||||
|   String? aPPLICATIONCOLUMNNAME; | ||||
|   String? cHILDSEGMENTSDV; | ||||
|   Null? cHILDSEGMENTSDVSplited; | ||||
|   String? cHILDSEGMENTSVS; | ||||
|   Null? cHILDSEGMENTSVSSplited; | ||||
|   String? dEFAULTTYPE; | ||||
|   String? dEFAULTVALUE; | ||||
|   String? dESCFLEXCONTEXTCODE; | ||||
|   String? dESCFLEXCONTEXTNAME; | ||||
|   String? dESCFLEXNAME; | ||||
|   String? dISPLAYFLAG; | ||||
|   String? eNABLEDFLAG; | ||||
|   ESERVICESDV? eSERVICESDV; | ||||
|   // List<Null>? eSERVICESVS; | ||||
|   String? fLEXVALUESETNAME; | ||||
|   String? fORMATTYPE; | ||||
|   String? fORMATTYPEDSP; | ||||
|   String? lONGLISTFLAG; | ||||
|   int? mAXIMUMSIZE; | ||||
|   String? mAXIMUMVALUE; | ||||
|   String? mINIMUMVALUE; | ||||
|   String? mOBILEENABLED; | ||||
|   String? nUMBERPRECISION; | ||||
|   String? nUMERICMODEENABLEDFLAG; | ||||
|   String? pARENTSEGMENTSDV; | ||||
|   List<Null>? pARENTSEGMENTSDVSplited; | ||||
|   String? pARENTSEGMENTSVS; | ||||
|   List<Null>? pARENTSEGMENTSVSSplitedVS; | ||||
|   String? rEADONLY; | ||||
|   String? rEQUIREDFLAG; | ||||
|   String? sEGMENTNAME; | ||||
|   String? sEGMENTPROMPT; | ||||
|   int? sEGMENTSEQNUM; | ||||
|   String? uPPERCASEONLYFLAG; | ||||
|   String? uSEDFLAG; | ||||
|   String? vALIDATIONTYPE; | ||||
|   String? vALIDATIONTYPEDSP; | ||||
| 
 | ||||
|   GetCCPDFFStructureModel( | ||||
|       {this.aLPHANUMERICALLOWEDFLAG, | ||||
|         this.aPPLICATIONCOLUMNNAME, | ||||
|         this.cHILDSEGMENTSDV, | ||||
|         this.cHILDSEGMENTSDVSplited, | ||||
|         this.cHILDSEGMENTSVS, | ||||
|         this.cHILDSEGMENTSVSSplited, | ||||
|         this.dEFAULTTYPE, | ||||
|         this.dEFAULTVALUE, | ||||
|         this.dESCFLEXCONTEXTCODE, | ||||
|         this.dESCFLEXCONTEXTNAME, | ||||
|         this.dESCFLEXNAME, | ||||
|         this.dISPLAYFLAG, | ||||
|         this.eNABLEDFLAG, | ||||
|         this.eSERVICESDV, | ||||
|         // this.eSERVICESVS, | ||||
|         this.fLEXVALUESETNAME, | ||||
|         this.fORMATTYPE, | ||||
|         this.fORMATTYPEDSP, | ||||
|         this.lONGLISTFLAG, | ||||
|         this.mAXIMUMSIZE, | ||||
|         this.mAXIMUMVALUE, | ||||
|         this.mINIMUMVALUE, | ||||
|         this.mOBILEENABLED, | ||||
|         this.nUMBERPRECISION, | ||||
|         this.nUMERICMODEENABLEDFLAG, | ||||
|         this.pARENTSEGMENTSDV, | ||||
|         this.pARENTSEGMENTSDVSplited, | ||||
|         this.pARENTSEGMENTSVS, | ||||
|         this.pARENTSEGMENTSVSSplitedVS, | ||||
|         this.rEADONLY, | ||||
|         this.rEQUIREDFLAG, | ||||
|         this.sEGMENTNAME, | ||||
|         this.sEGMENTPROMPT, | ||||
|         this.sEGMENTSEQNUM, | ||||
|         this.uPPERCASEONLYFLAG, | ||||
|         this.uSEDFLAG, | ||||
|         this.vALIDATIONTYPE, | ||||
|         this.vALIDATIONTYPEDSP}); | ||||
| 
 | ||||
|   GetCCPDFFStructureModel.fromJson(Map<String, dynamic> json) { | ||||
|     aLPHANUMERICALLOWEDFLAG = json['ALPHANUMERIC_ALLOWED_FLAG']; | ||||
|     aPPLICATIONCOLUMNNAME = json['APPLICATION_COLUMN_NAME']; | ||||
|     cHILDSEGMENTSDV = json['CHILD_SEGMENTS_DV']; | ||||
|     cHILDSEGMENTSDVSplited = json['CHILD_SEGMENTS_DV_Splited']; | ||||
|     cHILDSEGMENTSVS = json['CHILD_SEGMENTS_VS']; | ||||
|     cHILDSEGMENTSVSSplited = json['CHILD_SEGMENTS_VS_Splited']; | ||||
|     dEFAULTTYPE = json['DEFAULT_TYPE']; | ||||
|     dEFAULTVALUE = json['DEFAULT_VALUE']; | ||||
|     dESCFLEXCONTEXTCODE = json['DESC_FLEX_CONTEXT_CODE']; | ||||
|     dESCFLEXCONTEXTNAME = json['DESC_FLEX_CONTEXT_NAME']; | ||||
|     dESCFLEXNAME = json['DESC_FLEX_NAME']; | ||||
|     dISPLAYFLAG = json['DISPLAY_FLAG']; | ||||
|     eNABLEDFLAG = json['ENABLED_FLAG']; | ||||
|     eSERVICESDV = json['E_SERVICES_DV'] != null | ||||
|         ? new ESERVICESDV.fromJson(json['E_SERVICES_DV']) | ||||
|         : null; | ||||
|     // if (json['E_SERVICES_VS'] != null) { | ||||
|     //   eSERVICESVS = <Null>[]; | ||||
|     //   json['E_SERVICES_VS'].forEach((v) { | ||||
|     //     eSERVICESVS!.add(new Null.fromJson(v)); | ||||
|     //   }); | ||||
|     // } | ||||
|     fLEXVALUESETNAME = json['FLEX_VALUE_SET_NAME']; | ||||
|     fORMATTYPE = json['FORMAT_TYPE']; | ||||
|     fORMATTYPEDSP = json['FORMAT_TYPE_DSP']; | ||||
|     lONGLISTFLAG = json['LONGLIST_FLAG']; | ||||
|     mAXIMUMSIZE = json['MAXIMUM_SIZE']; | ||||
|     mAXIMUMVALUE = json['MAXIMUM_VALUE']; | ||||
|     mINIMUMVALUE = json['MINIMUM_VALUE']; | ||||
|     mOBILEENABLED = json['MOBILE_ENABLED']; | ||||
|     nUMBERPRECISION = json['NUMBER_PRECISION']; | ||||
|     nUMERICMODEENABLEDFLAG = json['NUMERIC_MODE_ENABLED_FLAG']; | ||||
|     pARENTSEGMENTSDV = json['PARENT_SEGMENTS_DV']; | ||||
|     // if (json['PARENT_SEGMENTS_DV_Splited'] != null) { | ||||
|     //   pARENTSEGMENTSDVSplited = <Null>[]; | ||||
|     //   json['PARENT_SEGMENTS_DV_Splited'].forEach((v) { | ||||
|     //     pARENTSEGMENTSDVSplited!.add(new Null.fromJson(v)); | ||||
|     //   }); | ||||
|     // } | ||||
|     // pARENTSEGMENTSVS = json['PARENT_SEGMENTS_VS']; | ||||
|     // if (json['PARENT_SEGMENTS_VS_SplitedVS'] != null) { | ||||
|     //   pARENTSEGMENTSVSSplitedVS = <Null>[]; | ||||
|     //   json['PARENT_SEGMENTS_VS_SplitedVS'].forEach((v) { | ||||
|     //     pARENTSEGMENTSVSSplitedVS!.add(new Null.fromJson(v)); | ||||
|     //   }); | ||||
|     // } | ||||
|     rEADONLY = json['READ_ONLY']; | ||||
|     rEQUIREDFLAG = json['REQUIRED_FLAG']; | ||||
|     sEGMENTNAME = json['SEGMENT_NAME']; | ||||
|     sEGMENTPROMPT = json['SEGMENT_PROMPT']; | ||||
|     sEGMENTSEQNUM = json['SEGMENT_SEQ_NUM']; | ||||
|     uPPERCASEONLYFLAG = json['UPPERCASE_ONLY_FLAG']; | ||||
|     uSEDFLAG = json['USED_FLAG']; | ||||
|     vALIDATIONTYPE = json['VALIDATION_TYPE']; | ||||
|     vALIDATIONTYPEDSP = json['VALIDATION_TYPE_DSP']; | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     data['ALPHANUMERIC_ALLOWED_FLAG'] = this.aLPHANUMERICALLOWEDFLAG; | ||||
|     data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; | ||||
|     data['CHILD_SEGMENTS_DV'] = this.cHILDSEGMENTSDV; | ||||
|     data['CHILD_SEGMENTS_DV_Splited'] = this.cHILDSEGMENTSDVSplited; | ||||
|     data['CHILD_SEGMENTS_VS'] = this.cHILDSEGMENTSVS; | ||||
|     data['CHILD_SEGMENTS_VS_Splited'] = this.cHILDSEGMENTSVSSplited; | ||||
|     data['DEFAULT_TYPE'] = this.dEFAULTTYPE; | ||||
|     data['DEFAULT_VALUE'] = this.dEFAULTVALUE; | ||||
|     data['DESC_FLEX_CONTEXT_CODE'] = this.dESCFLEXCONTEXTCODE; | ||||
|     data['DESC_FLEX_CONTEXT_NAME'] = this.dESCFLEXCONTEXTNAME; | ||||
|     data['DESC_FLEX_NAME'] = this.dESCFLEXNAME; | ||||
|     data['DISPLAY_FLAG'] = this.dISPLAYFLAG; | ||||
|     data['ENABLED_FLAG'] = this.eNABLEDFLAG; | ||||
|     if (this.eSERVICESDV != null) { | ||||
|       data['E_SERVICES_DV'] = this.eSERVICESDV!.toJson(); | ||||
|     } | ||||
|     // if (this.eSERVICESVS != null) { | ||||
|     //   data['E_SERVICES_VS'] = this.eSERVICESVS!.map((v) => v.toJson()).toList(); | ||||
|     // } | ||||
|     data['FLEX_VALUE_SET_NAME'] = this.fLEXVALUESETNAME; | ||||
|     data['FORMAT_TYPE'] = this.fORMATTYPE; | ||||
|     data['FORMAT_TYPE_DSP'] = this.fORMATTYPEDSP; | ||||
|     data['LONGLIST_FLAG'] = this.lONGLISTFLAG; | ||||
|     data['MAXIMUM_SIZE'] = this.mAXIMUMSIZE; | ||||
|     data['MAXIMUM_VALUE'] = this.mAXIMUMVALUE; | ||||
|     data['MINIMUM_VALUE'] = this.mINIMUMVALUE; | ||||
|     data['MOBILE_ENABLED'] = this.mOBILEENABLED; | ||||
|     data['NUMBER_PRECISION'] = this.nUMBERPRECISION; | ||||
|     data['NUMERIC_MODE_ENABLED_FLAG'] = this.nUMERICMODEENABLEDFLAG; | ||||
|     data['PARENT_SEGMENTS_DV'] = this.pARENTSEGMENTSDV; | ||||
|     // if (this.pARENTSEGMENTSDVSplited != null) { | ||||
|     //   data['PARENT_SEGMENTS_DV_Splited'] = | ||||
|     //       this.pARENTSEGMENTSDVSplited!.map((v) => v.toJson()).toList(); | ||||
|     // } | ||||
|     data['PARENT_SEGMENTS_VS'] = this.pARENTSEGMENTSVS; | ||||
|     // if (this.pARENTSEGMENTSVSSplitedVS != null) { | ||||
|     //   data['PARENT_SEGMENTS_VS_SplitedVS'] = | ||||
|     //       this.pARENTSEGMENTSVSSplitedVS!.map((v) => v.toJson()).toList(); | ||||
|     // } | ||||
|     data['READ_ONLY'] = this.rEADONLY; | ||||
|     data['REQUIRED_FLAG'] = this.rEQUIREDFLAG; | ||||
|     data['SEGMENT_NAME'] = this.sEGMENTNAME; | ||||
|     data['SEGMENT_PROMPT'] = this.sEGMENTPROMPT; | ||||
|     data['SEGMENT_SEQ_NUM'] = this.sEGMENTSEQNUM; | ||||
|     data['UPPERCASE_ONLY_FLAG'] = this.uPPERCASEONLYFLAG; | ||||
|     data['USED_FLAG'] = this.uSEDFLAG; | ||||
|     data['VALIDATION_TYPE'] = this.vALIDATIONTYPE; | ||||
|     data['VALIDATION_TYPE_DSP'] = this.vALIDATIONTYPEDSP; | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| class ESERVICESDV { | ||||
|   String? pIDCOLUMNNAME; | ||||
|   String? pRETURNMSG; | ||||
|   String? pRETURNSTATUS; | ||||
|   String? pVALUECOLUMNNAME; | ||||
| 
 | ||||
|   ESERVICESDV( | ||||
|       {this.pIDCOLUMNNAME, | ||||
|         this.pRETURNMSG, | ||||
|         this.pRETURNSTATUS, | ||||
|         this.pVALUECOLUMNNAME}); | ||||
| 
 | ||||
|   ESERVICESDV.fromJson(Map<String, dynamic> json) { | ||||
|     pIDCOLUMNNAME = json['P_ID_COLUMN_NAME']; | ||||
|     pRETURNMSG = json['P_RETURN_MSG']; | ||||
|     pRETURNSTATUS = json['P_RETURN_STATUS']; | ||||
|     pVALUECOLUMNNAME = json['P_VALUE_COLUMN_NAME']; | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     data['P_ID_COLUMN_NAME'] = this.pIDCOLUMNNAME; | ||||
|     data['P_RETURN_MSG'] = this.pRETURNMSG; | ||||
|     data['P_RETURN_STATUS'] = this.pRETURNSTATUS; | ||||
|     data['P_VALUE_COLUMN_NAME'] = this.pVALUECOLUMNNAME; | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,21 @@ | ||||
| class GetCCPOutputModel { | ||||
|   String? pOUTPUTFILE; | ||||
|   String? pRETURNMSG; | ||||
|   String? pRETURNSTATUS; | ||||
| 
 | ||||
|   GetCCPOutputModel({this.pOUTPUTFILE, this.pRETURNMSG, this.pRETURNSTATUS}); | ||||
| 
 | ||||
|   GetCCPOutputModel.fromJson(Map<String, dynamic> json) { | ||||
|     pOUTPUTFILE = json['P_OUTPUT_FILE']; | ||||
|     pRETURNMSG = json['P_RETURN_MSG']; | ||||
|     pRETURNSTATUS = json['P_RETURN_STATUS']; | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     data['P_OUTPUT_FILE'] = this.pOUTPUTFILE; | ||||
|     data['P_RETURN_MSG'] = this.pRETURNMSG; | ||||
|     data['P_RETURN_STATUS'] = this.pRETURNSTATUS; | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,32 @@ | ||||
| class GetCCPTransactionsModel { | ||||
|   String? cCPPHASE; | ||||
|   String? cCPSTATUS; | ||||
|   String? cONCURRENTPROGRAMNAME; | ||||
|   String? rEQUESTDATE; | ||||
|   int? rEQUESTID; | ||||
| 
 | ||||
|   GetCCPTransactionsModel( | ||||
|       {this.cCPPHASE, | ||||
|         this.cCPSTATUS, | ||||
|         this.cONCURRENTPROGRAMNAME, | ||||
|         this.rEQUESTDATE, | ||||
|         this.rEQUESTID}); | ||||
| 
 | ||||
|   GetCCPTransactionsModel.fromJson(Map<String, dynamic> json) { | ||||
|     cCPPHASE = json['CCP_PHASE']; | ||||
|     cCPSTATUS = json['CCP_STATUS']; | ||||
|     cONCURRENTPROGRAMNAME = json['CONCURRENT_PROGRAM_NAME']; | ||||
|     rEQUESTDATE = json['REQUEST_DATE']; | ||||
|     rEQUESTID = json['REQUEST_ID']; | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     data['CCP_PHASE'] = this.cCPPHASE; | ||||
|     data['CCP_STATUS'] = this.cCPSTATUS; | ||||
|     data['CONCURRENT_PROGRAM_NAME'] = this.cONCURRENTPROGRAMNAME; | ||||
|     data['REQUEST_DATE'] = this.rEQUESTDATE; | ||||
|     data['REQUEST_ID'] = this.rEQUESTID; | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,24 @@ | ||||
| class GetConcurrentProgramsModel { | ||||
|   int? cONCURRENTPROGRAMID; | ||||
|   String? cONCURRENTPROGRAMNAME; | ||||
|   String? uSERCONCURRENTPROGRAMNAME; | ||||
| 
 | ||||
|   GetConcurrentProgramsModel( | ||||
|       {this.cONCURRENTPROGRAMID, | ||||
|         this.cONCURRENTPROGRAMNAME, | ||||
|         this.uSERCONCURRENTPROGRAMNAME}); | ||||
| 
 | ||||
|   GetConcurrentProgramsModel.fromJson(Map<String, dynamic> json) { | ||||
|     cONCURRENTPROGRAMID = json['CONCURRENT_PROGRAM_ID']; | ||||
|     cONCURRENTPROGRAMNAME = json['CONCURRENT_PROGRAM_NAME']; | ||||
|     uSERCONCURRENTPROGRAMNAME = json['USER_CONCURRENT_PROGRAM_NAME']; | ||||
|   } | ||||
| 
 | ||||
|   Map<String, dynamic> toJson() { | ||||
|     final Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
|     data['CONCURRENT_PROGRAM_ID'] = this.cONCURRENTPROGRAMID; | ||||
|     data['CONCURRENT_PROGRAM_NAME'] = this.cONCURRENTPROGRAMNAME; | ||||
|     data['USER_CONCURRENT_PROGRAM_NAME'] = this.uSERCONCURRENTPROGRAMNAME; | ||||
|     return data; | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,218 @@ | ||||
| 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_requests_api_client.dart'; | ||||
| import 'package:mohem_flutter_app/classes/colors.dart'; | ||||
| import 'package:mohem_flutter_app/classes/date_uitl.dart'; | ||||
| import 'package:mohem_flutter_app/classes/file_process.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/get_eit_dff_structure_list_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_concurrent_programs_model.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/button/default_button.dart'; | ||||
| import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; | ||||
| 
 | ||||
| class MyRequests extends StatefulWidget { | ||||
|   const MyRequests({Key? key}) : super(key: key); | ||||
| 
 | ||||
|   @override | ||||
|   _MyRequestsState createState() => _MyRequestsState(); | ||||
| } | ||||
| 
 | ||||
| class _MyRequestsState extends State<MyRequests> { | ||||
|   List<GetConcurrentProgramsModel> getConcurrentProgramsList = []; | ||||
|   GetConcurrentProgramsModel? selectedConcurrentProgramList; | ||||
| 
 | ||||
|   List<GetCCPTransactionsModel> getCCPTransactionsList = []; | ||||
| 
 | ||||
|   bool isNewRequest = false; | ||||
| 
 | ||||
|   @override | ||||
|   void initState() { | ||||
|     getConcurrentPrograms(); | ||||
|     super.initState(); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Scaffold( | ||||
|         backgroundColor: Colors.white, | ||||
|         appBar: AppBarWidget( | ||||
|           context, | ||||
|           title: "Concurrent Reports", | ||||
|         ), | ||||
|         body: Container( | ||||
|           width: double.infinity, | ||||
|           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( | ||||
|             children: [ | ||||
|               12.height, | ||||
|               Container( | ||||
|                 padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 0), | ||||
|                 margin: const EdgeInsets.only(left: 12, right: 12, top: 0, bottom: 0), | ||||
|                 child: PopupMenuButton( | ||||
|                     child: DynamicTextFieldWidget( | ||||
|                       "Template Name", | ||||
|                       selectedConcurrentProgramList?.uSERCONCURRENTPROGRAMNAME ?? "", | ||||
|                       isEnable: false, | ||||
|                       isPopup: true, | ||||
|                       isInputTypeNum: true, | ||||
|                       isReadOnly: false, | ||||
|                     ).paddingOnly(bottom: 12), | ||||
|                     itemBuilder: (_) => <PopupMenuItem<int>>[ | ||||
|                           for (int i = 0; i < getConcurrentProgramsList!.length; i++) PopupMenuItem<int>(child: Text(getConcurrentProgramsList![i].uSERCONCURRENTPROGRAMNAME!), value: i), | ||||
|                         ], | ||||
|                     onSelected: (int popupIndex) { | ||||
|                       selectedConcurrentProgramList = getConcurrentProgramsList![popupIndex]; | ||||
|                       getCCPTransactions(selectedConcurrentProgramList?.cONCURRENTPROGRAMNAME); | ||||
|                       setState(() {}); | ||||
|                     }), | ||||
|               ), | ||||
|               12.height, | ||||
|               Expanded( | ||||
|                   child: ListView.separated( | ||||
|                       physics: const BouncingScrollPhysics(), | ||||
|                       shrinkWrap: true, | ||||
|                       itemBuilder: (BuildContext context, int index) { | ||||
|                         return Container( | ||||
|                           width: double.infinity, | ||||
|                           padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 12), | ||||
|                           margin: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 0), | ||||
|                           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: [ | ||||
|                                   ("Request ID: " + getCCPTransactionsList[index].rEQUESTID.toString()).toText12(color: MyColors.grey57Color), | ||||
|                                   DateUtil.formatDateToDate(DateUtil.convertStringToDate(getCCPTransactionsList[index].rEQUESTDATE!), false).toText12(color: MyColors.grey70Color), | ||||
|                                 ], | ||||
|                               ), | ||||
|                               Container( | ||||
|                                 padding: const EdgeInsets.only(top: 10.0), | ||||
|                                 child: ("Phase: " + getCCPTransactionsList[index].cCPPHASE!).toText12(color: MyColors.grey57Color, isBold: true), | ||||
|                               ), | ||||
|                               Container( | ||||
|                                 padding: const EdgeInsets.only(top: 10.0), | ||||
|                                 child: "Program Name: ".toText12(color: MyColors.grey57Color, isBold: true), | ||||
|                               ), | ||||
|                               getCCPTransactionsList[index].cONCURRENTPROGRAMNAME!.toText12(color: MyColors.gradiantEndColor), | ||||
|                               Container( | ||||
|                                 padding: const EdgeInsets.only(top: 10.0), | ||||
|                                 child: InkWell( | ||||
|                                   onTap: () { | ||||
|                                     getCCPOutput(getCCPTransactionsList[index].rEQUESTID.toString()); | ||||
|                                   }, | ||||
|                                   child: Row( | ||||
|                                     children: [ | ||||
|                                       "Output: ".toText12(color: MyColors.grey57Color), | ||||
|                                       8.width, | ||||
|                                       "Open PDF".toText12(color: MyColors.grey57Color), | ||||
|                                       6.width, | ||||
|                                       const Icon(Icons.launch, size: 16.0), | ||||
|                                     ], | ||||
|                                   ), | ||||
|                                 ), | ||||
|                               ), | ||||
|                             ], | ||||
|                           ), | ||||
|                         ); | ||||
|                       }, | ||||
|                       separatorBuilder: (BuildContext context, int index) => 12.height, | ||||
|                       itemCount: getCCPTransactionsList.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 { | ||||
|             openNewRequest(); | ||||
|           }).insideContainer, | ||||
|         )); | ||||
|   } | ||||
| 
 | ||||
|   void openNewRequest() async { | ||||
|     await Navigator.pushNamed(context, AppRoutes.newRequest).then((value) { | ||||
|       // getOpenTickets(); | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   void getConcurrentPrograms() async { | ||||
|     try { | ||||
|       Utils.showLoading(context); | ||||
|       getConcurrentProgramsList = await MyRequestsApiClient().getConcurrentPrograms(); | ||||
|       Utils.hideLoading(context); | ||||
|       setState(() {}); | ||||
|     } catch (ex) { | ||||
|       Utils.hideLoading(context); | ||||
|       Utils.handleException(ex, context, null); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   void getCCPTransactions(String? templateName) async { | ||||
|     try { | ||||
|       Utils.showLoading(context); | ||||
|       getCCPTransactionsList = await MyRequestsApiClient().getCCPTransactions(templateName); | ||||
|       Utils.hideLoading(context); | ||||
|       setState(() {}); | ||||
|     } catch (ex) { | ||||
|       Utils.hideLoading(context); | ||||
|       Utils.handleException(ex, context, null); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   void getCCPOutput(String requestID) async { | ||||
|     GetCCPOutputModel getCCPOutputModel; | ||||
|     try { | ||||
|       Utils.showLoading(context); | ||||
|       getCCPOutputModel = await MyRequestsApiClient().getCCPOutput(requestID); | ||||
|       Utils.hideLoading(context); | ||||
|       await FileProcess.downloadFile(getCCPOutputModel.pOUTPUTFILE!, requestID).then((value) { | ||||
|         File file = value; | ||||
|         debugPrint(file.toString()); | ||||
|         FileProcess.openFile(requestID); | ||||
|       }); | ||||
|       setState(() {}); | ||||
|     } catch (ex) { | ||||
|       Utils.hideLoading(context); | ||||
|       Utils.handleException(ex, context, null); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,423 @@ | ||||
| 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_requests_api_client.dart'; | ||||
| import 'package:mohem_flutter_app/classes/colors.dart'; | ||||
| import 'package:mohem_flutter_app/classes/utils.dart'; | ||||
| import 'package:mohem_flutter_app/extensions/int_extensions.dart'; | ||||
| import 'package:mohem_flutter_app/extensions/string_extensions.dart'; | ||||
| import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; | ||||
| import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; | ||||
| import 'package:mohem_flutter_app/models/get_eit_dff_structure_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'; | ||||
| import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; | ||||
| 
 | ||||
| class NewRequest extends StatefulWidget { | ||||
|   const NewRequest({Key? key}) : super(key: key); | ||||
| 
 | ||||
|   @override | ||||
|   _NewRequestState createState() => _NewRequestState(); | ||||
| } | ||||
| 
 | ||||
| class _NewRequestState extends State<NewRequest> { | ||||
|   List<GetConcurrentProgramsModel> getConcurrentProgramsList = []; | ||||
|   GetConcurrentProgramsModel? selectedConcurrentProgramList; | ||||
| 
 | ||||
|   List<GetEITDFFStructureList> getCCPDFFStructureModelList = []; | ||||
| 
 | ||||
|   DateTime selectedDate = DateTime.now(); | ||||
| 
 | ||||
|   @override | ||||
|   void initState() { | ||||
|     getConcurrentPrograms(); | ||||
|     super.initState(); | ||||
|   } | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return Scaffold( | ||||
|       backgroundColor: Colors.white, | ||||
|       appBar: AppBarWidget( | ||||
|         context, | ||||
|         title: "Concurrent Reports", | ||||
|       ), | ||||
|       body: Container( | ||||
|         child: Column( | ||||
|           children: [ | ||||
|             12.height, | ||||
|             Container( | ||||
|               padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 0), | ||||
|               margin: const EdgeInsets.only(left: 12, right: 12, top: 0, bottom: 0), | ||||
|               child: PopupMenuButton( | ||||
|                   child: DynamicTextFieldWidget( | ||||
|                     "Template Name", | ||||
|                     selectedConcurrentProgramList?.uSERCONCURRENTPROGRAMNAME ?? "", | ||||
|                     isEnable: false, | ||||
|                     isPopup: true, | ||||
|                     isInputTypeNum: true, | ||||
|                     isReadOnly: false, | ||||
|                   ).paddingOnly(bottom: 12), | ||||
|                   itemBuilder: (_) => <PopupMenuItem<int>>[ | ||||
|                         for (int i = 0; i < getConcurrentProgramsList!.length; i++) PopupMenuItem<int>(child: Text(getConcurrentProgramsList![i].uSERCONCURRENTPROGRAMNAME!), value: i), | ||||
|                       ], | ||||
|                   onSelected: (int popupIndex) { | ||||
|                     selectedConcurrentProgramList = getConcurrentProgramsList![popupIndex]; | ||||
|                     getCCPDFFStructure(selectedConcurrentProgramList?.cONCURRENTPROGRAMNAME); | ||||
|                     setState(() {}); | ||||
|                   }), | ||||
|             ), | ||||
|             (getCCPDFFStructureModelList.isEmpty | ||||
|                     ? LocaleKeys.noDataAvailable.tr().toText16().center | ||||
|                     : ListView.separated( | ||||
|                         physics: const BouncingScrollPhysics(), | ||||
|                         padding: const EdgeInsets.all(21), | ||||
|                         itemBuilder: (cxt, int parentIndex) => parseDynamicFormatType(getCCPDFFStructureModelList[parentIndex], parentIndex), | ||||
|                         separatorBuilder: (cxt, index) => 0.height, | ||||
|                         itemCount: getCCPDFFStructureModelList.length)) | ||||
|                 .expanded | ||||
|           ], | ||||
|         ), | ||||
|       ), | ||||
|         bottomSheet: Container( | ||||
|           decoration: const BoxDecoration( | ||||
|             color: MyColors.white, | ||||
|             boxShadow: [ | ||||
|               BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), | ||||
|             ], | ||||
|           ), | ||||
|           child: DefaultButton(LocaleKeys.submit.tr(), () async { | ||||
|             // openNewRequest(); | ||||
|           }).insideContainer, | ||||
|         ) | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   void getConcurrentPrograms() async { | ||||
|     try { | ||||
|       Utils.showLoading(context); | ||||
|       getConcurrentProgramsList = await MyRequestsApiClient().getConcurrentPrograms(); | ||||
|       Utils.hideLoading(context); | ||||
|       setState(() {}); | ||||
|     } catch (ex) { | ||||
|       Utils.hideLoading(context); | ||||
|       Utils.handleException(ex, context, null); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   void getCCPDFFStructure(String? templateName) async { | ||||
|     try { | ||||
|       Utils.showLoading(context); | ||||
|       getCCPDFFStructureModelList = await MyRequestsApiClient().getCCPDFFStructure(templateName); | ||||
|       Utils.hideLoading(context); | ||||
|       setState(() {}); | ||||
|     } catch (ex) { | ||||
|       Utils.hideLoading(context); | ||||
|       Utils.handleException(ex, context, null); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   Widget parseDynamicFormatType(GetEITDFFStructureList model, int index) { | ||||
|     if (model.dISPLAYFLAG != "N") { | ||||
|       if (model.vALIDATIONTYPE == "N") { | ||||
|         if (model.fORMATTYPE == "C") { | ||||
|           return DynamicTextFieldWidget( | ||||
|             (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), | ||||
|             model.eSERVICESDV?.pIDCOLUMNNAME ?? "", | ||||
|             isReadOnly: model.rEADONLY == "Y", | ||||
|             onChange: (text) { | ||||
|               model.fieldAnswer = text; | ||||
|               if (model.eSERVICESDV == null) { | ||||
|                 model.eSERVICESDV = ESERVICESDV(); | ||||
|               } | ||||
|               model.eSERVICESDV!.pIDCOLUMNNAME = text; | ||||
|             }, | ||||
|           ).paddingOnly(bottom: 12); | ||||
|         } else if (model.fORMATTYPE == "N") { | ||||
|           return DynamicTextFieldWidget( | ||||
|             (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), | ||||
|             model.eSERVICESDV?.pIDCOLUMNNAME ?? "", | ||||
|             isReadOnly: model.rEADONLY == "Y", | ||||
|             isInputTypeNum: true, | ||||
|             onChange: (text) { | ||||
|               model.fieldAnswer = text; | ||||
|               if (model.eSERVICESDV == null) { | ||||
|                 model.eSERVICESDV = ESERVICESDV(); | ||||
|               } | ||||
|               model.eSERVICESDV!.pIDCOLUMNNAME = text; | ||||
|             }, | ||||
|           ).paddingOnly(bottom: 12); | ||||
|         } else if (model.fORMATTYPE == "X") { | ||||
|           String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? (getCCPDFFStructureModelList![index].fieldAnswer ?? ""); | ||||
|           if (getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS) { | ||||
|             if (displayText.contains(" 00:00:00")) { | ||||
|               displayText = displayText.replaceAll(" 00:00:00", ""); | ||||
|             } | ||||
|             if (!displayText.contains("-")) { | ||||
|               displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText)); | ||||
|             } | ||||
|           } | ||||
|           return DynamicTextFieldWidget( | ||||
|             (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), | ||||
|             displayText, | ||||
|             suffixIconData: Icons.calendar_today, | ||||
|             isEnable: false, | ||||
|             onTap: () async { | ||||
|               if ((getCCPDFFStructureModelList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { | ||||
|                 if (getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS) { | ||||
|                   selectedDate = DateFormat("yyyy/MM/dd").parse(getCCPDFFStructureModelList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", "")); | ||||
|                 } else { | ||||
|                   selectedDate = DateTime.parse(getCCPDFFStructureModelList![index].eSERVICESDV!.pVALUECOLUMNNAME!); | ||||
|                 } | ||||
|               } | ||||
|               DateTime date = await _selectDate(context); | ||||
|               DateTime date1 = DateTime(date.year, date.month, date.day); | ||||
|               // getEitDffStructureList![index].fieldAnswer = date.toString(); | ||||
|               ESERVICESDV eservicesdv; | ||||
|               if (getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS) { | ||||
|                 eservicesdv = ESERVICESDV( | ||||
|                     pIDCOLUMNNAME: DateFormat('yyyy/MM/dd HH:MM:SS').format(date1), | ||||
|                     pRETURNMSG: "null", | ||||
|                     pRETURNSTATUS: getCCPDFFStructureModelList![index].dEFAULTVALUE, | ||||
|                     pVALUECOLUMNNAME: getCCPDFFStructureModelList![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: getCCPDFFStructureModelList![index].dEFAULTVALUE, | ||||
|                     pVALUECOLUMNNAME: getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS ? DateFormat('yyyy-MM-dd hh:mm:ss').format(date) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); | ||||
|               } | ||||
|               getCCPDFFStructureModelList![index].eSERVICESDV = eservicesdv; | ||||
|               setState(() {}); | ||||
|               if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { | ||||
|                 // calGetValueSetValues(model); | ||||
|               } | ||||
|             }, | ||||
|           ).paddingOnly(bottom: 12); | ||||
|         } else if (model.fORMATTYPE == "Y") { | ||||
|           String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? (getCCPDFFStructureModelList![index].fieldAnswer ?? ""); | ||||
|           if (getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS) { | ||||
|             if (displayText.contains(" 00:00:00")) { | ||||
|               displayText = displayText.replaceAll(" 00:00:00", ""); | ||||
|             } | ||||
|             if (!displayText.contains("-")) { | ||||
|               displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText)); | ||||
|             } | ||||
|           } | ||||
|           return DynamicTextFieldWidget( | ||||
|             (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), | ||||
|             displayText, | ||||
|             suffixIconData: Icons.calendar_today, | ||||
|             isEnable: false, | ||||
|             onTap: () async { | ||||
|               if ((getCCPDFFStructureModelList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { | ||||
|                 if (getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS) { | ||||
|                   String tempDate = getCCPDFFStructureModelList![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(getCCPDFFStructureModelList![index].eSERVICESDV!.pVALUECOLUMNNAME!); | ||||
|                 } | ||||
|               } | ||||
|               DateTime date = await _selectDate(context); | ||||
|               DateTime date1 = DateTime(date.year, date.month, date.day); | ||||
|               // getEitDffStructureList![index].fieldAnswer = date.toString(); | ||||
|               ESERVICESDV eservicesdv; | ||||
|               if (getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS) { | ||||
|                 eservicesdv = ESERVICESDV( | ||||
|                     pIDCOLUMNNAME: DateFormat('yyyy/MM/dd HH:MM:SS').format(date1), | ||||
|                     pRETURNMSG: "null", | ||||
|                     pRETURNSTATUS: getCCPDFFStructureModelList![index].dEFAULTVALUE, | ||||
|                     pVALUECOLUMNNAME: getCCPDFFStructureModelList![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: getCCPDFFStructureModelList![index].dEFAULTVALUE, | ||||
|                     pVALUECOLUMNNAME: getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS ? DateFormat('yyyy-MM-dd hh:mm:ss').format(date) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); | ||||
|               } | ||||
| 
 | ||||
|               getCCPDFFStructureModelList![index].eSERVICESDV = eservicesdv; | ||||
|               setState(() {}); | ||||
|               if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { | ||||
|                 if (getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS) { | ||||
|                   // calGetValueSetValues(model); | ||||
|                 } else {} | ||||
|               } | ||||
|             }, | ||||
|           ).paddingOnly(bottom: 12); | ||||
|         } | ||||
|       } else { | ||||
|         return PopupMenuButton( | ||||
|             child: DynamicTextFieldWidget( | ||||
|               (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), | ||||
|               model.eSERVICESDV?.pVALUECOLUMNNAME ?? "", | ||||
|               isEnable: false, | ||||
|               isPopup: true, | ||||
|               isInputTypeNum: true, | ||||
|               isReadOnly: model.rEADONLY == "Y", | ||||
|             ).paddingOnly(bottom: 12), | ||||
|             itemBuilder: (_) => <PopupMenuItem<int>>[ | ||||
|                   for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem<int>(child: Text(model.eSERVICESVS![i].vALUECOLUMNNAME!), value: i), | ||||
|                 ], | ||||
|             onSelected: (int popipIndex) { | ||||
|               ESERVICESDV eservicesdv = ESERVICESDV( | ||||
|                   pIDCOLUMNNAME: model.eSERVICESVS![popipIndex].iDCOLUMNNAME, | ||||
|                   pRETURNMSG: "null", | ||||
|                   pRETURNSTATUS: getCCPDFFStructureModelList![popipIndex].dEFAULTVALUE, | ||||
|                   pVALUECOLUMNNAME: model.eSERVICESVS![popipIndex].vALUECOLUMNNAME); | ||||
|               getCCPDFFStructureModelList![index].eSERVICESDV = eservicesdv; | ||||
|               setState(() {}); | ||||
|               if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { | ||||
|                 // getDefaultValues(model); | ||||
|               } | ||||
|             }); | ||||
|       } | ||||
|     } else { | ||||
|       return const SizedBox(); | ||||
|     } | ||||
|     if (model.fORMATTYPE == "N") { | ||||
|       if (model.eSERVICESVS?.isNotEmpty ?? false) { | ||||
|         return PopupMenuButton( | ||||
|             child: DynamicTextFieldWidget( | ||||
|               (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), | ||||
|               model.eSERVICESDV?.pVALUECOLUMNNAME ?? "", | ||||
|               isEnable: false, | ||||
|               isPopup: true, | ||||
|               isInputTypeNum: true, | ||||
|               isReadOnly: model.rEADONLY == "Y", | ||||
|             ).paddingOnly(bottom: 12), | ||||
|             itemBuilder: (_) => <PopupMenuItem<int>>[ | ||||
|                   for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem<int>(child: Text(model.eSERVICESVS![i].vALUECOLUMNNAME!), value: i), | ||||
|                 ], | ||||
|             onSelected: (int popipIndex) { | ||||
|               ESERVICESDV eservicesdv = ESERVICESDV( | ||||
|                   pIDCOLUMNNAME: model.eSERVICESVS![popipIndex].iDCOLUMNNAME, | ||||
|                   pRETURNMSG: "null", | ||||
|                   pRETURNSTATUS: getCCPDFFStructureModelList![popipIndex].dEFAULTVALUE, | ||||
|                   pVALUECOLUMNNAME: model.eSERVICESVS![popipIndex].vALUECOLUMNNAME); | ||||
|               getCCPDFFStructureModelList![index].eSERVICESDV = eservicesdv; | ||||
|               setState(() {}); | ||||
|               if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { | ||||
|                 // getDefaultValues(model); | ||||
|               } | ||||
|             }); | ||||
|       } | ||||
| 
 | ||||
|       return DynamicTextFieldWidget( | ||||
|         (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), | ||||
|         model.eSERVICESDV?.pIDCOLUMNNAME ?? "", | ||||
|         isReadOnly: model.rEADONLY == "Y", | ||||
|         onChange: (text) { | ||||
|           model.fieldAnswer = text; | ||||
|         }, | ||||
|       ).paddingOnly(bottom: 12); | ||||
|     } else if (model.fORMATTYPE == "X" || model.fORMATTYPE == "Y") { | ||||
|       String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? (getCCPDFFStructureModelList![index].fieldAnswer ?? ""); | ||||
|       if (getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS) { | ||||
|         if (displayText.contains(" 00:00:00")) { | ||||
|           displayText = displayText.replaceAll(" 00:00:00", ""); | ||||
|         } | ||||
|         if (!displayText.contains("-")) { | ||||
|           displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText)); | ||||
|         } | ||||
|       } | ||||
|       return DynamicTextFieldWidget( | ||||
|         (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), | ||||
|         displayText, | ||||
|         suffixIconData: Icons.calendar_today, | ||||
|         isEnable: false, | ||||
|         onTap: () async { | ||||
|           if ((getCCPDFFStructureModelList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { | ||||
|             if (getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS) { | ||||
|               selectedDate = DateFormat("yyyy/MM/dd").parse(getCCPDFFStructureModelList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", "")); | ||||
|             } else { | ||||
|               selectedDate = DateTime.parse(getCCPDFFStructureModelList![index].eSERVICESDV!.pVALUECOLUMNNAME!); | ||||
|             } | ||||
|           } | ||||
|           DateTime date = await _selectDate(context); | ||||
|           DateTime date1 = DateTime(date.year, date.month, date.day); | ||||
|           getCCPDFFStructureModelList![index].fieldAnswer = date.toString(); | ||||
|           ESERVICESDV eservicesdv = ESERVICESDV( | ||||
|               pIDCOLUMNNAME: DateFormat('yyyy-MM-dd').format(date1), | ||||
|               pRETURNMSG: "null", | ||||
|               pRETURNSTATUS: getCCPDFFStructureModelList![index].dEFAULTVALUE, | ||||
|               pVALUECOLUMNNAME: getCCPDFFStructureModelList![index].isDefaultTypeIsCDPS ? DateFormat('yyyy-MM-dd hh:mm:ss').format(date) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); | ||||
|           getCCPDFFStructureModelList![index].eSERVICESDV = eservicesdv; | ||||
|           setState(() {}); | ||||
|           if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { | ||||
|             // calGetValueSetValues(model); | ||||
|           } | ||||
|         }, | ||||
|       ).paddingOnly(bottom: 12); | ||||
|     } else if (model.fORMATTYPE == "I") { | ||||
|       return DynamicTextFieldWidget( | ||||
|         (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), | ||||
|         model.eSERVICESDV?.pIDCOLUMNNAME ?? (getCCPDFFStructureModelList![index].fieldAnswer ?? ""), | ||||
|         suffixIconData: Icons.access_time_filled_rounded, | ||||
|         isEnable: false, | ||||
|         onTap: () async { | ||||
|           if ((getCCPDFFStructureModelList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { | ||||
|             var timeString = getCCPDFFStructureModelList![index].eSERVICESDV!.pVALUECOLUMNNAME!.split(":"); | ||||
|             selectedDate = DateTime(0, 0, 0, int.parse(timeString[0]), int.parse(timeString[1])); | ||||
| 
 | ||||
|             //DateTime.parse(getEitDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!); | ||||
|           } | ||||
|           // TimeOfDay _time = await _selectTime(context); | ||||
|           // DateTime tempTime = DateTime(0, 1, 1, _time.hour, _time.minute); | ||||
|           // String time = DateFormat('HH:mm').format(tempTime).trim(); | ||||
| 
 | ||||
|           // DateTime date1 = DateTime(date.year, date.month, date.day); | ||||
|           //  getEitDffStructureList![index].fieldAnswer = date.toString(); | ||||
|           // ESERVICESDV eservicesdv = ESERVICESDV(pIDCOLUMNNAME: time, pRETURNMSG: "null", pRETURNSTATUS: getEitDffStructureList![index].dEFAULTVALUE, pVALUECOLUMNNAME: time); | ||||
|           // getCCPDFFStructureModelList![index].eSERVICESDV = eservicesdv; | ||||
|           setState(() {}); | ||||
|           if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { | ||||
|             // getCCPDFFStructureModelList(model); | ||||
|           } | ||||
|         }, | ||||
|       ).paddingOnly(bottom: 12); | ||||
|     } | ||||
| 
 | ||||
|     return Column( | ||||
|       crossAxisAlignment: CrossAxisAlignment.start, | ||||
|       mainAxisSize: MainAxisSize.min, | ||||
|       children: [], | ||||
|     ).objectContainerView(); | ||||
|   } | ||||
| 
 | ||||
|   Future<DateTime> _selectDate(BuildContext context) async { | ||||
|     DateTime time = selectedDate; | ||||
|     if (Platform.isIOS) { | ||||
|       await showCupertinoModalPopup( | ||||
|         context: context, | ||||
|         builder: (cxt) => Container( | ||||
|           height: 250, | ||||
|           color: Colors.white, | ||||
|           child: CupertinoDatePicker( | ||||
|             backgroundColor: Colors.white, | ||||
|             mode: CupertinoDatePickerMode.date, | ||||
|             onDateTimeChanged: (value) { | ||||
|               if (value != null && value != selectedDate) { | ||||
|                 time = value; | ||||
|               } | ||||
|             }, | ||||
|             initialDateTime: selectedDate, | ||||
|           ), | ||||
|         ), | ||||
|       ); | ||||
|     } else { | ||||
|       final DateTime? picked = | ||||
|           await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); | ||||
|       if (picked != null && picked != selectedDate) { | ||||
|         time = picked; | ||||
|       } | ||||
|     } | ||||
|     return time; | ||||
|   } | ||||
| } | ||||
					Loading…
					
					
				
		Reference in New Issue