Jelajahi Sumber

rapikan param history

Yulian 2 bulan lalu
induk
melakukan
d2f634452b

+ 28 - 5
lib/src/layouts/functions/history.dart

@@ -14,6 +14,26 @@ import 'package:telnow_mobile_new/src/utils/cache_manager.dart';
 import 'package:telnow_mobile_new/src/utils/provider.dart';
 import 'package:telnow_mobile_new/src/utils/ui_service.dart';
 
+enum HistoryTab {
+  ongoing,
+  done;
+
+  List get filters {
+    switch(this){
+      case HistoryTab.ongoing:
+        return [
+          {'title': 'stateQueue'.tr(), 'value': 'queue', 'filter': '{"or":[{"f":["currentState","EQ","DIANTRIKAN"]},{"f":["currentState","EQ","DIPROSES"]}]}'},
+          {'title': 'stateDone'.tr(), 'value': 'done', 'filter': '{"f":["currentState","EQ","DIMULAI"]}'},
+          {'title': 'hold'.tr(), 'value': 'hold', 'filter': '{"f":["currentState","EQ","HOLD"]}'}
+        ];
+      case HistoryTab.done:
+        return [
+          {'title': 'stateFinish'.tr(), 'value': 'finish', 'filter': '{"or":[{"f":["currentState","EQ","DISELESAIKAN"]},{"f":["currentState","EQ","TUNTAS"]}]}'},
+          {'title': 'stateCancel'.tr(), 'value': 'cancel', 'filter': '{"f":["currentState","EQ","DIBATALKAN"]}'}
+        ];
+    }
+  }
+}
 class HistoryFunction{
   final JwtToken token = JwtToken();
   final ApiAuthProvider apiAuthProvider = ApiAuthProvider();
@@ -79,26 +99,29 @@ class HistoryFunction{
   }
 
   getMission() async {
+    HistoryTab tab = historyModule.activeTab();
+    List filters = tab.filters;
+
     try {
       if (!historyModule.isLoadHistory() && !historyModule.stopLoadHistory()) {
         historyModule.setLoadHistory(true);
-        int indexFilterSelected = historyModule.pressAttention();
+        String selectedFilter = historyModule.selectedFilter();
         var sort = ['datetimeRequest,desc'];
         String filter;
 
         // If no selected filter button, use default filter;
-        if(indexFilterSelected == 0){
-          if(historyModule.selectedFilter() == 0){
+        if(selectedFilter == 'none'){
+          if(historyModule.activeTab().name == "done"){
             filter = '{"or":[{"f":["currentState","EQ","DISELESAIKAN"]},{"f":["currentState","EQ","TUNTAS"]},{"f":["currentState","EQ","DIBATALKAN"]}]}';
           } else {
             filter = '{"or":[{"f":["currentState","EQ","DIANTRIKAN"]},{"f":["currentState","EQ","DIPROSES"]},{"f":["currentState","EQ","DIMULAI"]}]}';
           }
         } else {
-          filter = filterList[indexFilterSelected-1]['filter'];
+          filter = filters.firstWhere((f) => f['value'] == selectedFilter)['filter'];
         }
 
         // If no internet connection and selected status is On going and filter button is Queued, display pending data.
-        if(historyModule.selectedFilter() == 0 && (indexFilterSelected == 0 || indexFilterSelected == 1) && U.newServerVersion(1709864293) && !U.getInternetStatus()){
+        if(historyModule.activeTab().name == "ongoing" && (selectedFilter == 'none' || selectedFilter == 'queue') && U.newServerVersion(1709864293) && !U.getInternetStatus()){
           List pendingList = sharedPreferencesManager.isKeyExists(SharedPreferencesManager.keyPendingData)!?jsonDecode(sharedPreferencesManager.getString(SharedPreferencesManager.keyPendingData)!):[];
           historyModule.setPendingData(pendingList);
         }

+ 70 - 59
lib/src/layouts/mobile/menu_history.dart

@@ -106,43 +106,10 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
             crossAxisAlignment: CrossAxisAlignment.start,
             children: [
               SizedBox(height: 16),
-              Row(
-                children: [
-                  GestureDetector(
-                    child: Container(
-                      margin: EdgeInsets.only(left: 16),
-                      padding: EdgeInsets.symmetric(vertical: 5, horizontal: 16),
-                      decoration: BoxDecoration(
-                          color: Colors.white,
-                          border: Border(bottom: BorderSide(color: historyModuleListen.selectedFilter() == 1 ? primaryColor : primaryColor.withValues(alpha: 0.3), width: historyModuleListen.selectedFilter() == 1 ? 2 : 1))),
-                      child: Text('ongoing'.tr(), style: TextStyle(color: historyModuleListen.selectedFilter() == 1 ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
-                    ),
-                    onTap: () {
-                      if (!historyModule.isLoadHistory()) {
-                        historyModule.setPressAttention(0);
-                        historyModule.setSelectedFilter(1);
-                        historyFunction.onRefresh();
-                      }
-                    },
-                  ),
-                  GestureDetector(
-                    child: Container(
-                      padding: EdgeInsets.symmetric(vertical: 5, horizontal: 16),
-                      decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: historyModuleListen.selectedFilter() == 0 ? primaryColor : primaryColor.withValues(alpha: 0.3), width: historyModuleListen.selectedFilter() == 0 ? 2 : 1))),
-                      child: Text('done'.tr(), style: TextStyle(color: historyModuleListen.selectedFilter() == 0 ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
-                    ),
-                    onTap: () {
-                      if (!historyModule.isLoadHistory()) {
-                        historyModule.setPressAttention(0);
-                        historyModule.setSelectedFilter(0);
-                        historyFunction.onRefresh();
-                      }
-                    },
-                  ),
-                ],
-              ),
+              buildTab(historyModuleListen),
               SizedBox(height: 20),
-              historyModuleListen.selectedFilter() == 0 ? doneFilter() : ongoingFilter(),
+              buildFilter(historyModuleListen),
+              // historyModuleListen.activeTab() == 0 ? doneFilter() : ongoingFilter(),
               SizedBox(height: 20),
             ],
           ),
@@ -155,8 +122,8 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
                 scrollOffset: 500,
                 child: EasyRefresh(
                   header: MaterialHeader(clamping: true, color: primaryColor),
-                  onRefresh: ()=>historyFunction.onRefresh(),
-                  child: historyModuleListen.selectedFilter() == 0 ? doneContainer() : ongoingContainer(),
+                  onRefresh: () => historyFunction.onRefresh(),
+                  child: historyModuleListen.activeTab().name == 'done' ? doneContainer() : ongoingContainer(),
                 ),
               ),
             ) : userModuleListen.resetData() ? Container() : loadingTemplate(() {
@@ -168,29 +135,72 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
     );
   }
 
-  Widget statusFilter(){
-    final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
+  //# kodingan baru start
+  Widget buildTab(historyModuleListen){
+    HistoryTab activeTab = historyModuleListen.activeTab();
+
+    return Row(
+      children: [
+        GestureDetector(
+          child: Container(
+            margin: EdgeInsets.only(left: 16),
+            padding: EdgeInsets.symmetric(vertical: 5, horizontal: 16),
+            decoration: BoxDecoration(
+                color: Colors.white,
+                border: Border(bottom: BorderSide(color: activeTab.name == "ongoing" ? primaryColor : primaryColor.withValues(alpha: 0.3), width: activeTab.name == "ongoing" ? 2 : 1))),
+            child: Text('ongoing'.tr(), style: TextStyle(color: activeTab.name == "ongoing" ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
+          ),
+          onTap: () {
+            if (!historyModule.isLoadHistory()) {
+              historyModule.setSelectedFilter('none');
+              historyModule.setActiveTab(HistoryTab.ongoing);
+              historyFunction.onRefresh();
+            }
+          },
+        ),
+        GestureDetector(
+          child: Container(
+            padding: EdgeInsets.symmetric(vertical: 5, horizontal: 16),
+            decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: activeTab.name == "done" ? primaryColor : primaryColor.withValues(alpha: 0.3), width: activeTab.name == "done" ? 2 : 1))),
+            child: Text('done'.tr(), style: TextStyle(color: activeTab.name == "done" ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
+          ),
+          onTap: () {
+            if (!historyModule.isLoadHistory()) {
+              historyModule.setSelectedFilter('none');
+              historyModule.setActiveTab(HistoryTab.done);
+              historyFunction.onRefresh();
+            }
+          },
+        ),
+      ],
+    );
+  }
+
+  Widget buildFilter(historyModuleListen){
+    HistoryTab tab = historyModuleListen.activeTab();
+    List currentFilters = tab.filters;
+
     return SingleChildScrollView(
       scrollDirection: Axis.horizontal,
       child: Row(
-        children: List.generate(historyFunction.filterList.length, (i) {
+        children: List.generate(currentFilters.length, (i) {
           return GestureDetector(
             child: Container(
               margin: EdgeInsets.only(left: 16),
               padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
               decoration: BoxDecoration(
-                  color: historyModuleListen.checkPressAttention(historyFunction.filterList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
-                  border: Border.all(color: historyModuleListen.checkPressAttention(historyFunction.filterList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
+                  color: historyModuleListen.checkSelectedFilter(currentFilters[i]['value']) ? primaryColor : Color(0xffF2F8F7),
+                  border: Border.all(color: historyModuleListen.checkSelectedFilter(currentFilters[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
                   borderRadius: BorderRadius.all(Radius.circular(50))),
-              child: Text(historyFunction.filterList[i]['title'], style: TextStyle(color: historyModuleListen.checkPressAttention(historyFunction.ongoingList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
+              child: Text(currentFilters[i]['title'], style: TextStyle(color: historyModuleListen.checkSelectedFilter(currentFilters[i]['value']) ? Colors.white : textColor, fontSize: 16)),
             ),
             onTap: () {
               if (!historyModule.isLoadHistory()) {
-                if (historyModule.checkPressAttention(historyFunction.filterList[i]['value'])) {
-                  historyModule.setPressAttention(0);
+                if (historyModule.checkSelectedFilter(currentFilters[i]['value'])) {
+                  historyModule.setSelectedFilter('none');
                   historyFunction.onRefresh();
                 } else {
-                  historyModule.setPressAttention(historyFunction.filterList[i]['value']);
+                  historyModule.setSelectedFilter(currentFilters[i]['value']);
                   historyFunction.onRefresh();
                 }
               }
@@ -200,6 +210,7 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
       ),
     );
   }
+  //# kodingan baru end
 
   Widget ongoingFilter() {
     final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
@@ -212,18 +223,18 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
               margin: EdgeInsets.only(left: 16),
               padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
               decoration: BoxDecoration(
-                  color: historyModuleListen.checkPressAttention(historyFunction.ongoingList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
-                  border: Border.all(color: historyModuleListen.checkPressAttention(historyFunction.ongoingList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
+                  color: historyModuleListen.checkSelectedFilter(historyFunction.ongoingList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
+                  border: Border.all(color: historyModuleListen.checkSelectedFilter(historyFunction.ongoingList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
                   borderRadius: BorderRadius.all(Radius.circular(50))),
-              child: Text(historyFunction.ongoingList[i]['title'], style: TextStyle(color: historyModuleListen.checkPressAttention(historyFunction.ongoingList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
+              child: Text(historyFunction.ongoingList[i]['title'], style: TextStyle(color: historyModuleListen.checkSelectedFilter(historyFunction.ongoingList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
             ),
             onTap: () {
               if (!historyModule.isLoadHistory()) {
-                if (historyModule.checkPressAttention(historyFunction.ongoingList[i]['value'])) {
-                  historyModule.setPressAttention(0);
+                if (historyModule.checkSelectedFilter(historyFunction.ongoingList[i]['value'])) {
+                  historyModule.setSelectedFilter('none');
                   historyFunction.onRefresh();
                 } else {
-                  historyModule.setPressAttention(historyFunction.ongoingList[i]['value']);
+                  historyModule.setSelectedFilter(historyFunction.ongoingList[i]['value']);
                   historyFunction.onRefresh();
                 }
               }
@@ -404,18 +415,18 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
             margin: EdgeInsets.only(left: 16),
             padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
             decoration: BoxDecoration(
-                color: historyModuleListen.checkPressAttention(historyFunction.doneList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
-                border: Border.all(color: historyModuleListen.checkPressAttention(historyFunction.doneList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
+                color: historyModuleListen.checkSelectedFilter(historyFunction.doneList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
+                border: Border.all(color: historyModuleListen.checkSelectedFilter(historyFunction.doneList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
                 borderRadius: BorderRadius.all(Radius.circular(50))),
-            child: Text(historyFunction.doneList[i]['title'], style: TextStyle(color: historyModuleListen.checkPressAttention(historyFunction.doneList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
+            child: Text(historyFunction.doneList[i]['title'], style: TextStyle(color: historyModuleListen.checkSelectedFilter(historyFunction.doneList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
           ),
           onTap: () {
             if (!historyModule.isLoadHistory()) {
-              if (historyModule.checkPressAttention(historyFunction.doneList[i]['value'])) {
-                historyModule.setPressAttention(0);
+              if (historyModule.checkSelectedFilter(historyFunction.doneList[i]['value'])) {
+                historyModule.setSelectedFilter(0);
                 historyFunction.onRefresh();
               } else {
-                historyModule.setPressAttention(historyFunction.doneList[i]['value']);
+                historyModule.setSelectedFilter(historyFunction.doneList[i]['value']);
                 historyFunction.onRefresh();
               }
             } else {

+ 21 - 21
lib/src/layouts/web/menu_history.dart

@@ -106,13 +106,13 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                     GestureDetector(
                       child: Container(
                         padding: EdgeInsets.symmetric(vertical: 5, horizontal: 16),
-                        decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: historyModuleListen.selectedFilter() == 1 ? primaryColor : primaryColor.withValues(alpha: 0.3), width: historyModuleListen.selectedFilter() == 1 ? 2 : 1))),
-                        child: Text('ongoing'.tr(), style: TextStyle(color: historyModuleListen.selectedFilter() == 1 ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
+                        decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: historyModuleListen.activeTab() == 1 ? primaryColor : primaryColor.withValues(alpha: 0.3), width: historyModuleListen.activeTab() == 1 ? 2 : 1))),
+                        child: Text('ongoing'.tr(), style: TextStyle(color: historyModuleListen.activeTab() == 1 ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
                       ),
                       onTap: () {
                         if (!historyModule.isLoadHistory()) {
-                          historyModule.setPressAttention(0);
-                          historyModule.setSelectedFilter(1);
+                          historyModule.setSelectedFilter(0);
+                          historyModule.setActiveTab(HistoryTab.ongoing);
                           hisFunc.onRefresh();
                         }
                       },
@@ -120,13 +120,13 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                     GestureDetector(
                       child: Container(
                         padding: EdgeInsets.symmetric(vertical: 5, horizontal: 16),
-                        decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: historyModuleListen.selectedFilter() == 0 ? primaryColor : primaryColor.withValues(alpha: 0.3), width: historyModuleListen.selectedFilter() == 0 ? 2 : 1))),
-                        child: Text('done'.tr(), style: TextStyle(color: historyModuleListen.selectedFilter() == 0 ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
+                        decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: historyModuleListen.activeTab() == 0 ? primaryColor : primaryColor.withValues(alpha: 0.3), width: historyModuleListen.activeTab() == 0 ? 2 : 1))),
+                        child: Text('done'.tr(), style: TextStyle(color: historyModuleListen.activeTab() == 0 ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
                       ),
                       onTap: () {
                         if (!historyModule.isLoadHistory()) {
-                          historyModule.setPressAttention(0);
                           historyModule.setSelectedFilter(0);
+                          historyModule.setActiveTab(HistoryTab.done);
                           hisFunc.onRefresh();
                         }
                       },
@@ -134,7 +134,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                   ],
                 ),
                 SizedBox(height: 20),
-                historyModuleListen.selectedFilter() == 0 ? doneFilter() : ongoingFilter(),
+                historyModuleListen.activeTab() == 0 ? doneFilter() : ongoingFilter(),
               ],
             ),
           ),
@@ -148,7 +148,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                 child: EasyRefresh(
                   header: MaterialHeader(clamping: true, color: primaryColor),
                   onRefresh: ()=>hisFunc.onRefresh(),
-                  child: historyModuleListen.selectedFilter() == 0 ? doneContainer() : ongoingContainer(),
+                  child: historyModuleListen.activeTab() == 0 ? doneContainer() : ongoingContainer(),
                 ),
               ),
             ) : userModuleListen.resetData() ? Container() : _timeLimit ? showButton(context) : loadingTemplate(() {if(mounted) setState(()=>_timeLimit=true);},),
@@ -169,18 +169,18 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
               margin: EdgeInsets.only(right: 16),
               padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
               decoration: BoxDecoration(
-                  color: historyModuleListen.checkPressAttention(hisFunc.ongoingList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
-                  border: Border.all(color: historyModuleListen.checkPressAttention(hisFunc.ongoingList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
+                  color: historyModuleListen.checkSelectedFilter(hisFunc.ongoingList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
+                  border: Border.all(color: historyModuleListen.checkSelectedFilter(hisFunc.ongoingList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
                   borderRadius: BorderRadius.all(Radius.circular(50))),
-              child: Text(hisFunc.ongoingList[i]['title'], style: TextStyle(color: historyModuleListen.checkPressAttention(hisFunc.ongoingList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
+              child: Text(hisFunc.ongoingList[i]['title'], style: TextStyle(color: historyModuleListen.checkSelectedFilter(hisFunc.ongoingList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
             ),
             onTap: () {
               if (!historyModule.isLoadHistory()) {
-                if (historyModule.checkPressAttention(hisFunc.ongoingList[i]['value'])) {
-                  historyModule.setPressAttention(0);
+                if (historyModule.checkSelectedFilter(hisFunc.ongoingList[i]['value'])) {
+                  historyModule.setSelectedFilter(0);
                   hisFunc.onRefresh();
                 } else {
-                  historyModule.setPressAttention(hisFunc.ongoingList[i]['value']);
+                  historyModule.setSelectedFilter(hisFunc.ongoingList[i]['value']);
                   hisFunc.onRefresh();
                 }
               }
@@ -380,18 +380,18 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
             margin: EdgeInsets.only(right: 16),
             padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
             decoration: BoxDecoration(
-                color: historyModuleListen.checkPressAttention(hisFunc.doneList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
-                border: Border.all(color: historyModuleListen.checkPressAttention(hisFunc.doneList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
+                color: historyModuleListen.checkSelectedFilter(hisFunc.doneList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
+                border: Border.all(color: historyModuleListen.checkSelectedFilter(hisFunc.doneList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
                 borderRadius: BorderRadius.all(Radius.circular(50))),
-            child: Text(hisFunc.doneList[i]['title'], style: TextStyle(color: historyModuleListen.checkPressAttention(hisFunc.doneList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
+            child: Text(hisFunc.doneList[i]['title'], style: TextStyle(color: historyModuleListen.checkSelectedFilter(hisFunc.doneList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
           ),
           onTap: () {
             if (!historyModule.isLoadHistory()) {
-              if (historyModule.checkPressAttention(hisFunc.doneList[i]['value'])) {
-                historyModule.setPressAttention(0);
+              if (historyModule.checkSelectedFilter(hisFunc.doneList[i]['value'])) {
+                historyModule.setSelectedFilter(0);
                 hisFunc.onRefresh();
               } else {
-                historyModule.setPressAttention(hisFunc.doneList[i]['value']);
+                historyModule.setSelectedFilter(hisFunc.doneList[i]['value']);
                 hisFunc.onRefresh();
               }
             }

+ 13 - 12
lib/src/utils/provider.dart

@@ -3,6 +3,7 @@ import 'dart:typed_data';
 
 import 'package:easy_localization/easy_localization.dart';
 import 'package:flutter/material.dart';
+import 'package:telnow_mobile_new/src/layouts/functions/history.dart';
 
 class UserModule with ChangeNotifier {
   static String _serialNumber = '';
@@ -310,13 +311,13 @@ class HistoryModule with ChangeNotifier {
 
   static List _data = [];
   static List _pendingData = [];
-  static int _pressAttention = 0;
-  static int _selectedFilter = 1;
+  static String _selectedFilter = 'none';
+  static HistoryTab _activeTab = HistoryTab.ongoing;
 
   List dataMisi() => _data;
   List dataPending() => _pendingData;
-  int pressAttention() => _pressAttention;
-  int selectedFilter() => _selectedFilter;
+  String selectedFilter() => _selectedFilter;
+  HistoryTab activeTab() => _activeTab;
   int page() => _page;
   bool isLoadHistory() => _isLoadHistory;
   bool stopLoadHistory() => _stopLoadHistory;
@@ -340,13 +341,13 @@ class HistoryModule with ChangeNotifier {
     notifyListeners();
   }
 
-  void setPressAttention(value) {
-    _pressAttention = value;
+  void setSelectedFilter(value) {
+    _selectedFilter = value;
     notifyListeners();
   }
 
-  void setSelectedFilter(value) {
-    _selectedFilter = value;
+  void setActiveTab(HistoryTab value) {
+    _activeTab = value;
     notifyListeners();
   }
 
@@ -400,8 +401,8 @@ class HistoryModule with ChangeNotifier {
     notifyListeners();
   }
 
-  bool checkPressAttention(value){
-    return _pressAttention == value;
+  bool checkSelectedFilter(value){
+    return _selectedFilter == value;
   }
 
   int getMisiLength(){
@@ -431,8 +432,8 @@ class HistoryModule with ChangeNotifier {
     _setLoading = false;
     _data = [];
     _pendingData = [];
-    _pressAttention = 0;
-    _selectedFilter = 1;
+    _selectedFilter = 'none';
+    _activeTab = HistoryTab.ongoing;
     _selectedIndexes = [];
     _activeForum = [];
   }