diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 00f18f3..a21411d 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" : "رصيد الاجازات الحالي", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 6bb5972..b5a607c 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", diff --git a/lib/api/chat/chat_provider_model.dart b/lib/api/chat/chat_provider_model.dart index d4b49f8..d5b6fb3 100644 --- a/lib/api/chat/chat_provider_model.dart +++ b/lib/api/chat/chat_provider_model.dart @@ -2,17 +2,15 @@ import 'dart:convert'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; -import 'package:fluttertoast/fluttertoast.dart'; import 'package:http/http.dart'; +import 'package:logger/logger.dart' as L; import 'package:logging/logging.dart'; import 'package:mohem_flutter_app/api/api_client.dart'; import 'package:mohem_flutter_app/classes/consts.dart'; -import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/models/chat/get_search_user_chat_model.dart'; import 'package:mohem_flutter_app/models/chat/get_single_user_chat_list_Model.dart'; import 'package:signalr_netcore/hub_connection.dart'; import 'package:signalr_netcore/signalr_client.dart'; -import 'package:logger/logger.dart' as L; class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { List userChatHistory = []; @@ -29,19 +27,13 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { void getChatMemberFromSearch(String sName, int cUserId) async { isLoading = true; notifyListeners(); - Response response = await ApiClient().getJsonForResponse( - "${ApiConsts.chatSearchMember}$sName/$cUserId", - token: token, - ); + Response response = await ApiClient().getJsonForResponse("${ApiConsts.chatSearchMember}$sName/$cUserId", token: token); isLoading = false; notifyListeners(); } void getUserRecentChats() async { - Response response = await ApiClient().getJsonForResponse( - "${ApiConsts.chatServerBaseApiUrl}${ApiConsts.chatRecentUrl}", - token: token, - ); + Response response = await ApiClient().getJsonForResponse("${ApiConsts.chatServerBaseApiUrl}${ApiConsts.chatRecentUrl}", token: token); ChatUserModel recentChat = userToList(response.body); pChatHistory = recentChat.response; searchedChats = pChatHistory; 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/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index b35e780..37e5d4e 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,10 @@ class CodegenLoader extends AssetLoader{ "female": "Hello girl :) {}" } }, - "reset_locale": "Reset Language" + "reset_locale": "Reset Language", + "chat": "دردشة", + "mychats": "دردشاتي", + "createNewChat": "Create New Chat" }; static const Map en_US = { "mohemm": "Mohemm", @@ -876,6 +881,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 +925,10 @@ 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" }; 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..85b677d 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'; diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 7d64f33..026d17e 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); }) @@ -430,7 +414,7 @@ class _DashboardScreenState extends State { "assets/icons/item_for_sale.svg", color: currentIndex == 3 ? MyColors.grey3AColor : MyColors.grey98Color, ).paddingAll(4), - label: LocaleKeys.itemsForSale.tr(), + label: LocaleKeys.chat.tr(), ), BottomNavigationBarItem( icon: SvgPicture.asset( 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/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/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..1eaac3e 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -62,14 +62,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 +73,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; @@ -111,7 +90,6 @@ class _WorkListScreenState extends State { @override void initState() { super.initState(); - providerData = Provider.of(context, listen: false); calculateCounter(); getWorkList(); @@ -124,10 +102,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,47 +113,50 @@ 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); AppState().setWorkList = workList; } - Utils.hideLoading(context); - setState(() {}); + if (showLoading) Utils.hideLoading(context); + if (showLoading) setState(() {}); } catch (ex) { - Utils.hideLoading(context); - Utils.handleException(ex, context, null); + if (showLoading) Utils.hideLoading(context); + if (showLoading) Utils.handleException(ex, context, null); } } void _onRefresh() async { - getWorkList(); - _refreshController.refreshCompleted(); + try { + _refreshController.refreshCompleted(); + Utils.showLoading(context); + List dataOnRefresh = await Future.wait([ + providerData.fetchWorkListCounter(context, showLoading: false), + getWorkList(showLoading: false), + ]); + calculateCounter(); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } } @override @@ -207,23 +185,13 @@ class _WorkListScreenState extends State { child: ListView.separated( 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 = []; @@ -316,17 +284,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 +315,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 +334,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 +364,12 @@ class _WorkListScreenState extends State { ); } - Widget rowItem(WorkListItemTypeModelData data, WorkListResponseModel workData, - int index) { + 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 +394,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 +413,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, diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index 9a32d30..94c7208 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"); @@ -152,6 +171,14 @@ class _WorkListDetailScreenState extends State { } } + 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 +223,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: [