19
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sefer_admin1/controller/functions/crud.dart';
|
||||
import 'package:sefer_admin1/controller/functions/wallet.dart'; // تأكد من المسار
|
||||
import 'package:sefer_admin1/controller/functions/wallet.dart';
|
||||
|
||||
import '../../../constant/links.dart'; // تأكد من المسار
|
||||
|
||||
// --- Controller: المسؤول عن المنطق (البحث، الفحص، الإضافة) ---
|
||||
class DriverGiftCheckerController extends GetxController {
|
||||
@@ -25,8 +27,7 @@ class DriverGiftCheckerController extends GetxController {
|
||||
Future<void> fetchDriverCache() async {
|
||||
try {
|
||||
final response = await CRUD().post(
|
||||
link:
|
||||
'https://api.intaleq.xyz/intaleq/Admin/driver/getDriverGiftPayment.php',
|
||||
link: '${AppLink.server}/Admin/driver/getDriverGiftPayment.php',
|
||||
payload: {'phone': phoneController.text.trim()},
|
||||
);
|
||||
// print('response: ${response}');
|
||||
@@ -55,7 +56,17 @@ class DriverGiftCheckerController extends GetxController {
|
||||
try {
|
||||
// الخطوة 1: استخراج الـ ID بناءً على رقم الهاتف
|
||||
var driver = driversCache.firstWhere(
|
||||
(d) => d['phone'].toString().contains(phoneInput),
|
||||
(d) {
|
||||
String dbPhone =
|
||||
d['phone'].toString().replaceAll(RegExp(r'[^0-9]'), '');
|
||||
String inputPhone = phoneInput.replaceAll(RegExp(r'[^0-9]'), '');
|
||||
// قارن آخر 9 أرقام لتجاوز مشكلة 09 مقابل 963
|
||||
if (dbPhone.length >= 9 && inputPhone.length >= 9) {
|
||||
return dbPhone.substring(dbPhone.length - 9) ==
|
||||
inputPhone.substring(inputPhone.length - 9);
|
||||
}
|
||||
return dbPhone == inputPhone;
|
||||
},
|
||||
orElse: () => null,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user