From 39b916bcc80d103d65fd3b5dc468266934c8e4b9 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 10 Aug 2022 11:45:31 +0300 Subject: [PATCH 1/2] performance page added --- assets/langs/ar-SA.json | 9 +- assets/langs/en-US.json | 9 +- lib/api/profile_api_client.dart | 14 ++- lib/config/routes.dart | 6 + lib/generated/locale_keys.g.dart | 8 +- lib/models/generic_response_model.dart | 6 +- lib/models/performance.dart | 18 +++ lib/ui/landing/widget/app_drawer.dart | 14 ++- lib/ui/landing/widget/services_widget.dart | 3 + lib/ui/performance/performance.dart | 117 +++++++++++++++++++ lib/ui/profile/add_update_family_member.dart | 4 +- 11 files changed, 190 insertions(+), 18 deletions(-) create mode 100644 lib/models/performance.dart create mode 100644 lib/ui/performance/performance.dart diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index ecedbdf..44cbea9 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -266,6 +266,7 @@ "summaryOfInformation": "ملخص المعلومات", "totalPayAmount": "المبلغ الإجمالي للدفع", "paymentInformation": "معلومات الدفع", + "performance": "تقييم الاداء", "amount": "مقدار", "correctCurrentDatails": "تعديل او اكمال التفاصيل الحالية", "selectType": " حدد نوع التغيير الذي تريد القيام به", @@ -310,10 +311,10 @@ "requestType": "نوع الطلب", "employeeDigitalID": "هويةالموظف الرقمية", "businessCard": "بطاقة العمل", - "checkOut":"وقت الخروج", - "regular":"منتظم", - "mark" : "علامة", - "selectMethodOfAttendance":"اختر طريقة تسجيل الحضور", + "checkOut": "وقت الخروج", + "regular": "منتظم", + "mark": "علامة", + "selectMethodOfAttendance": "اختر طريقة تسجيل الحضور", "comeNearHMGWifi": "HMG wifi من فضلك اقترب من", "profile": { "reset_password": { diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 32a5e43..15087ff 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -310,10 +310,11 @@ "wantToReject": "Are you sure want to reject?", "employeeDigitalID": "Employee Digital ID", "businessCard": "Business Card", - "checkOut":"Check Out", - "regular":"Regular", - "mark" : "Mark", - "selectMethodOfAttendance":"Select the method to mark the attendance", + "checkOut": "Check Out", + "regular": "Regular", + "mark": "Mark", + "performance": "Performance Evaluation", + "selectMethodOfAttendance": "Select the method to mark the attendance", "comeNearHMGWifi": "Please come near to HMG wifi", "profile": { "reset_password": { diff --git a/lib/api/profile_api_client.dart b/lib/api/profile_api_client.dart index b332499..7b4acd8 100644 --- a/lib/api/profile_api_client.dart +++ b/lib/api/profile_api_client.dart @@ -10,6 +10,7 @@ import 'package:mohem_flutter_app/models/get_employee_address_model.dart'; import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart'; import 'package:mohem_flutter_app/models/get_employee_phones_model.dart'; +import 'package:mohem_flutter_app/models/performance.dart'; import 'package:mohem_flutter_app/models/profile/get_countries_list_model.dart'; import 'package:mohem_flutter_app/models/profile/phone_number_types_model.dart'; import 'package:mohem_flutter_app/models/profile/start_address_approval_process_model.dart'; @@ -379,7 +380,7 @@ class ProfileApiClient { }, url, postParams); } - Future submetConatctTransactionAddAndUpdate(String actionType, int relationId, List> list) async { + Future submitContactTransactionAddAndUpdate(String actionType, int relationId, List> list) async { String url = "${ApiConsts.erpRest}SUBMIT_CONTACT_TRANSACTION"; Map postParams = { "P_MENU_TYPE": "E", @@ -395,4 +396,15 @@ class ProfileApiClient { return responseData.submitContactTransactionList; }, url, postParams); } + + Future?> getPerformanceAppraisal() async { + String url = "${ApiConsts.erpRest}GET_Performance_Appraisal"; + Map postParams = {}; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getPerformanceAppraisalList; + }, url, postParams); + } } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 9285671..733b603 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -15,6 +15,7 @@ import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_input import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/my_attendance_screen.dart'; import 'package:mohem_flutter_app/ui/payslip/monthly_pay_slip_screen.dart'; +import 'package:mohem_flutter_app/ui/performance/performance.dart'; import 'package:mohem_flutter_app/ui/profile/add_update_family_member.dart'; import 'package:mohem_flutter_app/ui/profile/basic_details.dart'; import 'package:mohem_flutter_app/ui/profile/contact_details.dart'; @@ -104,6 +105,10 @@ class AppRoutes { //Pay slip static const String monthlyPaySlip = "/monthlyPaySlip"; + //performance evaluation + + static const String performanceEvaluation = "/performanceEvaluation"; + static final Map routes = { login: (context) => LoginScreen(), verifyLogin: (context) => VerifyLoginScreen(), @@ -165,5 +170,6 @@ class AppRoutes { //pay slip monthlyPaySlip: (context) => MonthlyPaySlipScreen(), + performanceEvaluation: (context) => PerformanceAppraisal(), }; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index eac063d..c0742da 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -1,6 +1,6 @@ // DO NOT EDIT. This is code generated via package:easy_localization/generate.dart -abstract class LocaleKeys { +abstract class LocaleKeys { static const mohemm = 'mohemm'; static const english = 'english'; static const arabic = 'arabic'; @@ -247,7 +247,7 @@ abstract class LocaleKeys { static const Payroll = 'Payroll'; static const civilIdentityNumber = 'civilIdentityNumber'; static const dateOfBirth = 'dateOfBirth'; - static const maritalStatus = 'maritalStatus '; + static const maritalStatus = 'maritalStatus '; static const fullName = 'fullName'; static const remove = 'remove'; static const submit = 'submit'; @@ -273,7 +273,7 @@ abstract class LocaleKeys { static const enterNewInfo = 'enterNewInfo'; static const endDate = 'endDate'; static const removeThisMember = 'removeThisMember'; - static const updateThisMember = 'updateThisMember '; + static const updateThisMember = 'updateThisMember '; static const addNewFamilyMember = 'addNewFamilyMember'; static const addRow = 'addRow'; static const pleaseSelect = 'pleaseSelect'; @@ -282,6 +282,7 @@ abstract class LocaleKeys { static const add = 'add'; static const myProfile = 'myProfile'; static const mowadhafhi = 'mowadhafhi'; + static const performance = 'performance'; static const searchAnnouncements = 'searchAnnouncements'; static const announcements = 'announcements'; static const swipeRequest = 'swipeRequest'; @@ -334,5 +335,4 @@ abstract class LocaleKeys { static const gender_with_arg = 'gender.with_arg'; static const gender = 'gender'; static const reset_locale = 'reset_locale'; - } diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 782fb7c..856e97b 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -51,6 +51,7 @@ import 'package:mohem_flutter_app/models/notification_action_model.dart'; import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; import 'package:mohem_flutter_app/models/pending_transactions/get_pending_transactions_details.dart'; import 'package:mohem_flutter_app/models/pending_transactions/get_req_functions.dart'; +import 'package:mohem_flutter_app/models/performance.dart'; import 'package:mohem_flutter_app/models/privilege_list_model.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_cols_structions.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; @@ -193,7 +194,7 @@ class GenericResponseModel { // List? getPendingReqDetailsList; // List? getPendingReqFunctionsList; - List? getPerformanceAppraisalList; + List? getPerformanceAppraisalList; List? getPhonesNotificationBodyList; List? getPoItemHistoryList; GetPoNotificationBodyList? getPoNotificationBodyList; @@ -900,7 +901,8 @@ class GenericResponseModel { } // getPendingReqDetailsList = json['GetPendingReqDetailsList']; // getPendingReqFunctionsList = json['GetPendingReqFunctionsList']; - getPerformanceAppraisalList = json['GetPerformanceAppraisalList']; + getPerformanceAppraisalList = + json['GetPerformanceAppraisalList'] == null ? null : List.from(json["GetPerformanceAppraisalList"].map((x) => GetPerformanceAppraisalList.fromJson(x))); getPhonesNotificationBodyList = json["GetPhonesNotificationBodyList"] == null ? null : List.from(json["GetPhonesNotificationBodyList"].map((x) => GetPhonesNotificationBodyList.fromJson(x))); if (json['GetPoItemHistoryList'] != null) { diff --git a/lib/models/performance.dart b/lib/models/performance.dart new file mode 100644 index 0000000..53058ed --- /dev/null +++ b/lib/models/performance.dart @@ -0,0 +1,18 @@ +class GetPerformanceAppraisalList { + String? aPPRAISALSCORE; + int? aPPRAISALYEAR; + + GetPerformanceAppraisalList({this.aPPRAISALSCORE, this.aPPRAISALYEAR}); + + GetPerformanceAppraisalList.fromJson(Map json) { + aPPRAISALSCORE = json['APPRAISAL_SCORE']; + aPPRAISALYEAR = json['APPRAISAL_YEAR']; + } + + Map toJson() { + final Map data = new Map(); + data['APPRAISAL_SCORE'] = this.aPPRAISALSCORE; + data['APPRAISAL_YEAR'] = this.aPPRAISALYEAR; + return data; + } +} diff --git a/lib/ui/landing/widget/app_drawer.dart b/lib/ui/landing/widget/app_drawer.dart index 9bc9985..09e57ca 100644 --- a/lib/ui/landing/widget/app_drawer.dart +++ b/lib/ui/landing/widget/app_drawer.dart @@ -44,7 +44,7 @@ class _AppDrawerState extends State { const Divider(), InkWell( child: DrawerItem( - // 'Mowadhafhi', + // 'Mowadhafhi', LocaleKeys.mowadhafhi.tr(), icon: Icons.person, color: Colors.grey, @@ -54,6 +54,18 @@ class _AppDrawerState extends State { }, ), const Divider(), + InkWell( + child: DrawerItem( + // 'Mowadhafhi', + LocaleKeys.performance.tr(), + icon: Icons.person, + color: Colors.grey, + ), + onTap: () { + drawerNavigator(context, AppRoutes.performanceEvaluation); + }, + ), + const Divider(), InkWell( child: DrawerItem( LocaleKeys.pendingTransactions.tr(), diff --git a/lib/ui/landing/widget/services_widget.dart b/lib/ui/landing/widget/services_widget.dart index e99205b..cf466be 100644 --- a/lib/ui/landing/widget/services_widget.dart +++ b/lib/ui/landing/widget/services_widget.dart @@ -115,6 +115,9 @@ class ServicesWidget extends StatelessWidget { } else if (menuEntry.requestType == "VACATION_RULE") { Navigator.pushNamed(context, AppRoutes.vacationRule); return; + } else if (menuEntry.menuName == "MBL_PERINFO_SS") { + Navigator.of(context).pushNamed(AppRoutes.profile); + return; } List menuList = pro.getMenuEntriesList?.where((element) => element.parentMenuName == menuEntry.menuName && element.menuEntryType == "FUNCTION").toList() ?? []; menuEntry.icon = ""; diff --git a/lib/ui/performance/performance.dart b/lib/ui/performance/performance.dart new file mode 100644 index 0000000..27ddcb2 --- /dev/null +++ b/lib/ui/performance/performance.dart @@ -0,0 +1,117 @@ +import 'dart:io'; + +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/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/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/performance.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; + +class PerformanceAppraisal extends StatefulWidget { + const PerformanceAppraisal({Key? key}) : super(key: key); + + @override + _PerformanceAppraisalState createState() => _PerformanceAppraisalState(); +} + +class _PerformanceAppraisalState extends State { + List performance = []; + @override + void initState() { + getPerformanceAppraisal(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: MyColors.backgroundColor, + appBar: AppBarWidget( + context, + title: LocaleKeys.performance.tr(), + ), + body: performance.isNotEmpty + ? SingleChildScrollView( + child: Container( + width: double.infinity, + padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), + // margin: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), + child: Column(children: [ + Row(children: [Expanded(flex: 1, child: getPerformanceCard(performance.first))]), + GridView.count( + crossAxisCount: 2, + shrinkWrap: true, + // padding: EdgeInsets.all(4.0), + // //childAspectRatio: 8.0 / 9.0, + children: performance + .where((el) => performance.indexOf(el) != 0) + .map( + (item) => getPerformanceCard(item), + ) + .toList(), + ) + ]))) + : Utils.getNoDataWidget(context), + ); + } + + Widget getPerformanceCard(GetPerformanceAppraisalList performance) { + return Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + child: Padding( + padding: EdgeInsets.all(15), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Text( + "Performance evaluation in " + performance.aPPRAISALYEAR.toString(), + style: const TextStyle(fontWeight: FontWeight.bold), + )), + SizedBox( + height: 10, + ), + SliderTheme( + data: SliderThemeData(trackHeight: 3, thumbShape: SliderComponentShape.noThumb, overlayShape: SliderComponentShape.noOverlay), + child: Slider( + max: 100, + min: 0, + inactiveColor: Colors.grey.withOpacity(.4), + activeColor: Colors.green, + value: double.parse(performance.aPPRAISALSCORE!), + onChanged: (value) {}, + semanticFormatterCallback: (double newValue) { + return '${newValue.round()}'; + })), + SizedBox( + height: 10, + ), + Text( + performance.aPPRAISALSCORE.toString() + '%', + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18, + color: Colors.green, + ), + ), + ], + ))); + } + + void getPerformanceAppraisal() async { + try { + Utils.showLoading(context); + performance = (await ProfileApiClient().getPerformanceAppraisal())!; + setState(() {}); + Utils.hideLoading(context); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } +} diff --git a/lib/ui/profile/add_update_family_member.dart b/lib/ui/profile/add_update_family_member.dart index 9a0bd66..3d606cb 100644 --- a/lib/ui/profile/add_update_family_member.dart +++ b/lib/ui/profile/add_update_family_member.dart @@ -448,9 +448,9 @@ class _AddUpdateFamilyMemberState extends State { Utils.showLoading(context); if (args['actionType'] == "ADD") { var relationID = null; - submitContactTransactionList = await ProfileApiClient().submetConatctTransactionAddAndUpdate(args['actionType'], relationID, valuesFinal); + submitContactTransactionList = await ProfileApiClient().submitContactTransactionAddAndUpdate(args['actionType'], relationID, valuesFinal); } else if (args['actionType'] == "UPDATE") { - submitContactTransactionList = await ProfileApiClient().submetConatctTransactionAddAndUpdate(args['actionType'], args['relationID'], valuesFinal); + submitContactTransactionList = await ProfileApiClient().submitContactTransactionAddAndUpdate(args['actionType'], args['relationID'], valuesFinal); } var transactionId = submitContactTransactionList!.pTRANSACTIONID; var itemKey = submitContactTransactionList!.pITEMKEY; From f3477fb5f33f2a8ac8d6c7ea26c3cefd93cd70b9 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 4 Sep 2022 16:40:06 +0300 Subject: [PATCH 2/2] perforamce page updates --- assets/langs/ar-SA.json | 1 + assets/langs/en-US.json | 1 + lib/generated/locale_keys.g.dart | 1 + lib/ui/performance/performance.dart | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 44cbea9..036dde0 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -267,6 +267,7 @@ "totalPayAmount": "المبلغ الإجمالي للدفع", "paymentInformation": "معلومات الدفع", "performance": "تقييم الاداء", + "performanceEvaluation": "تقييم الأداء في", "amount": "مقدار", "correctCurrentDatails": "تعديل او اكمال التفاصيل الحالية", "selectType": " حدد نوع التغيير الذي تريد القيام به", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 15087ff..8f93658 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -314,6 +314,7 @@ "regular": "Regular", "mark": "Mark", "performance": "Performance Evaluation", + "performanceEvaluation": "Performance evaluation in", "selectMethodOfAttendance": "Select the method to mark the attendance", "comeNearHMGWifi": "Please come near to HMG wifi", "profile": { diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index c0742da..6ae78e0 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -335,4 +335,5 @@ abstract class LocaleKeys { static const gender_with_arg = 'gender.with_arg'; static const gender = 'gender'; static const reset_locale = 'reset_locale'; + static const performanceEvaluation = 'performanceEvaluation'; } diff --git a/lib/ui/performance/performance.dart b/lib/ui/performance/performance.dart index 27ddcb2..510db0b 100644 --- a/lib/ui/performance/performance.dart +++ b/lib/ui/performance/performance.dart @@ -70,7 +70,7 @@ class _PerformanceAppraisalState extends State { children: [ Container( child: Text( - "Performance evaluation in " + performance.aPPRAISALYEAR.toString(), + LocaleKeys.performanceEvaluation.tr() + performance.aPPRAISALYEAR.toString(), style: const TextStyle(fontWeight: FontWeight.bold), )), SizedBox(