From c7dca3c3774f643a6fdcbe4c0cec77d0785d757e Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 1 Dec 2022 15:35:04 +0300 Subject: [PATCH 01/11] Jira fixes for announcements & attachments --- lib/classes/date_uitl.dart | 2 +- lib/ui/misc/request_submit_screen.dart | 32 ++++++++++++------- .../screens/announcements/announcements.dart | 2 +- lib/ui/work_list/work_list_screen.dart | 2 +- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/lib/classes/date_uitl.dart b/lib/classes/date_uitl.dart index f8d1c02..93a7e3f 100644 --- a/lib/classes/date_uitl.dart +++ b/lib/classes/date_uitl.dart @@ -20,7 +20,7 @@ class DateUtil { } static DateTime convertSimpleStringDateToDate(String date) { - return DateFormat("MM/dd/yyyy hh:mm:ss a").parse(date); + return DateFormat("MM/dd/yyyy hh:mm:ss aaa").parse(date); } static DateTime convertSimpleStringDateToDateddMMyyyy(String date) { diff --git a/lib/ui/misc/request_submit_screen.dart b/lib/ui/misc/request_submit_screen.dart index f5a2d1e..86263bd 100644 --- a/lib/ui/misc/request_submit_screen.dart +++ b/lib/ui/misc/request_submit_screen.dart @@ -22,6 +22,7 @@ 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/circular_avatar.dart'; import 'package:mohem_flutter_app/widgets/dialogs/confirm_dialog.dart'; +import 'package:mohem_flutter_app/widgets/image_picker.dart'; import 'package:mohem_flutter_app/widgets/input_widget.dart'; class RequestSubmitScreenParams { @@ -48,6 +49,7 @@ class _RequestSubmitScreenState extends State { List approverList = []; List attachmentFiles = []; + List attachments = []; @override void initState() { @@ -72,16 +74,16 @@ class _RequestSubmitScreenState extends State { Utils.showLoading(context); List> list = []; if (attachmentFiles.isNotEmpty) { - attachmentFiles.asMap().forEach((index, value) async { - String type = value.path.split('.').last; - String name = value.path.split('/').last; - List fileContent = await value.readAsBytes(); - String encodedFile = base64Encode(fileContent); + attachments.asMap().forEach((index, value) async { + String type = attachmentFiles[index].path.split('.').last; + String name = attachmentFiles[index].path.split('/').last; + // List fileContent = await value.readAsBytes(); + // String encodedFile = base64Encode(fileContent); list.add(AttachmentModel( attachmentID: index, pFILECONTENTTYPE: type, pFILENAME: name, - pFILEDATA: encodedFile, + pFILEDATA: value, pTRANSACTIONID: params!.transactionId, ).toJson()); }); @@ -261,12 +263,18 @@ class _RequestSubmitScreenState extends State { 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(() {}); - } + ImageOptions.showImageOptionsNew(context, false, (String image, File file) { + setState(() { + attachmentFiles.add(file); + attachments.add(image); + Navigator.of(context).pop(); + }); + }); + // if (result != null) { + // attachmentFiles = attachmentFiles + result.paths.map((path) => File(path!)).toList(); + // attachmentFiles = attachmentFiles.toSet().toList(); + // setState(() {}); + // } }, fontSize: 14), ], ), diff --git a/lib/ui/screens/announcements/announcements.dart b/lib/ui/screens/announcements/announcements.dart index d43c12c..941ff65 100644 --- a/lib/ui/screens/announcements/announcements.dart +++ b/lib/ui/screens/announcements/announcements.dart @@ -95,7 +95,7 @@ class _AnnouncementsState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - (AppState().isArabic(context) ? _foundAnnouncements[index].titleAR! : getAnnouncementsObject[index].titleEN!).toText13(), + (AppState().isArabic(context) ? _foundAnnouncements[index].titleAR! : _foundAnnouncements[index].titleEN!).toText13(), 8.height, _foundAnnouncements[index].created!.toText10(color: MyColors.grey98Color) ], diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index f9f8d91..da1b60f 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -528,7 +528,7 @@ class _WorkListScreenState extends State { 10.height, Row( children: [ - DateUtil.formatDateToDate(DateUtil.convertSimpleStringDateToDate(workData.bEGINDATE!), false).toText10(color: MyColors.lightTextColor).expanded, + DateUtil.formatDateToDate(DateUtil.convertSimpleStringDateToDateddMMyyyy(workData.bEGINDATE!), false).toText10(color: MyColors.lightTextColor).expanded, RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkIconColor)), ], ), From c9dd403b238d8d5274d0d4a78eac70602ce95394 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 1 Dec 2022 16:36:31 +0300 Subject: [PATCH 02/11] subordinate leave fix --- lib/ui/my_team/subordinate_leave.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/my_team/subordinate_leave.dart b/lib/ui/my_team/subordinate_leave.dart index f08193c..e2fb999 100644 --- a/lib/ui/my_team/subordinate_leave.dart +++ b/lib/ui/my_team/subordinate_leave.dart @@ -99,7 +99,7 @@ class _SubordinateLeaveState extends State { itemBuilder: (BuildContext context, int index) { var diffDays = DateUtil.convertStringToDate(getSubordinatesLeavesTotalList[index].dATEEND!) .difference(DateUtil.convertStringToDate(getSubordinatesLeavesTotalList[index].dATESTART!)) - .inDays; + .inDays + 1; return Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ From e505a9fa8c8ea6da51800ca0d545e91facc6480f Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 5 Dec 2022 16:25:55 +0300 Subject: [PATCH 03/11] fixes --- lib/classes/date_uitl.dart | 2 +- lib/ui/work_list/worklist_detail_screen.dart | 44 ++++++++++---------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/lib/classes/date_uitl.dart b/lib/classes/date_uitl.dart index ae80080..a1e52d9 100644 --- a/lib/classes/date_uitl.dart +++ b/lib/classes/date_uitl.dart @@ -40,7 +40,7 @@ class DateUtil { } static DateTime convertSimpleStringDateToDate(String date) { - return DateFormat("MM/dd/yyyy hh:mm:ss aaa").parse(date); + return DateFormat("MM/dd/yyyy hh:mm:ss").parse(date); } static DateTime convertSimpleStringDateToDateddMMyyyy(String date) { diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index 824edc3..f87db2a 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -146,7 +146,9 @@ class _WorkListDetailScreenState extends State { getPRNotification(); } - controller.jumpToPage(0); + if(controller.hasClients) { + controller.jumpToPage(0); + } // List dataToFetch = await Future.wait([ // @@ -214,9 +216,9 @@ class _WorkListDetailScreenState extends State { ), child: Row( children: [ - myTab(LocaleKeys.info.tr(), 0), - (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") ? myTab(LocaleKeys.details.tr(), 1) : myTab(LocaleKeys.request.tr(), 1), - myTab(LocaleKeys.actions.tr(), 2), + (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") ? myTab(LocaleKeys.details.tr(), 0) : myTab(LocaleKeys.request.tr(), 0), + myTab(LocaleKeys.actions.tr(), 1), + myTab(LocaleKeys.info.tr(), 2), myTab(LocaleKeys.attachments.tr(), 3), ], ), @@ -230,6 +232,23 @@ class _WorkListDetailScreenState extends State { }); }, children: [ + (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") + ? DetailFragment(workListData, memberInformationListModel) + : RequestFragment( + moNotificationBodyList: getMoNotificationBodyList, + poLinesList: getPoNotificationBody?.pOLines ?? [], + itemCreationLines: getItemCreationNtfBody?.itemCreationLines ?? [], + prLinesList: getPrNotificationBody?.pRLines ?? [], + ), + isActionHistoryLoaded + ? actionHistoryList.isEmpty + ? Utils.getNoDataWidget(context) + : ActionsFragment( + workListData!.nOTIFICATIONID, + actionHistoryList, + voidCallback: reloadWorkList, + ) + : showLoadingAnimation(), InfoFragment( poHeaderList: getPoNotificationBody?.pOHeader ?? [], workListData: workListData, @@ -243,23 +262,6 @@ class _WorkListDetailScreenState extends State { getContactNotificationBodyList: getContactNotificationBodyList, getPrNotificationBodyList: getPrNotificationBody, ), - (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") - ? DetailFragment(workListData, memberInformationListModel) - : RequestFragment( - moNotificationBodyList: getMoNotificationBodyList, - poLinesList: getPoNotificationBody?.pOLines ?? [], - itemCreationLines: getItemCreationNtfBody?.itemCreationLines ?? [], - prLinesList: getPrNotificationBody?.pRLines ?? [], - ), - isActionHistoryLoaded - ? actionHistoryList.isEmpty - ? Utils.getNoDataWidget(context) - : ActionsFragment( - workListData!.nOTIFICATIONID, - actionHistoryList, - voidCallback: reloadWorkList, - ) - : showLoadingAnimation(), isAttachmentLoaded ? getAttachmentList.isEmpty ? Utils.getNoDataWidget(context) From 62acd531b044cbf8b007fe61714242268156db39 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 6 Dec 2022 09:37:29 +0300 Subject: [PATCH 04/11] fixes --- .../items_for_sale_api_client.dart | 35 ++++++++++++++++++ lib/ui/work_list/worklist_detail_screen.dart | 37 ++++++++++--------- lib/widgets/app_bar_widget.dart | 2 +- 3 files changed, 55 insertions(+), 19 deletions(-) diff --git a/lib/api/items_for_sale/items_for_sale_api_client.dart b/lib/api/items_for_sale/items_for_sale_api_client.dart index 436ae6e..eae6ffb 100644 --- a/lib/api/items_for_sale/items_for_sale_api_client.dart +++ b/lib/api/items_for_sale/items_for_sale_api_client.dart @@ -66,6 +66,41 @@ class ItemsForSaleApiClient { }, url, postParams); } + Future updateItemsForSale(int itemSaleID) async { + List getItemsForSaleList = []; + + String url = "${ApiConsts.cocRest}Mohemm_ITG_UpdateItemForSale"; + + // request.fields['itemSaleID'] = itemSaleID.toString(); + // request.fields['Channel'] = "31"; + // request.fields['isActive'] = "false"; + // request.fields['LogInToken'] = loginTokenID!; + // request.fields['Token'] = tokenID!; + // request.fields['MobileNo'] = empMobNum!; + // request.fields['EmployeeNumber'] = empNum!; + // request.fields['employeeNumber'] = empNum; + + Map postParams = { + "EmployeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, + "employeeNumber": AppState().memberInformationList?.eMPLOYEENUMBER, + "MobileNo": AppState().memberInformationList?.eMPLOYEEMOBILENUMBER, + "itemSaleID": itemSaleID.toString(), + "Channel": "31", + "isActive": "false", + "Token": AppState().postParamsObject?.tokenID + }; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((response) { + var body = json.decode(response['Mohemm_ITG_ResponseItem']); + + // body['result']['data'].forEach((v) { + // getItemsForSaleList.add(new GetItemsForSaleList.fromJson(v)); + // }); + return getItemsForSaleList; + }, url, postParams); + } + Future> getEmployeePostedAds() async { List employeePostedAdsList = []; diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index 96bd09f..3f5655e 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -146,7 +146,7 @@ class _WorkListDetailScreenState extends State { getPRNotification(); } - if(controller.hasClients) { + if (controller.hasClients) { controller.jumpToPage(0); } @@ -210,6 +210,7 @@ class _WorkListDetailScreenState extends State { ); }, child: Stack( + key: ValueKey(AppState().workListIndex ?? 0), children: [ Column( children: [ @@ -251,19 +252,19 @@ class _WorkListDetailScreenState extends State { (workListData!.iTEMTYPE == "HRSSA" || workListData!.iTEMTYPE == "STAMP") ? DetailFragment(workListData, memberInformationListModel) : RequestFragment( - moNotificationBodyList: getMoNotificationBodyList, - poLinesList: getPoNotificationBody?.pOLines ?? [], - itemCreationLines: getItemCreationNtfBody?.itemCreationLines ?? [], - prLinesList: getPrNotificationBody?.pRLines ?? [], - ), + moNotificationBodyList: getMoNotificationBodyList, + poLinesList: getPoNotificationBody?.pOLines ?? [], + itemCreationLines: getItemCreationNtfBody?.itemCreationLines ?? [], + prLinesList: getPrNotificationBody?.pRLines ?? [], + ), isActionHistoryLoaded ? actionHistoryList.isEmpty - ? Utils.getNoDataWidget(context) - : ActionsFragment( - workListData!.nOTIFICATIONID, - actionHistoryList, - voidCallback: reloadWorkList, - ) + ? Utils.getNoDataWidget(context) + : ActionsFragment( + workListData!.nOTIFICATIONID, + actionHistoryList, + voidCallback: reloadWorkList, + ) : showLoadingAnimation(), InfoFragment( poHeaderList: getPoNotificationBody?.pOHeader ?? [], @@ -565,7 +566,7 @@ class _WorkListDetailScreenState extends State { Future performNetworkCall(BuildContext context, {String? email, String? userId}) async { showDialog( context: context, - builder: (BuildContext cxt) => ConfirmDialog( + builder: (cxt) => ConfirmDialog( message: LocaleKeys.wantToReject.tr(), okTitle: LocaleKeys.reject.tr(), onTap: () async { @@ -648,12 +649,12 @@ class _WorkListDetailScreenState extends State { print(actionMode); showDialog( context: context, - builder: (BuildContext cxt) => AcceptRejectInputDialog( + builder: (cxt) => AcceptRejectInputDialog( message: title != null ? null : LocaleKeys.requestedItems.tr(), title: title, notificationGetRespond: notificationNoteInput, actionMode: actionMode, - onTap: (String note) { + onTap: (note) { Map payload = { "P_ACTION_MODE": actionMode, "P_APPROVER_INDEX": null, @@ -934,9 +935,9 @@ class _WorkListDetailScreenState extends State { apiCallCount++; notificationButtonsList = await WorkListApiClient().getNotificationButtons(workListData!.nOTIFICATIONID!); if (notificationButtonsList.isNotEmpty) { - isCloseAvailable = notificationButtonsList.any((GetNotificationButtonsList element) => element.bUTTONACTION == "CLOSE"); - isApproveAvailable = notificationButtonsList.any((GetNotificationButtonsList element) => element.bUTTONACTION == "APPROVED"); - isRejectAvailable = notificationButtonsList.any((GetNotificationButtonsList element) => element.bUTTONACTION == "REJECTED"); + isCloseAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "CLOSE"); + isApproveAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "APPROVED"); + isRejectAvailable = notificationButtonsList.any((element) => element.bUTTONACTION == "REJECTED"); } apiCallCount--; if (apiCallCount == 0) { diff --git a/lib/widgets/app_bar_widget.dart b/lib/widgets/app_bar_widget.dart index fa59d3a..38cf570 100644 --- a/lib/widgets/app_bar_widget.dart +++ b/lib/widgets/app_bar_widget.dart @@ -20,7 +20,7 @@ AppBar AppBarWidget(BuildContext context, children: [ GestureDetector( behavior: HitTestBehavior.opaque, - onTap: Feedback.wrapForTap(() => Navigator.maybePop(context, true), context), + onTap: Feedback.wrapForTap(() => Navigator.maybePop(context), context), child: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor), ), 4.width, From 31fba1f8e64550d0066df341cfecabc74c15468c Mon Sep 17 00:00:00 2001 From: "mirza.shafique" Date: Tue, 6 Dec 2022 09:58:55 +0300 Subject: [PATCH 05/11] worklist animation fix --- lib/ui/work_list/itg_detail_screen.dart | 291 ++++++++++--------- lib/ui/work_list/worklist_detail_screen.dart | 7 +- lib/widgets/app_bar_widget.dart | 2 +- 3 files changed, 164 insertions(+), 136 deletions(-) diff --git a/lib/ui/work_list/itg_detail_screen.dart b/lib/ui/work_list/itg_detail_screen.dart index cf33648..e123d22 100644 --- a/lib/ui/work_list/itg_detail_screen.dart +++ b/lib/ui/work_list/itg_detail_screen.dart @@ -35,6 +35,7 @@ class ItgDetailScreen extends StatefulWidget { class _ItgDetailScreenState extends State { int tabIndex = 0; + int animationIndex = 0; PageController controller = PageController(); bool showFabOptions = false; @@ -82,6 +83,7 @@ class _ItgDetailScreenState extends State { void getDataFromState() { if (requestDetails == null) { + animationIndex = animationIndex + 1; requestDetails = AppState().requestAllList![AppState().itgWorkListIndex!]; // ModalRoute.of(context)!.settings.arguments as WorkListResponseModel; providerData.itgFormsModel!.totalCount = providerData.itgFormsModel!.totalCount! - 1; getItgData(); @@ -95,151 +97,170 @@ class _ItgDetailScreenState extends State { return Scaffold( appBar: AppBarWidget(context, title: LocaleKeys.details.tr()), backgroundColor: Colors.white, - body: Stack( - children: [ - Column( - children: [ - Container( - padding: const EdgeInsets.only(left: 21, right: 21, top: 16, bottom: 16), - decoration: const BoxDecoration( - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(25), - bottomRight: Radius.circular(25), + body: AnimatedSwitcher( + duration: const Duration(milliseconds: 500), + switchInCurve: Curves.easeInToLinear, + transitionBuilder: (Widget child, Animation animation) { + Animation custom = Tween( + begin: const Offset(1.0, 0.0), + end: Offset.zero, + ).animate(animation); + return ClipRect( + child: SlideTransition( + position: custom, + child: child, + // textDirection: TextDirection.ltr, + ), + ); + }, + child: Stack( + key: ValueKey(animationIndex), + children: [ + Column( + children: [ + Container( + padding: const EdgeInsets.only(left: 21, right: 21, top: 16, bottom: 16), + decoration: const BoxDecoration( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(25), + bottomRight: Radius.circular(25), + ), + gradient: LinearGradient( + transform: GradientRotation(.83), + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ], + ), ), - gradient: LinearGradient( - transform: GradientRotation(.83), - begin: Alignment.topRight, - end: Alignment.bottomLeft, - colors: [ - MyColors.gradiantEndColor, - MyColors.gradiantStartColor, + child: Row( + children: [ + myTab(LocaleKeys.requestDetails.tr(), 0), + myTab(LocaleKeys.approvalLevel.tr(), 1), + myTab(LocaleKeys.requesterDetails.tr(), 2), ], ), ), - child: Row( + PageView( + controller: controller, + onPageChanged: (pageIndex) { + setState(() { + tabIndex = pageIndex; + }); + }, children: [ - myTab(LocaleKeys.requestDetails.tr(), 0), - myTab(LocaleKeys.approvalLevel.tr(), 1), - myTab(LocaleKeys.requesterDetails.tr(), 2), + RequestDetailFragment(fields: itgRequest?.fieldGoups?[1].fields ?? []), + ApprovalLevelfragment( + wFHistory: itgRequest?.wFHistory ?? [], + voidCallback: reloadITG, + ), + RequestDetailFragment(fields: itgRequest?.fieldGoups?[0].fields ?? []), ], - ), - ), - PageView( - controller: controller, - onPageChanged: (pageIndex) { - setState(() { - tabIndex = pageIndex; - }); - }, - children: [ - RequestDetailFragment(fields: itgRequest?.fieldGoups?[1].fields ?? []), - ApprovalLevelfragment( - wFHistory: itgRequest?.wFHistory ?? [], - voidCallback: reloadITG, - ), - RequestDetailFragment(fields: itgRequest?.fieldGoups?[0].fields ?? []), - ], - ).expanded, - if (isApproveAvailable || isRejectAvailable || isCloseAvailable) - Container( - padding: const EdgeInsets.only(top: 14, bottom: 14, left: 21, right: 21), - decoration: const BoxDecoration( - color: Colors.white, - border: Border( - top: BorderSide( - color: MyColors.lightGreyEFColor, - width: 1.0, + ).expanded, + if (isApproveAvailable || isRejectAvailable || isCloseAvailable) + Container( + padding: const EdgeInsets.only(top: 14, bottom: 14, left: 21, right: 21), + decoration: const BoxDecoration( + color: Colors.white, + border: Border( + top: BorderSide( + color: MyColors.lightGreyEFColor, + width: 1.0, + ), ), ), - ), - child: Row( + child: Row( + children: [ + if (isRejectAvailable) + DefaultButton( + LocaleKeys.reject.tr(), + () => performAction("REJECTED"), + colors: const [ + Color(0xffE47A7E), + Color(0xffDE6D71), + ], + ).expanded, + if (isApproveAvailable && isRejectAvailable) 8.width, + if (isApproveAvailable) + DefaultButton( + LocaleKeys.approve.tr(), + () => performAction("APPROVED"), + colors: const [ + Color(0xff28C884), + Color(0xff1BB271), + ], + ).expanded, + if (isCloseAvailable) + DefaultButton( + LocaleKeys.ok.tr(), + () => performAction("CLOSE"), + colors: const [ + Color(0xff32D892), + Color(0xff1AB170), + ], + ).expanded, + 8.width, + Container( + height: 43, + width: 43, + decoration: const BoxDecoration( + shape: BoxShape.circle, + color: MyColors.lightGreyE6Color, + ), + child: Icon(showFabOptions ? Icons.more_vert_rounded : Icons.more_horiz_rounded, color: MyColors.darkIconColor), + ).onPress(() { + setState(() { + showFabOptions = true; + }); + }) + ], + ), + ) + ], + ), + IgnorePointer( + ignoring: !showFabOptions, + child: AnimatedOpacity( + opacity: showFabOptions ? 1 : 0, + duration: const Duration(milliseconds: 250), + child: Container( + padding: const EdgeInsets.only(left: 21, right: 21, bottom: 75 - 12), + width: double.infinity, + height: double.infinity, + color: Colors.white.withOpacity(.67), + alignment: Alignment.bottomRight, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, children: [ - if (isRejectAvailable) - DefaultButton( - LocaleKeys.reject.tr(), - () => performAction("REJECTED"), - colors: const [ - Color(0xffE47A7E), - Color(0xffDE6D71), - ], - ).expanded, - if (isApproveAvailable && isRejectAvailable) 8.width, - if (isApproveAvailable) - DefaultButton( - LocaleKeys.approve.tr(), - () => performAction("APPROVED"), - colors: const [ - Color(0xff28C884), - Color(0xff1BB271), - ], - ).expanded, - if (isCloseAvailable) - DefaultButton( - LocaleKeys.ok.tr(), - () => performAction("CLOSE"), - colors: const [ - Color(0xff32D892), - Color(0xff1AB170), - ], - ).expanded, - 8.width, - Container( - height: 43, - width: 43, - decoration: const BoxDecoration( - shape: BoxShape.circle, - color: MyColors.lightGreyE6Color, - ), - child: Icon(showFabOptions ? Icons.more_vert_rounded : Icons.more_horiz_rounded, color: MyColors.darkIconColor), - ).onPress(() { - setState(() { - showFabOptions = true; - }); - }) + myFab(LocaleKeys.skip.tr(), "assets/images/skip.svg").onPress(() { + if (AppState().requestAllList!.length - 1 > AppState().itgWorkListIndex!) { + animationIndex = animationIndex + 1; + AppState().itgWorkListIndex = AppState().itgWorkListIndex! + 1; + requestDetails = null; + itgRequest = null; + tabIndex = 0; + showFabOptions = false; + getDataFromState(); + } else if (AppState().requestAllList!.length - 1 == AppState().itgWorkListIndex!) { + Navigator.pop(context); + } + }), + 12.height, + ...viewApiButtonsList(allowedActionList), ], ), - ) - ], - ), - IgnorePointer( - ignoring: !showFabOptions, - child: AnimatedOpacity( - opacity: showFabOptions ? 1 : 0, - duration: const Duration(milliseconds: 250), - child: Container( - padding: const EdgeInsets.only(left: 21, right: 21, bottom: 75 - 12), - width: double.infinity, - height: double.infinity, - color: Colors.white.withOpacity(.67), - alignment: Alignment.bottomRight, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - myFab(LocaleKeys.skip.tr(), "assets/images/skip.svg").onPress(() { - if (AppState().requestAllList!.length - 1 > AppState().itgWorkListIndex!) { - AppState().itgWorkListIndex = AppState().itgWorkListIndex! + 1; - requestDetails = null; - itgRequest = null; - tabIndex = 0; - showFabOptions = false; - getDataFromState(); - } else if (AppState().requestAllList!.length - 1 == AppState().itgWorkListIndex!) { - Navigator.pop(context); - } - }), - 12.height, - ...viewApiButtonsList(allowedActionList), - ], ), - ), - ).onPress(() { - setState(() { - showFabOptions = false; - }); - }), - ), - ], + ).onPress(() { + setState(() { + showFabOptions = false; + }); + }), + ), + ], + ), ), floatingActionButton: (!isApproveAvailable && !isRejectAvailable && !isCloseAvailable) ? Container( @@ -514,6 +535,7 @@ class _ItgDetailScreenState extends State { Utils.hideLoading(context); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); // Navigator.pop(context, "delegate_reload"); + animationIndex=animationIndex+1; AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!); if (AppState().requestAllList!.isEmpty) { Navigator.pop(context, "delegate_reload"); @@ -534,9 +556,11 @@ class _ItgDetailScreenState extends State { void performDataCorrectionORReportGeneratedAction(String requestType, int taskId, int itemId, String employeeNumber) async { try { Utils.showLoading(context); + animationIndex = animationIndex + 1; ITGRequest? itgRequest = await WorkListApiClient().grantITGRequest(requestType, taskId, itemId, employeeNumber, "", ""); Utils.hideLoading(context); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); + AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!); if (AppState().requestAllList!.isEmpty) { Navigator.pop(context, "delegate_reload"); @@ -555,6 +579,7 @@ class _ItgDetailScreenState extends State { } void reloadITG() { + animationIndex = animationIndex + 1; AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!); if (AppState().requestAllList!.isEmpty) { Navigator.pop(context, "delegate_reload"); diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index 5d6727c..9ae62fd 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -55,6 +55,7 @@ class WorkListDetailScreen extends StatefulWidget { class _WorkListDetailScreenState extends State { int tabIndex = 0; + int animationIndex = 0; PageController controller = PageController(); bool showFabOptions = false; @@ -187,7 +188,6 @@ class _WorkListDetailScreenState extends State { @override Widget build(BuildContext context) { getDataFromState(); - return Scaffold( appBar: AppBarWidget(context, title: LocaleKeys.details.tr()), backgroundColor: Colors.white, @@ -208,7 +208,7 @@ class _WorkListDetailScreenState extends State { ); }, child: Stack( - key: ValueKey(AppState().workListIndex ?? 0), + key: ValueKey(animationIndex), children: [ Column( children: [ @@ -350,6 +350,7 @@ class _WorkListDetailScreenState extends State { children: [ myFab(LocaleKeys.skip.tr(), "assets/images/skip.svg").onPress(() { if (AppState().workList!.length - 1 > AppState().workListIndex!) { + animationIndex = animationIndex + 1; AppState().setWorkListIndex = AppState().workListIndex! + 1; workListData = null; showFabOptions = false; @@ -685,6 +686,7 @@ class _WorkListDetailScreenState extends State { GenericResponseModel model = await WorkListApiClient().postNotificationActions(payload); Utils.hideLoading(context); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); + animationIndex=animationIndex+1; AppState().workList!.removeAt(AppState().workListIndex!); if (AppState().workList!.isEmpty) { Navigator.pop(context, "delegate_reload"); @@ -703,6 +705,7 @@ class _WorkListDetailScreenState extends State { } void reloadWorkList() { + animationIndex = animationIndex + 1; AppState().workList!.removeAt(AppState().workListIndex!); if (AppState().workList!.isEmpty) { Navigator.pop(context, "delegate_reload"); diff --git a/lib/widgets/app_bar_widget.dart b/lib/widgets/app_bar_widget.dart index fa59d3a..38cf570 100644 --- a/lib/widgets/app_bar_widget.dart +++ b/lib/widgets/app_bar_widget.dart @@ -20,7 +20,7 @@ AppBar AppBarWidget(BuildContext context, children: [ GestureDetector( behavior: HitTestBehavior.opaque, - onTap: Feedback.wrapForTap(() => Navigator.maybePop(context, true), context), + onTap: Feedback.wrapForTap(() => Navigator.maybePop(context), context), child: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor), ), 4.width, From f3ffdc0088ef5b0483ec802dcce59c7ec6f6a8a9 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 6 Dec 2022 10:48:27 +0300 Subject: [PATCH 06/11] marathon URL update --- lib/classes/consts.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index fb506a9..944a29b 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -26,7 +26,7 @@ class ApiConsts { static String chatUserImages = chatServerBaseUrl + "empservice/api/employee/"; //Brain Marathon Constants - static String marathonBaseUrl = "https://18.188.181.12/service/"; + static String marathonBaseUrl = "https://marathoon.com/service/"; static String marathonParticipantLoginUrl = marathonBaseUrl + "api/auth/participantlogin"; static String marathonProjectGetUrl = marathonBaseUrl + "api/Project/Project_Get"; static String marathonUpcomingUrl = marathonBaseUrl + "api/marathon/upcoming/"; From ff7eb2ad6db95da7dda5e0b7063d91bcfea751c0 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Tue, 6 Dec 2022 10:51:55 +0300 Subject: [PATCH 07/11] Chat Fixes & User Chat Counter --- lib/ui/chat/chat_home.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/ui/chat/chat_home.dart b/lib/ui/chat/chat_home.dart index 0438dc6..df03ba7 100644 --- a/lib/ui/chat/chat_home.dart +++ b/lib/ui/chat/chat_home.dart @@ -8,8 +8,10 @@ import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; import 'package:mohem_flutter_app/ui/chat/chat_home_screen.dart'; import 'package:mohem_flutter_app/ui/chat/favorite_users_screen.dart'; +import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:provider/provider.dart'; +import 'package:signalr_netcore/signalr_client.dart'; class ChatHome extends StatefulWidget { const ChatHome({Key? key}) : super(key: key); @@ -28,6 +30,13 @@ class _ChatHomeState extends State { super.initState(); data = Provider.of(context, listen: false); data.registerEvents(); + if (hubConnection.state != HubConnectionState.Connected) { + data.getUserAutoLoginToken().whenComplete(() async { + await data.buildHubConnection(); + data.getUserRecentChats(); + }); + return; + } if (data.searchedChats == null || data.searchedChats!.isEmpty) { data.getUserRecentChats(); } From e94a8d9a5e86e291132df140d09c40be9d5c702b Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Tue, 6 Dec 2022 10:57:56 +0300 Subject: [PATCH 08/11] Hub Connection Fix --- lib/provider/chat_provider_model.dart | 26 ++++++++++++-------------- lib/ui/chat/chat_home.dart | 2 +- lib/ui/landing/dashboard_screen.dart | 4 ++-- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/lib/provider/chat_provider_model.dart b/lib/provider/chat_provider_model.dart index b045bbb..0b522db 100644 --- a/lib/provider/chat_provider_model.dart +++ b/lib/provider/chat_provider_model.dart @@ -51,10 +51,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } Future buildHubConnection() async { - hubConnection = await getHubConnection(); - await hubConnection.start()!.then((value) { - print('-----------------------Hub Started For Chat------------------'); - }); + chatHubConnection = await getHubConnection(); + await chatHubConnection.start(); } Future getHubConnection() async { @@ -75,18 +73,18 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } void registerEvents() { - hubConnection.on("OnUpdateUserStatusAsync", changeStatus); - hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived); + chatHubConnection.on("OnUpdateUserStatusAsync", changeStatus); + chatHubConnection.on("OnDeliveredChatUserAsync", onMsgReceived); // hubConnection.on("OnSeenChatUserAsync", onChatSeen); //hubConnection.on("OnUserTypingAsync", onUserTyping); - hubConnection.on("OnUserCountAsync", userCountAsync); + chatHubConnection.on("OnUserCountAsync", userCountAsync); // hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow); - hubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered); - hubConnection.on("OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus); + chatHubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered); + chatHubConnection.on("OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus); } void getUserRecentChats() async { - if (hubConnection.state != HubConnectionState.Connected) { + if (chatHubConnection.state != HubConnectionState.Connected) { getUserAutoLoginToken().whenComplete(() async { await buildHubConnection(); getUserRecentChats(); @@ -127,7 +125,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } Future invokeUserChatHistoryNotDeliveredAsync({required int userId}) async { - await hubConnection.invoke("GetUserChatHistoryNotDeliveredAsync", args: [userId]); + await chatHubConnection.invoke("GetUserChatHistoryNotDeliveredAsync", args: [userId]); return ""; } @@ -194,7 +192,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { void updateUserChatHistoryStatusAsync(List data) { try { - hubConnection.invoke("UpdateUserChatHistoryStatusAsync", args: [data]); + chatHubConnection.invoke("UpdateUserChatHistoryStatusAsync", args: [data]); } catch (e) { throw e; } @@ -202,7 +200,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { void updateUserChatHistoryOnMsg(List data) { try { - hubConnection.invoke("UpdateUserChatHistoryStatusAsync", args: [data]); + chatHubConnection.invoke("UpdateUserChatHistoryStatusAsync", args: [data]); } catch (e) { throw e; } @@ -486,7 +484,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { String chatData = '{"contant":"$msg","contantNo":"$contentNo","chatEventId":$chatEventId,"fileTypeId": $fileTypeId,"currentUserId":${AppState().chatDetails!.response!.id},"chatSource":1,"userChatHistoryLineRequestList":[{"isSeen":false,"isDelivered":false,"targetUserId":$targetUserId,"targetUserStatus":1}],"chatReplyId":$chatReplyId,"conversationId":"$chatCID"}'; - await hubConnection.invoke("AddChatUserAsync", args: [json.decode(chatData)]); + await chatHubConnection.invoke("AddChatUserAsync", args: [json.decode(chatData)]); } void sendChatMessage(int targetUserId, String targetUserName, BuildContext context) async { diff --git a/lib/ui/chat/chat_home.dart b/lib/ui/chat/chat_home.dart index df03ba7..4e218e3 100644 --- a/lib/ui/chat/chat_home.dart +++ b/lib/ui/chat/chat_home.dart @@ -30,7 +30,7 @@ class _ChatHomeState extends State { super.initState(); data = Provider.of(context, listen: false); data.registerEvents(); - if (hubConnection.state != HubConnectionState.Connected) { + if (chatHubConnection.state != HubConnectionState.Connected) { data.getUserAutoLoginToken().whenComplete(() async { await data.buildHubConnection(); data.getUserRecentChats(); diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 8c1291a..f06a405 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -31,7 +31,7 @@ import 'package:provider/provider.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:signalr_netcore/signalr_client.dart'; -late HubConnection hubConnection; +late HubConnection chatHubConnection; class DashboardScreen extends StatefulWidget { DashboardScreen({Key? key}) : super(key: key); @@ -67,7 +67,7 @@ class _DashboardScreenState extends State { @override void dispose() { super.dispose(); - hubConnection.stop(); + chatHubConnection.stop(); } void _bHubCon() { From a949f15023cf047b16dc4e666411ee293f4dbb58 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 6 Dec 2022 11:04:13 +0300 Subject: [PATCH 09/11] fixes --- lib/ui/work_list/worklist_fragments/detail_fragment.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ui/work_list/worklist_fragments/detail_fragment.dart b/lib/ui/work_list/worklist_fragments/detail_fragment.dart index 43b5d7d..03e2272 100644 --- a/lib/ui/work_list/worklist_fragments/detail_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/detail_fragment.dart @@ -46,6 +46,7 @@ class _DetailFragmentState extends State { ], ).objectContainerView(), 12.height, + widget.memberInformationListModel != null ? Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, @@ -69,7 +70,7 @@ class _DetailFragmentState extends State { isItLast: true, ), ], - ).objectContainerView(), + ).objectContainerView() : Container(), ], ).paddingAll(21), ); From 915a7d208f1342c56672afc6e00fb859589ea2c4 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 6 Dec 2022 13:17:16 +0300 Subject: [PATCH 10/11] Jira translation fix --- lib/ui/landing/widget/app_drawer.dart | 44 +++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/ui/landing/widget/app_drawer.dart b/lib/ui/landing/widget/app_drawer.dart index ac70035..4160fde 100644 --- a/lib/ui/landing/widget/app_drawer.dart +++ b/lib/ui/landing/widget/app_drawer.dart @@ -69,28 +69,28 @@ class _AppDrawerState extends State { ).expanded ], ).paddingOnly(left: 14, right: 14, top: 21, bottom: 21), - Row( - children: [ - Row( - children: [ - LocaleKeys.english.tr().toText14(color: AppState().isArabic(context) ? null : MyColors.textMixColor).onPress(() { - context.setLocale(const Locale("en", "US")); - postLanguageChange(context); - }), - Container( - width: 1, - color: MyColors.darkWhiteColor, - height: 16, - margin: const EdgeInsets.only(left: 10, right: 10), - ), - LocaleKeys.arabic.tr().toText14(color: !AppState().isArabic(context) ? null : MyColors.textMixColor).onPress(() { - context.setLocale(const Locale("ar", "SA")); - postLanguageChange(context); - }), - ], - ), - ], - ).paddingOnly(left: 14, right: 14, bottom: 14), + // Row( + // children: [ + // Row( + // children: [ + // LocaleKeys.english.tr().toText14(color: AppState().isArabic(context) ? null : MyColors.textMixColor).onPress(() { + // context.setLocale(const Locale("en", "US")); + // postLanguageChange(context); + // }), + // Container( + // width: 1, + // color: MyColors.darkWhiteColor, + // height: 16, + // margin: const EdgeInsets.only(left: 10, right: 10), + // ), + // LocaleKeys.arabic.tr().toText14(color: !AppState().isArabic(context) ? null : MyColors.textMixColor).onPress(() { + // context.setLocale(const Locale("ar", "SA")); + // postLanguageChange(context); + // }), + // ], + // ), + // ], + // ).paddingOnly(left: 14, right: 14, bottom: 14), const Divider( height: 1, thickness: 1, From c500da9a188c3a1a436b4cd1381a8e2c50b68adf Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Tue, 6 Dec 2022 14:12:01 +0300 Subject: [PATCH 11/11] bug fix --- lib/api/my_attendance_api_client.dart | 4 +- lib/classes/utils.dart | 11 +++-- .../dynamic_screens/dynamic_input_screen.dart | 46 +++++++++++++++++-- lib/ui/profile/personal_info.dart | 2 +- 4 files changed, 53 insertions(+), 10 deletions(-) diff --git a/lib/api/my_attendance_api_client.dart b/lib/api/my_attendance_api_client.dart index 9bb16a8..5833413 100644 --- a/lib/api/my_attendance_api_client.dart +++ b/lib/api/my_attendance_api_client.dart @@ -70,7 +70,7 @@ class MyAttendanceApiClient { }, url, postParams); } - Future getDefaultValue(String pSegmentName, String pDescFlexContextCode, String pDescFlexName, List> list, String? empID) async { + Future getDefaultValue(String pSegmentName, String pDescFlexContextCode, String pDescFlexName, List> list, {String? empID}) async { String url = "${ApiConsts.erpRest}GET_DEFAULT_VALUE"; Map postParams = { "P_SELECTED_RESP_ID": -999, @@ -82,7 +82,7 @@ class MyAttendanceApiClient { "GetValueSetValuesTBL": list, }; postParams.addAll(AppState().postParamsJson); - if (empID!.isNotEmpty) { + if (empID != null && empID!.isNotEmpty) { postParams['P_SELECTED_EMPLOYEE_NUMBER'] = empID; } return await ApiClient().postJsonForObject((json) { diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index 7e7e83c..33d9830 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -9,6 +9,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:fluttertoast/fluttertoast.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/date_uitl.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/exceptions/api_exception.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; @@ -20,6 +21,7 @@ import 'package:mohem_flutter_app/widgets/loading_dialog.dart'; import 'package:nfc_manager/nfc_manager.dart'; import 'package:nfc_manager/platform_tags.dart'; import 'package:shared_preferences/shared_preferences.dart'; + // ignore_for_file: avoid_annotating_with_dynamic class Utils { @@ -289,7 +291,7 @@ class Utils { String formattedDate; if (date.isNotEmpty) { formattedDate = date.split('T')[0]; - if(!formattedDate.contains("00:00:00")) { + if (!formattedDate.contains("00:00:00")) { formattedDate = formattedDate + ' 00:00:00'; } } else { @@ -298,6 +300,10 @@ class Utils { return formattedDate; } + static String formatDateDefault(String date) { + return DateFormat('yyyy-MM-dd').format(DateFormat('dd-MMM-yyyy').parseLoose(date)); + } + static Future selectDate(BuildContext context, DateTime selectedDate) async { if (!Platform.isIOS) { await showCupertinoModalPopup( @@ -326,8 +332,7 @@ class Utils { return selectedDate; } - static void readNFc({required Function(String) onRead}) { - + static void readNFc({required Function(String) onRead}) { NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async { print(tag.data); var f; 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 ad7ad50..1c86eb8 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -50,6 +50,18 @@ class _DynamicInputScreenState extends State { descFlexConTextTitle = genericResponseModel!.pDESCFLEXCONTEXTNAME ?? ""; getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? []; //getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList(); + if (dynamicParams!.collectionNotificationList != null && dynamicParams!.collectionNotificationList!.isNotEmpty) { + getEitDffStructureList!.forEach((element) { + dynamicParams!.collectionNotificationList!.forEach((element2) { + if (element.sEGMENTNAME == element2.segmentName) { + element.fieldAnswer = element2.varchar2Value; + element.eSERVICESDV ??= ESERVICESDV(); + element.eSERVICESDV!.pIDCOLUMNNAME = element2.varchar2Value; + } + }); + }); + } + Utils.hideLoading(context); setState(() {}); } catch (ex) { @@ -114,15 +126,22 @@ class _DynamicInputScreenState extends State { try { Utils.showLoading(context); for (int i = 0; i < (structureList.cHILDSEGMENTSVSSplited?.length ?? 0); i++) { + List> values = []; String segmentId = structureList.cHILDSEGMENTSVSSplited![i]; if (dESCFLEXCONTEXTCODE.isEmpty) dESCFLEXCONTEXTCODE = structureList.dESCFLEXCONTEXTCODE!; List filteredList = getEitDffStructureList?.where((element) => element.cHILDSEGMENTSVSSplited!.contains(segmentId)).toList() ?? []; - List> values = filteredList + + if (filteredList.isEmpty && structureList.cHILDSEGMENTSVSSplited!.isNotEmpty) { + segmentId = structureList.cHILDSEGMENTSVSSplited![0]; + filteredList = getEitDffStructureList?.where((element) => element.cHILDSEGMENTSVSSplited!.contains(segmentId)).toList() ?? []; + } + values = filteredList .map((e) => GetSetValuesRequestModel( sEGMENTNAME: e.sEGMENTNAME, vALUECOLUMNNAME: e.eSERVICESDV!.pVALUECOLUMNNAME, dESCRIPTION: "", iDCOLUMNNAME: e.eSERVICESDV!.pIDCOLUMNNAME, fLEXVALUESETNAME: e.fLEXVALUESETNAME) .toJson()) .toList(); + List eServicesResponseModel = await MyAttendanceApiClient().getValueSetValues(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values, empID: dynamicParams!.selectedEmp ?? '', parentValue: structureList.eSERVICESDV!.pVALUECOLUMNNAME); List abc = genericResponseModel?.getEITDFFStructureList ?? []; @@ -162,9 +181,28 @@ class _DynamicInputScreenState extends State { List> getSetList = getDefaultValuesIonicLogic(parent); if (getSetList.isNotEmpty) { - ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, getSetList, dynamicParams!.selectedEmp); + ESERVICESDV defaultValue = + await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, getSetList, empID: dynamicParams!.selectedEmp); int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId); getEitDffStructureList![index].eSERVICESDV = defaultValue; + GetEITDFFStructureList defaultValueCheck = getEitDffStructureList!.where((GetEITDFFStructureList element) => element.sEGMENTNAME == segmentId).toList().first; + + if (defaultValueCheck.cHILDSEGMENTSDVSplited!.isNotEmpty && defaultValueCheck.rEADONLY == 'Y') { + getDefaultValues(defaultValueCheck); + Utils.hideLoading(context); + + // GetEITDFFStructureList? parent = getEitDffStructureList!.firstWhere((element) => element.sEGMENTNAME == segmentId); + // List> getSetList = getDefaultValuesIonicLogic(parent); + // ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, defaultValueCheck.dESCFLEXCONTEXTCODE!, defaultValueCheck.dESCFLEXNAME!, getSetList); + // int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId); + // getEitDffStructureList![index].eSERVICESDV = defaultValue; + } else if (defaultValueCheck.cHILDSEGMENTSVSSplited!.isNotEmpty && defaultValueCheck.rEADONLY == 'Y') { + calGetValueSetValues(defaultValueCheck); + Utils.hideLoading(context); + } + } else if (values.isNotEmpty) { + ESERVICESDV defaultValue = await MyAttendanceApiClient().getDefaultValue(segmentId, structureList.dESCFLEXCONTEXTCODE!, structureList.dESCFLEXNAME!, values); + int index = getEitDffStructureList!.indexWhere((element) => element.sEGMENTNAME == segmentId); } } await Future.delayed(const Duration(seconds: 1)); @@ -305,7 +343,7 @@ class _DynamicInputScreenState extends State { idColName = val; if (getEitDffStructureList![j].fORMATTYPE == "X") { - idColName = Utils.formatDateNew(idColName!); + idColName = Utils.formatDateDefault(idColName!); // commenting to test // DateTime date = DateFormat('yyyy-MM-dd').parse(idColName!); // idColName = DateFormat('yyyy-MM-dd HH:mm:ss').format(date); @@ -324,7 +362,7 @@ class _DynamicInputScreenState extends State { if (getEitDffStructureList![j].rEADONLY != "Y") { var data = getEitDffStructureList![j].eSERVICESDV; - // let x = document.getElementById(getEitDffStructureList![j].aPPLICATIONCOLUMNNAME) as HTMLSelectElement; + //let x = document.getElementById(getEitDffStructureList![j].aPPLICATIONCOLUMNNAME) as HTMLSelectElement; String? text = data?.pIDCOLUMNNAME; //x.options[x.selectedIndex] ? x.options[x.selectedIndex].text : ""; String? val = data?.pVALUECOLUMNNAME; //x.options[x.selectedIndex] ? x.options[x.selectedIndex].value : null; if ((val ?? "").isEmpty && parentsList[i].isRequired == "REQUIRED") { diff --git a/lib/ui/profile/personal_info.dart b/lib/ui/profile/personal_info.dart index b715cdc..79d0995 100644 --- a/lib/ui/profile/personal_info.dart +++ b/lib/ui/profile/personal_info.dart @@ -43,7 +43,7 @@ class PersonalInfo extends StatelessWidget { LocaleKeys.Payroll.tr().toText13(color: MyColors.lightGrayColor), (memberInformationList.pAYROLLNAME ?? "").toText16(), ], - ).objectContainerView(center: false).paddingAll(21), + ).objectContainerView().paddingAll(21), ), ); }