From 1cd7cd4d7653f1451da220c5d2d2be8307a54035 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 27 Oct 2022 15:54:52 +0300 Subject: [PATCH] issues fixed. --- lib/generated/codegen_loader.g.dart | 2 +- lib/ui/marathon/marathon_screen.dart | 32 ++++++------------- lib/ui/work_list/itg_detail_screen.dart | 1 + lib/ui/work_list/sheets/delegate_sheet.dart | 6 ++++ lib/ui/work_list/work_list_screen.dart | 29 +++++++++++------ lib/ui/work_list/worklist_detail_screen.dart | 29 +++++++++++------ .../worklist_fragments/actions_fragment.dart | 5 +-- 7 files changed, 61 insertions(+), 43 deletions(-) diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 5da5ba1..6e35b8d 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -932,7 +932,7 @@ static const Map en_US = { "updateMember": "Are You Sure You Want to Update this Member?", "fieldIsEmpty": "'{data}' Field is empty. Please select", "pleaseEnterComments": "Please enter comments", - "skip": "skip", + "skip": "Skip", "typeCurrentPasswordBelow": "Type Your Current password below", "currentPassword": "Current password", "profile": { diff --git a/lib/ui/marathon/marathon_screen.dart b/lib/ui/marathon/marathon_screen.dart index 445d72a..d8f1b97 100644 --- a/lib/ui/marathon/marathon_screen.dart +++ b/lib/ui/marathon/marathon_screen.dart @@ -30,8 +30,7 @@ class MarathonScreen extends StatelessWidget { children: [ const MarathonHeader(), 20.height, - MarathonProgressContainer(provider: provider) - .paddingOnly(left: 21, right: 21), + MarathonProgressContainer(provider: provider).paddingOnly(left: 21, right: 21), if (provider.isMarathonCompleted) InkWell( onTap: () { @@ -58,17 +57,12 @@ class MarathonScreen extends StatelessWidget { subTitle: Text( LocaleKeys.allQuestionsCorrect.tr(), textAlign: TextAlign.center, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.w600, - color: MyColors.darkTextColor, - letterSpacing: -1.08), + style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: MyColors.darkTextColor, letterSpacing: -1.08), ), ).paddingOnly(top: 12, left: 21, right: 21), ) else - QuestionCard(provider: provider) - .paddingOnly(top: 12, left: 21, right: 21), + QuestionCard(provider: provider).paddingOnly(top: 12, left: 21, right: 21), ], ), ), @@ -79,12 +73,10 @@ class MarathonScreen extends StatelessWidget { class MarathonProgressContainer extends StatefulWidget { final MarathonProvider provider; - const MarathonProgressContainer({Key? key, required this.provider}) - : super(key: key); + const MarathonProgressContainer({Key? key, required this.provider}) : super(key: key); @override - State createState() => - _MarathonProgressContainerState(); + State createState() => _MarathonProgressContainerState(); } class _MarathonProgressContainerState extends State { @@ -107,7 +99,7 @@ class _MarathonProgressContainerState extends State { return Container( width: double.infinity, decoration: MyDecorations.shadowDecoration, - padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 20), + padding: const EdgeInsets.all(21), child: Column( mainAxisSize: MainAxisSize.min, children: [ @@ -120,18 +112,15 @@ class _MarathonProgressContainerState extends State { borderRadius: BorderRadius.circular(12), ), padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 8), - child: - "${widget.provider.currentQuestionNumber.toString()} / ${widget.provider.totalQuestions.toString()} ${LocaleKeys.question.tr()}" - .toText12(color: MyColors.white), + child: "${widget.provider.currentQuestionNumber.toString()} / ${widget.provider.totalQuestions.toString()} ${LocaleKeys.question.tr()}".toText12(color: MyColors.white), ), "23 ${LocaleKeys.marathoners.tr()}".toText14(), - "00:${widget.provider.start < 10 ? "0${widget.provider.start}" : widget.provider.start}" - .toText18(), + "00:${widget.provider.start < 10 ? "0${widget.provider.start}" : widget.provider.start}".toText18(), ], ), 15.height, StepsIndicator( - lineLength: 23, + lineLength: 21, nbSteps: 10, selectedStep: widget.provider.currentQuestionNumber, doneLineColor: MyColors.greenColor, @@ -152,8 +141,7 @@ class _MarathonProgressContainerState extends State { 12.height, Row( children: [ - "${widget.provider.currentQuestionNumber * 10}% ${LocaleKeys.completed.tr()}" - .toText14(isBold: true), + "${widget.provider.currentQuestionNumber * 10}% ${LocaleKeys.completed.tr()}".toText14(isBold: true), ], ), ], diff --git a/lib/ui/work_list/itg_detail_screen.dart b/lib/ui/work_list/itg_detail_screen.dart index 0a74500..e306750 100644 --- a/lib/ui/work_list/itg_detail_screen.dart +++ b/lib/ui/work_list/itg_detail_screen.dart @@ -210,6 +210,7 @@ class _ItgDetailScreenState extends State { AppState().itgWorkListIndex = AppState().itgWorkListIndex! + 1; requestDetails = null; itgRequest = null; + tabIndex = 0; showFabOptions = false; getDataFromState(); } else if (AppState().requestAllList!.length - 1 == AppState().itgWorkListIndex!) { diff --git a/lib/ui/work_list/sheets/delegate_sheet.dart b/lib/ui/work_list/sheets/delegate_sheet.dart index 7417c30..4075332 100644 --- a/lib/ui/work_list/sheets/delegate_sheet.dart +++ b/lib/ui/work_list/sheets/delegate_sheet.dart @@ -54,6 +54,12 @@ class _DelegateSheetState extends State { var ids = widget.wFHistory!.map((e) => e.employeeID).toSet(); widget.wFHistory!.retainWhere((x) => ids.remove(x.employeeID)); } + + if (widget.actionHistoryList != null) { + widget.actionHistoryList = widget.actionHistoryList!.reversed.toList(); + var ids = widget.actionHistoryList!.map((e) => e.uSERNAME).toSet(); + widget.actionHistoryList!.retainWhere((x) => ids.remove(x.uSERNAME)); + } } @override diff --git a/lib/ui/work_list/work_list_screen.dart b/lib/ui/work_list/work_list_screen.dart index 7def350..9719030 100644 --- a/lib/ui/work_list/work_list_screen.dart +++ b/lib/ui/work_list/work_list_screen.dart @@ -131,16 +131,27 @@ class _WorkListScreenState extends State { } else if (workListElement.key == "COC") { workListElement.value = providerData.cocFinalCount; } else { - var tempList = providerData.getOpenNotificationsList?.where((notificationElement) { - return (notificationElement.itemType == workListItemTypes[workListItemIndex].key) && notificationElement.itemType == workListElement.key; - }).toList(); - if (tempList!.isNotEmpty) { - if ((AppState().workList?.length ?? 0) != (tempList.first.openNtfNumber ?? 0)) { - workListElement.value = AppState().workList?.length ?? 0; - providerData.workListCounter = providerData.workListCounter - ((tempList.first.openNtfNumber ?? 0) - (AppState().workList?.length ?? 0)); - providerData.notify(); + providerData.getOpenNotificationsList?.forEach((element) { + if ((element.itemType == workListItemTypes[workListItemIndex].key) && element.itemType == workListElement.key) { + if ((AppState().workList?.length ?? 0) != (element.openNtfNumber ?? 0)) { + workListElement.value = AppState().workList?.length ?? 0; + providerData.workListCounter = providerData.workListCounter - ((element.openNtfNumber ?? 0) - (AppState().workList?.length ?? 0)); + element.openNtfNumber = workListElement.value; + providerData.notify(); + } } - } + }); + + // var tempList = providerData.getOpenNotificationsList?.where((notificationElement) { + // return (notificationElement.itemType == workListItemTypes[workListItemIndex].key) && notificationElement.itemType == workListElement.key; + // }).toList(); + // if (tempList!.isNotEmpty) { + // if ((AppState().workList?.length ?? 0) != (tempList.first.openNtfNumber ?? 0)) { + // workListElement.value = AppState().workList?.length ?? 0; + // providerData.workListCounter = providerData.workListCounter - ((tempList.first.openNtfNumber ?? 0) - (AppState().workList?.length ?? 0)); + // providerData.notify(); + // } + // } } }); } diff --git a/lib/ui/work_list/worklist_detail_screen.dart b/lib/ui/work_list/worklist_detail_screen.dart index 6e4dcb2..03c9081 100644 --- a/lib/ui/work_list/worklist_detail_screen.dart +++ b/lib/ui/work_list/worklist_detail_screen.dart @@ -312,6 +312,7 @@ class _WorkListDetailScreenState extends State { AppState().setWorkListIndex = AppState().workListIndex! + 1; workListData = null; showFabOptions = false; + tabIndex = 0; getDataFromState(); } else if (AppState().workList!.length - 1 == AppState().workListIndex!) { Navigator.pop(context); @@ -354,26 +355,35 @@ class _WorkListDetailScreenState extends State { if (notificationButtonsList[i].bUTTONACTION! == "REJECTED" || notificationButtonsList[i].bUTTONACTION! == "APPROVED" || notificationButtonsList[i].bUTTONACTION! == "CLOSE") { continue; } - fabs.add(myFab(notificationButtonsList[i].bUTTONLABEL!, notificationButtonsList[i].bUTTONACTION == "DELEGATE" ? "assets/images/delegate.svg" : notificationButtonsList[i].bUTTONICON ?? "", - isIconAsset: notificationButtonsList[i].bUTTONACTION == "DELEGATE" ? true : false,) - .paddingOnly(bottom: 12) - .onPress(() => handleFabAction(notificationButtonsList[i]))); + fabs.add(myFab( + notificationButtonsList[i].bUTTONLABEL!, + notificationButtonsList[i].bUTTONACTION == "DELEGATE" ? "assets/images/delegate.svg" : notificationButtonsList[i].bUTTONICON ?? "", + isIconAsset: notificationButtonsList[i].bUTTONACTION == "DELEGATE" ? true : false, + ).paddingOnly(bottom: 12).onPress(() => handleFabAction(notificationButtonsList[i]))); } return fabs; } void handleFabAction(GetNotificationButtonsList notificationButton) { + print("notificationButton:${notificationButton.bUTTONACTION}"); switch (notificationButton.bUTTONACTION) { case "DELEGATE": showMyBottomSheet(context, child: DelegateSheet(title: LocaleKeys.delegate.tr(), apiMode: notificationButton.bUTTONACTION!, notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); - break; case "REQUEST_INFO": // do something else showMyBottomSheet(context, child: DelegateSheet(title: LocaleKeys.request_info.tr(), apiMode: "REQUEST_INFO", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); break; + case "TRANSFER_INFO": + // do something else + showMyBottomSheet(context, + child: DelegateSheet(title: notificationButton.bUTTONLABEL!, apiMode: notificationButton.bUTTONACTION!, notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); + break; + case "ANSWER_INFO": + performAction(notificationButton.bUTTONACTION!,title: notificationButton.bUTTONLABEL); + break; case "RFC": // do something else break; @@ -384,10 +394,10 @@ class _WorkListDetailScreenState extends State { // do something else case "APPROVE_AND_FORWARD": showMyBottomSheet(context, - child: DelegateSheet(title: "Approve and Forward", apiMode: "APPROVE_AND_FORWARD", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); + child: DelegateSheet(title: "Approve and Forward", apiMode: notificationButton.bUTTONACTION!, notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); break; case "FORWARD": - showMyBottomSheet(context, child: DelegateSheet(title: "Forward", apiMode: "FORWARD", notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); + showMyBottomSheet(context, child: DelegateSheet(title: "Forward", apiMode: notificationButton.bUTTONACTION!, notificationID: workListData!.nOTIFICATIONID, actionHistoryList: actionHistoryList)); break; case "REJECT": performNetworkCall(context, email: "", userId: ""); @@ -480,12 +490,13 @@ class _WorkListDetailScreenState extends State { ); } - void performAction(String actionMode) { + void performAction(String actionMode,{String? title}) { TextEditingController textEditingController = TextEditingController(); showDialog( context: context, builder: (cxt) => AcceptRejectInputDialog( - message: LocaleKeys.requestedItems.tr(), + message: title !=null ? null:LocaleKeys.requestedItems.tr(), + title: title, notificationGetRespond: notificationNoteInput, onTap: (note) { Map payload = { diff --git a/lib/ui/work_list/worklist_fragments/actions_fragment.dart b/lib/ui/work_list/worklist_fragments/actions_fragment.dart index c00f521..d5e1f89 100644 --- a/lib/ui/work_list/worklist_fragments/actions_fragment.dart +++ b/lib/ui/work_list/worklist_fragments/actions_fragment.dart @@ -124,6 +124,7 @@ class ActionsFragment extends StatelessWidget { } Color getStatusColor(String code) { + print("code:$code"); if (code == "SUBMIT") { return const Color(0xff2E303A); } else if (code == "REJECTED") { @@ -134,10 +135,10 @@ class ActionsFragment extends StatelessWidget { return MyColors.orange; } else if (code == "APPROVED" || code == "APPROVE") { return const Color(0xff1FA269); - } else if (code != "SUBMIT" && code != "REJECT" && code != "PENDING") { - return MyColors.orange; } else if (code == "REQUEST_INFO") { return const Color(0xff2E303A); + } else if (code != "SUBMIT" && code != "REJECT" && code != "PENDING") { + return MyColors.orange; } else { return const Color(0xff2E303A); }