fix profile

merge-requests/1/merge
Fatimah Alshammari 2 years ago
parent b281efe14c
commit 393e28b32c

@ -0,0 +1,73 @@
import 'dart:async';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/models/generic_response_model.dart';
import 'package:mohem_flutter_app/models/get_employee_address_model.dart';
import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart';
import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart';
import 'package:mohem_flutter_app/models/get_employee_phones_model.dart';
import 'api_client.dart';
class ProfileApiClient {
static final ProfileApiClient _instance = ProfileApiClient._internal();
ProfileApiClient._internal();
factory ProfileApiClient() => _instance;
Future<GetEmployeeContactsList?> getEmployeeContacts() async {
String url = "${ApiConsts.erpRest}GET_EMPLOYEE_CONTACTS";
Map<String, dynamic> postParams = {
"P_MENU_TYPE": "E",
"P_SELECTED_RESP_ID": -999,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return (responseData.getEmployeeContactsList?.length ?? 0) > 0 ? responseData.getEmployeeContactsList!.first : null;
}, url, postParams);
}
Future<List<GetEmployeeBasicDetailsList>> getEmployeeBasicDetails() async {
String url = "${ApiConsts.erpRest}GET_EMPLOYEE_BASIC_DETAILS";
Map<String, dynamic> postParams = {
"P_MENU_TYPE": "E",
"P_SELECTED_RESP_ID": -999,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return responseData.getEmployeeBasicDetailsList ?? [];
}, url, postParams);
}
Future<GetEmployeePhonesList?> getEmployeePhones() async {
String url = "${ApiConsts.erpRest}GET_EMPLOYEE_PHONES";
Map<String, dynamic> postParams = {
"P_MENU_TYPE": "E",
"P_SELECTED_RESP_ID": -999,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return (responseData.getEmployeePhonesList?.length ?? 0) > 0 ? responseData.getEmployeePhonesList!.first : null;
}, url, postParams);
}
Future<GetEmployeeAddressList?> getEmployeeAddress() async {
String url = "${ApiConsts.erpRest}GET_EMPLOYEE_ADDRESS";
Map<String, dynamic> postParams = {
"P_MENU_TYPE": "E",
"P_SELECTED_RESP_ID": -999,
};
postParams.addAll(AppState().postParamsJson);
return await ApiClient().postJsonForObject((json) {
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
return (responseData.getEmployeeAddressList?.length ?? 0) > 0 ? responseData.getEmployeeAddressList!.first : null;
}, url, postParams);
}
}

@ -36,4 +36,5 @@ class MyColors {
static const Color blackColor = Color(0xff000014);
static const Color grey3AColor = Color(0xff2E303A);
static const Color darkColor = Color(0xff000015);
static const Color lightGrayColor = Color(0xff808080);
}

