From 6529c2aeba99e9afeb12b4acb64ea57b9ec4a214 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Sun, 29 May 2022 10:56:28 +0300 Subject: [PATCH] profile pages --- lib/api/profile_api_client.dart | 12 +- lib/classes/colors.dart | 1 + lib/config/routes.dart | 13 + lib/models/generic_response_model.dart | 3 +- lib/models/get_employee_address_model.dart | 50 +++- lib/ui/landing/dashboard_screen.dart | 2 +- lib/ui/profile/basic_details.dart | 151 ++++++++++++ lib/ui/profile/contact_details.dart | 188 +++++++++++++++ lib/ui/profile/family_members.dart | 263 +++++++++++++++++++++ lib/ui/profile/personal_info.dart | 124 ++++++++++ lib/ui/profile/profile.dart | 3 +- 11 files changed, 799 insertions(+), 11 deletions(-) create mode 100644 lib/ui/profile/basic_details.dart create mode 100644 lib/ui/profile/contact_details.dart create mode 100644 lib/ui/profile/family_members.dart create mode 100644 lib/ui/profile/personal_info.dart diff --git a/lib/api/profile_api_client.dart b/lib/api/profile_api_client.dart index 9109815..9d9056e 100644 --- a/lib/api/profile_api_client.dart +++ b/lib/api/profile_api_client.dart @@ -19,7 +19,7 @@ class ProfileApiClient { factory ProfileApiClient() => _instance; - Future getEmployeeContacts() async { + Future> getEmployeeContacts() async { String url = "${ApiConsts.erpRest}GET_EMPLOYEE_CONTACTS"; Map postParams = { "P_MENU_TYPE": "E", @@ -28,7 +28,7 @@ class ProfileApiClient { postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); - return (responseData.getEmployeeContactsList?.length ?? 0) > 0 ? responseData.getEmployeeContactsList!.first : null; + return responseData.getEmployeeContactsList ?? []; }, url, postParams); } @@ -45,7 +45,7 @@ class ProfileApiClient { }, url, postParams); } - Future getEmployeePhones() async { + Future> getEmployeePhones() async { String url = "${ApiConsts.erpRest}GET_EMPLOYEE_PHONES"; Map postParams = { "P_MENU_TYPE": "E", @@ -54,11 +54,11 @@ class ProfileApiClient { postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); - return (responseData.getEmployeePhonesList?.length ?? 0) > 0 ? responseData.getEmployeePhonesList!.first : null; + return responseData.getEmployeePhonesList ?? []; }, url, postParams); } - Future getEmployeeAddress() async { + Future> getEmployeeAddress() async { String url = "${ApiConsts.erpRest}GET_EMPLOYEE_ADDRESS"; Map postParams = { "P_MENU_TYPE": "E", @@ -67,7 +67,7 @@ class ProfileApiClient { postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); - return (responseData.getEmployeeAddressList?.length ?? 0) > 0 ? responseData.getEmployeeAddressList!.first : null; + return responseData.getEmployeeAddressList ?? []; }, url, postParams); } } \ No newline at end of file diff --git a/lib/classes/colors.dart b/lib/classes/colors.dart index 08ce1c5..5386adf 100644 --- a/lib/classes/colors.dart +++ b/lib/classes/colors.dart @@ -37,4 +37,5 @@ class MyColors { static const Color grey3AColor = Color(0xff2E303A); static const Color darkColor = Color(0xff000015); static const Color lightGrayColor = Color(0xff808080); + static const Color DarkRedColor = Color(0xffD02127); } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 2735ed1..145b512 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -6,12 +6,17 @@ import 'package:mohem_flutter_app/ui/login/login_screen.dart'; import 'package:mohem_flutter_app/ui/login/new_password_screen.dart'; import 'package:mohem_flutter_app/ui/login/verify_last_login_screen.dart'; import 'package:mohem_flutter_app/ui/login/verify_login_screen.dart'; +import 'package:mohem_flutter_app/ui/profile/family_members.dart'; import 'package:mohem_flutter_app/ui/work_list/item_history_screen.dart'; import 'package:mohem_flutter_app/ui/work_list/missing_swipe/missing_swipe_screen.dart'; 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'; +import 'package:mohem_flutter_app/ui/profile/personal_info.dart'; +import 'package:mohem_flutter_app/ui/profile/basic_details.dart'; +import 'package:mohem_flutter_app/ui/profile/contact_details.dart'; +import 'package:mohem_flutter_app/ui/profile/family_members.dart'; class AppRoutes { static const String splash = "/splash"; @@ -42,6 +47,10 @@ class AppRoutes { //Profile static const String profile = "/profile"; + static const String personalInfo = "/personalInfo"; + static const String basicDetails = "/basicDetails"; + static const String contactDetails = "/contactDetails"; + static const String familyMembers = "/familyMembers"; static final Map routes = { login: (context) => LoginScreen(), @@ -66,5 +75,9 @@ class AppRoutes { //Profile profile: (context) => Profile(), + personalInfo: (context) => PesonalInfo(), + basicDetails: (context) => BasicDetails(), + contactDetails: (context) => ContactDetails(), + familyMembers: (context) => FamilyMembers(), }; } diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 98fbe1b..eeecaa5 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -3,6 +3,7 @@ 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_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'; @@ -117,7 +118,7 @@ class GenericResponseModel { List? getEITDFFStructureList; List? getEITTransactionList; List? getEarningsList; - List? getEmployeeAddressList; + List? getEmployeeAddressList; List? getEmployeeBasicDetailsList; List? getEmployeeContactsList; List? getEmployeePhonesList; diff --git a/lib/models/get_employee_address_model.dart b/lib/models/get_employee_address_model.dart index 6770264..1033797 100644 --- a/lib/models/get_employee_address_model.dart +++ b/lib/models/get_employee_address_model.dart @@ -1,4 +1,50 @@ -class GetEmployeeAddressList { -} \ No newline at end of file + class GetEmployeeAddressList { + String? aPPLICATIONCOLUMNNAME; + String? dATATYPE; + String? dATEVALUE; + String? dISPLAYFLAG; + Null? nUMBERVALUE; + String? sEGMENTPROMPT; + int? sEGMENTSEQNUM; + String? sEGMENTVALUEDSP; + String? vARCHAR2VALUE; + + GetEmployeeAddressList( + {this.aPPLICATIONCOLUMNNAME, + this.dATATYPE, + this.dATEVALUE, + this.dISPLAYFLAG, + this.nUMBERVALUE, + this.sEGMENTPROMPT, + this.sEGMENTSEQNUM, + this.sEGMENTVALUEDSP, + this.vARCHAR2VALUE}); + + GetEmployeeAddressList.fromJson(Map json) { + aPPLICATIONCOLUMNNAME = json['APPLICATION_COLUMN_NAME']; + dATATYPE = json['DATATYPE']; + dATEVALUE = json['DATE_VALUE']; + dISPLAYFLAG = json['DISPLAY_FLAG']; + nUMBERVALUE = json['NUMBER_VALUE']; + sEGMENTPROMPT = json['SEGMENT_PROMPT']; + sEGMENTSEQNUM = json['SEGMENT_SEQ_NUM']; + sEGMENTVALUEDSP = json['SEGMENT_VALUE_DSP']; + vARCHAR2VALUE = json['VARCHAR2_VALUE']; + } + + Map toJson() { + final Map data = new Map(); + data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; + data['DATATYPE'] = this.dATATYPE; + data['DATE_VALUE'] = this.dATEVALUE; + data['DISPLAY_FLAG'] = this.dISPLAYFLAG; + 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; + } + } diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 8acbbd2..6e10b6c 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -65,7 +65,7 @@ class _DashboardScreenState extends State { SvgPicture.asset("assets/images/side_nav.svg"), ], ).onPress(() { - Navigator.pushNamed(context, AppRoutes.profile); + Navigator.pushNamed(context, AppRoutes.personalInfo); }), Expanded( child: Row( diff --git a/lib/ui/profile/basic_details.dart b/lib/ui/profile/basic_details.dart new file mode 100644 index 0000000..e603180 --- /dev/null +++ b/lib/ui/profile/basic_details.dart @@ -0,0 +1,151 @@ + + +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/ui/profile/profile.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; + +class BasicDetails extends StatefulWidget { + const BasicDetails({Key? key}) : super(key: key); + + @override + _BasicDetailsState createState() => _BasicDetailsState(); +} + +class _BasicDetailsState extends State { + String? fullName = ""; + String? maritalStatus = ""; + String? birthDate = ""; + String? civilIdentityNumber = ""; + String? emailAddress = ""; + String? employeeNo = ""; + + List 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.white, + leading: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton( + icon: const Icon( + Icons.arrow_back_ios, + color: MyColors.backgroundBlackColor, + ), + onPressed: () => Navigator.pop(context), + ), + "Basic Details".toText24(isBold: true, color: MyColors.blackColor), + ], + ), + ), + backgroundColor: MyColors.backgroundColor, + bottomSheet:footer(), + 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: 5), + height: 280, + 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: [ + "Full Name".toText13(color: MyColors.lightGrayColor), + "${fullName}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20,), + "Marital Status".toText13(color: MyColors.lightGrayColor), + "${maritalStatus}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20,), + "Date of Birth".toText13(color: MyColors.lightGrayColor), + "${birthDate}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20,), + "Civil Identity Number".toText13(color: MyColors.lightGrayColor), + "${civilIdentityNumber}".toText16(isBold: true, color: MyColors.blackColor), + ] + ), + ), + ], + ) + + ); + } + footer(){ + return Container( + decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(10), + color: MyColors.white, + boxShadow: [ + BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), + ], + ), + child: DefaultButton("Update", () async { + // context.setLocale(const Locale("en", "US")); // to change Loacle + Profile(); + }).insideContainer, + ); + } +} diff --git a/lib/ui/profile/contact_details.dart b/lib/ui/profile/contact_details.dart new file mode 100644 index 0000000..3894c65 --- /dev/null +++ b/lib/ui/profile/contact_details.dart @@ -0,0 +1,188 @@ + + + + +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_address_model.dart'; +import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; +import 'package:mohem_flutter_app/models/get_employee_phones_model.dart'; +import 'package:mohem_flutter_app/ui/profile/profile.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; + +class ContactDetails extends StatefulWidget { + const ContactDetails({Key? key}) : super(key: key); + + @override + _ContactDetailsState createState() => _ContactDetailsState(); +} + +class _ContactDetailsState extends State { + String? fullName = ""; + String? maritalStatus = ""; + String? birthDate = ""; + String? civilIdentityNumber = ""; + String? emailAddress = ""; + String? employeeNo = ""; + + List getEmployeePhonesList = []; + List getEmployeeAddressList = []; + + @override + void initState() { + super.initState(); + getEmployeePhones(); + getEmployeeAddress(); + + } + + void getEmployeePhones() async { + try { + Utils.showLoading(context); + getEmployeePhonesList = await ProfileApiClient().getEmployeePhones(); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + void getEmployeeAddress() async { + try { + Utils.showLoading(context); + getEmployeeAddressList = await ProfileApiClient().getEmployeeAddress(); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + + + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: MyColors.white, + leading: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton( + icon: const Icon( + Icons.arrow_back_ios, + color: MyColors.backgroundBlackColor, + ), + onPressed: () => Navigator.pop(context), + ), + "Contact Details".toText24(isBold: true, color: MyColors.blackColor), + ], + ), + ), + backgroundColor: MyColors.backgroundColor, + bottomSheet:footer(), + 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: 150, + 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: [ + "${getEmployeePhonesList[0].pHONETYPEMEANING}".toText13(color: MyColors.lightGrayColor), + "${getEmployeePhonesList[0].pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20,), + "${getEmployeePhonesList[1].pHONETYPEMEANING}".toText13(color: MyColors.lightGrayColor), + "${getEmployeePhonesList[1].pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor), + ] + ), + ), + 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: 400, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.5), + spreadRadius: 5, + blurRadius: 26, + offset: Offset(0, 3), + ), + ], + color: Colors.white, + borderRadius: BorderRadius.circular(10.0), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "${getEmployeeAddressList[0].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), + "${getEmployeeAddressList[0].sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20,), + "${getEmployeeAddressList[2].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), + "${getEmployeeAddressList[2].sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20,), + "${getEmployeeAddressList[3].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), + "${getEmployeeAddressList[3].sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20,), + "${getEmployeeAddressList[4].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), + "${getEmployeeAddressList[4].sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20,), + "${getEmployeeAddressList[5].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), + "${getEmployeeAddressList[5].sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20,), + "${getEmployeeAddressList[6].sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), + "${getEmployeeAddressList[6].sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), + ] + ), + ), + ], + ) + + ); + } + + footer(){ + return Container( + decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(10), + color: MyColors.white, + boxShadow: [ + BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), + ], + ), + child: DefaultButton("Update", () async { + // context.setLocale(const Locale("en", "US")); // to change Loacle + Profile(); + }).insideContainer, + ); + } +} diff --git a/lib/ui/profile/family_members.dart b/lib/ui/profile/family_members.dart new file mode 100644 index 0000000..d420abc --- /dev/null +++ b/lib/ui/profile/family_members.dart @@ -0,0 +1,263 @@ + + + + + +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/dialogs/otp_dialog.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'; +import 'package:mohem_flutter_app/ui/profile/profile.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; + +class FamilyMembers extends StatefulWidget { + const FamilyMembers({Key? key}) : super(key: key); + + @override + _FamilyMembersState createState() => _FamilyMembersState(); +} + +class _FamilyMembersState extends State { + + List getEmployeeContactsList = []; + + + @override + void initState() { + super.initState(); + getEmployeeContacts(); + + } + + void getEmployeeContacts() async { + try { + Utils.showLoading(context); + getEmployeeContactsList = await ProfileApiClient().getEmployeeContacts(); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: MyColors.white, + leading: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton( + icon: const Icon( + Icons.arrow_back_ios, + color: MyColors.backgroundBlackColor, + ), + onPressed: () => Navigator.pop(context), + ), + Center( + child: "Family Members".toText24(isBold: true, color: MyColors.blackColor), + ) + ], + ), + ), + backgroundColor: MyColors.backgroundColor, + bottomSheet:footer(), + body: Column( + children: [ + SizedBox(height: 20,), + getEmployeeContactsList.length != 0 + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: getEmployeeContactsList.length, + itemBuilder: (context, index) { + return Container( + child: Column( + children: [ + Container( + width: double.infinity, + margin: EdgeInsets.only(top: 10, left: 26, right: 26,), + padding: EdgeInsets.only(left: 14, right: 14,top: 13, ), + 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: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "${getEmployeeContactsList[index].cONTACTNAME}".toText16(color: MyColors.blackColor), + "${getEmployeeContactsList[index].rELATIONSHIP}".toText11(isBold: true, color: MyColors.textMixColor), + SizedBox(height: 5,), + Divider( + color: MyColors.lightGreyEFColor, + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Container( + child: InkWell( + onTap: () { + + }, + child: RichText( + text: TextSpan( + children: [ + WidgetSpan( + child: Icon( + Icons.edit, + size: 15, + color: MyColors.grey67Color, + ), + ), + TextSpan( + text: "Update", + style: TextStyle( + color: MyColors.grey67Color, + fontSize: 12, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ) + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: SizedBox( + child: Container( + width: 3, + color: MyColors.lightGreyEFColor, + ), + ), + ), + Container( + child: InkWell( + onTap: () { + showAlertDialog(context); + }, + child: RichText( + text: TextSpan( + children: [ + WidgetSpan( + child: Icon( + Icons.delete, + size: 15, + color: Color(0x99FF0000), + ), + ), + TextSpan( + text: "Remove", + style: TextStyle( + color: MyColors.DarkRedColor, + fontSize: 12, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ) + ), + // ElevatedButton.icon( + // icon: Icon( + // Icons.delete, + // size: 15, + // color: Color(0x99FF0000), + // ), + // style: ElevatedButton.styleFrom( + // shadowColor: Colors.white, + // primary: Colors.white, + // ), + // label: "remove".toText12(color: MyColors.DarkRedColor), + // onPressed: (){}, + // ), + ], + ), + ] + ), + ), + ], + ) + ); + }) + ], + ), + ):Container(), + ], + ) + + + ); + } + + footer(){ + return Container( + decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(10), + color: MyColors.white, + boxShadow: [ + BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), + ], + ), + child: DefaultButton("Update", () async { + // context.setLocale(const Locale("en", "US")); // to change Loacle + Profile(); + }).insideContainer, + ); + } + + showAlertDialog(BuildContext context) { + Widget cancelButton = TextButton( + child: Text("CANCEL"), + onPressed: () { + Navigator.pop(context); + }, + ); + Widget continueButton = TextButton( + child: Text("OK"), + onPressed: () {}, + ); + AlertDialog alert = AlertDialog( + title: Text("Confirm"), + content: Text("Are You Sure You Want to Remove this Member?"), + actions: [ + cancelButton, + continueButton, + ], + ); + showDialog( + context: context, + builder: (BuildContext context) { + return alert; + }, + ); + } + +} diff --git a/lib/ui/profile/personal_info.dart b/lib/ui/profile/personal_info.dart new file mode 100644 index 0000000..d21c5ed --- /dev/null +++ b/lib/ui/profile/personal_info.dart @@ -0,0 +1,124 @@ + +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/member_information_list_model.dart'; +import 'package:mohem_flutter_app/ui/profile/profile.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; + +class PesonalInfo extends StatefulWidget { + const PesonalInfo({Key? key}) : super(key: key); + + @override + _PesonalInfoState createState() => _PesonalInfoState(); +} + +class _PesonalInfoState extends State { + String? fullName = ""; + String? maritalStatus = ""; + String? birthDate = ""; + String? civilIdentityNumber = ""; + String? emailAddress = ""; + String? employeeNo = ""; + + List getEmployeeBasicDetailsList = []; + MemberInformationListModel? _memberInformationList; + + @override + void initState() { + super.initState(); + + } + + + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: MyColors.white, + leading: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton( + icon: const Icon( + Icons.arrow_back_ios, + color: MyColors.backgroundBlackColor, + ), + onPressed: () => Navigator.pop(context), + ), + "Personal Information".toText24(isBold: true, color: MyColors.blackColor), + ], + ), + ), + backgroundColor: MyColors.backgroundColor, + bottomSheet:footer(), + 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: [ + "Category".toText13(color: MyColors.lightGrayColor), + "${_memberInformationList!.eMPLOYMENTCATEGORYMEANING}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20,), + "Address".toText13(color: MyColors.lightGrayColor), + "${_memberInformationList!.lOCATIONNAME}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20,), + "Phone Number".toText13(color: MyColors.lightGrayColor), + "${_memberInformationList!.eMPLOYEEMOBILENUMBER}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20,), + "Business Group".toText13(color: MyColors.lightGrayColor), + "${_memberInformationList!.bUSINESSGROUPNAME}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20,), + "Payroll".toText13(color: MyColors.lightGrayColor), + "${_memberInformationList!.pAYROLLNAME}".toText16(isBold: true, color: MyColors.blackColor), + ] + ), + ), + ], + ) + + ); + } + + footer(){ + return Container( + decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(10), + color: MyColors.white, + boxShadow: [ + BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), + ], + ), + child: DefaultButton("Update", () async { + // context.setLocale(const Locale("en", "US")); // to change Loacle + Profile(); + }).insideContainer, + ); + } +} diff --git a/lib/ui/profile/profile.dart b/lib/ui/profile/profile.dart index a3fa1ae..6cbf953 100644 --- a/lib/ui/profile/profile.dart +++ b/lib/ui/profile/profile.dart @@ -116,7 +116,8 @@ class _ProfileState extends State { ], ), ), - )), + ) + ), ), Container( width: double.infinity,