Update: 2026-06-26 17:29:23
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user