From 41a1ba125ef5221e049e58326eaaa4be6fcff141 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 29 Aug 2022 16:24:25 +0300 Subject: [PATCH] code improvements. --- lib/models/get_user_item_type_list.dart | 2 +- .../get_absence_dff_structure_list_model.dart | 2 +- .../get_attendance_tracking_list_model.dart | 2 +- .../get_employee_subordinates_list.dart | 153 +++++---- lib/models/update_item_type_success_list.dart | 2 +- lib/models/update_user_item_type_list.dart | 2 +- .../worklist/update_user_type_list.dart | 8 +- .../add_leave_balance_screen.dart | 298 +++++++++++++++++- lib/ui/my_team/view_attendance.dart | 4 +- lib/ui/profile/basic_details.dart | 80 +++-- lib/ui/profile/contact_details.dart | 168 ++++------ 11 files changed, 478 insertions(+), 243 deletions(-) diff --git a/lib/models/get_user_item_type_list.dart b/lib/models/get_user_item_type_list.dart index a197c2e..b21748e 100644 --- a/lib/models/get_user_item_type_list.dart +++ b/lib/models/get_user_item_type_list.dart @@ -25,7 +25,7 @@ class GetUserItemTypesList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['FYA_ENABLED_FALG'] = this.fYAENABLEDFALG; data['FYI_ENABLED_FLAG'] = this.fYIENABLEDFLAG; data['ITEM_TYPE'] = this.iTEMTYPE; diff --git a/lib/models/leave_balance/get_absence_dff_structure_list_model.dart b/lib/models/leave_balance/get_absence_dff_structure_list_model.dart index a7d04bb..3619311 100644 --- a/lib/models/leave_balance/get_absence_dff_structure_list_model.dart +++ b/lib/models/leave_balance/get_absence_dff_structure_list_model.dart @@ -88,7 +88,7 @@ class GetAbsenceDffStructureList { cHILDSEGMENTSDV = json['CHILD_SEGMENTS_DV']; cHILDSEGMENTSDVSplited = json['CHILD_SEGMENTS_DV_Splited'] == null ? [] : json['CHILD_SEGMENTS_DV_Splited'].cast(); cHILDSEGMENTSVS = json['CHILD_SEGMENTS_VS']; - cHILDSEGMENTSVSSplited = json['CHILD_SEGMENTS_VS_Splited'].cast(); + cHILDSEGMENTSVSSplited = json['CHILD_SEGMENTS_VS_Splited']== null ? [] : json['CHILD_SEGMENTS_VS_Splited'].cast(); dEFAULTTYPE = json['DEFAULT_TYPE']; dEFAULTVALUE = json['DEFAULT_VALUE']; dESCFLEXCONTEXTCODE = json['DESC_FLEX_CONTEXT_CODE']; diff --git a/lib/models/my_team/get_attendance_tracking_list_model.dart b/lib/models/my_team/get_attendance_tracking_list_model.dart index 7670702..10d9d52 100644 --- a/lib/models/my_team/get_attendance_tracking_list_model.dart +++ b/lib/models/my_team/get_attendance_tracking_list_model.dart @@ -41,7 +41,7 @@ class GetAttendanceTrackingList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_BREAK_HOURS'] = this.pBREAKHOURS; data['P_LATE_IN_HOURS'] = this.pLATEINHOURS; data['P_REMAINING_HOURS'] = this.pREMAININGHOURS; diff --git a/lib/models/my_team/get_employee_subordinates_list.dart b/lib/models/my_team/get_employee_subordinates_list.dart index b90034b..e0178eb 100644 --- a/lib/models/my_team/get_employee_subordinates_list.dart +++ b/lib/models/my_team/get_employee_subordinates_list.dart @@ -1,4 +1,3 @@ - class GetEmployeeSubordinatesList { String? aCTUALTERMINATIONDATE; String? aSSIGNMENTENDDATE; @@ -78,80 +77,80 @@ class GetEmployeeSubordinatesList { GetEmployeeSubordinatesList( {this.aCTUALTERMINATIONDATE, - this.aSSIGNMENTENDDATE, - this.aSSIGNMENTID, - this.aSSIGNMENTNUMBER, - this.aSSIGNMENTSTARTDATE, - this.aSSIGNMENTSTATUSTYPEID, - this.aSSIGNMENTTYPE, - this.bUSINESSGROUPID, - this.bUSINESSGROUPNAME, - this.cURRENTEMPLOYEEFLAG, - this.eMPLOYEEDISPLAYNAME, - this.eMPLOYEEEMAILADDRESS, - this.eMPLOYEEIMAGE, - this.eMPLOYEEMOBILENUMBER, - this.eMPLOYEENAME, - this.eMPLOYEENUMBER, - this.eMPLOYEEWORKNUMBER, - this.eMPLOYMENTCATEGORY, - this.eMPLOYMENTCATEGORYMEANING, - this.fREQUENCY, - this.fREQUENCYMEANING, - this.fROMROWNUM, - this.gRADEID, - this.gRADENAME, - this.genderCode, - this.genderMeaning, - this.hIREDATE, - this.isFavorite, - this.jOBID, - this.jOBNAME, - this.lOCATIONID, - this.lOCATIONNAME, - this.mANUALTIMECARDFLAG, - this.mANUALTIMECARDMEANING, - this.nATIONALITYCODE, - this.nATIONALITYMEANING, - this.nATIONALIDENTIFIER, - this.nORMALHOURS, - this.nOOFROWS, - this.nUMOFSUBORDINATES, - this.oRGANIZATIONID, - this.oRGANIZATIONNAME, - this.pAYROLLCODE, - this.pAYROLLID, - this.pAYROLLNAME, - this.pERSONID, - this.pERSONTYPE, - this.pERSONTYPEID, - this.pERINFORMATIONCATEGORY, - this.pOSITIONID, - this.pOSITIONNAME, - this.pRIMARYFLAG, - this.rOWNUM, - this.sERVICEDAYS, - this.sERVICEMONTHS, - this.sERVICEYEARS, - this.sUPERVISORASSIGNMENTID, - this.sUPERVISORDISPLAYNAME, - this.sUPERVISOREMAILADDRESS, - this.sUPERVISORID, - this.sUPERVISORMOBILENUMBER, - this.sUPERVISORNAME, - this.sUPERVISORNUMBER, - this.sUPERVISORWORKNUMBER, - this.sWIPESEXEMPTEDFLAG, - this.sWIPESEXEMPTEDMEANING, - this.sYSTEMPERSONTYPE, - this.tKEMAILADDRESS, - this.tKEMPLOYEEDISPLAYNAME, - this.tKEMPLOYEENAME, - this.tKEMPLOYEENUMBER, - this.tKPERSONID, - this.tOROWNUM, - this.uNITNUMBER, - this.uSERSTATUS}); + this.aSSIGNMENTENDDATE, + this.aSSIGNMENTID, + this.aSSIGNMENTNUMBER, + this.aSSIGNMENTSTARTDATE, + this.aSSIGNMENTSTATUSTYPEID, + this.aSSIGNMENTTYPE, + this.bUSINESSGROUPID, + this.bUSINESSGROUPNAME, + this.cURRENTEMPLOYEEFLAG, + this.eMPLOYEEDISPLAYNAME, + this.eMPLOYEEEMAILADDRESS, + this.eMPLOYEEIMAGE, + this.eMPLOYEEMOBILENUMBER, + this.eMPLOYEENAME, + this.eMPLOYEENUMBER, + this.eMPLOYEEWORKNUMBER, + this.eMPLOYMENTCATEGORY, + this.eMPLOYMENTCATEGORYMEANING, + this.fREQUENCY, + this.fREQUENCYMEANING, + this.fROMROWNUM, + this.gRADEID, + this.gRADENAME, + this.genderCode, + this.genderMeaning, + this.hIREDATE, + this.isFavorite, + this.jOBID, + this.jOBNAME, + this.lOCATIONID, + this.lOCATIONNAME, + this.mANUALTIMECARDFLAG, + this.mANUALTIMECARDMEANING, + this.nATIONALITYCODE, + this.nATIONALITYMEANING, + this.nATIONALIDENTIFIER, + this.nORMALHOURS, + this.nOOFROWS, + this.nUMOFSUBORDINATES, + this.oRGANIZATIONID, + this.oRGANIZATIONNAME, + this.pAYROLLCODE, + this.pAYROLLID, + this.pAYROLLNAME, + this.pERSONID, + this.pERSONTYPE, + this.pERSONTYPEID, + this.pERINFORMATIONCATEGORY, + this.pOSITIONID, + this.pOSITIONNAME, + this.pRIMARYFLAG, + this.rOWNUM, + this.sERVICEDAYS, + this.sERVICEMONTHS, + this.sERVICEYEARS, + this.sUPERVISORASSIGNMENTID, + this.sUPERVISORDISPLAYNAME, + this.sUPERVISOREMAILADDRESS, + this.sUPERVISORID, + this.sUPERVISORMOBILENUMBER, + this.sUPERVISORNAME, + this.sUPERVISORNUMBER, + this.sUPERVISORWORKNUMBER, + this.sWIPESEXEMPTEDFLAG, + this.sWIPESEXEMPTEDMEANING, + this.sYSTEMPERSONTYPE, + this.tKEMAILADDRESS, + this.tKEMPLOYEEDISPLAYNAME, + this.tKEMPLOYEENAME, + this.tKEMPLOYEENUMBER, + this.tKPERSONID, + this.tOROWNUM, + this.uNITNUMBER, + this.uSERSTATUS}); GetEmployeeSubordinatesList.fromJson(Map json) { aCTUALTERMINATIONDATE = json['ACTUAL_TERMINATION_DATE']; @@ -232,7 +231,7 @@ class GetEmployeeSubordinatesList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ACTUAL_TERMINATION_DATE'] = this.aCTUALTERMINATIONDATE; data['ASSIGNMENT_END_DATE'] = this.aSSIGNMENTENDDATE; data['ASSIGNMENT_ID'] = this.aSSIGNMENTID; @@ -310,4 +309,4 @@ class GetEmployeeSubordinatesList { data['USER_STATUS'] = this.uSERSTATUS; return data; } -} \ No newline at end of file +} diff --git a/lib/models/update_item_type_success_list.dart b/lib/models/update_item_type_success_list.dart index f133e38..81d0132 100644 --- a/lib/models/update_item_type_success_list.dart +++ b/lib/models/update_item_type_success_list.dart @@ -15,7 +15,7 @@ class UpdateItemTypeSuccessList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ItemID'] = this.itemID; data['UpdateError'] = this.updateError; data['UpdateSuccess'] = this.updateSuccess; diff --git a/lib/models/update_user_item_type_list.dart b/lib/models/update_user_item_type_list.dart index 58f4714..2253ebb 100644 --- a/lib/models/update_user_item_type_list.dart +++ b/lib/models/update_user_item_type_list.dart @@ -12,7 +12,7 @@ class UpdateUserItemTypesList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; return data; diff --git a/lib/models/worklist/update_user_type_list.dart b/lib/models/worklist/update_user_type_list.dart index 4ff377f..1637880 100644 --- a/lib/models/worklist/update_user_type_list.dart +++ b/lib/models/worklist/update_user_type_list.dart @@ -1,13 +1,9 @@ - - - class UpdateUserTypesList { int? itemID; String? pFYAENABLEDFALG; String? pFYIENABLEDFALG; String? pITEMTYPE; - UpdateUserTypesList({this.itemID, this.pFYAENABLEDFALG, this.pFYIENABLEDFALG, this.pITEMTYPE}); UpdateUserTypesList.fromJson(Map json) { @@ -18,11 +14,11 @@ class UpdateUserTypesList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ItemID'] = this.itemID; data['P_FYAENABLED_FALG'] = this.pFYAENABLEDFALG; data['P_FYIENABLED_FALG'] = this.pFYIENABLEDFALG; data['P_ITEM_TYPE'] = this.pITEMTYPE; return data; } -} \ No newline at end of file +} diff --git a/lib/ui/leave_balance/add_leave_balance_screen.dart b/lib/ui/leave_balance/add_leave_balance_screen.dart index e9ab981..ae7b2e2 100644 --- a/lib/ui/leave_balance/add_leave_balance_screen.dart +++ b/lib/ui/leave_balance/add_leave_balance_screen.dart @@ -27,7 +27,7 @@ class AddLeaveBalanceScreen extends StatefulWidget { } class _AddLeaveBalanceScreenState extends State { - List absenceDff = []; + List getabsenceDffStructureList = []; List absenceList = []; GetAbsenceAttendanceTypesList? selectedAbsenceType; @@ -58,8 +58,8 @@ class _AddLeaveBalanceScreenState extends State { void getAbsenceDffStructure(String flexCode) async { try { Utils.showLoading(context); - absenceDff.clear(); - absenceDff = await LeaveBalanceApiClient().getAbsenceDffStructure(flexCode, "HR_LOA_SS", -999); + getabsenceDffStructureList.clear(); + getabsenceDffStructureList = await LeaveBalanceApiClient().getAbsenceDffStructure(flexCode, "HR_LOA_SS", -999); Utils.hideLoading(context); setState(() {}); } catch (ex) { @@ -102,6 +102,7 @@ class _AddLeaveBalanceScreenState extends State { } selectedAbsenceType = absenceList[popupIndex]; setState(() {}); + getAbsenceDffStructure(selectedAbsenceType!.dESCFLEXCONTEXTCODE!); }, ), 12.height, @@ -134,8 +135,8 @@ class _AddLeaveBalanceScreenState extends State { ), 12.height, DynamicTextFieldWidget( - "totla dsays", - "days", + "Total Days", + "Days", isInputTypeNum: true, onChange: (input) { totalDays = int.parse(input); @@ -181,6 +182,293 @@ class _AddLeaveBalanceScreenState extends State { ); } + // Widget parseDynamicFormatType(GetAbsenceDffStructureList model, int index) { + // if (model.dISPLAYFLAG != "N") { + // if (model.vALIDATIONTYPE == "N") { + // if (model.fORMATTYPE == "C") { + // return DynamicTextFieldWidget( + // (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + // model.eSERVICESDV?.pIDCOLUMNNAME ?? "", + // isReadOnly: model.rEADONLY == "Y", + // onChange: (text) { + // model.eSERVICESDV ??= ESERVICESDV(); + // model.eSERVICESDV!.pIDCOLUMNNAME = text; + // }, + // ).paddingOnly(bottom: 12); + // } else if (model.fORMATTYPE == "N") { + // return DynamicTextFieldWidget( + // (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + // model.eSERVICESDV?.pIDCOLUMNNAME ?? "", + // isReadOnly: model.rEADONLY == "Y", + // isInputTypeNum: true, + // onChange: (text) { + // model.eSERVICESDV ??= ESERVICESDV(); + // model.eSERVICESDV!.pIDCOLUMNNAME = text; + // }, + // ).paddingOnly(bottom: 12); + // } else if (model.fORMATTYPE == "X") { + // String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? (getabsenceDffStructureList![index].fieldAnswer ?? ""); + // + // if (getabsenceDffStructureList[index].isDefaultTypeIsCDPS) { + // if (displayText.contains(" 00:00:00")) { + // displayText = displayText.replaceAll(" 00:00:00", ""); + // } + // if (displayText.contains("/")) { + // displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText)); + // } + // } + // return DynamicTextFieldWidget( + // (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + // displayText, + // suffixIconData: Icons.calendar_today, + // isEnable: false, + // onTap: () async { + // if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { + // if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) { + // selectedDate = DateFormat("yyyy/MM/dd").parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", "")); + // } else { + // selectedDate = DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!); + // } + // } + // DateTime date = await _selectDate(context); + // String dateString = date.toString().split(' ').first; + // // DateTime date1 = DateTime(date.year, date.month, date.day); + // // getabsenceDffStructureList![index].fieldAnswer = date.toString(); + // ESERVICESDV eservicesdv; + // if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) { + // eservicesdv = ESERVICESDV( + // pIDCOLUMNNAME: formatDate(dateString), + // pRETURNMSG: "null", + // pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE, + // pVALUECOLUMNNAME: getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + // } else { + // eservicesdv = ESERVICESDV( + // pIDCOLUMNNAME: dateString, + // pRETURNMSG: "null", + // pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE, + // pVALUECOLUMNNAME: getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + // } + // getabsenceDffStructureList![index].eSERVICESDV = eservicesdv; + // setState(() {}); + // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + // await calGetValueSetValues(model); + // } + // if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + // await getDefaultValues(model); + // } + // }, + // ).paddingOnly(bottom: 12); + // } else if (model.fORMATTYPE == "Y") { + // String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? (getabsenceDffStructureList![index].fieldAnswer ?? ""); + // if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) { + // displayText = reverseFormatDate(displayText); + // // if (displayText.contains(" 00:00:00")) { + // // displayText = displayText.replaceAll(" 00:00:00", ""); + // // } + // // if (!displayText.contains("-")) { + // // displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText)); + // // } + // } + // return DynamicTextFieldWidget( + // (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + // displayText, + // suffixIconData: Icons.calendar_today, + // isEnable: false, + // onTap: () async { + // if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { + // if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) { + // String tempDate = getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!; + // if (tempDate.contains("00:00:00")) { + // tempDate = tempDate.replaceAll("00:00:00", '').trim(); + // } + // if (tempDate.contains("/")) { + // selectedDate = DateFormat("yyyy/MM/dd").parse(tempDate); + // } else { + // selectedDate = DateFormat("yyyy-MM-dd").parse(tempDate); + // } + // } else { + // selectedDate = DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!); + // } + // } + // DateTime date = await _selectDate(context); + // String dateString = date.toString().split(' ').first; + // // getabsenceDffStructureList![index].fieldAnswer = date.toString(); + // ESERVICESDV eservicesdv; + // if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) { + // eservicesdv = ESERVICESDV( + // pIDCOLUMNNAME: formatDate(dateString), + // pRETURNMSG: "null", + // pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE, + // pVALUECOLUMNNAME: getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + // } else { + // eservicesdv = ESERVICESDV( + // pIDCOLUMNNAME: dateString, + // pRETURNMSG: "null", + // pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE, + // pVALUECOLUMNNAME: getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + // } + // + // getabsenceDffStructureList![index].eSERVICESDV = eservicesdv; + // setState(() {}); + // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + // await calGetValueSetValues(model); + // } + // if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + // await getDefaultValues(model); + // } + // }, + // ).paddingOnly(bottom: 12); + // } + // } else { + // return PopupMenuButton( + // child: DynamicTextFieldWidget( + // (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + // model.eSERVICESDV?.pVALUECOLUMNNAME ?? "", + // isEnable: false, + // isPopup: true, + // isInputTypeNum: true, + // isReadOnly: model.rEADONLY == "Y", + // ).paddingOnly(bottom: 12), + // itemBuilder: (_) => >[ + // if (model.rEADONLY != "Y") + // for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem(child: Text(model.eSERVICESVS![i].vALUECOLUMNNAME!), value: i), + // ], + // onSelected: (int popipIndex) async { + // ESERVICESDV eservicesdv = ESERVICESDV( + // pIDCOLUMNNAME: model.eSERVICESVS![popipIndex].iDCOLUMNNAME, + // pRETURNMSG: "null", + // pRETURNSTATUS: "null", //getabsenceDffStructureList![popipIndex].dEFAULTVALUE, + // pVALUECOLUMNNAME: model.eSERVICESVS![popipIndex].vALUECOLUMNNAME); + // getabsenceDffStructureList![index].eSERVICESDV = eservicesdv; + // setState(() {}); + // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + // await calGetValueSetValues(model); + // } + // if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + // await getDefaultValues(model); + // } + // }); + // } + // } else { + // return const SizedBox(); + // } + // if (model.fORMATTYPE == "N") { + // if (model.eSERVICESVS?.isNotEmpty ?? false) { + // return PopupMenuButton( + // child: DynamicTextFieldWidget( + // (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + // model.eSERVICESDV?.pVALUECOLUMNNAME ?? "", + // isEnable: false, + // isPopup: true, + // isInputTypeNum: true, + // isReadOnly: model.rEADONLY == "Y", + // ).paddingOnly(bottom: 12), + // itemBuilder: (_) => >[ + // if (model.rEADONLY != "Y") + // for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem(value: i, child: Text(model.eSERVICESVS![i].vALUECOLUMNNAME!)), + // ], + // onSelected: (int popipIndex) async { + // ESERVICESDV eservicesdv = + // ESERVICESDV(pIDCOLUMNNAME: model.eSERVICESVS![popipIndex].iDCOLUMNNAME, pRETURNMSG: "null", pRETURNSTATUS: "null", pVALUECOLUMNNAME: model.eSERVICESVS![popipIndex].vALUECOLUMNNAME); + // getabsenceDffStructureList![index].eSERVICESDV = eservicesdv; + // setState(() {}); + // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + // await calGetValueSetValues(model); + // } + // if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + // await getDefaultValues(model); + // } + // }); + // } + // + // return DynamicTextFieldWidget( + // (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + // model.eSERVICESDV?.pIDCOLUMNNAME ?? "", + // isReadOnly: model.rEADONLY == "Y", + // onChange: (text) { + // model.fieldAnswer = text; + // }, + // ).paddingOnly(bottom: 12); + // } else if (model.fORMATTYPE == "X" || model.fORMATTYPE == "Y") { + // String displayText = model.eSERVICESDV?.pIDCOLUMNNAME ?? (getabsenceDffStructureList![index].fieldAnswer ?? ""); + // if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) { + // if (displayText.contains(" 00:00:00")) { + // displayText = displayText.replaceAll(" 00:00:00", ""); + // } + // if (!displayText.contains("-")) { + // displayText = DateFormat('yyyy-MM-dd').format(DateFormat("yyyy/MM/dd").parse(displayText)); + // } + // } + // return DynamicTextFieldWidget( + // (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + // displayText, + // suffixIconData: Icons.calendar_today, + // isEnable: false, + // onTap: () async { + // if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { + // if (getabsenceDffStructureList![index].isDefaultTypeIsCDPS) { + // selectedDate = DateFormat("yyyy/MM/dd").parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.replaceAll('/"', '').replaceAll(" 00:00:00", "")); + // } else { + // selectedDate = DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!); + // } + // } + // DateTime date = await _selectDate(context); + // String dateString = date.toString().split(' ').first; + // getabsenceDffStructureList![index].fieldAnswer = date.toString(); + // ESERVICESDV eservicesdv = ESERVICESDV( + // pIDCOLUMNNAME: dateString, + // pRETURNMSG: "null", + // pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE, + // pVALUECOLUMNNAME: getabsenceDffStructureList![index].isDefaultTypeIsCDPS ? reverseFormatStandardDate(formatDate(dateString)) : DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + // getabsenceDffStructureList![index].eSERVICESDV = eservicesdv; + // setState(() {}); + // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + // await calGetValueSetValues(model); + // } + // if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + // await getDefaultValues(model); + // } + // }, + // ).paddingOnly(bottom: 12); + // } else if (model.fORMATTYPE == "I") { + // return DynamicTextFieldWidget( + // (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + // model.eSERVICESDV?.pIDCOLUMNNAME ?? (getabsenceDffStructureList![index].fieldAnswer ?? ""), + // suffixIconData: Icons.access_time_filled_rounded, + // isEnable: false, + // onTap: () async { + // if ((getabsenceDffStructureList![index].eSERVICESDV?.pVALUECOLUMNNAME != null)) { + // var timeString = getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!.split(":"); + // selectedDate = DateTime(0, 0, 0, int.parse(timeString[0]), int.parse(timeString[1])); + // + // //DateTime.parse(getabsenceDffStructureList![index].eSERVICESDV!.pVALUECOLUMNNAME!); + // } + // TimeOfDay _time = await _selectTime(context); + // DateTime tempTime = DateTime(0, 1, 1, _time.hour, _time.minute); + // String time = DateFormat('HH:mm').format(tempTime).trim(); + // + // // DateTime date1 = DateTime(date.year, date.month, date.day); + // // getabsenceDffStructureList![index].fieldAnswer = date.toString(); + // ESERVICESDV eservicesdv = ESERVICESDV(pIDCOLUMNNAME: time, pRETURNMSG: "null", pRETURNSTATUS: getabsenceDffStructureList![index].dEFAULTVALUE, pVALUECOLUMNNAME: time); + // getabsenceDffStructureList![index].eSERVICESDV = eservicesdv; + // setState(() {}); + // // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + // // await calGetValueSetValues(model); + // // } + // // if (model.cHILDSEGMENTSDVSplited?.isNotEmpty ?? false) { + // // await getDefaultValues(model); + // // } + // }, + // ).paddingOnly(bottom: 12); + // } + // + // return Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisSize: MainAxisSize.min, + // children: [], + // ).objectContainerView(); + // } + Future _selectDate(BuildContext context, DateTime? dateInput) async { DateTime time = dateInput ?? DateTime.now(); if (Platform.isIOS) { diff --git a/lib/ui/my_team/view_attendance.dart b/lib/ui/my_team/view_attendance.dart index b24a895..06b0bce 100644 --- a/lib/ui/my_team/view_attendance.dart +++ b/lib/ui/my_team/view_attendance.dart @@ -447,7 +447,7 @@ class _ViewAttendanceState extends State { List _getDataSource() { - final List meetings = []; + List meetings = []; return meetings; } @@ -545,7 +545,7 @@ class MeetingDataSource extends CalendarDataSource { } Meeting _getMeetingData(int index) { - final dynamic meeting = appointments; + dynamic meeting = appointments; Meeting meetingData; if (meeting is Meeting) { meetingData = meeting; diff --git a/lib/ui/profile/basic_details.dart b/lib/ui/profile/basic_details.dart index 35f2071..a2896a5 100644 --- a/lib/ui/profile/basic_details.dart +++ b/lib/ui/profile/basic_details.dart @@ -5,6 +5,7 @@ import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/config/routes.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; @@ -33,9 +34,11 @@ class _BasicDetailsState extends State { String? emailAddress = ""; String? employeeNo = ""; int correctOrNew = 1; - List getEmployeeBasicDetailsList = []; + List? getEmployeeBasicDetailsList; + late MemberInformationListModel memberInformationList; GetMenuEntriesList menuEntries = GetMenuEntriesList(); + @override void initState() { super.initState(); @@ -58,7 +61,6 @@ class _BasicDetailsState extends State { } } - Widget build(BuildContext context) { return Scaffold( appBar: AppBarWidget( @@ -68,53 +70,43 @@ class _BasicDetailsState extends State { backgroundColor: MyColors.backgroundColor, body: Column( children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only(top: 20, left: 21, right: 21, bottom: 20), - padding: EdgeInsets.only(left: 14, right: 14, top: 13, bottom: 5), - height: 300, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 5, - blurRadius: 26, - offset: Offset(0, 3), - ), - ], - color: Colors.white, - borderRadius: BorderRadius.circular(10.0), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: getEmployeeBasicDetailsList.map((e) => - Column( - children: [ - e.dISPLAYFLAG == "Y" ? Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - "${e.sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), - "${e.sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), - SizedBox(height: 12,) - ]): Container(), - ], - )).toList()), - ), - ], - ), - ), + ListView( + padding: const EdgeInsets.all(21), + children: [ + getEmployeeBasicDetailsList == null + ? const SizedBox().expanded + : (getEmployeeBasicDetailsList!.isEmpty + ? Utils.getNoDataWidget(context).expanded + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: getEmployeeBasicDetailsList! + .map((e) => Column( + children: [ + e.dISPLAYFLAG == "Y" + ? Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + "${e.sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), + "${e.sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), + 12.height + ]) + : Container(), + ], + )) + .toList()) + .objectContainerView()) + ], + ).expanded, DefaultButton( - LocaleKeys.update.tr(), - menuEntries.updateButton == 'Y' ? () async { - showAlertDialog(context);} - : null).insideContainer, + LocaleKeys.update.tr(), + menuEntries.updateButton == 'Y' + ? () async { + showAlertDialog(context); + } + : null) + .insideContainer, ], )); } - void showAlertDialog(BuildContext context) { Widget cancelButton = TextButton( child: Text(LocaleKeys.cancel.tr()), diff --git a/lib/ui/profile/contact_details.dart b/lib/ui/profile/contact_details.dart index 9eda586..4bc3fa1 100644 --- a/lib/ui/profile/contact_details.dart +++ b/lib/ui/profile/contact_details.dart @@ -4,7 +4,9 @@ import 'package:mohem_flutter_app/api/profile_api_client.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/config/routes.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/get_employee_address_model.dart'; @@ -13,9 +15,7 @@ import 'package:mohem_flutter_app/models/get_employee_phones_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_address_screen.dart'; import 'package:mohem_flutter_app/ui/profile/phone_numbers.dart'; -import 'package:mohem_flutter_app/ui/profile/profile_screen.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; -import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:provider/provider.dart'; class ContactDetails extends StatefulWidget { @@ -47,26 +47,12 @@ class _ContactDetailsState extends State { menuEntriesPhone = menuData.where((GetMenuEntriesList e) => e.requestType == 'PHONE_NUMBERS').toList()[0]; menuEntriesAddress = menuData.where((GetMenuEntriesList e) => e.requestType == 'ADDRESS').toList()[0]; getEmployeePhones(); - - setState(() {}); } void getEmployeePhones() async { try { Utils.showLoading(context); getEmployeePhonesList = await ProfileApiClient().getEmployeePhones(); - getEmployeeAddress(); - Utils.hideLoading(context); - setState(() {}); - } catch (ex) { - Utils.hideLoading(context); - Utils.handleException(ex, context, null); - } - } - - void getEmployeeAddress() async { - try { - Utils.showLoading(context); getEmployeeAddressList = await ProfileApiClient().getEmployeeAddress(); Utils.hideLoading(context); setState(() {}); @@ -78,37 +64,18 @@ class _ContactDetailsState extends State { Widget build(BuildContext context) { return Scaffold( - appBar: AppBarWidget( - context, - title: LocaleKeys.profile_contactDetails.tr(), - ), - backgroundColor: MyColors.backgroundColor, - // bottomSheet: footer(), - body: SingleChildScrollView( - child: Column(children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only( - top: 20, - left: 26, - right: 26, - ), - padding: EdgeInsets.all(15), - - ///height: 200, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 5, - blurRadius: 26, - offset: Offset(0, 3), - ), - ], - color: Colors.white, - borderRadius: BorderRadius.circular(10.0), - ), - child: Stack(children: [ + appBar: AppBarWidget( + context, + title: LocaleKeys.profile_contactDetails.tr(), + ), + backgroundColor: MyColors.backgroundColor, + // bottomSheet: footer(), + body: ListView( + padding: const EdgeInsets.all(21), + children: [ + if (getEmployeePhonesList.isNotEmpty) + Stack( + children: [ Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -125,37 +92,33 @@ class _ContactDetailsState extends State { : Container() ], ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: getEmployeePhonesList - .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - "${e.pHONETYPEMEANING}".toText13(color: MyColors.lightGrayColor), - "${e.pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor), - ])) - .toList()) - ])), - Container( - width: double.infinity, - margin: EdgeInsets.only( - top: 20, - left: 26, - right: 26, - ), - padding: EdgeInsets.all(15), - // height: 400, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 5, - blurRadius: 26, - offset: Offset(0, 3), - ), - ], - color: Colors.white, - borderRadius: BorderRadius.circular(10.0), - ), - child: Stack(children: [ + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.zero, + itemBuilder: (cxt, index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "${getEmployeePhonesList[index].pHONETYPEMEANING}".toText13(color: MyColors.lightGrayColor), + ("${getEmployeePhonesList[index].pHONENUMBER}" ?? "").toText16(isBold: true, color: MyColors.blackColor), + ], + ), + separatorBuilder: (cxt, index) => 12.height, + itemCount: getEmployeePhonesList.length), + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: getEmployeePhonesList + // .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + // "${e.pHONETYPEMEANING}".toText13(color: MyColors.lightGrayColor), + // "${e.pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor), + // ])) + // .toList()) + ], + ).objectContainerView(), + 12.height, + if (getEmployeeAddressList.isNotEmpty) + Stack( + children: [ Row( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -172,34 +135,31 @@ class _ContactDetailsState extends State { : Container() ], ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: getEmployeeAddressList - .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - "${e.sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), - "${e.sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), - SizedBox( - height: 20, - ), - ])) - .toList()) - ])) - ]))); - } - - Widget footer() { - return Container( - decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(10), - color: MyColors.white, - boxShadow: [ - BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.zero, + itemBuilder: (cxt, index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "${getEmployeeAddressList[index].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), + ("${getEmployeeAddressList[index].sEGMENTVALUEDSP}" ?? "").toText16(isBold: true, color: MyColors.blackColor), + ], + ), + separatorBuilder: (cxt, index) => 12.height, + itemCount: getEmployeeAddressList.length), + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: getEmployeeAddressList + // .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + // "${e.sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), + // "${e.sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), + // ])) + // .toList()) + ], + ).objectContainerView() ], ), - child: DefaultButton(LocaleKeys.update.tr(), () async { - // context.setLocale(const Locale("en", "US")); // to change Loacle - ProfileScreen(); - }).insideContainer, ); }