Fixes & Updates - 2026-06-01: Integrate Back-End v3 updates, fix call/connection issues across apps
This commit is contained in:
@@ -6,7 +6,21 @@ import '../functions/crud.dart';
|
||||
class ComplaintController extends GetxController {
|
||||
var complaintList = [].obs;
|
||||
var isLoading = false.obs;
|
||||
var showOnlyDelayed = false.obs;
|
||||
final CRUD _crud = CRUD();
|
||||
|
||||
List<dynamic> get delayedComplaints {
|
||||
final weekAgo = DateTime.now().subtract(const Duration(days: 7));
|
||||
return complaintList.where((c) {
|
||||
if (c['statusComplaint'] == 'Resolved') return false;
|
||||
try {
|
||||
final date = DateTime.parse(c['date_filed']);
|
||||
return date.isBefore(weekAgo);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}).toList();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
|
||||
@@ -6,10 +6,8 @@ import 'package:sefer_admin1/constant/links.dart';
|
||||
import 'package:sefer_admin1/controller/functions/crud.dart';
|
||||
import 'package:sefer_admin1/controller/auth/otp_helper.dart';
|
||||
|
||||
import '../../constant/api_key.dart';
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
|
||||
class DashboardController extends GetxController {
|
||||
bool isLoading = false;
|
||||
@@ -38,7 +36,6 @@ class DashboardController extends GetxController {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (res != 'failure' && res != null) {
|
||||
try {
|
||||
var d = res is String ? jsonDecode(res) : res;
|
||||
|
||||
@@ -16,8 +16,8 @@ class DashboardV2Controller extends GetxController {
|
||||
super.onInit();
|
||||
fetchRealtimeData();
|
||||
fetchSmartAlerts();
|
||||
// Auto refresh every 30 seconds
|
||||
_timer = Timer.periodic(const Duration(seconds: 30), (timer) {
|
||||
// Auto refresh every 2 minutes
|
||||
_timer = Timer.periodic(const Duration(minutes: 2), (timer) {
|
||||
fetchRealtimeData();
|
||||
fetchSmartAlerts();
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ import '../../print.dart';
|
||||
|
||||
class FinancialV2Controller extends GetxController {
|
||||
bool isLoading = true;
|
||||
|
||||
|
||||
Map<String, dynamic> stats = {};
|
||||
List<dynamic> settlements = [];
|
||||
|
||||
@@ -19,19 +19,20 @@ class FinancialV2Controller extends GetxController {
|
||||
Future<void> fetchAllFinancials() async {
|
||||
isLoading = true;
|
||||
update();
|
||||
|
||||
|
||||
await Future.wait([
|
||||
fetchStats(),
|
||||
fetchSettlements(),
|
||||
]);
|
||||
|
||||
|
||||
isLoading = false;
|
||||
update();
|
||||
}
|
||||
|
||||
Future<void> fetchStats() async {
|
||||
try {
|
||||
var res = await CRUD().get(link: AppLink.financialStatsV2, payload: {});
|
||||
var res =
|
||||
await CRUD().getWallet(link: AppLink.financialStatsV2, payload: {});
|
||||
if (res != 'failure' && res != null) {
|
||||
var d = res is String ? jsonDecode(res) : res;
|
||||
if (d['status'] == 'success') {
|
||||
@@ -45,7 +46,8 @@ class FinancialV2Controller extends GetxController {
|
||||
|
||||
Future<void> fetchSettlements() async {
|
||||
try {
|
||||
var res = await CRUD().get(link: AppLink.settlementsV2, payload: {});
|
||||
var res =
|
||||
await CRUD().getWallet(link: AppLink.settlementsV2, payload: {});
|
||||
if (res != 'failure' && res != null) {
|
||||
var d = res is String ? jsonDecode(res) : res;
|
||||
if (d['status'] == 'success') {
|
||||
|
||||
Reference in New Issue
Block a user