From 3fcbd9946a7fd008946a89ad4635d235dd13c58b Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 16 Aug 2022 12:04:28 +0300 Subject: [PATCH 1/8] configs for ios. --- ios/Runner.xcodeproj/project.pbxproj | 37 ++++++++++++++++--- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- ios/Runner/Info.plist | 2 + lib/main.dart | 3 +- lib/models/profile_menu.model.dart | 4 +- lib/ui/landing/dashboard_screen.dart | 4 +- lib/ui/login/login_screen.dart | 8 ++-- .../dynamic_screens/dynamic_input_screen.dart | 5 +-- 8 files changed, 47 insertions(+), 18 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 7ca764b..f6164da 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ @@ -140,6 +140,7 @@ 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, AAF25E5FC427CABFCDCC628C /* [CP] Embed Pods Frameworks */, + 8E1FBB2EA6B3AEDD9488054A /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -156,7 +157,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -234,6 +235,23 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + 8E1FBB2EA6B3AEDD9488054A /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -358,7 +376,10 @@ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.mohemFlutterApp; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -482,7 +503,10 @@ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.mohemFlutterApp; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -501,7 +525,10 @@ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.mohemFlutterApp; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140c..3db53b6 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone + diff --git a/lib/main.dart b/lib/main.dart index cd00082..b1e74db 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,7 @@ import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; -import 'package:firebase_core/firebase_core.dart'; + import 'package:flutter/material.dart'; import 'package:logger/logger.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; @@ -24,7 +24,6 @@ var logger = Logger( Future main() async { WidgetsFlutterBinding.ensureInitialized(); await EasyLocalization.ensureInitialized(); - await Firebase.initializeApp(); AppState().setPostParamsModel( PostParamsModel(channel: 31, versionID: 5.0, mobileType: Platform.isAndroid ? "android" : "ios"), ); diff --git a/lib/models/profile_menu.model.dart b/lib/models/profile_menu.model.dart index c1b77b7..7005c88 100644 --- a/lib/models/profile_menu.model.dart +++ b/lib/models/profile_menu.model.dart @@ -1,6 +1,3 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - class ProfileMenu { final String name; final String icon; @@ -8,5 +5,6 @@ class ProfileMenu { final String dynamicUrl; final String functionName; final String requestID; + ProfileMenu({this.name = '', this.icon = '', this.route = '', this.dynamicUrl = '', this.functionName = '', this.requestID = ''}); } diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 2e7e769..4406a4d 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -324,7 +326,7 @@ class _DashboardScreenState extends State { child: AppDrawer(), ), bottomNavigationBar: SizedBox( - height: 70, + height: Platform.isAndroid ? 70 : 100, child: BottomNavigationBar( items: [ BottomNavigationBarItem( diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index d02fd74..a2ef87a 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/src/public_ext.dart'; +import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -23,7 +24,6 @@ import 'package:mohem_flutter_app/models/member_login_list_model.dart'; import 'package:mohem_flutter_app/models/privilege_list_model.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/input_widget.dart'; -import 'package:shared_preferences/shared_preferences.dart'; class LoginScreen extends StatefulWidget { LoginScreen({Key? key}) : super(key: key); @@ -41,7 +41,7 @@ class _LoginScreenState extends State { CheckMobileAppVersionModel? _checkMobileAppVersion; MemberLoginListModel? _memberLoginList; - final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; + late final FirebaseMessaging _firebaseMessaging; bool _autoLogin = false; @@ -75,6 +75,8 @@ class _LoginScreenState extends State { Future checkFirebaseToken() async { try { Utils.showLoading(context); + await Firebase.initializeApp(); + _firebaseMessaging = FirebaseMessaging.instance; firebaseToken = await _firebaseMessaging.getToken(); loginInfo = await LoginApiClient().getMobileLoginInfoNEW(firebaseToken ?? "", Platform.isAndroid ? "android" : "ios"); if (loginInfo == null) { @@ -88,7 +90,7 @@ class _LoginScreenState extends State { } } catch (ex) { Utils.hideLoading(context); - Utils.handleException(ex, context, null); + Utils.handleException(ex, context, (errorMsg){}); } } diff --git a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart index a88e041..051d72a 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -176,7 +176,6 @@ class _DynamicInputScreenState extends State { List> getDefaultValuesIonicLogic(GetEITDFFStructureList structureElement) { try { - Utils.showLoading(context); List parentValue = structureElement.pARENTSEGMENTSVSSplitedVS ?? []; List parentsList = structureElement.pARENTSEGMENTSDVSplited ?? []; @@ -718,7 +717,7 @@ class _DynamicInputScreenState extends State { Future _selectDate(BuildContext context) async { DateTime time = selectedDate; - if (!Platform.isIOS) { + if (Platform.isIOS) { await showCupertinoModalPopup( context: context, builder: (cxt) => Container( @@ -749,7 +748,7 @@ class _DynamicInputScreenState extends State { Future _selectTime(BuildContext context) async { TimeOfDay time = TimeOfDay(hour: selectedDate.hour, minute: selectedDate.minute); - if (!Platform.isIOS) { + if (Platform.isIOS) { await showCupertinoModalPopup( context: context, builder: (cxt) => Container( From 4edb19c2bb214f76ed86c3aa70ead8c1cd91958e Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 16 Aug 2022 16:07:51 +0300 Subject: [PATCH 2/8] Vacation rule added cont. --- lib/classes/colors.dart | 3 + lib/extensions/widget_extensions.dart | 3 +- lib/models/generic_response_model.dart | 9 +- .../attendance/add_vacation_rule_screen.dart | 245 +++++++++++++++++- lib/ui/work_list/sheets/delegate_sheet.dart | 34 +-- .../work_list/sheets/selected_item_sheet.dart | 8 +- lib/widgets/bottom_sheet.dart | 12 +- .../search_employee_bottom_sheet.dart | 224 ++++++++++++++++ .../dynamic_textfield_widget.dart | 5 +- 9 files changed, 494 insertions(+), 49 deletions(-) create mode 100644 lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart diff --git a/lib/classes/colors.dart b/lib/classes/colors.dart index 4b34186..e37a049 100644 --- a/lib/classes/colors.dart +++ b/lib/classes/colors.dart @@ -22,11 +22,14 @@ class MyColors { static const Color darkWhiteColor = Color(0xffE0E0E0); static const Color redColor = Color(0xffD02127); static const Color yellowColor = Color(0xffF4E31C); + static const Color yellowFavColor = Color(0xffEAC321); static const Color backgroundBlackColor = Color(0xff202529); static const Color black = Color(0xff000000); static const Color white = Color(0xffffffff); static const Color green = Color(0xffffffff); static const Color borderColor = Color(0xffE8E8E8); + static const Color borderE3Color = Color(0xffE3E3E3); + static const Color borderCEColor = Color(0xffCECECE); //static const Color grey67Color = Color(0xff676767); static const Color whiteColor = Color(0xFFEEEEEE); static const Color greenColor = Color(0xff1FA269); diff --git a/lib/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart index bbe50b4..247cde5 100644 --- a/lib/extensions/widget_extensions.dart +++ b/lib/extensions/widget_extensions.dart @@ -41,7 +41,7 @@ extension WidgetExtensions on Widget { child: this, ); - Widget objectContainerView({String title = ""}) { + Widget objectContainerView({String title = "", String note = ""}) { return Container( padding: const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), decoration: BoxDecoration( @@ -62,6 +62,7 @@ extension WidgetExtensions on Widget { if (title.isNotEmpty) title.toText16(), if (title.isNotEmpty) 12.height, this, + if (note.isNotEmpty) note.toText11(), ], ), ); diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 782fb7c..1260d80 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -294,7 +294,7 @@ class GenericResponseModel { String? registerUserNameList; List? replacementList; List? respondAttributesList; - String? respondRolesList; + List? respondRolesList; String? resubmitAbsenceTransactionList; String? resubmitEITTransactionList; String? resubmitHrTransactionList; @@ -1163,7 +1163,12 @@ class GenericResponseModel { respondAttributesList!.add(new RespondAttributesList.fromJson(v)); }); } - respondRolesList = json['RespondRolesList']; + if (json['RespondRolesList'] != null) { + respondRolesList = []; + json['RespondRolesList'].forEach((v) { + respondRolesList!.add(v); + }); + } resubmitAbsenceTransactionList = json['ResubmitAbsenceTransactionList']; resubmitEITTransactionList = json['ResubmitEITTransactionList']; resubmitHrTransactionList = json['ResubmitHrTransactionList']; diff --git a/lib/ui/attendance/add_vacation_rule_screen.dart b/lib/ui/attendance/add_vacation_rule_screen.dart index b3c3780..a76e65a 100644 --- a/lib/ui/attendance/add_vacation_rule_screen.dart +++ b/lib/ui/attendance/add_vacation_rule_screen.dart @@ -1,7 +1,11 @@ +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/vacation_rule_api_client.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/vacation_rule/get_item_type_notifications_list_model.dart'; @@ -9,8 +13,13 @@ import 'package:mohem_flutter_app/models/vacation_rule/get_notification_reassign import 'package:mohem_flutter_app/models/vacation_rule/respond_attributes_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/vr_item_types_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/wf_look_up_list_model.dart'; +import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; +import 'package:mohem_flutter_app/widgets/bottom_sheets/search_employee_bottom_sheet.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; +import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; class AddVacationRuleScreen extends StatefulWidget { AddVacationRuleScreen({Key? key}) : super(key: key); @@ -23,14 +32,24 @@ class AddVacationRuleScreen extends StatefulWidget { class _AddVacationRuleScreenState extends State { List? vrItemTypesList; + VrItemTypesList? selectedItemType; + List? itemTypeNotificationsList; + GetItemTypeNotificationsList? selectedItemTypeNotification; List? notificationReassignModeList; + GetNotificationReassignModeList? notificationReassignMode; + List? respondAttributesList; List? wfLookupList; + ReplacementList? selectedReplacementEmployee; + int currentStage = 0; + DateTime startTime = DateTime.now(); + DateTime? endTime; + @override void initState() { super.initState(); @@ -53,7 +72,8 @@ class _AddVacationRuleScreenState extends State { void getItemTypeNotificationsList() async { try { Utils.showLoading(context); - //itemTypeNotificationsList = await VacationRuleApiClient().getItemTypeNotifications(); + itemTypeNotificationsList = await VacationRuleApiClient().getItemTypeNotifications(selectedItemType!.iTEMTYPE!); + itemTypeNotificationsList!.insert(0, GetItemTypeNotificationsList(nOTIFICATIONDISPLAYNAME: "All", nOTIFICATIONNAME: "*", fYIFLAG: "N")); Utils.hideLoading(context); currentStage = 2; setState(() {}); @@ -67,13 +87,31 @@ class _AddVacationRuleScreenState extends State { try { Utils.showLoading(context); List results = await Future.wait([ - // VacationRuleApiClient().getNotificationReassignMode(), - // VacationRuleApiClient().getRespondAttributes("", ""), + VacationRuleApiClient().getNotificationReassignMode(), + VacationRuleApiClient().getRespondAttributes(selectedItemType!.iTEMTYPE!, selectedItemTypeNotification!.nOTIFICATIONNAME!), // VacationRuleApiClient().getWfLookup(P_LOOKUP_TYPE), ]); notificationReassignModeList = results[0]; + if (selectedItemType!.iTEMTYPE != "*") { + notificationReassignModeList!.add( + GetNotificationReassignModeList( + rADIOBUTTONLABEL: "Deliver notifications to me regardless of any general rules", + rADIOBUTTONACTION: "deliver_notification", + rADIOBUTTONSEQ: 1, + ), + ); + } + if (selectedItemTypeNotification!.fYIFLAG == "Y") { + notificationReassignModeList!.add( + GetNotificationReassignModeList( + rADIOBUTTONLABEL: "Close", + rADIOBUTTONACTION: "close", + rADIOBUTTONSEQ: 1, + ), + ); + } respondAttributesList = results[1]; - wfLookupList = results[2]; + // wfLookupList = results[2]; Utils.hideLoading(context); currentStage = 3; setState(() {}); @@ -94,7 +132,7 @@ class _AddVacationRuleScreenState extends State { backgroundColor: Colors.white, appBar: AppBarWidget( context, - title: LocaleKeys.vacationRule.tr(), + title: LocaleKeys.vacationRule.tr(), // todo @Sikander change title to 'Vacation Type' ), body: vrItemTypesList == null ? const SizedBox() @@ -105,20 +143,199 @@ class _AddVacationRuleScreenState extends State { ListView( padding: const EdgeInsets.all(21), physics: const BouncingScrollPhysics(), - children: [], + children: [ + if (vrItemTypesList!.isNotEmpty) + PopupMenuButton( + child: DynamicTextFieldWidget( + LocaleKeys.itemType.tr(), + selectedItemType == null ? "Select Type" : selectedItemType!.iTEMTYPEDISPLAYNAME!, + isEnable: false, + isPopup: true, + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + for (int i = 0; i < vrItemTypesList!.length; i++) PopupMenuItem(value: i, child: Text(vrItemTypesList![i].iTEMTYPEDISPLAYNAME!)), + ], + onSelected: (int popupIndex) { + if (selectedItemType == vrItemTypesList![popupIndex]) { + return; + } + selectedItemType = vrItemTypesList![popupIndex]; + setState(() {}); + if (selectedItemType!.iTEMTYPE == "*") { + selectedItemTypeNotification = GetItemTypeNotificationsList(nOTIFICATIONDISPLAYNAME: "All", nOTIFICATIONNAME: "*", fYIFLAG: "N"); + itemTypeNotificationsList = null; + notificationReassignMode = null; + callCombineApis(); + } else { + selectedItemTypeNotification = null; + notificationReassignMode = null; + getItemTypeNotificationsList(); + } + }).objectContainerView(title: "Apply for Vacation Rule\nStep 1", note: "*If All is selected, you will skip to step 3"), + if ((itemTypeNotificationsList ?? []).isNotEmpty) ...[ + 12.height, + PopupMenuButton( + child: DynamicTextFieldWidget( + "Notification", + selectedItemTypeNotification == null ? "Select Notification" : selectedItemTypeNotification!.nOTIFICATIONDISPLAYNAME!, + isEnable: false, + isPopup: true, + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + for (int i = 0; i < itemTypeNotificationsList!.length; i++) PopupMenuItem(value: i, child: Text(itemTypeNotificationsList![i].nOTIFICATIONDISPLAYNAME!)), + ], + onSelected: (int popupIndex) { + if (selectedItemTypeNotification == itemTypeNotificationsList![popupIndex]) { + return; + } + selectedItemTypeNotification = itemTypeNotificationsList![popupIndex]; + notificationReassignMode = null; + setState(() {}); + callCombineApis(); + }).objectContainerView(title: "Step 2") + ], + if (selectedItemType != null && selectedItemTypeNotification != null && currentStage == 3) ...[ + 12.height, + Column( + children: [ + ItemDetailView(LocaleKeys.itemType.tr(), selectedItemType!.iTEMTYPEDISPLAYNAME!), + ItemDetailView("Notification", selectedItemTypeNotification!.nOTIFICATIONDISPLAYNAME!), + 12.height, + DynamicTextFieldWidget( + "Start Date", + formattedDate(startTime), + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + var start = await _selectDateTime(context, startTime); + if (start != startTime) { + startTime = start; + setState(() {}); + } + }, + ), + 12.height, + DynamicTextFieldWidget( + "End Date", + formattedDate(endTime), + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + var end = await _selectDateTime(context, endTime ?? startTime); + if (end != endTime) { + endTime = end; + setState(() {}); + } + }, + ), + 12.height, + DynamicTextFieldWidget( + "Message", + "Write a message", + lines: 2, + onChange: (message) {}, + // isEnable: false, + // isPopup: true, + ).paddingOnly(bottom: 12), + PopupMenuButton( + child: DynamicTextFieldWidget( + "Notification Reassign", + notificationReassignMode == null ? "Select Notification" : notificationReassignMode!.rADIOBUTTONLABEL ?? "", + isEnable: false, + isPopup: true, + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + for (int i = 0; i < notificationReassignModeList!.length; i++) PopupMenuItem(value: i, child: Text(notificationReassignModeList![i].rADIOBUTTONLABEL!)), + ], + onSelected: (int popupIndex) { + if (notificationReassignMode == notificationReassignModeList![popupIndex]) { + return; + } + notificationReassignMode = notificationReassignModeList![popupIndex]; + setState(() {}); + }), + DynamicTextFieldWidget( + "Select Employee", + selectedReplacementEmployee == null ? "Search employee for replacement" : selectedReplacementEmployee!.employeeDisplayName ?? "", + isEnable: false, + onTap: () { + showMyBottomSheet( + context, + child: SearchEmployeeBottomSheet( + title: "Search for Employee", + apiMode: "DELEGATE", + onSelectEmployee: (_selectedEmployee) { + // Navigator.pop(context); + selectedReplacementEmployee = _selectedEmployee; + setState(() {}); + }, + ), + ); + }, + ).paddingOnly(bottom: 12), + ], + ).objectContainerView(title: "Step 3") + ] + ], ).expanded, DefaultButton( - currentStage == 3 ? LocaleKeys.apply.tr() : LocaleKeys.next.tr(), - () { - if (currentStage == 1) { - getItemTypeNotificationsList(); - } else if (currentStage == 2) { - callCombineApis(); - } - }, + LocaleKeys.apply.tr(), + currentStage != 3 + ? null + : () { + if (currentStage == 1) { + getItemTypeNotificationsList(); + } else if (currentStage == 2) { + callCombineApis(); + } + }, ).insideContainer, ], )), ); } + + Future _selectDateTime(BuildContext context, DateTime _time) async { + DateTime time = _time; + if (Platform.isIOS) { + await showCupertinoModalPopup( + context: context, + builder: (cxt) => Container( + height: 250, + color: Colors.white, + child: CupertinoDatePicker( + backgroundColor: Colors.white, + mode: CupertinoDatePickerMode.dateAndTime, + onDateTimeChanged: (value) { + if (value != _time) { + time = value; + } + }, + initialDateTime: _time, + ), + ), + ); + } else { + final DateTime? picked = await showDatePicker(context: context, initialDate: _time, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + final TimeOfDay? timePicked = await showTimePicker( + context: context, + initialTime: TimeOfDay.fromDateTime(picked!), + ); + if (picked != _time || timePicked != TimeOfDay.fromDateTime(picked)) { + time = picked; + time = time.add( + Duration( + hours: timePicked!.hour, + minutes: timePicked.minute, + ), + ); + } + } + return time; + } + + String formattedDate(DateTime? _time) { + if (_time == null) return "Select date and time"; + return DateFormat("MM/dd/yyyy hh:mm:ss a").format(_time); + } } diff --git a/lib/ui/work_list/sheets/delegate_sheet.dart b/lib/ui/work_list/sheets/delegate_sheet.dart index 1923c27..55483bf 100644 --- a/lib/ui/work_list/sheets/delegate_sheet.dart +++ b/lib/ui/work_list/sheets/delegate_sheet.dart @@ -109,14 +109,14 @@ class _DelegateSheetState extends State { Expanded( child: SingleChildScrollView( child: Padding( - padding: EdgeInsets.all(21), + padding: const EdgeInsets.all(21), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - widget.title.toText24(), - 24.height, + widget.title.toText24(isBold: true), + 21.height, "Search".toText16(), - 20.height, + 11.height, Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ @@ -148,7 +148,7 @@ class _DelegateSheetState extends State { ), ), Container( - height: 24, + height: 36, width: 1, color: Color(0xffE5E5E5), ), @@ -156,17 +156,9 @@ class _DelegateSheetState extends State { padding: EdgeInsets.all(8), child: Row( children: [ - Text( - selectedType, - style: const TextStyle( - fontSize: 11, - fontWeight: FontWeight.w600, - color: Color(0xff2B353E), - letterSpacing: -0.44, - ), - ), + selectedType.toText12(), 4.width, - Icon( + const Icon( Icons.keyboard_arrow_down, color: Colors.black, size: 16, @@ -269,7 +261,7 @@ class _DelegateSheetState extends State { }, separatorBuilder: (context, index) { return Container( - color: MyColors.borderColor, + color: MyColors.borderE3Color, width: double.infinity, height: 1, margin: EdgeInsets.only(top: 8, bottom: 8), @@ -286,7 +278,7 @@ class _DelegateSheetState extends State { }, separatorBuilder: (context, index) { return Container( - color: MyColors.borderColor, + color: MyColors.borderE3Color, width: double.infinity, height: 1, margin: EdgeInsets.only(top: 8, bottom: 8), @@ -371,11 +363,11 @@ class _DelegateSheetState extends State { width: 30, isImageBase64: true, ), - 16.width, - Expanded( - child: (actionHistory.nAME ?? "").toText12(), - ), + 9.width, + (actionHistory.nAME ?? "").toText12().expanded, IconButton( + padding: EdgeInsets.zero, + constraints: const BoxConstraints(), onPressed: () { actionHistory.isFavorite = true; fetchChangeFav( diff --git a/lib/ui/work_list/sheets/selected_item_sheet.dart b/lib/ui/work_list/sheets/selected_item_sheet.dart index aadec34..2d37d06 100644 --- a/lib/ui/work_list/sheets/selected_item_sheet.dart +++ b/lib/ui/work_list/sheets/selected_item_sheet.dart @@ -37,12 +37,12 @@ class SelectedItemSheet extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - title.toText24(), - 24.height, + title.toText24(isBold: true), + 21.height, if (actionHistoryList != null) showItem(actionHistoryList!.nAME, actionHistoryList!.isFavorite), if (favoriteReplacements != null) showItem(favoriteReplacements!.employeeDisplayName, true), if (replacementList != null) showItem(replacementList!.employeeDisplayName, replacementList!.isFavorite), - 12.height, + 14.height, InputWidget( "Enter a note", "This is simple note", @@ -61,7 +61,7 @@ class SelectedItemSheet extends StatelessWidget { Container( width: double.infinity, height: 1, - color: MyColors.borderColor, + color: MyColors.borderE3Color, ), Row( children: [ diff --git a/lib/widgets/bottom_sheet.dart b/lib/widgets/bottom_sheet.dart index d151afc..206d017 100644 --- a/lib/widgets/bottom_sheet.dart +++ b/lib/widgets/bottom_sheet.dart @@ -8,11 +8,11 @@ void showMyBottomSheet(BuildContext context, {required Widget child}) { backgroundColor: Colors.transparent, builder: (BuildContext context) { return Container( - decoration: BoxDecoration( + decoration: const BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( - topRight: Radius.circular(24), - topLeft: Radius.circular(24), + topRight: Radius.circular(25), + topLeft: Radius.circular(25), ), ), clipBehavior: Clip.antiAlias, @@ -20,12 +20,12 @@ void showMyBottomSheet(BuildContext context, {required Widget child}) { mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ - 8.height, + 13.height, Container( height: 6, width: 60, - decoration: BoxDecoration( - color: Colors.grey[200], + decoration: const BoxDecoration( + color: Color(0xff9A9A9A), borderRadius: BorderRadius.all( Radius.circular(20), ), diff --git a/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart b/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart new file mode 100644 index 0000000..9aabbb7 --- /dev/null +++ b/lib/widgets/bottom_sheets/search_employee_bottom_sheet.dart @@ -0,0 +1,224 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/get_action_history_list_model.dart'; +import 'package:mohem_flutter_app/models/worklist/get_favorite_replacements_model.dart'; +import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/circular_avatar.dart'; +import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; + +class SearchEmployeeBottomSheet extends StatefulWidget { + int? notificationID; + String title, apiMode; + List? actionHistoryList; + Function(ReplacementList) onSelectEmployee; + + SearchEmployeeBottomSheet({required this.title, required this.apiMode, this.notificationID, this.actionHistoryList, required this.onSelectEmployee}); + + @override + State createState() => _SearchEmployeeBottomSheetState(); +} + +class _SearchEmployeeBottomSheetState extends State { + TextEditingController username = TextEditingController(); + String searchText = ""; + + List? optionsList = [ + LocaleKeys.fullName.tr(), + LocaleKeys.username.tr(), + LocaleKeys.endDate.tr(), + ]; + List? favUsersList; + + List? replacementList; + List? favouriteUserList; + List? nonFavouriteUserList; + + int _selectedSearchIndex = 0; + + void fetchUserByInput({bool isNeedLoading = true}) async { + try { + Utils.showLoading(context); + replacementList = await WorkListApiClient().searchUserByInput( + userName: _selectedSearchIndex == 0 ? searchText : "", + userId: _selectedSearchIndex == 1 ? searchText : "", + email: _selectedSearchIndex == 2 ? searchText : "", + ); + favouriteUserList = replacementList?.where((element) => element.isFavorite ?? false).toList(); + nonFavouriteUserList = replacementList?.where((element) => !(element.isFavorite ?? false)).toList(); + Utils.hideLoading(context); + setState(() {}); + } catch (e) { + Utils.hideLoading(context); + Utils.handleException(e, context, null); + } + + if (isNeedLoading) Utils.hideLoading(context); + setState(() {}); + return null; + } + + @override + Widget build(BuildContext context) { + return SizedBox( + width: double.infinity, + height: MediaQuery.of(context).size.height - 100, + child: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + widget.title.toText24(isBold: true), + 21.height, + "Search".toText16(), + 11.height, + Row( + children: [ + radioOption("Name", 0, _selectedSearchIndex), + radioOption("User Name", 1, _selectedSearchIndex), + radioOption("Email", 2, _selectedSearchIndex), + ], + ), + 14.height, + Row( + children: [ + DynamicTextFieldWidget( + "Search", + "Search By Username", + inputAction: TextInputAction.done, + suffixIconData: Icons.search, + onChange: (text) { + searchText = text; + setState(() {}); + }, + ).expanded, + IconButton( + constraints: const BoxConstraints(), + onPressed: () async { + await SystemChannels.textInput.invokeMethod('TextInput.hide'); + fetchUserByInput(); + }, + icon: Icon(Icons.search)) + ], + ), + if (replacementList != null) + replacementList!.isEmpty + ? Utils.getNoDataWidget(context).expanded + : ListView( + physics: const BouncingScrollPhysics(), + padding: EdgeInsets.only(top: 21, bottom: 8), + children: [ + if (favouriteUserList?.isNotEmpty ?? false) ...[ + "Favorites".toText16(), + 12.height, + ListView.separated( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (cxt, index) => employeeItemView(favouriteUserList![index]), + separatorBuilder: (cxt, index) => Container( + height: 1, + color: MyColors.borderE3Color, + ), + itemCount: favouriteUserList?.length ?? 0), + 12.height, + ], + if (nonFavouriteUserList?.isNotEmpty ?? false) ...[ + "Related".toText16(), + 12.height, + ListView.separated( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (cxt, index) => employeeItemView(nonFavouriteUserList![index]), + separatorBuilder: (cxt, index) => Container( + height: 1, + color: MyColors.borderE3Color, + ), + itemCount: nonFavouriteUserList?.length ?? 0), + ] + ], + ).expanded + ], + ).paddingOnly(left: 21, right: 21, bottom: 0, top: 21).expanded, + Container(width: double.infinity, height: 1, color: MyColors.lightGreyEFColor), + DefaultButton( + LocaleKeys.cancel.tr(), + () { + Navigator.pop(context); + }, + textColor: MyColors.grey3AColor, + colors: const [ + Color(0xffE6E6E6), + Color(0xffE6E6E6), + ], + ).insideContainer + ], + ), + ); + } + + Widget employeeItemView(ReplacementList replacement) { + return InkWell( + onTap: () { + Navigator.pop(context); + widget.onSelectEmployee(replacement); + }, + child: SizedBox( + height: 50, + child: Row( + children: [ + CircularAvatar( + url: replacement.employeeImage ?? "", + height: 30, + width: 30, + isImageBase64: true, + ), + 16.width, + Expanded( + child: (replacement.employeeDisplayName ?? "").toText12(), + ), + Icon(Icons.star, size: 16, color: replacement.isFavorite! ? MyColors.yellowFavColor : MyColors.borderCEColor), + ], + ), + ), + ); + } + + Widget radioOption(String title, int value, int groupValue) { + return Row( + children: [ + Container( + width: 24, + height: 24, + decoration: BoxDecoration( + color: Colors.transparent, + border: Border.all(color: MyColors.borderColor, width: 1), + borderRadius: const BorderRadius.all(Radius.circular(100)), + ), + padding: const EdgeInsets.all(4), + child: Container( + width: double.infinity, + height: double.infinity, + decoration: BoxDecoration( + color: value == groupValue ? MyColors.grey3AColor : Colors.transparent, + borderRadius: BorderRadius.all(const Radius.circular(100)), + ), + ), + ), + 9.width, + title.toText12(color: MyColors.grey57Color) + ], + ).onPress(() { + _selectedSearchIndex = value; + setState(() {}); + }).expanded; + } +} diff --git a/lib/widgets/dynamic_forms/dynamic_textfield_widget.dart b/lib/widgets/dynamic_forms/dynamic_textfield_widget.dart index c44be0d..398b746 100644 --- a/lib/widgets/dynamic_forms/dynamic_textfield_widget.dart +++ b/lib/widgets/dynamic_forms/dynamic_textfield_widget.dart @@ -8,6 +8,7 @@ class DynamicTextFieldWidget extends StatelessWidget { final VoidCallback? onTap; final IconData? suffixIconData; final bool isEnable; + final TextInputAction? inputAction; final bool isReadOnly; final bool isPopup; final int? lines; @@ -24,6 +25,7 @@ class DynamicTextFieldWidget extends StatelessWidget { this.isReadOnly = false, this.isPopup = false, this.lines = 1, + this.inputAction, this.onChange, this.isInputTypeNum = false, this.isBackgroundEnable = false}); @@ -62,6 +64,7 @@ class DynamicTextFieldWidget extends StatelessWidget { TextField( enabled: isEnable, scrollPadding: EdgeInsets.zero, readOnly: isReadOnly, + textInputAction: inputAction, keyboardType: isInputTypeNum ? TextInputType.number : TextInputType.text, //controller: controller, maxLines: lines, @@ -99,7 +102,7 @@ class DynamicTextFieldWidget extends StatelessWidget { ), ), if (isPopup) const Icon(Icons.keyboard_arrow_down_outlined, color: MyColors.darkIconColor), - if (onTap != null) Icon(suffixIconData ?? Icons.keyboard_arrow_down_outlined, color: MyColors.darkIconColor,size: 20), + if (onTap != null) Icon(suffixIconData ?? Icons.keyboard_arrow_down_outlined, color: MyColors.darkIconColor), ], ), ), From 3750f2c90455d65667de0a77a7289104b2370f28 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 23 Aug 2022 15:27:47 +0300 Subject: [PATCH 3/8] Vacation rule added complete. --- assets/langs/ar-SA.json | 1 + assets/langs/en-US.json | 1 + lib/api/vacation_rule_api_client.dart | 26 +- lib/extensions/widget_extensions.dart | 25 ++ lib/generated/locale_keys.g.dart | 1 + lib/models/generic_response_model.dart | 15 +- .../create_vacation_rule_list_model.dart | 18 + .../attendance/add_vacation_rule_screen.dart | 338 +++++++++++++++--- lib/ui/attendance/vacation_rule_screen.dart | 2 +- lib/widgets/dialogs/confirm_dialog.dart | 41 +-- 10 files changed, 389 insertions(+), 79 deletions(-) create mode 100644 lib/models/vacation_rule/create_vacation_rule_list_model.dart diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index ecedbdf..6821686 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -31,6 +31,7 @@ "viewAllServices": "عرض جميع الخدمات", "monthlyAttendance": "الحضور الشهري", "vacationRule": "حكم اجازة", + "vacationType": "نوع الاجازة", "startDateT": "تاريخ البدء", "endDateT": "تاريخ الانتهاء", "workFromHome": "العمل من المنزل", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 32a5e43..03ac050 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -31,6 +31,7 @@ "viewAllServices": "View All Services", "monthlyAttendance": "Monthly Attendance", "vacationRule": "Vacation Rule", + "vacationType": "Vacation Type", "startDateT": "Start Date", "endDateT": "End Date", "workFromHome": "Work From Home", diff --git a/lib/api/vacation_rule_api_client.dart b/lib/api/vacation_rule_api_client.dart index d144174..746116a 100644 --- a/lib/api/vacation_rule_api_client.dart +++ b/lib/api/vacation_rule_api_client.dart @@ -2,10 +2,10 @@ import 'package:mohem_flutter_app/api/api_client.dart'; 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/vacation_rule/create_vacation_rule_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/get_item_type_notifications_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/get_notification_reassign_mode_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/get_vacation_rules_list_model.dart'; -import 'package:mohem_flutter_app/models/vacation_rule/respond_attributes_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/vr_item_types_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/wf_look_up_list_model.dart'; @@ -56,13 +56,33 @@ class VacationRuleApiClient { }, url, postParams); } - Future> getRespondAttributes(String pItemType, String pNotificationName) async { + Future getRespondAttributes(String pItemType, String pNotificationName) async { String url = "${ApiConsts.erpRest}GET_RESPOND_ATTRIBUTES"; Map postParams = {"P_ITEM_TYPE": pItemType, "P_NOTIFICATION_NAME": pNotificationName}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel? responseData = GenericResponseModel.fromJson(json); - return responseData.respondAttributesList ?? []; + return responseData; + }, url, postParams); + } + + Future createVacationRule(String pBeginDate, String pEndDate, String pItemType, String pNotificationName, String pMessage, String pAction, String pReplacementUserName, + List> respondAttributeList) async { + String url = "${ApiConsts.erpRest}CREATE_VACATION_RULE"; + Map postParams = { + "P_ITEM_TYPE": pItemType, + "P_NOTIFICATION_NAME": pNotificationName, + "P_BEGIN_DATE": pBeginDate, + "P_END_DATE": pEndDate, + "P_MESSAGE": pMessage, + "P_REPLACEMENT_USER_NAME": pReplacementUserName, + "P_ACTION": pAction, + "RespondAttributeList": respondAttributeList, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.createVacationRuleList; }, url, postParams); } diff --git a/lib/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart index 247cde5..c9a4b49 100644 --- a/lib/extensions/widget_extensions.dart +++ b/lib/extensions/widget_extensions.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/widgets.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:shimmer/shimmer.dart'; @@ -67,4 +68,28 @@ extension WidgetExtensions on Widget { ), ); } + + Widget objectContainerBorderView({String title = "", String note = ""}) { + return Container( + padding: const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + border: Border.all( + color: MyColors.lightGreyEFColor, + width: 1, + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + if (title.isNotEmpty) title.toText16(), + if (title.isNotEmpty) 12.height, + this, + if (note.isNotEmpty) note.toText11(), + ], + ), + ); + } } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index eac063d..c37b5c8 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -32,6 +32,7 @@ abstract class LocaleKeys { static const viewAllServices = 'viewAllServices'; static const monthlyAttendance = 'monthlyAttendance'; static const vacationRule = 'vacationRule'; + static const vacationType = 'vacationType'; static const startDateT = 'startDateT'; static const endDateT = 'endDateT'; static const workFromHome = 'workFromHome'; diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 1260d80..e288d38 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -55,18 +55,19 @@ 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'; import 'package:mohem_flutter_app/models/profile/get_address_dff_structure_list.dart'; +import 'package:mohem_flutter_app/models/profile/get_contact_clos_structure_list.dart'; +import 'package:mohem_flutter_app/models/profile/get_contact_details_list.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'; import 'package:mohem_flutter_app/models/profile/submit_address_transaction.dart'; -import 'package:mohem_flutter_app/models/profile/get_contact_clos_structure_list.dart'; -import 'package:mohem_flutter_app/models/profile/get_contact_details_list.dart'; import 'package:mohem_flutter_app/models/profile/submit_basic_details_transaction_model.dart'; import 'package:mohem_flutter_app/models/profile/submit_contact_transaction_list_model.dart'; import 'package:mohem_flutter_app/models/start_eit_approval_process_model.dart'; import 'package:mohem_flutter_app/models/start_phone_approval_process_model.dart'; import 'package:mohem_flutter_app/models/submit_eit_transaction_list_model.dart'; import 'package:mohem_flutter_app/models/subordinates_on_leaves_model.dart'; +import 'package:mohem_flutter_app/models/vacation_rule/create_vacation_rule_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/get_item_type_notifications_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/get_notification_reassign_mode_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/get_vacation_rules_list_model.dart'; @@ -124,7 +125,7 @@ class GenericResponseModel { String? companyImageURL; String? companyMainCompany; List? countryList; - String? createVacationRuleList; + CreateVacationRuleList? createVacationRuleList; String? deleteAttachmentList; String? deleteVacationRuleList; String? disableSessionList; @@ -662,7 +663,8 @@ class GenericResponseModel { countryList!.add(new GetCountriesListModel.fromJson(v)); }); } - createVacationRuleList = json['CreateVacationRuleList']; + + createVacationRuleList = json['CreateVacationRuleList'] != null ? new CreateVacationRuleList.fromJson(json['CreateVacationRuleList']) : null; deleteAttachmentList = json['DeleteAttachmentList']; deleteVacationRuleList = json['DeleteVacationRuleList']; disableSessionList = json['DisableSessionList']; @@ -1299,7 +1301,10 @@ class GenericResponseModel { if (this.countryList != null) { data['CountryList'] = this.countryList!.map((v) => v.toJson()).toList(); } - data['CreateVacationRuleList'] = this.createVacationRuleList; + + if (this.createVacationRuleList != null) { + data['CreateVacationRuleList'] = this.createVacationRuleList!.toJson(); + } data['DeleteAttachmentList'] = this.deleteAttachmentList; data['DeleteVacationRuleList'] = this.deleteVacationRuleList; data['DisableSessionList'] = this.disableSessionList; diff --git a/lib/models/vacation_rule/create_vacation_rule_list_model.dart b/lib/models/vacation_rule/create_vacation_rule_list_model.dart new file mode 100644 index 0000000..5fd489a --- /dev/null +++ b/lib/models/vacation_rule/create_vacation_rule_list_model.dart @@ -0,0 +1,18 @@ +class CreateVacationRuleList { + String? pRETURNMSG; + String? pRETURNSTATUS; + + CreateVacationRuleList({this.pRETURNMSG, this.pRETURNSTATUS}); + + CreateVacationRuleList.fromJson(Map json) { + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + } + + Map toJson() { + final Map data = new Map(); + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + return data; + } +} \ No newline at end of file diff --git a/lib/ui/attendance/add_vacation_rule_screen.dart b/lib/ui/attendance/add_vacation_rule_screen.dart index a76e65a..51bf0d7 100644 --- a/lib/ui/attendance/add_vacation_rule_screen.dart +++ b/lib/ui/attendance/add_vacation_rule_screen.dart @@ -4,10 +4,15 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/vacation_rule_api_client.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/date_uitl.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/vacation_rule/create_vacation_rule_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/get_item_type_notifications_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/get_notification_reassign_mode_list_model.dart'; import 'package:mohem_flutter_app/models/vacation_rule/respond_attributes_list_model.dart'; @@ -18,6 +23,7 @@ import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; import 'package:mohem_flutter_app/widgets/bottom_sheets/search_employee_bottom_sheet.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart'; import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; @@ -41,11 +47,18 @@ class _AddVacationRuleScreenState extends State { GetNotificationReassignModeList? notificationReassignMode; List? respondAttributesList; + List? roleList = []; List? wfLookupList; ReplacementList? selectedReplacementEmployee; + String varcharInput = ""; + String numInput = ""; + DateTime? dateInput; + WFLookUpList? wfLook; + int currentStage = 0; + String message = ""; DateTime startTime = DateTime.now(); DateTime? endTime; @@ -89,14 +102,23 @@ class _AddVacationRuleScreenState extends State { List results = await Future.wait([ VacationRuleApiClient().getNotificationReassignMode(), VacationRuleApiClient().getRespondAttributes(selectedItemType!.iTEMTYPE!, selectedItemTypeNotification!.nOTIFICATIONNAME!), - // VacationRuleApiClient().getWfLookup(P_LOOKUP_TYPE), ]); notificationReassignModeList = results[0]; + GenericResponseModel respondAttribute = results[1]; + respondAttributesList = respondAttribute.respondAttributesList; + if (respondAttributesList?.isNotEmpty ?? false) { + int index = respondAttributesList!.indexWhere((element) => element.aTTRIBUTETYPE == "LOOKUP"); + if (index > -1) { + wfLookupList = await VacationRuleApiClient().getWfLookup(respondAttributesList![index].aTTRIBUTEFORMAT!); + } + } + roleList = respondAttribute.respondRolesList; + if (selectedItemType!.iTEMTYPE != "*") { notificationReassignModeList!.add( GetNotificationReassignModeList( rADIOBUTTONLABEL: "Deliver notifications to me regardless of any general rules", - rADIOBUTTONACTION: "deliver_notification", + rADIOBUTTONACTION: "DELIVER", // ionic: DELIVER rADIOBUTTONSEQ: 1, ), ); @@ -105,13 +127,25 @@ class _AddVacationRuleScreenState extends State { notificationReassignModeList!.add( GetNotificationReassignModeList( rADIOBUTTONLABEL: "Close", - rADIOBUTTONACTION: "close", + rADIOBUTTONACTION: "CLOSE", // ionic: CLOSE + rADIOBUTTONSEQ: 1, + ), + ); + } + if (respondAttributesList!.isNotEmpty && !(selectedItemTypeNotification!.fYIFLAG == "Y")) { + notificationReassignModeList!.add( + GetNotificationReassignModeList( + rADIOBUTTONLABEL: "Respond", + rADIOBUTTONACTION: "RESPOND", // ionic: RESPOND rADIOBUTTONSEQ: 1, ), ); } - respondAttributesList = results[1]; - // wfLookupList = results[2]; + + if (notificationReassignModeList!.isNotEmpty) { + notificationReassignMode = notificationReassignModeList!.first; + } + Utils.hideLoading(context); currentStage = 3; setState(() {}); @@ -121,6 +155,111 @@ class _AddVacationRuleScreenState extends State { } } + List getDynamicWidgetList() { + List respondAttributesWidgetList = []; + for (int i = 0; i < respondAttributesList!.length; i++) { + if (respondAttributesList![i].aTTRIBUTETYPE == "VARCHAR2") { + respondAttributesWidgetList.add( + DynamicTextFieldWidget(respondAttributesList![i].aTTRIBUTEDISPLAYNAME!, respondAttributesList![i].aTTRIBUTENAME!, onChange: (message) { + varcharInput = message; + }).paddingOnly(bottom: 12), + ); + } else if (respondAttributesList![i].aTTRIBUTETYPE == "LOOKUP") { + respondAttributesWidgetList.add( + PopupMenuButton( + child: DynamicTextFieldWidget( + respondAttributesList![i].aTTRIBUTEDISPLAYNAME!, + wfLook?.lOOKUPMEANING ?? respondAttributesList![i].aTTRIBUTENAME!, + isEnable: false, + isPopup: true, + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + for (int i = 0; i < wfLookupList!.length; i++) PopupMenuItem(value: i, child: Text(wfLookupList![i].lOOKUPMEANING!)), + ], + onSelected: (int popupIndex) { + wfLook = wfLookupList![popupIndex]; + setState(() {}); + }, + ), + ); + } else if (respondAttributesList![i].aTTRIBUTETYPE == "DATE") { + respondAttributesWidgetList.add(DynamicTextFieldWidget( + respondAttributesList![i].aTTRIBUTEDISPLAYNAME!, + dateInput?.toString() ?? respondAttributesList![i].aTTRIBUTENAME!, + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + dateInput = await _selectDate(context); + setState(() {}); + }, + ).paddingOnly(bottom: 12)); + } else if (respondAttributesList![i].aTTRIBUTETYPE == "NUMBER") { + respondAttributesWidgetList.add( + DynamicTextFieldWidget( + respondAttributesList![i].aTTRIBUTEDISPLAYNAME!, + respondAttributesList![i].aTTRIBUTENAME!, + isInputTypeNum: true, + onChange: (input) { + numInput = input; + }, + ), + ); + } + } + return respondAttributesWidgetList; + } + + void createVacationRule(List> respondAttributeList) async { + try { + Utils.showLoading(context); + CreateVacationRuleList? createVacationRuleList = await VacationRuleApiClient().createVacationRule(DateUtil.convertDateToStringLocation(startTime), DateUtil.convertDateToStringLocation(endTime!), + selectedItemType!.iTEMTYPE!, selectedItemTypeNotification!.nOTIFICATIONNAME!, message, getPAction(), selectedReplacementEmployee!.userName!, respondAttributeList); + Utils.hideLoading(context); + Utils.showToast("Vacation rule added."); + Navigator.popUntil(context, ModalRoute.withName('AppRoutes.dashboard')); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + String getPAction() { + String pAction = ""; + switch (notificationReassignMode?.rADIOBUTTONACTION ?? "") { + case 'DELEGATE': + { + pAction = "FORWARD"; + break; + } + case 'RESPOND': + { + pAction = "RESPOND"; + break; + } + case 'CLOSE': + { + pAction = "RESPOND"; + break; + } + case 'DELIVER': + { + pAction = "NOOP"; + break; + } + case 'TRANSFER': + { + pAction = "TRANSFER"; + break; + } + default: + { + pAction = ""; + break; + } + } + return pAction; + } + @override void dispose() { super.dispose(); @@ -132,7 +271,7 @@ class _AddVacationRuleScreenState extends State { backgroundColor: Colors.white, appBar: AppBarWidget( context, - title: LocaleKeys.vacationRule.tr(), // todo @Sikander change title to 'Vacation Type' + title: LocaleKeys.vacationType.tr(), ), body: vrItemTypesList == null ? const SizedBox() @@ -233,46 +372,75 @@ class _AddVacationRuleScreenState extends State { "Message", "Write a message", lines: 2, - onChange: (message) {}, - // isEnable: false, - // isPopup: true, - ).paddingOnly(bottom: 12), - PopupMenuButton( - child: DynamicTextFieldWidget( - "Notification Reassign", - notificationReassignMode == null ? "Select Notification" : notificationReassignMode!.rADIOBUTTONLABEL ?? "", - isEnable: false, - isPopup: true, - ).paddingOnly(bottom: 12), - itemBuilder: (_) => >[ - for (int i = 0; i < notificationReassignModeList!.length; i++) PopupMenuItem(value: i, child: Text(notificationReassignModeList![i].rADIOBUTTONLABEL!)), - ], - onSelected: (int popupIndex) { - if (notificationReassignMode == notificationReassignModeList![popupIndex]) { - return; - } - notificationReassignMode = notificationReassignModeList![popupIndex]; - setState(() {}); - }), - DynamicTextFieldWidget( - "Select Employee", - selectedReplacementEmployee == null ? "Search employee for replacement" : selectedReplacementEmployee!.employeeDisplayName ?? "", - isEnable: false, - onTap: () { - showMyBottomSheet( - context, - child: SearchEmployeeBottomSheet( - title: "Search for Employee", - apiMode: "DELEGATE", - onSelectEmployee: (_selectedEmployee) { - // Navigator.pop(context); - selectedReplacementEmployee = _selectedEmployee; - setState(() {}); - }, - ), - ); + onChange: (message) { + this.message = message; }, ).paddingOnly(bottom: 12), + ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + padding: EdgeInsets.zero, + itemBuilder: (cxt, index) { + return Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.transparent, + border: Border.all(color: MyColors.borderColor, width: 1), + borderRadius: const BorderRadius.all(Radius.circular(100)), + ), + padding: const EdgeInsets.all(4), + child: Container( + width: double.infinity, + height: double.infinity, + decoration: BoxDecoration( + color: notificationReassignModeList![index] == notificationReassignMode ? MyColors.grey3AColor : Colors.transparent, + borderRadius: BorderRadius.all(const Radius.circular(100)), + ), + ), + ), + 9.width, + (notificationReassignModeList![index].rADIOBUTTONLABEL!).toText12(color: MyColors.grey57Color).expanded + ], + ).onPress(() { + if (notificationReassignMode == notificationReassignModeList![index]) { + return; + } + notificationReassignMode = notificationReassignModeList![index]; + setState(() {}); + }); + }, + separatorBuilder: (cxt, index) => 12.height, + itemCount: notificationReassignModeList!.length) + .objectContainerBorderView(title: "Notification Reassign"), + 12.height, + if (respondAttributesList?.isNotEmpty ?? false) ...getDynamicWidgetList(), + if (roleList!.isNotEmpty && notificationReassignMode?.rADIOBUTTONACTION == 'RESPOND' || + // if (notificationReassignMode?.rADIOBUTTONACTION == 'RESPOND' || + (notificationReassignMode?.rADIOBUTTONACTION == 'DELEGATE') || + (notificationReassignMode?.rADIOBUTTONACTION == 'TRANSFER')) + DynamicTextFieldWidget( + "Select Employee", + selectedReplacementEmployee == null ? "Search employee for replacement" : selectedReplacementEmployee!.employeeDisplayName ?? "", + isEnable: false, + onTap: () { + showMyBottomSheet( + context, + child: SearchEmployeeBottomSheet( + title: "Search for Employee", + apiMode: "DELEGATE", + onSelectEmployee: (_selectedEmployee) { + // Navigator.pop(context); + selectedReplacementEmployee = _selectedEmployee; + setState(() {}); + }, + ), + ); + }, + ).paddingOnly(bottom: 12), ], ).objectContainerView(title: "Step 3") ] @@ -283,11 +451,54 @@ class _AddVacationRuleScreenState extends State { currentStage != 3 ? null : () { - if (currentStage == 1) { - getItemTypeNotificationsList(); - } else if (currentStage == 2) { - callCombineApis(); + if (endTime == null) { + Utils.showToast("Please specify End Time"); + return; + } else if (notificationReassignMode == null) { + Utils.showToast("Please select notification reassign"); + return; + } else if (selectedReplacementEmployee == null) { + Utils.showToast("Please select employee for replacement"); + return; } + + List> list = []; + + if (respondAttributesList?.isNotEmpty ?? false) { + for (int i = 0; i < respondAttributesList!.length; i++) { + if (respondAttributesList![i].aTTRIBUTETYPE == "VARCHAR2") { + list.add({"ATTRIBUTE_NAME": respondAttributesList![i].aTTRIBUTENAME, "ATTRIBUTE_TEXT_VALUE": varcharInput}); + } + if (respondAttributesList![i].aTTRIBUTETYPE == "LOOKUP") { + if (wfLook == null) { + Utils.showToast('Please select action'); + break; + } + list.add({"ATTRIBUTE_NAME": respondAttributesList![i].aTTRIBUTENAME, "ATTRIBUTE_TEXT_VALUE": wfLook!.lOOKUPCODE}); + } + if (respondAttributesList![i].aTTRIBUTETYPE == "DATE") { + if (dateInput == null) { + Utils.showToast('Please select date'); + break; + } + list.add({"ATTRIBUTE_NAME": respondAttributesList![i].aTTRIBUTENAME, "ATTRIBUTE_TEXT_VALUE": DateUtil.convertDateToStringLocation(dateInput!)}); + } + if (respondAttributesList![i].aTTRIBUTETYPE == "NUMBER") { + list.add({"ATTRIBUTE_NAME": respondAttributesList![i].aTTRIBUTENAME, "ATTRIBUTE_TEXT_VALUE": numInput}); + } + } + } + + showDialog( + context: context, + builder: (cxt) => ConfirmDialog( + message: LocaleKeys.areYouSureYouWantToSubmit.tr(), + onTap: () { + Navigator.pop(context); + createVacationRule(list); + }, + ), + ); }, ).insideContainer, ], @@ -338,4 +549,35 @@ class _AddVacationRuleScreenState extends State { if (_time == null) return "Select date and time"; return DateFormat("MM/dd/yyyy hh:mm:ss a").format(_time); } + + Future _selectDate(BuildContext context) async { + DateTime time = dateInput ?? DateTime.now(); + if (Platform.isIOS) { + await showCupertinoModalPopup( + context: context, + builder: (cxt) => Container( + height: 250, + color: Colors.white, + child: CupertinoDatePicker( + backgroundColor: Colors.white, + mode: CupertinoDatePickerMode.date, + onDateTimeChanged: (value) { + if (value != null && value != dateInput) { + time = value; + } + }, + initialDateTime: dateInput, + ), + ), + ); + } else { + final DateTime? picked = + await showDatePicker(context: context, initialDate: dateInput ?? DateTime.now(), initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + if (picked != null && picked != dateInput) { + time = picked; + } + } + time = DateTime(time.year, time.month, time.day); + return time; + } } diff --git a/lib/ui/attendance/vacation_rule_screen.dart b/lib/ui/attendance/vacation_rule_screen.dart index a2aa5df..5598e05 100644 --- a/lib/ui/attendance/vacation_rule_screen.dart +++ b/lib/ui/attendance/vacation_rule_screen.dart @@ -140,7 +140,7 @@ class _VacationRuleScreenState extends State { } String getParsedTime(String time) { - DateTime date = DateFormat("mm/dd/yyyy").parse(time); + DateTime date = DateFormat("MM/dd/yyyy").parse(time); return DateFormat("d MMM yyyy").format(date); } } diff --git a/lib/widgets/dialogs/confirm_dialog.dart b/lib/widgets/dialogs/confirm_dialog.dart index 7264a9b..4c94340 100644 --- a/lib/widgets/dialogs/confirm_dialog.dart +++ b/lib/widgets/dialogs/confirm_dialog.dart @@ -1,25 +1,28 @@ import 'package:easy_localization/src/public_ext.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.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/button/default_button.dart'; class ConfirmDialog extends StatelessWidget { final String? title; - final String? message; + final String message; final String? okTitle; final VoidCallback? onTap; - const ConfirmDialog({Key? key, this.title, @required this.message, this.okTitle, this.onTap}) : super(key: key); + const ConfirmDialog({Key? key, this.title, required this.message, this.okTitle, this.onTap}) : super(key: key); @override Widget build(BuildContext context) { return Dialog( backgroundColor: Colors.white, - shape: RoundedRectangleBorder(), - insetPadding: EdgeInsets.only(left: 21, right: 21), + shape: const RoundedRectangleBorder(), + insetPadding: const EdgeInsets.only(left: 21, right: 21), child: Padding( - padding: EdgeInsets.only(left: 20, right: 20, top: 18, bottom: 28), + padding: const EdgeInsets.only(left: 20, right: 20, top: 18, bottom: 28), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, @@ -28,33 +31,27 @@ class ConfirmDialog extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( - child: Padding( - padding: const EdgeInsets.only(top: 16.0), - child: Text( - title ?? LocaleKeys.confirm.tr(), - style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Color(0xff2B353E), height: 35 / 24, letterSpacing: -0.96), - ), - ), + child: Text( + title ?? LocaleKeys.confirm.tr(), + style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, height: 35 / 24, letterSpacing: -0.96), + ).paddingOnly(top: 16), ), IconButton( padding: EdgeInsets.zero, - icon: Icon(Icons.close), - color: Color(0xff2B353E), - constraints: BoxConstraints(), + icon: const Icon(Icons.close), + color: MyColors.darkTextColor, + constraints: const BoxConstraints(), onPressed: () { Navigator.pop(context); }, ) ], ), - Text( - message ?? "", - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff808080), letterSpacing: -0.48), - ), - SizedBox(height: 28), + message.toText16(color: MyColors.lightGrayColor), + 28.height, DefaultButton( okTitle ?? LocaleKeys.ok.tr(), - onTap == null ? () => Navigator.pop(context) : onTap, + onTap ?? () => Navigator.pop(context), textColor: Colors.white, //color: Ap.green, ), From 14047154255ed3d128c05134f179099f2a967d00 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 23 Aug 2022 16:11:52 +0300 Subject: [PATCH 4/8] Vacation rule translation added. --- assets/langs/ar-SA.json | 31 +++++++++-- assets/langs/en-US.json | 31 +++++++++-- lib/generated/codegen_loader.g.dart | 54 +++++++++++++++++++ lib/generated/locale_keys.g.dart | 23 ++++++++ .../attendance/add_vacation_rule_screen.dart | 53 +++++++++--------- 5 files changed, 157 insertions(+), 35 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 6821686..0c6ce54 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -311,11 +311,34 @@ "requestType": "نوع الطلب", "employeeDigitalID": "هويةالموظف الرقمية", "businessCard": "بطاقة العمل", - "checkOut":"وقت الخروج", - "regular":"منتظم", - "mark" : "علامة", - "selectMethodOfAttendance":"اختر طريقة تسجيل الحضور", + "checkOut": "وقت الخروج", + "regular": "منتظم", + "mark": "علامة", + "selectMethodOfAttendance": "اختر طريقة تسجيل الحضور", "comeNearHMGWifi": "HMG wifi من فضلك اقترب من", + "deliverNotificationToMeRegardless": "تسليم الإخطارات إلي بغض النظر عن أي قواعد عامة", + "close": "أغلق", + "respond": "يرد", + "vacationRuleAdded": "تمت إضافة قاعدة الإجازة", + "selectTypeT": "اختر صنف", + "notification": "تنبيه", + "selectNotification": "حدد إعلام", + "ifAllSelectedYouWillSkip": "* إذا تم تحديد الكل ، فستنتقل إلى الخطوة 3", + "applyForVacationRule": "التقدم بطلب للحصول على قانون الإجازة", + "step1": "الخطوة 1", + "step2": "الخطوة 2", + "step3": "الخطوه 3", + "message": "رسالة", + "writeAMessage": "اكتب رسالة", + "notificationReassign": "إعادة تعيين الإخطار", + "selectEmployee": "حدد الموظف", + "searchEmployeeForReplacement": "ابحث عن موظف بديل", + "searchForEmployee": "ابحث عن موظف", + "pleaseSpecifyEndTime": "الرجاء تحديد وقت الانتهاء", + "pleaseSelectNotificationReassign": "يرجى تحديد إعادة تعيين الإخطار", + "pleaseSelectEmployeeForReplacement": "الرجاء تحديد موظف للاستبدال", + "pleaseSelectAction": "الرجاء تحديد الإجراء", + "pleaseSelectDate": "الرجاء تحديد التاريخ", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 03ac050..812fa49 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -311,11 +311,34 @@ "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", + "selectMethodOfAttendance": "Select the method to mark the attendance", "comeNearHMGWifi": "Please come near to HMG wifi", + "deliverNotificationToMeRegardless": "Deliver notifications to me regardless of any general rules", + "close": "Close", + "respond": "Respond", + "vacationRuleAdded": "Vacation rule added", + "selectTypeT": "Select Type", + "notification": "Notification", + "selectNotification": "Select Notification", + "ifAllSelectedYouWillSkip": "*If All is selected, you will skip to step 3", + "applyForVacationRule": "Apply for Vacation Rule", + "step1": "Step 1", + "step2": "Step 2", + "step3": "Step 3", + "message": "Message", + "writeAMessage": "Write a message", + "notificationReassign": "Notification Reassign", + "selectEmployee": "Select Employee", + "searchEmployeeForReplacement": "Search employee for replacement", + "searchForEmployee": "Search for Employee", + "pleaseSpecifyEndTime": "Please specify End Time", + "pleaseSelectNotificationReassign": "Please select notification reassign", + "pleaseSelectEmployeeForReplacement": "Please select employee for replacement", + "pleaseSelectAction": "Please select action", + "pleaseSelectDate": "Please select date", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 2fa8d35..57323da 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -47,6 +47,9 @@ class CodegenLoader extends AssetLoader{ "viewAllServices": "عرض جميع الخدمات", "monthlyAttendance": "الحضور الشهري", "vacationRule": "حكم اجازة", + "vacationType": "نوع الاجازة", + "startDateT": "تاريخ البدء", + "endDateT": "تاريخ الانتهاء", "workFromHome": "العمل من المنزل", "ticketRequest": "طلب تذكرة", "viewAllOffers": "مشاهدة جميع العروض", @@ -248,6 +251,7 @@ class CodegenLoader extends AssetLoader{ "myAttendance": "حضوري", "workOnBreak": "التعويض عن العمل اثناءالاستراحه", "next": "التالي", + "apply": "يتقدم", "mobile": "التليفون المحمول", "completingYear": "نحن نقدر لك لاستكمال خدمة", "year": "سنة", @@ -328,6 +332,29 @@ class CodegenLoader extends AssetLoader{ "mark": "علامة", "selectMethodOfAttendance": "اختر طريقة تسجيل الحضور", "comeNearHMGWifi": "HMG wifi من فضلك اقترب من", + "deliverNotificationToMeRegardless": "تسليم الإخطارات إلي بغض النظر عن أي قواعد عامة", + "close": "أغلق", + "respond": "يرد", + "vacationRuleAdded": "تمت إضافة قاعدة الإجازة", + "selectTypeT": "اختر صنف", + "notification": "تنبيه", + "selectNotification": "حدد إعلام", + "ifAllSelectedYouWillSkip": "* إذا تم تحديد الكل ، فستنتقل إلى الخطوة 3", + "applyForVacationRule": "التقدم بطلب للحصول على قانون الإجازة", + "step1": "الخطوة 1", + "step2": "الخطوة 2", + "step3": "الخطوه 3", + "message": "رسالة", + "writeAMessage": "اكتب رسالة", + "notificationReassign": "إعادة تعيين الإخطار", + "selectEmployee": "حدد الموظف", + "searchEmployeeForReplacement": "ابحث عن موظف بديل", + "searchForEmployee": "ابحث عن موظف", + "pleaseSpecifyEndTime": "الرجاء تحديد وقت الانتهاء", + "pleaseSelectNotificationReassign": "يرجى تحديد إعادة تعيين الإخطار", + "pleaseSelectEmployeeForReplacement": "الرجاء تحديد موظف للاستبدال", + "pleaseSelectAction": "الرجاء تحديد الإجراء", + "pleaseSelectDate": "الرجاء تحديد التاريخ", "profile": { "reset_password": { "label": "Reset Password", @@ -395,6 +422,9 @@ static const Map en_US = { "viewAllServices": "View All Services", "monthlyAttendance": "Monthly Attendance", "vacationRule": "Vacation Rule", + "vacationType": "Vacation Type", + "startDateT": "Start Date", + "endDateT": "End Date", "workFromHome": "Work From Home", "ticketRequest": "Ticket Request", "viewAllOffers": "View All Offers", @@ -596,6 +626,7 @@ static const Map en_US = { "myAttendance": "My Attendance", "workOnBreak": "Work On Break", "next": "Next", + "apply": "Apply", "mobile": "Mobile", "year": "Year", "month": "Month", @@ -676,6 +707,29 @@ static const Map en_US = { "mark": "Mark", "selectMethodOfAttendance": "Select the method to mark the attendance", "comeNearHMGWifi": "Please come near to HMG wifi", + "deliverNotificationToMeRegardless": "Deliver notifications to me regardless of any general rules", + "close": "Close", + "respond": "Respond", + "vacationRuleAdded": "Vacation rule added", + "selectTypeT": "Select Type", + "notification": "Notification", + "selectNotification": "Select Notification", + "ifAllSelectedYouWillSkip": "*If All is selected, you will skip to step 3", + "applyForVacationRule": "Apply for Vacation Rule", + "step1": "Step 1", + "step2": "Step 2", + "step3": "Step 3", + "message": "Message", + "writeAMessage": "Write a message", + "notificationReassign": "Notification Reassign", + "selectEmployee": "Select Employee", + "searchEmployeeForReplacement": "Search employee for replacement", + "searchForEmployee": "Search for Employee", + "pleaseSpecifyEndTime": "Please specify End Time", + "pleaseSelectNotificationReassign": "Please select notification reassign", + "pleaseSelectEmployeeForReplacement": "Please select employee for replacement", + "pleaseSelectAction": "Please select action", + "pleaseSelectDate": "Please select date", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index c37b5c8..d736c34 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -317,6 +317,29 @@ abstract class LocaleKeys { static const mark = 'mark'; static const selectMethodOfAttendance = 'selectMethodOfAttendance'; static const comeNearHMGWifi = 'comeNearHMGWifi'; + static const deliverNotificationToMeRegardless = 'deliverNotificationToMeRegardless'; + static const close = 'close'; + static const respond = 'respond'; + static const vacationRuleAdded = 'vacationRuleAdded'; + static const selectTypeT = 'selectTypeT'; + static const notification = 'notification'; + static const selectNotification = 'selectNotification'; + static const ifAllSelectedYouWillSkip = 'ifAllSelectedYouWillSkip'; + static const applyForVacationRule = 'applyForVacationRule'; + static const step1 = 'step1'; + static const step2 = 'step2'; + static const step3 = 'step3'; + static const message = 'message'; + static const writeAMessage = 'writeAMessage'; + static const notificationReassign = 'notificationReassign'; + static const selectEmployee = 'selectEmployee'; + static const searchEmployeeForReplacement = 'searchEmployeeForReplacement'; + static const searchForEmployee = 'searchForEmployee'; + static const pleaseSpecifyEndTime = 'pleaseSpecifyEndTime'; + static const pleaseSelectNotificationReassign = 'pleaseSelectNotificationReassign'; + static const pleaseSelectEmployeeForReplacement = 'pleaseSelectEmployeeForReplacement'; + static const pleaseSelectAction = 'pleaseSelectAction'; + static const pleaseSelectDate = 'pleaseSelectDate'; 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'; diff --git a/lib/ui/attendance/add_vacation_rule_screen.dart b/lib/ui/attendance/add_vacation_rule_screen.dart index 51bf0d7..b7f7f5d 100644 --- a/lib/ui/attendance/add_vacation_rule_screen.dart +++ b/lib/ui/attendance/add_vacation_rule_screen.dart @@ -7,6 +7,7 @@ import 'package:mohem_flutter_app/api/vacation_rule_api_client.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/date_uitl.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; @@ -117,7 +118,7 @@ class _AddVacationRuleScreenState extends State { if (selectedItemType!.iTEMTYPE != "*") { notificationReassignModeList!.add( GetNotificationReassignModeList( - rADIOBUTTONLABEL: "Deliver notifications to me regardless of any general rules", + rADIOBUTTONLABEL: LocaleKeys.deliverNotificationToMeRegardless.tr(), rADIOBUTTONACTION: "DELIVER", // ionic: DELIVER rADIOBUTTONSEQ: 1, ), @@ -126,7 +127,7 @@ class _AddVacationRuleScreenState extends State { if (selectedItemTypeNotification!.fYIFLAG == "Y") { notificationReassignModeList!.add( GetNotificationReassignModeList( - rADIOBUTTONLABEL: "Close", + rADIOBUTTONLABEL: LocaleKeys.close.tr(), rADIOBUTTONACTION: "CLOSE", // ionic: CLOSE rADIOBUTTONSEQ: 1, ), @@ -135,7 +136,7 @@ class _AddVacationRuleScreenState extends State { if (respondAttributesList!.isNotEmpty && !(selectedItemTypeNotification!.fYIFLAG == "Y")) { notificationReassignModeList!.add( GetNotificationReassignModeList( - rADIOBUTTONLABEL: "Respond", + rADIOBUTTONLABEL: LocaleKeys.respond.tr(), rADIOBUTTONACTION: "RESPOND", // ionic: RESPOND rADIOBUTTONSEQ: 1, ), @@ -215,8 +216,8 @@ class _AddVacationRuleScreenState extends State { CreateVacationRuleList? createVacationRuleList = await VacationRuleApiClient().createVacationRule(DateUtil.convertDateToStringLocation(startTime), DateUtil.convertDateToStringLocation(endTime!), selectedItemType!.iTEMTYPE!, selectedItemTypeNotification!.nOTIFICATIONNAME!, message, getPAction(), selectedReplacementEmployee!.userName!, respondAttributeList); Utils.hideLoading(context); - Utils.showToast("Vacation rule added."); - Navigator.popUntil(context, ModalRoute.withName('AppRoutes.dashboard')); + Utils.showToast("Vacation rule added"); + Navigator.popUntil(context, ModalRoute.withName(AppRoutes.dashboard)); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); @@ -287,7 +288,7 @@ class _AddVacationRuleScreenState extends State { PopupMenuButton( child: DynamicTextFieldWidget( LocaleKeys.itemType.tr(), - selectedItemType == null ? "Select Type" : selectedItemType!.iTEMTYPEDISPLAYNAME!, + selectedItemType == null ? LocaleKeys.selectType.tr() : selectedItemType!.iTEMTYPEDISPLAYNAME!, isEnable: false, isPopup: true, ).paddingOnly(bottom: 12), @@ -310,13 +311,13 @@ class _AddVacationRuleScreenState extends State { notificationReassignMode = null; getItemTypeNotificationsList(); } - }).objectContainerView(title: "Apply for Vacation Rule\nStep 1", note: "*If All is selected, you will skip to step 3"), + }).objectContainerView(title: "${LocaleKeys.applyForVacationRule.tr()}\n${LocaleKeys.step1.tr()}", note: LocaleKeys.ifAllSelectedYouWillSkip.tr()), if ((itemTypeNotificationsList ?? []).isNotEmpty) ...[ 12.height, PopupMenuButton( child: DynamicTextFieldWidget( "Notification", - selectedItemTypeNotification == null ? "Select Notification" : selectedItemTypeNotification!.nOTIFICATIONDISPLAYNAME!, + selectedItemTypeNotification == null ? LocaleKeys.selectNotification.tr() : selectedItemTypeNotification!.nOTIFICATIONDISPLAYNAME!, isEnable: false, isPopup: true, ).paddingOnly(bottom: 12), @@ -331,17 +332,17 @@ class _AddVacationRuleScreenState extends State { notificationReassignMode = null; setState(() {}); callCombineApis(); - }).objectContainerView(title: "Step 2") + }).objectContainerView(title: LocaleKeys.step2.tr()) ], if (selectedItemType != null && selectedItemTypeNotification != null && currentStage == 3) ...[ 12.height, Column( children: [ ItemDetailView(LocaleKeys.itemType.tr(), selectedItemType!.iTEMTYPEDISPLAYNAME!), - ItemDetailView("Notification", selectedItemTypeNotification!.nOTIFICATIONDISPLAYNAME!), + ItemDetailView(LocaleKeys.notification.tr(), selectedItemTypeNotification!.nOTIFICATIONDISPLAYNAME!), 12.height, DynamicTextFieldWidget( - "Start Date", + LocaleKeys.startDateT.tr(), formattedDate(startTime), suffixIconData: Icons.calendar_today, isEnable: false, @@ -355,7 +356,7 @@ class _AddVacationRuleScreenState extends State { ), 12.height, DynamicTextFieldWidget( - "End Date", + LocaleKeys.endDateT.tr(), formattedDate(endTime), suffixIconData: Icons.calendar_today, isEnable: false, @@ -369,8 +370,8 @@ class _AddVacationRuleScreenState extends State { ), 12.height, DynamicTextFieldWidget( - "Message", - "Write a message", + LocaleKeys.message.tr(), + LocaleKeys.writeAMessage.tr(), lines: 2, onChange: (message) { this.message = message; @@ -415,7 +416,7 @@ class _AddVacationRuleScreenState extends State { }, separatorBuilder: (cxt, index) => 12.height, itemCount: notificationReassignModeList!.length) - .objectContainerBorderView(title: "Notification Reassign"), + .objectContainerBorderView(title: LocaleKeys.notificationReassign.tr()), 12.height, if (respondAttributesList?.isNotEmpty ?? false) ...getDynamicWidgetList(), if (roleList!.isNotEmpty && notificationReassignMode?.rADIOBUTTONACTION == 'RESPOND' || @@ -423,15 +424,15 @@ class _AddVacationRuleScreenState extends State { (notificationReassignMode?.rADIOBUTTONACTION == 'DELEGATE') || (notificationReassignMode?.rADIOBUTTONACTION == 'TRANSFER')) DynamicTextFieldWidget( - "Select Employee", - selectedReplacementEmployee == null ? "Search employee for replacement" : selectedReplacementEmployee!.employeeDisplayName ?? "", + LocaleKeys.selectEmployee.tr(), + selectedReplacementEmployee == null ? LocaleKeys.searchEmployeeForReplacement.tr() : selectedReplacementEmployee!.employeeDisplayName ?? "", isEnable: false, onTap: () { showMyBottomSheet( context, child: SearchEmployeeBottomSheet( - title: "Search for Employee", - apiMode: "DELEGATE", + title: LocaleKeys.searchForEmployee.tr(), + apiMode: LocaleKeys.delegate.tr(), onSelectEmployee: (_selectedEmployee) { // Navigator.pop(context); selectedReplacementEmployee = _selectedEmployee; @@ -442,7 +443,7 @@ class _AddVacationRuleScreenState extends State { }, ).paddingOnly(bottom: 12), ], - ).objectContainerView(title: "Step 3") + ).objectContainerView(title: LocaleKeys.step3.tr()) ] ], ).expanded, @@ -452,18 +453,16 @@ class _AddVacationRuleScreenState extends State { ? null : () { if (endTime == null) { - Utils.showToast("Please specify End Time"); + Utils.showToast(LocaleKeys.pleaseSpecifyEndTime.tr()); return; } else if (notificationReassignMode == null) { - Utils.showToast("Please select notification reassign"); + Utils.showToast(LocaleKeys.pleaseSelectNotificationReassign.tr()); return; } else if (selectedReplacementEmployee == null) { - Utils.showToast("Please select employee for replacement"); + Utils.showToast(LocaleKeys.pleaseSelectEmployeeForReplacement.tr()); return; } - List> list = []; - if (respondAttributesList?.isNotEmpty ?? false) { for (int i = 0; i < respondAttributesList!.length; i++) { if (respondAttributesList![i].aTTRIBUTETYPE == "VARCHAR2") { @@ -471,14 +470,14 @@ class _AddVacationRuleScreenState extends State { } if (respondAttributesList![i].aTTRIBUTETYPE == "LOOKUP") { if (wfLook == null) { - Utils.showToast('Please select action'); + Utils.showToast(LocaleKeys.pleaseSelectAction.tr()); break; } list.add({"ATTRIBUTE_NAME": respondAttributesList![i].aTTRIBUTENAME, "ATTRIBUTE_TEXT_VALUE": wfLook!.lOOKUPCODE}); } if (respondAttributesList![i].aTTRIBUTETYPE == "DATE") { if (dateInput == null) { - Utils.showToast('Please select date'); + Utils.showToast(LocaleKeys.pleaseSelectDate.tr()); break; } list.add({"ATTRIBUTE_NAME": respondAttributesList![i].aTTRIBUTENAME, "ATTRIBUTE_TEXT_VALUE": DateUtil.convertDateToStringLocation(dateInput!)}); From 18084ce29fef54032bbedc54e579ee8d5c8ca18c Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 23 Aug 2022 16:49:40 +0300 Subject: [PATCH 5/8] services menu structure improvements. --- lib/config/routes.dart | 6 ++-- lib/ui/landing/widget/services_widget.dart | 3 +- ...en.dart => services_menu_list_screen.dart} | 28 +++++++++++-------- 3 files changed, 22 insertions(+), 15 deletions(-) rename lib/ui/my_attendance/{my_attendance_screen.dart => services_menu_list_screen.dart} (67%) diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 9285671..61cf8aa 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -13,7 +13,7 @@ import 'package:mohem_flutter_app/ui/login/verify_login_screen.dart'; import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; -import 'package:mohem_flutter_app/ui/my_attendance/my_attendance_screen.dart'; +import 'package:mohem_flutter_app/ui/my_attendance/services_menu_list_screen.dart'; import 'package:mohem_flutter_app/ui/payslip/monthly_pay_slip_screen.dart'; import 'package:mohem_flutter_app/ui/profile/add_update_family_member.dart'; import 'package:mohem_flutter_app/ui/profile/basic_details.dart'; @@ -61,7 +61,7 @@ class AppRoutes { static const String itgDetail = "/itgDetail"; static const String itemHistory = "/itemHistory"; - static const String myAttendance = "/myAttendance"; + static const String servicesMenuListScreen = "/servicesMenuListScreen"; static const String dynamicScreen = "/dynamicScreen"; static const String addDynamicInput = "/addDynamicInput"; static const String requestSubmitScreen = "/requestSubmitScreen"; @@ -124,7 +124,7 @@ class AppRoutes { itgDetail: (context) => ItgDetailScreen(), itemHistory: (context) => ItemHistoryScreen(), - myAttendance: (context) => MyAttendanceScreen(), + servicesMenuListScreen: (context) => ServicesMenuListScreen(), // workFromHome: (context) => WorkFromHomeScreen(), // addWorkFromHome: (context) => AddWorkFromHomeScreen(), profile: (context) => ProfileScreen(), diff --git a/lib/ui/landing/widget/services_widget.dart b/lib/ui/landing/widget/services_widget.dart index e99205b..868ca5e 100644 --- a/lib/ui/landing/widget/services_widget.dart +++ b/lib/ui/landing/widget/services_widget.dart @@ -9,6 +9,7 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; +import 'package:mohem_flutter_app/ui/my_attendance/services_menu_list_screen.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; import 'package:provider/provider.dart'; @@ -126,7 +127,7 @@ class ServicesWidget extends StatelessWidget { Navigator.pushNamed(context, AppRoutes.monthlyPaySlip); } } else { - Navigator.pushNamed(context, AppRoutes.myAttendance, arguments: menuList); + Navigator.pushNamed(context, AppRoutes.servicesMenuListScreen, arguments: ServicesMenuListScreenParams(menuEntry.prompt!, menuList)); } return; } diff --git a/lib/ui/my_attendance/my_attendance_screen.dart b/lib/ui/my_attendance/services_menu_list_screen.dart similarity index 67% rename from lib/ui/my_attendance/my_attendance_screen.dart rename to lib/ui/my_attendance/services_menu_list_screen.dart index 207e2c7..fdf6e4f 100644 --- a/lib/ui/my_attendance/my_attendance_screen.dart +++ b/lib/ui/my_attendance/services_menu_list_screen.dart @@ -1,4 +1,3 @@ -import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; @@ -7,37 +6,44 @@ import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; -import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; -class MyAttendanceScreen extends StatelessWidget { - List list; +class ServicesMenuListScreenParams { + final String title; + final List list; - MyAttendanceScreen({Key? key, this.list = const []}) : super(key: key); + ServicesMenuListScreenParams(this.title, this.list); +} + +class ServicesMenuListScreen extends StatelessWidget { + late ServicesMenuListScreenParams servicesMenuData; + + ServicesMenuListScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { - list = ModalRoute.of(context)!.settings.arguments as List; + servicesMenuData = ModalRoute.of(context)!.settings.arguments as ServicesMenuListScreenParams; + return Scaffold( backgroundColor: Colors.white, appBar: AppBarWidget( context, - title: LocaleKeys.myAttendance.tr(), + title: servicesMenuData.title, ), body: SizedBox( width: double.infinity, height: double.infinity, - child: list.isEmpty + child: servicesMenuData.list.isEmpty ? Utils.getNoDataWidget(context) : ListView.separated( padding: const EdgeInsets.all(21), - itemBuilder: (cxt, index) => itemView("assets/images/pdf.svg", list[index].prompt!).onPress(() { - Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(list[index].prompt!, list[index].functionName!)); + itemBuilder: (cxt, index) => itemView("assets/images/pdf.svg", servicesMenuData.list[index].prompt!).onPress(() { + Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!)); }), separatorBuilder: (cxt, index) => 12.height, - itemCount: list.length), + itemCount: servicesMenuData.list.length), ), ); } From 11bd7a70851fda5613acf19ef4a39a43fa94060c Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 23 Aug 2022 17:24:17 +0300 Subject: [PATCH 6/8] improvements. --- .../announcements/announcement_details.dart | 64 ++++----- .../screens/announcements/announcements.dart | 130 ++++++++---------- 2 files changed, 79 insertions(+), 115 deletions(-) diff --git a/lib/ui/screens/announcements/announcement_details.dart b/lib/ui/screens/announcements/announcement_details.dart index a788b5d..a8b2c2c 100644 --- a/lib/ui/screens/announcements/announcement_details.dart +++ b/lib/ui/screens/announcements/announcement_details.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_html/flutter_html.dart'; import 'package:mohem_flutter_app/api/pending_transactions_api_client.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/get_announcement_details.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; @@ -37,47 +38,30 @@ class _AnnouncementDetailsState extends State { context, title: LocaleKeys.announcements.tr(), ), - body: SingleChildScrollView( - child: Container( - width: double.infinity, - padding: const EdgeInsets.all(10.0), - margin: const EdgeInsets.all(12.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(10), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - SizedBox( - width: double.infinity, - height: 150.0, - child: ClipRRect( - borderRadius: BorderRadius.circular(10), - child: Image.memory( - base64Decode(Utils.getBase64FromJpeg(getAnnouncementDetailsObj?.bannerImage)), - fit: BoxFit.cover, + body: getAnnouncementDetailsObj == null + ? const SizedBox() + : SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + width: double.infinity, + height: 150.0, + child: ClipRRect( + borderRadius: BorderRadius.circular(10), + child: Image.memory( + base64Decode(Utils.getBase64FromJpeg(getAnnouncementDetailsObj?.bannerImage)), + fit: BoxFit.cover, + ), + ), ), - ), - ), - Container( - margin: const EdgeInsets.only(top: 12.0), - child: Html( - data: getAnnouncementDetailsObj?.bodyEN, - ), - ), - ], - ), - ), - ), + Html( + data: getAnnouncementDetailsObj?.bodyEN, + ).paddingOnly(top: 12), + ], + ).objectContainerView().paddingAll(21), + ), ); } diff --git a/lib/ui/screens/announcements/announcements.dart b/lib/ui/screens/announcements/announcements.dart index f367157..56ca155 100644 --- a/lib/ui/screens/announcements/announcements.dart +++ b/lib/ui/screens/announcements/announcements.dart @@ -9,6 +9,7 @@ import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/get_announcements.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; @@ -44,18 +45,15 @@ class _AnnouncementsState extends State { context, title: LocaleKeys.announcements.tr(), ), - body: getAnnouncementsObject.isNotEmpty - ? Container( - margin: const EdgeInsets.only(top: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - 12.height, - Container( - margin: const EdgeInsets.fromLTRB(12.0, 0.0, 12.0, 0.0), - child: DynamicTextFieldWidget( - "Search", + body: jsonResponse.isEmpty + ? const SizedBox() + : getAnnouncementsObject.isNotEmpty + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + DynamicTextFieldWidget( + LocaleKeys.search.tr(), LocaleKeys.searchAnnouncements.tr(), isEnable: true, suffixIconData: Icons.search, @@ -66,72 +64,52 @@ class _AnnouncementsState extends State { onChange: (String value) { _runFilter(value); }, - ), - ), - 12.height, - Expanded( - child: ListView.separated( - physics: const BouncingScrollPhysics(), - shrinkWrap: true, - itemBuilder: (BuildContext context, int index) { - return InkWell( - onTap: () { - openAnnouncementsDetails(int.parse(_foundAnnouncements[index].rowID!)); - }, - child: Container( - width: double.infinity, - padding: const EdgeInsets.all(10.0), - margin: const EdgeInsets.only(left: 12, right: 12, top: 10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(10), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], - ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - width: 80.0, - height: 80.0, - child: ClipRRect( - borderRadius: BorderRadius.circular(10), - child: Image.memory( - base64Decode(Utils.getBase64FromJpeg(_foundAnnouncements[index].bannerImage)), - fit: BoxFit.cover, - ), - ), - ), - 12.width, - SizedBox( - height: 80.0, - width: 200.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppState().isArabic(context) ? _foundAnnouncements[index].titleAR!.toText13() : getAnnouncementsObject[index].titleEN!.toText13(), - 8.height, - _foundAnnouncements[index].created!.toText10(color: MyColors.grey98Color) - ], - ), + ).paddingOnly(left: 21, right: 21), + ListView.separated( + physics: const BouncingScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.all(21), + itemBuilder: (BuildContext context, int index) { + return InkWell( + onTap: () { + openAnnouncementsDetails(int.parse(_foundAnnouncements[index].rowID!)); + }, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + width: 80.0, + child: AspectRatio( + aspectRatio: 1 / 1, + child: ClipRRect( + borderRadius: BorderRadius.circular(10), + child: Image.memory( + base64Decode(Utils.getBase64FromJpeg(_foundAnnouncements[index].bannerImage)), + fit: BoxFit.cover, ), - ], + ), ), ), - ); - }, - separatorBuilder: (BuildContext context, int index) => 1.height, - itemCount: _foundAnnouncements.length ?? 0)) - ], - ), - ) - : Utils.getNoDataWidget(context), + 12.width, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (AppState().isArabic(context) ? _foundAnnouncements[index].titleAR! : getAnnouncementsObject[index].titleEN!).toText13(), + 8.height, + _foundAnnouncements[index].created!.toText10(color: MyColors.grey98Color) + ], + ).expanded, + ], + ).objectContainerView(), + ); + }, + separatorBuilder: (BuildContext context, int index) => 12.height, + itemCount: _foundAnnouncements.length, + ).expanded + ], + ) + : Utils.getNoDataWidget(context), ); } @@ -151,6 +129,8 @@ class _AnnouncementsState extends State { try { Utils.showLoading(context); jsonResponse = await PendingTransactionsApiClient().getAnnouncements(itgAwarenessID, currentPageNo, itgRowID); + // todo '@haroon' move below post processing code to above method and get exact model which you need, + var jsonDecodedData = jsonDecode(jsonDecode(jsonResponse)['result']['data']); for (int i = 0; i < jsonDecodedData.length; i++) { getAnnouncementsObject.add(GetAnnouncementsObject.fromJson(jsonDecodedData[i])); From 20f7d98ce5aec59d394bfc73e56c5656bee2040a Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 24 Aug 2022 14:49:54 +0300 Subject: [PATCH 7/8] profile improvements --- lib/classes/colors.dart | 1 + lib/config/routes.dart | 4 +- lib/extensions/string_extensions.dart | 10 +- lib/ui/profile/contact_details.dart | 2 +- lib/ui/profile/family_members.dart | 2 +- lib/ui/profile/personal_info.dart | 126 ++++---------- .../{screens => }/profile/profile_screen.dart | 106 ++++++------ .../{screens => }/profile/widgets/header.dart | 0 lib/ui/profile/widgets/profile_info.dart | 131 ++++++++++++++ lib/ui/profile/widgets/profile_panel.dart | 49 ++++++ .../screens/profile/widgets/profile_info.dart | 160 ------------------ .../profile/widgets/profile_panel.dart | 39 ----- 12 files changed, 278 insertions(+), 352 deletions(-) rename lib/ui/{screens => }/profile/profile_screen.dart (59%) rename lib/ui/{screens => }/profile/widgets/header.dart (100%) create mode 100644 lib/ui/profile/widgets/profile_info.dart create mode 100644 lib/ui/profile/widgets/profile_panel.dart delete mode 100644 lib/ui/screens/profile/widgets/profile_info.dart delete mode 100644 lib/ui/screens/profile/widgets/profile_panel.dart diff --git a/lib/classes/colors.dart b/lib/classes/colors.dart index e37a049..1b7c1a5 100644 --- a/lib/classes/colors.dart +++ b/lib/classes/colors.dart @@ -12,6 +12,7 @@ class MyColors { static const Color grey57Color = Color(0xff575757); static const Color grey67Color = Color(0xff676767); static const Color grey77Color = Color(0xff777777); + static const Color grey80Color = Color(0xff808080); static const Color grey70Color = Color(0xff707070); static const Color greyACColor = Color(0xffACACAC); static const Color grey98Color = Color(0xff989898); diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 61cf8aa..ca476df 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -32,7 +32,7 @@ import 'package:mohem_flutter_app/ui/screens/mowadhafhi/mowadhafhi_hr_request.da import 'package:mohem_flutter_app/ui/screens/mowadhafhi/request_details.dart'; import 'package:mohem_flutter_app/ui/screens/pending_transactions/pending_transactions.dart'; import 'package:mohem_flutter_app/ui/screens/pending_transactions/pending_transactions_details.dart'; -import 'package:mohem_flutter_app/ui/screens/profile/profile_screen.dart'; +import 'package:mohem_flutter_app/ui/profile/profile_screen.dart'; import 'package:mohem_flutter_app/ui/screens/submenu_screen.dart'; import 'package:mohem_flutter_app/ui/work_list/item_history_screen.dart'; import 'package:mohem_flutter_app/ui/work_list/itg_detail_screen.dart'; @@ -139,7 +139,7 @@ class AppRoutes { //Profile //profile: (context) => Profile(), //profile: (context) => Profile(), - personalInfo: (context) => PesonalInfo(), + personalInfo: (context) => PersonalInfo(), basicDetails: (context) => BasicDetails(), contactDetails: (context) => ContactDetails(), familyMembers: (context) => FamilyMembers(), diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 869b61c..e895ad1 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -54,10 +54,16 @@ extension EmailValidator on String { style: TextStyle(color: color ?? MyColors.darkTextColor, fontSize: 14, letterSpacing: -0.48, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), ); - Widget toText16({Color? color, bool isBold = false, int? maxlines}) => Text( + Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines}) => Text( this, maxLines: maxlines, - style: TextStyle(color: color ?? MyColors.darkTextColor, fontSize: 16, letterSpacing: -0.64, fontWeight: isBold ? FontWeight.bold : FontWeight.w600), + style: TextStyle( + color: color ?? MyColors.darkTextColor, + fontSize: 16, + letterSpacing: -0.64, + fontWeight: isBold ? FontWeight.bold : FontWeight.w600, + decoration: isUnderLine ? TextDecoration.underline : null, + ), ); Widget toText17({Color? color, bool isBold = false}) => Text( diff --git a/lib/ui/profile/contact_details.dart b/lib/ui/profile/contact_details.dart index 034292d..c0af0c5 100644 --- a/lib/ui/profile/contact_details.dart +++ b/lib/ui/profile/contact_details.dart @@ -13,7 +13,7 @@ import 'package:mohem_flutter_app/models/get_employee_phones_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_address_screen.dart'; import 'package:mohem_flutter_app/ui/profile/phone_numbers.dart'; -import 'package:mohem_flutter_app/ui/screens/profile/profile_screen.dart'; +import 'package:mohem_flutter_app/ui/profile/profile_screen.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:provider/provider.dart'; diff --git a/lib/ui/profile/family_members.dart b/lib/ui/profile/family_members.dart index 2dd84ea..4f38531 100644 --- a/lib/ui/profile/family_members.dart +++ b/lib/ui/profile/family_members.dart @@ -8,7 +8,7 @@ import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart'; import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_familyMembers_screen.dart'; -import 'package:mohem_flutter_app/ui/screens/profile/profile_screen.dart'; +import 'package:mohem_flutter_app/ui/profile/profile_screen.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; diff --git a/lib/ui/profile/personal_info.dart b/lib/ui/profile/personal_info.dart index ce35bf1..bd7eebd 100644 --- a/lib/ui/profile/personal_info.dart +++ b/lib/ui/profile/personal_info.dart @@ -2,114 +2,48 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/app_state/app_state.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/models/get_employee_basic_details.model.dart'; import 'package:mohem_flutter_app/models/member_information_list_model.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; -import 'package:mohem_flutter_app/widgets/button/default_button.dart'; -class PesonalInfo extends StatefulWidget { - const PesonalInfo({Key? key}) : super(key: key); +class PersonalInfo extends StatelessWidget { + PersonalInfo({Key? key}) : super(key: key); - @override - _PesonalInfoState createState() => _PesonalInfoState(); -} - -class _PesonalInfoState extends State { - String? fullName = ""; - String? maritalStatus = ""; - String? birthDate = ""; - String? civilIdentityNumber = ""; - String? emailAddress = ""; - String? employeeNo = ""; - - // List getEmployeeBasicDetailsList = []; - // MemberInformationListModel? _memberInformationList; - - late MemberInformationListModel memberInformationList; - - List getEmployeeBasicDetailsList = []; - - @override - void initState() { - super.initState(); - memberInformationList = AppState().memberInformationList!; - } + MemberInformationListModel memberInformationList = AppState().memberInformationList!; Widget build(BuildContext context) { return Scaffold( - appBar: AppBarWidget( - context, - title: LocaleKeys.profile_personalInformation.tr(), - ), - backgroundColor: MyColors.backgroundColor, - // bottomSheet:footer(), - body: Column( + appBar: AppBarWidget( + context, + title: LocaleKeys.profile_personalInformation.tr(), + ), + backgroundColor: MyColors.backgroundColor, + body: SizedBox( + width: MediaQuery.of(context).size.width, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - Container( - width: double.infinity, - margin: EdgeInsets.only( - top: 28, - left: 26, - right: 26, - ), - padding: EdgeInsets.only(left: 14, right: 14, top: 13, bottom: 20), - height: 350, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 5, - blurRadius: 26, - offset: Offset(0, 3), - ), - ], - color: Colors.white, - borderRadius: BorderRadius.circular(10.0), - ), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.category.tr().toText13(color: MyColors.lightGrayColor), - "${memberInformationList!.eMPLOYMENTCATEGORYMEANING}".toText16(isBold: true, color: MyColors.blackColor), - SizedBox( - height: 20, - ), - LocaleKeys.address.tr().toText13(color: MyColors.lightGrayColor), - "${memberInformationList!.lOCATIONNAME}".toText16(isBold: true, color: MyColors.blackColor), - SizedBox( - height: 20, - ), - LocaleKeys.phoneNumber.tr().toText13(color: MyColors.lightGrayColor), - "${memberInformationList!.eMPLOYEEMOBILENUMBER}".toText16(isBold: true, color: MyColors.blackColor), - SizedBox( - height: 20, - ), - LocaleKeys.businessGroup.tr().toText13(color: MyColors.lightGrayColor), - "${memberInformationList!.bUSINESSGROUPNAME}".toText16(isBold: true, color: MyColors.blackColor), - SizedBox( - height: 20, - ), - LocaleKeys.Payroll.tr().toText13(color: MyColors.lightGrayColor), - "${memberInformationList!.pAYROLLNAME}".toText16(isBold: true, color: MyColors.blackColor), - ]), - ), + LocaleKeys.category.tr().toText13(color: MyColors.lightGrayColor), + (memberInformationList.eMPLOYMENTCATEGORYMEANING ?? "").toText16(), + 20.height, + LocaleKeys.address.tr().toText13(color: MyColors.lightGrayColor), + (memberInformationList.lOCATIONNAME ?? "").toText16(), + 20.height, + LocaleKeys.phoneNumber.tr().toText13(color: MyColors.lightGrayColor), + (memberInformationList.eMPLOYEEMOBILENUMBER ?? "").toText16(), + 20.height, + LocaleKeys.businessGroup.tr().toText13(color: MyColors.lightGrayColor), + (memberInformationList.bUSINESSGROUPNAME ?? "").toText16(), + 20.height, + LocaleKeys.Payroll.tr().toText13(color: MyColors.lightGrayColor), + (memberInformationList.pAYROLLNAME ?? "").toText16(), ], - )); - } - - Widget footer() { - return Container( - decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(10), - color: MyColors.white, - boxShadow: [ - BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), - ], + ).objectContainerView().paddingAll(21), ), - child: DefaultButton( - LocaleKeys.update.tr(), - () async {}, - ).insideContainer, ); } } diff --git a/lib/ui/screens/profile/profile_screen.dart b/lib/ui/profile/profile_screen.dart similarity index 59% rename from lib/ui/screens/profile/profile_screen.dart rename to lib/ui/profile/profile_screen.dart index 35c4a57..cea9f11 100644 --- a/lib/ui/screens/profile/profile_screen.dart +++ b/lib/ui/profile/profile_screen.dart @@ -1,19 +1,20 @@ -import 'dart:ui'; import 'dart:convert'; import 'dart:ui'; -import 'package:easy_localization/easy_localization.dart'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:image_picker/image_picker.dart'; import 'package:mohem_flutter_app/api/profile_api_client.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; import 'package:mohem_flutter_app/models/member_information_list_model.dart'; -import 'package:mohem_flutter_app/ui/screens/profile/widgets/header.dart'; -import 'package:mohem_flutter_app/ui/screens/profile/widgets/profile_panel.dart'; +import 'package:mohem_flutter_app/ui/profile/widgets/profile_panel.dart'; import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; // todo '@sultan' kindly follow structure of code written. use extension methods for widgets and dont hard code strings, use localizations @@ -40,17 +41,24 @@ class _ProfileScreenState extends State { @override Widget build(BuildContext context) { return Scaffold( - extendBody: true, - backgroundColor: const Color(0xffefefef), - body: Stack(children: [ + extendBody: true, + backgroundColor: const Color(0xffefefef), + body: Stack( + children: [ Container( height: 300, - margin: EdgeInsets.only(top: 50), - decoration: BoxDecoration(image: DecorationImage(image: MemoryImage(Utils.getPostBytes(memberInformationList.eMPLOYEEIMAGE)), fit: BoxFit.cover)), - child: new BackdropFilter( - filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), - child: new Container( - decoration: new BoxDecoration(color: Colors.white.withOpacity(0.0)), + margin: const EdgeInsets.only(top: 50), + decoration: BoxDecoration( + image: DecorationImage( + image: MemoryImage( + Utils.getPostBytes(memberInformationList.eMPLOYEEIMAGE), + ), + fit: BoxFit.cover), + ), + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), + child: Container( + color: Colors.white.withOpacity(0.0), ), ), ), @@ -59,50 +67,46 @@ class _ProfileScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - SizedBox( - height: 80, - ), - Container( - padding: EdgeInsets.only(left: 15, right: 15), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - IconButton( - onPressed: () { - Navigator.pop(context); - }, - icon: Icon( - Icons.arrow_back_ios, - color: Colors.white, - ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton( + onPressed: () { + Navigator.pop(context); + }, + icon: const Icon( + Icons.arrow_back_ios, + color: Colors.white, ), - InkWell( - onTap: () { - startImageSheet(); - }, - child: Container( - padding: EdgeInsets.only(left: 10, right: 10, top: 5, bottom: 5), - decoration: BoxDecoration(borderRadius: BorderRadius.circular(15), color: Colors.black.withOpacity(.3)), - child: Row( - children: [ - Icon(Icons.photo, color: Colors.white), - Text( - 'Edit', - style: TextStyle(color: Colors.white, fontSize: 12), - ) - ], - ), + ), + InkWell( + onTap: () { + startImageSheet(); + }, + child: Container( + padding: const EdgeInsets.only(left: 17, right: 17, top: 8, bottom: 8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(30), + color: Colors.black.withOpacity(.21), + ), + child: Row( + children: [ + const Icon(Icons.photo, color: Colors.white, size: 16), + 4.width, + LocaleKeys.edit.tr().toText12(color: Colors.white), + ], ), ), - ], - ), - ), - HeaderPanel(memberInformationList), - ProfilePanle(memberInformationList) + ), + ], + ).paddingOnly(left: 16, right: 16, top: 80), + ProfilePanel(memberInformationList) ], ), ) - ])); + ], + ), + ); } void startImageSheet() { diff --git a/lib/ui/screens/profile/widgets/header.dart b/lib/ui/profile/widgets/header.dart similarity index 100% rename from lib/ui/screens/profile/widgets/header.dart rename to lib/ui/profile/widgets/header.dart diff --git a/lib/ui/profile/widgets/profile_info.dart b/lib/ui/profile/widgets/profile_info.dart new file mode 100644 index 0000000..63880b3 --- /dev/null +++ b/lib/ui/profile/widgets/profile_info.dart @@ -0,0 +1,131 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/cupertino.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/config/routes.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; +import 'package:mohem_flutter_app/models/member_information_list_model.dart'; +import 'package:mohem_flutter_app/models/profile_menu.model.dart'; + +class ProfileInFo extends StatefulWidget { + ProfileInFo(this.memberInfo); + + MemberInformationListModel memberInfo; + + @override + State createState() => _ProfileInFoState(); +} + +class _ProfileInFoState extends State { + static List menuData = []; + String data = '.'; + double sliderValue = 75; + List menu = [ + ProfileMenu(name: LocaleKeys.profile_personalInformation.tr(), icon: 'personal-info.svg', route: AppRoutes.personalInfo, dynamicUrl: '', menuEntries: getMenuEntries('')), + ProfileMenu(name: LocaleKeys.profile_basicDetails.tr(), icon: 'basic-details.svg', route: AppRoutes.basicDetails, menuEntries: getMenuEntries('BASIC_DETAILS')), + ProfileMenu(name: LocaleKeys.profile_contactDetails.tr(), icon: 'contact-details.svg', route: AppRoutes.contactDetails, dynamicUrl: '', menuEntries: getMenuEntries('ADDRESS')), + ProfileMenu(name: LocaleKeys.profile_familyDetails.tr(), icon: 'family-members.svg', route: AppRoutes.familyMembers, dynamicUrl: '', menuEntries: getMenuEntries('CONTACT')), + ]; + + @override + void setState(VoidCallback fn) { + super.setState(fn); + } + + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 16.height, + widget.memberInfo.eMPLOYEENAME!.toText22(), + ("${widget.memberInfo.eMPLOYEENUMBER!} | ${widget.memberInfo.jOBNAME!}").toText13(color: MyColors.grey80Color), + widget.memberInfo.eMPLOYEEEMAILADDRESS!.toText13(), + 12.height, + const Divider(height: 8, thickness: 8, color: MyColors.lightGreyEFColor), + 12.height, + LocaleKeys.completingYear.tr().toText11(), + Row(children: [ + appreciationTime(LocaleKeys.year.tr(), widget.memberInfo.sERVICEYEARS.toString()), + appreciationTime(LocaleKeys.month.tr(), widget.memberInfo.sERVICEMONTHS.toString()), + appreciationTime(LocaleKeys.day.tr(), widget.memberInfo.sERVICEDAYS.toString()), + ]).paddingOnly(bottom: 12, top: 12), + const Divider(height: 8, thickness: 8, color: MyColors.lightGreyEFColor), + Column( + // mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (LocaleKeys.profile_profileCompletionPer.tr() + ' 75%').toText16(), + 8.height, + Row( + children: [ + for (var i = 0; i < 4; i++) + if (i < 3) Expanded(child: drawSlider(Color(0xff2BB8A6))) else Expanded(child: drawSlider(const Color(0xffefefef))) + ], + ), + 14.height, + LocaleKeys.profile_completeProfile.tr().toText16(color: MyColors.textMixColor, isUnderLine: true), + ], + ).paddingOnly(left: 21, right: 21, bottom: 18, top: 12), + const Divider(height: 8, thickness: 8, color: MyColors.lightGreyEFColor), + ListView.separated( + padding: EdgeInsets.zero, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) => Row( + children: [ + SvgPicture.asset('assets/images/' + menu[index].icon, width: 20, height: 20), + 16.width, + menu[index].name.toText16().expanded, + 16.width, + const Icon(Icons.arrow_forward, color: MyColors.darkIconColor) + ], + ).onPress(() { + Navigator.pushNamed(context, menu[index].route); + }).paddingOnly(left: 21, right: 21, top: 21), + separatorBuilder: (cxt, index) => 12.height, + itemCount: menu.length), + ], + ); + } + + Widget drawSlider(color) { + return Row(children: [ + Expanded( + flex: 1, + child: ClipRRect( + borderRadius: BorderRadius.circular(10), + child: Container( + height: 6, + width: 20, + color: color, + ), + )), + Container(height: 6, width: 3, color: Colors.white), + ]); + } + + Widget appreciationTime(String title, String value) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + title.toText13(color: MyColors.grey80Color), + value.padLeft(2, '0').toText20(color: MyColors.textMixColor), + ], + ).expanded; + } +} + +GetMenuEntriesList getMenuEntries(String type) { + List data = _ProfileInFoState.menuData.where((GetMenuEntriesList test) => test.functionName == type).toList(); + if (data.isNotEmpty) { + return data[0]; + } else { + return GetMenuEntriesList(); + } +} diff --git a/lib/ui/profile/widgets/profile_panel.dart b/lib/ui/profile/widgets/profile_panel.dart new file mode 100644 index 0000000..da3e02c --- /dev/null +++ b/lib/ui/profile/widgets/profile_panel.dart @@ -0,0 +1,49 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/models/member_information_list_model.dart'; +import 'package:mohem_flutter_app/ui/profile/widgets/profile_info.dart'; + +class ProfilePanel extends StatelessWidget { + ProfilePanel(this.memberInformationList); + + late MemberInformationListModel memberInformationList; + + @override + Widget build(BuildContext context) { + return SizedBox( + height: MediaQuery.of(context).size.height, + child: Stack( + children: [ + Container( + margin: const EdgeInsets.only(top: 32), + padding: const EdgeInsets.only(top: 37), + decoration: BoxDecoration( + color: Colors.white, + // border: Border.all(color: MyColors.lightGreyEFColor, width: 1), + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(25), + topRight: Radius.circular(25), + ), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.1), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: ProfileInFo(memberInformationList), + ), + Container(height: 68, alignment: Alignment.center, child: profileImage()) + ], + ), + ); + } + + Widget profileImage() => CircleAvatar( + radius: 68, + backgroundImage: MemoryImage(Utils.getPostBytes(memberInformationList.eMPLOYEEIMAGE)), + backgroundColor: Colors.black, + ); +} diff --git a/lib/ui/screens/profile/widgets/profile_info.dart b/lib/ui/screens/profile/widgets/profile_info.dart deleted file mode 100644 index 029e50a..0000000 --- a/lib/ui/screens/profile/widgets/profile_info.dart +++ /dev/null @@ -1,160 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; -import 'package:mohem_flutter_app/config/routes.dart'; -import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; -import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; -import 'package:mohem_flutter_app/models/member_information_list_model.dart'; -import 'package:easy_localization/easy_localization.dart'; -import 'package:mohem_flutter_app/models/profile_menu.model.dart'; -import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; -import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart'; -import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; -import 'package:provider/provider.dart'; - -// todo '@sultan' kindly follow structure of code written. use extension methods for widgets, also format code - -class ProfileInFo extends StatefulWidget { - ProfileInFo(this.memberInfo); - - MemberInformationListModel memberInfo; - - @override - State createState() => _ProfileInFoState(); -} - -class _ProfileInFoState extends State { - static List menuData = []; - String data = '.'; - double sliderValue = 75; - List menu = [ - ProfileMenu(name: LocaleKeys.profile_personalInformation.tr(), icon: 'personal-info.svg', route: AppRoutes.personalInfo, dynamicUrl: '', menuEntries: getMenuEntries('')), - ProfileMenu(name: LocaleKeys.profile_basicDetails.tr(), icon: 'basic-details.svg', route: AppRoutes.basicDetails, menuEntries: getMenuEntries('BASIC_DETAILS')), - ProfileMenu(name: LocaleKeys.profile_contactDetails.tr(), icon: 'contact-details.svg', route: AppRoutes.contactDetails, dynamicUrl: '', menuEntries: getMenuEntries('ADDRESS')), - ProfileMenu(name: LocaleKeys.profile_familyDetails.tr(), icon: 'family-members.svg', route: AppRoutes.familyMembers, dynamicUrl: '', menuEntries: getMenuEntries('CONTACT')), - ]; - - @override - void setState(VoidCallback fn) { - super.setState(fn); - } - - @override - Widget build(BuildContext context) { - return Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - /// card header - customLabel(widget.memberInfo.eMPLOYEENAME.toString(), 22, Colors.black, true), - - customLabel(widget.memberInfo.eMPLOYEENUMBER.toString() + ' | ' + widget.memberInfo.jOBNAME.toString(), 14, Colors.grey, false), - - customLabel(widget.memberInfo.eMPLOYEEEMAILADDRESS.toString(), 13, Colors.black, true), - - Divider(height: 40, thickness: 8, color: const Color(0xffefefef)), - - customLabel(LocaleKeys.completingYear.tr(), 10, Colors.black, true), - - SizedBox(height: 10), - Container( - child: Row(mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Column( - children: [customLabel(LocaleKeys.year.tr(), 14, const Color(0xff808080), true), customLabel(widget.memberInfo.sERVICEYEARS.toString().padLeft(2, '0'), 22, Color(0xff2BB8A6), true)], - ), - Column( - children: [customLabel(LocaleKeys.month.tr(), 14, const Color(0xff808080), true), customLabel(widget.memberInfo.sERVICEMONTHS.toString().padLeft(2, '0'), 22, Color(0xff2BB8A6), true)], - ), - Column( - children: [customLabel(LocaleKeys.day.tr(), 14, const Color(0xff808080), true), customLabel(widget.memberInfo.sERVICEDAYS.toString().padLeft(2, '0'), 22, Color(0xff2BB8A6), true)], - ) - ])), - - Divider(height: 40, thickness: 8, color: const Color(0xffefefef)), - Container( - padding: EdgeInsets.only( - left: 20, - right: 20, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - customLabel(LocaleKeys.profile_profileCompletionPer.tr() + ' 75%', 18, Colors.black, true), - const SizedBox(height: 10), - Row( - children: [ - for (var i = 0; i < 4; i++) - if (i < 3) Expanded(child: drawSlider(Color(0xff2BB8A6))) else Expanded(child: drawSlider(const Color(0xffefefef))) - ], - ), - const SizedBox(height: 10), - Text( - LocaleKeys.profile_completeProfile.tr(), - style: TextStyle(color: Color(0xff2BB8A6), fontWeight: FontWeight.bold, decoration: TextDecoration.underline), - ), - ], - ), - ), - - /// description - Divider(height: 50, thickness: 8, color: const Color(0xffefefef)), - - Column( - children: menu.map((i) => rowItem(i, context)).toList(), - ) - ], - ), - ); - } - - Widget drawSlider(color) { - return Row(children: [ - Expanded( - flex: 1, - child: ClipRRect( - borderRadius: BorderRadius.circular(10), - child: Container( - height: 6, - width: 20, - color: color, - ), - )), - Container(height: 6, width: 3, color: Colors.white), - ]); - } - - Widget rowItem(obj, context) { - return InkWell( - onTap: () { - //if (obj.dynamicUrl == '') { - Navigator.pushNamed(context, obj.route); - // } else { - // Navigator.pushNamed(context, AppRoutes.addDynamicInputProfile, arguments: DynamicListViewParams(obj.name, obj.functionName, uRL: obj.dynamicUrl, requestID: obj.requestID)); - //} - }, - child: ListTile( - leading: SvgPicture.asset('assets/images/' + obj.icon), - title: Text(obj.name), - trailing: Icon(Icons.arrow_forward), - ), - ); - } - - Widget customLabel(String label, double size, Color color, bool isBold, {double padding = 0.0}) => Container( - padding: EdgeInsets.all(padding), - // height: 50, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.center, - children: [Text(label, style: TextStyle(color: color, fontSize: size, fontWeight: isBold ? FontWeight.bold : FontWeight.normal))])); -} - -GetMenuEntriesList getMenuEntries(String type) { - List data = _ProfileInFoState.menuData.where((GetMenuEntriesList test) => test.functionName == type).toList(); - if (data.isNotEmpty) { - return data[0]; - } else { - return GetMenuEntriesList(); - } -} diff --git a/lib/ui/screens/profile/widgets/profile_panel.dart b/lib/ui/screens/profile/widgets/profile_panel.dart deleted file mode 100644 index 1facf52..0000000 --- a/lib/ui/screens/profile/widgets/profile_panel.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:mohem_flutter_app/classes/utils.dart'; -import 'package:mohem_flutter_app/models/member_information_list_model.dart'; -import 'package:mohem_flutter_app/ui/screens/profile/widgets/profile_info.dart'; - -class ProfilePanle extends StatelessWidget { - ProfilePanle(this.memberInformationList); - - late MemberInformationListModel memberInformationList; - - @override - Widget build(BuildContext context) { - double _width = MediaQuery.of(context).size.width; - return Container( - margin: EdgeInsets.fromLTRB(5, 0, 5, 10), - height: MediaQuery.of(context).size.height, - child: Stack(children: [ - Container( - width: _width, - margin: EdgeInsets.only(top: 50), - padding: EdgeInsets.only(top: 50), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: const BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), - boxShadow: [BoxShadow(color: Colors.white60, blurRadius: 10, spreadRadius: 10)], - ), - child: ProfileInFo(memberInformationList), - ), - Container(height: 100, alignment: Alignment.center, child: ProfileImage()) - ])); - } - - Widget ProfileImage() => CircleAvatar( - radius: 70, - backgroundImage: MemoryImage(Utils.getPostBytes(memberInformationList.eMPLOYEEIMAGE)), - backgroundColor: Colors.black, - ); -} From 8247032a5262cea29f7eba4f660170c6a3531565 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 24 Aug 2022 16:21:34 +0300 Subject: [PATCH 8/8] profile options linked with home page personal information. --- lib/models/profile_menu.model.dart | 9 +--- .../services_menu_list_screen.dart | 13 +++++ lib/ui/profile/widgets/profile_info.dart | 47 +++++-------------- 3 files changed, 27 insertions(+), 42 deletions(-) diff --git a/lib/models/profile_menu.model.dart b/lib/models/profile_menu.model.dart index f125893..b8039ad 100644 --- a/lib/models/profile_menu.model.dart +++ b/lib/models/profile_menu.model.dart @@ -1,12 +1,7 @@ -import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; - class ProfileMenu { final String name; final String icon; final String route; - final String dynamicUrl; - final String functionName; - final String requestID; - final GetMenuEntriesList menuEntries; - ProfileMenu({this.name = '', this.icon = '', this.route = '', this.dynamicUrl = '', this.functionName = '', this.requestID = '', required this.menuEntries}); + + ProfileMenu({this.name = '', this.icon = '', this.route = ''}); } diff --git a/lib/ui/my_attendance/services_menu_list_screen.dart b/lib/ui/my_attendance/services_menu_list_screen.dart index fdf6e4f..eac127d 100644 --- a/lib/ui/my_attendance/services_menu_list_screen.dart +++ b/lib/ui/my_attendance/services_menu_list_screen.dart @@ -40,6 +40,19 @@ class ServicesMenuListScreen extends StatelessWidget { : ListView.separated( padding: const EdgeInsets.all(21), itemBuilder: (cxt, index) => itemView("assets/images/pdf.svg", servicesMenuData.list[index].prompt!).onPress(() { + if (servicesMenuData.list[index].parentMenuName == "MBL_PERINFO_SS") { + if (servicesMenuData.list[index].requestType == "BASIC_DETAILS") { + Navigator.pushNamed(context, AppRoutes.basicDetails); + } else if (servicesMenuData.list[index].requestType == "PHONE_NUMBERS") { + Navigator.pushNamed(context, AppRoutes.personalInfo); + } else if (servicesMenuData.list[index].requestType == "ADDRESS") { + Navigator.pushNamed(context, AppRoutes.contactDetails); + } else if (servicesMenuData.list[index].requestType == "CONTACT") { + Navigator.pushNamed(context, AppRoutes.familyMembers); + } + return; + } + Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(servicesMenuData.list[index].prompt!, servicesMenuData.list[index].functionName!)); }), separatorBuilder: (cxt, index) => 12.height, diff --git a/lib/ui/profile/widgets/profile_info.dart b/lib/ui/profile/widgets/profile_info.dart index 63880b3..2be854e 100644 --- a/lib/ui/profile/widgets/profile_info.dart +++ b/lib/ui/profile/widgets/profile_info.dart @@ -8,52 +8,38 @@ import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; -import 'package:mohem_flutter_app/models/dashboard/menu_entries.dart'; import 'package:mohem_flutter_app/models/member_information_list_model.dart'; import 'package:mohem_flutter_app/models/profile_menu.model.dart'; -class ProfileInFo extends StatefulWidget { - ProfileInFo(this.memberInfo); - +class ProfileInFo extends StatelessWidget { MemberInformationListModel memberInfo; - @override - State createState() => _ProfileInFoState(); -} + ProfileInFo(this.memberInfo, {Key? key}) : super(key: key); -class _ProfileInFoState extends State { - static List menuData = []; - String data = '.'; - double sliderValue = 75; List menu = [ - ProfileMenu(name: LocaleKeys.profile_personalInformation.tr(), icon: 'personal-info.svg', route: AppRoutes.personalInfo, dynamicUrl: '', menuEntries: getMenuEntries('')), - ProfileMenu(name: LocaleKeys.profile_basicDetails.tr(), icon: 'basic-details.svg', route: AppRoutes.basicDetails, menuEntries: getMenuEntries('BASIC_DETAILS')), - ProfileMenu(name: LocaleKeys.profile_contactDetails.tr(), icon: 'contact-details.svg', route: AppRoutes.contactDetails, dynamicUrl: '', menuEntries: getMenuEntries('ADDRESS')), - ProfileMenu(name: LocaleKeys.profile_familyDetails.tr(), icon: 'family-members.svg', route: AppRoutes.familyMembers, dynamicUrl: '', menuEntries: getMenuEntries('CONTACT')), + ProfileMenu(name: LocaleKeys.profile_personalInformation.tr(), icon: 'personal-info.svg', route: AppRoutes.personalInfo), + ProfileMenu(name: LocaleKeys.profile_basicDetails.tr(), icon: 'basic-details.svg', route: AppRoutes.basicDetails), + ProfileMenu(name: LocaleKeys.profile_contactDetails.tr(), icon: 'contact-details.svg', route: AppRoutes.contactDetails), + ProfileMenu(name: LocaleKeys.profile_familyDetails.tr(), icon: 'family-members.svg', route: AppRoutes.familyMembers), ]; - @override - void setState(VoidCallback fn) { - super.setState(fn); - } - @override Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ 16.height, - widget.memberInfo.eMPLOYEENAME!.toText22(), - ("${widget.memberInfo.eMPLOYEENUMBER!} | ${widget.memberInfo.jOBNAME!}").toText13(color: MyColors.grey80Color), - widget.memberInfo.eMPLOYEEEMAILADDRESS!.toText13(), + memberInfo.eMPLOYEENAME!.toText22(), + ("${memberInfo.eMPLOYEENUMBER!} | ${memberInfo.jOBNAME!}").toText13(color: MyColors.grey80Color), + memberInfo.eMPLOYEEEMAILADDRESS!.toText13(), 12.height, const Divider(height: 8, thickness: 8, color: MyColors.lightGreyEFColor), 12.height, LocaleKeys.completingYear.tr().toText11(), Row(children: [ - appreciationTime(LocaleKeys.year.tr(), widget.memberInfo.sERVICEYEARS.toString()), - appreciationTime(LocaleKeys.month.tr(), widget.memberInfo.sERVICEMONTHS.toString()), - appreciationTime(LocaleKeys.day.tr(), widget.memberInfo.sERVICEDAYS.toString()), + appreciationTime(LocaleKeys.year.tr(), memberInfo.sERVICEYEARS.toString()), + appreciationTime(LocaleKeys.month.tr(), memberInfo.sERVICEMONTHS.toString()), + appreciationTime(LocaleKeys.day.tr(), memberInfo.sERVICEDAYS.toString()), ]).paddingOnly(bottom: 12, top: 12), const Divider(height: 8, thickness: 8, color: MyColors.lightGreyEFColor), Column( @@ -120,12 +106,3 @@ class _ProfileInFoState extends State { ).expanded; } } - -GetMenuEntriesList getMenuEntries(String type) { - List data = _ProfileInFoState.menuData.where((GetMenuEntriesList test) => test.functionName == type).toList(); - if (data.isNotEmpty) { - return data[0]; - } else { - return GetMenuEntriesList(); - } -}