From 4edb19c2bb214f76ed86c3aa70ead8c1cd91958e Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 16 Aug 2022 16:07:51 +0300 Subject: [PATCH 01/10] 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 02/10] 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 03/10] 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 04/10] 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 05/10] 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 06/10] 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 07/10] 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(); - } -} From 9b50c2cf31245fbb750e010f6c199c8b094c6383 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 25 Aug 2022 09:25:47 +0300 Subject: [PATCH 08/10] mark attendance improvement. --- lib/ui/landing/dashboard_screen.dart | 6 +- lib/ui/landing/today_attendance_screen.dart | 296 ++++++++++---------- lib/widgets/mark_attendance_widget.dart | 249 ++++++++++++++++ 3 files changed, 405 insertions(+), 146 deletions(-) create mode 100644 lib/widgets/mark_attendance_widget.dart diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 4406a4d..da9cb5f 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -17,6 +17,8 @@ import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/ui/landing/widget/app_drawer.dart'; import 'package:mohem_flutter_app/ui/landing/widget/menus_widget.dart'; import 'package:mohem_flutter_app/ui/landing/widget/services_widget.dart'; +import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; +import 'package:mohem_flutter_app/widgets/mark_attendance_widget.dart'; import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; import 'package:provider/provider.dart'; @@ -206,7 +208,9 @@ class _DashboardScreenState extends State { ), ), child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/play.svg" : "assets/images/stop.svg"), - ), + ).onPress(() { + showMyBottomSheet(context, child: MarkAttendanceWidget(model)); + }), ], ), ], diff --git a/lib/ui/landing/today_attendance_screen.dart b/lib/ui/landing/today_attendance_screen.dart index 9346773..83c3f06 100644 --- a/lib/ui/landing/today_attendance_screen.dart +++ b/lib/ui/landing/today_attendance_screen.dart @@ -1,6 +1,5 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_countdown_timer/flutter_countdown_timer.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; @@ -16,17 +15,13 @@ 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/provider/dashboard_provider_model.dart'; import 'package:mohem_flutter_app/widgets/circular_step_progress_bar.dart'; -import 'package:mohem_flutter_app/widgets/dialogs/dialogs.dart'; import 'package:mohem_flutter_app/widgets/location/Location.dart'; import 'package:mohem_flutter_app/widgets/nfc/nfc_reader_sheet.dart'; +import 'package:mohem_flutter_app/widgets/qr_scanner_dialog.dart'; import 'package:nfc_manager/nfc_manager.dart'; import 'package:provider/provider.dart'; import 'package:wifi_iot/wifi_iot.dart'; -import 'package:mohem_flutter_app/widgets/qr_scanner_dialog.dart'; - - - class TodayAttendanceScreen extends StatefulWidget { TodayAttendanceScreen({Key? key}) : super(key: key); @@ -44,11 +39,11 @@ class _TodayAttendanceScreenState extends State { @override void initState() { super.initState(); - checkAttendanceAvailablity(); + checkAttendanceAvailability(); data = Provider.of(context, listen: false); } - void checkAttendanceAvailablity() async { + void checkAttendanceAvailability() async { bool isAvailable = await NfcManager.instance.isAvailable(); setState(() { AppState().privilegeListModel!.forEach((element) { @@ -104,7 +99,7 @@ class _TodayAttendanceScreenState extends State { builder: (context, model, child) { return (model.isAttendanceTrackingLoading ? Center(child: CircularProgressIndicator()) - : ListView( + : Column( children: [ Container( color: MyColors.backgroundBlackColor, @@ -114,144 +109,156 @@ class _TodayAttendanceScreenState extends State { children: [ DateUtil.getWeekDayMonthDayYearDateFormatted(DateTime.now(), "en").toText24(isBold: true, color: Colors.white), LocaleKeys.timeLeftToday.tr().toText16(color: Color(0xffACACAC)), - 21.height, + //21.height, Center( - child: CircularStepProgressBar( - totalSteps: 16 * 4, - currentStep: (model.progress * 100).toInt(), - width: 216, - height: 216, - selectedColor: MyColors.gradiantEndColor, - unselectedColor: MyColors.grey70Color, - child: Center( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - CountdownTimer( - endTime: model.endTime, - onEnd: null, - endWidget: "00:00:00".toText32(color: Colors.white, isBold: true), - textStyle: TextStyle(color: Colors.white, fontSize: 32, letterSpacing: -1.92, fontWeight: FontWeight.bold, height: 1), - ), - 19.height, - LocaleKeys.shiftTime.tr().tr().toText12(color: MyColors.greyACColor), - (model.attendanceTracking!.pShtName ?? "00:00:00").toString().toText22(color: Colors.white, isBold: true), - ], + child: AspectRatio( + aspectRatio: 265 / 265, + child: CircularStepProgressBar( + totalSteps: 16 * 4, + currentStep: (model.progress * 100).toInt(), + //width: 216, + // height: 216, + selectedColor: MyColors.gradiantEndColor, + unselectedColor: MyColors.grey70Color, + child: Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + CountdownTimer( + endTime: model.endTime, + onEnd: null, + endWidget: "00:00:00".toText32(color: Colors.white, isBold: true), + textStyle: TextStyle(color: Colors.white, fontSize: 32, letterSpacing: -1.92, fontWeight: FontWeight.bold, height: 1), + ), + 19.height, + LocaleKeys.shiftTime.tr().tr().toText12(color: MyColors.greyACColor), + (model.attendanceTracking!.pShtName ?? "00:00:00").toString().toText22(color: Colors.white, isBold: true), + ], + ), ), ), - ), - ), + ).paddingAll(21), + ).expanded, ], ), - ), - Container( - color: MyColors.backgroundBlackColor, - child: Stack( - children: [ - Container( - height: 187, - padding: EdgeInsets.only(left: 31, right: 31, top: 31, bottom: 16), - decoration: BoxDecoration( - borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), - gradient: const LinearGradient(transform: GradientRotation(.64), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ - MyColors.gradiantEndColor, - MyColors.gradiantStartColor, - ]), - ), - child: Column( - children: [ - Row( - children: [ - commonStatusView(LocaleKeys.checkIn.tr(), (model.attendanceTracking!.pSwipeIn) ?? "- - : - -"), - commonStatusView(LocaleKeys.checkOut.tr(), (model.attendanceTracking!.pSwipeOut) ?? "- - : - -") - ], - ), - 21.height, - Row( - children: [ - commonStatusView(LocaleKeys.lateIn.tr(), (model.attendanceTracking!.pLateInHours) ?? "- - : - -"), - commonStatusView(LocaleKeys.regular.tr(), (model.attendanceTracking!.pScheduledHours) ?? "- - : - -") - ], - ), - ], - ), - ), - Container( - width: double.infinity, - decoration: BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), - margin: EdgeInsets.only(top: 187 - 31), - padding: EdgeInsets.only(left: 21, right: 21, top: 24, bottom: 24), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - LocaleKeys.mark.tr().tr().toText12(), - LocaleKeys.attendance.tr().tr().toText24(), - LocaleKeys.selectMethodOfAttendance.tr().tr().toText12(color: Color(0xff535353)), - 24.height, - GridView( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - padding: EdgeInsets.zero, - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8), - children: [ - if (isNfcEnabled) - attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () { - if (isNfcLocationEnabled) { - Location.getCurrentLocation((LatLng? latlng) { - performNfcAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); - }); - } else { - performNfcAttendance(model); - } - }), - if (isWifiEnabled) - attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, () { - if (isWifiLocationEnabled) { + ).expanded, + Center( + child: Container( + // color: MyColors.backgroundBlackColor, + decoration: const BoxDecoration( + borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), + gradient: LinearGradient(transform: GradientRotation(.64), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ]), + ), + child: Column( + children: [ + Container( + //height: 187, + padding: const EdgeInsets.only(left: 31, right: 31, top: 31, bottom: 16), + decoration: const BoxDecoration( + borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), + gradient: LinearGradient(transform: GradientRotation(.64), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ]), + ), + child: Column( + children: [ + Row( + children: [ + commonStatusView(LocaleKeys.checkIn.tr(), (model.attendanceTracking!.pSwipeIn) ?? "- - : - -"), + commonStatusView(LocaleKeys.checkOut.tr(), (model.attendanceTracking!.pSwipeOut) ?? "- - : - -") + ], + ), + 21.height, + Row( + children: [ + commonStatusView(LocaleKeys.lateIn.tr(), (model.attendanceTracking!.pLateInHours) ?? "- - : - -"), + commonStatusView(LocaleKeys.regular.tr(), (model.attendanceTracking!.pScheduledHours) ?? "- - : - -") + ], + ), + ], + ), + ), //.expanded, - Location.getCurrentLocation((LatLng? latlng) { - performWifiAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); - }); - } else { - performWifiAttendance(model); - } - // connectWifi(); - }), - if (isQrEnabled) - attendanceMethod("QR", "assets/images/ic_qr.svg", isQrEnabled, () async { - if (isQrLocationEnabled) { - Location.getCurrentLocation((LatLng? latlng) { - performQrCodeAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); - }); - } else { - performQrCodeAttendance(model); - } - // performQrCodeAttendance(model); - }), - ], - ) - ], + // MarkAttendanceWidget(model), + Container( + width: double.infinity, + decoration: BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), + // margin: EdgeInsets.only(top: 187 - 31), + padding: EdgeInsets.only(left: 21, right: 21, top: 24, bottom: 24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + LocaleKeys.markAttendance.tr().toSectionHeading(), + LocaleKeys.selectMethodOfAttendance.tr().tr().toText11(color: Color(0xff535353)), + 24.height, + GridView( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.zero, + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8), + children: [ + if (isNfcEnabled) + attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () { + if (isNfcLocationEnabled) { + Location.getCurrentLocation((LatLng? latlng) { + performNfcAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + }); + } else { + performNfcAttendance(model); + } + }), + if (isWifiEnabled) + attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, () { + if (isWifiLocationEnabled) { + Location.getCurrentLocation((LatLng? latlng) { + performWifiAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + }); + } else { + performWifiAttendance(model); + } + // connectWifi(); + }), + if (isQrEnabled) + attendanceMethod("QR", "assets/images/ic_qr.svg", isQrEnabled, () async { + if (isQrLocationEnabled) { + Location.getCurrentLocation((LatLng? latlng) { + performQrCodeAttendance(model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + }); + } else { + performQrCodeAttendance(model); + } + // performQrCodeAttendance(model); + }), + ], + ) + ], + ), ), - ), - // Positioned( - // top: 187 - 21, - // child: Container( - // padding: EdgeInsets.only(left: 31, right: 31, top: 31, bottom: 16), - // decoration: BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), - // child: Column( - // children: [ - // Row( - // children: [commonStatusView("Check In", "09:27"), commonStatusView("Check Out", "- - : - -")], - // ), - // 21.height, - // Row( - // children: [commonStatusView("Late In", "00:27"), commonStatusView("Regular", "08:00")], - // ), - // ], - // ), - // ), - // ), - ], + // Positioned( + // top: 187 - 21, + // child: Container( + // padding: EdgeInsets.only(left: 31, right: 31, top: 31, bottom: 16), + // decoration: BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), + // child: Column( + // children: [ + // Row( + // children: [commonStatusView("Check In", "09:27"), commonStatusView("Check Out", "- - : - -")], + // ), + // 21.height, + // Row( + // children: [commonStatusView("Late In", "00:27"), commonStatusView("Regular", "08:00")], + // ), + // ], + // ), + // ), + // ), + ], + ), ), ) ], @@ -328,7 +335,7 @@ class _TodayAttendanceScreenState extends State { builder: (context) => QrScannerDialog(), ), ); - if(qrCodeValue!=null){ + if (qrCodeValue != null) { print("qrCode: " + qrCodeValue); Utils.showLoading(context); try { @@ -361,11 +368,10 @@ class _TodayAttendanceScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - child: SvgPicture.asset( + SvgPicture.asset( image, color: Colors.white, - )), + ).expanded, title.toText17(isBold: true, color: Colors.white), ], ), @@ -382,7 +388,7 @@ class _TodayAttendanceScreenState extends State { Widget commonStatusView(String title, String time) => Expanded( child: Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - title.toText12(color: Colors.white), + title.toText12(color: Colors.white.withOpacity(.69)), time.toText22(color: Colors.white, isBold: true), ]), ); diff --git a/lib/widgets/mark_attendance_widget.dart b/lib/widgets/mark_attendance_widget.dart new file mode 100644 index 0000000..c534dee --- /dev/null +++ b/lib/widgets/mark_attendance_widget.dart @@ -0,0 +1,249 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:mohem_flutter_app/api/dashboard_api_client.dart'; +import 'package:mohem_flutter_app/app_state/app_state.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/extensions/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/provider/dashboard_provider_model.dart'; +import 'package:mohem_flutter_app/widgets/location/Location.dart'; +import 'package:mohem_flutter_app/widgets/nfc/nfc_reader_sheet.dart'; +import 'package:mohem_flutter_app/widgets/qr_scanner_dialog.dart'; +import 'package:nfc_manager/nfc_manager.dart'; +import 'package:wifi_iot/wifi_iot.dart'; + +class MarkAttendanceWidget extends StatefulWidget { + DashboardProviderModel model; + + MarkAttendanceWidget(this.model, {Key? key}) : super(key: key); + + @override + _MarkAttendanceWidgetState createState() { + return _MarkAttendanceWidgetState(); + } +} + +class _MarkAttendanceWidgetState extends State { + bool isNfcEnabled = false, isNfcLocationEnabled = false, isQrEnabled = false, isQrLocationEnabled = false, isWifiEnabled = false, isWifiLocationEnabled = false; + + @override + void initState() { + super.initState(); + checkAttendanceAvailability(); + } + + void checkAttendanceAvailability() async { + bool isAvailable = await NfcManager.instance.isAvailable(); + setState(() { + AppState().privilegeListModel!.forEach((element) { + print(element.serviceName.toString() + " " + element.previlege.toString()); // Check availability + + if (element.serviceName == "enableNFC") { + if (isAvailable) if (element.previlege ?? false) isNfcEnabled = true; + } else if (element.serviceName == "enableQR") { + if (element.previlege ?? false) isQrEnabled = true; + } else if (element.serviceName == "enableWIFI") { + if (element.previlege ?? false) isWifiEnabled = true; + } else if (element.serviceName!.trim() == "enableLocationNFC") { + if (element.previlege ?? false) isNfcLocationEnabled = true; + } else if (element.serviceName == "enableLocationQR") { + if (element.previlege ?? false) isQrLocationEnabled = true; + } else if (element.serviceName == "enableLocationWIFI") { + if (element.previlege ?? false) isWifiLocationEnabled = true; + } + }); + }); + } + + @override + void dispose() { + super.dispose(); + // Stop Session + NfcManager.instance.stopSession(); + } + + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.only(left: 21, right: 21, bottom: 21), + decoration: BoxDecoration(borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)), color: Colors.white), + + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.markAttendance.tr().toSectionHeading(), + LocaleKeys.selectMethodOfAttendance.tr().tr().toText11(color: const Color(0xff535353)), + GridView( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: const EdgeInsets.only(bottom: 14, top: 21), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1 / 1, crossAxisSpacing: 8, mainAxisSpacing: 8), + children: [ + if (isNfcEnabled) + attendanceMethod("NFC", "assets/images/nfc.svg", isNfcEnabled, () { + if (isNfcLocationEnabled) { + Location.getCurrentLocation((LatLng? latlng) { + performNfcAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + }); + } else { + performNfcAttendance(widget.model); + } + }), + if (isWifiEnabled) + attendanceMethod("Wifi", "assets/images/wufu.svg", isWifiEnabled, () { + if (isWifiLocationEnabled) { + Location.getCurrentLocation((LatLng? latlng) { + performWifiAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + }); + } else { + performWifiAttendance(widget.model); + } + // connectWifi(); + }), + if (isQrEnabled) + attendanceMethod("QR", "assets/images/ic_qr.svg", isQrEnabled, () async { + if (isQrLocationEnabled) { + Location.getCurrentLocation((LatLng? latlng) { + performQrCodeAttendance(widget.model, lat: latlng?.latitude.toString() ?? "", lng: latlng?.longitude.toString() ?? ""); + }); + } else { + performQrCodeAttendance(widget.model); + } + // performQrCodeAttendance(model); + }), + ], + ) + ], + ), + ); + } + + Future performNfcAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { + if (isNfcLocationEnabled) { + print("nfc location enabled"); + } else { + print("nfc not location enabled"); + } + + showNfcReader(context, onNcfScan: (String? nfcId) async { + print(nfcId); + Utils.showLoading(context); + try { + GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 2, nfcValue: nfcId ?? "", isGpsRequired: isNfcLocationEnabled, lat: lat, long: lng); + bool status = await model.fetchAttendanceTracking(context); + Utils.hideLoading(context); + } catch (ex) { + print(ex); + Utils.hideLoading(context); + Utils.handleException(ex, context, (msg) { + Utils.confirmDialog(context, msg); + }); + } + }); + } + + Future performWifiAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { + if (isWifiLocationEnabled) { + print("wifi location enabled"); + } else { + print("wifi not location enabled"); + } + + bool v = await WiFiForIoTPlugin.connect(AppState().mohemmWifiSSID ?? "", password: AppState().mohemmWifiPassword ?? "", joinOnce: true, security: NetworkSecurity.WPA, withInternet: false); + if (v) { + await WiFiForIoTPlugin.forceWifiUsage(true); + print("connected"); + Utils.showLoading(context); + try { + GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 3, nfcValue: "", isGpsRequired: isWifiLocationEnabled, lat: lat, long: lng); + bool status = await model.fetchAttendanceTracking(context); + Utils.hideLoading(context); + await closeWifiRequest(); + } catch (ex) { + print(ex); + await closeWifiRequest(); + Utils.hideLoading(context); + Utils.handleException(ex, context, (msg) { + Utils.confirmDialog(context, msg); + }); + } + } else { + Utils.confirmDialog(context, LocaleKeys.comeNearHMGWifi.tr()); + } + } + + Future closeWifiRequest() async { + await WiFiForIoTPlugin.forceWifiUsage(false); + bool v = await WiFiForIoTPlugin.disconnect(); + return v; + } + + Future performQrCodeAttendance(DashboardProviderModel model, {String lat = "0", String lng = "0"}) async { + var qrCodeValue = await Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => QrScannerDialog(), + ), + ); + if (qrCodeValue != null) { + print("qrCode: " + qrCodeValue); + Utils.showLoading(context); + try { + GenericResponseModel? g = await DashboardApiClient().markAttendance(pointType: 1, isGpsRequired: isQrLocationEnabled, lat: lat, long: lng, QRValue: qrCodeValue); + bool status = await model.fetchAttendanceTracking(context); + Utils.hideLoading(context); + } catch (ex) { + print(ex); + Utils.hideLoading(context); + Utils.handleException(ex, context, (msg) { + Utils.confirmDialog(context, msg); + }); + } + } + } + + Widget attendanceMethod(String title, String image, bool isEnabled, VoidCallback onPress) => Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + gradient: const LinearGradient( + transform: GradientRotation(.64), + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ], + ), + ), + clipBehavior: Clip.antiAlias, + child: Stack( + children: [ + Container( + padding: const EdgeInsets.only(left: 10, right: 10, top: 14, bottom: 14), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: SvgPicture.asset( + image, + color: Colors.white, + )), + title.toText17(isBold: true, color: Colors.white), + ], + ), + ), + if (!isEnabled) + Container( + width: double.infinity, + height: double.infinity, + color: Colors.grey.withOpacity(0.7), + ) + ], + ), + ).onPress(onPress); +} From fc6b923fc4da5b6984dc4a2de314b63b8bd1302b Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 25 Aug 2022 11:12:39 +0300 Subject: [PATCH 09/10] mowadhafhi improvement. --- lib/config/routes.dart | 6 +- .../screens/mowadhafhi/mowadhafhi_home.dart | 167 +++++------ .../mowadhafhi/mowadhafhi_hr_request.dart | 267 +++++++----------- 3 files changed, 169 insertions(+), 271 deletions(-) diff --git a/lib/config/routes.dart b/lib/config/routes.dart index ca476df..91e4b56 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -18,13 +18,15 @@ 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'; import 'package:mohem_flutter_app/ui/profile/contact_details.dart'; +import 'package:mohem_flutter_app/ui/profile/delete_family_member.dart'; import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_address_screen.dart'; import 'package:mohem_flutter_app/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart'; import 'package:mohem_flutter_app/ui/profile/family_members.dart'; import 'package:mohem_flutter_app/ui/profile/personal_info.dart'; +import 'package:mohem_flutter_app/ui/profile/profile_screen.dart'; import 'package:mohem_flutter_app/ui/screens/announcements/announcement_details.dart'; import 'package:mohem_flutter_app/ui/screens/announcements/announcements.dart'; -import 'package:mohem_flutter_app/ui/profile/delete_family_member.dart'; + // import 'package:mohem_flutter_app/ui/my_attendance/work_from_home_screen.dart'; import 'package:mohem_flutter_app/ui/screens/eit/add_eit.dart'; import 'package:mohem_flutter_app/ui/screens/mowadhafhi/mowadhafhi_home.dart'; @@ -32,7 +34,6 @@ 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/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'; @@ -70,6 +71,7 @@ class AppRoutes { static const String addDynamicInputProfile = 'addDynamicInputProfile'; static const String addDynamicAddressScreen = 'addDynamicAddressProfile'; + //Attendance static const String attendance = "/attendance"; static const String monthlyAttendance = "/monthlyAttendance"; diff --git a/lib/ui/screens/mowadhafhi/mowadhafhi_home.dart b/lib/ui/screens/mowadhafhi/mowadhafhi_home.dart index edf6b03..45d881f 100644 --- a/lib/ui/screens/mowadhafhi/mowadhafhi_home.dart +++ b/lib/ui/screens/mowadhafhi/mowadhafhi_home.dart @@ -7,6 +7,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/mowadhafhi/get_tickets_list.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; @@ -20,7 +21,7 @@ class MowadhafhiHome extends StatefulWidget { } class _MowadhafhiHomeState extends State { - List getTicketsByEmployeeList = []; + List? getTicketsByEmployeeList; @override void initState() { @@ -28,111 +29,10 @@ class _MowadhafhiHomeState extends State { super.initState(); } - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.white, - appBar: AppBarWidget( - context, - title: LocaleKeys.mowadhafhiRequest.tr(), - ), - body: Container( - margin: const EdgeInsets.only(top: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: ListView.separated( - physics: const BouncingScrollPhysics(), - shrinkWrap: true, - itemBuilder: (BuildContext context, int index) { - return InkWell( - onTap: () { - openRequestDetails(getTicketsByEmployeeList[index].ticketId!); - }, - child: Container( - width: double.infinity, - // height: 100.0, - padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), - margin: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 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: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - getTicketsByEmployeeList[index].ticketTypeName!.toText14(color: MyColors.grey57Color), - getTicketsByEmployeeList[index].created!.split(" ")[0].toText12(color: MyColors.grey70Color), - ], - ), - Container( - padding: const EdgeInsets.only(top: 10.0), - child: getTicketsByEmployeeList[index].description!.toText12(color: MyColors.grey57Color), - ), - Container( - padding: const EdgeInsets.only(top: 10.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - getTicketsByEmployeeList[index].ticketStatusInternalName!.toText14(color: MyColors.gradiantEndColor), - SvgPicture.asset( - "assets/images/arrow_next.svg", - color: MyColors.darkIconColor, - ) - ], - ), - ), - ], - ), - ), - ); - }, - separatorBuilder: (BuildContext context, int index) => 12.height, - itemCount: getTicketsByEmployeeList.length ?? 0)), - 80.height - ], - ), - ), - bottomSheet: Container( - decoration: const BoxDecoration( - color: MyColors.white, - boxShadow: [ - BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), - ], - ), - child: DefaultButton(LocaleKeys.createRequest.tr(), () async { - openHRRequest(); - }).insideContainer, - )); - } - - void openRequestDetails(String itgTicketID) async { - await Navigator.pushNamed(context, AppRoutes.mowadhafhiDetails, arguments: itgTicketID); - } - - void openHRRequest() async { - await Navigator.pushNamed(context, AppRoutes.mowadhafhiHRRequest).then((value) { - getOpenTickets(); - }); - } - void getOpenTickets() async { try { Utils.showLoading(context); - getTicketsByEmployeeList.clear(); + getTicketsByEmployeeList?.clear(); getTicketsByEmployeeList = await MowadhafhiApiClient().getTicketsByEmployee(); Utils.hideLoading(context); setState(() {}); @@ -141,4 +41,65 @@ class _MowadhafhiHomeState extends State { Utils.handleException(ex, context, null); } } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget( + context, + title: LocaleKeys.mowadhafhiRequest.tr(), + ), + body: getTicketsByEmployeeList == null + ? const SizedBox() + : (getTicketsByEmployeeList!.isEmpty) + ? Utils.getNoDataWidget(context) + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ListView.separated( + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.all(21), + itemBuilder: (BuildContext context, int index) { + return InkWell( + onTap: () { + Navigator.pushNamed(context, AppRoutes.mowadhafhiDetails, arguments: getTicketsByEmployeeList![index].ticketId); + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + getTicketsByEmployeeList![index].ticketTypeName!.toText14(color: MyColors.darkTextColor).expanded, + getTicketsByEmployeeList![index].created!.split(" ")[0].toText12(color: MyColors.grey70Color), + ], + ), + getTicketsByEmployeeList![index].description!.toText12(color: MyColors.grey57Color), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + getTicketsByEmployeeList![index].ticketStatusInternalName!.toText14(color: MyColors.textMixColor), + SvgPicture.asset( + "assets/images/arrow_next.svg", + color: MyColors.darkIconColor, + ) + ], + ), + ], + ).objectContainerView(), + ); + }, + separatorBuilder: (BuildContext context, int index) => 12.height, + itemCount: getTicketsByEmployeeList!.length) + .expanded, + DefaultButton(LocaleKeys.createRequest.tr(), () async { + await Navigator.pushNamed(context, AppRoutes.mowadhafhiHRRequest); + getOpenTickets(); + }).insideContainer + ], + ), + ); + } } diff --git a/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart b/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart index 7ac6c43..44b3833 100644 --- a/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart +++ b/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart @@ -21,7 +21,6 @@ import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/button/simple_button.dart'; import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; -import 'package:mohem_flutter_app/widgets/radio/show_radio.dart'; class MowadhafhiHRRequest extends StatefulWidget { const MowadhafhiHRRequest({Key? key}) : super(key: key); @@ -42,7 +41,9 @@ class _MowadhafhiHRRequestState extends State { GetSectionTopics? selectedTopic; List attachmentFiles = []; - String selectedServiceType = ""; + GetTicketTypes? selectedServiceType; + + // String selectedServiceType = ""; String description = ""; int? projectID; @@ -58,69 +59,40 @@ class _MowadhafhiHRRequestState extends State { backgroundColor: Colors.white, appBar: AppBarWidget( context, - title: LocaleKeys.mowadhafhiRequest.tr(), + title: LocaleKeys.createRequest.tr(), ), - body: SingleChildScrollView( - child: getTicketTypesList.isNotEmpty - ? Container( - width: double.infinity, - padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), - margin: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), - 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, + body: getTicketTypesList.isNotEmpty + ? Column( + children: [ + ListView( + padding: const EdgeInsets.all(21), children: [ - LocaleKeys.serviceType.tr().toText16(), - 12.height, - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - SizedBox( - height: 40, - child: ListView.separated( - itemBuilder: (context, index) { - return Container( - padding: const EdgeInsets.only(right: 6, top: 8, bottom: 8), - child: ShowRadio( - title: getTicketTypesList[index].typeName!, - value: getTicketTypesList[index].ticketTypeId!.toString(), - groupValue: selectedServiceType, - selectedColor: MyColors.gradiantStartColor), - ).onPress(() { - selectedServiceType = getTicketTypesList[index].ticketTypeId!.toString(); - setState(() {}); - }); - }, - separatorBuilder: (context, index) => 1.width, - shrinkWrap: true, - itemCount: getTicketTypesList.length ?? 0, - scrollDirection: Axis.horizontal, - ), + PopupMenuButton( + child: DynamicTextFieldWidget( + LocaleKeys.serviceType.tr(), + selectedServiceType?.typeName ?? LocaleKeys.selectTypeT.tr(), + isEnable: false, + isPopup: true, + isInputTypeNum: true, + isReadOnly: false, ), - ], - ), - 12.height, - LocaleKeys.departmentName.tr().toText16(), + itemBuilder: (_) => >[ + for (int i = 0; i < getTicketTypesList.length; i++) PopupMenuItem(child: Text(getTicketTypesList[i].typeName!), value: i), + ], + onSelected: (int popupIndex) { + selectedServiceType = getTicketTypesList[popupIndex]; //.ticketTypeId!.toString(); + setState(() {}); + }), 12.height, PopupMenuButton( child: DynamicTextFieldWidget( - LocaleKeys.selectDepartment.tr(), - selectedDepartment?.departmentName ?? "", + LocaleKeys.departmentName.tr(), + selectedDepartment?.departmentName ?? LocaleKeys.selectDepartment.tr(), isEnable: false, isPopup: true, isInputTypeNum: true, isReadOnly: false, - ).paddingOnly(bottom: 12), + ), itemBuilder: (_) => >[ for (int i = 0; i < getProjectDepartmentsList!.length; i++) PopupMenuItem(child: Text(getProjectDepartmentsList![i].departmentName!), value: i), ], @@ -130,17 +102,15 @@ class _MowadhafhiHRRequestState extends State { setState(() {}); }), 12.height, - LocaleKeys.relatedSection.tr().toText16(), - 12.height, PopupMenuButton( child: DynamicTextFieldWidget( - LocaleKeys.selectSection.tr(), - selectedSection?.sectionName ?? "", + LocaleKeys.relatedSection.tr(), + selectedSection?.sectionName ?? LocaleKeys.selectSection.tr(), isEnable: false, isPopup: true, isInputTypeNum: true, isReadOnly: false, - ).paddingOnly(bottom: 12), + ), itemBuilder: (_) => >[ for (int i = 0; i < getDepartmentSectionsList!.length; i++) PopupMenuItem(child: Text(getDepartmentSectionsList![i].sectionName!), value: i), ], @@ -150,35 +120,29 @@ class _MowadhafhiHRRequestState extends State { setState(() {}); }), 12.height, - LocaleKeys.relatedTopic.tr().toText16(), - 12.height, PopupMenuButton( child: DynamicTextFieldWidget( - LocaleKeys.selectTopic.tr(), - selectedTopic?.topicName ?? "", + LocaleKeys.relatedTopic.tr(), + selectedTopic?.topicName ?? LocaleKeys.selectTopic.tr(), isEnable: false, isPopup: true, isInputTypeNum: true, isReadOnly: false, - ).paddingOnly(bottom: 12), + ), itemBuilder: (_) => >[ - for (int i = 0; i < getSectionTopicsList!.length; i++) PopupMenuItem(child: Text(getSectionTopicsList![i].topicName!), value: i), + for (int i = 0; i < getSectionTopicsList.length; i++) PopupMenuItem(child: Text(getSectionTopicsList[i].topicName!), value: i), ], onSelected: (int popupIndex) { - selectedTopic = getSectionTopicsList![popupIndex]; + selectedTopic = getSectionTopicsList[popupIndex]; // getDepartmentSections(selectedSection?.departmentSectionId); setState(() {}); }), 12.height, - LocaleKeys.supportingDocument.tr().toText16(), - 12.height, - attachmentView("Attachments"), - 12.height, - LocaleKeys.description.tr().toText16(), + attachmentView("Attachments").objectContainerView(title: LocaleKeys.supportingDocument.tr()), 12.height, DynamicTextFieldWidget( - "", - "", + LocaleKeys.description.tr(), + LocaleKeys.writeAMessage.tr(), isEnable: true, isPopup: false, lines: 4, @@ -189,40 +153,25 @@ class _MowadhafhiHRRequestState extends State { description = value; }, ), - 50.height ], - ), - ) - : Container(), - ), - bottomSheet: Container( - padding: const EdgeInsets.only(top: 8.0, bottom: 8.0), - decoration: const BoxDecoration( - color: MyColors.white, - ), - child: Row( - children: [ - 12.width, - Expanded( - child: DefaultButton( - LocaleKeys.submit.tr(), - !checkValidation() - ? null - : () { - submitHRRequest(); - }, - color: const Color(0xFFD02127), - ), - ), - 12.width, - ], - ), - ), + ).expanded, + DefaultButton( + LocaleKeys.submit.tr(), + !checkValidation() + ? null + : () { + submitHRRequest(); + }, + color: const Color(0xFFD02127), + ).insideContainer + ], + ) + : Container(), ); } bool checkValidation() { - if (selectedServiceType == "" || selectedDepartment == null || selectedSection == null || selectedTopic == null) { + if (selectedServiceType == null || selectedDepartment == null || selectedSection == null || selectedTopic == null) { return false; } else { return true; @@ -230,69 +179,55 @@ class _MowadhafhiHRRequestState extends State { } Widget attachmentView(String title) { - return Container( - padding: const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Row( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - title.toText16().expanded, - 6.width, - SimpleButton(LocaleKeys.add.tr(), () async { - FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true); - if (result != null) { - attachmentFiles = attachmentFiles + result.paths.map((path) => File(path!)).toList(); - attachmentFiles = attachmentFiles.toSet().toList(); - setState(() {}); - } - }, fontSize: 14), - ], - ), - if (attachmentFiles.isNotEmpty) 12.height, - if (attachmentFiles.isNotEmpty) - ListView.separated( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - itemBuilder: (cxt, index) { - String fileName = attachmentFiles[index].path.split('/').last; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + title.toText16().expanded, + 6.width, + SimpleButton(LocaleKeys.add.tr(), () async { + FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true); + if (result != null) { + attachmentFiles = attachmentFiles + result.paths.map((path) => File(path!)).toList(); + attachmentFiles = attachmentFiles.toSet().toList(); + setState(() {}); + } + }, fontSize: 14), + ], + ), + if (attachmentFiles.isNotEmpty) 12.height, + if (attachmentFiles.isNotEmpty) + ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) { + String fileName = attachmentFiles[index].path.split('/').last; - return Row( - children: [ - fileName.toText13().expanded, - 6.width, - IconButton( - padding: EdgeInsets.zero, - iconSize: 20, - icon: const Icon(Icons.cancel_rounded), - color: MyColors.redColor, - constraints: const BoxConstraints(), - onPressed: () async { - attachmentFiles.removeAt(index); - setState(() {}); - }, - ) - ], - ); - }, - separatorBuilder: (cxt, index) => 6.height, - itemCount: attachmentFiles.length), - ], - ), + return Row( + children: [ + fileName.toText13().expanded, + 6.width, + IconButton( + padding: EdgeInsets.zero, + iconSize: 20, + icon: const Icon(Icons.cancel_rounded), + color: MyColors.redColor, + constraints: const BoxConstraints(), + onPressed: () async { + attachmentFiles.removeAt(index); + setState(() {}); + }, + ) + ], + ); + }, + separatorBuilder: (cxt, index) => 6.height, + itemCount: attachmentFiles.length), + ], ); } @@ -376,7 +311,7 @@ class _MowadhafhiHRRequestState extends State { } } int? messageStatus = await MowadhafhiApiClient().submitRequest(selectedDepartment?.projectDepartmentId, description, projectID, selectedSection?.departmentSectionId.toString(), - selectedTopic?.sectionTopicId.toString(), int.parse(selectedServiceType), list); + selectedTopic?.sectionTopicId.toString(), selectedServiceType!.ticketTypeId, list); Utils.showToast(LocaleKeys.requestCreatedSuccessfully.tr()); Utils.hideLoading(context); Navigator.pop(context); From d6cc5fcc6cc5d93852b490f76cfc91e9629a8a92 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 25 Aug 2022 12:40:52 +0300 Subject: [PATCH 10/10] pending transaction. --- analysis_options.yaml | 2 + lib/classes/date_uitl.dart | 8 +- lib/models/add_att_success_list_model.dart | 4 +- lib/models/add_attachment_list_model.dart | 2 +- lib/models/attachment_model.dart | 2 +- .../basic_member_information_model.dart | 2 +- .../check_mobile_app_version_model.dart | 2 +- lib/models/content_info_model.dart | 4 +- .../get_set_values_request_model.dart | 2 +- .../validate_eit_transaction_model.dart | 2 +- lib/models/eit/get_eit_transaction_model.dart | 4 +- lib/models/generic_response_model.dart | 2 +- ...llection_notification_body_list_model.dart | 4 +- lib/models/get_action_history_list_model.dart | 2 +- lib/models/get_announcement_details.dart | 2 +- lib/models/get_announcements.dart | 2 +- lib/models/get_approves_list_model.dart | 2 +- lib/models/get_attachement_list_model.dart | 2 +- .../get_contact_dff_structure_list.dart | 2 +- ...get_day_hours_type_details_list_model.dart | 2 +- lib/models/get_default_value_list_model.dart | 2 +- .../get_eit_dff_structure_list_model.dart | 10 +- .../get_eit_transaction_list_model.dart | 4 +- lib/models/get_employee_address_model.dart | 2 +- .../get_employee_basic_details.model.dart | 2 +- lib/models/get_employee_contacts.model.dart | 2 +- lib/models/get_employee_phones_model.dart | 2 +- ...get_item_creation_ntf_body_list_model.dart | 6 +- .../get_mo_Item_history_list_model.dart | 2 +- .../get_mo_notification_body_list_model.dart | 2 +- .../get_mobile_login_info_list_model.dart | 2 +- .../get_notification_buttons_list_model.dart | 2 +- .../get_po_Item_history_list_model.dart | 2 +- .../get_po_notification_body_list_model.dart | 6 +- .../get_quotation_analysis_list_model.dart | 2 +- ...et_schedule_shifts_details_list_model.dart | 2 +- ...stamp_ms_notification_body_list_model.dart | 2 +- ...stamp_ns_notification_body_list_model.dart | 2 +- .../get_time_card_summary_list_model.dart | 2 +- .../allowed_actions_model.dart | 2 +- .../itg_forms_models/field_goups_model.dart | 2 +- lib/models/itg_forms_models/fields_model.dart | 2 +- .../itg_forms_models/itg_request_model.dart | 2 +- .../request_detail_model.dart | 2 +- .../itg_forms_models/request_type_model.dart | 2 +- .../itg_forms_models/wf_history_model.dart | 2 +- lib/models/member_information_list_model.dart | 2 +- lib/models/member_login_list_model.dart | 2 +- .../get_deductions_List_model.dart | 2 +- .../get_earnings_list_model.dart | 2 +- .../get_pay_slip_list_model.dart | 2 +- .../get_payment_information_list_model.dart | 2 +- .../get_summary_of_payment_list_model.dart | 2 +- .../mowadhafhi/get_department_sections.dart | 2 +- .../mowadhafhi/get_project_departments.dart | 2 +- lib/models/mowadhafhi/get_projects.dart | 2 +- lib/models/mowadhafhi/get_section_topics.dart | 2 +- lib/models/mowadhafhi/get_ticket_details.dart | 2 +- .../mowadhafhi/get_ticket_transactions.dart | 2 +- lib/models/mowadhafhi/get_ticket_types.dart | 2 +- lib/models/mowadhafhi/get_tickets_list.dart | 2 +- .../mowadhafhi_attachement_request.dart | 2 +- lib/models/notification_action_model.dart | 2 +- ...ion_get_respond_attributes_list_model.dart | 2 +- lib/models/payslip/get_deductions_list.dart | 2 +- lib/models/payslip/get_earnings_list.dart | 2 +- .../payslip/get_payment_information.dart | 2 +- lib/models/payslip/get_payslip.dart | 2 +- .../payslip/get_summary_of_payment.dart | 2 +- .../get_pending_transactions_details.dart | 2 +- .../get_req_functions.dart | 2 +- lib/models/post_params_model.dart | 4 +- lib/models/privilege_list_model.dart | 2 +- .../basic_details_cols_structions.dart | 4 +- .../profile/basic_details_dff_structure.dart | 2 +- .../get_address_dff_structure_list.dart | 2 +- .../get_contact_clos_structure_list.dart | 4 +- .../profile/get_contact_details_list.dart | 2 +- .../profile/get_countries_list_model.dart | 2 +- .../profile/phone_number_types_model.dart | 2 +- .../start_address_approval_process_model.dart | 2 +- .../profile/submit_address_transaction.dart | 2 +- ...ubmit_basic_details_transaction_model.dart | 2 +- ...submit_contact_transaction_list_model.dart | 2 +- .../profile/submit_phone_transactions.dart | 2 +- .../start_eit_approval_process_model.dart | 2 +- .../start_phone_approval_process_model.dart | 2 +- .../submit_eit_transaction_list_model.dart | 2 +- lib/models/subordinates_on_leaves_model.dart | 2 +- lib/models/surah_model.dart | 4 +- .../create_vacation_rule_list_model.dart | 2 +- ...et_item_type_notifications_list_model.dart | 2 +- ...notification_reassign_mode_list_model.dart | 2 +- .../get_vacation_rules_list_model.dart | 2 +- .../respond_attributes_list_model.dart | 2 +- .../vr_item_types_list_model.dart | 2 +- .../vacation_rule/wf_look_up_list_model.dart | 2 +- .../validate_eit_transaction_list_model.dart | 2 +- .../hr/get_basic_det_ntf_body_list_model.dart | 2 +- lib/models/worklist_item_type_model.dart | 2 +- lib/models/worklist_response_model.dart | 2 +- .../attendance/add_vacation_rule_screen.dart | 6 +- .../attendance/monthly_attendance_screen.dart | 4 +- lib/ui/landing/dashboard_screen.dart | 2 +- .../dynamic_screens/dynamic_input_screen.dart | 4 +- lib/ui/profile/add_update_family_member.dart | 2 +- lib/ui/profile/delete_family_member.dart | 2 +- .../dynamic_input_address_screen.dart | 2 +- .../dynamic_input_basic_details_screen.dart | 2 +- lib/ui/profile/profile_screen.dart | 2 +- .../announcements/announcement_details.dart | 2 +- .../pending_transactions.dart | 156 +++++++----------- .../pending_transactions_details.dart | 104 +++--------- lib/widgets/circular_step_progress_bar.dart | 52 +++--- lib/widgets/location/Location.dart | 4 +- lib/widgets/nfc/nfc_reader_sheet.dart | 2 +- 116 files changed, 252 insertions(+), 336 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index a84033c..674be66 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -18,6 +18,7 @@ analyzer: avoid_annotating_with_dynamic: error unnecessary_null_checks: error unnecessary_brace_in_string_interps: error + unnecessary_final: error linter: @@ -49,6 +50,7 @@ linter: unnecessary_null_checks: true unnecessary_brace_in_string_interps: true unnecessary_string_interpolations: true + unnecessary_final: true # avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule diff --git a/lib/classes/date_uitl.dart b/lib/classes/date_uitl.dart index 8754fdb..73945f8 100644 --- a/lib/classes/date_uitl.dart +++ b/lib/classes/date_uitl.dart @@ -8,8 +8,8 @@ class DateUtil { if (date != null) { const start = "/Date("; const end = "+0300)"; - final startIndex = date.indexOf(start); - final endIndex = date.indexOf(end, startIndex + start.length); + int startIndex = date.indexOf(start); + int endIndex = date.indexOf(end, startIndex + start.length); return DateTime.fromMillisecondsSinceEpoch( int.parse( date.substring(startIndex + start.length, endIndex), @@ -32,8 +32,8 @@ class DateUtil { if (date != null) { const start = "/Date("; const end = ")"; - final startIndex = date.indexOf(start); - final endIndex = date.indexOf(end, startIndex + start.length); + int startIndex = date.indexOf(start); + int endIndex = date.indexOf(end, startIndex + start.length); return DateTime.fromMillisecondsSinceEpoch( int.parse( date.substring(startIndex + start.length, endIndex), diff --git a/lib/models/add_att_success_list_model.dart b/lib/models/add_att_success_list_model.dart index e33fff2..f432d42 100644 --- a/lib/models/add_att_success_list_model.dart +++ b/lib/models/add_att_success_list_model.dart @@ -10,9 +10,9 @@ class AddAttSuccessList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['AddSuccess'] = this.addSuccess; data['AttachmentID'] = this.attachmentID; return data; } -} \ No newline at end of file +} diff --git a/lib/models/add_attachment_list_model.dart b/lib/models/add_attachment_list_model.dart index e34d80c..aa75d8f 100644 --- a/lib/models/add_attachment_list_model.dart +++ b/lib/models/add_attachment_list_model.dart @@ -10,7 +10,7 @@ class AddAttachmentList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; return data; diff --git a/lib/models/attachment_model.dart b/lib/models/attachment_model.dart index eb51dcf..855a490 100644 --- a/lib/models/attachment_model.dart +++ b/lib/models/attachment_model.dart @@ -16,7 +16,7 @@ class AttachmentModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['AttachmentID'] = this.attachmentID; data['P_FILE_CONTENT_TYPE'] = this.pFILECONTENTTYPE; data['P_FILE_DATA'] = this.pFILEDATA; diff --git a/lib/models/basic_member_information_model.dart b/lib/models/basic_member_information_model.dart index 33b55fa..6df7e84 100644 --- a/lib/models/basic_member_information_model.dart +++ b/lib/models/basic_member_information_model.dart @@ -21,7 +21,7 @@ class BasicMemberInformationModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_EMAIL_ADDRESS'] = this.pEMAILADDRESS; data['P_LEGISLATION_CODE'] = this.pLEGISLATIONCODE; data['P_MOBILE_NUMBER'] = this.pMOBILENUMBER; diff --git a/lib/models/check_mobile_app_version_model.dart b/lib/models/check_mobile_app_version_model.dart index cd301d3..a7a72d1 100644 --- a/lib/models/check_mobile_app_version_model.dart +++ b/lib/models/check_mobile_app_version_model.dart @@ -139,7 +139,7 @@ class CheckMobileAppVersionModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['Date'] = this.date; data['LanguageID'] = this.languageID; data['ServiceName'] = this.serviceName; diff --git a/lib/models/content_info_model.dart b/lib/models/content_info_model.dart index 4eec746..c7a4a7a 100644 --- a/lib/models/content_info_model.dart +++ b/lib/models/content_info_model.dart @@ -19,7 +19,7 @@ class ContentInfoModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['totalItemsCount'] = this.totalItemsCount; data['statusCode'] = this.statusCode; data['message'] = this.message; @@ -52,7 +52,7 @@ class ContentInfoDataModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['contentInfoId'] = this.contentInfoId; data['contentTypeId'] = this.contentTypeId; data['content'] = this.content; diff --git a/lib/models/dyanmic_forms/get_set_values_request_model.dart b/lib/models/dyanmic_forms/get_set_values_request_model.dart index 82bc05a..07c840a 100644 --- a/lib/models/dyanmic_forms/get_set_values_request_model.dart +++ b/lib/models/dyanmic_forms/get_set_values_request_model.dart @@ -21,7 +21,7 @@ class GetSetValuesRequestModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['SEGMENT_NAME'] = this.sEGMENTNAME; data['VALUE_COLUMN_NAME'] = this.vALUECOLUMNNAME; data['DESCRIPTION'] = this.dESCRIPTION; diff --git a/lib/models/dyanmic_forms/validate_eit_transaction_model.dart b/lib/models/dyanmic_forms/validate_eit_transaction_model.dart index a543e5c..3b485d7 100644 --- a/lib/models/dyanmic_forms/validate_eit_transaction_model.dart +++ b/lib/models/dyanmic_forms/validate_eit_transaction_model.dart @@ -16,7 +16,7 @@ class ValidateEitTransactionModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['TRANSACTION_NUMBER'] = this.tRANSACTIONNUMBER; data['NAME'] = this.nAME; data['VARCHAR2_VALUE'] = this.vARCHAR2VALUE; diff --git a/lib/models/eit/get_eit_transaction_model.dart b/lib/models/eit/get_eit_transaction_model.dart index 309c0a4..dffe320 100644 --- a/lib/models/eit/get_eit_transaction_model.dart +++ b/lib/models/eit/get_eit_transaction_model.dart @@ -13,7 +13,7 @@ class GetEitTransactionsModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); if (this.collectionTransaction != null) { data['Collection_Transaction'] = this.collectionTransaction!.map((v) => v.toJson()).toList(); } @@ -80,7 +80,7 @@ class CollectionTransaction { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; data['DATATYPE'] = this.dATATYPE; data['DATE_VALUE'] = this.dATEVALUE; diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index e288d38..23026e3 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -1249,7 +1249,7 @@ class GenericResponseModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['Date'] = this.date; data['LanguageID'] = this.languageID; data['ServiceName'] = this.serviceName; diff --git a/lib/models/get_absence_collection_notification_body_list_model.dart b/lib/models/get_absence_collection_notification_body_list_model.dart index 057cb64..8ca774a 100644 --- a/lib/models/get_absence_collection_notification_body_list_model.dart +++ b/lib/models/get_absence_collection_notification_body_list_model.dart @@ -13,7 +13,7 @@ class GetAbsenceCollectionNotificationBodyList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); if (this.collectionNotification != null) { data['Collection_Notification'] = this.collectionNotification!.map((v) => v.toJson()).toList(); } @@ -74,7 +74,7 @@ class CollectionNotificationAbsence { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ACTION'] = this.aCTION; data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; data['DATATYPE'] = this.dATATYPE; diff --git a/lib/models/get_action_history_list_model.dart b/lib/models/get_action_history_list_model.dart index c89a974..fd6857a 100644 --- a/lib/models/get_action_history_list_model.dart +++ b/lib/models/get_action_history_list_model.dart @@ -54,7 +54,7 @@ class GetActionHistoryList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ACTION'] = this.aCTION; data['ACTION_CODE'] = this.aCTIONCODE; data['EMAIL_ADDRESS'] = this.eMAILADDRESS; diff --git a/lib/models/get_announcement_details.dart b/lib/models/get_announcement_details.dart index 33628ce..45e4a1c 100644 --- a/lib/models/get_announcement_details.dart +++ b/lib/models/get_announcement_details.dart @@ -51,7 +51,7 @@ class GetAnnouncementDetails { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['Title_EN'] = this.titleEN; data['Title_AR'] = this.titleAR; data['EmailBody_EN'] = this.emailBodyEN; diff --git a/lib/models/get_announcements.dart b/lib/models/get_announcements.dart index 05b6988..70e93dc 100644 --- a/lib/models/get_announcements.dart +++ b/lib/models/get_announcements.dart @@ -51,7 +51,7 @@ class GetAnnouncementsObject { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['Title_EN'] = this.titleEN; data['Title_AR'] = this.titleAR; data['Banner_Image'] = this.bannerImage; diff --git a/lib/models/get_approves_list_model.dart b/lib/models/get_approves_list_model.dart index f5a4d82..2aec5b8 100644 --- a/lib/models/get_approves_list_model.dart +++ b/lib/models/get_approves_list_model.dart @@ -42,7 +42,7 @@ class GetApprovesList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['APPROVAL_STATUS'] = this.aPPROVALSTATUS; data['APPROVER'] = this.aPPROVER; data['APPROVER_CATEGORY'] = this.aPPROVERCATEGORY; diff --git a/lib/models/get_attachement_list_model.dart b/lib/models/get_attachement_list_model.dart index 79c43bb..7dd6376 100644 --- a/lib/models/get_attachement_list_model.dart +++ b/lib/models/get_attachement_list_model.dart @@ -51,7 +51,7 @@ class GetAttachementList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ATTACHED_DOCUMENT_ID'] = this.aTTACHEDDOCUMENTID; data['CATEGORY_ID'] = this.cATEGORYID; data['DATATYPE_ID'] = this.dATATYPEID; diff --git a/lib/models/get_contact_dff_structure_list.dart b/lib/models/get_contact_dff_structure_list.dart index 44a86be..7c226a9 100644 --- a/lib/models/get_contact_dff_structure_list.dart +++ b/lib/models/get_contact_dff_structure_list.dart @@ -126,7 +126,7 @@ class GetContactDffStructureList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ALPHANUMERIC_ALLOWED_FLAG'] = this.aLPHANUMERICALLOWEDFLAG; data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; data['CHILD_SEGMENTS_VS'] = this.cHILDSEGMENTSVS; diff --git a/lib/models/get_day_hours_type_details_list_model.dart b/lib/models/get_day_hours_type_details_list_model.dart index daaac74..e4eef25 100644 --- a/lib/models/get_day_hours_type_details_list_model.dart +++ b/lib/models/get_day_hours_type_details_list_model.dart @@ -132,7 +132,7 @@ class GetDayHoursTypeDetailsList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ABSENCE_ATTENDANCE_ID'] = this.aBSENCEATTENDANCEID; data['ABSENCE_ATTENDANCE_TYPE_ID'] = this.aBSENCEATTENDANCETYPEID; data['ABSENT_FLAG'] = this.aBSENTFLAG; diff --git a/lib/models/get_default_value_list_model.dart b/lib/models/get_default_value_list_model.dart index 3ee7fc1..6e46d2b 100644 --- a/lib/models/get_default_value_list_model.dart +++ b/lib/models/get_default_value_list_model.dart @@ -18,7 +18,7 @@ class GetDefaultValueList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_ID_COLUMN_NAME'] = this.pIDCOLUMNNAME; data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; diff --git a/lib/models/get_eit_dff_structure_list_model.dart b/lib/models/get_eit_dff_structure_list_model.dart index 5856014..832dc86 100644 --- a/lib/models/get_eit_dff_structure_list_model.dart +++ b/lib/models/get_eit_dff_structure_list_model.dart @@ -151,7 +151,7 @@ class GetEITDFFStructureList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ALPHANUMERIC_ALLOWED_FLAG'] = this.aLPHANUMERICALLOWEDFLAG; data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; data['CHILD_SEGMENTS_DV'] = this.cHILDSEGMENTSDV; @@ -225,7 +225,7 @@ class ESERVICESDV { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_ID_COLUMN_NAME'] = this.pIDCOLUMNNAME; data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; @@ -256,7 +256,7 @@ class ESERVICESVS { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['DESCRIPTION'] = this.dESCRIPTION; data['FROM_ROW_NUM'] = this.fROMROWNUM; data['ID_COLUMN_NAME'] = this.iDCOLUMNNAME; @@ -280,7 +280,7 @@ class PARENTSEGMENTSDVSplited { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['IsRequired'] = this.isRequired; data['Name'] = this.name; return data; @@ -299,7 +299,7 @@ class PARENTSEGMENTSVSSplitedVS { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['IsRequired'] = this.isRequired; data['Name'] = this.name; return data; diff --git a/lib/models/get_eit_transaction_list_model.dart b/lib/models/get_eit_transaction_list_model.dart index d2ff7c0..d8c39c9 100644 --- a/lib/models/get_eit_transaction_list_model.dart +++ b/lib/models/get_eit_transaction_list_model.dart @@ -13,7 +13,7 @@ class GetEITTransactionList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); if (this.collectionTransaction != null) { data['Collection_Transaction'] = this.collectionTransaction!.map((v) => v.toJson()).toList(); @@ -81,7 +81,7 @@ class CollectionTransaction { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; data['DATATYPE'] = this.dATATYPE; data['DATE_VALUE'] = this.dATEVALUE; diff --git a/lib/models/get_employee_address_model.dart b/lib/models/get_employee_address_model.dart index 1033797..8531ced 100644 --- a/lib/models/get_employee_address_model.dart +++ b/lib/models/get_employee_address_model.dart @@ -35,7 +35,7 @@ } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; data['DATATYPE'] = this.dATATYPE; data['DATE_VALUE'] = this.dATEVALUE; diff --git a/lib/models/get_employee_basic_details.model.dart b/lib/models/get_employee_basic_details.model.dart index 06713c0..0a3acd7 100644 --- a/lib/models/get_employee_basic_details.model.dart +++ b/lib/models/get_employee_basic_details.model.dart @@ -37,7 +37,7 @@ class GetEmployeeBasicDetailsList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; data['DATATYPE'] = this.dATATYPE; data['DATE_VALUE'] = this.dATEVALUE; diff --git a/lib/models/get_employee_contacts.model.dart b/lib/models/get_employee_contacts.model.dart index 4064d10..df0a41f 100644 --- a/lib/models/get_employee_contacts.model.dart +++ b/lib/models/get_employee_contacts.model.dart @@ -31,7 +31,7 @@ class GetEmployeeContactsList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['CONTACT_NAME'] = this.cONTACTNAME; data['CONTACT_PERSON_ID'] = this.cONTACTPERSONID; data['CONTACT_RELATIONSHIP_ID'] = this.cONTACTRELATIONSHIPID; diff --git a/lib/models/get_employee_phones_model.dart b/lib/models/get_employee_phones_model.dart index b4038ae..f18138e 100644 --- a/lib/models/get_employee_phones_model.dart +++ b/lib/models/get_employee_phones_model.dart @@ -28,7 +28,7 @@ class GetEmployeePhonesList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ACTION'] = this.aCTION; data['DATE_FROM'] = this.dATEFROM; data['DATE_TO'] = this.dATETO; diff --git a/lib/models/get_item_creation_ntf_body_list_model.dart b/lib/models/get_item_creation_ntf_body_list_model.dart index 83c81cb..e4c22e7 100644 --- a/lib/models/get_item_creation_ntf_body_list_model.dart +++ b/lib/models/get_item_creation_ntf_body_list_model.dart @@ -24,7 +24,7 @@ class GetItemCreationNtfBodyList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); if (this.itemCreationHeader != null) { data['ItemCreationHeader'] = this.itemCreationHeader!.map((v) => v.toJson()).toList(); } @@ -108,7 +108,7 @@ class ItemCreationHeader { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ANALYZED_BY'] = this.aNALYZEDBY; data['ANALYZED_BY_ID'] = this.aNALYZEDBYID; data['ANALYZED_DATE'] = this.aNALYZEDDATE; @@ -250,7 +250,7 @@ class ItemCreationLines { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['CHARGE_TO_PATIENT'] = this.cHARGETOPATIENT; data['FROM_ROW_NUM'] = this.fROMROWNUM; data['INVENTORY_ITEM_ID'] = this.iNVENTORYITEMID; diff --git a/lib/models/get_mo_Item_history_list_model.dart b/lib/models/get_mo_Item_history_list_model.dart index 3604322..f008a17 100644 --- a/lib/models/get_mo_Item_history_list_model.dart +++ b/lib/models/get_mo_Item_history_list_model.dart @@ -72,7 +72,7 @@ class GetMoItemHistoryList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['DATE_REQUIRED'] = this.dATEREQUIRED; data['DESCRIPTION'] = this.dESCRIPTION; data['FROM_LOCATOR'] = this.fROMLOCATOR; diff --git a/lib/models/get_mo_notification_body_list_model.dart b/lib/models/get_mo_notification_body_list_model.dart index 613d10f..1fc11ca 100644 --- a/lib/models/get_mo_notification_body_list_model.dart +++ b/lib/models/get_mo_notification_body_list_model.dart @@ -75,7 +75,7 @@ class GetMoNotificationBodyList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['DATE_REQUIRED'] = this.dATEREQUIRED; data['DESCRIPTION'] = this.dESCRIPTION; data['FROM_LOCATOR'] = this.fROMLOCATOR; diff --git a/lib/models/get_mobile_login_info_list_model.dart b/lib/models/get_mobile_login_info_list_model.dart index ff419f2..a2f7799 100644 --- a/lib/models/get_mobile_login_info_list_model.dart +++ b/lib/models/get_mobile_login_info_list_model.dart @@ -45,7 +45,7 @@ class GetMobileLoginInfoListModel { } Map toJson() { - final Map data = Map(); + Map data = Map(); data['ID'] = iD; data['EmployeeID'] = employeeID; data['ChannelID'] = channelID; diff --git a/lib/models/get_notification_buttons_list_model.dart b/lib/models/get_notification_buttons_list_model.dart index a6b29d2..91ac57d 100644 --- a/lib/models/get_notification_buttons_list_model.dart +++ b/lib/models/get_notification_buttons_list_model.dart @@ -15,7 +15,7 @@ class GetNotificationButtonsList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['BUTTON_ACTION'] = this.bUTTONACTION; data['BUTTON_ICON'] = this.bUTTONICON; data['BUTTON_LABEL'] = this.bUTTONLABEL; diff --git a/lib/models/get_po_Item_history_list_model.dart b/lib/models/get_po_Item_history_list_model.dart index d51861b..656457d 100644 --- a/lib/models/get_po_Item_history_list_model.dart +++ b/lib/models/get_po_Item_history_list_model.dart @@ -66,7 +66,7 @@ class GetPoItemHistoryList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['BALANCE_QUANTITY'] = this.bALANCEQUANTITY; data['BONUS_QUANTITY'] = this.bONUSQUANTITY; data['BUYER'] = this.bUYER; diff --git a/lib/models/get_po_notification_body_list_model.dart b/lib/models/get_po_notification_body_list_model.dart index 7b5c1cb..5d77b68 100644 --- a/lib/models/get_po_notification_body_list_model.dart +++ b/lib/models/get_po_notification_body_list_model.dart @@ -26,7 +26,7 @@ class GetPoNotificationBodyList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); if (this.pOHeader != null) { data['POHeader'] = this.pOHeader!.map((v) => v.toJson()).toList(); } @@ -116,7 +116,7 @@ class POHeader { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['BUYER'] = this.bUYER; data['COMMENTS'] = this.cOMMENTS; data['CREATION_DATE'] = this.cREATIONDATE; @@ -215,7 +215,7 @@ class POLines { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['DELIVER_TO_LOCATION'] = this.dELIVERTOLOCATION; data['FROM_ROW_NUM'] = this.fROMROWNUM; data['ITEM_CODE'] = this.iTEMCODE; diff --git a/lib/models/get_quotation_analysis_list_model.dart b/lib/models/get_quotation_analysis_list_model.dart index c0be32d..4ceaa96 100644 --- a/lib/models/get_quotation_analysis_list_model.dart +++ b/lib/models/get_quotation_analysis_list_model.dart @@ -60,7 +60,7 @@ class GetQuotationAnalysisList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['FROM_ROW_NUM'] = this.fROMROWNUM; data['ITEM_CODE'] = this.iTEMCODE; data['ITEM_DESC'] = this.iTEMDESC; diff --git a/lib/models/get_schedule_shifts_details_list_model.dart b/lib/models/get_schedule_shifts_details_list_model.dart index 8003446..df740a0 100644 --- a/lib/models/get_schedule_shifts_details_list_model.dart +++ b/lib/models/get_schedule_shifts_details_list_model.dart @@ -94,7 +94,7 @@ class GetScheduleShiftsDetailsList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ACTUAL_WOB_HRS'] = this.aCTUALWOBHRS; data['APPROVED_END_DATETIME'] = this.aPPROVEDENDDATETIME; data['APPROVED_END_REASON'] = this.aPPROVEDENDREASON; diff --git a/lib/models/get_stamp_ms_notification_body_list_model.dart b/lib/models/get_stamp_ms_notification_body_list_model.dart index dbead87..884f32b 100644 --- a/lib/models/get_stamp_ms_notification_body_list_model.dart +++ b/lib/models/get_stamp_ms_notification_body_list_model.dart @@ -96,7 +96,7 @@ class GetStampMsNotificationBodyList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ACTUAL_WOB_HRS'] = this.aCTUALWOBHRS; data['ACTUAL_WOB_SEC'] = this.aCTUALWOBSEC; data['APPROVED_END_REASON_DESC'] = this.aPPROVEDENDREASONDESC; diff --git a/lib/models/get_stamp_ns_notification_body_list_model.dart b/lib/models/get_stamp_ns_notification_body_list_model.dart index 4ce708c..c1c8515 100644 --- a/lib/models/get_stamp_ns_notification_body_list_model.dart +++ b/lib/models/get_stamp_ns_notification_body_list_model.dart @@ -43,7 +43,7 @@ class GetStampNsNotificationBodyList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ASSIGNMENT_ID'] = this.aSSIGNMENTID; data['ASSIGNMENT_NUMBER'] = this.aSSIGNMENTNUMBER; data['BUSINESS_GROUP_ID'] = this.bUSINESSGROUPID; diff --git a/lib/models/get_time_card_summary_list_model.dart b/lib/models/get_time_card_summary_list_model.dart index 727e29f..85a2a8e 100644 --- a/lib/models/get_time_card_summary_list_model.dart +++ b/lib/models/get_time_card_summary_list_model.dart @@ -113,7 +113,7 @@ class GetTimeCardSummaryList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ABSENT_DAYS'] = this.aBSENTDAYS; data['ACTUAL_HRS'] = this.aCTUALHRS; data['APPROVED_TIMEBACK_HRS'] = this.aPPROVEDTIMEBACKHRS; diff --git a/lib/models/itg_forms_models/allowed_actions_model.dart b/lib/models/itg_forms_models/allowed_actions_model.dart index 9c394c3..0ab5efc 100644 --- a/lib/models/itg_forms_models/allowed_actions_model.dart +++ b/lib/models/itg_forms_models/allowed_actions_model.dart @@ -12,7 +12,7 @@ class AllowedActions { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['Action'] = this.action; data['Details'] = this.details; data['IsAvailable'] = this.isAvailable; diff --git a/lib/models/itg_forms_models/field_goups_model.dart b/lib/models/itg_forms_models/field_goups_model.dart index 362fda7..a964a4d 100644 --- a/lib/models/itg_forms_models/field_goups_model.dart +++ b/lib/models/itg_forms_models/field_goups_model.dart @@ -17,7 +17,7 @@ class FieldGoups { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); if (this.fields != null) { data['Fields'] = this.fields!.map((v) => v.toJson()).toList(); } diff --git a/lib/models/itg_forms_models/fields_model.dart b/lib/models/itg_forms_models/fields_model.dart index 3800f81..528c960 100644 --- a/lib/models/itg_forms_models/fields_model.dart +++ b/lib/models/itg_forms_models/fields_model.dart @@ -16,7 +16,7 @@ class Fields { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['MultipleValue'] = this.multipleValue; data['TableValue'] = this.tableValue; data['Title'] = this.title; diff --git a/lib/models/itg_forms_models/itg_request_model.dart b/lib/models/itg_forms_models/itg_request_model.dart index 5bc4fa4..75f6a69 100644 --- a/lib/models/itg_forms_models/itg_request_model.dart +++ b/lib/models/itg_forms_models/itg_request_model.dart @@ -35,7 +35,7 @@ class ITGRequest { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); if (this.allowedActions != null) { data['AllowedActions'] = this.allowedActions!.map((v) => v.toJson()).toList(); } diff --git a/lib/models/itg_forms_models/request_detail_model.dart b/lib/models/itg_forms_models/request_detail_model.dart index b7b5a9c..1193423 100644 --- a/lib/models/itg_forms_models/request_detail_model.dart +++ b/lib/models/itg_forms_models/request_detail_model.dart @@ -21,7 +21,7 @@ class RequestDetails { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ID'] = this.iD; data['ItemID'] = this.itemID; data['ListID'] = this.listID; diff --git a/lib/models/itg_forms_models/request_type_model.dart b/lib/models/itg_forms_models/request_type_model.dart index 92d2515..0845183 100644 --- a/lib/models/itg_forms_models/request_type_model.dart +++ b/lib/models/itg_forms_models/request_type_model.dart @@ -21,7 +21,7 @@ class RequestType { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ItemCount'] = this.itemCount; if (this.requestDetails != null) { data['RequestDetails'] = this.requestDetails!.map((v) => v.toJson()).toList(); diff --git a/lib/models/itg_forms_models/wf_history_model.dart b/lib/models/itg_forms_models/wf_history_model.dart index 8e3dd6d..c804f67 100644 --- a/lib/models/itg_forms_models/wf_history_model.dart +++ b/lib/models/itg_forms_models/wf_history_model.dart @@ -27,7 +27,7 @@ class WFHistory { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['Action'] = this.action; data['ApprovalLevel'] = this.approvalLevel; data['Date'] = this.date; diff --git a/lib/models/member_information_list_model.dart b/lib/models/member_information_list_model.dart index dc64e53..0050fed 100644 --- a/lib/models/member_information_list_model.dart +++ b/lib/models/member_information_list_model.dart @@ -254,7 +254,7 @@ class MemberInformationListModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ACTUAL_TERMINATION_DATE'] = this.aCTUALTERMINATIONDATE; data['ASSIGNMENT_END_DATE'] = this.aSSIGNMENTENDDATE; data['ASSIGNMENT_ID'] = this.aSSIGNMENTID; diff --git a/lib/models/member_login_list_model.dart b/lib/models/member_login_list_model.dart index ffbc942..c9e1039 100644 --- a/lib/models/member_login_list_model.dart +++ b/lib/models/member_login_list_model.dart @@ -33,7 +33,7 @@ class MemberLoginListModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_EMAIL_ADDRESS'] = this.pEMAILADDRESS; data['P_INVALID_LOGIN_MSG'] = this.pINVALIDLOGINMSG; data['P_LEGISLATION_CODE'] = this.pLEGISLATIONCODE; diff --git a/lib/models/monthly_pay_slip/get_deductions_List_model.dart b/lib/models/monthly_pay_slip/get_deductions_List_model.dart index 7a99447..07bf1ba 100644 --- a/lib/models/monthly_pay_slip/get_deductions_List_model.dart +++ b/lib/models/monthly_pay_slip/get_deductions_List_model.dart @@ -24,7 +24,7 @@ class GetDeductionsList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['AMOUNT'] = this.aMOUNT; data['ELEMENT_NAME'] = this.eLEMENTNAME; data['FROM_ROW_NUM'] = this.fROMROWNUM; diff --git a/lib/models/monthly_pay_slip/get_earnings_list_model.dart b/lib/models/monthly_pay_slip/get_earnings_list_model.dart index 4c38fa6..f525d16 100644 --- a/lib/models/monthly_pay_slip/get_earnings_list_model.dart +++ b/lib/models/monthly_pay_slip/get_earnings_list_model.dart @@ -24,7 +24,7 @@ class GetEarningsList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['AMOUNT'] = this.aMOUNT; data['ELEMENT_NAME'] = this.eLEMENTNAME; data['FROM_ROW_NUM'] = this.fROMROWNUM; diff --git a/lib/models/monthly_pay_slip/get_pay_slip_list_model.dart b/lib/models/monthly_pay_slip/get_pay_slip_list_model.dart index 7cf8883..c3e9d7e 100644 --- a/lib/models/monthly_pay_slip/get_pay_slip_list_model.dart +++ b/lib/models/monthly_pay_slip/get_pay_slip_list_model.dart @@ -24,7 +24,7 @@ class GetPayslipList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ACTION_CONTEXT_ID'] = this.aCTIONCONTEXTID; data['PAYMENT_DATE'] = this.pAYMENTDATE; data['PAYSLIP_CHOICE'] = this.pAYSLIPCHOICE; diff --git a/lib/models/monthly_pay_slip/get_payment_information_list_model.dart b/lib/models/monthly_pay_slip/get_payment_information_list_model.dart index 75ed21c..f73be78 100644 --- a/lib/models/monthly_pay_slip/get_payment_information_list_model.dart +++ b/lib/models/monthly_pay_slip/get_payment_information_list_model.dart @@ -21,7 +21,7 @@ class GetPaymentInformationList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ACCOUNT_NUMBER'] = this.aCCOUNTNUMBER; data['AMOUNT'] = this.aMOUNT; data['BANK_NAME'] = this.bANKNAME; diff --git a/lib/models/monthly_pay_slip/get_summary_of_payment_list_model.dart b/lib/models/monthly_pay_slip/get_summary_of_payment_list_model.dart index 72ee89b..be65e35 100644 --- a/lib/models/monthly_pay_slip/get_summary_of_payment_list_model.dart +++ b/lib/models/monthly_pay_slip/get_summary_of_payment_list_model.dart @@ -24,7 +24,7 @@ class GetSummaryOfPaymentList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['TOTAL_DEDUCTIONS_AMOUNT'] = this.tOTALDEDUCTIONSAMOUNT; data['TOTAL_DEDUCTIONS_PERCENTAGE'] = this.tOTALDEDUCTIONSPERCENTAGE; data['TOTAL_EARNINGS_AMOUNT'] = this.tOTALEARNINGSAMOUNT; diff --git a/lib/models/mowadhafhi/get_department_sections.dart b/lib/models/mowadhafhi/get_department_sections.dart index 2d534ba..3a98db4 100644 --- a/lib/models/mowadhafhi/get_department_sections.dart +++ b/lib/models/mowadhafhi/get_department_sections.dart @@ -30,7 +30,7 @@ class GetDepartmentSections { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['departmentId'] = this.departmentId; data['departmentName'] = this.departmentName; data['departmentSectionId'] = this.departmentSectionId; diff --git a/lib/models/mowadhafhi/get_project_departments.dart b/lib/models/mowadhafhi/get_project_departments.dart index 436399d..53a2d5d 100644 --- a/lib/models/mowadhafhi/get_project_departments.dart +++ b/lib/models/mowadhafhi/get_project_departments.dart @@ -21,7 +21,7 @@ class GetProjectDepartments { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['departmentId'] = this.departmentId; data['departmentName'] = this.departmentName; data['projectCode'] = this.projectCode; diff --git a/lib/models/mowadhafhi/get_projects.dart b/lib/models/mowadhafhi/get_projects.dart index 62b99c3..3e76e84 100644 --- a/lib/models/mowadhafhi/get_projects.dart +++ b/lib/models/mowadhafhi/get_projects.dart @@ -10,7 +10,7 @@ class GetMowadhafhiProjects { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['projectId'] = this.projectId; data['projectName'] = this.projectName; return data; diff --git a/lib/models/mowadhafhi/get_section_topics.dart b/lib/models/mowadhafhi/get_section_topics.dart index c596527..d7ed3b8 100644 --- a/lib/models/mowadhafhi/get_section_topics.dart +++ b/lib/models/mowadhafhi/get_section_topics.dart @@ -42,7 +42,7 @@ class GetSectionTopics { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['departmentId'] = this.departmentId; data['departmentName'] = this.departmentName; data['projectCode'] = this.projectCode; diff --git a/lib/models/mowadhafhi/get_ticket_details.dart b/lib/models/mowadhafhi/get_ticket_details.dart index 5f896bd..cc1b13c 100644 --- a/lib/models/mowadhafhi/get_ticket_details.dart +++ b/lib/models/mowadhafhi/get_ticket_details.dart @@ -57,7 +57,7 @@ class GetTicketDetailsByEmployee { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['closedBy'] = this.closedBy; data['created'] = this.created; data['departmentId'] = this.departmentId; diff --git a/lib/models/mowadhafhi/get_ticket_transactions.dart b/lib/models/mowadhafhi/get_ticket_transactions.dart index 9091761..be793ca 100644 --- a/lib/models/mowadhafhi/get_ticket_transactions.dart +++ b/lib/models/mowadhafhi/get_ticket_transactions.dart @@ -27,7 +27,7 @@ class GetTicketTransactions { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['actionBy'] = this.actionBy; data['actionDate'] = this.actionDate; data['comments'] = this.comments; diff --git a/lib/models/mowadhafhi/get_ticket_types.dart b/lib/models/mowadhafhi/get_ticket_types.dart index ae68e2d..53a9fc4 100644 --- a/lib/models/mowadhafhi/get_ticket_types.dart +++ b/lib/models/mowadhafhi/get_ticket_types.dart @@ -12,7 +12,7 @@ class GetTicketTypes { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ticketIdPrefix'] = this.ticketIdPrefix; data['ticketTypeId'] = this.ticketTypeId; data['typeName'] = this.typeName; diff --git a/lib/models/mowadhafhi/get_tickets_list.dart b/lib/models/mowadhafhi/get_tickets_list.dart index 34005df..0172b45 100644 --- a/lib/models/mowadhafhi/get_tickets_list.dart +++ b/lib/models/mowadhafhi/get_tickets_list.dart @@ -135,7 +135,7 @@ class GetTicketsByEmployeeList { } Map toJson() { - final Map data = {}; + Map data = {}; data['agentRating'] = agentRating; data['assignedSpecialist'] = assignedSpecialist; data['assignedSpecialistName'] = assignedSpecialistName; diff --git a/lib/models/mowadhafhi/mowadhafhi_attachement_request.dart b/lib/models/mowadhafhi/mowadhafhi_attachement_request.dart index a72bd16..e223834 100644 --- a/lib/models/mowadhafhi/mowadhafhi_attachement_request.dart +++ b/lib/models/mowadhafhi/mowadhafhi_attachement_request.dart @@ -13,7 +13,7 @@ class MowadhafhiRequestAttachment { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['Base64Data'] = this.base64Data; data['FileName'] = this.fileName; data['ContentType'] = this.contentType; diff --git a/lib/models/notification_action_model.dart b/lib/models/notification_action_model.dart index a1214e1..3398ed6 100644 --- a/lib/models/notification_action_model.dart +++ b/lib/models/notification_action_model.dart @@ -10,7 +10,7 @@ class NotificationAction { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; return data; diff --git a/lib/models/notification_get_respond_attributes_list_model.dart b/lib/models/notification_get_respond_attributes_list_model.dart index 9810e24..e85e2c8 100644 --- a/lib/models/notification_get_respond_attributes_list_model.dart +++ b/lib/models/notification_get_respond_attributes_list_model.dart @@ -14,7 +14,7 @@ class NotificationGetRespondAttributesList { } Map toJson() { - final Map data = {}; + Map data = {}; data['ATTRIBUTE_DISPLAY_NAME'] = attributeDisplayName; data['ATTRIBUTE_FORMAT'] = attributeFormat; data['ATTRIBUTE_NAME'] = attributeName; diff --git a/lib/models/payslip/get_deductions_list.dart b/lib/models/payslip/get_deductions_list.dart index 7a99447..07bf1ba 100644 --- a/lib/models/payslip/get_deductions_list.dart +++ b/lib/models/payslip/get_deductions_list.dart @@ -24,7 +24,7 @@ class GetDeductionsList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['AMOUNT'] = this.aMOUNT; data['ELEMENT_NAME'] = this.eLEMENTNAME; data['FROM_ROW_NUM'] = this.fROMROWNUM; diff --git a/lib/models/payslip/get_earnings_list.dart b/lib/models/payslip/get_earnings_list.dart index 272dab3..a374733 100644 --- a/lib/models/payslip/get_earnings_list.dart +++ b/lib/models/payslip/get_earnings_list.dart @@ -25,7 +25,7 @@ class GetEarningsList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['AMOUNT'] = this.aMOUNT; data['ELEMENT_NAME'] = this.eLEMENTNAME; data['FROM_ROW_NUM'] = this.fROMROWNUM; diff --git a/lib/models/payslip/get_payment_information.dart b/lib/models/payslip/get_payment_information.dart index 277b409..7d92eba 100644 --- a/lib/models/payslip/get_payment_information.dart +++ b/lib/models/payslip/get_payment_information.dart @@ -22,7 +22,7 @@ class GetPaymentInformationList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ACCOUNT_NUMBER'] = this.aCCOUNTNUMBER; data['AMOUNT'] = this.aMOUNT; data['BANK_NAME'] = this.bANKNAME; diff --git a/lib/models/payslip/get_payslip.dart b/lib/models/payslip/get_payslip.dart index 2bb8280..bc85d16 100644 --- a/lib/models/payslip/get_payslip.dart +++ b/lib/models/payslip/get_payslip.dart @@ -26,7 +26,7 @@ class GetPayslipList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ACTION_CONTEXT_ID'] = this.aCTIONCONTEXTID; data['PAYMENT_DATE'] = this.pAYMENTDATE; data['PAYSLIP_CHOICE'] = this.pAYSLIPCHOICE; diff --git a/lib/models/payslip/get_summary_of_payment.dart b/lib/models/payslip/get_summary_of_payment.dart index abf3dc4..e977371 100644 --- a/lib/models/payslip/get_summary_of_payment.dart +++ b/lib/models/payslip/get_summary_of_payment.dart @@ -26,7 +26,7 @@ class GetSummaryOfPaymentList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['TOTAL_DEDUCTIONS_AMOUNT'] = this.tOTALDEDUCTIONSAMOUNT; data['TOTAL_DEDUCTIONS_PERCENTAGE'] = this.tOTALDEDUCTIONSPERCENTAGE; data['TOTAL_EARNINGS_AMOUNT'] = this.tOTALEARNINGSAMOUNT; diff --git a/lib/models/pending_transactions/get_pending_transactions_details.dart b/lib/models/pending_transactions/get_pending_transactions_details.dart index 0752269..711d689 100644 --- a/lib/models/pending_transactions/get_pending_transactions_details.dart +++ b/lib/models/pending_transactions/get_pending_transactions_details.dart @@ -39,7 +39,7 @@ class GetPendingTransactionsDetails { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['CREATION_DATE'] = this.cREATIONDATE; data['FROM_ROW_NUM'] = this.fROMROWNUM; data['ITEM_KEY'] = this.iTEMKEY; diff --git a/lib/models/pending_transactions/get_req_functions.dart b/lib/models/pending_transactions/get_req_functions.dart index bfb5892..22e4ced 100644 --- a/lib/models/pending_transactions/get_req_functions.dart +++ b/lib/models/pending_transactions/get_req_functions.dart @@ -13,7 +13,7 @@ class GetPendingTransactionsFunctions { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['FUNCTION_ID'] = this.fUNCTIONID; data['FUNCTION_NAME'] = this.fUNCTIONNAME; data['FUNCTION_PROMPT'] = this.fUNCTIONPROMPT; diff --git a/lib/models/post_params_model.dart b/lib/models/post_params_model.dart index 7e62257..b44bec9 100644 --- a/lib/models/post_params_model.dart +++ b/lib/models/post_params_model.dart @@ -43,7 +43,7 @@ class PostParamsModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['VersionID'] = this.versionID; data['Channel'] = this.channel; data['LanguageID'] = this.languageID; @@ -56,7 +56,7 @@ class PostParamsModel { } Map toJsonAfterLogin() { - final Map data = new Map(); + Map data = new Map(); data['VersionID'] = this.versionID; data['Channel'] = this.channel; data['LanguageID'] = this.languageID; diff --git a/lib/models/privilege_list_model.dart b/lib/models/privilege_list_model.dart index ad83500..3d39118 100644 --- a/lib/models/privilege_list_model.dart +++ b/lib/models/privilege_list_model.dart @@ -17,7 +17,7 @@ class PrivilegeListModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ID'] = this.iD; data['ServiceName'] = this.serviceName; data['Previlege'] = this.previlege; diff --git a/lib/models/profile/basic_details_cols_structions.dart b/lib/models/profile/basic_details_cols_structions.dart index dceacd6..bb3138c 100644 --- a/lib/models/profile/basic_details_cols_structions.dart +++ b/lib/models/profile/basic_details_cols_structions.dart @@ -45,7 +45,7 @@ class GetBasicDetColsStructureList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; data['DATATYPE'] = this.dATATYPE; data['DISPLAY_FLAG'] = this.dISPLAYFLAG; @@ -76,7 +76,7 @@ class ObjectValuesList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['CODE'] = this.cODE; data['DESCRIPTION'] = this.dESCRIPTION; data['MEANING'] = this.mEANING; diff --git a/lib/models/profile/basic_details_dff_structure.dart b/lib/models/profile/basic_details_dff_structure.dart index 9d44b85..cb68ac5 100644 --- a/lib/models/profile/basic_details_dff_structure.dart +++ b/lib/models/profile/basic_details_dff_structure.dart @@ -142,7 +142,7 @@ class GetBasicDetDffStructureList { } Map toJson() { - final Map data = Map(); + Map data = Map(); data['ALPHANUMERIC_ALLOWED_FLAG'] = this.aLPHANUMERICALLOWEDFLAG; data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; data['CHILD_SEGMENTS_VS'] = this.cHILDSEGMENTSVS; diff --git a/lib/models/profile/get_address_dff_structure_list.dart b/lib/models/profile/get_address_dff_structure_list.dart index 50d9b97..786e683 100644 --- a/lib/models/profile/get_address_dff_structure_list.dart +++ b/lib/models/profile/get_address_dff_structure_list.dart @@ -137,7 +137,7 @@ class GetAddressDffStructureList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ALPHANUMERIC_ALLOWED_FLAG'] = this.aLPHANUMERICALLOWEDFLAG; data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; data['CHILD_SEGMENTS_VS'] = this.cHILDSEGMENTSVS; diff --git a/lib/models/profile/get_contact_clos_structure_list.dart b/lib/models/profile/get_contact_clos_structure_list.dart index 7f3ad90..29b991b 100644 --- a/lib/models/profile/get_contact_clos_structure_list.dart +++ b/lib/models/profile/get_contact_clos_structure_list.dart @@ -51,7 +51,7 @@ class GetContactColsStructureList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; data['DATATYPE'] = this.dATATYPE; data['DISPLAY_FLAG'] = this.dISPLAYFLAG; @@ -84,7 +84,7 @@ class ObjectValuesList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['CODE'] = this.cODE; data['DESCRIPTION'] = this.dESCRIPTION; data['MEANING'] = this.mEANING; diff --git a/lib/models/profile/get_contact_details_list.dart b/lib/models/profile/get_contact_details_list.dart index 9097291..4b8dbbc 100644 --- a/lib/models/profile/get_contact_details_list.dart +++ b/lib/models/profile/get_contact_details_list.dart @@ -38,7 +38,7 @@ class GetContactDetailsList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['APPLICATION_COLUMN_NAME'] = this.aPPLICATIONCOLUMNNAME; data['DATATYPE'] = this.dATATYPE; data['DATE_VALUE'] = this.dATEVALUE; diff --git a/lib/models/profile/get_countries_list_model.dart b/lib/models/profile/get_countries_list_model.dart index dc9e9c7..b8ae1e4 100644 --- a/lib/models/profile/get_countries_list_model.dart +++ b/lib/models/profile/get_countries_list_model.dart @@ -10,7 +10,7 @@ class GetCountriesListModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['COUNTRY_CODE'] = this.cOUNTRYCODE; data['COUNTRY_NAME'] = this.cOUNTRYNAME; return data; diff --git a/lib/models/profile/phone_number_types_model.dart b/lib/models/profile/phone_number_types_model.dart index 47b8a35..417ba87 100644 --- a/lib/models/profile/phone_number_types_model.dart +++ b/lib/models/profile/phone_number_types_model.dart @@ -12,7 +12,7 @@ class GetPhoneNumberTypesModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['CODE'] = this.cODE; data['DESCRIPTION'] = this.dESCRIPTION; data['MEANING'] = this.mEANING; diff --git a/lib/models/profile/start_address_approval_process_model.dart b/lib/models/profile/start_address_approval_process_model.dart index 717298d..6083057 100644 --- a/lib/models/profile/start_address_approval_process_model.dart +++ b/lib/models/profile/start_address_approval_process_model.dart @@ -10,7 +10,7 @@ class StartAddressApprovalProcess { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; return data; diff --git a/lib/models/profile/submit_address_transaction.dart b/lib/models/profile/submit_address_transaction.dart index 193cb68..a2cd874 100644 --- a/lib/models/profile/submit_address_transaction.dart +++ b/lib/models/profile/submit_address_transaction.dart @@ -14,7 +14,7 @@ class SubmitAddressTransaction { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_ITEM_KEY'] = this.pITEMKEY; data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; diff --git a/lib/models/profile/submit_basic_details_transaction_model.dart b/lib/models/profile/submit_basic_details_transaction_model.dart index db6ea7a..bed00ed 100644 --- a/lib/models/profile/submit_basic_details_transaction_model.dart +++ b/lib/models/profile/submit_basic_details_transaction_model.dart @@ -14,7 +14,7 @@ class SubmitBasicDetailsTransactionList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_ITEM_KEY'] = this.pITEMKEY; data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; diff --git a/lib/models/profile/submit_contact_transaction_list_model.dart b/lib/models/profile/submit_contact_transaction_list_model.dart index 3510473..531567c 100644 --- a/lib/models/profile/submit_contact_transaction_list_model.dart +++ b/lib/models/profile/submit_contact_transaction_list_model.dart @@ -19,7 +19,7 @@ class SubmitContactTransactionList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_ITEM_KEY'] = this.pITEMKEY; data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; diff --git a/lib/models/profile/submit_phone_transactions.dart b/lib/models/profile/submit_phone_transactions.dart index 6b7afd1..c9af8b0 100644 --- a/lib/models/profile/submit_phone_transactions.dart +++ b/lib/models/profile/submit_phone_transactions.dart @@ -14,7 +14,7 @@ class SubmitPhonesTransactionList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_ITEM_KEY'] = this.pITEMKEY; data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; diff --git a/lib/models/start_eit_approval_process_model.dart b/lib/models/start_eit_approval_process_model.dart index f49043b..359b882 100644 --- a/lib/models/start_eit_approval_process_model.dart +++ b/lib/models/start_eit_approval_process_model.dart @@ -10,7 +10,7 @@ class StartEitApprovalProcess { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; return data; diff --git a/lib/models/start_phone_approval_process_model.dart b/lib/models/start_phone_approval_process_model.dart index 2ce3a15..005b29a 100644 --- a/lib/models/start_phone_approval_process_model.dart +++ b/lib/models/start_phone_approval_process_model.dart @@ -10,7 +10,7 @@ class StartPhoneApprovalProcess { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; return data; diff --git a/lib/models/submit_eit_transaction_list_model.dart b/lib/models/submit_eit_transaction_list_model.dart index 288ce8e..f493f8b 100644 --- a/lib/models/submit_eit_transaction_list_model.dart +++ b/lib/models/submit_eit_transaction_list_model.dart @@ -18,7 +18,7 @@ class SubmitEITTransactionList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_ITEM_KEY'] = this.pITEMKEY; data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; diff --git a/lib/models/subordinates_on_leaves_model.dart b/lib/models/subordinates_on_leaves_model.dart index d6437f3..aac37ff 100644 --- a/lib/models/subordinates_on_leaves_model.dart +++ b/lib/models/subordinates_on_leaves_model.dart @@ -48,7 +48,7 @@ class SubordinatesLeavesList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ABSENCE_ATTENDANCE_TYPE_NAME'] = this.aBSENCEATTENDANCETYPENAME; data['CALENDAR_ENTRY_DESC'] = this.cALENDARENTRYDESC; data['DATE_END'] = this.dATEEND; diff --git a/lib/models/surah_model.dart b/lib/models/surah_model.dart index acc171a..bd96e18 100644 --- a/lib/models/surah_model.dart +++ b/lib/models/surah_model.dart @@ -19,7 +19,7 @@ class SurahModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['totalItemsCount'] = totalItemsCount; data['statusCode'] = statusCode; data['message'] = message; @@ -58,7 +58,7 @@ class SurahModelData { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['id'] = this.id; data['surahID'] = this.surahID; data['nameAR'] = this.nameAR; diff --git a/lib/models/vacation_rule/create_vacation_rule_list_model.dart b/lib/models/vacation_rule/create_vacation_rule_list_model.dart index 5fd489a..cff2a49 100644 --- a/lib/models/vacation_rule/create_vacation_rule_list_model.dart +++ b/lib/models/vacation_rule/create_vacation_rule_list_model.dart @@ -10,7 +10,7 @@ class CreateVacationRuleList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; return data; diff --git a/lib/models/vacation_rule/get_item_type_notifications_list_model.dart b/lib/models/vacation_rule/get_item_type_notifications_list_model.dart index 4d80a0e..ef11453 100644 --- a/lib/models/vacation_rule/get_item_type_notifications_list_model.dart +++ b/lib/models/vacation_rule/get_item_type_notifications_list_model.dart @@ -18,7 +18,7 @@ class GetItemTypeNotificationsList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['FYI_FLAG'] = this.fYIFLAG; data['NOTIFICATION_DISPLAY_NAME'] = this.nOTIFICATIONDISPLAYNAME; data['NOTIFICATION_NAME'] = this.nOTIFICATIONNAME; diff --git a/lib/models/vacation_rule/get_notification_reassign_mode_list_model.dart b/lib/models/vacation_rule/get_notification_reassign_mode_list_model.dart index e3495d0..c111a71 100644 --- a/lib/models/vacation_rule/get_notification_reassign_mode_list_model.dart +++ b/lib/models/vacation_rule/get_notification_reassign_mode_list_model.dart @@ -13,7 +13,7 @@ class GetNotificationReassignModeList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['RADIO_BUTTON_ACTION'] = this.rADIOBUTTONACTION; data['RADIO_BUTTON_LABEL'] = this.rADIOBUTTONLABEL; data['RADIO_BUTTON_SEQ'] = this.rADIOBUTTONSEQ; diff --git a/lib/models/vacation_rule/get_vacation_rules_list_model.dart b/lib/models/vacation_rule/get_vacation_rules_list_model.dart index 5abd32a..f93fdb5 100644 --- a/lib/models/vacation_rule/get_vacation_rules_list_model.dart +++ b/lib/models/vacation_rule/get_vacation_rules_list_model.dart @@ -66,7 +66,7 @@ class GetVacationRulesList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ACTION'] = this.aCTION; data['ACTION_DISPLAY'] = this.aCTIONDISPLAY; data['BEGIN_DATE'] = this.bEGINDATE; diff --git a/lib/models/vacation_rule/respond_attributes_list_model.dart b/lib/models/vacation_rule/respond_attributes_list_model.dart index ca7b2db..79de43f 100644 --- a/lib/models/vacation_rule/respond_attributes_list_model.dart +++ b/lib/models/vacation_rule/respond_attributes_list_model.dart @@ -18,7 +18,7 @@ class RespondAttributesList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ATTRIBUTE_DISPLAY_NAME'] = this.aTTRIBUTEDISPLAYNAME; data['ATTRIBUTE_FORMAT'] = this.aTTRIBUTEFORMAT; data['ATTRIBUTE_NAME'] = this.aTTRIBUTENAME; diff --git a/lib/models/vacation_rule/vr_item_types_list_model.dart b/lib/models/vacation_rule/vr_item_types_list_model.dart index d31ffa6..69735db 100644 --- a/lib/models/vacation_rule/vr_item_types_list_model.dart +++ b/lib/models/vacation_rule/vr_item_types_list_model.dart @@ -10,7 +10,7 @@ class VrItemTypesList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['ITEM_TYPE'] = this.iTEMTYPE; data['ITEM_TYPE_DISPLAY_NAME'] = this.iTEMTYPEDISPLAYNAME; return data; diff --git a/lib/models/vacation_rule/wf_look_up_list_model.dart b/lib/models/vacation_rule/wf_look_up_list_model.dart index 25fb2ee..3b48e26 100644 --- a/lib/models/vacation_rule/wf_look_up_list_model.dart +++ b/lib/models/vacation_rule/wf_look_up_list_model.dart @@ -12,7 +12,7 @@ class WFLookUpList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['LOOKUP_CODE'] = this.lOOKUPCODE; data['LOOKUP_DESCRIPTION'] = this.lOOKUPDESCRIPTION; data['LOOKUP_MEANING'] = this.lOOKUPMEANING; diff --git a/lib/models/validate_eit_transaction_list_model.dart b/lib/models/validate_eit_transaction_list_model.dart index 02f2af0..ac35c17 100644 --- a/lib/models/validate_eit_transaction_list_model.dart +++ b/lib/models/validate_eit_transaction_list_model.dart @@ -10,7 +10,7 @@ class ValidateEITTransactionList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['P_RETURN_MSG'] = this.pRETURNMSG; data['P_RETURN_STATUS'] = this.pRETURNSTATUS; return data; diff --git a/lib/models/worklist/hr/get_basic_det_ntf_body_list_model.dart b/lib/models/worklist/hr/get_basic_det_ntf_body_list_model.dart index afdcd29..0275ce5 100644 --- a/lib/models/worklist/hr/get_basic_det_ntf_body_list_model.dart +++ b/lib/models/worklist/hr/get_basic_det_ntf_body_list_model.dart @@ -14,7 +14,7 @@ class GetBasicDetNtfBodyList { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['PREV_SEGMENT_VALUE_DSP'] = this.prevSegmentValueDsp; data['SEGMENT_PROMPT'] = this.segmentPrompt; data['SEGMENT_VALUE_DSP'] = this.segmentValueDsp; diff --git a/lib/models/worklist_item_type_model.dart b/lib/models/worklist_item_type_model.dart index 49346c0..b164bd0 100644 --- a/lib/models/worklist_item_type_model.dart +++ b/lib/models/worklist_item_type_model.dart @@ -24,7 +24,7 @@ class WorkListItemTypeModelData { } Map toJson() { - final Map data = {}; + Map data = {}; data['value'] = value; data['name'] = name; data['fullName'] = fullName; diff --git a/lib/models/worklist_response_model.dart b/lib/models/worklist_response_model.dart index 4899d5a..0ab44cf 100644 --- a/lib/models/worklist_response_model.dart +++ b/lib/models/worklist_response_model.dart @@ -100,7 +100,7 @@ class WorkListResponseModel { } Map toJson() { - final Map data = new Map(); + Map data = new Map(); data['BEGIN_DATE'] = this.bEGINDATE; data['DUE_DATE'] = this.dUEDATE; data['END_DATE'] = this.eNDDATE; diff --git a/lib/ui/attendance/add_vacation_rule_screen.dart b/lib/ui/attendance/add_vacation_rule_screen.dart index b7f7f5d..4846053 100644 --- a/lib/ui/attendance/add_vacation_rule_screen.dart +++ b/lib/ui/attendance/add_vacation_rule_screen.dart @@ -526,8 +526,8 @@ class _AddVacationRuleScreenState extends State { ), ); } 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( + DateTime? picked = await showDatePicker(context: context, initialDate: _time, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + TimeOfDay? timePicked = await showTimePicker( context: context, initialTime: TimeOfDay.fromDateTime(picked!), ); @@ -570,7 +570,7 @@ class _AddVacationRuleScreenState extends State { ), ); } else { - final DateTime? picked = + 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; diff --git a/lib/ui/attendance/monthly_attendance_screen.dart b/lib/ui/attendance/monthly_attendance_screen.dart index 6a73f70..caaf65c 100644 --- a/lib/ui/attendance/monthly_attendance_screen.dart +++ b/lib/ui/attendance/monthly_attendance_screen.dart @@ -694,7 +694,7 @@ class _MonthlyAttendanceScreenState extends State { } List _getDataSource() { - final List meetings = []; + List meetings = []; return meetings; } @@ -792,7 +792,7 @@ class MeetingDataSource extends CalendarDataSource { } Meeting _getMeetingData(int index) { - final dynamic meeting = appointments; + dynamic meeting = appointments; Meeting meetingData; if (meeting is Meeting) { meetingData = meeting; diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index da9cb5f..4a6ad82 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -56,7 +56,7 @@ class _DashboardScreenState extends State { @override Widget build(BuildContext context) { List namesD = ["Nostalgia Perfume Perfume", "Al Nafoura", "AlJadi", "Nostalgia Perfume"]; - final GlobalKey _key = GlobalKey(); // + GlobalKey _key = GlobalKey(); // return Scaffold( key: _scaffoldState, body: Column( 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 051d72a..72b0567 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -736,7 +736,7 @@ class _DynamicInputScreenState extends State { ), ); } else { - final DateTime? picked = + DateTime? picked = await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); if (picked != null && picked != selectedDate) { time = picked; @@ -768,7 +768,7 @@ class _DynamicInputScreenState extends State { ), ); } else { - final TimeOfDay? picked = await showTimePicker( + TimeOfDay? picked = await showTimePicker( context: context, initialTime: time, builder: (cxt, child) { diff --git a/lib/ui/profile/add_update_family_member.dart b/lib/ui/profile/add_update_family_member.dart index 9a0bd66..6ad82d0 100644 --- a/lib/ui/profile/add_update_family_member.dart +++ b/lib/ui/profile/add_update_family_member.dart @@ -345,7 +345,7 @@ class _AddUpdateFamilyMemberState extends State { ), ); } else { - final DateTime? picked = + DateTime? picked = await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); if (picked != null && picked != selectedDate) { time = picked; diff --git a/lib/ui/profile/delete_family_member.dart b/lib/ui/profile/delete_family_member.dart index 58ec825..af4601d 100644 --- a/lib/ui/profile/delete_family_member.dart +++ b/lib/ui/profile/delete_family_member.dart @@ -141,7 +141,7 @@ class _DeleteFamilyMemberState extends State { ), ); } else { - final DateTime? picked = + DateTime? picked = await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); if (picked != null && picked != selectedDate) { time = picked; diff --git a/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart index c4dadd2..815db77 100644 --- a/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart +++ b/lib/ui/profile/dynamic_screens/dynamic_input_address_screen.dart @@ -325,7 +325,7 @@ class _DynamicInputScreenState extends State { ), ); } else { - final DateTime? picked = + DateTime? picked = await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); if (picked != null && picked != selectedDate) { time = picked; diff --git a/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart b/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart index a279305..422d67b 100644 --- a/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart +++ b/lib/ui/profile/dynamic_screens/dynamic_input_basic_details_screen.dart @@ -336,7 +336,7 @@ class _DynamicInputScreenState extends State { ), ); } else { - final DateTime? picked = + DateTime? picked = await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); if (picked != null && picked != selectedDate) { time = picked; diff --git a/lib/ui/profile/profile_screen.dart b/lib/ui/profile/profile_screen.dart index cea9f11..8caf637 100644 --- a/lib/ui/profile/profile_screen.dart +++ b/lib/ui/profile/profile_screen.dart @@ -138,7 +138,7 @@ class _ProfileScreenState extends State { } void openGallery(bool isCamera) async { - final XFile? image = await _picker.pickImage(source: isCamera ? ImageSource.camera : ImageSource.gallery); + XFile? image = await _picker.pickImage(source: isCamera ? ImageSource.camera : ImageSource.gallery); if (image != null) { String img = base64.encode(await image!.readAsBytes()); diff --git a/lib/ui/screens/announcements/announcement_details.dart b/lib/ui/screens/announcements/announcement_details.dart index a8b2c2c..06af534 100644 --- a/lib/ui/screens/announcements/announcement_details.dart +++ b/lib/ui/screens/announcements/announcement_details.dart @@ -67,7 +67,7 @@ class _AnnouncementDetailsState extends State { void getRequestID() { if (currentPageNo == 0) { - final arguments = (ModalRoute.of(context)?.settings.arguments ?? {}) as Map; + Map arguments = (ModalRoute.of(context)?.settings.arguments ?? {}) as Map; currentPageNo = arguments["currentPageNo"]; rowID = arguments["rowID"]; getAnnouncementDetails(0, rowID); diff --git a/lib/ui/screens/pending_transactions/pending_transactions.dart b/lib/ui/screens/pending_transactions/pending_transactions.dart index 997ec0d..0a69c60 100644 --- a/lib/ui/screens/pending_transactions/pending_transactions.dart +++ b/lib/ui/screens/pending_transactions/pending_transactions.dart @@ -4,7 +4,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/pending_transactions_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'; @@ -39,88 +38,74 @@ class _PendingTransactionsState extends State { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Colors.white, - appBar: AppBarWidget( - context, - title: LocaleKeys.pendingTransactions.tr(), - ), - body: SingleChildScrollView( - child: Container( - width: double.infinity, - padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), - margin: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), - 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( - children: [ - 12.height, - PopupMenuButton( - child: DynamicTextFieldWidget( - LocaleKeys.selectRequestType.tr(), - selectedFunction?.fUNCTIONPROMPT ?? "", - isEnable: false, - isPopup: true, - isInputTypeNum: true, - isReadOnly: false, - ).paddingOnly(bottom: 12), - itemBuilder: (_) => >[ - for (int i = 0; i < getPendingTransactionsFunctions!.length; i++) PopupMenuItem(child: Text(getPendingTransactionsFunctions![i].fUNCTIONPROMPT!), value: i), - ], - onSelected: (int popupIndex) { - selectedFunction = getPendingTransactionsFunctions[popupIndex]; - setState(() {}); - }), - 12.height, - DynamicTextFieldWidget( - LocaleKeys.dateFrom.tr(), - selectedDateFrom.toString().split(" ")[0], - suffixIconData: Icons.calendar_today, - isEnable: false, - onTap: () async { - selectedDateFrom = await _selectDate(context, DateTime.now()); - setState(() {}); - }, - ).paddingOnly(bottom: 12), - 12.height, - DynamicTextFieldWidget( - LocaleKeys.dateTo.tr(), - selectedDateTo.toString().split(" ")[0], - suffixIconData: Icons.calendar_today, - isEnable: false, - onTap: () async { - selectedDateTo = await _selectDate(context, DateTime.now()); + backgroundColor: Colors.white, + appBar: AppBarWidget( + context, + title: LocaleKeys.pendingTransactions.tr(), + ), + body: Column( + children: [ + Column( + children: [ + PopupMenuButton( + child: DynamicTextFieldWidget( + LocaleKeys.requestType.tr(), + selectedFunction?.fUNCTIONPROMPT ?? LocaleKeys.selectRequestType.tr(), + isEnable: false, + isPopup: true, + isInputTypeNum: true, + isReadOnly: false, + ), + itemBuilder: (_) => >[ + for (int i = 0; i < getPendingTransactionsFunctions.length; i++) PopupMenuItem(child: Text(getPendingTransactionsFunctions![i].fUNCTIONPROMPT!), value: i), + ], + onSelected: (int popupIndex) { + selectedFunction = getPendingTransactionsFunctions[popupIndex]; setState(() {}); - }, - ).paddingOnly(bottom: 12), - ], - ), - ), - ), - bottomSheet: Container( - decoration: const BoxDecoration( - color: MyColors.white, - boxShadow: [ - BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), + }), + 12.height, + DynamicTextFieldWidget( + LocaleKeys.dateFrom.tr(), + selectedDateFrom.toString().split(" ")[0], + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + selectedDateFrom = await _selectDate(context, DateTime.now()); + setState(() {}); + }, + ), + 12.height, + DynamicTextFieldWidget( + LocaleKeys.dateTo.tr(), + selectedDateTo.toString().split(" ")[0], + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + selectedDateTo = await _selectDate(context, DateTime.now()); + setState(() {}); + }, + ) ], - ), - child: DefaultButton( + ).objectContainerView().expanded, + DefaultButton( LocaleKeys.submit.tr(), selectedFunction == null ? null : () async { - openRequestDetails(); + Navigator.pushNamed( + context, + AppRoutes.pendingTransactionsDetails, + arguments: { + "selectedFunctionID": selectedFunction?.fUNCTIONID, + "dateFrom": DateUtil.convertDateToString(selectedDateFrom), + "dateTo": DateUtil.convertDateToString(selectedDateTo) + }, + ); }) - .insideContainer, - )); + .insideContainer + ], + ), + ); } Future _selectDate(BuildContext context, DateTime selectedDate) async { @@ -144,8 +129,7 @@ class _PendingTransactionsState extends State { ), ); } else { - final DateTime? picked = - await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + DateTime? picked = await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); if (picked != null && picked != selectedDate) { time = picked; } @@ -163,20 +147,4 @@ class _PendingTransactionsState extends State { Utils.handleException(ex, context, null); } } - - void openRequestDetails() async { - await Navigator.pushNamed(context, AppRoutes.pendingTransactionsDetails, - arguments: {"selectedFunctionID": selectedFunction?.fUNCTIONID, "dateFrom": DateUtil.convertDateToString(selectedDateFrom), "dateTo": DateUtil.convertDateToString(selectedDateTo)}); - } - - void getPendingReqDetails() async { - try { - Utils.showLoading(context); - getPendingTransactionsFunctions = await PendingTransactionsApiClient().getPendingReqFunctions(); - Utils.hideLoading(context); - } catch (ex) { - Utils.hideLoading(context); - Utils.handleException(ex, context, null); - } - } } diff --git a/lib/ui/screens/pending_transactions/pending_transactions_details.dart b/lib/ui/screens/pending_transactions/pending_transactions_details.dart index 2c8895a..0ff7f06 100644 --- a/lib/ui/screens/pending_transactions/pending_transactions_details.dart +++ b/lib/ui/screens/pending_transactions/pending_transactions_details.dart @@ -1,13 +1,13 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/pending_transactions_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/pending_transactions/get_pending_transactions_details.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; class PendingTransactionsDetails extends StatefulWidget { const PendingTransactionsDetails({Key? key}) : super(key: key); @@ -21,7 +21,7 @@ class _PendingTransactionsDetailsState extends State String dateFrom = ""; String dateTo = ""; - List getPendingTransactionsDetails = []; + List? getPendingTransactionsDetails; @override void initState() { @@ -30,7 +30,7 @@ class _PendingTransactionsDetailsState extends State void getFunctionID() { if (functionID == "") { - final arguments = (ModalRoute.of(context)?.settings.arguments ?? {}) as Map; + Map arguments = (ModalRoute.of(context)?.settings.arguments ?? {}) as Map; functionID = arguments["selectedFunctionID"].toString(); dateFrom = arguments["dateFrom"]; dateTo = arguments["dateTo"]; @@ -47,81 +47,27 @@ class _PendingTransactionsDetailsState extends State context, title: LocaleKeys.pendingTransactions.tr(), ), - body: getPendingTransactionsDetails.isNotEmpty - ? Container( - margin: const EdgeInsets.only(top: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: ListView.separated( - physics: const BouncingScrollPhysics(), - shrinkWrap: true, - itemBuilder: (BuildContext context, int index) { - return Container( - width: double.infinity, - padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), - margin: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), - 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, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - "Created For ".toText14(color: MyColors.grey57Color), - getPendingTransactionsDetails[index].tRANSACTIONCREATEDFOR!.toText14(color: MyColors.grey57Color), - ], - ), - Column( - children: [ - getPendingTransactionsDetails[index].cREATIONDATE!.split(" ")[0].toText12(color: MyColors.grey70Color), - getPendingTransactionsDetails[index].cREATIONDATE!.split(" ")[1].toText12(color: MyColors.grey70Color), - ], - ), - ], - ), - Container( - child: Row( - children: [ - "Request Name: ".toText14(color: MyColors.grey57Color), - getPendingTransactionsDetails[index].uSERFUNCTIONNAME!.toText12(color: MyColors.grey57Color), - ], - ), - ), - Container( - padding: const EdgeInsets.only(top: 0.0), - child: Row( - children: [ - LocaleKeys.requestType.tr().toText14(color: MyColors.grey57Color), - getPendingTransactionsDetails[index].rEQUESTTYPE!.toText14(color: MyColors.redColor), - ], - ), - ), - ], - ), - ); - }, - separatorBuilder: (BuildContext context, int index) => 12.height, - itemCount: getPendingTransactionsDetails.length ?? 0)) - ], - ), - ) - : Utils.getNoDataWidget(context), + body: getPendingTransactionsDetails == null + ? const SizedBox() + : (getPendingTransactionsDetails!.isNotEmpty + ? ListView.separated( + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.all(21), + itemBuilder: (BuildContext context, int index) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ItemDetailView(LocaleKeys.createdFor.tr(), getPendingTransactionsDetails![index].tRANSACTIONCREATEDFOR!), + ItemDetailView(LocaleKeys.creationDate.tr(), getPendingTransactionsDetails![index].cREATIONDATE!), + ItemDetailView(LocaleKeys.requestName.tr(), getPendingTransactionsDetails![index].uSERFUNCTIONNAME!), + ItemDetailView(LocaleKeys.requestType.tr(), getPendingTransactionsDetails![index].rEQUESTTYPE!), + ], + ).objectContainerView(); + }, + separatorBuilder: (BuildContext context, int index) => 12.height, + itemCount: getPendingTransactionsDetails!.length) + : Utils.getNoDataWidget(context)), ); } diff --git a/lib/widgets/circular_step_progress_bar.dart b/lib/widgets/circular_step_progress_bar.dart index 6789aed..b137dc6 100644 --- a/lib/widgets/circular_step_progress_bar.dart +++ b/lib/widgets/circular_step_progress_bar.dart @@ -173,7 +173,7 @@ class CircularStepProgressBar extends StatelessWidget { Widget build(BuildContext context) { // Print warning when arcSize greater than math.pi * 2 which causes steps to overlap if (arcSize > math.pi * 2) print("WARNING (step_progress_indicator): arcSize of CircularStepProgressBar is greater than 360° (math.pi * 2), this will cause some steps to overlap!"); - final TextDirection textDirection = Directionality.of(context); + TextDirection textDirection = Directionality.of(context); return LayoutBuilder( builder: (context, constraints) => SizedBox( @@ -232,7 +232,7 @@ class CircularStepProgressBar extends StatelessWidget { for (int step = 0; step < totalSteps; ++step) { // Consider max between selected and unselected case - final customSizeValue = math.max(customStepSize!(step, false), customStepSize!(step, true)); + var customSizeValue = math.max(customStepSize!(step, false), customStepSize!(step, true)); if (customSizeValue > currentMaxSize) { currentMaxSize = customSizeValue; } @@ -288,19 +288,19 @@ class _CircularIndicatorPainter implements CustomPainter { @override void paint(Canvas canvas, Size size) { - final w = size.width; - final h = size.height; + var w = size.width; + var h = size.height; // Step length is user-defined arcSize // divided by the total number of steps (each step same size) - final stepLength = arcSize / totalSteps; + var stepLength = arcSize / totalSteps; // Define general arc paint Paint paint = Paint() ..style = PaintingStyle.stroke ..strokeWidth = maxDefinedSize; - final rect = Rect.fromCenter( + var rect = Rect.fromCenter( // Rect created from the center of the widget center: Offset(w / 2, h / 2), // For both height and width, subtract maxDefinedSize to fit indicator inside the parent container @@ -313,7 +313,7 @@ class _CircularIndicatorPainter implements CustomPainter { } // Change color selected or unselected based on the circularDirection - final isClockwise = circularDirection == CircularDirection.clockwise; + var isClockwise = circularDirection == CircularDirection.clockwise; // Make a continuous arc without rendering all the steps when possible if (padding == 0 && customColor == null && customStepSize == null && roundedCap == null) { @@ -334,10 +334,10 @@ class _CircularIndicatorPainter implements CustomPainter { double stepAngle = isClockwise ? startingAngle - stepLength : startingAngle; for (; isClockwise ? step >= 0 : step < totalSteps; isClockwise ? stepAngle -= stepLength : stepAngle += stepLength, isClockwise ? --step : ++step) { // Check if the current step is selected or unselected - final isSelectedColor = _isSelectedColor(step, isClockwise); + var isSelectedColor = _isSelectedColor(step, isClockwise); // Size of the step - final indexStepSize = customStepSize != null + var indexStepSize = customStepSize != null // Consider step index inverted when counterclockwise ? customStepSize!(_indexOfStep(step, isClockwise), isSelectedColor) : isSelectedColor @@ -345,7 +345,7 @@ class _CircularIndicatorPainter implements CustomPainter { : unselectedStepSize ?? stepSize; // Use customColor if defined - final stepColor = customColor != null + var stepColor = customColor != null // Consider step index inverted when counterclockwise ? customColor!(_indexOfStep(step, isClockwise)) : isSelectedColor @@ -353,14 +353,14 @@ class _CircularIndicatorPainter implements CustomPainter { : unselectedColor!; // Apply stroke cap to each step - final hasStrokeCap = roundedCap != null ? roundedCap!(_indexOfStep(step, isClockwise), isSelectedColor) : false; - final strokeCap = hasStrokeCap ? StrokeCap.round : StrokeCap.butt; + var hasStrokeCap = roundedCap != null ? roundedCap!(_indexOfStep(step, isClockwise), isSelectedColor) : false; + var strokeCap = hasStrokeCap ? StrokeCap.round : StrokeCap.butt; // Remove extra size caused by rounded stroke cap // https://github.com/SandroMaglione/step-progress-indicator/issues/20#issue-786114745 - final extraCapSize = indexStepSize / 2; - final extraCapAngle = extraCapSize / (rect.width / 2); - final extraCapRemove = hasStrokeCap && removeRoundedCapExtraAngle; + var extraCapSize = indexStepSize / 2; + var extraCapAngle = extraCapSize / (rect.width / 2); + var extraCapRemove = hasStrokeCap && removeRoundedCapExtraAngle; // Draw arc steps of the indicator _drawArcOnCanvas( @@ -379,35 +379,35 @@ class _CircularIndicatorPainter implements CustomPainter { /// Draw optimized continuous indicator instead of multiple steps void _drawContinuousArc(Canvas canvas, Paint paint, Rect rect, bool isClockwise) { // Compute color of the selected and unselected bars - final firstStepColor = isClockwise ? selectedColor : unselectedColor; - final secondStepColor = !isClockwise ? selectedColor : unselectedColor; + var firstStepColor = isClockwise ? selectedColor : unselectedColor; + var secondStepColor = !isClockwise ? selectedColor : unselectedColor; // Selected and unselected step sizes if defined, otherwise use stepSize - final firstStepSize = isClockwise ? selectedStepSize ?? stepSize : unselectedStepSize ?? stepSize; - final secondStepSize = !isClockwise ? selectedStepSize ?? stepSize : unselectedStepSize ?? stepSize; + var firstStepSize = isClockwise ? selectedStepSize ?? stepSize : unselectedStepSize ?? stepSize; + var secondStepSize = !isClockwise ? selectedStepSize ?? stepSize : unselectedStepSize ?? stepSize; // Compute length and starting angle of the selected and unselected bars - final firstArcLength = arcSize * (currentStep / totalSteps); - final secondArcLength = arcSize - firstArcLength; + var firstArcLength = arcSize * (currentStep / totalSteps); + var secondArcLength = arcSize - firstArcLength; // firstArcStartingAngle = startingAngle - final secondArcStartingAngle = startingAngle + firstArcLength; + var secondArcStartingAngle = startingAngle + firstArcLength; // Apply stroke cap to both arcs // NOTE: For continuous circular indicator, it uses 0 and 1 as index to // apply the rounded cap - final firstArcStrokeCap = roundedCap != null + var firstArcStrokeCap = roundedCap != null ? isClockwise ? roundedCap!(0, true) : roundedCap!(1, false) : false; - final secondArcStrokeCap = roundedCap != null + var secondArcStrokeCap = roundedCap != null ? isClockwise ? roundedCap!(1, false) : roundedCap!(0, true) : false; - final firstCap = firstArcStrokeCap ? StrokeCap.round : StrokeCap.butt; - final secondCap = secondArcStrokeCap ? StrokeCap.round : StrokeCap.butt; + var firstCap = firstArcStrokeCap ? StrokeCap.round : StrokeCap.butt; + var secondCap = secondArcStrokeCap ? StrokeCap.round : StrokeCap.butt; // When clockwise, draw the second arc first and the first on top of it // Required when stroke cap is rounded to make the selected step on top of the unselected diff --git a/lib/widgets/location/Location.dart b/lib/widgets/location/Location.dart index 8456fd2..47e2238 100644 --- a/lib/widgets/location/Location.dart +++ b/lib/widgets/location/Location.dart @@ -93,7 +93,7 @@ class _Map { BitmapDescriptor? icon, VoidCallback? onTap, }) { - final MarkerId markerId = MarkerId(id); + MarkerId markerId = MarkerId(id); return Marker( icon: icon ?? BitmapDescriptor.defaultMarker, markerId: markerId, @@ -224,7 +224,7 @@ class _Map { if (bound == null) return; CameraUpdate camera = CameraUpdate.newLatLngBounds(bound, padding!); - final GoogleMapController controller = await mapController!.future; + GoogleMapController controller = await mapController!.future; controller.animateCamera(camera); } diff --git a/lib/widgets/nfc/nfc_reader_sheet.dart b/lib/widgets/nfc/nfc_reader_sheet.dart index 84397ba..53c0d4f 100644 --- a/lib/widgets/nfc/nfc_reader_sheet.dart +++ b/lib/widgets/nfc/nfc_reader_sheet.dart @@ -42,7 +42,7 @@ class _NfcLayoutState extends State { NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async { print(tag.data); var f = MifareUltralight(tag: tag, identifier: tag.data["nfca"]["identifier"], type: 2, maxTransceiveLength: 252, timeout: 22); - final String identifier = f.identifier.map((e) => e.toRadixString(16).padLeft(2, '0')).join(''); + String identifier = f.identifier.map((e) => e.toRadixString(16).padLeft(2, '0')).join(''); // print(identifier); // => 0428fcf2255e81 nfcId = identifier;