my team module and workList settings
parent
0820f87877
commit
a22f679908
@ -0,0 +1,149 @@
|
||||
|
||||
|
||||
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/dashboard/get_attendance_tracking_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart';
|
||||
import 'package:mohem_flutter_app/models/generic_response_model.dart';
|
||||
import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart';
|
||||
import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart';
|
||||
|
||||
class MyTeamApiClient {
|
||||
static final MyTeamApiClient _instance = MyTeamApiClient._internal();
|
||||
|
||||
MyTeamApiClient._internal();
|
||||
|
||||
factory MyTeamApiClient() => _instance;
|
||||
|
||||
|
||||
Future<List<GetEmployeeSubordinatesList>> getEmployeeSubordinates(String searchEmpEmail, String searchEmpName, String searchEmpNo) async {
|
||||
String url = "${ApiConsts.erpRest}GET_EMPLOYEE_SUBORDINATES";
|
||||
Map<String, dynamic> postParams = {
|
||||
"P_PAGE_LIMIT": 50,
|
||||
"P_PAGE_NUM": 1,
|
||||
"P_SEARCH_EMAIL_ADDRESS": searchEmpEmail,
|
||||
"P_SEARCH_EMPLOYEE_DISPLAY_NAME": searchEmpName,
|
||||
"P_SEARCH_EMPLOYEE_NUMBER": searchEmpNo,
|
||||
};
|
||||
postParams.addAll(AppState().postParamsJson);
|
||||
return await ApiClient().postJsonForObject((json) {
|
||||
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||||
return responseData.getEmployeeSubordinatesList ?? [];
|
||||
}, url, postParams);
|
||||
}
|
||||
|
||||
Future<GetTimeCardSummaryList?> getTimeCardSummary(String month, int year, String? empID) async {
|
||||
String url = "${ApiConsts.erpRest}GET_TIME_CARD_SUMMARY";
|
||||
Map<String, dynamic> postParams = {
|
||||
"P_MENU_TYPE": "M",
|
||||
"P_SELECTED_RESP_ID": -999,
|
||||
"SearchMonth": month,
|
||||
"SearchYear": year,
|
||||
};
|
||||
|
||||
postParams.addAll(AppState().postParamsJson);
|
||||
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
|
||||
return await ApiClient().postJsonForObject((json) {
|
||||
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||||
return (responseData.getTimeCardSummaryList?.length ?? 0) > 0 ? responseData.getTimeCardSummaryList!.first : null;
|
||||
}, url, postParams);
|
||||
}
|
||||
|
||||
Future<List<GetDayHoursTypeDetailsList>> getDayHoursTypeDetails(String month, int year, String? empID) async {
|
||||
String url = "${ApiConsts.erpRest}GET_DAY_HOURS_TYPE_DETAILS";
|
||||
Map<String, dynamic> postParams = {
|
||||
"P_MENU_TYPE": "M",
|
||||
"P_PAGE_LIMIT": 100,
|
||||
"P_PAGE_NUM": 1,
|
||||
"P_SELECTED_RESP_ID": -999,
|
||||
"SearchMonth": month,
|
||||
"SearchYear": year,
|
||||
};
|
||||
postParams.addAll(AppState().postParamsJson);
|
||||
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
|
||||
return await ApiClient().postJsonForObject((json) {
|
||||
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||||
print(responseData.getDayHoursTypeDetailsList!.length);
|
||||
return responseData.getDayHoursTypeDetailsList ?? [];
|
||||
}, url, postParams);
|
||||
}
|
||||
|
||||
|
||||
Future<GetAttendanceTracking?> getAttendanceTracking(String? empID) async {
|
||||
String url = "${ApiConsts.erpRest}GET_Attendance_Tracking";
|
||||
Map<String, dynamic> postParams = {};
|
||||
postParams.addAll(AppState().postParamsJson);
|
||||
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
|
||||
return await ApiClient().postJsonForObject((json) {
|
||||
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||||
print(responseData.getAttendanceTrackingList);
|
||||
return responseData.getAttendanceTrackingList;
|
||||
}, url, postParams);
|
||||
}
|
||||
|
||||
Future<List<GetEmployeeSubordinatesList>> employeeSubordinates(String searchEmpEmail, String searchEmpName, String searchEmpNo, String? empID) async {
|
||||
String url = "${ApiConsts.erpRest}GET_EMPLOYEE_SUBORDINATES";
|
||||
Map<String, dynamic> postParams = {
|
||||
"P_PAGE_LIMIT": 50,
|
||||
"P_PAGE_NUM": 1,
|
||||
"P_SEARCH_EMAIL_ADDRESS": searchEmpEmail,
|
||||
"P_SEARCH_EMPLOYEE_DISPLAY_NAME": searchEmpName,
|
||||
"P_SEARCH_EMPLOYEE_NUMBER": searchEmpNo,
|
||||
};
|
||||
postParams.addAll(AppState().postParamsJson);
|
||||
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
|
||||
return await ApiClient().postJsonForObject((json) {
|
||||
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||||
return responseData.getEmployeeSubordinatesList ?? [];
|
||||
}, url, postParams);
|
||||
}
|
||||
|
||||
Future<List<GetMenuEntriesList>> employeeSubordinatesRequest(String? empID) async {
|
||||
String url = "${ApiConsts.erpRest}GET_MENU_ENTRIES";
|
||||
Map<String, dynamic> postParams = {
|
||||
"P_MENU_TYPE": "M",
|
||||
"P_SELECTED_RESP_ID": -999,
|
||||
};
|
||||
postParams.addAll(AppState().postParamsJson);
|
||||
postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID;
|
||||
return await ApiClient().postJsonForObject((json) {
|
||||
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
||||
return responseData.getMenuEntriesList ?? [];
|
||||
}, url, postParams);
|
||||
}
|
||||
|
||||
Future<List<GetFavoriteReplacements>?> getFavoriteReplacement() async {
|
||||
String url = "${ApiConsts.erpRest}Mohemm_GetFavoriteReplacements";
|
||||
Map<String, dynamic> postParams = {
|
||||
};
|
||||
postParams.addAll(AppState().postParamsJson);
|
||||
return await ApiClient().postJsonForObject((json) {
|
||||
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
|
||||
return responseData.mohemmGetFavoriteReplacementsList;
|
||||
}, url, postParams);
|
||||
}
|
||||
|
||||
Future<GenericResponseModel> changeFavoriteReplacements({required String email, required String employeName, required String image, required String userName, bool isFav = false}) async {
|
||||
String url = "${ApiConsts.erpRest}Mohemm_ChangeFavoriteReplacements";
|
||||
Map<String, dynamic> postParamsObj = {
|
||||
"EMAIL_ADDRESS": email,
|
||||
"EMPLOYEE_DISPLAY_NAME": employeName,
|
||||
"EMPLOYEE_IMAGE": image,
|
||||
"IsFavorite": isFav,
|
||||
"USER_NAME": userName,
|
||||
};
|
||||
Map<String, dynamic> postParams = {
|
||||
"Mohemm_ChangeReplacementsInputList": [postParamsObj],
|
||||
//postParams["Mohemm_ChangeReplacementsInputList"] = list;
|
||||
};
|
||||
postParams.addAll(AppState().postParamsJson);
|
||||
return await ApiClient().postJsonForObject((json) {
|
||||
GenericResponseModel responseData = GenericResponseModel.fromJson(json);
|
||||
return responseData;
|
||||
}, url, postParams);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
|
||||
|
||||
class GetAttendanceTrackingList {
|
||||
String? pBREAKHOURS;
|
||||
String? pLATEINHOURS;
|
||||
String? pREMAININGHOURS;
|
||||
String? pRETURNMSG;
|
||||
String? pRETURNSTATUS;
|
||||
String? pSCHEDULEDHOURS;
|
||||
String? pSHTNAME;
|
||||
String? pSPENTHOURS;
|
||||
String? pSWIPESEXEMPTEDFLAG;
|
||||
Null? pSWIPEIN;
|
||||
Null? pSWIPEOUT;
|
||||
|
||||
GetAttendanceTrackingList(
|
||||
{this.pBREAKHOURS,
|
||||
this.pLATEINHOURS,
|
||||
this.pREMAININGHOURS,
|
||||
this.pRETURNMSG,
|
||||
this.pRETURNSTATUS,
|
||||
this.pSCHEDULEDHOURS,
|
||||
this.pSHTNAME,
|
||||
this.pSPENTHOURS,
|
||||
this.pSWIPESEXEMPTEDFLAG,
|
||||
this.pSWIPEIN,
|
||||
this.pSWIPEOUT});
|
||||
|
||||
GetAttendanceTrackingList.fromJson(Map<String, dynamic> json) {
|
||||
pBREAKHOURS = json['P_BREAK_HOURS'];
|
||||
pLATEINHOURS = json['P_LATE_IN_HOURS'];
|
||||
pREMAININGHOURS = json['P_REMAINING_HOURS'];
|
||||
pRETURNMSG = json['P_RETURN_MSG'];
|
||||
pRETURNSTATUS = json['P_RETURN_STATUS'];
|
||||
pSCHEDULEDHOURS = json['P_SCHEDULED_HOURS'];
|
||||
pSHTNAME = json['P_SHT_NAME'];
|
||||
pSPENTHOURS = json['P_SPENT_HOURS'];
|
||||
pSWIPESEXEMPTEDFLAG = json['P_SWIPES_EXEMPTED_FLAG'];
|
||||
pSWIPEIN = json['P_SWIPE_IN'];
|
||||
pSWIPEOUT = json['P_SWIPE_OUT'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['P_BREAK_HOURS'] = this.pBREAKHOURS;
|
||||
data['P_LATE_IN_HOURS'] = this.pLATEINHOURS;
|
||||
data['P_REMAINING_HOURS'] = this.pREMAININGHOURS;
|
||||
data['P_RETURN_MSG'] = this.pRETURNMSG;
|
||||
data['P_RETURN_STATUS'] = this.pRETURNSTATUS;
|
||||
data['P_SCHEDULED_HOURS'] = this.pSCHEDULEDHOURS;
|
||||
data['P_SHT_NAME'] = this.pSHTNAME;
|
||||
data['P_SPENT_HOURS'] = this.pSPENTHOURS;
|
||||
data['P_SWIPES_EXEMPTED_FLAG'] = this.pSWIPESEXEMPTEDFLAG;
|
||||
data['P_SWIPE_IN'] = this.pSWIPEIN;
|
||||
data['P_SWIPE_OUT'] = this.pSWIPEOUT;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,313 @@
|
||||
|
||||
class GetEmployeeSubordinatesList {
|
||||
String? aCTUALTERMINATIONDATE;
|
||||
String? aSSIGNMENTENDDATE;
|
||||
int? aSSIGNMENTID;
|
||||
String? aSSIGNMENTNUMBER;
|
||||
String? aSSIGNMENTSTARTDATE;
|
||||
int? aSSIGNMENTSTATUSTYPEID;
|
||||
String? aSSIGNMENTTYPE;
|
||||
int? bUSINESSGROUPID;
|
||||
String? bUSINESSGROUPNAME;
|
||||
String? cURRENTEMPLOYEEFLAG;
|
||||
String? eMPLOYEEDISPLAYNAME;
|
||||
String? eMPLOYEEEMAILADDRESS;
|
||||
String? eMPLOYEEIMAGE;
|
||||
String? eMPLOYEEMOBILENUMBER;
|
||||
String? eMPLOYEENAME;
|
||||
String? eMPLOYEENUMBER;
|
||||
String? eMPLOYEEWORKNUMBER;
|
||||
String? eMPLOYMENTCATEGORY;
|
||||
String? eMPLOYMENTCATEGORYMEANING;
|
||||
String? fREQUENCY;
|
||||
String? fREQUENCYMEANING;
|
||||
int? fROMROWNUM;
|
||||
dynamic? gRADEID;
|
||||
dynamic? gRADENAME;
|
||||
dynamic? genderCode;
|
||||
dynamic? genderMeaning;
|
||||
String? hIREDATE;
|
||||
bool? isFavorite;
|
||||
int? jOBID;
|
||||
String? jOBNAME;
|
||||
int? lOCATIONID;
|
||||
String? lOCATIONNAME;
|
||||
String? mANUALTIMECARDFLAG;
|
||||
String? mANUALTIMECARDMEANING;
|
||||
String? nATIONALITYCODE;
|
||||
String? nATIONALITYMEANING;
|
||||
String? nATIONALIDENTIFIER;
|
||||
dynamic? nORMALHOURS;
|
||||
int? nOOFROWS;
|
||||
int? nUMOFSUBORDINATES;
|
||||
int? oRGANIZATIONID;
|
||||
String? oRGANIZATIONNAME;
|
||||
String? pAYROLLCODE;
|
||||
int? pAYROLLID;
|
||||
String? pAYROLLNAME;
|
||||
int? pERSONID;
|
||||
String? pERSONTYPE;
|
||||
int? pERSONTYPEID;
|
||||
String? pERINFORMATIONCATEGORY;
|
||||
int? pOSITIONID;
|
||||
String? pOSITIONNAME;
|
||||
String? pRIMARYFLAG;
|
||||
int? rOWNUM;
|
||||
int? sERVICEDAYS;
|
||||
int? sERVICEMONTHS;
|
||||
int? sERVICEYEARS;
|
||||
String? sUPERVISORASSIGNMENTID;
|
||||
String? sUPERVISORDISPLAYNAME;
|
||||
String? sUPERVISOREMAILADDRESS;
|
||||
int? sUPERVISORID;
|
||||
String? sUPERVISORMOBILENUMBER;
|
||||
String? sUPERVISORNAME;
|
||||
String? sUPERVISORNUMBER;
|
||||
String? sUPERVISORWORKNUMBER;
|
||||
String? sWIPESEXEMPTEDFLAG;
|
||||
String? sWIPESEXEMPTEDMEANING;
|
||||
String? sYSTEMPERSONTYPE;
|
||||
String? tKEMAILADDRESS;
|
||||
String? tKEMPLOYEEDISPLAYNAME;
|
||||
String? tKEMPLOYEENAME;
|
||||
String? tKEMPLOYEENUMBER;
|
||||
int? tKPERSONID;
|
||||
int? tOROWNUM;
|
||||
String? uNITNUMBER;
|
||||
String? uSERSTATUS;
|
||||
|
||||
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});
|
||||
|
||||
GetEmployeeSubordinatesList.fromJson(Map<String, dynamic> json) {
|
||||
aCTUALTERMINATIONDATE = json['ACTUAL_TERMINATION_DATE'];
|
||||
aSSIGNMENTENDDATE = json['ASSIGNMENT_END_DATE'];
|
||||
aSSIGNMENTID = json['ASSIGNMENT_ID'];
|
||||
aSSIGNMENTNUMBER = json['ASSIGNMENT_NUMBER'];
|
||||
aSSIGNMENTSTARTDATE = json['ASSIGNMENT_START_DATE'];
|
||||
aSSIGNMENTSTATUSTYPEID = json['ASSIGNMENT_STATUS_TYPE_ID'];
|
||||
aSSIGNMENTTYPE = json['ASSIGNMENT_TYPE'];
|
||||
bUSINESSGROUPID = json['BUSINESS_GROUP_ID'];
|
||||
bUSINESSGROUPNAME = json['BUSINESS_GROUP_NAME'];
|
||||
cURRENTEMPLOYEEFLAG = json['CURRENT_EMPLOYEE_FLAG'];
|
||||
eMPLOYEEDISPLAYNAME = json['EMPLOYEE_DISPLAY_NAME'];
|
||||
eMPLOYEEEMAILADDRESS = json['EMPLOYEE_EMAIL_ADDRESS'];
|
||||
eMPLOYEEIMAGE = json['EMPLOYEE_IMAGE'];
|
||||
eMPLOYEEMOBILENUMBER = json['EMPLOYEE_MOBILE_NUMBER'];
|
||||
eMPLOYEENAME = json['EMPLOYEE_NAME'];
|
||||
eMPLOYEENUMBER = json['EMPLOYEE_NUMBER'];
|
||||
eMPLOYEEWORKNUMBER = json['EMPLOYEE_WORK_NUMBER'];
|
||||
eMPLOYMENTCATEGORY = json['EMPLOYMENT_CATEGORY'];
|
||||
eMPLOYMENTCATEGORYMEANING = json['EMPLOYMENT_CATEGORY_MEANING'];
|
||||
fREQUENCY = json['FREQUENCY'];
|
||||
fREQUENCYMEANING = json['FREQUENCY_MEANING'];
|
||||
fROMROWNUM = json['FROM_ROW_NUM'];
|
||||
gRADEID = json['GRADE_ID'];
|
||||
gRADENAME = json['GRADE_NAME'];
|
||||
genderCode = json['GenderCode'];
|
||||
genderMeaning = json['GenderMeaning'];
|
||||
hIREDATE = json['HIRE_DATE'];
|
||||
isFavorite = json['IsFavorite'];
|
||||
jOBID = json['JOB_ID'];
|
||||
jOBNAME = json['JOB_NAME'];
|
||||
lOCATIONID = json['LOCATION_ID'];
|
||||
lOCATIONNAME = json['LOCATION_NAME'];
|
||||
mANUALTIMECARDFLAG = json['MANUAL_TIMECARD_FLAG'];
|
||||
mANUALTIMECARDMEANING = json['MANUAL_TIMECARD_MEANING'];
|
||||
nATIONALITYCODE = json['NATIONALITY_CODE'];
|
||||
nATIONALITYMEANING = json['NATIONALITY_MEANING'];
|
||||
nATIONALIDENTIFIER = json['NATIONAL_IDENTIFIER'];
|
||||
nORMALHOURS = json['NORMAL_HOURS'];
|
||||
nOOFROWS = json['NO_OF_ROWS'];
|
||||
nUMOFSUBORDINATES = json['NUM_OF_SUBORDINATES'];
|
||||
oRGANIZATIONID = json['ORGANIZATION_ID'];
|
||||
oRGANIZATIONNAME = json['ORGANIZATION_NAME'];
|
||||
pAYROLLCODE = json['PAYROLL_CODE'];
|
||||
pAYROLLID = json['PAYROLL_ID'];
|
||||
pAYROLLNAME = json['PAYROLL_NAME'];
|
||||
pERSONID = json['PERSON_ID'];
|
||||
pERSONTYPE = json['PERSON_TYPE'];
|
||||
pERSONTYPEID = json['PERSON_TYPE_ID'];
|
||||
pERINFORMATIONCATEGORY = json['PER_INFORMATION_CATEGORY'];
|
||||
pOSITIONID = json['POSITION_ID'];
|
||||
pOSITIONNAME = json['POSITION_NAME'];
|
||||
pRIMARYFLAG = json['PRIMARY_FLAG'];
|
||||
rOWNUM = json['ROW_NUM'];
|
||||
sERVICEDAYS = json['SERVICE_DAYS'];
|
||||
sERVICEMONTHS = json['SERVICE_MONTHS'];
|
||||
sERVICEYEARS = json['SERVICE_YEARS'];
|
||||
sUPERVISORASSIGNMENTID = json['SUPERVISOR_ASSIGNMENT_ID'];
|
||||
sUPERVISORDISPLAYNAME = json['SUPERVISOR_DISPLAY_NAME'];
|
||||
sUPERVISOREMAILADDRESS = json['SUPERVISOR_EMAIL_ADDRESS'];
|
||||
sUPERVISORID = json['SUPERVISOR_ID'];
|
||||
sUPERVISORMOBILENUMBER = json['SUPERVISOR_MOBILE_NUMBER'];
|
||||
sUPERVISORNAME = json['SUPERVISOR_NAME'];
|
||||
sUPERVISORNUMBER = json['SUPERVISOR_NUMBER'];
|
||||
sUPERVISORWORKNUMBER = json['SUPERVISOR_WORK_NUMBER'];
|
||||
sWIPESEXEMPTEDFLAG = json['SWIPES_EXEMPTED_FLAG'];
|
||||
sWIPESEXEMPTEDMEANING = json['SWIPES_EXEMPTED_MEANING'];
|
||||
sYSTEMPERSONTYPE = json['SYSTEM_PERSON_TYPE'];
|
||||
tKEMAILADDRESS = json['TK_EMAIL_ADDRESS'];
|
||||
tKEMPLOYEEDISPLAYNAME = json['TK_EMPLOYEE_DISPLAY_NAME'];
|
||||
tKEMPLOYEENAME = json['TK_EMPLOYEE_NAME'];
|
||||
tKEMPLOYEENUMBER = json['TK_EMPLOYEE_NUMBER'];
|
||||
tKPERSONID = json['TK_PERSON_ID'];
|
||||
tOROWNUM = json['TO_ROW_NUM'];
|
||||
uNITNUMBER = json['UNIT_NUMBER'];
|
||||
uSERSTATUS = json['USER_STATUS'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ACTUAL_TERMINATION_DATE'] = this.aCTUALTERMINATIONDATE;
|
||||
data['ASSIGNMENT_END_DATE'] = this.aSSIGNMENTENDDATE;
|
||||
data['ASSIGNMENT_ID'] = this.aSSIGNMENTID;
|
||||
data['ASSIGNMENT_NUMBER'] = this.aSSIGNMENTNUMBER;
|
||||
data['ASSIGNMENT_START_DATE'] = this.aSSIGNMENTSTARTDATE;
|
||||
data['ASSIGNMENT_STATUS_TYPE_ID'] = this.aSSIGNMENTSTATUSTYPEID;
|
||||
data['ASSIGNMENT_TYPE'] = this.aSSIGNMENTTYPE;
|
||||
data['BUSINESS_GROUP_ID'] = this.bUSINESSGROUPID;
|
||||
data['BUSINESS_GROUP_NAME'] = this.bUSINESSGROUPNAME;
|
||||
data['CURRENT_EMPLOYEE_FLAG'] = this.cURRENTEMPLOYEEFLAG;
|
||||
data['EMPLOYEE_DISPLAY_NAME'] = this.eMPLOYEEDISPLAYNAME;
|
||||
data['EMPLOYEE_EMAIL_ADDRESS'] = this.eMPLOYEEEMAILADDRESS;
|
||||
data['EMPLOYEE_IMAGE'] = this.eMPLOYEEIMAGE;
|
||||
data['EMPLOYEE_MOBILE_NUMBER'] = this.eMPLOYEEMOBILENUMBER;
|
||||
data['EMPLOYEE_NAME'] = this.eMPLOYEENAME;
|
||||
data['EMPLOYEE_NUMBER'] = this.eMPLOYEENUMBER;
|
||||
data['EMPLOYEE_WORK_NUMBER'] = this.eMPLOYEEWORKNUMBER;
|
||||
data['EMPLOYMENT_CATEGORY'] = this.eMPLOYMENTCATEGORY;
|
||||
data['EMPLOYMENT_CATEGORY_MEANING'] = this.eMPLOYMENTCATEGORYMEANING;
|
||||
data['FREQUENCY'] = this.fREQUENCY;
|
||||
data['FREQUENCY_MEANING'] = this.fREQUENCYMEANING;
|
||||
data['FROM_ROW_NUM'] = this.fROMROWNUM;
|
||||
data['GRADE_ID'] = this.gRADEID;
|
||||
data['GRADE_NAME'] = this.gRADENAME;
|
||||
data['GenderCode'] = this.genderCode;
|
||||
data['GenderMeaning'] = this.genderMeaning;
|
||||
data['HIRE_DATE'] = this.hIREDATE;
|
||||
data['IsFavorite'] = this.isFavorite;
|
||||
data['JOB_ID'] = this.jOBID;
|
||||
data['JOB_NAME'] = this.jOBNAME;
|
||||
data['LOCATION_ID'] = this.lOCATIONID;
|
||||
data['LOCATION_NAME'] = this.lOCATIONNAME;
|
||||
data['MANUAL_TIMECARD_FLAG'] = this.mANUALTIMECARDFLAG;
|
||||
data['MANUAL_TIMECARD_MEANING'] = this.mANUALTIMECARDMEANING;
|
||||
data['NATIONALITY_CODE'] = this.nATIONALITYCODE;
|
||||
data['NATIONALITY_MEANING'] = this.nATIONALITYMEANING;
|
||||
data['NATIONAL_IDENTIFIER'] = this.nATIONALIDENTIFIER;
|
||||
data['NORMAL_HOURS'] = this.nORMALHOURS;
|
||||
data['NO_OF_ROWS'] = this.nOOFROWS;
|
||||
data['NUM_OF_SUBORDINATES'] = this.nUMOFSUBORDINATES;
|
||||
data['ORGANIZATION_ID'] = this.oRGANIZATIONID;
|
||||
data['ORGANIZATION_NAME'] = this.oRGANIZATIONNAME;
|
||||
data['PAYROLL_CODE'] = this.pAYROLLCODE;
|
||||
data['PAYROLL_ID'] = this.pAYROLLID;
|
||||
data['PAYROLL_NAME'] = this.pAYROLLNAME;
|
||||
data['PERSON_ID'] = this.pERSONID;
|
||||
data['PERSON_TYPE'] = this.pERSONTYPE;
|
||||
data['PERSON_TYPE_ID'] = this.pERSONTYPEID;
|
||||
data['PER_INFORMATION_CATEGORY'] = this.pERINFORMATIONCATEGORY;
|
||||
data['POSITION_ID'] = this.pOSITIONID;
|
||||
data['POSITION_NAME'] = this.pOSITIONNAME;
|
||||
data['PRIMARY_FLAG'] = this.pRIMARYFLAG;
|
||||
data['ROW_NUM'] = this.rOWNUM;
|
||||
data['SERVICE_DAYS'] = this.sERVICEDAYS;
|
||||
data['SERVICE_MONTHS'] = this.sERVICEMONTHS;
|
||||
data['SERVICE_YEARS'] = this.sERVICEYEARS;
|
||||
data['SUPERVISOR_ASSIGNMENT_ID'] = this.sUPERVISORASSIGNMENTID;
|
||||
data['SUPERVISOR_DISPLAY_NAME'] = this.sUPERVISORDISPLAYNAME;
|
||||
data['SUPERVISOR_EMAIL_ADDRESS'] = this.sUPERVISOREMAILADDRESS;
|
||||
data['SUPERVISOR_ID'] = this.sUPERVISORID;
|
||||
data['SUPERVISOR_MOBILE_NUMBER'] = this.sUPERVISORMOBILENUMBER;
|
||||
data['SUPERVISOR_NAME'] = this.sUPERVISORNAME;
|
||||
data['SUPERVISOR_NUMBER'] = this.sUPERVISORNUMBER;
|
||||
data['SUPERVISOR_WORK_NUMBER'] = this.sUPERVISORWORKNUMBER;
|
||||
data['SWIPES_EXEMPTED_FLAG'] = this.sWIPESEXEMPTEDFLAG;
|
||||
data['SWIPES_EXEMPTED_MEANING'] = this.sWIPESEXEMPTEDMEANING;
|
||||
data['SYSTEM_PERSON_TYPE'] = this.sYSTEMPERSONTYPE;
|
||||
data['TK_EMAIL_ADDRESS'] = this.tKEMAILADDRESS;
|
||||
data['TK_EMPLOYEE_DISPLAY_NAME'] = this.tKEMPLOYEEDISPLAYNAME;
|
||||
data['TK_EMPLOYEE_NAME'] = this.tKEMPLOYEENAME;
|
||||
data['TK_EMPLOYEE_NUMBER'] = this.tKEMPLOYEENUMBER;
|
||||
data['TK_PERSON_ID'] = this.tKPERSONID;
|
||||
data['TO_ROW_NUM'] = this.tOROWNUM;
|
||||
data['UNIT_NUMBER'] = this.uNITNUMBER;
|
||||
data['USER_STATUS'] = this.uSERSTATUS;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
|
||||
class UpdateUserTypesList {
|
||||
int? itemID;
|
||||
String? pFYAENABLEDFALG;
|
||||
String? pFYIENABLEDFALG;
|
||||
String? pITEMTYPE;
|
||||
|
||||
|
||||
UpdateUserTypesList({this.itemID, this.pFYAENABLEDFALG, this.pFYIENABLEDFALG, this.pITEMTYPE});
|
||||
|
||||
UpdateUserTypesList.fromJson(Map<String, dynamic> json) {
|
||||
itemID = json['ItemID'];
|
||||
pFYAENABLEDFALG = json['P_FYAENABLED_FALG'];
|
||||
pFYIENABLEDFALG = json['P_FYIENABLED_FALG'];
|
||||
pITEMTYPE = json['P_ITEM_TYPE'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ItemID'] = this.itemID;
|
||||
data['P_FYAENABLED_FALG'] = this.pFYAENABLEDFALG;
|
||||
data['P_FYIENABLED_FALG'] = this.pFYIENABLEDFALG;
|
||||
data['P_ITEM_TYPE'] = this.pITEMTYPE;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
|
||||
import 'dart:ui';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:mohem_flutter_app/api/my_team/my_team_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/my_team/get_employee_subordinates_list.dart';
|
||||
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
|
||||
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart';
|
||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||
|
||||
class CreateRequest extends StatefulWidget {
|
||||
const CreateRequest ({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_CreateRequestState createState() => _CreateRequestState();
|
||||
}
|
||||
|
||||
class _CreateRequestState extends State<CreateRequest> {
|
||||
String searchEmpEmail ="";
|
||||
String searchEmpName ="";
|
||||
String searchEmpNo = "";
|
||||
String? empId;
|
||||
List<GetEmployeeSubordinatesList> getEmployeeSubordinatesList = [];
|
||||
// late DashboardProviderModel data;
|
||||
List<GetMenuEntriesList> getMenuEntriesList = [];
|
||||
GetEmployeeSubordinatesList? getEmployeeSubordinates;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// data.fetchMenuEntries();
|
||||
employeeSubRequest();
|
||||
}
|
||||
|
||||
void employeeSubRequest() async {
|
||||
try {
|
||||
Utils.showLoading(context);
|
||||
getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString());
|
||||
getMenuEntriesList = await MyTeamApiClient().employeeSubordinatesRequest(getEmployeeSubordinates?.eMPLOYEENUMBER);
|
||||
Utils.hideLoading(context);
|
||||
setState(() {});
|
||||
} catch (ex) {
|
||||
Utils.hideLoading(context);
|
||||
Utils.handleException(ex, context, null);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList;
|
||||
print(getMenuEntriesList.length);
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBarWidget(
|
||||
context,
|
||||
title: LocaleKeys.createRequest.tr(),
|
||||
),
|
||||
body: SizedBox(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: getMenuEntriesList.isEmpty
|
||||
? Utils.getNoDataWidget(context)
|
||||
: ListView.separated(
|
||||
padding: const EdgeInsets.all(21),
|
||||
itemBuilder: (cxt, index) => itemView("assets/images/pdf.svg", getMenuEntriesList[index].prompt!, index).onPress(() {
|
||||
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(getMenuEntriesList[index].prompt!, getMenuEntriesList[index].functionName!));
|
||||
}),
|
||||
separatorBuilder: (cxt, index) => 12.height,
|
||||
itemCount: getMenuEntriesList.length),
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
Widget itemView(String icon, String title, index) {
|
||||
return getMenuEntriesList[index].parentMenuName !=""? Row(
|
||||
children: [
|
||||
(title).toText16().expanded, 12.width,
|
||||
SvgPicture.asset(
|
||||
"assets/images/arrow_next.svg",
|
||||
color: MyColors.darkIconColor,
|
||||
)
|
||||
],
|
||||
).objectContainerView() : SizedBox();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,314 @@
|
||||
import 'dart:collection';
|
||||
import 'dart:ui';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:mohem_flutter_app/api/my_team/my_team_api_client.dart';
|
||||
import 'package:mohem_flutter_app/api/worklist/worklist_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/generic_response_model.dart';
|
||||
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart';
|
||||
import 'package:mohem_flutter_app/models/profile_menu.model.dart';
|
||||
import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart';
|
||||
import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart';
|
||||
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
|
||||
import 'package:mohem_flutter_app/widgets/circular_avatar.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class EmployeeDetails extends StatefulWidget {
|
||||
EmployeeDetails();
|
||||
|
||||
@override
|
||||
_EmployeeDetailsState createState() => _EmployeeDetailsState();
|
||||
|
||||
}
|
||||
|
||||
class _EmployeeDetailsState extends State<EmployeeDetails> {
|
||||
GetEmployeeSubordinatesList? getEmployeeSubordinates;
|
||||
static List<GetMenuEntriesList> menuData = [];
|
||||
List<ProfileMenu> menu =[];
|
||||
String? selectedFavLetter;
|
||||
List<String>? favLetters;
|
||||
List<GetFavoriteReplacements>? favUsersList;
|
||||
List<ReplacementList>? replacementList;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
//favorite
|
||||
void fetchChangeFav({required String email, required String employeName, required String image, required String userName, bool isFav = false, bool isNeedToRefresh = false}) async {
|
||||
Utils.showLoading(context);
|
||||
getEmployeeSubordinates = ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList;
|
||||
GenericResponseModel model = await MyTeamApiClient().changeFavoriteReplacements(
|
||||
email: email,
|
||||
employeName: employeName,
|
||||
image: image,
|
||||
userName: userName,
|
||||
isFav: isFav,
|
||||
);
|
||||
getEmployeeSubordinates!.isFavorite = isFav;
|
||||
Utils.hideLoading(context);
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
getEmployeeSubordinates = ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList;
|
||||
setMenu();
|
||||
return Scaffold(
|
||||
extendBody: true,
|
||||
backgroundColor: MyColors.lightGreyEFColor,
|
||||
body: Stack(children: [
|
||||
Container(
|
||||
height: 200,
|
||||
margin: EdgeInsets.only(top: 30),
|
||||
decoration: BoxDecoration(image: DecorationImage(image: MemoryImage(Utils.getPostBytes(getEmployeeSubordinates!.eMPLOYEEIMAGE)), fit: BoxFit.cover)),
|
||||
child: new BackdropFilter(
|
||||
filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
|
||||
child: new Container(
|
||||
decoration: new BoxDecoration(color: Colors.white.withOpacity(0.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
80.height,
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 15, right: 15),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.arrow_back_ios,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
myTeamInfo()
|
||||
],
|
||||
),
|
||||
)
|
||||
]));
|
||||
}
|
||||
|
||||
Widget myTeamInfo() {
|
||||
Uri phoneNumber = Uri.parse('tel:${getEmployeeSubordinates?.eMPLOYEEMOBILENUMBER}');
|
||||
double _width = MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width;
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(21, 0, 21, 10),
|
||||
child: Stack(children: [
|
||||
Container(
|
||||
width: _width,
|
||||
//height: 150,
|
||||
margin: EdgeInsets.only(top: 50),
|
||||
padding: EdgeInsets.only(top: 50),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(15)),
|
||||
boxShadow: [BoxShadow(color: MyColors.lightGreyColor, blurRadius: 15, spreadRadius: 3)],
|
||||
),
|
||||
child: Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
/// card header
|
||||
customLabel(getEmployeeSubordinates!.eMPLOYEENAME.toString(), 22, Colors.black, true),
|
||||
customLabel(getEmployeeSubordinates!.eMPLOYEENUMBER.toString() + ' | ' + getEmployeeSubordinates!.jOBNAME.toString(), 14, Colors.grey, false),
|
||||
customLabel(getEmployeeSubordinates!.eMPLOYEEEMAILADDRESS.toString(), 13, Colors.black, true),
|
||||
],
|
||||
).paddingOnly(top: 10, bottom: 10),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: (){
|
||||
if(getEmployeeSubordinates!.isFavorite != true){
|
||||
showFavoriteAlertDialog(context);
|
||||
setState(() {});
|
||||
}else{
|
||||
fetchChangeFav(
|
||||
email: getEmployeeSubordinates?.eMPLOYEEEMAILADDRESS ?? "",
|
||||
employeName: getEmployeeSubordinates!.eMPLOYEENAME ?? "",
|
||||
image: getEmployeeSubordinates!.eMPLOYEEIMAGE ?? "",
|
||||
userName: getEmployeeSubordinates!.eMPLOYEENUMBER ?? "",
|
||||
isFav: false,);
|
||||
setState(() {});
|
||||
} },
|
||||
icon: getEmployeeSubordinates!.isFavorite != true
|
||||
? Icon(
|
||||
Icons.star_outline,
|
||||
size: 35,
|
||||
color: Colors.green,
|
||||
)
|
||||
: Icon(
|
||||
Icons.star_outlined,
|
||||
size: 35,
|
||||
color: Colors.green,
|
||||
),
|
||||
).paddingOnly(top: 50),
|
||||
Container(height: 100, alignment: Alignment.center, child: ProfileImage()),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
launchUrl(phoneNumber);
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.whatsapp,
|
||||
color: Colors.green,
|
||||
size: 30,
|
||||
).paddingOnly(top: 30),
|
||||
),
|
||||
],
|
||||
)
|
||||
])),
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(21, 8, 21, 10),
|
||||
height: 260,
|
||||
padding: EdgeInsets.only(top: 15, bottom: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(15)),
|
||||
boxShadow: [BoxShadow(color: MyColors.lightGreyColor, blurRadius: 15, spreadRadius: 3)],
|
||||
),
|
||||
child: Column(
|
||||
children: menu.map((ProfileMenu i) => rowItem(i, context)).toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget ProfileImage() =>
|
||||
CircleAvatar(
|
||||
radius: 70,
|
||||
backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSubordinates?.eMPLOYEEIMAGE)),
|
||||
backgroundColor: Colors.black,
|
||||
);
|
||||
|
||||
Widget customLabel(String label, double size, Color color, bool isBold, {double padding = 0.0}) =>
|
||||
Container(
|
||||
padding: EdgeInsets.all(padding),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [Text(label, style: TextStyle(color: color, fontSize: size, fontWeight: isBold ? FontWeight.bold : FontWeight.normal))]));
|
||||
|
||||
Widget rowItem(obj, context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
|
||||
Navigator.pushNamed(context, obj.route, arguments:obj.arguments);
|
||||
|
||||
},
|
||||
child: ListTile(
|
||||
leading: SvgPicture.asset('assets/images/' + obj.icon),
|
||||
title: Text(obj.name),
|
||||
trailing: Icon(Icons.arrow_forward),
|
||||
),
|
||||
);
|
||||
}
|
||||
void setMenu(){
|
||||
menu = [
|
||||
ProfileMenu(name: "Profile Details", icon: 'personal-info.svg', route: AppRoutes.profileDetails, arguments:getEmployeeSubordinates, dynamicUrl: '', menuEntries: getMenuEntries('')),
|
||||
ProfileMenu(name: "Create Request", icon: 'personal-info.svg', route: AppRoutes.createRequest,arguments: getEmployeeSubordinates, menuEntries: getMenuEntries('')),
|
||||
ProfileMenu(name: "View Attendance", icon: 'personal-info.svg', route: AppRoutes.viewAttendance, arguments: getEmployeeSubordinates, dynamicUrl: '', menuEntries: getMenuEntries('')),
|
||||
ProfileMenu(name: "Team Members", icon: 'family-members.svg', route: AppRoutes.teamMembers, arguments: getEmployeeSubordinates, dynamicUrl: '', menuEntries: getMenuEntries('')),
|
||||
];
|
||||
}
|
||||
|
||||
void showFavoriteAlertDialog(BuildContext context) {
|
||||
Widget cancelButton = TextButton(
|
||||
child: Text(
|
||||
LocaleKeys.cancel.tr(),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
);
|
||||
Widget continueButton = TextButton(
|
||||
child: Text(
|
||||
LocaleKeys.ok.tr(),
|
||||
),
|
||||
onPressed: () {
|
||||
fetchChangeFav(
|
||||
email: getEmployeeSubordinates?.eMPLOYEEEMAILADDRESS ?? "",
|
||||
employeName: getEmployeeSubordinates!.eMPLOYEENAME ?? "",
|
||||
image: getEmployeeSubordinates!.eMPLOYEEIMAGE ?? "",
|
||||
userName: getEmployeeSubordinates!.eMPLOYEENUMBER ?? "",
|
||||
isFav: true,
|
||||
);
|
||||
setState(() {});
|
||||
Navigator.pop(context);
|
||||
},
|
||||
);
|
||||
AlertDialog alert = AlertDialog(
|
||||
title: Text(
|
||||
LocaleKeys.confirm.tr(),
|
||||
),
|
||||
content: Container(
|
||||
height: 150,
|
||||
child: Column(
|
||||
children: [
|
||||
Text("Do you want to add" + "${getEmployeeSubordinates!.eMPLOYEENAME.toString()}" + "in your favorite list "),
|
||||
CircularAvatar(
|
||||
url: getEmployeeSubordinates!.eMPLOYEEIMAGE ?? "",
|
||||
height: 50,
|
||||
width: 50,
|
||||
isImageBase64: true,
|
||||
).paddingOnly(top: 21),
|
||||
// 16.width,
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
cancelButton,
|
||||
continueButton,
|
||||
],
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return alert;
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
GetMenuEntriesList getMenuEntries(String type) {
|
||||
List<GetMenuEntriesList> data = _EmployeeDetailsState.menuData.where((GetMenuEntriesList test) => test.functionName == type).toList();
|
||||
if (data.isNotEmpty) {
|
||||
return data[0];
|
||||
} else {
|
||||
return GetMenuEntriesList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,241 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mohem_flutter_app/api/my_team/my_team_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/string_extensions.dart';
|
||||
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
||||
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart';
|
||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
|
||||
class MyTeam extends StatefulWidget {
|
||||
const MyTeam({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyTeamState createState() => _MyTeamState();
|
||||
}
|
||||
|
||||
class _MyTeamState extends State<MyTeam> {
|
||||
String searchEmpEmail ="";
|
||||
String searchEmpName ="";
|
||||
String searchEmpNo = "";
|
||||
String? empId;
|
||||
List<GetEmployeeSubordinatesList> getEmployeeSubordinatesList = [];
|
||||
TextEditingController? _textEditingController = TextEditingController();
|
||||
List<GetEmployeeSubordinatesList> getEmployeeSListOnSearch = [];
|
||||
|
||||
String dropdownValue = 'Name';
|
||||
|
||||
void initState() {
|
||||
super.initState();
|
||||
getEmployeeSubordinates();
|
||||
}
|
||||
|
||||
void getEmployeeSubordinates() async {
|
||||
try {
|
||||
Utils.showLoading(context);
|
||||
getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString());
|
||||
getEmployeeSListOnSearch =getEmployeeSubordinatesList;
|
||||
Utils.hideLoading(context);
|
||||
setState(() {});
|
||||
} catch (ex) {
|
||||
Utils.hideLoading(context);
|
||||
Utils.handleException(ex, context, null);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBarWidget(
|
||||
context,
|
||||
title:"My Team Members",
|
||||
),
|
||||
backgroundColor: MyColors.backgroundColor,
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
margin: EdgeInsets.only(
|
||||
top: 28,
|
||||
left: 18,
|
||||
right: 18,
|
||||
// bottom: 28
|
||||
),
|
||||
padding: EdgeInsets.only( left: 10, right: 10),
|
||||
height: 65,
|
||||
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:
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children : <Widget>[
|
||||
Expanded(
|
||||
child:
|
||||
TextField(
|
||||
onChanged: dropdownValue =="Name" ?
|
||||
(String value){
|
||||
getEmployeeSListOnSearch = getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element)
|
||||
=> element.eMPLOYEENAME!.toLowerCase().contains(value.toLowerCase())).toList();
|
||||
setState(() {});
|
||||
}: (String value){
|
||||
getEmployeeSListOnSearch = getEmployeeSubordinatesList.where((GetEmployeeSubordinatesList element)
|
||||
=> element.eMPLOYEEEMAILADDRESS!.toLowerCase().contains(value.toLowerCase())).toList();
|
||||
setState(() {});
|
||||
},
|
||||
controller: _textEditingController,
|
||||
decoration: InputDecoration(
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
border: InputBorder.none,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
// contentPadding: EdgeInsets.fromLTRB(10, 15, 10, 15),
|
||||
hintText: 'Search by $dropdownValue',
|
||||
hintStyle: TextStyle(fontSize: 16.0, color: Colors.black,),
|
||||
),
|
||||
)),
|
||||
dropDown()
|
||||
]),
|
||||
),
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
_textEditingController!.text.isNotEmpty && getEmployeeSListOnSearch.isEmpty ?
|
||||
Container(
|
||||
child: "No Results found".toText16(color: MyColors.blackColor),).paddingOnly(top: 10)
|
||||
: ListView.builder(
|
||||
scrollDirection: Axis.vertical,
|
||||
shrinkWrap: true,
|
||||
physics: ScrollPhysics(),
|
||||
itemCount: _textEditingController!.text.isNotEmpty ? getEmployeeSListOnSearch.length : getEmployeeSubordinatesList.length,
|
||||
itemBuilder: (context, index) {
|
||||
var phoneNumber = Uri.parse('tel:${getEmployeeSListOnSearch[index].eMPLOYEEMOBILENUMBER}');
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
margin: EdgeInsets.only(
|
||||
top: 18,
|
||||
left: 18,
|
||||
right: 18,
|
||||
),
|
||||
padding: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
|
||||
// height: 110,
|
||||
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: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
|
||||
CircleAvatar(
|
||||
radius: 25,
|
||||
backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSListOnSearch[index].eMPLOYEEIMAGE)),
|
||||
backgroundColor: Colors.black,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
"Present".toText13(color: MyColors.greenColor),
|
||||
"${getEmployeeSListOnSearch[index].eMPLOYEENAME}".toText16(color: MyColors.blackColor),
|
||||
"${getEmployeeSListOnSearch[index].pOSITIONNAME}".toText13(color: MyColors.blackColor),
|
||||
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
launchUrl(phoneNumber);
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.whatsapp,
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async{
|
||||
Navigator.pushNamed(context,AppRoutes.employeeDetails,arguments: getEmployeeSListOnSearch[index]);
|
||||
// Navigator.of(context).push(MaterialPageRoute(builder: (context)=> EmployeeDetails(getEmployeeSubordinates: getEmployeeSubordinatesList[index])),);
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.arrow_forward_outlined,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
})
|
||||
],
|
||||
),
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Widget dropDown(){
|
||||
return DropdownButton<String>(
|
||||
value: dropdownValue,
|
||||
icon: const Icon(Icons.keyboard_arrow_down),
|
||||
elevation: 16,
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
dropdownValue = newValue!;
|
||||
});
|
||||
},
|
||||
items: <String>['Name', 'Email']
|
||||
.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
||||
import 'package:mohem_flutter_app/classes/colors.dart';
|
||||
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
||||
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
|
||||
import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart';
|
||||
import 'package:mohem_flutter_app/models/member_information_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart';
|
||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
|
||||
|
||||
class ProfileDetails extends StatefulWidget {
|
||||
const ProfileDetails({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ProfileDetailsState createState() => _ProfileDetailsState();
|
||||
}
|
||||
|
||||
class _ProfileDetailsState extends State<ProfileDetails> {
|
||||
|
||||
GetEmployeeSubordinatesList? getEmployeeSubordinates;
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList;
|
||||
return Scaffold(
|
||||
appBar: AppBarWidget(
|
||||
context,
|
||||
title: "Profile Details",
|
||||
),
|
||||
backgroundColor: MyColors.backgroundColor,
|
||||
body: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
margin: EdgeInsets.only(
|
||||
top: 28,
|
||||
left: 26,
|
||||
right: 26,
|
||||
),
|
||||
padding: EdgeInsets.only(left: 14, right: 14, top: 13, bottom: 20),
|
||||
height: 350,
|
||||
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: [
|
||||
LocaleKeys.category.tr().toText13(color: MyColors.lightGrayColor),
|
||||
"${getEmployeeSubordinates?.eMPLOYMENTCATEGORYMEANING}".toText16(isBold: true, color: MyColors.blackColor),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
LocaleKeys.address.tr().toText13(color: MyColors.lightGrayColor),
|
||||
"${getEmployeeSubordinates?.lOCATIONNAME}".toText16(isBold: true, color: MyColors.blackColor),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
LocaleKeys.phoneNumber.tr().toText13(color: MyColors.lightGrayColor),
|
||||
"${getEmployeeSubordinates?.eMPLOYEEMOBILENUMBER}".toText16(isBold: true, color: MyColors.blackColor),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
LocaleKeys.businessGroup.tr().toText13(color: MyColors.lightGrayColor),
|
||||
"${getEmployeeSubordinates?.bUSINESSGROUPNAME}".toText16(isBold: true, color: MyColors.blackColor),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
LocaleKeys.Payroll.tr().toText13(color: MyColors.lightGrayColor),
|
||||
"${getEmployeeSubordinates?.pAYROLLNAME}".toText16(isBold: true, color: MyColors.blackColor),
|
||||
]),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,156 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mohem_flutter_app/api/my_team/my_team_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/string_extensions.dart';
|
||||
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart';
|
||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class TeamMembers extends StatefulWidget {
|
||||
const TeamMembers({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_TeamMembersState createState() => _TeamMembersState();
|
||||
}
|
||||
|
||||
class _TeamMembersState extends State<TeamMembers> {
|
||||
String searchEmpEmail ="";
|
||||
String searchEmpName ="";
|
||||
String searchEmpNo = "";
|
||||
String? empId;
|
||||
List<GetEmployeeSubordinatesList> getEmployeeSubordinatesList = [];
|
||||
GetEmployeeSubordinatesList? getEmployeeSubordinates;
|
||||
|
||||
void initState() {
|
||||
super.initState();
|
||||
employeeSubordinates();
|
||||
setState(() {});
|
||||
|
||||
}
|
||||
|
||||
void employeeSubordinates() async {
|
||||
try {
|
||||
Utils.showLoading(context);
|
||||
getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString());
|
||||
getEmployeeSubordinatesList = await MyTeamApiClient().employeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString(),getEmployeeSubordinates?.eMPLOYEENUMBER);
|
||||
Utils.hideLoading(context);
|
||||
setState(() {});
|
||||
} catch (ex) {
|
||||
Utils.hideLoading(context);
|
||||
Utils.handleException(ex, context, null);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList;
|
||||
return Scaffold(
|
||||
appBar: AppBarWidget(
|
||||
context,
|
||||
title: "Team Members",
|
||||
),
|
||||
backgroundColor: MyColors.backgroundColor,
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
if(getEmployeeSubordinatesList != 0)
|
||||
ListView.builder(
|
||||
scrollDirection: Axis.vertical,
|
||||
shrinkWrap: true,
|
||||
physics: ScrollPhysics(),
|
||||
itemCount: getEmployeeSubordinatesList.length,
|
||||
itemBuilder: (context, index) {
|
||||
var phoneNumber = Uri.parse('tel:${getEmployeeSubordinatesList[index].eMPLOYEENUMBER}');
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
margin: EdgeInsets.only(
|
||||
top: 18,
|
||||
left: 18,
|
||||
right: 18,
|
||||
),
|
||||
padding: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
|
||||
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: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 25,
|
||||
backgroundImage: MemoryImage(Utils.getPostBytes(getEmployeeSubordinatesList[index].eMPLOYEEIMAGE)),
|
||||
backgroundColor: Colors.black,
|
||||
),
|
||||
// MyTeamImage()
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
"Present".toText13(color: MyColors.greenColor),
|
||||
"${getEmployeeSubordinatesList[index].eMPLOYEENAME}".toText16(color: MyColors.blackColor),
|
||||
"${getEmployeeSubordinatesList[index].pOSITIONNAME}".toText13(color: MyColors.blackColor),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
launchUrl(phoneNumber);
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.whatsapp,
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top:30),
|
||||
child: "No Members".toText16(isBold: true, color: MyColors.black),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
// SizedBox(height: 20),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Widget MyTeamImage() => CircleAvatar(
|
||||
radius: 30,
|
||||
//backgroundImage: MemoryImage(Utils.getPostBytes(memberInformationList.eMPLOYEEIMAGE)),
|
||||
backgroundColor: Colors.black,
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,569 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mohem_flutter_app/api/monthly_attendance_api_client.dart';
|
||||
import 'package:mohem_flutter_app/api/my_team/my_team_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/get_attendance_tracking_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart';
|
||||
import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart';
|
||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||
import 'package:mohem_flutter_app/widgets/circular_step_progress_bar.dart';
|
||||
import 'package:month_picker_dialog/month_picker_dialog.dart';
|
||||
import 'package:pie_chart/pie_chart.dart';
|
||||
import 'package:syncfusion_flutter_calendar/calendar.dart';
|
||||
|
||||
class ViewAttendance extends StatefulWidget {
|
||||
const ViewAttendance({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ViewAttendanceState createState() => _ViewAttendanceState();
|
||||
}
|
||||
|
||||
class _ViewAttendanceState extends State<ViewAttendance> {
|
||||
bool isPresent = false;
|
||||
bool isAbsent = false;
|
||||
bool isMissing = false;
|
||||
bool isOff = false;
|
||||
DateTime date = DateTime.now();
|
||||
late DateTime formattedDate;
|
||||
var currentMonth = DateTime.now().month;
|
||||
String searchMonth = getMonth(DateTime.now().month);
|
||||
int searchYear = DateTime.now().year;
|
||||
int? pRTPID;
|
||||
|
||||
String searchEmpEmail ="";
|
||||
String searchEmpName ="";
|
||||
String searchEmpNo = "";
|
||||
String? empId;
|
||||
List<GetEmployeeSubordinatesList> getEmployeeSubordinatesList = [];
|
||||
List<GetDayHoursTypeDetailsList> getDayHoursTypeDetailsList = [];
|
||||
GetTimeCardSummaryList? getTimeCardSummaryList;
|
||||
GetAttendanceTracking? attendanceTracking;
|
||||
GetEmployeeSubordinatesList? getEmployeeSubordinates;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
formattedDate = date;
|
||||
callTimeCardAndHourDetails(date.day, searchMonth, searchYear);
|
||||
// setState(() {});
|
||||
}
|
||||
|
||||
|
||||
void callTimeCardAndHourDetails(index, searchMonth, searchYear) async {
|
||||
try {
|
||||
Utils.showLoading(context);
|
||||
getEmployeeSubordinatesList = await MyTeamApiClient().getEmployeeSubordinates(searchEmpEmail.toString(), searchEmpName.toString(), searchEmpNo.toString());
|
||||
getTimeCardSummaryList = await MyTeamApiClient().getTimeCardSummary(searchMonth, searchYear,getEmployeeSubordinates?.eMPLOYEENUMBER);
|
||||
getDayHoursTypeDetailsList = await MyTeamApiClient().getDayHoursTypeDetails(searchMonth, searchYear, getEmployeeSubordinates?.eMPLOYEENUMBER);
|
||||
attendanceTracking = await MyTeamApiClient().getAttendanceTracking(getEmployeeSubordinates?.eMPLOYEENUMBER);
|
||||
Utils.hideLoading(context);
|
||||
_calendarController.displayDate = formattedDate;
|
||||
setState(() {});
|
||||
} catch (ex) {
|
||||
Utils.hideLoading(context);
|
||||
Utils.handleException(ex, context, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
final CalendarController _calendarController = CalendarController();
|
||||
final List<Color> _colorList = [Color(0xff2AB2AB), Color(0xff202529)];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
getEmployeeSubordinates ??= ModalRoute.of(context)?.settings.arguments as GetEmployeeSubordinatesList;
|
||||
Map<String, double> dataMap = {
|
||||
"Present": getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList!.aTTENDEDDAYS!.toDouble() : 0,
|
||||
"Absent": getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList!.aBSENTDAYS!.toDouble() : 0,
|
||||
};
|
||||
//if(getTimeCardSummaryList ==null)
|
||||
// callTimeCardAndHourDetails(date.day, searchMonth, searchYear);
|
||||
return Scaffold(
|
||||
appBar: AppBarWidget(
|
||||
context,
|
||||
title: "View Attendance",
|
||||
),
|
||||
backgroundColor: MyColors.backgroundColor,
|
||||
body: SingleChildScrollView(
|
||||
child: Column(children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
margin: EdgeInsets.only(
|
||||
top: 28,
|
||||
left: 18,
|
||||
right: 18,
|
||||
),
|
||||
padding: EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 16),
|
||||
// height: 120,
|
||||
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: [
|
||||
"Today's Attendance".toText20(color: MyColors.blackColor),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
LocaleKeys.checkIn.tr().toText12(isBold: true, color: MyColors.greenColor),
|
||||
"${(attendanceTracking?.pSwipeIn)?? "- - : - -"}".toText16(isBold: true, color: MyColors.grey57Color),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
LocaleKeys.checkOut.tr().toText12(isBold: true, color: MyColors.redColor),
|
||||
"${(attendanceTracking?.pSwipeOut)?? "- - : - -"}".toText16(isBold: true, color: MyColors.grey57Color),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
LocaleKeys.lateIn.tr().toText12(isBold: true, color: MyColors.blackColor),
|
||||
"${(attendanceTracking?.pLateInHours)?? "- - : - -"}".toText16(isBold: true, color: MyColors.grey57Color),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
margin: EdgeInsets.only(
|
||||
top: 18,
|
||||
left: 18,
|
||||
right: 18,
|
||||
bottom: 28,
|
||||
),
|
||||
padding: EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 16),
|
||||
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(
|
||||
children: [
|
||||
//20.height,
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
"${DateFormat("MMMM-yyyy").format(formattedDate)}".toText16(color: MyColors.blackColor),
|
||||
const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.blackColor),
|
||||
],
|
||||
).onPress(() async {
|
||||
showMonthPicker(
|
||||
context: context, //locale: EasyLocalization.of(context)?.locale,
|
||||
initialDate: formattedDate,
|
||||
firstDate: DateTime(searchYear - 2),
|
||||
lastDate: DateTime.now(),
|
||||
).then((selectedDate) {
|
||||
if (selectedDate != null) {
|
||||
searchMonth = getMonth(selectedDate.month);
|
||||
searchYear = selectedDate.year;
|
||||
formattedDate = selectedDate; //DateFormat('MMMM-yyyy').format(selectedDate);
|
||||
// _calendarController.selectedDate = formattedDate;
|
||||
callTimeCardAndHourDetails(selectedDate.day, searchMonth, searchYear);
|
||||
}
|
||||
});
|
||||
})
|
||||
],
|
||||
),
|
||||
18.height,
|
||||
AspectRatio(aspectRatio: 333 / 270, child: calendarWidget()),
|
||||
Row(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: [
|
||||
LocaleKeys.attendance.tr().toText12(isBold: true, color: MyColors.grey3AColor),
|
||||
LocaleKeys.stats.tr().toText24(isBold: true, color: MyColors.grey3AColor),
|
||||
],
|
||||
),
|
||||
30.height,
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
height: 8,
|
||||
width: 8,
|
||||
decoration: BoxDecoration(
|
||||
color: MyColors.lightGreenColor,
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(left: 5, right: 5),
|
||||
child: "${LocaleKeys.present.tr()} ${getTimeCardSummaryList?.aTTENDEDDAYS != null ? getTimeCardSummaryList?.aTTENDEDDAYS : 0}".toText16(isBold: true, color: MyColors.lightGreenColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
8.height,
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
height: 9,
|
||||
width: 9,
|
||||
decoration: BoxDecoration(
|
||||
color: MyColors.backgroundBlackColor,
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(left: 5, right: 5),
|
||||
child: "${LocaleKeys.absent.tr()} ${getTimeCardSummaryList?.aBSENTDAYS != null ? getTimeCardSummaryList?.aBSENTDAYS : 0 }".toText16(
|
||||
isBold: true,
|
||||
color: MyColors.backgroundBlackColor,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 170,
|
||||
height: 170,
|
||||
child: PieChart(
|
||||
dataMap: dataMap,
|
||||
animationDuration: const Duration(milliseconds: 800),
|
||||
chartLegendSpacing: 0,
|
||||
chartRadius: MediaQuery.of(context).size.width / 5.2,
|
||||
colorList: _colorList,
|
||||
initialAngleInDegree: 0,
|
||||
chartType: ChartType.ring,
|
||||
ringStrokeWidth: 80,
|
||||
legendOptions: const LegendOptions(
|
||||
showLegendsInRow: false,
|
||||
showLegends: false,
|
||||
),
|
||||
chartValuesOptions: const ChartValuesOptions(
|
||||
showChartValueBackground: false,
|
||||
showChartValues: true,
|
||||
showChartValuesInPercentage: true,
|
||||
showChartValuesOutside: false,
|
||||
decimalPlaces: 1,
|
||||
chartValueStyle: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
color: MyColors.white,
|
||||
)),
|
||||
),
|
||||
),
|
||||
],
|
||||
).paddingOnly(left: 21, right: 21, bottom: 21),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget calendarWidget() {
|
||||
return SfCalendar(
|
||||
view: CalendarView.month,
|
||||
showDatePickerButton: false,
|
||||
controller: _calendarController,
|
||||
backgroundColor: Colors.white,
|
||||
headerHeight: 0,
|
||||
viewNavigationMode: ViewNavigationMode.none,
|
||||
todayHighlightColor: MyColors.grey3AColor,
|
||||
showNavigationArrow: false,
|
||||
showCurrentTimeIndicator: false,
|
||||
showWeekNumber: false,
|
||||
cellBorderColor: Colors.white,
|
||||
selectionDecoration: BoxDecoration(
|
||||
border: Border.all(color: MyColors.white, width: 10),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(100)),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
dataSource: MeetingDataSource(_getDataSource()),
|
||||
monthViewSettings: const MonthViewSettings(
|
||||
dayFormat: 'EEE',
|
||||
showTrailingAndLeadingDates: false,
|
||||
showAgenda: false,
|
||||
//navigationDirection: MonthNavigationDirection.vertical,
|
||||
monthCellStyle: MonthCellStyle(
|
||||
textStyle: TextStyle(
|
||||
fontStyle: FontStyle.normal,
|
||||
fontSize: 13,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
viewHeaderStyle: const ViewHeaderStyle(
|
||||
dayTextStyle: TextStyle(color: MyColors.grey3AColor, fontSize: 13, fontWeight: FontWeight.w600),
|
||||
),
|
||||
monthCellBuilder: (build, details) {
|
||||
if (details.date.month == formattedDate.month && details.date.year == formattedDate.year) {
|
||||
int val = details.date.day;
|
||||
//check day is off
|
||||
if (getDayHoursTypeDetailsList.isNotEmpty) {
|
||||
if (getDayHoursTypeDetailsList?[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList?[val - 1].dAYTYPE == 'OFF') {
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
color: MyColors.greyACColor.withOpacity(.12),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"$val",
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: MyColors.greyA5Color,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
//check day is Present
|
||||
else if (getDayHoursTypeDetailsList?[val - 1].aTTENDEDFLAG == 'Y') {
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
transform: GradientRotation(.46),
|
||||
begin: Alignment.topRight,
|
||||
end: Alignment.bottomLeft,
|
||||
colors: [MyColors.gradiantEndColor, MyColors.gradiantStartColor],
|
||||
),
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
offset: const Offset(0, 2),
|
||||
blurRadius: 26,
|
||||
color: MyColors.blackColor.withOpacity(0.100),
|
||||
),
|
||||
],
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"$val",
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: MyColors.white,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
//check day is Absent
|
||||
else if (getDayHoursTypeDetailsList?[val - 1].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList?[val - 1].aBSENTFLAG == 'Y') {
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
color: MyColors.backgroundBlackColor,
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
offset: const Offset(0, 2),
|
||||
blurRadius: 26,
|
||||
color: MyColors.blackColor.withOpacity(0.100),
|
||||
),
|
||||
],
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"$val",
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: MyColors.white,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
return Container(
|
||||
margin: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: MyColors.backgroundBlackColor, width: 2.0, style: BorderStyle.solid), //Border.all
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
offset: const Offset(0, 2),
|
||||
blurRadius: 26,
|
||||
color: MyColors.blackColor.withOpacity(0.100),
|
||||
),
|
||||
],
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"$val",
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xff1F2428),
|
||||
),
|
||||
),
|
||||
);
|
||||
// return Container(
|
||||
// alignment: Alignment.center,
|
||||
// child: Text("$val"),
|
||||
// );
|
||||
} else {
|
||||
return const SizedBox();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
List<Meeting> _getDataSource() {
|
||||
final List<Meeting> meetings = <Meeting>[];
|
||||
return meetings;
|
||||
}
|
||||
|
||||
static String getMonth(int month) {
|
||||
switch (month) {
|
||||
case 1:
|
||||
return "January";
|
||||
case 2:
|
||||
return "February";
|
||||
case 3:
|
||||
return "March";
|
||||
case 4:
|
||||
return "April";
|
||||
case 5:
|
||||
return "May";
|
||||
case 6:
|
||||
return "June";
|
||||
case 7:
|
||||
return "July";
|
||||
case 8:
|
||||
return "August";
|
||||
case 9:
|
||||
return "September";
|
||||
case 10:
|
||||
return "October";
|
||||
case 11:
|
||||
return "November";
|
||||
case 12:
|
||||
return "December";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
static String getMonthAr(int month) {
|
||||
switch (month) {
|
||||
case 1:
|
||||
return 'يناير';
|
||||
case 2:
|
||||
return ' فبراير';
|
||||
case 3:
|
||||
return 'مارس';
|
||||
case 4:
|
||||
return 'أبريل';
|
||||
case 5:
|
||||
return 'مايو';
|
||||
case 6:
|
||||
return 'يونيو';
|
||||
case 7:
|
||||
return 'يوليو';
|
||||
case 8:
|
||||
return 'أغسطس';
|
||||
case 9:
|
||||
return 'سبتمبر';
|
||||
case 10:
|
||||
return ' اكتوبر';
|
||||
case 11:
|
||||
return ' نوفمبر';
|
||||
case 12:
|
||||
return 'ديسمبر';
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MeetingDataSource extends CalendarDataSource {
|
||||
MeetingDataSource(List<Meeting> source) {
|
||||
appointments = source;
|
||||
}
|
||||
|
||||
@override
|
||||
DateTime getStartTime(int index) {
|
||||
return _getMeetingData(index).from;
|
||||
}
|
||||
|
||||
@override
|
||||
DateTime getEndTime(int index) {
|
||||
return _getMeetingData(index).to;
|
||||
}
|
||||
|
||||
@override
|
||||
String getSubject(int index) {
|
||||
return _getMeetingData(index).eventName;
|
||||
}
|
||||
|
||||
@override
|
||||
Color getColor(int index) {
|
||||
return _getMeetingData(index).background;
|
||||
}
|
||||
|
||||
@override
|
||||
bool isAllDay(int index) {
|
||||
return _getMeetingData(index).isAllDay;
|
||||
}
|
||||
|
||||
Meeting _getMeetingData(int index) {
|
||||
final dynamic meeting = appointments;
|
||||
Meeting meetingData;
|
||||
if (meeting is Meeting) {
|
||||
meetingData = meeting;
|
||||
}
|
||||
return meeting;
|
||||
}
|
||||
}
|
||||
|
||||
class Meeting {
|
||||
Meeting(this.eventName, this.from, this.to, this.background, this.isAllDay);
|
||||
|
||||
String eventName;
|
||||
DateTime from;
|
||||
DateTime to;
|
||||
Color background;
|
||||
bool isAllDay;
|
||||
}
|
||||
@ -0,0 +1,197 @@
|
||||
|
||||
import 'package:easy_localization/src/public_ext.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:mohem_flutter_app/api/worklist/worklist_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/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/generic_response_model.dart';
|
||||
import 'package:mohem_flutter_app/models/get_user_item_type_list.dart';
|
||||
import 'package:mohem_flutter_app/models/update_user_item_type_list.dart';
|
||||
import 'package:mohem_flutter_app/models/worklist/update_user_type_list.dart';
|
||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
||||
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
|
||||
|
||||
class WorklistSettings extends StatefulWidget {
|
||||
const WorklistSettings({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_WorklistSettingsState createState() => _WorklistSettingsState();
|
||||
}
|
||||
|
||||
class _WorklistSettingsState extends State<WorklistSettings> {
|
||||
List<GetUserItemTypesList> getUserItemTypesList = [];
|
||||
UpdateUserItemTypesList? updateUserItemTypesList;
|
||||
|
||||
|
||||
void initState() {
|
||||
super.initState();
|
||||
userItemTypesList();
|
||||
}
|
||||
|
||||
void userItemTypesList() async {
|
||||
try {
|
||||
Utils.showLoading(context);
|
||||
getUserItemTypesList = await WorkListApiClient().getUserItemTypes();
|
||||
Utils.hideLoading(context);
|
||||
setState(() {});
|
||||
} catch (ex) {
|
||||
Utils.hideLoading(context);
|
||||
Utils.handleException(ex, context, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void updateUserItem() async {
|
||||
try {
|
||||
Utils.showLoading(context);
|
||||
List<Map<String, dynamic>> itemList=[];
|
||||
for (var element in getUserItemTypesList) {
|
||||
|
||||
itemList.add(UpdateUserTypesList(itemID: element.uSERITEMTYPEID, pITEMTYPE: element.iTEMTYPE,pFYAENABLEDFALG: element.fYAENABLEDFALG, pFYIENABLEDFALG: element.fYIENABLEDFLAG).toJson());
|
||||
|
||||
}
|
||||
updateUserItemTypesList = await WorkListApiClient().updateUserItemTypes(itemList);
|
||||
Utils.hideLoading(context);
|
||||
Navigator.pushNamed(context, AppRoutes.workList);
|
||||
setState(() {});
|
||||
} catch (ex) {
|
||||
Utils.hideLoading(context);
|
||||
Utils.handleException(ex, context, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(backgroundColor: Colors.white,
|
||||
appBar: AppBarWidget(
|
||||
context,
|
||||
title: "Worklist Settings",
|
||||
),
|
||||
body:Container(
|
||||
margin: const EdgeInsets.only(top: 21, left: 21, right: 21),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
child: "Turn on notifications for".tr().toText22(color: MyColors.blackColor),
|
||||
).paddingOnly(top: 10, bottom: 50),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
child: "Item Type".tr().toText14(color: MyColors.blackColor) ,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Container(
|
||||
child: "FYA".tr().toText14(color: MyColors.blackColor) ,
|
||||
),
|
||||
Container(
|
||||
child: "FYI".tr().toText14(color: MyColors.blackColor) ,
|
||||
).paddingOnly(left: 30, right: 30),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
Divider(
|
||||
color: MyColors.greyA5Color,
|
||||
),
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.vertical,
|
||||
shrinkWrap: true,
|
||||
physics: ScrollPhysics(),
|
||||
itemCount: getUserItemTypesList == null ? 0 : getUserItemTypesList.length,
|
||||
itemBuilder: (BuildContext context,int index) {
|
||||
return Container(
|
||||
child: Column(
|
||||
children:[
|
||||
|
||||
customSwitch(getUserItemTypesList[index]),
|
||||
]
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
)
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: MyColors.white,
|
||||
boxShadow: [
|
||||
BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3),
|
||||
],
|
||||
),
|
||||
child: DefaultButton(
|
||||
LocaleKeys.submit.tr(), () async {
|
||||
updateUserItem();
|
||||
}
|
||||
)
|
||||
.insideContainer,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget customSwitch(GetUserItemTypesList list){
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 21),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(list.iTEMTYPE.toString(), style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: MyColors.blackColor
|
||||
),),
|
||||
const Spacer(),
|
||||
Row(
|
||||
children: [
|
||||
CupertinoSwitch(
|
||||
trackColor: Colors.grey,
|
||||
activeColor: MyColors.gradiantEndColor,
|
||||
value: list?.fYAENABLEDFALG =='Y' ?true : false,
|
||||
onChanged: (value){
|
||||
setState(() {
|
||||
list?.fYAENABLEDFALG = value == true ? 'Y': 'N';
|
||||
});
|
||||
}
|
||||
),
|
||||
CupertinoSwitch(
|
||||
trackColor: Colors.grey,
|
||||
activeColor: MyColors.gradiantEndColor,
|
||||
value: list?.fYIENABLEDFLAG =='Y' ?true : false,
|
||||
onChanged: (value){
|
||||
setState(() {
|
||||
// list.isFYI = value;
|
||||
list?.fYIENABLEDFLAG = value ==true ? 'Y': 'N';
|
||||
});
|
||||
}
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue