Browse Source

beresin context di history

Yulian 2 months ago
parent
commit
ee83788aac

+ 1 - 1
android/app/build.gradle.kts

@@ -109,7 +109,7 @@ android {
         applicationId = "com.datacomsolusindo.telnow2.telnow_mobile2"
         // You can update the following values to match your application needs.
         // For more information, see: https://flutter.dev/to/review-gradle-config.
-        minSdk = 23//flutter.minSdkVersion
+        minSdk = flutter.minSdkVersion//flutter.minSdkVersion
         targetSdk = flutter.targetSdkVersion
         versionCode = flutter.versionCode
         versionName = flutter.versionName

+ 2 - 1
android/settings.gradle.kts

@@ -51,7 +51,8 @@ plugins {
     // START: FlutterFire Configuration
     id("com.google.gms.google-services") version("4.3.15") apply false
     // END: FlutterFire Configuration
-    id("org.jetbrains.kotlin.android") version "1.8.22" apply false
+    id("org.jetbrains.kotlin.android") version "2.1.0" apply false
+//    id("org.jetbrains.kotlin.android") version "1.8.22" apply false
 }
 
 include(":app")

+ 110 - 100
lib/src/layouts/functions/history.dart

@@ -6,172 +6,177 @@ import 'package:provider/provider.dart';
 import 'package:telnow_mobile_new/src/api/api_auth_provider.dart';
 import 'package:telnow_mobile_new/src/api/jwt_token.dart';
 import 'package:telnow_mobile_new/src/injector/injector.dart';
-import 'package:telnow_mobile_new/src/layouts/components/template.dart';
 import 'package:telnow_mobile_new/src/layouts/mobile/request_create.dart';
 import 'package:telnow_mobile_new/src/layouts/web/request_create.dart';
 import 'package:telnow_mobile_new/src/storage/sharedpreferences/shared_preferences_manager.dart';
 import 'package:telnow_mobile_new/src/utils/U.dart';
 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';
 
 class HistoryFunction{
   final JwtToken token = JwtToken();
   final ApiAuthProvider apiAuthProvider = ApiAuthProvider();
   final SharedPreferencesManager sharedPreferencesManager = locator<SharedPreferencesManager>();
 
+  final BuildContext context = UIService.context!;
+  late final HistoryModule historyModule = Provider.of<HistoryModule>(context, listen: false);
+  late final UserModule userModule = Provider.of<UserModule>(context, listen: false);
+
+  List filterList = [
+    {'title': 'stateQueue'.tr(), 'value': 1, 'filter': '{"or":[{"f":["currentState","EQ","DIANTRIKAN"]},{"f":["currentState","EQ","DIPROSES"]}]}'},
+    {'title': 'stateDone'.tr(), 'value': 2, 'filter': '{"f":["currentState","EQ","DIMULAI"]}'},
+    {'title': 'hold'.tr(), 'value': 3, 'filter': '{"f":["currentState","EQ","HOLD"]}'},
+    {'title': 'stateFinish'.tr(), 'value': 4, 'filter': '{"or":[{"f":["currentState","EQ","DISELESAIKAN"]},{"f":["currentState","EQ","TUNTAS"]}]}'},
+    {'title': 'stateCancel'.tr(), 'value': 5, 'filter': '{"f":["currentState","EQ","DIBATALKAN"]}'}
+  ];
+
   List doneList = [
-    {'title': 'stateFinish'.tr(), 'value': 3, 'filter': '{"or":[{"f":["currentState","EQ","DISELESAIKAN"]},{"f":["currentState","EQ","TUNTAS"]}]}'},
-    {'title': 'stateCancel'.tr(), 'value': 4, 'filter': '{"f":["currentState","EQ","DIBATALKAN"]}'},
+    {'title': 'stateFinish'.tr(), 'value': 4, 'filter': '{"or":[{"f":["currentState","EQ","DISELESAIKAN"]},{"f":["currentState","EQ","TUNTAS"]}]}'},
+    {'title': 'stateCancel'.tr(), 'value': 5, 'filter': '{"f":["currentState","EQ","DIBATALKAN"]}'},
   ];
+
   List ongoingList = [
     {'title': 'stateQueue'.tr(), 'value': 1, 'filter': '{"or":[{"f":["currentState","EQ","DIANTRIKAN"]},{"f":["currentState","EQ","DIPROSES"]}]}'},
     {'title': 'stateDone'.tr(), 'value': 2, 'filter': '{"f":["currentState","EQ","DIMULAI"]}'},
     {'title': 'hold'.tr(), 'value': 3, 'filter': '{"f":["currentState","EQ","HOLD"]}'},
   ];
 
-  getActiveForum(BuildContext context, {bool loadAfterAction = false}) async {
+  getActiveForum({bool loadAfterAction = false}) async {
     try {
       String urlForum = '/api/notifications/search/forumNotification';
 
       var val = await CacheMan.readData(urlForum);
       if (val != null) {
-        Provider.of<HistoryModule>(context, listen: false).setActiveForum(val['data']);
+        historyModule.setActiveForum(val['data']);
       }
 
       var data = await apiAuthProvider.getData(urlForum, null);
       if (data != null) {
-        Provider.of<HistoryModule>(context, listen: false).setActiveForum(data);
+        historyModule.setActiveForum(data);
         CacheMan.writeData(urlForum, data);
-        getUser(context);
-      }
-      else{
-        getUser(context);
       }
+      // kayaknya ga guna getUser disini. 031125
+      // getUser();
     } catch (e) {
-      print(e.toString());
+      debugPrint(e.toString());
     }
   }
 
-  getUser(BuildContext context) async {
+  getUser() async {
     try {
       var res = await token.getUserData();
       if (res != null) {
-        Provider.of<UserModule>(context, listen: false).setList(res);
-        getMission(context);
+        userModule.setList(res);
+        // dipindah di event onRefresh, paralel sama get notifForum. 031125
+        // getMission();
       } else {
-        Provider.of<UserModule>(context, listen: false).setResetData(true);
+        userModule.setResetData(true);
       }
     } catch (e) {
-      Provider.of<UserModule>(context, listen: false).setResetData(true);
+      userModule.setResetData(true);
     }
   }
 
-  getMission(BuildContext context) async {
+  getMission() async {
     try {
-      if (!Provider.of<HistoryModule>(context, listen: false).isLoadHistory() && !Provider.of<HistoryModule>(context, listen: false).stopLoadHistory()) {
-        Provider.of<HistoryModule>(context, listen: false).setLoadHistory(true);
+      if (!historyModule.isLoadHistory() && !historyModule.stopLoadHistory()) {
+        historyModule.setLoadHistory(true);
+        int indexFilterSelected = historyModule.pressAttention();
         var sort = ['datetimeRequest,desc'];
-        var filter = '';
+        String filter;
 
-        if (Provider.of<HistoryModule>(context, listen: false).selectedFilter() == 0) {
-          if (Provider.of<HistoryModule>(context, listen: false).pressAttention() != 0) {
-            for (int i = 0; i < doneList.length; i++) {
-              if (Provider.of<HistoryModule>(context, listen: false).checkPressAttention(doneList[i]['value'])) {
-                filter = doneList[i]['filter'];
-              }
-            }
-          } else {
+        // If no selected filter button, use default filter;
+        if(indexFilterSelected == 0){
+          if(historyModule.selectedFilter() == 0){
             filter = '{"or":[{"f":["currentState","EQ","DISELESAIKAN"]},{"f":["currentState","EQ","TUNTAS"]},{"f":["currentState","EQ","DIBATALKAN"]}]}';
-          }
-        } else {
-          if((Provider.of<HistoryModule>(context, listen: false).pressAttention() == 0 || Provider.of<HistoryModule>(context, listen: false).pressAttention() == 1) && U.newServerVersion(1709864293) && !U.getInternetStatus()){
-            List pendingList = sharedPreferencesManager.isKeyExists(SharedPreferencesManager.keyPendingData)!?jsonDecode(sharedPreferencesManager.getString(SharedPreferencesManager.keyPendingData)!):[];
-            Provider.of<HistoryModule>(context, listen: false).setPendingData(pendingList);
-          }
-
-          if (Provider.of<HistoryModule>(context, listen: false).pressAttention() != 0) {
-            for (int i = 0; i < ongoingList.length; i++) {
-              if (Provider.of<HistoryModule>(context, listen: false).checkPressAttention(ongoingList[i]['value'])) {
-                filter = ongoingList[i]['filter'];
-              }
-            }
           } else {
             filter = '{"or":[{"f":["currentState","EQ","DIANTRIKAN"]},{"f":["currentState","EQ","DIPROSES"]},{"f":["currentState","EQ","DIMULAI"]}]}';
           }
+        } else {
+          filter = filterList[indexFilterSelected-1]['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()){
+          List pendingList = sharedPreferencesManager.isKeyExists(SharedPreferencesManager.keyPendingData)!?jsonDecode(sharedPreferencesManager.getString(SharedPreferencesManager.keyPendingData)!):[];
+          historyModule.setPendingData(pendingList);
         }
 
         String url = '/api/requestHistories/search/myReqHistory';
 
         String key = url + filter;
         var val = await CacheMan.readData(key);
-        if (val != null && Provider.of<HistoryModule>(context, listen: false).page() == 0) {
-          Provider.of<HistoryModule>(context, listen: false).setMisi(val['data']);
+        if (val != null && historyModule.page() == 0) {
+          historyModule.setMisi(val['data']);
         }
 
-        var misi = await apiAuthProvider.getData(url, {'size': '30', 'page': Provider.of<HistoryModule>(context, listen: false).page().toString(), 'sort': sort, 'filter': filter});
-        if (misi != null) {
+        var mission = await apiAuthProvider.getData(url, {'size': '30', 'page': historyModule.page().toString(), 'sort': sort, 'filter': filter});
+        if (mission != null){
+          // debugPrint("Cek tekan kene!!");
+          historyModule.setLoadHistory(false);
           List tempData = [];
-          if (misi.containsKey('_embedded')) {
-            for (int i = 0; i < misi['_embedded']['requestHistories'].length; i++) {
-              var _isFrm = false;
-              var _id = null;
-              var _msg = null;
+          if (mission.containsKey('_embedded')) {
+            // debugPrint('Balikan data: ${mission['_embedded']['requestHistories'].length}');
+            for (int i = 0; i < mission['_embedded']['requestHistories'].length; i++) {
+              var isFrm = false;
+              String id = "";
+              String msg = "";
 
-              Provider.of<HistoryModule>(context, listen: false).activeForum().forEach((el) {
-                if (el['ticketId'] == misi['_embedded']['requestHistories'][i]['ticketNo']) {
-                  _id = el['id'];
-                  _msg = el['desc'];
+              historyModule.activeForum().forEach((el) {
+                if (el['ticketId'] == mission['_embedded']['requestHistories'][i]['ticketNo']) {
+                  id = el['id'];
+                  msg = el['desc'];
                 }
               });
 
-              if (_id != null) _isFrm = true;
-              misi['_embedded']['requestHistories'][i]['_hasForum'] = _isFrm;
-              misi['_embedded']['requestHistories'][i]['_forumId'] = _id;
-              misi['_embedded']['requestHistories'][i]['_forumMsg'] = _msg;
+              if (id != "") isFrm = true;
+              mission['_embedded']['requestHistories'][i]['_hasForum'] = isFrm;
+              mission['_embedded']['requestHistories'][i]['_forumId'] = id;
+              mission['_embedded']['requestHistories'][i]['_forumMsg'] = msg;
 
-              tempData.add(misi['_embedded']['requestHistories'][i]);
+              tempData.add(mission['_embedded']['requestHistories'][i]);
             }
           }
 
-          Provider.of<HistoryModule>(context, listen: false).setLoadHistory(false);
-          if (tempData.length == 0) {
-            Provider.of<HistoryModule>(context, listen: false).setStopLoadHistory(true);
-            Provider.of<HistoryModule>(context, listen: false).clearMisi();
+          // debugPrint('Filter Index: ${indexFilterSelected} & Filter: $filter');
+          // historyModule.setLoadHistory(false);
+          if (tempData.isEmpty) {
+            historyModule.setStopLoadHistory(true);
+            historyModule.clearMisi();
             CacheMan.writeData(key, tempData);
           } else {
-            if (Provider.of<HistoryModule>(context, listen: false).page() == 0) {
+            if (historyModule.page() == 0) {
               CacheMan.writeData(key, tempData);
-              Provider.of<HistoryModule>(context, listen: false).clearMisi();
+              historyModule.clearMisi();
             }
-            Provider.of<HistoryModule>(context, listen: false).addPage();
+            historyModule.addPage();
           }
-          // print("tempData");
-          // print(tempData);
-          Provider.of<HistoryModule>(context, listen: false).setMisi(tempData);
+          historyModule.setMisi(tempData);
 
-          if (Provider.of<HistoryModule>(context, listen: false).getMisiLength() >= misi['page']['totalElements']) {
-            Provider.of<HistoryModule>(context, listen: false).setStopLoadHistory(true);
+          if (historyModule.getMisiLength() >= mission['page']['totalElements']) {
+            historyModule.setStopLoadHistory(true);
           }
-        }
-        else{
-          Provider.of<HistoryModule>(context, listen: false).setLoadHistory(false);
-          Provider.of<HistoryModule>(context, listen: false).setStopLoadHistory(true);
+        } else {
+          historyModule.setLoadHistory(false);
+          historyModule.setStopLoadHistory(true);
         }
       }
     } catch (e) {
-      print(e.toString());
+      debugPrint(e.toString());
     }
   }
 
-  onRefresh(BuildContext context) async {
-    Provider.of<HistoryModule>(context, listen: false).clearMisi();
-    Provider.of<HistoryModule>(context, listen: false).setPendingData([]);
-    Provider.of<HistoryModule>(context, listen: false).setActiveForum([]);
-    Provider.of<HistoryModule>(context, listen: false).setSelectedIndexes([]);
-    Provider.of<HistoryModule>(context, listen: false).setMultiSelectMode(false);
-    Provider.of<HistoryModule>(context, listen: false).setStopLoadHistory(false);
-    Provider.of<HistoryModule>(context, listen: false).setPage(0);
-    getActiveForum(context);
+  onRefresh() async {
+    historyModule.clearMisi();
+    historyModule.setPendingData([]);
+    historyModule.setActiveForum([]);
+    historyModule.setSelectedIndexes([]);
+    historyModule.setMultiSelectMode(false);
+    historyModule.setStopLoadHistory(false);
+    historyModule.setPage(0);
+    getMission();
+    getActiveForum();
   }
 
   bool askForRate(list) {
@@ -189,12 +194,12 @@ class HistoryFunction{
   }
 
   selectedController(BuildContext context, i) {
-    if (Provider.of<HistoryModule>(context, listen: false).selectedIndexes().contains(i)) {
-      Provider.of<HistoryModule>(context, listen: false).removeSelectedIndexes(i);
+    if (historyModule.selectedIndexes().contains(i)) {
+      historyModule.removeSelectedIndexes(i);
     } else {
-      Provider.of<HistoryModule>(context, listen: false).addSelectedIndexes(i);
+      historyModule.addSelectedIndexes(i);
     }
-    Provider.of<HistoryModule>(context, listen: false).setMultiSelectMode(Provider.of<HistoryModule>(context, listen: false).selectedIndexes().length == 0 ? false : true);
+    historyModule.setMultiSelectMode(historyModule.selectedIndexes().isEmpty ? false : true);
   }
 
   deleteData(BuildContext context) {
@@ -216,12 +221,12 @@ class HistoryFunction{
                 onPressed: () async {
                   Navigator.of(contextt).pop();
                   List<String> params = [];
-                  Provider.of<HistoryModule>(context, listen: false).selectedIndexes().forEach((e) {
-                    params.add(Provider.of<HistoryModule>(context, listen: false).dataMisi()[e]["ticketNo"]);
+                  historyModule.selectedIndexes().forEach((e) {
+                    params.add(historyModule.dataMisi()[e]["ticketNo"]);
                   });
                   var res = await apiAuthProvider.postData("/api/requestHistories/deleteMyHistory", {"ticketNumbers": params}, null);
                   if (res != null) {
-                    onRefresh(context);
+                    onRefresh();
                   }
                 },
                 child: Text("buttonYes".tr())),
@@ -231,27 +236,32 @@ class HistoryFunction{
     );
   }
 
-  requestAgainAction(BuildContext context, int i) async{
+  requestAgainAction(int i) async{
+    final isWebView = U.webView(context);
     try {
       String tenant = '';
       String filter = '';
 
-      if ((Provider.of<HistoryModule>(context, listen: false).dataMisi()[i]['requestGroupCode']).split(" ").length != 1) {
-        tenant = ',{"f":["tenantCode","EQ","${(Provider.of<HistoryModule>(context, listen: false).dataMisi()[i]['requestGroupCode']).split(" ").first}"]}';
+      if ((historyModule.dataMisi()[i]['requestGroupCode']).split(" ").length != 1) {
+        tenant = ',{"f":["tenantCode","EQ","${(historyModule.dataMisi()[i]['requestGroupCode']).split(" ").first}"]}';
       }
-      filter = '{"and":[{"f":["code","EQ","${Provider.of<HistoryModule>(context, listen: false).dataMisi()[i]['requestCode']}"]}$tenant]}';
+      filter = '{"and":[{"f":["code","EQ","${historyModule.dataMisi()[i]['requestCode']}"]}$tenant]}';
 
       var res = await apiAuthProvider.getData('/api/requests/search/customFind', {'filter': filter});
       if (res != null) {
         if (res.containsKey('_embedded')) {
-          navigateTo(context, U.webView(context)?WebReqCreatePage(user: Provider.of<UserModule>(context, listen: false).user(), request: res['_embedded']['requests'][0]):MobReqCreatePage(user: Provider.of<UserModule>(context, listen: false).user(), request: res['_embedded']['requests'][0]));
+          UIService.navigateTo(
+            isWebView ?
+              WebReqCreatePage(user: userModule.user(), request: res['_embedded']['requests'][0]) :
+              MobReqCreatePage(user: userModule.user(), request: res['_embedded']['requests'][0])
+          );
         } else {
-          showError(context, 'reqCodeNotFound'.tr());
+          UIService.showError('reqCodeNotFound'.tr());
         }
       }
     } catch (e) {
-      showError(context, e.toString());
-      print(e);
+      UIService.showError(e.toString());
+      debugPrint(e.toString());
     }
   }
 }

+ 72 - 68
lib/src/layouts/functions/home.dart

@@ -16,32 +16,36 @@ class HomeFunction{
   final ApiAuthProvider apiAuthProvider = ApiAuthProvider();
   final JwtToken token = JwtToken();
   final BuildContext context = UIService.context!;
+  late final ServiceModule serviceModule = Provider.of<ServiceModule>(context, listen: false);
+  late final UserModule userModule = Provider.of<UserModule>(context, listen: false);
 
   getProfileData(BuildContext context)async{
-    if (!Provider.of<ServiceModule>(context, listen: false).initialized()) {
-      Provider.of<ServiceModule>(context, listen: false).setInitialized(true);
+    if (!serviceModule.initialized()) {
+      serviceModule.setInitialized(true);
 
       try{
         var license = await U.getLicense(showErr: false);
-        Provider.of<UserModule>(context, listen: false).setHouseKeeping(license['houseKeepingFunction']);
-      }catch(e){}
+        userModule.setHouseKeeping(license['houseKeepingFunction']);
+      }catch(e){
+        debugPrint(e.toString());
+      }
 
       try{
         var res = await token.getUserData();
         if(res != null){
-          Provider.of<UserModule>(context, listen: false).setList(res);
-          Provider.of<UserModule>(context, listen: false).setProfile(res['_profile']['data']);
-          Provider.of<UserModule>(context, listen: false).setDndStatus(res['dnd']);
+          userModule.setList(res);
+          userModule.setProfile(res['_profile']['data']);
+          userModule.setDndStatus(res['dnd']);
 
           getOptions(context);
         } else {
-          Provider.of<ServiceModule>(context, listen: false).setInitialized(false);
-          Provider.of<UserModule>(context, listen: false).setResetData(true);
+          serviceModule.setInitialized(false);
+          userModule.setResetData(true);
         }
       }catch(e){
         showError(context, e.toString());
-        Provider.of<ServiceModule>(context, listen: false).setInitialized(false);
-        Provider.of<UserModule>(context, listen: false).setResetData(true);
+        serviceModule.setInitialized(false);
+        userModule.setResetData(true);
       }
     }
   }
@@ -52,25 +56,25 @@ class HomeFunction{
 
       var val = await CacheMan.readData(url);
       if (val != null) {
-        Provider.of<ServiceModule>(context, listen: false).setScoope(val['data']);
+        serviceModule.setScoope(val['data']);
       }
 
       var res = await apiAuthProvider.getData(url, null);
       if (res != null) {
         CacheMan.writeData(url, res);
-        Provider.of<ServiceModule>(context, listen: false).setScoope(res);
+        serviceModule.setScoope(res);
       }
 
-      if(Provider.of<ServiceModule>(context, listen: false).scoope().isNotEmpty){
+      if(serviceModule.scoope().isNotEmpty){
         //dev-note: cek 1-1, mekanisme load nya. ada yg bikin berat tidak?
-        for (int i = 0; i < Provider.of<ServiceModule>(context, listen: false).scoope().length; i++) {
-          if (sharedPreferencesManager.isKeyExists(SharedPreferencesManager.keyScoope)! && sharedPreferencesManager.getString(SharedPreferencesManager.keyScoope) == Provider.of<ServiceModule>(context, listen: false).scoope()[i]['key']) {
-            Provider.of<ServiceModule>(context, listen: false).setScoopeValue(Provider.of<ServiceModule>(context, listen: false).scoope()[i]['key']);
-            Provider.of<ServiceModule>(context, listen: false).setScoopeName(Provider.of<ServiceModule>(context, listen: false).scoope()[i]['value']);
+        for (int i = 0; i < serviceModule.scoope().length; i++) {
+          if (sharedPreferencesManager.isKeyExists(SharedPreferencesManager.keyScoope)! && sharedPreferencesManager.getString(SharedPreferencesManager.keyScoope) == serviceModule.scoope()[i]['key']) {
+            serviceModule.setScoopeValue(serviceModule.scoope()[i]['key']);
+            serviceModule.setScoopeName(serviceModule.scoope()[i]['value']);
           }
         }
 
-        var profile = Provider.of<UserModule>(context, listen: false).profile();
+        var profile = userModule.profile();
         if(profile['topMenu']['show'] != null && profile['topMenu']['show'] == true) {
           if(U.newServerVersion(1709864293)){
             getTopMenuNew(context);
@@ -86,67 +90,67 @@ class HomeFunction{
         if(profile['quickAction'] != null && profile['quickAction']['show'] == true) getQuickAction(context);
         getUnreadMessages(context);
       }
-      Provider.of<ServiceModule>(context, listen: false).setInitialized(false);
+      serviceModule.setInitialized(false);
     } catch (e) {
-      Provider.of<ServiceModule>(context, listen: false).setInitialized(false);
+      serviceModule.setInitialized(false);
       print(e.toString());
     }
   }
 
   getSpecialOffer(BuildContext context) async {
     try {
-      String url = '/api/informants/search/request/specialOffer/'+Provider.of<ServiceModule>(context, listen: false).scoopeValue();
+      String url = '/api/informants/search/request/specialOffer/'+serviceModule.scoopeValue();
 
       var val = await CacheMan.readData(url);
       if (val != null) {
-        Provider.of<ServiceModule>(context, listen: false).setSpecialOffer(val['data']);
+        serviceModule.setSpecialOffer(val['data']);
       }
 
       var res = await apiAuthProvider.getData(url, null);
       if (res != null) {
         if (res.length > 0) {
           CacheMan.writeData(url, res);
-          Provider.of<ServiceModule>(context, listen: false).setSpecialOffer(res);
+          serviceModule.setSpecialOffer(res);
         } else {
-          Provider.of<ServiceModule>(context, listen: false).setSpecialOffer([]);
+          serviceModule.setSpecialOffer([]);
         }
       }
     } catch (e) {
       print(e.toString());
-      Provider.of<ServiceModule>(context, listen: false).setSpecialOffer([]);
+      serviceModule.setSpecialOffer([]);
     }
   }
 
   getTopMenuNew(BuildContext context) async {
     try {
-      var url = '/api/requestGroups/search/dashboard/topMenu/'+Provider.of<ServiceModule>(context, listen: false).scoopeValue();
+      var url = '/api/requestGroups/search/dashboard/topMenu/'+serviceModule.scoopeValue();
 
       var val = await CacheMan.readData('$url?responseServantGroup=${U.servantDisplay()}');
       if (val != null) {
-        Provider.of<ServiceModule>(context, listen: false).setTopMenu(val['data']['topMenu']);
-        Provider.of<ServiceModule>(context, listen: false).setReqGroup(val['data']['excludeTopMenu']);
+        serviceModule.setTopMenu(val['data']['topMenu']);
+        serviceModule.setReqGroup(val['data']['excludeTopMenu']);
       }
 
       var res = await apiAuthProvider.getData(url, {'responseServantGroup': U.servantDisplay().toString()});
       if (res != null) {
         CacheMan.writeData('$url?responseServantGroup=${U.servantDisplay()}', res);
-        Provider.of<ServiceModule>(context, listen: false).setTopMenu(res['topMenu']);
-        Provider.of<ServiceModule>(context, listen: false).setReqGroup(res['excludeTopMenu']);
+        serviceModule.setTopMenu(res['topMenu']);
+        serviceModule.setReqGroup(res['excludeTopMenu']);
       }
     } catch (e) {
       print(e.toString());
-      Provider.of<ServiceModule>(context, listen: false).setTopMenu([]);
-      Provider.of<ServiceModule>(context, listen: false).setReqGroup([]);
+      serviceModule.setTopMenu([]);
+      serviceModule.setReqGroup([]);
     }
   }
 
   getTopMenu(BuildContext context) async {
     try {
-      var url = '/api/requestGroups/search/topMenu/'+Provider.of<ServiceModule>(context, listen: false).scoopeValue();
+      var url = '/api/requestGroups/search/topMenu/'+serviceModule.scoopeValue();
 
       var val = await CacheMan.readData('$url?responseServantGroup=${U.servantDisplay()}');
       if (val != null) {
-        Provider.of<ServiceModule>(context, listen: false).setTopMenu(val['data']);
+        serviceModule.setTopMenu(val['data']);
       }
 
       var res = await apiAuthProvider.getData(url, {'responseServantGroup': U.servantDisplay().toString()});
@@ -156,28 +160,28 @@ class HomeFunction{
 
         if (tempData.length > 0) {
           CacheMan.writeData('$url?responseServantGroup=${U.servantDisplay()}', res);
-          Provider.of<ServiceModule>(context, listen: false).setTopMenu(tempData);
+          serviceModule.setTopMenu(tempData);
         } else {
           CacheMan.writeData('$url?responseServantGroup=${U.servantDisplay()}', []);
-          Provider.of<ServiceModule>(context, listen: false).setTopMenu([]);
+          serviceModule.setTopMenu([]);
         }
       }
       else{
-        Provider.of<ServiceModule>(context, listen: false).setTopMenu([]);
+        serviceModule.setTopMenu([]);
       }
     } catch (e) {
       print(e.toString());
-      Provider.of<ServiceModule>(context, listen: false).setTopMenu([]);
+      serviceModule.setTopMenu([]);
     }
   }
 
   getReqGroup(BuildContext context) async {
     try {
-      var url = '/api/requestGroups/search/excludeTopMenu/'+Provider.of<ServiceModule>(context, listen: false).scoopeValue();
+      var url = '/api/requestGroups/search/excludeTopMenu/'+serviceModule.scoopeValue();
 
       var val = await CacheMan.readData('$url?responseServantGroup=${U.servantDisplay()}');
       if (val != null) {
-        Provider.of<ServiceModule>(context, listen: false).setReqGroup(val['data']);
+        serviceModule.setReqGroup(val['data']);
       }
 
       var res = await apiAuthProvider.getData(url, {'responseServantGroup': U.servantDisplay().toString()});
@@ -187,39 +191,39 @@ class HomeFunction{
 
         if (tempData.length > 0) {
           CacheMan.writeData('$url?responseServantGroup=${U.servantDisplay()}', res);
-          Provider.of<ServiceModule>(context, listen: false).setReqGroup(tempData);
+          serviceModule.setReqGroup(tempData);
         } else {
           CacheMan.writeData('$url?responseServantGroup=${U.servantDisplay()}', []);
-          Provider.of<ServiceModule>(context, listen: false).setReqGroup([]);
+          serviceModule.setReqGroup([]);
         }
       }
     } catch (e) {
       print(e.toString());
-      Provider.of<ServiceModule>(context, listen: false).setReqGroup([]);
+      serviceModule.setReqGroup([]);
     }
   }
 
   getFrequentlyRequested() async {
     try {
-      var url = '/api/requestHistories/search/frequently/request/' + Provider.of<ServiceModule>(context, listen: false).scoopeValue();
+      var url = '/api/requestHistories/search/frequently/request/' + serviceModule.scoopeValue();
 
       var val = await CacheMan.readData(url);
       if (val != null) {
-        Provider.of<ServiceModule>(context, listen: false).setData(val['data']);
+        serviceModule.setData(val['data']);
       }
 
       var res = await apiAuthProvider.getData(url, null);
       if (res != null) {
         if (res.length > 0) {
           CacheMan.writeData(url, res);
-          Provider.of<ServiceModule>(context, listen: false).setData(res);
+          serviceModule.setData(res);
         } else {
-          Provider.of<ServiceModule>(context, listen: false).setData([]);
+          serviceModule.setData([]);
         }
       }
     } catch (e) {
       debugPrint(e.toString());
-      Provider.of<ServiceModule>(context, listen: false).setData([]);
+      serviceModule.setData([]);
     }
   }
 
@@ -229,45 +233,45 @@ class HomeFunction{
 
       var val = await CacheMan.readData(url);
       if (val != null) {
-        Provider.of<ServiceModule>(context, listen: false).setBanner(val['data']);
+        serviceModule.setBanner(val['data']);
       }
 
       var res = await apiAuthProvider.getData(url, {'size': '20'});
       if (res != null) {
         if (res.length > 0) {
           CacheMan.writeData(url, res);
-          Provider.of<ServiceModule>(context, listen: false).setBanner(res);
+          serviceModule.setBanner(res);
         } else {
-          Provider.of<ServiceModule>(context, listen: false).setBanner([]);
+          serviceModule.setBanner([]);
         }
       }
     } catch (e) {
       print(e.toString());
-      Provider.of<ServiceModule>(context, listen: false).setBanner([]);
+      serviceModule.setBanner([]);
     }
   }
 
   getQuickAction(BuildContext context) async {
     try {
-      String url = '/api/informants/search/request/quickAction/'+Provider.of<ServiceModule>(context, listen: false).scoopeValue();
+      String url = '/api/informants/search/request/quickAction/'+serviceModule.scoopeValue();
 
       var val = await CacheMan.readData(url);
       if (val != null) {
-        Provider.of<ServiceModule>(context, listen: false).setQuickAct(val['data']);
+        serviceModule.setQuickAct(val['data']);
       }
 
       var res = await apiAuthProvider.getData(url, null);
       if (res != null) {
         if (res.length > 0) {
           CacheMan.writeData(url, res);
-          Provider.of<ServiceModule>(context, listen: false).setQuickAct(res);
+          serviceModule.setQuickAct(res);
         } else {
-          Provider.of<ServiceModule>(context, listen: false).setQuickAct([]);
+          serviceModule.setQuickAct([]);
         }
       }
     } catch (e) {
       print(e.toString());
-      Provider.of<ServiceModule>(context, listen: false).setQuickAct([]);
+      serviceModule.setQuickAct([]);
     }
   }
 
@@ -276,10 +280,10 @@ class HomeFunction{
       var url = "/api/contactCenter/whatsapp" ;
       var res = await apiAuthProvider.getData(url, null);
       if (res != null) {
-        Provider.of<ServiceModule>(context, listen: false).setContactCenter(res);
+        serviceModule.setContactCenter(res);
       }
     }catch(e){
-      Provider.of<ServiceModule>(context, listen: false).setContactCenter('');
+      serviceModule.setContactCenter('');
     }
   }
 
@@ -288,19 +292,19 @@ class HomeFunction{
       var res = await apiAuthProvider.getData('/api/messages/search/myMessages', null);
       if (res != null) {
         List tempData = [];
-        Provider.of<ServiceModule>(context, listen: false).setUnreadMessage(false);
+        serviceModule.setUnreadMessage(false);
         if(res.containsKey('_embedded')){
           for (int i = 0; i < res['_embedded']['myMessages'].length; i++) {
-            if(res['_embedded']['myMessages'][i]['lastReadStatus'] == 'UNREAD' && res['_embedded']['myMessages'][i]['userId'] != Provider.of<UserModule>(context, listen: false).user()['userId']){
-              Provider.of<ServiceModule>(context, listen: false).setUnreadMessage(true);
+            if(res['_embedded']['myMessages'][i]['lastReadStatus'] == 'UNREAD' && res['_embedded']['myMessages'][i]['userId'] != userModule.user()['userId']){
+              serviceModule.setUnreadMessage(true);
             }
             tempData.add(res['_embedded']['myMessages'][i]);
           }
         }
 
-        Provider.of<ServiceModule>(context, listen: false).setMessage([]);
+        serviceModule.setMessage([]);
         if (tempData.length > 0) {
-          Provider.of<ServiceModule>(context, listen: false).setMessage(tempData);
+          serviceModule.setMessage(tempData);
         }
       }
     } catch (e) {
@@ -313,8 +317,8 @@ class HomeFunction{
       var res = await apiAuthProvider.getData(url, null);
       if (res != null) {
         for (int i = 0; i < res.length; i++) {
-          if (res[i]['readStatus'] == 'UNREAD' && res[i]['userId'] != Provider.of<UserModule>(context, listen: false).user()['userId']){
-            Provider.of<ServiceModule>(context, listen: false).setUnreadMessage(true);
+          if (res[i]['readStatus'] == 'UNREAD' && res[i]['userId'] != userModule.user()['userId']){
+            serviceModule.setUnreadMessage(true);
           }
         }
       }
@@ -322,7 +326,7 @@ class HomeFunction{
   }
 
   onRefresh(BuildContext context){
-    var profile = Provider.of<UserModule>(context, listen: false).profile();
+    var profile = userModule.profile();
     if(profile['topMenu']['show'] != null && profile['topMenu']['show'] == true) {
       if(U.newServerVersion(1709864293)){
         getTopMenuNew(context);

File diff suppressed because it is too large
+ 155 - 106
lib/src/layouts/mobile/menu_history.dart


+ 130 - 126
lib/src/layouts/web/menu_history.dart

@@ -21,6 +21,8 @@ class WebHistoryPage extends StatefulWidget {
 class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStateMixin {
   final HistoryFunction hisFunc = HistoryFunction();
   late AnimationController _animationController;
+  late final HistoryModule historyModule = Provider.of<HistoryModule>(context, listen: false);
+  late final UserModule userModule = Provider.of<UserModule>(context, listen: false);
 
   var rating = [
     {'key': 1, 'image': "assets/image/icon/very_dissatisfied.png", 'label': 'disatisfied'.tr()},
@@ -34,12 +36,12 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
   @override
   void initState() {
     // print(U.newServerVersion(1716279633));
-    Provider.of<HistoryModule>(context, listen: false).reset();
-    _animationController = new AnimationController(vsync: this, duration: Duration(seconds: 1));
+    historyModule.reset();
+    _animationController = AnimationController(vsync: this, duration: Duration(seconds: 1));
     _animationController.repeat(reverse: true);
 
     WidgetsBinding.instance.addPostFrameCallback((_) {
-      hisFunc.getActiveForum(context);
+      hisFunc.getActiveForum();
     });
     // TODO: implement initState
     super.initState();
@@ -53,9 +55,11 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
 
   @override
   Widget build(BuildContext context) {
-    return Provider.of<UserModule>(context).resetData() ? RefreshPage(() {
-      Provider.of<UserModule>(context, listen: false).setResetData(false);
-      hisFunc.getActiveForum(context);
+    final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
+    final UserModule userModuleListen = Provider.of<UserModule>(context);
+    return userModuleListen.resetData() ? RefreshPage(() {
+      userModule.setResetData(false);
+      hisFunc.getActiveForum();
     }) : Scaffold(
       backgroundColor: backgroundColor,
       appBar: PreferredSize(preferredSize: Size.fromHeight(0), child: AppBar(elevation: 0, backgroundColor: primaryColor)),
@@ -67,9 +71,10 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
               mainAxisAlignment: MainAxisAlignment.spaceBetween,
               children: [
                 Text('history'.tr(), style: TextStyle(color: textColor, fontSize: 17, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis),
-                Provider.of<HistoryModule>(context).multiSelectMode() ? GestureDetector(
+                historyModuleListen.multiSelectMode() ? GestureDetector(
                   child: Container(
                     padding: EdgeInsets.fromLTRB(16, 9, 16, 9),
+                    decoration: BoxDecoration(color: primaryColor.withValues(alpha: 0.1), border: Border.all(color: primaryColor), borderRadius: BorderRadius.all(Radius.circular(50))),
                     child: Row(
                       children: [
                         Text('delete'.tr(), style: TextStyle(color: primaryColor, fontSize: 14)),
@@ -77,7 +82,6 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                         U.iconsax('trash', color: primaryColor, size: 20)
                       ],
                     ),
-                    decoration: BoxDecoration(color: primaryColor.withValues(alpha: 0.1), border: Border.all(color: primaryColor), borderRadius: BorderRadius.all(Radius.circular(50))),
                   ),
                   onTap: () => hisFunc.deleteData(context),
                 ) : GestureDetector(
@@ -102,52 +106,52 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                     GestureDetector(
                       child: Container(
                         padding: EdgeInsets.symmetric(vertical: 5, horizontal: 16),
-                        child: Text('ongoing'.tr(), style: TextStyle(color: Provider.of<HistoryModule>(context).selectedFilter() == 1 ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
-                        decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: Provider.of<HistoryModule>(context).selectedFilter() == 1 ? primaryColor : primaryColor.withValues(alpha: 0.3), width: Provider.of<HistoryModule>(context).selectedFilter() == 1 ? 2 : 1))),
+                        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 (!Provider.of<HistoryModule>(context, listen: false).isLoadHistory()) {
-                          Provider.of<HistoryModule>(context, listen: false).setPressAttention(0);
-                          Provider.of<HistoryModule>(context, listen: false).setSelectedFilter(1);
-                          hisFunc.onRefresh(context);
+                        if (!historyModule.isLoadHistory()) {
+                          historyModule.setPressAttention(0);
+                          historyModule.setSelectedFilter(1);
+                          hisFunc.onRefresh();
                         }
                       },
                     ),
                     GestureDetector(
                       child: Container(
                         padding: EdgeInsets.symmetric(vertical: 5, horizontal: 16),
-                        child: Text('done'.tr(), style: TextStyle(color: Provider.of<HistoryModule>(context).selectedFilter() == 0 ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
-                        decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: Provider.of<HistoryModule>(context).selectedFilter() == 0 ? primaryColor : primaryColor.withValues(alpha: 0.3), width: Provider.of<HistoryModule>(context).selectedFilter() == 0 ? 2 : 1))),
+                        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 (!Provider.of<HistoryModule>(context, listen: false).isLoadHistory()) {
-                          Provider.of<HistoryModule>(context, listen: false).setPressAttention(0);
-                          Provider.of<HistoryModule>(context, listen: false).setSelectedFilter(0);
-                          hisFunc.onRefresh(context);
+                        if (!historyModule.isLoadHistory()) {
+                          historyModule.setPressAttention(0);
+                          historyModule.setSelectedFilter(0);
+                          hisFunc.onRefresh();
                         }
                       },
                     ),
                   ],
                 ),
                 SizedBox(height: 20),
-                Provider.of<HistoryModule>(context).selectedFilter() == 0 ? doneFilter() : ongoingFilter(),
+                historyModuleListen.selectedFilter() == 0 ? doneFilter() : ongoingFilter(),
               ],
             ),
           ),
           Expanded(
-            child: Provider.of<UserModule>(context).user().isNotEmpty ? Container(
+            child: userModuleListen.user().isNotEmpty ? Container(
               width: double.infinity,
               padding: EdgeInsets.symmetric(horizontal: 100),
               child: LazyLoadScrollView(
-                onEndOfPage: () => hisFunc.getMission(context),
+                onEndOfPage: () => hisFunc.getMission(),
                 scrollOffset: 500,
                 child: EasyRefresh(
                   header: MaterialHeader(clamping: true, color: primaryColor),
-                  onRefresh: ()=>hisFunc.onRefresh(context),
-                  child: Provider.of<HistoryModule>(context).selectedFilter() == 0 ? doneContainer() : ongoingContainer(),
+                  onRefresh: ()=>hisFunc.onRefresh(),
+                  child: historyModuleListen.selectedFilter() == 0 ? doneContainer() : ongoingContainer(),
                 ),
               ),
-            ) : Provider.of<UserModule>(context).resetData() ? Container() : _timeLimit ? showButton(context) : loadingTemplate(() {if(mounted) setState(()=>_timeLimit=true);},),
+            ) : userModuleListen.resetData() ? Container() : _timeLimit ? showButton(context) : loadingTemplate(() {if(mounted) setState(()=>_timeLimit=true);},),
           )
         ],
       ),
@@ -155,6 +159,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
   }
 
   Widget ongoingFilter() {
+    final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
     return SingleChildScrollView(
       scrollDirection: Axis.horizontal,
       child: Row(
@@ -163,20 +168,20 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
             child: Container(
               margin: EdgeInsets.only(right: 16),
               padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
-              child: Text(hisFunc.ongoingList[i]['title'], style: TextStyle(color: Provider.of<HistoryModule>(context).checkPressAttention(hisFunc.ongoingList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
               decoration: BoxDecoration(
-                  color: Provider.of<HistoryModule>(context).checkPressAttention(hisFunc.ongoingList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
-                  border: Border.all(color: Provider.of<HistoryModule>(context).checkPressAttention(hisFunc.ongoingList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
+                  color: historyModuleListen.checkPressAttention(hisFunc.ongoingList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
+                  border: Border.all(color: historyModuleListen.checkPressAttention(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)),
             ),
             onTap: () {
-              if (!Provider.of<HistoryModule>(context, listen: false).isLoadHistory()) {
-                if (Provider.of<HistoryModule>(context, listen: false).checkPressAttention(hisFunc.ongoingList[i]['value'])) {
-                  Provider.of<HistoryModule>(context, listen: false).setPressAttention(0);
-                  hisFunc.onRefresh(context);
+              if (!historyModule.isLoadHistory()) {
+                if (historyModule.checkPressAttention(hisFunc.ongoingList[i]['value'])) {
+                  historyModule.setPressAttention(0);
+                  hisFunc.onRefresh();
                 } else {
-                  Provider.of<HistoryModule>(context, listen: false).setPressAttention(hisFunc.ongoingList[i]['value']);
-                  hisFunc.onRefresh(context);
+                  historyModule.setPressAttention(hisFunc.ongoingList[i]['value']);
+                  hisFunc.onRefresh();
                 }
               }
             },
@@ -187,11 +192,12 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
   }
 
   Widget ongoingContainer() {
+    final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
     return SingleChildScrollView(
       child: Column(
         children: [
           U.newServerVersion(1709864293) && !U.getInternetStatus() ? Column(
-            children: List.generate(Provider.of<HistoryModule>(context).dataPending().length, (i) {
+            children: List.generate(historyModuleListen.dataPending().length, (i) {
               return GestureDetector(
                 child: Container(
                   width: double.infinity,
@@ -203,7 +209,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                       Row(
                         mainAxisAlignment: MainAxisAlignment.spaceBetween,
                         children: [
-                          Text(convertDate(Provider.of<HistoryModule>(context).dataPending()[i]['datetimeRequest'], context.locale.toString()), style: TextStyle(color: primaryColor, fontSize: 14)),
+                          Text(convertDate(historyModuleListen.dataPending()[i]['datetimeRequest'], context.locale.toString()), style: TextStyle(color: primaryColor, fontSize: 14)),
                           renderStatus('sending'.tr(), Color(0xff02C539).withValues(alpha: 0.2))
                         ],
                       ),
@@ -212,22 +218,22 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                       SizedBox(height: 10),
                       Row(
                         children: [
-                          imageTiles(imageUrl: Provider.of<HistoryModule>(context).dataPending()[i]['image'] ?? "null"),
+                          imageTiles(imageUrl: historyModuleListen.dataPending()[i]['image'] ?? "null"),
                           SizedBox(width: 25),
                           Expanded(
                             child: Column(
                               crossAxisAlignment: CrossAxisAlignment.start,
                               children: [
-                                Text(Provider.of<HistoryModule>(context).dataPending()[i]['title'], style: TextStyle(color: textColor, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis),
+                                Text(historyModuleListen.dataPending()[i]['title'], style: TextStyle(color: textColor, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis),
                                 SizedBox(height: 10),
-                                Text(Provider.of<HistoryModule>(context).dataPending()[i][U.langColumn(context, 'sub')], style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
+                                Text(historyModuleListen.dataPending()[i][U.langColumn(context, 'sub')], style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
                                 SizedBox(height: 5),
-                                Text(Provider.of<HistoryModule>(context).dataPending()[i][U.langColumn(context, 'desc')], style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
+                                Text(historyModuleListen.dataPending()[i][U.langColumn(context, 'desc')], style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
                                 dashed(top: 10, bottom: 10),
                                 Row(
                                   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                   children: [
-                                    Text('location'.tr()+': '+Provider.of<HistoryModule>(context).dataPending()[i]['location'], style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
+                                    Text('${'location'.tr()}: ${historyModuleListen.dataPending()[i]['location']}', style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
                                     Row(
                                       children: [
                                         Container(
@@ -250,13 +256,13 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                 ),
                 onTap: () {
                   if(!U.getInternetStatus()){
-                    // navigateTo(context, MobHistoryDetailPendingPage(data: Provider.of<HistoryModule>(context, listen: false).dataPending()[i])).then((val) {
+                    // navigateTo(context, MobHistoryDetailPendingPage(data: historyModule.dataPending()[i])).then((val) {
                     //   val = val??false;
                     //   if(val) hisFunc.onRefresh(context);
                     // });
                   }
                   else{
-                    hisFunc.onRefresh(context);
+                    hisFunc.onRefresh();
                   }
                 },
               );
@@ -264,7 +270,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
           ) : Container(),
 
           Column(
-            children: List.generate(Provider.of<HistoryModule>(context).dataMisi().length, (i) {
+            children: List.generate(historyModuleListen.dataMisi().length, (i) {
               return GestureDetector(
                 child: Container(
                   width: double.infinity,
@@ -275,27 +281,25 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                     children: [
                       Row(
                         children: [
-                          Text(convertDate(Provider.of<HistoryModule>(context).dataMisi()[i]['datetimeRequest'], context.locale.toString()), style: TextStyle(color: primaryColor, fontSize: 14)),
+                          Text(convertDate(historyModuleListen.dataMisi()[i]['datetimeRequest'], context.locale.toString()), style: TextStyle(color: primaryColor, fontSize: 14)),
                           SizedBox(width: 15),
                           Expanded(
-                            child: Text('ticketNumber'.tr()+': '+Provider.of<HistoryModule>(context).dataMisi()[i]['ticketNo'], style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
+                            child: Text('${'ticketNumber'.tr()}: ${historyModuleListen.dataMisi()[i]['ticketNo']}', style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
                           ),
-                          Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'DIMULAI' ? Container(
-                            child: Row(
-                              children: [
-                                Container(
-                                  width: 25, height: 25,
-                                  decoration: BoxDecoration(
-                                      border: Border.all(color: primaryColor), borderRadius: BorderRadius.all(Radius.circular(25)),
-                                      image: DecorationImage(image: AssetImage('assets/image/general/Avatar.jpg'), fit: BoxFit.cover)
-                                  ),
+                          historyModuleListen.dataMisi()[i]['currentState'] == 'DIMULAI' ? Row(
+                            children: [
+                              Container(
+                                width: 25, height: 25,
+                                decoration: BoxDecoration(
+                                    border: Border.all(color: primaryColor), borderRadius: BorderRadius.all(Radius.circular(25)),
+                                    image: DecorationImage(image: AssetImage('assets/image/general/Avatar.jpg'), fit: BoxFit.cover)
                                 ),
-                                SizedBox(width: 8),
-                                Text(Provider.of<HistoryModule>(context).dataMisi()[i]['servantNameStart'] + 'isWorking'.tr(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis)
-                              ],
-                            ),
+                              ),
+                              SizedBox(width: 8),
+                              Text(historyModuleListen.dataMisi()[i]['servantNameStart'] + 'isWorking'.tr(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis)
+                            ],
                           ) : Container(),
-                          Provider.of<HistoryModule>(context).dataMisi()[i]['_activeHoldRequest'] != null?renderStatus('hold'.tr(), Color(0xffD3D3D3)):Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'DIMULAI'?renderStatus('onProgress'.tr(), Color(0xffCCA600).withValues(alpha: 0.2)):renderStatus('queued'.tr(), Color(0xff02C539).withValues(alpha: 0.2))
+                          historyModuleListen.dataMisi()[i]['_activeHoldRequest'] != null?renderStatus('hold'.tr(), Color(0xffD3D3D3)):historyModuleListen.dataMisi()[i]['currentState'] == 'DIMULAI'?renderStatus('onProgress'.tr(), Color(0xffCCA600).withValues(alpha: 0.2)):renderStatus('queued'.tr(), Color(0xff02C539).withValues(alpha: 0.2))
                         ],
                       ),
                       SizedBox(height: 10),
@@ -303,42 +307,40 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                       SizedBox(height: 10),
                       Row(
                         children: [
-                          imageTiles(imageUrl: Provider.of<HistoryModule>(context).dataMisi()[i]['_requestImage'] ?? "null", width: 150, height: 120),
+                          imageTiles(imageUrl: historyModuleListen.dataMisi()[i]['_requestImage'] ?? "null", width: 150, height: 120),
                           SizedBox(width: 25),
                           Expanded(
                             child: Column(
                               crossAxisAlignment: CrossAxisAlignment.start,
                               children: [
-                                Text(Provider.of<HistoryModule>(context).dataMisi()[i][U.langColumn(context, 'requestGroupDescription')], style: TextStyle(color: textColor, fontSize: 16), overflow: TextOverflow.ellipsis),
+                                Text(historyModuleListen.dataMisi()[i][U.langColumn(context, 'requestGroupDescription')], style: TextStyle(color: textColor, fontSize: 16), overflow: TextOverflow.ellipsis),
                                 SizedBox(height: 10),
-                                Text(Provider.of<HistoryModule>(context).dataMisi()[i][U.langColumn(context, 'requestSubject')], style: TextStyle(color: textColor, fontWeight: FontWeight.w600), overflow: TextOverflow.ellipsis),
+                                Text(historyModuleListen.dataMisi()[i][U.langColumn(context, 'requestSubject')], style: TextStyle(color: textColor, fontWeight: FontWeight.w600), overflow: TextOverflow.ellipsis),
                                 SizedBox(height: 5),
-                                Text(Provider.of<HistoryModule>(context).dataMisi()[i][U.langColumn(context, '_subjectDescription')]??'', style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
+                                Text(historyModuleListen.dataMisi()[i][U.langColumn(context, '_subjectDescription')]??'', style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
                                 dashed(top: 10, bottom: 10),
-                                renderRequested(Provider.of<HistoryModule>(context).dataMisi()[i]),
+                                renderRequested(historyModuleListen.dataMisi()[i]),
                                 Row(
                                   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                   crossAxisAlignment: CrossAxisAlignment.center ,
                                   children: [
-                                    Text('location'.tr()+': '+Provider.of<HistoryModule>(context).dataMisi()[i]['ipphoneExtLocation'], style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
-                                    Provider.of<HistoryModule>(context).dataMisi()[i]['_activeHoldRequest'] != null ? Container(
-                                      child: Row(
-                                        children: [
-                                          Container(
-                                            width: 25, height: 25,
-                                            decoration: BoxDecoration(image: DecorationImage(image: AssetImage('assets/image/general/Watch.png'), fit: BoxFit.cover)),
-                                          ),
-                                          SizedBox(width: 8),
-                                          Text(Provider.of<HistoryModule>(context).dataMisi()[i]['_activeHoldRequest']['description'], style: TextStyle(color: textColor, fontSize: 14))
-                                        ],
-                                      ),
-                                    ) : Provider.of<HistoryModule>(context).dataMisi()[i]['_hasForum'] && Provider.of<HistoryModule>(context).dataMisi()[i]['_forumMsg'] != null ? ConstrainedBox(
+                                    Text('${'location'.tr()}: ${historyModuleListen.dataMisi()[i]['ipphoneExtLocation']}', style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
+                                    historyModuleListen.dataMisi()[i]['_activeHoldRequest'] != null ? Row(
+                                      children: [
+                                        Container(
+                                          width: 25, height: 25,
+                                          decoration: BoxDecoration(image: DecorationImage(image: AssetImage('assets/image/general/Watch.png'), fit: BoxFit.cover)),
+                                        ),
+                                        SizedBox(width: 8),
+                                        Text(historyModuleListen.dataMisi()[i]['_activeHoldRequest']['description'], style: TextStyle(color: textColor, fontSize: 14))
+                                      ],
+                                    ) : historyModuleListen.dataMisi()[i]['_hasForum'] && historyModuleListen.dataMisi()[i]['_forumMsg'] != null ? ConstrainedBox(
                                       constraints: BoxConstraints(minWidth: 10),
                                       child: Row(
                                         children: [
                                           FadeTransition(opacity: _animationController, child: U.iconsax('messages-3', color: primaryColor)),
                                           SizedBox(width: 8),
-                                          Text('“${Provider.of<HistoryModule>(context).dataMisi()[i]['_forumMsg']}”', style: TextStyle(color: textColor.withValues(alpha: 0.75), fontSize: 14, fontStyle: FontStyle.italic))
+                                          Text('“${historyModuleListen.dataMisi()[i]['_forumMsg']}”', style: TextStyle(color: textColor.withValues(alpha: 0.75), fontSize: 14, fontStyle: FontStyle.italic))
                                         ],
                                       ),
                                     ) : Container(),
@@ -354,14 +356,14 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                 ),
                 onTap: () => navigateTo(context, WebHistoryDetailPage(index: i)).then((val) {
                   val = val??false;
-                  if(val) Provider.of<HistoryModule>(context, listen: false).cancelMisi(i);
+                  if(val) historyModule.cancelMisi(i);
                 }),
               );
             }),
           ),
-          !Provider.of<HistoryModule>(context).stopLoadHistory() || (Provider.of<HistoryModule>(context).isLoadHistory() && Provider.of<HistoryModule>(context).page() > 0)
-              ? Container(margin: EdgeInsets.only(top: Provider.of<HistoryModule>(context).page() > 0 ? 0 : 50), child: loadingTemplateNoVoid())
-              : Provider.of<HistoryModule>(context).dataMisi().isEmpty && Provider.of<HistoryModule>(context).dataPending().isEmpty
+          !historyModuleListen.stopLoadHistory() || (historyModuleListen.isLoadHistory() && historyModuleListen.page() > 0)
+              ? Container(margin: EdgeInsets.only(top: historyModuleListen.page() > 0 ? 0 : 50), child: loadingTemplateNoVoid())
+              : historyModuleListen.dataMisi().isEmpty && historyModuleListen.dataPending().isEmpty
               ? NoDataPage()
               : Container(),
         ],
@@ -370,6 +372,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
   }
 
   Widget doneFilter() {
+    final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
     return Row(
       children: List.generate(hisFunc.doneList.length, (i) {
         return GestureDetector(
@@ -377,19 +380,19 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
             margin: EdgeInsets.only(right: 16),
             padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
             decoration: BoxDecoration(
-                color: Provider.of<HistoryModule>(context).checkPressAttention(hisFunc.doneList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
-                border: Border.all(color: Provider.of<HistoryModule>(context).checkPressAttention(hisFunc.doneList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
+                color: historyModuleListen.checkPressAttention(hisFunc.doneList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
+                border: Border.all(color: historyModuleListen.checkPressAttention(hisFunc.doneList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
                 borderRadius: BorderRadius.all(Radius.circular(50))),
-            child: Text(hisFunc.doneList[i]['title'], style: TextStyle(color: Provider.of<HistoryModule>(context).checkPressAttention(hisFunc.doneList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
+            child: Text(hisFunc.doneList[i]['title'], style: TextStyle(color: historyModuleListen.checkPressAttention(hisFunc.doneList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
           ),
           onTap: () {
-            if (!Provider.of<HistoryModule>(context, listen: false).isLoadHistory()) {
-              if (Provider.of<HistoryModule>(context, listen: false).checkPressAttention(hisFunc.doneList[i]['value'])) {
-                Provider.of<HistoryModule>(context, listen: false).setPressAttention(0);
-                hisFunc.onRefresh(context);
+            if (!historyModule.isLoadHistory()) {
+              if (historyModule.checkPressAttention(hisFunc.doneList[i]['value'])) {
+                historyModule.setPressAttention(0);
+                hisFunc.onRefresh();
               } else {
-                Provider.of<HistoryModule>(context, listen: false).setPressAttention(hisFunc.doneList[i]['value']);
-                hisFunc.onRefresh(context);
+                historyModule.setPressAttention(hisFunc.doneList[i]['value']);
+                hisFunc.onRefresh();
               }
             }
           },
@@ -399,11 +402,12 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
   }
 
   Widget doneContainer() {
+    final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
     return SingleChildScrollView(
       child: Column(
         children: [
           Column(
-              children: List.generate(Provider.of<HistoryModule>(context).dataMisi().length, (i) {
+              children: List.generate(historyModuleListen.dataMisi().length, (i) {
                 return GestureDetector(
                   child: Container(
                     width: double.infinity,
@@ -414,12 +418,12 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                       children: [
                         Row(
                           children: [
-                            Text(convertDate(Provider.of<HistoryModule>(context).dataMisi()[i]['datetimeRequest'], context.locale.toString()), style: TextStyle(color: primaryColor, fontSize: 14)),
+                            Text(convertDate(historyModuleListen.dataMisi()[i]['datetimeRequest'], context.locale.toString()), style: TextStyle(color: primaryColor, fontSize: 14)),
                             SizedBox(width: 15),
                             Expanded(
-                              child: Text('ticketNumber'.tr()+': '+Provider.of<HistoryModule>(context).dataMisi()[i]['ticketNo'], style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
+                              child: Text('${'ticketNumber'.tr()}: ${historyModuleListen.dataMisi()[i]['ticketNo']}', style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
                             ),
-                            Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'DISELESAIKAN' || Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'TUNTAS' ? renderStatus('stateFinish'.tr(), primaryColor.withValues(alpha: 0.4)) : renderStatus('stateCancel'.tr(), Color(0xffD81010).withValues(alpha: 0.4))
+                            historyModuleListen.dataMisi()[i]['currentState'] == 'DISELESAIKAN' || historyModuleListen.dataMisi()[i]['currentState'] == 'TUNTAS' ? renderStatus('stateFinish'.tr(), primaryColor.withValues(alpha: 0.4)) : renderStatus('stateCancel'.tr(), Color(0xffD81010).withValues(alpha: 0.4))
                           ],
                         ),
                         SizedBox(height: 10),
@@ -427,20 +431,20 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                         SizedBox(height: 10),
                         Row(
                           children: [
-                            imageTiles(imageUrl: Provider.of<HistoryModule>(context).dataMisi()[i]['_requestImage'] ?? "null", width: 150, height: 120),
+                            imageTiles(imageUrl: historyModuleListen.dataMisi()[i]['_requestImage'] ?? "null", width: 150, height: 120),
                             SizedBox(width: 25),
                             Expanded(
                               child: Column(
                                 crossAxisAlignment: CrossAxisAlignment.start,
                                 children: [
-                                  Text(Provider.of<HistoryModule>(context).dataMisi()[i][U.langColumn(context, 'requestGroupDescription')], style: TextStyle(color: textColor, fontSize: 16), overflow: TextOverflow.ellipsis),
+                                  Text(historyModuleListen.dataMisi()[i][U.langColumn(context, 'requestGroupDescription')], style: TextStyle(color: textColor, fontSize: 16), overflow: TextOverflow.ellipsis),
                                   SizedBox(height: 10),
-                                  Text(Provider.of<HistoryModule>(context).dataMisi()[i][U.langColumn(context, 'requestSubject')], style: TextStyle(color: textColor, fontWeight: FontWeight.w600), overflow: TextOverflow.ellipsis),
+                                  Text(historyModuleListen.dataMisi()[i][U.langColumn(context, 'requestSubject')], style: TextStyle(color: textColor, fontWeight: FontWeight.w600), overflow: TextOverflow.ellipsis),
                                   SizedBox(height: 5),
-                                  Text(Provider.of<HistoryModule>(context).dataMisi()[i][U.langColumn(context, '_subjectDescription')]??'', style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
+                                  Text(historyModuleListen.dataMisi()[i][U.langColumn(context, '_subjectDescription')]??'', style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
                                   dashed(top: 10, bottom: 10),
-                                  renderRequested(Provider.of<HistoryModule>(context).dataMisi()[i]),
-                                  Text('location'.tr()+': '+Provider.of<HistoryModule>(context).dataMisi()[i]['ipphoneExtLocation'], style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
+                                  renderRequested(historyModuleListen.dataMisi()[i]),
+                                  Text('${'location'.tr()}: ${historyModuleListen.dataMisi()[i]['ipphoneExtLocation']}', style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
                                 ],
                               ),
                             )
@@ -452,31 +456,31 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                         Row(
                           mainAxisAlignment: MainAxisAlignment.spaceBetween,
                           children: [
-                            !Provider.of<HistoryModule>(context).dataMisi()[i]['autoResponse'] && Provider.of<HistoryModule>(context).dataMisi()[i]['servantIdentityStart'] != '#system' && (Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'TUNTAS' || Provider.of<HistoryModule>(context).dataMisi()[i]['currentState'] == 'DISELESAIKAN') ? Container(
+                            !historyModuleListen.dataMisi()[i]['autoResponse'] && historyModuleListen.dataMisi()[i]['servantIdentityStart'] != '#system' && (historyModuleListen.dataMisi()[i]['currentState'] == 'TUNTAS' || historyModuleListen.dataMisi()[i]['currentState'] == 'DISELESAIKAN') ? Container(
                               child: hisFunc.askForRate(Provider.of<HistoryModule>(context, listen: true).dataMisi()[i]) ? GestureDetector(
                                 child: Container(
                                   padding: EdgeInsets.symmetric(vertical: 4, horizontal: 16),
-                                  child: Text('rateReq'.tr(), style: TextStyle(color: secondaryColor, fontSize: 14), overflow: TextOverflow.ellipsis),
                                   decoration: BoxDecoration(color: Colors.white, border: Border.all(color: secondaryColor), borderRadius: BorderRadius.all(Radius.circular(50))),
+                                  child: Text('rateReq'.tr(), style: TextStyle(color: secondaryColor, fontSize: 14), overflow: TextOverflow.ellipsis),
                                 ),
                                 onTap: () {
-                                  U.newServerVersion(1716279633) ? rateMissionNew(context, Provider.of<HistoryModule>(context, listen: false).dataMisi()[i], i) : rateMission(context, Provider.of<HistoryModule>(context, listen: false).dataMisi()[i], i);
+                                  U.newServerVersion(1716279633) ? rateMissionNew(context, historyModule.dataMisi()[i], i) : rateMission(context, historyModule.dataMisi()[i], i);
                                 },
-                              ) : !hisFunc.isAutoResponse(Provider.of<HistoryModule>(context).dataMisi()[i]) ? Row(
+                              ) : !hisFunc.isAutoResponse(historyModuleListen.dataMisi()[i]) ? Row(
                                 children: [
-                                  Image(image: AssetImage(rating[Provider.of<HistoryModule>(context).dataMisi()[i]['satisfactionRate'] - 1]['image'].toString()), width: 25),
+                                  Image(image: AssetImage(rating[historyModuleListen.dataMisi()[i]['satisfactionRate'] - 1]['image'].toString()), width: 25),
                                   SizedBox(width: 5),
-                                  Text(rating[Provider.of<HistoryModule>(context).dataMisi()[i]['satisfactionRate'] - 1]['label'].toString(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
+                                  Text(rating[historyModuleListen.dataMisi()[i]['satisfactionRate'] - 1]['label'].toString(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
                                 ],
                               ) : Container(),
-                            ) : message(Provider.of<HistoryModule>(context).dataMisi()[i]['_hasForum'], Provider.of<HistoryModule>(context).dataMisi()[i]['_forumMsg'] ?? "null"),
+                            ) : message(historyModuleListen.dataMisi()[i]['_hasForum'], historyModuleListen.dataMisi()[i]['_forumMsg'] ?? "null"),
                             GestureDetector(
                               child: Container(
                                 padding: EdgeInsets.symmetric(vertical: 4, horizontal: 16),
-                                child: Text('reqAgain'.tr(), style: TextStyle(color: primaryColor, fontSize: 14)),
                                 decoration: BoxDecoration(color: Colors.white, border: Border.all(color: primaryColor), borderRadius: BorderRadius.all(Radius.circular(50))),
+                                child: Text('reqAgain'.tr(), style: TextStyle(color: primaryColor, fontSize: 14)),
                               ),
-                              onTap: () => hisFunc.requestAgainAction(context, i),
+                              onTap: () => hisFunc.requestAgainAction(i),
                             )
                           ],
                         ),
@@ -484,7 +488,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                     ),
                   ),
                   onTap: () {
-                    if (Provider.of<HistoryModule>(context, listen: false).multiSelectMode()) {
+                    if (historyModule.multiSelectMode()) {
                       hisFunc.selectedController(context, i);
                     } else {
                       navigateTo(context, WebHistoryDetailPage(index: i));
@@ -494,9 +498,9 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                 );
               })
           ),
-          !Provider.of<HistoryModule>(context).stopLoadHistory() || (Provider.of<HistoryModule>(context).isLoadHistory() && Provider.of<HistoryModule>(context).page() > 0)
-              ? Container(margin: EdgeInsets.only(top: Provider.of<HistoryModule>(context).page() > 0 ? 0 : 50), child: loadingTemplateNoVoid())
-              : Provider.of<HistoryModule>(context).dataMisi().length == 0 ? NoDataPage() : Container(),
+          !historyModuleListen.stopLoadHistory() || (historyModuleListen.isLoadHistory() && historyModuleListen.page() > 0)
+              ? Container(margin: EdgeInsets.only(top: historyModuleListen.page() > 0 ? 0 : 50), child: loadingTemplateNoVoid())
+              : historyModuleListen.dataMisi().isEmpty ? NoDataPage() : Container(),
         ],
       ),
     );
@@ -504,7 +508,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
 
   Widget renderRequested(list){
     if(list['receptionistId'] != null){
-      var user = Provider.of<UserModule>(context, listen: false).user();
+      var user = userModule.user();
       if(user['roomAttendant'] && user['userId'] != list['informantUserId'] && user['userId'] == list['receptionistId']){
         return Column(
           crossAxisAlignment: CrossAxisAlignment.start,
@@ -529,14 +533,14 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
     return Container();
   }
 
-  Widget message(bool _hasForum, String _forumMsg, {double top = 0}) {
-    return _hasForum ? Container(
+  Widget message(bool hasForum, String forumMsg, {double top = 0}) {
+    return hasForum ? Container(
       margin: EdgeInsets.only(top: top),
       child: Row(
         children: [
           FadeTransition(opacity: _animationController, child: U.iconsax('messages-3', color: primaryColor)),
           SizedBox(width: 8),
-          Text('“$_forumMsg”', style: TextStyle(color: textColor.withValues(alpha: 0.75), fontSize: 14, fontStyle: FontStyle.italic), overflow: TextOverflow.ellipsis),
+          Text('“$forumMsg”', style: TextStyle(color: textColor.withValues(alpha: 0.75), fontSize: 14, fontStyle: FontStyle.italic), overflow: TextOverflow.ellipsis),
         ],
       ),
     ) : Container();
@@ -546,10 +550,10 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
     return Container(
       padding: EdgeInsets.symmetric(vertical: 3, horizontal: 10),
       margin: EdgeInsets.only(left: 10),
-      child: Text(text, style: TextStyle(fontSize: 12, color: textColor)),
       decoration: BoxDecoration(
         color: color, borderRadius: BorderRadius.all(Radius.circular(3))
       ),
+      child: Text(text, style: TextStyle(fontSize: 12, color: textColor)),
     );
   }
 
@@ -633,7 +637,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
 
                                       var res = await ApiAuthProvider() .postData('/api/requestHistories/rateSatisfy', null, data);
                                       if (res != null) {
-                                        Provider.of<HistoryModule>(context, listen: false).setSatisfaction(index, tempRating);
+                                        historyModule.setSatisfaction(index, tempRating);
                                         navigateBack(contexts);
                                       }
                                     }
@@ -664,7 +668,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
           String description = '';
           String ratingAspect = '';
           TextEditingController controllerOptOther = new TextEditingController();
-          List aspectList = list['_ratingAspect'+locale[0].toUpperCase()+locale[1]] != null && list['_ratingAspect'+locale[0].toUpperCase()+locale[1]].trim() != '' ? list['_ratingAspect'+locale[0].toUpperCase()+locale[1]].split(';') : [];
+          List aspectList = list['_ratingAspect${locale[0].toUpperCase()}${locale[1]}'] != null && list['_ratingAspect'+locale[0].toUpperCase()+locale[1]].trim() != '' ? list['_ratingAspect'+locale[0].toUpperCase()+locale[1]].split(';') : [];
           if(aspectList.isNotEmpty){
             aspectList.add('OTHER_OPTION');
           }
@@ -693,7 +697,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                             Row(
                               mainAxisAlignment: MainAxisAlignment.spaceBetween,
                               children: [
-                                Text('ticketNumber'.tr()+': '+list['ticketNo'], style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w300)),
+                                Text('${'ticketNumber'.tr()}: '+list['ticketNo'], style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w300)),
                                 Text(convertDate(list['datetimeRequest'], context.locale.toString()), style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w300)),
                               ],
                             ),
@@ -735,7 +739,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                             tempRating != 0 ? Column(
                               crossAxisAlignment: CrossAxisAlignment.start,
                               children: [
-                                Text('whatMakesYou'.tr()+' '+description+'?', style: TextStyle(fontSize: 16)),
+                                Text('${'whatMakesYou'.tr()} $description?', style: TextStyle(fontSize: 16)),
                                 SizedBox(height: 12),
                                 Wrap(
                                   runSpacing: 10, spacing: 10,
@@ -801,7 +805,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
 
                                       var res = await ApiAuthProvider() .postData('/api/requestHistories/rateSatisfy', null, data);
                                       if (res != null) {
-                                        Provider.of<HistoryModule>(context, listen: false).setSatisfaction(index, tempRating);
+                                        historyModule.setSatisfaction(index, tempRating);
                                         navigateBack(contexts);
                                       }
                                     }

+ 2 - 2
lib/src/utils/ui_service.dart

@@ -53,10 +53,10 @@ class UIService {
     }
   }
 
-  static void navigateTo(String routePath) {
+  static void navigateTo(Widget child) {
     final ctx = context;
     if (ctx != null) {
-      AutoRouter.of(ctx).navigatePath(routePath);
+      Navigator.push(ctx, PageTransition(type: PageTransitionType.rightToLeft, child: child));
     }
   }