From da6b935c0b1db30bb6cca34c047d2e91376e569b Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 6 Mar 2022 10:14:59 +0300 Subject: [PATCH 01/19] subpages changes --- lib/config/routes.dart | 4 ++ lib/ui/landing/dashboard_screen.dart | 2 +- lib/ui/landing/widget/services_widget.dart | 74 +++++++++++++--------- lib/ui/screens/submenu_screen.dart | 61 ++++++++++++++++++ 4 files changed, 111 insertions(+), 30 deletions(-) create mode 100644 lib/ui/screens/submenu_screen.dart diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 3eba985..26a1bfe 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -6,6 +6,7 @@ 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/screens/submenu_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'; @@ -21,6 +22,7 @@ class AppRoutes { static const String loginVerification = "/loginVerification"; static const String dashboard = "/dashboard"; static const String todayAttendance = "/todayAttendance"; + static const String subMenuScreen = "/submenuScreen"; static const String initialRoute = login; //Work List @@ -32,6 +34,8 @@ class AppRoutes { verifyLogin: (context) => VerifyLoginScreen(), verifyLastLogin: (context) => VerifyLastLoginScreen(), dashboard: (context) => DashboardScreen(), + + subMenuScreen: (context) => SubMenuScreen(), newPassword: (context) => NewPasswordScreen(), forgotPassword: (context) => ForgotPasswordScreen(), todayAttendance: (context) => TodayAttendanceScreen(), diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 92ea49d..eded6b7 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -46,7 +46,7 @@ class _DashboardScreenState extends State { data.fetchWorkListCounter(); data.fetchMissingSwipe(); data.fetchLeaveTicketBalance(); - // data.fetchMenuEntries(); + data.fetchMenuEntries(); } @override diff --git a/lib/ui/landing/widget/services_widget.dart b/lib/ui/landing/widget/services_widget.dart index f397a4c..955915c 100644 --- a/lib/ui/landing/widget/services_widget.dart +++ b/lib/ui/landing/widget/services_widget.dart @@ -1,10 +1,13 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.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/dashboard/menus.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; import 'package:provider/provider.dart'; @@ -60,35 +63,39 @@ class ServicesWidget extends StatelessWidget { aspectRatio: 105 / 105, child: data.isServicesMenusLoading ? ServicesMenuShimmer() - : Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SvgPicture.asset(iconT[index]), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Expanded( - child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText11(isBold: true), - ), - SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4) - ], - ) - ], - ).paddingOnly(left: 10, right: 10, bottom: 10, top: 12), - ), + : InkWell( + onTap: () { + getSubmenus(context, data.getMenuEntriesList, data.homeMenus![parentIndex].menuEntiesList[index]); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SvgPicture.asset(iconT[index]), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText11(isBold: true), + ), + SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4) + ], + ) + ], + ).paddingOnly(left: 10, right: 10, bottom: 10, top: 12), + )), ); }, separatorBuilder: (cxt, index) => 9.width, @@ -107,6 +114,15 @@ class ServicesWidget extends StatelessWidget { ); } + void getSubmenus(BuildContext context, List? menuEntries, GetMenuEntriesList? homeSubMenu) { + List? selectedMenu = menuEntries?.where((element) => element.parentMenuName == homeSubMenu?.menuName).toList(); + Navigator.pushNamed( + context, + AppRoutes.subMenuScreen, + arguments: Menus(homeSubMenu!, selectedMenu!), + ); + } + String firstWord(String value) { return value.split(" ").length > 1 ? value.split(" ")[0] : ""; } diff --git a/lib/ui/screens/submenu_screen.dart b/lib/ui/screens/submenu_screen.dart new file mode 100644 index 0000000..bc9fbc9 --- /dev/null +++ b/lib/ui/screens/submenu_screen.dart @@ -0,0 +1,61 @@ +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:mohem_flutter_app/classes/colors.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/dashboard/menu_entries.dart'; +import 'package:mohem_flutter_app/models/dashboard/menus.dart'; +import 'package:mohem_flutter_app/ui/app_bar.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; + +class SubMenuScreen extends StatelessWidget { + late Menus menu; + + @override + Widget build(BuildContext context) { + menu = ModalRoute.of(context)!.settings.arguments as Menus; + return Scaffold( + backgroundColor: Colors.white, + appBar: appBar( + context, + title: menu.menuEntry.prompt.toString(), + ), + body: Container( + width: double.infinity, + height: double.infinity, + child: Column( + children: menu.menuEntiesList.map((i) => rowItem(i)).toList(), + )), + ); + } + + Widget rowItem(GetMenuEntriesList obj) { + return InkWell( + onTap: () {}, + child: Container( + width: double.infinity, + padding: EdgeInsets.all(12), + margin: EdgeInsets.only(top: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.1), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [Text(obj.prompt.toString()), Icon(Icons.arrow_right)], + ).paddingAll(6), + ), + ); + } +} From 0cd37ce0fa85534cab38205418a94d9df6c2e282 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Sun, 3 Apr 2022 13:13:28 +0300 Subject: [PATCH 02/19] fix calendar --- assets/langs/ar-SA.json | 1 + assets/langs/en-US.json | 1 + lib/classes/colors.dart | 9 + lib/config/routes.dart | 17 + lib/extensions/string_extensions.dart | 9 + lib/extensions/widget_extensions.dart | 2 + lib/generated/codegen_loader.g.dart | 2 + lib/ui/attendance/monthly_attendance.dart | 671 ++++++++++++++++++ .../attendence_details_bottom_sheet.dart | 228 ++++++ lib/ui/landing/dashboard.dart | 13 +- pubspec.lock | 86 ++- pubspec.yaml | 4 + 12 files changed, 1020 insertions(+), 23 deletions(-) create mode 100644 lib/ui/attendance/monthly_attendance.dart create mode 100644 lib/ui/bottom_sheets/attendence_details_bottom_sheet.dart diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 1d9e8bc..9c9b933 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -49,6 +49,7 @@ "loginCodeWillSentToMobileNumber": "الرجاء إدخال معرف الموظف الخاص بك ، وسيتم إرسال رمز تسجيل الدخول إلى رقم هاتفك المحمول", "changePassword": "تغيير كلمة المرور", "itemsForSale": "سلع للبيع", + "attendanceDetails": "تفاصيل الحضور", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 9c812ce..538c567 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -49,6 +49,7 @@ "loginCodeWillSentToMobileNumber": "Please Enter your Employee ID, A login code will be sent to your mobile number", "changePassword": "Change Password", "itemsForSale": "Items for Sale", + "attendanceDetails": "Attendence Details", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", diff --git a/lib/classes/colors.dart b/lib/classes/colors.dart index 2e5eaef..2a34a05 100644 --- a/lib/classes/colors.dart +++ b/lib/classes/colors.dart @@ -25,4 +25,13 @@ class MyColors { static const Color white = Color(0xffffffff); static const Color green = Color(0xffffffff); static const Color borderColor = Color(0xffE8E8E8); + static const Color grey67Color = Color(0xff676767); + static const Color whiteColor = Color(0xFFEEEEEE); + static const Color greenColor = Color(0xff1FA269); + static const Color lightGreenColor = Color(0xff2AB2AB); + static const Color darkGreyColor = Color(0xff464646); + static const Color greyA5Color = Color(0xffA5A5A5); + static const Color blackColor = Color(0xff000014); + static const Color grey3AColor = Color(0xff2E303A); + static const Color darkColor = Color(0xff000015); } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 39a4ebc..4ca0181 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -7,6 +7,8 @@ import 'package:mohem_flutter_app/ui/login/new_password_screen.dart'; import 'package:mohem_flutter_app/ui/login/verify_login_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'; class AppRoutes { static const String splash = "/splash"; @@ -21,10 +23,18 @@ class AppRoutes { static const String todayAttendance = "/todayAttendance"; static const String initialRoute = login; + //Work List static const String workList = "/workList"; static const String missingSwipe = "/missingSwipe"; + //Attendance + static const String attendance = "/attendance"; + static const String monthlyAttendance = "/monthlyAttendance"; + + //Bottom Sheet + static const String attendanceDetailsBottomSheet = "/attendanceDetailsBottomSheet"; + static final Map routes = { login: (context) => LoginScreen(), verifyLogin: (context) => VerifyLoginScreen(), @@ -33,8 +43,15 @@ class AppRoutes { forgotPassword: (context) => ForgotPasswordScreen(), todayAttendance: (context) => TodayAttendanceScreen(), + //Work List workList: (context) => WorkListScreen(), missingSwipe: (context) => MissingSwipeScreen(), + + //Attendance + monthlyAttendance: (context) => MonthlyAttendance(), + + //Bottom Sheet + attendanceDetailsBottomSheet: (context) => AttendenceDetailsBottomSheet(), }; } diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 9db4829..e80cdeb 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -51,6 +51,10 @@ extension EmailValidator on String { this, style: TextStyle(color: color ?? MyColors.darkTextColor, fontSize: 17, letterSpacing: -0.68, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), ); + Widget toText20({Color? color, bool isBold = false}) => Text( + this, + style: TextStyle(fontSize: 20, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.4), + ); Widget toText22({Color? color, bool isBold = false}) => Text( this, @@ -67,6 +71,11 @@ extension EmailValidator on String { style: TextStyle(height: 32 / 32, color: color ?? MyColors.darkTextColor, fontSize: 32, letterSpacing: -1.92, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), ); + Widget toText44({Color? color, bool isBold = false}) => Text( + this, + style: TextStyle(height: 32 / 32, color: color ?? MyColors.darkTextColor, fontSize: 44, letterSpacing: -2.64, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), + ); + bool isValidEmail() { return RegExp(r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$').hasMatch(this); } diff --git a/lib/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart index 787894d..030fa50 100644 --- a/lib/extensions/widget_extensions.dart +++ b/lib/extensions/widget_extensions.dart @@ -4,6 +4,8 @@ import 'package:flutter/widgets.dart'; extension WidgetExtensions on Widget { Widget onPress(VoidCallback onTap) => InkWell(onTap: onTap, child: this); + Widget get expanded => Expanded(child: this); + Widget paddingAll(double _value) => Padding(padding: EdgeInsets.all(_value), child: this); Widget paddingOnly({double left = 0.0, double right = 0.0, double top = 0.0, double bottom = 0.0}) => diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index b43f3bd..23003fe 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -65,6 +65,7 @@ class CodegenLoader extends AssetLoader{ "loginCodeWillSentToMobileNumber": "الرجاء إدخال معرف الموظف الخاص بك ، وسيتم إرسال رمز تسجيل الدخول إلى رقم هاتفك المحمول", "changePassword": "تغيير كلمة المرور", "itemsForSale": "سلع للبيع", + "attendanceDetails": "تفاصيل الحضور", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", @@ -154,6 +155,7 @@ static const Map en_US = { "loginCodeWillSentToMobileNumber": "Please Enter your Employee ID, A login code will be sent to your mobile number", "changePassword": "Change Password", "itemsForSale": "Items for Sale", + "attendanceDetails": "Attendence Details", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", diff --git a/lib/ui/attendance/monthly_attendance.dart b/lib/ui/attendance/monthly_attendance.dart new file mode 100644 index 0000000..ff370a3 --- /dev/null +++ b/lib/ui/attendance/monthly_attendance.dart @@ -0,0 +1,671 @@ +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/painting.dart'; +import 'package:mohem_flutter_app/classes/colors.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/widgets/circular_step_progress_bar.dart'; +import 'package:syncfusion_flutter_calendar/calendar.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:pie_chart/pie_chart.dart'; + +class MonthlyAttendance extends StatefulWidget { + MonthlyAttendance({Key? key}) : super(key: key); + + @override + _MonthlyAttendanceState createState() { + return _MonthlyAttendanceState(); + } +} + +class _MonthlyAttendanceState extends State { + bool isPresent = true; + bool isAbsent = true; + bool isMissingDays = true; + bool isOffDays = true; + + @override + void initState() { + super.initState(); + } + + Map dataMap = { + "Present": 65, + "Absent": 35, + }; + + final List _colorList = [Color(0xff2AB2AB), Color(0xff202529)]; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: MyColors.white, + leading: IconButton( + icon: const Icon( + Icons.arrow_back_ios, + color: MyColors.backgroundBlackColor, + ), + onPressed: () => Navigator.pop(context), + ), + ), + backgroundColor: Colors.white, + body: ListView( + scrollDirection: Axis.vertical, + children: [ + Column( + children: [ + 20.height, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Attendance".toText24(isBold: true, color: MyColors.darkIconColor), + Row( + children: [ + "June 13, 2021".toText16(color: MyColors.greyACColor), + const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor), + ], + ).onPress(() { + showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime(2021), + lastDate: DateTime(2025), + builder: (context, child) { + return Theme( + data: ThemeData.dark().copyWith( + colorScheme: const ColorScheme.dark( + primary: MyColors.lightGreenColor, + onPrimary: MyColors.white, + surface: MyColors.lightGreenColor, + onSurface: MyColors.darkTextColor, + ), + dialogBackgroundColor: Colors.white, + ), + child: child!, + ); + }, + ); + }) + ], + ).paddingOnly(left: 21, right: 21), + 18.height, + AspectRatio(aspectRatio: 333 / 270, child: calenderWidget()).paddingOnly(left: 21, right: 21), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + optionUI("Schedule\nDays", "16"), + 6.width, + optionUI("Off\nDays", "0"), + 6.width, + optionUI("Non\nAnalyzed", "0"), + 6.width, + optionUI("Shortage\nHour", "6"), + ], + ).paddingOnly(left: 21, right: 21), + 35.height, + Container( + width: double.infinity, + height: 227, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: const BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), + boxShadow: [ + BoxShadow( + offset: const Offset(0, 2), + blurRadius: 26, + color: MyColors.darkColor.withOpacity(0.1), + ), + ], + ), + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + children: [ + "Attendance".toText12(isBold: true, color: MyColors.grey3AColor), + "Stats".toText24(isBold: true, color: MyColors.grey3AColor), + ], + ).paddingOnly(left: 21, top: 29, bottom: 36), + Row( + children: [ + Container( + height: 9, + width: 9, + decoration: BoxDecoration( + color: MyColors.lightGreenColor, + borderRadius: BorderRadius.circular(100), + ), + ), + Container( + margin: const EdgeInsets.only(left: 5, right: 5), + child: "PRESENT 16".toText16(isBold: true, color: MyColors.lightGreenColor), + ), + ], + ).paddingOnly(left: 21, right: 23), + 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: "ABSENT 04".toText16( + isBold: true, + color: MyColors.backgroundBlackColor, + ), + ) + ], + ).paddingOnly(left: 21, top: 8), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 169, + 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: 65, top: 27, right: 21, bottom: 28), + ], + ), + ), + ], + ), + ], + ), + ); + } + + Widget optionUI(String title, String value) { + return AspectRatio( + aspectRatio: 1 / 1, + child: Container( + padding: const EdgeInsets.only(top: 10, left: 8, right: 8, bottom: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + offset: const Offset(0, 1), + blurRadius: 15, + color: MyColors.darkColor.withOpacity(0.1), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [title.toText10(color: MyColors.darkTextColor).expanded, value.toText20(color: MyColors.darkTextColor)], + ), + ), + ).expanded; + } + + Widget calenderWidget() { + return SfCalendar( + view: CalendarView.month, + headerHeight: 0, + todayHighlightColor: MyColors.grey3AColor, + viewHeaderStyle: const ViewHeaderStyle( + dayTextStyle: TextStyle(color: MyColors.grey3AColor, fontSize: 13, fontWeight: FontWeight.w600), + ), + monthCellBuilder: (cxt, build) { + int val = build.date.day % 4; + isPresent = val == 0; + isAbsent = val == 1; + isMissingDays = val == 2; + isOffDays = val == 3; + if (isPresent) { + 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( + "${build.date.day}", + style: const TextStyle( + fontSize: 13, + fontWeight: FontWeight.w500, + color: MyColors.white, + ), + ), + ); + } else if (isAbsent) { + 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( + "${build.date.day}", + style: const TextStyle( + fontSize: 13, + fontWeight: FontWeight.w500, + color: MyColors.white, + ), + ), + ); + } else if (isMissingDays) { + 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( + "${build.date.day}", + style: const TextStyle( + fontSize: 13, + fontWeight: FontWeight.w500, + color: Color(0xff1F2428), + ), + ), + ); + } else if (isOffDays) { + return Container( + margin: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: MyColors.greyACColor.withOpacity(.12), + shape: BoxShape.circle, + ), + alignment: Alignment.center, + child: Text( + "${build.date.day}", + style: const TextStyle( + fontSize: 13, + fontWeight: FontWeight.w500, + color: MyColors.greyA5Color, + ), + ), + ); + } else { + return Container(); + } + }, + monthViewSettings: const MonthViewSettings( + dayFormat: 'EEE', + showTrailingAndLeadingDates: false, + appointmentDisplayMode: MonthAppointmentDisplayMode.appointment, + showAgenda: false, + navigationDirection: MonthNavigationDirection.horizontal, + monthCellStyle: MonthCellStyle( + textStyle: TextStyle( + fontStyle: FontStyle.normal, + fontSize: 13, + color: Colors.white, + ), + ), + ), + showNavigationArrow: false, + showDatePickerButton: 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()), + onTap: calendarTapped, + ); + } + + void calendarTapped(CalendarTapDetails details) { + showModalBottomSheet( + context: context, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)), + isScrollControlled: true, + backgroundColor: MyColors.backgroundBlackColor, + builder: (_) { + return DraggableScrollableSheet( + maxChildSize: 0.9, + expand: false, + builder: (_, controller) { + return Column( + children: [ + Container( + width: 75, + height: 7, + margin: const EdgeInsets.symmetric(vertical: 10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: MyColors.darkGreyColor, + ), + ), + Expanded( + child: ListView.builder( + controller: controller, + itemCount: 1, + itemBuilder: (_, i) => Container( + decoration: const BoxDecoration( + borderRadius: BorderRadius.vertical( + top: Radius.circular(35.0), + ), + color: MyColors.backgroundBlackColor, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column(children: [ + "June 13, 2021".toText24(isBold: true, color: Colors.white), + LocaleKeys.attendanceDetails.tr().toText16(color: MyColors.lightGreyEFColor), + 21.height, + ]).paddingOnly(top: 25, left: 21, right: 21, bottom: 10), + Center( + child: CircularStepProgressBar( + totalSteps: 16 * 4, + currentStep: 16, + width: 210, + height: 210, + selectedColor: MyColors.gradiantEndColor, + unselectedColor: MyColors.grey70Color, + child: Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + "99%".toText44(color: Colors.white, isBold: true), + "Completed".tr().toText11(color: MyColors.greyACColor), + 19.height, + "Shift Time".tr().toText11(color: MyColors.greyACColor), + "08:00 - 17:00".toText22(color: Colors.white, isBold: true), + ], + ), + ), + ), + ), + Container( + padding: const EdgeInsets.only(top: 20, bottom: 20), + ), + Stack( + children: [ + Container( + height: 5, + padding: const EdgeInsets.only(top: 24, bottom: 24), + color: MyColors.backgroundBlackColor, + ), + Container( + width: double.infinity, + decoration: const BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), + padding: const EdgeInsets.only(left: 21, right: 21, top: 28, bottom: 24), + child: Column( + children: [ + Row( + children: [ + Container( + margin: const EdgeInsets.only(right: 30, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Actual Check In ".tr().toText11( + color: MyColors.grey67Color, + ), + 8.height, + "08:27".toText22(color: Colors.black, isBold: true), + ], + ), + ), + 40.width, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Actual Check Out".tr().toText11( + color: MyColors.grey67Color, + ), + 8.height, + "18:20".toText22(color: Colors.black, isBold: true), + ], + ), + ], + ), + 25.height, + const Divider( + height: 1, + thickness: 1, + color: MyColors.whiteColor, + ), + 25.height, + Row( + children: [ + Container( + margin: const EdgeInsets.only(right: 30, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Approved Check In".tr().toText11( + color: MyColors.grey67Color, + ), + 8.height, + "09:27".toText22(color: MyColors.greenColor, isBold: true), + ], + ), + ), + 30.width, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Approved Check Out".tr().toText11( + color: MyColors.grey67Color, + ), + 8.height, + "18:20".toText22(color: MyColors.greenColor, isBold: true), + ], + ), + ], + ), + 25.height, + const Divider( + height: 1, + thickness: 1, + color: MyColors.whiteColor, + ), + 25.height, + Row( + children: [ + Container( + margin: const EdgeInsets.only(right: 30, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Late In".tr().toText11( + color: MyColors.grey67Color, + ), + 8.height, + "00:27".toText22(color: MyColors.redColor, isBold: true), + ], + ), + ), + 80.width, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Excess".tr().toText11( + color: MyColors.grey67Color, + ), + 8.height, + "00:00".toText22(color: Colors.black, isBold: true), + ], + ), + ], + ), + 25.height, + const Divider( + height: 1, + thickness: 1, + color: MyColors.whiteColor, + ), + 25.height, + Row( + children: [ + Container( + margin: const EdgeInsets.only(right: 30, left: 15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Shortage".tr().toText11( + color: MyColors.grey67Color, + ), + 8.height, + "00:00".toText22(color: Colors.black, isBold: true), + ], + ), + ), + 80.width, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + "Early Out".tr().toText11( + color: MyColors.grey67Color, + ), + 8.height, + "00:00".toText22(color: Colors.black, isBold: true), + ], + ), + ], + ), + ], + ), + ), + ], + ), + ], + ), + ), + ), + ), + ], + ); + }, + ); + }, + ); + } + + List _getDataSource() { + final List meetings = []; + + // _events.forEach((key, value) { + // final DateTime startTime = DateTime(key.year, key.month, key.day, 21, 0, 0); + // final DateTime endTime = DateTime(key.year, key.month, key.day, 22, 0, 0); + // meetings.add(Meeting("", startTime, endTime, MyColors.backgroundBlackColor, false)); + // }); + return meetings; + } +} + +class MeetingDataSource extends CalendarDataSource { + MeetingDataSource(List 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; +} diff --git a/lib/ui/bottom_sheets/attendence_details_bottom_sheet.dart b/lib/ui/bottom_sheets/attendence_details_bottom_sheet.dart new file mode 100644 index 0000000..4c42d6c --- /dev/null +++ b/lib/ui/bottom_sheets/attendence_details_bottom_sheet.dart @@ -0,0 +1,228 @@ +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:mohem_flutter_app/classes/colors.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/widgets/circular_step_progress_bar.dart'; + +class AttendenceDetailsBottomSheet extends StatefulWidget { + + AttendenceDetailsBottomSheet({Key? key}) : super(key: key); + + @override + _AttendenceDetailsBottomSheetState createState() => _AttendenceDetailsBottomSheetState(); +} + +class _AttendenceDetailsBottomSheetState extends State { + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + bottomSheet:BottomSheet( + + onClosing: () => print("not getting called"), + builder: (_) => Container( + color: Colors.red, + height: MediaQuery.of(context).size.height*0.9, + child: Column( + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.vertical( top: Radius.circular(25.0),), + color: MyColors.backgroundBlackColor, + ), + margin:EdgeInsets.only(top: 45) , + padding: EdgeInsets.only(left: 11, right: 11, bottom: 21), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Center( + child: Padding( + padding: const EdgeInsets.all(10), + child: Container( + margin:EdgeInsets.only(top: 5) , + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(35.0),), + color: Color(0xff464646), + ), + width: 80, + height: 6, + ), + ), + ), + Container( + padding: EdgeInsets.only(top: 25,left: 11, right: 11, bottom: 10), + child: Column(children: [ + "June 13, 2021".toText24(isBold: true, color: Colors.white), + LocaleKeys.attendanceDetails.tr().toText16(color: Color(0xffACACAC)), + // LocaleKeys.timeLeftToday.tr().toText16(color: Color(0xffACACAC)), + 21.height, + ] ), + ), + Center( + child: CircularStepProgressBar( + totalSteps: 16 * 4, + currentStep: 16, + width: 210, + height: 210, + selectedColor: MyColors.gradiantEndColor, + unselectedColor: MyColors.grey70Color, + child: Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + "99%".toText32(color: Colors.white, isBold: true), + "Completed".tr().toText12(color: MyColors.greyACColor), + 19.height, + "Shift Time".tr().toText12(color: MyColors.greyACColor), + "08:00 - 17:00".toText22(color: Colors.white, isBold: true), + ], + ), + ), + ), + ), + ], + ), + ), + Stack( + children: [ + Container( + height: 32, + // padding: EdgeInsets.only(top: 24, bottom: 24), + color: MyColors.backgroundBlackColor, + ), + Container( + width: double.infinity, + decoration: BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), + margin: EdgeInsets.only(top: 10), + padding: EdgeInsets.only(left: 21, right: 21, top: 24, bottom: 24), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children:[ + Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + "Actual Check In ".tr().toText12(color: MyColors.black), + ], + ), + SizedBox(height: 8,), + Row( + children: [ + "08:27".toText22(color: Colors.black, isBold: true), + ], + ), + SizedBox(height: 30,), + Row( + children: [ + "Approved Check In".tr().toText12(color: MyColors.black), + ], + ), + SizedBox(height: 8,), + Row( + children: [ + "09:27".toText22(color: Color(0xff1FA269), isBold: true), + ], + ), + SizedBox(height: 30,), + Row( + children: [ + "Late In".tr().toText12(color: MyColors.black), + ], + ), + SizedBox(height: 8,), + Row( + children: [ + "00:27".toText22(color: Color(0xffD02127), isBold: true), + ], + ), + SizedBox(height: 30,), + Row( + children: [ "Shortage".tr().toText12(color: MyColors.black), + ] ), + SizedBox(height: 8,), + Row( + children: [ + "00:00".toText22(color: Colors.black, isBold: true),], + ), + ], + ), + ], + ), + Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + "Actual Check Out".tr().toText12(color: MyColors.black), + ], + ), + SizedBox(height: 8,), + Row( + children: [ + "18:20".toText22(color: Colors.black, isBold: true),], + ), + SizedBox(height: 30,), + Row( + children: [ "Approved Check Out".tr().toText12(color: MyColors.black), + ], + ), + SizedBox(height: 8,), + Row( + children: [ + "18:20".toText22(color: Color(0xff1FA269), isBold: true),], + ), + SizedBox(height: 30,), + Row( + children: ["Excess".tr().toText12(color: MyColors.black), + ], + ), + SizedBox(height: 8,), + Row( + children: [ + "00:00".toText22(color: Colors.black, isBold: true),], + ), + SizedBox(height: 30,), + Row( + children: ["Early Out".tr().toText12(color: MyColors.black), + ], + ), + SizedBox(height: 8,), + Row( + children: [ + "00:00".toText22(color: Colors.black, isBold: true),], + ), + ], + ), + ], + ), + ] ), + ), + ]), + ], + ), + ) + )); + + } + + +} diff --git a/lib/ui/landing/dashboard.dart b/lib/ui/landing/dashboard.dart index 2c8367a..feb405d 100644 --- a/lib/ui/landing/dashboard.dart +++ b/lib/ui/landing/dashboard.dart @@ -9,6 +9,10 @@ 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/widgets/circular_avatar.dart'; +import 'package:mohem_flutter_app/widgets/circular_step_progress_bar.dart'; + + + class Dashboard extends StatefulWidget { Dashboard({Key? key}) : super(key: key); @@ -407,7 +411,10 @@ class _DashboardState extends State { .tr() .toText12(isUnderLine: true), ], - ).paddingOnly(left: 21, right: 21), + ).paddingOnly(left: 21, right: 21).onPress(() { + Navigator.pushNamed( + context, AppRoutes.monthlyAttendance); + }), SizedBox( height: 103 + 33, child: ListView.separated( @@ -464,4 +471,8 @@ class _DashboardState extends State { ), ); } + + + + } diff --git a/pubspec.lock b/pubspec.lock index 56d2f3f..414fd74 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -28,7 +28,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: @@ -104,6 +104,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_calendar_carousel: + dependency: "direct main" + description: + name: flutter_calendar_carousel + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" flutter_lints: dependency: "direct dev" description: @@ -129,7 +136,7 @@ packages: name: flutter_svg url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.3" flutter_test: dependency: "direct dev" description: flutter @@ -195,14 +202,14 @@ packages: name: local_auth url: "https://pub.dartlang.org" source: hosted - version: "1.1.9" + version: "1.1.10" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" meta: dependency: transitive description: @@ -251,7 +258,7 @@ packages: name: path_provider_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.9" + version: "2.0.11" path_provider_ios: dependency: transitive description: @@ -265,28 +272,28 @@ packages: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.5" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.0.5" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "2.0.3" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.0.5" permission_handler: dependency: "direct main" description: @@ -308,6 +315,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.4.0" + pie_chart: + dependency: "direct main" + description: + name: pie_chart + url: "https://pub.dartlang.org" + source: hosted + version: "5.1.0" platform: dependency: transitive description: @@ -321,7 +335,7 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.1.2" process: dependency: transitive description: @@ -335,35 +349,35 @@ packages: name: provider url: "https://pub.dartlang.org" source: hosted - version: "6.0.1" + version: "6.0.2" shared_preferences: dependency: transitive description: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "2.0.11" + version: "2.0.12" shared_preferences_android: dependency: transitive description: name: shared_preferences_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.9" + version: "2.0.10" shared_preferences_ios: dependency: transitive description: name: shared_preferences_ios url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.0.9" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.0.4" shared_preferences_macos: dependency: transitive description: @@ -384,14 +398,14 @@ packages: name: shared_preferences_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.3" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.0.4" sizer: dependency: "direct main" description: @@ -432,6 +446,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + syncfusion_flutter_calendar: + dependency: "direct main" + description: + name: syncfusion_flutter_calendar + url: "https://pub.dartlang.org" + source: hosted + version: "19.4.48" + syncfusion_flutter_core: + dependency: transitive + description: + name: syncfusion_flutter_core + url: "https://pub.dartlang.org" + source: hosted + version: "19.4.48" + syncfusion_flutter_datepicker: + dependency: transitive + description: + name: syncfusion_flutter_datepicker + url: "https://pub.dartlang.org" + source: hosted + version: "19.4.48" term_glyph: dependency: transitive description: @@ -445,7 +480,14 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.4.3" + timezone: + dependency: transitive + description: + name: timezone + url: "https://pub.dartlang.org" + source: hosted + version: "0.8.0" typed_data: dependency: transitive description: @@ -466,14 +508,14 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" win32: dependency: transitive description: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.3.1" + version: "2.3.9" xdg_directories: dependency: transitive description: @@ -489,5 +531,5 @@ packages: source: hosted version: "5.3.1" sdks: - dart: ">=2.14.0 <3.0.0" + dart: ">=2.15.0 <3.0.0" flutter: ">=2.5.0" diff --git a/pubspec.yaml b/pubspec.yaml index dfbb0eb..bd299c5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -44,6 +44,10 @@ dependencies: sizer: ^2.0.15 local_auth: ^1.1.9 fluttertoast: ^8.0.8 + syncfusion_flutter_calendar: ^19.4.48 + flutter_calendar_carousel: ^2.1.0 + pie_chart: ^5.1.0 + dev_dependencies: From 0974861463116a1338fa1985342316c26f7e2850 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 10 May 2022 16:47:59 +0300 Subject: [PATCH 03/19] updated menus --- lib/api/eit_api_client.dart | 31 +++++ lib/config/routes.dart | 5 + lib/main.dart | 4 +- lib/models/eit/get_eit_transaction_model.dart | 103 ++++++++++++++++ lib/provider/eit_provider_model.dart | 35 ++++++ lib/ui/landing/widget/missing_swipe.dart | 110 ++++++++++++++++++ lib/ui/screens/eit/add_eit.dart | 63 ++++++++++ lib/ui/screens/submenu_screen.dart | 19 ++- 8 files changed, 358 insertions(+), 12 deletions(-) create mode 100644 lib/api/eit_api_client.dart create mode 100644 lib/models/eit/get_eit_transaction_model.dart create mode 100644 lib/provider/eit_provider_model.dart create mode 100644 lib/ui/landing/widget/missing_swipe.dart create mode 100644 lib/ui/screens/eit/add_eit.dart diff --git a/lib/api/eit_api_client.dart b/lib/api/eit_api_client.dart new file mode 100644 index 0000000..e3f78bf --- /dev/null +++ b/lib/api/eit_api_client.dart @@ -0,0 +1,31 @@ +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/basic_member_information_model.dart'; +import 'package:mohem_flutter_app/models/check_mobile_app_version_model.dart'; +import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart'; +import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; +import 'package:mohem_flutter_app/models/eit/get_eit_transaction_model.dart'; +import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/member_login_list_model.dart'; + +import 'api_client.dart'; + +class EITApiClient { + static final EITApiClient _instance = EITApiClient._internal(); + + EITApiClient._internal(); + + factory EITApiClient() => _instance; + + Future?> getEITTransactions(String functionName) async { + String url = "${ApiConsts.erpRest}GET_EIT_TRANSACTIONS"; + Map postParams = {'P_FUNCTION_NAME': functionName, "P_MENU_TYPE": "E", "P_PAGE_LIMIT": 50, "P_PAGE_NUM": 1}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + List? responseData = GET_EIT_Transactions_Model.fromJson(json['GetEITTransactionList'][0]).collectionTransaction; + return responseData; + }, url, postParams); + } +} diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 26a1bfe..aa3fcee 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -6,6 +6,7 @@ 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/screens/eit/add_eit.dart'; import 'package:mohem_flutter_app/ui/screens/submenu_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'; @@ -23,6 +24,7 @@ class AppRoutes { static const String dashboard = "/dashboard"; static const String todayAttendance = "/todayAttendance"; static const String subMenuScreen = "/submenuScreen"; + static const String addEitScreen = "/addeitScreen"; static const String initialRoute = login; //Work List @@ -39,6 +41,9 @@ class AppRoutes { newPassword: (context) => NewPasswordScreen(), forgotPassword: (context) => ForgotPasswordScreen(), todayAttendance: (context) => TodayAttendanceScreen(), + //eit + + addEitScreen: (context) => AddEITScreen(), //Work List workList: (context) => WorkListScreen(), diff --git a/lib/main.dart b/lib/main.dart index 49b0e35..6e6ead2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -7,6 +7,7 @@ import 'package:mohem_flutter_app/config/app_provider.dart'; import 'package:mohem_flutter_app/generated/codegen_loader.g.dart'; import 'package:mohem_flutter_app/models/post_params_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; +import 'package:mohem_flutter_app/provider/eit_provider_model.dart'; import 'package:mohem_flutter_app/theme/app_theme.dart'; import 'package:provider/provider.dart'; import 'package:sizer/sizer.dart'; @@ -14,14 +15,12 @@ import 'package:firebase_core/firebase_core.dart'; import 'config/routes.dart'; import 'package:logger/logger.dart'; - var logger = Logger( // filter: null, // Use the default LogFilter (-> only log in debug mode) printer: PrettyPrinter(lineLength: 0), // Use the PrettyPrinter to format and print log // output: null, // U ); - Future main() async { WidgetsFlutterBinding.ensureInitialized(); await EasyLocalization.ensureInitialized(); @@ -37,6 +36,7 @@ Future main() async { child: MultiProvider( providers: [ ChangeNotifierProvider(create: (_) => DashboardProviderModel()), + ChangeNotifierProvider(create: (_) => EITProviderModel()), ], child: MyApp(), ), diff --git a/lib/models/eit/get_eit_transaction_model.dart b/lib/models/eit/get_eit_transaction_model.dart new file mode 100644 index 0000000..186ef9c --- /dev/null +++ b/lib/models/eit/get_eit_transaction_model.dart @@ -0,0 +1,103 @@ +class GET_EIT_Transactions_Model { + List? collectionTransaction; + + GET_EIT_Transactions_Model({this.collectionTransaction}); + + GET_EIT_Transactions_Model.fromJson(Map json) { + if (json['Collection_Transaction'] != null) { + collectionTransaction = []; + json['Collection_Transaction'].forEach((v) { + collectionTransaction!.add(new CollectionTransaction.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.collectionTransaction != null) { + data['Collection_Transaction'] = this.collectionTransaction!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class CollectionTransaction { + String? aPPLICATIONCOLUMNNAME; + String? dATATYPE; + String? dATEVALUE; + String? dESCFLEXCONTEXTCODE; + String? dESCFLEXNAME; + String? dISPLAYFLAG; + int? fROMROWNUM; + int? nOOFROWS; + dynamic? nUMBERVALUE; + int? rOWNUM; + String? sEGMENTNAME; + String? sEGMENTPROMPT; + int? sEGMENTSEQNUM; + String? sEGMENTVALUEDSP; + int? tOROWNUM; + int? tRANSACTIONNUMBER; + String? vARCHAR2VALUE; + + CollectionTransaction( + {this.aPPLICATIONCOLUMNNAME, + this.dATATYPE, + this.dATEVALUE, + this.dESCFLEXCONTEXTCODE, + this.dESCFLEXNAME, + this.dISPLAYFLAG, + this.fROMROWNUM, + this.nOOFROWS, + this.nUMBERVALUE, + this.rOWNUM, + this.sEGMENTNAME, + this.sEGMENTPROMPT, + this.sEGMENTSEQNUM, + this.sEGMENTVALUEDSP, + this.tOROWNUM, + this.tRANSACTIONNUMBER, + this.vARCHAR2VALUE}); + + CollectionTransaction.fromJson(Map json) { + aPPLICATIONCOLUMNNAME = json['APPLICATION_COLUMN_NAME']; + dATATYPE = json['DATATYPE']; + dATEVALUE = json['DATE_VALUE']; + dESCFLEXCONTEXTCODE = json['DESC_FLEX_CONTEXT_CODE']; + dESCFLEXNAME = json['DESC_FLEX_NAME']; + dISPLAYFLAG = json['DISPLAY_FLAG']; + fROMROWNUM = json['FROM_ROW_NUM']; + nOOFROWS = json['NO_OF_ROWS']; + nUMBERVALUE = json['NUMBER_VALUE']; + rOWNUM = json['ROW_NUM']; + sEGMENTNAME = json['SEGMENT_NAME']; + sEGMENTPROMPT = json['SEGMENT_PROMPT']; + sEGMENTSEQNUM = json['SEGMENT_SEQ_NUM']; + sEGMENTVALUEDSP = json['SEGMENT_VALUE_DSP']; + tOROWNUM = json['TO_ROW_NUM']; + tRANSACTIONNUMBER = json['TRANSACTION_NUMBER']; + 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['DESC_FLEX_CONTEXT_CODE'] = this.dESCFLEXCONTEXTCODE; + data['DESC_FLEX_NAME'] = this.dESCFLEXNAME; + data['DISPLAY_FLAG'] = this.dISPLAYFLAG; + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['NUMBER_VALUE'] = this.nUMBERVALUE; + data['ROW_NUM'] = this.rOWNUM; + data['SEGMENT_NAME'] = this.sEGMENTNAME; + data['SEGMENT_PROMPT'] = this.sEGMENTPROMPT; + data['SEGMENT_SEQ_NUM'] = this.sEGMENTSEQNUM; + data['SEGMENT_VALUE_DSP'] = this.sEGMENTVALUEDSP; + data['TO_ROW_NUM'] = this.tOROWNUM; + data['TRANSACTION_NUMBER'] = this.tRANSACTIONNUMBER; + data['VARCHAR2_VALUE'] = this.vARCHAR2VALUE; + return data; + } +} diff --git a/lib/provider/eit_provider_model.dart b/lib/provider/eit_provider_model.dart new file mode 100644 index 0000000..664e5cc --- /dev/null +++ b/lib/provider/eit_provider_model.dart @@ -0,0 +1,35 @@ +import 'dart:convert'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/dashboard_api_client.dart'; +import 'package:mohem_flutter_app/api/eit_api_client.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/main.dart'; +import 'package:mohem_flutter_app/models/dashboard/get_attendance_tracking_list_model.dart'; +import 'package:mohem_flutter_app/models/dashboard/itg_forms_model.dart'; +import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; +import 'package:mohem_flutter_app/models/dashboard/menus.dart'; +import 'package:mohem_flutter_app/models/eit/get_eit_transaction_model.dart'; +import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/widgets/Updater.dart'; + +/// Mix-in [DiagnosticableTreeMixin] to have access to [debugFillProperties] for the devtool +// ignore: prefer_mixin +class EITProviderModel with ChangeNotifier, DiagnosticableTreeMixin { + List? eitTransactionList; + late bool isEitLoaded = false; + void getEITList(String functionName) async { + try { + eitTransactionList = await EITApiClient().getEITTransactions(functionName); + isEitLoaded = true; + + notifyListeners(); + } catch (ex) { + isEitLoaded = false; + logger.wtf(ex); + notifyListeners(); + Utils.handleException(ex, null); + } + } +} diff --git a/lib/ui/landing/widget/missing_swipe.dart b/lib/ui/landing/widget/missing_swipe.dart new file mode 100644 index 0000000..ebd011a --- /dev/null +++ b/lib/ui/landing/widget/missing_swipe.dart @@ -0,0 +1,110 @@ +import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:mohem_flutter_app/classes/colors.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/dashboard/menus.dart'; +import 'package:mohem_flutter_app/models/eit/get_eit_transaction_model.dart'; +import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; +import 'package:mohem_flutter_app/provider/eit_provider_model.dart'; +import 'package:mohem_flutter_app/ui/work_list/work_list_screen.dart'; +import 'package:mohem_flutter_app/widgets/loading_dialog.dart'; +import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; +import 'package:provider/provider.dart'; + +class MissingSwipe extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, data, child) { + return !data.isEitLoaded + ? LoadingDialog() + : SizedBox( + width: double.infinity, + height: double.infinity, + child: ListView.separated( + itemBuilder: (context, index) { + return rowItem(data.eitTransactionList![index]); + }, + separatorBuilder: (context, index) { + return 12.height; + }, + itemCount: data.eitTransactionList?.length ?? 0, + padding: EdgeInsets.only(left: 21, right: 21), + )); + }, + ); + } + + Widget rowItem(CollectionTransaction types) { + return InkWell( + onTap: () { + // Navigator.pushNamed(context, AppRoutes.missingSwipe); + }, + child: Container( + width: double.infinity, + padding: EdgeInsets.all(12), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(10), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + gradient: LinearGradient(transform: GradientRotation(.46), begin: Alignment.topRight, end: Alignment.bottomRight, colors: [Colors.red, Colors.blue]), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SvgPicture.asset( + "assets/images/miss_swipe.svg", + color: Colors.white, + ), + 2.height, + Text(types.aPPLICATIONCOLUMNNAME.toString()) + ], + ).paddingAll(6), + ), + 12.width, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + "Missing Swipe Request".toText16(), + "Missing Swipe Request for Hussain, Mohammad has been approved".toText10(), + 12.height, + Row( + children: [ + Expanded(child: "07 Jan 2021".toText10(color: MyColors.lightTextColor)), + SvgPicture.asset( + "assets/images/arrow_next.svg", + color: MyColors.darkIconColor, + ) + ], + ), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/ui/screens/eit/add_eit.dart b/lib/ui/screens/eit/add_eit.dart new file mode 100644 index 0000000..44918fb --- /dev/null +++ b/lib/ui/screens/eit/add_eit.dart @@ -0,0 +1,63 @@ +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; +import 'package:mohem_flutter_app/models/dashboard/menus.dart'; +import 'package:mohem_flutter_app/provider/eit_provider_model.dart'; +import 'package:mohem_flutter_app/ui/app_bar.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/ui/landing/widget/missing_swipe.dart'; +import 'package:provider/provider.dart'; + +class AddEITScreen extends StatelessWidget { + late GetMenuEntriesList getMenu; + late EITProviderModel data; + + @override + Widget build(BuildContext context) { + getMenu = ModalRoute.of(context)!.settings.arguments as GetMenuEntriesList; + + data = Provider.of(context, listen: false); + data.getEITList(getMenu.functionName.toString()); + return DefaultTabController( + length: 2, + child: Scaffold( + backgroundColor: Colors.white, + appBar: appBar( + context, + title: getMenu.prompt.toString(), + ), + body: Container( + width: double.infinity, + height: double.infinity, + child: Column(children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(20), bottomRight: Radius.circular(20)), + gradient: LinearGradient(transform: GradientRotation(.46), begin: Alignment.topRight, end: Alignment.bottomRight, colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ]), + ), + clipBehavior: Clip.antiAlias, + child: TabBar( + indicatorColor: Colors.white, + labelColor: Colors.white, + tabs: [ + Tab( + text: "Missing Swipe", + ), + Tab( + text: "Swipe Request", + ), + ], + ), + ), + Expanded( + child: TabBarView( + children: [MissingSwipe(), Container()], + ), + ) + ])), + )); + } +} diff --git a/lib/ui/screens/submenu_screen.dart b/lib/ui/screens/submenu_screen.dart index bc9fbc9..0b3fdbd 100644 --- a/lib/ui/screens/submenu_screen.dart +++ b/lib/ui/screens/submenu_screen.dart @@ -1,19 +1,12 @@ -import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/svg.dart'; -import 'package:mohem_flutter_app/classes/colors.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/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/dashboard/menus.dart'; import 'package:mohem_flutter_app/ui/app_bar.dart'; -import 'package:mohem_flutter_app/extensions/string_extensions.dart'; -import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; class SubMenuScreen extends StatelessWidget { late Menus menu; - @override Widget build(BuildContext context) { menu = ModalRoute.of(context)!.settings.arguments as Menus; @@ -27,14 +20,20 @@ class SubMenuScreen extends StatelessWidget { width: double.infinity, height: double.infinity, child: Column( - children: menu.menuEntiesList.map((i) => rowItem(i)).toList(), + children: menu.menuEntiesList.map((i) => rowItem(i, context)).toList(), )), ); } - Widget rowItem(GetMenuEntriesList obj) { + Widget rowItem(obj, context) { return InkWell( - onTap: () {}, + onTap: () { + Navigator.pushNamed( + context, + AppRoutes.addEitScreen, + arguments: obj, + ); + }, child: Container( width: double.infinity, padding: EdgeInsets.all(12), From 339b343c4cc9f4a1b7f39aa97679e8cbb9211f59 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 11 May 2022 10:24:34 +0300 Subject: [PATCH 04/19] fix calendar --- assets/langs/ar-SA.json | 19 ++++++ assets/langs/en-US.json | 21 ++++++- lib/generated/codegen_loader.g.dart | 40 +++++++++++- lib/ui/attendance/monthly_attendance.dart | 77 ++++++++++++++++------- 4 files changed, 132 insertions(+), 25 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 9c9b933..614e233 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -50,6 +50,25 @@ "changePassword": "تغيير كلمة المرور", "itemsForSale": "سلع للبيع", "attendanceDetails": "تفاصيل الحضور", + "order": "الطلبات", + "earlyOut" : "الخروج مبكرا", + "shortage" : "ساعات التقصير", + "excess" : "Excess", + "lateIn" : "القدوم المتاخر", + "approvedCheckOut": "وقت الخروج", + "approvedCheckIn":"وقت الدخول", + "actualCheckOut": "وقت الخروج", + "actualCheckIn": "وقت الدخول", + "present": "حضور", + "shiftTime": "وقت التناوب", + "absent": "غياب", + "attendance": "الحضور", + "scheduleDays" :"ايام العمل", + "offDays":"ايام الراحه", + "nonAnalyzed" : "لايوجد تحليل", + "shortageHour": "ساعات التقصير", + "stats": "الحاله", + "completed": "تم اكمال", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 538c567..221da4a 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -49,7 +49,26 @@ "loginCodeWillSentToMobileNumber": "Please Enter your Employee ID, A login code will be sent to your mobile number", "changePassword": "Change Password", "itemsForSale": "Items for Sale", - "attendanceDetails": "Attendence Details", + "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", + "shiftTime": "Shift Time", + "absent": "ABSENT 10", + "attendance": "Attendance", + "scheduleDays" :"Schedule\nDays", + "offDays":"Off\nDays", + "nonAnalyzed" : "Non\nAnalyzed", + "shortageHour": "Shortage\nHour", + "stats": "Stats", + "completed": "Completed", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 23003fe..522166a 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -66,6 +66,25 @@ class CodegenLoader extends AssetLoader{ "changePassword": "تغيير كلمة المرور", "itemsForSale": "سلع للبيع", "attendanceDetails": "تفاصيل الحضور", + "order": "الطلبات", + "earlyOut": "الخروج مبكرا", + "shortage": "ساعات التقصير", + "excess": "Excess", + "lateIn": "القدوم المتاخر", + "approvedCheckOut": "وقت الخروج", + "approvedCheckIn": "وقت الدخول", + "actualCheckOut": "وقت الخروج", + "actualCheckIn": "وقت الدخول", + "present": "حضور", + "shiftTime": "وقت التناوب", + "absent": "غياب", + "attendance": "الحضور", + "scheduleDays": "ايام العمل", + "offDays": "ايام الراحه", + "nonAnalyzed": "لايوجد تحليل", + "shortageHour": "ساعات التقصير", + "stats": "الحاله", + "completed": "تم اكمال", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", @@ -155,7 +174,26 @@ static const Map en_US = { "loginCodeWillSentToMobileNumber": "Please Enter your Employee ID, A login code will be sent to your mobile number", "changePassword": "Change Password", "itemsForSale": "Items for Sale", - "attendanceDetails": "Attendence Details", + "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", + "shiftTime": "Shift Time", + "absent": "ABSENT 10", + "attendance": "Attendance", + "scheduleDays": "Schedule\nDays", + "offDays": "Off\nDays", + "nonAnalyzed": "Non\nAnalyzed", + "shortageHour": "Shortage\nHour", + "stats": "Stats", + "completed": "Completed", "msg": "Hello {} in the {} world ", "msg_named": "{} are written in the {lang} language", "clickMe": "Click me", diff --git a/lib/ui/attendance/monthly_attendance.dart b/lib/ui/attendance/monthly_attendance.dart index ff370a3..af7df52 100644 --- a/lib/ui/attendance/monthly_attendance.dart +++ b/lib/ui/attendance/monthly_attendance.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; @@ -26,8 +27,12 @@ class _MonthlyAttendanceState extends State { bool isMissingDays = true; bool isOffDays = true; + + DateTime date = DateTime.now(); + late var formattedDate; @override void initState() { + formattedDate = DateFormat('d-MMM-yy').format(date); super.initState(); } @@ -61,14 +66,16 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Attendance".toText24(isBold: true, color: MyColors.darkIconColor), + LocaleKeys.attendance + .tr().toText24(isBold: true, color: MyColors.darkIconColor), Row( children: [ - "June 13, 2021".toText16(color: MyColors.greyACColor), + Text(formattedDate), + // "June 13, 2021".toText16(color: MyColors.greyACColor), const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor), ], - ).onPress(() { - showDatePicker( + ).onPress(() async { + await showDatePicker( context: context, initialDate: DateTime.now(), firstDate: DateTime(2021), @@ -87,7 +94,14 @@ class _MonthlyAttendanceState extends State { child: child!, ); }, - ); + ).then((selectedDate) { + if (selectedDate != null) { + setState(() { + date = selectedDate; + formattedDate = DateFormat('d-MMM-yy').format(selectedDate); + }); + } + }); }) ], ).paddingOnly(left: 21, right: 21), @@ -96,13 +110,16 @@ class _MonthlyAttendanceState extends State { Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - optionUI("Schedule\nDays", "16"), + optionUI(LocaleKeys.scheduleDays.tr(), "16"), 6.width, - optionUI("Off\nDays", "0"), + optionUI(LocaleKeys.offDays + .tr(), "0"), 6.width, - optionUI("Non\nAnalyzed", "0"), + optionUI(LocaleKeys.nonAnalyzed + .tr(), "0"), 6.width, - optionUI("Shortage\nHour", "6"), + optionUI(LocaleKeys.shortageHour + .tr(), "6"), ], ).paddingOnly(left: 21, right: 21), 35.height, @@ -127,8 +144,10 @@ class _MonthlyAttendanceState extends State { children: [ Column( children: [ - "Attendance".toText12(isBold: true, color: MyColors.grey3AColor), - "Stats".toText24(isBold: true, color: MyColors.grey3AColor), + LocaleKeys.attendance + .tr().toText12(isBold: true, color: MyColors.grey3AColor), + LocaleKeys.stats + .tr().toText24(isBold: true, color: MyColors.grey3AColor), ], ).paddingOnly(left: 21, top: 29, bottom: 36), Row( @@ -143,7 +162,8 @@ class _MonthlyAttendanceState extends State { ), Container( margin: const EdgeInsets.only(left: 5, right: 5), - child: "PRESENT 16".toText16(isBold: true, color: MyColors.lightGreenColor), + child: LocaleKeys.present + .tr().toText16(isBold: true, color: MyColors.lightGreenColor), ), ], ).paddingOnly(left: 21, right: 23), @@ -160,7 +180,8 @@ class _MonthlyAttendanceState extends State { ), Container( margin: const EdgeInsets.only(left: 5, right: 5), - child: "ABSENT 04".toText16( + child: LocaleKeys.absent + .tr().toText16( isBold: true, color: MyColors.backgroundBlackColor, ), @@ -432,9 +453,11 @@ class _MonthlyAttendanceState extends State { mainAxisSize: MainAxisSize.min, children: [ "99%".toText44(color: Colors.white, isBold: true), - "Completed".tr().toText11(color: MyColors.greyACColor), + LocaleKeys.completed + .tr().toText11(color: MyColors.greyACColor), 19.height, - "Shift Time".tr().toText11(color: MyColors.greyACColor), + LocaleKeys.shiftTime + .tr().toText11(color: MyColors.greyACColor), "08:00 - 17:00".toText22(color: Colors.white, isBold: true), ], ), @@ -464,7 +487,8 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Actual Check In ".tr().toText11( + LocaleKeys.actualCheckIn + .tr().toText11( color: MyColors.grey67Color, ), 8.height, @@ -476,7 +500,8 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Actual Check Out".tr().toText11( + LocaleKeys.actualCheckOut + .tr().toText11( color: MyColors.grey67Color, ), 8.height, @@ -499,7 +524,8 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Approved Check In".tr().toText11( + LocaleKeys.approvedCheckIn + .tr().toText11( color: MyColors.grey67Color, ), 8.height, @@ -511,7 +537,8 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Approved Check Out".tr().toText11( + LocaleKeys.approvedCheckOut + .tr().toText11( color: MyColors.grey67Color, ), 8.height, @@ -534,7 +561,8 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Late In".tr().toText11( + LocaleKeys.lateIn + .tr().toText11( color: MyColors.grey67Color, ), 8.height, @@ -546,7 +574,8 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Excess".tr().toText11( + LocaleKeys.excess + .tr().toText11( color: MyColors.grey67Color, ), 8.height, @@ -569,7 +598,8 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Shortage".tr().toText11( + LocaleKeys.shortage + .tr().toText11( color: MyColors.grey67Color, ), 8.height, @@ -581,7 +611,8 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Early Out".tr().toText11( + LocaleKeys.earlyOut + .tr().toText11( color: MyColors.grey67Color, ), 8.height, From 4d9405a8dbe5211b06ba27279480b8b35eebea48 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 11 May 2022 10:30:21 +0300 Subject: [PATCH 05/19] fix --- lib/generated/locale_keys.g.dart | 89 ++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 lib/generated/locale_keys.g.dart diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart new file mode 100644 index 0000000..41d8750 --- /dev/null +++ b/lib/generated/locale_keys.g.dart @@ -0,0 +1,89 @@ +// DO NOT EDIT. This is code generated via package:easy_localization/generate.dart + +abstract class LocaleKeys { + static const mohemm = 'mohemm'; + static const english = 'english'; + static const arabic = 'arabic'; + static const login = 'login'; + static const pleaseEnterLoginDetails = 'pleaseEnterLoginDetails'; + static const username = 'username'; + static const password = 'password'; + static const welcomeBack = 'welcomeBack'; + static const wouldYouLikeToLoginWithCurrentUsername = 'wouldYouLikeToLoginWithCurrentUsername'; + static const lastLoginDetails = 'lastLoginDetails'; + static const verificationType = 'verificationType'; + static const pleaseVerify = 'pleaseVerify'; + static const verifyThroughFace = 'verifyThroughFace'; + static const verifyThroughFingerprint = 'verifyThroughFingerprint'; + static const verifyThroughSMS = 'verifyThroughSMS'; + static const verifyThroughWhatsapp = 'verifyThroughWhatsapp'; + static const useAnotherAccount = 'useAnotherAccount'; + static const pleaseEnterTheVerificationCodeSentTo = 'pleaseEnterTheVerificationCodeSentTo'; + static const theVerificationCodeWillExpireIn = 'theVerificationCodeWillExpireIn'; + static const goodMorning = 'goodMorning'; + static const markAttendance = 'markAttendance'; + static const timeLeftToday = 'timeLeftToday'; + static const checkIn = 'checkIn'; + static const workList = 'workList'; + static const leaveBalance = 'leaveBalance'; + static const missingSwipes = 'missingSwipes'; + static const ticketBalance = 'ticketBalance'; + static const services = 'services'; + static const viewAllServices = 'viewAllServices'; + static const monthlyAttendance = 'monthlyAttendance'; + static const workFromHome = 'workFromHome'; + static const ticketRequest = 'ticketRequest'; + static const viewAllOffers = 'viewAllOffers'; + static const offers = 'offers'; + static const discounts = 'discounts'; + static const newString = 'newString'; + static const setTheNewPassword = 'setTheNewPassword'; + static const typeYourNewPasswordBelow = 'typeYourNewPasswordBelow'; + static const confirmPassword = 'confirmPassword'; + static const update = 'update'; + static const title = 'title'; + static const home = 'home'; + static const mySalary = 'mySalary'; + static const createRequest = 'createRequest'; + static const forgotPassword = 'forgotPassword'; + static const employeeId = 'employeeId'; + static const loginCodeWillSentToMobileNumber = 'loginCodeWillSentToMobileNumber'; + static const changePassword = 'changePassword'; + 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 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 human = 'human'; + static const resources = 'resources'; + 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 = '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'; + +} From 49bc689351d270d728ccc48a17205105f8680b3a Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 18 May 2022 10:41:53 +0300 Subject: [PATCH 06/19] Merge branch 'development_sikander' of https://gitlab.com/mirza.shafique/mohem_flutter_app into development_sultan --- lib/provider/eit_provider_model.dart | 5 +++-- lib/ui/screens/eit/add_eit.dart | 11 ++++++----- lib/ui/screens/submenu_screen.dart | 12 +++++++----- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/provider/eit_provider_model.dart b/lib/provider/eit_provider_model.dart index 664e5cc..1543184 100644 --- a/lib/provider/eit_provider_model.dart +++ b/lib/provider/eit_provider_model.dart @@ -1,5 +1,4 @@ import 'dart:convert'; - import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/dashboard_api_client.dart'; @@ -29,7 +28,9 @@ class EITProviderModel with ChangeNotifier, DiagnosticableTreeMixin { isEitLoaded = false; logger.wtf(ex); notifyListeners(); - Utils.handleException(ex, null); + Utils.handleException(ex, null, (ts) { + print(ts); + }); } } } diff --git a/lib/ui/screens/eit/add_eit.dart b/lib/ui/screens/eit/add_eit.dart index 44918fb..0dbcd1c 100644 --- a/lib/ui/screens/eit/add_eit.dart +++ b/lib/ui/screens/eit/add_eit.dart @@ -3,9 +3,9 @@ import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/dashboard/menus.dart'; import 'package:mohem_flutter_app/provider/eit_provider_model.dart'; -import 'package:mohem_flutter_app/ui/app_bar.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/ui/landing/widget/missing_swipe.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:provider/provider.dart'; class AddEITScreen extends StatelessWidget { @@ -22,10 +22,11 @@ class AddEITScreen extends StatelessWidget { length: 2, child: Scaffold( backgroundColor: Colors.white, - appBar: appBar( - context, - title: getMenu.prompt.toString(), - ), + appBar: AppBarWidget(context, title: getMenu.prompt.toString()), + //AppBar( + + // title: getMenu.prompt.toString(), + // ), body: Container( width: double.infinity, height: double.infinity, diff --git a/lib/ui/screens/submenu_screen.dart b/lib/ui/screens/submenu_screen.dart index 0b3fdbd..fbb1c40 100644 --- a/lib/ui/screens/submenu_screen.dart +++ b/lib/ui/screens/submenu_screen.dart @@ -2,8 +2,8 @@ import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/dashboard/menus.dart'; -import 'package:mohem_flutter_app/ui/app_bar.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; class SubMenuScreen extends StatelessWidget { late Menus menu; @@ -12,10 +12,12 @@ class SubMenuScreen extends StatelessWidget { menu = ModalRoute.of(context)!.settings.arguments as Menus; return Scaffold( backgroundColor: Colors.white, - appBar: appBar( - context, - title: menu.menuEntry.prompt.toString(), - ), + appBar: AppBarWidget(context, title: menu.menuEntry.prompt.toString()), + // AppBar( + // context, + // title: menu.menuEntry.prompt.toString(), + // ), + body: Container( width: double.infinity, height: double.infinity, From b281efe14c5442dd66250a59b0c26ddd9785c868 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Sun, 22 May 2022 09:13:25 +0300 Subject: [PATCH 07/19] fix monthly attendance --- assets/langs/ar-SA.json | 2 + assets/langs/en-US.json | 2 + lib/api/monthlyAttendance_api_client.dart | 72 +++++ lib/classes/colors.dart | 2 +- lib/models/generic_response_model.dart | 48 ++- ...get_day_hours_type_details_list_model.dart | 180 +++++++++++ ...et_schedule_shifts_details_list_model.dart | 129 ++++++++ .../get_time_card_summary_list_model.dart | 153 ++++++++++ lib/ui/attendance/monthly_attendance.dart | 279 ++++++++++++------ .../attendence_details_bottom_sheet.dart | 2 +- lib/ui/landing/widget/services_widget.dart | 5 +- 11 files changed, 774 insertions(+), 100 deletions(-) create mode 100644 lib/api/monthlyAttendance_api_client.dart create mode 100644 lib/models/get_day_hours_type_details_list_model.dart create mode 100644 lib/models/get_schedule_shifts_details_list_model.dart create mode 100644 lib/models/get_time_card_summary_list_model.dart diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index d9d2a54..275a647 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -63,6 +63,7 @@ "actualCheckOut": "وقت الخروج", "actualCheckIn": "وقت الدخول", "present": "حضور", + "pres" : "حضور", "shiftTime": "وقت التناوب", "absent": "غياب", "attendance": "الحضور", @@ -225,6 +226,7 @@ "requestDate": "تاريخ الطلب", "analyzedDate": "تاريخ التحليل", "urgent": "العاجلة", + "approvedCheckIn" : "وقت الدخول", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 857437e..301fd7f 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -63,6 +63,7 @@ "actualCheckOut": "Actual Check Out", "actualCheckIn": "Actual Check In", "present": "PRESENT 11", + "pres" : "present", "shiftTime": "Shift Time", "absent": "ABSENT 10", "attendance": "Attendance", @@ -223,6 +224,7 @@ "relatedTo": "Related To", "requestDate": "Request Date", "analyzedDate": "Analyzed Date", + "approvedCheckIn" : "Approved Check In", "urgent": "Urgent", "profile": { "reset_password": { diff --git a/lib/api/monthlyAttendance_api_client.dart b/lib/api/monthlyAttendance_api_client.dart new file mode 100644 index 0000000..4f6aca7 --- /dev/null +++ b/lib/api/monthlyAttendance_api_client.dart @@ -0,0 +1,72 @@ + +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_day_hours_type_details_list_model.dart'; +import 'package:mohem_flutter_app/models/get_mobile_login_info_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 'api_client.dart'; + +class MonthlyAttendanceApiClient { + static final MonthlyAttendanceApiClient _instance = MonthlyAttendanceApiClient._internal(); + + MonthlyAttendanceApiClient._internal(); + + factory MonthlyAttendanceApiClient() => _instance; + + + Future getTimeCardSummary(String month, int year) async { + String url = "${ApiConsts.erpRest}GET_TIME_CARD_SUMMARY"; + Map postParams = { + "P_MENU_TYPE": "E", + "P_SELECTED_RESP_ID": -999, + "SearchMonth": month, + "SearchYear": year, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return (responseData.getTimeCardSummaryList?.length ?? 0) > 0 ? responseData.getTimeCardSummaryList!.first : null; + }, url, postParams); + } + + Future> getDayHoursTypeDetails(String month, int year) async { + String url = "${ApiConsts.erpRest}GET_DAY_HOURS_TYPE_DETAILS"; + Map postParams = { + "P_MENU_TYPE": "E", + "P_PAGE_LIMIT": 100, + "P_PAGE_NUM": 1, + "P_SELECTED_RESP_ID": -999, + "SearchMonth": month, + "SearchYear": year, + }; + postParams.addAll(AppState().postParamsJson); + // postParams["DeviceToken"] = deviceToken; + // postParams["DeviceType"] = deviceType; + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + print("Response Data______"); + print(responseData.getDayHoursTypeDetailsList!.length); + return responseData.getDayHoursTypeDetailsList ?? []; + }, url, postParams); + } + + + Future getScheduleShiftsDetails(int pRTPID) async { + String url = "${ApiConsts.erpRest}GET_SCHEDULE_SHIFTS_DETAILS"; + Map postParams = { + "P_PAGE_LIMIT": 10, + "P_PAGE_NUM": 1, + "P_RTP_ID": pRTPID, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return (responseData.getScheduleShiftsDetailsList?.length ?? 0) > 0 ? responseData.getScheduleShiftsDetailsList!.first : null; + }, url, postParams); + } + +} \ No newline at end of file diff --git a/lib/classes/colors.dart b/lib/classes/colors.dart index 5643297..80fbbe7 100644 --- a/lib/classes/colors.dart +++ b/lib/classes/colors.dart @@ -27,7 +27,7 @@ class MyColors { static const Color white = Color(0xffffffff); static const Color green = Color(0xffffffff); static const Color borderColor = Color(0xffE8E8E8); - static const Color grey67Color = Color(0xff676767); + // static const Color grey67Color = Color(0xff676767); static const Color whiteColor = Color(0xFFEEEEEE); static const Color greenColor = Color(0xff1FA269); static const Color lightGreenColor = Color(0xff2AB2AB); diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 1c19832..f8403dd 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -2,6 +2,7 @@ import 'package:mohem_flutter_app/models/get_absence_collection_notification_bod 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_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'; @@ -9,8 +10,10 @@ import 'package:mohem_flutter_app/models/get_notification_buttons_list_model.dar import 'package:mohem_flutter_app/models/get_po_Item_history_list_model.dart'; import 'package:mohem_flutter_app/models/get_po_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_quotation_analysis_list_model.dart'; +import 'package:mohem_flutter_app/models/get_schedule_shifts_details_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ms_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_model.dart'; +import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/models/member_login_list_model.dart'; import 'package:mohem_flutter_app/models/notification_action_model.dart'; import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; @@ -104,7 +107,7 @@ class GenericResponseModel { List? getContactDffStructureList; List? getContactNotificationBodyList; List? getCountriesList; - List? getDayHoursTypeDetailsList; + List? getDayHoursTypeDetailsList; List? getDeductionsList; List? getDefaultValueList; List? getEITCollectionNotificationBodyList; @@ -149,7 +152,7 @@ class GenericResponseModel { List? getSITCollectionNotificationBodyList; List? getSITDFFStructureList; List? getSITTransactionList; - List? getScheduleShiftsDetailsList; + List? getScheduleShiftsDetailsList; List? getShiftTypesList; List? getStampMsNotificationBodyList; List? getStampNsNotificationBodyList; @@ -161,7 +164,7 @@ class GenericResponseModel { List? getTermColsStructureList; List? getTermDffStructureList; List? getTermNotificationBodyList; - List? getTimeCardSummaryList; + List? getTimeCardSummaryList; List? getUserItemTypesList; List? getVacationRulesList; List? getVaccinationOnHandList; @@ -637,7 +640,13 @@ class GenericResponseModel { getContactDffStructureList = json['GetContactDffStructureList']; getContactNotificationBodyList = json['GetContactNotificationBodyList']; getCountriesList = json['GetCountriesList']; - getDayHoursTypeDetailsList = json['GetDayHoursTypeDetailsList']; + if (json['GetDayHoursTypeDetailsList'] != null) { + getDayHoursTypeDetailsList = []; + json['GetDayHoursTypeDetailsList'].forEach((v) { + getDayHoursTypeDetailsList! + .add(new GetDayHoursTypeDetailsList.fromJson(v)); + }); + } getDeductionsList = json['GetDeductionsList']; getDefaultValueList = json['GetDefaultValueList']; getEITCollectionNotificationBodyList = json['GetEITCollectionNotificationBodyList']; @@ -712,7 +721,13 @@ class GenericResponseModel { getSITCollectionNotificationBodyList = json['GetSITCollectionNotificationBodyList']; getSITDFFStructureList = json['GetSITDFFStructureList']; getSITTransactionList = json['GetSITTransactionList']; - getScheduleShiftsDetailsList = json['GetScheduleShiftsDetailsList']; + if (json['GetScheduleShiftsDetailsList'] != null) { + getScheduleShiftsDetailsList = []; + json['GetScheduleShiftsDetailsList'].forEach((v) { + getScheduleShiftsDetailsList! + .add(new GetScheduleShiftsDetailsList.fromJson(v)); + }); + } getShiftTypesList = json['GetShiftTypesList']; if (json['GetStampMsNotificationBodyList'] != null) { @@ -743,7 +758,13 @@ class GenericResponseModel { getTermColsStructureList = json['GetTermColsStructureList']; getTermDffStructureList = json['GetTermDffStructureList']; getTermNotificationBodyList = json['GetTermNotificationBodyList']; - getTimeCardSummaryList = json['GetTimeCardSummaryList']; + + if (json['GetTimeCardSummaryList'] != null) { + getTimeCardSummaryList = []; + json['GetTimeCardSummaryList'].forEach((v) { + getTimeCardSummaryList!.add(new GetTimeCardSummaryList.fromJson(v)); + }); + } getUserItemTypesList = json['GetUserItemTypesList']; getVacationRulesList = json['GetVacationRulesList']; getVaccinationOnHandList = json['GetVaccinationOnHandList']; @@ -1002,7 +1023,10 @@ class GenericResponseModel { data['GetContactDffStructureList'] = this.getContactDffStructureList; data['GetContactNotificationBodyList'] = this.getContactNotificationBodyList; data['GetCountriesList'] = this.getCountriesList; - data['GetDayHoursTypeDetailsList'] = this.getDayHoursTypeDetailsList; + if (this.getDayHoursTypeDetailsList != null) { + data['GetDayHoursTypeDetailsList'] = + this.getDayHoursTypeDetailsList!.map((v) => v.toJson()).toList(); + } data['GetDeductionsList'] = this.getDeductionsList; data['GetDefaultValueList'] = this.getDefaultValueList; data['GetEITCollectionNotificationBodyList'] = this.getEITCollectionNotificationBodyList; @@ -1067,7 +1091,10 @@ class GenericResponseModel { data['GetSITCollectionNotificationBodyList'] = this.getSITCollectionNotificationBodyList; data['GetSITDFFStructureList'] = this.getSITDFFStructureList; data['GetSITTransactionList'] = this.getSITTransactionList; - data['GetScheduleShiftsDetailsList'] = this.getScheduleShiftsDetailsList; + if (this.getScheduleShiftsDetailsList != null) { + data['GetScheduleShiftsDetailsList'] = + this.getScheduleShiftsDetailsList!.map((v) => v.toJson()).toList(); + } data['GetShiftTypesList'] = this.getShiftTypesList; if (this.getStampMsNotificationBodyList != null) { @@ -1092,7 +1119,10 @@ class GenericResponseModel { data['GetTermColsStructureList'] = this.getTermColsStructureList; data['GetTermDffStructureList'] = this.getTermDffStructureList; data['GetTermNotificationBodyList'] = this.getTermNotificationBodyList; - data['GetTimeCardSummaryList'] = this.getTimeCardSummaryList; + if (this.getTimeCardSummaryList != null) { + data['GetTimeCardSummaryList'] = + this.getTimeCardSummaryList!.map((v) => v.toJson()).toList(); + } data['GetUserItemTypesList'] = this.getUserItemTypesList; data['GetVacationRulesList'] = this.getVacationRulesList; data['GetVaccinationOnHandList'] = this.getVaccinationOnHandList; diff --git a/lib/models/get_day_hours_type_details_list_model.dart b/lib/models/get_day_hours_type_details_list_model.dart new file mode 100644 index 0000000..5d0a0ab --- /dev/null +++ b/lib/models/get_day_hours_type_details_list_model.dart @@ -0,0 +1,180 @@ +class GetDayHoursTypeDetailsList { + Null? aBSENCEATTENDANCEID; + Null? aBSENCEATTENDANCETYPEID; + String? aBSENTFLAG; + String? aCTUALHRS; + String? aNALAYZEDFLAG; + String? aPPROVEDTIMEBACKHRS; + String? aPPRTIMEBACKFLAG; + int? aSSIGNMENTID; + String? aTTENDEDFLAG; + Null? cALENDARENTRYID; + String? cOMPOFFFLAG; + String? cOMPOFFHRS; + String? cOMPOFFHHRS; + String? cOMPOFFNHRS; + String? cOMPOFFWHRS; + String? dAYTYPE; + String? eARLYOUTFLAG; + String? eARLYOUTHRS; + String? eXCESSFLAG; + String? eXCESSHRS; + int? fROMROWNUM; + String? lATEINFLAG; + String? lATEINHRS; + String? mISSINGSWIPEFLAG; + String? nONSCHEDULEDFLAG; + Null? nOOFROWS; + String? oNCALLHRS; + Null? pERSONEXTRAINFOID; + String? pLANNEDOTHRS; + String? pLANNEDOTHRSFLAG; + String? rEMARKS; + int? rOWNUM; + int? rTPID; + String? sCHEDULEDHRS; + String? sCHEDULEDONCALLHRS; + String? sCHEDULEDPLANNEDOTHRS; + String? sCHEDULEDATE; + String? sHORTAGEFLAG; + String? sHORTAGEHRS; + String? tIMEBACKFLAG; + String? tIMEBACKHRS; + int? tOROWNUM; + + GetDayHoursTypeDetailsList( + {this.aBSENCEATTENDANCEID, + this.aBSENCEATTENDANCETYPEID, + this.aBSENTFLAG, + this.aCTUALHRS, + this.aNALAYZEDFLAG, + this.aPPROVEDTIMEBACKHRS, + this.aPPRTIMEBACKFLAG, + this.aSSIGNMENTID, + this.aTTENDEDFLAG, + this.cALENDARENTRYID, + this.cOMPOFFFLAG, + this.cOMPOFFHRS, + this.cOMPOFFHHRS, + this.cOMPOFFNHRS, + this.cOMPOFFWHRS, + this.dAYTYPE, + this.eARLYOUTFLAG, + this.eARLYOUTHRS, + this.eXCESSFLAG, + this.eXCESSHRS, + this.fROMROWNUM, + this.lATEINFLAG, + this.lATEINHRS, + this.mISSINGSWIPEFLAG, + this.nONSCHEDULEDFLAG, + this.nOOFROWS, + this.oNCALLHRS, + this.pERSONEXTRAINFOID, + this.pLANNEDOTHRS, + this.pLANNEDOTHRSFLAG, + this.rEMARKS, + this.rOWNUM, + this.rTPID, + this.sCHEDULEDHRS, + this.sCHEDULEDONCALLHRS, + this.sCHEDULEDPLANNEDOTHRS, + this.sCHEDULEDATE, + this.sHORTAGEFLAG, + this.sHORTAGEHRS, + this.tIMEBACKFLAG, + this.tIMEBACKHRS, + this.tOROWNUM}); + + GetDayHoursTypeDetailsList.fromJson(Map json) { + aBSENCEATTENDANCEID = json['ABSENCE_ATTENDANCE_ID']; + aBSENCEATTENDANCETYPEID = json['ABSENCE_ATTENDANCE_TYPE_ID']; + aBSENTFLAG = json['ABSENT_FLAG']; + aCTUALHRS = json['ACTUAL_HRS']; + aNALAYZEDFLAG = json['ANALAYZED_FLAG']; + aPPROVEDTIMEBACKHRS = json['APPROVED_TIMEBACK_HRS']; + aPPRTIMEBACKFLAG = json['APPR_TIMEBACK_FLAG']; + aSSIGNMENTID = json['ASSIGNMENT_ID']; + aTTENDEDFLAG = json['ATTENDED_FLAG']; + cALENDARENTRYID = json['CALENDAR_ENTRY_ID']; + cOMPOFFFLAG = json['COMP_OFF_FLAG']; + cOMPOFFHRS = json['COMP_OFF_HRS']; + cOMPOFFHHRS = json['COMP_OFF_H_HRS']; + cOMPOFFNHRS = json['COMP_OFF_N_HRS']; + cOMPOFFWHRS = json['COMP_OFF_W_HRS']; + dAYTYPE = json['DAY_TYPE']; + eARLYOUTFLAG = json['EARLY_OUT_FLAG']; + eARLYOUTHRS = json['EARLY_OUT_HRS']; + eXCESSFLAG = json['EXCESS_FLAG']; + eXCESSHRS = json['EXCESS_HRS']; + fROMROWNUM = json['FROM_ROW_NUM']; + lATEINFLAG = json['LATE_IN_FLAG']; + lATEINHRS = json['LATE_IN_HRS']; + mISSINGSWIPEFLAG = json['MISSING_SWIPE_FLAG']; + nONSCHEDULEDFLAG = json['NON_SCHEDULED_FLAG']; + nOOFROWS = json['NO_OF_ROWS']; + oNCALLHRS = json['ON_CALL_HRS']; + pERSONEXTRAINFOID = json['PERSON_EXTRA_INFO_ID']; + pLANNEDOTHRS = json['PLANNED_OT_HRS']; + pLANNEDOTHRSFLAG = json['PLANNED_OT_HRS_FLAG']; + rEMARKS = json['REMARKS']; + rOWNUM = json['ROW_NUM']; + rTPID = json['RTP_ID']; + sCHEDULEDHRS = json['SCHEDULED_HRS']; + sCHEDULEDONCALLHRS = json['SCHEDULED_ON_CALL_HRS']; + sCHEDULEDPLANNEDOTHRS = json['SCHEDULED_PLANNED_OT_HRS']; + sCHEDULEDATE = json['SCHEDULE_DATE']; + sHORTAGEFLAG = json['SHORTAGE_FLAG']; + sHORTAGEHRS = json['SHORTAGE_HRS']; + tIMEBACKFLAG = json['TIMEBACK_FLAG']; + tIMEBACKHRS = json['TIMEBACK_HRS']; + tOROWNUM = json['TO_ROW_NUM']; + } + + Map toJson() { + final Map data = new Map(); + data['ABSENCE_ATTENDANCE_ID'] = this.aBSENCEATTENDANCEID; + data['ABSENCE_ATTENDANCE_TYPE_ID'] = this.aBSENCEATTENDANCETYPEID; + data['ABSENT_FLAG'] = this.aBSENTFLAG; + data['ACTUAL_HRS'] = this.aCTUALHRS; + data['ANALAYZED_FLAG'] = this.aNALAYZEDFLAG; + data['APPROVED_TIMEBACK_HRS'] = this.aPPROVEDTIMEBACKHRS; + data['APPR_TIMEBACK_FLAG'] = this.aPPRTIMEBACKFLAG; + data['ASSIGNMENT_ID'] = this.aSSIGNMENTID; + data['ATTENDED_FLAG'] = this.aTTENDEDFLAG; + data['CALENDAR_ENTRY_ID'] = this.cALENDARENTRYID; + data['COMP_OFF_FLAG'] = this.cOMPOFFFLAG; + data['COMP_OFF_HRS'] = this.cOMPOFFHRS; + data['COMP_OFF_H_HRS'] = this.cOMPOFFHHRS; + data['COMP_OFF_N_HRS'] = this.cOMPOFFNHRS; + data['COMP_OFF_W_HRS'] = this.cOMPOFFWHRS; + data['DAY_TYPE'] = this.dAYTYPE; + data['EARLY_OUT_FLAG'] = this.eARLYOUTFLAG; + data['EARLY_OUT_HRS'] = this.eARLYOUTHRS; + data['EXCESS_FLAG'] = this.eXCESSFLAG; + data['EXCESS_HRS'] = this.eXCESSHRS; + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['LATE_IN_FLAG'] = this.lATEINFLAG; + data['LATE_IN_HRS'] = this.lATEINHRS; + data['MISSING_SWIPE_FLAG'] = this.mISSINGSWIPEFLAG; + data['NON_SCHEDULED_FLAG'] = this.nONSCHEDULEDFLAG; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['ON_CALL_HRS'] = this.oNCALLHRS; + data['PERSON_EXTRA_INFO_ID'] = this.pERSONEXTRAINFOID; + data['PLANNED_OT_HRS'] = this.pLANNEDOTHRS; + data['PLANNED_OT_HRS_FLAG'] = this.pLANNEDOTHRSFLAG; + data['REMARKS'] = this.rEMARKS; + data['ROW_NUM'] = this.rOWNUM; + data['RTP_ID'] = this.rTPID; + data['SCHEDULED_HRS'] = this.sCHEDULEDHRS; + data['SCHEDULED_ON_CALL_HRS'] = this.sCHEDULEDONCALLHRS; + data['SCHEDULED_PLANNED_OT_HRS'] = this.sCHEDULEDPLANNEDOTHRS; + data['SCHEDULE_DATE'] = this.sCHEDULEDATE; + data['SHORTAGE_FLAG'] = this.sHORTAGEFLAG; + data['SHORTAGE_HRS'] = this.sHORTAGEHRS; + data['TIMEBACK_FLAG'] = this.tIMEBACKFLAG; + data['TIMEBACK_HRS'] = this.tIMEBACKHRS; + data['TO_ROW_NUM'] = this.tOROWNUM; + return data; + } +} \ No newline at end of file diff --git a/lib/models/get_schedule_shifts_details_list_model.dart b/lib/models/get_schedule_shifts_details_list_model.dart new file mode 100644 index 0000000..8003446 --- /dev/null +++ b/lib/models/get_schedule_shifts_details_list_model.dart @@ -0,0 +1,129 @@ + +class GetScheduleShiftsDetailsList { + String? aCTUALWOBHRS; + String? aPPROVEDENDDATETIME; + String? aPPROVEDENDREASON; + String? aPPROVEDENDREASONDESC; + String? aPPROVEDENDTIME; + String? aPPROVEDSTARTDATETIME; + String? aPPROVEDSTARTREASON; + String? aPPROVEDSTARTREASONDESC; + String? aPPROVEDSTARTTIME; + int? aSSIGNMENTID; + String? bREAKNAME; + int? fROMROWNUM; + int? nOOFROWS; + String? pERCENTAGE; + int? rOWNUM; + int? rTPID; + int? rTPSCHEDULEID; + String? sCHEDULEDATE; + int? sEQNO; + String? sHTACTUALENDDATETIME; + String? sHTACTUALENDTIME; + String? sHTACTUALHRS; + String? sHTACTUALSTARTDATETIME; + String? sHTACTUALSTARTTIME; + String? sHTCODE; + String? sHTNAME; + String? sHTTYPE; + String? sHTTYPEDESC; + int? tOROWNUM; + + GetScheduleShiftsDetailsList( + {this.aCTUALWOBHRS, + this.aPPROVEDENDDATETIME, + this.aPPROVEDENDREASON, + this.aPPROVEDENDREASONDESC, + this.aPPROVEDENDTIME, + this.aPPROVEDSTARTDATETIME, + this.aPPROVEDSTARTREASON, + this.aPPROVEDSTARTREASONDESC, + this.aPPROVEDSTARTTIME, + this.aSSIGNMENTID, + this.bREAKNAME, + this.fROMROWNUM, + this.nOOFROWS, + this.pERCENTAGE, + this.rOWNUM, + this.rTPID, + this.rTPSCHEDULEID, + this.sCHEDULEDATE, + this.sEQNO, + this.sHTACTUALENDDATETIME, + this.sHTACTUALENDTIME, + this.sHTACTUALHRS, + this.sHTACTUALSTARTDATETIME, + this.sHTACTUALSTARTTIME, + this.sHTCODE, + this.sHTNAME, + this.sHTTYPE, + this.sHTTYPEDESC, + this.tOROWNUM}); + + GetScheduleShiftsDetailsList.fromJson(Map json) { + aCTUALWOBHRS = json['ACTUAL_WOB_HRS']; + aPPROVEDENDDATETIME = json['APPROVED_END_DATETIME']; + aPPROVEDENDREASON = json['APPROVED_END_REASON']; + aPPROVEDENDREASONDESC = json['APPROVED_END_REASON_DESC']; + aPPROVEDENDTIME = json['APPROVED_END_TIME']; + aPPROVEDSTARTDATETIME = json['APPROVED_START_DATETIME']; + aPPROVEDSTARTREASON = json['APPROVED_START_REASON']; + aPPROVEDSTARTREASONDESC = json['APPROVED_START_REASON_DESC']; + aPPROVEDSTARTTIME = json['APPROVED_START_TIME']; + aSSIGNMENTID = json['ASSIGNMENT_ID']; + bREAKNAME = json['BREAK_NAME']; + fROMROWNUM = json['FROM_ROW_NUM']; + nOOFROWS = json['NO_OF_ROWS']; + pERCENTAGE = json['PERCENTAGE']; + rOWNUM = json['ROW_NUM']; + rTPID = json['RTP_ID']; + rTPSCHEDULEID = json['RTP_SCHEDULE_ID']; + sCHEDULEDATE = json['SCHEDULE_DATE']; + sEQNO = json['SEQ_NO']; + sHTACTUALENDDATETIME = json['SHT_ACTUAL_END_DATETIME']; + sHTACTUALENDTIME = json['SHT_ACTUAL_END_TIME']; + sHTACTUALHRS = json['SHT_ACTUAL_HRS']; + sHTACTUALSTARTDATETIME = json['SHT_ACTUAL_START_DATETIME']; + sHTACTUALSTARTTIME = json['SHT_ACTUAL_START_TIME']; + sHTCODE = json['SHT_CODE']; + sHTNAME = json['SHT_NAME']; + sHTTYPE = json['SHT_TYPE']; + sHTTYPEDESC = json['SHT_TYPE_DESC']; + tOROWNUM = json['TO_ROW_NUM']; + } + + Map toJson() { + final Map data = new Map(); + data['ACTUAL_WOB_HRS'] = this.aCTUALWOBHRS; + data['APPROVED_END_DATETIME'] = this.aPPROVEDENDDATETIME; + data['APPROVED_END_REASON'] = this.aPPROVEDENDREASON; + data['APPROVED_END_REASON_DESC'] = this.aPPROVEDENDREASONDESC; + data['APPROVED_END_TIME'] = this.aPPROVEDENDTIME; + data['APPROVED_START_DATETIME'] = this.aPPROVEDSTARTDATETIME; + data['APPROVED_START_REASON'] = this.aPPROVEDSTARTREASON; + data['APPROVED_START_REASON_DESC'] = this.aPPROVEDSTARTREASONDESC; + data['APPROVED_START_TIME'] = this.aPPROVEDSTARTTIME; + data['ASSIGNMENT_ID'] = this.aSSIGNMENTID; + data['BREAK_NAME'] = this.bREAKNAME; + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['PERCENTAGE'] = this.pERCENTAGE; + data['ROW_NUM'] = this.rOWNUM; + data['RTP_ID'] = this.rTPID; + data['RTP_SCHEDULE_ID'] = this.rTPSCHEDULEID; + data['SCHEDULE_DATE'] = this.sCHEDULEDATE; + data['SEQ_NO'] = this.sEQNO; + data['SHT_ACTUAL_END_DATETIME'] = this.sHTACTUALENDDATETIME; + data['SHT_ACTUAL_END_TIME'] = this.sHTACTUALENDTIME; + data['SHT_ACTUAL_HRS'] = this.sHTACTUALHRS; + data['SHT_ACTUAL_START_DATETIME'] = this.sHTACTUALSTARTDATETIME; + data['SHT_ACTUAL_START_TIME'] = this.sHTACTUALSTARTTIME; + data['SHT_CODE'] = this.sHTCODE; + data['SHT_NAME'] = this.sHTNAME; + data['SHT_TYPE'] = this.sHTTYPE; + data['SHT_TYPE_DESC'] = this.sHTTYPEDESC; + data['TO_ROW_NUM'] = this.tOROWNUM; + return data; + } +} \ No newline at end of file diff --git a/lib/models/get_time_card_summary_list_model.dart b/lib/models/get_time_card_summary_list_model.dart new file mode 100644 index 0000000..6799bfa --- /dev/null +++ b/lib/models/get_time_card_summary_list_model.dart @@ -0,0 +1,153 @@ + + +class GetTimeCardSummaryList { + int? aBSENTDAYS; + int? aCTUALHRS; + int? aPPROVEDTIMEBACKHRS; + int? aSSIGNMENTID; + int? aTTENDEDDAYS; + int? bUSINESSTRIP; + int? cOMPOFFHHRS; + int? cOMPOFFNHRS; + int? cOMPOFFWHRS; + int? dESIREDSCHEDULEDHRS; + int? eARLYOUTHRS; + int? eXCESSHRS; + int? hALFDAYLEAVE; + int? lATEINHRS; + int? lEAVESHOLIDAYSHRS; + int? nONSCHEDULEDAYS; + int? nOTANALYZEDDAYS; + int? oFFDAYS; + int? oNCALLHRS; + int? pAIDLEAVE; + int? pERIODDAYS; + int? pLANNEDOTHRS; + int? pUBLICHOLIDAY; + int? sCHEDULEDHRS; + int? sCHEDULEDONCALLHRS; + int? sCHEDULEDPLANNEDOTHRS; + int? sCHEDULEDAYS; + int? sHORTAGEHRS; + int? sHORTAGESCHEDULEHRS; + int? sICKLEAVE; + int? tIMEBACKHRS; + double? tIMEBACKBALANCE; + int? uNAUTHORIZEDLEAVE; + int? uNCOVERDSHORTAGEHRS; + int? uNPAIDLEAVE; + + GetTimeCardSummaryList( + {this.aBSENTDAYS, + this.aCTUALHRS, + this.aPPROVEDTIMEBACKHRS, + this.aSSIGNMENTID, + this.aTTENDEDDAYS, + this.bUSINESSTRIP, + this.cOMPOFFHHRS, + this.cOMPOFFNHRS, + this.cOMPOFFWHRS, + this.dESIREDSCHEDULEDHRS, + this.eARLYOUTHRS, + this.eXCESSHRS, + this.hALFDAYLEAVE, + this.lATEINHRS, + this.lEAVESHOLIDAYSHRS, + this.nONSCHEDULEDAYS, + this.nOTANALYZEDDAYS, + this.oFFDAYS, + this.oNCALLHRS, + this.pAIDLEAVE, + this.pERIODDAYS, + this.pLANNEDOTHRS, + this.pUBLICHOLIDAY, + this.sCHEDULEDHRS, + this.sCHEDULEDONCALLHRS, + this.sCHEDULEDPLANNEDOTHRS, + this.sCHEDULEDAYS, + this.sHORTAGEHRS, + this.sHORTAGESCHEDULEHRS, + this.sICKLEAVE, + this.tIMEBACKHRS, + this.tIMEBACKBALANCE, + this.uNAUTHORIZEDLEAVE, + this.uNCOVERDSHORTAGEHRS, + this.uNPAIDLEAVE}); + + GetTimeCardSummaryList.fromJson(Map json) { + aBSENTDAYS = json['ABSENT_DAYS']; + aCTUALHRS = json['ACTUAL_HRS']; + aPPROVEDTIMEBACKHRS = json['APPROVED_TIMEBACK_HRS']; + aSSIGNMENTID = json['ASSIGNMENT_ID']; + aTTENDEDDAYS = json['ATTENDED_DAYS']; + bUSINESSTRIP = json['BUSINESS_TRIP']; + cOMPOFFHHRS = json['COMP_OFF_H_HRS']; + cOMPOFFNHRS = json['COMP_OFF_N_HRS']; + cOMPOFFWHRS = json['COMP_OFF_W_HRS']; + dESIREDSCHEDULEDHRS = json['DESIRED_SCHEDULED_HRS']; + eARLYOUTHRS = json['EARLY_OUT_HRS']; + eXCESSHRS = json['EXCESS_HRS']; + hALFDAYLEAVE = json['HALF_DAY_LEAVE']; + lATEINHRS = json['LATE_IN_HRS']; + lEAVESHOLIDAYSHRS = json['LEAVES_HOLIDAYS_HRS']; + nONSCHEDULEDAYS = json['NON_SCHEDULE_DAYS']; + nOTANALYZEDDAYS = json['NOT_ANALYZED_DAYS']; + oFFDAYS = json['OFF_DAYS']; + oNCALLHRS = json['ON_CALL_HRS']; + pAIDLEAVE = json['PAID_LEAVE']; + pERIODDAYS = json['PERIOD_DAYS']; + pLANNEDOTHRS = json['PLANNED_OTHRS']; + pUBLICHOLIDAY = json['PUBLIC_HOLIDAY']; + sCHEDULEDHRS = json['SCHEDULED_HRS']; + sCHEDULEDONCALLHRS = json['SCHEDULED_ON_CALL_HRS']; + sCHEDULEDPLANNEDOTHRS = json['SCHEDULED_PLANNED_OT_HRS']; + sCHEDULEDAYS = json['SCHEDULE_DAYS']; + sHORTAGEHRS = json['SHORTAGE_HRS']; + sHORTAGESCHEDULEHRS = json['SHORTAGE_SCHEDULE_HRS']; + sICKLEAVE = json['SICK_LEAVE']; + tIMEBACKHRS = json['TIMEBACK_HRS']; + tIMEBACKBALANCE = json['TIME_BACK_BALANCE']; + uNAUTHORIZEDLEAVE = json['UNAUTHORIZED_LEAVE']; + uNCOVERDSHORTAGEHRS = json['UNCOVERD_SHORTAGE_HRS']; + uNPAIDLEAVE = json['UNPAID_LEAVE']; + } + + Map toJson() { + final Map data = new Map(); + data['ABSENT_DAYS'] = this.aBSENTDAYS; + data['ACTUAL_HRS'] = this.aCTUALHRS; + data['APPROVED_TIMEBACK_HRS'] = this.aPPROVEDTIMEBACKHRS; + data['ASSIGNMENT_ID'] = this.aSSIGNMENTID; + data['ATTENDED_DAYS'] = this.aTTENDEDDAYS; + data['BUSINESS_TRIP'] = this.bUSINESSTRIP; + data['COMP_OFF_H_HRS'] = this.cOMPOFFHHRS; + data['COMP_OFF_N_HRS'] = this.cOMPOFFNHRS; + data['COMP_OFF_W_HRS'] = this.cOMPOFFWHRS; + data['DESIRED_SCHEDULED_HRS'] = this.dESIREDSCHEDULEDHRS; + data['EARLY_OUT_HRS'] = this.eARLYOUTHRS; + data['EXCESS_HRS'] = this.eXCESSHRS; + data['HALF_DAY_LEAVE'] = this.hALFDAYLEAVE; + data['LATE_IN_HRS'] = this.lATEINHRS; + data['LEAVES_HOLIDAYS_HRS'] = this.lEAVESHOLIDAYSHRS; + data['NON_SCHEDULE_DAYS'] = this.nONSCHEDULEDAYS; + data['NOT_ANALYZED_DAYS'] = this.nOTANALYZEDDAYS; + data['OFF_DAYS'] = this.oFFDAYS; + data['ON_CALL_HRS'] = this.oNCALLHRS; + data['PAID_LEAVE'] = this.pAIDLEAVE; + data['PERIOD_DAYS'] = this.pERIODDAYS; + data['PLANNED_OTHRS'] = this.pLANNEDOTHRS; + data['PUBLIC_HOLIDAY'] = this.pUBLICHOLIDAY; + data['SCHEDULED_HRS'] = this.sCHEDULEDHRS; + data['SCHEDULED_ON_CALL_HRS'] = this.sCHEDULEDONCALLHRS; + data['SCHEDULED_PLANNED_OT_HRS'] = this.sCHEDULEDPLANNEDOTHRS; + data['SCHEDULE_DAYS'] = this.sCHEDULEDAYS; + data['SHORTAGE_HRS'] = this.sHORTAGEHRS; + data['SHORTAGE_SCHEDULE_HRS'] = this.sHORTAGESCHEDULEHRS; + data['SICK_LEAVE'] = this.sICKLEAVE; + data['TIMEBACK_HRS'] = this.tIMEBACKHRS; + data['TIME_BACK_BALANCE'] = this.tIMEBACKBALANCE; + data['UNAUTHORIZED_LEAVE'] = this.uNAUTHORIZEDLEAVE; + data['UNCOVERD_SHORTAGE_HRS'] = this.uNCOVERDSHORTAGEHRS; + data['UNPAID_LEAVE'] = this.uNPAIDLEAVE; + return data; + }} \ No newline at end of file diff --git a/lib/ui/attendance/monthly_attendance.dart b/lib/ui/attendance/monthly_attendance.dart index af7df52..7391211 100644 --- a/lib/ui/attendance/monthly_attendance.dart +++ b/lib/ui/attendance/monthly_attendance.dart @@ -2,11 +2,17 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; +import 'package:mohem_flutter_app/api/monthlyAttendance_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_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/widgets/circular_step_progress_bar.dart'; +import 'package:provider/provider.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:flutter/cupertino.dart'; @@ -26,25 +32,103 @@ class _MonthlyAttendanceState extends State { bool isAbsent = true; bool isMissingDays = true; bool isOffDays = true; - - DateTime date = DateTime.now(); late var formattedDate; + var currentMonth = DateTime.now().month; + String searchMonth = getMonth(DateTime.now().month); + int searchYear = DateTime.now().year; + int? pRTPID; + + List getDayHoursTypeDetailsList = []; + GetTimeCardSummaryList? getTimeCardSummaryList; + + // GetDayHoursTypeDetailsList? getDayHoursTypeDetailsList; + GetScheduleShiftsDetailsList? getScheduleShiftsDetailsList; + @override void initState() { - formattedDate = DateFormat('d-MMM-yy').format(date); super.initState(); + getTimeCardSummary(searchMonth, searchYear); + getDayHoursTypeDetails(date.day, searchMonth, searchYear); + formattedDate = DateFormat('MMM-yyyy').format(date); + } + + void getTimeCardSummary(searchMonth, searchYear) async { + try { + Utils.showLoading(context); + getTimeCardSummaryList = await MonthlyAttendanceApiClient().getTimeCardSummary(searchMonth, searchYear); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } } - Map dataMap = { - "Present": 65, - "Absent": 35, - }; + void getDayHoursTypeDetails(index, searchMonth, searchYear) async { + try { + Utils.showLoading(context); + getDayHoursTypeDetailsList = await MonthlyAttendanceApiClient().getDayHoursTypeDetails(searchMonth, searchYear); + Utils.hideLoading(context); + pRTPID = getDayHoursTypeDetailsList[index].rTPID; + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + countAllAttendDays(); + getScheduleShiftsDetails(pRTPID); + } + + getScheduleShiftsDetails(pRTPID) async { + try { + Utils.showLoading(context); + getScheduleShiftsDetailsList = await MonthlyAttendanceApiClient().getScheduleShiftsDetails(pRTPID); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + countAllAttendDays() { + // print(getDayHoursTypeDetailsList.length); + for (int i = 0; i < getDayHoursTypeDetailsList.length; i++) { + if (getDayHoursTypeDetailsList[i].aTTENDEDFLAG == 'Y') { + isPresent = true; + isAbsent = false; + isMissingDays = false; + isOffDays = false; + } else if (getDayHoursTypeDetailsList[i].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[i].aBSENTFLAG == 'Y') { + isPresent = false; + isAbsent = true; + isMissingDays = false; + isOffDays = false; + } else if (getDayHoursTypeDetailsList[i].aTTENDEDFLAG == 'N' && getDayHoursTypeDetailsList[i].dAYTYPE == 'OFF') { + isPresent = false; + isAbsent = false; + isMissingDays = false; + isOffDays = true; + } else { + isPresent = false; + isAbsent = false; + isMissingDays = true; + isOffDays = false; + } + } + } + + final CalendarController _calendarController = CalendarController(); final List _colorList = [Color(0xff2AB2AB), Color(0xff202529)]; @override Widget build(BuildContext context) { + Map dataMap = { + "Present": getTimeCardSummaryList!.aTTENDEDDAYS!.toDouble(), + "Absent": getTimeCardSummaryList!.aBSENTDAYS!.toDouble(), + }; return Scaffold( appBar: AppBar( backgroundColor: MyColors.white, @@ -66,20 +150,18 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.attendance - .tr().toText24(isBold: true, color: MyColors.darkIconColor), + "Attendance".toText24(isBold: true, color: MyColors.darkIconColor), Row( children: [ - Text(formattedDate), - // "June 13, 2021".toText16(color: MyColors.greyACColor), + Text(formattedDate), const Icon(Icons.keyboard_arrow_down_rounded, color: MyColors.greyACColor), ], ).onPress(() async { - await showDatePicker( + await showDatePicker( context: context, initialDate: DateTime.now(), firstDate: DateTime(2021), - lastDate: DateTime(2025), + lastDate: DateTime.now(), builder: (context, child) { return Theme( data: ThemeData.dark().copyWith( @@ -95,31 +177,34 @@ class _MonthlyAttendanceState extends State { ); }, ).then((selectedDate) { - if (selectedDate != null) { - setState(() { - date = selectedDate; - formattedDate = DateFormat('d-MMM-yy').format(selectedDate); - }); - } - }); + if (selectedDate != null) { + var selectedMonth = DateFormat('MMMM').format(selectedDate); + var selectedYear = DateFormat('yyyy').format(selectedDate); + searchMonth = selectedMonth; + searchYear = int.parse(selectedYear); + setState(() { + // date = selectedDate; + formattedDate = DateFormat('MMMM-yyyy').format(selectedDate); + getTimeCardSummary(searchMonth, searchYear); + getDayHoursTypeDetails(selectedDate.day, searchMonth, searchYear); + }); + } + }); }) ], ).paddingOnly(left: 21, right: 21), 18.height, - AspectRatio(aspectRatio: 333 / 270, child: calenderWidget()).paddingOnly(left: 21, right: 21), + AspectRatio(aspectRatio: 333 / 270, child: calendarWidget()).paddingOnly(left: 21, right: 21), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - optionUI(LocaleKeys.scheduleDays.tr(), "16"), + optionUI("Schedule\nDays", "${getTimeCardSummaryList!.sCHEDULEDAYS}"), 6.width, - optionUI(LocaleKeys.offDays - .tr(), "0"), + optionUI("Off\nDays", "${getTimeCardSummaryList!.oFFDAYS}"), 6.width, - optionUI(LocaleKeys.nonAnalyzed - .tr(), "0"), + optionUI("Non\nAnalyzed", "${getTimeCardSummaryList!.uNAUTHORIZEDLEAVE}"), 6.width, - optionUI(LocaleKeys.shortageHour - .tr(), "6"), + optionUI("Shortage\nHour", "${getTimeCardSummaryList!.sHORTAGEHRS}"), ], ).paddingOnly(left: 21, right: 21), 35.height, @@ -144,10 +229,8 @@ class _MonthlyAttendanceState extends State { children: [ Column( children: [ - LocaleKeys.attendance - .tr().toText12(isBold: true, color: MyColors.grey3AColor), - LocaleKeys.stats - .tr().toText24(isBold: true, color: MyColors.grey3AColor), + "Attendance".toText12(isBold: true, color: MyColors.grey3AColor), + "Stats".toText24(isBold: true, color: MyColors.grey3AColor), ], ).paddingOnly(left: 21, top: 29, bottom: 36), Row( @@ -162,8 +245,7 @@ class _MonthlyAttendanceState extends State { ), Container( margin: const EdgeInsets.only(left: 5, right: 5), - child: LocaleKeys.present - .tr().toText16(isBold: true, color: MyColors.lightGreenColor), + child: "PRESENT ${getTimeCardSummaryList!.aTTENDEDDAYS}".toText16(isBold: true, color: MyColors.lightGreenColor), ), ], ).paddingOnly(left: 21, right: 23), @@ -180,8 +262,7 @@ class _MonthlyAttendanceState extends State { ), Container( margin: const EdgeInsets.only(left: 5, right: 5), - child: LocaleKeys.absent - .tr().toText16( + child: "ABSENT ${getTimeCardSummaryList!.aBSENTDAYS}".toText16( isBold: true, color: MyColors.backgroundBlackColor, ), @@ -252,26 +333,25 @@ class _MonthlyAttendanceState extends State { ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [title.toText10(color: MyColors.darkTextColor).expanded, value.toText20(color: MyColors.darkTextColor)], + children: [title.toText10(color: MyColors.darkTextColor).expanded, value.toText20(color: MyColors.darkTextColor)], ), ), ).expanded; } - Widget calenderWidget() { + Widget calendarWidget() { return SfCalendar( view: CalendarView.month, + // onViewChanged: viewChanged, + controller: _calendarController, headerHeight: 0, todayHighlightColor: MyColors.grey3AColor, viewHeaderStyle: const ViewHeaderStyle( - dayTextStyle: TextStyle(color: MyColors.grey3AColor, fontSize: 13, fontWeight: FontWeight.w600), + dayTextStyle: TextStyle(color: MyColors.grey3AColor, fontSize: 13, fontWeight: FontWeight.w600), ), monthCellBuilder: (cxt, build) { - int val = build.date.day % 4; - isPresent = val == 0; - isAbsent = val == 1; - isMissingDays = val == 2; - isOffDays = val == 3; + int val = build.date.day; + val == countAllAttendDays(); if (isPresent) { return Container( margin: const EdgeInsets.all(4), @@ -294,7 +374,7 @@ class _MonthlyAttendanceState extends State { alignment: Alignment.center, child: Text( "${build.date.day}", - style: const TextStyle( + style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w500, color: MyColors.white, @@ -318,7 +398,7 @@ class _MonthlyAttendanceState extends State { alignment: Alignment.center, child: Text( "${build.date.day}", - style: const TextStyle( + style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w500, color: MyColors.white, @@ -342,7 +422,7 @@ class _MonthlyAttendanceState extends State { alignment: Alignment.center, child: Text( "${build.date.day}", - style: const TextStyle( + style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w500, color: Color(0xff1F2428), @@ -359,7 +439,7 @@ class _MonthlyAttendanceState extends State { alignment: Alignment.center, child: Text( "${build.date.day}", - style: const TextStyle( + style: const TextStyle( fontSize: 13, fontWeight: FontWeight.w500, color: MyColors.greyA5Color, @@ -399,7 +479,16 @@ class _MonthlyAttendanceState extends State { ); } - void calendarTapped(CalendarTapDetails details) { + calendarTapped(CalendarTapDetails details) { + dynamic string = getScheduleShiftsDetailsList!.pERCENTAGE; + dynamic percentage = string!.indexOf('%'); + print(percentage); + print(details.date?.day.toString()); + int? index = details.date?.day; + if (index != null) { + index = index - 1; + } + getDayHoursTypeDetails(index, getMonth(details.date!.month), details.date?.year); showModalBottomSheet( context: context, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)), @@ -436,14 +525,14 @@ class _MonthlyAttendanceState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Column(children: [ - "June 13, 2021".toText24(isBold: true, color: Colors.white), - LocaleKeys.attendanceDetails.tr().toText16(color: MyColors.lightGreyEFColor), + "${getScheduleShiftsDetailsList!.sCHEDULEDATE!.substring(0, 9)}".toText24(isBold: true, color: Colors.white), + "Attendance Details".tr().toText16(color: MyColors.lightGreyEFColor), 21.height, ]).paddingOnly(top: 25, left: 21, right: 21, bottom: 10), Center( child: CircularStepProgressBar( totalSteps: 16 * 4, - currentStep: 16, + currentStep: percentage, width: 210, height: 210, selectedColor: MyColors.gradiantEndColor, @@ -452,13 +541,11 @@ class _MonthlyAttendanceState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - "99%".toText44(color: Colors.white, isBold: true), - LocaleKeys.completed - .tr().toText11(color: MyColors.greyACColor), + "${getScheduleShiftsDetailsList!.pERCENTAGE}".toText44(color: Colors.white, isBold: true), + "Completed".tr().toText11(color: MyColors.greyACColor), 19.height, - LocaleKeys.shiftTime - .tr().toText11(color: MyColors.greyACColor), - "08:00 - 17:00".toText22(color: Colors.white, isBold: true), + "Shift Time".tr().toText11(color: MyColors.greyACColor), + "${getScheduleShiftsDetailsList!.sHTNAME}".toText22(color: Colors.white, isBold: true), ], ), ), @@ -487,12 +574,11 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.actualCheckIn - .tr().toText11( + "Actual Check In ".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "08:27".toText22(color: Colors.black, isBold: true), + "${getScheduleShiftsDetailsList!.sHTACTUALSTARTTIME}".toText22(color: Colors.black, isBold: true), ], ), ), @@ -500,12 +586,11 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.actualCheckOut - .tr().toText11( + "Actual Check Out".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "18:20".toText22(color: Colors.black, isBold: true), + "${getScheduleShiftsDetailsList!.sHTACTUALENDTIME}".toText22(color: Colors.black, isBold: true), ], ), ], @@ -524,12 +609,11 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.approvedCheckIn - .tr().toText11( + "Approved Check In".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "09:27".toText22(color: MyColors.greenColor, isBold: true), + "${getScheduleShiftsDetailsList!.aPPROVEDSTARTTIME}".toText22(color: MyColors.greenColor, isBold: true), ], ), ), @@ -537,12 +621,11 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.approvedCheckOut - .tr().toText11( + "Approved Check Out".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "18:20".toText22(color: MyColors.greenColor, isBold: true), + "${getScheduleShiftsDetailsList!.aPPROVEDENDTIME}".toText22(color: MyColors.greenColor, isBold: true), ], ), ], @@ -561,12 +644,11 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.lateIn - .tr().toText11( + "Late In".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "00:27".toText22(color: MyColors.redColor, isBold: true), + "${getDayHoursTypeDetailsList[i].lATEINHRS}".toText22(color: MyColors.redColor, isBold: true), ], ), ), @@ -574,12 +656,11 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.excess - .tr().toText11( + "Excess".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "00:00".toText22(color: Colors.black, isBold: true), + "${getDayHoursTypeDetailsList[i].eXCESSHRS}".toText22(color: Colors.black, isBold: true), ], ), ], @@ -598,12 +679,11 @@ class _MonthlyAttendanceState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.shortage - .tr().toText11( + "Shortage".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "00:00".toText22(color: Colors.black, isBold: true), + "${getDayHoursTypeDetailsList[i].sHORTAGEHRS}".toText22(color: Colors.black, isBold: true), ], ), ), @@ -611,12 +691,11 @@ class _MonthlyAttendanceState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.earlyOut - .tr().toText11( + "Early Out".tr().toText11( color: MyColors.grey67Color, ), 8.height, - "00:00".toText22(color: Colors.black, isBold: true), + "${getDayHoursTypeDetailsList[i].eARLYOUTHRS}".toText22(color: Colors.black, isBold: true), ], ), ], @@ -639,16 +718,40 @@ class _MonthlyAttendanceState extends State { ); } + List _getDataSource() { final List meetings = []; - - // _events.forEach((key, value) { - // final DateTime startTime = DateTime(key.year, key.month, key.day, 21, 0, 0); - // final DateTime endTime = DateTime(key.year, key.month, key.day, 22, 0, 0); - // meetings.add(Meeting("", startTime, endTime, MyColors.backgroundBlackColor, false)); - // }); return meetings; } + + static 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"; + } + } } class MeetingDataSource extends CalendarDataSource { diff --git a/lib/ui/bottom_sheets/attendence_details_bottom_sheet.dart b/lib/ui/bottom_sheets/attendence_details_bottom_sheet.dart index 4c42d6c..ea9f798 100644 --- a/lib/ui/bottom_sheets/attendence_details_bottom_sheet.dart +++ b/lib/ui/bottom_sheets/attendence_details_bottom_sheet.dart @@ -66,7 +66,7 @@ class _AttendenceDetailsBottomSheetState extends State Date: Tue, 24 May 2022 10:49:15 +0300 Subject: [PATCH 08/19] fix profile --- lib/api/profile_api_client.dart | 73 +++++ lib/classes/colors.dart | 1 + lib/config/routes.dart | 7 + lib/models/generic_response_model.dart | 60 +++- lib/models/get_employee_address_model.dart | 4 + .../get_employee_basic_details.model.dart | 53 ++++ lib/models/get_employee_contacts.model.dart | 45 +++ lib/models/get_employee_phones_model.dart | 53 ++++ lib/ui/landing/dashboard_screen.dart | 4 +- lib/ui/profile/profile.dart | 288 ++++++++++++++++++ 10 files changed, 575 insertions(+), 13 deletions(-) create mode 100644 lib/api/profile_api_client.dart create mode 100644 lib/models/get_employee_address_model.dart create mode 100644 lib/models/get_employee_basic_details.model.dart create mode 100644 lib/models/get_employee_contacts.model.dart create mode 100644 lib/models/get_employee_phones_model.dart create mode 100644 lib/ui/profile/profile.dart diff --git a/lib/api/profile_api_client.dart b/lib/api/profile_api_client.dart new file mode 100644 index 0000000..9109815 --- /dev/null +++ b/lib/api/profile_api_client.dart @@ -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 getEmployeeContacts() async { + String url = "${ApiConsts.erpRest}GET_EMPLOYEE_CONTACTS"; + Map 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> getEmployeeBasicDetails() async { + String url = "${ApiConsts.erpRest}GET_EMPLOYEE_BASIC_DETAILS"; + Map 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 getEmployeePhones() async { + String url = "${ApiConsts.erpRest}GET_EMPLOYEE_PHONES"; + Map 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 getEmployeeAddress() async { + String url = "${ApiConsts.erpRest}GET_EMPLOYEE_ADDRESS"; + Map 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); + } +} \ No newline at end of file diff --git a/lib/classes/colors.dart b/lib/classes/colors.dart index 80fbbe7..08ce1c5 100644 --- a/lib/classes/colors.dart +++ b/lib/classes/colors.dart @@ -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); } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index ba98b19..2735ed1 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -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 routes = { login: (context) => LoginScreen(), verifyLogin: (context) => VerifyLoginScreen(), @@ -59,5 +63,8 @@ class AppRoutes { //Bottom Sheet attendanceDetailsBottomSheet: (context) => AttendenceDetailsBottomSheet(), + + //Profile + profile: (context) => Profile(), }; } diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index f8403dd..98fbe1b 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -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? getEITDFFStructureList; List? getEITTransactionList; List? getEarningsList; - List? getEmployeeAddressList; - List? getEmployeeBasicDetailsList; - List? getEmployeeContactsList; - List? getEmployeePhonesList; + List? getEmployeeAddressList; + List? getEmployeeBasicDetailsList; + List? getEmployeeContactsList; + List? getEmployeePhonesList; List? getEmployeeSubordinatesList; List? getFliexfieldStructureList; List? 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 = []; + json['GetEmployeeAddressList'].forEach((v) { + getEmployeeAddressList!.add(dynamic); + }); + } + if (json['GetEmployeeBasicDetailsList'] != null) { + getEmployeeBasicDetailsList = []; + json['GetEmployeeBasicDetailsList'].forEach((v) { + getEmployeeBasicDetailsList! + .add(new GetEmployeeBasicDetailsList.fromJson(v)); + }); + } + if (json['GetEmployeeContactsList'] != null) { + getEmployeeContactsList = []; + json['GetEmployeeContactsList'].forEach((v) { + getEmployeeContactsList!.add(new GetEmployeeContactsList.fromJson(v)); + }); + } + if (json['GetEmployeePhonesList'] != null) { + 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; diff --git a/lib/models/get_employee_address_model.dart b/lib/models/get_employee_address_model.dart new file mode 100644 index 0000000..6770264 --- /dev/null +++ b/lib/models/get_employee_address_model.dart @@ -0,0 +1,4 @@ + +class GetEmployeeAddressList { + +} \ No newline at end of file diff --git a/lib/models/get_employee_basic_details.model.dart b/lib/models/get_employee_basic_details.model.dart new file mode 100644 index 0000000..06713c0 --- /dev/null +++ b/lib/models/get_employee_basic_details.model.dart @@ -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 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 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['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; + } +} \ No newline at end of file diff --git a/lib/models/get_employee_contacts.model.dart b/lib/models/get_employee_contacts.model.dart new file mode 100644 index 0000000..4064d10 --- /dev/null +++ b/lib/models/get_employee_contacts.model.dart @@ -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 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 toJson() { + final Map data = new Map(); + 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; + } +} \ No newline at end of file diff --git a/lib/models/get_employee_phones_model.dart b/lib/models/get_employee_phones_model.dart new file mode 100644 index 0000000..1fbba7f --- /dev/null +++ b/lib/models/get_employee_phones_model.dart @@ -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 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 toJson() { + final Map data = new Map(); + 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; + } +} \ No newline at end of file diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 029da02..8acbbd2 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -64,7 +64,9 @@ class _DashboardScreenState extends State { 8.width, SvgPicture.asset("assets/images/side_nav.svg"), ], - ).onPress(() {}), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.profile); + }), Expanded( child: Row( crossAxisAlignment: CrossAxisAlignment.center, diff --git a/lib/ui/profile/profile.dart b/lib/ui/profile/profile.dart new file mode 100644 index 0000000..a3fa1ae --- /dev/null +++ b/lib/ui/profile/profile.dart @@ -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 { + 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.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: [ + InkWell( + onTap: () { + + }, + child: Row( + children: [ + + SizedBox( + width: 15, + ), + "Personal Information".toText16(isBold: true, color: MyColors.grey3AColor), + ], + ), + ), + SizedBox( + height: 5, + ), + InkWell( + onTap: () { + + }, + child: Row( + children: [ + + SizedBox( + width: 15, + ), + "Basic Details".toText16(isBold: true, color: MyColors.grey3AColor), + ], + ), + ), + SizedBox( + height: 5, + ), + InkWell( + onTap: () { + + }, + child: Row( + children: [ + + SizedBox( + width: 20, + ), + "Contact Details".toText16(isBold: true, color: MyColors.grey3AColor), + ], + ), + ), + SizedBox( + height: 5, + ), + InkWell( + onTap: () { + + }, + child: Row( + children: [ + + 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, + // ], + // ) + // ], + // ), + // ] + // ), + // ), + ); + } +} From 6e86c0ba380551b8e37238aad2188db176bfab1c Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 24 May 2022 17:59:52 +0300 Subject: [PATCH 09/19] profile details --- android/app/src/main/AndroidManifest.xml | 1 + assets/images/user-avatar.png | Bin 0 -> 20893 bytes lib/config/routes.dart | 5 + lib/ui/landing/dashboard_screen.dart | 502 +++++++++--------- lib/ui/landing/widget/app_drawer.dart | 47 ++ lib/ui/landing/widget/drawer_item.dart | 59 ++ lib/ui/screens/profile/profile_screen.dart | 66 +++ lib/ui/screens/profile/widgets/header.dart | 16 + .../screens/profile/widgets/profile_info.dart | 122 +++++ .../profile/widgets/profile_panel.dart | 28 + 10 files changed, 598 insertions(+), 248 deletions(-) create mode 100644 assets/images/user-avatar.png create mode 100644 lib/ui/landing/widget/app_drawer.dart create mode 100644 lib/ui/landing/widget/drawer_item.dart create mode 100644 lib/ui/screens/profile/profile_screen.dart create mode 100644 lib/ui/screens/profile/widgets/header.dart create mode 100644 lib/ui/screens/profile/widgets/profile_info.dart create mode 100644 lib/ui/screens/profile/widgets/profile_panel.dart diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 7be27d5..27bdf35 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -7,6 +7,7 @@ !u}#@Ri>9$LIJ5|9)C0IDOA zo^@fNjjARJDt0Q85}f*07IeBlt@I4&oGh%N9RUDtCr;>B3j;e{VkZl8OIuDS9@78x z;DmnvR}CR0{!bS>GagbENf}}xt6v7hEOg9t^rXCq#KgqhzkV8W$_an_@8Qt@cu0-y z?5sH<5JyKxI!7itt6xSC1`ZAm2t6Z&k&zbKgVxsB(oWZj*3y>jzli*AI>H9F`oB!9 z?M$pJiT}~n)w8m<;~^#eH_`um{%f6fCWilKCQIA@-WGI&kbf-@20D7k|ImgG<^EU8 zDgDdD06OzO`n(L>|LOVv)cyB7+>n2h|6hywubuv<7P?hlL~h9cJT_iLi7pCN0DvFx zLs&q;33$?qkVUR&!=`1G?0jXo7N|O(3=Gix80T&)^X^@u@Qd|EY?jU1XLNn!-Av&t zcMp=x=1r{Jz9!*MAHykwXb@AXhIl*ZK}_BB!)+}KtL+~4Qa3z}R%@+KtEYE|!^`S3 z_J;~H#ix(0Q|?cajKA2;1Hv{S7CaLNz~wIKncJBFJJ<}`vl++zb>PW zmtvBpf%m@#I28wIR~nE%v|UNpAs*HgIu=`Jfk6jaqJM?9`!6VB78!Iv2O0ExK}(q= zXgh|XvT7ET*gv9B;{V?geMx{B;x9)=Mx8sfXsIkLw9%ZZLso!pOR0W148~baXZm{y z?u|jm>~~ht$_U^r<-%P!%(uoVS+EqS*77X<^ogzG@Rj%P7aukM%;4@1*pex+-YW2) zGs&>vR5%uKP6A>S#!nW9pYHF|P&zK#`WHjT0Hv+ZJ9>64##4x1frL4VVCBg} z#Zr@%P%{K~lX@H9E#t*H9A^DpiIjF7;KeDgVb6V@I-ujXFkm65@;b?E=xP&f7 zo=BRdxJmdq{}F)=7}U_J`1Qbr4kDta%+uB~lGE!nbp2a|V3eaeAb z6>ncxIGN3pm!Qs=grMf$n)CTDnaSGA-B?e#xAIpL$(16Y(jnDIpH8Vxz5Nj8!u18jM@)e#?7|>9s7E&;YIB@(9hrR~X;J8Qx-{g(Fg4oVs>TDS|9d(DjBlKk2DV|I{2F!_hFmv@}#08M@zuCY2Q{&6SRM-0Da@ zfoq)~)29%ItphEt!nWc}DDbkH6>$r2-fdqXW_HdOg zQu$Q!h4ln6K;l~Vt8%OJ9 z%hmpVBL33tHgeOVl&(A+a#f0$a>L*V0J8(}PWEMM%_F7ZoWgrHWvrv+0qI@Ss9KHR z`GJ1(NJr@k@+^^+mm;4i!Gtkp*=hS8;p39DM~uU{vVK{8BG4^=KW<7o*B0W0vR36{ z?b`Qj460O^RMG7Ll#-ICV=*HtsVHV|(A|LfY+yIg1k4T$0ds$}uKvtjm~8!+PV7|n zHx)4>Rt9rbK(CBP1mg^J7Q)vpqJu#&@9ItEh8_|IPCAksK2)O(I(s;9X!cYKE$w|R3$_lOuxHh%}}H|9;m zJG<8Hrmg*Hrm=0sxeMkDB9$UqZu_12tPEr}37{9go>V5DIR&!eqm&-nFy3 zJzW;tzj?V!$SNB;o^Q>sVM;uWj0Agz;goUT_`!07B4I$K4-O7a);@19XQ$h1up05ce`)-r4A+h3G)2Lg zuB^Xs2(hB+by6P4u#v&cW?u2#D}mCHW#Mhe>xm6-FY0TA?r2teeQ+w0UrH5c)I1To z+jG`0(mUV&991Z3E;RWVtv9H9NP_RLWz?PAifHocBg$p0^3I_mWGVLU!uR3W1es%r ziU8SYEQ7~xDx8hgEmR0zXviN7D$_WI3;7_!{bPD@f3$<3@wI>kc%!6hFi7Us4FGQu zXqXLT*b%>8c*8SB{2kuo0o`{PP^~3m5E79PMYhi}V9wD#HUO0ZT&pHPKTy9tt6jy4 zCmLc$C)0_+5qcg^aiDhzv1j*Z884jyMrkOV)N|w79 zwago-j(@<`sgJ40?DK;s^nl%CV_Tc{!N6lwWAs|%M^<-w_PdQ7bG+~|1f zQ*Mj#QD$P0W3pcF@@IA(O^fDiZP+#Nno)Yh#lwHKZ+TmFJ-84(q1)|aWaF%t+9Oi0 zPe=oT%C=kbzM^y@KHES0f@WzzGmP}^k9ID-rCN&RuG2#(Rg2v3QaA`S+ARrIUbH=p zr*ct<25_8SQdfKUDmV?lNLQEt#?h&dZ(H=;DlJ`Gbx3_#b~}j+KV0pOV2?>idpeX& z_jQS7>nKUgMt?ec^)0WElh_MlWbx>F=du>a_hk)3;;~I9#$1>@t8)Nbhb5`#OTAj5 z@5Ky8AK&lm;4e&H@pf=JsMh=69xF{|j|ZjUP>KdoKY+?E-F`OsXQq4FKtaxN>V}>n zK>J2=DPv>!w-_ZW5i zQ9?P+)1VU57vQW&!#7fWulPa!iVRY%8)LJVZ-^BF%}k z^?5ti1PaooyWi?W*3m)W_zk0wR+tfE5fw~52IHs(aS4Dp`&&r6qQ^|(S`EgS z1nt(W1hsE=xKn#{IaUN~LPO8^>cCPb7jt{X!JvP#Dft(Z(a7L*8_pOji0Ny1Zuecr zH__w%O7{XL{*kN;(7?`AyKCyZDQXpe0LJCQXchKsER$B)JQBvv@IoyThE-|jDU&Vf z37hL@i^T@tjJ2wC?Iq*AQ=amaqx&Y+*#3#OT8hawCW;B5t7MLdZQ*#1b1Z@v1`AE4 z4Pn8M`OeF4)wc=@TFqLYmycP3yq5&}-=+?T3oN}bxBxZtJqIMGri2G4>Ea)<@7hdl zR3~&tk61x14HH**jT4KKOC~D?>2;Ri{SRu520>cO+`_4iXWMgh+3JClt+4M3t74?h^h0%))G%QT-(~ zXSl(3JegG^btT{U~wA{Gu z6yUV_eFC^2V^ShuQ66F{K)Keht<8b!3JRP0c6jMC_c13wM^mLv@jK-}WgkwLeNhRL zz3gYBZ8<_IrP3%51_x!)f3{*d2&goX1bK;O$`uxNYyduQrF-@t9HfL6XnaipMtxa8 zGRU^-S=R%5|1w$Kx$39VolhINbS|L@qr#UDCo0$Rcbliut^Tu5o|u0ap=Y?TOL|6NCN2LWA2gc4CXZUm zX*T4$yPNZa^*F>10h*-7;dHRJ$vgZIIIT(vz9<1L7gVQF}$zCOYP(*HUxg^^d~gm43?AG^Q##NY{)fQoxKdVKy$D3c+%9YpeTp%vR)C zR{yakZ5mfRpZ`(pps0X}ELHq_yKeAzAk!ItHxR`M7GEd%JnOlOK0g8;z!~*1>myG~ zHQR(}AqZ5B2g2_`hY9P!Zt29rExHPw(HkI4JHp2w8zi-@)-yjlrz`XgrF8jzUumj=pm`}| zC&;}JK`JZ5E!`}h3-L(90_J1ep@KBkIN**If!fJE^5gt3S{jvdE$MVCxKA?%CDf#o zDAK)j+BsumvG8F z?wctNj@sQ6EceZODNf%-hCR78{RRQ>{k{t@RUZ5TbiW+RfaPvfWi5ildI1Fcl)E5( zL6VSze%9Ov<*7EI9ydHUQO&#YV-4CQUs> zgdPwm(uHHcN?I<6PV&#cO&U;44Fn$du234{-{gOGXdx=b*mw&Qcc+hxUuf1|xNp^y zrwGeWj)hyGZ0QVf4Q}O!sg#2IAlaDK2KwR^1{1TDu2^4Ix9n4^bh%%rmf9ZL2mIm` z4$rF*w!Um0Z>k_x-)Piy?SE#y7V1rH<>9Dsz{2p47yEAk+C>}}RgDS`A2#JtbI|S= zBr2*jI=OVLdo^GX97?gQ_#eniKS{5RXlr?lmBzHAVWT=taJQwCY!F>{!9+%eS_OWh zmZ6kPiR>B5DzrYiiO}?4ny_B$|pB3LNw1rMXCIQn>;9y zoYUKp{AmI8=Uu6ChRb32u#i`>!9#rUN+9OvL>HzGF`oQ*xO$zg3|QB*k@j2l$1dyn zIU3Iigr^B&zHBeBh?d;*u&7su9EJRl+Nji8IeSw7ppX)N_w@lAfw<@?mnQrdx!=0z z@%W&$b5^e?W&W7YSY8)9AJBpbvOb++#S(fYWCUHBie zeE}P#oO{}KvJ#8S1+HaCi0?4AQfCp3|2|oU!zwtTC!w=}-*Nv8yto>we9VOGVJJUj zU#6hl+BYol&efl1b?Kuqt}(O9Y~*L{NInPSTA9YGIDweAb3ORx{u0`?O4v;|MwUvz zX%5fGZ+sGqe<;-`Zt~VlI=_wGZ5P$|A~P#C$aFxF0&%J}p(qv1yGqHh zb2#I_W}ayQocO6kd+c+2KRGKj)*b?AI5I4UJ)8QKRQ@zh=E13$7}f@qR~aiv8qBw? z*H@Yy9C4blTHfuN0^uG@uO z^dz}l1us<=68U{Kf4XAp2-#y!w*Zx)UltjW{3sBVL3|q8HrKJXj-qqvJ`#!#xMz9R z&mYCC6v)9qPjo2H(o0ZmWL{k;`S6j%*sldf1G-`oqPeLP8F=oL$*90GbTg{g(=qLg zGk=-#{1m8yt1zXylmsJGgfVDMYqog3=$II&-^usz{H={}2a!Mlatij3c%;N&KJ8JG zu{OhQ%&;-T+F4Qh(a7BP6YX}ZJcG|GtX31nT8x(^=d(ZCFjhIU)%ov~_VmwxG~+J+ z84eIEdNfqVqj^DpldAO(Zmit&znJm8S-q)wYhR3~J)nbP?DtUbld;lSu9T;`gq{vCtOT`RR@sr;OVBTiB zkAhSGJQ1`9J)d9NoBN?W_{6Ft-QB>Uc5#twCt+v7h7fl=!O2761EkB3EfOAvk%Xu? zKyYIN??XC#V)MtSCQ*V~CGvHrWV};7__Mv((1#@pl!;U6ScVQUrc{)9IqML4oWb~6 zsO8=Ba+i%wr#SEO2tG4jPb7O2mPQ6w&p(2nDCH2uCJgtRsFK;ag~^Mf39Ap@3$2#o zo5A~4vGwBDtqZ{l#`E`5#q>V*GMl`7%J~~A^WP&f`)zzHYSnW%t?~!9KB4z1WVV-A zeGw^c$I;2pnEdI>-egu^^>)oP_Jw;Sd%~gHlZUKCEz25~P+^7IpY#wPMZw8K9`T#r z#WY4fW?^k%!;E%Xhy}y@3h#nq;7v6cLz_kkx1_}2I@<*QchbM(Opp0@oFND(0@(?w zu!ZdL4CZ-(o{PJZR?cR$Xa?@!S<7tK3^i~soqvQDIxkvFo)^yyc6`k|Fs?8NA#o$# z$I&59aAE;g(&YkK_yg``2^avvGslMPQ)0L?AZ-oM4yT@52O{XcZ~s^+cfK!Ia-~FF z;sIhk7t?=j=n^!XvVv1N*sCiMp(-h9rKC|vGlOjPQxZ+~NH1x>3a{T%#E6iSE}&ry2PoahndRjF{XUvh;@C^C;P*45V{a53g(Wq zlmv{lO$9h-GAs9fF4M*LTvpEK94=11aF{j=Iltl=AtL+5VDt76o%9}0Js(#nD4ONA z$CLW%p+eY*`g>4V6#1S(Vtpz&&2dNMuNB5i866`sk`vn^!b;M20SpmsePA!&KD8pA z!Ss`{(QC77|Dj!2K@#-VqQ@=-QNb3O{?UEw3?vkTY!PW$)VZH7y5Ar+Xtw>a$T+v=|Y^2-5T9`*gV6SC5S#pZ+`swT48>=SW5 zP~Gwz<88k28HD0osam zMp03@MT$Ghu}wZG_Ebgi>f6rqvLjvRHLUgog}kPGfs*PnUL~yb$7^P%8fw2zf6pj@ zw=*9uc*~fkDUW-x-U&tyCh13g4DLs@De36Ms|qiGjjSHctSxja zZg=1g`?QIw;H0%niK1*abIjp6D*88Z7jMt5f=+9$v}SgZ-8sRzKVJ&#hU4>pkt?;SJ`H7X{7`Oi3jCwr!%Ka{%1;EVT1B zqJ8oUU~ry?>X3Yxpf}jQ1?*4{pS!+;!o7r%+z4GwyR{qc?g;}%#!cLy3K5wE>!c3G zh$^a^$g8HrcnsF|x_kR@ytB;4ggW$~AH}?SbIbDMpeG&o8Hdext66EPtF!>^Ryu{- zpUzElOFPWtdg11J!}E8n!=JNbYm4kj{Gj(^sbUl4trsw5PL8kLx?B^#^ldA9bu8Ly{#1Z>VR!{S8D`iRUdup?V#vBUWyQ{d>TYc zfR0J|^AGLI>R(u_)`nupx3$-Cu|L~LjpKi4xiqR>oAvP4VVa+bARqHdFBxTZSApLU zbkN!3^w^y&IM0l^9lZiWN~q!)tV7_ax!b7>zNttnmML)RBEy{Vn_s1_9p66}S7sjb z(yS8UFoU3Wy2YXaMjbJ1^xG}j!4VIJ$J2bXeaXxxjFr}FSa@toz2e=^{_2nrMEtP7 z=Y0?$u{5lo3cf7%Ito1TGu@yT(0w@%y00W<;Z_fJ<+RsqZ^W@dF$S4GJd!EW*f37} zl#-K0^0)jO-{Mz~ z9wQgPkp<}D11)`sh;#LO%9U#)>J|wFIah1U2mCIUqs5y@zsFm8iz(k(2T0nde=!dXU#Kl74AkuZpUxSjHOb%-t>>bWLQHdPBC<;?K>w0B0w>)k0XZBU1; z>D`Z1H~B-OT`pI`=Vult3)P?~hB{DyTf?9#54t9Tx8f&TE%CFR*EuPkwAo>HsXutI zWyXi(xqak6JERcMVkS+ZUw8bqcj5yW(K*_%-BxEonBx8HnNfrDux zf2aRkN}-;WAcZJngPfT2Z}!@!KnZw8XC{VFFUN>^gRVFd&eu3)+`%f+&fK^$lg-n+ zZ{2?`GK^H>k>mjb@~Bc$1qpRd0zz6(Tg=l4&NF5o=m*`uF32}W^py*hFcyAV)M*=e zI6F+;A6|4l{AVrT$)7qdM)r&t*-cDmGHs(W6pcme zI39I}nEf4!0#fRHqIm)SDWON*6_gzCDc{GV99t32I5C;G6Z4u?fblEn4f8QI)lzt*|(os7l<$_oehTI1vtF(%D3I*u(i#y9q?6BqQ z9KyVdL{fiGNYzuI_B@j59h8LF+Z#FnGm z*$c>wDAa?ves~O;6e=@K)wof3B2r0)MzKw^8UGcP(z_@A6|XDgEaMT3B8_%ZY&9Mg zNLwdUz)9lov+tCBZ?yW9$a~(_>=VG7wd;s${8vaaW!@;_K*saW9A+y#8837n9K7f; zAwmZ4pL*n_e(*f5G`ruJe5wfykv@=lx>u1vB9!%-D{zZ{6?3hYM%ln422#86>oUa^ zOYxJ7wxEiP_a0m6{`P2bX<~K zO0aG4i{KntR>Vu~Yh=!vFsCQae8;FiqXCkp+%tb*<%^;a~azR7)J4ipyRBU%j)NhY%L z-Gp@&!*Gh@T=!x$r@#3lCZv8S)E83HUK!fYo{R^%@}XVpg6dJXfy9ma<|jy}pQV|{ zlMI=leAB#7ZgLLSYC4T@U(5g>k7Kjw8gMjBwg)1AhacBPlvw+h{{q!rtP@FwQY0IU zItZcqC2atGEj)rF3fBp+IS{q<&ZkG#BGKYt6}-E*J1m%arnJ{y>KWy5&Z9zKS=|gc<|#*>M+BEk7#fSB zdgN!99xxe>53AM+%8EZzh3-v~xJnD<+jQCtI8*ER&!D`4zW+s%0j$3H3Y{&%I?^pLPKW{5YKicBfa9*i-x1NxkxD7-^gafM29fvud`TXU0yPVVGMao8Y#at z-7_d#-|V)#>u@fs4$(v3T%50spQbdxim8}t8rc$~aF_(YzH8(cpD?_%+V$c^g!dU& zg8>~xPE-yE^B8Sl$2i86Tuy@g$sHEbmyU17>My-i=E0s9Fob~3BA9%+dn7WLvugrH zp8WAhwtK-T_AczsP%-h}Af?E3TP@HE3vU5#3LkSy7_d|b$v+?T3 z!cjw3LnyC;aHzAKvZ><3tw%{9>EtUVTdk|N-Z}C)mD;NtDrUeLYVW*uVH&6LTI3jfEK%7j{Ked+86f|m5duN*x?j${(l%9iOk~Q!wkr|vpX}G z2M7K(;piBot$!OaBbc2;6%e~oa2T$J$jS;`Pb$+CjJ2KYO!tq?l^Ek9Q?|?0iTU>% zvQxgp(H=(>gn`kGW{RvP(J8VhejabU^A24xc9~cTcbu#C+vCm88DNbIkwjK%UO!@) zf!)C}2V)SXW}`SX7*yGTDo!E)sfg-BQ;-o?nl_Jm$DwO}F6A&I7WLHFpW->!>F)GyQKq3D$j!8Hj9!AM3 zMAXI9L51KsRQ*I-KiynNVmXkEi-YL#ikYb7w=#AS*hVpD$oJ#E0HFD7ly zzW|;U$FY@cu^!a0gF^99&ZO0g5FwMz^?63un#E{A`$JRZkX3b=tPaEX)NRdSU&0~s zK^8?8`Fff5cB3|~7_S&%+~G&HB=B-2SXV@671(1?pMHSSz0pE~&43rI`t0P87ta(= zt44udv6!StFA@bMHtlXyg?e)W@5?}Yj!}jOXNbXLp3U_m8fw;?&0;6B>tR-`vJz!j zf)e3`v7#dw^Cn(lyqaVu)f6udZ&kL>63J2=OnqR)6R)f8Jl=y@3laYsPmVIqE5kgm zm>e6|s=tcsD-Vgpa%_a8JGSi`xA&DO>=*<%=Pt%=x-^{pgW0uY0%nwi2|lpfgT4XW zA(mqqE7$j+yK%oltGtIPit%iu0$GT5p^ugdx54d(LMZ0#!_0@QB1pJoXluz^jSe+i zO8s0J@8#_1^PHrrL}>vL)(+Oy^l$3kGC?gP6R-Sa@w$p+! z_u8GGeJJ1E;2?0zOA^l2o-E>2g`U=5OjN8et2b6m42|C;gxCWf`N-HVBRK? z|1BqLc`4biRI7}W3Ht80+Z}2QzEE6*q;L9HAJhq|LXBzP9q%Hyj+AW$qc3m_JCvYI zjm>Ndk=MY(%jtvfV9&-kl@4lUoQ8NPI#S@vvkqhl`J=d6sh-kMm{pG6Ht1~hd*Ys+ z*PK&|>M`d2i>fjFbKk|&MT>Z$m#!x}Zyes53*6uvdZT6kHwR+S3?lK5iuDQas&{4U z@bsU(6;S$d@r?h@VawHm>poqwz~@i@*6s4ZNQk)=^^ZYN8~jh0-qCATUJm8JJ;bB@ zqy29f+{^mD>3t*t((PQ5Y}8$HPH7god~CGE_YZ%y!X|$E1h`3**WrYUaw;fImJFR7 zX9}ysi%Abs?zFoZ+dKcxu$US1O8-1NCfm;%2 zzKH%aJ2q;st)`%XA1!5mqitL(xnNNV5f4}5XXO{`b#e-|HsyyHDQ08|Zr*!Y97lZx z%&Rqe8@>kf@>nQ$KK$7re;)r{#=KFG(98GPf6pSDHvo|z0g;>9;qSN}VBN3!u0wlj zYo_rLZA!ooBdFUQ7tJmnRsa3H#O~UZ=+Rd?yJ$EYvxxW*pVs^YC=Z^NTW}Vl47ooX z#0Y^n(B?tWXhlt4RsDQ?-;KR_y~n)5+K*fCvGa>D5JRX4(fw38d2vpqs@y%xIK1bG zd8K(#E=31*uEOC~`n@R5nl}{U*%J?_HV1*Q2rs}jrV$v}-1b{5*vP@1A}>CPK!AWf zc5Rf*`KKa3p}0t?b?)^b?qJ6n#H+H*ooCnkZ_D+uSfUd?-tBoxni+W(H7@^TQermU zjoGKKza0T+*+O}8F-L>qNVrS+Ib9`Xc}QvAgcW8FIa{wA#DE!C5j1waHgxarZjtav zXF}KducTF%w`q=q@CKF__ZpFpA5lD}WXA)`geUeYCxe%J$K=BKFr{mu`jI8C#U0;X zK5K8Zr+AG2OJ8FK^zqEvCZ0vNv46@-V};SFtBFUodnau7jrvX@U;tZDCzX8Gd+oM- znkm3Dr`1Y=JWH46dZt1L6%+vz-cR^4fwb@cI61;7!|YW&nD*sBvwkY`ZE@h)PdOc_ zS;e4HcE<+srvJ@u;Np&h>z(WmYC9@QYZo3Owr`KA+^K&3sX@Pmn|5u zC9RM?you8bF7E1e&OK&_>=I&JmQ!byoZmYhX@AGmC^7jgSQO_I<@Ku#cGuPL+LKN? z{|Bp-CWr-262b3^-Y=)AYM`=8ODK9hEGWW8)U~-jSGJW&1)#K?7odlsR~HTdHg?PI zNx$}Z#U^?aa(%{Yl_)&x9aCN4zkZ&YW~%E2Gs#+CdyzbP;5#KLL5;KifAlEodS8sQ z-?z-4D|GF$<(~|DN}pk?ah$O4DLjkW)s#Od<5J zQejhRN&6e|fp5SkiI-VdO1O`5u0O8USRHW7)0-$mgav3n)1wUv z@=i0fwf=KTCALR|Nj-)xD+m+;p}N=v7p0(Vv**WBWH%nKpgYt^9P6z7vCy@)WMz#Z z?3RpO`Mz*^oP~FlZ6yzppr~)El0>XSYV3PacVhN0S0#rFsuWxn1Y_!dP~#FF>cS=d z$(SE%%~lEm@1p&%N;-3;shrR?goRdrc++)3o!{R&pAuBgLCa#)i3*10KH?|NiUwC5Qo6 zTY@H4mow&3Qi%)Xpe}UsjNYIuRb9uq{D7IjI0>K!fM9XsMbXv%lp#1ngai=R6{{gm zpcR2Ov@~hdz=yb~fV++uv!=d!6WUK&`u8d0J;lu2?9ncd4-M}vP1U`>=_?Y)dh|p} z!{#w`Ae?ziZGwTR!?2oKtrHKZSKS|#CHRW3Tfpg%R5_Utd927*qj>0vmN71oH_P#B zBo)!p?z49oZ-C3+WB3!GJN0mJ7Xi?5D(6Xr2(Uw5Y>?HM_Rv}ZhATsJ_dYIpX)5c>>7s9r;wuOOiCnc8MCR<8vg-8&~Zg=;VL)@S1 zn`Zh=MSKokMV@6$XzDf`*`vS)t8|7BHhP!2pJ#E<1q5?Vc~eCuwfQr zXEEZKTP6R5+BRbA9F~j^uHQ#fI!$YN^Fuf+r;F5CU|)30`$L-a{PVYf%rI&#lcu+? zWh>3W4Ht#s&mp+H{@Z3cJjfc|_i7*I&joML#FQ#n-+0`8-P}zvEpU^BQsMTlc$AP! z+C`-!qBHMa^8bIyE5!ug+|N3Pxc> zcgzDE?H-|k0*5$GllusabTw}cXRP1|d1|)!OM;8;)O)d~#~He$aSg=hj0}dl*t5*V z&Paxe*%BBGxO<&a@3_JA62p=dirB(x(h{2O`p3W%<3IgV zCd=pXhdZU;%eXmfSr1NFmo3^pa=T12bBKghh{U5W?rlHC<>MC#r00&J{qmB2$1f10 zfLUl-DqF%~rLcBg0*$pTb+JTT@s++2lSIOb>-@%vuSlD}FGq+DK`)b2Zh1yXSIC~~ z;9_1;ifM}tPHBO?SQmU;1{E1~#mPCsrNJl~8J}xJj6t-lCEd<4=4uwpgenAsS|U{=fz@q1GDVJ>(Mw_f!4Uv z7$RNzq_cIGV`u&r29a+mvhS60NBpXa_6B~}qU`hGAhsT?OI{>%>}q34$yp?vOV<53)W;nw)n0xC8d zlt`#|HfEIb(}5jF@D^2)2d4PF*l3|)M4&pKu%)=enfu4PM>KB%d-t*EiJQKjvgIq; zSWuPB-MdTt+CbRK{gi?A)5agNwZi%p+sAj=E`+WXjR0|()WXnZnu3!V`-aWFA&vAy zrE6Qb^ylN@D_H`$Sz))Nr)>Ab$-A1d-YA5_Hm+(@wG z67M%Z^2NRXULSS5 z*(xJ%+bS-NPHDvRk^bAw@5c2bAuo1+*)JK&`oOi*4hvNPVP6Jg18{Ful(Kr3@xDA1 zz+2U6!|n4I=s}}%$G*7UQ;&u{Om`QCcB@!esE(CF;Hs%5J#OIL?K`Lu{BYwHZOZ9N z?NeLA|H;VcmX;5_2QsSi#4@<>ew;zRNAlfnyv1|Haq#hQIjkfyyvSthy@a{)(5RGC zpB9y}*8qwXsok?j$;~+_I2yPL-DQS$rq>r?2W(L3#~?v1!PyzjVOtHztY)=puY`XF zg4)06E;DCv4<#)tz}v^~ofeRu<|EE(6BUsK=T{i?3b6;R93`V(5ypm3fVkSd6CZw} zH;i)~RG50K_HS_N?*%NV$JQkCifxOG7V+CKeA;PR-9w-6VT-u6358lD^JzkU+7K=+ z3cAP7{lWh(`sMka~ONK z;BQ6UJd1+Q@10MKgso{P+j|NMM?D4#DN9UbHXbCYnCNEZo~wY#p>pW{kojNPHB~A z=36kLwjDl>=B`P>PTIGmkTVDnu1qHnl+#Dk^CA-QVtvuu@~FHN(Up3&=T(N@d^jX& zNFP!dH@czSknH+i(%A-Vv38IXA5@wpR!W?oP?|JjnM-AqwHIxWn)8xTW5JZD2WR)` zQ_A$7x_@2d+;AwSM3xq>h#+1cnTnQMK!7sOV5FUMNap>(Sp4Un4$HeBS)eMms;Ny! z5UQv-<+5BD)QXSdp%7rPQ+gvrVa{^>V8g=0bf=%inPmLP>*m|SWinrDM#0md2R^w) zWmnXZLp&lOaxwE`%QF2UesBa$49lFFrcLn5TDE(yu-|#x<{DlYytNX^5oc!0$E&E` z-L3*UU+h?0xN^dPPZM(ruB_Tj7!r-M0%n*-T48>K#iuyw)lM;tO0oZVv%cvnxYS}# zL94!#5ud-Fhki(sN#9cPx1+?=l<|zdW01S|gzGyD4J=qi*<&$}f!XmZpJ0x5_-9JOn?%MjLFD5cTG(Ze|+_iy{zEtEiar%l1sjbObdVcw$=~35V0%R zTe!tRtcHnDJg}!!nQB$Y?yQ%z`~V&Fg-65(m-QhMk26#eSxvH~d!7=`TevRW zYFH0V631ZUlu1;cD*PLeKiBZhwNN z`Zj2fa;BQ{7;L=s*!5U=qD%3!b@FY)0OnoH94p->+GBt>UfmFjkv}AAwHcWwrxV{z zSg_#KW*Db5e*={quQK;FkvOVj{SlS+iLj@Hp2ku?V(8T~ocs-ByVTcGy1J>@vk862 z$K!qRUEtd>HS58Gu|-QrA0p*?Vx|!!Zbo5jd*Q@S)t2Vh?X<1Bv9Zws#M@hGByOi> z3IH~0&L>nM(SW5v=azzn@4JLd*kz$?CA@DF5meGN%iLYc6zkOe33lSO3I`_BI}|a{a|OLHz}2hoM_4y5=Qz(>WXK@=x!QHZg<4D|>lgwr((b4NT!( zcuO)ivs5Q!3Cm2{OO@Mstr%&6nNq}14_hk$c)_wGOQ-b`_s-?-(rl}Lax$3l50FMy zZvWfpct88zSYXCWoM~3m)N5wtIrQ#ZC*t6rKe&7qiMPp2ZP|)~v+_MGbQ}gfER`f> zIzD}TY^Yv29D(QZ!VkELiFlWH!-wT{_RYYv};M}-Y9#3n%uXy+>L%AF%i9BR0hKQE>FF!!hDT;0D*UVtNU4MDwq?J{x zKcQzBU;ftZbdCJJmp_up>+|oCBu33lZ=+1jA8)sU;oKN@m=5iZTrVwI<*HjgV(>Vv zy-f7pxV(Pgw&weDIXHB1zZF?rxETGq@~oJIs`XpYP4lK0c6x4G*}n$y@~*u-koTr| zY;rPRnr$1VFes47{!6;Uu4>I?3VXH9Im@^yWiKriG$Sgm;n5ct2!8H;>rQV+i+Vg; zTN9bLtk<-g_-*&FbC!EB)%^5h8DhEeUHkDCi80)<-Qa7w?cugkAvE$8OIt%U^W}K& zAjQmMwuYxnCz9v&9p~0@?Y|UXb7K*+teIbb%sw!8lq6@&a+v{VCn*REQ#~$_{@m=Q znr!v$dK9$CmjD2$TmOCwz^YP7IF>>>C(`4Z=ep4IF{OZxbgpJWV(m7Y=Xw;JF!dPj zw2R4S>Hdqz{pRehzy@@Rqc}2es*FV>=l1qAH~IFuroD~dEI;jFq4&HEO>>53gyz+b zas+a8ELyt=-Utcp$@lKf8bX`mF8gHL1AP{cbIDRPEP? z%9c@Rdh`&HBQ!fp@(`t}W&o`1`zwH`>5lht46mY)>#V7@T)xe)`*?@Ks%?kXDht(Z zoiT+y+G=&Usa&%?boC~9=YIw74iNFQV@LVdb;geEp|AYi-ZW!s_8$yv-n@nW`JcZ= z-~RRwX%C*X+M$M1#uH9FiC%f$`E=ybM~hbjtZb5RfR#aBH>}^lE2$gl7dPBM&pqod zKxg2lA(OLb&!j7^_#mBo?%56Lx2p8{Z?2(V-I09ib@oY<=zVXW)vD=+#{KMPzoNhY z`>W{r=iT+Qh6ZJzG;jU_T5|5WboMz*Dpp+?xEpmQ4X{$&7?W7Z~o>lXy1MLIa4XOr&kQo2S3esxR)=kA}?5NT=m!UX}<;OJ^}|0mMvS( z^ZH+O#~r_q{N;hcs_W#_Pp9)QdM)4Q)!9??Jj_3<7!0u5%7UYx;2L0^{%(kJKyBm}7Gf$@I&P=oSYJk;Zj<;^vLO;9y zI{N8PuBEjvboVr**(vO^&jML(oqX~M%?_>5zx%3LdbzIl__{Tp$bLO;meF@J?$Eo15XLmF-r+w#-l~coJpF6L{SFc_} z|L_n0Ot@ZE^dO!Lvbk z9aEbyVLW~CgO}087r&wD)0G=<+elyhR&%S%_q=r`EjgvRn@Mrn{hjapkgmGwYqVuc zvHwVfI~LcuPCx5xdfgk}Nb?uu`wQb?+}-32u#-yoDCZ`(&s++CHmg?ei9FH#BKw)PCx4` zdgEIz=BGx?AF=anXJQ6evFxp1w~oI1t#8wfKf8f&Dl!_|v}sf6V;_4z;roe64fi^| z`O<%<33FbZ)LmD$W%Uj8-K*b3xJN9h;d_6d`ON>Nb?eISnorUli86eWxa3vm(wpD* zR+>7kyWb7XTYe3&{2tl9eLMZ+hd-nr|KJC-ZCmY+=<~J{vx?`XFFjgL6AwCQ|1uX> zT=92w`+YNM+Pqhk$s65R_uMb(N=yewnVj?%Qz{_-~o_diY9>r@&T-`vwV)%wn%HMH^h-_r8s&&u~4FT3m` z^qb%Omai37xm8{Vj#7$a^Ugc&pnLDWn+{sIhyY-twT;RZ7EbxT^DqBTZu;!xmt;rM zLALKve?{Y`E^cW`Th~8C%kKOCS{ggr2jRjzZa%&ElK;so-oa6qj?O=*sLLt7@9ul( zy_a6f-}$>{RDJrFcG`RUS}&G%#-=@wqS?bASRA`JhOy!rZLNQ_On58bmHy4IeT{zp z)1Qu(DQ7y*-u~7v0=F|Z(@7P``17k*(h1okwrK>@vdL^P{1SiWL@~qVR!t zz0<%d#Ur}6uk`|HXKad77!juM2N=ip<5hmFWJF9dn8b(&EG(b@^8N3pRnM&qrfqDy z8R+Y8{gkksvF*k^6364%zWf94r|Yiy@kpFr*_=k~DIxBw`lru+Rv!IQHe=gpKLb6z z)YIG8S8I}-$yl~Q!<~C7Xi^*_NrvyYe*KGIqCejM0Db84%SY^eTO)FXg~z>I{=p9# zSY=d^ef_PU4r)kg*ic(WOBukk*>LO^?U6^N8Pw)R9AGVd{Biood)`A&KJi5DnOkqm z8R+e6{ertXO~Z!TGFqMi9Qz-B&$|h=Fw)wH0<1?KdWf$0=tl|9tg@C}2GY1KAq^YZ z&9L~EUtIg5)Bfq*0Rk&8mDt<*vNL4#kY=HKuw@FMoJqI zfQ65Aue{<4`_giUj>a}Pk-VQgii&nbtVJ7 zZQRnJ5vE~7Z5ged0n`R+1hrE1R%pPIzaG3J@C++!oy$NPtD`h*bZ*AQ_kS*TY4vpk|8P3JX}b{`%MQ9IGNHzo@aN zu{uh_Mp5(E&A9RGH`Gp1TOk1pKd<%GFMP46IWK(NX@E@{HVU7}E=>TnQ`Aq>3kg`? z|F`eZ#tozMdEZ?+#>?EMalt$d8)ZS+M#C9E?fl@o|JJa6o)ilQSoq4pbw3{YU-Hb; zK@yK8jnz>aHsW#FcH;4WX8b z)(Qn!LqkLKiyLkzT8>9tylJeC(y%e&65HVkp_WinMQVittebEA1#Q~2u}JwHk+G(6 z{V5F_BQm)ioD^yaHC3cmD8Rb*M|SNh4+mFY8_#ps_|veVwv4u(fuhw^VF2sD?z)Sf zU9qC|J!2zN%Rm~dqcm)!Hla~$2sMS;DoQI1VBv;0Yx&4PZ*L0E!%D$MKC)5#D2h~D zg#awvV+72gw{L*>`N-|hgl&ke_AQx(HZy?QD$0$dDI9riW~+hWxBuoh zv~$Of1~g42>kOp%>0X+)vYz)ywvXCEjTNC40z`Et8oARE+Q59cr3cr}6 z2}{$K+BDjF28vK?xd*H}@3^D&JzyhK&p?{jozk?G`b0;e!6MXJt^o_b{PFmskB-7a zC%;op^E-fP+RAUniW3=X4Kq?Ho_Ct7qBL#gI%x$9F3+`>OTfajrdK}qY{7Q(=m>rQFf z8Xej1%q&rRd41k{E&=Pld+cI+XAaHgy`=ednlx=SKNA~KD+770!CV5?1NYkLV6B6x zn|(cf?LP}k<4@C;+BBL@2J%{ixdg2H4Y1NV>N2pB=H2OO+R9+6quOL%YcO|!wR+{M zLVRm{v>wg9edAM`dYZOU3(5>h2Jqwt)MDOR?f~ol`|NZuZwHCS)6>((4;vk$n{89r zf=z4r%s?J%F?WFV&;t+VbMIMHl*OldS=h8)l}-loSc|y>tVbVtIGt>pmDDqk#ix2% z*i3!mqtsv?YcW@Vg$Lm;U$$(N9v=Chb{4ClENtdKlf{S-wV1abr^ppxJ!a3o%Jq?) z#hvL{*vxej3l?17YBE=V_2|QPI+*9x z9eqba!DgJrcmJ}mS+KO`KHNOjW^MrMsV5Dv@_yuIu^P(4X5RBywD|H=o4En3r73MPE&%K4rwp))aGYmx&r}vRi;&Br z#h91tSh)bKr|kMwA&%cHRzq3XEJQL37Gz#(G#`LvpAZ(}@Xg|SQx-N0k<5YxX)7$h z!*=i9ZI6^G$ids2;tx>hl(Vp@wvDEj0X%93wc730^%d62=bodTJ9l+E59Ys42HdGz zPaUmRx_dHtl4&cE*qG`WK#ihSyWP4DSkEqB-t8Qi{{}LU<;C$VZ8tDAQ)w^*d8pN{ z1J;V=&or1WQ|o31vOIOm(snm(p*>1M30#+U_;&n6mMe?2Hb*3zB z7b(X@h_%}_+f~3?o`Z{cML0AOUrI0yr_P&y!9YU+eOWHp5yLj z?RE{YR(E-6ndbu{kFjNWoheJ(dCX routes = { login: (context) => LoginScreen(), verifyLogin: (context) => VerifyLoginScreen(), @@ -65,5 +69,6 @@ class AppRoutes { myAttendance: (context) => MyAttendanceScreen(), workFromHome: (context) => WorkFromHomeScreen(), addWorkFromHome: (context) => AddWorkFromHomeScreen(), + profile: (context) => ProfileScreen(), }; } diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index be692fe..354e0db 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -10,6 +10,7 @@ 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/provider/dashboard_provider_model.dart'; +import 'package:mohem_flutter_app/ui/landing/widget/app_drawer.dart'; import 'package:mohem_flutter_app/ui/landing/widget/menus_widget.dart'; import 'package:mohem_flutter_app/ui/landing/widget/services_widget.dart'; import 'package:mohem_flutter_app/widgets/circular_avatar.dart'; @@ -27,7 +28,7 @@ class DashboardScreen extends StatefulWidget { class _DashboardScreenState extends State { late DashboardProviderModel data; - + final GlobalKey _scaffoldState = GlobalKey(); @override void initState() { super.initState(); @@ -47,272 +48,277 @@ class _DashboardScreenState extends State { @override Widget build(BuildContext context) { List namesD = ["Nostalgia Perfume Perfume", "Al Nafoura", "AlJadi", "Nostalgia Perfume"]; - + final GlobalKey _key = GlobalKey(); // return Scaffold( - body: Column( - children: [ - Row( - children: [ - Row( - mainAxisSize: MainAxisSize.min, - children: [ - CircularAvatar( - width: 34, - height: 34, - url: "https://cdn4.iconfinder.com/data/icons/professions-2-2/151/89-512.png", - ), - 8.width, - SvgPicture.asset("assets/images/side_nav.svg"), - ], - ).onPress(() {}), - Expanded( - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - //AppLogo(), - 8.width, - LocaleKeys.mohemm.tr().toText14() - ], - ), - ), - SizedBox( - width: 36, - height: 36, - child: Stack( - alignment: Alignment.centerLeft, - children: [ - SvgPicture.asset("assets/images/announcements.svg"), - Positioned( - right: 0, - top: 0, - child: Container( - padding: const EdgeInsets.only(left: 5, right: 5), - decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)), - child: "3".toText12(color: Colors.white), + key: _scaffoldState, + body: Column( + children: [ + Row( + children: [ + Builder(builder: (context) { + return Row( + mainAxisSize: MainAxisSize.min, + children: [ + CircularAvatar( + width: 34, + height: 34, + url: "https://cdn4.iconfinder.com/data/icons/professions-2-2/151/89-512.png", ), - ) - ], + 8.width, + SvgPicture.asset("assets/images/side_nav.svg"), + ], + ).onPress(() { + _scaffoldState.currentState!.openDrawer(); + }); + }), + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + //AppLogo(), + 8.width, + LocaleKeys.mohemm.tr().toText14() + ], + ), ), - ).onPress(() { - data.update(context); - }) - ], - ).paddingOnly(left: 21, right: 21, top: 48, bottom: 7), - Expanded( - child: SingleChildScrollView( - child: Column( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, + SizedBox( + width: 36, + height: 36, + child: Stack( + alignment: Alignment.centerLeft, children: [ - LocaleKeys.goodMorning.tr().toText14(color: MyColors.grey77Color), - "Mahmoud Shrouf".toText24(isBold: true), - 16.height, - Row( - children: [ - Expanded( - child: AspectRatio( - aspectRatio: 159 / 159, - child: Consumer( - builder: (context, model, child) { - return (model.isAttendanceTrackingLoading - ? GetAttendanceTrackingShimmer() - : Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - gradient: const LinearGradient(transform: GradientRotation(.46), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ - MyColors.gradiantEndColor, - MyColors.gradiantStartColor, - ]), - ), - child: Stack( - alignment: Alignment.center, - children: [ - if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, + SvgPicture.asset("assets/images/announcements.svg"), + Positioned( + right: 0, + top: 0, + child: Container( + padding: const EdgeInsets.only(left: 5, right: 5), + decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)), + child: "3".toText12(color: Colors.white), + ), + ) + ], + ), + ).onPress(() { + data.update(context); + }) + ], + ).paddingOnly(left: 21, right: 21, top: 48, bottom: 7), + Expanded( + child: SingleChildScrollView( + child: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.goodMorning.tr().toText14(color: MyColors.grey77Color), + "Mahmoud Shrouf".toText24(isBold: true), + 16.height, + Row( + children: [ + Expanded( + child: AspectRatio( + aspectRatio: 159 / 159, + child: Consumer( + builder: (context, model, child) { + return (model.isAttendanceTrackingLoading + ? GetAttendanceTrackingShimmer() + : Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + gradient: const LinearGradient(transform: GradientRotation(.46), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ]), + ), + child: Stack( + alignment: Alignment.center, + children: [ + if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true), + if (model.isTimeRemainingInSeconds == 0) "01-02-2022".toText12(color: Colors.white), + if (model.isTimeRemainingInSeconds != 0) + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 9.height, + CountdownTimer( + endTime: model.endTime, + onEnd: null, + endWidget: "00:00:00".toText14(color: Colors.white, isBold: true), + textStyle: TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold), + ), + LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white), + 9.height, + ClipRRect( + borderRadius: BorderRadius.all( + Radius.circular(20), + ), + child: LinearProgressIndicator( + value: model.progress, + minHeight: 8, + valueColor: const AlwaysStoppedAnimation(Colors.white), + backgroundColor: const Color(0xff196D73), + ), + ), + ], + ), + ], + ).paddingOnly(top: 12, right: 15, left: 12), + ), + Row( children: [ - LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true), - if (model.isTimeRemainingInSeconds == 0) "01-02-2022".toText12(color: Colors.white), - if (model.isTimeRemainingInSeconds != 0) - Column( + Expanded( + child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - 9.height, - CountdownTimer( - endTime: model.endTime, - onEnd: null, - endWidget: "00:00:00".toText14(color: Colors.white, isBold: true), - textStyle: TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold), - ), - LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white), - 9.height, - ClipRRect( - borderRadius: BorderRadius.all( - Radius.circular(20), - ), - child: LinearProgressIndicator( - value: model.progress, - minHeight: 8, - valueColor: const AlwaysStoppedAnimation(Colors.white), - backgroundColor: const Color(0xff196D73), - ), - ), + LocaleKeys.checkIn.tr().toText12(color: Colors.white), + (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn) + .toString() + .toText14(color: Colors.white, isBold: true), + 4.height, ], + ).paddingOnly(left: 12), + ), + Container( + width: 45, + height: 45, + padding: const EdgeInsets.only(left: 14, right: 14), + decoration: const BoxDecoration( + color: Color(0xff259EA4), + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(15), + ), ), - ], - ).paddingOnly(top: 12, right: 15, left: 12), - ), - Row( - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.checkIn.tr().toText12(color: Colors.white), - (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn) - .toString() - .toText14(color: Colors.white, isBold: true), - 4.height, - ], - ).paddingOnly(left: 12), - ), - Container( - width: 45, - height: 45, - padding: const EdgeInsets.only(left: 14, right: 14), - decoration: const BoxDecoration( - color: Color(0xff259EA4), - borderRadius: BorderRadius.only( - bottomRight: Radius.circular(15), - ), + child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"), ), - child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"), - ), - ], - ), - ], - ), - ], - ), - ).onPress(() { - Navigator.pushNamed(context, AppRoutes.todayAttendance); - })) - .animatedSwither(); - }, + ], + ), + ], + ), + ], + ), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.todayAttendance); + })) + .animatedSwither(); + }, + ), ), ), - ), - 9.width, - Expanded( - child: MenusWidget(), - ), - ], - ), - ], - ).paddingOnly(left: 21, right: 21, top: 7), - ServicesWidget(), - 8.height, - Container( - width: double.infinity, - padding: EdgeInsets.only(top: 31), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only(topRight: Radius.circular(50), topLeft: Radius.circular(50)), - border: Border.all(color: MyColors.lightGreyEDColor, width: 1), - ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ + 9.width, Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - LocaleKeys.offers.tr().toText12(), - Row( - children: [ - LocaleKeys.discounts.tr().toText24(isBold: true), - 6.width, - Container( - padding: const EdgeInsets.only(left: 8, right: 8), - decoration: BoxDecoration( - color: MyColors.yellowColor, - borderRadius: BorderRadius.circular(10), - ), - child: LocaleKeys.newString.tr().toText10(isBold: true)), - ], - ), - ], - ), + child: MenusWidget(), ), - LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true), ], - ).paddingOnly(left: 21, right: 21), - SizedBox( - height: 103 + 33, - child: ListView.separated( - shrinkWrap: true, - physics: const BouncingScrollPhysics(), - padding: const EdgeInsets.only(left: 21, right: 21, top: 13), - scrollDirection: Axis.horizontal, - itemBuilder: (cxt, index) { - return SizedBox( - width: 73, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 73, - height: 73, - decoration: BoxDecoration( - borderRadius: const BorderRadius.all( - Radius.circular(100), - ), - border: Border.all(color: MyColors.lightGreyEDColor, width: 1), - ), - child: ClipRRect( - borderRadius: const BorderRadius.all( - Radius.circular(50), + ), + ], + ).paddingOnly(left: 21, right: 21, top: 7), + ServicesWidget(), + 8.height, + Container( + width: double.infinity, + padding: EdgeInsets.only(top: 31), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only(topRight: Radius.circular(50), topLeft: Radius.circular(50)), + border: Border.all(color: MyColors.lightGreyEDColor, width: 1), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + LocaleKeys.offers.tr().toText12(), + Row( + children: [ + LocaleKeys.discounts.tr().toText24(isBold: true), + 6.width, + Container( + padding: const EdgeInsets.only(left: 8, right: 8), + decoration: BoxDecoration( + color: MyColors.yellowColor, + borderRadius: BorderRadius.circular(10), + ), + child: LocaleKeys.newString.tr().toText10(isBold: true)), + ], + ), + ], + ), + ), + LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true), + ], + ).paddingOnly(left: 21, right: 21), + SizedBox( + height: 103 + 33, + child: ListView.separated( + shrinkWrap: true, + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.only(left: 21, right: 21, top: 13), + scrollDirection: Axis.horizontal, + itemBuilder: (cxt, index) { + return SizedBox( + width: 73, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 73, + height: 73, + decoration: BoxDecoration( + borderRadius: const BorderRadius.all( + Radius.circular(100), + ), + border: Border.all(color: MyColors.lightGreyEDColor, width: 1), ), - child: Image.network( - "https://play-lh.googleusercontent.com/NPo88ojmhah4HDiposucJmfQIop4z4xc8kqJK9ITO9o-yCab2zxIp7PPB_XPj2iUojo", - fit: BoxFit.cover, + child: ClipRRect( + borderRadius: const BorderRadius.all( + Radius.circular(50), + ), + child: Image.network( + "https://play-lh.googleusercontent.com/NPo88ojmhah4HDiposucJmfQIop4z4xc8kqJK9ITO9o-yCab2zxIp7PPB_XPj2iUojo", + fit: BoxFit.cover, + ), ), ), - ), - 4.height, - Expanded( - child: namesD[6 % (index + 1)].toText12(isCenter: true, maxLine: 2), - ), - ], - ), - ); - }, - separatorBuilder: (cxt, index) => 8.width, - itemCount: 6), - ), - ], - ), - ) - ], + 4.height, + Expanded( + child: namesD[6 % (index + 1)].toText12(isCenter: true, maxLine: 2), + ), + ], + ), + ); + }, + separatorBuilder: (cxt, index) => 8.width, + itemCount: 6), + ), + ], + ), + ) + ], + ), ), - ), - ) - ], - ), - ); + ) + ], + ), + drawer: SafeArea(child: AppDrawer())); } } diff --git a/lib/ui/landing/widget/app_drawer.dart b/lib/ui/landing/widget/app_drawer.dart new file mode 100644 index 0000000..4ef5eb4 --- /dev/null +++ b/lib/ui/landing/widget/app_drawer.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:mohem_flutter_app/config/routes.dart'; +import 'package:mohem_flutter_app/ui/landing/widget/drawer_item.dart'; +import 'package:provider/provider.dart'; + +class AppDrawer extends StatefulWidget { + @override + _AppDrawerState createState() => _AppDrawerState(); +} + +class _AppDrawerState extends State { + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + child: Drawer( + child: Column(children: [ + const SizedBox( + height: 200, + ), + Expanded( + child: ListView(padding: const EdgeInsets.all(21), physics: const BouncingScrollPhysics(), children: [ + Divider(), + InkWell( + child: DrawerItem( + 'My Profile', + icon: Icons.person, + color: Colors.grey, + ), + onTap: () { + drawerNavigator(context, AppRoutes.profile); + }) + ])) + ]))); + } + + drawerNavigator(context, routeName) { + Navigator.of(context).pushNamed(routeName); + } +} + +String capitalizeOnlyFirstLater(String text) { + if (text.trim().isEmpty) return ""; + + return "${text[0].toUpperCase()}${text.substring(1)}"; +} diff --git a/lib/ui/landing/widget/drawer_item.dart b/lib/ui/landing/widget/drawer_item.dart new file mode 100644 index 0000000..301719b --- /dev/null +++ b/lib/ui/landing/widget/drawer_item.dart @@ -0,0 +1,59 @@ +import 'dart:ui'; +import 'package:flutter/material.dart'; + +class DrawerItem extends StatefulWidget { + final String title; + final String subTitle; + final IconData icon; + final Color color; + final dynamic assetLink; + + const DrawerItem(this.title, {required this.icon, required this.color, this.subTitle = '', this.assetLink}); + + @override + _DrawerItemState createState() => _DrawerItemState(); +} + +class _DrawerItemState extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(top: 0, bottom: 5, left: 0, right: 0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (widget.assetLink != null) + Container( + height: 20, + width: 20, + child: Image.asset(widget.assetLink), + ), + if (widget.assetLink == null) + Icon( + widget.icon, + color: widget.color ?? Colors.black87, + size: 25, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + width: MediaQuery.of(context).size.width * 0.45, + child: Text(widget.title, + style: TextStyle( + color: widget.color ?? Color(0xFF2E303A), + fontSize: 14, + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + letterSpacing: -0.84, + )), + ), + ], + ), + ), + ], + )); + } +} diff --git a/lib/ui/screens/profile/profile_screen.dart b/lib/ui/screens/profile/profile_screen.dart new file mode 100644 index 0000000..4431c95 --- /dev/null +++ b/lib/ui/screens/profile/profile_screen.dart @@ -0,0 +1,66 @@ +import 'dart:ui'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.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 { + @override + Widget build(BuildContext context) { + return Scaffold( + extendBody: true, + backgroundColor: const Color(0xffefefef), + body: Stack(children: [ + 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, + ), + ), + 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: [ + SizedBox( + height: 80, + ), + Container( + padding: EdgeInsets.only(left: 15, right: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton( + onPressed: () {}, + icon: Icon( + Icons.arrow_back_ios, + color: Colors.white, + )), + InkWell( + child: Container( + padding: EdgeInsets.only(left: 10, right: 10, top: 5, bottom: 5), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(15), color: Colors.black.withOpacity(.3)), + child: Row(children: [ + Icon(Icons.photo, color: Colors.white), + Text( + 'Edit', + style: TextStyle(color: Colors.white, fontSize: 12), + ) + ]))), + ], + )), + HeaderPanel(), + ProfilePanle() + ]), + ) + ])); + } +} diff --git a/lib/ui/screens/profile/widgets/header.dart b/lib/ui/screens/profile/widgets/header.dart new file mode 100644 index 0000000..3a4499a --- /dev/null +++ b/lib/ui/screens/profile/widgets/header.dart @@ -0,0 +1,16 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class HeaderPanel extends StatelessWidget { + @override + Widget build(BuildContext context) { + double _width = MediaQuery.of(context).size.width; + return Container( + padding: EdgeInsets.symmetric(horizontal: _width / 10, vertical: 0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [], + )); + } +} diff --git a/lib/ui/screens/profile/widgets/profile_info.dart b/lib/ui/screens/profile/widgets/profile_info.dart new file mode 100644 index 0000000..a02b56e --- /dev/null +++ b/lib/ui/screens/profile/widgets/profile_info.dart @@ -0,0 +1,122 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class ProfileInFo extends StatelessWidget { + String data = '.'; + double sliderValue = 75; + List menu = [ + ProfileMenu(name: 'Personal information', icon: ''), + ProfileMenu(name: 'Basic Details', icon: ''), + ProfileMenu(name: 'Family Details', icon: ''), + ]; + @override + Widget build(BuildContext context) { + return Container( + child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [ + /// card header + customLabel('Sultan khan', 22, Colors.black, true), + + customLabel('217869 | Software Developer', 14, Colors.grey, false), + + customLabel('sultan.khan@cloudsolutions.com.sa', 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), + + 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)], + ), + Column( + children: [customLabel('Month', 14, const Color(0xff808080), true), customLabel('06', 22, Color(0xff2BB8A6), true)], + ), + Column( + children: [customLabel('Day', 14, const Color(0xff808080), true), customLabel('20', 22, Color(0xff2BB8A6), true)], + ) + ])), + + Divider(height: 40, thickness: 8, color: const Color(0xffefefef)), + Container( + padding: EdgeInsets.only( + left: 20, + right: 20, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + customLabel('Profile Completion 75%', 18, Colors.black, true), + const SizedBox(height: 10), + Row( + children: [ + for (var i = 0; i < 4; i++) + if (i < 3) Expanded(child: drawSlider(Color(0xff2BB8A6))) else Expanded(child: drawSlider(const Color(0xffefefef))) + ], + ), + const SizedBox(height: 10), + Text( + 'Complete Profile', + style: TextStyle(color: Color(0xff2BB8A6), fontWeight: FontWeight.bold, decoration: TextDecoration.underline), + ), + ], + )), + + /// description + Divider(height: 50, thickness: 8, color: const Color(0xffefefef)), + + Column( + children: menu.map((i) => rowItem(i, context)).toList(), + ) + ])); + } + + Widget drawSlider(color) { + return Row(children: [ + Expanded( + flex: 1, + child: ClipRRect( + borderRadius: BorderRadius.circular(10), + child: Container( + height: 6, + width: 20, + color: color, + ), + )), + Container(height: 6, width: 3, color: Colors.white), + ]); + } + + Widget rowItem(obj, context) { + return InkWell( + onTap: () { + // Navigator.pushNamed( + // context, + // AppRoutes.addEitScreen, + // arguments: obj, + // ); + }, + child: ListTile( + leading: FlutterLogo(), + title: Text(obj.name), + trailing: Icon(Icons.arrow_forward), + ), + ); + } + + Widget customLabel(String label, double size, Color color, bool isBold, {double padding = 0.0}) => Container( + padding: EdgeInsets.all(padding), + // height: 50, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + 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 new file mode 100644 index 0000000..7cf73ea --- /dev/null +++ b/lib/ui/screens/profile/widgets/profile_panel.dart @@ -0,0 +1,28 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/ui/screens/profile/widgets/profile_info.dart'; + +class ProfilePanle extends StatelessWidget { + @override + Widget build(BuildContext context) { + double _width = MediaQuery.of(context).size.width; + return Container( + margin: EdgeInsets.fromLTRB(5, 0, 5, 10), + height: MediaQuery.of(context).size.height, + child: Stack(children: [ + Container( + width: _width, + margin: EdgeInsets.only(top: 50), + padding: EdgeInsets.only(top: 50), + decoration: BoxDecoration( + 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(), + ), + Container(height: 100, alignment: Alignment.center, child: ProfileImage()) + ])); + } + + Widget ProfileImage() => CircleAvatar(radius: 70, backgroundImage: AssetImage('assets/images/user-avatar.png')); +} From 6529c2aeba99e9afeb12b4acb64ea57b9ec4a214 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Sun, 29 May 2022 10:56:28 +0300 Subject: [PATCH 10/19] 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, From 44c9a090f920eeccabeaa8309316d1b4c0ed3852 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Sun, 29 May 2022 11:39:16 +0300 Subject: [PATCH 11/19] fix personal details --- lib/models/generic_response_model.dart | 4 ++-- lib/ui/profile/personal_info.dart | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index eeecaa5..7fe9fe4 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -658,9 +658,9 @@ class GenericResponseModel { getEITTransactionList = json['GetEITTransactionList']; getEarningsList = json['GetEarningsList']; if (json['GetEmployeeAddressList'] != null) { - getEmployeeAddressList = []; + getEmployeeAddressList = []; json['GetEmployeeAddressList'].forEach((v) { - getEmployeeAddressList!.add(dynamic); + getEmployeeAddressList!.add(new GetEmployeeAddressList.fromJson(v)); }); } if (json['GetEmployeeBasicDetailsList'] != null) { diff --git a/lib/ui/profile/personal_info.dart b/lib/ui/profile/personal_info.dart index d21c5ed..e2abba0 100644 --- a/lib/ui/profile/personal_info.dart +++ b/lib/ui/profile/personal_info.dart @@ -2,6 +2,7 @@ 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/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; @@ -27,12 +28,18 @@ class _PesonalInfoState extends State { String? emailAddress = ""; String? employeeNo = ""; + // List getEmployeeBasicDetailsList = []; + // MemberInformationListModel? _memberInformationList; + + late MemberInformationListModel memberInformationList; + List getEmployeeBasicDetailsList = []; - MemberInformationListModel? _memberInformationList; + @override void initState() { super.initState(); + memberInformationList = AppState().memberInformationList!; } @@ -80,23 +87,23 @@ class _PesonalInfoState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ "Category".toText13(color: MyColors.lightGrayColor), - "${_memberInformationList!.eMPLOYMENTCATEGORYMEANING}".toText16(isBold: true, color: MyColors.blackColor), + "${memberInformationList!.eMPLOYMENTCATEGORYMEANING}".toText16(isBold: true, color: MyColors.blackColor), SizedBox( height: 20,), "Address".toText13(color: MyColors.lightGrayColor), - "${_memberInformationList!.lOCATIONNAME}".toText16(isBold: true, color: MyColors.blackColor), + "${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), + "${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), + "${memberInformationList!.bUSINESSGROUPNAME}".toText16(isBold: true, color: MyColors.blackColor), SizedBox( height: 20,), "Payroll".toText13(color: MyColors.lightGrayColor), - "${_memberInformationList!.pAYROLLNAME}".toText16(isBold: true, color: MyColors.blackColor), + "${memberInformationList!.pAYROLLNAME}".toText16(isBold: true, color: MyColors.blackColor), ] ), ), From fad58931f302eda1b87c75d68357c5c34798e198 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 29 May 2022 14:11:14 +0300 Subject: [PATCH 12/19] profile --- .vscode/settings.json | 5 ++ android/app/src/main/AndroidManifest.xml | 1 - assets/langs/ar-SA.json | 11 ++- assets/langs/en-US.json | 31 +++++--- lib/classes/utils.dart | 20 +++++ lib/generated/codegen_loader.g.dart | 76 +++++++++++++++++-- lib/generated/locale_keys.g.dart | 42 ++++++++-- lib/models/generic_response_model.dart | 4 +- lib/models/profile_menu.model.dart | 9 +++ lib/ui/screens/profile/profile_screen.dart | 55 +++++++++++--- lib/ui/screens/profile/widgets/header.dart | 3 + .../screens/profile/widgets/profile_info.dart | 48 ++++++------ .../profile/widgets/profile_panel.dart | 12 ++- 13 files changed, 255 insertions(+), 62 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 lib/models/profile_menu.model.dart 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, + ); } From f8651ab49a8752aaa7c31b1f922263d5a34d15c4 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 29 May 2022 14:22:33 +0300 Subject: [PATCH 13/19] app bar --- lib/ui/profile/basic_details.dart | 92 ++++++++++++++++--------------- 1 file changed, 49 insertions(+), 43 deletions(-) diff --git a/lib/ui/profile/basic_details.dart b/lib/ui/profile/basic_details.dart index e603180..0beec77 100644 --- a/lib/ui/profile/basic_details.dart +++ b/lib/ui/profile/basic_details.dart @@ -1,5 +1,3 @@ - - import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/profile_api_client.dart'; @@ -10,6 +8,7 @@ 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/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; class BasicDetails extends StatefulWidget { @@ -71,30 +70,38 @@ class _BasicDetailsState extends State { 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), - ], - ), + appBar: AppBarWidget( + context, + title: "Basic Details", ), + // 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(), + 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), + 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: [ @@ -108,32 +115,31 @@ class _BasicDetailsState extends State { 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), - ] - ), + 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(){ + + footer() { return Container( decoration: BoxDecoration( // borderRadius: BorderRadius.circular(10), From 1305e895a1feb81fcb16b9b8d69c65ca2abdaa5c Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Sun, 29 May 2022 15:50:22 +0300 Subject: [PATCH 14/19] fix arabic translation --- assets/langs/ar-SA.json | 10 ++++++ assets/langs/en-US.json | 13 +++++++- lib/generated/codegen_loader.g.dart | 24 ++++++++++++-- lib/generated/locale_keys.g.dart | 10 ++++++ lib/ui/profile/basic_details.dart | 13 ++++---- lib/ui/profile/contact_details.dart | 22 ++++--------- lib/ui/profile/family_members.dart | 28 +++++----------- lib/ui/profile/personal_info.dart | 32 +++++++------------ .../screens/profile/widgets/profile_info.dart | 1 + 9 files changed, 87 insertions(+), 66 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 98599fd..9efc35d 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -235,6 +235,15 @@ "year": "سنة", "month": "شهر", "day": "يوم", + "address" : "العنوان", + "phoneNumber": "رقم الجوال", + "businessGroup": "مجموعة العمل", + "Payroll": "الراتب", + "civilIdentityNumber": "رقم الهويه", + "dateOfBirth" : "تاريخ الميلاد", + "maritalStatus ": "الحالة الاجتماعية", + "fullName": "الأسم الكامل", + "remove": "حذف", "profile": { "reset_password": { "label": "Reset Password", @@ -245,6 +254,7 @@ "completeProfile": "الملف الشخصي الكامل", "personalInformation": "معلومات شخصية", "basicDetails": "تفاصيل أساسية", + "contactDetails": "بيانات التواصل", "familyDetails": "تفاصيل عائلية" }, "clicked": { diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 7601eee..dd2d2a4 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -236,6 +236,16 @@ "month": "Month", "day": "Day", "completingYear": "We appreciate you for completing the service of", + "address" : "Address", + "phoneNumber": "Phone Number", + "businessGroup": "Business", + "Payroll": "Payroll", + "civilIdentityNumber": "Civil Identity Number", + "dateOfBirth" : "Date of Birth", + "maritalStatus ": "Marital Status ", + "fullName": "Full Name", + "remove": "remove", + "update": "update", "profile": { "reset_password": { "label": "Reset Password", @@ -246,7 +256,8 @@ "completeProfile": "Complete Profile", "personalInformation": "Personal Information", "basicDetails": "Basic Details", - "familyDetails": "Family Details" + "contactDetails": "Contact Details", + "familyDetails": "Family Members" }, "clicked": { "zero": "You clicked {} times!", diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index d7f4465..5e6c80e 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -251,6 +251,15 @@ class CodegenLoader extends AssetLoader{ "year": "سنة", "month": "شهر", "day": "يوم", + "address": "العنوان", + "phoneNumber": "رقم الجوال", + "businessGroup": "مجموعة العمل", + "Payroll": "الراتب", + "civilIdentityNumber": "رقم الهويه", + "dateOfBirth": "تاريخ الميلاد", + "maritalStatus ": "الحالة الاجتماعية", + "fullName": "الأسم الكامل", + "remove": "حذف", "profile": { "reset_password": { "label": "Reset Password", @@ -261,6 +270,7 @@ class CodegenLoader extends AssetLoader{ "completeProfile": "الملف الشخصي الكامل", "personalInformation": "معلومات شخصية", "basicDetails": "تفاصيل أساسية", + "contactDetails": "بيانات التواصل", "familyDetails": "تفاصيل عائلية" }, "clicked": { @@ -330,7 +340,7 @@ static const Map en_US = { "setTheNewPassword": "Set the new password", "typeYourNewPasswordBelow": "Type your new password below", "confirmPassword": "Confirm Password", - "update": "Update", + "update": "update", "title": "Title", "home": "Home", "mySalary": "My Salary", @@ -526,6 +536,15 @@ static const Map en_US = { "month": "Month", "day": "Day", "completingYear": "We appreciate you for completing the service of", + "address": "Address", + "phoneNumber": "Phone Number", + "businessGroup": "Business", + "Payroll": "Payroll", + "civilIdentityNumber": "Civil Identity Number", + "dateOfBirth": "Date of Birth", + "maritalStatus ": "Marital Status ", + "fullName": "Full Name", + "remove": "remove", "profile": { "reset_password": { "label": "Reset Password", @@ -536,7 +555,8 @@ static const Map en_US = { "completeProfile": "Complete Profile", "personalInformation": "Personal Information", "basicDetails": "Basic Details", - "familyDetails": "Family Details" + "contactDetails": "Contact Details", + "familyDetails": "Family Members" }, "clicked": { "zero": "You clicked {} times!", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index b2b255d..230e45b 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -236,6 +236,15 @@ abstract class LocaleKeys { static const year = 'year'; static const month = 'month'; static const day = 'day'; + static const address = 'address'; + static const phoneNumber = 'phoneNumber'; + static const businessGroup = 'businessGroup'; + static const Payroll = 'Payroll'; + static const civilIdentityNumber = 'civilIdentityNumber'; + static const dateOfBirth = 'dateOfBirth'; + static const maritalStatus = 'maritalStatus '; + static const fullName = 'fullName'; + static const remove = 'remove'; 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'; @@ -244,6 +253,7 @@ abstract class LocaleKeys { static const profile_completeProfile = 'profile.completeProfile'; static const profile_personalInformation = 'profile.personalInformation'; static const profile_basicDetails = 'profile.basicDetails'; + static const profile_contactDetails = 'profile.contactDetails'; static const profile_familyDetails = 'profile.familyDetails'; static const profile = 'profile'; static const clicked = 'clicked'; diff --git a/lib/ui/profile/basic_details.dart b/lib/ui/profile/basic_details.dart index 0beec77..e229918 100644 --- a/lib/ui/profile/basic_details.dart +++ b/lib/ui/profile/basic_details.dart @@ -6,6 +6,7 @@ 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/generated/locale_keys.g.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/app_bar_widget.dart'; @@ -72,7 +73,7 @@ class _BasicDetailsState extends State { return Scaffold( appBar: AppBarWidget( context, - title: "Basic Details", + title: LocaleKeys.profile_basicDetails.tr(), ), // appBar: AppBar( // backgroundColor: MyColors.white, @@ -116,22 +117,22 @@ class _BasicDetailsState extends State { borderRadius: BorderRadius.circular(10.0), ), child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Full Name".toText13(color: MyColors.lightGrayColor), + LocaleKeys.fullName.tr().toText13(color: MyColors.lightGrayColor), "${fullName}".toText16(isBold: true, color: MyColors.blackColor), SizedBox( height: 20, ), - "Marital Status".toText13(color: MyColors.lightGrayColor), + LocaleKeys.maritalStatus.tr().toText13(color: MyColors.lightGrayColor), "${maritalStatus}".toText16(isBold: true, color: MyColors.blackColor), SizedBox( height: 20, ), - "Date of Birth".toText13(color: MyColors.lightGrayColor), + LocaleKeys.dateOfBirth.tr().toText13(color: MyColors.lightGrayColor), "${birthDate}".toText16(isBold: true, color: MyColors.blackColor), SizedBox( height: 20, ), - "Civil Identity Number".toText13(color: MyColors.lightGrayColor), + LocaleKeys.civilIdentityNumber.tr().toText13(color: MyColors.lightGrayColor), "${civilIdentityNumber}".toText16(isBold: true, color: MyColors.blackColor), ]), ), @@ -148,7 +149,7 @@ class _BasicDetailsState extends State { BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), ], ), - child: DefaultButton("Update", () async { + child: DefaultButton(LocaleKeys.update.tr(), () 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 index 3894c65..32f0ce8 100644 --- a/lib/ui/profile/contact_details.dart +++ b/lib/ui/profile/contact_details.dart @@ -10,10 +10,12 @@ 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/generated/locale_keys.g.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/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; class ContactDetails extends StatefulWidget { @@ -70,21 +72,9 @@ class _ContactDetailsState extends State { 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), - ], - ), + appBar: AppBarWidget( + context, + title: LocaleKeys.profile_contactDetails.tr(), ), backgroundColor: MyColors.backgroundColor, bottomSheet:footer(), @@ -179,7 +169,7 @@ class _ContactDetailsState extends State { BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), ], ), - child: DefaultButton("Update", () async { + child: DefaultButton(LocaleKeys.update.tr(), () 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 index d420abc..d62f101 100644 --- a/lib/ui/profile/family_members.dart +++ b/lib/ui/profile/family_members.dart @@ -12,9 +12,11 @@ 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/generated/locale_keys.g.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/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; class FamilyMembers extends StatefulWidget { @@ -51,23 +53,9 @@ class _FamilyMembersState extends State { 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), - ) - ], - ), + appBar: AppBarWidget( + context, + title: LocaleKeys.profile_familyDetails.tr(), ), backgroundColor: MyColors.backgroundColor, bottomSheet:footer(), @@ -136,7 +124,7 @@ class _FamilyMembersState extends State { ), ), TextSpan( - text: "Update", + text: LocaleKeys.update.tr(), style: TextStyle( color: MyColors.grey67Color, fontSize: 12, @@ -173,7 +161,7 @@ class _FamilyMembersState extends State { ), ), TextSpan( - text: "Remove", + text:LocaleKeys.remove.tr(), style: TextStyle( color: MyColors.DarkRedColor, fontSize: 12, @@ -226,7 +214,7 @@ class _FamilyMembersState extends State { BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), ], ), - child: DefaultButton("Update", () async { + child: DefaultButton(LocaleKeys.update.tr(), () async { // context.setLocale(const Locale("en", "US")); // to change Loacle Profile(); }).insideContainer, diff --git a/lib/ui/profile/personal_info.dart b/lib/ui/profile/personal_info.dart index e2abba0..b136141 100644 --- a/lib/ui/profile/personal_info.dart +++ b/lib/ui/profile/personal_info.dart @@ -8,9 +8,11 @@ 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/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/ui/profile/profile.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; class PesonalInfo extends StatefulWidget { @@ -46,22 +48,10 @@ class _PesonalInfoState extends State { 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), - ], + appBar: AppBarWidget( + context, + title: LocaleKeys.profile_personalInformation.tr(), ), - ), backgroundColor: MyColors.backgroundColor, bottomSheet:footer(), body: Column( @@ -86,23 +76,23 @@ class _PesonalInfoState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Category".toText13(color: MyColors.lightGrayColor), + LocaleKeys.category.tr().toText13(color: MyColors.lightGrayColor), "${memberInformationList!.eMPLOYMENTCATEGORYMEANING}".toText16(isBold: true, color: MyColors.blackColor), SizedBox( height: 20,), - "Address".toText13(color: MyColors.lightGrayColor), + LocaleKeys.address.tr().toText13(color: MyColors.lightGrayColor), "${memberInformationList!.lOCATIONNAME}".toText16(isBold: true, color: MyColors.blackColor), SizedBox( height: 20,), - "Phone Number".toText13(color: MyColors.lightGrayColor), + LocaleKeys.phoneNumber.tr().toText13(color: MyColors.lightGrayColor), "${memberInformationList!.eMPLOYEEMOBILENUMBER}".toText16(isBold: true, color: MyColors.blackColor), SizedBox( height: 20,), - "Business Group".toText13(color: MyColors.lightGrayColor), + LocaleKeys.businessGroup.tr().toText13(color: MyColors.lightGrayColor), "${memberInformationList!.bUSINESSGROUPNAME}".toText16(isBold: true, color: MyColors.blackColor), SizedBox( height: 20,), - "Payroll".toText13(color: MyColors.lightGrayColor), + LocaleKeys.Payroll.tr().toText13(color: MyColors.lightGrayColor), "${memberInformationList!.pAYROLLNAME}".toText16(isBold: true, color: MyColors.blackColor), ] ), @@ -122,7 +112,7 @@ class _PesonalInfoState extends State { BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), ], ), - child: DefaultButton("Update", () async { + child: DefaultButton(LocaleKeys.update.tr(), () async { // context.setLocale(const Locale("en", "US")); // to change Loacle Profile(); }).insideContainer, diff --git a/lib/ui/screens/profile/widgets/profile_info.dart b/lib/ui/screens/profile/widgets/profile_info.dart index ecd5ef3..1141fcf 100644 --- a/lib/ui/screens/profile/widgets/profile_info.dart +++ b/lib/ui/screens/profile/widgets/profile_info.dart @@ -14,6 +14,7 @@ class ProfileInFo extends StatelessWidget { List menu = [ 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_contactDetails.tr(), icon: Icons.location_on, route: AppRoutes.contactDetails), ProfileMenu(name: LocaleKeys.profile_familyDetails.tr(), icon: Icons.reduce_capacity_sharp, route: AppRoutes.familyMembers), ]; @override From b5a5399b95ea486fa8085d7b8625840220c9a5f9 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 2 Jun 2022 11:54:02 +0300 Subject: [PATCH 15/19] profile --- assets/images/basic-details.svg | 9 ++ assets/images/contact-details.svg | 5 + assets/images/family-members.svg | 3 + assets/images/personal-info.svg | 14 +++ assets/langs/en-US.json | 7 +- lib/api/profile_api_client.dart | 21 +++-- lib/classes/consts.dart | 4 +- lib/models/profile_menu.model.dart | 4 +- lib/ui/profile/basic_details.dart | 78 ++++++++++++++- lib/ui/profile/personal_info.dart | 94 +++++++++---------- lib/ui/screens/profile/profile_screen.dart | 74 ++++++++++++--- .../screens/profile/widgets/profile_info.dart | 14 ++- lib/widgets/bottom_sheet.dart | 39 ++++++++ lib/widgets/radio/show_radio.dart | 5 +- pubspec.yaml | 2 +- 15 files changed, 280 insertions(+), 93 deletions(-) create mode 100644 assets/images/basic-details.svg create mode 100644 assets/images/contact-details.svg create mode 100644 assets/images/family-members.svg create mode 100644 assets/images/personal-info.svg diff --git a/assets/images/basic-details.svg b/assets/images/basic-details.svg new file mode 100644 index 0000000..215f00b --- /dev/null +++ b/assets/images/basic-details.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/contact-details.svg b/assets/images/contact-details.svg new file mode 100644 index 0000000..c9ac5a5 --- /dev/null +++ b/assets/images/contact-details.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/family-members.svg b/assets/images/family-members.svg new file mode 100644 index 0000000..eca7dd5 --- /dev/null +++ b/assets/images/family-members.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/personal-info.svg b/assets/images/personal-info.svg new file mode 100644 index 0000000..9daf5ad --- /dev/null +++ b/assets/images/personal-info.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index dd2d2a4..9097f9e 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -236,16 +236,15 @@ "month": "Month", "day": "Day", "completingYear": "We appreciate you for completing the service of", - "address" : "Address", + "address": "Address", "phoneNumber": "Phone Number", "businessGroup": "Business", "Payroll": "Payroll", "civilIdentityNumber": "Civil Identity Number", - "dateOfBirth" : "Date of Birth", + "dateOfBirth": "Date of Birth", "maritalStatus ": "Marital Status ", "fullName": "Full Name", - "remove": "remove", - "update": "update", + "remove": "Remove", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/api/profile_api_client.dart b/lib/api/profile_api_client.dart index 9d9056e..bb6a900 100644 --- a/lib/api/profile_api_client.dart +++ b/lib/api/profile_api_client.dart @@ -1,5 +1,3 @@ - - import 'dart:async'; import 'package:mohem_flutter_app/app_state/app_state.dart'; @@ -18,12 +16,11 @@ class ProfileApiClient { factory ProfileApiClient() => _instance; - Future> getEmployeeContacts() async { String url = "${ApiConsts.erpRest}GET_EMPLOYEE_CONTACTS"; Map postParams = { - "P_MENU_TYPE": "E", - "P_SELECTED_RESP_ID": -999, + "P_MENU_TYPE": "E", + "P_SELECTED_RESP_ID": -999, }; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { @@ -32,7 +29,7 @@ class ProfileApiClient { }, url, postParams); } - Future> getEmployeeBasicDetails() async { + Future> getEmployeeBasicDetails() async { String url = "${ApiConsts.erpRest}GET_EMPLOYEE_BASIC_DETAILS"; Map postParams = { "P_MENU_TYPE": "E", @@ -70,4 +67,14 @@ class ProfileApiClient { return responseData.getEmployeeAddressList ?? []; }, url, postParams); } -} \ No newline at end of file + + Future updateEmpImage(img) async { + String url = "${ApiConsts.erpRest}UPDATE_EMPLOYEE_IMAGE"; + Map postParams = {"P_MENU_TYPE": "E", "P_SELECTED_RESP_ID": -999, "P_IMAGE": img}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + // GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return json['UpdateEmployeeImageList']; + }, url, postParams); + } +} diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index ca8e2f0..e9e3c86 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -1,7 +1,7 @@ class ApiConsts { //static String baseUrl = "http://10.200.204.20:2801/"; // Local server - // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server - static String baseUrl = "https://hmgwebservices.com"; // Live server + static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server + //static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrlServices = baseUrl + "/Services/"; // server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; diff --git a/lib/models/profile_menu.model.dart b/lib/models/profile_menu.model.dart index 4593f9c..c26ee7f 100644 --- a/lib/models/profile_menu.model.dart +++ b/lib/models/profile_menu.model.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; class ProfileMenu { final String name; - final IconData icon; + final String icon; final String route; - ProfileMenu({this.name = '', this.icon = Icons.home, this.route = ''}); + ProfileMenu({this.name = '', this.icon = '', this.route = ''}); } diff --git a/lib/ui/profile/basic_details.dart b/lib/ui/profile/basic_details.dart index e229918..5110fae 100644 --- a/lib/ui/profile/basic_details.dart +++ b/lib/ui/profile/basic_details.dart @@ -11,6 +11,7 @@ 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/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/radio/show_radio.dart'; class BasicDetails extends StatefulWidget { const BasicDetails({Key? key}) : super(key: key); @@ -150,9 +151,82 @@ class _BasicDetailsState extends State { ], ), child: DefaultButton(LocaleKeys.update.tr(), () async { - // context.setLocale(const Locale("en", "US")); // to change Loacle - Profile(); + showAlertDialog(context); }).insideContainer, ); } + + showAlertDialog(BuildContext context) { + dynamic changeOrNew = 1; + Widget cancelButton = TextButton( + child: Text("Cancel"), + onPressed: () { + Navigator.pop(context); + }, + ); + Widget continueButton = TextButton( + child: Text("Next"), + onPressed: () {}, + ); + StatefulBuilder alert = StatefulBuilder(builder: (context, setState) { + return AlertDialog( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(10.0))), + title: Text("Confirm"), + content: Builder(builder: (context) { + // Get available height and width of the build area of this widget. Make a choice depending on the size. + var height = MediaQuery.of(context).size.height * .5; + return Container( + height: height, + child: Column(children: [ + Text( + "Select the type of change you want to make.", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + ), + Divider(), + Column( + children: [ + ListTile( + title: Text("correct or complete the current details"), + leading: Radio( + value: 1, + groupValue: changeOrNew, + onChanged: (value) { + setState(() { + changeOrNew = int.parse(value.toString()); + }); + }, + activeColor: Colors.green, + ), + ), + ListTile( + title: Text("Enter new Information because of a real change to the current details (e.g because of a change in marital status)"), + leading: Radio( + value: 2, + groupValue: changeOrNew, + onChanged: (value) { + setState(() { + changeOrNew = int.parse(value.toString()); + }); + }, + activeColor: Colors.green, + ), + ), + ], + ) + ])); + }), + 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 index b136141..0ad9e2f 100644 --- a/lib/ui/profile/personal_info.dart +++ b/lib/ui/profile/personal_info.dart @@ -1,17 +1,12 @@ - -import 'package:easy_localization/src/public_ext.dart'; +import 'package:easy_localization/easy_localization.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/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/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/ui/profile/profile.dart'; + import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; @@ -37,29 +32,30 @@ class _PesonalInfoState extends State { List getEmployeeBasicDetailsList = []; - @override void initState() { super.initState(); memberInformationList = AppState().memberInformationList!; - } - Widget build(BuildContext context) { return Scaffold( appBar: AppBarWidget( context, title: LocaleKeys.profile_personalInformation.tr(), ), - backgroundColor: MyColors.backgroundColor, - bottomSheet:footer(), - body: Column( - children: [ - Container( + 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), + 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: [ @@ -70,40 +66,39 @@ class _PesonalInfoState extends State { offset: Offset(0, 3), ), ], - color: Colors.white, - borderRadius: BorderRadius.circular(10.0), + color: Colors.white, + borderRadius: BorderRadius.circular(10.0), ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.category.tr().toText13(color: MyColors.lightGrayColor), - "${memberInformationList!.eMPLOYMENTCATEGORYMEANING}".toText16(isBold: true, color: MyColors.blackColor), - SizedBox( - height: 20,), - LocaleKeys.address.tr().toText13(color: MyColors.lightGrayColor), - "${memberInformationList!.lOCATIONNAME}".toText16(isBold: true, color: MyColors.blackColor), - SizedBox( - height: 20,), - LocaleKeys.phoneNumber.tr().toText13(color: MyColors.lightGrayColor), - "${memberInformationList!.eMPLOYEEMOBILENUMBER}".toText16(isBold: true, color: MyColors.blackColor), - SizedBox( - height: 20,), - LocaleKeys.businessGroup.tr().toText13(color: MyColors.lightGrayColor), - "${memberInformationList!.bUSINESSGROUPNAME}".toText16(isBold: true, color: MyColors.blackColor), - SizedBox( - height: 20,), - LocaleKeys.Payroll.tr().toText13(color: MyColors.lightGrayColor), - "${memberInformationList!.pAYROLLNAME}".toText16(isBold: true, color: MyColors.blackColor), - ] - ), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + LocaleKeys.category.tr().toText13(color: MyColors.lightGrayColor), + "${memberInformationList!.eMPLOYMENTCATEGORYMEANING}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20, ), - ], - ) - - ); + LocaleKeys.address.tr().toText13(color: MyColors.lightGrayColor), + "${memberInformationList!.lOCATIONNAME}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20, + ), + LocaleKeys.phoneNumber.tr().toText13(color: MyColors.lightGrayColor), + "${memberInformationList!.eMPLOYEEMOBILENUMBER}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20, + ), + LocaleKeys.businessGroup.tr().toText13(color: MyColors.lightGrayColor), + "${memberInformationList!.bUSINESSGROUPNAME}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20, + ), + LocaleKeys.Payroll.tr().toText13(color: MyColors.lightGrayColor), + "${memberInformationList!.pAYROLLNAME}".toText16(isBold: true, color: MyColors.blackColor), + ]), + ), + ], + )); } - footer(){ + footer() { return Container( decoration: BoxDecoration( // borderRadius: BorderRadius.circular(10), @@ -112,10 +107,7 @@ class _PesonalInfoState extends State { BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), ], ), - child: DefaultButton(LocaleKeys.update.tr(), () async { - // context.setLocale(const Locale("en", "US")); // to change Loacle - Profile(); - }).insideContainer, + child: DefaultButton(LocaleKeys.update.tr(), () async {}).insideContainer, ); } } diff --git a/lib/ui/screens/profile/profile_screen.dart b/lib/ui/screens/profile/profile_screen.dart index f1c0f8f..c1be51e 100644 --- a/lib/ui/screens/profile/profile_screen.dart +++ b/lib/ui/screens/profile/profile_screen.dart @@ -1,7 +1,8 @@ import 'dart:ui'; - +import 'dart:convert'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:image_picker/image_picker.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'; @@ -9,6 +10,7 @@ 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'; +import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; class ProfileScreen extends StatefulWidget { const ProfileScreen({Key? key}) : super(key: key); @@ -19,8 +21,8 @@ class ProfileScreen extends StatefulWidget { class _ProfileScreenState extends State { late MemberInformationListModel memberInformationList; - - List getEmployeeBasicDetailsList = []; + final ImagePicker _picker = ImagePicker(); + //List getEmployeeBasicDetailsList = []; @override void initState() { @@ -65,6 +67,9 @@ class _ProfileScreenState extends State { color: Colors.white, )), InkWell( + onTap: () { + startImageSheet(); + }, child: Container( padding: EdgeInsets.only(left: 10, right: 10, top: 5, bottom: 5), decoration: BoxDecoration(borderRadius: BorderRadius.circular(15), color: Colors.black.withOpacity(.3)), @@ -84,18 +89,61 @@ class _ProfileScreenState extends State { ])); } - void getEmployeeBasicDetails() async { - try { + startImageSheet() { + showMyBottomSheet(context, + child: Column( + children: [ + Container( + padding: EdgeInsets.only(left: 20, right: 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [Text('OK'), Text('CANCEL')], + )), + BottomSheetItem( + onTap: () { + openGallery(false); + }, + title: 'Open Gallery', + icon: Icons.browse_gallery_outlined, + ), + BottomSheetItem( + onTap: () { + openGallery(true); + }, + title: 'Open Camera', + icon: Icons.camera, + ) + ], + )); + } + + void openGallery(bool isCamera) async { + final XFile? image = await _picker.pickImage(source: isCamera ? ImageSource.camera : ImageSource.gallery); + + if (image != null) { + String img = base64.encode(await image!.readAsBytes()); Utils.showLoading(context); - getEmployeeBasicDetailsList = await ProfileApiClient().getEmployeeBasicDetails(); - Utils.hideLoading(context); - //basicDetails(); - print("getEmployeeBasicDetailsList.length"); - print(getEmployeeBasicDetailsList.length); - setState(() {}); - } catch (ex) { + dynamic empImageUpdteResp = await ProfileApiClient().updateEmpImage(img); Utils.hideLoading(context); - Utils.handleException(ex, context, null); + if (empImageUpdteResp['P_RETURN_STATUS'] == 'S') { + setState(() { + memberInformationList.eMPLOYEEIMAGE = img; + }); + } } } + // 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/profile_info.dart b/lib/ui/screens/profile/widgets/profile_info.dart index 1141fcf..8919924 100644 --- a/lib/ui/screens/profile/widgets/profile_info.dart +++ b/lib/ui/screens/profile/widgets/profile_info.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.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'; @@ -12,10 +13,10 @@ class ProfileInFo extends StatelessWidget { String data = '.'; double sliderValue = 75; List menu = [ - 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_contactDetails.tr(), icon: Icons.location_on, route: AppRoutes.contactDetails), - ProfileMenu(name: LocaleKeys.profile_familyDetails.tr(), icon: Icons.reduce_capacity_sharp, route: AppRoutes.familyMembers), + ProfileMenu(name: LocaleKeys.profile_personalInformation.tr(), icon: 'personal-info.svg', route: AppRoutes.personalInfo), + ProfileMenu(name: LocaleKeys.profile_basicDetails.tr(), icon: 'basic-details.svg', route: AppRoutes.basicDetails), + ProfileMenu(name: LocaleKeys.profile_contactDetails.tr(), icon: 'contact-details.svg', route: AppRoutes.contactDetails), + ProfileMenu(name: LocaleKeys.profile_familyDetails.tr(), icon: 'family-members.svg', route: AppRoutes.familyMembers), ]; @override Widget build(BuildContext context) { @@ -103,10 +104,7 @@ class ProfileInFo extends StatelessWidget { Navigator.pushNamed(context, obj.route); }, child: ListTile( - leading: Icon( - obj.icon, - color: Color(0xff2BB8A6), - ), + leading: SvgPicture.asset('assets/images/' + obj.icon), title: Text(obj.name), trailing: Icon(Icons.arrow_forward), ), diff --git a/lib/widgets/bottom_sheet.dart b/lib/widgets/bottom_sheet.dart index a44fd7b..f0bf3f8 100644 --- a/lib/widgets/bottom_sheet.dart +++ b/lib/widgets/bottom_sheet.dart @@ -39,3 +39,42 @@ showMyBottomSheet(BuildContext context, {required Widget child}) { }, ); } + +class BottomSheetItem extends StatelessWidget { + final Function onTap; + final IconData icon; + final String title; + final Color color; + + const BottomSheetItem({Key? key, required this.onTap, required this.title, required this.icon, this.color = Colors.black}) : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: () { + if (onTap != null) { + Navigator.pop(context); + onTap(); + } + }, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 18.0, vertical: 18.0), + child: Row( + children: [ + if (icon != null) + Icon( + icon, + color: color, + size: 18.0, + ), + if (icon != null) SizedBox(width: 24.0), + Text( + title ?? "", + style: TextStyle(color: color), + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/radio/show_radio.dart b/lib/widgets/radio/show_radio.dart index fda5bf9..65e0e36 100644 --- a/lib/widgets/radio/show_radio.dart +++ b/lib/widgets/radio/show_radio.dart @@ -7,8 +7,7 @@ import 'package:mohem_flutter_app/extensions/int_extensions.dart'; class ShowRadio extends StatelessWidget { String title, value, groupValue; - ShowRadio( - {required this.title, required this.value, required this.groupValue}); + ShowRadio({required this.title, required this.value, required this.groupValue}); @override Widget build(BuildContext context) { @@ -34,7 +33,7 @@ class ShowRadio extends StatelessWidget { ), ), 12.width, - title.toText12(isBold: true) + title.toText12(isBold: true, maxLine: 2) ], ); } diff --git a/pubspec.yaml b/pubspec.yaml index 8afdae3..b613514 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -54,7 +54,7 @@ dependencies: flutter_countdown_timer: ^4.1.0 nfc_manager: ^3.1.1 uuid: ^3.0.6 - + image_picker: ^0.8.5+3 # maps google_maps_flutter: ^2.0.2 google_maps_utils: ^1.4.0+1 From 8f80bbb9dbb2094efbc5c3fcffba8fcfc72fc7ee Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 8 Jun 2022 10:27:35 +0300 Subject: [PATCH 16/19] profile dynamic forms --- lib/api/profile_api_client.dart | 41 +++ lib/config/routes.dart | 4 + lib/models/generic_response_model.dart | 22 +- .../basic_details_cols_structions.dart | 83 +++++ .../profile/basic_details_dff_structure.dart | 187 +++++++++++ lib/models/profile_menu.model.dart | 5 +- lib/ui/attendance/monthly_attendance.dart | 1 - .../dynamic_screens/dynamic_input_screen.dart | 1 - .../dynamic_listview_screen.dart | 7 +- lib/ui/profile/basic_details.dart | 13 +- .../dynamic_screens/dynamic_input_screen.dart | 299 ++++++++++++++++++ .../dynamic_listview_screen.dart | 105 ++++++ lib/ui/screens/profile/profile_screen.dart | 16 +- .../screens/profile/widgets/profile_info.dart | 18 +- 14 files changed, 771 insertions(+), 31 deletions(-) create mode 100644 lib/models/profile/basic_details_cols_structions.dart create mode 100644 lib/models/profile/basic_details_dff_structure.dart create mode 100644 lib/ui/profile/dynamic_screens/dynamic_input_screen.dart create mode 100644 lib/ui/profile/dynamic_screens/dynamic_listview_screen.dart diff --git a/lib/api/profile_api_client.dart b/lib/api/profile_api_client.dart index bb6a900..7f783f2 100644 --- a/lib/api/profile_api_client.dart +++ b/lib/api/profile_api_client.dart @@ -3,6 +3,7 @@ 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_eit_dff_structure_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'; @@ -77,4 +78,44 @@ class ProfileApiClient { return json['UpdateEmployeeImageList']; }, url, postParams); } + + Future getDffStructure(String pFunctionName, String uRL, String requestType) async { + String url = ApiConsts.erpRest + uRL; + Map postParams = {"P_SELECTED_RESP_ID": -999, "P_MENU_TYPE": "E", "P_FUNCTION_NAME": pFunctionName, "P_REQUEST_TYPE": requestType}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } + + Future getColStructure(String pFunctionName, String uRL, String requestType) async { + String url = ApiConsts.erpRest + uRL; + Map postParams = {"P_SELECTED_RESP_ID": -999, "P_MENU_TYPE": "E", "P_FUNCTION_NAME": pFunctionName, "P_REQUEST_TYPE": requestType}; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData; + }, url, postParams); + } + + Future getValueSetValues(String pSegmentName, String pDescFlexContextCode, String pDescFlexName, List> list) async { + String url = "${ApiConsts.erpRest}GET_VALUE_SET_VALUES"; + Map postParams = { + "P_SELECTED_RESP_ID": -999, + "P_MENU_TYPE": "E", + "P_PAGE_LIMIT": 1000, + "P_PAGE_NUM": 1, + "P_PARENT_VALUE": null, + "P_SEGMENT_NAME": pSegmentName, + "P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode, + "P_DESC_FLEX_NAME": pDescFlexName, + "GetValueSetValuesTBL": list, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getValueSetValuesList!.first; + }, url, postParams); + } } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 20acd28..a9007cb 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -8,6 +8,7 @@ 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/my_attendance/dynamic_screens/dynamic_input_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/my_attendance_screen.dart'; +import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_screen.dart'; // import 'package:mohem_flutter_app/ui/my_attendance/work_from_home_screen.dart'; import 'package:mohem_flutter_app/ui/screens/eit/add_eit.dart'; import 'package:mohem_flutter_app/ui/screens/profile/profile_screen.dart'; @@ -53,6 +54,8 @@ class AppRoutes { static const String addDynamicInput = "/addDynamicInput"; //profile + + static const String addDynamicInputProfile = 'addDynamicInputProfile'; //Attendance static const String attendance = "/attendance"; static const String monthlyAttendance = "/monthlyAttendance"; @@ -106,5 +109,6 @@ class AppRoutes { familyMembers: (context) => FamilyMembers(), dynamicScreen: (context) => DynamicListViewScreen(), addDynamicInput: (context) => DynamicInputScreen(), + addDynamicInputProfile: (context) => DynamicInputScreenProfile(), }; } diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 366489c..92eb6db 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -23,6 +23,8 @@ import 'package:mohem_flutter_app/models/get_time_card_summary_list_model.dart'; import 'package:mohem_flutter_app/models/member_login_list_model.dart'; import 'package:mohem_flutter_app/models/notification_action_model.dart'; import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; +import 'package:mohem_flutter_app/models/profile/basic_details_cols_structions.dart'; +import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; import 'package:mohem_flutter_app/models/subordinates_on_leaves_model.dart'; import 'package:mohem_flutter_app/models/worklist_response_model.dart'; @@ -97,8 +99,8 @@ class GenericResponseModel { List? getApprovesList; List? getAttachementList; GetAttendanceTracking? getAttendanceTrackingList; - List? getBasicDetColsStructureList; - List? getBasicDetDffStructureList; + List? getBasicDetColsStructureList; + List? getBasicDetDffStructureList; List? getBasicDetNtfBodyList; List? getCEICollectionNotificationBodyList; List? getCEIDFFStructureList; @@ -623,9 +625,19 @@ class GenericResponseModel { }); } getAttendanceTrackingList = json["GetAttendanceTrackingList"] == null ? null : GetAttendanceTracking.fromMap(json["GetAttendanceTrackingList"]); - getBasicDetColsStructureList = json['GetBasicDetColsStructureList']; - getBasicDetDffStructureList = json['GetBasicDetDffStructureList']; - + if (json['GetBasicDetColsStructureList'] != null) { + getBasicDetColsStructureList = []; + json['GetBasicDetColsStructureList'].forEach((v) { + getBasicDetColsStructureList!.add(new GetBasicDetColsStructureList.fromJson(v)); + }); + } + // getBasicDetDffStructureList = json['GetBasicDetDffStructureList']; + if (json['GetBasicDetDffStructureList'] != null) { + getBasicDetDffStructureList = []; + json['GetBasicDetDffStructureList'].forEach((v) { + getBasicDetDffStructureList!.add(new GetBasicDetDffStructureList.fromJson(v)); + }); + } if (json['GetBasicDetNtfBodyList'] != null) { getBasicDetNtfBodyList = []; json['GetBasicDetNtfBodyList'].forEach((v) { diff --git a/lib/models/profile/basic_details_cols_structions.dart b/lib/models/profile/basic_details_cols_structions.dart new file mode 100644 index 0000000..2094a3c --- /dev/null +++ b/lib/models/profile/basic_details_cols_structions.dart @@ -0,0 +1,83 @@ +class GetBasicDetColsStructureList { + String? aPPLICATIONCOLUMNNAME; + String? dATATYPE; + String? dISPLAYFLAG; + int? mAXIMUMSIZE; + String? oBJECTNAME; + String? oBJECTTYPE; + List? objectValuesList; + String? rEQUIREDFLAG; + String? sEGMENTPROMPT; + int? sEGMENTSEQNUM; + String? fieldAnswer; + GetBasicDetColsStructureList({ + this.aPPLICATIONCOLUMNNAME, + this.dATATYPE, + this.dISPLAYFLAG, + this.mAXIMUMSIZE, + this.oBJECTNAME, + this.oBJECTTYPE, + this.objectValuesList, + this.rEQUIREDFLAG, + this.sEGMENTPROMPT, + this.sEGMENTSEQNUM, + this.fieldAnswer, + }); + + GetBasicDetColsStructureList.fromJson(Map json) { + aPPLICATIONCOLUMNNAME = json['APPLICATION_COLUMN_NAME']; + dATATYPE = json['DATATYPE']; + dISPLAYFLAG = json['DISPLAY_FLAG']; + mAXIMUMSIZE = json['MAXIMUM_SIZE']; + oBJECTNAME = json['OBJECT_NAME']; + oBJECTTYPE = json['OBJECT_TYPE']; + if (json['ObjectValuesList'] != null) { + objectValuesList = []; + json['ObjectValuesList'].forEach((v) { + objectValuesList!.add(new ObjectValuesList.fromJson(v)); + }); + } + rEQUIREDFLAG = json['REQUIRED_FLAG']; + sEGMENTPROMPT = json['SEGMENT_PROMPT']; + sEGMENTSEQNUM = json['SEGMENT_SEQ_NUM']; + } + + Map toJson() { + final Map data = new Map(); + data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; + data['DATATYPE'] = this.dATATYPE; + data['DISPLAY_FLAG'] = this.dISPLAYFLAG; + data['MAXIMUM_SIZE'] = this.mAXIMUMSIZE; + data['OBJECT_NAME'] = this.oBJECTNAME; + data['OBJECT_TYPE'] = this.oBJECTTYPE; + if (this.objectValuesList != null) { + data['ObjectValuesList'] = this.objectValuesList!.map((v) => v.toJson()).toList(); + } + data['REQUIRED_FLAG'] = this.rEQUIREDFLAG; + data['SEGMENT_PROMPT'] = this.sEGMENTPROMPT; + data['SEGMENT_SEQ_NUM'] = this.sEGMENTSEQNUM; + return data; + } +} + +class ObjectValuesList { + String? cODE; + String? dESCRIPTION; + String? mEANING; + + ObjectValuesList({this.cODE, this.dESCRIPTION, this.mEANING}); + + ObjectValuesList.fromJson(Map json) { + cODE = json['CODE']; + dESCRIPTION = json['DESCRIPTION']; + mEANING = json['MEANING']; + } + + Map toJson() { + final Map data = new Map(); + data['CODE'] = this.cODE; + data['DESCRIPTION'] = this.dESCRIPTION; + data['MEANING'] = this.mEANING; + return data; + } +} diff --git a/lib/models/profile/basic_details_dff_structure.dart b/lib/models/profile/basic_details_dff_structure.dart new file mode 100644 index 0000000..45bf406 --- /dev/null +++ b/lib/models/profile/basic_details_dff_structure.dart @@ -0,0 +1,187 @@ +import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; + +class GetBasicDetDffStructureList { + String? aLPHANUMERICALLOWEDFLAG; + String? aPPLICATIONCOLUMNNAME; + String? cHILDSEGMENTSVS; + Null? cHILDSEGMENTSVSSplited; + String? dEFAULTTYPE; + String? dEFAULTVALUE; + String? dESCFLEXCONTEXTCODE; + String? dESCFLEXCONTEXTNAME; + String? dESCFLEXNAME; + String? dISPLAYFLAG; + String? eNABLEDFLAG; + ESERVICESDV? eSERVICESDV; + List? eSERVICESVS; + String? fLEXVALUESETNAME; + String? fORMATTYPE; + String? fORMATTYPEDSP; + bool? isEmptyOption; + String? lONGLISTFLAG; + int? mAXIMUMSIZE; + String? mAXIMUMVALUE; + String? mINIMUMVALUE; + String? mOBILEENABLED; + String? nUMBERPRECISION; + String? nUMERICMODEENABLEDFLAG; + String? pARENTSEGMENTSDV; + List? pARENTSEGMENTSDVSplited; + String? pARENTSEGMENTSVS; + List? pARENTSEGMENTSVSSplitedVS; + String? rEADONLY; + String? rEQUIREDFLAG; + String? sEGMENTNAME; + String? sEGMENTPROMPT; + int? sEGMENTSEQNUM; + String? uPPERCASEONLYFLAG; + String? uSEDFLAG; + String? vALIDATIONTYPE; + String? vALIDATIONTYPEDSP; + String? fieldAnswer; + + GetBasicDetDffStructureList( + {this.aLPHANUMERICALLOWEDFLAG, + this.aPPLICATIONCOLUMNNAME, + this.cHILDSEGMENTSVS, + this.cHILDSEGMENTSVSSplited, + this.dEFAULTTYPE, + this.dEFAULTVALUE, + this.dESCFLEXCONTEXTCODE, + this.dESCFLEXCONTEXTNAME, + this.dESCFLEXNAME, + this.dISPLAYFLAG, + this.eNABLEDFLAG, + this.eSERVICESDV, + this.eSERVICESVS, + this.fLEXVALUESETNAME, + this.fORMATTYPE, + this.fORMATTYPEDSP, + this.isEmptyOption, + this.lONGLISTFLAG, + this.mAXIMUMSIZE, + this.mAXIMUMVALUE, + this.mINIMUMVALUE, + this.mOBILEENABLED, + this.nUMBERPRECISION, + this.nUMERICMODEENABLEDFLAG, + this.pARENTSEGMENTSDV, + this.pARENTSEGMENTSDVSplited, + this.pARENTSEGMENTSVS, + this.pARENTSEGMENTSVSSplitedVS, + this.rEADONLY, + this.rEQUIREDFLAG, + this.sEGMENTNAME, + this.sEGMENTPROMPT, + this.sEGMENTSEQNUM, + this.uPPERCASEONLYFLAG, + this.uSEDFLAG, + this.vALIDATIONTYPE, + this.vALIDATIONTYPEDSP, + this.fieldAnswer}); + + GetBasicDetDffStructureList.fromJson(Map json) { + aLPHANUMERICALLOWEDFLAG = json['ALPHANUMERIC_ALLOWED_FLAG']; + aPPLICATIONCOLUMNNAME = json['APPLICATION_COLUMN_NAME']; + cHILDSEGMENTSVS = json['CHILD_SEGMENTS_VS']; + cHILDSEGMENTSVSSplited = json['CHILD_SEGMENTS_VS_Splited']; + dEFAULTTYPE = json['DEFAULT_TYPE']; + dEFAULTVALUE = json['DEFAULT_VALUE']; + dESCFLEXCONTEXTCODE = json['DESC_FLEX_CONTEXT_CODE']; + dESCFLEXCONTEXTNAME = json['DESC_FLEX_CONTEXT_NAME']; + dESCFLEXNAME = json['DESC_FLEX_NAME']; + dISPLAYFLAG = json['DISPLAY_FLAG']; + eNABLEDFLAG = json['ENABLED_FLAG']; + eSERVICESDV = json['E_SERVICES_DV'] != null ? ESERVICESDV.fromJson(json['E_SERVICES_DV']) : null; + if (json['E_SERVICES_VS'] != null) { + eSERVICESVS = []; + json['E_SERVICES_VS'].forEach((v) { + eSERVICESVS!.add(ESERVICESVS.fromJson(v)); + }); + } + fLEXVALUESETNAME = json['FLEX_VALUE_SET_NAME']; + fORMATTYPE = json['FORMAT_TYPE']; + fORMATTYPEDSP = json['FORMAT_TYPE_DSP']; + isEmptyOption = json['IsEmptyOption']; + lONGLISTFLAG = json['LONGLIST_FLAG']; + mAXIMUMSIZE = json['MAXIMUM_SIZE']; + mAXIMUMVALUE = json['MAXIMUM_VALUE']; + mINIMUMVALUE = json['MINIMUM_VALUE']; + mOBILEENABLED = json['MOBILE_ENABLED']; + nUMBERPRECISION = json['NUMBER_PRECISION']; + nUMERICMODEENABLEDFLAG = json['NUMERIC_MODE_ENABLED_FLAG']; + pARENTSEGMENTSDV = json['PARENT_SEGMENTS_DV']; + if (json['PARENT_SEGMENTS_DV_Splited'] != null) { + pARENTSEGMENTSDVSplited = []; + json['PARENT_SEGMENTS_DV_Splited'].forEach((v) { + pARENTSEGMENTSDVSplited!.add((v)); + }); + } + pARENTSEGMENTSVS = json['PARENT_SEGMENTS_VS']; + if (json['PARENT_SEGMENTS_VS_SplitedVS'] != null) { + pARENTSEGMENTSVSSplitedVS = []; + json['PARENT_SEGMENTS_VS_SplitedVS'].forEach((v) { + pARENTSEGMENTSVSSplitedVS!.add(v); + }); + } + rEADONLY = json['READ_ONLY']; + rEQUIREDFLAG = json['REQUIRED_FLAG']; + sEGMENTNAME = json['SEGMENT_NAME']; + sEGMENTPROMPT = json['SEGMENT_PROMPT']; + sEGMENTSEQNUM = json['SEGMENT_SEQ_NUM']; + uPPERCASEONLYFLAG = json['UPPERCASE_ONLY_FLAG']; + uSEDFLAG = json['USED_FLAG']; + vALIDATIONTYPE = json['VALIDATION_TYPE']; + vALIDATIONTYPEDSP = json['VALIDATION_TYPE_DSP']; + } + + Map toJson() { + final Map data = Map(); + data['ALPHANUMERIC_ALLOWED_FLAG'] = this.aLPHANUMERICALLOWEDFLAG; + data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; + data['CHILD_SEGMENTS_VS'] = this.cHILDSEGMENTSVS; + data['CHILD_SEGMENTS_VS_Splited'] = this.cHILDSEGMENTSVSSplited; + data['DEFAULT_TYPE'] = this.dEFAULTTYPE; + data['DEFAULT_VALUE'] = this.dEFAULTVALUE; + data['DESC_FLEX_CONTEXT_CODE'] = this.dESCFLEXCONTEXTCODE; + data['DESC_FLEX_CONTEXT_NAME'] = this.dESCFLEXCONTEXTNAME; + data['DESC_FLEX_NAME'] = this.dESCFLEXNAME; + data['DISPLAY_FLAG'] = this.dISPLAYFLAG; + data['ENABLED_FLAG'] = this.eNABLEDFLAG; + if (this.eSERVICESDV != null) { + data['E_SERVICES_DV'] = this.eSERVICESDV!.toJson(); + } + if (this.eSERVICESVS != null) { + data['E_SERVICES_VS'] = this.eSERVICESVS!.map((v) => v.toJson()).toList(); + } + data['FLEX_VALUE_SET_NAME'] = this.fLEXVALUESETNAME; + data['FORMAT_TYPE'] = this.fORMATTYPE; + data['FORMAT_TYPE_DSP'] = this.fORMATTYPEDSP; + data['IsEmptyOption'] = this.isEmptyOption; + data['LONGLIST_FLAG'] = this.lONGLISTFLAG; + data['MAXIMUM_SIZE'] = this.mAXIMUMSIZE; + data['MAXIMUM_VALUE'] = this.mAXIMUMVALUE; + data['MINIMUM_VALUE'] = this.mINIMUMVALUE; + data['MOBILE_ENABLED'] = this.mOBILEENABLED; + data['NUMBER_PRECISION'] = this.nUMBERPRECISION; + data['NUMERIC_MODE_ENABLED_FLAG'] = this.nUMERICMODEENABLEDFLAG; + data['PARENT_SEGMENTS_DV'] = this.pARENTSEGMENTSDV; + if (this.pARENTSEGMENTSDVSplited != null) { + data['PARENT_SEGMENTS_DV_Splited'] = this.pARENTSEGMENTSDVSplited!.map((v) => v).toList(); + } + data['PARENT_SEGMENTS_VS'] = this.pARENTSEGMENTSVS; + if (this.pARENTSEGMENTSVSSplitedVS != null) { + data['PARENT_SEGMENTS_VS_SplitedVS'] = this.pARENTSEGMENTSVSSplitedVS!.map((v) => v).toList(); + } + data['READ_ONLY'] = this.rEADONLY; + data['REQUIRED_FLAG'] = this.rEQUIREDFLAG; + data['SEGMENT_NAME'] = this.sEGMENTNAME; + data['SEGMENT_PROMPT'] = this.sEGMENTPROMPT; + data['SEGMENT_SEQ_NUM'] = this.sEGMENTSEQNUM; + data['UPPERCASE_ONLY_FLAG'] = this.uPPERCASEONLYFLAG; + data['USED_FLAG'] = this.uSEDFLAG; + data['VALIDATION_TYPE'] = this.vALIDATIONTYPE; + data['VALIDATION_TYPE_DSP'] = this.vALIDATIONTYPEDSP; + return data; + } +} diff --git a/lib/models/profile_menu.model.dart b/lib/models/profile_menu.model.dart index c26ee7f..c1b77b7 100644 --- a/lib/models/profile_menu.model.dart +++ b/lib/models/profile_menu.model.dart @@ -5,5 +5,8 @@ class ProfileMenu { final String name; final String icon; final String route; - ProfileMenu({this.name = '', this.icon = '', this.route = ''}); + final String dynamicUrl; + final String functionName; + final String requestID; + ProfileMenu({this.name = '', this.icon = '', this.route = '', this.dynamicUrl = '', this.functionName = '', this.requestID = ''}); } diff --git a/lib/ui/attendance/monthly_attendance.dart b/lib/ui/attendance/monthly_attendance.dart index 7391211..fa531a3 100644 --- a/lib/ui/attendance/monthly_attendance.dart +++ b/lib/ui/attendance/monthly_attendance.dart @@ -718,7 +718,6 @@ class _MonthlyAttendanceState extends State { ); } - List _getDataSource() { final List meetings = []; return meetings; diff --git a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart index 6fe23ae..114c53c 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -137,7 +137,6 @@ class _DynamicInputScreenState extends State { for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem(child: Text(model.eSERVICESVS![i].vALUECOLUMNNAME!), value: i), ], onSelected: (int index) { - ESERVICESDV eservicesdv = ESERVICESDV( pIDCOLUMNNAME: model.eSERVICESVS![index].vALUECOLUMNNAME, pRETURNMSG: "null", diff --git a/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart index ccf4222..37ba465 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart @@ -15,7 +15,10 @@ import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; class DynamicListViewParams { String title; String dynamicId; - DynamicListViewParams(this.title, this.dynamicId); + String uRL; + String requestID; + String colsURL; + DynamicListViewParams(this.title, this.dynamicId, {this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = '', this.colsURL = ''}); } class DynamicListViewScreen extends StatefulWidget { @@ -96,7 +99,7 @@ class _DynamicListViewScreenState extends State { ), child: const Icon(Icons.add, color: Colors.white, size: 30), ).onPress(() { - Navigator.pushNamed(context, AppRoutes.addDynamicInput,arguments: dynamicParams); + Navigator.pushNamed(context, AppRoutes.addDynamicInput, arguments: dynamicParams); }), ); } diff --git a/lib/ui/profile/basic_details.dart b/lib/ui/profile/basic_details.dart index 5110fae..0faa885 100644 --- a/lib/ui/profile/basic_details.dart +++ b/lib/ui/profile/basic_details.dart @@ -3,11 +3,13 @@ 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/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/get_employee_basic_details.model.dart'; +import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; import 'package:mohem_flutter_app/ui/profile/profile.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; @@ -45,7 +47,7 @@ class _BasicDetailsState extends State { basicDetails(); print("getEmployeeBasicDetailsList.length"); print(getEmployeeBasicDetailsList.length); - setState(() {}); + // setState(() {}); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); @@ -166,7 +168,9 @@ class _BasicDetailsState extends State { ); Widget continueButton = TextButton( child: Text("Next"), - onPressed: () {}, + onPressed: () { + continueDynamicForms(); + }, ); StatefulBuilder alert = StatefulBuilder(builder: (context, setState) { return AlertDialog( @@ -229,4 +233,9 @@ class _BasicDetailsState extends State { }, ); } + + void continueDynamicForms() { + Navigator.pushNamed(context, AppRoutes.addDynamicInputProfile, + arguments: DynamicListViewParams(LocaleKeys.profile_basicDetails.tr(), 'HR_PERINFO_SS', uRL: 'GET_BASIC_DET_DFF_STRUCTURE', requestID: 'BASIC_DETAILS')); + } } diff --git a/lib/ui/profile/dynamic_screens/dynamic_input_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_input_screen.dart new file mode 100644 index 0000000..0ee9fb5 --- /dev/null +++ b/lib/ui/profile/dynamic_screens/dynamic_input_screen.dart @@ -0,0 +1,299 @@ +import 'dart:io'; + +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/my_attendance_api_client.dart'; +import 'package:mohem_flutter_app/api/profile_api_client.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/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/dyanmic_forms/get_set_values_request_model.dart'; +import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; +import 'package:mohem_flutter_app/models/profile/basic_details_cols_structions.dart'; +import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.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'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; + +class DynamicInputScreenProfile extends StatefulWidget { + DynamicInputScreenProfile({Key? key}) : super(key: key); + + @override + _DynamicInputScreenState createState() { + return _DynamicInputScreenState(); + } +} + +class _DynamicInputScreenState extends State { + GenericResponseModel? genericResponseModel; + List? getBasicDetDffStructureList; + List? getBasicDetColsStructureList; + DynamicListViewParams? dynamicParams; + + @override + void initState() { + super.initState(); + } + + void getTransactionsStructure() async { + try { + Utils.showLoading(context); + genericResponseModel = await ProfileApiClient().getDffStructure(dynamicParams!.dynamicId, dynamicParams!.uRL, dynamicParams!.requestID); + getBasicDetDffStructureList = genericResponseModel?.getBasicDetDffStructureList ?? []; + //getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList(); + + genericResponseModel = await ProfileApiClient().getColStructure(dynamicParams!.dynamicId, 'GET_BASIC_DET_COLS_STRUCTURE', dynamicParams!.requestID); + getBasicDetColsStructureList = genericResponseModel?.getBasicDetColsStructureList ?? []; + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + void calGetValueSetValues(GetBasicDetDffStructureList structureList) async { + try { + Utils.showLoading(context); + String segmentId = structureList.cHILDSEGMENTSVS!; + List filteredList = getBasicDetDffStructureList?.where((element) => element.cHILDSEGMENTSVS == segmentId).toList() ?? []; + List> values = filteredList + .map((e) => GetSetValuesRequestModel( + sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME) + .toJson()) + .toList(); + ESERVICESVS genericResponseModel = await MyAttendanceApiClient().getValueSetValues(structureList.cHILDSEGMENTSVS!, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values); + + int index = getBasicDetDffStructureList!.indexWhere((element) => element.sEGMENTNAME == structureList.cHILDSEGMENTSVS); + getBasicDetDffStructureList![index].eSERVICESVS!.add(genericResponseModel); + // getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? []; + //getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList(); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + if (dynamicParams == null) { + dynamicParams = ModalRoute.of(context)!.settings.arguments as DynamicListViewParams; + getTransactionsStructure(); + } + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget( + context, + title: dynamicParams!.title, + ), + body: Column( + children: [ + (getBasicDetDffStructureList == null + ? const SizedBox() + : (getBasicDetDffStructureList!.isEmpty + ? LocaleKeys.noDataAvailable.tr().toText16().center + : ListView.separated( + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.all(21), + itemBuilder: (BuildContext cxt, int parentIndex) { + if (parentIndex < getBasicDetColsStructureList!.length) { + return parseDynamicFormatTypeCols(getBasicDetColsStructureList![parentIndex], parentIndex); + } else { + int count = parentIndex - getBasicDetColsStructureList!.length; + return parseDynamicFormatType(getBasicDetDffStructureList![count], count); + } + }, + separatorBuilder: (cxt, index) => 0.height, + itemCount: getBasicDetColsStructureList!.length + getBasicDetDffStructureList!.length))) + .expanded, + // 12.height, + DefaultButton( + LocaleKeys.next.tr(), + (getBasicDetDffStructureList ?? []).isEmpty + ? null + : () => { + //Navigator.of(context).pushNamed(LOGIN_TYPE) + }, + ).insideContainer, + ], + ), + ); + } + + Widget parseDynamicFormatType(GetBasicDetDffStructureList model, int index) { + if (model.dISPLAYFLAG != "N") { + } else { + return const SizedBox(); + } + + if (model.fORMATTYPE == "C") { + if (model.eSERVICESVS?.isNotEmpty ?? false) { + return PopupMenuButton( + child: DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pIDCOLUMNNAME ?? "", + isEnable: false, + isPopup: true, + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem(child: Text(model.eSERVICESVS![i].vALUECOLUMNNAME!), value: i), + ], + onSelected: (int index) { + ESERVICESDV eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: model.eSERVICESVS![index].vALUECOLUMNNAME, + pRETURNMSG: "null", + pRETURNSTATUS: getBasicDetDffStructureList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: model.eSERVICESVS![index].vALUECOLUMNNAME); + + print(model.eSERVICESVS![index].toJson()); + }); + } + + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pIDCOLUMNNAME ?? "", + isReadOnly: model.rEADONLY == "Y", + onChange: (text) { + model.fieldAnswer = text; + }, + ).paddingOnly(bottom: 12); + } else if (model.fORMATTYPE == "X") { + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.eSERVICESDV?.pIDCOLUMNNAME ?? (getBasicDetDffStructureList![index].fieldAnswer ?? ""), + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + DateTime date = await _selectDate(context); + DateTime date1 = DateTime(date.year, date.month, date.day); + getBasicDetDffStructureList![index].fieldAnswer = date.toString(); + ESERVICESDV eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: DateFormat('yyyy-MM-dd').format(date1), + pRETURNMSG: "null", + pRETURNSTATUS: getBasicDetDffStructureList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + getBasicDetDffStructureList![index].eSERVICESDV = eservicesdv; + setState(() {}); + if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + calGetValueSetValues(model); + } + }, + ).paddingOnly(bottom: 12); + } + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [], + ).objectContainerView(); + } + + Widget parseDynamicFormatTypeCols(GetBasicDetColsStructureList model, int index) { + if (model.dISPLAYFLAG != "N") { + } else { + return const SizedBox(); + } + + if (model.dATATYPE == "VARCHAR2") { + if (model.objectValuesList?.isNotEmpty ?? false) { + return PopupMenuButton( + child: DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + "", //model.aPPLICATIONCOLUMNNAME ?? "", + isEnable: false, + isPopup: true, + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + for (int i = 0; i < model.objectValuesList!.length; i++) PopupMenuItem(child: Text(model.objectValuesList![i].mEANING!), value: i), + ], + onSelected: (int index) { + ESERVICESDV eservicesdv = + ESERVICESDV(pIDCOLUMNNAME: model.objectValuesList![index].dESCRIPTION, pRETURNMSG: "null", pRETURNSTATUS: model.oBJECTNAME, pVALUECOLUMNNAME: model.aPPLICATIONCOLUMNNAME); + }); + } + + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.fieldAnswer ?? "", + //model.aPPLICATIONCOLUMNNAME ?? "", + //"", + isReadOnly: false, + onChange: (text) { + model.fieldAnswer = text; + }, + ).paddingOnly(bottom: 12); + } else if (model.dATATYPE == "DATE") { + return DynamicTextFieldWidget( + (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), + model.aPPLICATIONCOLUMNNAME ?? (getBasicDetColsStructureList![index].fieldAnswer ?? ""), + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + DateTime date = await _selectDate(context); + DateTime date1 = DateTime(date.year, date.month, date.day); + getBasicDetDffStructureList![index].fieldAnswer = date.toString(); + ESERVICESDV eservicesdv = ESERVICESDV( + pIDCOLUMNNAME: DateFormat('yyyy-MM-dd').format(date1), + pRETURNMSG: "null", + pRETURNSTATUS: getBasicDetDffStructureList![index].dEFAULTVALUE, + pVALUECOLUMNNAME: DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + getBasicDetDffStructureList![index].eSERVICESDV = eservicesdv; + setState(() {}); + // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { + // calGetValueSetValues(model); + // } + }, + ).paddingOnly(bottom: 12); + } + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [], + ).objectContainerView(); + } + + DateTime selectedDate = DateTime.now(); + + Future _selectDate(BuildContext context) async { + DateTime time = selectedDate; + if (!Platform.isIOS) { + await showCupertinoModalPopup( + context: context, + builder: (cxt) => Container( + height: 250, + color: Colors.white, + child: CupertinoDatePicker( + backgroundColor: Colors.white, + mode: CupertinoDatePickerMode.date, + onDateTimeChanged: (value) { + if (value != null && value != selectedDate) { + time = value; + } + }, + initialDateTime: selectedDate, + ), + ), + ); + } else { + final DateTime? picked = + await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + if (picked != null && picked != selectedDate) { + time = picked; + } + } + return time; + } +} diff --git a/lib/ui/profile/dynamic_screens/dynamic_listview_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_listview_screen.dart new file mode 100644 index 0000000..5ba4109 --- /dev/null +++ b/lib/ui/profile/dynamic_screens/dynamic_listview_screen.dart @@ -0,0 +1,105 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/my_attendance_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/get_eit_transaction_list_model.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; + +class DynamicListViewParams { + String title; + String dynamicId; + String uRL; + String requestID; + DynamicListViewParams(this.title, this.dynamicId, {this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = ''}); +} + +class DynamicListViewScreen extends StatefulWidget { + DynamicListViewScreen({Key? key}) : super(key: key); + + @override + _DynamicListViewScreenState createState() { + return _DynamicListViewScreenState(); + } +} + +class _DynamicListViewScreenState extends State { + List? getEITTransactionList; + DynamicListViewParams? dynamicParams; + @override + void initState() { + super.initState(); + } + + void getTransactions() async { + try { + Utils.showLoading(context); + getEITTransactionList = await MyAttendanceApiClient().getEitTransaction(dynamicParams!.dynamicId); + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + if (dynamicParams == null) { + dynamicParams = ModalRoute.of(context)!.settings.arguments as DynamicListViewParams; + getTransactions(); + } + + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget( + context, + title: dynamicParams!.title, + ), + body: getEITTransactionList == null + ? const SizedBox() + : (getEITTransactionList!.isEmpty + ? LocaleKeys.noDataAvailable.tr().toText16().center + : ListView.separated( + physics: const BouncingScrollPhysics(), + padding: EdgeInsets.all(21), + itemBuilder: (cxt, int parentIndex) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + for (int t = 0; t < (getEITTransactionList![parentIndex].collectionTransaction ?? []).length; t++) + if (getEITTransactionList![parentIndex].collectionTransaction![t].dISPLAYFLAG == "Y") + ItemDetailView( + getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTPROMPT!, getEITTransactionList![parentIndex].collectionTransaction![t].sEGMENTVALUEDSP ?? ""), + ], + ).objectContainerView(), + separatorBuilder: (cxt, index) => 12.height, + itemCount: getEITTransactionList!.length)), + floatingActionButton: Container( + height: 50, + width: 50, + decoration: const BoxDecoration( + shape: BoxShape.circle, + gradient: LinearGradient(transform: GradientRotation(.83), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ]), + ), + child: const Icon(Icons.add, color: Colors.white, size: 30), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.addDynamicInput, arguments: dynamicParams); + }), + ); + } +} diff --git a/lib/ui/screens/profile/profile_screen.dart b/lib/ui/screens/profile/profile_screen.dart index c1be51e..76f8a20 100644 --- a/lib/ui/screens/profile/profile_screen.dart +++ b/lib/ui/screens/profile/profile_screen.dart @@ -22,7 +22,7 @@ class ProfileScreen extends StatefulWidget { class _ProfileScreenState extends State { late MemberInformationListModel memberInformationList; final ImagePicker _picker = ImagePicker(); - //List getEmployeeBasicDetailsList = []; + List getEmployeeBasicDetailsList = []; @override void initState() { @@ -132,18 +132,4 @@ class _ProfileScreenState extends State { } } } - // 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/profile_info.dart b/lib/ui/screens/profile/widgets/profile_info.dart index 8919924..6f30b7a 100644 --- a/lib/ui/screens/profile/widgets/profile_info.dart +++ b/lib/ui/screens/profile/widgets/profile_info.dart @@ -6,6 +6,8 @@ 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'; +import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart'; +import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; class ProfileInFo extends StatelessWidget { ProfileInFo(this.memberInfo); @@ -13,10 +15,14 @@ class ProfileInFo extends StatelessWidget { String data = '.'; double sliderValue = 75; List menu = [ - ProfileMenu(name: LocaleKeys.profile_personalInformation.tr(), icon: 'personal-info.svg', route: AppRoutes.personalInfo), - ProfileMenu(name: LocaleKeys.profile_basicDetails.tr(), icon: 'basic-details.svg', route: AppRoutes.basicDetails), - ProfileMenu(name: LocaleKeys.profile_contactDetails.tr(), icon: 'contact-details.svg', route: AppRoutes.contactDetails), - ProfileMenu(name: LocaleKeys.profile_familyDetails.tr(), icon: 'family-members.svg', route: AppRoutes.familyMembers), + ProfileMenu(name: LocaleKeys.profile_personalInformation.tr(), icon: 'personal-info.svg', route: AppRoutes.personalInfo, dynamicUrl: ''), + ProfileMenu( + name: LocaleKeys.profile_basicDetails.tr(), + icon: 'basic-details.svg', + route: AppRoutes.basicDetails, + ), + ProfileMenu(name: LocaleKeys.profile_contactDetails.tr(), icon: 'contact-details.svg', route: AppRoutes.contactDetails, dynamicUrl: ''), + ProfileMenu(name: LocaleKeys.profile_familyDetails.tr(), icon: 'family-members.svg', route: AppRoutes.familyMembers, dynamicUrl: ''), ]; @override Widget build(BuildContext context) { @@ -101,7 +107,11 @@ class ProfileInFo extends StatelessWidget { Widget rowItem(obj, context) { return InkWell( onTap: () { + //if (obj.dynamicUrl == '') { Navigator.pushNamed(context, obj.route); + // } else { + // Navigator.pushNamed(context, AppRoutes.addDynamicInputProfile, arguments: DynamicListViewParams(obj.name, obj.functionName, uRL: obj.dynamicUrl, requestID: obj.requestID)); + //} }, child: ListTile( leading: SvgPicture.asset('assets/images/' + obj.icon), From c4096bd44dc35a9d423b604e4f8a22c6a0404f2d Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 8 Jun 2022 12:33:42 +0300 Subject: [PATCH 17/19] improvements --- lib/config/routes.dart | 2 +- .../basic_details_cols_structions.dart | 6 +- .../profile/basic_details_dff_structure.dart | 5 +- lib/ui/profile/basic_details.dart | 9 +- ...dart => dynamic_input_profile_screen.dart} | 107 +++++++++++------- 5 files changed, 78 insertions(+), 51 deletions(-) rename lib/ui/profile/dynamic_screens/{dynamic_input_screen.dart => dynamic_input_profile_screen.dart} (72%) diff --git a/lib/config/routes.dart b/lib/config/routes.dart index a9007cb..e377b8a 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -8,7 +8,7 @@ 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/my_attendance/dynamic_screens/dynamic_input_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/my_attendance_screen.dart'; -import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_screen.dart'; +import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart'; // import 'package:mohem_flutter_app/ui/my_attendance/work_from_home_screen.dart'; import 'package:mohem_flutter_app/ui/screens/eit/add_eit.dart'; import 'package:mohem_flutter_app/ui/screens/profile/profile_screen.dart'; diff --git a/lib/models/profile/basic_details_cols_structions.dart b/lib/models/profile/basic_details_cols_structions.dart index 2094a3c..dceacd6 100644 --- a/lib/models/profile/basic_details_cols_structions.dart +++ b/lib/models/profile/basic_details_cols_structions.dart @@ -1,3 +1,5 @@ +import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; + class GetBasicDetColsStructureList { String? aPPLICATIONCOLUMNNAME; String? dATATYPE; @@ -9,7 +11,7 @@ class GetBasicDetColsStructureList { String? rEQUIREDFLAG; String? sEGMENTPROMPT; int? sEGMENTSEQNUM; - String? fieldAnswer; + GetEmployeeBasicDetailsList? userBasicDetail; GetBasicDetColsStructureList({ this.aPPLICATIONCOLUMNNAME, this.dATATYPE, @@ -21,7 +23,7 @@ class GetBasicDetColsStructureList { this.rEQUIREDFLAG, this.sEGMENTPROMPT, this.sEGMENTSEQNUM, - this.fieldAnswer, + this.userBasicDetail, }); GetBasicDetColsStructureList.fromJson(Map json) { diff --git a/lib/models/profile/basic_details_dff_structure.dart b/lib/models/profile/basic_details_dff_structure.dart index 45bf406..db3312e 100644 --- a/lib/models/profile/basic_details_dff_structure.dart +++ b/lib/models/profile/basic_details_dff_structure.dart @@ -1,4 +1,5 @@ import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; +import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; class GetBasicDetDffStructureList { String? aLPHANUMERICALLOWEDFLAG; @@ -38,7 +39,7 @@ class GetBasicDetDffStructureList { String? uSEDFLAG; String? vALIDATIONTYPE; String? vALIDATIONTYPEDSP; - String? fieldAnswer; + GetEmployeeBasicDetailsList? userBasicDetail; GetBasicDetDffStructureList( {this.aLPHANUMERICALLOWEDFLAG, @@ -78,7 +79,7 @@ class GetBasicDetDffStructureList { this.uSEDFLAG, this.vALIDATIONTYPE, this.vALIDATIONTYPEDSP, - this.fieldAnswer}); + this.userBasicDetail}); GetBasicDetDffStructureList.fromJson(Map json) { aLPHANUMERICALLOWEDFLAG = json['ALPHANUMERIC_ALLOWED_FLAG']; diff --git a/lib/ui/profile/basic_details.dart b/lib/ui/profile/basic_details.dart index 0faa885..4733777 100644 --- a/lib/ui/profile/basic_details.dart +++ b/lib/ui/profile/basic_details.dart @@ -4,16 +4,12 @@ import 'package:mohem_flutter_app/api/profile_api_client.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/config/routes.dart'; -import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; -import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; -import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; -import 'package:mohem_flutter_app/ui/profile/profile.dart'; +import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; -import 'package:mohem_flutter_app/widgets/radio/show_radio.dart'; class BasicDetails extends StatefulWidget { const BasicDetails({Key? key}) : super(key: key); @@ -236,6 +232,7 @@ class _BasicDetailsState extends State { void continueDynamicForms() { Navigator.pushNamed(context, AppRoutes.addDynamicInputProfile, - arguments: DynamicListViewParams(LocaleKeys.profile_basicDetails.tr(), 'HR_PERINFO_SS', uRL: 'GET_BASIC_DET_DFF_STRUCTURE', requestID: 'BASIC_DETAILS')); + arguments: DynamicProfileParams(LocaleKeys.profile_basicDetails.tr(), 'HR_PERINFO_SS', + uRL: 'GET_BASIC_DET_DFF_STRUCTURE', requestID: 'BASIC_DETAILS', getEmployeeBasicDetailsList: getEmployeeBasicDetailsList)); } } diff --git a/lib/ui/profile/dynamic_screens/dynamic_input_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart similarity index 72% rename from lib/ui/profile/dynamic_screens/dynamic_input_screen.dart rename to lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart index 0ee9fb5..6ce01bc 100644 --- a/lib/ui/profile/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart @@ -13,6 +13,7 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/dyanmic_forms/get_set_values_request_model.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; +import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_cols_structions.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; @@ -20,6 +21,18 @@ import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; +class DynamicProfileParams { + String title; + String dynamicId; + String uRL; + String requestID; + String colsURL; + List? getEmployeeBasicDetailsList; + + DynamicProfileParams(this.title, this.dynamicId, + {this.uRL = 'GET_EIT_DFF_STRUCTURE', this.requestID = '', this.colsURL = '', this.getEmployeeBasicDetailsList = const []}); +} + class DynamicInputScreenProfile extends StatefulWidget { DynamicInputScreenProfile({Key? key}) : super(key: key); @@ -33,7 +46,7 @@ class _DynamicInputScreenState extends State { GenericResponseModel? genericResponseModel; List? getBasicDetDffStructureList; List? getBasicDetColsStructureList; - DynamicListViewParams? dynamicParams; + DynamicProfileParams? dynamicParams; @override void initState() { @@ -45,10 +58,16 @@ class _DynamicInputScreenState extends State { Utils.showLoading(context); genericResponseModel = await ProfileApiClient().getDffStructure(dynamicParams!.dynamicId, dynamicParams!.uRL, dynamicParams!.requestID); getBasicDetDffStructureList = genericResponseModel?.getBasicDetDffStructureList ?? []; - //getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList(); + + getBasicDetDffStructureList?.forEach((element) { + element.userBasicDetail = dynamicParams!.getEmployeeBasicDetailsList!.singleWhere((userDetail) => userDetail.aPPLICATIONCOLUMNNAME == element.aPPLICATIONCOLUMNNAME); + }); genericResponseModel = await ProfileApiClient().getColStructure(dynamicParams!.dynamicId, 'GET_BASIC_DET_COLS_STRUCTURE', dynamicParams!.requestID); getBasicDetColsStructureList = genericResponseModel?.getBasicDetColsStructureList ?? []; + getBasicDetColsStructureList?.forEach((element) { + element.userBasicDetail = dynamicParams!.getEmployeeBasicDetailsList!.singleWhere((userDetail) => userDetail.aPPLICATIONCOLUMNNAME == element.aPPLICATIONCOLUMNNAME); + }); Utils.hideLoading(context); setState(() {}); } catch (ex) { @@ -89,7 +108,7 @@ class _DynamicInputScreenState extends State { @override Widget build(BuildContext context) { if (dynamicParams == null) { - dynamicParams = ModalRoute.of(context)!.settings.arguments as DynamicListViewParams; + dynamicParams = ModalRoute.of(context)!.settings.arguments as DynamicProfileParams; getTransactionsStructure(); } return Scaffold( @@ -100,23 +119,33 @@ class _DynamicInputScreenState extends State { ), body: Column( children: [ - (getBasicDetDffStructureList == null + (getBasicDetDffStructureList == null && getBasicDetColsStructureList == null ? const SizedBox() - : (getBasicDetDffStructureList!.isEmpty + : (getBasicDetDffStructureList!.isEmpty && getBasicDetColsStructureList!.isEmpty ? LocaleKeys.noDataAvailable.tr().toText16().center - : ListView.separated( + : ListView( physics: const BouncingScrollPhysics(), padding: const EdgeInsets.all(21), - itemBuilder: (BuildContext cxt, int parentIndex) { - if (parentIndex < getBasicDetColsStructureList!.length) { - return parseDynamicFormatTypeCols(getBasicDetColsStructureList![parentIndex], parentIndex); - } else { - int count = parentIndex - getBasicDetColsStructureList!.length; - return parseDynamicFormatType(getBasicDetDffStructureList![count], count); - } - }, - separatorBuilder: (cxt, index) => 0.height, - itemCount: getBasicDetColsStructureList!.length + getBasicDetDffStructureList!.length))) + children: [ + ListView.separated( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (BuildContext cxt, int parentIndex) { + return parseDynamicFormatTypeCols(getBasicDetColsStructureList![parentIndex], parentIndex); + }, + separatorBuilder: (cxt, index) => 0.height, + itemCount: getBasicDetColsStructureList!.length), + 12.height, + ListView.separated( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (BuildContext cxt, int parentIndex) { + return parseDynamicFormatType(getBasicDetDffStructureList![parentIndex], parentIndex); + }, + separatorBuilder: (cxt, index) => 0.height, + itemCount: getBasicDetDffStructureList!.length), + ], + ))) .expanded, // 12.height, DefaultButton( @@ -143,21 +172,16 @@ class _DynamicInputScreenState extends State { return PopupMenuButton( child: DynamicTextFieldWidget( (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), - model.eSERVICESDV?.pIDCOLUMNNAME ?? "", + model.userBasicDetail?.sEGMENTVALUEDSP ?? "", isEnable: false, isPopup: true, ).paddingOnly(bottom: 12), itemBuilder: (_) => >[ for (int i = 0; i < model.eSERVICESVS!.length; i++) PopupMenuItem(child: Text(model.eSERVICESVS![i].vALUECOLUMNNAME!), value: i), ], - onSelected: (int index) { - ESERVICESDV eservicesdv = ESERVICESDV( - pIDCOLUMNNAME: model.eSERVICESVS![index].vALUECOLUMNNAME, - pRETURNMSG: "null", - pRETURNSTATUS: getBasicDetDffStructureList![index].dEFAULTVALUE, - pVALUECOLUMNNAME: model.eSERVICESVS![index].vALUECOLUMNNAME); - - print(model.eSERVICESVS![index].toJson()); + onSelected: (int popupIndex) { + getBasicDetDffStructureList![index].userBasicDetail!.sEGMENTVALUEDSP = model.eSERVICESVS![popupIndex].vALUECOLUMNNAME!; + setState(() {}); }); } @@ -166,19 +190,20 @@ class _DynamicInputScreenState extends State { model.eSERVICESDV?.pIDCOLUMNNAME ?? "", isReadOnly: model.rEADONLY == "Y", onChange: (text) { - model.fieldAnswer = text; + getBasicDetDffStructureList![index].userBasicDetail!.sEGMENTVALUEDSP = text; + }, ).paddingOnly(bottom: 12); } else if (model.fORMATTYPE == "X") { return DynamicTextFieldWidget( (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), - model.eSERVICESDV?.pIDCOLUMNNAME ?? (getBasicDetDffStructureList![index].fieldAnswer ?? ""), + model.eSERVICESDV?.pIDCOLUMNNAME ?? (getBasicDetDffStructureList![index].userBasicDetail?.sEGMENTVALUEDSP ?? ""), suffixIconData: Icons.calendar_today, isEnable: false, onTap: () async { DateTime date = await _selectDate(context); DateTime date1 = DateTime(date.year, date.month, date.day); - getBasicDetDffStructureList![index].fieldAnswer = date.toString(); + getBasicDetDffStructureList![index].userBasicDetail!.sEGMENTVALUEDSP = date.toString(); ESERVICESDV eservicesdv = ESERVICESDV( pIDCOLUMNNAME: DateFormat('yyyy-MM-dd').format(date1), pRETURNMSG: "null", @@ -211,45 +236,47 @@ class _DynamicInputScreenState extends State { return PopupMenuButton( child: DynamicTextFieldWidget( (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), - "", //model.aPPLICATIONCOLUMNNAME ?? "", + model.userBasicDetail?.sEGMENTVALUEDSP ?? "", isEnable: false, isPopup: true, ).paddingOnly(bottom: 12), itemBuilder: (_) => >[ for (int i = 0; i < model.objectValuesList!.length; i++) PopupMenuItem(child: Text(model.objectValuesList![i].mEANING!), value: i), ], - onSelected: (int index) { + onSelected: (int popupIndex) { ESERVICESDV eservicesdv = ESERVICESDV(pIDCOLUMNNAME: model.objectValuesList![index].dESCRIPTION, pRETURNMSG: "null", pRETURNSTATUS: model.oBJECTNAME, pVALUECOLUMNNAME: model.aPPLICATIONCOLUMNNAME); + getBasicDetDffStructureList![index].userBasicDetail!.sEGMENTVALUEDSP = model.objectValuesList![popupIndex].dESCRIPTION!; + setState(() {}); }); } return DynamicTextFieldWidget( (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), - model.fieldAnswer ?? "", + model.userBasicDetail?.sEGMENTVALUEDSP ?? "", //model.aPPLICATIONCOLUMNNAME ?? "", //"", isReadOnly: false, onChange: (text) { - model.fieldAnswer = text; + getBasicDetColsStructureList![index].userBasicDetail!.sEGMENTVALUEDSP = text; }, ).paddingOnly(bottom: 12); } else if (model.dATATYPE == "DATE") { return DynamicTextFieldWidget( (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), - model.aPPLICATIONCOLUMNNAME ?? (getBasicDetColsStructureList![index].fieldAnswer ?? ""), + model.aPPLICATIONCOLUMNNAME ?? (getBasicDetColsStructureList![index].userBasicDetail?.sEGMENTVALUEDSP ?? ""), suffixIconData: Icons.calendar_today, isEnable: false, onTap: () async { DateTime date = await _selectDate(context); DateTime date1 = DateTime(date.year, date.month, date.day); - getBasicDetDffStructureList![index].fieldAnswer = date.toString(); - ESERVICESDV eservicesdv = ESERVICESDV( - pIDCOLUMNNAME: DateFormat('yyyy-MM-dd').format(date1), - pRETURNMSG: "null", - pRETURNSTATUS: getBasicDetDffStructureList![index].dEFAULTVALUE, - pVALUECOLUMNNAME: DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); - getBasicDetDffStructureList![index].eSERVICESDV = eservicesdv; + getBasicDetColsStructureList![index].userBasicDetail?.sEGMENTVALUEDSP = date.toString(); + // ESERVICESDV eservicesdv = ESERVICESDV( + // pIDCOLUMNNAME: DateFormat('yyyy-MM-dd').format(date1), + // pRETURNMSG: "null", + // pRETURNSTATUS: getBasicDetDffStructureList![index].dEFAULTVALUE, + // pVALUECOLUMNNAME: DateFormat('yyyy-MM-ddThh:mm:ss.s').format(date)); + // getBasicDetDffStructureList![index].eSERVICESDV = eservicesdv; setState(() {}); // if (model.cHILDSEGMENTSVSSplited?.isNotEmpty ?? false) { // calGetValueSetValues(model); From 979879a28622c927077eb9e60d28feeb715294c8 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 9 Jun 2022 10:48:13 +0300 Subject: [PATCH 18/19] phone number is progress --- lib/api/profile_api_client.dart | 14 ++ lib/models/generic_response_model.dart | 12 +- .../profile/phone_number_types_modek.dart | 21 +++ lib/ui/profile/basic_details.dart | 2 +- lib/ui/profile/contact_details.dart | 176 ++++++++++++------ lib/ui/profile/phone_numbers.dart | 115 ++++++++++++ 6 files changed, 277 insertions(+), 63 deletions(-) create mode 100644 lib/models/profile/phone_number_types_modek.dart create mode 100644 lib/ui/profile/phone_numbers.dart diff --git a/lib/api/profile_api_client.dart b/lib/api/profile_api_client.dart index 7f783f2..3e254b4 100644 --- a/lib/api/profile_api_client.dart +++ b/lib/api/profile_api_client.dart @@ -8,6 +8,7 @@ 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 'package:mohem_flutter_app/models/profile/phone_number_types_modek.dart'; import 'api_client.dart'; class ProfileApiClient { @@ -118,4 +119,17 @@ class ProfileApiClient { return responseData.getValueSetValuesList!.first; }, url, postParams); } + + Future> getPhoneNumberTypes() async { + String url = "${ApiConsts.erpRest}GET_OBJECT_VALUES"; + Map 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.getObjectValuesList ?? []; + }, url, postParams); + } } diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 92eb6db..fa65b1f 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -25,6 +25,7 @@ import 'package:mohem_flutter_app/models/notification_action_model.dart'; import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_cols_structions.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; +import 'package:mohem_flutter_app/models/profile/phone_number_types_modek.dart'; import 'package:mohem_flutter_app/models/subordinates_on_leaves_model.dart'; import 'package:mohem_flutter_app/models/worklist_response_model.dart'; @@ -139,7 +140,7 @@ class GenericResponseModel { List? getMoNotificationBodyList; List? getNotificationButtonsList; List? getNotificationReassignModeList; - List? getObjectValuesList; + List? getObjectValuesList; GetOpenMissingSwipesList? getOpenMissingSwipesList; List? getOpenNotificationsList; List? getOpenNotificationsNumList; @@ -736,8 +737,13 @@ class GenericResponseModel { }); } - getNotificationReassignModeList = json['GetNotificationReassignModeList']; - getObjectValuesList = json['GetObjectValuesList']; + if (json['GetObjectValuesList'] != null) { + getObjectValuesList = []; + json['GetObjectValuesList'].forEach((v) { + getObjectValuesList!.add(new GetPhoneNumberTypesModel.fromJson(v)); + }); + } + getOpenMissingSwipesList = json["GetOpenMissingSwipesList"] == null ? null : GetOpenMissingSwipesList.fromJson(json["GetOpenMissingSwipesList"]); getOpenNotificationsList = json["GetOpenNotificationsList"] == null ? null : List.from(json["GetOpenNotificationsList"].map((x) => GetOpenNotificationsList.fromMap(x))); getOpenNotificationsNumList = json['GetOpenNotificationsNumList']; diff --git a/lib/models/profile/phone_number_types_modek.dart b/lib/models/profile/phone_number_types_modek.dart new file mode 100644 index 0000000..47b8a35 --- /dev/null +++ b/lib/models/profile/phone_number_types_modek.dart @@ -0,0 +1,21 @@ +class GetPhoneNumberTypesModel { + String? cODE; + String? dESCRIPTION; + String? mEANING; + + GetPhoneNumberTypesModel({this.cODE, this.dESCRIPTION, this.mEANING}); + + GetPhoneNumberTypesModel.fromJson(Map json) { + cODE = json['CODE']; + dESCRIPTION = json['DESCRIPTION']; + mEANING = json['MEANING']; + } + + Map toJson() { + final Map data = new Map(); + data['CODE'] = this.cODE; + data['DESCRIPTION'] = this.dESCRIPTION; + data['MEANING'] = this.mEANING; + return data; + } +} diff --git a/lib/ui/profile/basic_details.dart b/lib/ui/profile/basic_details.dart index 4733777..8a316fd 100644 --- a/lib/ui/profile/basic_details.dart +++ b/lib/ui/profile/basic_details.dart @@ -43,7 +43,7 @@ class _BasicDetailsState extends State { basicDetails(); print("getEmployeeBasicDetailsList.length"); print(getEmployeeBasicDetailsList.length); - // setState(() {}); + setState(() {}); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); diff --git a/lib/ui/profile/contact_details.dart b/lib/ui/profile/contact_details.dart index 32f0ce8..d36b19a 100644 --- a/lib/ui/profile/contact_details.dart +++ b/lib/ui/profile/contact_details.dart @@ -1,7 +1,3 @@ - - - - import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/profile_api_client.dart'; @@ -14,6 +10,7 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.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/phone_numbers.dart'; import 'package:mohem_flutter_app/ui/profile/profile.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; @@ -39,15 +36,17 @@ class _ContactDetailsState extends State { @override void initState() { super.initState(); + getEmployeePhones(); - getEmployeeAddress(); + setState(() {}); } void getEmployeePhones() async { try { Utils.showLoading(context); getEmployeePhonesList = await ProfileApiClient().getEmployeePhones(); + getEmployeeAddress(); Utils.hideLoading(context); setState(() {}); } catch (ex) { @@ -68,8 +67,6 @@ class _ContactDetailsState extends State { } } - - Widget build(BuildContext context) { return Scaffold( appBar: AppBarWidget( @@ -77,14 +74,17 @@ class _ContactDetailsState extends State { title: LocaleKeys.profile_contactDetails.tr(), ), backgroundColor: MyColors.backgroundColor, - bottomSheet:footer(), - body: Column( - children: [ - Container( + 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, + margin: EdgeInsets.only( + top: 20, + left: 26, + right: 26, + ), + padding: EdgeInsets.only(left: 14, right: 14, top: 5, bottom: 20), + height: 200, decoration: BoxDecoration( boxShadow: [ BoxShadow( @@ -97,22 +97,48 @@ class _ContactDetailsState extends State { color: Colors.white, borderRadius: BorderRadius.circular(10.0), ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Row( + mainAxisAlignment: MainAxisAlignment.end, 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), - ] + IconButton( + icon: Icon( + Icons.edit_location_alt_outlined, + size: 20, + ), + onPressed: () { + updatePhone(); + }, + ) + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: getEmployeePhonesList + .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + "${e.pHONETYPEMEANING}".toText13(color: MyColors.lightGrayColor), + "${e.pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor), + ])) + .toList()) + ]) + + // [ + // "${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( + Container( width: double.infinity, - margin: EdgeInsets.only(top: 28, left: 26, right: 26,), - padding: EdgeInsets.only(left: 14, right: 14,top: 13, bottom: 20), + margin: EdgeInsets.only( + top: 20, + left: 26, + right: 26, + ), + padding: EdgeInsets.only(left: 14, right: 14, top: 5, bottom: 20), height: 400, decoration: BoxDecoration( boxShadow: [ @@ -126,41 +152,66 @@ class _ContactDetailsState extends State { color: Colors.white, borderRadius: BorderRadius.circular(10.0), ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: SingleChildScrollView( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Row( + mainAxisAlignment: MainAxisAlignment.end, 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), - ] - ), - ), - ], - ) - - ); + IconButton( + icon: Icon( + Icons.edit_location_alt_outlined, + size: 20, + ), + onPressed: () {}, + ) + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: getEmployeeAddressList + .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + "${e.sEGMENTPROMPT}".toText13(color: MyColors.lightGrayColor), + "${e.sEGMENTVALUEDSP}".toText16(isBold: true, color: MyColors.blackColor), + SizedBox( + height: 20, + ), + ])) + .toList()) + ]))) + // "${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(){ + footer() { return Container( decoration: BoxDecoration( // borderRadius: BorderRadius.circular(10), @@ -175,4 +226,11 @@ class _ContactDetailsState extends State { }).insideContainer, ); } + + updatePhone() { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => PhoneNumbers(getEmployeePhonesList: this.getEmployeePhonesList)), + ); + } } diff --git a/lib/ui/profile/phone_numbers.dart b/lib/ui/profile/phone_numbers.dart new file mode 100644 index 0000000..aabf50e --- /dev/null +++ b/lib/ui/profile/phone_numbers.dart @@ -0,0 +1,115 @@ +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/generated/locale_keys.g.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/models/profile/phone_number_types_modek.dart'; +import 'package:mohem_flutter_app/ui/profile/profile.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; + +class PhoneNumbers extends StatefulWidget { + List getEmployeePhonesList; + + PhoneNumbers({Key? key, required this.getEmployeePhonesList}) : super(key: key); + + @override + _PhoneNumbersState createState() => _PhoneNumbersState(); +} + +class _PhoneNumbersState extends State { + List getPhoneNumberTypesList = []; + @override + void initState() { + super.initState(); + getPhoneNumberTypes(); + } + + void getPhoneNumberTypes() async { + Utils.showLoading(context); + getPhoneNumberTypesList = await ProfileApiClient().getPhoneNumberTypes(); + setState(() {}); + Utils.hideLoading(context); + } + + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBarWidget( + context, + title: LocaleKeys.profile_contactDetails.tr(), + ), + backgroundColor: MyColors.backgroundColor, + bottomSheet: footer(), + body: Column(children: [ + Container( + width: double.infinity, + margin: EdgeInsets.only( + top: 20, + left: 26, + right: 26, + ), + padding: EdgeInsets.only(left: 14, right: 14, top: 5, 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: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: widget.getEmployeePhonesList + .map((e) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + PopupMenuButton( + child: DynamicTextFieldWidget( + "Please Select *", + e.pHONETYPEMEANING ?? "", + isEnable: true, + isPopup: true, + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + for (int i = 0; i < getPhoneNumberTypesList.length; i++) PopupMenuItem(child: Text(getPhoneNumberTypesList![i].mEANING!), value: i), + ], + onSelected: (int index) { + e.pHONETYPEMEANING = getPhoneNumberTypesList[index].mEANING; + setState(() {}); + }), + "${e.pHONENUMBER}".toText16(isBold: true, color: MyColors.blackColor), + ])) + .toList()))) + ])); + } + + footer() { + return Container( + decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(10), + color: MyColors.white, + boxShadow: [ + BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), + ], + ), + child: DefaultButton(LocaleKeys.update.tr(), () async { + // context.setLocale(const Locale("en", "US")); // to change Loacle + Profile(); + }).insideContainer, + ); + } + + updatePhone() {} +} From cee80111fcb537dfafbe67104ba83160d6cfc527 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 9 Jun 2022 14:06:04 +0300 Subject: [PATCH 19/19] for comment --- lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart index 6ce01bc..6e054c9 100644 --- a/lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart +++ b/lib/ui/profile/dynamic_screens/dynamic_input_profile_screen.dart @@ -1,5 +1,6 @@ import 'dart:io'; + import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart';