diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..af7c712 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cSpell.words": [ + "MPLOYEEIMAGE" + ] +} \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 27bdf35..7be27d5 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -7,7 +7,6 @@ en_US = { "confirm": "Confirm", "passwordChangedSuccessfully": "Password changed successfully", "itemsForSale": "Items for Sale", + "attendanceDetails": "Attendance Details", + "order": "order", + "earlyOut": "Early Out", + "shortage": "Shortage", + "excess": "Excess", + "lateIn": "Late In", + "approvedCheckOut": "Approved Check Out", + "approvedCheckIn": "Approved Check In", + "actualCheckOut": "Actual Check Out", + "actualCheckIn": "Actual Check In", + "present": "PRESENT 11", + "pres": "present", + "shiftTime": "Shift Time", + "absent": "ABSENT 10", + "attendance": "Attendance", + "scheduleDays": "Schedule\nDays", + "offDays": "Off\nDays", + "nonAnalyzed": "Non\nAnalyzed", + "shortageHour": "Shortage\nHour", + "stats": "Stats", + "completed": "Completed", "doNotUseRecentPassword": "Do not use recent password", "atLeastOneLowercase": "At least one lowercase", "atLeastOneUppercase": "At least one uppercase", @@ -465,12 +519,24 @@ static const Map en_US = { "requestDetails": "Request Details", "approvalLevel": "Approval Level", "requesterDetails": "Requester Details", + "myAttendance": "My Attendance", + "workOnBreak": "Work On Break", + "next": "Next", + "year": "Year", + "month": "Month", + "day": "Day", + "completingYear": "We appreciate you for completing the service of", "profile": { "reset_password": { "label": "Reset Password", "username": "Username", "password": "password" - } + }, + "profileCompletionPer": "Profile Completion", + "completeProfile": "Complete Profile", + "personalInformation": "Personal Information", + "basicDetails": "Basic Details", + "familyDetails": "Family Details" }, "clicked": { "zero": "You clicked {} times!", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index fed6ef6..b2b255d 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -53,6 +53,30 @@ abstract class LocaleKeys { static const confirm = 'confirm'; static const passwordChangedSuccessfully = 'passwordChangedSuccessfully'; static const itemsForSale = 'itemsForSale'; + static const attendanceDetails = 'attendanceDetails'; + static const order = 'order'; + static const earlyOut = 'earlyOut'; + static const shortage = 'shortage'; + static const excess = 'excess'; + static const lateIn = 'lateIn'; + static const approvedCheckOut = 'approvedCheckOut'; + static const approvedCheckIn = 'approvedCheckIn'; + static const actualCheckOut = 'actualCheckOut'; + static const actualCheckIn = 'actualCheckIn'; + static const present = 'present'; + static const pres = 'pres'; + static const shiftTime = 'shiftTime'; + static const absent = 'absent'; + static const attendance = 'attendance'; + static const scheduleDays = 'scheduleDays'; + static const offDays = 'offDays'; + static const nonAnalyzed = 'nonAnalyzed'; + static const shortageHour = 'shortageHour'; + static const stats = 'stats'; + static const completed = 'completed'; + static const msg = 'msg'; + static const msg_named = 'msg_named'; + static const clickMe = 'clickMe'; static const doNotUseRecentPassword = 'doNotUseRecentPassword'; static const atLeastOneLowercase = 'atLeastOneLowercase'; static const atLeastOneUppercase = 'atLeastOneUppercase'; @@ -172,9 +196,6 @@ abstract class LocaleKeys { static const rfqUOM = 'rfqUOM'; static const rfqQty = 'rfqQty'; static const rfqNumber = 'rfqNumber'; - static const msg = 'msg'; - static const msg_named = 'msg_named'; - static const clickMe = 'clickMe'; static const human = 'human'; static const resources = 'resources'; static const details = 'details'; @@ -208,18 +229,27 @@ abstract class LocaleKeys { static const requestDetails = 'requestDetails'; static const approvalLevel = 'approvalLevel'; static const requesterDetails = 'requesterDetails'; + static const myAttendance = 'myAttendance'; + static const workOnBreak = 'workOnBreak'; + static const next = 'next'; + static const completingYear = 'completingYear'; + static const year = 'year'; + static const month = 'month'; + static const day = 'day'; static const profile_reset_password_label = 'profile.reset_password.label'; static const profile_reset_password_username = 'profile.reset_password.username'; static const profile_reset_password_password = 'profile.reset_password.password'; static const profile_reset_password = 'profile.reset_password'; + static const profile_profileCompletionPer = 'profile.profileCompletionPer'; + static const profile_completeProfile = 'profile.completeProfile'; + static const profile_personalInformation = 'profile.personalInformation'; + static const profile_basicDetails = 'profile.basicDetails'; + static const profile_familyDetails = 'profile.familyDetails'; static const profile = 'profile'; static const clicked = 'clicked'; static const amount = 'amount'; static const gender_with_arg = 'gender.with_arg'; static const gender = 'gender'; static const reset_locale = 'reset_locale'; - static const myAttendance = 'myAttendance'; - static const workOnBreak = 'workOnBreak'; - static const next = 'next'; } diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 6c27fe4..40da7d0 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -669,9 +669,9 @@ class GenericResponseModel { } getEarningsList = json['GetEarningsList']; if (json['GetEmployeeAddressList'] != null) { - getEmployeeAddressList = []; + getEmployeeAddressList = [].cast(); json['GetEmployeeAddressList'].forEach((v) { - getEmployeeAddressList!.add(dynamic); + getEmployeeAddressList!.add(v); }); } if (json['GetEmployeeBasicDetailsList'] != null) { diff --git a/lib/models/profile_menu.model.dart b/lib/models/profile_menu.model.dart new file mode 100644 index 0000000..4593f9c --- /dev/null +++ b/lib/models/profile_menu.model.dart @@ -0,0 +1,9 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class ProfileMenu { + final String name; + final IconData icon; + final String route; + ProfileMenu({this.name = '', this.icon = Icons.home, this.route = ''}); +} diff --git a/lib/ui/screens/profile/profile_screen.dart b/lib/ui/screens/profile/profile_screen.dart index 4431c95..f1c0f8f 100644 --- a/lib/ui/screens/profile/profile_screen.dart +++ b/lib/ui/screens/profile/profile_screen.dart @@ -2,10 +2,33 @@ import 'dart:ui'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/profile_api_client.dart'; +import 'package:mohem_flutter_app/app_state/app_state.dart'; +import 'package:mohem_flutter_app/classes/utils.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/screens/profile/widgets/header.dart'; import 'package:mohem_flutter_app/ui/screens/profile/widgets/profile_panel.dart'; -class ProfileScreen extends StatelessWidget { +class ProfileScreen extends StatefulWidget { + const ProfileScreen({Key? key}) : super(key: key); + + @override + _ProfileScreenState createState() => _ProfileScreenState(); +} + +class _ProfileScreenState extends State { + late MemberInformationListModel memberInformationList; + + List getEmployeeBasicDetailsList = []; + + @override + void initState() { + super.initState(); + memberInformationList = AppState().memberInformationList!; + //getEmployeeBasicDetails(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -15,12 +38,7 @@ class ProfileScreen extends StatelessWidget { Container( height: 300, margin: EdgeInsets.only(top: 50), - decoration: new BoxDecoration( - image: new DecorationImage( - image: new ExactAssetImage('assets/images/user-avatar.png'), - fit: BoxFit.cover, - ), - ), + decoration: BoxDecoration(image: DecorationImage(image: MemoryImage(Utils.getPostBytes(memberInformationList.eMPLOYEEIMAGE)), fit: BoxFit.cover)), child: new BackdropFilter( filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), child: new Container( @@ -39,7 +57,9 @@ class ProfileScreen extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ IconButton( - onPressed: () {}, + onPressed: () { + Navigator.pop(context); + }, icon: Icon( Icons.arrow_back_ios, color: Colors.white, @@ -57,10 +77,25 @@ class ProfileScreen extends StatelessWidget { ]))), ], )), - HeaderPanel(), - ProfilePanle() + HeaderPanel(memberInformationList), + ProfilePanle(memberInformationList) ]), ) ])); } + + 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); + } + } } diff --git a/lib/ui/screens/profile/widgets/header.dart b/lib/ui/screens/profile/widgets/header.dart index 3a4499a..ca3d829 100644 --- a/lib/ui/screens/profile/widgets/header.dart +++ b/lib/ui/screens/profile/widgets/header.dart @@ -1,7 +1,10 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/models/member_information_list_model.dart'; class HeaderPanel extends StatelessWidget { + HeaderPanel(this.memberInformationList); + late MemberInformationListModel memberInformationList; @override Widget build(BuildContext context) { double _width = MediaQuery.of(context).size.width; diff --git a/lib/ui/screens/profile/widgets/profile_info.dart b/lib/ui/screens/profile/widgets/profile_info.dart index a02b56e..ecd5ef3 100644 --- a/lib/ui/screens/profile/widgets/profile_info.dart +++ b/lib/ui/screens/profile/widgets/profile_info.dart @@ -1,40 +1,47 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/config/routes.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/member_information_list_model.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:mohem_flutter_app/models/profile_menu.model.dart'; class ProfileInFo extends StatelessWidget { + ProfileInFo(this.memberInfo); + MemberInformationListModel memberInfo; String data = '.'; double sliderValue = 75; List menu = [ - ProfileMenu(name: 'Personal information', icon: ''), - ProfileMenu(name: 'Basic Details', icon: ''), - ProfileMenu(name: 'Family Details', icon: ''), + ProfileMenu(name: LocaleKeys.profile_personalInformation.tr(), icon: Icons.info, route: AppRoutes.personalInfo), + ProfileMenu(name: LocaleKeys.profile_basicDetails.tr(), icon: Icons.contacts, route: AppRoutes.basicDetails), + ProfileMenu(name: LocaleKeys.profile_familyDetails.tr(), icon: Icons.reduce_capacity_sharp, route: AppRoutes.familyMembers), ]; @override Widget build(BuildContext context) { return Container( child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [ /// card header - customLabel('Sultan khan', 22, Colors.black, true), + customLabel(memberInfo.eMPLOYEENAME.toString(), 22, Colors.black, true), - customLabel('217869 | Software Developer', 14, Colors.grey, false), + customLabel(memberInfo.eMPLOYEENUMBER.toString() + ' | ' + memberInfo.jOBNAME.toString(), 14, Colors.grey, false), - customLabel('sultan.khan@cloudsolutions.com.sa', 13, Colors.black, true), + customLabel(memberInfo.eMPLOYEEEMAILADDRESS.toString(), 13, Colors.black, true), Divider(height: 40, thickness: 8, color: const Color(0xffefefef)), - customLabel('We appreciates you for completing the service of', 10, Colors.black, true), + customLabel(LocaleKeys.completingYear.tr(), 10, Colors.black, true), SizedBox(height: 10), Container( child: Row(mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.center, children: [ Column( - children: [customLabel('Years', 14, const Color(0xff808080), true), customLabel('03', 22, Color(0xff2BB8A6), true)], + children: [customLabel(LocaleKeys.year.tr(), 14, const Color(0xff808080), true), customLabel(memberInfo.sERVICEYEARS.toString().padLeft(2, '0'), 22, Color(0xff2BB8A6), true)], ), Column( - children: [customLabel('Month', 14, const Color(0xff808080), true), customLabel('06', 22, Color(0xff2BB8A6), true)], + children: [customLabel(LocaleKeys.month.tr(), 14, const Color(0xff808080), true), customLabel(memberInfo.sERVICEMONTHS.toString().padLeft(2, '0'), 22, Color(0xff2BB8A6), true)], ), Column( - children: [customLabel('Day', 14, const Color(0xff808080), true), customLabel('20', 22, Color(0xff2BB8A6), true)], + children: [customLabel(LocaleKeys.day.tr(), 14, const Color(0xff808080), true), customLabel(memberInfo.sERVICEDAYS.toString().padLeft(2, '0'), 22, Color(0xff2BB8A6), true)], ) ])), @@ -48,7 +55,7 @@ class ProfileInFo extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - customLabel('Profile Completion 75%', 18, Colors.black, true), + customLabel(LocaleKeys.profile_profileCompletionPer.tr() + ' 75%', 18, Colors.black, true), const SizedBox(height: 10), Row( children: [ @@ -58,7 +65,7 @@ class ProfileInFo extends StatelessWidget { ), const SizedBox(height: 10), Text( - 'Complete Profile', + LocaleKeys.profile_completeProfile.tr(), style: TextStyle(color: Color(0xff2BB8A6), fontWeight: FontWeight.bold, decoration: TextDecoration.underline), ), ], @@ -92,14 +99,13 @@ class ProfileInFo extends StatelessWidget { Widget rowItem(obj, context) { return InkWell( onTap: () { - // Navigator.pushNamed( - // context, - // AppRoutes.addEitScreen, - // arguments: obj, - // ); + Navigator.pushNamed(context, obj.route); }, child: ListTile( - leading: FlutterLogo(), + leading: Icon( + obj.icon, + color: Color(0xff2BB8A6), + ), title: Text(obj.name), trailing: Icon(Icons.arrow_forward), ), @@ -114,9 +120,3 @@ class ProfileInFo extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [Text(label, style: TextStyle(color: color, fontSize: size, fontWeight: isBold ? FontWeight.bold : FontWeight.normal))])); } - -class ProfileMenu { - final String name; - final String icon; - ProfileMenu({this.name = '', this.icon = ''}); -} diff --git a/lib/ui/screens/profile/widgets/profile_panel.dart b/lib/ui/screens/profile/widgets/profile_panel.dart index 7cf73ea..fd99abb 100644 --- a/lib/ui/screens/profile/widgets/profile_panel.dart +++ b/lib/ui/screens/profile/widgets/profile_panel.dart @@ -1,8 +1,12 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/models/member_information_list_model.dart'; import 'package:mohem_flutter_app/ui/screens/profile/widgets/profile_info.dart'; class ProfilePanle extends StatelessWidget { + ProfilePanle(this.memberInformationList); + late MemberInformationListModel memberInformationList; @override Widget build(BuildContext context) { double _width = MediaQuery.of(context).size.width; @@ -18,11 +22,15 @@ class ProfilePanle extends StatelessWidget { color: Colors.white, borderRadius: const BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), boxShadow: [BoxShadow(color: Colors.white60, blurRadius: 10, spreadRadius: 10)]), - child: ProfileInFo(), + child: ProfileInFo(memberInformationList), ), Container(height: 100, alignment: Alignment.center, child: ProfileImage()) ])); } - Widget ProfileImage() => CircleAvatar(radius: 70, backgroundImage: AssetImage('assets/images/user-avatar.png')); + Widget ProfileImage() => CircleAvatar( + radius: 70, + backgroundImage: MemoryImage(Utils.getPostBytes(memberInformationList.eMPLOYEEIMAGE)), + backgroundColor: Colors.black, + ); }