Explorar el Código

set pindah2 filter pake indexed stack

Yulian hace 1 mes
padre
commit
1337ea3280

+ 3 - 9
lib/src/layouts/components/template.dart

@@ -256,13 +256,7 @@ Widget loadingTemplate(VoidCallback setState){
   return Center(
     child: SizedBox(
       height: 36,
-      child: LoadingIndicator(
-        indicatorType: Indicator.ballPulseRise,
-        colors: U.defaultRainbowColors(),
-        strokeWidth: 2,
-        backgroundColor: Colors.black.withValues(alpha: 0),
-        pathBackgroundColor: Colors.black,
-      ),
+      child: loadingTemplateNoVoid()
     ),
   );
 }
@@ -272,8 +266,8 @@ Widget loadingTemplateNoVoid(){
     child: SizedBox(
       height: 36,
       child: LoadingIndicator(
-        indicatorType: Indicator.ballPulseRise,
-        colors: U.defaultRainbowColors(),
+        indicatorType: Indicator.ballClipRotatePulse,
+        colors: U.loadingIndicatorColors(),
         strokeWidth: 2,
         backgroundColor: Colors.black.withValues(alpha: 0),
         pathBackgroundColor: Colors.black,

+ 17 - 14
lib/src/layouts/functions/history.dart

@@ -101,11 +101,13 @@ class HistoryFunction{
   getMission() async {
     HistoryTab tab = historyModule.activeTab();
     List filters = tab.filters;
+    String selectedFilter = historyModule.selectedFilter();
+    String state = '${tab.name}::$selectedFilter';
 
     try {
-      if (!historyModule.isLoadHistory() && !historyModule.stopLoadHistory()) {
-        historyModule.setLoadHistory(true);
-        String selectedFilter = historyModule.selectedFilter();
+      // debugPrint('historyModule.isLoadHistory(state: state): ${historyModule.isLoadHistory(state: state)}');
+      if (!historyModule.isLoadHistory(state: state) && !historyModule.stopLoadHistory()) {
+        historyModule.setLoadHistory(true, state);
         var sort = ['datetimeRequest,desc'];
         String filter;
 
@@ -131,13 +133,13 @@ class HistoryFunction{
         String key = url + filter;
         var val = await CacheMan.readData(key);
         if (val != null && historyModule.page() == 0) {
-          historyModule.setMisi(val['data']);
+          historyModule.setDataRequests(state, val['data']);
         }
 
         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);
+          historyModule.setLoadHistory(false, state);
           List tempData = [];
           if (mission.containsKey('_embedded')) {
             // debugPrint('Balikan data: ${mission['_embedded']['requestHistories'].length}');
@@ -166,22 +168,22 @@ class HistoryFunction{
           // historyModule.setLoadHistory(false);
           if (tempData.isEmpty) {
             historyModule.setStopLoadHistory(true);
-            historyModule.clearMisi();
+            historyModule.clearDataRequests();
             CacheMan.writeData(key, tempData);
           } else {
             if (historyModule.page() == 0) {
               CacheMan.writeData(key, tempData);
-              historyModule.clearMisi();
+              historyModule.clearDataRequests();
             }
             historyModule.addPage();
           }
-          historyModule.setMisi(tempData);
+          historyModule.setDataRequests(state, tempData);
 
           if (historyModule.getMisiLength() >= mission['page']['totalElements']) {
             historyModule.setStopLoadHistory(true);
           }
         } else {
-          historyModule.setLoadHistory(false);
+          historyModule.setLoadHistory(false, state);
           historyModule.setStopLoadHistory(true);
         }
       }
@@ -191,7 +193,8 @@ class HistoryFunction{
   }
 
   onRefresh() async {
-    historyModule.clearMisi();
+    historyModule.setCurrentPage();
+    historyModule.clearDataRequests();
     historyModule.setPendingData([]);
     historyModule.setActiveForum([]);
     historyModule.setSelectedIndexes([]);
@@ -245,7 +248,7 @@ class HistoryFunction{
                   Navigator.of(contextt).pop();
                   List<String> params = [];
                   historyModule.selectedIndexes().forEach((e) {
-                    params.add(historyModule.dataMisi()[e]["ticketNo"]);
+                    params.add(historyModule.dataRequests()[e]["ticketNo"]);
                   });
                   var res = await apiAuthProvider.postData("/api/requestHistories/deleteMyHistory", {"ticketNumbers": params}, null);
                   if (res != null) {
@@ -265,10 +268,10 @@ class HistoryFunction{
       String tenant = '';
       String filter = '';
 
-      if ((historyModule.dataMisi()[i]['requestGroupCode']).split(" ").length != 1) {
-        tenant = ',{"f":["tenantCode","EQ","${(historyModule.dataMisi()[i]['requestGroupCode']).split(" ").first}"]}';
+      if ((historyModule.dataRequests()[i]['requestGroupCode']).split(" ").length != 1) {
+        tenant = ',{"f":["tenantCode","EQ","${(historyModule.dataRequests()[i]['requestGroupCode']).split(" ").first}"]}';
       }
-      filter = '{"and":[{"f":["code","EQ","${historyModule.dataMisi()[i]['requestCode']}"]}$tenant]}';
+      filter = '{"and":[{"f":["code","EQ","${historyModule.dataRequests()[i]['requestCode']}"]}$tenant]}';
 
       var res = await apiAuthProvider.getData('/api/requests/search/customFind', {'filter': filter});
       if (res != null) {

+ 1 - 1
lib/src/layouts/mobile/history_detail.dart

@@ -44,7 +44,7 @@ class _MobHistoryDetailPageState extends State<MobHistoryDetailPage> {
   }
 
   getData() async{
-    var res = await detFunc.getMission(UIService.getLocale(), Provider.of<HistoryModule>(context, listen: false).dataMisi()[widget.index]);
+    var res = await detFunc.getMission(UIService.getLocale(), Provider.of<HistoryModule>(context, listen: false).dataRequests()[widget.index]);
     setState((){
       user = res['user'];
       list = res['list'];

+ 107 - 131
lib/src/layouts/mobile/menu_history.dart

@@ -12,7 +12,6 @@ import 'package:telnow_mobile_new/src/layouts/mobile/history_rating.dart';
 import 'package:telnow_mobile_new/src/utils/U.dart';
 import 'package:telnow_mobile_new/src/utils/dio_logging_interceptors.dart';
 import 'package:telnow_mobile_new/src/utils/provider.dart';
-import 'package:telnow_mobile_new/src/utils/ui_service.dart';
 
 class MobHistoryPage extends StatefulWidget {
   const MobHistoryPage({super.key});
@@ -26,6 +25,7 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
   late AnimationController _animationController;
   late final HistoryModule historyModule;
   late final UserModule userModule;
+  final List<String> pages = ['ongoing::none', 'ongoing::queue', 'ongoing::done', 'ongoing::hold', 'done::none', 'done::finish', 'done::cancel'];
 
   var rating = [
     {'key': 1, 'image': "assets/image/icon/very_dissatisfied.png", 'label': 'disatisfied'.tr()},
@@ -43,17 +43,32 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
     historyModule.reset();
     _animationController = AnimationController(vsync: this, duration: Duration(seconds: 1));
     _animationController.repeat(reverse: true);
-    
+    initializePages();
+
     WidgetsBinding.instance.addPostFrameCallback((_) {
       historyFunction.getActiveForum();
       // getUser taruh sini dulu. di-load bareng render widget. 031125
       historyFunction.getUser();
+      historyModule.setCurrentPage();
       historyFunction.getMission();
     });
     // TODO: implement initState
     super.initState();
   }
 
+  void initializePages(){
+    Map<String, List> data = {};
+    Map<String, bool> isLoad = {};
+
+    for(var i=0; i<pages.length; i++){
+      // debugPrint('initialize for ${pages[i]}, length: ${pages.length}');
+      data[pages[i]] = [];
+      isLoad[pages[i]] = false;
+    }
+    historyModule.initDataPages(data);
+    historyModule.initIsLoadPages(isLoad);
+  }
+
   @override
   void dispose() {
     _animationController.dispose();
@@ -114,21 +129,14 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
             ],
           ),
           Expanded(
-            child: userModuleListen.user().isNotEmpty ? Container(
-              alignment: Alignment.topCenter,
-              width: U.bodyWidth(context),
-              child: LazyLoadScrollView(
-                onEndOfPage: () => historyFunction.getMission(),
-                scrollOffset: 500,
-                child: EasyRefresh(
-                  header: MaterialHeader(clamping: true, color: primaryColor),
-                  onRefresh: () => historyFunction.onRefresh(),
-                  child: historyModuleListen.activeTab().name == 'done' ? doneContainer() : ongoingContainer(),
-                ),
-              ),
-            ) : userModuleListen.resetData() ? Container() : loadingTemplate(() {
-              if(mounted) setState(()=>_timeLimit=true);
-            },),
+            child: userModuleListen.user().isNotEmpty
+                ? indexedStackedBody()
+                : userModuleListen.resetData()
+                ? Container()
+                : loadingTemplate(() {
+                    if(mounted) setState(() => _timeLimit=true);
+                  },
+            ),
           )
         ],
       ),
@@ -151,11 +159,11 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
             child: Text('ongoing'.tr(), style: TextStyle(color: activeTab.name == "ongoing" ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
           ),
           onTap: () {
-            if (!historyModule.isLoadHistory()) {
+            // if (!historyModule.isLoadHistory()) {
               historyModule.setSelectedFilter('none');
               historyModule.setActiveTab(HistoryTab.ongoing);
               historyFunction.onRefresh();
-            }
+            // }
           },
         ),
         GestureDetector(
@@ -165,11 +173,11 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
             child: Text('done'.tr(), style: TextStyle(color: activeTab.name == "done" ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
           ),
           onTap: () {
-            if (!historyModule.isLoadHistory()) {
+            // if (!historyModule.isLoadHistory()) {
               historyModule.setSelectedFilter('none');
               historyModule.setActiveTab(HistoryTab.done);
               historyFunction.onRefresh();
-            }
+            // }
           },
         ),
       ],
@@ -195,7 +203,7 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
               child: Text(currentFilters[i]['title'], style: TextStyle(color: historyModuleListen.checkSelectedFilter(currentFilters[i]['value']) ? Colors.white : textColor, fontSize: 16)),
             ),
             onTap: () {
-              if (!historyModule.isLoadHistory()) {
+              // if (!historyModule.isLoadHistory()) {
                 if (historyModule.checkSelectedFilter(currentFilters[i]['value'])) {
                   historyModule.setSelectedFilter('none');
                   historyFunction.onRefresh();
@@ -203,55 +211,57 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
                   historyModule.setSelectedFilter(currentFilters[i]['value']);
                   historyFunction.onRefresh();
                 }
-              }
+              // }
             },
           );
         }),
       ),
     );
   }
-  //# kodingan baru end
 
-  Widget ongoingFilter() {
-    final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
-    return SingleChildScrollView(
-      scrollDirection: Axis.horizontal,
-      child: Row(
-        children: List.generate(historyFunction.ongoingList.length, (i) {
-          return GestureDetector(
-            child: Container(
-              margin: EdgeInsets.only(left: 16),
-              padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
-              decoration: BoxDecoration(
-                  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.checkSelectedFilter(historyFunction.ongoingList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
-            ),
-            onTap: () {
-              if (!historyModule.isLoadHistory()) {
-                if (historyModule.checkSelectedFilter(historyFunction.ongoingList[i]['value'])) {
-                  historyModule.setSelectedFilter('none');
-                  historyFunction.onRefresh();
-                } else {
-                  historyModule.setSelectedFilter(historyFunction.ongoingList[i]['value']);
-                  historyFunction.onRefresh();
-                }
-              }
-            },
-          );
-        }),
+  Widget indexedStackedBody(){
+    HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
+    int currentIndex = pages.indexOf(historyModuleListen.currentPage());
+// debugPrint('current index: $currentIndex for ${historyModuleListen.currentPage()}');
+
+    return IndexedStack(
+      index: currentIndex,
+      children: List.generate(pages.length, (i){
+        return buildBody(pages[i]);
+      }),
+    );
+  }
+
+  Widget buildBody(String keyState){
+    HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
+    // debugPrint('build for $keyState. The data is ${historyModuleListen.dataRequests(state: keyState).length}');
+
+    return Container(
+      alignment: Alignment.topCenter,
+      width: U.bodyWidth(context),
+      child: LazyLoadScrollView(
+        onEndOfPage: () => historyFunction.getMission(),
+        scrollOffset: 500,
+        child: EasyRefresh(
+          header: MaterialHeader(clamping: true, color: primaryColor),
+          onRefresh: () => historyFunction.onRefresh(),
+          child: keyState.startsWith('done',0) ? doneContainer(historyModuleListen, keyState) : ongoingContainer(historyModuleListen, keyState),
+        ),
       ),
     );
   }
+  //# kodingan baru end
+
+  Widget ongoingContainer(HistoryModule historyModuleListen, String state) {
+    // final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
+    final dataPending = historyModuleListen.dataPending();
+    final dataRequest = historyModuleListen.dataRequests(state: state);
 
-  Widget ongoingContainer() {
-    final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
     return SingleChildScrollView(
       child: Column(
         children: [
           U.newServerVersion(1709864293) && !U.getInternetStatus() ? Column(
-            children: List.generate(historyModuleListen.dataPending().length, (i) {
+            children: List.generate(dataPending.length, (i) {
               return GestureDetector(
                 child: Container(
                   padding: EdgeInsets.all(16),
@@ -260,17 +270,17 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
                     children: [
                       Row(
                         children: [
-                          imageTiles(imageUrl: historyModuleListen.dataPending()[i]['image'] ?? "null"),
+                          imageTiles(imageUrl: dataPending[i]['image'] ?? "null"),
                           SizedBox(width: 16),
                           Expanded(
                             child: Column(
                               crossAxisAlignment: CrossAxisAlignment.start,
                               children: [
-                                Text(historyModuleListen.dataPending()[i]['title'], style: TextStyle(color: textColor, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis),
+                                Text(dataPending[i]['title'], style: TextStyle(color: textColor, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis),
                                 SizedBox(height: 6),
-                                Text(historyModuleListen.dataPending()[i][U.langColumn(context, 'sub')], style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
+                                Text(dataPending[i][U.langColumn(context, 'sub')], style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
                                 SizedBox(height: 6),
-                                Text(convertDate(historyModuleListen.dataPending()[i]['datetimeRequest'], context.locale.toString()), style: TextStyle(color: textColor, fontSize: 13, fontWeight: FontWeight.w300)),
+                                Text(convertDate(dataPending[i]['datetimeRequest'], context.locale.toString()), style: TextStyle(color: textColor, fontSize: 13, fontWeight: FontWeight.w300)),
                               ],
                             ),
                           )
@@ -311,7 +321,7 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
           ) : Container(),
 
           Column(
-            children: List.generate(historyModuleListen.dataMisi().length, (i) {
+            children: List.generate(dataRequest.length, (i) {
               return GestureDetector(
                 child: Container(
                   padding: EdgeInsets.all(16),
@@ -320,31 +330,31 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
                     children: [
                       Row(
                         children: [
-                          imageTiles(imageUrl: historyModuleListen.dataMisi()[i]['_requestImage'] ?? "null"),
+                          imageTiles(imageUrl: dataRequest[i]['_requestImage'] ?? "null"),
                           SizedBox(width: 16),
                           Expanded(
                             child: Column(
                               crossAxisAlignment: CrossAxisAlignment.start,
                               children: [
-                                Text(historyModuleListen.dataMisi()[i][U.langColumn(context, 'requestGroupDescription')]??'', style: TextStyle(color: textColor, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis),
+                                Text(dataRequest[i][U.langColumn(context, 'requestGroupDescription')]??'', style: TextStyle(color: textColor, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis),
                                 SizedBox(height: 6),
-                                Text(historyModuleListen.dataMisi()[i][U.langColumn(context, 'requestSubject')]??'', style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
+                                Text(dataRequest[i][U.langColumn(context, 'requestSubject')]??'', style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
                                 SizedBox(height: 6),
-                                renderRequested(historyModuleListen.dataMisi()[i]),
-                                Text(convertDate(historyModuleListen.dataMisi()[i]['datetimeRequest']??'', context.locale.toString()), style: TextStyle(color: textColor, fontSize: 13, fontWeight: FontWeight.w300)),
+                                renderRequested(dataRequest[i]),
+                                Text(convertDate(dataRequest[i]['datetimeRequest']??'', context.locale.toString()), style: TextStyle(color: textColor, fontSize: 13, fontWeight: FontWeight.w300)),
                               ],
                             ),
                           )
                         ],
                       ),
-                      historyModuleListen.dataMisi()[i]['currentState'] == 'DIMULAI' || historyModuleListen.dataMisi()[i]['_hasForum'] ? Column(
+                      dataRequest[i]['currentState'] == 'DIMULAI' || dataRequest[i]['_hasForum'] ? Column(
                         crossAxisAlignment: CrossAxisAlignment.start,
                         children: [
                           SizedBox(height: 16),
                           divider(),
                         ],
                       ) : Container(),
-                      historyModuleListen.dataMisi()[i]['_activeHoldRequest'] != null ? Container(
+                      dataRequest[i]['_activeHoldRequest'] != null ? Container(
                         width: double.infinity,
                         margin: EdgeInsets.only(top: 16),
                         child: Row(
@@ -354,10 +364,10 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
                               decoration: BoxDecoration(image: DecorationImage(image: AssetImage('assets/image/general/Watch.png'), fit: BoxFit.cover)),
                             ),
                             SizedBox(width: 8),
-                            Expanded(child: Text(historyModuleListen.dataMisi()[i]['_activeHoldRequest']['description'], style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis))
+                            Expanded(child: Text(dataRequest[i]['_activeHoldRequest']['description'], style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis))
                           ],
                         ),
-                      ) : historyModuleListen.dataMisi()[i]['currentState'] == 'DIMULAI' ? Container(
+                      ) : dataRequest[i]['currentState'] == 'DIMULAI' ? Container(
                         width: double.infinity,
                         margin: EdgeInsets.only(top: 16),
                         child: Row(
@@ -370,18 +380,18 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
                                   image: DecorationImage(image: AssetImage('assets/image/general/Avatar.jpg'), fit: BoxFit.cover)),
                             ),
                             SizedBox(width: 8),
-                            Expanded(child: Text(historyModuleListen.dataMisi()[i]['servantNameStart'] + 'isWorking'.tr(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis))
+                            Expanded(child: Text(dataRequest[i]['servantNameStart'] + 'isWorking'.tr(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis))
                           ],
                         ),
                       ) : Container(),
-                      !historyModuleListen.dataMisi()[i]['autoResponse'] && historyModuleListen.dataMisi()[i]['_hasForum'] && historyModuleListen.dataMisi()[i]['_forumMsg'] != null ? Container(
+                      !dataRequest[i]['autoResponse'] && dataRequest[i]['_hasForum'] && dataRequest[i]['_forumMsg'] != null ? Container(
                         width: double.infinity,
                         margin: EdgeInsets.only(top: 16),
                         child: Row(
                           children: [
                             FadeTransition(opacity: _animationController, child: U.iconsax('messages-3', color: primaryColor)),
                             SizedBox(width: 8),
-                            Expanded(child: Text('“${historyModuleListen.dataMisi()[i]['_forumMsg']}”', style: TextStyle(color: textColor.withValues(alpha: 0.75), fontSize: 14, fontStyle: FontStyle.italic), overflow: TextOverflow.ellipsis,))
+                            Expanded(child: Text('“${dataRequest[i]['_forumMsg']}”', style: TextStyle(color: textColor.withValues(alpha: 0.75), fontSize: 14, fontStyle: FontStyle.italic), overflow: TextOverflow.ellipsis,))
                           ],
                         ),
                       )
@@ -398,7 +408,7 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
           ),
           !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
+              : dataRequest.isEmpty && dataPending.isEmpty
               ? NoDataPage()
               : Container(),
         ],
@@ -406,45 +416,15 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
     );
   }
 
-  Widget doneFilter() {
-    final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
-    return Row(
-      children: List.generate(historyFunction.doneList.length, (i) {
-        return GestureDetector(
-          child: Container(
-            margin: EdgeInsets.only(left: 16),
-            padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
-            decoration: BoxDecoration(
-                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.checkSelectedFilter(historyFunction.doneList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
-          ),
-          onTap: () {
-            if (!historyModule.isLoadHistory()) {
-              if (historyModule.checkSelectedFilter(historyFunction.doneList[i]['value'])) {
-                historyModule.setSelectedFilter(0);
-                historyFunction.onRefresh();
-              } else {
-                historyModule.setSelectedFilter(historyFunction.doneList[i]['value']);
-                historyFunction.onRefresh();
-              }
-            } else {
-              UIService.showError("Ngko sek to!");
-            }
-          },
-        );
-      }),
-    );
-  }
+  Widget doneContainer(HistoryModule historyModuleListen, String state) {
+    // final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
+    final dataRequest = historyModuleListen.dataRequests(state: state);
 
-  Widget doneContainer() {
-    final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
     return SingleChildScrollView(
       child: Column(
         children: [
           Column(
-              children: List.generate(historyModuleListen.dataMisi().length, (i) {
+              children: List.generate(dataRequest.length, (i) {
                 return GestureDetector(
                   child: Container(
                     padding: EdgeInsets.all(16),
@@ -456,28 +436,28 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
                         Row(
                           // crossAxisAlignment: CrossAxisAlignment.start,
                           children: [
-                            imageTiles(imageUrl: historyModuleListen.dataMisi()[i]['_requestImage'] ?? "null"),
+                            imageTiles(imageUrl: dataRequest[i]['_requestImage'] ?? "null"),
                             SizedBox(width: 16),
                             Expanded(
                               child: Column(
                                 crossAxisAlignment: CrossAxisAlignment.start,
                                 children: [
-                                  Text(historyModuleListen.dataMisi()[i][U.langColumn(context, 'requestGroupDescription')]??"",
+                                  Text(dataRequest[i][U.langColumn(context, 'requestGroupDescription')]??"",
                                       style: TextStyle(color: textColor, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis),
                                   SizedBox(height: 6),
-                                  Text(historyModuleListen.dataMisi()[i][U.langColumn(context, 'requestSubject')]??"", style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
+                                  Text(dataRequest[i][U.langColumn(context, 'requestSubject')]??"", style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
                                   SizedBox(height: 6),
-                                  renderRequested(historyModuleListen.dataMisi()[i]),
+                                  renderRequested(dataRequest[i]),
                                   Row(
                                     crossAxisAlignment: CrossAxisAlignment.start,
                                     children: [
-                                      Text(convertDate(historyModuleListen.dataMisi()[i]['datetimeRequest'], context.locale.toString()),
+                                      Text(convertDate(dataRequest[i]['datetimeRequest'], context.locale.toString()),
                                           style: TextStyle(color: textColor, fontSize: 13, fontWeight: FontWeight.w300)),
                                       Text(
-                                          ' - ${historyModuleListen.dataMisi()[i]['currentState'] == 'DISELESAIKAN' || historyModuleListen.dataMisi()[i]['currentState'] == 'TUNTAS' ? 'stateFinish'.tr() : 'stateCancel'.tr()}',
+                                          ' - ${dataRequest[i]['currentState'] == 'DISELESAIKAN' || dataRequest[i]['currentState'] == 'TUNTAS' ? 'stateFinish'.tr() : 'stateCancel'.tr()}',
                                           style: TextStyle(
-                                              color: historyModuleListen.dataMisi()[i]['currentState'] == 'DISELESAIKAN' ||
-                                                  historyModuleListen.dataMisi()[i]['currentState'] == 'TUNTAS'
+                                              color: dataRequest[i]['currentState'] == 'DISELESAIKAN' ||
+                                                  dataRequest[i]['currentState'] == 'TUNTAS'
                                                   ? primaryColor
                                                   : Color(0xffD81010),
                                               fontSize: 13,
@@ -495,8 +475,8 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
                         Row(
                           mainAxisAlignment: MainAxisAlignment.spaceBetween,
                           children: [
-                            !historyModuleListen.dataMisi()[i]['autoResponse'] && historyModuleListen.dataMisi()[i]['servantIdentityStart'] != '#system' && (historyModuleListen.dataMisi()[i]['currentState'] == 'TUNTAS' || historyModuleListen.dataMisi()[i]['currentState'] == 'DISELESAIKAN') ? Container(
-                              child: historyFunction.askForRate(Provider.of<HistoryModule>(context, listen: true).dataMisi()[i]) ? GestureDetector(
+                            !dataRequest[i]['autoResponse'] && dataRequest[i]['servantIdentityStart'] != '#system' && (dataRequest[i]['currentState'] == 'TUNTAS' || dataRequest[i]['currentState'] == 'DISELESAIKAN') ? Container(
+                              child: historyFunction.askForRate(dataRequest[i]) ? GestureDetector(
                                 child: Container(
                                   padding: EdgeInsets.symmetric(vertical: 4, horizontal: 16),
                                   decoration: BoxDecoration(
@@ -506,31 +486,31 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
                                   child: Text('rateReq'.tr(), style: TextStyle(color: secondaryColor, fontSize: 14), overflow: TextOverflow.ellipsis),
                                 ),
                                 onTap: () {
-                                  U.newServerVersion(1716279633) ? navigateTo(context, MobHistoryRatingPage(historyModule.dataMisi()[i])).then((tempRating) {
+                                  U.newServerVersion(1716279633) ? navigateTo(context, MobHistoryRatingPage(historyModule.dataRequests()[i])).then((tempRating) {
                                     if(tempRating != null){
                                       historyModule.setSatisfaction(i, tempRating);
                                     }
-                                  }) : rateMission(context, historyModule.dataMisi()[i], i);
+                                  }) : rateMission(context, historyModule.dataRequests()[i], i);
                                 },
-                              ) : !historyFunction.isAutoResponse(historyModuleListen.dataMisi()[i]) ? Row(
+                              ) : !historyFunction.isAutoResponse(dataRequest[i]) ? Row(
                                 children: [
-                                  Image(image: AssetImage(rating[historyModuleListen.dataMisi()[i]['satisfactionRate'] - 1]['image'].toString()), width: 25),
+                                  Image(image: AssetImage(rating[dataRequest[i]['satisfactionRate'] - 1]['image'].toString()), width: 25),
                                   SizedBox(width: 5),
-                                  Text(rating[historyModuleListen.dataMisi()[i]['satisfactionRate'] - 1]['label'].toString(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
+                                  Text(rating[dataRequest[i]['satisfactionRate'] - 1]['label'].toString(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
                                 ],
                               ) : Container(),
-                            ) : message(historyModuleListen.dataMisi()[i]['_hasForum'], historyModuleListen.dataMisi()[i]['_forumMsg'] ?? "null"),
+                            ) : message(dataRequest[i]['_hasForum'], dataRequest[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: () => historyFunction.requestAgainAction(i),
                             )
                           ],
                         ),
-                        (!historyModuleListen.dataMisi()[i]['autoResponse'] && historyModuleListen.dataMisi()[i]['servantIdentityStart'] != '#system' && (historyModuleListen.dataMisi()[i]['currentState'] == 'TUNTAS' || historyModuleListen.dataMisi()[i]['currentState'] == 'DISELESAIKAN')) ? message(historyModuleListen.dataMisi()[i]['_hasForum'], historyModuleListen.dataMisi()[i]['_forumMsg'] ?? "null", top: 16) : Container()
+                        (!dataRequest[i]['autoResponse'] && dataRequest[i]['servantIdentityStart'] != '#system' && (dataRequest[i]['currentState'] == 'TUNTAS' || dataRequest[i]['currentState'] == 'DISELESAIKAN')) ? message(dataRequest[i]['_hasForum'], dataRequest[i]['_forumMsg'] ?? "null", top: 16) : Container()
                       ],
                     ),
                   ),
@@ -546,7 +526,7 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
               })),
           !historyModuleListen.stopLoadHistory() || (historyModuleListen.isLoadHistory() && historyModuleListen.page() > 0)
               ? Container(margin: EdgeInsets.only(top: historyModuleListen.page() > 0 ? 0 : 50), child: loadingTemplateNoVoid())
-              : historyModuleListen.dataMisi().length == 0
+              : dataRequest.isEmpty
               ? NoDataPage()
               : Container(),
         ],
@@ -686,7 +666,3 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
         });
   }
 }
-
-Widget mbuh(context){
-  return Text('data');
-}

+ 1 - 1
lib/src/layouts/web/history_detail.dart

@@ -42,7 +42,7 @@ class _WebHistoryDetailPageState extends State<WebHistoryDetailPage> {
   }
 
   getData() async{
-    var res = await detFunc.getMission(context.locale.toString(), Provider.of<HistoryModule>(context, listen: false).dataMisi()[widget.index]);
+    var res = await detFunc.getMission(context.locale.toString(), Provider.of<HistoryModule>(context, listen: false).dataRequests()[widget.index]);
     setState((){
       user = res['user'];
       list = res['list'];

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

@@ -270,7 +270,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
           ) : Container(),
 
           Column(
-            children: List.generate(historyModuleListen.dataMisi().length, (i) {
+            children: List.generate(historyModuleListen.dataRequests().length, (i) {
               return GestureDetector(
                 child: Container(
                   width: double.infinity,
@@ -281,12 +281,12 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                     children: [
                       Row(
                         children: [
-                          Text(convertDate(historyModuleListen.dataMisi()[i]['datetimeRequest'], context.locale.toString()), style: TextStyle(color: primaryColor, fontSize: 14)),
+                          Text(convertDate(historyModuleListen.dataRequests()[i]['datetimeRequest'], context.locale.toString()), style: TextStyle(color: primaryColor, fontSize: 14)),
                           SizedBox(width: 15),
                           Expanded(
-                            child: Text('${'ticketNumber'.tr()}: ${historyModuleListen.dataMisi()[i]['ticketNo']}', style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
+                            child: Text('${'ticketNumber'.tr()}: ${historyModuleListen.dataRequests()[i]['ticketNo']}', style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
                           ),
-                          historyModuleListen.dataMisi()[i]['currentState'] == 'DIMULAI' ? Row(
+                          historyModuleListen.dataRequests()[i]['currentState'] == 'DIMULAI' ? Row(
                             children: [
                               Container(
                                 width: 25, height: 25,
@@ -296,10 +296,10 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                                 ),
                               ),
                               SizedBox(width: 8),
-                              Text(historyModuleListen.dataMisi()[i]['servantNameStart'] + 'isWorking'.tr(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis)
+                              Text(historyModuleListen.dataRequests()[i]['servantNameStart'] + 'isWorking'.tr(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis)
                             ],
                           ) : Container(),
-                          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))
+                          historyModuleListen.dataRequests()[i]['_activeHoldRequest'] != null?renderStatus('hold'.tr(), Color(0xffD3D3D3)):historyModuleListen.dataRequests()[i]['currentState'] == 'DIMULAI'?renderStatus('onProgress'.tr(), Color(0xffCCA600).withValues(alpha: 0.2)):renderStatus('queued'.tr(), Color(0xff02C539).withValues(alpha: 0.2))
                         ],
                       ),
                       SizedBox(height: 10),
@@ -307,40 +307,40 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                       SizedBox(height: 10),
                       Row(
                         children: [
-                          imageTiles(imageUrl: historyModuleListen.dataMisi()[i]['_requestImage'] ?? "null", width: 150, height: 120),
+                          imageTiles(imageUrl: historyModuleListen.dataRequests()[i]['_requestImage'] ?? "null", width: 150, height: 120),
                           SizedBox(width: 25),
                           Expanded(
                             child: Column(
                               crossAxisAlignment: CrossAxisAlignment.start,
                               children: [
-                                Text(historyModuleListen.dataMisi()[i][U.langColumn(context, 'requestGroupDescription')], style: TextStyle(color: textColor, fontSize: 16), overflow: TextOverflow.ellipsis),
+                                Text(historyModuleListen.dataRequests()[i][U.langColumn(context, 'requestGroupDescription')], style: TextStyle(color: textColor, fontSize: 16), overflow: TextOverflow.ellipsis),
                                 SizedBox(height: 10),
-                                Text(historyModuleListen.dataMisi()[i][U.langColumn(context, 'requestSubject')], style: TextStyle(color: textColor, fontWeight: FontWeight.w600), overflow: TextOverflow.ellipsis),
+                                Text(historyModuleListen.dataRequests()[i][U.langColumn(context, 'requestSubject')], style: TextStyle(color: textColor, fontWeight: FontWeight.w600), overflow: TextOverflow.ellipsis),
                                 SizedBox(height: 5),
-                                Text(historyModuleListen.dataMisi()[i][U.langColumn(context, '_subjectDescription')]??'', style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
+                                Text(historyModuleListen.dataRequests()[i][U.langColumn(context, '_subjectDescription')]??'', style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
                                 dashed(top: 10, bottom: 10),
-                                renderRequested(historyModuleListen.dataMisi()[i]),
+                                renderRequested(historyModuleListen.dataRequests()[i]),
                                 Row(
                                   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                   crossAxisAlignment: CrossAxisAlignment.center ,
                                   children: [
-                                    Text('${'location'.tr()}: ${historyModuleListen.dataMisi()[i]['ipphoneExtLocation']}', style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
-                                    historyModuleListen.dataMisi()[i]['_activeHoldRequest'] != null ? Row(
+                                    Text('${'location'.tr()}: ${historyModuleListen.dataRequests()[i]['ipphoneExtLocation']}', style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
+                                    historyModuleListen.dataRequests()[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))
+                                        Text(historyModuleListen.dataRequests()[i]['_activeHoldRequest']['description'], style: TextStyle(color: textColor, fontSize: 14))
                                       ],
-                                    ) : historyModuleListen.dataMisi()[i]['_hasForum'] && historyModuleListen.dataMisi()[i]['_forumMsg'] != null ? ConstrainedBox(
+                                    ) : historyModuleListen.dataRequests()[i]['_hasForum'] && historyModuleListen.dataRequests()[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('“${historyModuleListen.dataMisi()[i]['_forumMsg']}”', style: TextStyle(color: textColor.withValues(alpha: 0.75), fontSize: 14, fontStyle: FontStyle.italic))
+                                          Text('“${historyModuleListen.dataRequests()[i]['_forumMsg']}”', style: TextStyle(color: textColor.withValues(alpha: 0.75), fontSize: 14, fontStyle: FontStyle.italic))
                                         ],
                                       ),
                                     ) : Container(),
@@ -363,7 +363,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
           ),
           !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
+              : historyModuleListen.dataRequests().isEmpty && historyModuleListen.dataPending().isEmpty
               ? NoDataPage()
               : Container(),
         ],
@@ -407,7 +407,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
       child: Column(
         children: [
           Column(
-              children: List.generate(historyModuleListen.dataMisi().length, (i) {
+              children: List.generate(historyModuleListen.dataRequests().length, (i) {
                 return GestureDetector(
                   child: Container(
                     width: double.infinity,
@@ -418,12 +418,12 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                       children: [
                         Row(
                           children: [
-                            Text(convertDate(historyModuleListen.dataMisi()[i]['datetimeRequest'], context.locale.toString()), style: TextStyle(color: primaryColor, fontSize: 14)),
+                            Text(convertDate(historyModuleListen.dataRequests()[i]['datetimeRequest'], context.locale.toString()), style: TextStyle(color: primaryColor, fontSize: 14)),
                             SizedBox(width: 15),
                             Expanded(
-                              child: Text('${'ticketNumber'.tr()}: ${historyModuleListen.dataMisi()[i]['ticketNo']}', style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
+                              child: Text('${'ticketNumber'.tr()}: ${historyModuleListen.dataRequests()[i]['ticketNo']}', style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
                             ),
-                            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))
+                            historyModuleListen.dataRequests()[i]['currentState'] == 'DISELESAIKAN' || historyModuleListen.dataRequests()[i]['currentState'] == 'TUNTAS' ? renderStatus('stateFinish'.tr(), primaryColor.withValues(alpha: 0.4)) : renderStatus('stateCancel'.tr(), Color(0xffD81010).withValues(alpha: 0.4))
                           ],
                         ),
                         SizedBox(height: 10),
@@ -431,20 +431,20 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                         SizedBox(height: 10),
                         Row(
                           children: [
-                            imageTiles(imageUrl: historyModuleListen.dataMisi()[i]['_requestImage'] ?? "null", width: 150, height: 120),
+                            imageTiles(imageUrl: historyModuleListen.dataRequests()[i]['_requestImage'] ?? "null", width: 150, height: 120),
                             SizedBox(width: 25),
                             Expanded(
                               child: Column(
                                 crossAxisAlignment: CrossAxisAlignment.start,
                                 children: [
-                                  Text(historyModuleListen.dataMisi()[i][U.langColumn(context, 'requestGroupDescription')], style: TextStyle(color: textColor, fontSize: 16), overflow: TextOverflow.ellipsis),
+                                  Text(historyModuleListen.dataRequests()[i][U.langColumn(context, 'requestGroupDescription')], style: TextStyle(color: textColor, fontSize: 16), overflow: TextOverflow.ellipsis),
                                   SizedBox(height: 10),
-                                  Text(historyModuleListen.dataMisi()[i][U.langColumn(context, 'requestSubject')], style: TextStyle(color: textColor, fontWeight: FontWeight.w600), overflow: TextOverflow.ellipsis),
+                                  Text(historyModuleListen.dataRequests()[i][U.langColumn(context, 'requestSubject')], style: TextStyle(color: textColor, fontWeight: FontWeight.w600), overflow: TextOverflow.ellipsis),
                                   SizedBox(height: 5),
-                                  Text(historyModuleListen.dataMisi()[i][U.langColumn(context, '_subjectDescription')]??'', style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
+                                  Text(historyModuleListen.dataRequests()[i][U.langColumn(context, '_subjectDescription')]??'', style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
                                   dashed(top: 10, bottom: 10),
-                                  renderRequested(historyModuleListen.dataMisi()[i]),
-                                  Text('${'location'.tr()}: ${historyModuleListen.dataMisi()[i]['ipphoneExtLocation']}', style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
+                                  renderRequested(historyModuleListen.dataRequests()[i]),
+                                  Text('${'location'.tr()}: ${historyModuleListen.dataRequests()[i]['ipphoneExtLocation']}', style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
                                 ],
                               ),
                             )
@@ -456,24 +456,24 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
                         Row(
                           mainAxisAlignment: MainAxisAlignment.spaceBetween,
                           children: [
-                            !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(
+                            !historyModuleListen.dataRequests()[i]['autoResponse'] && historyModuleListen.dataRequests()[i]['servantIdentityStart'] != '#system' && (historyModuleListen.dataRequests()[i]['currentState'] == 'TUNTAS' || historyModuleListen.dataRequests()[i]['currentState'] == 'DISELESAIKAN') ? Container(
+                              child: hisFunc.askForRate(Provider.of<HistoryModule>(context, listen: true).dataRequests()[i]) ? GestureDetector(
                                 child: Container(
                                   padding: EdgeInsets.symmetric(vertical: 4, horizontal: 16),
                                   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, historyModule.dataMisi()[i], i) : rateMission(context, historyModule.dataMisi()[i], i);
+                                  U.newServerVersion(1716279633) ? rateMissionNew(context, historyModule.dataRequests()[i], i) : rateMission(context, historyModule.dataRequests()[i], i);
                                 },
-                              ) : !hisFunc.isAutoResponse(historyModuleListen.dataMisi()[i]) ? Row(
+                              ) : !hisFunc.isAutoResponse(historyModuleListen.dataRequests()[i]) ? Row(
                                 children: [
-                                  Image(image: AssetImage(rating[historyModuleListen.dataMisi()[i]['satisfactionRate'] - 1]['image'].toString()), width: 25),
+                                  Image(image: AssetImage(rating[historyModuleListen.dataRequests()[i]['satisfactionRate'] - 1]['image'].toString()), width: 25),
                                   SizedBox(width: 5),
-                                  Text(rating[historyModuleListen.dataMisi()[i]['satisfactionRate'] - 1]['label'].toString(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
+                                  Text(rating[historyModuleListen.dataRequests()[i]['satisfactionRate'] - 1]['label'].toString(), style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
                                 ],
                               ) : Container(),
-                            ) : message(historyModuleListen.dataMisi()[i]['_hasForum'], historyModuleListen.dataMisi()[i]['_forumMsg'] ?? "null"),
+                            ) : message(historyModuleListen.dataRequests()[i]['_hasForum'], historyModuleListen.dataRequests()[i]['_forumMsg'] ?? "null"),
                             GestureDetector(
                               child: Container(
                                 padding: EdgeInsets.symmetric(vertical: 4, horizontal: 16),
@@ -500,7 +500,7 @@ class _WebHistoryPageState extends State<WebHistoryPage> with TickerProviderStat
           ),
           !historyModuleListen.stopLoadHistory() || (historyModuleListen.isLoadHistory() && historyModuleListen.page() > 0)
               ? Container(margin: EdgeInsets.only(top: historyModuleListen.page() > 0 ? 0 : 50), child: loadingTemplateNoVoid())
-              : historyModuleListen.dataMisi().isEmpty ? NoDataPage() : Container(),
+              : historyModuleListen.dataRequests().isEmpty ? NoDataPage() : Container(),
         ],
       ),
     );

+ 11 - 0
lib/src/utils/U.dart

@@ -521,6 +521,17 @@ class U {
       ];
   }
 
+  static List<Color> loadingIndicatorColors() {
+      return [
+        Color(0xFF17BC91),
+        Color(0xFF72D3B7),
+        Color(0xFF3FE365),
+        Color(0xFFBAE33F),
+        Color(0xFFE3D53F),
+        Color(0xFFE33F3F)
+      ];
+  }
+
   static Widget iconsax(String name, {Color color = Colors.black, double size = 24}){
     return SvgPicture.asset(
       'assets/iconsax/${name}.svg',

+ 32 - 16
lib/src/utils/provider.dart

@@ -302,29 +302,31 @@ class ServiceModule with ChangeNotifier {
 
 class HistoryModule with ChangeNotifier {
   static int _page = 0;
-  static bool _isLoadHistory = false;
+  static Map<String, bool> _isLoadHistory = {};
   static bool _stopLoadHistory = false;
   static bool _multiSelectMode = false;
   static bool _setLoading = false;
   static List _selectedIndexes = [];
   static List _activeForum = [];
 
-  static List _data = [];
+  static Map<String, List> _data = {};
   static List _pendingData = [];
   static String _selectedFilter = 'none';
+  static String _currentPage = 'ongoing::none';
   static HistoryTab _activeTab = HistoryTab.ongoing;
 
-  List dataMisi() => _data;
+  List dataRequests({String state = ''}) => _data[state != '' ? state : _currentPage]!;
   List dataPending() => _pendingData;
   String selectedFilter() => _selectedFilter;
   HistoryTab activeTab() => _activeTab;
   int page() => _page;
-  bool isLoadHistory() => _isLoadHistory;
+  bool isLoadHistory({String state = ''}) => _isLoadHistory[state != '' ? state : _currentPage]!;
   bool stopLoadHistory() => _stopLoadHistory;
   bool multiSelectMode() => _multiSelectMode;
   bool setLoading() => _setLoading;
   List selectedIndexes() => _selectedIndexes;
   List activeForum() => _activeForum;
+  String currentPage() => _currentPage;
 
   void addSelectedIndexes(i) {
     _selectedIndexes.add(i);
@@ -351,6 +353,11 @@ class HistoryModule with ChangeNotifier {
     notifyListeners();
   }
 
+  void setCurrentPage() {
+    // debugPrint('called to set current page with value: ${_activeTab.name}::$_selectedFilter');
+    _currentPage = '${_activeTab.name}::$_selectedFilter';
+  }
+
   void setPage(value) {
     _page = value;
     notifyListeners();
@@ -361,8 +368,8 @@ class HistoryModule with ChangeNotifier {
     notifyListeners();
   }
 
-  void setLoadHistory(value) {
-    _isLoadHistory = value;
+  void setLoadHistory(bool value, String state) {
+    _isLoadHistory[state] = value;
     notifyListeners();
   }
 
@@ -381,13 +388,22 @@ class HistoryModule with ChangeNotifier {
     notifyListeners();
   }
 
-  void setMisi(list) {
-    _data.addAll(list);
+  void setDataRequests(String keyState, List list) {
+    // debugPrint('set data request => $keyState: ${list.length} data');
+    _data[keyState]!.addAll(list);
     notifyListeners();
   }
 
-  void clearMisi() {
-    _data.clear();
+  void initDataPages(Map<String, List> data){
+    _data = data;
+  }
+
+  void initIsLoadPages(Map<String, bool> data){
+    _isLoadHistory = data;
+  }
+
+  void clearDataRequests() {
+    _data[_currentPage]!.clear();
     notifyListeners();
   }
 
@@ -406,31 +422,31 @@ class HistoryModule with ChangeNotifier {
   }
 
   int getMisiLength(){
-    return _data.length;
+    return _data[_currentPage]!.length;
   }
 
   void setSatisfaction(index, rate) {
-    _data[index]['satisfactionRate'] = rate;
+    _data[_currentPage]![index]['satisfactionRate'] = rate;
     notifyListeners();
   }
 
   void cancelMisi(index) {
-    _data.removeAt(index);
+    _data[_currentPage]!.removeAt(index);
     notifyListeners();
   }
 
   void setForumFalse(index) {
-    _data[index]['_hasForum'] = false;
+    _data[_currentPage]![index]['_hasForum'] = false;
     notifyListeners();
   }
 
   void reset(){
     _page = 0;
-    _isLoadHistory = false;
+    _isLoadHistory = {};
     _stopLoadHistory = false;
     _multiSelectMode = false;
     _setLoading = false;
-    _data = [];
+    _data = {};
     _pendingData = [];
     _selectedFilter = 'none';
     _activeTab = HistoryTab.ongoing;