المجلدات وأسماء حزم dart واستيراداتها: siro_rider → intaleq_rider siro_driver → intaleq_driver siro_admin → intaleq_admin siro_service → intaleq_service شمل ذلك `name:` في كل pubspec وكل `package:siro_*` في الاستيرادات (115 ملفاً في rider وحده)، وإشارات أسماء المجلدات في docs/ وتعليق في backend/Admin/notifications/broadcast.php. لم تبقَ إشارة واحدة (تحقّقت). + ضُمّت حزم get و get_storage داخل intaleq_driver/packages/ وحُوّلت مساراتها الثلاثة من `../../Intaleq/packages/*` إلى `./packages/*`. كانت تُحل عرضاً إلى مجلد App/Intaleq القديم المجاور — تبعية خارج المستودع تنكسر بأول نقل. لم يبقَ في أي تطبيق تبعية مسار خارج الشجرة. ⚠️ لم تُمسّ بعد: هويات المتاجر (applicationId · PRODUCT_BUNDLE_IDENTIFIER · shorebird app_id) ولا الألوان ولا النصوص المرئية ولا النطاقات — كل منها كوميت منفصل، والهويات تحتاج قرار المالك. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
63 lines
1.6 KiB
Dart
63 lines
1.6 KiB
Dart
import 'dart:async';
|
|
import 'dart:convert';
|
|
import 'package:get/get.dart';
|
|
import 'package:intaleq_admin/constant/links.dart';
|
|
import 'package:intaleq_admin/controller/functions/crud.dart';
|
|
import '../../print.dart';
|
|
|
|
class DashboardV2Controller extends GetxController {
|
|
bool isLoading = true;
|
|
Map<String, dynamic> realtimeData = {};
|
|
List<dynamic> smartAlerts = [];
|
|
Timer? _timer;
|
|
|
|
@override
|
|
void onInit() {
|
|
super.onInit();
|
|
fetchRealtimeData();
|
|
fetchSmartAlerts();
|
|
// Auto refresh every 2 minutes
|
|
_timer = Timer.periodic(const Duration(minutes: 2), (timer) {
|
|
fetchRealtimeData();
|
|
fetchSmartAlerts();
|
|
});
|
|
}
|
|
|
|
@override
|
|
void onClose() {
|
|
_timer?.cancel();
|
|
super.onClose();
|
|
}
|
|
|
|
Future<void> fetchRealtimeData() async {
|
|
try {
|
|
var res = await CRUD().get(link: AppLink.realtimeDashboardV2, payload: {});
|
|
if (res != 'failure' && res != null) {
|
|
var d = res is String ? jsonDecode(res) : res;
|
|
if (d['status'] == 'success') {
|
|
realtimeData = d['message'];
|
|
isLoading = false;
|
|
update();
|
|
}
|
|
}
|
|
} catch (e) {
|
|
Log.print('Error fetching realtime dashboard: $e');
|
|
}
|
|
}
|
|
|
|
Future<void> fetchSmartAlerts() async {
|
|
try {
|
|
var res = await CRUD().get(link: AppLink.smartAlertsV2, payload: {});
|
|
if (res != 'failure' && res != null) {
|
|
var d = res is String ? jsonDecode(res) : res;
|
|
if (d['status'] == 'success') {
|
|
smartAlerts = d['message'];
|
|
update();
|
|
}
|
|
}
|
|
} catch (e) {
|
|
Log.print('Error fetching smart alerts: $e');
|
|
}
|
|
}
|
|
}
|