From 0cd37ce0fa85534cab38205418a94d9df6c2e282 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Sun, 3 Apr 2022 13:13:28 +0300 Subject: [PATCH 1/5] 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 339b343c4cc9f4a1b7f39aa97679e8cbb9211f59 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 11 May 2022 10:24:34 +0300 Subject: [PATCH 2/5] 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 3/5] 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 b281efe14c5442dd66250a59b0c26ddd9785c868 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Sun, 22 May 2022 09:13:25 +0300 Subject: [PATCH 4/5] 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 5/5] 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, + // ], + // ) + // ], + // ), + // ] + // ), + // ), + ); + } +}