diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 00f18f3..161bde6 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -407,7 +407,7 @@ "rateUI": ".1 كيف تريد تقييم التطبيق", "submitSurvey": "ارسال الاستبيان", "typeHere": "اكتب هنا", - "info_detail": "تفاصيل المعلومات", + "infoDetail": "تفاصيل المعلومات", "amount_detail": "تفاصيل المبلغ", "currentBalance": "الرصيد الحالي", "currentLeaveBalance" : "رصيد الاجازات الحالي", @@ -454,5 +454,16 @@ "reset_locale": "Reset Language", "chat": "دردشة", "mychats": "دردشاتي", - "createNewChat": "Create New Chat" + "createNewChat": "Create New Chat", + "advancedSearch": "بحث متقدم", + "openNot": "التبليغات المفتوحة", + "fyi": "تبليغات للعلم", + "toDo": "تبليغات الأعمال", + "all": "كل التبليغات", + "meNot": "تبليغات صادرة مني", + "view": "عرض", + "fromUserName": "من", + "sentDate": "تاريخ الإرسال", + "itemTypeDisplayName": "اسم العرض", + "none": "بدون" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 6bb5972..b88b14c 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -407,7 +407,7 @@ "rateUI": "1. How would you rate this UI?", "submitSurvey":"Submit Survey", "typeHere": "Type here", - "info_detail": "Info Detail", + "infoDetail": "Info Detail", "amount_detail": "Amount Detail", "currentBalance": "Current Balance", "currentLeaveBalance" : "Current Leave Balance", @@ -454,5 +454,16 @@ "reset_locale": "Reset Language", "chat": "Chat", "mychats": "My Chats", - "createNewChat": "Create New Chat" + "createNewChat": "Create New Chat", + "advancedSearch": "Advanced Search", + "openNot": "Open Notifications", + "fyi": "FYI Notifications", + "toDo": "To Do Notifications", + "all": "All Notifications", + "meNot": "Notifications from Me", + "view": "View", + "fromUserName": "From User Name", + "sentDate": "Sent Date", + "itemTypeDisplayName": "Item Type Display Name", + "none": "None" } \ No newline at end of file diff --git a/lib/api/offers_and_discounts_api_client.dart b/lib/api/offers_and_discounts_api_client.dart index b5aa9e6..6189612 100644 --- a/lib/api/offers_and_discounts_api_client.dart +++ b/lib/api/offers_and_discounts_api_client.dart @@ -57,9 +57,11 @@ class OffersAndDiscountsApiClient { var bodyData = json.decode(body['result']['data']); - bodyData.forEach((v) { + if(bodyData != null) { + bodyData.forEach((v) { getSaleCategoriesList.add(OffersListModel.fromJson(v)); }); + } return getSaleCategoriesList; }, url, diff --git a/lib/api/worklist/worklist_api_client.dart b/lib/api/worklist/worklist_api_client.dart index 91c0db0..8c5aed2 100644 --- a/lib/api/worklist/worklist_api_client.dart +++ b/lib/api/worklist/worklist_api_client.dart @@ -28,7 +28,6 @@ import 'package:mohem_flutter_app/models/worklist/hr/get_basic_det_ntf_body_list import 'package:mohem_flutter_app/models/worklist/hr/get_contact_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/hr/get_phones_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/worklist/replacement_list_model.dart'; -import 'package:mohem_flutter_app/models/worklist/update_user_type_list.dart'; import 'package:mohem_flutter_app/models/worklist_response_model.dart'; class WorkListApiClient { @@ -38,13 +37,18 @@ class WorkListApiClient { factory WorkListApiClient() => _instance; - Future?> getWorkList(int pPageNum, String pItemType) async { + Future?> getWorkList(int pPageNum, String pItemType, String pNotificationType, + {String pSearchUser = "", String pSearchItemType = "", String pSentDate = "", String pSearchSubject = ""}) async { String url = "${ApiConsts.erpRest}GET_WORKLIST"; Map postParams = { - "P_NOTIFICATION_TYPE": "1", + "P_NOTIFICATION_TYPE": pNotificationType, "P_PAGE_NUM": pPageNum, - "P_PAGE_LIMIT": 50, + "P_PAGE_LIMIT": 25, "P_ITEM_TYPE": pItemType, + "P_SEARCH_FROM_USER": pSearchUser, + "P_SEARCH_ITEM_TYPE_DSP_NAME": pSearchItemType, + "P_SEARCH_SENT_DATE": pSentDate, + "P_SEARCH_SUBJECT": pSearchSubject }; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { @@ -481,12 +485,9 @@ class WorkListApiClient { }, url, postParams); } - Future> getUserItemTypes() async { String url = "${ApiConsts.erpRest}GET_USER_ITEM_TYPES"; - Map postParams = { - - }; + Map postParams = {}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel responseData = GenericResponseModel.fromJson(json); @@ -496,15 +497,11 @@ class WorkListApiClient { Future updateUserItemTypes(List> itemList) async { String url = "${ApiConsts.erpRest}UPDATE_USER_ITEM_TYPES"; - Map postParams = { - "UpdateItemTypeList": itemList - }; + Map postParams = {"UpdateItemTypeList": itemList}; postParams.addAll(AppState().postParamsJson); return await ApiClient().postJsonForObject((json) { GenericResponseModel responseData = GenericResponseModel.fromJson(json); return responseData.updateUserItemTypesList; }, url, postParams); } - - } diff --git a/lib/classes/colors.dart b/lib/classes/colors.dart index 82fd46f..dba3db5 100644 --- a/lib/classes/colors.dart +++ b/lib/classes/colors.dart @@ -47,7 +47,7 @@ class MyColors { static const Color grey3AColor = Color(0xff2E303A); static const Color darkColor = Color(0xff000015); static const Color lightGrayColor = Color(0xff808080); - static const Color DarkRedColor = Color(0xffD02127); + static const Color darkRedColor = Color(0xffD02127); static const Color lightGreyColor = Color(0xffC7C7C7); static const Color green69Color = Color(0xff1FA169); static const Color redA3Color = Color(0xffCA3332); diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 7609fdf..e82c30a 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -1,9 +1,7 @@ class ApiConsts { //static String baseUrl = "http://10.200.204.20:2801/"; // Local server static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server - //15153 - //Abcd@12345 - //static String baseUrl = "https://hmgwebservices.com"; // Live server + // static String baseUrl = "https://hmgwebservices.com"; // Live server static String baseUrlServices = baseUrl + "/Services/"; // server // static String baseUrlServices = "https://api.cssynapses.com/tangheem/"; // Live server static String utilitiesRest = baseUrlServices + "Utilities.svc/REST/"; diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index a9075c7..2462f57 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -65,10 +65,10 @@ extension EmailValidator on String { style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.52, decoration: isUnderLine ? TextDecoration.underline : null), ); - Widget toText14({Color? color, bool isBold = false, FontWeight? weight, int? maxlines}) => Text( + Widget toText14({Color? color, bool isUnderLine = false, bool isBold = false, FontWeight? weight, int? maxlines}) => Text( this, maxLines: maxlines, - style: TextStyle(color: color ?? MyColors.darkTextColor, fontSize: 14, letterSpacing: -0.48, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600)), + style: TextStyle(color: color ?? MyColors.darkTextColor, fontSize: 14, letterSpacing: -0.48, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.w600), decoration: isUnderLine ? TextDecoration.underline : null), ); Widget toText16({Color? color, bool isUnderLine = false, bool isBold = false, int? maxlines}) => Text( diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index b35e780..42dc55e 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -423,6 +423,8 @@ class CodegenLoader extends AssetLoader{ "rateUI": ".1 كيف تريد تقييم التطبيق", "submitSurvey": "ارسال الاستبيان", "typeHere": "اكتب هنا", + "infoDetail": "تفاصيل المعلومات", + "amount_detail": "تفاصيل المبلغ", "currentBalance": "الرصيد الحالي", "currentLeaveBalance": "رصيد الاجازات الحالي", "calculatedDays": "الايام المحسوبه", @@ -465,7 +467,21 @@ class CodegenLoader extends AssetLoader{ "female": "Hello girl :) {}" } }, - "reset_locale": "Reset Language" + "reset_locale": "Reset Language", + "chat": "دردشة", + "mychats": "دردشاتي", + "createNewChat": "Create New Chat", + "advancedSearch": "بحث متقدم", + "openNot": "التبليغات المفتوحة", + "fyi": "تبليغات للعلم", + "toDo": "تبليغات الأعمال", + "all": "كل التبليغات", + "meNot": "تبليغات صادرة مني", + "view": "عرض", + "fromUserName": "من", + "sentDate": "تاريخ الإرسال", + "itemTypeDisplayName": "اسم العرض", + "none": "بدون" }; static const Map en_US = { "mohemm": "Mohemm", @@ -876,6 +892,8 @@ static const Map en_US = { "rateUI": "1. How would you rate this UI?", "submitSurvey": "Submit Survey", "typeHere": "Type here", + "infoDetail": "Info Detail", + "amount_detail": "Amount Detail", "currentBalance": "Current Balance", "currentLeaveBalance": "Current Leave Balance", "calculatedDays": "Calculated Days", @@ -918,7 +936,21 @@ static const Map en_US = { "female": "Hello girl :) {}" } }, - "reset_locale": "Reset Language" + "reset_locale": "Reset Language", + "chat": "Chat", + "mychats": "My Chats", + "createNewChat": "Create New Chat", + "advancedSearch": "Advanced Search", + "openNot": "Open Notifications", + "fyi": "FYI Notifications", + "toDo": "To Do Notifications", + "all": "All Notifications", + "meNot": "Notifications from Me", + "view": "View", + "fromUserName": "From User Name", + "sentDate": "Sent Date", + "itemTypeDisplayName": "Item Type Display Name", + "none": "None" }; static const Map> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index dea9ddf..b17f5ba 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -408,7 +408,7 @@ abstract class LocaleKeys { static const rateUI = 'rateUI'; static const submitSurvey = 'submitSurvey'; static const typeHere = 'typeHere'; - static const info_detail = 'info_detail'; + static const infoDetail = 'infoDetail'; static const amount_detail = 'amount_detail'; static const currentBalance = 'currentBalance'; static const currentLeaveBalance = 'currentLeaveBalance'; @@ -441,5 +441,16 @@ abstract class LocaleKeys { static const chat = 'chat'; static const mychats = 'mychats'; static const createNewChat = 'createNewChat'; + static const advancedSearch = 'advancedSearch'; + static const openNot = 'openNot'; + static const fyi = 'fyi'; + static const toDo = 'toDo'; + static const all = 'all'; + static const meNot = 'meNot'; + static const view = 'view'; + static const fromUserName = 'fromUserName'; + static const sentDate = 'sentDate'; + static const itemTypeDisplayName = 'itemTypeDisplayName'; + static const none = 'none'; } diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 7d64f33..4ecb644 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -107,24 +107,8 @@ class _DashboardScreenState extends State { }); }), Image.asset("assets/images/logos/main_mohemm_logo.png", width: 134, height: 28).expanded, - SizedBox( - width: 36, - height: 36, - child: Stack( - alignment: Alignment.centerLeft, - children: [ - SvgPicture.asset("assets/images/announcements.svg"), - Positioned( - right: 0, - top: 0, - child: Container( - padding: const EdgeInsets.only(left: 5, right: 5), - decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)), - child: "3".toText12(color: Colors.white), - ), - ) - ], - ), + SvgPicture.asset( + "assets/images/announcements.svg", ).onPress(() async { await Navigator.pushNamed(context, AppRoutes.announcements); }) @@ -178,7 +162,7 @@ class _DashboardScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true), - if (model.isTimeRemainingInSeconds == 0) "01-02-2022".toText12(color: Colors.white), + if (model.isTimeRemainingInSeconds == 0) DateTime.now().toString().split(" ")[0].toText12(color: Colors.white), if (model.isTimeRemainingInSeconds != 0) Column( mainAxisSize: MainAxisSize.min, @@ -189,7 +173,7 @@ class _DashboardScreenState extends State { endTime: model.endTime, onEnd: null, endWidget: "00:00:00".toText14(color: Colors.white, isBold: true), - textStyle: TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold), + textStyle: const TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold), ), LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white), 9.height, diff --git a/lib/ui/landing/widget/menus_widget.dart b/lib/ui/landing/widget/menus_widget.dart index 6e550ec..60b194a 100644 --- a/lib/ui/landing/widget/menus_widget.dart +++ b/lib/ui/landing/widget/menus_widget.dart @@ -18,6 +18,7 @@ class MenusWidget extends StatelessWidget { return Consumer( builder: (cxt, data, child) { + print("data.workListCounter:${data.workListCounter}"); return GridView( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 2 / 2, crossAxisSpacing: 9, mainAxisSpacing: 9), padding: EdgeInsets.zero, @@ -44,11 +45,7 @@ class MenusWidget extends StatelessWidget { Expanded( child: data.workListCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), ), - RotatedBox( - quarterTurns: AppState().isArabic(context) ? 2:4, - child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) - ), - + RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), ], ) ], @@ -75,10 +72,7 @@ class MenusWidget extends StatelessWidget { Expanded( child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), ), - RotatedBox( - quarterTurns: AppState().isArabic(context) ? 2:4, - child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) - ), + RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), ], ) ], @@ -105,10 +99,7 @@ class MenusWidget extends StatelessWidget { Expanded( child: data.leaveBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), ), - RotatedBox( - quarterTurns: AppState().isArabic(context) ? 2:4, - child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) - ), + RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), ], ) ], @@ -135,10 +126,7 @@ class MenusWidget extends StatelessWidget { Expanded( child: data.ticketBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1), ), - RotatedBox( - quarterTurns: AppState().isArabic(context) ? 2:4, - child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white) - ), + RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)), ], ) ], diff --git a/lib/ui/leave_balance/add_leave_balance_screen.dart b/lib/ui/leave_balance/add_leave_balance_screen.dart index 5fce5ec..eb8e493 100644 --- a/lib/ui/leave_balance/add_leave_balance_screen.dart +++ b/lib/ui/leave_balance/add_leave_balance_screen.dart @@ -109,14 +109,14 @@ class _AddLeaveBalanceScreenState extends State { } } await LeaveBalanceApiClient().validateAbsenceTransaction(selectedAbsenceType!.dESCFLEXCONTEXTCODE!, "HR_LOA_SS", selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, - selectedReplacementEmployee!.userName!, DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), -999, dffDataMap, + selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "", DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), -999, dffDataMap, comments: comment); SumbitAbsenceTransactionList submit = await LeaveBalanceApiClient().submitAbsenceTransaction( selectedAbsenceType!.dESCFLEXCONTEXTCODE!, "HR_LOA_SS", selectedAbsenceType!.aBSENCEATTENDANCETYPEID!, - selectedReplacementEmployee!.userName!, + selectedReplacementEmployee != null ? selectedReplacementEmployee!.userName! : "", DateUtil.getFormattedDate(startDateTime!, "MM/dd/yyyy"), DateUtil.getFormattedDate(endDateTime!, "MM/dd/yyyy"), -999, @@ -126,9 +126,9 @@ class _AddLeaveBalanceScreenState extends State { Utils.hideLoading(context); await Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams(LocaleKeys.submit.tr(), submit.pTRANSACTIONID!, "", "add_leave_balance")); - Utils.showLoading(context); + // Utils.showLoading(context); await LeaveBalanceApiClient().cancelHrTransaction(submit.pTRANSACTIONID!); - Utils.hideLoading(context); + // Utils.hideLoading(context); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index 3518b18..b4b406b 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -129,9 +129,9 @@ class _LoginScreenState extends State { Widget build(BuildContext context) { if (isAppOpenBySystem == null) { isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool; - print('isAppOpenBySystem:$isAppOpenBySystem'); - username.text = "15153"; - password.text = "Abcd@12345"; + + // username.text = "15153"; + // password.text = "Abcd@12345"; if (isAppOpenBySystem!) checkFirebaseToken(); } diff --git a/lib/ui/screens/items_for_sale/fragments/add_details_fragment.dart b/lib/ui/screens/items_for_sale/fragments/add_details_fragment.dart index 8b2f24e..b2791ec 100644 --- a/lib/ui/screens/items_for_sale/fragments/add_details_fragment.dart +++ b/lib/ui/screens/items_for_sale/fragments/add_details_fragment.dart @@ -189,7 +189,7 @@ class _AddItemDetailsFragmentState extends State { title.toText16().expanded, 6.width, SimpleButton(LocaleKeys.add.tr(), () { - ImageOptions.showImageOptionsNew(context, (String image, File file) { + ImageOptions.showImageOptionsNew(context, false, (String image, File file) { setState(() { images.add(image); Navigator.of(context).pop(); @@ -272,15 +272,15 @@ class _AddItemDetailsFragmentState extends State { } void getRegions() async { - // try { + try { Utils.showLoading(context); getRegionsList = await ItemsForSaleApiClient().getRegions(); await getAdDetails(); Utils.hideLoading(context); setState(() {}); - // } catch (ex) { - // Utils.hideLoading(context); - // Utils.handleException(ex, context, null); - // } + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } } } diff --git a/lib/ui/work_list/itg_detail_screen.dart b/lib/ui/work_list/itg_detail_screen.dart index e0c256c..b1deae8 100644 --- a/lib/ui/work_list/itg_detail_screen.dart +++ b/lib/ui/work_list/itg_detail_screen.dart @@ -123,9 +123,7 @@ class _ItgDetailScreenState extends State { }, children: [ RequestDetailFragment(fields: itgRequest?.fieldGoups?[1].fields ?? []), - ApprovalLevelfragment( - wFHistory: itgRequest?.wFHistory ?? [], - ), + ApprovalLevelfragment(wFHistory: itgRequest?.wFHistory ?? []), RequestDetailFragment(fields: itgRequest?.fieldGoups?[0].fields ?? []), ], ).expanded, diff --git a/lib/ui/work_list/itg_fragments/approval_level_fragment.dart b/lib/ui/work_list/itg_fragments/approval_level_fragment.dart index 027d8ca..4ffca44 100644 --- a/lib/ui/work_list/itg_fragments/approval_level_fragment.dart +++ b/lib/ui/work_list/itg_fragments/approval_level_fragment.dart @@ -112,16 +112,18 @@ class ApprovalLevelfragment extends StatelessWidget { } Color getStatusColor(String code) { - if (code == "SUBMIT") { - return const Color(0xff2E303A); - } else if (code == "REJECTED") { - return const Color(0xffD02127); - } else if (code == "APPROVED" || code == "Requested Information") { - return const Color(0xff1FA269); - } else if (code == "REQUEST_INFO") { - return const Color(0xff2E303A); + if (code == "Submit") { + return MyColors.grey3AColor; + } else if (code == "Pending") { + return MyColors.yellowColor; + } else if (code == "Not Doable" || code == "Rejected") { + return MyColors.redColor; + } else if (code == "APPROVED") { + return MyColors.greenColor; + } else if (code == "Requested Information") { + return MyColors.orange; } else { - return const Color(0xff2E303A); + return MyColors.yellowColor; } } } diff --git a/lib/ui/work_list/sheets/delegate_sheet.dart b/lib/ui/work_list/sheets/delegate_sheet.dart index b0cfef1..1dbc30c 100644 --- a/lib/ui/work_list/sheets/delegate_sheet.dart +++ b/lib/ui/work_list/sheets/delegate_sheet.dart @@ -441,7 +441,7 @@ class _DelegateSheetState extends State { onTap: () { showMyBottomSheet(context, child: SelectedItemSheet( - "Comment", + LocaleKeys.comments.tr(), apiMode: widget.apiMode, replacementList: actionHistory, notificationID: widget.notificationID, diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index 6169b47..a19d6a5 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -1,4 +1,7 @@ +import 'dart:io'; + import 'package:easy_localization/src/public_ext.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:mohem_flutter_app/api/worklist/worklist_api_client.dart'; @@ -18,6 +21,9 @@ import 'package:mohem_flutter_app/models/worklist_item_type_model.dart'; import 'package:mohem_flutter_app/models/worklist_response_model.dart'; import 'package:mohem_flutter_app/provider/dashboard_provider_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/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; import 'package:provider/provider.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; @@ -62,14 +68,7 @@ class _WorkListScreenState extends State { key: 'POAPPRV', disable: false), WorkListItemTypeModelData( - value: 0, - name: 'ITG', - fullName: LocaleKeys.ITGForms.tr(), - active: false, - color: [Color(0xffEB8C90), Color(0xffDE6C70)], - icon: "assets/images/miss_swipe.svg", - key: 'ITG', - disable: false), + value: 0, name: 'ITG', fullName: LocaleKeys.ITGForms.tr(), active: false, color: [Color(0xffEB8C90), Color(0xffDE6C70)], icon: "assets/images/miss_swipe.svg", key: 'ITG', disable: false), WorkListItemTypeModelData( value: 0, name: 'IC', @@ -80,23 +79,9 @@ class _WorkListScreenState extends State { key: 'INVITEM', disable: false), WorkListItemTypeModelData( - value: 0, - name: 'STAMP', - fullName: LocaleKeys.stamp.tr(), - active: false, - color: [Color(0xff32D892), Color(0xff1AB170)], - icon: "assets/images/miss_swipe.svg", - key: 'STAMP', - disable: false), + value: 0, name: 'STAMP', fullName: LocaleKeys.stamp.tr(), active: false, color: [Color(0xff32D892), Color(0xff1AB170)], icon: "assets/images/miss_swipe.svg", key: 'STAMP', disable: false), WorkListItemTypeModelData( - value: 0, - name: 'COC', - fullName: LocaleKeys.itemCreation.tr(), - active: false, - color: [Color(0xff787299), Color(0xff1AB170)], - icon: "assets/images/miss_swipe.svg", - key: 'COC', - disable: true) + value: 0, name: 'COC', fullName: LocaleKeys.itemCreation.tr(), active: false, color: [Color(0xff787299), Color(0xff1AB170)], icon: "assets/images/miss_swipe.svg", key: 'COC', disable: true) ]; int workListItemIndex = 0; @@ -108,13 +93,36 @@ class _WorkListScreenState extends State { final RefreshController _refreshController = RefreshController(initialRefresh: false); + final Map advancedSearchViews = {}; + final Map advancedSearchSearchBy = {}; + final Map advancedSearchItemType = {}; + + int selectedViewID = 1; + String? selectedViewName; + + int selectedSearchByID = 0; + String? selectedSearchByName; + + String selectedItemTypeID = ""; + String? selectedItemTypeName; + + String searchByInput = ""; + String searchByDate = ""; + + DateTime selectedDate = DateTime.now(); + final ScrollController _controller = ScrollController(); + @override void initState() { super.initState(); - providerData = Provider.of(context, listen: false); calculateCounter(); getWorkList(); + setupAdvancedSearchParams(); + } + + void setupAdvancedSearchParams() { + advancedSearchViews.addAll({1: LocaleKeys.openNot.tr(), 2: LocaleKeys.fyi.tr(), 3: LocaleKeys.toDo.tr(), 4: LocaleKeys.all.tr(), 5: LocaleKeys.meNot.tr()}); } void calculateCounter() { @@ -124,10 +132,7 @@ class _WorkListScreenState extends State { } else if (workListElement.key == "COC") { workListElement.value = providerData.cocFinalCount; } else { - var tempList = providerData.getOpenNotificationsList - ?.where((notificationElement) => - notificationElement.itemType == workListElement.key) - .toList(); + var tempList = providerData.getOpenNotificationsList?.where((notificationElement) => notificationElement.itemType == workListElement.key).toList(); if (tempList!.isNotEmpty) { workListElement.value = tempList.first.openNtfNumber ?? 0; } @@ -138,36 +143,45 @@ class _WorkListScreenState extends State { ItgFormsModel? itgFormsModel; int? itgRequestTypeIndex; - void getWorkList() async { + Future getWorkList({bool showLoading = true}) async { try { - Utils.showLoading(context); + if (showLoading) Utils.showLoading(context); if (workListItemTypes[workListItemIndex].key == "ITG") { itgFormsModel = await WorkListApiClient().getITGTaskCountRequestType(); List requestAllList = []; for (int i = 0; i < (itgFormsModel?.requestType!.length ?? 0); i++) { itgFormsModel?.requestType![i].requestDetails?.forEach((element) { - element.requestType = - itgFormsModel?.requestType![i].requestTypeCode; + element.requestType = itgFormsModel?.requestType![i].requestTypeCode; }); - requestAllList = requestAllList + - (itgFormsModel?.requestType![i].requestDetails ?? []); + requestAllList = requestAllList + (itgFormsModel?.requestType![i].requestDetails ?? []); } AppState().setRequestAllList = requestAllList; - itgFormsModel?.requestType!.insert( - 0, - RequestType( - requestDetails: requestAllList, - requestTypeCode: "all", - requestTypeName: "All")); + itgFormsModel?.requestType!.insert(0, RequestType(requestDetails: requestAllList, requestTypeCode: "all", requestTypeName: "All")); if ((itgFormsModel?.requestType?.length ?? 0) > 0) { itgRequestTypeIndex = 0; } } else { itgRequestTypeIndex = null; - workList = await WorkListApiClient() - .getWorkList(pageNumber, workListItemTypes[workListItemIndex].key); + workList = await WorkListApiClient().getWorkList(pageNumber, workListItemTypes[workListItemIndex].key, selectedViewID.toString()); AppState().setWorkList = workList; } + if (showLoading) Utils.hideLoading(context); + if (showLoading) setState(() {}); + } catch (ex) { + if (showLoading) Utils.hideLoading(context); + if (showLoading) Utils.handleException(ex, context, null); + } + } + + void _onRefresh() async { + try { + _refreshController.refreshCompleted(); + Utils.showLoading(context); + List dataOnRefresh = await Future.wait([ + providerData.fetchWorkListCounter(context, showLoading: false), + getWorkList(showLoading: false), + ]); + calculateCounter(); Utils.hideLoading(context); setState(() {}); } catch (ex) { @@ -176,11 +190,6 @@ class _WorkListScreenState extends State { } } - void _onRefresh() async { - getWorkList(); - _refreshController.refreshCompleted(); - } - @override void dispose() { super.dispose(); @@ -205,25 +214,16 @@ class _WorkListScreenState extends State { SizedBox( height: 40, child: ListView.separated( + controller: _controller, itemBuilder: (context, index) { return Container( - padding: const EdgeInsets.only( - left: 21, right: 21, top: 8, bottom: 8), + padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8), alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6), - color: workListItemIndex == index - ? MyColors.darkIconColor - : MyColors.lightGreyEAColor), - child: - ("${workListItemTypes[index].name} ${workListItemTypes[index].value > 0 ? "(${workListItemTypes[index].value})" : ""}") - .toText12( - color: workListItemIndex == index - ? MyColors.white - : MyColors.black), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(6), color: workListItemIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor), + child: ("${workListItemTypes[index].name} ${workListItemTypes[index].value > 0 ? "(${workListItemTypes[index].value})" : ""}") + .toText12(color: workListItemIndex == index ? MyColors.white : MyColors.black), ).onPress(() { - if (workListItemIndex != index && - !workListItemTypes[index].disable) { + if (workListItemIndex != index && !workListItemTypes[index].disable) { workListItemIndex = index; if (workListItemTypes[index].value == 0) { workList = []; @@ -245,7 +245,15 @@ class _WorkListScreenState extends State { padding: const EdgeInsets.only(left: 21, right: 21), ), ).paddingOnly(top: 21, bottom: 21), - workListItemTypes[workListItemIndex].fullName.toSectionHeading().paddingOnly(left: 21, right: 21), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + workListItemTypes[workListItemIndex].fullName.toSectionHeading().paddingOnly(left: 21, right: 21), + LocaleKeys.advancedSearch.tr().toText14(isUnderLine: true).onPress(() { + openBottomSheet(context); + }).paddingOnly(left: 21, right: 21) + ], + ), SmartRefresher( enablePullDown: true, enablePullUp: false, @@ -316,17 +324,14 @@ class _WorkListScreenState extends State { ); } - Widget itgRowItem(WorkListItemTypeModelData data, - RequestDetails requestDetails, int index) { + Widget itgRowItem(WorkListItemTypeModelData data, RequestDetails requestDetails, int index) { return InkWell( onTap: () async { AppState().setItgWorkListIndex = index; - var shouldReloadData = - await Navigator.pushNamed(context, AppRoutes.itgDetail); + var shouldReloadData = await Navigator.pushNamed(context, AppRoutes.itgDetail); if (shouldReloadData != null) { if (shouldReloadData.toString() == "delegate_reload") { - providerData.itgFormsModel!.totalCount = - providerData.itgFormsModel!.totalCount! - 1; + providerData.itgFormsModel!.totalCount = providerData.itgFormsModel!.totalCount! - 1; calculateCounter(); getWorkList(); } @@ -350,8 +355,7 @@ class _WorkListScreenState extends State { }, child: Container( width: double.infinity, - padding: - const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), + padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), @@ -370,20 +374,11 @@ class _WorkListScreenState extends State { Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), - gradient: LinearGradient( - transform: GradientRotation(.218), - begin: Alignment.topRight, - end: Alignment.bottomRight, - colors: data.color), + gradient: LinearGradient(transform: GradientRotation(.218), begin: Alignment.topRight, end: Alignment.bottomRight, colors: data.color), ), child: Column( crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SvgPicture.asset("assets/images/miss_swipe.svg", - width: 20, height: 20, color: Colors.white), - 2.height, - data.name.toText10(color: Colors.white) - ], + children: [SvgPicture.asset("assets/images/miss_swipe.svg", width: 20, height: 20, color: Colors.white), 2.height, data.name.toText10(color: Colors.white)], ).paddingAll(6), ), 8.width, @@ -409,15 +404,153 @@ class _WorkListScreenState extends State { ); } - Widget rowItem(WorkListItemTypeModelData data, WorkListResponseModel workData, - int index) { + void openBottomSheet(BuildContext context) { + showMyBottomSheet( + context, + child: Padding( + padding: const EdgeInsets.all(21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + LocaleKeys.advancedSearch.tr().toText18(), + IconButton( + icon: const Icon(Icons.close, color: MyColors.darkIconColor), + onPressed: () => Navigator.pop(context), + ), + ], + ), + 12.height, + PopupMenuButton( + child: DynamicTextFieldWidget( + LocaleKeys.view.tr(), + selectedViewName != null ? selectedViewName! : LocaleKeys.view.tr(), + isEnable: false, + isPopup: true, + isInputTypeNum: true, + isReadOnly: false, + ), + itemBuilder: (_) => >[ + PopupMenuItem(value: 1, child: Text(LocaleKeys.openNot.tr())), + PopupMenuItem(value: 2, child: Text(LocaleKeys.fyi.tr())), + PopupMenuItem(value: 3, child: Text(LocaleKeys.toDo.tr())), + PopupMenuItem(value: 4, child: Text(LocaleKeys.all.tr())), + PopupMenuItem(value: 5, child: Text(LocaleKeys.meNot.tr())), + ], + onSelected: (int popupIndex) { + selectedViewID = popupIndex; + selectedViewName = getSelectedViewName(popupIndex); + setState(() {}); + }, + ), + 12.height, + PopupMenuButton( + child: DynamicTextFieldWidget( + LocaleKeys.searchBy.tr(), + selectedSearchByName != null ? selectedSearchByName! : LocaleKeys.searchBy.tr(), + isEnable: false, + isPopup: true, + isInputTypeNum: true, + isReadOnly: false, + ), + itemBuilder: (_) => >[ + PopupMenuItem(value: 1, child: Text(LocaleKeys.fromUserName.tr())), + PopupMenuItem(value: 2, child: Text(LocaleKeys.subject.tr())), + PopupMenuItem(value: 3, child: Text(LocaleKeys.sentDate.tr())), + PopupMenuItem(value: 4, child: Text(LocaleKeys.itemTypeDisplayName.tr())), + PopupMenuItem(value: 5, child: Text(LocaleKeys.none.tr())), + ], + onSelected: (int popupIndex) { + selectedSearchByID = popupIndex; + selectedSearchByName = getSelectedSearchByName(popupIndex); + setState(() {}); + }, + ), + 12.height, + if (selectedSearchByID == 1 || selectedSearchByID == 2 || selectedSearchByID == 4) + DynamicTextFieldWidget( + LocaleKeys.searchBy.tr(), + LocaleKeys.searchBy.tr(), + isEnable: true, + isPopup: false, + lines: 1, + isInputTypeNum: false, + isReadOnly: false, + onChange: (String value) { + debugPrint(value); + searchByInput = value; + }, + ), + if (selectedSearchByID == 3) + DynamicTextFieldWidget( + LocaleKeys.searchBy.tr(), + LocaleKeys.sentDate.tr(), + suffixIconData: Icons.calendar_today, + isEnable: false, + onTap: () async { + selectedDate = await _selectDate(context, DateTime.now()); + searchByDate = selectedDate.day.toString() + "-" + getMonth(selectedDate.month) + "-" + selectedDate.year.toString(); + setState(() {}); + }, + ), + 12.height, + PopupMenuButton( + child: DynamicTextFieldWidget( + LocaleKeys.itemType.tr(), + selectedItemTypeName != null ? selectedItemTypeName! : LocaleKeys.itemType.tr(), + isEnable: false, + isPopup: true, + isInputTypeNum: true, + isReadOnly: false, + ), + itemBuilder: (_) => >[ + const PopupMenuItem(value: "HRSSA", child: Text("HR")), + const PopupMenuItem(value: "POAPPRV", child: Text("PO")), + const PopupMenuItem(value: "REQAPPRV", child: Text("PR")), + const PopupMenuItem(value: "INVMOA", child: Text("MR")), + const PopupMenuItem(value: "INVITEM", child: Text("IC")), + const PopupMenuItem(value: "STAMP", child: Text("STAMP")), + ], + onSelected: (String popupIndex) { + selectedItemTypeID = popupIndex; + selectedItemTypeName = getSelectedItemType(popupIndex); + setState(() {}); + }, + ), + 20.height, + DefaultButton(LocaleKeys.search.tr(), () async { + Navigator.pop(context); + itgRequestTypeIndex = null; + int index = -1; + for (int i = 0; i < workListItemTypes.length; i++) { + if (workListItemTypes[i].key == selectedItemTypeID) { + index = i; + break; + } + } + Utils.showLoading(context); + workList = await WorkListApiClient().getWorkList(pageNumber, selectedItemTypeID, selectedViewID.toString(), + pSearchUser: searchByInput, pSearchSubject: searchByInput, pSentDate: searchByDate, pSearchItemType: searchByInput); + workListItemIndex = index; + AppState().setWorkList = workList; + _animateToIndex(index, 50.0); + Utils.hideLoading(context); + setState(() {}); + }) + ], + ), + ), + ); + } + + Widget rowItem(WorkListItemTypeModelData data, WorkListResponseModel workData, int index) { return InkWell( onTap: () async { AppState().setWorkListIndex = index; var data = workList![index]; - var shouldReloadData = await Navigator.pushNamed( - context, AppRoutes.workListDetail, - arguments: workData); + var shouldReloadData = await Navigator.pushNamed(context, AppRoutes.workListDetail, arguments: workData); if (shouldReloadData != null) { if (shouldReloadData.toString() == "delegate_reload") { calculateCounter(); @@ -442,8 +575,7 @@ class _WorkListScreenState extends State { }, child: Container( width: double.infinity, - padding: - const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), + padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), @@ -462,20 +594,11 @@ class _WorkListScreenState extends State { Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), - gradient: LinearGradient( - transform: GradientRotation(.218), - begin: Alignment.topRight, - end: Alignment.bottomRight, - colors: data.color), + gradient: LinearGradient(transform: GradientRotation(.218), begin: Alignment.topRight, end: Alignment.bottomRight, colors: data.color), ), child: Column( crossAxisAlignment: CrossAxisAlignment.center, - children: [ - SvgPicture.asset("assets/images/miss_swipe.svg", - width: 20, height: 20, color: Colors.white), - 2.height, - data.name.toText10(color: Colors.white) - ], + children: [SvgPicture.asset("assets/images/miss_swipe.svg", width: 20, height: 20, color: Colors.white), 2.height, data.name.toText10(color: Colors.white)], ).paddingAll(6), ), 8.width, @@ -500,4 +623,141 @@ class _WorkListScreenState extends State { ), ); } + + void _animateToIndex(int index, double width) { + _controller.animateTo( + index * width, + duration: const Duration(seconds: 1), + curve: Curves.fastOutSlowIn, + ); + } + + String getSelectedViewName(int index) { + String returnVal = ""; + switch (index) { + case 1: + returnVal = LocaleKeys.openNot.tr(); + break; + case 2: + returnVal = LocaleKeys.fyi.tr(); + break; + case 3: + returnVal = LocaleKeys.toDo.tr(); + break; + case 4: + returnVal = LocaleKeys.all.tr(); + break; + case 5: + returnVal = LocaleKeys.meNot.tr(); + break; + } + return returnVal; + } + + String getSelectedSearchByName(int index) { + String returnVal = ""; + switch (index) { + case 1: + returnVal = LocaleKeys.fromUserName.tr(); + break; + case 2: + returnVal = LocaleKeys.subject.tr(); + break; + case 3: + returnVal = LocaleKeys.sentDate.tr(); + break; + case 4: + returnVal = LocaleKeys.itemType.tr(); + break; + case 5: + returnVal = LocaleKeys.none.tr(); + break; + } + return returnVal; + } + + String getSelectedItemType(String index) { + String returnVal = ""; + switch (index) { + case "HRSSA": + returnVal = "HR"; + break; + case "POAPPRV": + returnVal = "PO"; + break; + case "REQAPPRV": + returnVal = "PR"; + break; + case "INVMOA": + returnVal = "MR"; + break; + case "INVITEM": + returnVal = "IC"; + break; + case "STAMP": + returnVal = "STAMP"; + break; + } + return returnVal; + } + + Future _selectDate(BuildContext context, DateTime selectedDate) async { + DateTime time = selectedDate; + if (!Platform.isIOS) { + await showCupertinoModalPopup( + context: context, + builder: (cxt) => Container( + height: 250, + color: Colors.white, + child: CupertinoDatePicker( + backgroundColor: Colors.white, + mode: CupertinoDatePickerMode.date, + onDateTimeChanged: (value) { + if (value != null && value != selectedDate) { + time = value; + } + }, + initialDateTime: selectedDate, + ), + ), + ); + } else { + DateTime? picked = await showDatePicker(context: context, initialDate: selectedDate, initialEntryMode: DatePickerEntryMode.calendarOnly, firstDate: DateTime(2015, 8), lastDate: DateTime(2101)); + if (picked != null && picked != selectedDate) { + time = picked; + } + } + return time; + } + + String getMonth(int month) { + switch (month) { + case 1: + return "Jan"; + case 2: + return "Feb"; + case 3: + return "Mar"; + case 4: + return "Apr"; + case 5: + return "May"; + case 6: + return "June"; + case 7: + return "July"; + case 8: + return "Aug"; + case 9: + return "Sep"; + case 10: + return "Oct"; + case 11: + return "Nov"; + case 12: + return "Dec"; + default: + return ""; + } + } } diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index 9a32d30..8dd57a2 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -135,9 +135,28 @@ class _WorkListDetailScreenState extends State { if (getNotificationRespondAttributes.isNotEmpty) { notificationNoteInput = getNotificationRespondAttributes.first; } - notificationButtonsList = await WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!); - actionHistoryList = await WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!); - getAttachmentList = await WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!); + + List dataToFetch = await Future.wait([ + WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!), + WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!), + WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!), + ]); + + notificationButtonsList = dataToFetch[0]; + actionHistoryList = dataToFetch[1]; + getAttachmentList = dataToFetch[2]; + + // List futureRequest = []; + // List futureObject = []; + // + // addRequestInFuture(notificationButtonsList, WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!)); + // addRequestInFuture(actionHistoryList, WorkListApiClient().getActionHistory(workListData!.nOTIFICATIONID!)); + // addRequestInFuture(getAttachmentList, WorkListApiClient().getAttachments(workListData!.nOTIFICATIONID!)); + + // List dataToFetch = await Future.wait(futureRequest); + // for(int i=0;i element.bUTTONACTION == "CLOSE"); @@ -149,9 +168,20 @@ class _WorkListDetailScreenState extends State { } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); + setState(() { + + }); } } + List futureRequest = []; + List futureObject = []; + + void addRequestInFuture(data, request) { + futureObject.add(data); + futureRequest.add(request); + } + void getDataFromState() { if (workListData == null) { workListData = AppState().workList![AppState().workListIndex!]; // ModalRoute.of(context)!.settings.arguments as WorkListResponseModel; @@ -196,6 +226,7 @@ class _WorkListDetailScreenState extends State { ], ), ), + if ((workListData?.sUBJECT ?? "").isNotEmpty) workListData!.sUBJECT!.toText14().paddingOnly(top: 20, right: 21, left: 21), PageView( controller: controller, onPageChanged: (pageIndex) { diff --git a/lib/ui/work_list/worklist_fragments/actions_fragment.dart b/lib/ui/work_list/worklist_fragments/actions_fragment.dart index bc97c79..3663cc5 100644 --- a/lib/ui/work_list/worklist_fragments/actions_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/actions_fragment.dart @@ -8,6 +8,7 @@ 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/ui/work_list/sheets/delegate_sheet.dart'; +import 'package:mohem_flutter_app/ui/work_list/sheets/selected_item_sheet.dart'; import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; import 'package:mohem_flutter_app/widgets/circular_avatar.dart'; @@ -77,11 +78,11 @@ class ActionsFragment extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ actionHistory.nAME!.toText16(), - if ((actionHistory.nOTE ?? "").isNotEmpty) actionHistory.nOTE!.toText12(color: MyColors.grey57Color), + if ((actionHistory.nOTE ?? "").isNotEmpty) "Note: ${actionHistory.nOTE!}".toText12(color: MyColors.grey57Color), 4.height, Row( children: [ - actionHistory.aCTION!.toText10(), + actionHistory.aCTION!.toText10(color: getStatusColor(actionHistory.aCTIONCODE!)), 8.width, if (actionHistory.nOTIFICATIONDATE!.isNotEmpty) DateUtil.formatDateToDate(DateUtil.convertSimpleStringDateToDateddMMyyyy(actionHistory.nOTIFICATIONDATE!), false).toText12(color: MyColors.lightTextColor), @@ -100,7 +101,15 @@ class ActionsFragment extends StatelessWidget { }).expanded, Container(width: 1, height: 30, color: MyColors.lightGreyEFColor), LocaleKeys.delegate.tr().toText12(color: MyColors.gradiantEndColor).center.paddingOnly(top: 6, bottom: 6).onPress(() { - showMyBottomSheet(context, child: DelegateSheet(title: "Delegate", apiMode: "DELEGATE", notificationID: notificationID, actionHistoryList: actionHistoryList)); + showMyBottomSheet( + context, + child: SelectedItemSheet( + LocaleKeys.comments.tr(), + apiMode: "DELEGATE", + actionHistoryList: actionHistory, + notificationID: notificationID, + ), + ); }).expanded, ], ), diff --git a/lib/ui/work_list/worklist_fragments/attachments_fragment.dart b/lib/ui/work_list/worklist_fragments/attachments_fragment.dart index ebc3db9..b351683 100644 --- a/lib/ui/work_list/worklist_fragments/attachments_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/attachments_fragment.dart @@ -4,6 +4,7 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.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'; @@ -21,18 +22,18 @@ class AttachmentsFragment extends StatelessWidget { return ListView.separated( itemCount: getAttachmentList.length, itemBuilder: (context, index) { + return Row( children: [ SvgPicture.asset(determineFileIcon(getAttachmentList[index].fILECONTENTTYPE ?? "")), 12.width, - (getAttachmentList[index].fILENAME?.capitalizeFirstofEach ?? "").toText16().expanded, + (getAttachmentList[index].fILENAME ?? "").toText16().expanded, ], ).objectContainerView().onPress(() async { try { String path = await _createFileFromString(getAttachmentList[index].fILEDATA ?? "", getAttachmentList[index].fILECONTENTTYPE ?? ""); OpenFile.open(path); - } catch (ex) { - debugPrint("FileErorr:$ex"); + } catch (ex) {Utils.showToast("Cannot open file."); } }); }, diff --git a/lib/ui/work_list/worklist_fragments/info_fragments.dart b/lib/ui/work_list/worklist_fragments/info_fragments.dart index adab78c..18d5f68 100644 --- a/lib/ui/work_list/worklist_fragments/info_fragments.dart +++ b/lib/ui/work_list/worklist_fragments/info_fragments.dart @@ -142,7 +142,7 @@ class InfoFragment extends StatelessWidget { isItLast: true, ), ], - ).objectContainerView(title: LocaleKeys.info_detail.tr()), + ).objectContainerView(title: LocaleKeys.infoDetail.tr()), 12.height, Column( children: [ diff --git a/lib/widgets/bottom_sheets/attachment_options.dart b/lib/widgets/bottom_sheets/attachment_options.dart index 83b6d3d..30189a0 100644 --- a/lib/widgets/bottom_sheets/attachment_options.dart +++ b/lib/widgets/bottom_sheets/attachment_options.dart @@ -8,8 +8,9 @@ class AttachmentOptions extends StatelessWidget { VoidCallback onCameraTap; VoidCallback onGalleryTap; VoidCallback onFilesTap; + bool showFilesOption; - AttachmentOptions({Key? key, required this.onCameraTap, required this.onGalleryTap, required this.onFilesTap}) : super(key: key); + AttachmentOptions({Key? key, required this.onCameraTap, required this.onGalleryTap, required this.onFilesTap, this.showFilesOption = true}) : super(key: key); @override Widget build(BuildContext context) { @@ -28,7 +29,7 @@ class AttachmentOptions extends StatelessWidget { children: [ itemView("open_camera.svg", "Open\nCamera", onCameraTap), itemView("gallery.svg", "Upload from\nGallery", onGalleryTap), - itemView("files.svg", "Upload from\nFiles", onFilesTap), + if (showFilesOption) itemView("files.svg", "Upload from\nFiles", onFilesTap), ], ) ], diff --git a/lib/widgets/image_picker.dart b/lib/widgets/image_picker.dart index 4c17250..4a99577 100644 --- a/lib/widgets/image_picker.dart +++ b/lib/widgets/image_picker.dart @@ -10,10 +10,11 @@ import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; import 'package:mohem_flutter_app/widgets/bottom_sheets/attachment_options.dart'; class ImageOptions { - static void showImageOptionsNew(BuildContext context, Function(String, File) image) { + static void showImageOptionsNew(BuildContext context, bool showFilesOption, Function(String, File) image) { showMyBottomSheet( context, child: AttachmentOptions( + showFilesOption: showFilesOption, onCameraTap: () async { if (Platform.isAndroid) { cameraImageAndroid(image);