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/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index 26060ea..964dab8 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -123,6 +123,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { List? getOpenNotificationsList; MohemmITGPendingTaskResponseItem? cocCount; int cocFinalCount = 0; + //Work List API's & Methods Future fetchWorkListCounter(context, {bool showLoading = false}) async { try { diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index 8cd93e4..4a7b659 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -140,7 +140,7 @@ class _LoginScreenState extends State { Widget build(BuildContext context) { if (isAppOpenBySystem == null) { isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool; - if (kDebugMode) { + if (kReleaseMode) { // username.text = "15444"; // Maha User username.text = "15153"; // Tamer User password.text = "Abcd@12345"; diff --git a/lib/ui/marathon/marathon_intro_screen.dart b/lib/ui/marathon/marathon_intro_screen.dart index 4a1a2b6..9ccf5b0 100644 --- a/lib/ui/marathon/marathon_intro_screen.dart +++ b/lib/ui/marathon/marathon_intro_screen.dart @@ -178,47 +178,45 @@ class MarathonFooter extends StatelessWidget { }) : super(key: key); Widget buildNoteForDemo() { - return Flexible( - child: RichText( - text: TextSpan( - children: [ - TextSpan( - text: LocaleKeys.note.tr(), - style: const TextStyle( - color: MyColors.darkTextColor, - fontSize: 17, - letterSpacing: -0.64, - fontWeight: FontWeight.bold, - ), + return RichText( + text: TextSpan( + children: [ + TextSpan( + text: LocaleKeys.note.tr(), + style: const TextStyle( + color: MyColors.darkTextColor, + fontSize: 17, + letterSpacing: -0.64, + fontWeight: FontWeight.bold, ), - TextSpan( - text: " " + LocaleKeys.demoMarathonNoteP1.tr(), - style: const TextStyle( - color: MyColors.grey77Color, - fontSize: 17, - letterSpacing: -0.64, - fontWeight: FontWeight.w500, - ), + ), + TextSpan( + text: " " + LocaleKeys.demoMarathonNoteP1.tr(), + style: const TextStyle( + color: MyColors.grey77Color, + fontSize: 17, + letterSpacing: -0.64, + fontWeight: FontWeight.w500, ), - TextSpan( - text: " " + LocaleKeys.demoMarathonNoteP2.tr(), - style: const TextStyle( - color: MyColors.darkTextColor, - fontSize: 17, - fontWeight: FontWeight.bold, - ), + ), + TextSpan( + text: " " + LocaleKeys.demoMarathonNoteP2.tr(), + style: const TextStyle( + color: MyColors.darkTextColor, + fontSize: 17, + fontWeight: FontWeight.bold, ), - TextSpan( - text: " " + LocaleKeys.demoMarathonNoteP3.tr(), - style: const TextStyle( - color: MyColors.grey77Color, - fontSize: 17, - letterSpacing: -0.64, - fontWeight: FontWeight.w500, - ), - ) - ], - ), + ), + TextSpan( + text: " " + LocaleKeys.demoMarathonNoteP3.tr(), + style: const TextStyle( + color: MyColors.grey77Color, + fontSize: 17, + letterSpacing: -0.64, + fontWeight: FontWeight.w500, + ), + ) + ], ), ).paddingOnly(right: 21, left: 21, top: 11, bottom: 0); } diff --git a/lib/ui/marathon/marathon_provider.dart b/lib/ui/marathon/marathon_provider.dart index 50a7bd2..39958c2 100644 --- a/lib/ui/marathon/marathon_provider.dart +++ b/lib/ui/marathon/marathon_provider.dart @@ -55,11 +55,13 @@ class MarathonProvider extends ChangeNotifier { timer.cancel(); cancelTimer(); isMarathonCompleted = true; - await Future.delayed(const Duration(seconds: 3)); - Navigator.pushReplacementNamed( - context, - AppRoutes.marathonWinnerSelection, + await Future.delayed(const Duration(seconds: 3)).whenComplete( + () => Navigator.pushReplacementNamed( + context, + AppRoutes.marathonWinnerSelection, + ), ); + resetValues(); return; @@ -77,8 +79,9 @@ class MarathonProvider extends ChangeNotifier { void resetValues() { timerU.cancel(); - isMarathonCompleted = false; - currentQuestionNumber = 1; + _isMarathonCompleted = false; + _currentQuestionNumber = 1; + notifyListeners(); } void cancelTimer() { diff --git a/lib/ui/marathon/marathon_screen.dart b/lib/ui/marathon/marathon_screen.dart index 2d7acee..d8f1b97 100644 --- a/lib/ui/marathon/marathon_screen.dart +++ b/lib/ui/marathon/marathon_screen.dart @@ -29,9 +29,8 @@ class MarathonScreen extends StatelessWidget { child: Column( children: [ const MarathonHeader(), - 20.height, - MarathonProgressContainer(provider: provider) - .paddingOnly(left: 21, right: 21), + 20.height, + 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/marathon/widgets/question_card.dart b/lib/ui/marathon/widgets/question_card.dart index 08c9e3b..45fa6cc 100644 --- a/lib/ui/marathon/widgets/question_card.dart +++ b/lib/ui/marathon/widgets/question_card.dart @@ -135,9 +135,7 @@ class AnswerContent extends StatelessWidget { final DummyQuestionModel question; final MarathonProvider provider; - const AnswerContent( - {Key? key, required this.question, required this.provider}) - : super(key: key); + const AnswerContent({Key? key, required this.question, required this.provider}) : super(key: key); @override Widget build(BuildContext context) { @@ -170,20 +168,18 @@ class AnswerContent extends StatelessWidget { provider.startTimer(context); provider.swipeCardLeft(); }, - child: Flexible( - child: Container( - height: 60, - width: MediaQuery.of(context).size.width - 75, - alignment: Alignment.centerLeft, - decoration: MyDecorations.answerContainerDecoration, - child: Center( - child: Text( - question.opt1!, - style: const TextStyle( - color: MyColors.darkTextColor, - fontWeight: FontWeight.w600, - fontSize: 16, - ), + child: Container( + height: 60, + width: MediaQuery.of(context).size.width - 75, + alignment: Alignment.centerLeft, + decoration: MyDecorations.answerContainerDecoration, + child: Center( + child: Text( + question.opt1!, + style: const TextStyle( + color: MyColors.darkTextColor, + fontWeight: FontWeight.w600, + fontSize: 16, ), ), ), 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); }