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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'otp_helper.dart';
|
||||
|
||||
class OtpVerificationAdmin extends StatefulWidget {
|
||||
final String phone;
|
||||
const OtpVerificationAdmin({required this.phone});
|
||||
const OtpVerificationAdmin({super.key, required this.phone});
|
||||
|
||||
@override
|
||||
State<OtpVerificationAdmin> createState() => _OtpVerificationAdminState();
|
||||
|
||||
@@ -37,12 +37,12 @@ class OtpHelper extends GetxController {
|
||||
mySnackbarSuccess('تم إرسال رمز التحقق إلى رقمك عبر WhatsApp');
|
||||
return true;
|
||||
} else {
|
||||
mySnackeBarError('حدث خطأ من الخادم. حاول مجددًا.');
|
||||
mySnackbarError('حدث خطأ من الخادم. حاول مجددًا.');
|
||||
return false;
|
||||
}
|
||||
} catch (e) {
|
||||
Log.print('OTP SEND ERROR: $e');
|
||||
mySnackeBarError('حدث خطأ أثناء الإرسال: $e');
|
||||
mySnackbarError('حدث خطأ أثناء الإرسال: $e');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -68,14 +68,14 @@ class OtpHelper extends GetxController {
|
||||
mySnackbarSuccess('تم التحقق من الرقم بنجاح');
|
||||
await checkAdminLogin();
|
||||
} else {
|
||||
mySnackeBarError(response['message'] ?? 'فشل في التحقق.');
|
||||
mySnackbarError(response['message'] ?? 'فشل في التحقق.');
|
||||
}
|
||||
} else {
|
||||
mySnackeBarError('فشل من الخادم. حاول مرة أخرى.');
|
||||
mySnackbarError('فشل من الخادم. حاول مرة أخرى.');
|
||||
}
|
||||
} catch (e) {
|
||||
Log.print('OTP VERIFY ERROR: $e');
|
||||
mySnackeBarError('خطأ في التحقق: $e');
|
||||
mySnackbarError('خطأ في التحقق: $e');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ class OtpHelper extends GetxController {
|
||||
}
|
||||
} catch (e) {
|
||||
Log.print('LOGIN ERROR: $e');
|
||||
mySnackeBarError('حدث خطأ أثناء تسجيل الدخول: $e');
|
||||
mySnackbarError('حدث خطأ أثناء تسجيل الدخول: $e');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ class OtpHelper extends GetxController {
|
||||
}
|
||||
} catch (e) {
|
||||
Log.print('OTP VERIFY LOGIN ERROR: $e');
|
||||
mySnackeBarError('خطأ في التحقق من الرمز: $e');
|
||||
mySnackbarError('خطأ في التحقق من الرمز: $e');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,8 +161,9 @@ class OtpHelper extends GetxController {
|
||||
await box.write('admin_role', role);
|
||||
Log.print('Admin role saved: $role');
|
||||
}
|
||||
if (data['phone'] != null)
|
||||
if (data['phone'] != null) {
|
||||
await box.write(BoxName.adminPhone, data['phone']);
|
||||
}
|
||||
}
|
||||
|
||||
await box.write(BoxName.phoneVerified, true);
|
||||
@@ -197,7 +198,7 @@ class OtpHelper extends GetxController {
|
||||
Get.back();
|
||||
verifyLoginOtp(phone, otpCode, password, fingerprint);
|
||||
} else {
|
||||
mySnackeBarError('الرجاء إدخال رمز صحيح');
|
||||
mySnackbarError('الرجاء إدخال رمز صحيح');
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@@ -2,7 +2,8 @@ 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/main.dart'; // للوصول لـ box
|
||||
import 'package:siro_admin/main.dart';
|
||||
import 'package:siro_admin/views/widgets/snackbar.dart';
|
||||
|
||||
class AdminRegisterController extends GetxController {
|
||||
final nameCtrl = TextEditingController();
|
||||
@@ -32,20 +33,14 @@ class AdminRegisterController extends GetxController {
|
||||
|
||||
if (response != 'failure') {
|
||||
if (response['status'] == 'pending') {
|
||||
Get.snackbar('نجاح', response['message'] ?? 'تم تقديم الطلب بنجاح',
|
||||
backgroundColor: Colors.green.withOpacity(0.8),
|
||||
colorText: Colors.white);
|
||||
mySnackbarSuccess(response['message'] ?? 'تم تقديم الطلب بنجاح');
|
||||
Future.delayed(const Duration(seconds: 2), () => Get.back());
|
||||
} else {
|
||||
Get.snackbar('خطأ', 'حدث خطأ غير متوقع',
|
||||
backgroundColor: Colors.red.withOpacity(0.8),
|
||||
colorText: Colors.white);
|
||||
mySnackbarError('حدث خطأ غير متوقع');
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
Get.snackbar('خطأ', 'فشل في الاتصال بالخادم',
|
||||
backgroundColor: Colors.red.withOpacity(0.8),
|
||||
colorText: Colors.white);
|
||||
mySnackbarError('فشل في الاتصال بالخادم');
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import 'package:http/http.dart' as http;
|
||||
import '../../../constant/links.dart';
|
||||
import '../../constant/api_key.dart';
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/colors.dart';
|
||||
import '../../main.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class PaymobPayout extends GetxController {
|
||||
@@ -65,13 +65,10 @@ class PaymobPayout extends GetxController {
|
||||
'passengerID': 'admin',
|
||||
'driverID': box.read(BoxName.driverID).toString(),
|
||||
});
|
||||
Get.snackbar('Transaction successful'.tr,
|
||||
'${'Transaction successful'.tr} ${dec['amount']}',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess('${'Transaction successful'.tr} ${dec['amount']}');
|
||||
// Get.find<CaptainWalletController>().getCaptainWalletFromRide();
|
||||
} else if (dec['disbursement_status'] == 'failed') {
|
||||
Get.snackbar('Transaction failed'.tr, 'Transaction failed'.tr,
|
||||
backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('Transaction failed'.tr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +87,7 @@ class PaymobPayout extends GetxController {
|
||||
"bank_code": bankCode, //"CIB",
|
||||
"bank_transaction_type": "cash_transfer"
|
||||
};
|
||||
var res = await http
|
||||
await http
|
||||
.post(
|
||||
Uri.parse('https://payouts.paymobsolutions.com/api/secure/disburse/'),
|
||||
headers: headers,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/links.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class DriverController extends GetxController {
|
||||
@@ -17,7 +18,7 @@ class DriverController extends GetxController {
|
||||
drivers = (res)['message'];
|
||||
update(['drivers']); // تحديث الـ UI
|
||||
} else {
|
||||
Get.snackbar('Error', 'Failed to load drivers');
|
||||
mySnackbarError('Failed to load drivers');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +32,7 @@ class DriverController extends GetxController {
|
||||
driverDetails = (res)['message'];
|
||||
update(['driverDetails']); // تحديث صفحة التفاصيل
|
||||
} else {
|
||||
Get.snackbar('Error', 'Failed to load driver details');
|
||||
mySnackbarError('Failed to load driver details');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import '../functions/crud.dart';
|
||||
|
||||
class Driverthebest extends GetxController {
|
||||
@@ -15,7 +15,7 @@ class Driverthebest extends GetxController {
|
||||
driver = jsonDecode(res)['message'];
|
||||
update();
|
||||
} else {
|
||||
Get.snackbar('error', '', backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('error');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class DriverTheBestGizaController extends GetxController {
|
||||
driver = jsonDecode(res)['message'];
|
||||
update();
|
||||
} else {
|
||||
Get.snackbar('error', '', backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('error');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class DriverTheBestAlexandriaController extends GetxController {
|
||||
driver = jsonDecode(res)['message'];
|
||||
update();
|
||||
} else {
|
||||
Get.snackbar('error', '', backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('error');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ import 'dart:math';
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:siro_admin/constant/colors.dart';
|
||||
import 'package:siro_admin/constant/links.dart';
|
||||
import 'package:siro_admin/controller/functions/crud.dart';
|
||||
import 'package:siro_admin/views/widgets/snackbar.dart';
|
||||
|
||||
class EmployeeController extends GetxController {
|
||||
List employee = [];
|
||||
@@ -19,7 +19,7 @@ class EmployeeController extends GetxController {
|
||||
fetchEmployee() async {
|
||||
var res = await CRUD().get(link: AppLink.getEmployee, payload: {});
|
||||
if (res is String && (res == 'failure' || res == 'token_expired')) {
|
||||
Get.snackbar('error', 'Failed to load employees', backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('Failed to load employees');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class EmployeeController extends GetxController {
|
||||
employee = jsonData['message'];
|
||||
update();
|
||||
} catch (e) {
|
||||
Get.snackbar('error', 'Invalid server response', backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('Invalid server response');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,8 +59,7 @@ class EmployeeController extends GetxController {
|
||||
// You can handle the success case here, such as showing a success message
|
||||
|
||||
Get.back();
|
||||
Get.snackbar('Success', 'Employee added successfully',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess('Employee added successfully');
|
||||
name.clear();
|
||||
education.clear();
|
||||
site.clear();
|
||||
@@ -69,8 +68,7 @@ class EmployeeController extends GetxController {
|
||||
fetchEmployee();
|
||||
} else {
|
||||
// Handle the error case by showing a snackbar with an error message
|
||||
Get.snackbar('Error', 'Failed to add employee',
|
||||
backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('Failed to add employee');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,22 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:secure_string_operations/secure_string_operations.dart';
|
||||
import 'package:siro_admin/constant/info.dart';
|
||||
import 'package:siro_admin/env/env.dart';
|
||||
|
||||
import '../../constant/api_key.dart';
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/char_map.dart';
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import '../../views/widgets/elevated_btn.dart';
|
||||
import '../functions/encrypt_decrypt.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import '../notification_controller.dart';
|
||||
import 'local_notification.dart';
|
||||
import 'notification_service.dart';
|
||||
import 'token_access.dart';
|
||||
|
||||
class FirebaseMessagesController extends GetxController {
|
||||
final fcmToken = FirebaseMessaging.instance;
|
||||
@@ -53,7 +48,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
await messaging.requestPermission();
|
||||
} else if (Platform.isIOS) {
|
||||
// Request permission for iOS
|
||||
NotificationSettings settings = await messaging.requestPermission(
|
||||
await messaging.requestPermission(
|
||||
alert: true,
|
||||
announcement: true,
|
||||
badge: true,
|
||||
@@ -107,7 +102,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
);
|
||||
|
||||
var jsonResponse = jsonDecode(res.body);
|
||||
Log.print('jsonResponse: ${jsonResponse}');
|
||||
Log.print('jsonResponse: $jsonResponse');
|
||||
if (jsonResponse['status'] == 'success') {
|
||||
// var newData = jsonResponse['data'] as List;
|
||||
// Log.print('newData: ${newData}');
|
||||
@@ -185,7 +180,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
// }
|
||||
|
||||
isSendingNotifications = false;
|
||||
Get.snackbar("Success", "All notifications sent!");
|
||||
mySnackbarSuccess("All notifications sent!");
|
||||
}
|
||||
|
||||
bool isSendingNotificationsPassenger = false;
|
||||
@@ -204,7 +199,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
// }
|
||||
|
||||
isSendingNotificationsPassenger = false;
|
||||
Get.snackbar("Success", "All notifications sent!");
|
||||
mySnackbarSuccess("All notifications sent!");
|
||||
}
|
||||
|
||||
Future getAllTokenPassengers() async {
|
||||
@@ -241,9 +236,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
||||
// If the app is in the background or terminated, show a system tray message
|
||||
RemoteNotification? notification = message.notification;
|
||||
AndroidNotification? android = notification?.android;
|
||||
// if (notification != null && android != null) {
|
||||
// if (message.notification != null) {
|
||||
if (message.data.isNotEmpty && message.notification != null) {
|
||||
fireBaseTitles(message);
|
||||
}
|
||||
@@ -267,26 +260,8 @@ class FirebaseMessagesController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
SnackbarController driverAppliedTripSnakBar() {
|
||||
return Get.snackbar(
|
||||
'Driver Applied the Ride for You'.tr,
|
||||
'',
|
||||
colorText: AppColor.greenColor,
|
||||
duration: const Duration(seconds: 3),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
titleText: Text(
|
||||
'Applied'.tr,
|
||||
style: const TextStyle(color: AppColor.redColor),
|
||||
),
|
||||
messageText: Text(
|
||||
'Driver Applied the Ride for You'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
icon: const Icon(Icons.approval),
|
||||
shouldIconPulse: true,
|
||||
margin: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
);
|
||||
void driverAppliedTripSnakBar() {
|
||||
mySnackbarSuccess('Driver Applied the Ride for You'.tr);
|
||||
}
|
||||
|
||||
Future<dynamic> passengerDialog(String message) {
|
||||
|
||||
@@ -14,9 +14,9 @@ import '../../constant/links.dart';
|
||||
import '../../env/env.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import 'device_info.dart';
|
||||
import 'encrypt_decrypt.dart';
|
||||
import 'security_checks.dart';
|
||||
import 'ssl_pinning.dart';
|
||||
|
||||
class CRUD {
|
||||
@@ -36,7 +36,7 @@ class CRUD {
|
||||
'password': AK.passnpassenger,
|
||||
'aud': '${AK.allowed}$dev',
|
||||
};
|
||||
Log.print('payload: ${payload}');
|
||||
Log.print('payload: $payload');
|
||||
var response1 = await _client.post(
|
||||
Uri.parse(AppLink.loginJwtDriver),
|
||||
body: payload,
|
||||
@@ -46,7 +46,7 @@ class CRUD {
|
||||
final decodedResponse1 = jsonDecode(response1.body);
|
||||
|
||||
final jwt = decodedResponse1['jwt'];
|
||||
Log.print('jwt: ${jwt}');
|
||||
Log.print('jwt: $jwt');
|
||||
await box.write(BoxName.jwt, X.c(X.c(X.c(jwt, cn), cC), cs));
|
||||
await storage.write(key: BoxName.jwt, value: X.c(X.c(X.c(jwt, cn), cC), cs));
|
||||
// await AppInitializer().getKey();
|
||||
@@ -334,11 +334,11 @@ class CRUD {
|
||||
Future<dynamic> postWallet(
|
||||
{required String link, Map<String, dynamic>? payload}) async {
|
||||
var s = await getJwtWallet();
|
||||
Log.print('jwt: ${s}');
|
||||
Log.print('jwt: $s');
|
||||
final hmac = box.read(BoxName.hmac);
|
||||
Log.print('hmac: ${hmac}');
|
||||
Log.print('hmac: $hmac');
|
||||
var url = Uri.parse(link);
|
||||
Log.print('url: ${url}');
|
||||
Log.print('url: $url');
|
||||
|
||||
// إضافة الـ HMAC للـ payload لزيادة التوافقية
|
||||
if (payload != null && hmac != null) {
|
||||
@@ -389,9 +389,9 @@ class CRUD {
|
||||
link: AppLink.send_whatsapp_message,
|
||||
payload: {'receiver': to, 'message': message});
|
||||
if (res != 'failure') {
|
||||
Get.snackbar('Success', 'Message sent successfully');
|
||||
mySnackbarSuccess('Message sent successfully');
|
||||
} else {
|
||||
Get.snackbar('Error', 'Failed to send message');
|
||||
mySnackbarError('Failed to send message');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,7 +399,6 @@ class CRUD {
|
||||
required String channelName,
|
||||
required String uid,
|
||||
}) async {
|
||||
var uid = box.read(BoxName.phone) ?? box.read(BoxName.phoneDriver);
|
||||
var res = await _client.get(
|
||||
Uri.parse(
|
||||
'https://repulsive-pig-rugby-shirt.cyclic.app/token?channelName=$channelName'),
|
||||
@@ -450,15 +449,6 @@ class CRUD {
|
||||
}
|
||||
|
||||
Future allMethodForAI(String prompt, driverID, imagePath) async {
|
||||
// await ImageController().choosImage(linkPHP, imagePath);
|
||||
Future.delayed(const Duration(seconds: 2));
|
||||
var extractedString = await arabicTextExtractByVisionAndAI(
|
||||
imagePath: imagePath, driverID: driverID);
|
||||
var json = jsonDecode(extractedString);
|
||||
var textValues = getAllTextValuesWithLineNumbers(json);
|
||||
// List<String> textValues = getAllTextValues(json);
|
||||
|
||||
// await AI().geminiAiExtraction(prompt, textValues);
|
||||
}
|
||||
|
||||
Map<String, List<Map<String, String>>> getAllTextValuesWithLineNumbers(
|
||||
@@ -616,7 +606,7 @@ class CRUD {
|
||||
"receiver": phone
|
||||
});
|
||||
|
||||
var res = await _client.post(
|
||||
await _client.post(
|
||||
Uri.parse(AppLink.sendSms),
|
||||
body: body,
|
||||
headers: headers,
|
||||
|
||||
@@ -12,7 +12,7 @@ import '../../print.dart';
|
||||
class DeviceHelper {
|
||||
static Future<String> getDeviceFingerprint() async {
|
||||
final DeviceInfoPlugin deviceInfoPlugin = DeviceInfoPlugin();
|
||||
var deviceData;
|
||||
Map<String, dynamic> deviceData;
|
||||
|
||||
try {
|
||||
if (Platform.isAndroid) {
|
||||
@@ -58,9 +58,6 @@ class SecurityHelper {
|
||||
bool isNotTrust = false;
|
||||
bool isJailBroken = false;
|
||||
bool isRealDevice = true;
|
||||
bool isOnExternalStorage = false;
|
||||
bool checkForIssues = false;
|
||||
bool isDevMode = false;
|
||||
bool isTampered = false;
|
||||
String bundleId = "";
|
||||
|
||||
@@ -68,15 +65,6 @@ class SecurityHelper {
|
||||
isNotTrust = await JailbreakRootDetection.instance.isNotTrust;
|
||||
isJailBroken = await JailbreakRootDetection.instance.isJailBroken;
|
||||
isRealDevice = await JailbreakRootDetection.instance.isRealDevice;
|
||||
isOnExternalStorage =
|
||||
await JailbreakRootDetection.instance.isOnExternalStorage;
|
||||
|
||||
List<JailbreakIssue> issues =
|
||||
await JailbreakRootDetection.instance.checkForIssues;
|
||||
checkForIssues = issues.isNotEmpty;
|
||||
|
||||
isDevMode = await JailbreakRootDetection.instance.isDevMode;
|
||||
|
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||
bundleId = packageInfo.packageName;
|
||||
if (bundleId.isNotEmpty) {
|
||||
|
||||
@@ -26,8 +26,6 @@ class DigitObscuringFormatter extends TextInputFormatter {
|
||||
TextSelection updateCursorPosition(
|
||||
String maskedText, TextSelection currentSelection) {
|
||||
final cursorPosition = currentSelection.baseOffset;
|
||||
final cursorOffset =
|
||||
currentSelection.extentOffset - currentSelection.baseOffset;
|
||||
final totalDigits = maskedText.length;
|
||||
const visibleDigits = 4;
|
||||
final hiddenDigits = totalDigits - visibleDigits * 2;
|
||||
|
||||
@@ -4,8 +4,6 @@ import 'package:secure_string_operations/secure_string_operations.dart';
|
||||
|
||||
import '../../constant/char_map.dart';
|
||||
import '../../env/env.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
|
||||
class EncryptionHelper {
|
||||
static EncryptionHelper? _instance;
|
||||
|
||||
@@ -10,6 +10,7 @@ import '../../constant/style.dart';
|
||||
import '../../main.dart';
|
||||
import '../../views/widgets/elevated_btn.dart';
|
||||
import '../../views/widgets/my_textField.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import 'crud.dart';
|
||||
|
||||
class LogOutController extends GetxController {
|
||||
@@ -20,12 +21,11 @@ class LogOutController extends GetxController {
|
||||
|
||||
Future deleteMyAccountDriver(String id) async {
|
||||
await CRUD().post(link: AppLink.removeUser, payload: {'id': id}).then(
|
||||
(value) => Get.snackbar('Deleted'.tr, 'Your Account is Deleted',
|
||||
backgroundColor: AppColor.redColor));
|
||||
(value) => mySnackbarWarning('Your Account is Deleted'.tr));
|
||||
}
|
||||
|
||||
checkBeforeDelete() async {
|
||||
var res = await CRUD().post(
|
||||
await CRUD().post(
|
||||
link: AppLink.deletecaptainAccounr,
|
||||
payload: {'id': box.read(BoxName.driverID)}).then((value) => exit(0));
|
||||
}
|
||||
@@ -88,7 +88,7 @@ class LogOutController extends GetxController {
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(AppColor.redColor),
|
||||
backgroundColor: WidgetStateProperty.all(AppColor.redColor),
|
||||
),
|
||||
onPressed: () {
|
||||
// box.remove(BoxName.agreeTerms);
|
||||
@@ -131,7 +131,7 @@ class LogOutController extends GetxController {
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(AppColor.redColor),
|
||||
backgroundColor: WidgetStateProperty.all(AppColor.redColor),
|
||||
),
|
||||
onPressed: () {
|
||||
// box.remove(BoxName.agreeTerms);
|
||||
@@ -172,9 +172,7 @@ class LogOutController extends GetxController {
|
||||
'email': box.read(BoxName.email),
|
||||
});
|
||||
} else {
|
||||
Get.snackbar('Email Wrong'.tr, 'Email you inserted is Wrong.'.tr,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('Email you inserted is Wrong.'.tr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:image_cropper/image_cropper.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:path/path.dart';
|
||||
import 'package:image/image.dart' as img;
|
||||
|
||||
import 'package:path_provider/path_provider.dart' as path_provider;
|
||||
@@ -16,6 +15,7 @@ import '../../constant/colors.dart';
|
||||
import '../../constant/info.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import 'encrypt_decrypt.dart';
|
||||
|
||||
class ImageController extends GetxController {
|
||||
@@ -141,7 +141,7 @@ class ImageController extends GetxController {
|
||||
File compressedImage = await compressImage(processedImage);
|
||||
|
||||
print('link =$link');
|
||||
Log.print('link: ${link}');
|
||||
Log.print('link: $link');
|
||||
|
||||
await uploadImage(
|
||||
compressedImage,
|
||||
@@ -153,8 +153,7 @@ class ImageController extends GetxController {
|
||||
);
|
||||
} catch (e) {
|
||||
print('Error in choosImage: $e');
|
||||
Get.snackbar('Image Upload Failed'.tr, e.toString(),
|
||||
backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('Image Upload Failed'.tr);
|
||||
} finally {
|
||||
isloading = false;
|
||||
update();
|
||||
@@ -229,8 +228,7 @@ class ImageController extends GetxController {
|
||||
link,
|
||||
);
|
||||
} catch (e) {
|
||||
Get.snackbar('Image Upload Failed'.tr, e.toString(),
|
||||
backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('Image Upload Failed'.tr);
|
||||
} finally {
|
||||
isloading = false;
|
||||
update();
|
||||
@@ -243,7 +241,7 @@ class ImageController extends GetxController {
|
||||
'POST',
|
||||
Uri.parse(link),
|
||||
);
|
||||
Log.print('request: ${request}');
|
||||
Log.print('request: $request');
|
||||
var length = await file.length();
|
||||
var stream = http.ByteStream(file.openRead());
|
||||
final headers = {
|
||||
@@ -251,14 +249,8 @@ class ImageController extends GetxController {
|
||||
'Bearer ${r(box.read(BoxName.jwt)).split(AppInformation.addd)[0]}',
|
||||
// 'X-HMAC-Auth': '${box.read(BoxName.hmac)}',
|
||||
};
|
||||
Log.print('headers: ${headers}');
|
||||
Log.print('headers: $headers');
|
||||
|
||||
var multipartFile = http.MultipartFile(
|
||||
'image',
|
||||
stream,
|
||||
length,
|
||||
filename: basename(file.path),
|
||||
);
|
||||
request.headers.addAll(headers);
|
||||
// Set the file name to the driverID
|
||||
|
||||
@@ -278,8 +270,7 @@ class ImageController extends GetxController {
|
||||
if (res.statusCode == 200) {
|
||||
Log.print('jsonDecode(res.body): ${jsonDecode(res.body)}');
|
||||
if (jsonDecode(res.body)['status'] == 'Image uploaded successfully!') {
|
||||
Get.snackbar('Success'.tr, 'Image uploaded successfully!'.tr,
|
||||
backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess('Image uploaded successfully!'.tr);
|
||||
}
|
||||
return jsonDecode(res.body);
|
||||
} else {
|
||||
@@ -330,8 +321,7 @@ class ImageController extends GetxController {
|
||||
link,
|
||||
);
|
||||
} catch (e) {
|
||||
Get.snackbar('Image Upload Failed'.tr, e.toString(),
|
||||
backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('Image Upload Failed'.tr);
|
||||
} finally {
|
||||
isloading = false;
|
||||
update();
|
||||
@@ -346,12 +336,6 @@ class ImageController extends GetxController {
|
||||
|
||||
var length = await file.length();
|
||||
var stream = http.ByteStream(file.openRead());
|
||||
var multipartFile = http.MultipartFile(
|
||||
'image',
|
||||
stream,
|
||||
length,
|
||||
filename: basename(file.path),
|
||||
);
|
||||
request.headers.addAll({
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:siro_admin/constant/colors.dart';
|
||||
|
||||
import '../../constant/links.dart';
|
||||
import '../firebase/firbase_messge.dart';
|
||||
import '../../views/widgets/snackbar.dart';
|
||||
import 'crud.dart';
|
||||
|
||||
class WalletController extends GetxController {
|
||||
@@ -35,11 +34,9 @@ class WalletController extends GetxController {
|
||||
// token, // Access token correctly
|
||||
// 'ding.wav',
|
||||
// );
|
||||
Get.snackbar('success', 'addPaymentToDriver',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess('addPaymentToDriver');
|
||||
} else {
|
||||
Get.snackbar('error', 'addPaymentToDriver',
|
||||
backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('addPaymentToDriver');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,10 +65,9 @@ class WalletController extends GetxController {
|
||||
'phone': phone,
|
||||
});
|
||||
if (res != 'failure') {
|
||||
Get.snackbar('success', 'addDrivergift300',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess('addDrivergift300');
|
||||
} else {
|
||||
Get.snackbar('error', res, backgroundColor: AppColor.redColor);
|
||||
mySnackbarError(res);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,11 +82,9 @@ class WalletController extends GetxController {
|
||||
'driverId': driverID.toString(),
|
||||
});
|
||||
if (res != 'failure') {
|
||||
Get.snackbar('success', 'addSeferWallet',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
mySnackbarSuccess('addSeferWallet');
|
||||
} else {
|
||||
Get.snackbar('error', 'addSeferWallet',
|
||||
backgroundColor: AppColor.redColor);
|
||||
mySnackbarError('addSeferWallet');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../views/widgets/snackbar.dart';
|
||||
import 'firebase/notification_service.dart';
|
||||
|
||||
class NotificationController extends GetxController {
|
||||
@@ -131,13 +132,7 @@ class NotificationController extends GetxController {
|
||||
onPressed: () async {
|
||||
if (titleController.text.trim().isEmpty ||
|
||||
bodyController.text.trim().isEmpty) {
|
||||
Get.snackbar(
|
||||
"تنبيه",
|
||||
"الرجاء تعبئة جميع الحقول",
|
||||
backgroundColor: Colors.amber.withOpacity(0.8),
|
||||
colorText: Colors.white,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
);
|
||||
mySnackbarWarning("الرجاء تعبئة جميع الحقول");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -171,13 +166,7 @@ class NotificationController extends GetxController {
|
||||
/// تنفيذ عملية الإرسال الفعلية
|
||||
Future<void> _processSending(String target) async {
|
||||
// إظهار تنبيه بدء العملية
|
||||
Get.snackbar(
|
||||
"جاري الإرسال",
|
||||
"يتم إرسال الإشعار لـ $target...",
|
||||
backgroundColor: _primaryAccent.withOpacity(0.2),
|
||||
colorText: Colors.white,
|
||||
duration: const Duration(seconds: 2),
|
||||
);
|
||||
mySnackbarInfo("يتم إرسال الإشعار لـ $target...");
|
||||
|
||||
try {
|
||||
// استدعاء خدمة الإرسال
|
||||
@@ -189,19 +178,9 @@ class NotificationController extends GetxController {
|
||||
category: 'fromAdmin',
|
||||
);
|
||||
|
||||
Get.snackbar(
|
||||
"نجاح",
|
||||
"تم إرسال الإشعار بنجاح",
|
||||
backgroundColor: Colors.green.withOpacity(0.5),
|
||||
colorText: Colors.white,
|
||||
);
|
||||
mySnackbarSuccess("تم إرسال الإشعار بنجاح");
|
||||
} catch (e) {
|
||||
Get.snackbar(
|
||||
"خطأ",
|
||||
"فشل إرسال الإشعار: $e",
|
||||
backgroundColor: Colors.red.withOpacity(0.5),
|
||||
colorText: Colors.white,
|
||||
);
|
||||
mySnackbarError("فشل إرسال الإشعار: $e");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'dart:async';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:siro_admin/constant/links.dart';
|
||||
|
||||
import '../../print.dart';
|
||||
|
||||
// --- Models ---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user