Update: 2026-06-26 17:29:23
This commit is contained in:
@@ -4,8 +4,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class CaptainAdminController extends GetxController {
|
||||
@@ -60,8 +60,7 @@ class CaptainAdminController extends GetxController {
|
||||
captainData = d;
|
||||
} else {
|
||||
captainData = {};
|
||||
Get.snackbar('Error', 'No captain found with this phone number',
|
||||
backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('No captain found with this phone number');
|
||||
}
|
||||
|
||||
isLoading = false;
|
||||
@@ -102,17 +101,16 @@ class CaptainAdminController extends GetxController {
|
||||
if (didAuthenticate) {
|
||||
// User authenticated successfully, proceed with payment
|
||||
await addCaptainPrizeToWallet();
|
||||
Get.snackbar('Prize Added', '', backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess('Prize Added');
|
||||
} else {
|
||||
// Authentication failed, handle accordingly
|
||||
Get.snackbar('Authentication failed', '',
|
||||
backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('Authentication failed');
|
||||
// 'Authentication failed');
|
||||
}
|
||||
} else {
|
||||
// Local authentication not available, proceed with payment without authentication
|
||||
await addCaptainPrizeToWallet();
|
||||
Get.snackbar('Prize Added', '', backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess('Prize Added');
|
||||
}
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'package:get/get.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class ComplaintController extends GetxController {
|
||||
@@ -41,7 +42,7 @@ class ComplaintController extends GetxController {
|
||||
complaintList.clear();
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar("خطأ", "فشل جلب الشكاوى: $e");
|
||||
mySnackbarError("فشل جلب الشكاوى: $e");
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
@@ -61,7 +62,7 @@ class ComplaintController extends GetxController {
|
||||
}
|
||||
return false;
|
||||
} catch (e) {
|
||||
Get.snackbar("خطأ", "فشل تحديث الشكوى: $e");
|
||||
mySnackbarError("فشل تحديث الشكوى: $e");
|
||||
return false;
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'package:get/get.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class DriverDocsController extends GetxController {
|
||||
@@ -49,7 +50,7 @@ class DriverDocsController extends GetxController {
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar("خطأ", "فشل جلب السائقين: $e");
|
||||
mySnackbarError("فشل جلب السائقين: $e");
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
isMoreLoading.value = false;
|
||||
@@ -70,7 +71,7 @@ class DriverDocsController extends GetxController {
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar("خطأ", "فشل جلب تفاصيل السائق: $e");
|
||||
mySnackbarError("فشل جلب تفاصيل السائق: $e");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -88,7 +89,7 @@ class DriverDocsController extends GetxController {
|
||||
}
|
||||
return false;
|
||||
} catch (e) {
|
||||
Get.snackbar("خطأ", "فشل اعتماد السائق: $e");
|
||||
mySnackbarError("فشل اعتماد السائق: $e");
|
||||
return false;
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
|
||||
@@ -1,34 +1,51 @@
|
||||
import 'dart:convert';
|
||||
import 'package:get/get.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class KazanController extends GetxController {
|
||||
var kazanData = {}.obs;
|
||||
var isLoading = false.obs;
|
||||
var selectedCountry = 'Syria'.obs;
|
||||
final CRUD _crud = CRUD();
|
||||
|
||||
final List<Map<String, String>> countries = [
|
||||
{'code': 'syria', 'name': 'سوريا', 'flag': '🇸🇾'},
|
||||
{'code': 'jordan', 'name': 'الأردن', 'flag': '🇯🇴'},
|
||||
{'code': 'egypt', 'name': 'مصر', 'flag': '🇪🇬'},
|
||||
];
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
getKazan();
|
||||
}
|
||||
|
||||
void setCountry(String countryName) {
|
||||
selectedCountry.value = countryName;
|
||||
getKazan();
|
||||
}
|
||||
|
||||
Future<void> getKazan() async {
|
||||
isLoading.value = true;
|
||||
try {
|
||||
var response = await _crud.get(link: "${AppLink.getKazanPercent}?country=syria");
|
||||
final countryParam = selectedCountry.value.toLowerCase();
|
||||
var response = await _crud.get(link: "${AppLink.getKazanPercent}?country=$countryParam");
|
||||
if (response != null && response != 'failure' && response != 'token_expired') {
|
||||
var decoded = response is String ? jsonDecode(response) : response;
|
||||
if (decoded['status'] == "success") {
|
||||
var message = decoded['message'];
|
||||
if (message is List && message.isNotEmpty) {
|
||||
kazanData.value = message[0];
|
||||
kazanData.value = Map<String, dynamic>.from(message[0]);
|
||||
kazanData['country'] = selectedCountry.value;
|
||||
} else {
|
||||
kazanData.value = {'country': selectedCountry.value};
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar("خطأ", "فشل جلب بيانات التسعير: $e");
|
||||
mySnackbarError('فشل جلب بيانات التسعير: $e');
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
@@ -37,8 +54,9 @@ class KazanController extends GetxController {
|
||||
Future<bool> updateKazan(Map<String, dynamic> data) async {
|
||||
isLoading.value = true;
|
||||
try {
|
||||
data['country'] = selectedCountry.value;
|
||||
final String link = data.containsKey('id') ? AppLink.updateKazanPercent : AppLink.addKazanPercent;
|
||||
|
||||
|
||||
Map<String, String> payload = {};
|
||||
data.forEach((key, value) {
|
||||
payload[key] = value.toString();
|
||||
@@ -51,7 +69,7 @@ class KazanController extends GetxController {
|
||||
}
|
||||
return false;
|
||||
} catch (e) {
|
||||
Get.snackbar("خطأ", "فشل تحديث التسعير: $e");
|
||||
mySnackbarError('فشل تحديث التسعير: $e');
|
||||
return false;
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:get/get.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class MarketingController extends GetxController {
|
||||
@@ -38,22 +39,14 @@ class MarketingController extends GetxController {
|
||||
void toggleAutopilot(bool value) {
|
||||
isAutopilotEnabled = value;
|
||||
update();
|
||||
Get.snackbar(
|
||||
"Autopilot Updated".tr,
|
||||
value ? "Full Autopilot mode enabled".tr : "Approval Mode enabled".tr,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
mySnackbarInfo(value ? "Full Autopilot mode enabled".tr : "Approval Mode enabled".tr);
|
||||
}
|
||||
|
||||
// --- System Prompt Configuration Saver ---
|
||||
void savePrompt(String newPrompt) {
|
||||
systemPrompt = newPrompt;
|
||||
update();
|
||||
Get.snackbar(
|
||||
"Configuration Saved".tr,
|
||||
"Gemini system instructions updated successfully".tr,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
mySnackbarSuccess("Gemini system instructions updated successfully".tr);
|
||||
}
|
||||
|
||||
Future<void> fetchAnomalies() async {
|
||||
@@ -72,10 +65,10 @@ class MarketingController extends GetxController {
|
||||
if (res is Map && res['status'] == 'success') {
|
||||
priceAnomalies = res['message'] ?? [];
|
||||
} else {
|
||||
Get.snackbar("Error", "Failed to fetch price anomalies");
|
||||
mySnackbarError("Failed to fetch price anomalies");
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar("Error", "Network error while loading anomalies");
|
||||
mySnackbarError("Network error while loading anomalies");
|
||||
} finally {
|
||||
isLoading = false;
|
||||
update();
|
||||
@@ -123,10 +116,10 @@ class MarketingController extends GetxController {
|
||||
if (res is Map && res['status'] == 'success') {
|
||||
campaignsLog = res['message'] ?? [];
|
||||
} else {
|
||||
Get.snackbar("Error", "Failed to fetch campaign logs");
|
||||
mySnackbarError("Failed to fetch campaign logs");
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar("Error", "Network error while loading campaign logs");
|
||||
mySnackbarError("Network error while loading campaign logs");
|
||||
} finally {
|
||||
isLoading = false;
|
||||
update();
|
||||
@@ -175,17 +168,17 @@ class MarketingController extends GetxController {
|
||||
);
|
||||
if (res is Map) {
|
||||
if (res['status'] == 'success') {
|
||||
Get.snackbar("Success", "AI campaign triggered successfully! Promos sent.");
|
||||
mySnackbarSuccess("AI campaign triggered successfully! Promos sent.");
|
||||
fetchCampaignsLog();
|
||||
fetchTelemetry();
|
||||
} else {
|
||||
Get.snackbar("Campaign Alert", res['message'] ?? "Campaign rate limited.");
|
||||
mySnackbarWarning(res['message'] ?? "Campaign rate limited.");
|
||||
}
|
||||
} else {
|
||||
Get.snackbar("Error", "Failed to trigger AI campaign");
|
||||
mySnackbarError("Failed to trigger AI campaign");
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar("Error", "Network error while triggering campaign");
|
||||
mySnackbarError("Network error while triggering campaign");
|
||||
} finally {
|
||||
isLoading = false;
|
||||
update();
|
||||
@@ -224,10 +217,10 @@ class MarketingController extends GetxController {
|
||||
simulatorRecommendationMessage = data['recommendation_message'];
|
||||
}
|
||||
} else {
|
||||
Get.snackbar("Simulation Error", res['message'] ?? "Failed to run simulation");
|
||||
mySnackbarError(res['message'] ?? "Failed to run simulation");
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar("Error", "Network error during simulation");
|
||||
mySnackbarError("Network error during simulation");
|
||||
} finally {
|
||||
isLoading = false;
|
||||
update();
|
||||
@@ -340,9 +333,4 @@ class MarketingController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
// Initially fetch these too if needed, but fetch them specifically when country changes
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class PassengerAdminController extends GetxController {
|
||||
@@ -90,9 +90,7 @@ class PassengerAdminController extends GetxController {
|
||||
final ok = (d['status'] == 'success');
|
||||
if (ok) {
|
||||
// (اختياري) حدّث الكاش/الواجهة — مثلاً أعد الجلب
|
||||
Get.snackbar('Update successful',
|
||||
d['message']?.toString() ?? 'Passenger updated successfully',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess(d['message']?.toString() ?? 'Passenger updated successfully');
|
||||
// await getPassengerCount(); // أو حدّث passengersData محليًا إذا متاح
|
||||
} else {
|
||||
// (اختياري) أظهر رسالة خطأ
|
||||
@@ -120,17 +118,16 @@ class PassengerAdminController extends GetxController {
|
||||
if (didAuthenticate) {
|
||||
// User authenticated successfully, proceed with payment
|
||||
await addPassengerPrizeToWallet();
|
||||
Get.snackbar('Prize Added', '', backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess('Prize Added');
|
||||
} else {
|
||||
// Authentication failed, handle accordingly
|
||||
Get.snackbar('Authentication failed', '',
|
||||
backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('Authentication failed');
|
||||
// 'Authentication failed');
|
||||
}
|
||||
} else {
|
||||
// Local authentication not available, proceed with payment without authentication
|
||||
await addPassengerPrizeToWallet();
|
||||
Get.snackbar('Prize Added', '', backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess('Prize Added');
|
||||
}
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'package:get/get.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class PromoController extends GetxController {
|
||||
@@ -27,7 +28,7 @@ class PromoController extends GetxController {
|
||||
promoList.clear();
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar("خطأ", "فشل جلب أكواد الخصم: $e");
|
||||
mySnackbarError("فشل جلب أكواد الخصم: $e");
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
@@ -43,7 +44,7 @@ class PromoController extends GetxController {
|
||||
}
|
||||
return false;
|
||||
} catch (e) {
|
||||
Get.snackbar("خطأ", "فشل إضافة كود الخصم: $e");
|
||||
mySnackbarError("فشل إضافة كود الخصم: $e");
|
||||
return false;
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
@@ -59,7 +60,7 @@ class PromoController extends GetxController {
|
||||
}
|
||||
return false;
|
||||
} catch (e) {
|
||||
Get.snackbar("خطأ", "فشل حذف كود الخصم: $e");
|
||||
mySnackbarError("فشل حذف كود الخصم: $e");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -74,7 +75,7 @@ class PromoController extends GetxController {
|
||||
}
|
||||
return false;
|
||||
} catch (e) {
|
||||
Get.snackbar("خطأ", "فشل تحديث كود الخصم: $e");
|
||||
mySnackbarError("فشل تحديث كود الخصم: $e");
|
||||
return false;
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class QualityController extends GetxController {
|
||||
@@ -21,10 +21,10 @@ class QualityController extends GetxController {
|
||||
driversBlacklist = res['message']['drivers'] ?? [];
|
||||
passengersBlacklist = res['message']['passengers'] ?? [];
|
||||
} else {
|
||||
Get.snackbar("Error", "Failed to fetch blacklist");
|
||||
mySnackbarError("Failed to fetch blacklist");
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar("Error", "Network error");
|
||||
mySnackbarError("Network error");
|
||||
} finally {
|
||||
isLoading = false;
|
||||
update();
|
||||
@@ -41,13 +41,13 @@ class QualityController extends GetxController {
|
||||
},
|
||||
);
|
||||
if (res is Map && res['status'] == 'success') {
|
||||
Get.snackbar("Success", "Driver unblocked successfully");
|
||||
mySnackbarSuccess("Driver unblocked successfully");
|
||||
fetchBlacklist(); // Refresh
|
||||
} else {
|
||||
Get.snackbar("Error", res['message'] ?? "Failed to unblock driver");
|
||||
mySnackbarError(res['message'] ?? "Failed to unblock driver");
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar("Error", "Network error");
|
||||
mySnackbarError("Network error");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@ class QualityController extends GetxController {
|
||||
},
|
||||
);
|
||||
if (res is Map && res['status'] == 'success') {
|
||||
Get.snackbar("Success", "Passenger unblocked successfully");
|
||||
mySnackbarSuccess("Passenger unblocked successfully");
|
||||
fetchBlacklist(); // Refresh
|
||||
} else {
|
||||
Get.snackbar("Error", res['message'] ?? "Failed to unblock passenger");
|
||||
mySnackbarError(res['message'] ?? "Failed to unblock passenger");
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar("Error", "Network error");
|
||||
mySnackbarError("Network error");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,11 +82,11 @@ class QualityController extends GetxController {
|
||||
if (res is Map && res['status'] == 'success') {
|
||||
scorecardData = res['message'];
|
||||
} else {
|
||||
Get.snackbar("Error", "Failed to fetch scorecard");
|
||||
mySnackbarError("Failed to fetch scorecard");
|
||||
scorecardData = {};
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar("Error", "Network error");
|
||||
mySnackbarError("Network error");
|
||||
scorecardData = {};
|
||||
} finally {
|
||||
isLoading = false;
|
||||
@@ -94,9 +94,4 @@ class QualityController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
// fetchBlacklist() can be called when opening the page
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:ffi';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../constant/api_key.dart';
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/info.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../main.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class RegisterCaptainController extends GetxController {
|
||||
@@ -102,7 +101,7 @@ class RegisterCaptainController extends GetxController {
|
||||
driverNotCompleteRegistration = d;
|
||||
update();
|
||||
} else {
|
||||
Get.snackbar(res, '');
|
||||
mySnackbarError(res);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,9 +278,7 @@ class RegisterCaptainController extends GetxController {
|
||||
await addRegistrationCarEgypt();
|
||||
|
||||
if (isCarSaved && isDriverSaved) {
|
||||
Get.snackbar('added', '',
|
||||
backgroundColor:
|
||||
AppColor.greenColor); // Get.offAll(() => HomeCaptain());
|
||||
mySnackbarSuccess('added'); // Get.offAll(() => HomeCaptain());
|
||||
// Get.offAll(() => HomeCaptain());
|
||||
}
|
||||
}
|
||||
@@ -348,11 +345,9 @@ class RegisterCaptainController extends GetxController {
|
||||
// Handle response
|
||||
if (status1['status'] == 'success') {
|
||||
isDriverSaved = true;
|
||||
Get.snackbar('Success', 'Driver data saved successfully',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess('Driver data saved successfully');
|
||||
} else {
|
||||
Get.snackbar('Error', 'Failed to save driver data',
|
||||
backgroundColor: Colors.red);
|
||||
mySnackbarError('Failed to save driver data');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,7 +358,7 @@ class RegisterCaptainController extends GetxController {
|
||||
"InspectionResult": responseCriminalRecordEgypt['InspectionResult'],
|
||||
});
|
||||
if (res != 'failure') {
|
||||
Get.snackbar('uploaded sucssefuly'.tr, '');
|
||||
mySnackbarSuccess('uploaded sucssefuly'.tr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,8 +389,7 @@ class RegisterCaptainController extends GetxController {
|
||||
var status = jsonDecode(res);
|
||||
if (status['status'] == 'success') {
|
||||
isCarSaved = true;
|
||||
Get.snackbar('Success', 'message',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess('message');
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
@@ -557,7 +551,6 @@ class RegisterCaptainController extends GetxController {
|
||||
var responseData = jsonDecode(response.body);
|
||||
// Process the responseData as needed
|
||||
|
||||
var result = responseData['candidates'][0]['content']['parts'][0]['text'];
|
||||
RegExp regex = RegExp(r"```json([^`]*)```");
|
||||
String? jsonString =
|
||||
regex.firstMatch(responseData.toString())?.group(1)?.trim();
|
||||
@@ -580,8 +573,7 @@ class RegisterCaptainController extends GetxController {
|
||||
|
||||
update();
|
||||
} else {
|
||||
Get.snackbar('Error', "JSON string not found",
|
||||
backgroundColor: AppColor.redColor);
|
||||
mySnackbarError("JSON string not found");
|
||||
}
|
||||
|
||||
// Rest of your code...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:siro_admin/constant/links.dart';
|
||||
import 'package:siro_admin/controller/functions/crud.dart';
|
||||
import 'package:siro_admin/views/widgets/snackbar.dart';
|
||||
import '../../print.dart';
|
||||
|
||||
class SecurityV2Controller extends GetxController {
|
||||
@@ -26,9 +26,7 @@ class SecurityV2Controller extends GetxController {
|
||||
|
||||
if (res == 'failure' || res == 'token_expired') {
|
||||
Log.print('CRUD returned: $res');
|
||||
Get.snackbar("خطأ بالاتصال", "السيرفر أرجع: $res",
|
||||
backgroundColor: const Color(0x88FF0000),
|
||||
colorText: const Color(0xFFFFFFFF));
|
||||
mySnackbarError("السيرفر أرجع: $res");
|
||||
auditLogs = [];
|
||||
} else if (res != null) {
|
||||
var d = res is String ? jsonDecode(res) : res;
|
||||
@@ -44,16 +42,12 @@ class SecurityV2Controller extends GetxController {
|
||||
}
|
||||
} else {
|
||||
Log.print('Status not success: ${d['status']}');
|
||||
Get.snackbar("خطأ من السيرفر", "${d['message'] ?? d['status']}",
|
||||
backgroundColor: const Color(0x88FF0000),
|
||||
colorText: const Color(0xFFFFFFFF));
|
||||
mySnackbarError("${d['message'] ?? d['status']}");
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
Log.print('Error fetching audit logs: $e');
|
||||
Get.snackbar("خطأ برمجي", "$e",
|
||||
backgroundColor: const Color(0x88FF0000),
|
||||
colorText: const Color(0xFFFFFFFF));
|
||||
mySnackbarError("$e");
|
||||
}
|
||||
|
||||
isLoading = false;
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../functions/crud.dart';
|
||||
import '../functions/device_info.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
|
||||
class StaffController extends GetxController {
|
||||
@@ -53,10 +52,10 @@ class StaffController extends GetxController {
|
||||
_clearFields();
|
||||
Get.back();
|
||||
} else {
|
||||
mySnackeBarError('فشل في إضافة الموظف. يرجى المحاولة لاحقاً');
|
||||
mySnackbarError('فشل في إضافة الموظف. يرجى المحاولة لاحقاً');
|
||||
}
|
||||
} catch (e) {
|
||||
mySnackeBarError('حدث خطأ: $e');
|
||||
mySnackbarError('حدث خطأ: $e');
|
||||
} finally {
|
||||
isLoading = false;
|
||||
update();
|
||||
|
||||
@@ -303,10 +303,11 @@ class StaticController extends GetxController {
|
||||
totalMonthlyPassengers = data[0]['totalMonthly'].toString();
|
||||
}
|
||||
final spots = _generateSpots(data, 'day', 'totalPassengers', start, end);
|
||||
if (isCompare)
|
||||
if (isCompare) {
|
||||
chartDataPassengersCompare = spots;
|
||||
else
|
||||
} else {
|
||||
chartDataPassengers = spots;
|
||||
}
|
||||
}
|
||||
|
||||
// ─── Rides ────────────────────────────────────────────────
|
||||
@@ -322,10 +323,11 @@ class StaticController extends GetxController {
|
||||
totalMonthlyRides = data[0]['totalMonthly'].toString();
|
||||
}
|
||||
final spots = _generateSpots(data, 'day', 'totalRides', start, end);
|
||||
if (isCompare)
|
||||
if (isCompare) {
|
||||
chartDataRidesCompare = spots;
|
||||
else
|
||||
} else {
|
||||
chartDataRides = spots;
|
||||
}
|
||||
}
|
||||
|
||||
// ─── Drivers ──────────────────────────────────────────────
|
||||
|
||||
@@ -7,7 +7,6 @@ import '../../constant/api_key.dart';
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class WalletAdminController extends GetxController {
|
||||
@@ -46,7 +45,7 @@ class WalletAdminController extends GetxController {
|
||||
driversWalletPoints[i]['email'].toString(),
|
||||
);
|
||||
await Future.delayed(const Duration(seconds: 3));
|
||||
} on FormatException catch (e) {
|
||||
} on FormatException {
|
||||
// Handle the error or rethrow the exception as needed
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user