@ -11,6 +11,7 @@ import 'package:mohem_flutter_app/ui/work_list/missing_swipe/missing_swipe_scree
import 'package:mohem_flutter_app/ui/work_list/work_list_screen.dart';
import 'package:mohem_flutter_app/ui/bottom_sheets/attendence_details_bottom_sheet.dart';
import 'package:mohem_flutter_app/ui/attendance/monthly_attendance.dart';
import 'package:mohem_flutter_app/ui/profile/profile.dart';
class AppRoutes {
static const String splash = "/splash";
@ -39,6 +40,9 @@ class AppRoutes {
//Bottom Sheet
static const String attendanceDetailsBottomSheet = "/attendanceDetailsBottomSheet";
//Profile
static const String profile = "/profile";
static final Map<String, WidgetBuilder> routes = {
login: (context) => LoginScreen(),
verifyLogin: (context) => VerifyLoginScreen(),
@ -59,5 +63,8 @@ class AppRoutes {
//Bottom Sheet
attendanceDetailsBottomSheet: (context) => AttendenceDetailsBottomSheet(),
//Profile
profile: (context) => Profile(),
};
}

@ -3,6 +3,9 @@ import 'package:mohem_flutter_app/models/get_action_history_list_model.dart';
import 'package:mohem_flutter_app/models/get_attachement_list_model.dart';
import 'package:mohem_flutter_app/models/get_basic_det_ntf_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_day_hours_type_details_list_model.dart';
import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart';
import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart';
import 'package:mohem_flutter_app/models/get_employee_phones_model.dart';
import 'package:mohem_flutter_app/models/get_item_creation_ntf_body_list_model.dart';
import 'package:mohem_flutter_app/models/get_mo_Item_history_list_model.dart';
import 'package:mohem_flutter_app/models/get_mo_notification_body_list_model.dart';
@ -114,10 +117,10 @@ class GenericResponseModel {
List<String>? getEITDFFStructureList;
List<String>? getEITTransactionList;
List<String>? getEarningsList;
List<String>? getEmployeeAddressList;
List<String>? getEmployeeBasicDetailsList;
List<String>? getEmployeeContactsList;
List<String>? getEmployeePhonesList;
List<dynamic>? getEmployeeAddressList;
List<GetEmployeeBasicDetailsList>? getEmployeeBasicDetailsList;
List<GetEmployeeContactsList>? getEmployeeContactsList;
List<GetEmployeePhonesList>? getEmployeePhonesList;
List<String>? getEmployeeSubordinatesList;
List<String>? getFliexfieldStructureList;
List<String>? getHrCollectionNotificationBodyList;
@ -653,10 +656,31 @@ class GenericResponseModel {
getEITDFFStructureList = json['GetEITDFFStructureList'];
getEITTransactionList = json['GetEITTransactionList'];
getEarningsList = json['GetEarningsList'];
getEmployeeAddressList = json['GetEmployeeAddressList'];
getEmployeeBasicDetailsList = json['GetEmployeeBasicDetailsList'];
getEmployeeContactsList = json['GetEmployeeContactsList'];
getEmployeePhonesList = json['GetEmployeePhonesList'];
if (json['GetEmployeeAddressList'] != null) {
getEmployeeAddressList = <dynamic>[];
json['GetEmployeeAddressList'].forEach((v) {
getEmployeeAddressList!.add(dynamic);
});
}
if (json['GetEmployeeBasicDetailsList'] != null) {
getEmployeeBasicDetailsList = <GetEmployeeBasicDetailsList>[];
json['GetEmployeeBasicDetailsList'].forEach((v) {
getEmployeeBasicDetailsList!
.add(new GetEmployeeBasicDetailsList.fromJson(v));
});
}
if (json['GetEmployeeContactsList'] != null) {
getEmployeeContactsList = <GetEmployeeContactsList>[];
json['GetEmployeeContactsList'].forEach((v) {
getEmployeeContactsList!.add(new GetEmployeeContactsList.fromJson(v));
});
}
if (json['GetEmployeePhonesList'] != null) {
getEmployeePhonesList = <GetEmployeePhonesList>[];
json['GetEmployeePhonesList'].forEach((v) {
getEmployeePhonesList!.add(new GetEmployeePhonesList.fromJson(v));
});
}
getEmployeeSubordinatesList = json['GetEmployeeSubordinatesList'];
getFliexfieldStructureList = json['GetFliexfieldStructureList'];
getHrCollectionNotificationBodyList = json['GetHrCollectionNotificationBodyList'];
@ -1033,10 +1057,22 @@ class GenericResponseModel {
data['GetEITDFFStructureList'] = this.getEITDFFStructureList;
data['GetEITTransactionList'] = this.getEITTransactionList;
data['GetEarningsList'] = this.getEarningsList;
data['GetEmployeeAddressList'] = this.getEmployeeAddressList;
data['GetEmployeeBasicDetailsList'] = this.getEmployeeBasicDetailsList;
data['GetEmployeeContactsList'] = this.getEmployeeContactsList;
data['GetEmployeePhonesList'] = this.getEmployeePhonesList;
if (this.getEmployeeAddressList != null) {
data['GetEmployeeAddressList'] =
this.getEmployeeAddressList!.map((v) => v.toJson()).toList();
}
if (this.getEmployeeBasicDetailsList != null) {
data['GetEmployeeBasicDetailsList'] =
this.getEmployeeBasicDetailsList!.map((v) => v.toJson()).toList();
}
if (this.getEmployeeContactsList != null) {
data['GetEmployeeContactsList'] =
this.getEmployeeContactsList!.map((v) => v.toJson()).toList();
}
if (this.getEmployeePhonesList != null) {
data['GetEmployeePhonesList'] =
this.getEmployeePhonesList!.map((v) => v.toJson()).toList();
}
data['GetEmployeeSubordinatesList'] = this.getEmployeeSubordinatesList;
data['GetFliexfieldStructureList'] = this.getFliexfieldStructureList;
data['GetHrCollectionNotificationBodyList'] = this.getHrCollectionNotificationBodyList;

@ -0,0 +1,4 @@
class GetEmployeeAddressList {
}

@ -0,0 +1,53 @@
class GetEmployeeBasicDetailsList {
String? aPPLICATIONCOLUMNNAME;
String? dATATYPE;
String? dATEVALUE;
String? dISPLAYFLAG;
int? gROUPNUM;
int? nUMBERVALUE;
String? sEGMENTPROMPT;
int? sEGMENTSEQNUM;
String? sEGMENTVALUEDSP;
String? vARCHAR2VALUE;
GetEmployeeBasicDetailsList(
{this.aPPLICATIONCOLUMNNAME,
this.dATATYPE,
this.dATEVALUE,
this.dISPLAYFLAG,
this.gROUPNUM,
this.nUMBERVALUE,
this.sEGMENTPROMPT,
this.sEGMENTSEQNUM,
this.sEGMENTVALUEDSP,
this.vARCHAR2VALUE});
GetEmployeeBasicDetailsList.fromJson(Map<String, dynamic> json) {
aPPLICATIONCOLUMNNAME = json['APPLICATION_COLUMN_NAME'];
dATATYPE = json['DATATYPE'];
dATEVALUE = json['DATE_VALUE'];
dISPLAYFLAG = json['DISPLAY_FLAG'];
gROUPNUM = json['GROUP_NUM'];
nUMBERVALUE = json['NUMBER_VALUE'];
sEGMENTPROMPT = json['SEGMENT_PROMPT'];
sEGMENTSEQNUM = json['SEGMENT_SEQ_NUM'];
sEGMENTVALUEDSP = json['SEGMENT_VALUE_DSP'];
vARCHAR2VALUE = json['VARCHAR2_VALUE'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME;
data['DATATYPE'] = this.dATATYPE;
data['DATE_VALUE'] = this.dATEVALUE;
data['DISPLAY_FLAG'] = this.dISPLAYFLAG;
data['GROUP_NUM'] = this.gROUPNUM;
data['NUMBER_VALUE'] = this.nUMBERVALUE;
data['SEGMENT_PROMPT'] = this.sEGMENTPROMPT;
data['SEGMENT_SEQ_NUM'] = this.sEGMENTSEQNUM;
data['SEGMENT_VALUE_DSP'] = this.sEGMENTVALUEDSP;
data['VARCHAR2_VALUE'] = this.vARCHAR2VALUE;
return data;
}
}

@ -0,0 +1,45 @@
class GetEmployeeContactsList {
String? cONTACTNAME;
int? cONTACTPERSONID;
int? cONTACTRELATIONSHIPID;
String? cONTACTTYPE;
String? dATEOFBIRTH;
int? pERSONID;
String? pRIMARYCONTACTFLAG;
String? rELATIONSHIP;
GetEmployeeContactsList(
{this.cONTACTNAME,
this.cONTACTPERSONID,
this.cONTACTRELATIONSHIPID,
this.cONTACTTYPE,
this.dATEOFBIRTH,
this.pERSONID,
this.pRIMARYCONTACTFLAG,
this.rELATIONSHIP});
GetEmployeeContactsList.fromJson(Map<String, dynamic> json) {
cONTACTNAME = json['CONTACT_NAME'];
cONTACTPERSONID = json['CONTACT_PERSON_ID'];
cONTACTRELATIONSHIPID = json['CONTACT_RELATIONSHIP_ID'];
cONTACTTYPE = json['CONTACT_TYPE'];
dATEOFBIRTH = json['DATE_OF_BIRTH'];
pERSONID = json['PERSON_ID'];
pRIMARYCONTACTFLAG = json['PRIMARY_CONTACT_FLAG'];
rELATIONSHIP = json['RELATIONSHIP'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['CONTACT_NAME'] = this.cONTACTNAME;
data['CONTACT_PERSON_ID'] = this.cONTACTPERSONID;
data['CONTACT_RELATIONSHIP_ID'] = this.cONTACTRELATIONSHIPID;
data['CONTACT_TYPE'] = this.cONTACTTYPE;
data['DATE_OF_BIRTH'] = this.dATEOFBIRTH;
data['PERSON_ID'] = this.pERSONID;
data['PRIMARY_CONTACT_FLAG'] = this.pRIMARYCONTACTFLAG;
data['RELATIONSHIP'] = this.rELATIONSHIP;
return data;
}
}

@ -0,0 +1,53 @@
class GetEmployeePhonesList {
String? dATEFROM;
String? dATETO;
int? oBJECTVERSIONNUMBER;
int? pARENTID;
String? pARENTTABLE;
int? pHONEID;
String? pHONENUMBER;
String? pHONETYPE;
String? pHONETYPEMEANING;
int? rOWINDEX;
GetEmployeePhonesList(
{this.dATEFROM,
this.dATETO,
this.oBJECTVERSIONNUMBER,
this.pARENTID,
this.pARENTTABLE,
this.pHONEID,
this.pHONENUMBER,
this.pHONETYPE,
this.pHONETYPEMEANING,
this.rOWINDEX});
GetEmployeePhonesList.fromJson(Map<String, dynamic> json) {
dATEFROM = json['DATE_FROM'];
dATETO = json['DATE_TO'];
oBJECTVERSIONNUMBER = json['OBJECT_VERSION_NUMBER'];
pARENTID = json['PARENT_ID'];
pARENTTABLE = json['PARENT_TABLE'];
pHONEID = json['PHONE_ID'];
pHONENUMBER = json['PHONE_NUMBER'];
pHONETYPE = json['PHONE_TYPE'];
pHONETYPEMEANING = json['PHONE_TYPE_MEANING'];
rOWINDEX = json['ROW_INDEX'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['DATE_FROM'] = this.dATEFROM;
data['DATE_TO'] = this.dATETO;
data['OBJECT_VERSION_NUMBER'] = this.oBJECTVERSIONNUMBER;
data['PARENT_ID'] = this.pARENTID;
data['PARENT_TABLE'] = this.pARENTTABLE;
data['PHONE_ID'] = this.pHONEID;
data['PHONE_NUMBER'] = this.pHONENUMBER;
data['PHONE_TYPE'] = this.pHONETYPE;
data['PHONE_TYPE_MEANING'] = this.pHONETYPEMEANING;
data['ROW_INDEX'] = this.rOWINDEX;
return data;
}
}

@ -64,7 +64,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
8.width,
SvgPicture.asset("assets/images/side_nav.svg"),
],
).onPress(() {}),
).onPress(() {
Navigator.pushNamed(context, AppRoutes.profile);
}),
Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,

@ -0,0 +1,288 @@
import 'package:easy_localization/src/public_ext.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/api/profile_api_client.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/utils.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart';
import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart';
class Profile extends StatefulWidget {
const Profile({Key? key}) : super(key: key);
@override
_ProfileState createState() => _ProfileState();
}
class _ProfileState extends State<Profile> {
String? fullName = "";
String? maritalStatus = "";
String? birthDate = "";
String? civilIdentityNumber = "";
String? emailAddress = "";
String? employeeNo = "";
List<GetEmployeeBasicDetailsList> getEmployeeBasicDetailsList = [];
@override
void initState() {
super.initState();
getEmployeeBasicDetails();
basicDetails();
}
void getEmployeeBasicDetails() async {
try {
Utils.showLoading(context);
getEmployeeBasicDetailsList = await ProfileApiClient().getEmployeeBasicDetails();
Utils.hideLoading(context);
basicDetails();
print("getEmployeeBasicDetailsList.length");
print(getEmployeeBasicDetailsList.length);
setState(() {});
} catch (ex) {
Utils.hideLoading(context);
Utils.handleException(ex, context, null);
}
}
basicDetails() {
for (int i = 0; i < getEmployeeBasicDetailsList.length; i++) {
if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'FULL_NAME') {
fullName = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP;
} else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'MARITAL_STATUS') {
maritalStatus = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP;
} else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'DATE_OF_BIRTH') {
birthDate = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP;
} else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'NATIONAL_IDENTIFIER') {
civilIdentityNumber = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP;
} else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'EMAIL_ADDRESS') {
emailAddress = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP;
} else if (getEmployeeBasicDetailsList[i].aPPLICATIONCOLUMNNAME == 'EMPLOYEE_NUMBER') {
employeeNo = getEmployeeBasicDetailsList[i].sEGMENTVALUEDSP;
}
}
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: MyColors.lightGreenColor,
leading: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
IconButton(
icon: const Icon(
Icons.arrow_back_ios,
color: MyColors.backgroundBlackColor,
),
onPressed: () => Navigator.pop(context),
),
],
),
),
backgroundColor: MyColors.lightGreenColor,
body: Stack(children: [
Align(
alignment: Alignment.topRight,
child: Container(
height: 30,
width: 80,
padding: EdgeInsets.only(left: 10.0, right: 10.0, top: 5, bottom: 5),
decoration: BoxDecoration(
border: Border.all(
color: MyColors.gradiantEndColor,
style: BorderStyle.solid,
),
color: MyColors.gradiantEndColor,
borderRadius: BorderRadius.circular(100.0)),
child: InkWell(
onTap: () {},
child: RichText(
text: TextSpan(
children: [
WidgetSpan(
child: Icon(
Icons.image,
size: 20,
color: Colors.white,
),
),
TextSpan(
text: " Edit",
),
],
),
),
)),
),
Container(
width: double.infinity,
margin: EdgeInsets.only(top: 48),
height: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(topLeft: Radius.circular(30.0), topRight: Radius.circular(30.0)),
),
child: Column(
children: [
"${fullName}".toText20(isBold: true, color: MyColors.blackColor),
"${employeeNo}".toText12(isBold: false, color: MyColors.lightGrayColor),
"${emailAddress}".toText12(isBold: false, color: MyColors.black),
SizedBox(
height: 5,
),
Divider(
color: MyColors.lightGreyE6Color,
height: 20,
thickness: 8,
indent: 0,
endIndent: 0,
),
Container(
padding: EdgeInsets.only(left: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
InkWell(
onTap: () {
},
child: Row(
children: <Widget>[
SizedBox(
width: 15,
),
"Personal Information".toText16(isBold: true, color: MyColors.grey3AColor),
],
),
),
SizedBox(
height: 5,
),
InkWell(
onTap: () {
},
child: Row(
children: <Widget>[
SizedBox(
width: 15,
),
"Basic Details".toText16(isBold: true, color: MyColors.grey3AColor),
],
),
),
SizedBox(
height: 5,
),
InkWell(
onTap: () {
},
child: Row(
children: <Widget>[
SizedBox(
width: 20,
),
"Contact Details".toText16(isBold: true, color: MyColors.grey3AColor),
],
),
),
SizedBox(
height: 5,
),
InkWell(
onTap: () {
},
child: Row(
children: <Widget>[
SizedBox(
width: 20,
),
"Family Members".toText16(isBold: true, color: MyColors.grey3AColor),
],
),
),
SizedBox(
height: 5,
),
],
),
),
],
).paddingOnly( top: 35, bottom: 36),
),
Align(
alignment: Alignment.topCenter,
child: SizedBox(
child: CircleAvatar(
radius: 40.0,
backgroundColor: Colors.white,
child: CircleAvatar(
child: Align(
alignment: Alignment.bottomRight,
// child: CircleAvatar(
// backgroundColor: Colors.white,
// radius: 12.0,
// child: Icon(
// Icons.camera_alt,
// size: 15.0,
// color: Color(0xFF404040),
// ),
// ),
),
radius: 38.0,
// url:"",
),
),
)),
])
// Container(
// margin: const EdgeInsets.only(top:50),
// decoration: const BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(30.0),
// topRight: Radius.circular(30.0))
// ),
// // color: MyColors.white,
// child: Stack(
// children: [
// Container(
// height: 30,
// color: MyColors.lightGreenColor,
// margin: const EdgeInsets.only(bottom: 20,),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// CircleAvatar(
// backgroundColor: Colors.grey.shade800,
// ),
// ],
// ),
// ),
// ListView(
// scrollDirection: Axis.vertical,
// children: [
// Column(
// children: [
// // 20.height,
// ],
// )
// ],
// ),
// ]
// ),
// ),
);
}
}
Loading…
Cancel
Save